qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Harsh Prateek Bora <harshpb@linux.ibm.com>
To: "Cédric Le Goater" <clg@kaod.org>,
	npiggin@gmail.com, qemu-ppc@nongnu.org
Cc: danielhb413@gmail.com, david@gibson.dropbear.id.au,
	qemu-devel@nongnu.org
Subject: Re: [PATCH v3 1/2] ppc/spapr: Introduce SPAPR_IRQ_NR_IPIS to refer IRQ range for CPU IPIs.
Date: Thu, 23 Nov 2023 15:01:47 +0530	[thread overview]
Message-ID: <3030ea29-3611-bd4f-cfd5-b34e4cf6b800@linux.ibm.com> (raw)
In-Reply-To: <1523c986-7022-4b3f-8e26-b25d8621c623@kaod.org>



On 11/23/23 14:20, Cédric Le Goater wrote:
> On 11/23/23 06:57, Harsh Prateek Bora wrote:
>> spapr_irq_init currently uses existing macro SPAPR_XIRQ_BASE to refer to
>> the range of CPU IPIs during initialization of nr-irqs property.
>> It is more appropriate to have its own define which can be further
>> reused as appropriate for correct interpretation.
>>
>> Signed-off-by: Harsh Prateek Bora <harshpb@linux.ibm.com>
>> Suggested-by: Cedric Le Goater <clg@kaod.org>
> 
> One comment below
> 
> Reviewed-by: Cédric Le Goater <clg@kaod.org>
> 

Thanks, responding below ..

>> ---
>>   include/hw/ppc/spapr_irq.h | 14 +++++++++++++-
>>   hw/ppc/spapr_irq.c         |  6 ++++--
>>   2 files changed, 17 insertions(+), 3 deletions(-)
>>
>> diff --git a/include/hw/ppc/spapr_irq.h b/include/hw/ppc/spapr_irq.h
>> index c22a72c9e2..4fd2d5853d 100644
>> --- a/include/hw/ppc/spapr_irq.h
>> +++ b/include/hw/ppc/spapr_irq.h
>> @@ -14,9 +14,21 @@
>>   #include "qom/object.h"
>>   /*
>> - * IRQ range offsets per device type
>> + * The XIVE IRQ backend uses the same layout as the XICS backend but
>> + * covers the full range of the IRQ number space. The IRQ numbers for
>> + * the CPU IPIs are allocated at the bottom of this space, below 4K,
>> + * to preserve compatibility with XICS which does not use that range.
>> + */
>> +
>> +/*
>> + * CPU IPI range (XIVE only)
>>    */
>>   #define SPAPR_IRQ_IPI        0x0
>> +#define SPAPR_IRQ_NR_IPIS    0x1000
>> +
>> +/*
>> + * IRQ range offsets per device type
>> + */
>>   #define SPAPR_XIRQ_BASE      XICS_IRQ_BASE /* 0x1000 */
>>   #define SPAPR_IRQ_EPOW       (SPAPR_XIRQ_BASE + 0x0000)
>> diff --git a/hw/ppc/spapr_irq.c b/hw/ppc/spapr_irq.c
>> index a0d1e1298e..97b2fc42ab 100644
>> --- a/hw/ppc/spapr_irq.c
>> +++ b/hw/ppc/spapr_irq.c
>> @@ -23,6 +23,8 @@
>>   #include "trace.h"
>> +QEMU_BUILD_BUG_ON(SPAPR_IRQ_NR_IPIS > SPAPR_XIRQ_BASE);
>> +
> 
> I would have put the check in include/hw/ppc/spapr_irq.h but since
> SPAPR_XIRQ_BASE is only used in hw/ppc/spapr_irq.c which is always
> compiled, this is fine. You might want to change that in case a
> respin is asked for.
> 

I had initially tried keeping it in spapr_irq.h , but that would give a 
build break for XICS_IRQ_BASE not defined since that gets defined in 
spapr_xics.h and is included later in some files, however, the 
QEMU_BUILD_BUG_ON expects it to be defined before it reaches here.

regards,
Harsh

> Thanks,
> 
> C.
> 
> 
>>   static const TypeInfo spapr_intc_info = {
>>       .name = TYPE_SPAPR_INTC,
>>       .parent = TYPE_INTERFACE,
>> @@ -329,7 +331,7 @@ void spapr_irq_init(SpaprMachineState *spapr, 
>> Error **errp)
>>           int i;
>>           dev = qdev_new(TYPE_SPAPR_XIVE);
>> -        qdev_prop_set_uint32(dev, "nr-irqs", smc->nr_xirqs + 
>> SPAPR_XIRQ_BASE);
>> +        qdev_prop_set_uint32(dev, "nr-irqs", smc->nr_xirqs + 
>> SPAPR_IRQ_NR_IPIS);
>>           /*
>>            * 8 XIVE END structures per CPU. One for each available
>>            * priority
>> @@ -356,7 +358,7 @@ void spapr_irq_init(SpaprMachineState *spapr, 
>> Error **errp)
>>       }
>>       spapr->qirqs = qemu_allocate_irqs(spapr_set_irq, spapr,
>> -                                      smc->nr_xirqs + SPAPR_XIRQ_BASE);
>> +                                      smc->nr_xirqs + 
>> SPAPR_IRQ_NR_IPIS);
>>       /*
>>        * Mostly we don't actually need this until reset, except that not
> 


  reply	other threads:[~2023-11-23  9:32 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-23  5:57 [PATCH v3 0/2] Introduce SPAPR_IRQ_NR_IPIS and fix max-cpus Harsh Prateek Bora
2023-11-23  5:57 ` [PATCH v3 1/2] ppc/spapr: Introduce SPAPR_IRQ_NR_IPIS to refer IRQ range for CPU IPIs Harsh Prateek Bora
2023-11-23  8:50   ` Cédric Le Goater
2023-11-23  9:31     ` Harsh Prateek Bora [this message]
2023-11-23 14:12       ` Cédric Le Goater
2023-11-24  8:01         ` Harsh Prateek Bora
2023-11-24  8:09           ` Cédric Le Goater
2024-01-03 12:05             ` Kowshik Jois B S
2023-11-23  5:57 ` [PATCH v3 2/2] ppc/spapr: Initialize max_cpus limit to SPAPR_IRQ_NR_IPIS Harsh Prateek Bora
2023-11-23  8:51   ` Cédric Le Goater
2024-01-03 12:23     ` Kowshik Jois B S

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3030ea29-3611-bd4f-cfd5-b34e4cf6b800@linux.ibm.com \
    --to=harshpb@linux.ibm.com \
    --cc=clg@kaod.org \
    --cc=danielhb413@gmail.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=npiggin@gmail.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).