[PATCH v3 3/5] conf: introduce acpi-hotplug-bridge and acpi-root-hotplug pm options

Ani Sinha ani at anisinha.ca
Tue Sep 28 11:10:19 UTC 2021



On Tue, 28 Sep 2021, Daniel P. Berrangé wrote:

> On Tue, Sep 28, 2021 at 03:28:04PM +0530, Ani Sinha wrote:
> >
> >
> > On Tue, 28 Sep 2021, Daniel P. Berrangé wrote:
> >
> > > On Tue, Sep 28, 2021 at 02:35:47PM +0530, Ani Sinha wrote:
> > > >
> > > >
> > > > On Tue, 28 Sep 2021, Daniel P. Berrangé wrote:
> > > >
> > > > > On Sun, Sep 12, 2021 at 08:56:29AM +0530, Ani Sinha wrote:
> > > > > > This change introduces libvirt xml support for the following two pm options:
> > > > > >
> > > > > > <pm>
> > > > > >   <acpi-hotplug-bridge enabled='no'/>
> > > > > >   <acpi-root-hotplug enabled='yes'/>
> > > > > > </pm>
> > > > >
> > > > >
> > > > > > +``acpi-hotplug-bridge``
> > > > > > +   :since:`Since 7.8.0` This option enables or disables BIOS ACPI based hotplug support
> > > > > > +   for cold plugged bridges. It is available only for x86 guests, both for q35 and pc
> > > > > > +   machine types. For pc machines, the support is available from `QEMU 2.12`. For q35
> > > > > > +   machines, the support is available from `QEMU 6.1`. Examples of cold plugged bridges
> > > > > > +   include PCI-PCI bridges for pc machine types (pci-bridge controller). For q35 machines,
> > > > > > +   it includes PCIE root ports (pcie-root-port controller). This is a global option that
> > > > > > +   affects all bridges. No other bridge specific option is required to be specified.
> > > > >
> > > > > Can you confirm my understanding of the situation..
> > > > >
> > > > >  - i440fx / PCI topology - hotplug always uses ACPI
> > > > >
> > > >
> > > > ACPI is the primary means of enabling hotplug. shpc might also have a role
> > > > here but I think it is disabled. Igor (cc'd) might throw some lights on
> > > > how shpc comes to play.
> > >
> > > Yes, I think it will be important to understand if 'shpc' becomes relevant
> > > when ACPI hotplug is disabled for PCI
> > >
> > > >
> > > > >  - q35 / PCIe topology - hotplug historically used native PCIe hotplug,
> > > > >                          but in 6.1 switched to ACPI
> > > > >
> > > >
> > > > Correct.
> > > >
> > > > > Given, the name "acpi-hotplug-bridge",  am I right that this option
> > > > > has *no* effect, if the q35 machine is using native PCIe hotplug
> > > > > approach ?
> > > >
> > > > Its complicated.
> > > > With "acpi-hotplug-bridge" ON, native hotplug is disabled in qemu.
> > > > With "acpi-hotplug-bridge" OFF, native hotplug is enabled in qemu.
> > >
> > > Oh, I mis-read and didn't realize this was controlling the QEMU
> > > "acpi-pci-hotplug-with-bridge-support" configuration.
> > >
> > > With this in mind I think the naming is somewhat misleading. Setting it
> > > to off would give users the impression that hotplug is disabled, which
> > > is not the case for Q35 at least. It is just switching to a different
> > > hotplug implementation.
> > >
> > > At least from Q35 pov, I think it would be better to call it
> > >
> > >     hotplug-mode="acpi|pcie"
> > >
> > > so it is clear that no matter what value it is set to, hotplug
> > > is still available.
> > >
> > > If we also consider PIIX, then depending on the answer wrt shpc
> > > above, we might want one of
> > >
> > >     hotplug-mode="acpi|pcie|none"
> > >     hotplug-mode="acpi|pcie|shpc"
> > >
> >
> > If libvirt does not deal with shpc today I think we should not bother with
> > shpc at all. We should simply have a boolean mode appropriately named that
> > choses between acpi hotplug vs native.
>
> I want to understand what's possible at the qemu hardware level,
> so we don't paint ourselves into a corner.
>
> IIUC, with shpc we only have a toggle on "pci-bridge" devices,
> and those currently have shpc=true by default. There's no shpc
> setting on the pci-root, and theres no global setting.
>
> Seems to imply that if we have acpi-hotplug disabled for PIIX,
> then there would be no hotplug on the pci-root, but shpc hotplug
> would still be available on any pci-bridge devices ?
>
> > > > Libvirt does not allow it, but by directly using qemu commandline it is
> > > > possible to enable ACPI hotplug for pcie-root-ports by turning
> > > > "acpi-hotplug-bridge" ON _and_ enable native hotplug at the same time. In
> > > > that case, as Julia has mentioned in some other thread, the guest OS
> > > > always choses native over ACPI based hotplug.
> > >
> > > I see that is refering to pie-root-port gaining  native_hotplug=bool in 6.1
> > >
> > > You say the guest OS always chooses native over ACPI - is that reqiired
> > > in the spec, or is that just how some common guest OS have choosen to
> > > impl it today ?
> > >
> >
> > I am not sure but I *think* this is guest OS dependent too? Julia to
> > rescue here :-)
> >
> > >
> > > > The <target hotplug="on/off"> switch in libvirt for pcie-root-ports
> > > > currently does not care whether native or acpi hotplug is used. It simply
> > > > turns on the hotplug for that particular port. Whether ACPI or native is
> > > > used is controlled by this global flag that Julia has introduced in 6.1.
> > >
> > > Right so we have
> > >
> > >   * PIIX4
> > >
> > >       - acpi-root-pci-hotplug=bool
> > >
> > >         Whether hotplug is enabled for the root bridge or not
> > >
> > >           <target hotplug="on/off"> for pci-root controller
> > >
> > >
> > >       - acpi-pci-hotplug-with-bridge-support=bool
> > >
> > >         Toggles support for ACPI based hotplug across all bridges.
> > > 	If disabled will there will be no hotplug at all for PIIX4 ?
> > > 	Or does 'shpc' come into play in that scenario ?
> > >
> > >
> > >    PIIX combinations
> > >
> > >        (1) acpi-root-pci-hotplug=yes
> > >            acpi-pci-hotplug-with-bridge-support=yes
> > >
> > >          - All bridges have hotplug
> > >
> > >        (2) acpi-root-pci-hotplug=yes
> > >            acpi-pci-hotplug-with-bridge-support=no
> > >
> > >          - No bridges have hotplug
> > >
> > >        (3) acpi-root-pci-hotplug=no
> > >            acpi-pci-hotplug-with-bridge-support=yes
> > >
> > >          - All bridges except root have hotplug
> > >
> > >        (4) acpi-root-pci-hotplug=no
> > >            acpi-pci-hotplug-with-bridge-support=no
> > >
> > >          - No bridges have hotplug. Essentially identical to (2)
> >
> > no (4) is not identical to (2). In (4) no hotplug is enabled. In (2) pci
> > root bus still has hotplug enabled.
>
> So you're saying that acpi-root-pci-hotplug=yes overrides the
> global request acpi-pci-hotplug-with-bridge-support=no and
> turns ACPI hotplug back on for the pcie-root

No. acpi-pci-hotplug-with-bridge-support only affects the bridges. It has
no effect on pci root bus. pci root bus is controlled by
acpi-root-pci-hotplug option. So acpi-pci-hotplug-with-bridge-support is
not "global" wrt hotplug for ports on the root bus and bridges. Its
"global" as in its a global option for all bridges.

Makes sense? I know this is all convoluted.


>
> > >   * Q35
> > >
> > >
> > >       - acpi-pci-hotplug-with-bridge-support=bool
> > >
> > >         Toggles support for ACPI based hotplug. If disabled native
> > > 	PCIe hotplug is activated instead
> > >
> > >
> > >   * pcie-root-port
> > >
> > >       - hotplug=bool
> > >
> > >         Toggles whether hotplug is enabled on the port. Affects
> > > 	either native and ACPI based hotplug, depending on what
> > > 	acpi-pci-hotplug-with-bridge-support=bool is set to ?
> > >
> > >           <target hotplug="on/off"> for pcie-root-port controller
> > >
> > >       - native_hotplug=bool
> > >
> > >         Can be used to also enable native hotplug, even when ACPI
> > > 	based hotplug is globally enabled. IOW only really relevant
> > > 	when acpi-pci-hotplug-with-bridge-support=true
> > >
> > >
> > >    Q35 combinations
> > >
> > >        (1) acpi-pci-hotplug-with-bridge-support=yes
> > >            pcie-root-port.hotplug=yes
> > >            pcie-root-port.native_hotplug=yes
> > >
> > >            ports have both ACPI + native hotplug, guest prefers native
> > >
> > >
> > >        (2) acpi-pci-hotplug-with-bridge-support=yes
> > >            pcie-root-port.hotplug=no
> > >            pcie-root-port.native_hotplug=yes
> > >
> > >            ports have no hotplug, despite native_hotplug=yes IIUC
> > >
> > >
> > >        (3) acpi-pci-hotplug-with-bridge-support=yes
> > >            pcie-root-port.hotplug=yes
> > >            pcie-root-port.native_hotplug=no
> > >
> > >            ports have ACPI hotplug only
> > >
> > >
> > >        (4) acpi-pci-hotplug-with-bridge-support=yes
> > >            pcie-root-port.hotplug=no
> > >            pcie-root-port.native_hotplug=no
> > >
> > >            ports have no hotplug
> > >
> > >
> > >        (5) acpi-pci-hotplug-with-bridge-support=no
> > >            pcie-root-port.hotplug=yes
> > >            pcie-root-port.native_hotplug=yes
> > >
> > >            ports have native hotplug
> > >
> > >
> > >        (6) acpi-pci-hotplug-with-bridge-support=no
> > >            pcie-root-port.hotplug=no
> > >            pcie-root-port.native_hotplug=yes
> > >
> > >            ports have no hotplug, despite native_hotplug=yes IIUC
> > >
> > >
> > >        (7) acpi-pci-hotplug-with-bridge-support=no
> > >            pcie-root-port.hotplug=yes
> > >            pcie-root-port.native_hotplug=no
> > >
> > >            ports have no hotplug, despite hotplug=yes IIUC
> > >
> > >
> > >        (8) acpi-pci-hotplug-with-bridge-support=no
> > >            pcie-root-port.hotplug=no
> > >            pcie-root-port.native_hotplug=no
> > >
> > >            ports have no hotplug
> > >
> > >
> > >
> > > Regards,
> > > Daniel
> > > --
> > > |: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
> > > |: https://libvirt.org         -o-            https://fstop138.berrange.com :|
> > > |: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
> > >
> > >
>
>
> Regards,
> Daniel
> --
> |: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
> |: https://libvirt.org         -o-            https://fstop138.berrange.com :|
> |: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
>
>


More information about the libvir-list mailing list