* [PATCH v2] hw/pcie-root-port: Fix hotplug for PCI devices requiring IO
@ 2021-08-02 9:00 Marcel Apfelbaum
2021-08-02 9:05 ` Daniel P. Berrangé
0 siblings, 1 reply; 3+ messages in thread
From: Marcel Apfelbaum @ 2021-08-02 9:00 UTC (permalink / raw)
To: qemu-devel; +Cc: marcel, imammedo, mst
Q35 has now ACPI hotplug enabled by default for PCI(e) devices.
As opposed to native PCIe hotplug, guests like Fedora 34
will not assign IO range to pcie-root-ports not supporting
native hotplug, resulting into a regression.
Reproduce by:
qemu-bin -M q35 -device pcie-root-port,id=p1 -monitor stdio
device_add e1000,bus=p1
In the Guest OS the respective pcie-root-port will have the IO range
disabled.
Fix it by setting the "reserve-io" hint capability of the
pcie-root-ports so the firmware will allocate the IO range instead.
Acked-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
---
v2:
- improve commit message (Igor)
hw/pci-bridge/gen_pcie_root_port.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/hw/pci-bridge/gen_pcie_root_port.c b/hw/pci-bridge/gen_pcie_root_port.c
index ec9907917e..20099a8ae3 100644
--- a/hw/pci-bridge/gen_pcie_root_port.c
+++ b/hw/pci-bridge/gen_pcie_root_port.c
@@ -28,6 +28,7 @@ OBJECT_DECLARE_SIMPLE_TYPE(GenPCIERootPort, GEN_PCIE_ROOT_PORT)
(GEN_PCIE_ROOT_PORT_AER_OFFSET + PCI_ERR_SIZEOF)
#define GEN_PCIE_ROOT_PORT_MSIX_NR_VECTOR 1
+#define GEN_PCIE_ROOT_DEFAULT_IO_RANGE 4096
struct GenPCIERootPort {
/*< private >*/
@@ -75,6 +76,7 @@ static bool gen_rp_test_migrate_msix(void *opaque, int version_id)
static void gen_rp_realize(DeviceState *dev, Error **errp)
{
PCIDevice *d = PCI_DEVICE(dev);
+ PCIESlot *s = PCIE_SLOT(d);
GenPCIERootPort *grp = GEN_PCIE_ROOT_PORT(d);
PCIERootPortClass *rpc = PCIE_ROOT_PORT_GET_CLASS(d);
Error *local_err = NULL;
@@ -85,6 +87,9 @@ static void gen_rp_realize(DeviceState *dev, Error **errp)
return;
}
+ if (grp->res_reserve.io == -1 && s->hotplug && !s->native_hotplug) {
+ grp->res_reserve.io = GEN_PCIE_ROOT_DEFAULT_IO_RANGE;
+ }
int rc = pci_bridge_qemu_reserve_cap_init(d, 0,
grp->res_reserve, errp);
--
2.31.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] hw/pcie-root-port: Fix hotplug for PCI devices requiring IO
2021-08-02 9:00 [PATCH v2] hw/pcie-root-port: Fix hotplug for PCI devices requiring IO Marcel Apfelbaum
@ 2021-08-02 9:05 ` Daniel P. Berrangé
2021-08-02 13:30 ` Marcel Apfelbaum
0 siblings, 1 reply; 3+ messages in thread
From: Daniel P. Berrangé @ 2021-08-02 9:05 UTC (permalink / raw)
To: Marcel Apfelbaum; +Cc: marcel, imammedo, qemu-devel, mst
On Mon, Aug 02, 2021 at 12:00:57PM +0300, Marcel Apfelbaum wrote:
> Q35 has now ACPI hotplug enabled by default for PCI(e) devices.
> As opposed to native PCIe hotplug, guests like Fedora 34
> will not assign IO range to pcie-root-ports not supporting
> native hotplug, resulting into a regression.
Presumably this means this patch should have 'for 6.1' tagged
in subject, as we don't want 6.1 to regress ?
>
> Reproduce by:
> qemu-bin -M q35 -device pcie-root-port,id=p1 -monitor stdio
> device_add e1000,bus=p1
> In the Guest OS the respective pcie-root-port will have the IO range
> disabled.
>
> Fix it by setting the "reserve-io" hint capability of the
> pcie-root-ports so the firmware will allocate the IO range instead.
>
> Acked-by: Igor Mammedov <imammedo@redhat.com>
> Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
> ---
> v2:
> - improve commit message (Igor)
>
> hw/pci-bridge/gen_pcie_root_port.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/hw/pci-bridge/gen_pcie_root_port.c b/hw/pci-bridge/gen_pcie_root_port.c
> index ec9907917e..20099a8ae3 100644
> --- a/hw/pci-bridge/gen_pcie_root_port.c
> +++ b/hw/pci-bridge/gen_pcie_root_port.c
> @@ -28,6 +28,7 @@ OBJECT_DECLARE_SIMPLE_TYPE(GenPCIERootPort, GEN_PCIE_ROOT_PORT)
> (GEN_PCIE_ROOT_PORT_AER_OFFSET + PCI_ERR_SIZEOF)
>
> #define GEN_PCIE_ROOT_PORT_MSIX_NR_VECTOR 1
> +#define GEN_PCIE_ROOT_DEFAULT_IO_RANGE 4096
>
> struct GenPCIERootPort {
> /*< private >*/
> @@ -75,6 +76,7 @@ static bool gen_rp_test_migrate_msix(void *opaque, int version_id)
> static void gen_rp_realize(DeviceState *dev, Error **errp)
> {
> PCIDevice *d = PCI_DEVICE(dev);
> + PCIESlot *s = PCIE_SLOT(d);
> GenPCIERootPort *grp = GEN_PCIE_ROOT_PORT(d);
> PCIERootPortClass *rpc = PCIE_ROOT_PORT_GET_CLASS(d);
> Error *local_err = NULL;
> @@ -85,6 +87,9 @@ static void gen_rp_realize(DeviceState *dev, Error **errp)
> return;
> }
>
> + if (grp->res_reserve.io == -1 && s->hotplug && !s->native_hotplug) {
> + grp->res_reserve.io = GEN_PCIE_ROOT_DEFAULT_IO_RANGE;
> + }
> int rc = pci_bridge_qemu_reserve_cap_init(d, 0,
> grp->res_reserve, errp);
>
> --
> 2.31.1
>
>
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 :|
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] hw/pcie-root-port: Fix hotplug for PCI devices requiring IO
2021-08-02 9:05 ` Daniel P. Berrangé
@ 2021-08-02 13:30 ` Marcel Apfelbaum
0 siblings, 0 replies; 3+ messages in thread
From: Marcel Apfelbaum @ 2021-08-02 13:30 UTC (permalink / raw)
To: Daniel P. Berrangé
Cc: Marcel Apfelbaum, Igor Mammedov, qemu devel list, Michael S. Tsirkin
[-- Attachment #1: Type: text/plain, Size: 3000 bytes --]
Hi Daniel,
On Mon, Aug 2, 2021 at 12:05 PM Daniel P. Berrangé <berrange@redhat.com>
wrote:
> On Mon, Aug 02, 2021 at 12:00:57PM +0300, Marcel Apfelbaum wrote:
> > Q35 has now ACPI hotplug enabled by default for PCI(e) devices.
> > As opposed to native PCIe hotplug, guests like Fedora 34
> > will not assign IO range to pcie-root-ports not supporting
> > native hotplug, resulting into a regression.
>
> Presumably this means this patch should have 'for 6.1' tagged
> in subject, as we don't want 6.1 to regress ?
>
I agree I should have added the tag, however Michael is aware as
he proposed this patch.
I can re-spin if necessary.
Thanks,
Marcel
>
> >
> > Reproduce by:
> > qemu-bin -M q35 -device pcie-root-port,id=p1 -monitor stdio
> > device_add e1000,bus=p1
> > In the Guest OS the respective pcie-root-port will have the IO range
> > disabled.
> >
> > Fix it by setting the "reserve-io" hint capability of the
> > pcie-root-ports so the firmware will allocate the IO range instead.
> >
> > Acked-by: Igor Mammedov <imammedo@redhat.com>
> > Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
> > ---
> > v2:
> > - improve commit message (Igor)
> >
> > hw/pci-bridge/gen_pcie_root_port.c | 5 +++++
> > 1 file changed, 5 insertions(+)
> >
> > diff --git a/hw/pci-bridge/gen_pcie_root_port.c
> b/hw/pci-bridge/gen_pcie_root_port.c
> > index ec9907917e..20099a8ae3 100644
> > --- a/hw/pci-bridge/gen_pcie_root_port.c
> > +++ b/hw/pci-bridge/gen_pcie_root_port.c
> > @@ -28,6 +28,7 @@ OBJECT_DECLARE_SIMPLE_TYPE(GenPCIERootPort,
> GEN_PCIE_ROOT_PORT)
> > (GEN_PCIE_ROOT_PORT_AER_OFFSET + PCI_ERR_SIZEOF)
> >
> > #define GEN_PCIE_ROOT_PORT_MSIX_NR_VECTOR 1
> > +#define GEN_PCIE_ROOT_DEFAULT_IO_RANGE 4096
> >
> > struct GenPCIERootPort {
> > /*< private >*/
> > @@ -75,6 +76,7 @@ static bool gen_rp_test_migrate_msix(void *opaque, int
> version_id)
> > static void gen_rp_realize(DeviceState *dev, Error **errp)
> > {
> > PCIDevice *d = PCI_DEVICE(dev);
> > + PCIESlot *s = PCIE_SLOT(d);
> > GenPCIERootPort *grp = GEN_PCIE_ROOT_PORT(d);
> > PCIERootPortClass *rpc = PCIE_ROOT_PORT_GET_CLASS(d);
> > Error *local_err = NULL;
> > @@ -85,6 +87,9 @@ static void gen_rp_realize(DeviceState *dev, Error
> **errp)
> > return;
> > }
> >
> > + if (grp->res_reserve.io == -1 && s->hotplug && !s->native_hotplug)
> {
> > + grp->res_reserve.io = GEN_PCIE_ROOT_DEFAULT_IO_RANGE;
> > + }
> > int rc = pci_bridge_qemu_reserve_cap_init(d, 0,
> > grp->res_reserve, errp);
> >
> > --
> > 2.31.1
> >
> >
>
> 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 :|
>
>
[-- Attachment #2: Type: text/html, Size: 4718 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-08-02 13:31 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-02 9:00 [PATCH v2] hw/pcie-root-port: Fix hotplug for PCI devices requiring IO Marcel Apfelbaum
2021-08-02 9:05 ` Daniel P. Berrangé
2021-08-02 13:30 ` Marcel Apfelbaum
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.