aspeed queue
Subsystems (2)
The following changes since commit 229a834518b950d56fd1bc94923276504d0ee9d4:
Merge remote-tracking branch 'remotes/philmd-gitlab/tags/renesas-20210306' into staging (2021-03-08 15:45:48 +0000)
are available in the Git repository at:
https://github.com/legoater/qemu/ tags/pull-aspeed-20210309
for you to fetch changes up to c59f781e3bcca4a80aef5d229488fd45dbfdbd9a:
hw/misc: Model KCS devices in the Aspeed LPC controller (2021-03-09 12:01:28 +0100)
----------------------------------------------------------------
Aspeed patches :
* New model for the Aspeed LPC controller
* Misc cleanups
----------------------------------------------------------------
Andrew Jeffery (4):
hw/arm: ast2600: Force a multiple of 32 of IRQs for the GIC hw/arm: ast2600: Set AST2600_MAX_IRQ to value from datasheet hw/arm: ast2600: Correct the iBT interrupt ID hw/misc: Model KCS devices in the Aspeed LPC controller
Cédric Le Goater (2):
hw/arm/aspeed: Fix location of firmware images in documentation hw/misc: Add a basic Aspeed LPC controller model
Joel Stanley (1):
arm/ast2600: Fix SMP booting with -kernel
docs/system/arm/aspeed.rst | 16 +- include/hw/arm/aspeed_soc.h | 3 + include/hw/misc/aspeed_lpc.h | 47 +++++ hw/arm/aspeed_ast2600.c | 51 ++++- hw/arm/aspeed_soc.c | 34 ++- hw/misc/aspeed_lpc.c | 486 +++++++++++++++++++++++++++++++++++++++++++ hw/misc/meson.build | 7 +- 7 files changed, 625 insertions(+), 19 deletions(-) create mode 100644 include/hw/misc/aspeed_lpc.h create mode 100644 hw/misc/aspeed_lpc.c
[PULL 1/7] arm/ast2600: Fix SMP booting with -kernel
From: Joel Stanley <[email protected]>
The ast2600 machines do not have PSCI firmware, so this property should have never been set. Removing this node fixes SMP booting Linux kernels that have PSCI enabled, as Linux fails to find PSCI in the device tree and falls back to the soc-specific method for enabling secondary CPUs.
The comment is out of date as Qemu has supported -kernel booting since 9bb6d14081ce ("aspeed: Add boot stub for smp booting"), in v5.1.
Message-Id: <[email protected]>
--- hw/arm/aspeed_ast2600.c | 7 ------- 1 file changed, 7 deletions(-)
hw/arm/aspeed_ast2600.c +0 -7
@@ -241,8 +241,6 @@ static void aspeed_soc_ast2600_realize(DeviceState *dev, Error **errp)/* CPU */ for (i =0 ; i < sc->num_cpus; i++) { -object_property_set_int (OBJECT (&s->cpu[i]),"psci-conduit" , -QEMU_PSCI_CONDUIT_SMC , &error_abort);if (sc->num_cpus >1 ) {object_property_set_int (OBJECT (&s->cpu[i]),"reset-cbar" ,ASPEED_A7MPCORE_ADDR , &error_abort);
@@ -253,11 +251,6 @@ static void aspeed_soc_ast2600_realize(DeviceState *dev, Error **errp)object_property_set_int (OBJECT (&s->cpu[i]),"cntfrq" ,1125000000 , &error_abort); -/* -* TODO: the secondary CPUs are started and a boot helper -* is needed when using -kernel -*/ -if (!qdev_realize (DEVICE (&s->cpu[i]),NULL , errp)) {return ; }
Signature · 1 line
2.26.2
[PULL 7/7] hw/misc: Model KCS devices in the Aspeed LPC controller
In reply to Cédric Le GoaterFrom: Andrew Jeffery <[email protected]>
Keyboard-Controller-Style devices for IPMI purposes are exposed via LPC IO cycles from the BMC to the host.
Expose support on the BMC side by implementing the usual MMIO behaviours, and expose the ability to inspect the KCS registers in "host" style by accessing QOM properties associated with each register.
The model caters to the IRQ style of both the AST2600 and the earlier SoCs (AST2400 and AST2500). The AST2600 allocates an IRQ for each LPC sub-device, while there is a single IRQ shared across all subdevices on the AST2400 and AST2500.
Message-Id: <[email protected]>
--- include/hw/arm/aspeed_soc.h | 1 + include/hw/misc/aspeed_lpc.h | 17 +- hw/arm/aspeed_ast2600.c | 28 ++- hw/arm/aspeed_soc.c | 24 ++- hw/misc/aspeed_lpc.c | 359 ++++++++++++++++++++++++++++++++++- 5 files changed, 424 insertions(+), 5 deletions(-)
include/hw/arm/aspeed_soc.h +1 -0
@@ -132,6 +132,7 @@ enum {ASPEED_DEV_SDRAM ,ASPEED_DEV_XDMA ,ASPEED_DEV_EMMC , + ASPEED_DEV_KCS, };#endif /* ASPEED_SOC_H */
include/hw/misc/aspeed_lpc.h +16 -1
@@ -12,10 +12,22 @@#include "hw/sysbus.h" +#include <stdint.h> +#define TYPE_ASPEED_LPC "aspeed.lpc"#define ASPEED_LPC (obj) OBJECT_CHECK(AspeedLPCState, (obj), TYPE_ASPEED_LPC) -#define ASPEED_LPC_NR_REGS (0x260 >> 2) +#define ASPEED_LPC_NR_REGS (0x260 >> 2) + +enum aspeed_lpc_subdevice { + aspeed_lpc_kcs_1 =0 , + aspeed_lpc_kcs_2, + aspeed_lpc_kcs_3, + aspeed_lpc_kcs_4, + aspeed_lpc_ibt, +}; + +#define ASPEED_LPC_NR_SUBDEVS 5 typedef struct AspeedLPCState { /* <private> */
@@ -25,6 +37,9 @@ typedef struct AspeedLPCState {MemoryRegion iomem;qemu_irq irq; +qemu_irq subdevice_irqs[ASPEED_LPC_NR_SUBDEVS ]; +uint32_t subdevice_irqs_pending; +uint32_t regs[ASPEED_LPC_NR_REGS ];uint32_t hicr7; } AspeedLPCState;
hw/arm/aspeed_ast2600.c +27 -1
@@ -104,7 +104,7 @@ static const int aspeed_soc_ast2600_irqmap[] = { [ASPEED_DEV_ETH2] = 3, [ASPEED_DEV_ETH3] = 32, [ASPEED_DEV_ETH4] = 33, - + [ASPEED_DEV_KCS] = 138, /* 138 -> 142 */ };static qemu_irq aspeed_soc_get_irq (AspeedSoCState *s,int ctrl)
@@ -470,8 +470,34 @@ static void aspeed_soc_ast2600_realize(DeviceState *dev, Error **errp)return ; }sysbus_mmio_map (SYS_BUS_DEVICE (&s->lpc),0 , sc->memmap[ASPEED_DEV_LPC ]); + +/* Connect the LPC IRQ to the GIC. It is otherwise unused. */ sysbus_connect_irq (SYS_BUS_DEVICE (&s->lpc),0 ,aspeed_soc_get_irq (s,ASPEED_DEV_LPC )); + +/* +* On the AST2600 LPC subdevice IRQs are connected straight to the GIC. +* +* LPC subdevice IRQ sources are offset from 1 because the LPC model caters +* to the AST2400 and AST2500. SoCs before the AST2600 have one LPC IRQ +* shared across the subdevices, and the shared IRQ output to the VIC is at +* offset 0. +*/ +sysbus_connect_irq (SYS_BUS_DEVICE (&s->lpc),1 + aspeed_lpc_kcs_1, +qdev_get_gpio_in (DEVICE (&s->a7mpcore), + sc->irqmap[ASPEED_DEV_KCS ] + aspeed_lpc_kcs_1)); + +sysbus_connect_irq (SYS_BUS_DEVICE (&s->lpc),1 + aspeed_lpc_kcs_2, +qdev_get_gpio_in (DEVICE (&s->a7mpcore), + sc->irqmap[ASPEED_DEV_KCS ] + aspeed_lpc_kcs_2)); + +sysbus_connect_irq (SYS_BUS_DEVICE (&s->lpc),1 + aspeed_lpc_kcs_3, +qdev_get_gpio_in (DEVICE (&s->a7mpcore), + sc->irqmap[ASPEED_DEV_KCS ] + aspeed_lpc_kcs_3)); + +sysbus_connect_irq (SYS_BUS_DEVICE (&s->lpc),1 + aspeed_lpc_kcs_4, +qdev_get_gpio_in (DEVICE (&s->a7mpcore), + sc->irqmap[ASPEED_DEV_KCS ] + aspeed_lpc_kcs_4)); }static void aspeed_soc_ast2600_class_init (ObjectClass *oc,void *data)
hw/arm/aspeed_soc.c +23 -1
@@ -112,7 +112,6 @@ static const int aspeed_soc_ast2400_irqmap[] = { [ASPEED_DEV_WDT] = 27, [ASPEED_DEV_PWM] = 28, [ASPEED_DEV_LPC] = 8, - [ASPEED_DEV_IBT] = 8, /* LPC */ [ASPEED_DEV_I2C] = 12, [ASPEED_DEV_ETH1] = 2, [ASPEED_DEV_ETH2] = 3,
@@ -401,8 +400,31 @@ static void aspeed_soc_realize(DeviceState *dev, Error **errp)return ; }sysbus_mmio_map (SYS_BUS_DEVICE (&s->lpc),0 , sc->memmap[ASPEED_DEV_LPC ]); + +/* Connect the LPC IRQ to the VIC */ sysbus_connect_irq (SYS_BUS_DEVICE (&s->lpc),0 ,aspeed_soc_get_irq (s,ASPEED_DEV_LPC )); + +/* +* On the AST2400 and AST2500 the one LPC IRQ is shared between all of the +* subdevices. Connect the LPC subdevice IRQs to the LPC controller IRQ (by +* contrast, on the AST2600, the subdevice IRQs are connected straight to +* the GIC). +* +* LPC subdevice IRQ sources are offset from 1 because the shared IRQ output +* to the VIC is at offset 0. +*/ +sysbus_connect_irq (SYS_BUS_DEVICE (&s->lpc),1 + aspeed_lpc_kcs_1, +qdev_get_gpio_in (DEVICE (&s->lpc), aspeed_lpc_kcs_1)); + +sysbus_connect_irq (SYS_BUS_DEVICE (&s->lpc),1 + aspeed_lpc_kcs_2, +qdev_get_gpio_in (DEVICE (&s->lpc), aspeed_lpc_kcs_2)); + +sysbus_connect_irq (SYS_BUS_DEVICE (&s->lpc),1 + aspeed_lpc_kcs_3, +qdev_get_gpio_in (DEVICE (&s->lpc), aspeed_lpc_kcs_3)); + +sysbus_connect_irq (SYS_BUS_DEVICE (&s->lpc),1 + aspeed_lpc_kcs_4, +qdev_get_gpio_in (DEVICE (&s->lpc), aspeed_lpc_kcs_4)); }static Property aspeed_soc_properties[] = { DEFINE_PROP_LINK("dram", AspeedSoCState, dram_mr, TYPE_MEMORY_REGION,
hw/misc/aspeed_lpc.c +357 -2
420 lines not on this page · raw message
Signature · 1 line
2.26.2
[PULL 3/7] hw/arm: ast2600: Force a multiple of 32 of IRQs for the GIC
In reply to Cédric Le GoaterFrom: Andrew Jeffery <[email protected]>
This appears to be a requirement of the GIC model. The AST2600 allocates 197 GIC IRQs, which we will adjust shortly.
Message-Id: <[email protected]>
--- hw/arm/aspeed_ast2600.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
hw/arm/aspeed_ast2600.c +2 -2
@@ -65,7 +65,7 @@ static const hwaddr aspeed_soc_ast2600_memmap[] = {#define ASPEED_A7MPCORE_ADDR 0x40460000 -#define ASPEED_SOC_AST2600_MAX_IRQ 128 +#define AST2600_MAX_IRQ 128/* Shared Peripheral Interrupt values below are offset by -32 from datasheet */ static const int aspeed_soc_ast2600_irqmap[] = {
@@ -260,7 +260,7 @@ static void aspeed_soc_ast2600_realize(DeviceState *dev, Error **errp)object_property_set_int (OBJECT (&s->a7mpcore),"num-cpu" , sc->num_cpus, &error_abort);object_property_set_int (OBJECT (&s->a7mpcore),"num-irq" , -ASPEED_SOC_AST2600_MAX_IRQ +GIC_INTERNAL , +ROUND_UP (AST2600_MAX_IRQ +GIC_INTERNAL ,32 ), &error_abort);sysbus_realize (SYS_BUS_DEVICE (&s->a7mpcore), &error_abort);
Signature · 1 line
2.26.2
[PULL 4/7] hw/arm: ast2600: Set AST2600_MAX_IRQ to value from datasheet
In reply to Cédric Le GoaterFrom: Andrew Jeffery <[email protected]>
The datasheet says we have 197 IRQs allocated, and we need more than 128 to describe IRQs from LPC devices. Raise the value now to allow modelling of the LPC devices.
Message-Id: <[email protected]>
--- hw/arm/aspeed_ast2600.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/arm/aspeed_ast2600.c +1 -1
@@ -65,7 +65,7 @@ static const hwaddr aspeed_soc_ast2600_memmap[] = {#define ASPEED_A7MPCORE_ADDR 0x40460000 -#define AST2600_MAX_IRQ 128 +#define AST2600_MAX_IRQ 197/* Shared Peripheral Interrupt values below are offset by -32 from datasheet */ static const int aspeed_soc_ast2600_irqmap[] = {
Signature · 1 line
2.26.2
[PULL 5/7] hw/arm: ast2600: Correct the iBT interrupt ID
In reply to Cédric Le GoaterFrom: Andrew Jeffery <[email protected]>
The AST2600 allocates distinct GIC IRQs for the LPC subdevices such as the iBT device. Previously on the AST2400 and AST2500 the LPC subdevices shared a single LPC IRQ.
Message-Id: <[email protected]>
--- hw/arm/aspeed_ast2600.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/arm/aspeed_ast2600.c +1 -1
@@ -98,7 +98,7 @@ static const int aspeed_soc_ast2600_irqmap[] = { [ASPEED_DEV_WDT] = 24, [ASPEED_DEV_PWM] = 44, [ASPEED_DEV_LPC] = 35, - [ASPEED_DEV_IBT] = 35, /* LPC */ + [ASPEED_DEV_IBT] = 143, [ASPEED_DEV_I2C] = 110, /* 110 -> 125 */ [ASPEED_DEV_ETH1] = 2, [ASPEED_DEV_ETH2] = 3,
Signature · 1 line
2.26.2
[PULL 6/7] hw/misc: Add a basic Aspeed LPC controller model
In reply to Cédric Le GoaterThis is a very minimal framework to access registers which are used to configure the AHB memory mapping of the flash chips on the LPC HC Firmware address space.
Message-Id: <[email protected]>
--- docs/system/arm/aspeed.rst | 2 +- include/hw/arm/aspeed_soc.h | 2 + include/hw/misc/aspeed_lpc.h | 32 +++++++++ hw/arm/aspeed_ast2600.c | 10 +++ hw/arm/aspeed_soc.c | 10 +++ hw/misc/aspeed_lpc.c | 131 +++++++++++++++++++++++++++++++++++ hw/misc/meson.build | 7 +- 7 files changed, 192 insertions(+), 2 deletions(-) create mode 100644 include/hw/misc/aspeed_lpc.h create mode 100644 hw/misc/aspeed_lpc.c
docs/system/arm/aspeed.rst +1 -1
@@ -48,6 +48,7 @@ Supported devices * UART * Ethernet controllers * Front LEDs (PCA9552 on I2C bus) + * LPC Peripheral Controller (a subset of subdevices are supported) Missing devices
@@ -56,7 +57,6 @@ Missing devices * Coprocessor support * ADC (out of tree implementation) * PWM and Fan Controller - * LPC Bus Controller * Slave GPIO Controller * Super I/O Controller * Hash/Crypto Engine
include/hw/arm/aspeed_soc.h +2 -0
@@ -28,6 +28,7 @@#include "hw/sd/aspeed_sdhci.h" #include "hw/usb/hcd-ehci.h" #include "qom/object.h" +#include "hw/misc/aspeed_lpc.h" #define ASPEED_SPIS_NUM 2#define ASPEED_EHCIS_NUM 2
@@ -61,6 +62,7 @@ struct AspeedSoCState {AspeedGPIOState gpio_1_8v;AspeedSDHCIState sdhci;AspeedSDHCIState emmc; +AspeedLPCState lpc; };#define TYPE_ASPEED_SOC "aspeed-soc"
include/hw/misc/aspeed_lpc.h new file +32 -0
@@ -0,0 +1,32 @@ +/* +* ASPEED LPC Controller +* +* Copyright (C) 2017-2018 IBM Corp. +* +* This code is licensed under the GPL version 2 or later. See +* the COPYING file in the top-level directory. +*/ + +#ifndef ASPEED_LPC_H +#define ASPEED_LPC_H + +#include "hw/sysbus.h" + +#define TYPE_ASPEED_LPC "aspeed.lpc" +#define ASPEED_LPC (obj) OBJECT_CHECK(AspeedLPCState, (obj), TYPE_ASPEED_LPC) + +#define ASPEED_LPC_NR_REGS (0x260 >> 2) + +typedef struct AspeedLPCState { +/* <private> */ +SysBusDevice parent; + +/*< public >*/ +MemoryRegion iomem; +qemu_irq irq; + +uint32_t regs[ASPEED_LPC_NR_REGS ]; +uint32_t hicr7; +}AspeedLPCState ; + +#endif /* _ASPEED_LPC_H_ */
hw/arm/aspeed_ast2600.c +10 -0
@@ -211,6 +211,8 @@ static void aspeed_soc_ast2600_init(Object *obj)object_initialize_child (obj,"emmc-controller.sdhci" , &s->emmc.slots[0 ],TYPE_SYSBUS_SDHCI ); + +object_initialize_child (obj,"lpc" , &s->lpc,TYPE_ASPEED_LPC ); }/*
@@ -462,6 +464,14 @@ static void aspeed_soc_ast2600_realize(DeviceState *dev, Error **errp)sysbus_mmio_map (SYS_BUS_DEVICE (&s->emmc),0 , sc->memmap[ASPEED_DEV_EMMC ]);sysbus_connect_irq (SYS_BUS_DEVICE (&s->emmc),0 ,aspeed_soc_get_irq (s,ASPEED_DEV_EMMC )); + +/* LPC */ +if (!sysbus_realize (SYS_BUS_DEVICE (&s->lpc), errp)) { +return ; + } +sysbus_mmio_map (SYS_BUS_DEVICE (&s->lpc),0 , sc->memmap[ASPEED_DEV_LPC ]); +sysbus_connect_irq (SYS_BUS_DEVICE (&s->lpc),0 , +aspeed_soc_get_irq (s,ASPEED_DEV_LPC )); }static void aspeed_soc_ast2600_class_init (ObjectClass *oc,void *data)
hw/arm/aspeed_soc.c +10 -0
@@ -211,6 +211,8 @@ static void aspeed_soc_init(Object *obj)object_initialize_child (obj,"sdhci[*]" , &s->sdhci.slots[i],TYPE_SYSBUS_SDHCI ); } + +object_initialize_child (obj,"lpc" , &s->lpc,TYPE_ASPEED_LPC ); }static void aspeed_soc_realize (DeviceState *dev,Error **errp)
@@ -393,6 +395,14 @@ static void aspeed_soc_realize(DeviceState *dev, Error **errp) sc->memmap[ASPEED_DEV_SDHCI]);sysbus_connect_irq (SYS_BUS_DEVICE (&s->sdhci),0 ,aspeed_soc_get_irq (s,ASPEED_DEV_SDHCI )); + +/* LPC */ +if (!sysbus_realize (SYS_BUS_DEVICE (&s->lpc), errp)) { +return ; + } +sysbus_mmio_map (SYS_BUS_DEVICE (&s->lpc),0 , sc->memmap[ASPEED_DEV_LPC ]); +sysbus_connect_irq (SYS_BUS_DEVICE (&s->lpc),0 , +aspeed_soc_get_irq (s,ASPEED_DEV_LPC )); }static Property aspeed_soc_properties[] = { DEFINE_PROP_LINK("dram", AspeedSoCState, dram_mr, TYPE_MEMORY_REGION,
hw/misc/aspeed_lpc.c new file +131 -0
131 lines not on this page · raw message
hw/misc/meson.build +6 -1
@@ -102,7 +102,12 @@ softmmu_ss.add(when: 'CONFIG_ARMSSE_MHU', if_true: files('armsse-mhu.c')) softmmu_ss.add(when: 'CONFIG_PVPANIC_ISA', if_true: files('pvpanic-isa.c')) softmmu_ss.add(when: 'CONFIG_PVPANIC_PCI', if_true: files('pvpanic-pci.c')) softmmu_ss.add(when: 'CONFIG_AUX', if_true: files('auxbus.c')) -softmmu_ss.add(when: 'CONFIG_ASPEED_SOC', if_true: files('aspeed_scu.c', 'aspeed_sdmc.c', 'aspeed_xdma.c')) +softmmu_ss.add(when: 'CONFIG_ASPEED_SOC', if_true: files( + 'aspeed_lpc.c', + 'aspeed_scu.c', + 'aspeed_sdmc.c', + 'aspeed_xdma.c')) + softmmu_ss.add(when: 'CONFIG_MSF2', if_true: files('msf2-sysreg.c')) softmmu_ss.add(when: 'CONFIG_NRF51_SOC', if_true: files('nrf51_rng.c'))
Signature · 1 line
2.26.2
[PULL 2/7] hw/arm/aspeed: Fix location of firmware images in documentation
In reply to Cédric Le GoaterFirmware images can be found on the OpenBMC jenkins site and on the OpenBMC GitHub release page.
Message-Id: <[email protected]>
--- docs/system/arm/aspeed.rst | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
docs/system/arm/aspeed.rst +9 -5
@@ -72,18 +72,22 @@ Missing devices Boot options ------------ -The Aspeed machines can be started using the -kernel option to load a -Linux kernel or from a firmware image which can be downloaded from the -OpenPOWER jenkins : +The Aspeed machines can be started using the ``-kernel`` option to +load a Linux kernel or from a firmware. Images can be downloaded from +the OpenBMC jenkins : - https://openpower.xyz/ + https://jenkins.openbmc.org/job/ci-openbmc/lastSuccessfulBuild/distro=ubuntu,label=docker-builder + +or directly from the OpenBMC GitHub release repository : + + https://github.com/openbmc/openbmc/releases The image should be attached as an MTD drive. Run : .. code-block:: bash $ qemu-system-arm -M romulus-bmc -nic user \ - -drive file=flash-romulus,format=raw,if=mtd -nographic + -drive file=obmc-phosphor-image-romulus.static.mtd,format=raw,if=mtd -nographic Options specific to Aspeed machines are :
Signature · 1 line
2.26.2
Peter Maydell
AppliedQuoted 11 lines · Cédric Le Goater
The following changes since commit
229a834518b950d56fd1bc94923276504d0ee9d4:Merge remote-tracking branch 'remotes/philmd-gitlab/tags/renesas-20210306' into staging (2021-03-08 15:45:48 +0000)
are available in the Git repository at:
https://github.com/legoater/qemu/ tags/pull-aspeed-20210309
for you to fetch changes up to
c59f781e3bcca4a80aef5d229488fd45dbfdbd9a:
Quoted 8 lines
hw/misc: Model KCS devices in the Aspeed LPC controller (2021-03-09 12:01:28 +0100)
----------------------------------------------------------------
Aspeed patches :* New model for the Aspeed LPC controller
* Misc cleanups
Applied, thanks.
Please update the changelog at https://wiki.qemu.org/ChangeLog/6.0
for any user-visible changes.
-- PMM