All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1] hw/pci-host/aspeed_pcie: Fix global MSI setting during class initialization
@ 2026-10-19  2:44 Jamin Lin
  2026-10-19  9:25 ` Peter Maydell
  2026-10-19 10:11 ` Philippe Mathieu-Daudé
  0 siblings, 2 replies; 5+ messages in thread
From: Jamin Lin @ 2026-10-19  2:44 UTC (permalink / raw)
  To: marcelomanzo@gmail.com, peter.maydell@linaro.org,
	Cédric Le Goater, Kane Chen, open list:ASPEED BMCs,
	open list:All patches CC here
  Cc: Jamin Lin, Troy Lee

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.

Reported-by: Marcelo Manzo <marcelomanzo@gmail.com>
Fixes: f002aa35f3205d55bbe4a68670ba19a6dcf1d6a8 ("hw/pci-host/aspeed: Add AST2600 PCIe config space and host bridge")
Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
---
 hw/pci-host/aspeed_pcie.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/pci-host/aspeed_pcie.c b/hw/pci-host/aspeed_pcie.c
index b46eb74234..ceb010f213 100644
--- a/hw/pci-host/aspeed_pcie.c
+++ b/hw/pci-host/aspeed_pcie.c
@@ -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;
 }
 
 /*
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v1] hw/pci-host/aspeed_pcie: Fix global MSI setting during class initialization
  2026-10-19  2:44 [PATCH v1] hw/pci-host/aspeed_pcie: Fix global MSI setting during class initialization Jamin Lin
@ 2026-10-19  9:25 ` Peter Maydell
  2026-10-20  3:48   ` Jamin Lin
  2026-10-19 10:11 ` Philippe Mathieu-Daudé
  1 sibling, 1 reply; 5+ messages in thread
From: Peter Maydell @ 2026-10-19  9:25 UTC (permalink / raw)
  To: Jamin Lin
  Cc: marcelomanzo@gmail.com, Cédric Le Goater, Kane Chen,
	open list:ASPEED BMCs, open list:All patches CC here, Troy Lee

On Mon, 19 Oct 2026 at 03:44, Jamin Lin <jamin_lin@aspeedtech.com> wrote:
>
> 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.
>
> Reported-by: Marcelo Manzo <marcelomanzo@gmail.com>
> Fixes: f002aa35f3205d55bbe4a68670ba19a6dcf1d6a8 ("hw/pci-host/aspeed: Add AST2600 PCIe config space and host bridge")
> Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>

This should also be

Cc: qemu-stable@nongnu.org

> ---
>  hw/pci-host/aspeed_pcie.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/hw/pci-host/aspeed_pcie.c b/hw/pci-host/aspeed_pcie.c
> index b46eb74234..ceb010f213 100644
> --- a/hw/pci-host/aspeed_pcie.c
> +++ b/hw/pci-host/aspeed_pcie.c
> @@ -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;
>  }

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

thanks
-- PMM


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v1] hw/pci-host/aspeed_pcie: Fix global MSI setting during class initialization
  2026-10-19  2:44 [PATCH v1] hw/pci-host/aspeed_pcie: Fix global MSI setting during class initialization Jamin Lin
  2026-10-19  9:25 ` Peter Maydell
@ 2026-10-19 10:11 ` Philippe Mathieu-Daudé
  2026-10-20  3:43   ` Jamin Lin
  1 sibling, 1 reply; 5+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-10-19 10:11 UTC (permalink / raw)
  To: Jamin Lin, marcelomanzo@gmail.com, peter.maydell@linaro.org,
	Cédric Le Goater, Kane Chen, open list:ASPEED BMCs,
	open list:All patches CC here
  Cc: Troy Lee

On 2026-10-19 4:44, Jamin Lin wrote:
> 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.
> 
> Reported-by: Marcelo Manzo <marcelomanzo@gmail.com>
> 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")
Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>

> Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
> ---
>   hw/pci-host/aspeed_pcie.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)


^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [PATCH v1] hw/pci-host/aspeed_pcie: Fix global MSI setting during class initialization
  2026-10-19 10:11 ` Philippe Mathieu-Daudé
@ 2026-10-20  3:43   ` Jamin Lin
  0 siblings, 0 replies; 5+ messages in thread
From: Jamin Lin @ 2026-10-20  3:43 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, marcelomanzo@gmail.com,
	peter.maydell@linaro.org, Cédric Le Goater, Kane Chen,
	open list:ASPEED BMCs, open list:All patches CC here
  Cc: Troy Lee

Hi Philippe

> Subject: Re: [PATCH v1] hw/pci-host/aspeed_pcie: Fix global MSI setting during
> class initialization
> 
> On 2026-10-19 4:44, Jamin Lin wrote:
> > 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.
> >
> > Reported-by: Marcelo Manzo <marcelomanzo@gmail.com>
> > 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")
> Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
> 

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

https://patchwork.kernel.org/project/qemu-devel/patch/20261020033755.2618640-1-jamin_lin@aspeedtech.com/

Jamin

> > Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
> > ---
> >   hw/pci-host/aspeed_pcie.c | 4 ++--
> >   1 file changed, 2 insertions(+), 2 deletions(-)

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [PATCH v1] hw/pci-host/aspeed_pcie: Fix global MSI setting during class initialization
  2026-10-19  9:25 ` Peter Maydell
@ 2026-10-20  3:48   ` Jamin Lin
  0 siblings, 0 replies; 5+ messages in thread
From: Jamin Lin @ 2026-10-20  3:48 UTC (permalink / raw)
  To: Peter Maydell
  Cc: marcelomanzo@gmail.com, Cédric Le Goater, Kane Chen,
	open list:ASPEED BMCs, open list:All patches CC here, Troy Lee

> Subject: Re: [PATCH v1] hw/pci-host/aspeed_pcie: Fix global MSI setting during
> class initialization
> 
> On Mon, 19 Oct 2026 at 03:44, Jamin Lin <jamin_lin@aspeedtech.com> wrote:
> >
> > 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.
> >
> > Reported-by: Marcelo Manzo <marcelomanzo@gmail.com>
> > Fixes: f002aa35f3205d55bbe4a68670ba19a6dcf1d6a8 ("hw/pci-host/aspeed:
> > Add AST2600 PCIe config space and host bridge")
> > Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
> 
> This should also be
> 
> Cc: qemu-stable@nongnu.org
> 
Sorry, I forgot to add the Cc: qemu-stable@nongnu.org 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/20261020033755.2618640-1-jamin_lin@aspeedtech.com/

Jamin
> > ---
> >  hw/pci-host/aspeed_pcie.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/hw/pci-host/aspeed_pcie.c b/hw/pci-host/aspeed_pcie.c
> > index b46eb74234..ceb010f213 100644
> > --- a/hw/pci-host/aspeed_pcie.c
> > +++ b/hw/pci-host/aspeed_pcie.c
> > @@ -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;
> >  }
> 
> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
> 
> thanks
> -- PMM

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-10-20  3:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-19  2:44 [PATCH v1] hw/pci-host/aspeed_pcie: Fix global MSI setting during class initialization Jamin Lin
2026-10-19  9:25 ` Peter Maydell
2026-10-20  3:48   ` Jamin Lin
2026-10-19 10:11 ` Philippe Mathieu-Daudé
2026-10-20  3:43   ` Jamin Lin

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.