qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 05/25] spapr: introduce a spapr_irq_set() helper


From: Cédric Le Goater
Subject: Re: [Qemu-devel] [PATCH 05/25] spapr: introduce a spapr_irq_set() helper
Date: Fri, 24 Nov 2017 09:32:37 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0

On 11/24/2017 04:16 AM, David Gibson wrote:
> On Thu, Nov 23, 2017 at 02:29:35PM +0100, Cédric Le Goater wrote:
>> It will make synchronisation easier with the XIVE interrupt mode when
>> available. The 'irq' parameter refers to the global IRQ number space.
>>
>> Signed-off-by: Cédric Le Goater <address@hidden>
> 
> s/spapr_irq_set/spapr_irq_set_lsi/
> 
> otherwise the name doesn't tell you what it sets.

That is when it gets confusing. This routine does two things :

 - it allocates the IRQ number 
 - it sets the type of the allocated IRQ number, LSI or MSI. 

because both information are held under the same flag : 

  ics->irqs[srcno].flags

But the main purpose of this routine is to do the allocation, 
so that is why I changed the name. 

Now that you have the explanations and that you rather still 
have the prefix '_lsi', please tell me. In any case, I will add
a comment on what the routine is doing.

Thanks,

C.    
 
 
> With that change,
> 
> Reviewed-by: David Gibson <address@hidden>
> 
>> ---
>>  hw/ppc/spapr.c | 11 ++++++++---
>>  1 file changed, 8 insertions(+), 3 deletions(-)
>>
>> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
>> index 7ae84d40bdb4..79f38a9ff4e1 100644
>> --- a/hw/ppc/spapr.c
>> +++ b/hw/ppc/spapr.c
>> @@ -3594,6 +3594,11 @@ static int ics_find_free_block(ICSState *ics, int 
>> num, int alignnum)
>>      return -1;
>>  }
>>  
>> +static void spapr_irq_set(sPAPRMachineState *spapr, int irq, bool lsi)
>> +{
>> +    ics_set_irq_type(spapr->ics, irq - spapr->ics->offset, lsi);
>> +}
>> +
>>  int spapr_irq_alloc(sPAPRMachineState *spapr, int irq_hint, bool lsi,
>>                      Error **errp)
>>  {
>> @@ -3618,7 +3623,7 @@ int spapr_irq_alloc(sPAPRMachineState *spapr, int 
>> irq_hint, bool lsi,
>>          irq += ics->offset;
>>      }
>>  
>> -    ics_set_irq_type(ics, irq - ics->offset, lsi);
>> +    spapr_irq_set(spapr, irq, lsi);
>>      trace_spapr_irq_alloc(irq);
>>  
>>      return irq;
>> @@ -3657,10 +3662,10 @@ int spapr_irq_alloc_block(sPAPRMachineState *spapr, 
>> int num, bool lsi,
>>          return -1;
>>      }
>>  
>> +    first += ics->offset;
>>      for (i = first; i < first + num; ++i) {
>> -        ics_set_irq_type(ics, i, lsi);
>> +        spapr_irq_set(spapr, i, lsi);
>>      }
>> -    first += ics->offset;
>>  
>>      trace_spapr_irq_alloc_block(first, num, lsi, align);
>>  
> 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]