Skip to contentSkip to conversation

i.MX fixes

PATCH Applied Bernhard Beschow 4 participants 11 messages May 1, 2025 – May 6, 2025 Arm i.MX and Layerscape

lore
Share & tools
lore
#0 lore raw

cover i.MX fixes

This series contains two bug fixes related to i.MX SoCs, plus one cosmetic change. The first fix adresses a bug in the Designware PCIe bridge that just got introduced in the 10.1 development cycle, the other one fixes a bug in the i.MX GPIO controller which existed since its introduction.

Bernhard Beschow (3):
hw/pci-host/designware: Remove unused include hw/pci-host/designware: Fix viewport configuration hw/gpio/imx_gpio: Fix interpretation of GDIR polarity

 hw/gpio/imx_gpio.c       | 2 +-
 hw/pci-host/designware.c | 5 ++---
 2 files changed, 3 insertions(+), 4 deletions(-)
Signature · 1 line
2.49.0
#1 lore raw

PATCH 1/3 hw/pci-host/designware: Remove unused include

The DEFINE_TYPES() macro doesn't need the qemu/module.h include.

Fixes 13a07eb146c8 ("hw/pci-host/designware: Declare CPU QOM types using

DEFINE_TYPES() macro")

---
 hw/pci-host/designware.c | 1 -
 1 file changed, 1 deletion(-)
hw/pci-host/designware.c +0 -1
index 183f838392..b4bff14579 100644
@@ -20,7 +20,6 @@
 
 #include "qemu/osdep.h"
 #include "qapi/error.h"
-#include "qemu/module.h"
 #include "qemu/log.h"
 #include "qemu/bitops.h"
 #include "hw/pci/msi.h"
Signature · 1 line
2.49.0
Reviewed-by on v1 1/3
#2 lore raw

Re: [PATCH 1/3] hw/pci-host/designware: Remove unused include

Quoted 4 lines · Bernhard Beschow

The DEFINE_TYPES() macro doesn't need the qemu/module.h include.

Fixes 13a07eb146c8 ("hw/pci-host/designware: Declare CPU QOM types using

DEFINE_TYPES() macro")

The 'Fixes:' tag is for bug being fixed. Here I suggest:

Since commit 13a07eb146c8 ("hw/pci-host/designware: Declare CPU QOM types using DEFINE_TYPES() macro") which removed the type_init() use, we don't need to include "qemu/module.h" anymore.

(I can do the update when applying if you agree).

Quoted 10 lines
---
  hw/pci-host/designware.c | 1 -
  1 file changed, 1 deletion(-)
hw/pci-host/designware.c +0 -0
index 183f838392..b4bff14579 100644

hw/pci-host/designware.c line 25

Quoted 7 lines
hw/pci-host/designware.c +0 -1
@@ -20,7 +20,6 @@
 
  #include "qemu/osdep.h"
  #include "qapi/error.h"
-#include "qemu/module.h"
  #include "qemu/log.h"
  #include "qemu/bitops.h"
  #include "hw/pci/msi.h"
$ git grep -L type_init $(git grep -l qemu/module.h hw) | wc -l
      50
#3 lore raw

Re: [PATCH 1/3] hw/pci-host/designware: Remove unused include

Am 1. Mai 2025 19:02:35 UTC schrieb "Philippe Mathieu-Daudé" <[email protected]>:

Quoted 7 lines · Bernhard Beschow
Quoted 4 lines

The DEFINE_TYPES() macro doesn't need the qemu/module.h include.

Fixes 13a07eb146c8 ("hw/pci-host/designware: Declare CPU QOM types using

DEFINE_TYPES() macro")

The 'Fixes:' tag is for bug being fixed.

I see. Thanks for clarifying!

Quoted 7 lines

Here I suggest:

Since commit 13a07eb146c8 ("hw/pci-host/designware: Declare CPU QOM types using DEFINE_TYPES() macro") which removed the type_init() use, we don't need to include "qemu/module.h" anymore.

(I can do the update when applying if you agree).

Fine with me!

Best regards,
Bernhard

Quoted 23 lines
Quoted 11 lines
---
  hw/pci-host/designware.c | 1 -
  1 file changed, 1 deletion(-)
hw/pci-host/designware.c +0 -0
index 183f838392..b4bff14579 100644

hw/pci-host/designware.c line 24

Quoted 6 lines
hw/pci-host/designware.c +0 -1
@@ -20,7 +20,6 @@
    #include "qemu/osdep.h"
  #include "qapi/error.h"
-#include "qemu/module.h"
  #include "qemu/log.h"
  #include "qemu/bitops.h"
  #include "hw/pci/msi.h"
$ git grep -L type_init $(git grep -l qemu/module.h hw) | wc -l
     50
#4 lore raw

Re: [PATCH 1/3] hw/pci-host/designware: Remove unused include

In reply to Philippe Mathieu-Daudé
Quoted 7 lines · Philippe Mathieu-Daudé
Quoted 4 lines · Bernhard Beschow

The DEFINE_TYPES() macro doesn't need the qemu/module.h include.

Fixes 13a07eb146c8 ("hw/pci-host/designware: Declare CPU QOM types using

DEFINE_TYPES() macro")

The 'Fixes:' tag is for bug being fixed. Here I suggest:

Wasn't that Resolves: that's used for bugs or Buglink: and Fixes: to refer to commits this fixes up? I thought we used Fixes: like that until now.

Regards,
BALATON Zoltan

Quoted 30 lines

Since commit 13a07eb146c8 ("hw/pci-host/designware: Declare CPU QOM types using DEFINE_TYPES() macro") which removed the type_init() use, we don't need to include "qemu/module.h" anymore.

(I can do the update when applying if you agree).

Quoted 10 lines
---
  hw/pci-host/designware.c | 1 -
  1 file changed, 1 deletion(-)
hw/pci-host/designware.c +0 -0
index 183f838392..b4bff14579 100644

hw/pci-host/designware.c line 24

Quoted 6 lines
hw/pci-host/designware.c +0 -1
@@ -20,7 +20,6 @@
    #include "qemu/osdep.h"
  #include "qapi/error.h"
-#include "qemu/module.h"
  #include "qemu/log.h"
  #include "qemu/bitops.h"
  #include "hw/pci/msi.h"
$ git grep -L type_init $(git grep -l qemu/module.h hw) | wc -l
     50
#5 lore raw

Re: [PATCH 1/3] hw/pci-host/designware: Remove unused include

In reply to Philippe Mathieu-Daudé
Quoted 8 lines · Philippe Mathieu-Daudé
Quoted 4 lines · Bernhard Beschow

The DEFINE_TYPES() macro doesn't need the qemu/module.h include.

Fixes 13a07eb146c8 ("hw/pci-host/designware: Declare CPU QOM types using

DEFINE_TYPES() macro")

The 'Fixes:' tag is for bug being fixed.

No, Fixes: is for indicating the commit being fixed, so this commit message is fine. We use Resolves: for gitlab bug URLs (though gitlab itself will parse a URL out of a Fixes: tag too).

We mention this in

https://www.qemu.org/docs/master/devel/submitting-a-patch.html#write-a-meaningful-commit-message

with an example of use.

thanks
-- PMM

#6 lore raw

Re: [PATCH 1/3] hw/pci-host/designware: Remove unused include

Quoted 14 lines · Peter Maydell
Quoted 8 lines · Philippe Mathieu-Daudé
Quoted 4 lines · Bernhard Beschow

The DEFINE_TYPES() macro doesn't need the qemu/module.h include.

Fixes 13a07eb146c8 ("hw/pci-host/designware: Declare CPU QOM types using

DEFINE_TYPES() macro")

The 'Fixes:' tag is for bug being fixed.

No, Fixes: is for indicating the commit being fixed, so this commit message is fine. We use Resolves: for gitlab bug URLs (though gitlab itself will parse a URL out of a Fixes: tag too).

Quoted 5 lines

We mention this in

https://www.qemu.org/docs/master/devel/submitting-a-patch.html#write-a-meaningful-commit-message

with an example of use.

OK, TIL.

#7 lore raw

PATCH 2/3 hw/pci-host/designware: Fix viewport configuration

In reply to Bernhard Beschow

Commit 6970f91ac781, "hw/pci-host/designware: Use deposit/extract API" accidentally introduced a copy-and-paste error, causing Linux 6.14 to hang when initializing the PCIe bridge on the imx8mp-evk machine. This fix corrects the error.

Fixes 6970f91ac781 ("hw/pci-host/designware: Use deposit/extract API")
---
 hw/pci-host/designware.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/pci-host/designware.c +2 -2
index b4bff14579..f6e49ce9b8 100644
@@ -348,14 +348,14 @@ static void designware_pcie_root_config_write(PCIDevice *d, uint32_t address,
 
     case DESIGNWARE_PCIE_ATU_LOWER_BASE:
     case DESIGNWARE_PCIE_ATU_UPPER_BASE:
-        viewport->base = deposit64(root->msi.base,
+        viewport->base = deposit64(viewport->base,
                                    address == DESIGNWARE_PCIE_ATU_LOWER_BASE
                                    ? 0 : 32, 32, val);
         break;
 
     case DESIGNWARE_PCIE_ATU_LOWER_TARGET:
     case DESIGNWARE_PCIE_ATU_UPPER_TARGET:
-        viewport->target = deposit64(root->msi.base,
+        viewport->target = deposit64(viewport->target,
                                      address == DESIGNWARE_PCIE_ATU_LOWER_TARGET
                                      ? 0 : 32, 32, val);
         break;
Signature · 1 line
2.49.0
Reviewed-by on v1 2/3
#8 lore raw

Re: [PATCH 2/3] hw/pci-host/designware: Fix viewport configuration

Quoted 22 lines · Bernhard Beschow

Commit 6970f91ac781, "hw/pci-host/designware: Use deposit/extract API" accidentally introduced a copy-and-paste error, causing Linux 6.14 to hang when initializing the PCIe bridge on the imx8mp-evk machine. This fix corrects the error.

Fixes 6970f91ac781 ("hw/pci-host/designware: Use deposit/extract API")
---
  hw/pci-host/designware.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
hw/pci-host/designware.c +1 -1
index b4bff14579..f6e49ce9b8 100644
@@ -348,14 +348,14 @@ static void designware_pcie_root_config_write(PCIDevice *d, uint32_t address,
 
      case DESIGNWARE_PCIE_ATU_LOWER_BASE:
      case DESIGNWARE_PCIE_ATU_UPPER_BASE:
-        viewport->base = deposit64(root->msi.base,
+        viewport->base = deposit64(viewport->base,
                                     address == DESIGNWARE_PCIE_ATU_LOWER_BASE

hw/pci-host/designware.c static void designware_pcie_root_config_write(PCIDevice *d, uint32_t address, · line 361

Quoted 10 lines
hw/pci-host/designware.c +1 -1
                                     ? 0 : 32, 32, val);
          break;
 
      case DESIGNWARE_PCIE_ATU_LOWER_TARGET:
      case DESIGNWARE_PCIE_ATU_UPPER_TARGET:
-        viewport->target = deposit64(root->msi.base,
+        viewport->target = deposit64(viewport->target,
                                       address == DESIGNWARE_PCIE_ATU_LOWER_TARGET
                                       ? 0 : 32, 32, val);
          break;

Oops sorry :/

#9 lore raw

PATCH 3/3 hw/gpio/imx_gpio: Fix interpretation of GDIR polarity

In reply to Bernhard Beschow

According to the i.MX 8M Plus reference manual, a GPIO pin is configured as an output when the corresponding bit in the GDIR register is set. The function imx_gpio_set_int_line() is intended to be a no-op if the pin is configured as an output, returning early in such cases. However, it inverts the condition. Fix this by returning early when the bit is set.

Fixes f44272809779 ("i.MX: Add GPIO device")
cc qemu-stable
---
 hw/gpio/imx_gpio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/gpio/imx_gpio.c +1 -1
index f23c52af26..450ece4548 100644
@@ -72,7 +72,7 @@ static void imx_gpio_update_int(IMXGPIOState *s)
 static void imx_gpio_set_int_line(IMXGPIOState *s, int line, IMXGPIOLevel level)
 {
     /* if this signal isn't configured as an input signal, nothing to do */
-    if (!extract32(s->gdir, line, 1)) {
+    if (extract32(s->gdir, line, 1)) {
         return;
     }
 
Signature · 1 line
2.49.0
#10 lore raw
In reply to Bernhard Beschow
Quoted 10 lines · Bernhard Beschow

This series contains two bug fixes related to i.MX SoCs, plus one cosmetic change. The first fix adresses a bug in the Designware PCIe bridge that just got introduced in the 10.1 development cycle, the other one fixes a bug in the i.MX GPIO controller which existed since its introduction.

Bernhard Beschow (3):
hw/pci-host/designware: Remove unused include hw/pci-host/designware: Fix viewport configuration hw/gpio/imx_gpio: Fix interpretation of GDIR polarity

Applied to target-arm.next, thanks.

-- PMM