qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Igor Mammedov <imammedo@redhat.com>
To: Eric Ren <renzhengeek@gmail.com>
Cc: marcel@redhat.com, "Daniel P. Berrangé" <berrange@redhat.com>,
	qemu-devel@nongnu.org
Subject: Re: Is it possible to support hotplug device to PXB bridge?
Date: Fri, 22 Apr 2022 13:51:01 +0200	[thread overview]
Message-ID: <20220422135101.65796823@redhat.com> (raw)
In-Reply-To: <CAKM4AeydH7gAmZtR432uYw2jNqdokyJY4qpVvc+KN12bxtBggg@mail.gmail.com>

On Fri, 22 Apr 2022 17:33:08 +0800
Eric Ren <renzhengeek@gmail.com> wrote:

> Hi Igor, Daniel:
> 
> Thanks for the hints!
> 
> In the PXB doc (https://github.com/qemu/qemu/blob/master/docs/pci_expander_bridge.txt),
> PXB device internally adds a pci bridge, according to the impl brief:
> 
> ```
> The PXB is composed by:
> ...
> - PCIBridgeDev(TYPE_PCI_BRIDGE_DEV)
> Created automatically as part of init sequence.
> When adding a device to PXB it is attached to the bridge for two reasons:
> - Using the bridge will **enable hotplug support**
> - All the devices behind the bridge will use bridge's IO/MEM windows compacting
> the PCI address space.
> ```
> 
> A PXB device already takes 2 bus nr: 1 for the added root bus via host
> bridge, 1 for the pci bridge.
> If statically adding 1 more pci bridge, it takes 1 more pci bus...
> 
> Anyway, will try to figure out the reason why the doc says "Using the
> bridge will enable hotplug support",
> but in fact not :-)
> 
> The start point seemingly is, to generate correct ACPI SSDT table
> having hotplug devices/methods for slots behind the PXB
> internal pci bridge.
It doesn't look like a trivial thing to impl.

The easiest approach is what Daniel has suggested (provided guest
OS supports SHPC):

 -device pxb,id=bridge1,bus=pci.0,bus_nr=1 \
 -device pci-bridge,id=hpbridge,bus=bridge1,chassis_nr=1,shpc=on

then you can hotplug devices on hpbridge

Alternatively allow shpc on builtin pxb bridge, by adding a property
that could turn it on, as it's explicitly disabled at the moment:

  pxb_dev_realize_common():
     qdev_prop_set_bit(bds, PCI_BRIDGE_DEV_PROP_SHPC, false);

 
> Regards,
> Eric Ren
> 
> On Fri, 22 Apr 2022 at 16:57, Igor Mammedov <imammedo@redhat.com> wrote:
> >
> > On Fri, 22 Apr 2022 09:29:20 +0100
> > Daniel P. Berrangé <berrange@redhat.com> wrote:
> >  
> > > On Fri, Apr 22, 2022 at 03:17:11PM +0800, Eric Ren wrote:  
> > > > Hi Marcel and all,
> > > >
> > > > It fails when I want to hotplug device to PXB bus. Then, I find this
> > > > commit that explicitely declares the fact that PXB bus does not support
> > > > hotplug device onto it.
> > > >
> > > > 7b346c742cd9 ("hw/pxb: declare pxb devices as not hot-pluggable")
> > > >
> > > > Could you please help confirm the possibility to make PXB bus hotpluggable,
> > > > and the main work to achieve it if possible?  
> > >
> > > Instead of trying to hotplug into the PXB, attach a 'pci-bridge' to the
> > > PXB and then you can hotplug into the latter instead.  
> >
> > there is no ACPI based hotplug for devices on pxb if I'm not mistaken, so
> > you'll likely need to enable shpc on pci-bridge.
> >  
> > > > Yes, pxb-pcie with Q35 do support hotplug, but we use i440 machine a long way,
> > > > not  willing to change machine type to have it.  
> > >
> > > With regards,
> > > Daniel  
> >  
> 
> 



      reply	other threads:[~2022-04-22 12:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-22  7:17 Is it possible to support hotplug device to PXB bridge? Eric Ren
2022-04-22  8:29 ` Daniel P. Berrangé
2022-04-22  8:57   ` Igor Mammedov
2022-04-22  9:33     ` Eric Ren
2022-04-22 11:51       ` Igor Mammedov [this message]

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=20220422135101.65796823@redhat.com \
    --to=imammedo@redhat.com \
    --cc=berrange@redhat.com \
    --cc=marcel@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=renzhengeek@gmail.com \
    /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).