Re: [PATCH v7 11/20] xen/riscv: introduce per-vCPU IMSIC state

Jan Beulich <[email protected]>
Newsgroups org.xenproject.lists.xen-devel
Message-ID <[email protected]>
On 13.08.2026 17:39, Oleksii Kurochko wrote:
> On 8/4/26 5:48 PM, Oleksii Kurochko wrote:
>> @@ -312,6 +318,35 @@ static int imsic_parse_node(const struct dt_device_node *node,
>>       return 0;
>>   }
>>   
>> +int vcpu_imsic_init(struct vcpu *v)
>> +{
>> +    struct vimsic_state *imsic_state;
>> +
>> +    /* Allocate IMSIC context */
>> +    imsic_state = xvzalloc(struct vimsic_state);
>> +    if ( !imsic_state )
>> +        return -ENOMEM;
>> +
>> +    /* Setup IMSIC context  */
>> +    rwlock_init(&imsic_state->vsfile_lock);
>> +
>> +    /*
>> +     * xvzalloc() already cleared the context, so guest_file_id == 0, i.e. the
>> +     * always-available s/w IMSIC VS-file. Only vsfile_pcpu needs an explicit
>> +     * initializer as its s/w VS-file value is NR_CPUS rather than 0.
>> +     */
>> +    imsic_state->vsfile_pcpu = NR_CPUS;
>> +
> Considering our conversation in another patch series vsfile_cpu would be 
> better name. Don't you mind if I will change vsfile_pcpu -> vsfile_cpu 
> and everywhere it is needed in this patch with saving of your Acked-by?

Such a rename won't invalidate my ack. What's important is that (here and/or
elsewhere) you make sure you only ever store CPU numbers there, not - like
you had it somewhere - hart IDs.

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.