Skip to contentSkip to conversation

hw/arm/aspeed: Sort device IDs and add IO expander test

PATCH Applied Jamin Lin 2 participants 7 messages Oct 5 – Oct 8 Arm/Aspeed machine support

lore
Share & tools
lore

Jamin Lin

author
#0 lore raw

v2 cover hw/arm/aspeed: Sort device IDs and add IO expander test

This series is split out from "[PATCH v1 0/11] hw/arm/aspeed: Use unimp array and table for unimplemented devices" to make the changes easier to review.

v1
1. sorts the ASPEED device IDs alphabetically.

v2
1. Split the device ID sorting change out into a separate series.
2. Fix the IO expander device IDs in the correct order.
3. Add a functional test for IO Expander 1 I2C.

Jamin Lin (2):
hw/arm/aspeed: Sort device IDs alphabetically tests/functional/aarch64/test_aspeed_ast2700a2: Add I2C test for IO
expander 1

 include/hw/arm/aspeed_soc.h                   | 176 +++++++++---------
 .../aarch64/test_aspeed_ast2700a2.py          |   3 +
 2 files changed, 91 insertions(+), 88 deletions(-)
Signature · 1 line
2.43.0
author
#1 lore raw

PATCH v2 1/2 hw/arm/aspeed: Sort device IDs alphabetically

The ASPEED device ID enum has grown over time without a consistent ordering rule. This makes it difficult to determine where new device IDs should be added and reduces readability and maintainability as more devices are introduced.

Sort the device IDs alphabetically to provide a consistent ordering rule. Keep related numbered devices together, such as SPI0, SPI1 and SPI2.

No functional change.

---
 include/hw/arm/aspeed_soc.h | 176 ++++++++++++++++++------------------
 1 file changed, 88 insertions(+), 88 deletions(-)
include/hw/arm/aspeed_soc.h +88 -88
index 38226d9b80..a110385743 100644
@@ -195,64 +195,56 @@ struct AspeedSoCClass {
 };
 
 enum {
-    ASPEED_DEV_VBOOTROM,
-    ASPEED_DEV_SPI_BOOT,
-    ASPEED_DEV_IOMEM,
-    ASPEED_DEV_IOMEM0,
-    ASPEED_DEV_IOMEM1,
-    ASPEED_DEV_UART0,
-    ASPEED_DEV_UART1,
-    ASPEED_DEV_UART2,
-    ASPEED_DEV_UART3,
-    ASPEED_DEV_UART4,
-    ASPEED_DEV_UART5,
-    ASPEED_DEV_UART6,
-    ASPEED_DEV_UART7,
-    ASPEED_DEV_UART8,
-    ASPEED_DEV_UART9,
-    ASPEED_DEV_UART10,
-    ASPEED_DEV_UART11,
-    ASPEED_DEV_UART12,
-    ASPEED_DEV_UART13,
-    ASPEED_DEV_VUART,
-    ASPEED_DEV_FMC,
-    ASPEED_DEV_SPI0,
-    ASPEED_DEV_SPI1,
-    ASPEED_DEV_SPI2,
+    ASPEED_DEV_ACRY,
+    ASPEED_DEV_ADC,
+    ASPEED_DEV_DP,
+    ASPEED_DEV_DPMCU,
     ASPEED_DEV_EHCI1,
     ASPEED_DEV_EHCI2,
     ASPEED_DEV_EHCI3,
     ASPEED_DEV_EHCI4,
-    ASPEED_DEV_VIC,
-    ASPEED_DEV_INTC,
-    ASPEED_DEV_INTCIO,
-    ASPEED_DEV_SDMC,
-    ASPEED_DEV_SCU,
-    ASPEED_DEV_ADC,
-    ASPEED_DEV_SBC,
+    ASPEED_DEV_EMMC,
     ASPEED_DEV_EMMC_BC,
-    ASPEED_DEV_VIDEO,
-    ASPEED_DEV_SRAM0,
-    ASPEED_DEV_SRAM1,
-    ASPEED_DEV_SDHCI,
+    ASPEED_DEV_ESPI,
+    ASPEED_DEV_ETH1,
+    ASPEED_DEV_ETH2,
+    ASPEED_DEV_ETH3,
+    ASPEED_DEV_ETH4,
+    ASPEED_DEV_FMC,
+    ASPEED_DEV_FSI1,
+    ASPEED_DEV_FSI2,
     ASPEED_DEV_GPIO,
     ASPEED_DEV_GPIO_1_8V,
-    ASPEED_DEV_SGPIOM0,
-    ASPEED_DEV_SGPIOM1,
-    ASPEED_DEV_RTC,
-    ASPEED_DEV_TIMER1,
-    ASPEED_DEV_TIMER2,
-    ASPEED_DEV_TIMER3,
-    ASPEED_DEV_TIMER4,
-    ASPEED_DEV_TIMER5,
-    ASPEED_DEV_TIMER6,
-    ASPEED_DEV_TIMER7,
-    ASPEED_DEV_TIMER8,
-    ASPEED_DEV_WDT,
-    ASPEED_DEV_PWM,
-    ASPEED_DEV_LPC,
-    ASPEED_DEV_IBT,
+    ASPEED_DEV_HACE,
     ASPEED_DEV_I2C,
+    ASPEED_DEV_I3C,
+    ASPEED_DEV_IBT,
+    ASPEED_DEV_INTC,
+    ASPEED_DEV_INTCIO,
+    ASPEED_DEV_IOMEM,
+    ASPEED_DEV_IOMEM0,
+    ASPEED_DEV_IOMEM1,
+    ASPEED_DEV_IOEXP0_I2C,
+    ASPEED_DEV_IOEXP1_I2C,
+    ASPEED_DEV_IOEXP0_I3C,
+    ASPEED_DEV_IOEXP1_I3C,
+    ASPEED_DEV_IOEXP0_INTCIO,
+    ASPEED_DEV_IOEXP1_INTCIO,
+    ASPEED_DEV_IPC0,
+    ASPEED_DEV_IPC1,
+    ASPEED_DEV_JTAG0,
+    ASPEED_DEV_JTAG1,
+    ASPEED_DEV_KCS,
+    ASPEED_DEV_LPC,
+    ASPEED_DEV_LTPI_CTRL1,
+    ASPEED_DEV_LTPI_CTRL2,
+    ASPEED_DEV_LTPI_IO0,
+    ASPEED_DEV_LTPI_IO1,
+    ASPEED_DEV_MII1,
+    ASPEED_DEV_MII2,
+    ASPEED_DEV_MII3,
+    ASPEED_DEV_MII4,
+    ASPEED_DEV_OTP,
     ASPEED_DEV_PCIE0,
     ASPEED_DEV_PCIE1,
     ASPEED_DEV_PCIE2,
@@ -263,49 +255,57 @@ enum {
     ASPEED_DEV_PCIE_MMIO1,
     ASPEED_DEV_PCIE_MMIO2,
     ASPEED_DEV_PECI,
-    ASPEED_DEV_ETH1,
-    ASPEED_DEV_ETH2,
-    ASPEED_DEV_ETH3,
-    ASPEED_DEV_ETH4,
-    ASPEED_DEV_MII1,
-    ASPEED_DEV_MII2,
-    ASPEED_DEV_MII3,
-    ASPEED_DEV_MII4,
-    ASPEED_DEV_SDRAM,
-    ASPEED_DEV_XDMA,
-    ASPEED_DEV_EMMC,
-    ASPEED_DEV_KCS,
-    ASPEED_DEV_HACE,
-    ASPEED_DEV_ACRY,
-    ASPEED_DEV_DPMCU,
-    ASPEED_DEV_DP,
-    ASPEED_DEV_I3C,
-    ASPEED_DEV_ESPI,
-    ASPEED_DEV_UDC,
-    ASPEED_DEV_JTAG0,
-    ASPEED_DEV_JTAG1,
-    ASPEED_DEV_FSI1,
-    ASPEED_DEV_FSI2,
+    ASPEED_DEV_PRIC0,
+    ASPEED_DEV_PRIC1,
+    ASPEED_DEV_PWM,
+    ASPEED_DEV_RTC,
+    ASPEED_DEV_SBC,
+    ASPEED_DEV_SCU,
     ASPEED_DEV_SCUIO,
+    ASPEED_DEV_SDHCI,
+    ASPEED_DEV_SDMC,
+    ASPEED_DEV_SDRAM,
+    ASPEED_DEV_SGPIOM0,
+    ASPEED_DEV_SGPIOM1,
     ASPEED_DEV_SLI,
     ASPEED_DEV_SLIIO,
+    ASPEED_DEV_SPI_BOOT,
+    ASPEED_DEV_SPI0,
+    ASPEED_DEV_SPI1,
+    ASPEED_DEV_SPI2,
+    ASPEED_DEV_SRAM0,
+    ASPEED_DEV_SRAM1,
+    ASPEED_DEV_TIMER1,
+    ASPEED_DEV_TIMER2,
+    ASPEED_DEV_TIMER3,
+    ASPEED_DEV_TIMER4,
+    ASPEED_DEV_TIMER5,
+    ASPEED_DEV_TIMER6,
+    ASPEED_DEV_TIMER7,
+    ASPEED_DEV_TIMER8,
+    ASPEED_DEV_UART0,
+    ASPEED_DEV_UART1,
+    ASPEED_DEV_UART2,
+    ASPEED_DEV_UART3,
+    ASPEED_DEV_UART4,
+    ASPEED_DEV_UART5,
+    ASPEED_DEV_UART6,
+    ASPEED_DEV_UART7,
+    ASPEED_DEV_UART8,
+    ASPEED_DEV_UART9,
+    ASPEED_DEV_UART10,
+    ASPEED_DEV_UART11,
+    ASPEED_DEV_UART12,
+    ASPEED_DEV_UART13,
+    ASPEED_DEV_UDC,
+    ASPEED_DEV_VBOOTROM,
+    ASPEED_DEV_VIC,
+    ASPEED_DEV_VIDEO,
+    ASPEED_DEV_VUART,
+    ASPEED_DEV_WDT,
+    ASPEED_DEV_XDMA,
     ASPEED_GIC_DIST,
     ASPEED_GIC_REDIST,
-    ASPEED_DEV_IPC0,
-    ASPEED_DEV_IPC1,
-    ASPEED_DEV_LTPI_CTRL1,
-    ASPEED_DEV_LTPI_CTRL2,
-    ASPEED_DEV_LTPI_IO0,
-    ASPEED_DEV_LTPI_IO1,
-    ASPEED_DEV_IOEXP0_I2C,
-    ASPEED_DEV_IOEXP1_I2C,
-    ASPEED_DEV_IOEXP0_INTCIO,
-    ASPEED_DEV_IOEXP1_INTCIO,
-    ASPEED_DEV_IOEXP0_I3C,
-    ASPEED_DEV_IOEXP1_I3C,
-    ASPEED_DEV_PRIC0,
-    ASPEED_DEV_PRIC1,
-    ASPEED_DEV_OTP,
 };
 
 const char *aspeed_soc_cpu_type(const char * const *valid_cpu_types);
Signature · 1 line
2.43.0
author
#2 lore raw

PATCH v2 2/2 tests/functional/aarch64/test_aspeed_ast2700a2: Add I2C test for IO expander 1

In reply to Jamin Lin

The IO expander test only checks the I2C bus of IO expander 0. The I2C buses of IO expander 1 are not tested, so a wrong interrupt wiring for IO expander 1 can not be detected.

Add a TMP105 device on the first I2C bus of IO expander 1 and check that it can be read from firmware.

---
 tests/functional/aarch64/test_aspeed_ast2700a2.py | 3 +++
 1 file changed, 3 insertions(+)
tests/functional/aarch64/test_aspeed_ast2700a2.py +3 -0
index 01c7c4fdbe..74ef93fc0d 100755
@@ -196,10 +196,13 @@ def test_aarch64_ast2700a2_evb_ioexp_v11_03(self):
         self.vm.set_machine('ast2700a2-evb,fmc-model=w25q512jv')
         self.vm.add_args('-device',
                          'tmp105,bus=ioexp0.0,address=0x4d,id=tmp-test-16')
+        self.vm.add_args('-device',
+                         'tmp105,bus=ioexp1.0,address=0x4d,id=tmp-test-32')
         self.start_ast2700_test('ast2700-dcscm-image', 8)
         self.verify_openbmc_boot_and_login('ast2700-dcscm', False)
         self.do_ast2700_i2c_test(8)
         self.do_ast2700_i2c_test(16)
+        self.do_ast2700_i2c_test(32)
 
 if __name__ == '__main__':
     QemuSystemTest.main()
Signature · 1 line
2.43.0
Reviewed-by on v2 2/2
#3 lore raw

Re: [PATCH v2 2/2] tests/functional/aarch64/test_aspeed_ast2700a2: Add I2C test for IO expander 1

Quoted 20 lines · Jamin Lin

The IO expander test only checks the I2C bus of IO expander 0. The I2C buses of IO expander 1 are not tested, so a wrong interrupt wiring for IO expander 1 can not be detected.

Add a TMP105 device on the first I2C bus of IO expander 1 and check that it can be read from firmware.

---
  tests/functional/aarch64/test_aspeed_ast2700a2.py | 3 +++
  1 file changed, 3 insertions(+)
tests/functional/aarch64/test_aspeed_ast2700a2.py +0 -0
index 01c7c4fdbe..74ef93fc0d 100755
@@ -196,10 +196,13 @@ def test_aarch64_ast2700a2_evb_ioexp_v11_03(self):
          self.vm.set_machine('ast2700a2-evb,fmc-model=w25q512jv')
          self.vm.add_args('-device',
                           'tmp105,bus=ioexp0.0,address=0x4d,id=tmp-test-16')

tests/functional/aarch64/test_aspeed_ast2700a2.py def test_aarch64_ast2700a2_evb_ioexp_v11_03(self): · line 208

Quoted 10 lines
tests/functional/aarch64/test_aspeed_ast2700a2.py +3 -0
+        self.vm.add_args('-device',
+                         'tmp105,bus=ioexp1.0,address=0x4d,id=tmp-test-32')
          self.start_ast2700_test('ast2700-dcscm-image', 8)
          self.verify_openbmc_boot_and_login('ast2700-dcscm', False)
          self.do_ast2700_i2c_test(8)
          self.do_ast2700_i2c_test(16)
+        self.do_ast2700_i2c_test(32)
 
  if __name__ == '__main__':
      QemuSystemTest.main()

Thanks,

C.

#4 lore raw
In reply to Jamin Lin
Quoted 6 lines · Jamin Lin

This series is split out from "[PATCH v1 0/11] hw/arm/aspeed: Use unimp array and table for unimplemented devices" to make the changes easier to review.

v1
1. sorts the ASPEED device IDs alphabetically.

This is already applied to aspeed-next along with :
https://lore.kernel.org/qemu-devel/[email protected]/

Quoted 4 lines

v2
1. Split the device ID sorting change out into a separate series.
2. Fix the IO expander device IDs in the correct order.
3. Add a functional test for IO Expander 1 I2C.

Applied patch 2 to :

https://github.com/legoater/qemu aspeed-next

Thanks,

C.

Quoted 9 lines

Jamin Lin (2):
hw/arm/aspeed: Sort device IDs alphabetically tests/functional/aarch64/test_aspeed_ast2700a2: Add I2C test for IO
expander 1

  include/hw/arm/aspeed_soc.h                   | 176 +++++++++---------
  .../aarch64/test_aspeed_ast2700a2.py          |   3 +
  2 files changed, 91 insertions(+), 88 deletions(-)
author
#5 lore raw

Hi Cédric

Quoted 8 lines

Subject: Re: [PATCH v2 0/2] hw/arm/aspeed: Sort device IDs and add IO expander test

Quoted 4 lines · Jamin Lin

This series is split out from "[PATCH v1 0/11] hw/arm/aspeed: Use unimp array and table for unimplemented devices" to make the changes easier to review.

Quoted 7 lines
Quoted 2 lines

v1
1. sorts the ASPEED device IDs alphabetically.

This is already applied to aspeed-next along with :
https://lore.kernel.org/qemu-devel/20260930072501.2612119-1-jamin_lin@as
peedtech.com/

Please apply the v2 patch instead.

The v1 version breaks the AST2700 IO Expander 1 functionality. This is also why I added a functional test in v2 to catch this issue. As a result, the functional test currently fails on aspeed-next with the v1 patch applied.

The v1 change is:

ASPEED_DEV_IOEXP0_I2C,
ASPEED_DEV_IOEXP0_I3C,
ASPEED_DEV_IOEXP0_INTCIO,
ASPEED_DEV_IOEXP1_I2C,
ASPEED_DEV_IOEXP1_I3C,
ASPEED_DEV_IOEXP1_INTCIO,

The correct ordering in v2 is:
https://patchwork.kernel.org/project/qemu-devel/patch/[email protected]/

+    ASPEED_DEV_IOEXP0_I2C,
+    ASPEED_DEV_IOEXP1_I2C,
+    ASPEED_DEV_IOEXP0_I3C,
+    ASPEED_DEV_IOEXP1_I3C,
+    ASPEED_DEV_IOEXP0_INTCIO,
+    ASPEED_DEV_IOEXP1_INTCIO,

Thanks for your help and support.

Jamin

Quoted 26 lines
Quoted 4 lines

v2
1. Split the device ID sorting change out into a separate series.
2. Fix the IO expander device IDs in the correct order.
3. Add a functional test for IO Expander 1 I2C.

Applied patch 2 to :

https://github.com/legoater/qemu aspeed-next

Thanks,

C.

Quoted 6 lines

Jamin Lin (2):
hw/arm/aspeed: Sort device IDs alphabetically tests/functional/aarch64/test_aspeed_ast2700a2: Add I2C test for IO
expander 1

  include/hw/arm/aspeed_soc.h                   | 176

+++++++++---------

Quoted 3 lines
  .../aarch64/test_aspeed_ast2700a2.py          |   3 +
  2 files changed, 91 insertions(+), 88 deletions(-)
#6 lore raw
Quoted 10 lines · Jamin Lin

Hi Cédric

Quoted 8 lines

Subject: Re: [PATCH v2 0/2] hw/arm/aspeed: Sort device IDs and add IO expander test

Quoted 4 lines · Jamin Lin

This series is split out from "[PATCH v1 0/11] hw/arm/aspeed: Use unimp array and table for unimplemented devices" to make the changes easier to review.

Quoted 8 lines
Quoted 7 lines
Quoted 2 lines

v1
1. sorts the ASPEED device IDs alphabetically.

This is already applied to aspeed-next along with :
https://lore.kernel.org/qemu-devel/20260930072501.2612119-1-jamin_lin@as
peedtech.com/

Please apply the v2 patch instead.

done.

C.

Quoted 54 lines

The v1 version breaks the AST2700 IO Expander 1 functionality. This is also why I added a functional test in v2 to catch this issue. As a result, the functional test currently fails on aspeed-next with the v1 patch applied.

The v1 change is:

ASPEED_DEV_IOEXP0_I2C,
ASPEED_DEV_IOEXP0_I3C,
ASPEED_DEV_IOEXP0_INTCIO,
ASPEED_DEV_IOEXP1_I2C,
ASPEED_DEV_IOEXP1_I3C,
ASPEED_DEV_IOEXP1_INTCIO,

The correct ordering in v2 is:
https://patchwork.kernel.org/project/qemu-devel/patch/[email protected]/

(quoted diff) +6 -0
+    ASPEED_DEV_IOEXP0_I2C,
+    ASPEED_DEV_IOEXP1_I2C,
+    ASPEED_DEV_IOEXP0_I3C,
+    ASPEED_DEV_IOEXP1_I3C,
+    ASPEED_DEV_IOEXP0_INTCIO,
+    ASPEED_DEV_IOEXP1_INTCIO,

Thanks for your help and support.

Jamin

Quoted 26 lines
Quoted 4 lines

v2
1. Split the device ID sorting change out into a separate series.
2. Fix the IO expander device IDs in the correct order.
3. Add a functional test for IO Expander 1 I2C.

Applied patch 2 to :

https://github.com/legoater/qemu aspeed-next

Thanks,

C.

Quoted 6 lines

Jamin Lin (2):
hw/arm/aspeed: Sort device IDs alphabetically tests/functional/aarch64/test_aspeed_ast2700a2: Add I2C test for IO
expander 1

   include/hw/arm/aspeed_soc.h                   | 176

+++++++++---------

Quoted 3 lines
   .../aarch64/test_aspeed_ast2700a2.py          |   3 +
   2 files changed, 91 insertions(+), 88 deletions(-)