All of lore.kernel.org
 help / color / mirror / Atom feed
From: Miles Glenn <milesg@linux.ibm.com>
To: "Cédric Le Goater" <clg@redhat.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, gautam@linux.ibm.com,
	kowal@linux.ibm.com
Subject: Re: Access to remote XIVE2 units (was Re: [PATCH v9 0/7] Power11 support for QEMU [PowerNV])
Date: Mon, 11 Aug 2025 10:17:06 -0500	[thread overview]
Message-ID: <145a086f73ac33d11bbeb51157de3f14a6982f2b.camel@linux.ibm.com> (raw)
In-Reply-To: <04eb08b6-b787-47f3-86b7-b2d3a0f50ed6@redhat.com>

+ Mike Kowal

On Sun, 2025-08-10 at 14:46 +0200, 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").
> 
> 
> Thanks,
> 
> C.
> 
> 
> 
> 
> 
> 
> 



  reply	other threads:[~2025-08-11 15:19 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 [this message]
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
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=145a086f73ac33d11bbeb51157de3f14a6982f2b.camel@linux.ibm.com \
    --to=milesg@linux.ibm.com \
    --cc=adityag@linux.ibm.com \
    --cc=clg@redhat.com \
    --cc=gautam@linux.ibm.com \
    --cc=harshpb@linux.ibm.com \
    --cc=kowal@linux.ibm.com \
    --cc=maddy@linux.ibm.com \
    --cc=mahesh@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.