aspeed queue
Subsystems (2)
The following changes since commit ae6e281633769bbc7424523d0ca1163e214571ad:
Merge tag 'pull-loongarch-20260302' of https://github.com/gaosong715/qemu into staging (2026-03-05 10:48:38 +0000)
are available in the Git repository at:
https://github.com/legoater/qemu/ tags/pull-aspeed-20260305
for you to fetch changes up to ee357844b13904a826ffa77834cd08e10ba1e9ba:
tests/functional/aarch64/test_aspeed_ast2700fc: Update test ASPEED OpenBMC SDK v11.01 (2026-03-05 18:47:46 +0100)
----------------------------------------------------------------
aspeed queue:
* Add I3C support to QEMU, add an dummy I3C device and extend the Aspeed I3C controller
* Update test ASPEED OpenBMC SDK v11.01
* Fix DMA64 address handling in Aspeed I2C model (AST2700 SoC)
----------------------------------------------------------------
Cédric Le Goater (1):
hw/i3c: Fix array bounds and storage in i3c_addr_is_rsvd()
Jamin Lin (37):
hw/i2c/aspeed_i2c: Fix DMA64 address handling
hw/misc/aspeed_i3c: Move to i3c directory
hw/i3c/aspeed_i3c: Switch to DEFINE_TYPES() and align parent_obj naming hw/i3c: Add bus support
hw/i3c: Split DesignWare I3C out of Aspeed I3C
hw/i3c/dw-i3c: Add more register fields
hw/i3c/aspeed_i3c: Add more register fields
hw/i3c/dw-i3c: Add more reset values
hw/i3c/aspeed_i3c: Add register RO field masks
hw/i3c/dw-i3c: Add register RO field masks
hw/i3c/dw-i3c: Treat more registers as read-as-zero
hw/i3c/dw-i3c: Use 32 bits on MMIO writes
hw/i3c/dw-i3c: Add IRQ MMIO behavior
hw/i3c/dw-i3c: Add data TX and RX
hw/i3c/dw-i3c: Add IBI handling
hw/i3c/dw-i3c: Add ctrl MMIO handling
hw/i3c/dw-i3c: Add controller resets
hw/i3c/aspeed: Add I3C bus get function
hw/i3c: Add Mock target
hw/arm/aspeed: Build with I3C_DEVICES
hw/i3c: Add hotplug support tests/functional/arm/test_aspeed_ast2600_sdk: Add i3c functional test
MAINTAINERS: Add I3C maintainers and reviewer
hw/i3c/dw-i3c: Use ROUND_UP() for RX buffer allocation alignment hw/i3c/mock-i3c-target: Set num_sent in TX callback to fix trace reporting hw/i3c/core: Initialize num_sent in i3c_send_byte() hw/i3c/mock-i3c-target: Simplify GETMRL byte extraction logic tests/functional/arm/test_aspeed_ast1030: Update test ASPEED Zephyr SDK v03.06 tests/functional/arm/test_aspeed_ast1060: Update test aspeed-zephyr-project v03.05 tests/functional/arm/test_aspeed_ast2500_sdk: Update test ASPEED OpenBMC SDK v11.01 tests/functional/arm/test_aspeed_ast2500_sdk_515: Update test ASPEED OpenBMC SDK v11.01 tests/functional/arm/test_aspeed_ast2600_sdk: Update test ASPEED OpenBMC SDK v11.01 tests/functional/arm/test_aspeed_ast2600_sdk_otp: Update test ASPEED OpenBMC SDK v11.01 tests/functional/arm/test_aspeed_ast2600_sdk_515: Update test ASPEED OpenBMC SDK v11.01 tests/functional/aarch64/test_aspeed_ast2700a1: Update test ASPEED OpenBMC SDK v11.01 tests/functional/aarch64/test_aspeed_ast2700a2: Update test ASPEED OpenBMC SDK v11.01 tests/functional/aarch64/test_aspeed_ast2700fc: Update test ASPEED OpenBMC SDK v11.01
MAINTAINERS | 13 +
meson.build | 1 +
hw/i3c/trace.h | 2 +
include/hw/arm/aspeed_soc.h | 2 +-
include/hw/{misc => i3c}/aspeed_i3c.h | 31 +-
include/hw/i3c/dw-i3c.h | 199 +++
include/hw/i3c/i3c.h | 277 +++
include/hw/i3c/mock-i3c-target.h | 52 +
hw/i2c/aspeed_i2c.c | 4 +-
hw/i3c/aspeed_i3c.c | 258 +++
hw/i3c/core.c | 664 +++++++
hw/i3c/dw-i3c.c | 1862 ++++++++++++++++++++
hw/i3c/mock-i3c-target.c | 303 ++++
hw/misc/aspeed_i3c.c | 383 ----
hw/Kconfig | 1 +
hw/arm/Kconfig | 3 +
hw/i3c/Kconfig | 15 +
hw/i3c/meson.build | 6 +
hw/i3c/trace-events | 48 +
hw/meson.build | 1 +
hw/misc/meson.build | 1 -
hw/misc/trace-events | 6 -
tests/functional/aarch64/test_aspeed_ast2700a1.py | 30 +-
tests/functional/aarch64/test_aspeed_ast2700a2.py | 30 +-
tests/functional/aarch64/test_aspeed_ast2700fc.py | 18 +-
tests/functional/arm/test_aspeed_ast1030.py | 12 +-
tests/functional/arm/test_aspeed_ast1060.py | 14 +-
tests/functional/arm/test_aspeed_ast2500_sdk.py | 8 +-
.../functional/arm/test_aspeed_ast2500_sdk_515.py | 8 +-
tests/functional/arm/test_aspeed_ast2600_sdk.py | 22 +-
.../functional/arm/test_aspeed_ast2600_sdk_515.py | 10 +-
.../functional/arm/test_aspeed_ast2600_sdk_otp.py | 10 +-
32 files changed, 3805 insertions(+), 489 deletions(-)
create mode 100644 hw/i3c/trace.h
rename include/hw/{misc => i3c}/aspeed_i3c.h (53%)
create mode 100644 include/hw/i3c/dw-i3c.h
create mode 100644 include/hw/i3c/i3c.h
create mode 100644 include/hw/i3c/mock-i3c-target.h
create mode 100644 hw/i3c/aspeed_i3c.c
create mode 100644 hw/i3c/core.c
create mode 100644 hw/i3c/dw-i3c.c
create mode 100644 hw/i3c/mock-i3c-target.c
delete mode 100644 hw/misc/aspeed_i3c.c
create mode 100644 hw/i3c/Kconfig
create mode 100644 hw/i3c/meson.build
create mode 100644 hw/i3c/trace-events[PULL 02/38] hw/misc/aspeed_i3c: Move to i3c directory
From: Jamin Lin <[email protected]>
Moves the Aspeed I3C model and traces into hw/i3c and creates I3C build files.
---
meson.build | 1 +
hw/i3c/trace.h | 2 ++
include/hw/arm/aspeed_soc.h | 2 +-
include/hw/{misc => i3c}/aspeed_i3c.h | 0
hw/{misc => i3c}/aspeed_i3c.c | 2 +-
hw/Kconfig | 1 +
hw/arm/Kconfig | 1 +
hw/i3c/Kconfig | 2 ++
hw/i3c/meson.build | 3 +++
hw/i3c/trace-events | 7 +++++++
hw/meson.build | 1 +
hw/misc/meson.build | 1 -
hw/misc/trace-events | 6 ------
13 files changed, 20 insertions(+), 9 deletions(-)
create mode 100644 hw/i3c/trace.h
rename include/hw/{misc => i3c}/aspeed_i3c.h (100%)
rename hw/{misc => i3c}/aspeed_i3c.c (99%)
create mode 100644 hw/i3c/Kconfig
create mode 100644 hw/i3c/meson.build
create mode 100644 hw/i3c/trace-eventsmeson.build +1 -0
@@ -3614,6 +3614,7 @@ if have_system 'hw/fsi', 'hw/hyperv', 'hw/i2c', + 'hw/i3c', 'hw/i386', 'hw/i386/xen', 'hw/i386/kvm',
hw/i3c/trace.h new file +2 -0
@@ -0,0 +1,2 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +#include "trace/trace-hw_i3c.h"
include/hw/arm/aspeed_soc.h +1 -1
@@ -23,7 +23,7 @@#include "hw/timer/aspeed_timer.h" #include "hw/rtc/aspeed_rtc.h" #include "hw/i2c/aspeed_i2c.h" -#include "hw/misc/aspeed_i3c.h" +#include "hw/i3c/aspeed_i3c.h" #include "hw/ssi/aspeed_smc.h" #include "hw/misc/aspeed_hace.h" #include "hw/misc/aspeed_sbc.h"
include/hw/i3c/aspeed_i3c.h renamed from include/hw/misc/aspeed_i3c.h +0 -0
hw/i3c/aspeed_i3c.c renamed from hw/misc/aspeed_i3c.c +1 -1
@@ -10,7 +10,7 @@#include "qemu/osdep.h" #include "qemu/log.h" #include "qemu/error-report.h" -#include "hw/misc/aspeed_i3c.h" +#include "hw/i3c/aspeed_i3c.h" #include "hw/core/registerfields.h" #include "hw/core/qdev-properties.h" #include "qapi/error.h"
hw/Kconfig +1 -0
@@ -13,6 +13,7 @@ source fsi/Kconfig source gpio/Kconfig source hyperv/Kconfig source i2c/Kconfig +source i3c/Kconfig source ide/Kconfig source input/Kconfig source intc/Kconfig
hw/arm/Kconfig +1 -0
@@ -545,6 +545,7 @@ config ASPEED_SOC select DS1338 select FTGMAC100 select I2C + select I3C select DPS310 select PCA9552 select PCA9554
hw/i3c/Kconfig new file +2 -0
@@ -0,0 +1,2 @@ +config I3C + bool
hw/i3c/meson.build new file +3 -0
@@ -0,0 +1,3 @@ +i3c_ss = ss.source_set() +i3c_ss.add(when: 'CONFIG_ASPEED_SOC', if_true: files('aspeed_i3c.c')) +system_ss.add_all(when: 'CONFIG_I3C', if_true: i3c_ss)
hw/i3c/trace-events new file +7 -0
@@ -0,0 +1,7 @@ +# See docs/devel/tracing.rst for syntax documentation. + +# aspeed_i3c.c +aspeed_i3c_read(uint64_t offset, uint64_t data) "I3C read: offset 0x%" PRIx64 " data 0x%" PRIx64 +aspeed_i3c_write(uint64_t offset, uint64_t data) "I3C write: offset 0x%" PRIx64 " data 0x%" PRIx64 +aspeed_i3c_device_read(uint32_t deviceid, uint64_t offset, uint64_t data) "I3C Dev[%u] read: offset 0x%" PRIx64 " data 0x%" PRIx64 +aspeed_i3c_device_write(uint32_t deviceid, uint64_t offset, uint64_t data) "I3C Dev[%u] write: offset 0x%" PRIx64 " data 0x%" PRIx64
hw/meson.build +1 -0
@@ -35,6 +35,7 @@ subdir('dma') subdir('gpio') subdir('hyperv') subdir('i2c') +subdir('i3c') subdir('ide') subdir('input') subdir('intc')
hw/misc/meson.build +0 -1
@@ -135,7 +135,6 @@ system_ss.add(when: 'CONFIG_PVPANIC_MMIO', if_true: files('pvpanic-mmio.c')) system_ss.add(when: 'CONFIG_AUX', if_true: files('auxbus.c')) system_ss.add(when: 'CONFIG_ASPEED_SOC', if_true: files( 'aspeed_hace.c', - 'aspeed_i3c.c', 'aspeed_lpc.c', 'aspeed_ltpi.c', 'aspeed_pwm.c',
hw/misc/trace-events +0 -6
@@ -293,12 +293,6 @@ armsse_mhu_write(uint64_t offset, uint64_t data, unsigned size) "SSE-200 MHU wri # aspeed_xdma.c aspeed_xdma_write(uint64_t offset, uint64_t data) "XDMA write: offset 0x%" PRIx64 " data 0x%" PRIx64 -# aspeed_i3c.c -aspeed_i3c_read(uint64_t offset, uint64_t data) "I3C read: offset 0x%" PRIx64 " data 0x%" PRIx64 -aspeed_i3c_write(uint64_t offset, uint64_t data) "I3C write: offset 0x%" PRIx64 " data 0x%" PRIx64 -aspeed_i3c_device_read(uint32_t deviceid, uint64_t offset, uint64_t data) "I3C Dev[%u] read: offset 0x%" PRIx64 " data 0x%" PRIx64 -aspeed_i3c_device_write(uint32_t deviceid, uint64_t offset, uint64_t data) "I3C Dev[%u] write: offset 0x%" PRIx64 " data 0x%" PRIx64 - # aspeed_pwm.c aspeed_pwm_read(uint64_t offset, uint64_t data) "read: offset 0x%" PRIx64 " data 0x%" PRIx64 aspeed_pwm_write(uint64_t offset, uint64_t data) "write: offset 0x%" PRIx64 " data 0x%" PRIx64
Signature · 1 line
2.53.0
[PULL 03/38] hw/i3c/aspeed_i3c: Switch to DEFINE_TYPES() and align parent_obj naming
In reply to Cédric Le GoaterFrom: Jamin Lin <[email protected]>
Following review feedback, update the Aspeed I3C device to use the DEFINE_TYPES() macro instead of an explicit type registration function.
DEFINE_TYPES() is the currently recommended approach in QEMU for registering multiple TypeInfo entries and avoids boilerplate type_init() code.
Additionally, rename embedded SysBusDevice fields from "parent" to "parent_obj" to comply with the QEMU coding style guidelines for QOM objects.
No functional change.
--- include/hw/i3c/aspeed_i3c.h | 16 ++++++---------- hw/i3c/aspeed_i3c.c | 35 +++++++++++++++-------------------- 2 files changed, 21 insertions(+), 30 deletions(-)
include/hw/i3c/aspeed_i3c.h +6 -10
@@ -21,28 +21,24 @@ OBJECT_DECLARE_TYPE(AspeedI3CState, AspeedI3CClass, ASPEED_I3C)#define ASPEED_I3C_NR_DEVICES 6 OBJECT_DECLARE_SIMPLE_TYPE(AspeedI3CDevice, ASPEED_I3C_DEVICE) -typedef struct AspeedI3CDevice { -/* <private> */ -SysBusDevice parent; +struct AspeedI3CDevice { +SysBusDevice parent_obj; -/* <public> */ MemoryRegion mr;qemu_irq irq;uint8_t id;uint32_t regs[ASPEED_I3C_DEVICE_NR_REGS ]; -}AspeedI3CDevice ; +}; -typedef struct AspeedI3CState { -/* <private> */ -SysBusDevice parent; +struct AspeedI3CState { +SysBusDevice parent_obj; -/* <public> */ MemoryRegion iomem;MemoryRegion iomem_container;qemu_irq irq;uint32_t regs[ASPEED_I3C_NR_REGS ];AspeedI3CDevice devices[ASPEED_I3C_NR_DEVICES ]; -}AspeedI3CState ; +};#endif /* ASPEED_I3C_H */
hw/i3c/aspeed_i3c.c +15 -20
@@ -337,13 +337,6 @@ static void aspeed_i3c_device_class_init(ObjectClass *klass, const void *data)device_class_set_props (dc, aspeed_i3c_device_properties); } -static const TypeInfo aspeed_i3c_device_info = { - .name =TYPE_ASPEED_I3C_DEVICE , - .parent =TYPE_SYS_BUS_DEVICE , - .instance_size =sizeof (AspeedI3CDevice), - .class_init = aspeed_i3c_device_class_init, -}; -static const VMStateDescription vmstate_aspeed_i3c = { .name =TYPE_ASPEED_I3C , .version_id =1 ,
@@ -366,18 +359,20 @@ static void aspeed_i3c_class_init(ObjectClass *klass, const void *data) dc->vmsd = &vmstate_aspeed_i3c; } -static const TypeInfo aspeed_i3c_info = { - .name =TYPE_ASPEED_I3C , - .parent =TYPE_SYS_BUS_DEVICE , - .instance_init = aspeed_i3c_instance_init, - .instance_size =sizeof (AspeedI3CState), - .class_init = aspeed_i3c_class_init, +static const TypeInfo aspeed_i3c_types[] = { + { + .name =TYPE_ASPEED_I3C , + .parent =TYPE_SYS_BUS_DEVICE , + .instance_init = aspeed_i3c_instance_init, + .instance_size =sizeof (AspeedI3CState), + .class_init = aspeed_i3c_class_init, + }, + { + .name =TYPE_ASPEED_I3C_DEVICE , + .parent =TYPE_SYS_BUS_DEVICE , + .instance_size =sizeof (AspeedI3CDevice), + .class_init = aspeed_i3c_device_class_init, + }, }; -static void aspeed_i3c_register_types (void ) -{ -type_register_static (&aspeed_i3c_device_info); -type_register_static (&aspeed_i3c_info); -} - -type_init (aspeed_i3c_register_types); +DEFINE_TYPES (aspeed_i3c_types)
Signature · 1 line
2.53.0
[PULL 01/38] hw/i2c/aspeed_i2c: Fix DMA64 address handling
In reply to Cédric Le GoaterFrom: Jamin Lin <[email protected]>
The current code updates the upper 32 bits of dma_dram_offset only when aic->has_dma64 is false, which is incorrect.
If aic->has_dma64 is true, the controller supports 64-bit DMA addressing and the upper 32-bit DMA address register must be used to update the dma_dram_offset accordingly.
Fix the condition so that the upper 32 bits are updated only when 64-bit DMA is supported.
--- hw/i2c/aspeed_i2c.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
hw/i2c/aspeed_i2c.c +2 -2
@@ -237,7 +237,7 @@ static void aspeed_i2c_set_tx_dma_dram_offset(AspeedI2CBus *bus) bus->dma_dram_offset =deposit64 (bus->dma_dram_offset,0 ,32 ,FIELD_EX32 (value,I2CM_DMA_TX_ADDR ,ADDR )); -if (!aic->has_dma64) { +if (aic->has_dma64) { value = bus->regs[R_I2CM_DMA_TX_ADDR_HI ]; bus->dma_dram_offset = deposit64(bus->dma_dram_offset, 32, 32,
@@ -262,7 +262,7 @@ static void aspeed_i2c_set_rx_dma_dram_offset(AspeedI2CBus *bus) bus->dma_dram_offset =deposit64 (bus->dma_dram_offset,0 ,32 ,FIELD_EX32 (value,I2CM_DMA_RX_ADDR ,ADDR )); -if (!aic->has_dma64) { +if (aic->has_dma64) { value = bus->regs[R_I2CM_DMA_RX_ADDR_HI ]; bus->dma_dram_offset = deposit64(bus->dma_dram_offset, 32, 32,
Signature · 1 line
2.53.0
[PULL 04/38] hw/i3c: Add bus support
In reply to Cédric Le GoaterFrom: Jamin Lin <[email protected]>
Adds an I3C bus and a target class.
The bus supports:
- I3C data transmission and reception
- CCCs (including ENTDAA)
- IBIs
- legacy I2C transactions
General usage of the bus is similar to I2C. Users are expected to initialize a bus via i3c_init_bus, and use the bus returned from the init function to do transactions on the bus.
In order to handle IBIs, the controller provides callbacks to handle receiving an IBI from a target, receiving (optional) additional IBI bytes from a target, and handling when a target is done with its IBI.
Similarly, target creation is done via i3c_target_create_simple and users use the provided I3CTarget to handle transactions. The target has functions provided that it can use to invoke an IBI and send additional bytes.
Along with the send, recv, and event callbacks that are expected of an I3C target, which are similar to I2C, there is a separate callback for CCC handling.
This is to help encapsulate CCC handling and keep it separate from target-specific read/write functionality.
To avoid repition for required CCCs among I3C targets, there is some class-level CCC handling added. The CCC is then passed to the target in case it needs to handle it in some way.
--- include/hw/i3c/i3c.h | 277 ++++++++++++++++++ hw/i3c/core.c | 647 +++++++++++++++++++++++++++++++++++++++++++ hw/i3c/meson.build | 1 + hw/i3c/trace-events | 16 ++ 4 files changed, 941 insertions(+) create mode 100644 include/hw/i3c/i3c.h create mode 100644 hw/i3c/core.c
include/hw/i3c/i3c.h new file +277 -0
@@ -0,0 +1,277 @@ +/* +* QEMU I3C bus interface. +* +* Copyright 2025 Google LLC +* +* SPDX-License-Identifier: GPL-2.0-or-later +*/ + +#ifndef QEMU_INCLUDE_HW_I3C_I3C_H_ +#define QEMU_INCLUDE_HW_I3C_I3C_H_ + +#include "hw/core/qdev.h" +#include "qom/object.h" +#include "hw/i2c/i2c.h" + +#define TYPE_I3C_TARGET "i3c-target" +OBJECT_DECLARE_TYPE(I3CTarget, I3CTargetClass, I3C_TARGET) + +typedef enum I3CEvent { +I3C_START_RECV , +I3C_START_SEND , +I3C_STOP , +I3C_NACK , +}I3CEvent ; + +typedef enum I3CCCC { +/* Broadcast CCCs */ +I3C_CCC_ENEC =0x00 , +I3C_CCC_DISEC =0x01 , +I3C_CCC_ENTAS0 =0x02 , +I3C_CCC_ENTAS1 =0x03 , +I3C_CCC_ENTAS2 =0x04 , +I3C_CCC_ENTAS3 =0x05 , +I3C_CCC_RSTDAA =0x06 , +I3C_CCC_ENTDAA =0x07 , +I3C_CCC_DEFTGTS =0x08 , +I3C_CCC_SETMWL =0x09 , +I3C_CCC_SETMRL =0x0a , +I3C_CCC_ENTTM =0x0b , +I3C_CCC_SETBUSCON =0x0c , +I3C_CCC_ENDXFER =0x12 , +I3C_CCC_ENTHDR0 =0x20 , +I3C_CCC_ENTHDR1 =0x21 , +I3C_CCC_ENTHDR2 =0x22 , +I3C_CCC_ENTHDR3 =0x23 , +I3C_CCC_ENTHDR4 =0x24 , +I3C_CCC_ENTHDR5 =0x25 , +I3C_CCC_ENTHDR6 =0x26 , +I3C_CCC_ENTHDR7 =0x27 , +I3C_CCC_SETXTIME =0x28 , +I3C_CCC_SETAASA =0x29 , +I3C_CCC_RSTACT =0x2a , +I3C_CCC_DEFGRPA =0x2b , +I3C_CCC_RSTGRPA =0x2c , +I3C_CCC_MLANE =0x2d , +/* Direct CCCs */ +I3C_CCCD_ENEC =0x80 , +I3C_CCCD_DISEC =0x81 , +I3C_CCCD_ENTAS0 =0x82 , +I3C_CCCD_ENTAS1 =0x83 , +I3C_CCCD_ENTAS2 =0x84 , +I3C_CCCD_ENTAS3 =0x85 , +I3C_CCCD_SETDASA =0x87 , +I3C_CCCD_SETNEWDA =0x88 , +I3C_CCCD_SETMWL =0x89 , +I3C_CCCD_SETMRL =0x8a , +I3C_CCCD_GETMWL =0x8b , +I3C_CCCD_GETMRL =0x8c , +I3C_CCCD_GETPID =0x8d , +I3C_CCCD_GETBCR =0x8e , +I3C_CCCD_GETDCR =0x8f , +I3C_CCCD_GETSTATUS =0x90 , +I3C_CCCD_GETACCCR =0x91 , +I3C_CCCD_ENDXFER =0x92 , +I3C_CCCD_SETBRGTGT =0x93 , +I3C_CCCD_GETMXDS =0x94 , +I3C_CCCD_GETCAPS =0x95 , +I3C_CCCD_SETROUTE =0x96 , +I3C_CCCD_SETXTIME =0x98 , +I3C_CCCD_GETXTIME =0x99 , +I3C_CCCD_RSTACT =0x9a , +I3C_CCCD_SETGRPA =0x9b , +I3C_CCCD_RSTGRPA =0x9c , +I3C_CCCD_MLANE =0x9d , +}I3CCCC ; + +#define CCC_IS_DIRECT (_ccc) (_ccc & 0x80) + +#define I3C_BROADCAST 0x7e +#define I3C_HJ_ADDR 0x02 +#define I3C_ENTDAA_SIZE 8 + +struct I3CTargetClass { +DeviceClass parent_class; + +/* +* Controller to target. Returns 0 for success, non-zero for NAK or other +* error. +*/ +int (*send)(I3CTarget *s,const uint8_t *data,uint32_t num_to_send, +uint32_t *num_sent); +/* +* Target to controller. I3C targets are able to terminate reads early, so +* this returns the number of bytes read from the target. +*/ +uint32_t (*recv)(I3CTarget *s,uint8_t *data,uint32_t num_to_read); +/* Notify the target of a bus state change. */ +int (*event)(I3CTarget *s,enum I3CEvent event); +/* +* Handle a read CCC transmitted from a controller. +* CCCs are I3C commands that I3C targets support. +* The target can NACK the CCC if it does not support it. +*/ +int (*handle_ccc_read)(I3CTarget *s,uint8_t *data,uint32_t num_to_read, +uint32_t *num_read); +/* +* Handle a write CCC transmitted from a controller. +* CCCs are I3C commands that I3C targets support. +* The target can NACK the CCC if it does not support it. +*/ +int (*handle_ccc_write)(I3CTarget *s,const uint8_t *data, +uint32_t num_to_send,uint32_t *num_sent); + +/* +* Matches and adds the candidate if the address matches the candidate's +* address. +* Returns true if the address matched, or if this was a broadcast, and +* updates the device list. Otherwise returns false. +*/ +bool (*target_match)(I3CTarget *candidate,uint8_t address,bool is_read, +bool broadcast,bool in_entdaa); +}; + +struct I3CTarget { +DeviceState parent_obj; + +uint8_t address; +uint8_t static_address; +uint8_t dcr; +uint8_t bcr; +uint64_t pid; + +/* CCC State tracking. */ +I3CCCC curr_ccc; +uint8_t ccc_byte_offset; +bool in_ccc; +bool in_test_mode; +}; + +struct I3CNode { +I3CTarget *target; +QLIST_ENTRY (I3CNode) next; +}; + +typedef struct I3CNode I3CNode ; + +typedef QLIST_HEAD(I3CNodeList, I3CNode) I3CNodeList; + +#define TYPE_I3C_BUS "i3c-bus" +OBJECT_DECLARE_TYPE(I3CBus, I3CBusClass, I3C_BUS) + +struct I3CBus { +BusState parent_obj; + +/* Legacy I2C. */ +I2CBus *i2c_bus; + +I3CNodeList current_devs; +bool broadcast; +uint8_t ccc; +bool in_ccc; +bool in_entdaa; +uint8_t saved_address; +}; + +struct I3CBusClass { +BusClass parent_class; + +/* Handle an incoming IBI request from a target */ +int (*ibi_handle) (I3CBus *bus,uint8_t addr,bool is_recv); +/* Receive data from an IBI request */ +int (*ibi_recv) (I3CBus *bus,uint8_t data); +/* Do anything that needs to be done, since the IBI is finished. */ +int (*ibi_finish) (I3CBus *bus); +}; + +I3CBus *i3c_init_bus (DeviceState *parent,const char *name); +I3CBus *i3c_init_bus_type (const char *type,DeviceState *parent, +const char *name); +void i3c_set_target_address (I3CTarget *dev,uint8_t address); +bool i3c_bus_busy (I3CBus *bus); + +/* +* Start a transfer on an I3C bus. +* If is_recv is known at compile-time (i.e. a device will always be sending or +* will always be receiving at a certain point), prefer to use i3c_start_recv or +* i3c_start_send instead. +* +* Returns 0 on success, non-zero on an error. +*/ +int i3c_start_transfer (I3CBus *bus,uint8_t address,bool is_recv); + +/* +* Start a receive transfer on an I3C bus. +* +* Returns 0 on success, non-zero on an error +*/ +int i3c_start_recv (I3CBus *bus,uint8_t address); + +/* +* Start a send transfer on an I3C bus. +* +* Returns 0 on success, non-zero on an error +*/ +int i3c_start_send (I3CBus *bus,uint8_t address); + +void i3c_end_transfer (I3CBus *bus); +void i3c_nack (I3CBus *bus); +int i3c_send_byte (I3CBus *bus,uint8_t data); +int i3c_send (I3CBus *bus,const uint8_t *data,uint32_t num_to_send, +uint32_t *num_sent); +/* +* I3C receives can only NACK on a CCC. The target should NACK a CCC it does not +* support. +*/ +int i3c_recv_byte (I3CBus *bus,uint8_t *data); +int i3c_recv (I3CBus *bus,uint8_t *data,uint32_t num_to_read, +uint32_t *num_read); +bool i3c_scan_bus (I3CBus *bus,uint8_t address,enum I3CEvent event); +int i3c_do_entdaa (I3CBus *bus,uint8_t address,uint64_t *pid,uint8_t *bcr, +uint8_t *dcr); +int i3c_start_device_transfer (I3CTarget *dev,int send_length); +bool i3c_target_match_and_add (I3CBus *bus,I3CTarget *target,uint8_t address, +enum I3CEvent event); +int i3c_target_send_ibi (I3CTarget *t,uint8_t addr,bool is_recv); +int i3c_target_send_ibi_bytes (I3CTarget *t,uint8_t data); +int i3c_target_ibi_finish (I3CTarget *t,uint8_t data); + +/* +* Legacy I2C functions. +* +* These are wrapper for I2C functions that take in an I3C bus instead of an I2C +* bus. Internally they use the I2C bus (and devices attached to it) that's a +* part of the I3C bus +*/ +void legacy_i2c_nack (I3CBus *bus); +uint8_t legacy_i2c_recv (I3CBus *bus); +int legacy_i2c_send (I3CBus *bus,uint8_t data); +int legacy_i2c_start_transfer (I3CBus *bus,uint8_t address,bool is_recv); +int legacy_i2c_start_recv (I3CBus *bus,uint8_t address); +int legacy_i2c_start_send (I3CBus *bus,uint8_t address); +void legacy_i2c_end_transfer (I3CBus *bus); +I2CSlave *legacy_i2c_device_create_simple (I3CBus *bus,const char *name, +uint8_t addr); + +/** +* Create an I3C Target. +* +* The target returned from this function still needs to be realized. +*/ +I3CTarget *i3c_target_new (const char *name,uint8_t addr,uint8_t dcr, +uint8_t bcr,uint64_t pid); + +/** +* Create and realize an I3C target. +* +* Create the target, initialize it, put it on the specified I3C bus, and +* realize it. +*/ +I3CTarget *i3c_target_create_simple (I3CBus *bus,const char *name, +uint8_t addr,uint8_t dcr,uint8_t bcr, +uint64_t pid); + +/* Realize and drop the reference count on an I3C target. */ +bool i3c_target_realize_and_unref (I3CTarget *dev,I3CBus *bus,Error **errp); + +#endif /* QEMU_INCLUDE_HW_I3C_I3C_H_ */
hw/i3c/core.c new file +647 -0
647 lines not on this page · raw message
hw/i3c/meson.build +1 -0
@@ -1,3 +1,4 @@ i3c_ss = ss.source_set() +i3c_ss.add(when: 'CONFIG_I3C', if_true: files('core.c')) i3c_ss.add(when: 'CONFIG_ASPEED_SOC', if_true: files('aspeed_i3c.c')) system_ss.add_all(when: 'CONFIG_I3C', if_true: i3c_ss)
hw/i3c/trace-events +16 -0
@@ -5,3 +5,19 @@ aspeed_i3c_read(uint64_t offset, uint64_t data) "I3C read: offset 0x%" PRIx64 " aspeed_i3c_write(uint64_t offset, uint64_t data) "I3C write: offset 0x%" PRIx64 " data 0x%" PRIx64 aspeed_i3c_device_read(uint32_t deviceid, uint64_t offset, uint64_t data) "I3C Dev[%u] read: offset 0x%" PRIx64 " data 0x%" PRIx64 aspeed_i3c_device_write(uint32_t deviceid, uint64_t offset, uint64_t data) "I3C Dev[%u] write: offset 0x%" PRIx64 " data 0x%" PRIx64 + +# core.c +i3c_target_event(uint8_t address, uint8_t event) "I3C target 0x%" PRIx8 " event 0x%" PRIx8 +i3c_target_handle_ccc(uint8_t address, uint8_t ccc) "I3C target 0x%" PRIx8 " handling CCC 0x%" PRIx8 +i3c_target_send_ibi(uint8_t address, bool is_recv) "I3C target IBI address 0x%" PRIx8 " RnW=%d" +i3c_target_send_ibi_bytes(uint8_t byte) "I3C target IBI byte 0x%" PRIx8 +i3c_target_ibi_finish(void) "I3C target IBI finish" +i3c_start_transfer(uint8_t address, bool is_recv) "I3C START with address 0x%" PRIx8 " is_recv=%d" +i3c_end_transfer(void) "I3C transfer done" +i3c_send(uint32_t num_sent, uint32_t num_to_send, bool ack) "I3C send %" PRId32 "/%" PRId32 " bytes, ack=%d" +i3c_recv(uint32_t num_read, uint32_t num_to_read, bool ack) "I3C recv %" PRId32 "/%" PRId32 " bytes, ack=%d" +legacy_i2c_nack(void) "Legacy I2C NACK" +legacy_i2c_recv(uint8_t byte) "Legacy I2C recv 0x%" PRIx8 +legacy_i2c_send(uint8_t byte) "Legacy I2C send 0x%" PRIx8 +legacy_i2c_start_transfer(uint8_t address, bool is_recv) "Legacy I2C START with address 0x%" PRIx8 " is_recv=%d" +legacy_i2c_end_transfer(void) "Legacy I2C STOP"
Signature · 1 line
2.53.0
[PULL 07/38] hw/i3c/aspeed_i3c: Add more register fields
In reply to Cédric Le GoaterFrom: Jamin Lin <[email protected]>
Adds the rest of the Aspeed I3C controller register fields.
--- hw/i3c/aspeed_i3c.c | 54 +++++++++++++++++++++++++++++++++++---------- 1 file changed, 42 insertions(+), 12 deletions(-)
hw/i3c/aspeed_i3c.c +42 -12
@@ -21,28 +21,58 @@/* I3C Controller Registers */ REG32(I3C1_REG0, 0x10) REG32(I3C1_REG1, 0x14) - FIELD(I3C1_REG1, I2C_MODE, 0, 1) - FIELD(I3C1_REG1, SA_EN, 15, 1) + FIELD(I3C1_REG1, I2C_MODE, 0, 1) + FIELD(I3C1_REG1, SLV_TEST_MODE, 1, 1) + FIELD(I3C1_REG1, ACT_MODE, 2, 2) + FIELD(I3C1_REG1, PENDING_INT, 4, 4) + FIELD(I3C1_REG1, SA, 8, 7) + FIELD(I3C1_REG1, SA_EN, 15, 1) + FIELD(I3C1_REG1, INST_ID, 16, 4) REG32(I3C2_REG0, 0x20) REG32(I3C2_REG1, 0x24) - FIELD(I3C2_REG1, I2C_MODE, 0, 1) - FIELD(I3C2_REG1, SA_EN, 15, 1) + FIELD(I3C2_REG1, I2C_MODE, 0, 1) + FIELD(I3C2_REG1, SLV_TEST_MODE, 1, 1) + FIELD(I3C2_REG1, ACT_MODE, 2, 2) + FIELD(I3C2_REG1, PENDING_INT, 4, 4) + FIELD(I3C2_REG1, SA, 8, 7) + FIELD(I3C2_REG1, SA_EN, 15, 1) + FIELD(I3C2_REG1, INST_ID, 16, 4) REG32(I3C3_REG0, 0x30) REG32(I3C3_REG1, 0x34) - FIELD(I3C3_REG1, I2C_MODE, 0, 1) - FIELD(I3C3_REG1, SA_EN, 15, 1) + FIELD(I3C3_REG1, I2C_MODE, 0, 1) + FIELD(I3C3_REG1, SLV_TEST_MODE, 1, 1) + FIELD(I3C3_REG1, ACT_MODE, 2, 2) + FIELD(I3C3_REG1, PENDING_INT, 4, 4) + FIELD(I3C3_REG1, SA, 8, 7) + FIELD(I3C3_REG1, SA_EN, 15, 1) + FIELD(I3C3_REG1, INST_ID, 16, 4) REG32(I3C4_REG0, 0x40) REG32(I3C4_REG1, 0x44) - FIELD(I3C4_REG1, I2C_MODE, 0, 1) - FIELD(I3C4_REG1, SA_EN, 15, 1) + FIELD(I3C4_REG1, I2C_MODE, 0, 1) + FIELD(I3C4_REG1, SLV_TEST_MODE, 1, 1) + FIELD(I3C4_REG1, ACT_MODE, 2, 2) + FIELD(I3C4_REG1, PENDING_INT, 4, 4) + FIELD(I3C4_REG1, SA, 8, 7) + FIELD(I3C4_REG1, SA_EN, 15, 1) + FIELD(I3C4_REG1, INST_ID, 16, 4) REG32(I3C5_REG0, 0x50) REG32(I3C5_REG1, 0x54) - FIELD(I3C5_REG1, I2C_MODE, 0, 1) - FIELD(I3C5_REG1, SA_EN, 15, 1) + FIELD(I3C5_REG1, I2C_MODE, 0, 1) + FIELD(I3C5_REG1, SLV_TEST_MODE, 1, 1) + FIELD(I3C5_REG1, ACT_MODE, 2, 2) + FIELD(I3C5_REG1, PENDING_INT, 4, 4) + FIELD(I3C5_REG1, SA, 8, 7) + FIELD(I3C5_REG1, SA_EN, 15, 1) + FIELD(I3C5_REG1, INST_ID, 16, 4) REG32(I3C6_REG0, 0x60) REG32(I3C6_REG1, 0x64) - FIELD(I3C6_REG1, I2C_MODE, 0, 1) - FIELD(I3C6_REG1, SA_EN, 15, 1) + FIELD(I3C6_REG1, I2C_MODE, 0, 1) + FIELD(I3C6_REG1, SLV_TEST_MODE, 1, 1) + FIELD(I3C6_REG1, ACT_MODE, 2, 2) + FIELD(I3C6_REG1, PENDING_INT, 4, 4) + FIELD(I3C6_REG1, SA, 8, 7) + FIELD(I3C6_REG1, SA_EN, 15, 1) + FIELD(I3C6_REG1, INST_ID, 16, 4)static uint64_t aspeed_i3c_read (void *opaque,hwaddr addr,unsigned int size) {
Signature · 1 line
2.53.0
[PULL 06/38] hw/i3c/dw-i3c: Add more register fields
In reply to Cédric Le GoaterFrom: Jamin Lin <[email protected]>
Adds the rest of the Designware register fields.
--- hw/i3c/dw-i3c.c | 199 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 199 insertions(+)
hw/i3c/dw-i3c.c +199 -0
@@ -19,54 +19,253 @@#include "trace.h" REG32(DEVICE_CTRL, 0x00) + FIELD(DEVICE_CTRL, I3C_BROADCAST_ADDR_INC, 0, 1) + FIELD(DEVICE_CTRL, I2C_SLAVE_PRESENT, 7, 1) + FIELD(DEVICE_CTRL, HOT_JOIN_ACK_NACK_CTRL, 8, 1) + FIELD(DEVICE_CTRL, IDLE_CNT_MULTIPLIER, 24, 2) + FIELD(DEVICE_CTRL, SLV_ADAPT_TO_I2C_I3C_MODE, 27, 1) + FIELD(DEVICE_CTRL, DMA_HANDSHAKE_EN, 28, 1) + FIELD(DEVICE_CTRL, I3C_ABORT, 29, 1) + FIELD(DEVICE_CTRL, I3C_RESUME, 30, 1) + FIELD(DEVICE_CTRL, I3C_EN, 31, 1) REG32(DEVICE_ADDR, 0x04) + FIELD(DEVICE_ADDR, STATIC_ADDR, 0, 7) + FIELD(DEVICE_ADDR, STATIC_ADDR_VALID, 15, 1) + FIELD(DEVICE_ADDR, DYNAMIC_ADDR, 16, 7) + FIELD(DEVICE_ADDR, DYNAMIC_ADDR_VALID, 31, 1) REG32(HW_CAPABILITY, 0x08) + FIELD(HW_CAPABILITY, DEVICE_ROLE_CONFIG, 0, 3) + FIELD(HW_CAPABILITY, HDR_DDR, 3, 1) + FIELD(HW_CAPABILITY, HDR_TS, 4, 1) REG32(COMMAND_QUEUE_PORT, 0x0c) +FIELD (COMMAND_QUEUE_PORT ,CMD_ATTR ,0 ,3 ) + /* Transfer command structure */ + FIELD(COMMAND_QUEUE_PORT, TID, 3, 4) + FIELD(COMMAND_QUEUE_PORT, CMD, 7, 8) + FIELD(COMMAND_QUEUE_PORT, CP, 15, 1) + FIELD(COMMAND_QUEUE_PORT, DEV_INDEX, 16, 5) + FIELD(COMMAND_QUEUE_PORT, SPEED, 21, 3) + FIELD(COMMAND_QUEUE_PORT, ROC, 26, 1) + FIELD(COMMAND_QUEUE_PORT, SDAP, 27, 1) + FIELD(COMMAND_QUEUE_PORT, RNW, 28, 1) + FIELD(COMMAND_QUEUE_PORT, TOC, 30, 1) +FIELD (COMMAND_QUEUE_PORT ,PEC ,31 ,1 ) + /* Transfer argument data structure */ + FIELD(COMMAND_QUEUE_PORT, DB, 8, 8) +FIELD (COMMAND_QUEUE_PORT ,DL ,16 ,16 ) + /* Short data argument data structure */ + FIELD(COMMAND_QUEUE_PORT, BYTE_STRB, 3, 3) + FIELD(COMMAND_QUEUE_PORT, BYTE0, 8, 8) + FIELD(COMMAND_QUEUE_PORT, BYTE1, 16, 8) +FIELD (COMMAND_QUEUE_PORT ,BYTE2 ,24 ,8 ) +/* Address assignment command structure */ +/* +* bits 3..21 and 26..31 are the same as the transfer command structure, or +* marked as reserved. + */ + FIELD(COMMAND_QUEUE_PORT, DEV_COUNT, 21, 3) REG32(RESPONSE_QUEUE_PORT, 0x10) + FIELD(RESPONSE_QUEUE_PORT, DL, 0, 16) + FIELD(RESPONSE_QUEUE_PORT, CCCT, 16, 8) + FIELD(RESPONSE_QUEUE_PORT, TID, 24, 3) + FIELD(RESPONSE_QUEUE_PORT, ERR_STATUS, 28, 4) REG32(RX_TX_DATA_PORT, 0x14) REG32(IBI_QUEUE_STATUS, 0x18) + FIELD(IBI_QUEUE_STATUS, IBI_DATA_LEN, 0, 8) + FIELD(IBI_QUEUE_STATUS, IBI_ID, 8, 8) + FIELD(IBI_QUEUE_STATUS, LAST_STATUS, 24, 1) + FIELD(IBI_QUEUE_STATUS, ERROR, 30, 1) + FIELD(IBI_QUEUE_STATUS, IBI_STATUS, 31, 1) REG32(IBI_QUEUE_DATA, 0x18) REG32(QUEUE_THLD_CTRL, 0x1c) +FIELD (QUEUE_THLD_CTRL ,CMD_BUF_EMPTY_THLD ,0 ,8 ); +FIELD (QUEUE_THLD_CTRL ,RESP_BUF_THLD ,8 ,8 ); +FIELD (QUEUE_THLD_CTRL ,IBI_DATA_THLD ,16 ,5 ); +FIELD (QUEUE_THLD_CTRL ,IBI_STATUS_THLD ,24 ,8 ); REG32(DATA_BUFFER_THLD_CTRL, 0x20) + FIELD(DATA_BUFFER_THLD_CTRL, TX_BUF_THLD, 0, 3) + FIELD(DATA_BUFFER_THLD_CTRL, RX_BUF_THLD, 8, 3) + FIELD(DATA_BUFFER_THLD_CTRL, TX_START_THLD, 16, 3) + FIELD(DATA_BUFFER_THLD_CTRL, RX_START_THLD, 24, 3) REG32(IBI_QUEUE_CTRL, 0x24) + FIELD(IBI_QUEUE_CTRL, NOTIFY_REJECTED_HOT_JOIN, 0, 1) + FIELD(IBI_QUEUE_CTRL, NOTIFY_REJECTED_MASTER_REQ, 1, 1) + FIELD(IBI_QUEUE_CTRL, NOTIFY_REJECTED_SLAVE_IRQ, 3, 1) REG32(IBI_MR_REQ_REJECT, 0x2c) REG32(IBI_SIR_REQ_REJECT, 0x30) REG32(RESET_CTRL, 0x34) + FIELD(RESET_CTRL, CORE_RESET, 0, 1) + FIELD(RESET_CTRL, CMD_QUEUE_RESET, 1, 1) + FIELD(RESET_CTRL, RESP_QUEUE_RESET, 2, 1) + FIELD(RESET_CTRL, TX_BUF_RESET, 3, 1) + FIELD(RESET_CTRL, RX_BUF_RESET, 4, 1) + FIELD(RESET_CTRL, IBI_QUEUE_RESET, 5, 1) REG32(SLV_EVENT_CTRL, 0x38) + FIELD(SLV_EVENT_CTRL, SLV_INTERRUPT, 0, 1) + FIELD(SLV_EVENT_CTRL, MASTER_INTERRUPT, 1, 1) + FIELD(SLV_EVENT_CTRL, HOT_JOIN_INTERRUPT, 3, 1) + FIELD(SLV_EVENT_CTRL, ACTIVITY_STATE, 4, 2) + FIELD(SLV_EVENT_CTRL, MRL_UPDATED, 6, 1) + FIELD(SLV_EVENT_CTRL, MWL_UPDATED, 7, 1) REG32(INTR_STATUS, 0x3c) + FIELD(INTR_STATUS, TX_THLD, 0, 1) + FIELD(INTR_STATUS, RX_THLD, 1, 1) + FIELD(INTR_STATUS, IBI_THLD, 2, 1) + FIELD(INTR_STATUS, CMD_QUEUE_RDY, 3, 1) + FIELD(INTR_STATUS, RESP_RDY, 4, 1) + FIELD(INTR_STATUS, TRANSFER_ABORT, 5, 1) + FIELD(INTR_STATUS, CCC_UPDATED, 6, 1) + FIELD(INTR_STATUS, DYN_ADDR_ASSGN, 8, 1) + FIELD(INTR_STATUS, TRANSFER_ERR, 9, 1) + FIELD(INTR_STATUS, DEFSLV, 10, 1) + FIELD(INTR_STATUS, READ_REQ_RECV, 11, 1) + FIELD(INTR_STATUS, IBI_UPDATED, 12, 1) + FIELD(INTR_STATUS, BUSOWNER_UPDATED, 13, 1) REG32(INTR_STATUS_EN, 0x40) + FIELD(INTR_STATUS_EN, TX_THLD, 0, 1) + FIELD(INTR_STATUS_EN, RX_THLD, 1, 1) + FIELD(INTR_STATUS_EN, IBI_THLD, 2, 1) + FIELD(INTR_STATUS_EN, CMD_QUEUE_RDY, 3, 1) + FIELD(INTR_STATUS_EN, RESP_RDY, 4, 1) + FIELD(INTR_STATUS_EN, TRANSFER_ABORT, 5, 1) + FIELD(INTR_STATUS_EN, CCC_UPDATED, 6, 1) + FIELD(INTR_STATUS_EN, DYN_ADDR_ASSGN, 8, 1) + FIELD(INTR_STATUS_EN, TRANSFER_ERR, 9, 1) + FIELD(INTR_STATUS_EN, DEFSLV, 10, 1) + FIELD(INTR_STATUS_EN, READ_REQ_RECV, 11, 1) + FIELD(INTR_STATUS_EN, IBI_UPDATED, 12, 1) + FIELD(INTR_STATUS_EN, BUSOWNER_UPDATED, 13, 1) REG32(INTR_SIGNAL_EN, 0x44) + FIELD(INTR_SIGNAL_EN, TX_THLD, 0, 1) + FIELD(INTR_SIGNAL_EN, RX_THLD, 1, 1) + FIELD(INTR_SIGNAL_EN, IBI_THLD, 2, 1) + FIELD(INTR_SIGNAL_EN, CMD_QUEUE_RDY, 3, 1) + FIELD(INTR_SIGNAL_EN, RESP_RDY, 4, 1) + FIELD(INTR_SIGNAL_EN, TRANSFER_ABORT, 5, 1) + FIELD(INTR_SIGNAL_EN, CCC_UPDATED, 6, 1) + FIELD(INTR_SIGNAL_EN, DYN_ADDR_ASSGN, 8, 1) + FIELD(INTR_SIGNAL_EN, TRANSFER_ERR, 9, 1) + FIELD(INTR_SIGNAL_EN, DEFSLV, 10, 1) + FIELD(INTR_SIGNAL_EN, READ_REQ_RECV, 11, 1) + FIELD(INTR_SIGNAL_EN, IBI_UPDATED, 12, 1) + FIELD(INTR_SIGNAL_EN, BUSOWNER_UPDATED, 13, 1) REG32(INTR_FORCE, 0x48) + FIELD(INTR_FORCE, TX_THLD, 0, 1) + FIELD(INTR_FORCE, RX_THLD, 1, 1) + FIELD(INTR_FORCE, IBI_THLD, 2, 1) + FIELD(INTR_FORCE, CMD_QUEUE_RDY, 3, 1) + FIELD(INTR_FORCE, RESP_RDY, 4, 1) + FIELD(INTR_FORCE, TRANSFER_ABORT, 5, 1) + FIELD(INTR_FORCE, CCC_UPDATED, 6, 1) + FIELD(INTR_FORCE, DYN_ADDR_ASSGN, 8, 1) + FIELD(INTR_FORCE, TRANSFER_ERR, 9, 1) + FIELD(INTR_FORCE, DEFSLV, 10, 1) + FIELD(INTR_FORCE, READ_REQ_RECV, 11, 1) + FIELD(INTR_FORCE, IBI_UPDATED, 12, 1) + FIELD(INTR_FORCE, BUSOWNER_UPDATED, 13, 1) REG32(QUEUE_STATUS_LEVEL, 0x4c) + FIELD(QUEUE_STATUS_LEVEL, CMD_QUEUE_EMPTY_LOC, 0, 8) + FIELD(QUEUE_STATUS_LEVEL, RESP_BUF_BLR, 8, 8) + FIELD(QUEUE_STATUS_LEVEL, IBI_BUF_BLR, 16, 8) + FIELD(QUEUE_STATUS_LEVEL, IBI_STATUS_CNT, 24, 5) REG32(DATA_BUFFER_STATUS_LEVEL, 0x50) + FIELD(DATA_BUFFER_STATUS_LEVEL, TX_BUF_EMPTY_LOC, 0, 8) + FIELD(DATA_BUFFER_STATUS_LEVEL, RX_BUF_BLR, 16, 8) REG32(PRESENT_STATE, 0x54) + FIELD(PRESENT_STATE, SCL_LINE_SIGNAL_LEVEL, 0, 1) + FIELD(PRESENT_STATE, SDA_LINE_SIGNAL_LEVEL, 1, 1) + FIELD(PRESENT_STATE, CURRENT_MASTER, 2, 1) + FIELD(PRESENT_STATE, CM_TFR_STATUS, 8, 6) + FIELD(PRESENT_STATE, CM_TFR_ST_STATUS, 16, 6) + FIELD(PRESENT_STATE, CMD_TID, 24, 4) REG32(CCC_DEVICE_STATUS, 0x58) + FIELD(CCC_DEVICE_STATUS, PENDING_INTR, 0, 4) + FIELD(CCC_DEVICE_STATUS, PROTOCOL_ERR, 5, 1) + FIELD(CCC_DEVICE_STATUS, ACTIVITY_MODE, 6, 2) + FIELD(CCC_DEVICE_STATUS, UNDER_ERR, 8, 1) + FIELD(CCC_DEVICE_STATUS, SLV_BUSY, 9, 1) + FIELD(CCC_DEVICE_STATUS, OVERFLOW_ERR, 10, 1) + FIELD(CCC_DEVICE_STATUS, DATA_NOT_READY, 11, 1) + FIELD(CCC_DEVICE_STATUS, BUFFER_NOT_AVAIL, 12, 1) REG32(DEVICE_ADDR_TABLE_POINTER, 0x5c) FIELD(DEVICE_ADDR_TABLE_POINTER, DEPTH, 16, 16) FIELD(DEVICE_ADDR_TABLE_POINTER, ADDR, 0, 16) REG32(DEV_CHAR_TABLE_POINTER, 0x60) + FIELD(DEV_CHAR_TABLE_POINTER, P_DEV_CHAR_TABLE_START_ADDR, 0, 12) + FIELD(DEV_CHAR_TABLE_POINTER, DEV_CHAR_TABLE_DEPTH, 12, 7) + FIELD(DEV_CHAR_TABLE_POINTER, PRESENT_DEV_CHAR_TABLE_INDEX, 19, 3) REG32(VENDOR_SPECIFIC_REG_POINTER, 0x6c) + FIELD(VENDOR_SPECIFIC_REG_POINTER, P_VENDOR_REG_START_ADDR, 0, 16) REG32(SLV_MIPI_PID_VALUE, 0x70) REG32(SLV_PID_VALUE, 0x74) + FIELD(SLV_PID_VALUE, SLV_PID_DCR, 0, 12) + FIELD(SLV_PID_VALUE, SLV_INST_ID, 12, 4) + FIELD(SLV_PID_VALUE, SLV_PART_ID, 16, 16) REG32(SLV_CHAR_CTRL, 0x78) + FIELD(SLV_CHAR_CTRL, BCR, 0, 8) + FIELD(SLV_CHAR_CTRL, DCR, 8, 8) + FIELD(SLV_CHAR_CTRL, HDR_CAP, 16, 8) REG32(SLV_MAX_LEN, 0x7c) + FIELD(SLV_MAX_LEN, MWL, 0, 16) + FIELD(SLV_MAX_LEN, MRL, 16, 16) REG32(MAX_READ_TURNAROUND, 0x80) REG32(MAX_DATA_SPEED, 0x84) REG32(SLV_DEBUG_STATUS, 0x88) REG32(SLV_INTR_REQ, 0x8c) + FIELD(SLV_INTR_REQ, SIR, 0, 1) + FIELD(SLV_INTR_REQ, SIR_CTRL, 1, 2) + FIELD(SLV_INTR_REQ, MIR, 3, 1) + FIELD(SLV_INTR_REQ, TS, 4, 1) + FIELD(SLV_INTR_REQ, IBI_STS, 8, 2) +REG32(SLV_TSX_SYMBL_TIMING, 0x90) + FIELD(SLV_TSX_SYMBL_TIMING, SLV_TSX_SYMBL_CNT, 0, 6) REG32(DEVICE_CTRL_EXTENDED, 0xb0) + FIELD(DEVICE_CTRL_EXTENDED, MODE, 0, 2) + FIELD(DEVICE_CTRL_EXTENDED, REQMST_ACK_CTRL, 3, 1) REG32(SCL_I3C_OD_TIMING, 0xb4) + FIELD(SCL_I3C_OD_TIMING, I3C_OD_LCNT, 0, 8) + FIELD(SCL_I3C_OD_TIMING, I3C_OD_HCNT, 16, 8) REG32(SCL_I3C_PP_TIMING, 0xb8) + FIELD(SCL_I3C_PP_TIMING, I3C_PP_LCNT, 0, 8) + FIELD(SCL_I3C_PP_TIMING, I3C_PP_HCNT, 16, 8) REG32(SCL_I2C_FM_TIMING, 0xbc) REG32(SCL_I2C_FMP_TIMING, 0xc0) + FIELD(SCL_I2C_FMP_TIMING, I2C_FMP_LCNT, 0, 16) + FIELD(SCL_I2C_FMP_TIMING, I2C_FMP_HCNT, 16, 8) REG32(SCL_EXT_LCNT_TIMING, 0xc8) REG32(SCL_EXT_TERMN_LCNT_TIMING, 0xcc) REG32(BUS_FREE_TIMING, 0xd4) REG32(BUS_IDLE_TIMING, 0xd8) + FIELD(BUS_IDLE_TIMING, BUS_IDLE_TIME, 0, 20) REG32(I3C_VER_ID, 0xe0) REG32(I3C_VER_TYPE, 0xe4) REG32(EXTENDED_CAPABILITY, 0xe8)REG32 (SLAVE_CONFIG ,0xec ) +/* Device characteristic table fields */ +REG32(DEVICE_CHARACTERISTIC_TABLE_LOC1, 0x200) +REG32(DEVICE_CHARACTERISTIC_TABLE_LOC_SECONDARY, 0x200) + FIELD(DEVICE_CHARACTERISTIC_TABLE_LOC_SECONDARY, DYNAMIC_ADDR, 0, 8) + FIELD(DEVICE_CHARACTERISTIC_TABLE_LOC_SECONDARY, DCR, 8, 8) + FIELD(DEVICE_CHARACTERISTIC_TABLE_LOC_SECONDARY, BCR, 16, 8) + FIELD(DEVICE_CHARACTERISTIC_TABLE_LOC_SECONDARY, STATIC_ADDR, 24, 8) +REG32(DEVICE_CHARACTERISTIC_TABLE_LOC2, 0x204) + FIELD(DEVICE_CHARACTERISTIC_TABLE_LOC2, MSB_PID, 0, 16) +REG32(DEVICE_CHARACTERISTIC_TABLE_LOC3, 0x208) + FIELD(DEVICE_CHARACTERISTIC_TABLE_LOC3, DCR, 0, 8) + FIELD(DEVICE_CHARACTERISTIC_TABLE_LOC3, BCR, 8, 8) +REG32(DEVICE_CHARACTERISTIC_TABLE_LOC4, 0x20c) +FIELD (DEVICE_CHARACTERISTIC_TABLE_LOC4 ,DEV_DYNAMIC_ADDR ,0 ,8 ) +/* Dev addr table fields */ +REG32(DEVICE_ADDR_TABLE_LOC1, 0x280) + FIELD(DEVICE_ADDR_TABLE_LOC1, DEV_STATIC_ADDR, 0, 7) + FIELD(DEVICE_ADDR_TABLE_LOC1, IBI_PEC_EN, 11, 1) + FIELD(DEVICE_ADDR_TABLE_LOC1, IBI_WITH_DATA, 12, 1) + FIELD(DEVICE_ADDR_TABLE_LOC1, SIR_REJECT, 13, 1) + FIELD(DEVICE_ADDR_TABLE_LOC1, MR_REJECT, 14, 1) + FIELD(DEVICE_ADDR_TABLE_LOC1, DEV_DYNAMIC_ADDR, 16, 8) + FIELD(DEVICE_ADDR_TABLE_LOC1, IBI_ADDR_MASK, 24, 2) + FIELD(DEVICE_ADDR_TABLE_LOC1, DEV_NACK_RETRY_CNT, 29, 2) + FIELD(DEVICE_ADDR_TABLE_LOC1, LEGACY_I2C_DEVICE, 31, 1)static const uint32_t dw_i3c_resets[DW_I3C_NR_REGS ] = { [R_HW_CAPABILITY ] =0x000e00bf ,
Signature · 1 line
2.53.0
[PULL 10/38] hw/i3c/dw-i3c: Add register RO field masks
In reply to Cédric Le GoaterFrom: Jamin Lin <[email protected]>
Adds read-only register masks for the DwC I3C controller.
--- hw/i3c/dw-i3c.c | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+)
hw/i3c/dw-i3c.c +40 -0
@@ -296,6 +296,45 @@ static const uint32_t dw_i3c_resets[DW_I3C_NR_REGS] = { [R_SLAVE_CONFIG] = 0x00000023, }; +static const uint32_t dw_i3c_ro[DW_I3C_NR_REGS ] = { + [R_DEVICE_CTRL ] =0x04fffe00 , + [R_DEVICE_ADDR ] =0x7f807f80 , + [R_HW_CAPABILITY ] =0xffffffff , + [R_IBI_QUEUE_STATUS ] =0xffffffff , + [R_DATA_BUFFER_THLD_CTRL ] =0xf8f8f8f8 , + [R_IBI_QUEUE_CTRL ] =0xfffffff0 , + [R_RESET_CTRL ] =0xffffffc0 , + [R_SLV_EVENT_CTRL ] =0xffffff3f , + [R_INTR_STATUS ] =0xffff809f , + [R_INTR_STATUS_EN ] =0xffff8080 , + [R_INTR_SIGNAL_EN ] =0xffff8080 , + [R_INTR_FORCE ] =0xffff8000 , + [R_QUEUE_STATUS_LEVEL ] =0xffffffff , + [R_DATA_BUFFER_STATUS_LEVEL ] =0xffffffff , + [R_PRESENT_STATE ] =0xffffffff , + [R_CCC_DEVICE_STATUS ] =0xffffffff , + [R_I3C_VER_ID ] =0xffffffff , + [R_I3C_VER_TYPE ] =0xffffffff , + [R_DEVICE_ADDR_TABLE_POINTER ] =0xffffffff , + [R_DEV_CHAR_TABLE_POINTER ] =0xffcbffff , + [R_SLV_PID_VALUE ] =0xffff0fff , + [R_SLV_CHAR_CTRL ] =0xffffffff , + [A_VENDOR_SPECIFIC_REG_POINTER ] =0xffffffff , + [R_SLV_MAX_LEN ] =0xffffffff , + [R_MAX_READ_TURNAROUND ] =0xffffffff , + [R_MAX_DATA_SPEED ] =0xffffffff , + [R_SLV_INTR_REQ ] =0xfffffff0 , + [R_SLV_TSX_SYMBL_TIMING ] =0xffffffc0 , + [R_DEVICE_CTRL_EXTENDED ] =0xfffffff8 , + [R_SCL_I3C_OD_TIMING ] =0xff00ff00 , + [R_SCL_I3C_PP_TIMING ] =0xff00ff00 , + [R_SCL_I2C_FMP_TIMING ] =0xff000000 , + [R_SCL_EXT_TERMN_LCNT_TIMING ] =0x0000fff0 , + [R_BUS_IDLE_TIMING ] =0xfff00000 , + [R_EXTENDED_CAPABILITY ] =0xffffffff , + [R_SLAVE_CONFIG ] =0xffffffff , +}; +static uint64_t dw_i3c_read (void *opaque,hwaddr offset,unsigned size) {DWI3C *s =DW_I3C (opaque);
@@ -324,6 +363,7 @@ static void dw_i3c_write(void *opaque, hwaddr offset, uint64_t value,trace_dw_i3c_write (s->id, offset, value); + value &= ~dw_i3c_ro[addr];switch (addr) {case R_HW_CAPABILITY :case R_RESPONSE_QUEUE_PORT :
Signature · 1 line
2.53.0
[PULL 05/38] hw/i3c: Split DesignWare I3C out of Aspeed I3C
In reply to Cédric Le GoaterFrom: Jamin Lin <[email protected]>
The Aspeed I3C IP block is technically an Aspeed IP block that manages 6 DW I3C controllers.
To help reflect this better and to make it easier for other SoCs to use the DW I3C model, we'll split out the DW portion from the Aspeed portion.
--- include/hw/i3c/aspeed_i3c.h | 17 +-- include/hw/i3c/dw-i3c.h | 33 ++++++ hw/i3c/aspeed_i3c.c | 181 +------------------------------- hw/i3c/dw-i3c.c | 202 ++++++++++++++++++++++++++++++++++++ hw/arm/Kconfig | 1 + hw/i3c/Kconfig | 3 + hw/i3c/meson.build | 1 + hw/i3c/trace-events | 6 +- 8 files changed, 250 insertions(+), 194 deletions(-) create mode 100644 include/hw/i3c/dw-i3c.h create mode 100644 hw/i3c/dw-i3c.c
include/hw/i3c/aspeed_i3c.h +3 -14
@@ -10,27 +10,15 @@ #ifndef ASPEED_I3C_H #define ASPEED_I3C_H +#include "hw/i3c/dw-i3c.h" #include "hw/core/sysbus.h" #define TYPE_ASPEED_I3C "aspeed.i3c" -#define TYPE_ASPEED_I3C_DEVICE "aspeed.i3c.device" OBJECT_DECLARE_TYPE(AspeedI3CState, AspeedI3CClass, ASPEED_I3C) #define ASPEED_I3C_NR_REGS (0x70 >> 2) -#define ASPEED_I3C_DEVICE_NR_REGS (0x300 >> 2) #define ASPEED_I3C_NR_DEVICES 6 -OBJECT_DECLARE_SIMPLE_TYPE(AspeedI3CDevice, ASPEED_I3C_DEVICE) -struct AspeedI3CDevice { - SysBusDevice parent_obj; - - MemoryRegion mr; - qemu_irq irq; - - uint8_t id; - uint32_t regs[ASPEED_I3C_DEVICE_NR_REGS]; -}; - struct AspeedI3CState { SysBusDevice parent_obj;
@@ -39,6 +27,7 @@ struct AspeedI3CState {qemu_irq irq;uint32_t regs[ASPEED_I3C_NR_REGS ]; - AspeedI3CDevice devices[ASPEED_I3C_NR_DEVICES]; +DWI3C devices[ASPEED_I3C_NR_DEVICES ]; + uint8_t id; };#endif /* ASPEED_I3C_H */
include/hw/i3c/dw-i3c.h new file +33 -0
@@ -0,0 +1,33 @@ +/* +* DesignWare I3C Controller +* +* Copyright (C) 2021 ASPEED Technology Inc. +* Copyright (C) 2025 Google, LLC. +* +* SPDX-License-Identifier: GPL-2.0-or-later +*/ + +#ifndef DW_I3C_H +#define DW_I3C_H + +#include "hw/core/sysbus.h" + +#define TYPE_DW_I3C "dw.i3c" +OBJECT_DECLARE_SIMPLE_TYPE(DWI3C, DW_I3C) + +#define DW_I3C_NR_REGS (0x300 >> 2) + +struct DWI3C { +SysBusDevice parent_obj; + +MemoryRegion mr; +qemu_irq irq; + +uint8_t id; +uint32_t regs[DW_I3C_NR_REGS ]; +}; + +/* Extern for other controllers that use DesignWare I3C. */ +extern const VMStateDescription vmstate_dw_i3c; + +#endif /* DW_I3C_H */
hw/i3c/aspeed_i3c.c +3 -178
217 lines not on this page · raw message
hw/i3c/dw-i3c.c new file +202 -0
202 lines not on this page · raw message
hw/arm/Kconfig +1 -0
@@ -546,6 +546,7 @@ config ASPEED_SOC select FTGMAC100 select I2C select I3C + select DW_I3C select DPS310 select PCA9552 select PCA9554
hw/i3c/Kconfig +3 -0
@@ -1,2 +1,5 @@ config I3C bool + +config DW_I3C + bool
hw/i3c/meson.build +1 -0
@@ -1,4 +1,5 @@ i3c_ss = ss.source_set() i3c_ss.add(when: 'CONFIG_I3C', if_true: files('core.c')) i3c_ss.add(when: 'CONFIG_ASPEED_SOC', if_true: files('aspeed_i3c.c')) +i3c_ss.add(when: 'CONFIG_DW_I3C', if_true: files('dw-i3c.c')) system_ss.add_all(when: 'CONFIG_I3C', if_true: i3c_ss)
hw/i3c/trace-events +4 -2
@@ -3,8 +3,10 @@ # aspeed_i3c.c aspeed_i3c_read(uint64_t offset, uint64_t data) "I3C read: offset 0x%" PRIx64 " data 0x%" PRIx64 aspeed_i3c_write(uint64_t offset, uint64_t data) "I3C write: offset 0x%" PRIx64 " data 0x%" PRIx64 -aspeed_i3c_device_read(uint32_t deviceid, uint64_t offset, uint64_t data) "I3C Dev[%u] read: offset 0x%" PRIx64 " data 0x%" PRIx64 -aspeed_i3c_device_write(uint32_t deviceid, uint64_t offset, uint64_t data) "I3C Dev[%u] write: offset 0x%" PRIx64 " data 0x%" PRIx64 + +# dw-i3c,c +dw_i3c_read(uint32_t deviceid, uint64_t offset, uint64_t data) "I3C Dev[%u] read: offset 0x%" PRIx64 " data 0x%" PRIx64 +dw_i3c_write(uint32_t deviceid, uint64_t offset, uint64_t data) "I3C Dev[%u] write: offset 0x%" PRIx64 " data 0x%" PRIx64 # core.c i3c_target_event(uint8_t address, uint8_t event) "I3C target 0x%" PRIx8 " event 0x%" PRIx8
Signature · 1 line
2.53.0
[PULL 13/38] hw/i3c/dw-i3c: Add IRQ MMIO behavior
In reply to Cédric Le GoaterFrom: Jamin Lin <[email protected]>
--- hw/i3c/dw-i3c.c | 56 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+)
hw/i3c/dw-i3c.c +56 -0
@@ -17,6 +17,7 @@#include "qapi/error.h" #include "migration/vmstate.h" #include "trace.h" +#include "hw/core/irq.h" REG32(DEVICE_CTRL, 0x00)FIELD (DEVICE_CTRL ,I3C_BROADCAST_ADDR_INC ,0 ,1 )
@@ -335,6 +336,46 @@ static const uint32_t dw_i3c_ro[DW_I3C_NR_REGS] = { [R_SLAVE_CONFIG] = 0xffffffff, }; +static void dw_i3c_update_irq (DWI3C *s) +{ +bool level = !!(s->regs[R_INTR_SIGNAL_EN ] & s->regs[R_INTR_STATUS ]); +qemu_set_irq (s->irq, level); +} + +static uint32_t dw_i3c_intr_status_r (DWI3C *s) +{ +/* Only return the status whose corresponding EN bits are set. */ +return s->regs[R_INTR_STATUS ] & s->regs[R_INTR_STATUS_EN ]; +} + +static void dw_i3c_intr_status_w (DWI3C *s,uint32_t val) +{ +/* INTR_STATUS[13:5] is w1c, other bits are RO. */ + val &=0x3fe0 ; + s->regs[R_INTR_STATUS ] &= ~val; + +dw_i3c_update_irq (s); +} + +static void dw_i3c_intr_status_en_w (DWI3C *s,uint32_t val) +{ + s->regs[R_INTR_STATUS_EN ] = val; +dw_i3c_update_irq (s); +} + +static void dw_i3c_intr_signal_en_w (DWI3C *s,uint32_t val) +{ + s->regs[R_INTR_SIGNAL_EN ] = val; +dw_i3c_update_irq (s); +} + +static void dw_i3c_intr_force_w (DWI3C *s,uint32_t val) +{ +/* INTR_FORCE is WO, just set the corresponding INTR_STATUS bits. */ + s->regs[R_INTR_STATUS ] = val; +dw_i3c_update_irq (s); +} +static uint64_t dw_i3c_read (void *opaque,hwaddr offset,unsigned size) {DWI3C *s =DW_I3C (opaque);
@@ -348,6 +389,9 @@ static uint64_t dw_i3c_read(void *opaque, hwaddr offset, unsigned size)case R_INTR_FORCE : value =0 ;break ; +case R_INTR_STATUS : + value =dw_i3c_intr_status_r (s); +break ;default : value = s->regs[addr];break ;
@@ -392,6 +436,18 @@ static void dw_i3c_write(void *opaque, hwaddr offset, uint64_t value,break ;case R_RESET_CTRL :break ; +case R_INTR_STATUS : +dw_i3c_intr_status_w (s, val32); +break ; +case R_INTR_STATUS_EN : +dw_i3c_intr_status_en_w (s, val32); +break ; +case R_INTR_SIGNAL_EN : +dw_i3c_intr_signal_en_w (s, val32); +break ; +case R_INTR_FORCE : +dw_i3c_intr_force_w (s, val32); +break ;default : s->regs[addr] = val32;break ;
Signature · 1 line
2.53.0
[PULL 08/38] hw/i3c/dw-i3c: Add more reset values
In reply to Cédric Le GoaterFrom: Jamin Lin <[email protected]>
Adds reset values for the new registers added.
--- hw/i3c/dw-i3c.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-)
hw/i3c/dw-i3c.c +19 -1
@@ -268,14 +268,32 @@ REG32(DEVICE_ADDR_TABLE_LOC1, 0x280) FIELD(DEVICE_ADDR_TABLE_LOC1, LEGACY_I2C_DEVICE, 31, 1)static const uint32_t dw_i3c_resets[DW_I3C_NR_REGS ] = { - [R_HW_CAPABILITY ] =0x000e00bf , +/* Target mode is not supported, don't advertise it for now. */ + [R_HW_CAPABILITY ] =0x000e00b9 , [R_QUEUE_THLD_CTRL ] =0x01000101 , + [R_DATA_BUFFER_THLD_CTRL ] =0x01010100 , + [R_SLV_EVENT_CTRL ] =0x0000000b , + [R_QUEUE_STATUS_LEVEL ] =0x00000002 , + [R_DATA_BUFFER_STATUS_LEVEL ] =0x00000010 , + [R_PRESENT_STATE ] =0x00000003 , [R_I3C_VER_ID ] =0x3130302a , [R_I3C_VER_TYPE ] =0x6c633033 , [R_DEVICE_ADDR_TABLE_POINTER ] =0x00080280 , [R_DEV_CHAR_TABLE_POINTER ] =0x00020200 , + [R_SLV_CHAR_CTRL ] =0x00010000 , [A_VENDOR_SPECIFIC_REG_POINTER ] =0x000000b0 , [R_SLV_MAX_LEN ] =0x00ff00ff , + [R_SLV_TSX_SYMBL_TIMING ] =0x0000003f , + [R_SCL_I3C_OD_TIMING ] =0x000a0010 , + [R_SCL_I3C_PP_TIMING ] =0x000a000a , + [R_SCL_I2C_FM_TIMING ] =0x00100010 , + [R_SCL_I2C_FMP_TIMING ] =0x00100010 , + [R_SCL_EXT_LCNT_TIMING ] =0x20202020 , + [R_SCL_EXT_TERMN_LCNT_TIMING ] =0x00300000 , + [R_BUS_FREE_TIMING ] =0x00200020 , + [R_BUS_IDLE_TIMING ] =0x00000020 , + [R_EXTENDED_CAPABILITY ] =0x00000239 , + [R_SLAVE_CONFIG ] =0x00000023 , };static uint64_t dw_i3c_read (void *opaque,hwaddr offset,unsigned size)
Signature · 1 line
2.53.0
[PULL 15/38] hw/i3c/dw-i3c: Add IBI handling
In reply to Cédric Le GoaterFrom: Jamin Lin <[email protected]>
Adds handling for different IBI events that the controller can receive. This includes:
- Handling a hot-join from a target
- Handling a secondary controller on the bus requesting to be the primary bus controller
- Handling an interrupt request from a target.
When receiving an IBI, the controller sets an interrupt to notify software about what happened.
When the IBI is finished being serviced, the controller pushes the result of the IBI and any data received from the target into the IBI queue.
--- include/hw/i3c/dw-i3c.h | 27 ++++ hw/i3c/dw-i3c.c | 317 ++++++++++++++++++++++++++++++++++++++++ hw/i3c/trace-events | 2 + 3 files changed, 346 insertions(+)
include/hw/i3c/dw-i3c.h +27 -0
@@ -141,6 +141,28 @@ typedef union DWI3CCmdQueueData {DWI3CAddrAssignCmd addr_assign_cmd; } DWI3CCmdQueueData; +/* +* When we receive an IBI with data, we need to store it temporarily until +* the target is finished sending data. Then we can set the IBI queue status +* appropriately. +*/ +typedef struct DWI3CIBIData { +/* Do we notify the user that an IBI was NACKed? */ +bool notify_ibi_nack; +/* Intermediate storage of IBI_QUEUE_STATUS. */ +uint32_t ibi_queue_status; +/* Temporary buffer to store IBI data from the target. */ +Fifo8 ibi_intermediate_queue; +/* The address we should send a CCC_DISEC to. */ +uint8_t disec_addr; +/* The byte we should send along with the CCC_DISEC. */ +uint8_t disec_byte; +/* Should we send a direct DISEC CCC? (As opposed to global). */ +bool send_direct_disec; +/* Was this IBI NACKed? */ +bool ibi_nacked; +}DWI3CIBIData ; +struct DWI3C {SysBusDevice parent_obj;
@@ -152,11 +174,16 @@ struct DWI3C {Fifo32 resp_queue;Fifo32 tx_queue;Fifo32 rx_queue; +Fifo32 ibi_queue; + +/* Temporary storage for IBI data. */ +DWI3CIBIData ibi_data;struct {uint8_t id;uint8_t cmd_resp_queue_capacity_bytes;uint16_t tx_rx_queue_capacity_bytes; +uint8_t ibi_queue_capacity_bytes;uint8_t num_addressable_devices;uint16_t dev_addr_table_pointer;uint16_t dev_addr_table_depth;
hw/i3c/dw-i3c.c +317 -0
361 lines not on this page · raw message
hw/i3c/trace-events +2 -0
@@ -9,6 +9,8 @@ dw_i3c_read(uint32_t deviceid, uint64_t offset, uint64_t data) "I3C Dev[%u] read dw_i3c_write(uint32_t deviceid, uint64_t offset, uint64_t data) "I3C Dev[%u] write: offset 0x%" PRIx64 " data 0x%" PRIx64 dw_i3c_send(uint32_t deviceid, uint32_t num_bytes) "I3C Dev[%u] send %" PRId32 " bytes to bus" dw_i3c_recv_data(uint32_t deviceid, uint32_t num_bytes) "I3C Dev[%u] recv %" PRId32 " bytes from bus" +dw_i3c_ibi_recv(uint32_t deviceid, uint8_t ibi_byte) "I3C Dev[%u] recv IBI byte 0x%" PRIx8 +dw_i3c_ibi_handle(uint32_t deviceid, uint8_t addr, bool rnw) "I3C Dev[%u] handle IBI from address 0x%" PRIx8 " RnW=%d" dw_i3c_pop_rx(uint32_t deviceid, uint32_t data) "I3C Dev[%u] pop 0x%" PRIx32 " from RX FIFO" dw_i3c_resp_queue_push(uint32_t deviceid, uint32_t data) "I3C Dev[%u] push 0x%" PRIx32 " to response queue" dw_i3c_push_tx(uint32_t deviceid, uint32_t data) "I3C Dev[%u] push 0x%" PRIx32 " to TX FIFO"
Signature · 1 line
2.53.0
[PULL 12/38] hw/i3c/dw-i3c: Use 32 bits on MMIO writes
In reply to Cédric Le GoaterFrom: Jamin Lin <[email protected]>
The registers are only 32 bits wide, so we should cast the 64-bit value passed in to only be 32 bits wide.
--- hw/i3c/dw-i3c.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
hw/i3c/dw-i3c.c +3 -2
@@ -363,10 +363,11 @@ static void dw_i3c_write(void *opaque, hwaddr offset, uint64_t value, {DWI3C *s =DW_I3C (opaque);uint32_t addr = offset >>2 ; +uint32_t val32 = (uint32_t )value;trace_dw_i3c_write (s->id, offset, value); - value &= ~dw_i3c_ro[addr]; + val32 &= ~dw_i3c_ro[addr];switch (addr) {case R_HW_CAPABILITY :case R_RESPONSE_QUEUE_PORT :
@@ -392,7 +393,7 @@ static void dw_i3c_write(void *opaque, hwaddr offset, uint64_t value,case R_RESET_CTRL :break ;default : - s->regs[addr] = value; + s->regs[addr] = val32;break ; } }
Signature · 1 line
2.53.0
[PULL 25/38] hw/i3c/dw-i3c: Use ROUND_UP() for RX buffer allocation alignment
In reply to Cédric Le GoaterFrom: Jamin Lin <[email protected]>
The RX temporary buffer allocation manually aligned the size using:
num + (4 - (num & 0x03))
Replace this with ROUND_UP(num, 4) for better readability and consistency with common QEMU coding style.
No functional change.
--- hw/i3c/dw-i3c.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/i3c/dw-i3c.c +1 -1
@@ -1282,7 +1282,7 @@ static uint16_t dw_i3c_rx(DWI3C *s, uint16_t num, bool is_i2c)* Allocate a temporary buffer to read data from the target. * Zero it and word-align it as well in case we're reading unaligned data. */ - g_autofree uint8_t *data = g_new0(uint8_t, num + (4 - (num & 0x03))); + g_autofree uint8_t *data = g_new0(uint8_t, ROUND_UP(num, 4));uint32_t *data32 = (uint32_t *)data;/* * 32-bits since the I3C API wants a 32-bit number, even though the
Signature · 1 line
2.53.0
[PULL 09/38] hw/i3c/aspeed_i3c: Add register RO field masks
In reply to Cédric Le GoaterFrom: Jamin Lin <[email protected]>
Adds read-only register masks for the Aspeed I3C controller registers.
--- hw/i3c/aspeed_i3c.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
hw/i3c/aspeed_i3c.c +16 -0
@@ -74,6 +74,21 @@ REG32(I3C6_REG1, 0x64) FIELD(I3C6_REG1, SA_EN, 15, 1) FIELD(I3C6_REG1, INST_ID, 16, 4) +static const uint32_t ast2600_i3c_controller_ro[ASPEED_I3C_NR_REGS ] = { + [R_I3C1_REG0 ] =0xcc000000 , + [R_I3C1_REG1 ] =0xfff00000 , + [R_I3C2_REG0 ] =0xcc000000 , + [R_I3C2_REG1 ] =0xfff00000 , + [R_I3C3_REG0 ] =0xcc000000 , + [R_I3C3_REG1 ] =0xfff00000 , + [R_I3C4_REG0 ] =0xcc000000 , + [R_I3C4_REG1 ] =0xfff00000 , + [R_I3C5_REG0 ] =0xcc000000 , + [R_I3C5_REG1 ] =0xfff00000 , + [R_I3C6_REG0 ] =0xcc000000 , + [R_I3C6_REG1 ] =0xfff00000 , +}; +static uint64_t aspeed_i3c_read (void *opaque,hwaddr addr,unsigned int size) {AspeedI3CState *s =ASPEED_I3C (opaque);
@@ -97,6 +112,7 @@ static void aspeed_i3c_write(void *opaque, addr >>=2 ; + data &= ~ast2600_i3c_controller_ro[addr];/* I3C controller register */ switch (addr) {case R_I3C1_REG1 :
Signature · 1 line
2.53.0
[PULL 11/38] hw/i3c/dw-i3c: Treat more registers as read-as-zero
In reply to Cédric Le GoaterFrom: Jamin Lin <[email protected]>
RESET_CTRL and INTR_FORCE are write-only.
--- hw/i3c/dw-i3c.c | 3 +++ 1 file changed, 3 insertions(+)
hw/i3c/dw-i3c.c +3 -0
@@ -342,7 +342,10 @@ static uint64_t dw_i3c_read(void *opaque, hwaddr offset, unsigned size)uint64_t value;switch (addr) { +/* RAZ */ case R_COMMAND_QUEUE_PORT : +case R_RESET_CTRL : +case R_INTR_FORCE : value =0 ;break ;default :
Signature · 1 line
2.53.0
[PULL 30/38] tests/functional/arm/test_aspeed_ast1060: Update test aspeed-zephyr-project v03.05
In reply to Cédric Le GoaterFrom: Jamin Lin <[email protected]>
--- tests/functional/arm/test_aspeed_ast1060.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
tests/functional/arm/test_aspeed_ast1060.py +7 -7
@@ -11,18 +11,18 @@ class AST1060Machine(AspeedTest): - ASSET_ASPEED_AST1060_PROT_3_04 = Asset( + ASSET_ASPEED_AST1060_PROT_3_05 = Asset( ('https://github.com/AspeedTech-BMC' - '/aspeed-zephyr-project/releases/download/v03.04' - '/ast1060_prot_v03.04.tgz'), - 'c0319df55f5b7a547efefc5a6ba374b881223d5fe1a776bfdd36f97fd1f31d50') + '/aspeed-zephyr-project/releases/download/v03.05' + '/ast1060_prot_v03.05.tgz'), + '63b36d7420290726ca80477de254474b7cb79539a42819bb1fe2665d598dadb5') - def test_arm_ast1060_prot_3_04(self): + def test_arm_ast1060_prot_3_05(self): self.set_machine('ast1060-evb') kernel_name = "ast1060_prot/zephyr.bin" kernel_file = self.archive_extract( - self.ASSET_ASPEED_AST1060_PROT_3_04, member=kernel_name) + self.ASSET_ASPEED_AST1060_PROT_3_05, member=kernel_name) self.vm.set_console() self.vm.add_args('-kernel', kernel_file, '-nographic')
@@ -35,7 +35,7 @@ def test_arm_ast1060_otp_blockdev_device(self): self.vm.set_machine("ast1060-evb") kernel_name = "ast1060_prot/zephyr.bin" - kernel_file = self.archive_extract(self.ASSET_ASPEED_AST1060_PROT_3_04, + kernel_file = self.archive_extract(self.ASSET_ASPEED_AST1060_PROT_3_05, member=kernel_name) otp_img = self.generate_otpmem_image()
Signature · 1 line
2.53.0
[PULL 17/38] hw/i3c/dw-i3c: Add controller resets
In reply to Cédric Le GoaterFrom: Jamin Lin <[email protected]>
Adds behavior to the device reset register.
--- hw/i3c/dw-i3c.c | 117 ++++++++++++++++++++++++++++++++++++++++++++ hw/i3c/trace-events | 1 + 2 files changed, 118 insertions(+)
hw/i3c/dw-i3c.c +117 -0
@@ -860,6 +860,122 @@ static void dw_i3c_intr_force_w(DWI3C *s, uint32_t val)dw_i3c_update_irq (s); } +static void dw_i3c_cmd_queue_reset (DWI3C *s) +{ +fifo32_reset (&s->cmd_queue); + +ARRAY_FIELD_DP32 (s->regs,QUEUE_STATUS_LEVEL ,CMD_QUEUE_EMPTY_LOC , +fifo32_num_free (&s->cmd_queue)); +uint8_t empty_threshold =ARRAY_FIELD_EX32 (s->regs,QUEUE_THLD_CTRL , +CMD_BUF_EMPTY_THLD ); +if (fifo32_num_free (&s->cmd_queue) >= empty_threshold) { +ARRAY_FIELD_DP32 (s->regs,INTR_STATUS ,CMD_QUEUE_RDY ,1 ); +dw_i3c_update_irq (s); + }; +} + +static void dw_i3c_resp_queue_reset (DWI3C *s) +{ +fifo32_reset (&s->resp_queue); + +ARRAY_FIELD_DP32 (s->regs,QUEUE_STATUS_LEVEL ,RESP_BUF_BLR , +fifo32_num_used (&s->resp_queue)); +/* +* This interrupt will always be cleared because the threshold is a minimum +* of 1 and the queue size is 0. +*/ +ARRAY_FIELD_DP32 (s->regs,INTR_STATUS ,RESP_RDY ,0 ); +dw_i3c_update_irq (s); +} + +static void dw_i3c_ibi_queue_reset (DWI3C *s) +{ +fifo32_reset (&s->ibi_queue); + +ARRAY_FIELD_DP32 (s->regs,QUEUE_STATUS_LEVEL ,IBI_BUF_BLR , +fifo32_num_used (&s->resp_queue)); +/* +* This interrupt will always be cleared because the threshold is a minimum +* of 1 and the queue size is 0. +*/ +ARRAY_FIELD_DP32 (s->regs,INTR_STATUS ,IBI_THLD ,0 ); +dw_i3c_update_irq (s); +} + +static void dw_i3c_tx_queue_reset (DWI3C *s) +{ +fifo32_reset (&s->tx_queue); + +ARRAY_FIELD_DP32 (s->regs,DATA_BUFFER_STATUS_LEVEL ,TX_BUF_EMPTY_LOC , +fifo32_num_free (&s->tx_queue)); +/* TX buf is empty, so this interrupt will always be set. */ +ARRAY_FIELD_DP32 (s->regs,INTR_STATUS ,TX_THLD ,1 ); +dw_i3c_update_irq (s); +} + +static void dw_i3c_rx_queue_reset (DWI3C *s) +{ +fifo32_reset (&s->rx_queue); + +ARRAY_FIELD_DP32 (s->regs,DATA_BUFFER_STATUS_LEVEL ,RX_BUF_BLR , +fifo32_num_used (&s->resp_queue)); +/* +* This interrupt will always be cleared because the threshold is a minimum +* of 1 and the queue size is 0. +*/ +ARRAY_FIELD_DP32 (s->regs,INTR_STATUS ,RX_THLD ,0 ); +dw_i3c_update_irq (s); +} + +static void dw_i3c_reset (DeviceState *dev) +{ +DWI3C *s =DW_I3C (dev); +trace_dw_i3c_reset (s->cfg.id); + +memcpy (s->regs, dw_i3c_resets,sizeof (s->regs)); +/* +* The user config for these may differ from our resets array, set them +* manually. +*/ +ARRAY_FIELD_DP32 (s->regs,DEVICE_ADDR_TABLE_POINTER ,ADDR , + s->cfg.dev_addr_table_pointer); +ARRAY_FIELD_DP32 (s->regs,DEVICE_ADDR_TABLE_POINTER ,DEPTH , + s->cfg.dev_addr_table_depth); +ARRAY_FIELD_DP32 (s->regs,DEV_CHAR_TABLE_POINTER , +P_DEV_CHAR_TABLE_START_ADDR , + s->cfg.dev_char_table_pointer); +ARRAY_FIELD_DP32 (s->regs,DEV_CHAR_TABLE_POINTER ,DEV_CHAR_TABLE_DEPTH , + s->cfg.dev_char_table_depth); + +dw_i3c_cmd_queue_reset (s); +dw_i3c_resp_queue_reset (s); +dw_i3c_ibi_queue_reset (s); +dw_i3c_tx_queue_reset (s); +dw_i3c_rx_queue_reset (s); +} + +static void dw_i3c_reset_ctrl_w (DWI3C *s,uint32_t val) +{ +if (FIELD_EX32 (val,RESET_CTRL ,CORE_RESET )) { +dw_i3c_reset (DEVICE (s)); + } +if (FIELD_EX32 (val,RESET_CTRL ,CMD_QUEUE_RESET )) { +dw_i3c_cmd_queue_reset (s); + } +if (FIELD_EX32 (val,RESET_CTRL ,RESP_QUEUE_RESET )) { +dw_i3c_resp_queue_reset (s); + } +if (FIELD_EX32 (val,RESET_CTRL ,TX_BUF_RESET )) { +dw_i3c_tx_queue_reset (s); + } +if (FIELD_EX32 (val,RESET_CTRL ,RX_BUF_RESET )) { +dw_i3c_rx_queue_reset (s); + } +if (FIELD_EX32 (val,RESET_CTRL ,IBI_QUEUE_RESET )) { +dw_i3c_ibi_queue_reset (s); + } +} +static uint32_t dw_i3c_pop_rx (DWI3C *s) {if (fifo32_is_empty (&s->rx_queue)) {
@@ -1617,6 +1733,7 @@ static void dw_i3c_write(void *opaque, hwaddr offset, uint64_t value,dw_i3c_cmd_queue_port_w (s, val32);break ;case R_RESET_CTRL : +dw_i3c_reset_ctrl_w (s, val32);break ;case R_INTR_STATUS :dw_i3c_intr_status_w (s, val32);
hw/i3c/trace-events +1 -0
@@ -11,6 +11,7 @@ dw_i3c_send(uint32_t deviceid, uint32_t num_bytes) "I3C Dev[%u] send %" PRId32 " dw_i3c_recv_data(uint32_t deviceid, uint32_t num_bytes) "I3C Dev[%u] recv %" PRId32 " bytes from bus" dw_i3c_ibi_recv(uint32_t deviceid, uint8_t ibi_byte) "I3C Dev[%u] recv IBI byte 0x%" PRIx8 dw_i3c_ibi_handle(uint32_t deviceid, uint8_t addr, bool rnw) "I3C Dev[%u] handle IBI from address 0x%" PRIx8 " RnW=%d" +dw_i3c_reset(uint32_t deviceid) "I3C Dev[%u] reset" dw_i3c_pop_rx(uint32_t deviceid, uint32_t data) "I3C Dev[%u] pop 0x%" PRIx32 " from RX FIFO" dw_i3c_resp_queue_push(uint32_t deviceid, uint32_t data) "I3C Dev[%u] push 0x%" PRIx32 " to response queue" dw_i3c_push_tx(uint32_t deviceid, uint32_t data) "I3C Dev[%u] push 0x%" PRIx32 " to TX FIFO"
Signature · 1 line
2.53.0
[PULL 35/38] tests/functional/arm/test_aspeed_ast2600_sdk_515: Update test ASPEED OpenBMC SDK v11.01
In reply to Cédric Le GoaterFrom: Jamin Lin <[email protected]>
--- tests/functional/arm/test_aspeed_ast2600_sdk_515.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
tests/functional/arm/test_aspeed_ast2600_sdk_515.py +5 -5
@@ -10,17 +10,17 @@ class AST2600Machine(AspeedTest): - ASSET_SDK_V1100_AST2600_515 = Asset( - 'https://github.com/AspeedTech-BMC/openbmc/releases/download/v11.00/ast2600-default-515-obmc.tar.gz', - 'ece1a934095378929780f03e7d092e562f4b33b2841b80ad7c3d12a85744c0f6') + ASSET_SDK_V1101_AST2600_515 = Asset( + 'https://github.com/AspeedTech-BMC/openbmc/releases/download/v11.01/ast2600-default-515-image.tar.gz', + 'f3ccf1c08db71cf891637fc73131b80b2c0c0e005c06d5dcae0cf74fc458b43c') def test_arm_ast2600_evb_sdk_515(self): self.set_machine('ast2600-evb') - self.archive_extract(self.ASSET_SDK_V1100_AST2600_515) + self.archive_extract(self.ASSET_SDK_V1101_AST2600_515) self.do_test_arm_aspeed_sdk_start( - self.scratch_file("ast2600-default-515", "image-bmc")) + self.scratch_file("ast2600-default-515-image", "image-bmc")) self.wait_for_console_pattern('ast2600-default-515 login:')
Signature · 1 line
2.53.0
[PULL 16/38] hw/i3c/dw-i3c: Add ctrl MMIO handling
In reply to Cédric Le GoaterFrom: Jamin Lin <[email protected]>
Adds functionality to the CTRL register.
--- hw/i3c/dw-i3c.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+)
hw/i3c/dw-i3c.c +35 -0
@@ -344,6 +344,8 @@ static const uint32_t dw_i3c_ro[DW_I3C_NR_REGS] = { [R_SLAVE_CONFIG] = 0xffffffff, }; +static void dw_i3c_cmd_queue_execute (DWI3C *s); +static inline bool dw_i3c_has_hdr_ts (DWI3C *s) {return ARRAY_FIELD_EX32 (s->regs,HW_CAPABILITY ,HDR_TS );
@@ -503,6 +505,36 @@ static int dw_i3c_recv_data(DWI3C *s, bool is_i2c, uint8_t *data,return ret; } +static void dw_i3c_ctrl_w (DWI3C *s,uint32_t val) +{ +/* +* If the user is setting I3C_RESUME, the controller was halted. +* Try and resume execution and leave the bit cleared. +*/ +if (FIELD_EX32 (val,DEVICE_CTRL ,I3C_RESUME )) { +dw_i3c_cmd_queue_execute (s); + val =FIELD_DP32 (val,DEVICE_CTRL ,I3C_RESUME ,0 ); + } +/* +* I3C_ABORT being set sends an I3C STOP. It's cleared when the STOP is +* sent. +*/ +if (FIELD_EX32 (val,DEVICE_CTRL ,I3C_ABORT )) { +dw_i3c_end_transfer (s,/*is_i2c=*/ true); +dw_i3c_end_transfer (s,/*is_i2c=*/ false); + val =FIELD_DP32 (val,DEVICE_CTRL ,I3C_ABORT ,0 ); +ARRAY_FIELD_DP32 (s->regs,INTR_STATUS ,TRANSFER_ABORT ,1 ); +dw_i3c_update_irq (s); + } +/* Update present state. */ +ARRAY_FIELD_DP32 (s->regs,PRESENT_STATE ,CM_TFR_ST_STATUS , +DW_I3C_TRANSFER_STATE_IDLE ); +ARRAY_FIELD_DP32 (s->regs,PRESENT_STATE ,CM_TFR_STATUS , +DW_I3C_TRANSFER_STATUS_IDLE ); + + s->regs[R_DEVICE_CTRL ] = val; +} +static inline bool dw_i3c_target_is_i2c (DWI3C *s,uint16_t offset) {/* / sizeof(uint32_t) because we're indexing into our 32-bit reg array. */
@@ -1575,6 +1607,9 @@ static void dw_i3c_write(void *opaque, hwaddr offset, uint64_t value,"] = 0x%08" PRIx64"\n" , __func__, offset, value);break ; +case R_DEVICE_CTRL : +dw_i3c_ctrl_w (s, val32); +break ;case R_RX_TX_DATA_PORT :dw_i3c_push_tx (s, val32);break ;
Signature · 1 line
2.53.0
[PULL 21/38] hw/i3c: Add hotplug support
In reply to Cédric Le GoaterFrom: Jamin Lin <[email protected]>
This adds support for hotplugging in I3C.
Conceptually this can be thought of as an I3C target being physically socketed onto a board.
It is then the target's responsibility to go through the hot-join and DAA process so it can participate on the bus.
--- hw/i3c/core.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
hw/i3c/core.c +17 -0
@@ -11,6 +11,7 @@#include "qapi/error.h" #include "trace.h" #include "hw/i3c/i3c.h" +#include "hw/core/hotplug.h" #include "hw/core/qdev-properties.h" /*
@@ -26,6 +27,17 @@ static const Property i3c_props[] = { DEFINE_PROP_UINT64("pid", struct I3CTarget, pid, 0), }; +static void i3c_realize (BusState *bus,Error **errp) +{ +qbus_set_bus_hotplug_handler (bus); +} + +static void i3c_class_init (ObjectClass *klass,const void *data) +{ +BusClass *k =BUS_CLASS (klass); + k->realize = i3c_realize; +} +I3CBus *i3c_init_bus (DeviceState *parent,const char *name) {return i3c_init_bus_type (TYPE_I3C_BUS , parent, name);
@@ -633,6 +645,11 @@ static const TypeInfo i3c_types[] = { .parent = TYPE_BUS, .instance_size = sizeof(I3CBus), .class_size = sizeof(I3CBusClass), + .class_init = i3c_class_init, + .interfaces = (InterfaceInfo []) { + {TYPE_HOTPLUG_HANDLER }, + { } + } }, { .name = TYPE_I3C_TARGET,
Signature · 1 line
2.53.0
[PULL 31/38] tests/functional/arm/test_aspeed_ast2500_sdk: Update test ASPEED OpenBMC SDK v11.01
In reply to Cédric Le GoaterFrom: Jamin Lin <[email protected]>
--- tests/functional/arm/test_aspeed_ast2500_sdk.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
tests/functional/arm/test_aspeed_ast2500_sdk.py +4 -4
@@ -10,14 +10,14 @@ class AST2500Machine(AspeedTest): - ASSET_SDK_V1000_AST2500 = Asset( - 'https://github.com/AspeedTech-BMC/openbmc/releases/download/v10.00/ast2500-default-obmc.tar.gz', - '7d71a3f71d5f4d9f3451f59a73bf9baf8fd9f6a24107eb504a3216151a8b2b5b') + ASSET_SDK_V1101_AST2500 = Asset( + 'https://github.com/AspeedTech-BMC/openbmc/releases/download/v11.01/ast2500-default-obmc.tar.gz', + '3faa1188198da2216837be4b53861c483a58c3ad63784089720bf8421e157da1') def test_arm_ast2500_evb_sdk(self): self.set_machine('ast2500-evb') - self.archive_extract(self.ASSET_SDK_V1000_AST2500) + self.archive_extract(self.ASSET_SDK_V1101_AST2500) self.do_test_arm_aspeed_sdk_start( self.scratch_file("ast2500-default", "image-bmc"))
Signature · 1 line
2.53.0
[PULL 34/38] tests/functional/arm/test_aspeed_ast2600_sdk_otp: Update test ASPEED OpenBMC SDK v11.01
In reply to Cédric Le GoaterFrom: Jamin Lin <[email protected]>
--- tests/functional/arm/test_aspeed_ast2600_sdk_otp.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
tests/functional/arm/test_aspeed_ast2600_sdk_otp.py +5 -5
@@ -12,15 +12,15 @@ class AST2600Machine(AspeedTest): - ASSET_SDK_V1100_AST2600 = Asset( - 'https://github.com/AspeedTech-BMC/openbmc/releases/download/v11.00/ast2600-default-obmc.tar.gz', - '64d8926a7d01b649168be96c986603b5690f06391286c438a3a772c8c7039e93') + ASSET_SDK_V1101_AST2600 = Asset( + 'https://github.com/AspeedTech-BMC/openbmc/releases/download/v11.01/ast2600-default-image.tar.gz', + '3c5b4d4ccf27b0d208a073f98426db54cd751b96143180cd15df1a83978f832c') def test_arm_ast2600_otp_blockdev_device(self): self.vm.set_machine("ast2600-evb") self.require_netdev('user') - image_path = self.archive_extract(self.ASSET_SDK_V1100_AST2600) + image_path = self.archive_extract(self.ASSET_SDK_V1101_AST2600) otp_img = self.generate_otpmem_image() self.vm.set_console()
@@ -29,7 +29,7 @@ def test_arm_ast2600_otp_blockdev_device(self): "-global", "aspeed-otp.drive=otp", ) self.vm.add_args('-drive', 'file=' + - self.scratch_file("ast2600-default", "image-bmc") + + self.scratch_file("ast2600-default-image", "image-bmc") + ',if=mtd,format=raw', '-net', 'nic', '-net', 'user', '-snapshot') self.vm.launch()
Signature · 1 line
2.53.0
[PULL 29/38] tests/functional/arm/test_aspeed_ast1030: Update test ASPEED Zephyr SDK v03.06
In reply to Cédric Le GoaterFrom: Jamin Lin <[email protected]>
--- tests/functional/arm/test_aspeed_ast1030.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
tests/functional/arm/test_aspeed_ast1030.py +6 -6
@@ -12,17 +12,17 @@ class AST1030Machine(AspeedTest): - ASSET_ZEPHYR_3_05 = Asset( + ASSET_ZEPHYR_3_06 = Asset( ('https://github.com/AspeedTech-BMC' - '/zephyr/releases/download/v00.03.05/ast1030-evb-demo.zip'), - '057528d343490b1fbb5a721e91084b4f04fec60dc114bd65e724554f9c217f4b') + '/zephyr/releases/download/v00.03.06/ast1030-evb-demo.zip'), + '056f37fcd9f165308cedca3a08f2bed37ed40c0a1402c4fa515613b80a369f38') - def test_arm_ast1030_zephyros_3_05(self): + def test_arm_ast1030_zephyros_3_06(self): self.set_machine('ast1030-evb') kernel_name = "ast1030-evb-demo/zephyr.elf" kernel_file = self.archive_extract( - self.ASSET_ZEPHYR_3_05, member=kernel_name) + self.ASSET_ZEPHYR_3_06, member=kernel_name) self.vm.set_console() self.vm.add_args('-kernel', kernel_file, '-nographic')
@@ -72,7 +72,7 @@ def test_arm_ast1030_otp_blockdev_device(self): self.vm.set_machine("ast1030-evb") kernel_name = "ast1030-evb-demo/zephyr.elf" - kernel_file = self.archive_extract(self.ASSET_ZEPHYR_3_05, + kernel_file = self.archive_extract(self.ASSET_ZEPHYR_3_06, member=kernel_name) otp_img = self.generate_otpmem_image()
Signature · 1 line
2.53.0
[PULL 27/38] hw/i3c/core: Initialize num_sent in i3c_send_byte()
In reply to Cédric Le GoaterFrom: Jamin Lin <[email protected]>
i3c_send_byte() declared num_sent without initializing it before passing its address to i3c_send().
Although i3c_send_byte() itself ignores num_sent after the call, i3c_send() forwards it to trace_i3c_send(). If the target send callback does not set *num_sent, the trace may print an uninitialized value, leading to misleading or garbage output.
Example concern from review:
trace_i3c_send(*num_sent, num_to_send, ret == 0);
If *num_sent is not written by the callback, this trace can report an incorrect number of transmitted bytes.
Initialize num_sent to 0 to ensure deterministic and predictable trace output, even if the callback fails to update it.
--- hw/i3c/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/i3c/core.c +1 -1
@@ -325,7 +325,7 @@ int i3c_send_byte(I3CBus *bus, uint8_t data)* Ignored, the caller can determine how many were sent based on if this was * ACKed/NACKed. */ -uint32_t num_sent; +uint32_t num_sent =0 ;return i3c_send (bus, &data,1 , &num_sent); }
Signature · 1 line
2.53.0
[PULL 18/38] hw/i3c/aspeed: Add I3C bus get function
In reply to Cédric Le GoaterFrom: Jamin Lin <[email protected]>
To retrieve the I3C bus object normally, the order is Aspeed I3C -> DW I3C[n] -> bus object, so make a nice wrapper for people to use.
--- include/hw/i3c/aspeed_i3c.h | 3 +++ hw/i3c/aspeed_i3c.c | 9 +++++++++ 2 files changed, 12 insertions(+)
include/hw/i3c/aspeed_i3c.h +3 -0
@@ -31,4 +31,7 @@ struct AspeedI3CState {DWI3C devices[ASPEED_I3C_NR_DEVICES ]; uint8_t id; }; + +I3CBus *aspeed_i3c_get_bus (AspeedI3CState *s,uint8_t bus_num); +#endif /* ASPEED_I3C_H */
hw/i3c/aspeed_i3c.c +9 -0
@@ -153,6 +153,15 @@ static const MemoryRegionOps aspeed_i3c_ops = { } }; +I3CBus *aspeed_i3c_get_bus (AspeedI3CState *s,uint8_t bus_num) +{ +if (bus_num <ARRAY_SIZE (s->devices)) { +return s->devices[bus_num].bus; + } +/* Developer error, fail fast. */ +g_assert_not_reached (); +} +static void aspeed_i3c_reset (DeviceState *dev) {AspeedI3CState *s =ASPEED_I3C (dev);
Signature · 1 line
2.53.0
[PULL 23/38] MAINTAINERS: Add I3C maintainers and reviewer
In reply to Cédric Le GoaterFrom: Jamin Lin <[email protected]>
Add a new I3C section to the MAINTAINERS file.
List Joe Komlodi, Cédric Le Goater and Jamin Lin as maintainers, and Nabih Estefan as the reviewer, covering the I3C core and related files under hw/i3c/ and include/hw/i3c/.
--- MAINTAINERS | 13 +++++++++++++ 1 file changed, 13 insertions(+)
MAINTAINERS +13 -0
@@ -3956,6 +3956,19 @@ F: include/hw/i2c/smbus_master.h F: include/hw/i2c/smbus_slave.h F: include/hw/i2c/smbus_eeprom.h +I3C +M: Joe Komlodi <[email protected]> +M: Cédric Le Goater <[email protected]> +M: Jamin Lin <[email protected]> +R: Nabih Estefan <[email protected]> +S: Maintained +F: hw/i3c/*.c +F: hw/i3c/.h +F: hw/i3c/Kconfig +F: hw/i3c/meson.build +F: hw/i3c/trace-events +F: include/hw/i3c/*.h + PMBus M: Titus Rwantare <[email protected]> S: Maintained
Signature · 1 line
2.53.0
[PULL 36/38] tests/functional/aarch64/test_aspeed_ast2700a1: Update test ASPEED OpenBMC SDK v11.01
In reply to Cédric Le GoaterFrom: Jamin Lin <[email protected]>
--- .../aarch64/test_aspeed_ast2700a1.py | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-)
tests/functional/aarch64/test_aspeed_ast2700a1.py +15 -15
@@ -78,13 +78,13 @@ def verify_openbmc_boot_and_login(self, name, enable_pcie=True): exec_command_and_wait_for_pattern(self, 'root', 'Password:') exec_command_and_wait_for_pattern(self, '0penBmc', f'root@{name}:~#') - ASSET_SDK_V1100_AST2700A1 = Asset( - 'https://github.com/AspeedTech-BMC/openbmc/releases/download/v11.00/ast2700-a1-obmc.tar.gz', - 'd5ceed511cd0dfefbb102fff2d731159e0472948a28066dc0d90bcd54be76525') + ASSET_SDK_V1101_AST2700A1 = Asset( + 'https://github.com/AspeedTech-BMC/openbmc/releases/download/v11.01/ast2700-a1-image.tar.gz', + '859808828531a51931aad3b4e70b28143eebb3cde1838ba7d8e7a2b844c8a1ab') - ASSET_SDK_V1100_AST2700A1_DCSCM = Asset( - 'https://github.com/AspeedTech-BMC/openbmc/releases/download/v11.00/ast2700-a1-dcscm-obmc.tar.gz', - '4f8778be176ece1b57d33c4aee13bb989be114c3e4703150eaeb6f996bd5587f') + ASSET_SDK_V1101_AST2700A1_DCSCM = Asset( + 'https://github.com/AspeedTech-BMC/openbmc/releases/download/v11.01/ast2700-a1-dcscm-image.tar.gz', + '4654eabad75da3fd33635cd6d29b7635181daefee7294b68feb124b9d4c24116') def do_ast2700_i2c_test(self, bus_id): bus_str = str(bus_id)
@@ -147,38 +147,38 @@ def start_ast2700_test_vbootrom(self, name, bus_id): self.do_test_aarch64_aspeed_sdk_start( self.scratch_file(name, 'image-bmc'), bus_id) - def test_aarch64_ast2700a1_evb_sdk_v11_00(self): + def test_aarch64_ast2700a1_evb_sdk_v11_01(self): self.set_machine('ast2700a1-evb') self.require_netdev('user') - self.archive_extract(self.ASSET_SDK_V1100_AST2700A1) + self.archive_extract(self.ASSET_SDK_V1101_AST2700A1) self.vm.add_args('-device', 'e1000e,netdev=net1,bus=pcie.2') self.vm.add_args('-netdev', 'user,id=net1') - self.start_ast2700_test('ast2700-a1', 1) + self.start_ast2700_test('ast2700-a1-image', 1) self.verify_openbmc_boot_and_login('ast2700-a1') self.do_ast2700_i2c_test(1) self.do_ast2700_pcie_test() - def test_aarch64_ast2700a1_evb_sdk_vbootrom_v11_00(self): + def test_aarch64_ast2700a1_evb_sdk_vbootrom_v11_01(self): self.set_machine('ast2700a1-evb') self.require_netdev('user') - self.archive_extract(self.ASSET_SDK_V1100_AST2700A1) + self.archive_extract(self.ASSET_SDK_V1101_AST2700A1) self.vm.add_args('-device', 'e1000e,netdev=net1,bus=pcie.2') self.vm.add_args('-netdev', 'user,id=net1') - self.start_ast2700_test_vbootrom('ast2700-a1', 1) + self.start_ast2700_test_vbootrom('ast2700-a1-image', 1) self.verify_vbootrom_firmware_flow() self.verify_openbmc_boot_start() - def test_aarch64_ast2700a1_evb_ioexp_v11_00(self): + def test_aarch64_ast2700a1_evb_ioexp_v11_01(self): self.set_machine('ast2700a1-evb') self.require_netdev('user') - self.archive_extract(self.ASSET_SDK_V1100_AST2700A1_DCSCM) + self.archive_extract(self.ASSET_SDK_V1101_AST2700A1_DCSCM) self.vm.set_machine('ast2700a1-evb,fmc-model=w25q512jv') self.vm.add_args('-device', 'tmp105,bus=ioexp0.0,address=0x4d,id=tmp-test-16') - self.start_ast2700_test('ast2700-a1-dcscm', 8) + self.start_ast2700_test('ast2700-a1-dcscm-image', 8) self.verify_openbmc_boot_and_login('ast2700-a1-dcscm', False) self.do_ast2700_i2c_test(8) self.do_ast2700_i2c_test(16)
Signature · 1 line
2.53.0
[PULL 33/38] tests/functional/arm/test_aspeed_ast2600_sdk: Update test ASPEED OpenBMC SDK v11.01
In reply to Cédric Le GoaterFrom: Jamin Lin <[email protected]>
--- tests/functional/arm/test_aspeed_ast2600_sdk.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
tests/functional/arm/test_aspeed_ast2600_sdk.py +5 -5
@@ -14,9 +14,9 @@ class AST2600Machine(AspeedTest): - ASSET_SDK_V1100_AST2600 = Asset( - 'https://github.com/AspeedTech-BMC/openbmc/releases/download/v11.00/ast2600-default-obmc.tar.gz', - '64d8926a7d01b649168be96c986603b5690f06391286c438a3a772c8c7039e93') + ASSET_SDK_V1101_AST2600 = Asset( + 'https://github.com/AspeedTech-BMC/openbmc/releases/download/v11.01/ast2600-default-image.tar.gz', + '3c5b4d4ccf27b0d208a073f98426db54cd751b96143180cd15df1a83978f832c') def do_ast2600_pcie_test(self): exec_command_and_wait_for_pattern(self,
@@ -44,7 +44,7 @@ def test_arm_ast2600_evb_sdk(self): self.set_machine('ast2600-evb') self.require_netdev('user') - self.archive_extract(self.ASSET_SDK_V1100_AST2600) + self.archive_extract(self.ASSET_SDK_V1101_AST2600) self.vm.add_args('-device', 'tmp105,bus=aspeed.i2c.bus.5,address=0x4d,id=tmp-test')
@@ -55,7 +55,7 @@ def test_arm_ast2600_evb_sdk(self): self.vm.add_args('-device', 'mock-i3c-target,bus=dw.i3c.5,pid=0xab9078563412') self.do_test_arm_aspeed_sdk_start( - self.scratch_file("ast2600-default", "image-bmc")) + self.scratch_file("ast2600-default-image", "image-bmc")) self.wait_for_console_pattern('ast2600-default login:')
Signature · 1 line
2.53.0
[PULL 26/38] hw/i3c/mock-i3c-target: Set num_sent in TX callback to fix trace reporting
In reply to Cédric Le GoaterFrom: Jamin Lin <[email protected]>
mock_i3c_target_tx() did not update *num_sent before returning.
Although some callers may not directly use this value, i3c_send() passes num_sent to trace_i3c_send(). If the target TX callback does not initialize *num_sent, the trace output may report an incorrect or uninitialized value, leading to confusing debugging information.
For example, the following trace was observed:
mock_i3c_target_tx I3C mock target write 0x12
i3c_send I3C send 0/1 bytes, ack=1 (expected 1/1 bytes)
This happens because *num_sent was never set by the TX callback.
Fix this by setting *num_sent in all return paths, including the IBI magic handling case, to accurately reflect the number of bytes consumed.
--- hw/i3c/mock-i3c-target.c | 2 ++ 1 file changed, 2 insertions(+)
hw/i3c/mock-i3c-target.c +2 -0
@@ -70,6 +70,7 @@ static int mock_i3c_target_tx(I3CTarget *i3c, const uint8_t *data,if (s->cfg.ibi_magic && num_to_send ==1 && s->cfg.ibi_magic == *data) {mock_i3c_target_ibi_timer_start (s); + *num_sent =1 ;return 0 ; }
@@ -86,6 +87,7 @@ static int mock_i3c_target_tx(I3CTarget *i3c, const uint8_t *data, s->buf[s->p_buf] = data[i]; s->p_buf++; } + *num_sent = to_write;return ret; }
Signature · 1 line
2.53.0
[PULL 28/38] hw/i3c/mock-i3c-target: Simplify GETMRL byte extraction logic
In reply to Cédric Le GoaterFrom: Jamin Lin <[email protected]>
The GETMRL handling logic extracted MSB/LSB bytes from s->cfg.buf_size using a mask-and-shift expression:
(buf_size & (0xff00 >> (offset * 8))) >>
(8 - (offset * 8))
While functionally correct, the expression is difficult to read and obscures the intent, which is simply to return a 16-bit value in MSB-first order.
Replace the mask/shift formula with explicit MSB/LSB extraction:
offset == 0 -> buf_size >> 8
offset == 1 -> buf_size & 0xff
This makes the code clearer and easier to review without altering behavior or data ordering.
No functional change.
--- hw/i3c/mock-i3c-target.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
hw/i3c/mock-i3c-target.c +6 -3
@@ -146,9 +146,12 @@ static int mock_i3c_target_handle_ccc_read(I3CTarget *i3c, uint8_t *data,if (s->ccc_byte_offset >=2 ) {break ; } - data[s->ccc_byte_offset] = (s->cfg.buf_size & - (0xff00 >> (s->ccc_byte_offset *8 ))) >> - (8 - (s->ccc_byte_offset *8 )); +if (s->ccc_byte_offset ==0 ) { + data[s->ccc_byte_offset] = (uint8_t )(s->cfg.buf_size >>8 ); + }else { + data[s->ccc_byte_offset] = (uint8_t )s->cfg.buf_size; + } + s->ccc_byte_offset++; *num_read = num_to_read; }
Signature · 1 line
2.53.0
[PULL 20/38] hw/arm/aspeed: Build with I3C_DEVICES
In reply to Cédric Le GoaterFrom: Jamin Lin <[email protected]>
Allows us to attach the mock I3C target
--- hw/arm/Kconfig | 1 + 1 file changed, 1 insertion(+)
hw/arm/Kconfig +1 -0
@@ -547,6 +547,7 @@ config ASPEED_SOC select I2C select I3C select DW_I3C + select I3C_DEVICES select DPS310 select PCA9552 select PCA9554
Signature · 1 line
2.53.0
[PULL 38/38] tests/functional/aarch64/test_aspeed_ast2700fc: Update test ASPEED OpenBMC SDK v11.01
In reply to Cédric Le GoaterFrom: Jamin Lin <[email protected]>
--- .../aarch64/test_aspeed_ast2700fc.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
tests/functional/aarch64/test_aspeed_ast2700fc.py +9 -9
@@ -61,9 +61,9 @@ def load_ast2700fc_coprocessor(self, name): self.vm.add_args('-device', f'loader,file={file},cpu-num={cpu_num}') - ASSET_SDK_V1100_AST2700 = Asset( - 'https://github.com/AspeedTech-BMC/openbmc/releases/download/v11.00/ast2700-default-obmc.tar.gz', - 'e2b8f043fe8063dd3b6ded93422e38bd41914dc9c3202199507652df024de4dc') + ASSET_SDK_V1101_AST2700 = Asset( + 'https://github.com/AspeedTech-BMC/openbmc/releases/download/v11.01/ast2700-default-image.tar.gz', + 'ce89dcd995cf284d41a6a4bd17a1b97d59939f0277bfe54fdaaf30e741ce7487') def do_ast2700_i2c_test(self): exec_command_and_wait_for_pattern(self,
@@ -148,23 +148,23 @@ def start_ast2700fc_test_vbootrom(self, name): self.do_test_aarch64_aspeed_sdk_start( self.scratch_file(name, 'image-bmc')) - def test_aarch64_ast2700fc_sdk_v11_00(self): + def test_aarch64_ast2700fc_sdk_v11_01(self): self.set_machine('ast2700fc') self.require_netdev('user') - self.archive_extract(self.ASSET_SDK_V1100_AST2700) - self.start_ast2700fc_test('ast2700-default') + self.archive_extract(self.ASSET_SDK_V1101_AST2700) + self.start_ast2700fc_test('ast2700-default-image') self.verify_openbmc_boot_and_login('ast2700-default') self.do_ast2700_i2c_test() self.do_ast2700_pcie_test() self.do_ast2700fc_ssp_test() self.do_ast2700fc_tsp_test() - def test_aarch64_ast2700fc_sdk_vbootrom_v11_00(self): + def test_aarch64_ast2700fc_sdk_vbootrom_v11_01(self): self.set_machine('ast2700fc') - self.archive_extract(self.ASSET_SDK_V1100_AST2700) - self.start_ast2700fc_test_vbootrom('ast2700-default') + self.archive_extract(self.ASSET_SDK_V1101_AST2700) + self.start_ast2700fc_test_vbootrom('ast2700-default-image') self.verify_openbmc_boot_and_login('ast2700-default') self.do_ast2700fc_ssp_test() self.do_ast2700fc_tsp_test()
Signature · 1 line
2.53.0
[PULL 22/38] tests/functional/arm/test_aspeed_ast2600_sdk: Add i3c functional test
In reply to Cédric Le GoaterFrom: Jamin Lin <[email protected]>
--- tests/functional/arm/test_aspeed_ast2600_sdk.py | 12 ++++++++++++ 1 file changed, 12 insertions(+)
tests/functional/arm/test_aspeed_ast2600_sdk.py +12 -0
@@ -31,6 +31,15 @@ def do_ast2600_pcie_test(self): 'ip addr show dev eth4', 'inet 10.0.2.15/24') + def do_ast2600_i3c_test(self): + exec_command_and_wait_for_pattern(self, + 'i3ctransfer -d /dev/bus/i3c/5-1234567890ab' + ' -w 0x12,0x34,0x56,0x78,0x90,0xab,0xcd,0xef', + 'Success on message 0') + exec_command_and_wait_for_pattern(self, + 'i3ctransfer -d /dev/bus/i3c/5-1234567890ab -r 8 | grep 0x | xargs', + '0x12 0x34 0x56 0x78 0x90 0xab 0xcd 0xef') + def test_arm_ast2600_evb_sdk(self): self.set_machine('ast2600-evb') self.require_netdev('user')
@@ -43,6 +52,8 @@ def test_arm_ast2600_evb_sdk(self): 'ds1338,bus=aspeed.i2c.bus.5,address=0x32') self.vm.add_args('-device', 'e1000e,netdev=net1,bus=pcie.0') self.vm.add_args('-netdev', 'user,id=net1') + self.vm.add_args('-device', + 'mock-i3c-target,bus=dw.i3c.5,pid=0xab9078563412') self.do_test_arm_aspeed_sdk_start( self.scratch_file("ast2600-default", "image-bmc"))
@@ -69,6 +80,7 @@ def test_arm_ast2600_evb_sdk(self): exec_command_and_wait_for_pattern(self, '/sbin/hwclock -f /dev/rtc1', year) self.do_ast2600_pcie_test() + self.do_ast2600_i3c_test() if __name__ == '__main__':
Signature · 1 line
2.53.0
[PULL 14/38] hw/i3c/dw-i3c: Add data TX and RX
In reply to Cédric Le GoaterFrom: Jamin Lin <[email protected]>
This adds data and CCC transmission, reception, and the associated queues required for data transmission and reception to happen.
The I3C controller transmits data by the user writing into a command queue. When the queue has a command and an argument in it, the controller starts executing the command.
The controller can execute 1 of 3 ways:
1. A larger data transfer that involves using the TX and RX queues. This is the most common way the controller does transactions.
2. A small data transfer that involves sending a couple bytes passed into the command queue argument.
3. An address assignment command. This is how the controller does ENTDAA. When ENTDAA succeeds in assigning an address to a target, it updates the controller's char table with the target's PID, BCR, and DCR.
The controller determines what addresses to send by looking at the index in the device address table specified by the argument in the command queue. ENTDAA also uses these addresses to assign to targets on the bus.
When the controller is done executing a command, it puts a response in the response queue indicating how command execution went.
In order for the user to send and receive data to/from the controller, the user reads/writes to a bidirectional TX/RX port.
--- include/hw/i3c/aspeed_i3c.h | 1 + include/hw/i3c/dw-i3c.h | 143 +++++- hw/i3c/dw-i3c.c | 882 +++++++++++++++++++++++++++++++++++- hw/i3c/trace-events | 10 + 4 files changed, 1030 insertions(+), 6 deletions(-)
include/hw/i3c/aspeed_i3c.h +1 -0
@@ -2,6 +2,7 @@* ASPEED I3C Controller * * Copyright (C) 2021 ASPEED Technology Inc. +* Copyright (C) 2023 Google, LLC * * This code is licensed under the GPL version 2 or later. See * the COPYING file in the top-level directory.
include/hw/i3c/dw-i3c.h +141 -2
161 lines not on this page · raw message
hw/i3c/dw-i3c.c +878 -4
947 lines not on this page · raw message
hw/i3c/trace-events +10 -0
@@ -7,6 +7,16 @@ aspeed_i3c_write(uint64_t offset, uint64_t data) "I3C write: offset 0x%" PRIx64 # dw-i3c,c dw_i3c_read(uint32_t deviceid, uint64_t offset, uint64_t data) "I3C Dev[%u] read: offset 0x%" PRIx64 " data 0x%" PRIx64 dw_i3c_write(uint32_t deviceid, uint64_t offset, uint64_t data) "I3C Dev[%u] write: offset 0x%" PRIx64 " data 0x%" PRIx64 +dw_i3c_send(uint32_t deviceid, uint32_t num_bytes) "I3C Dev[%u] send %" PRId32 " bytes to bus" +dw_i3c_recv_data(uint32_t deviceid, uint32_t num_bytes) "I3C Dev[%u] recv %" PRId32 " bytes from bus" +dw_i3c_pop_rx(uint32_t deviceid, uint32_t data) "I3C Dev[%u] pop 0x%" PRIx32 " from RX FIFO" +dw_i3c_resp_queue_push(uint32_t deviceid, uint32_t data) "I3C Dev[%u] push 0x%" PRIx32 " to response queue" +dw_i3c_push_tx(uint32_t deviceid, uint32_t data) "I3C Dev[%u] push 0x%" PRIx32 " to TX FIFO" +dw_i3c_pop_tx(uint32_t deviceid, uint32_t data) "I3C Dev[%u] pop 0x%" PRIx32 " from TX FIFO" +dw_i3c_push_rx(uint32_t deviceid, uint32_t data) "I3C Dev[%u] push 0x%" PRIx32 " to RX FIFO" +dw_i3c_transfer_ccc(uint32_t deviceid, uint8_t ccc) "I3C Dev[%u] transfer CCC 0x%" PRIx8 +dw_i3c_cmd_queue_execute(uint32_t deviceid, uint32_t cmd, uint32_t arg) "I3C Dev[%u] execute command 0x%" PRIx32 " arg 0x%" PRIx32 +dw_i3c_cmd_queue_push(uint32_t deviceid, uint32_t data) "I3C Dev[%u] push 0x%" PRIx32 " to cmd queue" # core.c i3c_target_event(uint8_t address, uint8_t event) "I3C target 0x%" PRIx8 " event 0x%" PRIx8
Signature · 1 line
2.53.0
Re: [PULL 14/38] hw/i3c/dw-i3c: Add data TX and RX
Hello,
Quoted 38 lines · Cédric Le Goater
From: Jamin Lin <[email protected]>
This adds data and CCC transmission, reception, and the associated queues required for data transmission and reception to happen.
The I3C controller transmits data by the user writing into a command queue. When the queue has a command and an argument in it, the controller starts executing the command.
The controller can execute 1 of 3 ways:
1. A larger data transfer that involves using the TX and RX queues. This is the most common way the controller does transactions.2. A small data transfer that involves sending a couple bytes passed into the command queue argument.
3. An address assignment command. This is how the controller does ENTDAA. When ENTDAA succeeds in assigning an address to a target, it updates the controller's char table with the target's PID, BCR, and DCR.
The controller determines what addresses to send by looking at the index in the device address table specified by the argument in the command queue. ENTDAA also uses these addresses to assign to targets on the bus.
When the controller is done executing a command, it puts a response in the response queue indicating how command execution went.
In order for the user to send and receive data to/from the controller, the user reads/writes to a bidirectional TX/RX port.
Signed-off-by Joe Komlodi <[email protected]>Reviewed-by Stephen Longfield <[email protected]>Reviewed-by Patrick Venture <[email protected]>Signed-off-by Jamin Lin <[email protected]>Tested-by Jithu Joseph <[email protected]>Signed-off-by Cédric Le Goater <[email protected]>
Quoted 6 lines
--- include/hw/i3c/aspeed_i3c.h | 1 + include/hw/i3c/dw-i3c.h | 143 +++++- hw/i3c/dw-i3c.c | 882 +++++++++++++++++++++++++++++++++++- hw/i3c/trace-events | 10 + 4 files changed, 1030 insertions(+), 6 deletions(-)
Coverity reports an "Uninitialized variables" issue :
_____________________________________________________________________________________________
*** CID 1645555: Uninitialized variables (UNINIT)
/builds/qemu-project/qemu/hw/i3c/dw-i3c.c: 1229 in dw_i3c_short_transfer()
1223 }
1224 if (arg.byte_strb & 0x04) {
1225 data[len] = arg.byte2;
1226 len++;
1227 }
1228
>>> CID 1645555: Uninitialized variables (UNINIT)
>>> Using uninitialized value "*data" when calling "dw_i3c_send".
1229 if (dw_i3c_send(s, data, len, &bytes_sent, is_i2c)) {
1230 err = DW_I3C_RESP_QUEUE_ERR_I2C_NACK;
1231 } else {
1232 /* Only go to an idle state on a successful transfer. */
1233 ARRAY_FIELD_DP32(s->regs, PRESENT_STATE, CM_TFR_ST_STATUS,
1234 DW_I3C_TRANSFER_STATE_IDLE);Should we call dw_i3c_send() when len == 0 ?
Thanks,
C.
Quoted 71 lines
hw/i3c/dw-i3c.c +71
-0+static void dw_i3c_short_transfer (DWI3C *s,DWI3CTransferCmd cmd, +DWI3CShortArg arg) +{ +uint8_t err =DW_I3C_RESP_QUEUE_ERR_NONE ; +uint8_t addr =dw_i3c_target_addr (s, cmd.dev_index); +bool is_i2c =dw_i3c_target_is_i2c (s, cmd.dev_index); +uint8_t data[4 ];/* Max we can send on a short transfer is 4 bytes. */ +uint8_t len =0 ; +uint32_t bytes_sent;/* Ignored on short transfers. */ + +/* Can't do reads on a short transfer. */ +if (cmd.rnw) { + g_autofree char *path = object_get_canonical_path(OBJECT(s)); +qemu_log_mask (LOG_GUEST_ERROR ,"%s: Cannot do a read on a short " +"transfer\n" , path); +return ; + } + +if (dw_i3c_send_start (s, addr,/*is_recv=*/ false, is_i2c)) { + err =DW_I3C_RESP_QUEUE_ERR_I2C_NACK ; + goto transfer_done; + } + +/* Are we sending a command? */ +if (cmd.cp) { + data[len] = cmd.cmd; + len++; +/* +* byte0 is the defining byte for a command, and is only sent if a +* command is present and if the command has a defining byte present. +* (byte_strb & 0x01) is always treated as set by the controller, and is +* ignored. +*/ +if (cmd.dbp) { + data[len] += arg.byte0; + len++; + } + } + +/* Send the bytes passed in the argument. */ +if (arg.byte_strb &0x02 ) { + data[len] = arg.byte1; + len++; + } +if (arg.byte_strb &0x04 ) { + data[len] = arg.byte2; + len++; + } + +if (dw_i3c_send (s, data, len, &bytes_sent, is_i2c)) { + err =DW_I3C_RESP_QUEUE_ERR_I2C_NACK ; + }else { +/* Only go to an idle state on a successful transfer. */ +ARRAY_FIELD_DP32 (s->regs,PRESENT_STATE ,CM_TFR_ST_STATUS , +DW_I3C_TRANSFER_STATE_IDLE ); + } + +transfer_done: +if (cmd.toc) { +dw_i3c_end_transfer (s, is_i2c); + } +if (cmd.roc) { +/* +* ccc_type is always 0 in controller mode, data_len is 0 in short +* transfers. +*/ +dw_i3c_resp_queue_push (s, err, cmd.tid,/*ccc_type=*/ 0 , +/*data_len=*/ 0 ); + } +} +
RE: [PULL 14/38] hw/i3c/dw-i3c: Add data TX and RX
+ Nabih
Quoted 58 lines
-----Original Message-----
From: Cédric Le Goater <[email protected]>
Sent: Monday, March 9, 2026 5:44 PM
To: [email protected]; [email protected]
Cc: Jamin Lin <[email protected]>; Joe Komlodi <[email protected]>; Stephen Longfield <[email protected]>; Patrick Venture <[email protected]>; Jithu Joseph <[email protected]>
Subject: Re: [PULL 14/38] hw/i3c/dw-i3c: Add data TX and RXHello,
Quoted 16 lines · Cédric Le Goater
From: Jamin Lin <[email protected]>
This adds data and CCC transmission, reception, and the associated queues required for data transmission and reception to happen.
The I3C controller transmits data by the user writing into a command queue. When the queue has a command and an argument in it, the controller starts executing the command.
The controller can execute 1 of 3 ways:
1. A larger data transfer that involves using the TX and RX queues. This is the most common way the controller does transactions.2. A small data transfer that involves sending a couple bytes passed into the command queue argument.
Quoted 8 lines
3. An address assignment command. This is how the controller does ENTDAA. When ENTDAA succeeds in assigning an address to a target, it updates the controller's char table with the target's PID, BCR, and DCR.
The controller determines what addresses to send by looking at the index in the device address table specified by the argument in the command queue. ENTDAA also uses these addresses to assign to targets on
the bus.
Quoted 12 lines
When the controller is done executing a command, it puts a response in the response queue indicating how command execution went.
In order for the user to send and receive data to/from the controller, the user reads/writes to a bidirectional TX/RX port.
Signed-off-by Joe Komlodi <[email protected]>Reviewed-by Stephen Longfield <[email protected]>Reviewed-by Patrick Venture <[email protected]>Signed-off-by Jamin Lin <[email protected]>Tested-by Jithu Joseph <[email protected]>Quoted 8 lines
Link:
https://lore.kernel.org/qemu-devel/20260225021158.1586584-14-jamin_lin
@aspeedtech.comSigned-off-by Cédric Le Goater <[email protected]>--- include/hw/i3c/aspeed_i3c.h | 1 + include/hw/i3c/dw-i3c.h | 143 +++++- hw/i3c/dw-i3c.c | 882
Quoted 5 lines
+++++++++++++++++++++++++++++++++++-
Quoted 2 lines
hw/i3c/trace-events | 10 + 4 files changed, 1030 insertions(+), 6 deletions(-)
I sent the v1 here,
https://patchwork.kernel.org/project/qemu-devel/patch/[email protected]/
Please help to review.
Thanks,
Jamin
Quoted 107 lines
Coverity reports an "Uninitialized variables" issue :
________________________________________________________________
_____________________________
*** CID 1645555: Uninitialized variables (UNINIT)
/builds/qemu-project/qemu/hw/i3c/dw-i3c.c: 1229 indw_i3c_short_transfer()
1223 }1224 if (arg.byte_strb & 0x04) { 1225 data[len] = arg.byte2; 1226 len++; 1227 } 1228 >>> CID 1645555: Uninitialized variables (UNINIT) >>> Using uninitialized value "*data" when calling "dw_i3c_send". 1229 if (dw_i3c_send(s, data, len, &bytes_sent, is_i2c)) { 1230 err = DW_I3C_RESP_QUEUE_ERR_I2C_NACK; 1231 } else { 1232 /* Only go to an idle state on a successful transfer. */ 1233 ARRAY_FIELD_DP32(s->regs, PRESENT_STATE,
CM_TFR_ST_STATUS,
1234DW_I3C_TRANSFER_STATE_IDLE);Should we call
dw_i3c_send()when len == 0 ?Thanks,
C.
hw/i3c/dw-i3c.c static uint64_t dw_i3c_read(void *opaque, hwaddr offset, unsigned size)
Quoted 13 lines
hw/i3c/dw-i3c.c +13
-0+static void dw_i3c_short_transfer (DWI3C *s,DWI3CTransferCmd cmd, +DWI3CShortArg arg) { +uint8_t err =DW_I3C_RESP_QUEUE_ERR_NONE ; +uint8_t addr =dw_i3c_target_addr (s, cmd.dev_index); +bool is_i2c =dw_i3c_target_is_i2c (s, cmd.dev_index); +uint8_t data[4 ];/* Max we can send on a short transfer is 4 bytes. */ +uint8_t len =0 ; +uint32_t bytes_sent;/* Ignored on short transfers. */ + +/* Can't do reads on a short transfer. */ +if (cmd.rnw) { + g_autofree char *path = object_get_canonical_path(OBJECT(s)); + qemu_log_mask(LOG_GUEST_ERROR, "%s: Cannot do a read on ashort "
Quoted 6 lines
hw/i3c/dw-i3c.c +6
-0+ "transfer\n", path); +return ; + } + +if (dw_i3c_send_start (s, addr,/*is_recv=*/ false, is_i2c)) { + err =DW_I3C_RESP_QUEUE_ERR_I2C_NACK ;hw/i3c/dw-i3c.c static uint64_t dw_i3c_read(void *opaque, hwaddr offset, unsigned size)
Quoted 10 lines
hw/i3c/dw-i3c.c +10
-0+ goto transfer_done; + } + +/* Are we sending a command? */ +if (cmd.cp) { + data[len] = cmd.cmd; + len++; +/* +* byte0 is the defining byte for a command, and is only sent if a +* command is present and if the command has a defining byte present.
Quoted 1 line
+ * (
byte_strb&0x01) is always treated as set by the controller,and is
Quoted 13 lines
hw/i3c/dw-i3c.c +13
-0+* ignored. +*/ +if (cmd.dbp) { + data[len] += arg.byte0; + len++; + } + } + +/* Send the bytes passed in the argument. */ +if (arg.byte_strb &0x02 ) { + data[len] = arg.byte1; + len++; + }hw/i3c/dw-i3c.c static uint64_t dw_i3c_read(void *opaque, hwaddr offset, unsigned size)
Quoted 10 lines
hw/i3c/dw-i3c.c +10
-0+if (arg.byte_strb &0x04 ) { + data[len] = arg.byte2; + len++; + } + +if (dw_i3c_send (s, data, len, &bytes_sent, is_i2c)) { + err =DW_I3C_RESP_QUEUE_ERR_I2C_NACK ; + }else { +/* Only go to an idle state on a successful transfer. */ + ARRAY_FIELD_DP32(s->regs, PRESENT_STATE,
CM_TFR_ST_STATUS,Quoted 17 lines
hw/i3c/dw-i3c.c +17
-0+ DW_I3C_TRANSFER_STATE_IDLE); + } + +transfer_done: +if (cmd.toc) { +dw_i3c_end_transfer (s, is_i2c); + } +if (cmd.roc) { +/* +* ccc_type is always 0 in controller mode, data_len is 0 in short +* transfers. +*/ +dw_i3c_resp_queue_push (s, err, cmd.tid,/*ccc_type=*/ 0 , +/*data_len=*/ 0 ); + } +} +
[PULL 19/38] hw/i3c: Add Mock target
In reply to Cédric Le GoaterFrom: Jamin Lin <[email protected]>
Adds a simple i3c device to be used for testing in lieu of a real device.
The mock target supports the following features:
- A buffer that users can read and write to.
- CCC support for commonly used CCCs when probing devices on an I3C bus.
- IBI sending upon receiving a user-defined byte.
--- include/hw/i3c/mock-i3c-target.h | 52 ++++++ hw/i3c/mock-i3c-target.c | 298 +++++++++++++++++++++++++++++++ hw/i3c/Kconfig | 10 ++ hw/i3c/meson.build | 1 + hw/i3c/trace-events | 10 ++ 5 files changed, 371 insertions(+) create mode 100644 include/hw/i3c/mock-i3c-target.h create mode 100644 hw/i3c/mock-i3c-target.c
include/hw/i3c/mock-i3c-target.h new file +52 -0
@@ -0,0 +1,52 @@ +#ifndef MOCK_I3C_TARGET_H_ +#define MOCK_I3C_TARGET_H_ + +/* +* Mock I3C Device +* +* Copyright (c) 2025 Google LLC +* +* The mock I3C device can be thought of as a simple EEPROM. It has a buffer, +* and the pointer in the buffer is reset to 0 on an I3C STOP. +* To write to the buffer, issue a private write and send data. +* To read from the buffer, issue a private read. +* +* The mock target also supports sending target interrupt IBIs. +* To issue an IBI, set the 'ibi-magic-num' property to a non-zero number, and +* send that number in a private transaction. The mock target will issue an IBI +* after 1 second. +* +* It also supports a handful of CCCs that are typically used when probing I3C +* devices. +* +* SPDX-License-Identifier: GPL-2.0-or-later +*/ + +#include "qemu/osdep.h" +#include "qemu/timer.h" +#include "hw/i3c/i3c.h" + +#define TYPE_MOCK_I3C_TARGET "mock-i3c-target" +OBJECT_DECLARE_SIMPLE_TYPE(MockI3cTargetState, MOCK_I3C_TARGET) + +struct MockI3cTargetState { +I3CTarget parent_obj; + +/* General device state */ +bool can_ibi; +QEMUTimer qtimer; +size_t p_buf; +uint8_t *buf; + +/* For Handing CCCs. */ +bool in_ccc; +I3CCCC curr_ccc; +uint8_t ccc_byte_offset; + +struct { +uint32_t buf_size; +uint8_t ibi_magic; + } cfg; +}; + +#endif
hw/i3c/mock-i3c-target.c new file +298 -0
298 lines not on this page · raw message
hw/i3c/Kconfig +10 -0
@@ -3,3 +3,13 @@ config I3C config DW_I3C bool + +config I3C_DEVICES + # Device group for i3c devices which can reasonably be user-plugged to any + # board's i3c bus. + bool + +config MOCK_I3C_TARGET + bool + select I3C + default y if I3C_DEVICES
hw/i3c/meson.build +1 -0
@@ -2,4 +2,5 @@ i3c_ss = ss.source_set() i3c_ss.add(when: 'CONFIG_I3C', if_true: files('core.c')) i3c_ss.add(when: 'CONFIG_ASPEED_SOC', if_true: files('aspeed_i3c.c')) i3c_ss.add(when: 'CONFIG_DW_I3C', if_true: files('dw-i3c.c')) +i3c_ss.add(when: 'CONFIG_MOCK_I3C_TARGET', if_true: files('mock-i3c-target.c')) system_ss.add_all(when: 'CONFIG_I3C', if_true: i3c_ss)
hw/i3c/trace-events +10 -0
@@ -36,3 +36,13 @@ legacy_i2c_recv(uint8_t byte) "Legacy I2C recv 0x%" PRIx8 legacy_i2c_send(uint8_t byte) "Legacy I2C send 0x%" PRIx8 legacy_i2c_start_transfer(uint8_t address, bool is_recv) "Legacy I2C START with address 0x%" PRIx8 " is_recv=%d" legacy_i2c_end_transfer(void) "Legacy I2C STOP" + +# mock-target.c +mock_i3c_target_rx(uint8_t byte) "I3C mock target read 0x%" PRIx8 +mock_i3c_target_tx(uint8_t byte) "I3C mock target write 0x%" PRIx8 +mock_i3c_target_event(uint8_t event) "I3C mock target event 0x%" PRIx8 +mock_i3c_target_handle_ccc_read(uint32_t num_read, uint32_t num_to_read) "I3C mock target read %" PRId32 "/%" PRId32 " bytes" +mock_i3c_target_new_ccc(uint8_t ccc) "I3C mock target handle CCC 0x%" PRIx8 +mock_i3c_target_handle_ccc_write(uint32_t num_sent, uint32_t num_to_send) "I3C mock target send %" PRId32 "/%" PRId32 " bytes" +mock_i3c_target_do_ibi(uint8_t address, bool is_recv) "I3C mock target IBI with address 0x%" PRIx8 " RnW=%d" +mock_i3c_target_do_ibi_nack(const char *reason) "NACKed from controller when %s target interrupt"
Signature · 1 line
2.53.0
[PULL 37/38] tests/functional/aarch64/test_aspeed_ast2700a2: Update test ASPEED OpenBMC SDK v11.01
In reply to Cédric Le GoaterFrom: Jamin Lin <[email protected]>
--- .../aarch64/test_aspeed_ast2700a2.py | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-)
tests/functional/aarch64/test_aspeed_ast2700a2.py +15 -15
@@ -78,13 +78,13 @@ def verify_openbmc_boot_and_login(self, name, enable_pcie=True): exec_command_and_wait_for_pattern(self, 'root', 'Password:') exec_command_and_wait_for_pattern(self, '0penBmc', f'root@{name}:~#') - ASSET_SDK_V1100_AST2700A2 = Asset( - 'https://github.com/AspeedTech-BMC/openbmc/releases/download/v11.00/ast2700-default-obmc.tar.gz', - 'e2b8f043fe8063dd3b6ded93422e38bd41914dc9c3202199507652df024de4dc') + ASSET_SDK_V1101_AST2700A2 = Asset( + 'https://github.com/AspeedTech-BMC/openbmc/releases/download/v11.01/ast2700-default-image.tar.gz', + 'ce89dcd995cf284d41a6a4bd17a1b97d59939f0277bfe54fdaaf30e741ce7487') - ASSET_SDK_V1100_AST2700A2_DCSCM = Asset( - 'https://github.com/AspeedTech-BMC/openbmc/releases/download/v11.00/ast2700-dcscm-obmc.tar.gz', - '0e93f7976139da71fab9df7952a58bdd80650e23e7abf5853b0eb6695deb02d0') + ASSET_SDK_V1101_AST2700A2_DCSCM = Asset( + 'https://github.com/AspeedTech-BMC/openbmc/releases/download/v11.01/ast2700-dcscm-image.tar.gz', + 'b92ece9ca733dfd7a20193a12582f743b77f1898116b6d6f1abe57ac8db01c56') def do_ast2700_i2c_test(self, bus_id): bus_str = str(bus_id)
@@ -150,38 +150,38 @@ def start_ast2700_test_vbootrom(self, name, bus_id): self.do_test_aarch64_aspeed_sdk_start( self.scratch_file(name, 'image-bmc'), bus_id) - def test_aarch64_ast2700a2_evb_sdk_v11_00(self): + def test_aarch64_ast2700a2_evb_sdk_v11_01(self): self.set_machine('ast2700a2-evb') self.require_netdev('user') - self.archive_extract(self.ASSET_SDK_V1100_AST2700A2) + self.archive_extract(self.ASSET_SDK_V1101_AST2700A2) self.vm.add_args('-device', 'e1000e,netdev=net1,bus=pcie.2') self.vm.add_args('-netdev', 'user,id=net1') - self.start_ast2700_test('ast2700-default', 1) + self.start_ast2700_test('ast2700-default-image', 1) self.verify_openbmc_boot_and_login('ast2700-default') self.do_ast2700_i2c_test(1) self.do_ast2700_pcie_test() - def test_aarch64_ast2700a2_evb_sdk_vbootrom_v11_00(self): + def test_aarch64_ast2700a2_evb_sdk_vbootrom_v11_01(self): self.set_machine('ast2700a2-evb') self.require_netdev('user') - self.archive_extract(self.ASSET_SDK_V1100_AST2700A2) + self.archive_extract(self.ASSET_SDK_V1101_AST2700A2) self.vm.add_args('-device', 'e1000e,netdev=net1,bus=pcie.2') self.vm.add_args('-netdev', 'user,id=net1') - self.start_ast2700_test_vbootrom('ast2700-default', 1) + self.start_ast2700_test_vbootrom('ast2700-default-image', 1) self.verify_vbootrom_firmware_flow() self.verify_openbmc_boot_start() - def test_aarch64_ast2700a2_evb_ioexp_v11_00(self): + def test_aarch64_ast2700a2_evb_ioexp_v11_01(self): self.set_machine('ast2700a2-evb') self.require_netdev('user') - self.archive_extract(self.ASSET_SDK_V1100_AST2700A2_DCSCM) + self.archive_extract(self.ASSET_SDK_V1101_AST2700A2_DCSCM) 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.start_ast2700_test('ast2700-dcscm', 8) + 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)
Signature · 1 line
2.53.0
[PULL 32/38] tests/functional/arm/test_aspeed_ast2500_sdk_515: Update test ASPEED OpenBMC SDK v11.01
In reply to Cédric Le GoaterFrom: Jamin Lin <[email protected]>
--- tests/functional/arm/test_aspeed_ast2500_sdk_515.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
tests/functional/arm/test_aspeed_ast2500_sdk_515.py +4 -4
@@ -10,14 +10,14 @@ class AST2500Machine(AspeedTest): - ASSET_SDK_V1100_AST2500_515 = Asset( - 'https://github.com/AspeedTech-BMC/openbmc/releases/download/v11.00/ast2500-default-515-obmc.tar.gz', - '5732255d4617d98b76bbbc116d331d6ac89906fa212969eb8213fdc4aea86451') + ASSET_SDK_V1101_AST2500_515 = Asset( + 'https://github.com/AspeedTech-BMC/openbmc/releases/download/v11.01/ast2500-default-515-obmc.tar.gz', + 'b848ff620d2e9c83e2fb4736b4d1c39b82fdb041058cd42be42c3b177bf38eb9') def test_arm_ast2500_evb_sdk_515(self): self.set_machine('ast2500-evb') - self.archive_extract(self.ASSET_SDK_V1100_AST2500_515) + self.archive_extract(self.ASSET_SDK_V1101_AST2500_515) self.do_test_arm_aspeed_sdk_start( self.scratch_file("ast2500-default-515", "image-bmc"))
Signature · 1 line
2.53.0
[PULL 24/38] hw/i3c: Fix array bounds and storage in i3c_addr_is_rsvd()
In reply to Cédric Le GoaterThe size of the is_rsvd lookup table in i3c_addr_is_rsvd() is 255 but should be 256 to cover all possible uint8_t address values and avoid potential out-of-bounds access.
The array should be static too as it's a constant lookup table.
--- hw/i3c/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/i3c/core.c +1 -1
@@ -525,7 +525,7 @@ int i3c_target_ibi_finish(I3CTarget *t, uint8_t data)static bool i3c_addr_is_rsvd (uint8_t addr) { -const bool is_rsvd[255 ] = { +static const bool is_rsvd[256 ] = { [0x00 ] = true, [0x01 ] = true, [0x02 ] = true,
Signature · 1 line
2.53.0
Peter Maydell
AppliedQuoted 13 lines · Cédric Le Goater
The following changes since commit
ae6e281633769bbc7424523d0ca1163e214571ad:Merge tag 'pull-loongarch-20260302' of https://github.com/gaosong715/qemu into staging (2026-03-05 10:48:38 +0000)
are available in the Git repository at:
https://github.com/legoater/qemu/ tags/pull-aspeed-20260305
for you to fetch changes up to
ee357844b13904a826ffa77834cd08e10ba1e9ba:tests/functional/aarch64/test_aspeed_ast2700fc: Update test ASPEED OpenBMC SDK v11.01 (2026-03-05 18:47:46 +0100)
Quoted 7 lines
----------------------------------------------------------------
aspeed queue:* Add I3C support to QEMU, add an dummy I3C device and extend the Aspeed I3C controller
* Update test ASPEED OpenBMC SDK v11.01
* Fix DMA64 address handling in Aspeed I2C model (AST2700 SoC)
Applied, thanks.
Please update the changelog at https://wiki.qemu.org/ChangeLog/11.0
for any user-visible changes.
-- PMM