ACPI: call acpi_set_pci_info when only acpi enabled
PATCH 1/1 ACPI: call acpi_set_pci_info when only acpi enabled
Commit f0c9d64a exposed an issue with the code order in acpi_setup. As of that commit, a xenfv machine type guest will no longer start if using pci passthrough. Re-order the code in that function to allow acpi_set_pci_info to be called before bailing on the other, non-related conditions. With this change I can again use pci passthrough and xenfv together.
--- hw/i386/acpi-build.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
hw/i386/acpi-build.c +7 -7
@@ -2834,6 +2834,13 @@ void acpi_setup(void)AcpiBuildState *build_state;Object *vmgenid_dev; +if (!acpi_enabled) { +ACPI_BUILD_DPRINTF ("ACPI disabled. Bailing out.\n" ); +return ; + } + +acpi_set_pci_info (); +if (!pcms->fw_cfg) {ACPI_BUILD_DPRINTF ("No fw cfg. Bailing out.\n" );return ;
@@ -2844,15 +2851,8 @@ void acpi_setup(void)return ; } -if (!acpi_enabled) { -ACPI_BUILD_DPRINTF ("ACPI disabled. Bailing out.\n" ); -return ; - } - build_state =g_malloc0 (sizeof *build_state); -acpi_set_pci_info (); -acpi_build_tables_init (&tables);acpi_build (&tables,MACHINE (pcms));
Signature · 1 line
1.9.0
Quoted 8 lines · On Wed, 26 Apr 2017 13:07:02 -0600 Bruce Rogers <[email protected]> wrote:
Commit
f0c9d64aexposed an issue with the code order inacpi_setup. As of that commit, a xenfv machine type guest will no longer start if using pci passthrough. Re-order the code in that function to allowacpi_set_pci_infoto be called before bailing on the other, non-related conditions. With this change I can again use pci passthrough and xenfv together.Signed-off-by Bruce Rogers <[email protected]>
it doesn't look right,acpi_set_pci_info() is supposed to affect only ACPI based hotplug
could you elaborate more on what's going on and
what error you see at startup?
Quoted 38 lines
--- hw/i386/acpi-build.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)hw/i386/acpi-build.c +7
-7@@ -2834,6 +2834,13 @@ void acpi_setup(void)AcpiBuildState *build_state;Object *vmgenid_dev; +if (!acpi_enabled) { +ACPI_BUILD_DPRINTF ("ACPI disabled. Bailing out.\n" ); +return ; + } + +acpi_set_pci_info (); +if (!pcms->fw_cfg) {ACPI_BUILD_DPRINTF ("No fw cfg. Bailing out.\n" );return ;@@ -2844,15 +2851,8 @@ void acpi_setup(void)return ; } -if (!acpi_enabled) { -ACPI_BUILD_DPRINTF ("ACPI disabled. Bailing out.\n" ); -return ; - } - build_state =g_malloc0 (sizeof *build_state); -acpi_set_pci_info (); -acpi_build_tables_init (&tables);acpi_build (&tables,MACHINE (pcms));
Quoted 11 lines
Quoted 1 line
Quoted 1 line · Igor Mammedov
Quoted 7 lines · On Wed, 26 Apr 2017 13:07:02 -0600 Bruce Rogers <[email protected]> wrote:
Commit
f0c9d64aexposed an issue with the code order inacpi_setup. As of that commit, a xenfv machine type guest will no longer start if using pci passthrough. Re-order the code in that function to allowacpi_set_pci_infoto be called before bailing on the other, non-related conditions. With this change I can again use pci passthrough and xenfv together.
Quoted 6 lines
Quoted 1 line
Signed-off-by Bruce Rogers <[email protected]>it doesn't look right,
acpi_set_pci_info()is supposed to affect only ACPI based hotplugcould you elaborate more on what's going on and
what error you see at startup?
I am using libvirt, driving the creation of the Xen HVM guest via libxl. libxl dynamically attaches the pci device via QMP. In the context of qmp_device_add(), we get a failure in hw/acpi/pcihp.c:acpi_pcihp_device_plug_cb() when it checks for bsel, and errors with the message: "Unsupported bus. Bus doesn't have property 'acpi-pcihp-bsel' set". I guess it wasn't clear from my description that hotplug was involved.
Bruce
Quoted 39 lines
Quoted 39 lines
--- hw/i386/acpi-build.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)hw/i386/acpi-build.c +7
-7@@ -2834,6 +2834,13 @@ void acpi_setup(void)AcpiBuildState *build_state;Object *vmgenid_dev; +if (!acpi_enabled) { +ACPI_BUILD_DPRINTF ("ACPI disabled. Bailing out.\n" ); +return ; + } + +acpi_set_pci_info (); +if (!pcms->fw_cfg) {ACPI_BUILD_DPRINTF ("No fw cfg. Bailing out.\n" );return ;@@ -2844,15 +2851,8 @@ void acpi_setup(void)return ; } -if (!acpi_enabled) { -ACPI_BUILD_DPRINTF ("ACPI disabled. Bailing out.\n" ); -return ; - } - build_state =g_malloc0 (sizeof *build_state); -acpi_set_pci_info (); -acpi_build_tables_init (&tables);acpi_build (&tables,MACHINE (pcms));
Quoted 18 lines · On Thu, 27 Apr 2017 09:44:31 -0600 "Bruce Rogers" <[email protected]> wrote:
Quoted 11 lines
Quoted 1 line
Quoted 1 line · Igor Mammedov
Quoted 7 lines · On Wed, 26 Apr 2017 13:07:02 -0600 Bruce Rogers <[email protected]> wrote:
Commit
f0c9d64aexposed an issue with the code order inacpi_setup. As of that commit, a xenfv machine type guest will no longer start if using pci passthrough. Re-order the code in that function to allowacpi_set_pci_infoto be called before bailing on the other, non-related conditions. With this change I can again use pci passthrough and xenfv together.Quoted 6 lines
Quoted 1 line
Signed-off-by Bruce Rogers <[email protected]>it doesn't look right,
acpi_set_pci_info()is supposed to affect only ACPI based hotplugcould you elaborate more on what's going on and
what error you see at startup?
Quoted 8 lines
I am using libvirt, driving the creation of the Xen HVM guest via libxl. libxl dynamically attaches the pci device via QMP. In the context of
qmp_device_add(), we get a failure inhw/acpi/pcihp.c:acpi_pcihp_device_plug_cb()when it checks for bsel, and errors with the message: "Unsupported bus. Bus doesn't have property 'acpi-pcihp-bsel' set". I guess it wasn't clear from my description that hotplug was involved.
is dev->hotplugged in acpi_pcihp_device_plug_cb() true at that time?
the point is that bsel is needed only when there is supporting ACPI code and useless otherwise, so acpi_pcihp_device_plug_cb() probably shouldn't run under xenfv. I'd try to add compat prop to PIIX4_PM and disable acpi_pcihp_device_plug_cb() for xenfv via machine compat property.
Quoted 43 lines
Bruce
Quoted 39 lines
Quoted 39 lines
--- hw/i386/acpi-build.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)hw/i386/acpi-build.c +7
-7@@ -2834,6 +2834,13 @@ void acpi_setup(void)AcpiBuildState *build_state;Object *vmgenid_dev; +if (!acpi_enabled) { +ACPI_BUILD_DPRINTF ("ACPI disabled. Bailing out.\n" ); +return ; + } + +acpi_set_pci_info (); +if (!pcms->fw_cfg) {ACPI_BUILD_DPRINTF ("No fw cfg. Bailing out.\n" );return ;@@ -2844,15 +2851,8 @@ void acpi_setup(void)return ; } -if (!acpi_enabled) { -ACPI_BUILD_DPRINTF ("ACPI disabled. Bailing out.\n" ); -return ; - } - build_state =g_malloc0 (sizeof *build_state); -acpi_set_pci_info (); -acpi_build_tables_init (&tables);acpi_build (&tables,MACHINE (pcms));
Quoted 32 lines
Quoted 3 lines
Quoted 3 lines · Igor Mammedov
Quoted 18 lines · On Thu, 27 Apr 2017 09:44:31 -0600 "Bruce Rogers" <[email protected]> wrote:
Quoted 11 lines
Quoted 1 line
Quoted 1 line · Igor Mammedov
Quoted 7 lines · On Wed, 26 Apr 2017 13:07:02 -0600 Bruce Rogers <[email protected]> wrote:
Commit
f0c9d64aexposed an issue with the code order inacpi_setup. As of that commit, a xenfv machine type guest will no longer start if using pci passthrough. Re-order the code in that function to allowacpi_set_pci_infoto be called before bailing on the other, non-related conditions. With this change I can again use pci passthrough and xenfv together.Quoted 6 lines
Quoted 1 line
Signed-off-by Bruce Rogers <[email protected]>it doesn't look right,
acpi_set_pci_info()is supposed to affect only ACPI based hotplugcould you elaborate more on what's going on and
what error you see at startup?Quoted 8 lines
I am using libvirt, driving the creation of the Xen HVM guest via libxl. libxl dynamically attaches the pci device via QMP. In the context of
qmp_device_add(), we get a failure inhw/acpi/pcihp.c:acpi_pcihp_device_plug_cb()when it checks for bsel, and errors with the message: "Unsupported bus. Bus doesn't have property 'acpi-pcihp-bsel' set". I guess it wasn't clear from my description that hotplug was involved.
Quoted 1 line
is
dev->hotpluggedinacpi_pcihp_device_plug_cb()true at that time?
Yes it is. It gets set in hw/core/qdev.c:device_initfn().
Quoted 5 lines
the point is that bsel is needed only when there is supporting ACPI code and useless otherwise, so
acpi_pcihp_device_plug_cb()probably shouldn't run under xenfv. I'd try to add compat prop toPIIX4_PMand disableacpi_pcihp_device_plug_cb()for xenfv via machine compat property.
I'll look into this then. I'm not too familiar yet with this area of the code. I simply bisected the problem, which pointed to the commit id referenced in the patch, and came up with what seemed like the most obvious solution.
Quoted 44 lines
Quoted 44 lines
Bruce
Quoted 39 lines
Quoted 39 lines
--- hw/i386/acpi-build.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)hw/i386/acpi-build.c +7
-7@@ -2834,6 +2834,13 @@ void acpi_setup(void)AcpiBuildState *build_state;Object *vmgenid_dev; +if (!acpi_enabled) { +ACPI_BUILD_DPRINTF ("ACPI disabled. Bailing out.\n" ); +return ; + } + +acpi_set_pci_info (); +if (!pcms->fw_cfg) {ACPI_BUILD_DPRINTF ("No fw cfg. Bailing out.\n" );return ;@@ -2844,15 +2851,8 @@ void acpi_setup(void)return ; } -if (!acpi_enabled) { -ACPI_BUILD_DPRINTF ("ACPI disabled. Bailing out.\n" ); -return ; - } - build_state =g_malloc0 (sizeof *build_state); -acpi_set_pci_info (); -acpi_build_tables_init (&tables);acpi_build (&tables,MACHINE (pcms));
Quoted 32 lines
Quoted 3 lines
Quoted 3 lines · Igor Mammedov
Quoted 18 lines · On Thu, 27 Apr 2017 09:44:31 -0600 "Bruce Rogers" <[email protected]> wrote:
Quoted 11 lines
Quoted 1 line
Quoted 1 line · Igor Mammedov
Quoted 7 lines · On Wed, 26 Apr 2017 13:07:02 -0600 Bruce Rogers <[email protected]> wrote:
Commit
f0c9d64aexposed an issue with the code order inacpi_setup. As of that commit, a xenfv machine type guest will no longer start if using pci passthrough. Re-order the code in that function to allowacpi_set_pci_infoto be called before bailing on the other, non-related conditions. With this change I can again use pci passthrough and xenfv together.Quoted 6 lines
Quoted 1 line
Signed-off-by Bruce Rogers <[email protected]>it doesn't look right,
acpi_set_pci_info()is supposed to affect only ACPI based hotplugcould you elaborate more on what's going on and
what error you see at startup?Quoted 8 lines
I am using libvirt, driving the creation of the Xen HVM guest via libxl. libxl dynamically attaches the pci device via QMP. In the context of
qmp_device_add(), we get a failure inhw/acpi/pcihp.c:acpi_pcihp_device_plug_cb()when it checks for bsel, and errors with the message: "Unsupported bus. Bus doesn't have property 'acpi-pcihp-bsel' set". I guess it wasn't clear from my description that hotplug was involved.
Quoted 6 lines
is
dev->hotpluggedinacpi_pcihp_device_plug_cb()true at that time?the point is that bsel is needed only when there is supporting ACPI code and useless otherwise, so
acpi_pcihp_device_plug_cb()probably shouldn't run under xenfv. I'd try to add compat prop toPIIX4_PMand disableacpi_pcihp_device_plug_cb()for xenfv via machine compat property.
So what would be wrong with simply conditionalizing the call to
acpi_pcihp_device_plug_cb() with a check for xen in piix4_device_plug_cb()
as follows:
}
} else if (object_dynamic_cast(OBJECT(dev), TYPE_PCI_DEVICE)) {- acpi_pcihp_device_plug_cb(hotplug_dev, &s->acpi_pci_hotplug, dev, errp);
+ if (!xen_enabled()) {
+ acpi_pcihp_device_plug_cb(hotplug_dev, &s->acpi_pci_hotplug, dev,
+ errp);
+ }
} else if (object_dynamic_cast(OBJECT(dev), TYPE_CPU)) {
if (s->cpu_hotplug_legacy) {
legacy_acpi_cpu_plug_cb(hotplug_dev, &s->gpe_cpu, dev, errp);Wouldn't that be the solution?
Bruce
Quoted 54 lines · On Thu, 27 Apr 2017 10:51:23 -0600 "Bruce Rogers" <[email protected]> wrote:
Quoted 32 lines
Quoted 3 lines
Quoted 3 lines · Igor Mammedov
Quoted 18 lines · On Thu, 27 Apr 2017 09:44:31 -0600 "Bruce Rogers" <[email protected]> wrote:
Quoted 11 lines
Quoted 1 line
Quoted 1 line · Igor Mammedov
Quoted 7 lines · On Wed, 26 Apr 2017 13:07:02 -0600 Bruce Rogers <[email protected]> wrote:
Commit
f0c9d64aexposed an issue with the code order inacpi_setup. As of that commit, a xenfv machine type guest will no longer start if using pci passthrough. Re-order the code in that function to allowacpi_set_pci_infoto be called before bailing on the other, non-related conditions. With this change I can again use pci passthrough and xenfv together.Quoted 6 lines
Quoted 1 line
Signed-off-by Bruce Rogers <[email protected]>it doesn't look right,
acpi_set_pci_info()is supposed to affect only ACPI based hotplugcould you elaborate more on what's going on and
what error you see at startup?Quoted 8 lines
I am using libvirt, driving the creation of the Xen HVM guest via libxl. libxl dynamically attaches the pci device via QMP. In the context of
qmp_device_add(), we get a failure inhw/acpi/pcihp.c:acpi_pcihp_device_plug_cb()when it checks for bsel, and errors with the message: "Unsupported bus. Bus doesn't have property 'acpi-pcihp-bsel' set". I guess it wasn't clear from my description that hotplug was involved.Quoted 6 lines
is
dev->hotpluggedinacpi_pcihp_device_plug_cb()true at that time?the point is that bsel is needed only when there is supporting ACPI code and useless otherwise, so
acpi_pcihp_device_plug_cb()probably shouldn't run under xenfv. I'd try to add compat prop toPIIX4_PMand disableacpi_pcihp_device_plug_cb()for xenfv via machine compat property.So what would be wrong with simply conditionalizing the call to
acpi_pcihp_device_plug_cb()with a check for xen inpiix4_device_plug_cb()
as follows:} } else if (object_dynamic_cast(OBJECT(dev), TYPE_PCI_DEVICE)) {(quoted diff) +4
-1- acpi_pcihp_device_plug_cb(hotplug_dev, &s->acpi_pci_hotplug, dev, errp); + if (!xen_enabled()) { + acpi_pcihp_device_plug_cb(hotplug_dev, &s->acpi_pci_hotplug, dev, + errp); + } } else if (object_dynamic_cast(OBJECT(dev), TYPE_CPU)) { if (s->cpu_hotplug_legacy) { legacy_acpi_cpu_plug_cb(hotplug_dev, &s->gpe_cpu, dev, errp);
Quoted 1 line
Wouldn't that be the solution?
it should work
is it possible to see unplug on that device later under xen?
Quoted 4 lines
Bruce
Quoted 57 lines · Igor Mammedov
Quoted 54 lines · On Thu, 27 Apr 2017 10:51:23 -0600 "Bruce Rogers" <[email protected]> wrote:
Quoted 32 lines
Quoted 3 lines
Quoted 3 lines · Igor Mammedov
Quoted 18 lines · On Thu, 27 Apr 2017 09:44:31 -0600 "Bruce Rogers" <[email protected]> wrote:
Quoted 11 lines
Quoted 1 line
Quoted 1 line · Igor Mammedov
Quoted 7 lines · On Wed, 26 Apr 2017 13:07:02 -0600 Bruce Rogers <[email protected]> wrote:
Commit
f0c9d64aexposed an issue with the code order inacpi_setup. As of that commit, a xenfv machine type guest will no longer start if using pci passthrough. Re-order the code in that function to allowacpi_set_pci_infoto be called before bailing on the other, non-related conditions. With this change I can again use pci passthrough and xenfv together.Quoted 6 lines
Quoted 1 line
Signed-off-by Bruce Rogers <[email protected]>it doesn't look right,
acpi_set_pci_info()is supposed to affect only ACPI based hotplugcould you elaborate more on what's going on and
what error you see at startup?Quoted 8 lines
I am using libvirt, driving the creation of the Xen HVM guest via libxl. libxl dynamically attaches the pci device via QMP. In the context of
qmp_device_add(), we get a failure inhw/acpi/pcihp.c:acpi_pcihp_device_plug_cb()when it checks for bsel, and errors with the message: "Unsupported bus. Bus doesn't have property 'acpi-pcihp-bsel' set". I guess it wasn't clear from my description that hotplug was involved.Quoted 6 lines
is
dev->hotpluggedinacpi_pcihp_device_plug_cb()true at that time?the point is that bsel is needed only when there is supporting ACPI code and useless otherwise, so
acpi_pcihp_device_plug_cb()probably shouldn't run under xenfv. I'd try to add compat prop toPIIX4_PMand disableacpi_pcihp_device_plug_cb()for xenfv via machine compat property.So what would be wrong with simply conditionalizing the call to
acpi_pcihp_device_plug_cb()with a check for xen inpiix4_device_plug_cb()
as follows:} } else if (object_dynamic_cast(OBJECT(dev), TYPE_PCI_DEVICE)) {(quoted diff) +4
-1- acpi_pcihp_device_plug_cb(hotplug_dev, &s->acpi_pci_hotplug, dev, errp); + if (!xen_enabled()) { + acpi_pcihp_device_plug_cb(hotplug_dev, &s->acpi_pci_hotplug, dev, + errp); + } } else if (object_dynamic_cast(OBJECT(dev), TYPE_CPU)) { if (s->cpu_hotplug_legacy) { legacy_acpi_cpu_plug_cb(hotplug_dev, &s->gpe_cpu, dev, errp);
Quoted 4 lines
Quoted 1 line
Wouldn't that be the solution?
it should work
is it possible to see unplug on that device later under xen?
Yes, it would be possible. I guess we need to do the same for acpi_pcihp_device_unplug_cb?
Quoted 62 lines
Quoted 3 lines
Quoted 3 lines · Stefano Stabellini
Quoted 42 lines · Igor Mammedov
Quoted 39 lines · On Thu, 27 Apr 2017 10:51:23 -0600 "Bruce Rogers" <[email protected]> wrote:
Quoted 38 lines
Quoted 3 lines
Quoted 3 lines · Igor Mammedov
Quoted 18 lines · On Thu, 27 Apr 2017 09:44:31 -0600 "Bruce Rogers" <[email protected]> wrote:
Quoted 11 lines
Quoted 1 line
Quoted 1 line · Igor Mammedov
Quoted 7 lines · On Wed, 26 Apr 2017 13:07:02 -0600 Bruce Rogers <[email protected]> wrote:
Commit
f0c9d64aexposed an issue with the code order inacpi_setup. As of that commit, a xenfv machine type guest will no longer start if using pci passthrough. Re-order the code in that function to allowacpi_set_pci_infoto be called before bailing on the other, non-related conditions. With this change I can again use pci passthrough and xenfv together.Quoted 6 lines
Quoted 1 line
Signed-off-by Bruce Rogers <[email protected]>it doesn't look right,
acpi_set_pci_info()is supposed to affect only ACPI based hotplugcould you elaborate more on what's going on and
what error you see at startup?Quoted 8 lines
I am using libvirt, driving the creation of the Xen HVM guest via libxl. libxl dynamically attaches the pci device via QMP. In the context of
qmp_device_add(), we get a failure inhw/acpi/pcihp.c:acpi_pcihp_device_plug_cb()when it checks for bsel, and errors with the message: "Unsupported bus. Bus doesn't have property 'acpi-pcihp-bsel' set". I guess it wasn't clear from my description that hotplug was involved.is
dev->hotpluggedinacpi_pcihp_device_plug_cb()true at that time?the point is that bsel is needed only when there is supporting ACPI code and useless otherwise, so
acpi_pcihp_device_plug_cb()probably shouldn't run under xenfv. I'd try to add compat prop toPIIX4_PMand disableacpi_pcihp_device_plug_cb()for xenfv via machine compat property.Quoted 7 lines
Quoted 7 lines
So what would be wrong with simply conditionalizing the call to
acpi_pcihp_device_plug_cb()with a check for xen inpiix4_device_plug_cb()
as follows:} } else if (object_dynamic_cast(OBJECT(dev), TYPE_PCI_DEVICE)) {- acpi_pcihp_device_plug_cb(hotplug_dev,
&s->acpi_pci_hotplug, dev,errp);
Quoted 8 lines
Quoted 8 lines
(quoted diff) +4
-0+ if (!xen_enabled()) { + acpi_pcihp_device_plug_cb(hotplug_dev, &s->acpi_pci_hotplug, dev, + errp); + } } else if (object_dynamic_cast(OBJECT(dev), TYPE_CPU)) { if (s->cpu_hotplug_legacy) { legacy_acpi_cpu_plug_cb(hotplug_dev, &s->gpe_cpu, dev, errp);
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
Wouldn't that be the solution?
it should work
is it possible to see unplug on that device later under xen?
Yes, it would be possible. I guess we need to do the same for
acpi_pcihp_device_unplug_cb?
Thanks guys, I'll send a new patch based on this discussion.
Bruce