Re: [PATCH v1 05/17] xen/riscv: implement virtual APLIC MMIO emulation

Jan Beulich <[email protected]>
Newsgroups org.xenproject.lists.xen-devel
Message-ID <[email protected]>
On 12.08.2026 13:51, Oleksii Kurochko wrote:
> On 8/12/26 11:10 AM, Jan Beulich wrote:
>> On 07.08.2026 18:08, Oleksii Kurochko wrote:
>>> On 8/6/26 4:28 PM, Jan Beulich wrote:
>>>> On 20.07.2026 18:02, Oleksii Kurochko wrote:
>>>>> +/*
>>>>> + * Convert a byte offset (within a SETIP/CLRIP/SETIE/CLRIE register group) to
>>>>> + * a 32-bit word index into the allocated_irqs bitmap.  Each word covers 32
>>>>> + * interrupt sources.  For SOURCECFG and TARGET groups the same division also
>>>>> + * yields the interrupt number directly, because those arrays store one 32-bit
>>>>> + * register per source.
>>>>> + */
>>>>> +#define regoffset_to_word_idx(reg_val) ((reg_val) / sizeof(uint32_t))
>>>>> +
>>>>> +static inline uint32_t generate_auth_mask(const struct domain *d,
>>>>> +                                          unsigned int word_idx)
>>>>> +{
>>>>> +    unsigned int first_bit = word_idx * sizeof(uint32_t) * BITS_PER_BYTE;
>>>>> +
>>>>> +    if ( word_idx >= DIV_ROUND_UP(d->arch.vintc->nr_virqs,
>>>>> +                                  sizeof(uint32_t) * BITS_PER_BYTE) )
>>>>> +    {
>>>>> +        dprintk(XENLOG_DEBUG, "incorrect word_idx(%u) is passed\n", word_idx);
>>>>
>>>> Is this really meant to stay?
>>>
>>> For debug purpose it could be useful, so I prefer to have it with
>>> changing it to gprintk(XENLOG_DEBUG, ...) to understand which domain is
>>> trying to access something wrong.
>>
>> gdprintk() implies you're on the vCPU that's the subject of the operation.
>> If that's always the case here, the function parameter wants to reflect
>> that as far as possible: "currd" instead of "d".
> 
> I will use currd. Then it also makes sense to add ASSERT(v == current) 
> in vaplic_emulate_{store,load}().

ASSERT(curr == current), that is.

Jan
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.