Introduce model for IBM's FSI
Subsystems (2)
v3 cover Introduce model for IBM's FSI
Hello,
Please review the patch-set version 3.
I have incorporated review comments from Cedric and Thomas.
Ninad Palsule (8):
hw/fsi: Introduce IBM's Local bus
hw/fsi: Introduce IBM's scratchpad
hw/fsi: Introduce IBM's cfam,fsi-slave
hw/fsi: Introduce IBM's FSI
hw/fsi: IBM's On-chip Peripheral Bus
hw/fsi: Aspeed APB2OPB interface
hw/arm: Hook up FSI module in AST2600
hw/fsi: Documentation and testing
MAINTAINERS | 20 ++ docs/specs/fsi.rst | 141 ++++++++++++ hw/Kconfig | 1 + hw/arm/Kconfig | 1 + hw/arm/aspeed_ast2600.c | 19 ++ hw/fsi/Kconfig | 23 ++ hw/fsi/aspeed-apb2opb.c | 352 +++++++++++++++++++++++++++++ hw/fsi/cfam.c | 239 ++++++++++++++++++++ hw/fsi/engine-scratchpad.c | 100 ++++++++ hw/fsi/fsi-master.c | 201 ++++++++++++++++ hw/fsi/fsi-slave.c | 109 +++++++++ hw/fsi/fsi.c | 54 +++++ hw/fsi/lbus.c | 94 ++++++++ hw/fsi/meson.build | 6 + hw/fsi/opb.c | 194 ++++++++++++++++ hw/fsi/trace-events | 8 + hw/fsi/trace.h | 1 + hw/meson.build | 1 + include/hw/arm/aspeed_soc.h | 4 + include/hw/fsi/aspeed-apb2opb.h | 33 +++ include/hw/fsi/cfam.h | 61 +++++ include/hw/fsi/engine-scratchpad.h | 33 +++ include/hw/fsi/fsi-master.h | 30 +++ include/hw/fsi/fsi-slave.h | 29 +++ include/hw/fsi/fsi.h | 31 +++ include/hw/fsi/lbus.h | 48 ++++ include/hw/fsi/opb.h | 43 ++++ include/qemu/bitops.h | 6 + meson.build | 1 + tests/qtest/fsi-test.c | 210 +++++++++++++++++ tests/qtest/meson.build | 2 + 31 files changed, 2095 insertions(+) create mode 100644 docs/specs/fsi.rst create mode 100644 hw/fsi/Kconfig create mode 100644 hw/fsi/aspeed-apb2opb.c create mode 100644 hw/fsi/cfam.c create mode 100644 hw/fsi/engine-scratchpad.c create mode 100644 hw/fsi/fsi-master.c create mode 100644 hw/fsi/fsi-slave.c create mode 100644 hw/fsi/fsi.c create mode 100644 hw/fsi/lbus.c create mode 100644 hw/fsi/meson.build create mode 100644 hw/fsi/opb.c create mode 100644 hw/fsi/trace-events create mode 100644 hw/fsi/trace.h create mode 100644 include/hw/fsi/aspeed-apb2opb.h create mode 100644 include/hw/fsi/cfam.h create mode 100644 include/hw/fsi/engine-scratchpad.h create mode 100644 include/hw/fsi/fsi-master.h create mode 100644 include/hw/fsi/fsi-slave.h create mode 100644 include/hw/fsi/fsi.h create mode 100644 include/hw/fsi/lbus.h create mode 100644 include/hw/fsi/opb.h create mode 100644 tests/qtest/fsi-test.c
Signature · 1 line
2.39.2
PATCH v3 1/8 hw/fsi: Introduce IBM's Local bus
This is a part of patchset where IBM's Flexible Service Interface is introduced.
The LBUS is modelled to maintain the qdev bus hierarchy and to take advantage of the object model to automatically generate the CFAM configuration block. The configuration block presents engines in the order they are attached to the CFAM's LBUS. Engine implementations should subclass the LBusDevice and set the 'config' member of LBusDeviceClass to match the engine's type.
---
v2:
- Incorporated Joel's review comments.
--- hw/Kconfig | 1 + hw/fsi/Kconfig | 2 + hw/fsi/lbus.c | 94 +++++++++++++++++++++++++++++++++++++++++++ hw/fsi/meson.build | 1 + hw/meson.build | 1 + include/hw/fsi/lbus.h | 48 ++++++++++++++++++++++ include/qemu/bitops.h | 6 +++ 7 files changed, 153 insertions(+) create mode 100644 hw/fsi/Kconfig create mode 100644 hw/fsi/lbus.c create mode 100644 hw/fsi/meson.build create mode 100644 include/hw/fsi/lbus.h
hw/Kconfig +1 -0
@@ -9,6 +9,7 @@ source core/Kconfig source cxl/Kconfig source display/Kconfig source dma/Kconfig +source fsi/Kconfig source gpio/Kconfig source hyperv/Kconfig source i2c/Kconfig
hw/fsi/Kconfig new file +2 -0
@@ -0,0 +1,2 @@ +config LBUS + bool
hw/fsi/lbus.c new file +94 -0
94 lines not on this page · raw message
hw/fsi/meson.build new file +1 -0
@@ -0,0 +1 @@ +system_ss.add(when: 'CONFIG_LBUS', if_true: files('lbus.c'))
hw/meson.build +1 -0
@@ -43,6 +43,7 @@ subdir('virtio') subdir('watchdog') subdir('xen') subdir('xenpv') +subdir('fsi') subdir('alpha') subdir('arm')
include/hw/fsi/lbus.h new file +48 -0
48 lines not on this page · raw message
include/qemu/bitops.h +6 -0
@@ -618,4 +618,10 @@ static inline uint64_t half_unshuffle64(uint64_t x) return x; } +/* Bitwise operations at the word level. */ +#define BE_BIT (x) BIT(31 - (x)) +#define GENMASK (t, b) \ + (((1ULL << ((t) + 1)) - 1) & ~((1ULL << (b)) - 1)) +#define BE_GENMASK (t, b) GENMASK(BE_BIT(t), BE_BIT(b)) +#endif
Signature · 1 line
2.39.2
PATCH v3 2/8 hw/fsi: Introduce IBM's scratchpad
In reply to Ninad PalsuleThis is a part of patchset where IBM's Flexible Service Interface is introduced.
The LBUS device is embeded inside the scratchpad. The scratchpad provides a non-functional registers. There is a 1-1 relation between scratchpad and LBUS devices. Each LBUS device has 1K memory mapped in the LBUS.
---
v2:
- Incorporated Joel's review comments.
--- hw/fsi/Kconfig | 4 ++ hw/fsi/engine-scratchpad.c | 100 +++++++++++++++++++++++++++++ hw/fsi/meson.build | 1 + include/hw/fsi/engine-scratchpad.h | 33 ++++++++++ 4 files changed, 138 insertions(+) create mode 100644 hw/fsi/engine-scratchpad.c create mode 100644 include/hw/fsi/engine-scratchpad.h
hw/fsi/Kconfig +4 -0
@@ -1,2 +1,6 @@ +config SCRATCHPAD + bool + select LBUS + config LBUS bool
hw/fsi/engine-scratchpad.c new file +100 -0
100 lines not on this page · raw message
hw/fsi/meson.build +1 -0
@@ -1 +1,2 @@ system_ss.add(when: 'CONFIG_LBUS', if_true: files('lbus.c')) +system_ss.add(when: 'CONFIG_SCRATCHPAD', if_true: files('engine-scratchpad.c'))
include/hw/fsi/engine-scratchpad.h new file +33 -0
@@ -0,0 +1,33 @@ +/* +* SPDX-License-Identifier: GPL-2.0-or-later +* Copyright (C) 2023 IBM Corp. +* +* IBM scratchpad engne +*/ +#ifndef FSI_ENGINE_SCRATCHPAD_H +#define FSI_ENGINE_SCRATCHPAD_H + +#include "qemu/bitops.h" + +#include "hw/fsi/lbus.h" + +#define ENGINE_CONFIG_NEXT BE_BIT(0) +#define ENGINE_CONFIG_VPD BE_BIT(1) +#define ENGINE_CONFIG_SLOTS BE_GENMASK(8, 15) +#define ENGINE_CONFIG_VERSION BE_GENMASK(16, 19) +#define ENGINE_CONFIG_TYPE BE_GENMASK(20, 27) +#define ENGINE_CONFIG_TYPE_PEEK (0x02 << 4) +#define ENGINE_CONFIG_TYPE_FSI (0x03 << 4) +#define ENGINE_CONFIG_TYPE_SCRATCHPAD (0x06 << 4) +#define ENGINE_CONFIG_CRC BE_GENMASK(28, 31) + +#define TYPE_SCRATCHPAD "scratchpad" +#define SCRATCHPAD (obj) OBJECT_CHECK(ScratchPad, (obj), TYPE_SCRATCHPAD) + +typedef struct ScratchPad { +LBusDevice parent; + +uint32_t reg; +}ScratchPad ; + +#endif /* FSI_ENGINE_SCRATCHPAD_H */
Signature · 1 line
2.39.2
PATCH v3 3/8 hw/fsi: Introduce IBM's cfam,fsi-slave
In reply to Ninad PalsuleThis is a part of patchset where IBM's Flexible Service Interface is introduced.
The Common FRU Access Macro (CFAM), an address space containing various "engines" that drive accesses on busses internal and external to the POWER chip. Examples include the SBEFIFO and I2C masters. The engines hang off of an internal Local Bus (LBUS) which is described by the CFAM configuration block.
The FSI slave: The slave is the terminal point of the FSI bus for FSI symbols addressed to it. Slaves can be cascaded off of one another. The slave's configuration registers appear in address space of the CFAM to which it is attached.
---
v2:
- Incorporated Joel's review comments.
v3:
- Incorporated Thomas Huth's review comments.
--- hw/fsi/Kconfig | 9 ++ hw/fsi/cfam.c | 241 +++++++++++++++++++++++++++++++++++++ hw/fsi/fsi-slave.c | 109 +++++++++++++++++ hw/fsi/meson.build | 2 + include/hw/fsi/cfam.h | 61 ++++++++++ include/hw/fsi/fsi-slave.h | 29 +++++ 6 files changed, 451 insertions(+) create mode 100644 hw/fsi/cfam.c create mode 100644 hw/fsi/fsi-slave.c create mode 100644 include/hw/fsi/cfam.h create mode 100644 include/hw/fsi/fsi-slave.h
hw/fsi/Kconfig +9 -0
@@ -1,3 +1,12 @@ +config CFAM + bool + select FSI + select SCRATCHPAD + select LBUS + +config FSI + bool + config SCRATCHPAD bool select LBUS
hw/fsi/cfam.c new file +241 -0
241 lines not on this page · raw message
hw/fsi/fsi-slave.c new file +109 -0
109 lines not on this page · raw message
hw/fsi/meson.build +2 -0
@@ -1,2 +1,4 @@ system_ss.add(when: 'CONFIG_LBUS', if_true: files('lbus.c')) system_ss.add(when: 'CONFIG_SCRATCHPAD', if_true: files('engine-scratchpad.c')) +system_ss.add(when: 'CONFIG_CFAM', if_true: files('cfam.c')) +system_ss.add(when: 'CONFIG_FSI', if_true: files('fsi-slave.c'))
include/hw/fsi/cfam.h new file +61 -0
61 lines not on this page · raw message
include/hw/fsi/fsi-slave.h new file +29 -0
@@ -0,0 +1,29 @@ +/* +* SPDX-License-Identifier: GPL-2.0-or-later +* Copyright (C) 2023 IBM Corp. +* +* IBM Flexible Service Interface slave +*/ +#ifndef FSI_FSI_SLAVE_H +#define FSI_FSI_SLAVE_H + +#include "exec/memory.h" +#include "hw/qdev-core.h" + +#include "hw/fsi/lbus.h" + +#include <stdint.h> + +#define TYPE_FSI_SLAVE "fsi.slave" +#define FSI_SLAVE (obj) \ + OBJECT_CHECK(FSISlaveState, (obj), TYPE_FSI_SLAVE) +#define FSI_SLAVE_CONTROL_NR_REGS ((0x40 >> 2) + 1) + +typedef struct FSISlaveState { +DeviceState parent; + +MemoryRegion iomem; +uint32_t regs[FSI_SLAVE_CONTROL_NR_REGS ]; +}FSISlaveState ; + +#endif /* FSI_FSI_H */
Signature · 1 line
2.39.2
PATCH v3 4/8 hw/fsi: Introduce IBM's FSI
In reply to Ninad PalsuleThis is a part of patchset where IBM's Flexible Service Interface is introduced.
This commit models the FSI bus. CFAM is hanging out of FSI bus. The bus is model such a way that it is embeded inside the FSI master which is a bus controller.
The FSI master: A controller in the platform service processor (e.g. BMC) driving CFAM engine accesses into the POWER chip. At the hardware level FSI is a bit-based protocol supporting synchronous and DMA-driven accesses of engines in a CFAM.
---
v2:
- Incorporated review comments by Joel
--- hw/fsi/cfam.c | 3 +- hw/fsi/fsi-master.c | 203 ++++++++++++++++++++++++++++++++++++ hw/fsi/fsi.c | 54 ++++++++++ hw/fsi/meson.build | 2 +- include/hw/fsi/cfam.h | 8 +- include/hw/fsi/fsi-master.h | 30 ++++++ include/hw/fsi/fsi-slave.h | 4 +- include/hw/fsi/fsi.h | 31 ++++++ 8 files changed, 327 insertions(+), 8 deletions(-) create mode 100644 hw/fsi/fsi-master.c create mode 100644 hw/fsi/fsi.c create mode 100644 include/hw/fsi/fsi-master.h create mode 100644 include/hw/fsi/fsi.h
hw/fsi/cfam.c +2 -1
@@ -7,11 +7,12 @@#include "qemu/osdep.h" +#include "qemu/bitops.h" #include "qapi/error.h" #include "qemu/log.h" -#include "hw/fsi/bits.h" #include "hw/fsi/cfam.h" +#include "hw/fsi/fsi.h" #include "hw/fsi/engine-scratchpad.h" #include "hw/qdev-properties.h"
hw/fsi/fsi-master.c new file +203 -0
203 lines not on this page · raw message
hw/fsi/fsi.c new file +54 -0
54 lines not on this page · raw message
hw/fsi/meson.build +1 -1
@@ -1,4 +1,4 @@ system_ss.add(when: 'CONFIG_LBUS', if_true: files('lbus.c')) system_ss.add(when: 'CONFIG_SCRATCHPAD', if_true: files('engine-scratchpad.c')) system_ss.add(when: 'CONFIG_CFAM', if_true: files('cfam.c')) -system_ss.add(when: 'CONFIG_FSI', if_true: files('fsi-slave.c')) +system_ss.add(when: 'CONFIG_FSI', if_true: files('fsi.c','fsi-master.c','fsi-slave.c'))
include/hw/fsi/cfam.h +4 -4
@@ -12,14 +12,14 @@#include "hw/fsi/fsi-slave.h" #include "hw/fsi/lbus.h" -#define TYPE_FSI_BUS "fsi.bus" -#define TYPE_CFAM "cfam"#define CFAM (obj) OBJECT_CHECK(CFAMState, (obj), TYPE_CFAM)#define CFAM_NR_REGS ((0x2e0 >> 2) + 1)#define TYPE_CFAM_CONFIG "cfam.config" +OBJECT_DECLARE_SIMPLE_TYPE(CFAMConfig, CFAM_CONFIG) +#define CFAM_CONFIG (obj) \ OBJECT_CHECK(CFAMConfig, (obj), TYPE_CFAM_CONFIG)/* P9-ism */
@@ -35,8 +35,8 @@ typedef struct CFAMConfig { } CFAMConfig;#define TYPE_CFAM_PEEK "cfam.peek" -#define CFAM_PEEK (obj) \ - OBJECT_CHECK(CFAMPeek, (obj), TYPE_CFAM_PEEK) +OBJECT_DECLARE_SIMPLE_TYPE(CFAMPeek, CFAM_PEEK) +#define CFAM_PEEK_NR_REGS ((0x130 >> 2) + 1) typedef struct CFAMPeek {
include/hw/fsi/fsi-master.h new file +30 -0
@@ -0,0 +1,30 @@ +/* +* SPDX-License-Identifier: GPL-2.0-or-later +* Copyright (C) 2019 IBM Corp. +* +* IBM Flexible Service Interface Master +*/ +#ifndef FSI_FSI_MASTER_H +#define FSI_FSI_MASTER_H + +#include "exec/memory.h" +#include "hw/qdev-core.h" +#include "hw/fsi/fsi.h" + +#define TYPE_FSI_MASTER "fsi.master" +OBJECT_DECLARE_SIMPLE_TYPE(FSIMasterState, FSI_MASTER) + +#define FSI_MASTER_NR_REGS ((0x2e0 >> 2) + 1) + +typedef struct FSIMasterState { +DeviceState parent; +MemoryRegion iomem; +MemoryRegion opb2fsi; + +FSIBus bus; + +uint32_t regs[FSI_MASTER_NR_REGS ]; +}FSIMasterState ; + + +#endif /* FSI_FSI_H */
include/hw/fsi/fsi-slave.h +2 -2
@@ -15,8 +15,8 @@#include <stdint.h> #define TYPE_FSI_SLAVE "fsi.slave" -#define FSI_SLAVE (obj) \ - OBJECT_CHECK(FSISlaveState, (obj), TYPE_FSI_SLAVE) +OBJECT_DECLARE_SIMPLE_TYPE(FSISlaveState, FSI_SLAVE) +#define FSI_SLAVE_CONTROL_NR_REGS ((0x40 >> 2) + 1) typedef struct FSISlaveState {
include/hw/fsi/fsi.h new file +31 -0
@@ -0,0 +1,31 @@ +/* +* SPDX-License-Identifier: GPL-2.0-or-later +* Copyright (C) 2023 IBM Corp. +* +* IBM Flexible Service Interface +*/ +#ifndef FSI_FSI_H +#define FSI_FSI_H + +#include "hw/qdev-core.h" + +/* +* TODO: Maybe unwind this dependency with const links? Store a +* pointer in FSIBus? +*/ +#include "hw/fsi/cfam.h" + +#define TYPE_FSI_BUS "fsi.bus" +OBJECT_DECLARE_SIMPLE_TYPE (FSIBus,FSI_BUS ) + +/* TODO: Figure out what's best with a point-to-point bus */ +typedef struct FSISlaveState FSISlaveState ; + +typedef struct FSIBus { +BusState bus; + +/* XXX: It's point-to-point, just instantiate the slave directly for now */ +CFAMState slave; +}FSIBus ; + +#endif
Signature · 1 line
2.39.2
PATCH v3 5/8 hw/fsi: IBM's On-chip Peripheral Bus
In reply to Ninad PalsuleThis is a part of patchset where IBM's Flexible Service Interface is introduced.
The On-Chip Peripheral Bus (OPB): A low-speed bus typically found in POWER processors. This now makes an appearance in the ASPEED SoC due to tight integration of the FSI master IP with the OPB, mainly the existence of an MMIO-mapping of the CFAM address straight onto a sub-region of the OPB address space.
---
v2:
- Incorporated review comment by Joel.
--- hw/fsi/Kconfig | 4 + hw/fsi/fsi-master.c | 6 +- hw/fsi/meson.build | 1 + hw/fsi/opb.c | 194 +++++++++++++++++++++++++++++++++++++++++++ include/hw/fsi/opb.h | 43 ++++++++++ 5 files changed, 244 insertions(+), 4 deletions(-) create mode 100644 hw/fsi/opb.c create mode 100644 include/hw/fsi/opb.h
hw/fsi/Kconfig +4 -0
@@ -1,3 +1,7 @@ +config OPB + bool + select CFAM + config CFAM bool select FSI
hw/fsi/fsi-master.c +2 -4
@@ -7,14 +7,12 @@#include "qemu/osdep.h" +#include "qemu/bitops.h" #include "qapi/error.h" -#include "qemu/log.h" -#include "hw/fsi/bits.h" #include "hw/fsi/fsi-master.h" - -#define TYPE_OP_BUS "opb" +#include "hw/fsi/opb.h" #define TO_REG (x) ((x) >> 2)
hw/fsi/meson.build +1 -0
@@ -2,3 +2,4 @@ system_ss.add(when: 'CONFIG_LBUS', if_true: files('lbus.c')) system_ss.add(when: 'CONFIG_SCRATCHPAD', if_true: files('engine-scratchpad.c')) system_ss.add(when: 'CONFIG_CFAM', if_true: files('cfam.c')) system_ss.add(when: 'CONFIG_FSI', if_true: files('fsi.c','fsi-master.c','fsi-slave.c')) +system_ss.add(when: 'CONFIG_OPB', if_true: files('opb.c'))
hw/fsi/opb.c new file +194 -0
194 lines not on this page · raw message
include/hw/fsi/opb.h new file +43 -0
43 lines not on this page · raw message
Signature · 1 line
2.39.2
PATCH v3 6/8 hw/fsi: Aspeed APB2OPB interface
In reply to Ninad PalsuleThis is a part of patchset where IBM's Flexible Service Interface is introduced.
An APB-to-OPB bridge enabling access to the OPB from the ARM core in the AST2600. Hardware limitations prevent the OPB from being directly mapped into APB, so all accesses are indirect through the bridge.
---
v2:
- Incorporated review comments by Joel
v3:
- Incorporated review comments by Thomas Huth
--- hw/arm/Kconfig | 1 + hw/fsi/Kconfig | 20 +- hw/fsi/aspeed-apb2opb.c | 352 ++++++++++++++++++++++++++++++++ hw/fsi/meson.build | 9 +- hw/fsi/trace-events | 2 + hw/fsi/trace.h | 1 + include/hw/fsi/aspeed-apb2opb.h | 33 +++ meson.build | 1 + 8 files changed, 407 insertions(+), 12 deletions(-) create mode 100644 hw/fsi/aspeed-apb2opb.c create mode 100644 hw/fsi/trace-events create mode 100644 hw/fsi/trace.h create mode 100644 include/hw/fsi/aspeed-apb2opb.h
hw/arm/Kconfig +1 -0
@@ -589,6 +589,7 @@ config FSL_IMX7 select PCI_EXPRESS_DESIGNWARE select SDHCI select UNIMP + select FSI_APB2OPB_ASPEED config ARM_SMMUV3 bool
hw/fsi/Kconfig +12 -8
@@ -1,19 +1,23 @@ -config OPB +config FSI_APB2OPB_ASPEED bool - select CFAM + select FSI_OPB -config CFAM +config FSI_OPB + bool + select FSI_CFAM + +config FSI_CFAM bool select FSI - select SCRATCHPAD - select LBUS + select FSI_SCRATCHPAD + select FSI_LBUS config FSI bool -config SCRATCHPAD +config FSI_SCRATCHPAD bool - select LBUS + select FSI_LBUS -config LBUS +config FSI_LBUS bool
hw/fsi/aspeed-apb2opb.c new file +352 -0
352 lines not on this page · raw message
hw/fsi/meson.build +5 -4
@@ -1,5 +1,6 @@ -system_ss.add(when: 'CONFIG_LBUS', if_true: files('lbus.c')) -system_ss.add(when: 'CONFIG_SCRATCHPAD', if_true: files('engine-scratchpad.c')) -system_ss.add(when: 'CONFIG_CFAM', if_true: files('cfam.c')) +system_ss.add(when: 'CONFIG_FSI_LBUS', if_true: files('lbus.c')) +system_ss.add(when: 'CONFIG_FSI_SCRATCHPAD', if_true: files('engine-scratchpad.c')) +system_ss.add(when: 'CONFIG_FSI_CFAM', if_true: files('cfam.c')) system_ss.add(when: 'CONFIG_FSI', if_true: files('fsi.c','fsi-master.c','fsi-slave.c')) -system_ss.add(when: 'CONFIG_OPB', if_true: files('opb.c')) +system_ss.add(when: 'CONFIG_FSI_OPB', if_true: files('opb.c')) +system_ss.add(when: 'CONFIG_FSI_APB2OPB_ASPEED', if_true: files('aspeed-apb2opb.c'))
hw/fsi/trace-events new file +2 -0
@@ -0,0 +1,2 @@ +aspeed_apb2opb_read(uint64_t addr, uint32_t size) "@0x%" PRIx64 " size=%d" +aspeed_apb2opb_write(uint64_t addr, uint32_t size, uint64_t data) "@0x%" PRIx64 " size=%d value=0x%"PRIx64
hw/fsi/trace.h new file +1 -0
@@ -0,0 +1 @@ +#include "trace/trace-hw_fsi.h"
include/hw/fsi/aspeed-apb2opb.h new file +33 -0
@@ -0,0 +1,33 @@ +/* +* SPDX-License-Identifier: GPL-2.0-or-later +* Copyright (C) 2023 IBM Corp. +* +* ASPEED APB2OPB Bridge +*/ +#ifndef FSI_ASPEED_APB2OPB_H +#define FSI_ASPEED_APB2OPB_H + +#include "hw/sysbus.h" +#include "hw/fsi/opb.h" + +#define TYPE_ASPEED_APB2OPB "aspeed.apb2opb" +OBJECT_DECLARE_SIMPLE_TYPE(AspeedAPB2OPBState, ASPEED_APB2OPB) + +#define ASPEED_APB2OPB_NR_REGS ((0xe8 >> 2) + 1) + +#define ASPEED_FSI_NUM 2 + +typedef struct AspeedAPB2OPBState { +/*< private >*/ +SysBusDevice parent_obj; + +/*< public >*/ +MemoryRegion iomem; + +uint32_t regs[ASPEED_APB2OPB_NR_REGS ]; +qemu_irq irq; + +OPBus opb[ASPEED_FSI_NUM ]; +}AspeedAPB2OPBState ; + +#endif /* FSI_ASPEED_APB2OPB_H */
meson.build +1 -0
@@ -3244,6 +3244,7 @@ if have_system 'hw/char', 'hw/display', 'hw/dma', + 'hw/fsi', 'hw/hyperv', 'hw/i2c', 'hw/i386',
Signature · 1 line
2.39.2
PATCH v3 7/8 hw/arm: Hook up FSI module in AST2600
In reply to Ninad PalsuleThis patchset introduces IBM's Flexible Service Interface(FSI).
Time for some fun with inter-processor buses. FSI allows a service processor access to the internal buses of a host POWER processor to perform configuration or debugging.
FSI has long existed in POWER processes and so comes with some baggage, including how it has been integrated into the ASPEED SoC.
Working backwards from the POWER processor, the fundamental pieces of interest for the implementation are:
1. The Common FRU Access Macro (CFAM), an address space containing various "engines" that drive accesses on buses internal and external to the POWER chip. Examples include the SBEFIFO and I2C masters. The engines hang off of an internal Local Bus (LBUS) which is described by the CFAM configuration block.
2. The FSI slave: The slave is the terminal point of the FSI bus for FSI symbols addressed to it. Slaves can be cascaded off of one another. The slave's configuration registers appear in address space of the CFAM to which it is attached.
3. The FSI master: A controller in the platform service processor (e.g. BMC) driving CFAM engine accesses into the POWER chip. At the hardware level FSI is a bit-based protocol supporting synchronous and DMA-driven accesses of engines in a CFAM.
4. The On-Chip Peripheral Bus (OPB): A low-speed bus typically found in POWER processors. This now makes an appearance in the ASPEED SoC due to tight integration of the FSI master IP with the OPB, mainly the existence of an MMIO-mapping of the CFAM address straight onto a sub-region of the OPB address space.
5. An APB-to-OPB bridge enabling access to the OPB from the ARM core in the AST2600. Hardware limitations prevent the OPB from being directly mapped into APB, so all accesses are indirect through the bridge.
The implementation appears as following in the qemu device tree:
(qemu) info qtree
bus: main-system-bus
type System
...
dev: aspeed.apb2opb, id ""
gpio-out "sysbus-irq" 1
mmio 000000001e79b000/0000000000001000
bus: opb.1
type opb
dev: fsi.master, id ""
bus: fsi.bus.1
type fsi.bus
dev: cfam.config, id ""
dev: cfam, id ""
bus: lbus.1
type lbus
dev: scratchpad, id ""
address = 0 (0x0)
bus: opb.0
type opb
dev: fsi.master, id ""
bus: fsi.bus.0
type fsi.bus
dev: cfam.config, id ""
dev: cfam, id ""
bus: lbus.0
type lbus
dev: scratchpad, id ""
address = 0 (0x0)
The LBUS is modelled to maintain the qdev bus hierarchy and to take advantage of the object model to automatically generate the CFAM configuration block. The configuration block presents engines in the order they are attached to the CFAM's LBUS. Engine implementations should subclass the LBusDevice and set the 'config' member of LBusDeviceClass to match the engine's type.
CFAM designs offer a lot of flexibility, for instance it is possible for a CFAM to be simultaneously driven from multiple FSI links. The modeling is not so complete; it's assumed that each CFAM is attached to a single FSI slave (as a consequence the CFAM subclasses the FSI slave).
As for FSI, its symbols and wire-protocol are not modelled at all. This is not necessary to get FSI off the ground thanks to the mapping of the CFAM address space onto the OPB address space - the models follow this directly and map the CFAM memory region into the OPB's memory region. Future work includes supporting more advanced accesses that drive the FSI master directly rather than indirectly via the CFAM mapping, which will require implementing the FSI state machine and methods for each of the FSI symbols on the slave. Further down the track we can also look at supporting the bitbanged SoftFSI drivers in Linux by extending the FSI slave model to resolve sequences of GPIO IRQs into FSI symbols, and calling the associated symbol method on the slave to map the access onto the CFAM.
Testing:
Tested by reading cfam config address 0 on rainier machine type.
root@p10bmc:~# pdbg -a getcfam 0x0
p0: 0x0 = 0xc0022d15--- hw/arm/aspeed_ast2600.c | 19 +++++++++++++++++++ include/hw/arm/aspeed_soc.h | 4 ++++ 2 files changed, 23 insertions(+)
hw/arm/aspeed_ast2600.c +19 -0
@@ -75,6 +75,8 @@ static const hwaddr aspeed_soc_ast2600_memmap[] = { [ASPEED_DEV_UART12] = 0x1E790600, [ASPEED_DEV_UART13] = 0x1E790700, [ASPEED_DEV_VUART] = 0x1E787000, + [ASPEED_DEV_FSI1] = 0x1E79B000, + [ASPEED_DEV_FSI2] = 0x1E79B100, [ASPEED_DEV_I3C] = 0x1E7A0000, [ASPEED_DEV_SDRAM] = 0x80000000, };
@@ -132,6 +134,8 @@ static const int aspeed_soc_ast2600_irqmap[] = { [ASPEED_DEV_ETH4] = 33, [ASPEED_DEV_KCS] = 138, /* 138 -> 142 */ [ASPEED_DEV_DP] = 62, + [ASPEED_DEV_FSI1] = 100, + [ASPEED_DEV_FSI2] = 101, [ASPEED_DEV_I3C] = 102, /* 102 -> 107 */ };
@@ -262,6 +266,10 @@ static void aspeed_soc_ast2600_init(Object *obj)object_initialize_child (obj,"emmc-boot-controller" , &s->emmc_boot_controller,TYPE_UNIMPLEMENTED_DEVICE ); + +for (i =0 ; i <ASPEED_FSI_NUM ; i++) { +object_initialize_child (obj,"fsi[*]" , &s->fsi[i],TYPE_ASPEED_APB2OPB ); + } }/*
@@ -622,6 +630,17 @@ static void aspeed_soc_ast2600_realize(DeviceState *dev, Error **errp)return ; }aspeed_mmio_map (s,SYS_BUS_DEVICE (&s->sbc),0 , sc->memmap[ASPEED_DEV_SBC ]); + +/* FSI */ +for (i =0 ; i <ASPEED_FSI_NUM ; i++) { +if (!sysbus_realize (SYS_BUS_DEVICE (&s->fsi[i]), errp)) { +return ; + } +aspeed_mmio_map (s,SYS_BUS_DEVICE (&s->fsi[i]),0 , + sc->memmap[ASPEED_DEV_FSI1 + i]); +sysbus_connect_irq (SYS_BUS_DEVICE (&s->fsi[i]),0 , +aspeed_soc_get_irq (s,ASPEED_DEV_FSI1 + i)); + } }static void aspeed_soc_ast2600_class_init (ObjectClass *oc,void *data)
include/hw/arm/aspeed_soc.h +4 -0
@@ -36,6 +36,7 @@#include "hw/misc/aspeed_lpc.h" #include "hw/misc/unimp.h" #include "hw/misc/aspeed_peci.h" +#include "hw/fsi/aspeed-apb2opb.h" #include "hw/char/serial.h" #define ASPEED_SPIS_NUM 2
@@ -96,6 +97,7 @@ struct AspeedSoCState {UnimplementedDeviceState udc;UnimplementedDeviceState sgpiom;UnimplementedDeviceState jtag[ASPEED_JTAG_NUM ]; +AspeedAPB2OPBState fsi[2 ]; };#define TYPE_ASPEED_SOC "aspeed-soc"
@@ -191,6 +193,8 @@ enum {ASPEED_DEV_SGPIOM ,ASPEED_DEV_JTAG0 ,ASPEED_DEV_JTAG1 , +ASPEED_DEV_FSI1 , + ASPEED_DEV_FSI2, };#define ASPEED_SOC_SPI_BOOT_ADDR 0x0
Signature · 1 line
2.39.2
PATCH v3 8/8 hw/fsi: Documentation and testing
In reply to Ninad PalsuleAdded FSI document
Added basic qtests for FSI model.
Added MAINITAINER for FSI
Replaced some qemu logs to traces.
---
v3:
- Incorporated Cedric's review comments.
--- MAINTAINERS | 20 ++++ docs/specs/fsi.rst | 141 +++++++++++++++++++++++++++ hw/fsi/cfam.c | 13 +-- hw/fsi/trace-events | 6 ++ tests/qtest/fsi-test.c | 210 ++++++++++++++++++++++++++++++++++++++++ tests/qtest/meson.build | 2 + 6 files changed, 384 insertions(+), 8 deletions(-) create mode 100644 docs/specs/fsi.rst create mode 100644 tests/qtest/fsi-test.c
MAINTAINERS +20 -0
@@ -3395,6 +3395,26 @@ F: tests/qtest/adm1272-test.c F: tests/qtest/max34451-test.c F: tests/qtest/isl_pmbus_vr-test.c +FSI +M: Ninad Palsule <[email protected]> +S: Maintained +F: hw/fsi/aspeed-apb2opb.c +F: hw/fsi/cfam.c +F: hw/fsi/fsi.c +F: hw/fsi/fsi-slave.c +F: hw/fsi/opb.c +F: hw/fsi/engine-scratchpad.c +F: hw/fsi/fsi-master.c +F: hw/fsi/lbus.c +F: include/hw/fsi/aspeed-apb2opb.h +F: include/hw/fsi/cfam.h +F: include/hw/fsi/fsi.h +F: include/hw/fsi/fsi-slave.h +F: include/hw/fsi/opb.h +F: include/hw/fsi/engine-scratchpad.h +F: include/hw/fsi/fsi-master.h +F: include/hw/fsi/lbus.h + Firmware schema specifications M: Philippe Mathieu-Daudé <[email protected]> R: Daniel P. Berrange <[email protected]>
docs/specs/fsi.rst new file +141 -0
141 lines not on this page · raw message
hw/fsi/cfam.c +5 -8
@@ -10,6 +10,7 @@#include "qemu/bitops.h" #include "qapi/error.h" #include "qemu/log.h" +#include "trace.h" #include "hw/fsi/cfam.h" #include "hw/fsi/fsi.h"
@@ -35,8 +36,7 @@ static uint64_t cfam_config_read(void *opaque, hwaddr addr, unsigned size) config =CFAM_CONFIG (opaque); cfam =container_of (config, CFAMState, config); -qemu_log_mask (LOG_UNIMP ,"%s: read @0x%" HWADDR_PRIx" size=%d\n" , - __func__, addr, size); +trace_cfam_config_read (addr, size);assert (size ==4 );assert (!(addr &3 ));
@@ -85,8 +85,7 @@ static void cfam_config_write(void *opaque, hwaddr addr, uint64_t data, {CFAMConfig *s =CFAM_CONFIG (opaque); -qemu_log_mask (LOG_UNIMP ,"%s: write @0x%" HWADDR_PRIx" size=%d " -"value=%" PRIx64"\n" , __func__, addr, size, data); +trace_cfam_config_write (addr, size, data);assert (size ==4 );assert (!(addr &3 ));
@@ -142,8 +141,7 @@ static const TypeInfo cfam_config_info = {static uint64_t cfam_unimplemented_read (void *opaque,hwaddr addr,unsigned size) { -qemu_log_mask (LOG_UNIMP ,"%s: read @0x%" HWADDR_PRIx" size=%d\n" , - __func__, addr, size); +trace_cfam_unimplemented_read (addr, size);return 0 ; }
@@ -151,8 +149,7 @@ static uint64_t cfam_unimplemented_read(void *opaque, hwaddr addr,static void cfam_unimplemented_write (void *opaque,hwaddr addr,uint64_t data,unsigned size) { -qemu_log_mask (LOG_UNIMP ,"%s: write @0x%" HWADDR_PRIx" size=%d " -"value=%" PRIx64"\n" , __func__, addr, size, data); +trace_cfam_unimplemented_write (addr, size, data); }static const struct MemoryRegionOps cfam_unimplemented_ops = {
hw/fsi/trace-events +6 -0
@@ -1,2 +1,8 @@ aspeed_apb2opb_read(uint64_t addr, uint32_t size) "@0x%" PRIx64 " size=%d" aspeed_apb2opb_write(uint64_t addr, uint32_t size, uint64_t data) "@0x%" PRIx64 " size=%d value=0x%"PRIx64 + +cfam_config_read(uint64_t addr, uint32_t size) "@0x%" PRIx64 " size=%d" +cfam_config_write(uint64_t addr, uint32_t size, uint64_t data) "@0x%" PRIx64 " size=%d value=0x%"PRIx64 + +cfam_unimplemented_read(uint64_t addr, uint32_t size) "@0x%" PRIx64 " size=%d" +cfam_unimplemented_write(uint64_t addr, uint32_t size, uint64_t data) "@0x%" PRIx64 " size=%d value=0x%"PRIx64
tests/qtest/fsi-test.c new file +210 -0
210 lines not on this page · raw message
tests/qtest/meson.build +2 -0
@@ -207,6 +207,7 @@ qtests_arm = \ (config_all_devices.has_key('CONFIG_TPM_TIS_I2C') ? ['tpm-tis-i2c-test'] : []) + \ (config_all_devices.has_key('CONFIG_VEXPRESS') ? ['test-arm-mptimer'] : []) + \ (config_all_devices.has_key('CONFIG_MICROBIT') ? ['microbit-test'] : []) + \ + (config_all_devices.has_key('CONFIG_FSI_APB2OPB_ASPEED') ? ['fsi-test'] : []) + \ ['arm-cpu-features', 'boot-serial-test']
@@ -318,6 +319,7 @@ qtests = { 'tpm-tis-device-test': [io, tpmemu_files, 'tpm-tis-util.c'], 'vmgenid-test': files('boot-sector.c', 'acpi-utils.c'), 'netdev-socket': files('netdev-socket.c', '../unit/socket-helpers.c'), + 'fsi-test': files('fsi-test.c'), } if vnc.found()
Signature · 1 line
2.39.2
Re: [PATCH v3 8/8] hw/fsi: Documentation and testing
Quoted 4 lines · Ninad Palsule
Added FSI document
Added basic qtests for FSI model.
Added MAINITAINER for FSI
Replaced some qemu logs to traces.
Sorry, that's not how we rework patch series in the QEMU development process. Please squash the log traces changes into the patches that introduced the original code, and please put the MAINTAINERS update, documentation and qtests into separate patches.
Thanks,
Thomas
Re: [PATCH v3 8/8] hw/fsi: Documentation and testing
Quoted 7 lines · Thomas Huth
Quoted 4 lines · Ninad Palsule
Added FSI document
Added basic qtests for FSI model.
Added MAINITAINER for FSI
Replaced some qemu logs to traces.Sorry, that's not how we rework patch series in the QEMU development process. Please squash the log traces changes into the patches that introduced the original code, and please put the
MAINTAINERSupdate, documentation and qtests into separate patches.
yes. This is true for some Kconfig changes also. On that topic, please make sure FSI is compiled only when ASPEED_SOC is selected. It could be useful for the PPC PowerNV machines one day but the models are not available yet.
I will try to go through the series this week. Wait a bit for the v4.
Thanks,
C.
Re: [PATCH v3 8/8] hw/fsi: Documentation and testing
Hello Cedric,
Quoted 7 lines · Cédric Le Goater
Quoted 6 lines · Thomas Huth
Quoted 4 lines · Ninad Palsule
Added FSI document
Added basic qtests for FSI model.
Added MAINITAINER for FSI
Replaced some qemu logs to traces.
Quoted 6 lines
Quoted 1 line
Sorry, that's not how we rework patch series in the QEMU development process. Please squash the log traces changes into the patches that introduced the original code, and please put the
MAINTAINERSupdate, documentation and qtests into separate patches.yes. This is true for some
Kconfigchanges also. On that topic, please make sure FSI is compiled only whenASPEED_SOCis selected. It could be useful for the PPC PowerNV machines one day but the models are not available yet.
Fixed the Kconfig rework and make sure that FSI is selected only with ASPEED_SOC.
Thanks for the review.
~Ninad
Quoted 8 lines
I will try to go through the series this week. Wait a bit for the v4.
Thanks,
C.
Re: [PATCH v3 8/8] hw/fsi: Documentation and testing
In reply to Thomas HuthHello Thomas,
Quoted 7 lines · Thomas Huth
Quoted 4 lines · Ninad Palsule
Added FSI document
Added basic qtests for FSI model.
Added MAINITAINER for FSI
Replaced some qemu logs to traces.Sorry, that's not how we rework patch series in the QEMU development process. Please squash the log traces changes into the patches that introduced the original code, and please put the
MAINTAINERSupdate, documentation and qtests into separate patches.
Fix the rework issue and added separate patches for MAINTAINER, doc and qtests.
Thanks for the review.
~Ninad
Quoted 5 lines
Thanks,
Thomas