Implement STM32L4x5 EXTI
Subsystems (2)
v2 cover Implement STM32L4x5 EXTI
This patch allows to emulate the STM32L4x5 EXTI device. It implements register access and software interruptions.
This is RFC since we still have troubles to make all tests pass. More precisely, the line g_assert_true(get_irq(GPIO_0_IRQ)); fails in the software interrupts test. No irq seems to be fired.
(We also tested the stm32f4_exti (on which this implementation is based upon) on but it also fails so don't really know if the test or the implementation is incorrect).
Thank you Philippe for your reviews ! They are really useful ! The code is now more concise and clear.
Also, Inès and I were wondering what would be the next step for our previous patchset that adds support for the B-L475E-IOT01A board and STM32L4x5 SoC.
We used the RFC tag because we were unsure if this met Qemu quality standard.
But now that this has been reviewed, is there anything we should to move it forward and merge it ?
Sincerely,
Arnaud Minier
Changes from v1 to v2:
- use arrays to deduplicate code and logic
- move internal constant EXTI_NUM_GPIO_EVENT_IN_LINES from the header to the .c file
- Improve copyright headers
- replace static const with #define
- use the DEFINE_TYPES macro
- fill the impl and valid field of the exti's MemoryRegionOps
- fix invalid test caused by a last minute change
Based-on: <[email protected]> ([RFC v3 2/2] hw/arm: Add minimal support for the B-L475E-IOT01A board)
Arnaud Minier (1):
Implement STM32L4x5 EXTI
hw/arm/Kconfig | 1 + hw/arm/stm32l4x5_soc.c | 65 ++++++- hw/misc/Kconfig | 3 + hw/misc/meson.build | 1 + hw/misc/stm32l4x5_exti.c | 303 ++++++++++++++++++++++++++++++ hw/misc/trace-events | 5 + include/hw/arm/stm32l4x5_soc.h | 3 + include/hw/misc/stm32l4x5_exti.h | 58 ++++++ tests/qtest/meson.build | 5 + tests/qtest/stm32l4x5_exti-test.c | 104 ++++++++++ 10 files changed, 546 insertions(+), 2 deletions(-) create mode 100644 hw/misc/stm32l4x5_exti.c create mode 100644 include/hw/misc/stm32l4x5_exti.h create mode 100644 tests/qtest/stm32l4x5_exti-test.c
Signature · 1 line
2.38.5
PATCH v2 1/1 Implement STM32L4x5 EXTI
From: Arnaud Minier <[email protected]>
--- hw/arm/Kconfig | 1 + hw/arm/stm32l4x5_soc.c | 65 ++++++- hw/misc/Kconfig | 3 + hw/misc/meson.build | 1 + hw/misc/stm32l4x5_exti.c | 303 ++++++++++++++++++++++++++++++ hw/misc/trace-events | 5 + include/hw/arm/stm32l4x5_soc.h | 3 + include/hw/misc/stm32l4x5_exti.h | 58 ++++++ tests/qtest/meson.build | 5 + tests/qtest/stm32l4x5_exti-test.c | 104 ++++++++++ 10 files changed, 546 insertions(+), 2 deletions(-) create mode 100644 hw/misc/stm32l4x5_exti.c create mode 100644 include/hw/misc/stm32l4x5_exti.h create mode 100644 tests/qtest/stm32l4x5_exti-test.c
hw/arm/Kconfig +1 -0
@@ -458,6 +458,7 @@ config STM32L4X5_SOC bool select ARM_V7M select OR_IRQ + select STM32L4X5_EXTI config XLNX_ZYNQMP_ARM bool
hw/arm/stm32l4x5_soc.c +63 -2
93 lines not on this page · raw message
hw/misc/Kconfig +3 -0
@@ -87,6 +87,9 @@ config STM32F4XX_SYSCFG config STM32F4XX_EXTI bool +config STM32L4X5_EXTI + bool + config MIPS_ITU bool
hw/misc/meson.build +1 -0
@@ -110,6 +110,7 @@ system_ss.add(when: 'CONFIG_XLNX_VERSAL_TRNG', if_true: files( system_ss.add(when: 'CONFIG_STM32F2XX_SYSCFG', if_true: files('stm32f2xx_syscfg.c')) system_ss.add(when: 'CONFIG_STM32F4XX_SYSCFG', if_true: files('stm32f4xx_syscfg.c')) system_ss.add(when: 'CONFIG_STM32F4XX_EXTI', if_true: files('stm32f4xx_exti.c')) +system_ss.add(when: 'CONFIG_STM32L4X5_EXTI', if_true: files('stm32l4x5_exti.c')) system_ss.add(when: 'CONFIG_MPS2_FPGAIO', if_true: files('mps2-fpgaio.c')) system_ss.add(when: 'CONFIG_MPS2_SCC', if_true: files('mps2-scc.c'))
hw/misc/stm32l4x5_exti.c new file +303 -0
303 lines not on this page · raw message
hw/misc/trace-events +5 -0
@@ -163,6 +163,11 @@ stm32f4xx_exti_set_irq(int irq, int level) "Set EXTI: %d to %d" stm32f4xx_exti_read(uint64_t addr) "reg read: addr: 0x%" PRIx64 " " stm32f4xx_exti_write(uint64_t addr, uint64_t data) "reg write: addr: 0x%" PRIx64 " val: 0x%" PRIx64 "" +# stm32l4x5_exti.c +stm32l4x5_exti_set_irq(int irq, int level) "Set EXTI: %d to %d" +stm32l4x5_exti_read(uint64_t addr, uint64_t data) "reg read: addr: 0x%" PRIx64 " val: 0x%" PRIx64 "" +stm32l4x5_exti_write(uint64_t addr, uint64_t data) "reg write: addr: 0x%" PRIx64 " val: 0x%" PRIx64 "" + # tz-mpc.c tz_mpc_reg_read(uint32_t offset, uint64_t data, unsigned size) "TZ MPC regs read: offset 0x%x data 0x%" PRIx64 " size %u" tz_mpc_reg_write(uint32_t offset, uint64_t data, unsigned size) "TZ MPC regs write: offset 0x%x data 0x%" PRIx64 " size %u"
include/hw/arm/stm32l4x5_soc.h +3 -0
@@ -32,6 +32,7 @@#include "qemu/units.h" #include "hw/qdev-core.h" #include "hw/arm/armv7m.h" +#include "hw/misc/stm32l4x5_exti.h" #include "qom/object.h" #define TYPE_STM32L4X5_SOC "stm32l4x5-soc"
@@ -45,6 +46,8 @@ struct Stm32l4x5SocState {ARMv7MState armv7m; +Stm32l4x5ExtiState exti; +MemoryRegion sram1;MemoryRegion sram2;MemoryRegion flash;
include/hw/misc/stm32l4x5_exti.h new file +58 -0
58 lines not on this page · raw message
tests/qtest/meson.build +5 -0
@@ -194,6 +194,10 @@ qtests_aspeed = \ ['aspeed_hace-test', 'aspeed_smc-test', 'aspeed_gpio-test'] + +qtests_stm32l4x5 = \ + ['stm32l4x5_exti-test'] + qtests_arm = \ (config_all_devices.has_key('CONFIG_MPS2') ? ['sse-timer-test'] : []) + \ (config_all_devices.has_key('CONFIG_CMSDK_APB_DUALTIMER') ? ['cmsdk-apb-dualtimer-test'] : []) + \
@@ -207,6 +211,7 @@ qtests_arm = \ (config_all_devices.has_key('CONFIG_TPM_TIS_I2C') ? ['tpm-tis-i2c-test'] : []) + \ (config_all_devices.has_key('CONFIG_VEXPRESS') ? ['test-arm-mptimer'] : []) + \ (config_all_devices.has_key('CONFIG_MICROBIT') ? ['microbit-test'] : []) + \ + (config_all_devices.has_key('CONFIG_STM32L4X5_SOC') ? qtests_stm32l4x5 : []) + \ ['arm-cpu-features', 'boot-serial-test']
tests/qtest/stm32l4x5_exti-test.c new file +104 -0
104 lines not on this page · raw message
Signature · 1 line
2.38.5