Skip to contentSkip to conversation

hw/pci-host/aspeed_pcie: Fix global MSI setting during class initialization

PATCH Superseded Jamin Lin 3 participants 5 messages Oct 19 – Oct 20 Arm/Aspeed machine support

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Jamin Lin

author
#0 lore raw

PATCH 1/1 hw/pci-host/aspeed_pcie: Fix global MSI setting during class initialization

Setting msi_nonbroken in class_init() affects all machine types, even when the ASPEED PCIe controller is not used.

Move msi_nonbroken to realize() to ensure it is only set when the ASPEED PCIe controller is realized.

Fixes f002aa35f3205d55bbe4a68670ba19a6dcf1d6a8 ("hw/pci-host/aspeed: Add AST2600 PCIe config space and host bridge")
---
 hw/pci-host/aspeed_pcie.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/pci-host/aspeed_pcie.c +2 -2
index b46eb74234..ceb010f213 100644
@@ -181,6 +181,8 @@ static void aspeed_pcie_rc_realize(DeviceState *dev, Error **errp)
     g_autofree char *dram_alias_name = NULL;
     g_autofree char *root_bus_name = NULL;
 
+    msi_nonbroken = true;
+
     /* PCI configuration space */
     pcie_host_mmcfg_init(pex, PCIE_MMCFG_SIZE_MAX);
     sysbus_init_mmio(sbd, &pex->mmio);
@@ -294,8 +296,6 @@ static void aspeed_pcie_rc_class_init(ObjectClass *klass, const void *data)
 
     hc->root_bus_path = aspeed_pcie_rc_root_bus_path;
     device_class_set_props(dc, aspeed_pcie_rc_props);
-
-    msi_nonbroken = true;
 }
 
 /*
Signature · 1 line
2.43.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · Jamin Lin

Setting msi_nonbroken in class_init() affects all machine types, even when the ASPEED PCIe controller is not used.

Move msi_nonbroken to realize() to ensure it is only set when the ASPEED PCIe controller is realized.

Fixes f002aa35f3205d55bbe4a68670ba19a6dcf1d6a8 ("hw/pci-host/aspeed: Add AST2600 PCIe config space and host bridge")

This should also be

Quoted 18 lines
---
 hw/pci-host/aspeed_pcie.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/pci-host/aspeed_pcie.c +2 -0
index b46eb74234..ceb010f213 100644
@@ -181,6 +181,8 @@ static void aspeed_pcie_rc_realize(DeviceState *dev, Error **errp)
     g_autofree char *dram_alias_name = NULL;
     g_autofree char *root_bus_name = NULL;
 
+    msi_nonbroken = true;
+
     /* PCI configuration space */
     pcie_host_mmcfg_init(pex, PCIE_MMCFG_SIZE_MAX);
     sysbus_init_mmio(sbd, &pex->mmio);

hw/pci-host/aspeed_pcie.c static void aspeed_pcie_rc_class_init(ObjectClass *klass, const void *data) · line 299

Quoted 6 lines
hw/pci-host/aspeed_pcie.c +0 -2
@@ -294,8 +296,6 @@ static void aspeed_pcie_rc_class_init(ObjectClass *klass, const void *data)
 
     hc->root_bus_path = aspeed_pcie_rc_root_bus_path;
     device_class_set_props(dc, aspeed_pcie_rc_props);
-
-    msi_nonbroken = true;
 }

thanks
-- PMM

Reviewed-by on v1 1/1
#3 lore raw
In reply to Jamin Lin
Quoted 8 lines · Jamin Lin

Setting msi_nonbroken in class_init() affects all machine types, even when the ASPEED PCIe controller is not used.

Move msi_nonbroken to realize() to ensure it is only set when the ASPEED PCIe controller is realized.

Fixes f002aa35f3205d55bbe4a68670ba19a6dcf1d6a8 ("hw/pci-host/aspeed: Add AST2600 PCIe config space and host bridge")

This commit mentions AST2600 but also enable that for AST2400/2500 and AST2700.

AST2700 wires it in commit ba6fb09048198a2952d731cd063f4307b137e7ec.

AST2400/2500 share hw/arm/aspeed_ast2400.c which has no PCIe host bridge. Previous commits could have been better, but too late, OK.

Suggestion:

The ASPEED PCIe class may be registered for machines that do not instantiate a PCIe root complex. Updating the global msi_nonbroken flag from class_init() therefore affects unrelated machines.

Defer the update to the per-device realize handler, so the flag changes only when an ASPEED PCIe root complex is actually instantiated.

Fixes f002aa35f3 ("hw/pci-host/aspeed: Add AST2600 PCIe host bridge")
Quoted 4 lines
---
  hw/pci-host/aspeed_pcie.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
author
#4 lore raw

Hi Philippe

Quoted 28 lines

Subject: Re: [PATCH v1] hw/pci-host/aspeed_pcie: Fix global MSI setting during class initialization

Quoted 9 lines · Jamin Lin

Setting msi_nonbroken in class_init() affects all machine types, even when the ASPEED PCIe controller is not used.

Move msi_nonbroken to realize() to ensure it is only set when the ASPEED PCIe controller is realized.

Fixes f002aa35f3205d55bbe4a68670ba19a6dcf1d6a8 ("hw/pci-host/aspeed:

Add AST2600 PCIe config space and host bridge")

This commit mentions AST2600 but also enable that for AST2400/2500 and AST2700.

AST2700 wires it in commit ba6fb09048198a2952d731cd063f4307b137e7ec.

AST2400/2500 share hw/arm/aspeed_ast2400.c which has no PCIe host bridge. Previous commits could have been better, but too late, OK.

Suggestion:

The ASPEED PCIe class may be registered for machines that do not instantiate a PCIe root complex. Updating the global msi_nonbroken flag from class_init() therefore affects unrelated machines.

Quoted 7 lines

Defer the update to the per-device realize handler, so the flag changes only when an ASPEED PCIe root complex is actually instantiated.

Fixes f002aa35f3 ("hw/pci-host/aspeed: Add AST2600 PCIe host bridge")

Thanks for the review and suggestion.
I send v2 with your suggested commit message here:

https://patchwork.kernel.org/project/qemu-devel/patch/[email protected]/

Jamin

Quoted 4 lines
Quoted 4 lines
---
  hw/pci-host/aspeed_pcie.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
author
#2 lore raw
In reply to Peter Maydell
Quoted 11 lines

Subject: Re: [PATCH v1] hw/pci-host/aspeed_pcie: Fix global MSI setting during class initialization

Quoted 7 lines · Jamin Lin

Setting msi_nonbroken in class_init() affects all machine types, even when the ASPEED PCIe controller is not used.

Move msi_nonbroken to realize() to ensure it is only set when the ASPEED PCIe controller is realized.

Quoted 9 lines
Quoted 4 lines
Fixes f002aa35f3205d55bbe4a68670ba19a6dcf1d6a8 ("hw/pci-host/aspeed:

Add AST2600 PCIe config space and host bridge")

This should also be

Sorry, I forgot to add the Cc: [email protected] tag to the commit message in v2, but I did CC the mailing list when sending the patch. If needed, I can resend v2 with the tag added.

https://patchwork.kernel.org/project/qemu-devel/patch/[email protected]/

Jamin

Quoted 30 lines

hw/pci-host/aspeed_pcie.c static void aspeed_pcie_rc_realize(DeviceState *dev,

Quoted 9 lines
---
 hw/pci-host/aspeed_pcie.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/pci-host/aspeed_pcie.c +0 -0
index b46eb74234..ceb010f213 100644
@@ -181,6 +181,8 @@ static void aspeed_pcie_rc_realize(DeviceState *dev,

Error **errp)

Quoted 12 lines
hw/pci-host/aspeed_pcie.c +2 -0
     g_autofree char *dram_alias_name = NULL;
     g_autofree char *root_bus_name = NULL;
 
+    msi_nonbroken = true;
+
     /* PCI configuration space */
     pcie_host_mmcfg_init(pex, PCIE_MMCFG_SIZE_MAX);
     sysbus_init_mmio(sbd, &pex->mmio); @@ -294,8 +296,6 @@ static

void aspeed_pcie_rc_class_init(ObjectClass *klass, const void *data)

     hc->root_bus_path = aspeed_pcie_rc_root_bus_path;
     device_class_set_props(dc, aspeed_pcie_rc_props);

hw/pci-host/aspeed_pcie.c static void aspeed_pcie_rc_class_init(ObjectClass *klass, const void *data) · line 299

Quoted 3 lines
hw/pci-host/aspeed_pcie.c +0 -2
-
-    msi_nonbroken = true;
 }

thanks
-- PMM