[PATCH 2/5] hw/arm/fsl-imx8mp: Fix parent of ocram memory region

Bernhard Beschow posted 5 patches 1 month ago
Maintainers: Bernhard Beschow <shentey@gmail.com>, Peter Maydell <peter.maydell@linaro.org>, Paolo Bonzini <pbonzini@redhat.com>, "Daniel P. Berrangé" <berrange@redhat.com>, Eduardo Habkost <eduardo@habkost.net>
[PATCH 2/5] hw/arm/fsl-imx8mp: Fix parent of ocram memory region
Posted by Bernhard Beschow 1 month ago
Rather than having a NULL parent, let the containing SoC object be the
parent. This cleans up the QOM composition tree a bit.

Fixes: 1aaf3478684f ("hw/arm/fsl-imx8mp: Add on-chip RAM")
cc: Gaurav Sharma <gaurav.sharma_7@nxp.com>
Signed-off-by: Bernhard Beschow <shentey@gmail.com>
---
 hw/arm/fsl-imx8mp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/arm/fsl-imx8mp.c b/hw/arm/fsl-imx8mp.c
index 0119a18416..839c925e4a 100644
--- a/hw/arm/fsl-imx8mp.c
+++ b/hw/arm/fsl-imx8mp.c
@@ -671,7 +671,7 @@ static void fsl_imx8mp_realize(DeviceState *dev, Error **errp)
                     fsl_imx8mp_memmap[FSL_IMX8MP_PCIE_PHY1].addr);
 
     /* On-Chip RAM */
-    if (!memory_region_init_ram(&s->ocram, NULL, "imx8mp.ocram",
+    if (!memory_region_init_ram(&s->ocram, OBJECT(dev), "imx8mp.ocram",
                                 fsl_imx8mp_memmap[FSL_IMX8MP_OCRAM].size,
                                 errp)) {
         return;
-- 
2.53.0
Re: [PATCH 2/5] hw/arm/fsl-imx8mp: Fix parent of ocram memory region
Posted by Peter Maydell 1 month ago
On Sun, 8 Mar 2026 at 20:35, Bernhard Beschow <shentey@gmail.com> wrote:
>
> Rather than having a NULL parent, let the containing SoC object be the
> parent. This cleans up the QOM composition tree a bit.
>
> Fixes:  ("hw/arm/fsl-imx8mp: Add on-chip RAM")
> cc: Gaurav Sharma <gaurav.sharma_7@nxp.com>
> Signed-off-by: Bernhard Beschow <shentey@gmail.com>
> ---
>  hw/arm/fsl-imx8mp.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/arm/fsl-imx8mp.c b/hw/arm/fsl-imx8mp.c
> index 0119a18416..839c925e4a 100644
> --- a/hw/arm/fsl-imx8mp.c
> +++ b/hw/arm/fsl-imx8mp.c
> @@ -671,7 +671,7 @@ static void fsl_imx8mp_realize(DeviceState *dev, Error **errp)
>                      fsl_imx8mp_memmap[FSL_IMX8MP_PCIE_PHY1].addr);
>
>      /* On-Chip RAM */
> -    if (!memory_region_init_ram(&s->ocram, NULL, "imx8mp.ocram",
> +    if (!memory_region_init_ram(&s->ocram, OBJECT(dev), "imx8mp.ocram",
>                                  fsl_imx8mp_memmap[FSL_IMX8MP_OCRAM].size,
>                                  errp)) {
>          return;


This is a migration break, because qemu_ram_set_idstr()
includes the qdev path of the owning device when it
creates the name of the ramblock for migrating it.
But since we haven't released anything with this change in
it and this board isn't versioned either, that's not a problem.

-- PMM
Re: [PATCH 2/5] hw/arm/fsl-imx8mp: Fix parent of ocram memory region
Posted by Markus Armbruster 1 month ago
Bernhard Beschow <shentey@gmail.com> writes:

> Rather than having a NULL parent, let the containing SoC object be the
> parent. This cleans up the QOM composition tree a bit.
>
> Fixes: 1aaf3478684f ("hw/arm/fsl-imx8mp: Add on-chip RAM")
> cc: Gaurav Sharma <gaurav.sharma_7@nxp.com>
> Signed-off-by: Bernhard Beschow <shentey@gmail.com>
> ---
>  hw/arm/fsl-imx8mp.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/arm/fsl-imx8mp.c b/hw/arm/fsl-imx8mp.c
> index 0119a18416..839c925e4a 100644
> --- a/hw/arm/fsl-imx8mp.c
> +++ b/hw/arm/fsl-imx8mp.c
> @@ -671,7 +671,7 @@ static void fsl_imx8mp_realize(DeviceState *dev, Error **errp)
>                      fsl_imx8mp_memmap[FSL_IMX8MP_PCIE_PHY1].addr);
>  
>      /* On-Chip RAM */
> -    if (!memory_region_init_ram(&s->ocram, NULL, "imx8mp.ocram",
> +    if (!memory_region_init_ram(&s->ocram, OBJECT(dev), "imx8mp.ocram",
>                                  fsl_imx8mp_memmap[FSL_IMX8MP_OCRAM].size,
>                                  errp)) {
>          return;

This moves /machine/unattached/imx8mp.ocram[0] to
/machine/soc/imx8mp.ocram[0], as expected.

Reviewed-by: Markus Armbruster <armbru@redhat.com>

Aside: not sure why [0].  Might just be something memory regions do.