Introduce model for IBM's FSI
Subsystems (2)
PATCH v12 3/11 hw/fsi: Introduce IBM's FSI Bus
In reply to Ninad PalsuleThis is a part of patchset where FSI bus is introduced.
The FSI bus is a simple bus where FSI master is attached.
[ clg: - removed include/hw/fsi/engine-scratchpad.h and
hw/fsi/engine-scratchpad.c
- dropped FSI_SCRATCHPAD
- included FSIBus definition
- dropped hw/fsi/trace-events changes ]
---
v11:
- Split the patch.
--- include/hw/fsi/fsi.h | 19 +++++++++++++++++++ hw/fsi/fsi.c | 22 ++++++++++++++++++++++ hw/fsi/meson.build | 2 +- 3 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 include/hw/fsi/fsi.h create mode 100644 hw/fsi/fsi.c
include/hw/fsi/fsi.h new file +19 -0
@@ -0,0 +1,19 @@ +/* +* SPDX-License-Identifier: GPL-2.0-or-later +* Copyright (C) 2024 IBM Corp. +* +* IBM Flexible Service Interface +*/ +#ifndef FSI_FSI_H +#define FSI_FSI_H + +#include "hw/qdev-core.h" + +#define TYPE_FSI_BUS "fsi.bus" +OBJECT_DECLARE_SIMPLE_TYPE(FSIBus, FSI_BUS) + +typedef struct FSIBus { +BusState bus; +}FSIBus ; + +#endif /* FSI_FSI_H */
hw/fsi/fsi.c new file +22 -0
@@ -0,0 +1,22 @@ +/* +* SPDX-License-Identifier: GPL-2.0-or-later +* Copyright (C) 2024 IBM Corp. +* +* IBM Flexible Service Interface +*/ +#include "qemu/osdep.h" + +#include "hw/fsi/fsi.h" + +static const TypeInfo fsi_bus_info = { + .name =TYPE_FSI_BUS , + .parent =TYPE_BUS , + .instance_size =sizeof (FSIBus), +}; + +static void fsi_bus_register_types (void ) +{ +type_register_static (&fsi_bus_info); +} + +type_init (fsi_bus_register_types);
hw/fsi/meson.build +1 -1
@@ -1 +1 @@ -system_ss.add(when: 'CONFIG_FSI', if_true: files('lbus.c')) +system_ss.add(when: 'CONFIG_FSI', if_true: files('lbus.c','fsi.c'))
Signature · 1 line
2.39.2
PATCH v12 4/11 hw/fsi: Introduce IBM's fsi-slave model
In reply to Ninad PalsuleThis is a part of patchset where IBM's Flexible Service Interface is introduced.
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.
--- include/hw/fsi/fsi.h | 18 ++++++++++ hw/fsi/fsi.c | 84 ++++++++++++++++++++++++++++++++++++++++++-- hw/fsi/trace-events | 2 ++ 3 files changed, 102 insertions(+), 2 deletions(-)
include/hw/fsi/fsi.h +18 -0
@@ -7,7 +7,13 @@#ifndef FSI_FSI_H #define FSI_FSI_H +#include "exec/memory.h" #include "hw/qdev-core.h" +#include "hw/fsi/lbus.h" +#include "qemu/bitops.h" + +/* Bitwise operations at the word level. */ +#define BE_GENMASK (hb, lb) MAKE_64BIT_MASK((lb), ((hb) - (lb) + 1))#define TYPE_FSI_BUS "fsi.bus"OBJECT_DECLARE_SIMPLE_TYPE (FSIBus,FSI_BUS )
@@ -16,4 +22,16 @@ typedef struct FSIBus {BusState bus; } FSIBus; +#define TYPE_FSI_SLAVE "fsi.slave" +OBJECT_DECLARE_SIMPLE_TYPE(FSISlaveState, 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 */
hw/fsi/fsi.c +82 -2
100 lines not on this page · raw message
hw/fsi/trace-events +2 -0
@@ -1,2 +1,4 @@ fsi_scratchpad_read(uint64_t addr, uint32_t size) "@0x%" PRIx64 " size=%d" fsi_scratchpad_write(uint64_t addr, uint32_t size, uint64_t data) "@0x%" PRIx64 " size=%d value=0x%"PRIx64 +fsi_slave_read(uint64_t addr, uint32_t size) "@0x%" PRIx64 " size=%d" +fsi_slave_write(uint64_t addr, uint32_t size, uint64_t data) "@0x%" PRIx64 " size=%d value=0x%"PRIx64
Signature · 1 line
2.39.2
PATCH v12 11/11 hw/fsi: Update MAINTAINER list
In reply to Ninad PalsuleAdded maintainer for IBM FSI model
---
v11:
- Added Cedric as reviewer.
--- MAINTAINERS | 9 +++++++++ 1 file changed, 9 insertions(+)
MAINTAINERS +9 -0
@@ -3585,6 +3585,15 @@ 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]> +R: Cédric Le Goater <[email protected]> +S: Maintained +F: hw/fsi/* +F: include/hw/fsi/* +F: docs/specs/fsi.rst +F: tests/qtest/fsi-test.c + Firmware schema specifications M: Philippe Mathieu-Daudé <[email protected]> R: Daniel P. Berrange <[email protected]>
Signature · 1 line
2.39.2
PATCH v12 6/11 hw/fsi: Introduce IBM's FSI master
In reply to Ninad PalsuleThis is a part of patchset where IBM's Flexible Service Interface is introduced.
This commit models the FSI master. CFAM is hanging out of 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.
[ clg: - move FSICFAMState object under FSIMasterState
- introduced fsi_master_init()
- reworked fsi_master_realize()
- dropped FSIBus definition ]
---
v9:
- Initialized registers.
- Fixed the address check.
v11:
- Replaced for loop with memset.
- Removed Joel's review tag as per Cedric.
--- include/hw/fsi/fsi-master.h | 32 +++++++ hw/fsi/fsi-master.c | 170 ++++++++++++++++++++++++++++++++++++ hw/fsi/meson.build | 2 +- hw/fsi/trace-events | 2 + 4 files changed, 205 insertions(+), 1 deletion(-) create mode 100644 include/hw/fsi/fsi-master.h create mode 100644 hw/fsi/fsi-master.c
include/hw/fsi/fsi-master.h new file +32 -0
@@ -0,0 +1,32 @@ +/* +* SPDX-License-Identifier: GPL-2.0-or-later +* Copyright (C) 2024 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" +#include "hw/fsi/cfam.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 ]; +FSICFAMState cfam; +}FSIMasterState ; + + +#endif /* FSI_FSI_H */
hw/fsi/fsi-master.c new file +170 -0
170 lines not on this page · raw message
hw/fsi/meson.build +1 -1
@@ -1 +1 @@ -system_ss.add(when: 'CONFIG_FSI', if_true: files('lbus.c','fsi.c','cfam.c')) +system_ss.add(when: 'CONFIG_FSI', if_true: files('lbus.c','fsi.c','cfam.c','fsi-master.c'))
hw/fsi/trace-events +2 -0
@@ -7,3 +7,5 @@ fsi_cfam_config_write(uint64_t addr, uint32_t size, uint64_t data) "@0x%" PRIx64 fsi_cfam_unimplemented_read(uint64_t addr, uint32_t size) "@0x%" PRIx64 " size=%d" fsi_cfam_unimplemented_write(uint64_t addr, uint32_t size, uint64_t data) "@0x%" PRIx64 " size=%d value=0x%"PRIx64 fsi_cfam_config_write_noaddr(uint64_t addr, uint32_t size, uint64_t data) "@0x%" PRIx64 " size=%d value=0x%"PRIx64 +fsi_master_read(uint64_t addr, uint32_t size) "@0x%" PRIx64 " size=%d" +fsi_master_write(uint64_t addr, uint32_t size, uint64_t data) "@0x%" PRIx64 " size=%d value=0x%"PRIx64
Signature · 1 line
2.39.2
PATCH v12 10/11 hw/fsi: Added FSI documentation
In reply to Ninad PalsuleDocumentation for IBM FSI model.
---
v11:
- Removed Cedric's signoff.
--- docs/specs/fsi.rst | 126 +++++++++++++++++++++++++++++++++++++++++++ docs/specs/index.rst | 1 + 2 files changed, 127 insertions(+) create mode 100644 docs/specs/fsi.rst
docs/specs/fsi.rst new file +126 -0
@@ -0,0 +1,126 @@ +====================================== +IBM's Flexible Service Interface (FSI) +====================================== + +The QEMU FSI emulation implements hardware interfaces between ASPEED SOC, FSI +master/slave and the end engine. + +FSI is a point-to-point two wire interface which is capable of supporting +distances of up to 4 meters. FSI interfaces have been used successfully for +many years in IBM servers to attach IBM Flexible Support Processors(FSP) to +CPUs and IBM ASICs. + +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: (see the `FSI specification`_ for more details) + +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 LBUS is modelled to maintain the qdev bus hierarchy and to take advantages +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. + +QEMU files related to FSI interface are in following directories: + - ``hw/fsi`` + - ``include/hw/fsi`` + +The following commands start the ``rainier-bmc`` machine with built-in FSI +model. There are no model specific arguments. Please check this document to +learn more about Aspeed ``rainier-bmc`` machine: docs/system/arm/aspeed.rst + +.. code-block:: console + + qemu-system-arm -M rainier-bmc -nographic \ + -kernel fitImage-linux.bin \ + -dtb aspeed-bmc-ibm-rainier.dtb \ + -initrd obmc-phosphor-initramfs.rootfs.cpio.xz \ + -drive file=obmc-phosphor-image.rootfs.wic.qcow2,if=sd,index=2 \ + -append "rootwait console=ttyS4,115200n8 root=PARTLABEL=rofs-a" + +The implementation appears as following in the qemu device tree: + +.. code-block:: console + + (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) + +pdbg is a simple application to allow debugging of the host POWER processors +from the BMC. (see the `pdbg source repository`_ for more details) + +.. code-block:: console + + root@p10bmc:~# pdbg -a getcfam 0x0 + p0: 0x0 = 0xc0022d15 + +.. _FSI specification: + https://openpowerfoundation.org/specifications/fsi/ + +.. _pdbg source repository: + https://github.com/open-power/pdbg
docs/specs/index.rst +1 -0
@@ -24,6 +24,7 @@ guest hardware that is specific to QEMU. acpi_erst sev-guest-firmware fw_cfg + fsi vmw_pvscsi-spec edu ivshmem-spec
Signature · 1 line
2.39.2
v12 cover Introduce model for IBM's FSI
Hello,
Please review the patch-set version 12.
I have incorporated review comments from Cedric.
v12:
- Minor changes.
- Added reviewed by tags.
Ninad Palsule (11):
hw/fsi: Introduce IBM's Local bus
hw/fsi: Introduce IBM's scratchpad device
hw/fsi: Introduce IBM's FSI Bus
hw/fsi: Introduce IBM's fsi-slave model
hw/fsi: Introduce IBM's cfam
hw/fsi: Introduce IBM's FSI master
hw/fsi: Aspeed APB2OPB & On-chip peripheral bus
hw/arm: Hook up FSI module in AST2600
hw/fsi: Added qtest
hw/fsi: Added FSI documentation
hw/fsi: Update MAINTAINER list
MAINTAINERS | 9 + docs/specs/fsi.rst | 126 ++++++++++++ docs/specs/index.rst | 1 + meson.build | 1 + hw/fsi/trace.h | 1 + include/hw/arm/aspeed_soc.h | 4 + include/hw/fsi/aspeed_apb2opb.h | 46 +++++ include/hw/fsi/cfam.h | 34 ++++ include/hw/fsi/fsi-master.h | 32 ++++ include/hw/fsi/fsi.h | 37 ++++ include/hw/fsi/lbus.h | 43 +++++ hw/arm/aspeed_ast2600.c | 19 ++ hw/fsi/aspeed_apb2opb.c | 329 ++++++++++++++++++++++++++++++++ hw/fsi/cfam.c | 168 ++++++++++++++++ hw/fsi/fsi-master.c | 170 +++++++++++++++++ hw/fsi/fsi.c | 102 ++++++++++ hw/fsi/lbus.c | 117 ++++++++++++ tests/qtest/aspeed-fsi-test.c | 205 ++++++++++++++++++++ hw/Kconfig | 1 + hw/arm/Kconfig | 1 + hw/fsi/Kconfig | 7 + hw/fsi/meson.build | 2 + hw/fsi/trace-events | 13 ++ hw/meson.build | 1 + tests/qtest/meson.build | 1 + 25 files changed, 1470 insertions(+) create mode 100644 docs/specs/fsi.rst 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/fsi-master.h create mode 100644 include/hw/fsi/fsi.h create mode 100644 include/hw/fsi/lbus.h create mode 100644 hw/fsi/aspeed_apb2opb.c create mode 100644 hw/fsi/cfam.c create mode 100644 hw/fsi/fsi-master.c create mode 100644 hw/fsi/fsi.c create mode 100644 hw/fsi/lbus.c create mode 100644 tests/qtest/aspeed-fsi-test.c create mode 100644 hw/fsi/Kconfig create mode 100644 hw/fsi/meson.build create mode 100644 hw/fsi/trace-events
Signature · 1 line
2.39.2
PATCH v12 2/11 hw/fsi: Introduce IBM's scratchpad device
This is a part of patchset where IBM's Flexible Service Interface is introduced.
The scratchpad provides a set of non-functional registers. The firmware is free to use them, hardware does not support any special management support. The scratchpad registers can be read or written from LBUS slave. The scratch pad is managed under FSI CFAM state.
[ clg: - moved object FSIScratchPad under FSICFAMState
- moved FSIScratchPad code under cfam.c ]
--- include/hw/fsi/lbus.h | 11 ++++++ hw/fsi/lbus.c | 78 +++++++++++++++++++++++++++++++++++++++++-- hw/fsi/trace-events | 2 ++ 3 files changed, 89 insertions(+), 2 deletions(-)
include/hw/fsi/lbus.h +11 -0
@@ -29,4 +29,15 @@ typedef struct FSILBus { MemoryRegion mr; } FSILBus; +#define TYPE_FSI_SCRATCHPAD "fsi.scratchpad" +#define SCRATCHPAD (obj) OBJECT_CHECK(FSIScratchPad, (obj), TYPE_FSI_SCRATCHPAD) + +#define FSI_SCRATCHPAD_NR_REGS 4 + +typedef struct FSIScratchPad { +FSILBusDevice parent; + +uint32_t regs[FSI_SCRATCHPAD_NR_REGS ]; +}FSIScratchPad ; +#endif /* FSI_LBUS_H */
hw/fsi/lbus.c +76 -2
97 lines not on this page · raw message
hw/fsi/trace-events +2 -0
@@ -0,0 +1,2 @@ +fsi_scratchpad_read(uint64_t addr, uint32_t size) "@0x%" PRIx64 " size=%d" +fsi_scratchpad_write(uint64_t addr, uint32_t size, uint64_t data) "@0x%" PRIx64 " size=%d value=0x%"PRIx64
Signature · 1 line
2.39.2
PATCH v12 1/11 hw/fsi: Introduce IBM's Local bus
In reply to Ninad PalsuleThis is a part of patchset where IBM's Flexible Service Interface is introduced.
The LBUS is modelled to maintain mapped memory for the devices. The memory is mapped after CFAM config, peek table and FSI slave registers.
[ clg: - removed lbus_add_device() bc unused
- removed lbus_create_device() bc used only once
- removed "address" property
- updated meson.build to build fsi dir
- included an empty hw/fsi/trace-events ]
---
v9:
- Changed LBUS memory region to 1MB.
v11:
- Split lbus and scratchpad into separate patches.
- Added fsi_ prefix for all functions in lbus.
- Removed FSI_LBUS* typedefs.
- Replaced for loop with memset.
--- meson.build | 1 + hw/fsi/trace.h | 1 + include/hw/fsi/lbus.h | 32 ++++++++++++++++++++++++++++++++ hw/fsi/lbus.c | 43 +++++++++++++++++++++++++++++++++++++++++++ hw/Kconfig | 1 + hw/fsi/Kconfig | 2 ++ hw/fsi/meson.build | 1 + hw/fsi/trace-events | 0 hw/meson.build | 1 + 9 files changed, 82 insertions(+) create mode 100644 hw/fsi/trace.h create mode 100644 include/hw/fsi/lbus.h create mode 100644 hw/fsi/lbus.c create mode 100644 hw/fsi/Kconfig create mode 100644 hw/fsi/meson.build create mode 100644 hw/fsi/trace-events
meson.build +1 -0
@@ -3290,6 +3290,7 @@ if have_system 'hw/char', 'hw/display', 'hw/dma', + 'hw/fsi', 'hw/hyperv', 'hw/i2c', 'hw/i386',
hw/fsi/trace.h new file +1 -0
@@ -0,0 +1 @@ +#include "trace/trace-hw_fsi.h"
include/hw/fsi/lbus.h new file +32 -0
@@ -0,0 +1,32 @@ +/* +* SPDX-License-Identifier: GPL-2.0-or-later +* Copyright (C) 2024 IBM Corp. +* +* IBM Local bus and connected device structures. +*/ +#ifndef FSI_LBUS_H +#define FSI_LBUS_H + +#include "hw/qdev-core.h" +#include "qemu/units.h" +#include "exec/memory.h" + +#define TYPE_FSI_LBUS_DEVICE "fsi.lbus.device" +OBJECT_DECLARE_SIMPLE_TYPE(FSILBusDevice, FSI_LBUS_DEVICE) + +typedef struct FSILBusDevice { +DeviceState parent; + +MemoryRegion iomem; +}FSILBusDevice ; + +#define TYPE_FSI_LBUS "fsi.lbus" +OBJECT_DECLARE_SIMPLE_TYPE(FSILBus, FSI_LBUS) + +typedef struct FSILBus { +BusState bus; + +MemoryRegion mr; +}FSILBus ; + +#endif /* FSI_LBUS_H */
hw/fsi/lbus.c new file +43 -0
43 lines not on this page · raw message
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 FSI + bool
hw/fsi/meson.build new file +1 -0
@@ -0,0 +1 @@ +system_ss.add(when: 'CONFIG_FSI', if_true: files('lbus.c'))
hw/fsi/trace-events new file +0 -0
hw/meson.build +1 -0
@@ -44,6 +44,7 @@ subdir('virtio') subdir('watchdog') subdir('xen') subdir('xenpv') +subdir('fsi') subdir('alpha') subdir('arm')
Signature · 1 line
2.39.2
PATCH v12 9/11 hw/fsi: Added qtest
In reply to Ninad PalsuleAdded basic qtests for FSI model.
---
v11:
- Removed Cedric's signoff
--- tests/qtest/aspeed-fsi-test.c | 205 ++++++++++++++++++++++++++++++++++ tests/qtest/meson.build | 1 + 2 files changed, 206 insertions(+) create mode 100644 tests/qtest/aspeed-fsi-test.c
tests/qtest/aspeed-fsi-test.c new file +205 -0
@@ -0,0 +1,205 @@ +/* +* QTest testcases for IBM's Flexible Service Interface (FSI) +* +* Copyright (c) 2023 IBM Corporation +* +* Authors: +* Ninad Palsule <[email protected]> +* +* This work is licensed under the terms of the GNU GPL, version 2 or later. +* See the COPYING file in the top-level directory. +*/ + +#include "qemu/osdep.h" +#include <glib/gstdio.h> + +#include "qemu/module.h" +#include "libqtest-single.h" + +/* Registers from ast2600 specifications */ +#define ASPEED_FSI_ENGINER_TRIGGER 0x04 +#define ASPEED_FSI_OPB0_BUS_SELECT 0x10 +#define ASPEED_FSI_OPB1_BUS_SELECT 0x28 +#define ASPEED_FSI_OPB0_RW_DIRECTION 0x14 +#define ASPEED_FSI_OPB1_RW_DIRECTION 0x2c +#define ASPEED_FSI_OPB0_XFER_SIZE 0x18 +#define ASPEED_FSI_OPB1_XFER_SIZE 0x30 +#define ASPEED_FSI_OPB0_BUS_ADDR 0x1c +#define ASPEED_FSI_OPB1_BUS_ADDR 0x34 +#define ASPEED_FSI_INTRRUPT_CLEAR 0x40 +#define ASPEED_FSI_INTRRUPT_STATUS 0x48 +#define ASPEED_FSI_OPB0_BUS_STATUS 0x80 +#define ASPEED_FSI_OPB1_BUS_STATUS 0x8c +#define ASPEED_FSI_OPB0_READ_DATA 0x84 +#define ASPEED_FSI_OPB1_READ_DATA 0x90 + +/* +* FSI Base addresses from the ast2600 specifications. +*/ +#define AST2600_OPB_FSI0_BASE_ADDR 0x1e79b000 +#define AST2600_OPB_FSI1_BASE_ADDR 0x1e79b100 + +static uint32_t aspeed_fsi_base_addr; + +static uint32_t aspeed_fsi_readl (QTestState *s,uint32_t reg) +{ +return qtest_readl (s, aspeed_fsi_base_addr + reg); +} + +static void aspeed_fsi_writel (QTestState *s,uint32_t reg,uint32_t val) +{ +qtest_writel (s, aspeed_fsi_base_addr + reg, val); +} + +/* Setup base address and select register */ +static void test_fsi_setup (QTestState *s,uint32_t base_addr) +{ +uint32_t curval; + + aspeed_fsi_base_addr = base_addr; + +/* Set the base select register */ +if (base_addr ==AST2600_OPB_FSI0_BASE_ADDR ) { +/* Unselect FSI1 */ +aspeed_fsi_writel (s,ASPEED_FSI_OPB1_BUS_SELECT ,0x0 ); + curval =aspeed_fsi_readl (s,ASPEED_FSI_OPB1_BUS_SELECT ); + g_assert_cmpuint(curval, ==, 0x0); + +/* Select FSI0 */ +aspeed_fsi_writel (s,ASPEED_FSI_OPB0_BUS_SELECT ,0x1 ); + curval =aspeed_fsi_readl (s,ASPEED_FSI_OPB0_BUS_SELECT ); + g_assert_cmpuint(curval, ==, 0x1); + }else if (base_addr ==AST2600_OPB_FSI1_BASE_ADDR ) { +/* Unselect FSI0 */ +aspeed_fsi_writel (s,ASPEED_FSI_OPB0_BUS_SELECT ,0x0 ); + curval =aspeed_fsi_readl (s,ASPEED_FSI_OPB0_BUS_SELECT ); + g_assert_cmpuint(curval, ==, 0x0); + +/* Select FSI1 */ +aspeed_fsi_writel (s,ASPEED_FSI_OPB1_BUS_SELECT ,0x1 ); + curval =aspeed_fsi_readl (s,ASPEED_FSI_OPB1_BUS_SELECT ); + g_assert_cmpuint(curval, ==, 0x1); + }else { +g_assert_not_reached (); + } +} + +static void test_fsi_reg_change (QTestState *s,uint32_t reg,uint32_t newval) +{ +uint32_t base; +uint32_t curval; + + base =aspeed_fsi_readl (s, reg); +aspeed_fsi_writel (s, reg, newval); + curval =aspeed_fsi_readl (s, reg); + g_assert_cmpuint(curval, ==, newval); +aspeed_fsi_writel (s, reg, base); + curval =aspeed_fsi_readl (s, reg); + g_assert_cmpuint(curval, ==, base); +} + +static void test_fsi0_master_regs (const void *data) +{ +QTestState *s = (QTestState *)data; + +test_fsi_setup (s,AST2600_OPB_FSI0_BASE_ADDR ); + +test_fsi_reg_change (s,ASPEED_FSI_OPB0_RW_DIRECTION ,0xF3F4F514 ); +test_fsi_reg_change (s,ASPEED_FSI_OPB0_XFER_SIZE ,0xF3F4F518 ); +test_fsi_reg_change (s,ASPEED_FSI_OPB0_BUS_ADDR ,0xF3F4F51c ); +test_fsi_reg_change (s,ASPEED_FSI_INTRRUPT_CLEAR ,0xF3F4F540 ); +test_fsi_reg_change (s,ASPEED_FSI_INTRRUPT_STATUS ,0xF3F4F548 ); +test_fsi_reg_change (s,ASPEED_FSI_OPB0_BUS_STATUS ,0xF3F4F580 ); +test_fsi_reg_change (s,ASPEED_FSI_OPB0_READ_DATA ,0xF3F4F584 ); +} + +static void test_fsi1_master_regs (const void *data) +{ +QTestState *s = (QTestState *)data; + +test_fsi_setup (s,AST2600_OPB_FSI1_BASE_ADDR ); + +test_fsi_reg_change (s,ASPEED_FSI_OPB1_RW_DIRECTION ,0xF3F4F514 ); +test_fsi_reg_change (s,ASPEED_FSI_OPB1_XFER_SIZE ,0xF3F4F518 ); +test_fsi_reg_change (s,ASPEED_FSI_OPB1_BUS_ADDR ,0xF3F4F51c ); +test_fsi_reg_change (s,ASPEED_FSI_INTRRUPT_CLEAR ,0xF3F4F540 ); +test_fsi_reg_change (s,ASPEED_FSI_INTRRUPT_STATUS ,0xF3F4F548 ); +test_fsi_reg_change (s,ASPEED_FSI_OPB1_BUS_STATUS ,0xF3F4F580 ); +test_fsi_reg_change (s,ASPEED_FSI_OPB1_READ_DATA ,0xF3F4F584 ); +} + +static void test_fsi0_getcfam_addr0 (const void *data) +{ +QTestState *s = (QTestState *)data; +uint32_t curval; + +test_fsi_setup (s,AST2600_OPB_FSI0_BASE_ADDR ); + +/* Master access direction read */ +aspeed_fsi_writel (s,ASPEED_FSI_OPB0_RW_DIRECTION ,0x1 ); +/* word */ +aspeed_fsi_writel (s,ASPEED_FSI_OPB0_XFER_SIZE ,0x3 ); +/* Address */ +aspeed_fsi_writel (s,ASPEED_FSI_OPB0_BUS_ADDR ,0xa0000000 ); +aspeed_fsi_writel (s,ASPEED_FSI_INTRRUPT_CLEAR ,0x1 ); +aspeed_fsi_writel (s,ASPEED_FSI_ENGINER_TRIGGER ,0x1 ); + + curval =aspeed_fsi_readl (s,ASPEED_FSI_INTRRUPT_STATUS ); + g_assert_cmpuint(curval, ==, 0x10000); + curval =aspeed_fsi_readl (s,ASPEED_FSI_OPB0_BUS_STATUS ); + g_assert_cmpuint(curval, ==, 0x0); + curval =aspeed_fsi_readl (s,ASPEED_FSI_OPB0_READ_DATA ); + g_assert_cmpuint(curval, ==, 0x152d02c0); +} + +static void test_fsi1_getcfam_addr0 (const void *data) +{ +QTestState *s = (QTestState *)data; +uint32_t curval; + +test_fsi_setup (s,AST2600_OPB_FSI1_BASE_ADDR ); + +/* Master access direction read */ +aspeed_fsi_writel (s,ASPEED_FSI_OPB1_RW_DIRECTION ,0x1 ); + +aspeed_fsi_writel (s,ASPEED_FSI_OPB1_XFER_SIZE ,0x3 ); +aspeed_fsi_writel (s,ASPEED_FSI_OPB1_BUS_ADDR ,0xa0000000 ); +aspeed_fsi_writel (s,ASPEED_FSI_INTRRUPT_CLEAR ,0x1 ); +aspeed_fsi_writel (s,ASPEED_FSI_ENGINER_TRIGGER ,0x1 ); + + curval =aspeed_fsi_readl (s,ASPEED_FSI_INTRRUPT_STATUS ); + g_assert_cmpuint(curval, ==, 0x20000); + curval =aspeed_fsi_readl (s,ASPEED_FSI_OPB1_BUS_STATUS ); + g_assert_cmpuint(curval, ==, 0x0); + curval =aspeed_fsi_readl (s,ASPEED_FSI_OPB1_READ_DATA ); + g_assert_cmpuint(curval, ==, 0x152d02c0); +} + +int main (int argc,char **argv) +{ +int ret =-1 ; +QTestState *s; + +g_test_init (&argc, &argv,NULL ); + + s =qtest_init ("-machine ast2600-evb " ); + +/* Tests for OPB/FSI0 */ +qtest_add_data_func ("/aspeed-fsi-test/test_fsi0_master_regs" , s, + test_fsi0_master_regs); + +qtest_add_data_func ("/aspeed-fsi-test/test_fsi0_getcfam_addr0" , s, + test_fsi0_getcfam_addr0); + +/* Tests for OPB/FSI1 */ +qtest_add_data_func ("/aspeed-fsi-test/test_fsi1_master_regs" , s, + test_fsi1_master_regs); + +qtest_add_data_func ("/aspeed-fsi-test/test_fsi1_getcfam_addr0" , s, + test_fsi1_getcfam_addr0); + + ret =g_test_run (); +qtest_quit (s); + +return ret; +}
tests/qtest/meson.build +1 -0
@@ -217,6 +217,7 @@ qtests_arm = \ (config_all_devices.has_key('CONFIG_VEXPRESS') ? ['test-arm-mptimer'] : []) + \ (config_all_devices.has_key('CONFIG_MICROBIT') ? ['microbit-test'] : []) + \ (config_all_devices.has_key('CONFIG_STM32L4X5_SOC') ? qtests_stm32l4x5 : []) + \ + (config_all_devices.has_key('CONFIG_FSI_APB2OPB_ASPEED') ? ['aspeed-fsi-test'] : []) + \ ['arm-cpu-features', 'boot-serial-test']
Signature · 1 line
2.39.2
PATCH v12 5/11 hw/fsi: Introduce IBM's cfam
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.
[ clg: - moved object FSIScratchPad under FSICFAMState
- moved FSIScratchPad code under cfam.c
- introduced fsi_cfam_instance_init()
- reworked fsi_cfam_realize() ]
---
v9:
- Added more registers to scratchpad
- Removed unnecessary address space
- Removed unnecessary header file
- Defined macros for config values.
- Cleaned up cfam config read.
--- include/hw/fsi/cfam.h | 34 +++++++++ hw/fsi/cfam.c | 168 ++++++++++++++++++++++++++++++++++++++++++ hw/fsi/meson.build | 2 +- hw/fsi/trace-events | 5 ++ 4 files changed, 208 insertions(+), 1 deletion(-) create mode 100644 include/hw/fsi/cfam.h create mode 100644 hw/fsi/cfam.c
include/hw/fsi/cfam.h new file +34 -0
@@ -0,0 +1,34 @@ +/* +* SPDX-License-Identifier: GPL-2.0-or-later +* Copyright (C) 2024 IBM Corp. +* +* IBM Common FRU Access Macro +*/ +#ifndef FSI_CFAM_H +#define FSI_CFAM_H + +#include "exec/memory.h" + +#include "hw/fsi/fsi.h" +#include "hw/fsi/lbus.h" + +#define TYPE_FSI_CFAM "cfam" +#define FSI_CFAM (obj) OBJECT_CHECK(FSICFAMState, (obj), TYPE_FSI_CFAM) + +/* P9-ism */ +#define CFAM_CONFIG_NR_REGS 0x28 + +typedef struct FSICFAMState { +/* < private > */ +FSISlaveState parent; + +/* CFAM config address space */ +MemoryRegion config_iomem; + +MemoryRegion mr; + +FSILBus lbus; +FSIScratchPad scratchpad; +}FSICFAMState ; + +#endif /* FSI_CFAM_H */
hw/fsi/cfam.c new file +168 -0
168 lines not on this page · raw message
hw/fsi/meson.build +1 -1
@@ -1 +1 @@ -system_ss.add(when: 'CONFIG_FSI', if_true: files('lbus.c','fsi.c')) +system_ss.add(when: 'CONFIG_FSI', if_true: files('lbus.c','fsi.c','cfam.c'))
hw/fsi/trace-events +5 -0
@@ -2,3 +2,8 @@ fsi_scratchpad_read(uint64_t addr, uint32_t size) "@0x%" PRIx64 " size=%d" fsi_scratchpad_write(uint64_t addr, uint32_t size, uint64_t data) "@0x%" PRIx64 " size=%d value=0x%"PRIx64 fsi_slave_read(uint64_t addr, uint32_t size) "@0x%" PRIx64 " size=%d" fsi_slave_write(uint64_t addr, uint32_t size, uint64_t data) "@0x%" PRIx64 " size=%d value=0x%"PRIx64 +fsi_cfam_config_read(uint64_t addr, uint32_t size) "@0x%" PRIx64 " size=%d" +fsi_cfam_config_write(uint64_t addr, uint32_t size, uint64_t data) "@0x%" PRIx64 " size=%d value=0x%"PRIx64 +fsi_cfam_unimplemented_read(uint64_t addr, uint32_t size) "@0x%" PRIx64 " size=%d" +fsi_cfam_unimplemented_write(uint64_t addr, uint32_t size, uint64_t data) "@0x%" PRIx64 " size=%d value=0x%"PRIx64 +fsi_cfam_config_write_noaddr(uint64_t addr, uint32_t size, uint64_t data) "@0x%" PRIx64 " size=%d value=0x%"PRIx64
Signature · 1 line
2.39.2
PATCH v12 8/11 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: fsi.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: fsi.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--- include/hw/arm/aspeed_soc.h | 4 ++++ hw/arm/aspeed_ast2600.c | 19 +++++++++++++++++++ 2 files changed, 23 insertions(+)
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
@@ -90,6 +91,7 @@ struct AspeedSoCState {UnimplementedDeviceState udc;UnimplementedDeviceState sgpiom;UnimplementedDeviceState jtag[ASPEED_JTAG_NUM ]; +AspeedAPB2OPBState fsi[2 ]; };#define TYPE_ASPEED_SOC "aspeed-soc"
@@ -214,6 +216,8 @@ enum {ASPEED_DEV_SGPIOM ,ASPEED_DEV_JTAG0 ,ASPEED_DEV_JTAG1 , +ASPEED_DEV_FSI1 , + ASPEED_DEV_FSI2, };#define ASPEED_SOC_SPI_BOOT_ADDR 0x0
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 */ };
@@ -264,6 +268,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 ); + } }/*
@@ -623,6 +631,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)
Signature · 1 line
2.39.2
PATCH v12 7/11 hw/fsi: Aspeed APB2OPB & On-chip peripheral bus
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.
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.
[ clg: - moved FSIMasterState under AspeedAPB2OPBState
- modified fsi_opb_fsi_master_address() and fsi_opb_opb2fsi_address()
- instroduced fsi_aspeed_apb2opb_init()
- reworked fsi_aspeed_apb2opb_realize()
- removed FSIMasterState object and fsi_opb_realize()
- simplified OPBus ]
---
v9:
- Removed unused parameters from function.
- Used qdev_realize() instead of qdev_realize_and_undef
- Given a name to the opb memory region.
v10:
- Combine Aspeed APB2OPB and on-chip pheripheral bus
--- include/hw/fsi/aspeed_apb2opb.h | 46 +++++ hw/fsi/aspeed_apb2opb.c | 329 ++++++++++++++++++++++++++++++++ hw/arm/Kconfig | 1 + hw/fsi/Kconfig | 5 + hw/fsi/meson.build | 1 + hw/fsi/trace-events | 2 + 6 files changed, 384 insertions(+) create mode 100644 include/hw/fsi/aspeed_apb2opb.h create mode 100644 hw/fsi/aspeed_apb2opb.c
include/hw/fsi/aspeed_apb2opb.h new file +46 -0
@@ -0,0 +1,46 @@ +/* +* SPDX-License-Identifier: GPL-2.0-or-later +* Copyright (C) 2024 IBM Corp. +* +* ASPEED APB2OPB Bridge +* IBM On-Chip Peripheral Bus +*/ +#ifndef FSI_ASPEED_APB2OPB_H +#define FSI_ASPEED_APB2OPB_H + +#include "exec/memory.h" +#include "hw/fsi/fsi-master.h" +#include "hw/sysbus.h" + +#define TYPE_FSI_OPB "fsi.opb" + +#define TYPE_OP_BUS "opb" +OBJECT_DECLARE_SIMPLE_TYPE(OPBus, OP_BUS) + +typedef struct OPBus { +BusState bus; + +MemoryRegion mr; +AddressSpace as; +}OPBus ; + +#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 { +SysBusDevice parent_obj; + +MemoryRegion iomem; + +uint32_t regs[ASPEED_APB2OPB_NR_REGS ]; +qemu_irq irq; + +OPBus opb[ASPEED_FSI_NUM ]; +FSIMasterState fsi[ASPEED_FSI_NUM ]; +}AspeedAPB2OPBState ; + +#endif /* FSI_ASPEED_APB2OPB_H */
hw/fsi/aspeed_apb2opb.c new file +329 -0
329 lines not on this page · raw message
hw/arm/Kconfig +1 -0
@@ -574,6 +574,7 @@ config ASPEED_SOC select LED select PMBUS select MAX31785 + select FSI_APB2OPB_ASPEED config MPS2 bool
hw/fsi/Kconfig +5 -0
@@ -1,2 +1,7 @@ +config FSI_APB2OPB_ASPEED + bool + depends on ASPEED_SOC + select FSI + config FSI bool
hw/fsi/meson.build +1 -0
@@ -1 +1,2 @@ system_ss.add(when: 'CONFIG_FSI', if_true: files('lbus.c','fsi.c','cfam.c','fsi-master.c')) +system_ss.add(when: 'CONFIG_FSI_APB2OPB_ASPEED', if_true: files('aspeed_apb2opb.c'))
hw/fsi/trace-events +2 -0
@@ -9,3 +9,5 @@ fsi_cfam_unimplemented_write(uint64_t addr, uint32_t size, uint64_t data) "@0x%" fsi_cfam_config_write_noaddr(uint64_t addr, uint32_t size, uint64_t data) "@0x%" PRIx64 " size=%d value=0x%"PRIx64 fsi_master_read(uint64_t addr, uint32_t size) "@0x%" PRIx64 " size=%d" fsi_master_write(uint64_t addr, uint32_t size, uint64_t data) "@0x%" PRIx64 " size=%d value=0x%"PRIx64 +fsi_aspeed_apb2opb_read(uint64_t addr, uint32_t size) "@0x%" PRIx64 " size=%d" +fsi_aspeed_apb2opb_write(uint64_t addr, uint32_t size, uint64_t data) "@0x%" PRIx64 " size=%d value=0x%"PRIx64
Signature · 1 line
2.39.2
Re: [PATCH v12 10/11] hw/fsi: Added FSI documentation
In reply to Ninad PalsuleQuoted 73 lines · Ninad Palsule
Documentation for IBM FSI model.
Signed-off-by Ninad Palsule <[email protected]>---
v11:
- Removed Cedric's signoff.--- docs/specs/fsi.rst | 126 +++++++++++++++++++++++++++++++++++++++++++ docs/specs/index.rst | 1 + 2 files changed, 127 insertions(+)create mode 100644
docs/specs/fsi.rstdocs/specs/fsi.rst new file +55
-0@@ -0,0 +1,126 @@ +====================================== +IBM's Flexible Service Interface (FSI) +====================================== + +The QEMU FSI emulation implements hardware interfaces between ASPEED SOC, FSI +master/slave and the end engine. + +FSI is a point-to-point two wire interface which is capable of supporting +distances of up to 4 meters. FSI interfaces have been used successfully for +many years in IBM servers to attach IBM Flexible Support Processors(FSP) to +CPUs and IBM ASICs. + +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: (see the `FSI specification`_ for more details) + +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 LBUS is modelled to maintain the qdev bus hierarchy and to take advantages +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
docs/specs/fsi.rst line 65
Quoted 10 lines
docs/specs/fsi.rst new file +10
-0+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. + +QEMU files related to FSI interface are in following directories: + - ``hw/fsi`` + - ``include/hw/fsi``
This is not useful.
docs/specs/fsi.rst line 69
Quoted 3 lines
docs/specs/fsi.rst new file +3
-0+The following commands start the ``rainier-bmc`` machine with built-in FSI +model. There are no model specific arguments. Please check this document to +learn more about Aspeed ``rainier-bmc`` machine: docs/system/arm/aspeed.rst
This should be : (:doc:../../system/arm/aspeed)
I will fix it.
Thanks,
C.
Quoted 69 lines
docs/specs/fsi.rst new file +57
-0+ +.. code-block:: console + + qemu-system-arm -M rainier-bmc -nographic \ + -kernel fitImage-linux.bin \ + -dtb aspeed-bmc-ibm-rainier.dtb \ + -initrd obmc-phosphor-initramfs.rootfs.cpio.xz \ + -drive file=obmc-phosphor-image.rootfs.wic.qcow2,if=sd,index=2 \ + -append "rootwait console=ttyS4,115200n8 root=PARTLABEL=rofs-a" + +The implementation appears as following in the qemu device tree: + +.. code-block:: console + + (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) + +pdbg is a simple application to allow debugging of the host POWER processors +from the BMC. (see the `pdbg source repository`_ for more details) + +.. code-block:: console + + root@p10bmc:~# pdbg -a getcfam 0x0 + p0: 0x0 = 0xc0022d15 + +.. _FSI specification: + https://openpowerfoundation.org/specifications/fsi/ + +.. _pdbg source repository: + https://github.com/open-power/pdbgdocs/specs/index.rst +1
-0@@ -24,6 +24,7 @@ guest hardware that is specific to QEMU. acpi_erst sev-guest-firmware fw_cfg + fsi vmw_pvscsi-spec edu ivshmem-spec
Cédric Le Goater
AppliedQuoted 8 lines · Ninad Palsule
Hello,
Please review the patch-set version 12.
I have incorporated review comments from Cedric.
v12:
- Minor changes.
- Added reviewed by tags.
Quoted 12 lines
Ninad Palsule (11):
hw/fsi: Introduce IBM's Local bus hw/fsi: Introduce IBM's scratchpad device hw/fsi: Introduce IBM's FSI Bus
hw/fsi: Introduce IBM's fsi-slave model hw/fsi: Introduce IBM's cfam
hw/fsi: Introduce IBM's FSI master hw/fsi: Aspeed APB2OPB & On-chip peripheral bus hw/arm: Hook up FSI module in AST2600 hw/fsi: Added qtest
hw/fsi: Added FSI documentation
hw/fsi: Update MAINTAINER list
Applied to aspeed-next.
Thanks,
C.