qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Cédric Le Goater" <clg@redhat.com>
To: Ganesh G R <ganeshgr@linux.ibm.com>,
	Aditya Gupta <adityag@linux.ibm.com>
Cc: Nicholas Piggin <npiggin@gmail.com>,
	Harsh Prateek Bora <harshpb@linux.ibm.com>,
	Mahesh J Salgaonkar <mahesh@linux.ibm.com>,
	Madhavan Srinivasan <maddy@linux.ibm.com>,
	qemu-devel@nongnu.org, qemu-ppc@nongnu.org,
	Glenn Miles <milesg@linux.ibm.com>,
	gautam@linux.ibm.com
Subject: Re: Access to remote XIVE2 units (was Re: [PATCH v9 0/7] Power11 support for QEMU [PowerNV])
Date: Thu, 25 Sep 2025 08:38:44 +0200	[thread overview]
Message-ID: <900db31c-54d5-410d-934e-347ca0b22ec2@redhat.com> (raw)
In-Reply-To: <f22953e3-5e87-4c86-844a-aba5c35ca3ca@linux.ibm.com>

On 9/24/25 14:14, Ganesh G R wrote:
> 
> On 8/29/25 3:19 AM, Cédric Le Goater wrote:
>> On 8/28/25 14:04, Aditya Gupta wrote:
>>> + Ganesh
>>>
>>> On 25/08/10 02:46PM, Cédric Le Goater wrote:
>>>> + Glenn
>>>> + Gautam
>>>>
>>>> On 8/10/25 12:45, Aditya Gupta wrote:
>>>>> On 25/08/10 12:26PM, Aditya Gupta wrote:
>>>>>>> <...snip...>
>>>>>>
>>>>>> About the error, seems xive2 always expecting powernv10 chip, I will
>>>>>> have to rethink how should I use the same xive2 for powernv11.
>>>>>>
>>>>>
>>>>> There's a type cast to Pnv10Chip in 'pnv_xive2_get_remote'.
>>>>> The cast is only temporarily used to get the 'PnvXive2' object in the
>>>>> Pnv10Chip.
>>>>> It's the only place in hw/intc/pnv_xive2.c assuming Pnv10Chip object.
>>>>>
>>>>> Thinking to have a helper function to just return the 'PnvXive2' object
>>>>> inside the chip, given a 'PnvChip'.
>>>>>
>>>>> Or the below change where we are adding another pointer in PnvChipClass:
>>>>>
>>>>>       diff --git a/hw/intc/pnv_xive2.c b/hw/intc/pnv_xive2.c
>>>>>       index e019cad5c14c..9832be5fd297 100644
>>>>>       --- a/hw/intc/pnv_xive2.c
>>>>>       +++ b/hw/intc/pnv_xive2.c
>>>>>       @@ -110,8 +110,8 @@ static PnvXive2 *pnv_xive2_get_remote(uint32_t vsd_type, hwaddr fwd_addr)
>>>>>            int i;
>>>>>            for (i = 0; i < pnv->num_chips; i++) {
>>>>>       -        Pnv10Chip *chip10 = PNV10_CHIP(pnv->chips[i]);
>>>>>       -        PnvXive2 *xive = &chip10->xive;
>>>>>       +        PnvChipClass *k = PNV_CHIP_GET_CLASS(pnv->chips[i]);
>>>>>       +        PnvXive2 *xive = k->intc_get(pnv->chips[i]);
>>>>>                /*
>>>>>                 * Is this the XIVE matching the forwarded VSD address is for this
>>>>>
>>>>> Which one do you suggest ? Or should I look for another way ?
>>>>>
>>>>> I am preferring the first way to have a helper, but both ways look hacky.
>>>>
>>>> Any call to qdev_get_machine() in device model is at best
>>>> a modeling shortcut, most likely it is a hack :
>>>>
>>>>    /*
>>>>     * Remote access to INT controllers. HW uses MMIOs(?). For now, a simple
>>>>     * scan of all the chips INT controller is good enough.
>>>>     */
>>>>
>>>> So all these calls are suspicious :
>>>>
>>>>    $ git grep qdev_get_machine hw/*/*pnv*
>>>>    hw/intc/pnv_xive2.c:    PnvMachineState *pnv = PNV_MACHINE(qdev_get_machine());
>>>>    hw/pci-host/pnv_phb.c:    PnvMachineState *pnv = PNV_MACHINE(qdev_get_machine());
>>>>    hw/pci-host/pnv_phb3.c:    PnvMachineState *pnv = PNV_MACHINE(qdev_get_machine());
>>>>    hw/ppc/pnv.c:    PnvMachineState *pnv = PNV_MACHINE(qdev_get_machine());
>>>>    hw/ppc/pnv.c:    PnvMachineState *pnv = PNV_MACHINE(qdev_get_machine());
>>>>    hw/ppc/pnv_chiptod.c:    PnvMachineState *pnv = PNV_MACHINE(qdev_get_machine());
>>>>    hw/ppc/pnv_chiptod.c:    PnvMachineState *pnv = PNV_MACHINE(qdev_get_machine());
>>>>    hw/ppc/pnv_lpc.c:    PnvMachineState *pnv = PNV_MACHINE(qdev_get_machine());
>>>>
>>>> In the particular case of XIVE2, the solution is to rework
>>>> pnv_xive2_get_remote() like it was for P9. See b68147b7a5bf
>>>> ("ppc/xive: Add support for the PC MMIOs").
>>>>
>>>
>>> Hi Cedric,
>>>
>>> While I am working with XIVE engineers to get the pnv_xive2_get_remote()
>>> reworked as suggested (since it's a bit more work due to multiple cases
>>> of indirect/direct vst, nvg/nvc types in case of XIVE2), I would like
>>> to propose below patch to have as an interim solution to unblock
>>> the PowerNV11 support patches.
>>
>> pHyp is an unknown FW implementation for opensource. Until an image
>> is released somewhere (please think about it), QEMU has nothing to
>> worry about other than supporting OPAL.
>>
>> For now, let's forget about the grouping aspect of XIVE2, simply
>> rework pnv_xive2_get_remote() as it was done in b68147b7a5bf for
>> XIVE. This shouldn't take long. And, for the nvg/nvc types, report
>> an error of some sort and add a TODO in the code.
>>
> A similar change cannot be done to XIVE2, because Fredric’s commit (96a2132ce95) has introduced modifications to the NVPG and NVC MMIO callbacks in order to support backlog counter operations.

Thanks for looking.

Indeed. So I guess Aditya's proposal adding a new PnvChipClass handler
is then the best alternative :

@@ -170,6 +170,7 @@ struct PnvChipClass {
      void (*intc_reset)(PnvChip *chip, PowerPCCPU *cpu);
      void (*intc_destroy)(PnvChip *chip, PowerPCCPU *cpu);
      void (*intc_print_info)(PnvChip *chip, PowerPCCPU *cpu, GString *buf);
+    void* (*intc_get)(PnvChip *chip);
      ISABus *(*isa_create)(PnvChip *chip, Error **errp);
      void (*dt_populate)(PnvChip *chip, void *fdt);
      void (*pic_print_info)(PnvChip *chip, GString *buf);

Aditya,

Could you please resend the whole powernv11 series including this
new patch for xive2 ?

Thanks,

C.





  reply	other threads:[~2025-09-25  6:39 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-08 11:59 [PATCH v9 0/7] Power11 support for QEMU [PowerNV] Aditya Gupta
2025-08-08 11:59 ` [PATCH v9 1/7] ppc/pnv: Introduce Pnv11Chip Aditya Gupta
2025-08-08 11:59 ` [PATCH v9 2/7] ppc/pnv: Introduce Power11 PowerNV machine Aditya Gupta
2025-08-08 11:59 ` [PATCH v9 3/7] ppc/pnv: Add XIVE2 controller to Power11 Aditya Gupta
2025-08-08 11:59 ` [PATCH v9 4/7] ppc/pnv: Add PHB5 PCIe Host bridge " Aditya Gupta
2025-08-08 11:59 ` [PATCH v9 5/7] ppc/pnv: Add ChipTOD model for Power11 Aditya Gupta
2025-08-08 11:59 ` [PATCH v9 6/7] tests/powernv: Switch to buildroot images instead of op-build Aditya Gupta
2025-08-08 11:59 ` [PATCH v9 7/7] tests/powernv: Add PowerNV test for Power11 Aditya Gupta
2025-08-08 12:32 ` [PATCH v9 0/7] Power11 support for QEMU [PowerNV] Cédric Le Goater
2025-08-10  6:56   ` Aditya Gupta
2025-08-10 10:45     ` Aditya Gupta
2025-08-10 12:46       ` Access to remote XIVE2 units (was Re: [PATCH v9 0/7] Power11 support for QEMU [PowerNV]) Cédric Le Goater
2025-08-11 15:17         ` Miles Glenn
2025-08-20  6:40         ` Aditya Gupta
2025-08-28 12:04         ` Aditya Gupta
2025-08-28 21:49           ` Cédric Le Goater
2025-09-24 12:14             ` Ganesh G R
2025-09-25  6:38               ` Cédric Le Goater [this message]
2025-09-25 12:51                 ` Aditya Gupta
2025-08-11 12:16     ` [PATCH v9 0/7] Power11 support for QEMU [PowerNV] Cédric Le Goater

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=900db31c-54d5-410d-934e-347ca0b22ec2@redhat.com \
    --to=clg@redhat.com \
    --cc=adityag@linux.ibm.com \
    --cc=ganeshgr@linux.ibm.com \
    --cc=gautam@linux.ibm.com \
    --cc=harshpb@linux.ibm.com \
    --cc=maddy@linux.ibm.com \
    --cc=mahesh@linux.ibm.com \
    --cc=milesg@linux.ibm.com \
    --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).