ppc queue
Subsystems (2)
The following changes since commit 93fac696d241dccb04ebb9d23da55fc1e9d8ee36:
Open 7.2 development tree (2022-08-30 09:40:41 -0700)
are available in the Git repository at:
https://gitlab.com/danielhb/qemu.git tags/pull-ppc-20220831
for you to fetch changes up to 2d9c27ac5c035823315f68c227ca1cc6313e9842:
ppc4xx: Fix code style problems reported by checkpatch (2022-08-31 14:08:06 -0300)
----------------------------------------------------------------
ppc patch queue for 2022-08-31:
In the first 7.2 queue we have changes in the powernv pnv-phb handling, the start of the QOMification of the ppc405 model, the removal of the taihu machine, a new SLOF image and others.
----------------------------------------------------------------
Alexey Kardashevskiy (1):
pseries: Update SLOF firmware image
BALATON Zoltan (9):
ppc4xx: Move PLB model to ppc4xx_devs.c
ppc4xx: Rename ppc405-plb to ppc4xx-plb
ppc4xx: Move EBC model to ppc4xx_devs.c
ppc4xx: Rename ppc405-ebc to ppc4xx-ebc hw/intc/ppc-uic: Convert ppc-uic to a PPC4xx DCR device
ppc405: Move machine specific code to ppc405_boards.c hw/ppc/sam3460ex: Remove PPC405 dependency from sam460ex hw/ppc/Kconfig: Move imply before select
ppc4xx: Fix code style problems reported by checkpatch
Cédric Le Goater (22):
ppc/ppc405: Remove taihu machine
ppc/ppc405: Introduce a PPC405 generic machine ppc/ppc405: Move devices under the ref405ep machine ppc/ppc405: Move SRAM under the ref405ep machine ppc/ppc405: Introduce a PPC405 SoC ppc/ppc405: Start QOMification of the SoC ppc/ppc405: QOM'ify CPU
ppc/ppc4xx: Introduce a DCR device model ppc/ppc405: QOM'ify CPC
ppc/ppc405: QOM'ify GPT
ppc/ppc405: QOM'ify OCM
ppc/ppc405: QOM'ify GPIO
ppc/ppc405: QOM'ify DMA
ppc/ppc405: QOM'ify EBC
ppc/ppc405: QOM'ify OPBA
ppc/ppc405: QOM'ify POB
ppc/ppc405: QOM'ify PLB
ppc/ppc405: QOM'ify MAL
ppc/ppc405: Use an embedded PPCUIC model in SoC state ppc/ppc405: Use an explicit I2C object ppc/ppc405: QOM'ify FPGA
ppc/ppc4xx: Fix sdram trace events
Daniel Henrique Barboza (24):
ppc/pnv: add PHB3 bus init helper
ppc/pnv: add PnvPHB base/proxy device
ppc/pnv: turn PnvPHB3 into a PnvPHB backend
ppc/pnv: add PHB4 bus init helper
ppc/pnv: turn PnvPHB4 into a PnvPHB backend
ppc/pnv: add pnv-phb-root-port device
ppc/pnv: remove pnv-phb3-root-port
ppc/pnv: remove pnv-phb4-root-port
ppc/pnv: remove root port name from pnv_phb_attach_root_port() ppc/pnv: remove pecc->rp_model
ppc/pnv: remove PnvPHB4.version
ppc/pnv: move attach_root_port helper to pnv-phb.c ppc/pnv: add phb-id/chip-id PnvPHB3RootBus properties ppc/pnv: add phb-id/chip-id PnvPHB4RootBus properties ppc/pnv: set root port chassis and slot using Bus properties ppc/pnv: add helpers for pnv-phb user devices ppc/pnv: turn chip8->phbs[] into a PnvPHB* array ppc/pnv: enable user created pnv-phb for powernv8 ppc/pnv: add PHB4 helpers for user created pnv-phb ppc/pnv: enable user created pnv-phb for powernv9 ppc/pnv: change pnv_phb4_get_pec() to also retrieve chip10->pecs ppc/pnv: user creatable pnv-phb for powernv10 ppc/pnv: consolidate pnv_parent_*_fixup() helpers ppc/pnv: fix QOM parenting of user creatable root ports
Lucas Mateus Castro (alqotel) (2):
fpu: Add rebias bool, value and operation
target/ppc: Bugfix FP when OE/UE are set
Nicholas Piggin (2):
target/ppc: Fix host PVR matching for KVM
ppc/pnv: Add initial P9/10 SBE model
MAINTAINERS | 2 +- docs/about/deprecated.rst | 9 - docs/about/removed-features.rst | 6 + docs/system/ppc/embedded.rst | 1 - docs/system/ppc/pseries.rst | 2 +- fpu/softfloat-parts.c.inc | 21 +- fpu/softfloat.c | 2 + hw/intc/ppc-uic.c | 26 +- hw/pci-host/meson.build | 3 +- hw/pci-host/pnv_phb.c | 337 ++++++++++++ hw/pci-host/pnv_phb.h | 55 ++ hw/pci-host/pnv_phb3.c | 152 +++-- hw/pci-host/pnv_phb4.c | 191 +++---- hw/pci-host/pnv_phb4_pec.c | 11 +- hw/ppc/Kconfig | 3 +- hw/ppc/meson.build | 1 + hw/ppc/pnv.c | 188 +++++-- hw/ppc/pnv_sbe.c | 414 ++++++++++++++ hw/ppc/pnv_xscom.c | 3 + hw/ppc/ppc405.h | 200 +++++-- hw/ppc/ppc405_boards.c | 552 +++++++++---------- hw/ppc/ppc405_uc.c | 1156 ++++++++++++++------------------------- hw/ppc/ppc440_bamboo.c | 34 +- hw/ppc/ppc440_uc.c | 3 +- hw/ppc/ppc4xx_devs.c | 554 ++++++++++++++----- hw/ppc/ppc4xx_pci.c | 31 +- hw/ppc/sam460ex.c | 38 +- hw/ppc/trace-events | 14 +- hw/ppc/virtex_ml507.c | 7 +- include/fpu/softfloat-types.h | 4 + include/hw/intc/ppc-uic.h | 6 +- include/hw/pci-host/pnv_phb3.h | 19 +- include/hw/pci-host/pnv_phb4.h | 22 +- include/hw/ppc/pnv.h | 13 +- include/hw/ppc/pnv_sbe.h | 55 ++ include/hw/ppc/pnv_xscom.h | 12 + include/hw/ppc/ppc4xx.h | 76 ++- pc-bios/README | 2 +- pc-bios/slof.bin | Bin 992384 -> 995176 bytes roms/SLOF | 2 +- target/ppc/cpu-qom.h | 6 +- target/ppc/cpu.c | 2 + target/ppc/cpu_init.c | 91 ++- target/ppc/fpu_helper.c | 2 - target/ppc/machine.c | 2 +- 45 files changed, 2736 insertions(+), 1594 deletions(-) create mode 100644 hw/pci-host/pnv_phb.c create mode 100644 hw/pci-host/pnv_phb.h create mode 100644 hw/ppc/pnv_sbe.c create mode 100644 include/hw/ppc/pnv_sbe.h
[PULL 04/60] fpu: Add rebias bool, value and operation
From: "Lucas Mateus Castro (alqotel)" <[email protected]>
Added the possibility of recalculating a result if it overflows or underflows, if the result overflow and the rebias bool is true then the intermediate result should have 3/4 of the total range subtracted from the exponent. The same for underflow but it should be added to the exponent of the intermediate number instead.
Message-Id: <[email protected]>
--- fpu/softfloat-parts.c.inc | 21 +++++++++++++++++++-- fpu/softfloat.c | 2 ++ include/fpu/softfloat-types.h | 4 ++++ 3 files changed, 25 insertions(+), 2 deletions(-)
fpu/softfloat-parts.c.inc +19 -2
@@ -214,18 +214,35 @@ static void partsN(uncanon_normal)(FloatPartsN *p, float_status *s, p->frac_lo &= ~round_mask; } } else if (unlikely(exp >= exp_max)) { - flags |= float_flag_overflow | float_flag_inexact; - if (overflow_norm) { + flags |= float_flag_overflow; + if (s->rebias_overflow) { + exp -= fmt->exp_re_bias; + } else if (overflow_norm) { + flags |= float_flag_inexact; exp = exp_max - 1; frac_allones(p); p->frac_lo &= ~round_mask; } else { + flags |= float_flag_inexact; p->cls = float_class_inf; exp = exp_max; frac_clear(p); } } frac_shr(p, frac_shift); + } else if (unlikely(s->rebias_underflow)) { + flags |= float_flag_underflow; + exp += fmt->exp_re_bias; + if (p->frac_lo & round_mask) { + flags |= float_flag_inexact; + if (frac_addi(p, p, inc)) { + frac_shr(p, 1); + p->frac_hi |= DECOMPOSED_IMPLICIT_BIT; + exp++; + } + p->frac_lo &= ~round_mask; + } + frac_shr(p, frac_shift); } else if (s->flush_to_zero) { flags |= float_flag_output_denormal; p->cls = float_class_zero;
fpu/softfloat.c +2 -0
@@ -521,6 +521,7 @@ typedef struct { typedef struct { int exp_size; int exp_bias; + int exp_re_bias; int exp_max; int frac_size; int frac_shift;
@@ -532,6 +533,7 @@ typedef struct {#define FLOAT_PARAMS_ (E ) \ .exp_size = E, \ .exp_bias = ((1 << E) - 1) >> 1, \ + .exp_re_bias = (1 << (E - 1)) + (1 << (E - 2)), \ .exp_max = (1 << E) - 1#define FLOAT_PARAMS (E ,F ) \
include/fpu/softfloat-types.h +4 -0
@@ -195,6 +195,10 @@ typedef struct float_status {bool snan_bit_is_one;bool use_first_nan;bool no_signaling_nans; +/* should overflowed results subtract re_bias to its exponent? */ +bool rebias_overflow; +/* should underflowed results add re_bias to its exponent? */ + bool rebias_underflow; } float_status;#endif /* SOFTFLOAT_TYPES_H */
Signature · 1 line
2.37.2
[PULL 07/60] ppc/pnv: add PnvPHB base/proxy device
In reply to Daniel Henrique BarbozaThe PnvPHB device is going to be the base device for all other powernv PHBs. It consists of a device that has the same user API as the other PHB, namely being a PCIHostBridge and having chip-id and index properties. It also has a 'backend' pointer that will be initialized with the PHB implementation that the device is going to use.
The initialization of the PHB backend is done by checking the PHB version via a 'version' attribute that can be set via a global machine property. The 'version' field will be used to make adjustments based on the running version, e.g. PHB3 uses a 'chip' reference while PHB4 uses 'pec'. To init the PnvPHB bus we'll rely on helpers for each version. The version 3 helper is already added (pnv_phb3_bus_init), the PHB4 helper will be added later on.
For now let's add the basic logic of the PnvPHB object, which consists mostly of pnv_phb_realize() doing all the work of checking the phb->version set, initializing the proper backend, passing through its attributes to the chosen backend, finalizing the backend realize and adding a root port in the end.
Message-Id: <[email protected]>
--- hw/pci-host/meson.build | 3 +- hw/pci-host/pnv_phb.c | 124 ++++++++++++++++++++++++++++++++++++++++ hw/pci-host/pnv_phb.h | 39 +++++++++++++ 3 files changed, 165 insertions(+), 1 deletion(-) create mode 100644 hw/pci-host/pnv_phb.c create mode 100644 hw/pci-host/pnv_phb.h
hw/pci-host/meson.build +2 -1
@@ -35,5 +35,6 @@ specific_ss.add(when: 'CONFIG_PCI_POWERNV', if_true: files( 'pnv_phb3_msi.c', 'pnv_phb3_pbcq.c', 'pnv_phb4.c', - 'pnv_phb4_pec.c' + 'pnv_phb4_pec.c', + 'pnv_phb.c', ))
hw/pci-host/pnv_phb.c new file +124 -0
124 lines not on this page · raw message
hw/pci-host/pnv_phb.h new file +39 -0
@@ -0,0 +1,39 @@ +/* +* QEMU PowerPC PowerNV Proxy PHB model +* +* Copyright (c) 2022, IBM Corporation. +* +* This code is licensed under the GPL version 2 or later. See the +* COPYING file in the top-level directory. +*/ + +#ifndef PCI_HOST_PNV_PHB_H +#define PCI_HOST_PNV_PHB_H + +#include "hw/pci/pcie_host.h" +#include "hw/pci/pcie_port.h" +#include "qom/object.h" + +typedef struct PnvChip PnvChip ; +typedef struct PnvPhb4PecState PnvPhb4PecState ; + +struct PnvPHB { +PCIExpressHost parent_obj; + +uint32_t chip_id; +uint32_t phb_id; +uint32_t version; +char bus_path[8 ]; + +PnvChip *chip; + +PnvPhb4PecState *pec; + +/* The PHB backend (PnvPHB3, PnvPHB4 ...) being used */ +Object *backend; +}; + +#define TYPE_PNV_PHB "pnv-phb" +OBJECT_DECLARE_SIMPLE_TYPE(PnvPHB, PNV_PHB) + +#endif /* PCI_HOST_PNV_PHB_H */
Signature · 1 line
2.37.2
[PULL 01/60] pseries: Update SLOF firmware image
In reply to Daniel Henrique BarbozaFrom: Alexey Kardashevskiy <[email protected]>
The only change is that now SLOF can also boot big endian zImage but kernel-addr=0 is still required.
--- docs/system/ppc/pseries.rst | 2 +- pc-bios/README | 2 +- pc-bios/slof.bin | Bin 992384 -> 995176 bytes roms/SLOF | 2 +- 4 files changed, 3 insertions(+), 3 deletions(-)
docs/system/ppc/pseries.rst +1 -1
@@ -62,7 +62,7 @@ Booting via ``-kernel`` supports the following: +-------------------+-------------------+------------------+ | vmlinux LE | ✓ | ✓ | +-------------------+-------------------+------------------+ -| zImage.pseries BE | x | ✓¹ | +| zImage.pseries BE | ✓¹ | ✓¹ | +-------------------+-------------------+------------------+ | zImage.pseries LE | ✓ | ✓ | +-------------------+-------------------+------------------+
pc-bios/README +1 -1
@@ -14,7 +14,7 @@ - SLOF (Slimline Open Firmware) is a free IEEE 1275 Open Firmware implementation for certain IBM POWER hardware. The sources are at https://github.com/aik/SLOF, and the image currently in qemu is - built from git tag qemu-slof-20220110. + built from git tag qemu-slof-20220719. - VOF (Virtual Open Firmware) is a minimalistic firmware to work with -machine pseries,x-vof=on. When enabled, the firmware acts as a slim shim and
pc-bios/slof.bin binary +0 -0
roms/SLOF +1 -1
@@ -1 +1 @@ -Subproject commit 5b4c5acdcd552a4e1796aeca6bb700f6cbb0282d +Subproject commit 6b6c16b4b40763507cf1f518096f3c3883c5cf2d
Signature · 1 line
2.37.2
[PULL 02/60] target/ppc: Fix host PVR matching for KVM
In reply to Daniel Henrique BarbozaFrom: Nicholas Piggin <[email protected]>
ppc_cpu_compare_class_pvr_mask() should match the best CPU class in the family, because it is used by the KVM subsystem to find the host CPU class. Since commit 03ae4133ab8 ("target-ppc: Add pvr_match() callback"), it matches any class in the family (the first one in the comparison list).
Since commit f30c843ced5 ("ppc/pnv: Introduce PowerNV machines with fixed CPU models"), pnv has relied on pnv_match having these new semantics to check machine compatibility with a CPU family.
Resolve this by adding a parameter to the pvr_match function to select the best or any match, and restore the old behaviour for the KVM case.
Prior to this fix, e.g., a POWER9 DD2.3 KVM host matches to the power9_v1.0 class (because that happens to be the first POWER9 family CPU compared). After the patch, it matches the power9_v2.0 class.
This approach requires pnv_match contain knowledge of the CPU classes implemented in the same family, which feels ugly. But pushing the 'best' match down to the class would still require they know about one another which is not obviously much better. For now this gets things working.
Message-Id: <[email protected]>
--- hw/ppc/pnv.c | 2 +- target/ppc/cpu-qom.h | 6 ++- target/ppc/cpu_init.c | 91 +++++++++++++++++++++++++++++++++---------- target/ppc/machine.c | 2 +- 4 files changed, 77 insertions(+), 24 deletions(-)
hw/ppc/pnv.c +1 -1
@@ -714,7 +714,7 @@ static bool pnv_match_cpu(const char *default_type, const char *cpu_type)PowerPCCPUClass *ppc =POWERPC_CPU_CLASS (object_class_by_name (cpu_type)); -return ppc_default->pvr_match (ppc_default, ppc->pvr); +return ppc_default->pvr_match (ppc_default, ppc->pvr, false); }static void pnv_ipmi_bt_init (ISABus *bus,IPMIBmc *bmc,uint32_t irq)
target/ppc/cpu-qom.h +5 -1
@@ -158,7 +158,11 @@ struct PowerPCCPUClass {void (*parent_parse_features)(const char *type,char *str,Error **errp);uint32_t pvr; -bool (*pvr_match)(struct PowerPCCPUClass *pcc,uint32_t pvr); +/* +* If @best is false, match if pcc is in the family of pvr +* Else match only if pcc is the best match for pvr in this family. +*/ +bool (*pvr_match)(struct PowerPCCPUClass *pcc,uint32_t pvr,bool best);uint64_t pcr_mask;/* Available bits in PCR register */ uint64_t pcr_supported;/* Bits for supported PowerISA versions */ uint32_t svr;
target/ppc/cpu_init.c +70 -21
139 lines not on this page · raw message
target/ppc/machine.c +1 -1
@@ -234,7 +234,7 @@ static bool pvr_match(PowerPCCPU *cpu, uint32_t pvr)if (pvr == pcc->pvr) {return true; } -return pcc->pvr_match (pcc, pvr); +return pcc->pvr_match (pcc, pvr, true); }static int cpu_post_load (void *opaque,int version_id)
Signature · 1 line
2.37.2
[PULL 11/60] ppc/pnv: add pnv-phb-root-port device
In reply to Daniel Henrique BarbozaWe have two very similar root-port devices, pnv-phb3-root-port and pnv-phb4-root-port. Both consist of a wrapper around the PCIESlot device that, until now, has no additional attributes.
The main difference between the PHB3 and PHB4 root ports is that pnv-phb4-root-port has the pnv_phb4_root_port_reset() callback. All other differences can be merged in a single device without too much trouble.
This patch introduces the unified pnv-phb-root-port that, in time, will be used as the default root port for the pnv-phb device.
Message-Id: <[email protected]>
--- hw/pci-host/pnv_phb.c | 115 +++++++++++++++++++++++++++++++++++++++--- hw/pci-host/pnv_phb.h | 16 ++++++ 2 files changed, 123 insertions(+), 8 deletions(-)
hw/pci-host/pnv_phb.c +107 -8
@@ -112,15 +112,114 @@ static void pnv_phb_class_init(ObjectClass *klass, void *data) dc->user_creatable = false; } -static void pnv_phb_register_type (void ) +static void pnv_phb_root_port_reset (DeviceState *dev) { -static const TypeInfo pnv_phb_type_info = { - .name =TYPE_PNV_PHB , - .parent =TYPE_PCIE_HOST_BRIDGE , - .instance_size =sizeof (PnvPHB), - .class_init = pnv_phb_class_init, - }; +PCIERootPortClass *rpc =PCIE_ROOT_PORT_GET_CLASS (dev); +PnvPHBRootPort *phb_rp =PNV_PHB_ROOT_PORT (dev); +PCIDevice *d =PCI_DEVICE (dev); +uint8_t *conf = d->config; + rpc->parent_reset (dev); + +if (phb_rp->version ==3 ) { +return ; + } + +/* PHB4 and later requires these extra reset steps */ +pci_byte_test_and_set_mask (conf +PCI_IO_BASE , +PCI_IO_RANGE_MASK &0xff ); +pci_byte_test_and_clear_mask (conf +PCI_IO_LIMIT , +PCI_IO_RANGE_MASK &0xff ); +pci_set_word (conf +PCI_MEMORY_BASE ,0 ); +pci_set_word (conf +PCI_MEMORY_LIMIT ,0xfff0 ); +pci_set_word (conf +PCI_PREF_MEMORY_BASE ,0x1 ); +pci_set_word (conf +PCI_PREF_MEMORY_LIMIT ,0xfff1 ); +pci_set_long (conf +PCI_PREF_BASE_UPPER32 ,0x1 );/* Hack */ +pci_set_long (conf +PCI_PREF_LIMIT_UPPER32 ,0xffffffff ); +pci_config_set_interrupt_pin (conf,0 ); +} + +static void pnv_phb_root_port_realize (DeviceState *dev,Error **errp) +{ +PCIERootPortClass *rpc =PCIE_ROOT_PORT_GET_CLASS (dev); +PnvPHBRootPort *phb_rp =PNV_PHB_ROOT_PORT (dev); +PCIDevice *pci =PCI_DEVICE (dev); +uint16_t device_id =0 ; +Error *local_err =NULL ; + + rpc->parent_realize (dev, &local_err); +if (local_err) { +error_propagate (errp, local_err); +return ; + } + +switch (phb_rp->version) { +case 3 : + device_id =PNV_PHB3_DEVICE_ID ; +break ; +case 4 : + device_id =PNV_PHB4_DEVICE_ID ; +break ; +case 5 : + device_id =PNV_PHB5_DEVICE_ID ; +break ; +default : +g_assert_not_reached (); + } + +pci_config_set_device_id (pci->config, device_id); +pci_config_set_interrupt_pin (pci->config,0 ); +} + +static Property pnv_phb_root_port_properties[] = { +DEFINE_PROP_UINT32 ("version" , PnvPHBRootPort, version,0 ), + +DEFINE_PROP_END_OF_LIST (), +}; + +static void pnv_phb_root_port_class_init (ObjectClass *klass,void *data) +{ +DeviceClass *dc =DEVICE_CLASS (klass); +PCIDeviceClass *k =PCI_DEVICE_CLASS (klass); +PCIERootPortClass *rpc =PCIE_ROOT_PORT_CLASS (klass); + + dc->desc ="IBM PHB PCIE Root Port" ; + +device_class_set_props (dc, pnv_phb_root_port_properties); +device_class_set_parent_realize (dc, pnv_phb_root_port_realize, + &rpc->parent_realize); +device_class_set_parent_reset (dc, pnv_phb_root_port_reset, + &rpc->parent_reset); + dc->reset = &pnv_phb_root_port_reset; + dc->user_creatable = false; + + k->vendor_id =PCI_VENDOR_ID_IBM ; +/* device_id will be written during realize() */ + k->device_id =0 ; + k->revision =0 ; + + rpc->exp_offset =0x48 ; + rpc->aer_offset =0x100 ; +} + +static const TypeInfo pnv_phb_type_info = { + .name =TYPE_PNV_PHB , + .parent =TYPE_PCIE_HOST_BRIDGE , + .instance_size =sizeof (PnvPHB), + .class_init = pnv_phb_class_init, +}; + +static const TypeInfo pnv_phb_root_port_info = { + .name =TYPE_PNV_PHB_ROOT_PORT , + .parent =TYPE_PCIE_ROOT_PORT , + .instance_size =sizeof (PnvPHBRootPort), + .class_init = pnv_phb_root_port_class_init, +}; + +static void pnv_phb_register_types (void ) +{type_register_static (&pnv_phb_type_info); +type_register_static (&pnv_phb_root_port_info); } -type_init (pnv_phb_register_type) + +type_init (pnv_phb_register_types)
hw/pci-host/pnv_phb.h +16 -0
@@ -36,4 +36,20 @@ struct PnvPHB {#define TYPE_PNV_PHB "pnv-phb"OBJECT_DECLARE_SIMPLE_TYPE (PnvPHB,PNV_PHB ) +/* +* PHB PCIe Root port + */ +#define PNV_PHB3_DEVICE_ID 0x03dc +#define PNV_PHB4_DEVICE_ID 0x04c1 +#define PNV_PHB5_DEVICE_ID 0x0652 + +typedef struct PnvPHBRootPort { +PCIESlot parent_obj; + +uint32_t version; +}PnvPHBRootPort ; + +#define TYPE_PNV_PHB_ROOT_PORT "pnv-phb-root-port" +OBJECT_DECLARE_SIMPLE_TYPE(PnvPHBRootPort, PNV_PHB_ROOT_PORT) +#endif /* PCI_HOST_PNV_PHB_H */
Signature · 1 line
2.37.2
[PULL 10/60] ppc/pnv: turn PnvPHB4 into a PnvPHB backend
In reply to Daniel Henrique BarbozaChange the parent type of the PnvPHB4 device to TYPE_PARENT since the PCI bus is going to be initialized by the PnvPHB parent. Functions that needs to access the bus via a PnvPHB4 object can do so via the phb4->phb_base pointer.
pnv_phb4_pec now creates a PnvPHB object.
The powernv9 machine class will create PnvPHB devices with version '4'. powernv10 will create using version '5'. Both are using global machine properties in their class_init() to do that.
These changes will benefit us when adding PnvPHB user creatable devices for powernv9 and powernv10.
Message-Id: <[email protected]>
--- hw/pci-host/pnv_phb4.c | 30 +++++------------------------- hw/pci-host/pnv_phb4_pec.c | 3 +-- hw/ppc/pnv.c | 20 +++++++++++++++++--- include/hw/pci-host/pnv_phb4.h | 5 ++++- 4 files changed, 27 insertions(+), 31 deletions(-)
hw/pci-host/pnv_phb4.c +5 -25
@@ -33,7 +33,7 @@static PCIDevice *pnv_phb4_find_cfg_dev (PnvPHB4 *phb) { -PCIHostState *pci =PCI_HOST_BRIDGE (phb); +PCIHostState *pci =PCI_HOST_BRIDGE (phb->phb_base);uint64_t addr = phb->regs[PHB_CONFIG_ADDRESS >>3 ];uint8_t bus, devfn;
@@ -129,7 +129,7 @@ static uint64_t pnv_phb4_config_read(PnvPHB4 *phb, unsigned off,static void pnv_phb4_rc_config_write (PnvPHB4 *phb,unsigned off,unsigned size,uint64_t val) { -PCIHostState *pci =PCI_HOST_BRIDGE (phb); +PCIHostState *pci =PCI_HOST_BRIDGE (phb->phb_base);PCIDevice *pdev;if (size !=4 ) {
@@ -150,7 +150,7 @@ static void pnv_phb4_rc_config_write(PnvPHB4 *phb, unsigned off,static uint64_t pnv_phb4_rc_config_read (PnvPHB4 *phb,unsigned off,unsigned size) { -PCIHostState *pci =PCI_HOST_BRIDGE (phb); +PCIHostState *pci =PCI_HOST_BRIDGE (phb->phb_base);PCIDevice *pdev;uint64_t val;
@@ -1558,8 +1558,6 @@ void pnv_phb4_bus_init(DeviceState *dev, PnvPHB4 *phb)static void pnv_phb4_realize (DeviceState *dev,Error **errp) {PnvPHB4 *phb =PNV_PHB4 (dev); -PnvPhb4PecClass *pecc =PNV_PHB4_PEC_GET_CLASS (phb->pec); -PCIHostState *pci =PCI_HOST_BRIDGE (dev);XiveSource *xsrc = &phb->xsrc;int nr_irqs;char name[32 ];
@@ -1573,12 +1571,6 @@ static void pnv_phb4_realize(DeviceState *dev, Error **errp)memory_region_init_io (&phb->mr_regs,OBJECT (phb), &pnv_phb4_reg_ops, phb, name,0x2000 ); -pnv_phb4_bus_init (dev, phb); - -/* Add a single Root port if running with defaults */ -pnv_phb_attach_root_port (pci, pecc->rp_model, - phb->phb_id, phb->chip_id); -/* Setup XIVE Source */ if (phb->big_phb) { nr_irqs = PNV_PHB4_MAX_INTs;
@@ -1598,16 +1590,6 @@ static void pnv_phb4_realize(DeviceState *dev, Error **errp)pnv_phb4_xscom_realize (phb); } -static const char *pnv_phb4_root_bus_path (PCIHostState *host_bridge, -PCIBus *rootbus) -{ -PnvPHB4 *phb =PNV_PHB4 (host_bridge); - -snprintf (phb->bus_path,sizeof (phb->bus_path),"00%02x:%02x" , - phb->chip_id, phb->phb_id); -return phb->bus_path; -} -/* * Address base trigger mode (POWER10) *
@@ -1692,19 +1674,17 @@ static Property pnv_phb4_properties[] = {DEFINE_PROP_UINT32 ("chip-id" , PnvPHB4, chip_id,0 ),DEFINE_PROP_LINK ("pec" , PnvPHB4, pec,TYPE_PNV_PHB4_PEC , PnvPhb4PecState *), + DEFINE_PROP_LINK("phb-base", PnvPHB4, phb_base, TYPE_PNV_PHB, PnvPHB *), DEFINE_PROP_END_OF_LIST(), };static void pnv_phb4_class_init (ObjectClass *klass,void *data) { -PCIHostBridgeClass *hc =PCI_HOST_BRIDGE_CLASS (klass);DeviceClass *dc =DEVICE_CLASS (klass);XiveNotifierClass *xfc =XIVE_NOTIFIER_CLASS (klass); - hc->root_bus_path = pnv_phb4_root_bus_path; dc->realize = pnv_phb4_realize;device_class_set_props (dc, pnv_phb4_properties); -set_bit (DEVICE_CATEGORY_BRIDGE , dc->categories); dc->user_creatable = false; xfc->notify = pnv_phb4_xive_notify;
@@ -1712,7 +1692,7 @@ static void pnv_phb4_class_init(ObjectClass *klass, void *data)static const TypeInfo pnv_phb4_type_info = { .name =TYPE_PNV_PHB4 , - .parent =TYPE_PCIE_HOST_BRIDGE , + .parent =TYPE_DEVICE , .instance_init = pnv_phb4_instance_init, .instance_size =sizeof (PnvPHB4), .class_init = pnv_phb4_class_init,
hw/pci-host/pnv_phb4_pec.c +1 -2
@@ -115,8 +115,7 @@ static void pnv_pec_default_phb_realize(PnvPhb4PecState *pec,int stack_no, Error **errp) { - PnvPhb4PecClass *pecc = PNV_PHB4_PEC_GET_CLASS(pec); -PnvPHB4 *phb =PNV_PHB4 (qdev_new (pecc->phb_type)); + PnvPHB *phb = PNV_PHB(qdev_new(TYPE_PNV_PHB));int phb_id =pnv_phb4_pec_get_phb_id (pec, stack_no);object_property_add_child (OBJECT (pec),"phb[*]" ,OBJECT (phb));
hw/ppc/pnv.c +17 -3
@@ -672,11 +672,14 @@ static void pnv_chip_power8_pic_print_info(PnvChip *chip, Monitor *mon)static int pnv_chip_power9_pic_print_info_child (Object *child,void *opaque) {Monitor *mon = opaque; -PnvPHB4 *phb4 = (PnvPHB4 *)object_dynamic_cast (child,TYPE_PNV_PHB4 ); +PnvPHB *phb = (PnvPHB *)object_dynamic_cast (child,TYPE_PNV_PHB ); -if (phb4) { -pnv_phb4_pic_print_info (phb4, mon); +if (!phb) { +return 0 ; } + +pnv_phb4_pic_print_info (PNV_PHB4 (phb->backend), mon); +return 0 ; }
@@ -2147,8 +2150,14 @@ static void pnv_machine_power9_class_init(ObjectClass *oc, void *data)PnvMachineClass *pmc =PNV_MACHINE_CLASS (oc);static const char compat[] ="qemu,powernv9\0ibm,powernv" ; +static GlobalProperty phb_compat[] = { + {TYPE_PNV_PHB ,"version" ,"4" }, + }; + mc->desc ="IBM PowerNV (Non-Virtualized) POWER9" ; mc->default_cpu_type =POWERPC_CPU_TYPE_NAME ("power9_v2.0" ); +compat_props_add (mc->compat_props, phb_compat,G_N_ELEMENTS (phb_compat)); + xfc->match_nvt = pnv_match_nvt; mc->alias ="powernv" ;
@@ -2165,8 +2174,13 @@ static void pnv_machine_power10_class_init(ObjectClass *oc, void *data)XiveFabricClass *xfc =XIVE_FABRIC_CLASS (oc);static const char compat[] ="qemu,powernv10\0ibm,powernv" ; +static GlobalProperty phb_compat[] = { + {TYPE_PNV_PHB ,"version" ,"5" }, + }; + mc->desc ="IBM PowerNV (Non-Virtualized) POWER10" ; mc->default_cpu_type =POWERPC_CPU_TYPE_NAME ("power10_v2.0" ); +compat_props_add (mc->compat_props, phb_compat,G_N_ELEMENTS (phb_compat)); pmc->compat = compat; pmc->compat_size =sizeof (compat);
include/hw/pci-host/pnv_phb4.h +4 -1
@@ -18,6 +18,7 @@typedef struct PnvPhb4PecState PnvPhb4PecState ;typedef struct PnvPhb4PecStack PnvPhb4PecStack ;typedef struct PnvPHB4 PnvPHB4 ; +typedef struct PnvPHB PnvPHB ;typedef struct PnvChip PnvChip ;/*
@@ -78,7 +79,9 @@ OBJECT_DECLARE_SIMPLE_TYPE(PnvPHB4, PNV_PHB4)#define PCI_MMIO_TOTAL_SIZE (0x1ull << 60)struct PnvPHB4 { -PCIExpressHost parent_obj; +DeviceState parent; + +PnvPHB *phb_base;uint32_t chip_id;uint32_t phb_id;
Signature · 1 line
2.37.2
[PULL 03/60] ppc/pnv: Add initial P9/10 SBE model
In reply to Daniel Henrique BarbozaFrom: Nicholas Piggin <[email protected]>
The SBE (Self Boot Engine) are on-chip microcontrollers that perform early boot steps, as well as provide some runtime facilities (e.g., timer, secure register access, MPIPL). The latter facilities are accessed mostly via a message system called SBEFIFO.
This driver provides initial emulation for the SBE runtime registers and a very basic SBEFIFO implementation that provides the timer command. This covers the basic SBE behaviour expected by skiboot when booting.
Message-Id: <[email protected]>
--- hw/ppc/meson.build | 1 + hw/ppc/pnv.c | 25 +++ hw/ppc/pnv_sbe.c | 414 +++++++++++++++++++++++++++++++++++++ hw/ppc/pnv_xscom.c | 3 + hw/ppc/trace-events | 11 + include/hw/ppc/pnv.h | 3 + include/hw/ppc/pnv_sbe.h | 55 +++++ include/hw/ppc/pnv_xscom.h | 12 ++ 8 files changed, 524 insertions(+) create mode 100644 hw/ppc/pnv_sbe.c create mode 100644 include/hw/ppc/pnv_sbe.h
hw/ppc/meson.build +1 -0
@@ -46,6 +46,7 @@ ppc_ss.add(when: 'CONFIG_POWERNV', if_true: files( 'pnv_lpc.c', 'pnv_psi.c', 'pnv_occ.c', + 'pnv_sbe.c', 'pnv_bmc.c', 'pnv_homer.c', 'pnv_pnor.c',
hw/ppc/pnv.c +25 -0
@@ -1397,6 +1397,8 @@ static void pnv_chip_power9_instance_init(Object *obj)object_initialize_child (obj,"occ" , &chip9->occ,TYPE_PNV9_OCC ); +object_initialize_child (obj,"sbe" , &chip9->sbe,TYPE_PNV9_SBE ); +object_initialize_child (obj,"homer" , &chip9->homer,TYPE_PNV9_HOMER );/* Number of PECs is the chip default */
@@ -1549,6 +1551,17 @@ static void pnv_chip_power9_realize(DeviceState *dev, Error **errp)memory_region_add_subregion (get_system_memory (),PNV9_OCC_SENSOR_BASE (chip), &chip9->occ.sram_regs); +/* SBE */ +if (!qdev_realize (DEVICE (&chip9->sbe),NULL , errp)) { +return ; + } +pnv_xscom_add_subregion (chip,PNV9_XSCOM_SBE_CTRL_BASE , + &chip9->sbe.xscom_ctrl_regs); +pnv_xscom_add_subregion (chip,PNV9_XSCOM_SBE_MBOX_BASE , + &chip9->sbe.xscom_mbox_regs); +qdev_connect_gpio_out (DEVICE (&chip9->sbe),0 ,qdev_get_gpio_in ( +DEVICE (&chip9->psi),PSIHB9_IRQ_PSU )); +/* HOMER */ object_property_set_link (OBJECT (&chip9->homer),"chip" ,OBJECT (chip), &error_abort);
@@ -1613,6 +1626,7 @@ static void pnv_chip_power10_instance_init(Object *obj)object_initialize_child (obj,"psi" , &chip10->psi,TYPE_PNV10_PSI );object_initialize_child (obj,"lpc" , &chip10->lpc,TYPE_PNV10_LPC );object_initialize_child (obj,"occ" , &chip10->occ,TYPE_PNV10_OCC ); +object_initialize_child (obj,"sbe" , &chip10->sbe,TYPE_PNV10_SBE );object_initialize_child (obj,"homer" , &chip10->homer,TYPE_PNV10_HOMER ); chip->num_pecs = pcc->num_pecs;
@@ -1754,6 +1768,17 @@ static void pnv_chip_power10_realize(DeviceState *dev, Error **errp)PNV10_OCC_SENSOR_BASE (chip), &chip10->occ.sram_regs); +/* SBE */ +if (!qdev_realize (DEVICE (&chip10->sbe),NULL , errp)) { +return ; + } +pnv_xscom_add_subregion (chip,PNV10_XSCOM_SBE_CTRL_BASE , + &chip10->sbe.xscom_ctrl_regs); +pnv_xscom_add_subregion (chip,PNV10_XSCOM_SBE_MBOX_BASE , + &chip10->sbe.xscom_mbox_regs); +qdev_connect_gpio_out (DEVICE (&chip10->sbe),0 ,qdev_get_gpio_in ( +DEVICE (&chip10->psi),PSIHB9_IRQ_PSU )); +/* HOMER */ object_property_set_link (OBJECT (&chip10->homer),"chip" ,OBJECT (chip), &error_abort);
hw/ppc/pnv_sbe.c new file +414 -0
414 lines not on this page · raw message
hw/ppc/pnv_xscom.c +3 -0
@@ -295,6 +295,9 @@ int pnv_dt_xscom(PnvChip *chip, void *fdt, int root_offset,_FDT ((fdt_setprop (fdt, xscom_offset,"reg" , reg,sizeof (reg))));_FDT ((fdt_setprop (fdt, xscom_offset,"compatible" , compat, compat_size)));_FDT ((fdt_setprop (fdt, xscom_offset,"scom-controller" ,NULL ,0 ))); +if (chip->chip_id ==0 ) { +_FDT ((fdt_setprop (fdt, xscom_offset,"primary" ,NULL ,0 ))); + } args.fdt = fdt; args.xscom_offset = xscom_offset;
hw/ppc/trace-events +11 -0
@@ -95,6 +95,17 @@ vof_write(uint32_t ih, unsigned cb, const char *msg) "ih=0x%x [%u] \"%s\"" vof_avail(uint64_t start, uint64_t end, uint64_t size) "0x%"PRIx64"..0x%"PRIx64" size=0x%"PRIx64 vof_claimed(uint64_t start, uint64_t end, uint64_t size) "0x%"PRIx64"..0x%"PRIx64" size=0x%"PRIx64 +# pnv_sbe.c +pnv_sbe_xscom_ctrl_read(uint64_t addr, uint64_t val) "addr 0x%" PRIx64 " val 0x%" PRIx64 +pnv_sbe_xscom_ctrl_write(uint64_t addr, uint64_t val) "addr 0x%" PRIx64 " val 0x%" PRIx64 +pnv_sbe_xscom_mbox_read(uint64_t addr, uint64_t val) "addr 0x%" PRIx64 " val 0x%" PRIx64 +pnv_sbe_xscom_mbox_write(uint64_t addr, uint64_t val) "addr 0x%" PRIx64 " val 0x%" PRIx64 +pnv_sbe_reg_set_host_doorbell(uint64_t val) "val 0x%" PRIx64 +pnv_sbe_cmd_timer_start(uint64_t ns) "ns 0x%" PRIu64 +pnv_sbe_cmd_timer_stop(void) "" +pnv_sbe_cmd_timer_expired(void) "" +pnv_sbe_msg_recv(uint16_t cmd, uint16_t seq, uint16_t ctrl_flags) "cmd 0x%" PRIx16 " seq %"PRIu16 " ctrl_flags 0x%" PRIx16 + # ppc.c ppc_tb_adjust(uint64_t offs1, uint64_t offs2, int64_t diff, int64_t seconds) "adjusted from 0x%"PRIx64" to 0x%"PRIx64", diff %"PRId64" (%"PRId64"s)" ppc_tb_load(uint64_t tb) "tb 0x%016" PRIx64
include/hw/ppc/pnv.h +3 -0
@@ -27,6 +27,7 @@#include "hw/ppc/pnv_pnor.h" #include "hw/ppc/pnv_psi.h" #include "hw/ppc/pnv_occ.h" +#include "hw/ppc/pnv_sbe.h" #include "hw/ppc/pnv_homer.h" #include "hw/ppc/pnv_xive.h" #include "hw/ppc/pnv_core.h"
@@ -100,6 +101,7 @@ struct Pnv9Chip {Pnv9Psi psi;PnvLpcController lpc;PnvOCC occ; +PnvSBE sbe;PnvHomer homer;uint32_t nr_quads;
@@ -129,6 +131,7 @@ struct Pnv10Chip {Pnv9Psi psi;PnvLpcController lpc;PnvOCC occ; +PnvSBE sbe;PnvHomer homer;uint32_t nr_quads;
include/hw/ppc/pnv_sbe.h new file +55 -0
55 lines not on this page · raw message
include/hw/ppc/pnv_xscom.h +12 -0
@@ -92,6 +92,12 @@ struct PnvXScomInterfaceClass {#define PNV9_XSCOM_OCC_BASE PNV_XSCOM_OCC_BASE#define PNV9_XSCOM_OCC_SIZE 0x8000 +#define PNV9_XSCOM_SBE_CTRL_BASE 0x00050008 +#define PNV9_XSCOM_SBE_CTRL_SIZE 0x1 + +#define PNV9_XSCOM_SBE_MBOX_BASE 0x000D0050 +#define PNV9_XSCOM_SBE_MBOX_SIZE 0x16 +#define PNV9_XSCOM_PBA_BASE 0x5012b00#define PNV9_XSCOM_PBA_SIZE 0x40
@@ -134,6 +140,12 @@ struct PnvXScomInterfaceClass {#define PNV10_XSCOM_OCC_BASE PNV9_XSCOM_OCC_BASE#define PNV10_XSCOM_OCC_SIZE PNV9_XSCOM_OCC_SIZE +#define PNV10_XSCOM_SBE_CTRL_BASE PNV9_XSCOM_SBE_CTRL_BASE +#define PNV10_XSCOM_SBE_CTRL_SIZE PNV9_XSCOM_SBE_CTRL_SIZE + +#define PNV10_XSCOM_SBE_MBOX_BASE PNV9_XSCOM_SBE_MBOX_BASE +#define PNV10_XSCOM_SBE_MBOX_SIZE PNV9_XSCOM_SBE_MBOX_SIZE +#define PNV10_XSCOM_PBA_BASE 0x01010CDA#define PNV10_XSCOM_PBA_SIZE 0x40
Signature · 1 line
2.37.2
[PULL 09/60] ppc/pnv: add PHB4 bus init helper
In reply to Daniel Henrique BarbozaSimilar to what we already did for the PnvPHB3 device, let's add a helper to init the bus when using a PnvPHB4. This helper will be used by PnvPHb when PnvPHB4 turns into a backend.
Message-Id: <[email protected]>
--- hw/pci-host/pnv_phb.c | 2 ++ hw/pci-host/pnv_phb4.c | 39 ++++++++++++++++++++-------------- include/hw/pci-host/pnv_phb4.h | 1 + 3 files changed, 26 insertions(+), 16 deletions(-)
hw/pci-host/pnv_phb.c +2 -0
@@ -69,6 +69,8 @@ static void pnv_phb_realize(DeviceState *dev, Error **errp)if (phb->version ==3 ) {pnv_phb3_bus_init (dev,PNV_PHB3 (phb->backend)); + }else { +pnv_phb4_bus_init (dev,PNV_PHB4 (phb->backend)); } pnv_phb_attach_root_port(pci, phb_rootport_typename,
hw/pci-host/pnv_phb4.c +23 -16
@@ -1528,30 +1528,16 @@ static void pnv_phb4_instance_init(Object *obj)object_initialize_child (obj,"source" , &phb->xsrc,TYPE_XIVE_SOURCE ); } -static void pnv_phb4_realize (DeviceState *dev,Error **errp) +void pnv_phb4_bus_init (DeviceState *dev,PnvPHB4 *phb) { -PnvPHB4 *phb =PNV_PHB4 (dev); -PnvPhb4PecClass *pecc =PNV_PHB4_PEC_GET_CLASS (phb->pec);PCIHostState *pci =PCI_HOST_BRIDGE (dev); -XiveSource *xsrc = &phb->xsrc; -int nr_irqs;char name[32 ]; -/* Set the "big_phb" flag */ - phb->big_phb = phb->phb_id ==0 || phb->phb_id ==3 ; - -/* Controller Registers */ -snprintf (name,sizeof (name),"phb4-%d.%d-regs" , phb->chip_id, - phb->phb_id); -memory_region_init_io (&phb->mr_regs,OBJECT (phb), &pnv_phb4_reg_ops, phb, - name,0x2000 ); -/* * PHB4 doesn't support IO space. However, qemu gets very upset if * we don't have an IO region to anchor IO BARs onto so we just * initialize one which we never hook up to anything */ -snprintf (name,sizeof (name),"phb4-%d.%d-pci-io" , phb->chip_id, phb->phb_id);memory_region_init (&phb->pci_io,OBJECT (phb), name,0x10000 );
@@ -1561,12 +1547,33 @@ static void pnv_phb4_realize(DeviceState *dev, Error **errp)memory_region_init (&phb->pci_mmio,OBJECT (phb), name,PCI_MMIO_TOTAL_SIZE ); - pci->bus =pci_register_root_bus (dev, dev->id, + pci->bus =pci_register_root_bus (dev, dev->id ? dev->id :NULL , pnv_phb4_set_irq, pnv_phb4_map_irq, phb, &phb->pci_mmio, &phb->pci_io,0 ,4 ,TYPE_PNV_PHB4_ROOT_BUS );pci_setup_iommu (pci->bus, pnv_phb4_dma_iommu, phb); pci->bus->flags |=PCI_BUS_EXTENDED_CONFIG_SPACE ; +} + +static void pnv_phb4_realize (DeviceState *dev,Error **errp) +{ +PnvPHB4 *phb =PNV_PHB4 (dev); +PnvPhb4PecClass *pecc =PNV_PHB4_PEC_GET_CLASS (phb->pec); +PCIHostState *pci =PCI_HOST_BRIDGE (dev); +XiveSource *xsrc = &phb->xsrc; +int nr_irqs; +char name[32 ]; + +/* Set the "big_phb" flag */ + phb->big_phb = phb->phb_id ==0 || phb->phb_id ==3 ; + +/* Controller Registers */ +snprintf (name,sizeof (name),"phb4-%d.%d-regs" , phb->chip_id, + phb->phb_id); +memory_region_init_io (&phb->mr_regs,OBJECT (phb), &pnv_phb4_reg_ops, phb, + name,0x2000 ); + +pnv_phb4_bus_init (dev, phb);/* Add a single Root port if running with defaults */ pnv_phb_attach_root_port(pci, pecc->rp_model,
include/hw/pci-host/pnv_phb4.h +1 -0
@@ -157,6 +157,7 @@ struct PnvPHB4 {void pnv_phb4_pic_print_info (PnvPHB4 *phb,Monitor *mon);int pnv_phb4_pec_get_phb_id (PnvPhb4PecState *pec,int stack_index); +void pnv_phb4_bus_init (DeviceState *dev,PnvPHB4 *phb);extern const MemoryRegionOps pnv_phb4_xscom_ops;/*
Signature · 1 line
2.37.2
[PULL 12/60] ppc/pnv: remove pnv-phb3-root-port
In reply to Daniel Henrique BarbozaThe unified pnv-phb-root-port can be used in its place. There is no ABI breakage in doing so because no official QEMU release introduced user creatable pnv-phb3-root-port devices.
Message-Id: <[email protected]>
--- hw/pci-host/pnv_phb.c | 2 +- hw/pci-host/pnv_phb3.c | 42 ---------------------------------- hw/ppc/pnv.c | 1 + include/hw/pci-host/pnv_phb3.h | 6 ----- 4 files changed, 2 insertions(+), 49 deletions(-)
hw/pci-host/pnv_phb.c +1 -1
@@ -34,7 +34,7 @@ static void pnv_phb_realize(DeviceState *dev, Error **errp)switch (phb->version) {case 3 : phb_typename =g_strdup (TYPE_PNV_PHB3 ); - phb_rootport_typename =g_strdup (TYPE_PNV_PHB3_ROOT_PORT ); + phb_rootport_typename =g_strdup (TYPE_PNV_PHB_ROOT_PORT );break ;case 4 : phb_typename =g_strdup (TYPE_PNV_PHB4 );
hw/pci-host/pnv_phb3.c +0 -42
51 lines not on this page · raw message
hw/ppc/pnv.c +1 -0
@@ -2129,6 +2129,7 @@ static void pnv_machine_power8_class_init(ObjectClass *oc, void *data)static GlobalProperty phb_compat[] = { {TYPE_PNV_PHB ,"version" ,"3" }, + {TYPE_PNV_PHB_ROOT_PORT ,"version" ,"3" }, }; mc->desc ="IBM PowerNV (Non-Virtualized) POWER8" ;
include/hw/pci-host/pnv_phb3.h +0 -6
@@ -108,12 +108,6 @@ struct PnvPBCQState {*/ #define TYPE_PNV_PHB3_ROOT_BUS "pnv-phb3-root" -#define TYPE_PNV_PHB3_ROOT_PORT "pnv-phb3-root-port" - -typedef struct PnvPHB3RootPort { -PCIESlot parent_obj; -}PnvPHB3RootPort ; -/* * PHB3 PCIe Host Bridge for PowerNV machines (POWER8) */
Signature · 1 line
2.37.2
[PULL 15/60] ppc/pnv: remove pecc->rp_model
In reply to Daniel Henrique BarbozaThe attribute is unused.
Message-Id: <[email protected]>
--- hw/pci-host/pnv_phb4_pec.c | 2 -- include/hw/pci-host/pnv_phb4.h | 1 - 2 files changed, 3 deletions(-)
hw/pci-host/pnv_phb4_pec.c +0 -2
@@ -260,7 +260,6 @@ static void pnv_pec_class_init(ObjectClass *klass, void *data) pecc->version =PNV_PHB4_VERSION ; pecc->phb_type =TYPE_PNV_PHB4 ; pecc->num_phbs = pnv_pec_num_phbs; - pecc->rp_model =TYPE_PNV_PHB_ROOT_PORT ; }static const TypeInfo pnv_pec_type_info = {
@@ -313,7 +312,6 @@ static void pnv_phb5_pec_class_init(ObjectClass *klass, void *data) pecc->version =PNV_PHB5_VERSION ; pecc->phb_type =TYPE_PNV_PHB5 ; pecc->num_phbs = pnv_phb5_pec_num_stacks; - pecc->rp_model =TYPE_PNV_PHB_ROOT_PORT ; }static const TypeInfo pnv_phb5_pec_type_info = {
include/hw/pci-host/pnv_phb4.h +0 -1
@@ -200,7 +200,6 @@ struct PnvPhb4PecClass {uint64_t version;const char *phb_type;const uint32_t *num_phbs; -const char *rp_model; };/*
Signature · 1 line
2.37.2
[PULL 05/60] target/ppc: Bugfix FP when OE/UE are set
In reply to Daniel Henrique BarbozaFrom: "Lucas Mateus Castro (alqotel)" <[email protected]>
When an overflow exception occurs and OE is set the intermediate result should be adjusted (by subtracting from the exponent) to avoid rounding to inf. The same applies to an underflow exceptionion and UE (but adding to the exponent). To do this set the fp_status.rebias_overflow when OE is set and fp_status.rebias_underflow when UE is set as the FPU will recalculate in case of a overflow/underflow if the according rebias* is set.
Message-Id: <[email protected]>
--- target/ppc/cpu.c | 2 ++ target/ppc/fpu_helper.c | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-)
target/ppc/cpu.c +2 -0
@@ -120,6 +120,8 @@ void ppc_store_fpscr(CPUPPCState *env, target_ulong val) val |=FP_FEX ; } env->fpscr = val; + env->fp_status.rebias_overflow = (FP_OE & env->fpscr) ? true : false; + env->fp_status.rebias_underflow = (FP_UE & env->fpscr) ? true : false;if (tcg_enabled ()) {fpscr_set_rounding_mode (env); }
target/ppc/fpu_helper.c +0 -2
@@ -348,7 +348,6 @@ static inline int float_overflow_excp(CPUPPCState *env)bool overflow_enabled = !!(env->fpscr &FP_OE );if (overflow_enabled) { -/* XXX: should adjust the result */ /* Update the floating-point enabled exception summary */ env->fpscr |=FP_FEX ;/* We must update the target FPR before raising the exception */
@@ -367,7 +366,6 @@ static inline void float_underflow_excp(CPUPPCState *env)/* Update the floating-point exception summary */ env->fpscr |=FP_FX ;if (env->fpscr &FP_UE ) { -/* XXX: should adjust the result */ /* Update the floating-point enabled exception summary */ env->fpscr |=FP_FEX ;/* We must update the target FPR before raising the exception */
Signature · 1 line
2.37.2
[PULL 13/60] ppc/pnv: remove pnv-phb4-root-port
In reply to Daniel Henrique BarbozaThe unified pnv-phb-root-port can be used instead. The phb4-root-port device isn't exposed to the user in any official QEMU release so there's no ABI breakage in removing it.
Message-Id: <[email protected]>
--- hw/pci-host/pnv_phb.c | 4 +- hw/pci-host/pnv_phb4.c | 85 ---------------------------------- hw/pci-host/pnv_phb4_pec.c | 4 +- hw/ppc/pnv.c | 2 + include/hw/pci-host/pnv_phb4.h | 9 ---- 5 files changed, 6 insertions(+), 98 deletions(-)
hw/pci-host/pnv_phb.c +2 -2
@@ -38,11 +38,11 @@ static void pnv_phb_realize(DeviceState *dev, Error **errp)break ;case 4 : phb_typename =g_strdup (TYPE_PNV_PHB4 ); - phb_rootport_typename =g_strdup (TYPE_PNV_PHB4_ROOT_PORT ); + phb_rootport_typename =g_strdup (TYPE_PNV_PHB_ROOT_PORT );break ;case 5 : phb_typename =g_strdup (TYPE_PNV_PHB5 ); - phb_rootport_typename =g_strdup (TYPE_PNV_PHB5_ROOT_PORT ); + phb_rootport_typename =g_strdup (TYPE_PNV_PHB_ROOT_PORT );break ;default :g_assert_not_reached ();
hw/pci-host/pnv_phb4.c +0 -85
94 lines not on this page · raw message
hw/pci-host/pnv_phb4_pec.c +2 -2
@@ -260,7 +260,7 @@ static void pnv_pec_class_init(ObjectClass *klass, void *data) pecc->version =PNV_PHB4_VERSION ; pecc->phb_type =TYPE_PNV_PHB4 ; pecc->num_phbs = pnv_pec_num_phbs; - pecc->rp_model =TYPE_PNV_PHB4_ROOT_PORT ; + pecc->rp_model =TYPE_PNV_PHB_ROOT_PORT ; }static const TypeInfo pnv_pec_type_info = {
@@ -313,7 +313,7 @@ static void pnv_phb5_pec_class_init(ObjectClass *klass, void *data) pecc->version =PNV_PHB5_VERSION ; pecc->phb_type =TYPE_PNV_PHB5 ; pecc->num_phbs = pnv_phb5_pec_num_stacks; - pecc->rp_model =TYPE_PNV_PHB5_ROOT_PORT ; + pecc->rp_model =TYPE_PNV_PHB_ROOT_PORT ; }static const TypeInfo pnv_phb5_pec_type_info = {
hw/ppc/pnv.c +2 -0
@@ -2153,6 +2153,7 @@ static void pnv_machine_power9_class_init(ObjectClass *oc, void *data)static GlobalProperty phb_compat[] = { {TYPE_PNV_PHB ,"version" ,"4" }, + {TYPE_PNV_PHB_ROOT_PORT ,"version" ,"4" }, }; mc->desc ="IBM PowerNV (Non-Virtualized) POWER9" ;
@@ -2177,6 +2178,7 @@ static void pnv_machine_power10_class_init(ObjectClass *oc, void *data)static GlobalProperty phb_compat[] = { {TYPE_PNV_PHB ,"version" ,"5" }, + {TYPE_PNV_PHB_ROOT_PORT ,"version" ,"5" }, }; mc->desc ="IBM PowerNV (Non-Virtualized) POWER10" ;
include/hw/pci-host/pnv_phb4.h +0 -9
@@ -45,16 +45,7 @@ typedef struct PnvPhb4DMASpace {QLIST_ENTRY (PnvPhb4DMASpace) list; } PnvPhb4DMASpace; -/* -* PHB4 PCIe Root port -*/ #define TYPE_PNV_PHB4_ROOT_BUS "pnv-phb4-root" -#define TYPE_PNV_PHB4_ROOT_PORT "pnv-phb4-root-port" -#define TYPE_PNV_PHB5_ROOT_PORT "pnv-phb5-root-port" - -typedef struct PnvPHB4RootPort { -PCIESlot parent_obj; -}PnvPHB4RootPort ;/* * PHB4 PCIe Host Bridge for PowerNV machines (POWER9)
Signature · 1 line
2.37.2
[PULL 14/60] ppc/pnv: remove root port name from pnv_phb_attach_root_port()
In reply to Daniel Henrique BarbozaWe support only a single root port, PNV_PHB_ROOT_PORT.
Message-Id: <[email protected]>
--- hw/pci-host/pnv_phb.c | 7 +------ hw/ppc/pnv.c | 9 +++++---- include/hw/ppc/pnv.h | 3 +-- 3 files changed, 7 insertions(+), 12 deletions(-)
hw/pci-host/pnv_phb.c +1 -6
@@ -24,7 +24,6 @@ static void pnv_phb_realize(DeviceState *dev, Error **errp)PnvPHB *phb =PNV_PHB (dev);PCIHostState *pci =PCI_HOST_BRIDGE (dev); g_autofree char *phb_typename = NULL; - g_autofree char *phb_rootport_typename = NULL;if (!phb->version) {error_setg (errp,"version not specified" );
@@ -34,15 +33,12 @@ static void pnv_phb_realize(DeviceState *dev, Error **errp)switch (phb->version) {case 3 : phb_typename =g_strdup (TYPE_PNV_PHB3 ); - phb_rootport_typename =g_strdup (TYPE_PNV_PHB_ROOT_PORT );break ;case 4 : phb_typename =g_strdup (TYPE_PNV_PHB4 ); - phb_rootport_typename =g_strdup (TYPE_PNV_PHB_ROOT_PORT );break ;case 5 : phb_typename =g_strdup (TYPE_PNV_PHB5 ); - phb_rootport_typename =g_strdup (TYPE_PNV_PHB_ROOT_PORT );break ;default :g_assert_not_reached ();
@@ -73,8 +69,7 @@ static void pnv_phb_realize(DeviceState *dev, Error **errp)pnv_phb4_bus_init (dev,PNV_PHB4 (phb->backend)); } -pnv_phb_attach_root_port (pci, phb_rootport_typename, - phb->phb_id, phb->chip_id); +pnv_phb_attach_root_port (pci, phb->phb_id, phb->chip_id); } static const char *pnv_phb_root_bus_path(PCIHostState *host_bridge,
hw/ppc/pnv.c +5 -4
@@ -1195,11 +1195,12 @@ static void pnv_chip_icp_realize(Pnv8Chip *chip8, Error **errp)* QOM id. 'chip_id' is going to be used as PCIE chassis for the * root port. */ -void pnv_phb_attach_root_port (PCIHostState *pci,const char *name, -int index,int chip_id) +void pnv_phb_attach_root_port (PCIHostState *pci,int index,int chip_id) { -PCIDevice *root =pci_new (PCI_DEVFN (0 ,0 ), name); - g_autofree char *default_id = g_strdup_printf("%s[%d]", name, index); +PCIDevice *root =pci_new (PCI_DEVFN (0 ,0 ),TYPE_PNV_PHB_ROOT_PORT ); + g_autofree char *default_id = g_strdup_printf("%s[%d]", +TYPE_PNV_PHB_ROOT_PORT , + index);const char *dev_id =DEVICE (root)->id; object_property_add_child(OBJECT(pci->bus), dev_id ? dev_id : default_id,
include/hw/ppc/pnv.h +1 -2
@@ -193,8 +193,7 @@ DECLARE_INSTANCE_CHECKER(PnvChip, PNV_CHIP_POWER10, TYPE_PNV_CHIP_POWER10) PowerPCCPU *pnv_chip_find_cpu(PnvChip *chip, uint32_t pir); -void pnv_phb_attach_root_port (PCIHostState *pci,const char *name, -int index,int chip_id); +void pnv_phb_attach_root_port (PCIHostState *pci,int index,int chip_id);#define TYPE_PNV_MACHINE MACHINE_TYPE_NAME("powernv")typedef struct PnvMachineClass PnvMachineClass ;
Signature · 1 line
2.37.2
[PULL 26/60] ppc/pnv: change pnv_phb4_get_pec() to also retrieve chip10->pecs
In reply to Daniel Henrique BarbozaThe function assumes that we're always dealing with a PNV9_CHIP() object. This is not the case when the pnv-phb device belongs to a powernv10 machine.
Change pnv_phb4_get_pec() to be able to work with PNV10_CHIP() if necessary.
Message-Id: <[email protected]>
--- hw/ppc/pnv.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-)
hw/ppc/pnv.c +15 -2
@@ -284,17 +284,30 @@ static void pnv_dt_icp(PnvChip *chip, void *fdt, uint32_t pir,static PnvPhb4PecState *pnv_phb4_get_pec (PnvChip *chip,PnvPHB4 *phb,Error **errp) { -Pnv9Chip *chip9 =PNV9_CHIP (chip); +PnvPHB *phb_base = phb->phb_base; +PnvPhb4PecState *pecs =NULL ;int chip_id = phb->chip_id;int index = phb->phb_id;int i, j; +if (phb_base->version ==4 ) { +Pnv9Chip *chip9 =PNV9_CHIP (chip); + + pecs = chip9->pecs; + }else if (phb_base->version ==5 ) { +Pnv10Chip *chip10 =PNV10_CHIP (chip); + + pecs = chip10->pecs; + }else { +g_assert_not_reached (); + } +for (i =0 ; i < chip->num_pecs; i++) {/* * For each PEC, check the amount of phbs it supports * and see if the given phb4 index matches an index. */ -PnvPhb4PecState *pec = &chip9->pecs[i]; +PnvPhb4PecState *pec = &pecs[i];for (j =0 ; j < pec->num_phbs; j++) {if (index ==pnv_phb4_pec_get_phb_id (pec, j)) {
Signature · 1 line
2.37.2
[PULL 06/60] ppc/pnv: add PHB3 bus init helper
In reply to Daniel Henrique BarbozaThe PnvPHB3 bus init consists of initializing the pci_io and pci_mmio regions, registering it via pci_register_root_bus() and then setup the iommu.
We'll want to init the bus from outside pnv_phb3.c when the bus is removed from the PnvPHB3 device and put into a new parent PnvPHB device. The new pnv_phb3_bus_init() helper will be used by the parent to init the bus when using the PHB3 backend.
Message-Id: <[email protected]>
--- hw/pci-host/pnv_phb3.c | 39 ++++++++++++++++++++-------------- include/hw/pci-host/pnv_phb3.h | 1 + 2 files changed, 24 insertions(+), 16 deletions(-)
hw/pci-host/pnv_phb3.c +23 -16
@@ -986,6 +986,28 @@ static void pnv_phb3_instance_init(Object *obj) } +void pnv_phb3_bus_init (DeviceState *dev,PnvPHB3 *phb) +{ +PCIHostState *pci =PCI_HOST_BRIDGE (dev); + +/* +* PHB3 doesn't support IO space. However, qemu gets very upset if +* we don't have an IO region to anchor IO BARs onto so we just +* initialize one which we never hook up to anything +*/ +memory_region_init (&phb->pci_io,OBJECT (phb),"pci-io" ,0x10000 ); +memory_region_init (&phb->pci_mmio,OBJECT (phb),"pci-mmio" , +PCI_MMIO_TOTAL_SIZE ); + + pci->bus =pci_register_root_bus (dev, + dev->id ? dev->id :NULL , + pnv_phb3_set_irq, pnv_phb3_map_irq, phb, + &phb->pci_mmio, &phb->pci_io, +0 ,4 ,TYPE_PNV_PHB3_ROOT_BUS ); + +pci_setup_iommu (pci->bus, pnv_phb3_dma_iommu, phb); +} +static void pnv_phb3_realize (DeviceState *dev,Error **errp) {PnvPHB3 *phb =PNV_PHB3 (dev);
@@ -1035,22 +1057,7 @@ static void pnv_phb3_realize(DeviceState *dev, Error **errp)memory_region_init_io (&phb->mr_regs,OBJECT (phb), &pnv_phb3_reg_ops, phb,"phb3-regs" ,0x1000 ); -/* -* PHB3 doesn't support IO space. However, qemu gets very upset if -* we don't have an IO region to anchor IO BARs onto so we just -* initialize one which we never hook up to anything -*/ -memory_region_init (&phb->pci_io,OBJECT (phb),"pci-io" ,0x10000 ); -memory_region_init (&phb->pci_mmio,OBJECT (phb),"pci-mmio" , -PCI_MMIO_TOTAL_SIZE ); - - pci->bus =pci_register_root_bus (dev, - dev->id ? dev->id :NULL , - pnv_phb3_set_irq, pnv_phb3_map_irq, phb, - &phb->pci_mmio, &phb->pci_io, -0 ,4 ,TYPE_PNV_PHB3_ROOT_BUS ); - -pci_setup_iommu (pci->bus, pnv_phb3_dma_iommu, phb); +pnv_phb3_bus_init (dev, phb);pnv_phb_attach_root_port (pci,TYPE_PNV_PHB3_ROOT_PORT , phb->phb_id, phb->chip_id);
include/hw/pci-host/pnv_phb3.h +1 -0
@@ -164,5 +164,6 @@ uint64_t pnv_phb3_reg_read(void *opaque, hwaddr off, unsigned size);void pnv_phb3_reg_write (void *opaque,hwaddr off,uint64_t val,unsigned size);void pnv_phb3_update_regions (PnvPHB3 *phb);void pnv_phb3_remap_irqs (PnvPHB3 *phb); +void pnv_phb3_bus_init (DeviceState *dev,PnvPHB3 *phb);#endif /* PCI_HOST_PNV_PHB3_H */
Signature · 1 line
2.37.2
[PULL 16/60] ppc/pnv: remove PnvPHB4.version
In reply to Daniel Henrique BarbozaIt's unused.
Message-Id: <[email protected]>
--- include/hw/pci-host/pnv_phb4.h | 2 -- 1 file changed, 2 deletions(-)
include/hw/pci-host/pnv_phb4.h +0 -2
@@ -77,8 +77,6 @@ struct PnvPHB4 {uint32_t chip_id;uint32_t phb_id; -uint64_t version; -/* The owner PEC */ PnvPhb4PecState *pec;
Signature · 1 line
2.37.2
[PULL 21/60] ppc/pnv: add helpers for pnv-phb user devices
In reply to Daniel Henrique Barbozapnv_parent_qom_fixup() and pnv_parent_bus_fixup() are versions of the helpers that were reverted by commit 9c10d86fee "ppc/pnv: Remove user-created PHB{3,4,5} devices". They are needed to amend the QOM and bus hierarchies of user created pnv-phbs, matching them with default pnv-phbs.
A new helper pnv_phb_user_device_init() is created to handle user-created devices setup. We're going to call it inside pnv_phb_realize() in case we're realizing an user created device. This will centralize all user device realated in a single spot, leaving the realize functions of the phb3/phb4 backends untouched.
Another helper called pnv_chip_add_phb() was added to handle the particularities of each chip version when adding a new PHB.
Message-Id: <[email protected]>
--- hw/pci-host/pnv_phb.c | 75 +++++++++++++++++++++++++++++++++++++++++++ hw/ppc/pnv.c | 20 ++++++++++++ include/hw/ppc/pnv.h | 1 + 3 files changed, 96 insertions(+)
hw/pci-host/pnv_phb.c +75 -0
@@ -18,6 +18,38 @@#include "hw/qdev-properties.h" #include "qom/object.h" + +/* +* Set the QOM parent of an object child. If the device state +* associated with the child has an id, use it as QOM id. Otherwise +* use object_typename[index] as QOM id. +*/ +static void pnv_parent_qom_fixup (Object *parent,Object *child,int index) +{ + g_autofree char *default_id = +g_strdup_printf ("%s[%d]" ,object_get_typename (child), index); +const char *dev_id =DEVICE (child)->id; + +if (child->parent == parent) { +return ; + } + +object_ref (child); +object_unparent (child); +object_property_add_child (parent, dev_id ? dev_id : default_id, child); +object_unref (child); +} + +static void pnv_parent_bus_fixup (DeviceState *parent,DeviceState *child, +Error **errp) +{ +BusState *parent_bus =qdev_get_parent_bus (parent); + +if (!qdev_set_parent_bus (child, parent_bus, errp)) { +return ; + } +} +/* * Attach a root port device. *
@@ -41,6 +73,39 @@ static void pnv_phb_attach_root_port(PCIHostState *pci)pci_realize_and_unref (root, pci->bus, &error_fatal); } +/* +* User created devices won't have the initial setup that default +* devices have. This setup consists of assigning a parent device +* (chip for PHB3, PEC for PHB4/5) that will be the QOM/bus parent +* of the PHB. +*/ +static bool pnv_phb_user_device_init (PnvPHB *phb,Error **errp) +{ +PnvMachineState *pnv =PNV_MACHINE (qdev_get_machine ()); +PnvChip *chip =pnv_get_chip (pnv, phb->chip_id); +Object *parent =NULL ; + +if (!chip) { +error_setg (errp,"invalid chip id: %d" , phb->chip_id); +return false; + } + + parent =pnv_chip_add_phb (chip, phb, errp); +if (!parent) { +return false; + } + +/* +* Reparent user created devices to the chip to build +* correctly the device tree. pnv_xscom_dt() needs every +* PHB to be a child of the chip to build the DT correctly. +*/ +pnv_parent_qom_fixup (parent,OBJECT (phb), phb->phb_id); +pnv_parent_bus_fixup (DEVICE (chip),DEVICE (phb), errp); + +return true; +} +static void pnv_phb_realize (DeviceState *dev,Error **errp) {PnvPHB *phb =PNV_PHB (dev);
@@ -74,6 +139,16 @@ static void pnv_phb_realize(DeviceState *dev, Error **errp)object_property_set_uint (phb->backend,"chip-id" , phb->chip_id, errp);object_property_set_link (phb->backend,"phb-base" ,OBJECT (phb), errp); +/* +* Handle user created devices. User devices will not have a +* pointer to a chip (PHB3) and a PEC (PHB4/5). +*/ +if (!phb->chip && !phb->pec) { +if (!pnv_phb_user_device_init (phb, errp)) { +return ; + } + } +if (phb->version ==3 ) {object_property_set_link (phb->backend,"chip" ,OBJECT (phb->chip), errp);
hw/ppc/pnv.c +20 -0
@@ -281,6 +281,26 @@ static void pnv_dt_icp(PnvChip *chip, void *fdt, uint32_t pir,g_free (reg); } +/* +* Adds a PnvPHB to the chip. Returns the parent obj of the +* PHB which varies with each version (phb version 3 is parented +* by the chip, version 4 and 5 are parented by the PEC +* device). +* +* TODO: for version 3 we're still parenting the PHB with the +* chip. We should parent with a (so far not implemented) +* PHB3 PEC device. +*/ +Object *pnv_chip_add_phb (PnvChip *chip,PnvPHB *phb,Error **errp) +{ +if (phb->version ==3 ) { +return OBJECT (chip); + }else { +/* phb4 support will be added later */ +return NULL ; + } +} +static void pnv_chip_power8_dt_populate (PnvChip *chip,void *fdt) {static const char compat[] ="ibm,power8-xscom\0ibm,xscom" ;
include/hw/ppc/pnv.h +1 -0
@@ -234,6 +234,7 @@ struct PnvMachineState { };PnvChip *pnv_get_chip (PnvMachineState *pnv,uint32_t chip_id); +Object *pnv_chip_add_phb (PnvChip *chip,PnvPHB *phb,Error **errp);#define PNV_FDT_ADDR 0x01000000#define PNV_TIMEBASE_FREQ 512000000ULL
Signature · 1 line
2.37.2
[PULL 31/60] ppc/ppc405: Introduce a PPC405 generic machine
In reply to Daniel Henrique BarbozaFrom: Cédric Le Goater <[email protected]>
We will use this machine as a base to define the ref405ep and possibly the PPC405 hotfoot board as found in the Linux kernel.
Message-Id: <[email protected]>
--- hw/ppc/ppc405_boards.c | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-)
hw/ppc/ppc405_boards.c +28 -3
@@ -50,6 +50,15 @@#define USE_FLASH_BIOS +#define TYPE_PPC405_MACHINE MACHINE_TYPE_NAME("ppc405") +OBJECT_DECLARE_SIMPLE_TYPE (Ppc405MachineState,PPC405_MACHINE ); + +struct Ppc405MachineState { +/* Private */ +MachineState parent_obj; +/* Public */ +}; +/*****************************************************************************/ /* PPC405EP reference board (IBM) */ /* Standalone board with:
@@ -332,18 +341,34 @@ static void ref405ep_class_init(ObjectClass *oc, void *data) mc->desc ="ref405ep" ; mc->init = ref405ep_init; - mc->default_ram_size =0x08000000 ; - mc->default_ram_id ="ef405ep.ram" ; }static const TypeInfo ref405ep_type = { .name =MACHINE_TYPE_NAME ("ref405ep" ), - .parent =TYPE_MACHINE , + .parent =TYPE_PPC405_MACHINE , .class_init = ref405ep_class_init, }; +static void ppc405_machine_class_init (ObjectClass *oc,void *data) +{ +MachineClass *mc =MACHINE_CLASS (oc); + + mc->desc ="PPC405 generic machine" ; + mc->default_ram_size =128 * MiB; + mc->default_ram_id ="ppc405.ram" ; +} + +static const TypeInfo ppc405_machine_type = { + .name =TYPE_PPC405_MACHINE , + .parent =TYPE_MACHINE , + .instance_size =sizeof (Ppc405MachineState), + .class_init = ppc405_machine_class_init, + .abstract = true, +}; +static void ppc405_machine_init (void ) { +type_register_static (&ppc405_machine_type);type_register_static (&ref405ep_type); }
Signature · 1 line
2.37.2
[PULL 08/60] ppc/pnv: turn PnvPHB3 into a PnvPHB backend
In reply to Daniel Henrique BarbozaWe need a handful of changes that needs to be done in a single swoop to turn PnvPHB3 into a PnvPHB backend.
In the PnvPHB3, since the PnvPHB device implements PCIExpressHost and will hold the PCI bus, change PnvPHB3 parent to TYPE_DEVICE. There are a couple of instances in pnv_phb3.c that needs to access the PCI bus, so a phb_base pointer is added to allow access to the parent PnvPHB. The PnvPHB3 root port will now be connected to a PnvPHB object.
In pnv.c, the powernv8 machine chip8 will now hold an array of PnvPHB objects. pnv_get_phb3_child() needs to be adapted to return the PnvPHB3 backend from the PnvPHB child. A global property is added in pnv_machine_power8_class_init() to ensure that all PnvPHBs are created with phb->version = 3.
After all these changes we're still able to boot a powernv8 machine with default settings. The real gain will come with user created PnvPHB devices, coming up next.
Message-Id: <[email protected]>
--- hw/pci-host/pnv_phb3.c | 27 +++++---------------------- hw/ppc/pnv.c | 21 +++++++++++++++------ include/hw/pci-host/pnv_phb3.h | 5 ++++- include/hw/ppc/pnv.h | 3 ++- 4 files changed, 26 insertions(+), 30 deletions(-)
hw/pci-host/pnv_phb3.c +5 -22
@@ -11,6 +11,7 @@#include "qapi/visitor.h" #include "qapi/error.h" #include "hw/pci-host/pnv_phb3_regs.h" +#include "hw/pci-host/pnv_phb.h" #include "hw/pci-host/pnv_phb3.h" #include "hw/pci/pcie_host.h" #include "hw/pci/pcie_port.h"
@@ -26,7 +27,7 @@static PCIDevice *pnv_phb3_find_cfg_dev (PnvPHB3 *phb) { -PCIHostState *pci =PCI_HOST_BRIDGE (phb); +PCIHostState *pci =PCI_HOST_BRIDGE (phb->phb_base);uint64_t addr = phb->regs[PHB_CONFIG_ADDRESS >>3 ];uint8_t bus, devfn;
@@ -590,7 +591,7 @@ void pnv_phb3_reg_write(void *opaque, hwaddr off, uint64_t val, unsigned size)uint64_t pnv_phb3_reg_read (void *opaque,hwaddr off,unsigned size) {PnvPHB3 *phb = opaque; -PCIHostState *pci =PCI_HOST_BRIDGE (phb); +PCIHostState *pci =PCI_HOST_BRIDGE (phb->phb_base);uint64_t val;if ((off &0xfffc ) ==PHB_CONFIG_DATA ) {
@@ -1011,7 +1012,6 @@ void pnv_phb3_bus_init(DeviceState *dev, PnvPHB3 *phb)static void pnv_phb3_realize (DeviceState *dev,Error **errp) {PnvPHB3 *phb =PNV_PHB3 (dev); -PCIHostState *pci =PCI_HOST_BRIDGE (dev);PnvMachineState *pnv =PNV_MACHINE (qdev_get_machine ());int i;
@@ -1056,11 +1056,6 @@ static void pnv_phb3_realize(DeviceState *dev, Error **errp)/* Controller Registers */ memory_region_init_io (&phb->mr_regs,OBJECT (phb), &pnv_phb3_reg_ops, phb,"phb3-regs" ,0x1000 ); - -pnv_phb3_bus_init (dev, phb); - -pnv_phb_attach_root_port (pci,TYPE_PNV_PHB3_ROOT_PORT , - phb->phb_id, phb->chip_id); }void pnv_phb3_update_regions (PnvPHB3 *phb)
@@ -1085,38 +1080,26 @@ void pnv_phb3_update_regions(PnvPHB3 *phb)pnv_phb3_check_all_m64s (phb); } -static const char *pnv_phb3_root_bus_path (PCIHostState *host_bridge, -PCIBus *rootbus) -{ -PnvPHB3 *phb =PNV_PHB3 (host_bridge); - -snprintf (phb->bus_path,sizeof (phb->bus_path),"00%02x:%02x" , - phb->chip_id, phb->phb_id); -return phb->bus_path; -} -static Property pnv_phb3_properties[] = {DEFINE_PROP_UINT32 ("index" , PnvPHB3, phb_id,0 ),DEFINE_PROP_UINT32 ("chip-id" , PnvPHB3, chip_id,0 ), DEFINE_PROP_LINK("chip", PnvPHB3, chip, TYPE_PNV_CHIP, PnvChip *), + DEFINE_PROP_LINK("phb-base", PnvPHB3, phb_base, TYPE_PNV_PHB, PnvPHB *),DEFINE_PROP_END_OF_LIST (), };static void pnv_phb3_class_init (ObjectClass *klass,void *data) { -PCIHostBridgeClass *hc =PCI_HOST_BRIDGE_CLASS (klass);DeviceClass *dc =DEVICE_CLASS (klass); - hc->root_bus_path = pnv_phb3_root_bus_path; dc->realize = pnv_phb3_realize;device_class_set_props (dc, pnv_phb3_properties); -set_bit (DEVICE_CATEGORY_BRIDGE , dc->categories); dc->user_creatable = false; }static const TypeInfo pnv_phb3_type_info = { .name =TYPE_PNV_PHB3 , - .parent =TYPE_PCIE_HOST_BRIDGE , + .parent =TYPE_DEVICE , .instance_size =sizeof (PnvPHB3), .class_init = pnv_phb3_class_init, .instance_init = pnv_phb3_instance_init,
hw/ppc/pnv.c +15 -6
@@ -43,6 +43,7 @@#include "hw/ipmi/ipmi.h" #include "target/ppc/mmu-hash64.h" #include "hw/pci/msi.h" +#include "hw/pci-host/pnv_phb.h" #include "hw/ppc/xics.h" #include "hw/qdev-properties.h"
@@ -660,7 +661,8 @@ static void pnv_chip_power8_pic_print_info(PnvChip *chip, Monitor *mon)ics_pic_print_info (&chip8->psi.ics, mon);for (i =0 ; i < chip8->num_phbs; i++) { -PnvPHB3 *phb3 = &chip8->phbs[i]; +PnvPHB *phb = &chip8->phbs[i]; +PnvPHB3 *phb3 =PNV_PHB3 (phb->backend);pnv_phb3_msi_pic_print_info (&phb3->msis, mon);ics_pic_print_info (&phb3->lsis, mon);
@@ -1149,7 +1151,7 @@ static void pnv_chip_power8_instance_init(Object *obj) chip8->num_phbs = pcc->num_phbs;for (i =0 ; i < chip8->num_phbs; i++) { -object_initialize_child (obj,"phb[*]" , &chip8->phbs[i],TYPE_PNV_PHB3 ); +object_initialize_child (obj,"phb[*]" , &chip8->phbs[i],TYPE_PNV_PHB ); } }
@@ -1287,9 +1289,9 @@ static void pnv_chip_power8_realize(DeviceState *dev, Error **errp)memory_region_add_subregion (get_system_memory (),PNV_HOMER_BASE (chip), &chip8->homer.regs); -/* PHB3 controllers */ +/* PHB controllers */ for (i =0 ; i < chip8->num_phbs; i++) { -PnvPHB3 *phb = &chip8->phbs[i]; +PnvPHB *phb = &chip8->phbs[i];object_property_set_int (OBJECT (phb),"index" , i, &error_fatal); object_property_set_int(OBJECT(phb), "chip-id", chip->chip_id,
@@ -1982,7 +1984,8 @@ static ICSState *pnv_ics_get(XICSFabric *xi, int irq) }for (j =0 ; j < chip8->num_phbs; j++) { -PnvPHB3 *phb3 = &chip8->phbs[j]; +PnvPHB *phb = &chip8->phbs[j]; +PnvPHB3 *phb3 =PNV_PHB3 (phb->backend);if (ics_valid_irq (&phb3->lsis, irq)) {return &phb3->lsis;
@@ -2020,7 +2023,8 @@ static void pnv_ics_resend(XICSFabric *xi)ics_resend (&chip8->psi.ics);for (j =0 ; j < chip8->num_phbs; j++) { -PnvPHB3 *phb3 = &chip8->phbs[j]; +PnvPHB *phb = &chip8->phbs[j]; +PnvPHB3 *phb3 =PNV_PHB3 (phb->backend);ics_resend (&phb3->lsis);ics_resend (ICS (&phb3->msis));
@@ -2120,8 +2124,13 @@ static void pnv_machine_power8_class_init(ObjectClass *oc, void *data)PnvMachineClass *pmc =PNV_MACHINE_CLASS (oc);static const char compat[] ="qemu,powernv8\0qemu,powernv\0ibm,powernv" ; +static GlobalProperty phb_compat[] = { + {TYPE_PNV_PHB ,"version" ,"3" }, + }; + mc->desc ="IBM PowerNV (Non-Virtualized) POWER8" ; mc->default_cpu_type =POWERPC_CPU_TYPE_NAME ("power8_v2.0" ); +compat_props_add (mc->compat_props, phb_compat,G_N_ELEMENTS (phb_compat)); xic->icp_get = pnv_icp_get; xic->ics_get = pnv_ics_get;
include/hw/pci-host/pnv_phb3.h +4 -1
@@ -14,6 +14,7 @@#include "hw/pci/pcie_port.h" #include "hw/ppc/xics.h" #include "qom/object.h" +#include "hw/pci-host/pnv_phb.h" typedef struct PnvPHB3 PnvPHB3 ;typedef struct PnvChip PnvChip ;
@@ -127,7 +128,9 @@ OBJECT_DECLARE_SIMPLE_TYPE(PnvPHB3, PNV_PHB3)#define PCI_MMIO_TOTAL_SIZE (0x1ull << 60)struct PnvPHB3 { -PCIExpressHost parent_obj; +DeviceState parent; + +PnvPHB *phb_base;uint32_t chip_id;uint32_t phb_id;
include/hw/ppc/pnv.h +2 -1
@@ -33,6 +33,7 @@#include "hw/ppc/pnv_core.h" #include "hw/pci-host/pnv_phb3.h" #include "hw/pci-host/pnv_phb4.h" +#include "hw/pci-host/pnv_phb.h" #include "qom/object.h" #define TYPE_PNV_CHIP "pnv-chip"
@@ -81,7 +82,7 @@ struct Pnv8Chip {PnvHomer homer;#define PNV8_CHIP_PHB3_MAX 4 -PnvPHB3 phbs[PNV8_CHIP_PHB3_MAX ]; +PnvPHB phbs[PNV8_CHIP_PHB3_MAX ];uint32_t num_phbs;XICSFabric *xics;
Signature · 1 line
2.37.2
[PULL 18/60] ppc/pnv: add phb-id/chip-id PnvPHB3RootBus properties
In reply to Daniel Henrique BarbozaWe rely on the phb-id and chip-id, which are PHB properties, to assign chassis and slot to the root port. For default devices this is no big
deal: the root port is being created under pnv_phb_realize() and the values are being passed on via the 'index' and 'chip-id' of the pnv_phb_attach_root_port() helper.
If we want to implement user created root ports we have a problem. The user created root port will not be aware of which PHB it belongs to, unless we're willing to violate QOM best practices and access the PHB via dev->parent_bus->parent. What we can do is to access the root bus parent bus.
Since we're already assigning the root port as QOM child of the bus, and the bus is initiated using PHB properties, let's add phb-id and chip-id as properties of the bus. This will allow us trivial access to them, for both user-created and default root ports, without doing anything too shady with QOM.
Message-Id: <[email protected]>
--- hw/pci-host/pnv_phb3.c | 50 ++++++++++++++++++++++++++++++++++ include/hw/pci-host/pnv_phb3.h | 9 +++++- 2 files changed, 58 insertions(+), 1 deletion(-)
hw/pci-host/pnv_phb3.c +50 -0
@@ -1006,6 +1006,11 @@ void pnv_phb3_bus_init(DeviceState *dev, PnvPHB3 *phb) &phb->pci_mmio, &phb->pci_io, 0, 4, TYPE_PNV_PHB3_ROOT_BUS); +object_property_set_int (OBJECT (pci->bus),"phb-id" , phb->phb_id, + &error_abort); +object_property_set_int (OBJECT (pci->bus),"chip-id" , phb->chip_id, + &error_abort); +pci_setup_iommu (pci->bus, pnv_phb3_dma_iommu, phb); }
@@ -1105,10 +1110,55 @@ static const TypeInfo pnv_phb3_type_info = { .instance_init = pnv_phb3_instance_init, }; +static void pnv_phb3_root_bus_get_prop (Object *obj,Visitor *v, +const char *name, +void *opaque,Error **errp) +{ +PnvPHB3RootBus *bus =PNV_PHB3_ROOT_BUS (obj); +uint64_t value =0 ; + +if (strcmp (name,"phb-id" ) ==0 ) { + value = bus->phb_id; + }else { + value = bus->chip_id; + } + +visit_type_size (v, name, &value, errp); +} + +static void pnv_phb3_root_bus_set_prop (Object *obj,Visitor *v, +const char *name, +void *opaque,Error **errp) + +{ +PnvPHB3RootBus *bus =PNV_PHB3_ROOT_BUS (obj); +uint64_t value; + +if (!visit_type_size (v, name, &value, errp)) { +return ; + } + +if (strcmp (name,"phb-id" ) ==0 ) { + bus->phb_id = value; + }else { + bus->chip_id = value; + } +} +static void pnv_phb3_root_bus_class_init (ObjectClass *klass,void *data) {BusClass *k =BUS_CLASS (klass); +object_class_property_add (klass,"phb-id" ,"int" , + pnv_phb3_root_bus_get_prop, + pnv_phb3_root_bus_set_prop, +NULL ,NULL ); + +object_class_property_add (klass,"chip-id" ,"int" , + pnv_phb3_root_bus_get_prop, + pnv_phb3_root_bus_set_prop, +NULL ,NULL ); +/* * PHB3 has only a single root complex. Enforce the limit on the * parent bus
include/hw/pci-host/pnv_phb3.h +8 -1
@@ -104,9 +104,16 @@ struct PnvPBCQState { };/* -* PHB3 PCIe Root port +* PHB3 PCIe Root Bus */ #define TYPE_PNV_PHB3_ROOT_BUS "pnv-phb3-root" +struct PnvPHB3RootBus { +PCIBus parent; + +uint32_t chip_id; +uint32_t phb_id; +}; +OBJECT_DECLARE_SIMPLE_TYPE (PnvPHB3RootBus,PNV_PHB3_ROOT_BUS )/* * PHB3 PCIe Host Bridge for PowerNV machines (POWER8)
Signature · 1 line
2.37.2
[PULL 23/60] ppc/pnv: enable user created pnv-phb for powernv8
In reply to Daniel Henrique BarbozaThe bulk of the work was already done by previous patches.
Use defaults_enabled() to determine whether we need to create the default devices or not.
Message-Id: <[email protected]>
--- hw/pci-host/pnv_phb.c | 9 +++++++-- hw/ppc/pnv.c | 32 ++++++++++++++++++-------------- 2 files changed, 25 insertions(+), 16 deletions(-)
hw/pci-host/pnv_phb.c +7 -2
@@ -17,6 +17,7 @@#include "hw/ppc/pnv.h" #include "hw/qdev-properties.h" #include "qom/object.h" +#include "sysemu/sysemu.h" /*
@@ -166,6 +167,10 @@ static void pnv_phb_realize(DeviceState *dev, Error **errp)pnv_phb4_bus_init (dev,PNV_PHB4 (phb->backend)); } +if (phb->version ==3 && !defaults_enabled ()) { +return ; + } +pnv_phb_attach_root_port (pci); }
@@ -201,7 +206,7 @@ static void pnv_phb_class_init(ObjectClass *klass, void *data) dc->realize = pnv_phb_realize;device_class_set_props (dc, pnv_phb_properties);set_bit (DEVICE_CATEGORY_BRIDGE , dc->categories); - dc->user_creatable = false; + dc->user_creatable = true; }static void pnv_phb_root_port_reset (DeviceState *dev)
@@ -292,7 +297,7 @@ static void pnv_phb_root_port_class_init(ObjectClass *klass, void *data)device_class_set_parent_reset (dc, pnv_phb_root_port_reset, &rpc->parent_reset); dc->reset = &pnv_phb_root_port_reset; - dc->user_creatable = false; + dc->user_creatable = true; k->vendor_id =PCI_VENDOR_ID_IBM ;/* device_id will be written during realize() */
hw/ppc/pnv.c +18 -14
@@ -1178,20 +1178,22 @@ static void pnv_chip_power8_instance_init(Object *obj)object_initialize_child (obj,"homer" , &chip8->homer,TYPE_PNV8_HOMER ); - chip8->num_phbs = pcc->num_phbs; - -for (i =0 ; i < chip8->num_phbs; i++) { -Object *phb =object_new (TYPE_PNV_PHB ); - -/* -* We need the chip to parent the PHB to allow the DT -* to build correctly (via pnv_xscom_dt()). -* -* TODO: the PHB should be parented by a PEC device that, at -* this moment, is not modelled powernv8/phb3. -*/ -object_property_add_child (obj,"phb[*]" , phb); - chip8->phbs[i] =PNV_PHB (phb); +if (defaults_enabled ()) { + chip8->num_phbs = pcc->num_phbs; + +for (i =0 ; i < chip8->num_phbs; i++) { +Object *phb =object_new (TYPE_PNV_PHB ); + +/* +* We need the chip to parent the PHB to allow the DT +* to build correctly (via pnv_xscom_dt()). +* +* TODO: the PHB should be parented by a PEC device that, at +* this moment, is not modelled powernv8/phb3. +*/ +object_property_add_child (obj,"phb[*]" , phb); + chip8->phbs[i] =PNV_PHB (phb); + } } }
@@ -2155,6 +2157,8 @@ static void pnv_machine_power8_class_init(ObjectClass *oc, void *data) pmc->compat = compat; pmc->compat_size =sizeof (compat); + +machine_class_allow_dynamic_sysbus_dev (mc,TYPE_PNV_PHB ); }static void pnv_machine_power9_class_init (ObjectClass *oc,void *data)
Signature · 1 line
2.37.2
[PULL 35/60] ppc/ppc405: Start QOMification of the SoC
In reply to Daniel Henrique BarbozaFrom: Cédric Le Goater <[email protected]>
This moves all the code previously done in the ppc405ep_init() routine under ppc405_soc_realize(). We can also adjust the number of banks now that we have control on ppc4xx_sdram_init().
Message-Id: <[email protected]>
--- hw/ppc/ppc405.h | 12 ++-- hw/ppc/ppc405_boards.c | 12 ++-- hw/ppc/ppc405_uc.c | 124 ++++++++++++++++++++--------------------- 3 files changed, 71 insertions(+), 77 deletions(-)
hw/ppc/ppc405.h +5 -7
@@ -73,9 +73,14 @@ struct Ppc405SoCState {/* Public */ MemoryRegion ram_banks[2 ];hwaddr ram_bases[2 ], ram_sizes[2 ]; +bool do_dram_init;MemoryRegion *dram_mr;hwaddr ram_size; + +uint32_t sysclk; +PowerPCCPU *cpu; +DeviceState *uic; };/* PowerPC 405 core */
@@ -84,11 +89,4 @@ ram_addr_t ppc405_set_bootinfo(CPUPPCState *env, ram_addr_t ram_size);void ppc4xx_plb_init (CPUPPCState *env);void ppc405_ebc_init (CPUPPCState *env); -PowerPCCPU *ppc405ep_init (MemoryRegion *address_space_mem, -MemoryRegion ram_memories[2 ], -hwaddr ram_bases[2 ], -hwaddr ram_sizes[2 ], -uint32_t sysclk,DeviceState **uicdev, -int do_init); -#endif /* PPC405_H */
hw/ppc/ppc405_boards.c +5 -7
@@ -237,9 +237,7 @@ static void ppc405_init(MachineState *machine)Ppc405MachineState *ppc405 =PPC405_MACHINE (machine);MachineClass *mc =MACHINE_GET_CLASS (machine);const char *kernel_filename = machine->kernel_filename; -PowerPCCPU *cpu;MemoryRegion *sysmem =get_system_memory (); -DeviceState *uicdev;if (machine->ram_size != mc->default_ram_size) {char *sz =size_to_str (mc->default_ram_size);
@@ -254,12 +252,12 @@ static void ppc405_init(MachineState *machine) machine->ram_size, &error_fatal);object_property_set_link (OBJECT (&ppc405->soc),"dram" ,OBJECT (machine->ram), &error_abort); +object_property_set_bool (OBJECT (&ppc405->soc),"dram-init" , + kernel_filename !=NULL , &error_abort); +object_property_set_uint (OBJECT (&ppc405->soc),"sys-clk" ,33333333 , + &error_abort);qdev_realize (DEVICE (&ppc405->soc),NULL , &error_fatal); - cpu =ppc405ep_init (sysmem, ppc405->soc.ram_banks, ppc405->soc.ram_bases, - ppc405->soc.ram_sizes, -33333333 , &uicdev, kernel_filename ==NULL ?0 :1 ); -/* allocate and load BIOS */ if (machine->firmware) {MemoryRegion *bios =g_new (MemoryRegion,1 );
@@ -315,7 +313,7 @@ static void ppc405_init(MachineState *machine)/* Load ELF kernel and rootfs.cpio */ }else if (kernel_filename && !machine->firmware) { -boot_from_kernel (machine, cpu); +boot_from_kernel (machine, ppc405->soc.cpu); } }
hw/ppc/ppc405_uc.c +61 -63
188 lines not on this page · raw message
Signature · 1 line
2.37.2
[PULL 20/60] ppc/pnv: set root port chassis and slot using Bus properties
In reply to Daniel Henrique BarbozaFor default root ports we have a way of accessing chassis and slot, before root_port_realize(), via pnv_phb_attach_root_port(). For the future user created root ports this won't be the case: we can't use this helper because we don't have access to the PHB phb-id/chip-id values.
In earlier patches we've added phb-id and chip-id to pnv-phb-root-bus objects. We're now able to use the bus to retrieve them. The bus is reachable for both user created and default devices, so we're changing all the code paths. This also allow us to validate these changes with the existing default devices.
Message-Id: <[email protected]>
--- hw/pci-host/pnv_phb.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-)
hw/pci-host/pnv_phb.c +16 -9
@@ -25,21 +25,19 @@* QOM id. 'chip_id' is going to be used as PCIE chassis for the * root port. */ -static void pnv_phb_attach_root_port (PCIHostState *pci,int index,int chip_id) +static void pnv_phb_attach_root_port (PCIHostState *pci) {PCIDevice *root =pci_new (PCI_DEVFN (0 ,0 ),TYPE_PNV_PHB_ROOT_PORT ); - g_autofree char *default_id = g_strdup_printf("%s[%d]", -TYPE_PNV_PHB_ROOT_PORT , - index);const char *dev_id =DEVICE (root)->id; + g_autofree char *default_id = NULL; +int index; + + index =object_property_get_int (OBJECT (pci->bus),"phb-id" , &error_fatal); + default_id =g_strdup_printf ("%s[%d]" ,TYPE_PNV_PHB_ROOT_PORT , index);object_property_add_child (OBJECT (pci->bus), dev_id ? dev_id : default_id,OBJECT (root)); -/* Set unique chassis/slot values for the root port */ -qdev_prop_set_uint8 (DEVICE (root),"chassis" , chip_id); -qdev_prop_set_uint16 (DEVICE (root),"slot" , index); -pci_realize_and_unref (root, pci->bus, &error_fatal); }
@@ -93,7 +91,7 @@ static void pnv_phb_realize(DeviceState *dev, Error **errp)pnv_phb4_bus_init (dev,PNV_PHB4 (phb->backend)); } -pnv_phb_attach_root_port (pci, phb->phb_id, phb->chip_id); +pnv_phb_attach_root_port (pci); } static const char *pnv_phb_root_bus_path(PCIHostState *host_bridge,
@@ -162,9 +160,18 @@ static void pnv_phb_root_port_realize(DeviceState *dev, Error **errp) {PCIERootPortClass *rpc =PCIE_ROOT_PORT_GET_CLASS (dev);PnvPHBRootPort *phb_rp =PNV_PHB_ROOT_PORT (dev); +PCIBus *bus =PCI_BUS (qdev_get_parent_bus (dev));PCIDevice *pci =PCI_DEVICE (dev);uint16_t device_id =0 ;Error *local_err =NULL ; +int chip_id, index; + + chip_id =object_property_get_int (OBJECT (bus),"chip-id" , &error_fatal); + index =object_property_get_int (OBJECT (bus),"phb-id" , &error_fatal); + +/* Set unique chassis/slot values for the root port */ +qdev_prop_set_uint8 (dev,"chassis" , chip_id); +qdev_prop_set_uint16 (dev,"slot" , index); rpc->parent_realize (dev, &local_err);if (local_err) {
Signature · 1 line
2.37.2
[PULL 17/60] ppc/pnv: move attach_root_port helper to pnv-phb.c
In reply to Daniel Henrique BarbozaThe helper is only used in this file.
Message-Id: <[email protected]>
--- hw/pci-host/pnv_phb.c | 24 ++++++++++++++++++++++++ hw/ppc/pnv.c | 25 ------------------------- include/hw/ppc/pnv.h | 1 - 3 files changed, 24 insertions(+), 26 deletions(-)
hw/pci-host/pnv_phb.c +24 -0
@@ -18,6 +18,30 @@#include "hw/qdev-properties.h" #include "qom/object.h" +/* +* Attach a root port device. +* +* 'index' will be used both as a PCIE slot value and to calculate +* QOM id. 'chip_id' is going to be used as PCIE chassis for the +* root port. +*/ +static void pnv_phb_attach_root_port (PCIHostState *pci,int index,int chip_id) +{ +PCIDevice *root =pci_new (PCI_DEVFN (0 ,0 ),TYPE_PNV_PHB_ROOT_PORT ); + g_autofree char *default_id = g_strdup_printf("%s[%d]", +TYPE_PNV_PHB_ROOT_PORT , + index); +const char *dev_id =DEVICE (root)->id; + +object_property_add_child (OBJECT (pci->bus), dev_id ? dev_id : default_id, +OBJECT (root)); + +/* Set unique chassis/slot values for the root port */ +qdev_prop_set_uint8 (DEVICE (root),"chassis" , chip_id); +qdev_prop_set_uint16 (DEVICE (root),"slot" , index); + +pci_realize_and_unref (root, pci->bus, &error_fatal); +}static void pnv_phb_realize (DeviceState *dev,Error **errp) {
hw/ppc/pnv.c +0 -25
@@ -1188,31 +1188,6 @@ static void pnv_chip_icp_realize(Pnv8Chip *chip8, Error **errp) } } -/* -* Attach a root port device. -* -* 'index' will be used both as a PCIE slot value and to calculate -* QOM id. 'chip_id' is going to be used as PCIE chassis for the -* root port. -*/ -void pnv_phb_attach_root_port (PCIHostState *pci,int index,int chip_id) -{ -PCIDevice *root =pci_new (PCI_DEVFN (0 ,0 ),TYPE_PNV_PHB_ROOT_PORT ); - g_autofree char *default_id = g_strdup_printf("%s[%d]", -TYPE_PNV_PHB_ROOT_PORT , - index); -const char *dev_id =DEVICE (root)->id; - -object_property_add_child (OBJECT (pci->bus), dev_id ? dev_id : default_id, -OBJECT (root)); - -/* Set unique chassis/slot values for the root port */ -qdev_prop_set_uint8 (DEVICE (root),"chassis" , chip_id); -qdev_prop_set_uint16 (DEVICE (root),"slot" , index); - -pci_realize_and_unref (root, pci->bus, &error_fatal); -} -static void pnv_chip_power8_realize (DeviceState *dev,Error **errp) {PnvChipClass *pcc =PNV_CHIP_GET_CLASS (dev);
include/hw/ppc/pnv.h +0 -1
@@ -193,7 +193,6 @@ DECLARE_INSTANCE_CHECKER(PnvChip, PNV_CHIP_POWER10, TYPE_PNV_CHIP_POWER10) PowerPCCPU *pnv_chip_find_cpu(PnvChip *chip, uint32_t pir); -void pnv_phb_attach_root_port (PCIHostState *pci,int index,int chip_id);#define TYPE_PNV_MACHINE MACHINE_TYPE_NAME("powernv")typedef struct PnvMachineClass PnvMachineClass ;
Signature · 1 line
2.37.2
[PULL 24/60] ppc/pnv: add PHB4 helpers for user created pnv-phb
In reply to Daniel Henrique BarbozaThe PHB4 backend relies on a link with the corresponding PEC element. This is trivial to do during machine_init() time for default devices, but not so much for user created ones.
pnv_phb4_get_pec() is a small variation of the function that was reverted by commit 9c10d86fee "ppc/pnv: Remove user-created PHB{3,4,5} devices". We'll use it to determine the appropriate PEC for a given user created pnv-phb that uses a PHB4 backend.
This is done during realize() time, in pnv_phb_user_device_init().
Message-Id: <[email protected]>
--- hw/ppc/pnv.c | 35 ++++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-)
hw/ppc/pnv.c +32 -3
@@ -281,6 +281,34 @@ static void pnv_dt_icp(PnvChip *chip, void *fdt, uint32_t pir,g_free (reg); } +static PnvPhb4PecState *pnv_phb4_get_pec (PnvChip *chip,PnvPHB4 *phb, +Error **errp) +{ +Pnv9Chip *chip9 =PNV9_CHIP (chip); +int chip_id = phb->chip_id; +int index = phb->phb_id; +int i, j; + +for (i =0 ; i < chip->num_pecs; i++) { +/* +* For each PEC, check the amount of phbs it supports +* and see if the given phb4 index matches an index. +*/ +PnvPhb4PecState *pec = &chip9->pecs[i]; + +for (j =0 ; j < pec->num_phbs; j++) { +if (index ==pnv_phb4_pec_get_phb_id (pec, j)) { +return pec; + } + } + } +error_setg (errp, +"pnv-phb4 chip-id %d index %d didn't match any existing PEC" , + chip_id, index); + +return NULL ; +} +/* * Adds a PnvPHB to the chip. Returns the parent obj of the * PHB which varies with each version (phb version 3 is parented
@@ -302,10 +330,11 @@ Object *pnv_chip_add_phb(PnvChip *chip, PnvPHB *phb, Error **errp) chip8->num_phbs++;return OBJECT (chip); - }else { -/* phb4 support will be added later */ -return NULL ; } + + phb->pec =pnv_phb4_get_pec (chip,PNV_PHB4 (phb->backend), errp); + +return OBJECT (phb->pec); }static void pnv_chip_power8_dt_populate (PnvChip *chip,void *fdt)
Signature · 1 line
2.37.2
[PULL 41/60] ppc/ppc405: QOM'ify GPIO
In reply to Daniel Henrique BarbozaFrom: Cédric Le Goater <[email protected]>
The GPIO controller is currently modeled as a simple SysBus device with a unique memory region.
Message-Id: <e95d7849f3768e1f9a2846c4b282392750678b3e.1660746880.git.balaton@eik.bme.hu>
--- hw/ppc/ppc405.h | 21 +++++++++++++++++++ hw/ppc/ppc405_uc.c | 50 ++++++++++++++++++++++----------------------- hw/ppc/trace-events | 1 - 3 files changed, 45 insertions(+), 27 deletions(-)
hw/ppc/ppc405.h +21 -0
@@ -63,6 +63,26 @@ struct ppc4xx_bd_info_t {uint32_t bi_iic_fast[2 ]; }; +/* GPIO */ +#define TYPE_PPC405_GPIO "ppc405-gpio" +OBJECT_DECLARE_SIMPLE_TYPE (Ppc405GpioState,PPC405_GPIO ); +struct Ppc405GpioState { +SysBusDevice parent_obj; + +MemoryRegion io; +uint32_t or; +uint32_t tcr; +uint32_t osrh; +uint32_t osrl; +uint32_t tsrh; +uint32_t tsrl; +uint32_t odr; +uint32_t ir; +uint32_t rr1; +uint32_t isr1h; +uint32_t isr1l; +}; +/* On Chip Memory */ #define TYPE_PPC405_OCM "ppc405-ocm"OBJECT_DECLARE_SIMPLE_TYPE (Ppc405OcmState,PPC405_OCM );
@@ -152,6 +172,7 @@ struct Ppc405SoCState {Ppc405CpcState cpc;Ppc405GptState gpt;Ppc405OcmState ocm; +Ppc405GpioState gpio; };/* PowerPC 405 core */
hw/ppc/ppc405_uc.c +24 -26
86 lines not on this page · raw message
hw/ppc/trace-events +0 -1
@@ -165,7 +165,6 @@ opba_init(uint64_t addr) "offet 0x%" PRIx64 ppc405_gpio_read(uint64_t addr, uint32_t size) "addr 0x%" PRIx64 " size %d" ppc405_gpio_write(uint64_t addr, uint32_t size, uint64_t val) "addr 0x%" PRIx64 " size %d = 0x%" PRIx64 -ppc405_gpio_init(uint64_t addr) "offet 0x%" PRIx64 ocm_update_mappings(uint32_t isarc, uint32_t isacntl, uint32_t dsarc, uint32_t dsacntl, uint32_t ocm_isarc, uint32_t ocm_isacntl, uint32_t ocm_dsarc, uint32_t ocm_dsacntl) "OCM update ISA 0x%08" PRIx32 " 0x%08" PRIx32 " (0x%08" PRIx32" 0x%08" PRIx32 ") DSA 0x%08" PRIx32 " 0x%08" PRIx32" (0x%08" PRIx32 " 0x%08" PRIx32 ")" ocm_map(const char* prefix, uint32_t isarc) "OCM map %s 0x%08" PRIx32
Signature · 1 line
2.37.2
[PULL 22/60] ppc/pnv: turn chip8->phbs[] into a PnvPHB* array
In reply to Daniel Henrique BarbozaWhen enabling user created PHBs (a change reverted by commit 9c10d86fee) we were handling PHBs created by default versus by the user in different manners. The only difference between these PHBs is that one will have a valid phb3->chip that is assigned during pnv_chip_power8_realize(), while the user created needs to search which chip it belongs to.
Aside from that there shouldn't be any difference. Making the default PHBs behave in line with the user created ones will make it easier to re-introduce them later on. It will also make the code easier to follow since we are dealing with them in equal manner.
The first step is to turn chip8->phbs[] into a PnvPHB3 pointer array. This will allow us to assign user created PHBs into it later on. The way we initilize the default case is now more in line with that would happen with the user created case: the object is created, parented by the chip because pnv_xscom_dt() relies on it, and then assigned to the array.
Message-Id: <[email protected]>
--- hw/ppc/pnv.c | 27 ++++++++++++++++++++++----- include/hw/ppc/pnv.h | 6 +++++- 2 files changed, 27 insertions(+), 6 deletions(-)
hw/ppc/pnv.c +22 -5
@@ -294,6 +294,13 @@ static void pnv_dt_icp(PnvChip *chip, void *fdt, uint32_t pir,Object *pnv_chip_add_phb (PnvChip *chip,PnvPHB *phb,Error **errp) {if (phb->version ==3 ) { +Pnv8Chip *chip8 =PNV8_CHIP (chip); + + phb->chip = chip; + + chip8->phbs[chip8->num_phbs] = phb; + chip8->num_phbs++; +return OBJECT (chip); }else {/* phb4 support will be added later */
@@ -681,7 +688,7 @@ static void pnv_chip_power8_pic_print_info(PnvChip *chip, Monitor *mon)ics_pic_print_info (&chip8->psi.ics, mon);for (i =0 ; i < chip8->num_phbs; i++) { -PnvPHB *phb = &chip8->phbs[i]; +PnvPHB *phb = chip8->phbs[i];PnvPHB3 *phb3 =PNV_PHB3 (phb->backend);pnv_phb3_msi_pic_print_info (&phb3->msis, mon);
@@ -1174,7 +1181,17 @@ static void pnv_chip_power8_instance_init(Object *obj) chip8->num_phbs = pcc->num_phbs;for (i =0 ; i < chip8->num_phbs; i++) { -object_initialize_child (obj,"phb[*]" , &chip8->phbs[i],TYPE_PNV_PHB ); +Object *phb =object_new (TYPE_PNV_PHB ); + +/* +* We need the chip to parent the PHB to allow the DT +* to build correctly (via pnv_xscom_dt()). +* +* TODO: the PHB should be parented by a PEC device that, at +* this moment, is not modelled powernv8/phb3. +*/ +object_property_add_child (obj,"phb[*]" , phb); + chip8->phbs[i] =PNV_PHB (phb); } }
@@ -1290,7 +1307,7 @@ static void pnv_chip_power8_realize(DeviceState *dev, Error **errp)/* PHB controllers */ for (i =0 ; i < chip8->num_phbs; i++) { -PnvPHB *phb = &chip8->phbs[i]; +PnvPHB *phb = chip8->phbs[i];object_property_set_int (OBJECT (phb),"index" , i, &error_fatal); object_property_set_int(OBJECT(phb), "chip-id", chip->chip_id,
@@ -1983,7 +2000,7 @@ static ICSState *pnv_ics_get(XICSFabric *xi, int irq) }for (j =0 ; j < chip8->num_phbs; j++) { -PnvPHB *phb = &chip8->phbs[j]; +PnvPHB *phb = chip8->phbs[j];PnvPHB3 *phb3 =PNV_PHB3 (phb->backend);if (ics_valid_irq (&phb3->lsis, irq)) {
@@ -2022,7 +2039,7 @@ static void pnv_ics_resend(XICSFabric *xi)ics_resend (&chip8->psi.ics);for (j =0 ; j < chip8->num_phbs; j++) { -PnvPHB *phb = &chip8->phbs[j]; +PnvPHB *phb = chip8->phbs[j];PnvPHB3 *phb3 =PNV_PHB3 (phb->backend);ics_resend (&phb3->lsis);
include/hw/ppc/pnv.h +5 -1
@@ -82,7 +82,11 @@ struct Pnv8Chip {PnvHomer homer;#define PNV8_CHIP_PHB3_MAX 4 -PnvPHB phbs[PNV8_CHIP_PHB3_MAX ]; +/* +* The array is used to allow quick access to the phbs by +* pnv_ics_get_child() and pnv_ics_resend_child(). +*/ +PnvPHB *phbs[PNV8_CHIP_PHB3_MAX ];uint32_t num_phbs;XICSFabric *xics;
Signature · 1 line
2.37.2
[PULL 19/60] ppc/pnv: add phb-id/chip-id PnvPHB4RootBus properties
In reply to Daniel Henrique BarbozaThe same rationale provided in the PHB3 bus case applies here.
Note: we could have merged both buses in a single object, like we did with the root ports, and spare some boilerplate. The reason we opted to preserve both buses objects is twofold:
- there's not user side advantage in doing so. Unifying the root ports presents a clear user QOL change when we enable user created devices back. The buses objects, aside from having a different QOM name, is transparent to the user;
- we leave a door opened in case we want to increase the root port limit for phb4/5 later on without having to deal with phb3 code.
Message-Id: <[email protected]>
--- hw/pci-host/pnv_phb4.c | 51 ++++++++++++++++++++++++++++++++++ include/hw/pci-host/pnv_phb4.h | 10 +++++++ 2 files changed, 61 insertions(+)
hw/pci-host/pnv_phb4.c +51 -0
@@ -1551,6 +1551,12 @@ void pnv_phb4_bus_init(DeviceState *dev, PnvPHB4 *phb) pnv_phb4_set_irq, pnv_phb4_map_irq, phb, &phb->pci_mmio, &phb->pci_io, 0, 4, TYPE_PNV_PHB4_ROOT_BUS); + +object_property_set_int (OBJECT (pci->bus),"phb-id" , phb->phb_id, + &error_abort); +object_property_set_int (OBJECT (pci->bus),"chip-id" , phb->chip_id, + &error_abort); +pci_setup_iommu (pci->bus, pnv_phb4_dma_iommu, phb); pci->bus->flags |=PCI_BUS_EXTENDED_CONFIG_SPACE ; }
@@ -1708,10 +1714,55 @@ static const TypeInfo pnv_phb5_type_info = { .instance_size = sizeof(PnvPHB4), }; +static void pnv_phb4_root_bus_get_prop (Object *obj,Visitor *v, +const char *name, +void *opaque,Error **errp) +{ +PnvPHB4RootBus *bus =PNV_PHB4_ROOT_BUS (obj); +uint64_t value =0 ; + +if (strcmp (name,"phb-id" ) ==0 ) { + value = bus->phb_id; + }else { + value = bus->chip_id; + } + +visit_type_size (v, name, &value, errp); +} + +static void pnv_phb4_root_bus_set_prop (Object *obj,Visitor *v, +const char *name, +void *opaque,Error **errp) + +{ +PnvPHB4RootBus *bus =PNV_PHB4_ROOT_BUS (obj); +uint64_t value; + +if (!visit_type_size (v, name, &value, errp)) { +return ; + } + +if (strcmp (name,"phb-id" ) ==0 ) { + bus->phb_id = value; + }else { + bus->chip_id = value; + } +} +static void pnv_phb4_root_bus_class_init (ObjectClass *klass,void *data) {BusClass *k =BUS_CLASS (klass); +object_class_property_add (klass,"phb-id" ,"int" , + pnv_phb4_root_bus_get_prop, + pnv_phb4_root_bus_set_prop, +NULL ,NULL ); + +object_class_property_add (klass,"chip-id" ,"int" , + pnv_phb4_root_bus_get_prop, + pnv_phb4_root_bus_set_prop, +NULL ,NULL ); +/* * PHB4 has only a single root complex. Enforce the limit on the * parent bus
include/hw/pci-host/pnv_phb4.h +10 -0
@@ -45,7 +45,17 @@ typedef struct PnvPhb4DMASpace {QLIST_ENTRY (PnvPhb4DMASpace) list; } PnvPhb4DMASpace; +/* +* PHB4 PCIe Root Bus +*/ #define TYPE_PNV_PHB4_ROOT_BUS "pnv-phb4-root" +struct PnvPHB4RootBus { +PCIBus parent; + +uint32_t chip_id; +uint32_t phb_id; +}; +OBJECT_DECLARE_SIMPLE_TYPE (PnvPHB4RootBus,PNV_PHB4_ROOT_BUS )/* * PHB4 PCIe Host Bridge for PowerNV machines (POWER9)
Signature · 1 line
2.37.2
[PULL 28/60] ppc/pnv: consolidate pnv_parent_*_fixup() helpers
In reply to Daniel Henrique BarbozaWe have 2 helpers that amends the QOM and parent bus of a given object, repectively. These 2 helpers are called together, and not by accident. Due to QOM internals, doing an object_unparent() will result in the device being removed from its parent bus. This means that changing the QOM parent requires reassigning the parent bus again.
Create a single helper called pnv_parent_fixup(), documenting some of the QOM specifics that we're dealing with the unparenting/parenting mechanics, and handle both the QOM and the parent bus assignment.
Next patch will make use of this function to handle a case where we need to change the QOM parent while keeping the same parent bus assigned beforehand.
Message-Id: <[email protected]>
--- hw/pci-host/pnv_phb.c | 43 ++++++++++++++++++++++++++++--------------- 1 file changed, 28 insertions(+), 15 deletions(-)
hw/pci-host/pnv_phb.c +28 -15
@@ -21,34 +21,45 @@/* -* Set the QOM parent of an object child. If the device state -* associated with the child has an id, use it as QOM id. Otherwise -* use object_typename[index] as QOM id. +* Set the QOM parent and parent bus of an object child. If the device +* state associated with the child has an id, use it as QOM id. +* Otherwise use object_typename[index] as QOM id. +* +* This helper does both operations at the same time because seting +* a new QOM child will erase the bus parent of the device. This happens +* because object_unparent() will call object_property_del_child(), +* which in turn calls the property release callback prop->release if +* it's defined. In our case this callback is set to +* object_finalize_child_property(), which was assigned during the +* first object_property_add_child() call. This callback will end up +* calling device_unparent(), and this function removes the device +* from its parent bus. +* +* The QOM and parent bus to be set aren´t necessarily related, so +* let's receive both as arguments. */ -static void pnv_parent_qom_fixup (Object *parent,Object *child,int index) +static bool pnv_parent_fixup (Object *parent,BusState *parent_bus, +Object *child,int index, +Error **errp) { g_autofree char *default_id =g_strdup_printf ("%s[%d]" ,object_get_typename (child), index);const char *dev_id =DEVICE (child)->id;if (child->parent == parent) { -return ; +return true; }object_ref (child);object_unparent (child);object_property_add_child (parent, dev_id ? dev_id : default_id, child);object_unref (child); -} - -static void pnv_parent_bus_fixup (DeviceState *parent,DeviceState *child, -Error **errp) -{ -BusState *parent_bus =qdev_get_parent_bus (parent); -if (!qdev_set_parent_bus (child, parent_bus, errp)) { -return ; +if (!qdev_set_parent_bus (DEVICE (child), parent_bus, errp)) { +return false; } + +return true; }/*
@@ -101,8 +112,10 @@ static bool pnv_phb_user_device_init(PnvPHB *phb, Error **errp)* correctly the device tree. pnv_xscom_dt() needs every * PHB to be a child of the chip to build the DT correctly. */ -pnv_parent_qom_fixup (parent,OBJECT (phb), phb->phb_id); -pnv_parent_bus_fixup (DEVICE (chip),DEVICE (phb), errp); +if (!pnv_parent_fixup (parent,qdev_get_parent_bus (DEVICE (chip)), +OBJECT (phb), phb->phb_id, errp)) { +return false; + }return true; }
Signature · 1 line
2.37.2
[PULL 43/60] ppc/ppc405: QOM'ify EBC
In reply to Daniel Henrique BarbozaFrom: Cédric Le Goater <[email protected]>
EBC is currently modeled as a DCR device. Also drop the ppc405_ebc_init() helper and adapt the sam460ex machine.
Message-Id: <51a0769ab605c5158f4f2f1c896725d5fe7a073b.1660746880.git.balaton@eik.bme.hu>
--- hw/ppc/ppc405.h | 17 ++++++++++++- hw/ppc/ppc405_uc.c | 62 ++++++++++++++++++++++++---------------------- hw/ppc/sam460ex.c | 4 ++- 3 files changed, 51 insertions(+), 32 deletions(-)
hw/ppc/ppc405.h +16 -1
@@ -63,6 +63,21 @@ struct ppc4xx_bd_info_t {uint32_t bi_iic_fast[2 ]; }; +/* Peripheral controller */ +#define TYPE_PPC405_EBC "ppc405-ebc" +OBJECT_DECLARE_SIMPLE_TYPE (Ppc405EbcState,PPC405_EBC ); +struct Ppc405EbcState { +Ppc4xxDcrDeviceState parent_obj; + +uint32_t addr; +uint32_t bcr[8 ]; +uint32_t bap[8 ]; +uint32_t bear; +uint32_t besr0; +uint32_t besr1; +uint32_t cfg; +}; +/* DMA controller */ #define TYPE_PPC405_DMA "ppc405-dma"OBJECT_DECLARE_SIMPLE_TYPE (Ppc405DmaState,PPC405_DMA );
@@ -192,12 +207,12 @@ struct Ppc405SoCState {Ppc405OcmState ocm;Ppc405GpioState gpio;Ppc405DmaState dma; + Ppc405EbcState ebc; };/* PowerPC 405 core */ ram_addr_t ppc405_set_bootinfo (CPUPPCState *env,ram_addr_t ram_size);void ppc4xx_plb_init (CPUPPCState *env); -void ppc405_ebc_init (CPUPPCState *env);#endif /* PPC405_H */
hw/ppc/ppc405_uc.c +32 -30
118 lines not on this page · raw message
hw/ppc/sam460ex.c +3 -1
@@ -371,7 +371,9 @@ static void sam460ex_init(MachineState *machine) qdev_get_gpio_in(uic[0], 3));/* External bus controller */ -ppc405_ebc_init (env); + dev =qdev_new (TYPE_PPC405_EBC ); +ppc4xx_dcr_realize (PPC4xx_DCR_DEVICE (dev), cpu, &error_fatal); +object_unref (OBJECT (dev));/* CPR */ ppc4xx_cpr_init (env);
Signature · 1 line
2.37.2
[PULL 25/60] ppc/pnv: enable user created pnv-phb for powernv9
In reply to Daniel Henrique BarbozaEnable pnv-phb user created devices for powernv9 now that we have everything in place.
Message-Id: <[email protected]>
--- hw/pci-host/pnv_phb.c | 2 +- hw/pci-host/pnv_phb4_pec.c | 6 ++++-- hw/ppc/pnv.c | 2 ++ 3 files changed, 7 insertions(+), 3 deletions(-)
hw/pci-host/pnv_phb.c +1 -1
@@ -167,7 +167,7 @@ static void pnv_phb_realize(DeviceState *dev, Error **errp)pnv_phb4_bus_init (dev,PNV_PHB4 (phb->backend)); } -if (phb->version ==3 && !defaults_enabled ()) { +if (!defaults_enabled ()) {return ; }
hw/pci-host/pnv_phb4_pec.c +4 -2
@@ -146,8 +146,10 @@ static void pnv_pec_realize(DeviceState *dev, Error **errp) pec->num_phbs = pecc->num_phbs[pec->index];/* Create PHBs if running with defaults */ -for (i =0 ; i < pec->num_phbs; i++) { -pnv_pec_default_phb_realize (pec, i, errp); +if (defaults_enabled ()) { +for (i =0 ; i < pec->num_phbs; i++) { +pnv_pec_default_phb_realize (pec, i, errp); + } }/* Initialize the XSCOM regions for the PEC registers */
hw/ppc/pnv.c +2 -0
@@ -2213,6 +2213,8 @@ static void pnv_machine_power9_class_init(ObjectClass *oc, void *data) pmc->compat = compat; pmc->compat_size =sizeof (compat); pmc->dt_power_mgt = pnv_dt_power_mgt; + +machine_class_allow_dynamic_sysbus_dev (mc,TYPE_PNV_PHB ); }static void pnv_machine_power10_class_init (ObjectClass *oc,void *data)
Signature · 1 line
2.37.2
[PULL 29/60] ppc/pnv: fix QOM parenting of user creatable root ports
In reply to Daniel Henrique BarbozaUser creatable root ports are being parented by the 'peripheral' or the 'peripheral-anon' container. This happens because this is the regular QOM schema for sysbus devices that are added via the command line.
Let's make this QOM hierarchy similar to what we have with default root ports, i.e. the root port must be parented by the pnv-root-bus. To do that we change the qom and bus parent of the root port during root_port_realize(). The realize() is shared by the default root port code path, so we can remove the code inside pnv_phb_attach_root_port() that was adding the root port as a child of the bus as well.
After all that, remove pnv_phb_attach_root_port() and create the root port explictly in the 'default_enabled()' case of pnv_phb_realize().
Message-Id: <[email protected]>
--- hw/pci-host/pnv_phb.c | 47 ++++++++++++++++++------------------------- 1 file changed, 20 insertions(+), 27 deletions(-)
hw/pci-host/pnv_phb.c +20 -27
@@ -62,29 +62,6 @@ static bool pnv_parent_fixup(Object *parent, BusState *parent_bus,return true; } -/* -* Attach a root port device. -* -* 'index' will be used both as a PCIE slot value and to calculate -* QOM id. 'chip_id' is going to be used as PCIE chassis for the -* root port. -*/ -static void pnv_phb_attach_root_port (PCIHostState *pci) -{ -PCIDevice *root =pci_new (PCI_DEVFN (0 ,0 ),TYPE_PNV_PHB_ROOT_PORT ); -const char *dev_id =DEVICE (root)->id; - g_autofree char *default_id = NULL; -int index; - - index =object_property_get_int (OBJECT (pci->bus),"phb-id" , &error_fatal); - default_id =g_strdup_printf ("%s[%d]" ,TYPE_PNV_PHB_ROOT_PORT , index); - -object_property_add_child (OBJECT (pci->bus), dev_id ? dev_id : default_id, -OBJECT (root)); - -pci_realize_and_unref (root, pci->bus, &error_fatal); -} -/* * User created devices won't have the initial setup that default * devices have. This setup consists of assigning a parent device
@@ -180,11 +157,11 @@ static void pnv_phb_realize(DeviceState *dev, Error **errp)pnv_phb4_bus_init (dev,PNV_PHB4 (phb->backend)); } -if (!defaults_enabled ()) { -return ; - } +if (defaults_enabled ()) { +PCIDevice *root =pci_new (PCI_DEVFN (0 ,0 ),TYPE_PNV_PHB_ROOT_PORT ); -pnv_phb_attach_root_port (pci); +pci_realize_and_unref (root, pci->bus, errp); + } } static const char *pnv_phb_root_bus_path(PCIHostState *host_bridge,
@@ -259,6 +236,11 @@ static void pnv_phb_root_port_realize(DeviceState *dev, Error **errp)Error *local_err =NULL ;int chip_id, index; +/* +* 'index' will be used both as a PCIE slot value and to calculate +* QOM id. 'chip_id' is going to be used as PCIE chassis for the +* root port. +*/ chip_id =object_property_get_int (OBJECT (bus),"chip-id" , &error_fatal); index =object_property_get_int (OBJECT (bus),"phb-id" , &error_fatal);
@@ -266,6 +248,17 @@ static void pnv_phb_root_port_realize(DeviceState *dev, Error **errp)qdev_prop_set_uint8 (dev,"chassis" , chip_id);qdev_prop_set_uint16 (dev,"slot" , index); +/* +* User created root ports are QOM parented to one of +* the peripheral containers but it's already at the right +* parent bus. Change the QOM parent to be the same as the +* parent bus it's already assigned to. +*/ +if (!pnv_parent_fixup (OBJECT (bus),BUS (bus),OBJECT (dev), + index, errp)) { +return ; + } + rpc->parent_realize (dev, &local_err);if (local_err) {error_propagate (errp, local_err);
Signature · 1 line
2.37.2
[PULL 45/60] ppc/ppc405: QOM'ify POB
In reply to Daniel Henrique BarbozaFrom: Cédric Le Goater <[email protected]>
POB is currently modeled as a simple DCR device.
Message-Id: <2bb1a89182523059ecb0e8d20c22a293534dec17.1660746880.git.balaton@eik.bme.hu>
--- hw/ppc/ppc405.h | 12 ++++++++++ hw/ppc/ppc405_uc.c | 56 ++++++++++++++++++++++++++-------------------- 2 files changed, 44 insertions(+), 24 deletions(-)
hw/ppc/ppc405.h +12 -0
@@ -63,6 +63,17 @@ struct ppc4xx_bd_info_t {uint32_t bi_iic_fast[2 ]; }; +/* PLB to OPB bridge */ +#define TYPE_PPC405_POB "ppc405-pob" +OBJECT_DECLARE_SIMPLE_TYPE (Ppc405PobState,PPC405_POB ); +struct Ppc405PobState { +Ppc4xxDcrDeviceState parent_obj; + +uint32_t bear; +uint32_t besr0; +uint32_t besr1; +}; +/* OPB arbitrer */ #define TYPE_PPC405_OPBA "ppc405-opba"OBJECT_DECLARE_SIMPLE_TYPE (Ppc405OpbaState,PPC405_OPBA );
@@ -220,6 +231,7 @@ struct Ppc405SoCState {Ppc405DmaState dma;Ppc405EbcState ebc;Ppc405OpbaState opba; +Ppc405PobState pob; };/* PowerPC 405 core */
hw/ppc/ppc405_uc.c +32 -24
107 lines not on this page · raw message
Signature · 1 line
2.37.2
[PULL 33/60] ppc/ppc405: Move SRAM under the ref405ep machine
In reply to Daniel Henrique BarbozaFrom: Cédric Le Goater <[email protected]>
It doesn't belong to the generic machine nor the SoC. Fix a typo in the name while we are at it.
Message-Id: <[email protected]>
--- hw/ppc/ppc405_boards.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
hw/ppc/ppc405_boards.c +6 -6
@@ -235,7 +235,6 @@ static void ppc405_init(MachineState *machine)MachineClass *mc =MACHINE_GET_CLASS (machine);const char *kernel_filename = machine->kernel_filename;PowerPCCPU *cpu; -MemoryRegion *sram =g_new (MemoryRegion,1 );MemoryRegion *ram_memories =g_new (MemoryRegion,2 );hwaddr ram_bases[2 ], ram_sizes[2 ];MemoryRegion *sysmem =get_system_memory ();
@@ -260,11 +259,6 @@ static void ppc405_init(MachineState *machine) cpu =ppc405ep_init (sysmem, ram_memories, ram_bases, ram_sizes,33333333 , &uicdev, kernel_filename ==NULL ?0 :1 ); -/* allocate SRAM */ -memory_region_init_ram (sram,NULL ,"ef405ep.sram" ,PPC405EP_SRAM_SIZE , - &error_fatal); -memory_region_add_subregion (sysmem,PPC405EP_SRAM_BASE , sram); -/* allocate and load BIOS */ if (machine->firmware) {MemoryRegion *bios =g_new (MemoryRegion,1 );
@@ -328,9 +322,15 @@ static void ref405ep_init(MachineState *machine) {DeviceState *dev;SysBusDevice *s; +MemoryRegion *sram =g_new (MemoryRegion,1 );ppc405_init (machine); +/* allocate SRAM */ +memory_region_init_ram (sram,NULL ,"ref405ep.sram" ,PPC405EP_SRAM_SIZE , + &error_fatal); +memory_region_add_subregion (get_system_memory (),PPC405EP_SRAM_BASE , sram); +/* Register FPGA */ ref405ep_fpga_init (get_system_memory (),PPC405EP_FPGA_BASE );/* Register NVRAM */
Signature · 1 line
2.37.2
[PULL 27/60] ppc/pnv: user creatable pnv-phb for powernv10
In reply to Daniel Henrique BarbozaGiven that powernv9 and powernv10 uses the same pnv-phb backend, the logic to allow user created pnv-phbs for powernv10 is already in place. Let's flip the switch.
Message-Id: <[email protected]>
--- hw/ppc/pnv.c | 2 ++ 1 file changed, 2 insertions(+)
hw/ppc/pnv.c +2 -0
@@ -2251,6 +2251,8 @@ static void pnv_machine_power10_class_init(ObjectClass *oc, void *data) pmc->dt_power_mgt = pnv_dt_power_mgt; xfc->match_nvt = pnv10_xive_match_nvt; + +machine_class_allow_dynamic_sysbus_dev (mc,TYPE_PNV_PHB ); }static bool pnv_machine_get_hb (Object *obj,Error **errp)
Signature · 1 line
2.37.2
[PULL 32/60] ppc/ppc405: Move devices under the ref405ep machine
In reply to Daniel Henrique BarbozaFrom: Cédric Le Goater <[email protected]>
Message-Id: <[email protected]>
--- hw/ppc/ppc405_boards.c | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-)
hw/ppc/ppc405_boards.c +19 -12
@@ -230,13 +230,11 @@ static void boot_from_kernel(MachineState *machine, PowerPCCPU *cpu) env->load_info = &boot_info; } -static void ref405ep_init (MachineState *machine) +static void ppc405_init (MachineState *machine) {MachineClass *mc =MACHINE_GET_CLASS (machine);const char *kernel_filename = machine->kernel_filename;PowerPCCPU *cpu; -DeviceState *dev; -SysBusDevice *s;MemoryRegion *sram =g_new (MemoryRegion,1 );MemoryRegion *ram_memories =g_new (MemoryRegion,2 );hwaddr ram_bases[2 ], ram_sizes[2 ];
@@ -294,15 +292,6 @@ static void ref405ep_init(MachineState *machine)memory_region_add_subregion (sysmem, (uint32_t )(-bios_size), bios); } -/* Register FPGA */ -ref405ep_fpga_init (sysmem,PPC405EP_FPGA_BASE ); -/* Register NVRAM */ - dev =qdev_new ("sysbus-m48t08" ); -qdev_prop_set_int32 (dev,"base-year" ,1968 ); - s =SYS_BUS_DEVICE (dev); -sysbus_realize_and_unref (s, &error_fatal); -sysbus_mmio_map (s,0 ,PPC405EP_NVRAM_BASE ); -/* Load kernel and initrd using U-Boot images */ if (kernel_filename && machine->firmware) {target_ulong kernel_base, initrd_base;
@@ -335,6 +324,23 @@ static void ref405ep_init(MachineState *machine) } } +static void ref405ep_init (MachineState *machine) +{ +DeviceState *dev; +SysBusDevice *s; + +ppc405_init (machine); + +/* Register FPGA */ +ref405ep_fpga_init (get_system_memory (),PPC405EP_FPGA_BASE ); +/* Register NVRAM */ + dev =qdev_new ("sysbus-m48t08" ); +qdev_prop_set_int32 (dev,"base-year" ,1968 ); + s =SYS_BUS_DEVICE (dev); +sysbus_realize_and_unref (s, &error_fatal); +sysbus_mmio_map (s,0 ,PPC405EP_NVRAM_BASE ); +} +static void ref405ep_class_init (ObjectClass *oc,void *data) {MachineClass *mc =MACHINE_CLASS (oc);
@@ -354,6 +360,7 @@ static void ppc405_machine_class_init(ObjectClass *oc, void *data)MachineClass *mc =MACHINE_CLASS (oc); mc->desc ="PPC405 generic machine" ; + mc->init = ppc405_init; mc->default_ram_size =128 * MiB; mc->default_ram_id ="ppc405.ram" ; }
Signature · 1 line
2.37.2
[PULL 46/60] ppc/ppc405: QOM'ify PLB
In reply to Daniel Henrique BarbozaFrom: Cédric Le Goater <[email protected]>
PLB is currently modeled as a simple DCR device. Also drop the ppc4xx_plb_init() helper and adapt the sam460ex machine.
Message-Id: <c4256d1bffca86fe1d696aa9c56732e5f563e114.1660746880.git.balaton@eik.bme.hu>
--- hw/ppc/ppc405.h | 14 ++++++++-- hw/ppc/ppc405_uc.c | 64 ++++++++++++++++++++++++++-------------------- hw/ppc/sam460ex.c | 4 ++- 3 files changed, 51 insertions(+), 31 deletions(-)
hw/ppc/ppc405.h +12 -2
@@ -63,6 +63,17 @@ struct ppc4xx_bd_info_t {uint32_t bi_iic_fast[2 ]; }; +/* Peripheral local bus arbitrer */ +#define TYPE_PPC405_PLB "ppc405-plb" +OBJECT_DECLARE_SIMPLE_TYPE (Ppc405PlbState,PPC405_PLB ); +struct Ppc405PlbState { +Ppc4xxDcrDeviceState parent_obj; + +uint32_t acr; +uint32_t bear; +uint32_t besr; +}; +/* PLB to OPB bridge */ #define TYPE_PPC405_POB "ppc405-pob"OBJECT_DECLARE_SIMPLE_TYPE (Ppc405PobState,PPC405_POB );
@@ -232,11 +243,10 @@ struct Ppc405SoCState {Ppc405EbcState ebc;Ppc405OpbaState opba;Ppc405PobState pob; + Ppc405PlbState plb; };/* PowerPC 405 core */ ram_addr_t ppc405_set_bootinfo (CPUPPCState *env,ram_addr_t ram_size); -void ppc4xx_plb_init (CPUPPCState *env); -#endif /* PPC405_H */
hw/ppc/ppc405_uc.c +36 -28
113 lines not on this page · raw message
hw/ppc/sam460ex.c +3 -1
@@ -309,7 +309,9 @@ static void sam460ex_init(MachineState *machine)ppc_dcr_init (env,NULL ,NULL );/* PLB arbitrer */ -ppc4xx_plb_init (env); + dev =qdev_new (TYPE_PPC405_PLB ); +ppc4xx_dcr_realize (PPC4xx_DCR_DEVICE (dev), cpu, &error_fatal); +object_unref (OBJECT (dev));/* interrupt controllers */ for (i =0 ; i <ARRAY_SIZE (uic); i++) {
Signature · 1 line
2.37.2
[PULL 30/60] ppc/ppc405: Remove taihu machine
In reply to Daniel Henrique BarbozaFrom: Cédric Le Goater <[email protected]>
It has been deprecated since 7.0.
Message-Id: <[email protected]>
--- MAINTAINERS | 2 +- docs/about/deprecated.rst | 9 -- docs/about/removed-features.rst | 6 + docs/system/ppc/embedded.rst | 1 - hw/ppc/ppc405_boards.c | 232 -------------------------------- 5 files changed, 7 insertions(+), 243 deletions(-)
MAINTAINERS +1 -1
@@ -1282,7 +1282,7 @@ F: hw/openrisc/openrisc_sim.c PowerPC Machines ---------------- -405 (ref405ep and taihu) +405 (ref405ep) L: [email protected] S: Orphan F: hw/ppc/ppc405_boards.c
docs/about/deprecated.rst +0 -9
@@ -233,15 +233,6 @@ deprecated; use the new name ``dtb-randomness`` instead. The new name better reflects the way this property affects all random data within the device tree blob, not just the ``kaslr-seed`` node. -PPC 405 ``taihu`` machine (since 7.0) -''''''''''''''''''''''''''''''''''''' - -The PPC 405 CPU is a system-on-a-chip, so all 405 machines are very similar, -except for some external periphery. However, the periphery of the ``taihu`` -machine is hardly emulated at all (e.g. neither the LCD nor the USB part had -been implemented), so there is not much value added by this board. Use the -``ref405ep`` machine instead. - ``pc-i440fx-1.4`` up to ``pc-i440fx-1.7`` (since 7.0) '''''''''''''''''''''''''''''''''''''''''''''''''''''
docs/about/removed-features.rst +6 -0
@@ -668,6 +668,12 @@ Aspeed ``swift-bmc`` machine (removed in 7.0) This machine was removed because it was unused. Alternative AST2500 based OpenPOWER machines are ``witherspoon-bmc`` and ``romulus-bmc``. +ppc ``taihu`` machine (removed in 7.2) +''''''''''''''''''''''''''''''''''''''''''''' + +This machine was removed because it was partially emulated and 405 +machines are very similar. Use the ``ref405ep`` machine instead. + linux-user mode CPUs --------------------
docs/system/ppc/embedded.rst +0 -1
@@ -6,5 +6,4 @@ Embedded family boards - ``ppce500`` generic paravirt e500 platform - ``ref405ep`` ref405ep - ``sam460ex`` aCube Sam460ex -- ``taihu`` taihu - ``virtex-ml507`` Xilinx Virtex ML507 reference design
hw/ppc/ppc405_boards.c +0 -232
241 lines not on this page · raw message
Signature · 1 line
2.37.2
[PULL 38/60] ppc/ppc405: QOM'ify CPC
In reply to Daniel Henrique BarbozaFrom: Cédric Le Goater <[email protected]>
The CPC controller is currently modeled as a DCR device.
Now that all clock settings are handled at the CPC level, change the SoC "sys-clk" property to be an alias on the same property in the CPC model.
Message-Id: <23393cb91a2c6c560a4461b3e9d1baa48ae28f74.1660746880.git.balaton@eik.bme.hu>
--- hw/ppc/ppc405.h | 35 ++++++++++- hw/ppc/ppc405_uc.c | 141 ++++++++++++++++++++------------------------- 2 files changed, 95 insertions(+), 81 deletions(-)
hw/ppc/ppc405.h +34 -1
@@ -63,6 +63,39 @@ struct ppc4xx_bd_info_t {uint32_t bi_iic_fast[2 ]; }; +#define TYPE_PPC405_CPC "ppc405-cpc" +OBJECT_DECLARE_SIMPLE_TYPE (Ppc405CpcState,PPC405_CPC ); + +enum { +PPC405EP_CPU_CLK =0 , +PPC405EP_PLB_CLK =1 , +PPC405EP_OPB_CLK =2 , +PPC405EP_EBC_CLK =3 , +PPC405EP_MAL_CLK =4 , +PPC405EP_PCI_CLK =5 , +PPC405EP_UART0_CLK =6 , +PPC405EP_UART1_CLK =7 , +PPC405EP_CLK_NB =8 , +}; + +struct Ppc405CpcState { +Ppc4xxDcrDeviceState parent_obj; + +uint32_t sysclk; +clk_setup_t clk_setup[PPC405EP_CLK_NB ]; +uint32_t boot; +uint32_t epctl; +uint32_t pllmr[2 ]; +uint32_t ucr; +uint32_t srr; +uint32_t jtagid; +uint32_t pci; +/* Clock and power management */ +uint32_t er; +uint32_t fr; +uint32_t sr; +}; +#define TYPE_PPC405_SOC "ppc405-soc"OBJECT_DECLARE_SIMPLE_TYPE (Ppc405SoCState,PPC405_SOC );
@@ -78,9 +111,9 @@ struct Ppc405SoCState {MemoryRegion *dram_mr;hwaddr ram_size; -uint32_t sysclk;PowerPCCPU cpu;DeviceState *uic; +Ppc405CpcState cpc; };/* PowerPC 405 core */
hw/ppc/ppc405_uc.c +61 -80
221 lines not on this page · raw message
Signature · 1 line
2.37.2
[PULL 34/60] ppc/ppc405: Introduce a PPC405 SoC
In reply to Daniel Henrique BarbozaFrom: Cédric Le Goater <[email protected]>
It is an initial model to start QOMification of the PPC405 board. QOM'ified devices will be reintroduced one by one. Start with the memory regions, which name prefix is changed to "ppc405".
Also, initialize only one RAM bank. The second bank is a dummy one (zero size) which is here to match the hard coded number of banks in ppc405ep_init().
Message-Id: <[email protected]>
--- hw/ppc/ppc405.h | 16 ++++++++++++++++ hw/ppc/ppc405_boards.c | 23 ++++++++++++----------- hw/ppc/ppc405_uc.c | 40 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 68 insertions(+), 11 deletions(-)
hw/ppc/ppc405.h +16 -0
@@ -25,6 +25,7 @@#ifndef PPC405_H #define PPC405_H +#include "qom/object.h" #include "hw/ppc/ppc4xx.h" #define PPC405EP_SDRAM_BASE 0x00000000
@@ -62,6 +63,21 @@ struct ppc4xx_bd_info_t {uint32_t bi_iic_fast[2 ]; }; +#define TYPE_PPC405_SOC "ppc405-soc" +OBJECT_DECLARE_SIMPLE_TYPE (Ppc405SoCState,PPC405_SOC ); + +struct Ppc405SoCState { +/* Private */ +DeviceState parent_obj; + +/* Public */ +MemoryRegion ram_banks[2 ]; +hwaddr ram_bases[2 ], ram_sizes[2 ]; + +MemoryRegion *dram_mr; +hwaddr ram_size; +}; +/* PowerPC 405 core */ ram_addr_t ppc405_set_bootinfo (CPUPPCState *env,ram_addr_t ram_size);
hw/ppc/ppc405_boards.c +12 -11
@@ -57,6 +57,8 @@ struct Ppc405MachineState {/* Private */ MachineState parent_obj;/* Public */ + +Ppc405SoCState soc; };/*****************************************************************************/
@@ -232,11 +234,10 @@ static void boot_from_kernel(MachineState *machine, PowerPCCPU *cpu)static void ppc405_init (MachineState *machine) { +Ppc405MachineState *ppc405 =PPC405_MACHINE (machine);MachineClass *mc =MACHINE_GET_CLASS (machine);const char *kernel_filename = machine->kernel_filename;PowerPCCPU *cpu; -MemoryRegion *ram_memories =g_new (MemoryRegion,2 ); -hwaddr ram_bases[2 ], ram_sizes[2 ];MemoryRegion *sysmem =get_system_memory ();DeviceState *uicdev;
@@ -247,16 +248,16 @@ static void ppc405_init(MachineState *machine)exit (EXIT_FAILURE ); } -/* XXX: fix this */ -memory_region_init_alias (&ram_memories[0 ],NULL ,"ef405ep.ram.alias" , - machine->ram,0 , machine->ram_size); - ram_bases[0 ] =0 ; - ram_sizes[0 ] = machine->ram_size; -memory_region_init (&ram_memories[1 ],NULL ,"ef405ep.ram1" ,0 ); - ram_bases[1 ] =0x00000000 ; - ram_sizes[1 ] =0x00000000 ; +object_initialize_child (OBJECT (machine),"soc" , &ppc405->soc, +TYPE_PPC405_SOC ); +object_property_set_uint (OBJECT (&ppc405->soc),"ram-size" , + machine->ram_size, &error_fatal); +object_property_set_link (OBJECT (&ppc405->soc),"dram" , +OBJECT (machine->ram), &error_abort); +qdev_realize (DEVICE (&ppc405->soc),NULL , &error_fatal); - cpu =ppc405ep_init (sysmem, ram_memories, ram_bases, ram_sizes, + cpu =ppc405ep_init (sysmem, ppc405->soc.ram_banks, ppc405->soc.ram_bases, + ppc405->soc.ram_sizes,33333333 , &uicdev, kernel_filename ==NULL ?0 :1 );/* allocate and load BIOS */
hw/ppc/ppc405_uc.c +40 -0
@@ -30,6 +30,7 @@#include "hw/ppc/ppc.h" #include "hw/i2c/ppc4xx_i2c.h" #include "hw/irq.h" +#include "hw/qdev-properties.h" #include "ppc405.h" #include "hw/char/serial.h" #include "qemu/timer.h"
@@ -1530,3 +1531,42 @@ PowerPCCPU *ppc405ep_init(MemoryRegion *address_space_mem,return cpu; } + +static void ppc405_soc_realize (DeviceState *dev,Error **errp) +{ +Ppc405SoCState *s =PPC405_SOC (dev); + +/* Initialize only one bank */ + s->ram_bases[0 ] =0 ; + s->ram_sizes[0 ] = s->ram_size; +memory_region_init_alias (&s->ram_banks[0 ],OBJECT (s), +"ppc405.sdram0" , s->dram_mr, + s->ram_bases[0 ], s->ram_sizes[0 ]); +} + +static Property ppc405_soc_properties[] = { +DEFINE_PROP_LINK ("dram" , Ppc405SoCState, dram_mr,TYPE_MEMORY_REGION , + MemoryRegion *), +DEFINE_PROP_UINT64 ("ram-size" , Ppc405SoCState, ram_size,0 ), +DEFINE_PROP_END_OF_LIST (), +}; + +static void ppc405_soc_class_init (ObjectClass *oc,void *data) +{ +DeviceClass *dc =DEVICE_CLASS (oc); + + dc->realize = ppc405_soc_realize; + dc->user_creatable = false; +device_class_set_props (dc, ppc405_soc_properties); +} + +static const TypeInfo ppc405_types[] = { + { + .name =TYPE_PPC405_SOC , + .parent =TYPE_DEVICE , + .instance_size =sizeof (Ppc405SoCState), + .class_init = ppc405_soc_class_init, + } +}; + +DEFINE_TYPES (ppc405_types)
Signature · 1 line
2.37.2
[PULL 47/60] ppc/ppc405: QOM'ify MAL
In reply to Daniel Henrique BarbozaFrom: Cédric Le Goater <[email protected]>
The Memory Access Layer (MAL) controller is currently modeled as a DCR device with 4 IRQs. Also drop the ppc4xx_mal_init() helper and adapt the sam460ex machine.
Message-Id: <d54a243dff94d95ba30dbcc09c27700a90ade932.1660746880.git.balaton@eik.bme.hu>
--- hw/ppc/ppc405.h | 1 + hw/ppc/ppc405_uc.c | 17 +++-- hw/ppc/ppc4xx_devs.c | 145 ++++++++++++++++++++-------------------- hw/ppc/sam460ex.c | 12 ++-- include/hw/ppc/ppc4xx.h | 28 +++++++- 5 files changed, 117 insertions(+), 86 deletions(-)
hw/ppc/ppc405.h +1 -0
@@ -244,6 +244,7 @@ struct Ppc405SoCState {Ppc405OpbaState opba;Ppc405PobState pob;Ppc405PlbState plb; +Ppc4xxMalState mal; };/* PowerPC 405 core */
hw/ppc/ppc405_uc.c +11 -6
@@ -1375,6 +1375,8 @@ static void ppc405_soc_instance_init(Object *obj)object_initialize_child (obj,"pob" , &s->pob,TYPE_PPC405_POB );object_initialize_child (obj,"plb" , &s->plb,TYPE_PPC405_PLB ); + +object_initialize_child (obj,"mal" , &s->mal, TYPE_PPC4xx_MAL); }static void ppc405_reset (void *opaque)
@@ -1385,7 +1387,6 @@ static void ppc405_reset(void *opaque)static void ppc405_soc_realize (DeviceState *dev,Error **errp) {Ppc405SoCState *s =PPC405_SOC (dev); -qemu_irq mal_irqs[4 ];CPUPPCState *env;SysBusDevice *sbd;int i;
@@ -1503,11 +1504,15 @@ static void ppc405_soc_realize(DeviceState *dev, Error **errp) }/* MAL */ - mal_irqs[0 ] =qdev_get_gpio_in (s->uic,11 ); - mal_irqs[1 ] =qdev_get_gpio_in (s->uic,12 ); - mal_irqs[2 ] =qdev_get_gpio_in (s->uic,13 ); - mal_irqs[3 ] =qdev_get_gpio_in (s->uic,14 ); -ppc4xx_mal_init (env,4 ,2 , mal_irqs); +object_property_set_int (OBJECT (&s->mal),"txc-num" ,4 , &error_abort); +object_property_set_int (OBJECT (&s->mal),"rxc-num" ,2 , &error_abort); +if (!ppc4xx_dcr_realize (PPC4xx_DCR_DEVICE (&s->mal), &s->cpu, errp)) { +return ; + } + sbd =SYS_BUS_DEVICE (&s->mal); +for (i =0 ; i <ARRAY_SIZE (s->mal.irqs); i++) { +sysbus_connect_irq (sbd, i,qdev_get_gpio_in (s->uic,11 + i)); + }/* Ethernet */ /* Uses UIC IRQs 9, 15, 17 */
hw/ppc/ppc4xx_devs.c +72 -73
192 lines not on this page · raw message
hw/ppc/sam460ex.c +8 -4
@@ -280,7 +280,6 @@ static void sam460ex_init(MachineState *machine)hwaddr ram_sizes[SDRAM_NR_BANKS ] = {0 };MemoryRegion *l2cache_ram =g_new (MemoryRegion,1 );DeviceState *uic[4 ]; -qemu_irq mal_irqs[4 ];int i;PCIBus *pci_bus;PowerPCCPU *cpu;
@@ -387,10 +386,15 @@ static void sam460ex_init(MachineState *machine)ppc4xx_sdr_init (env);/* MAL */ -for (i =0 ; i <ARRAY_SIZE (mal_irqs); i++) { - mal_irqs[i] =qdev_get_gpio_in (uic[2 ],3 + i); + dev =qdev_new (TYPE_PPC4xx_MAL); +qdev_prop_set_uint32 (dev,"txc-num" ,4 ); +qdev_prop_set_uint32 (dev,"rxc-num" ,16 ); +ppc4xx_dcr_realize (PPC4xx_DCR_DEVICE (dev), cpu, &error_fatal); +object_unref (OBJECT (dev)); + sbdev =SYS_BUS_DEVICE (dev); +for (i =0 ; i <ARRAY_SIZE (PPC4xx_MAL (dev)->irqs); i++) { +sysbus_connect_irq (sbdev, i,qdev_get_gpio_in (uic[2 ],3 + i)); } -ppc4xx_mal_init (env,4 ,16 , mal_irqs);/* DMA */ ppc4xx_dma_init (env,0x200 );
include/hw/ppc/ppc4xx.h +25 -3
@@ -40,9 +40,6 @@ void ppc4xx_sdram_init (CPUPPCState *env, qemu_irq irq, int nbanks,hwaddr *ram_sizes, int do_init); -void ppc4xx_mal_init (CPUPPCState *env,uint8_t txcnum,uint8_t rxcnum, -qemu_irq irqs[4 ]); -#define TYPE_PPC4xx_PCI_HOST_BRIDGE "ppc4xx-pcihost"/*
@@ -61,4 +58,29 @@ void ppc4xx_dcr_register(Ppc4xxDcrDeviceState *dev, int dcrn, void *opaque,bool ppc4xx_dcr_realize (Ppc4xxDcrDeviceState *dev,PowerPCCPU *cpu,Error **errp); +/* Memory Access Layer (MAL) */ +#define TYPE_PPC4xx_MAL "ppc4xx-mal" +OBJECT_DECLARE_SIMPLE_TYPE (Ppc4xxMalState, PPC4xx_MAL); +struct Ppc4xxMalState { +Ppc4xxDcrDeviceState parent_obj; + +qemu_irq irqs[4 ]; +uint32_t cfg; +uint32_t esr; +uint32_t ier; +uint32_t txcasr; +uint32_t txcarr; +uint32_t txeobisr; +uint32_t txdeir; +uint32_t rxcasr; +uint32_t rxcarr; +uint32_t rxeobisr; +uint32_t rxdeir; +uint32_t *txctpr; +uint32_t *rxctpr; +uint32_t *rcbs; +uint8_t txcnum; +uint8_t rxcnum; +}; +#endif /* PPC4XX_H */
Signature · 1 line
2.37.2
[PULL 37/60] ppc/ppc4xx: Introduce a DCR device model
In reply to Daniel Henrique BarbozaFrom: Cédric Le Goater <[email protected]>
The Device Control Registers (DCR) of on-SoC devices are accessed by software through the use of the mtdcr and mfdcr instructions. These are converted in transactions on a side band bus, the DCR bus, which connects the on-SoC devices to the CPU.
Ideally, we should model these accesses with a DCR namespace and DCR memory regions but today the DCR handlers are installed in a DCR table under the CPU. Instead, introduce a little device model wrapper to hold a CPU link and handle registration of DCR handlers.
The DCR device inherits from SysBus because most of these devices also have MMIO regions and/or IRQs. Being a SysBusDevice makes things easier to install the device model in the overall SoC.
Message-Id: <9b21bdf55e0a728f093bad299e030d98f302ded0.1660746880.git.balaton@eik.bme.hu>
--- hw/ppc/ppc4xx_devs.c | 41 +++++++++++++++++++++++++++++++++++++++++ include/hw/ppc/ppc4xx.h | 17 +++++++++++++++++ 2 files changed, 58 insertions(+)
hw/ppc/ppc4xx_devs.c +41 -0
@@ -664,3 +664,44 @@ void ppc4xx_mal_init(CPUPPCState *env, uint8_t txcnum, uint8_t rxcnum, mal, &dcr_read_mal, &dcr_write_mal); } } + +/* PPC4xx_DCR_DEVICE */ + +void ppc4xx_dcr_register (Ppc4xxDcrDeviceState *dev,int dcrn,void *opaque, +dcr_read_cb dcr_read,dcr_write_cb dcr_write) +{ +assert (dev->cpu); +ppc_dcr_register (&dev->cpu->env, dcrn, opaque, dcr_read, dcr_write); +} + +bool ppc4xx_dcr_realize (Ppc4xxDcrDeviceState *dev,PowerPCCPU *cpu, +Error **errp) +{ +object_property_set_link (OBJECT (dev),"cpu" ,OBJECT (cpu), &error_abort); +return sysbus_realize (SYS_BUS_DEVICE (dev), errp); +} + +static Property ppc4xx_dcr_properties[] = { +DEFINE_PROP_LINK ("cpu" , Ppc4xxDcrDeviceState, cpu,TYPE_POWERPC_CPU , + PowerPCCPU *), +DEFINE_PROP_END_OF_LIST (), +}; + +static void ppc4xx_dcr_class_init (ObjectClass *oc,void *data) +{ +DeviceClass *dc =DEVICE_CLASS (oc); + +device_class_set_props (dc, ppc4xx_dcr_properties); +} + +static const TypeInfo ppc4xx_types[] = { + { + .name = TYPE_PPC4xx_DCR_DEVICE, + .parent =TYPE_SYS_BUS_DEVICE , + .instance_size =sizeof (Ppc4xxDcrDeviceState), + .class_init = ppc4xx_dcr_class_init, + .abstract = true, + } +}; + +DEFINE_TYPES (ppc4xx_types)
include/hw/ppc/ppc4xx.h +17 -0
@@ -27,6 +27,7 @@#include "hw/ppc/ppc.h" #include "exec/memory.h" +#include "hw/sysbus.h" void ppc4xx_sdram_banks(MemoryRegion *ram, int nr_banks, MemoryRegion ram_memories[],
@@ -44,4 +45,20 @@ void ppc4xx_mal_init(CPUPPCState *env, uint8_t txcnum, uint8_t rxcnum,#define TYPE_PPC4xx_PCI_HOST_BRIDGE "ppc4xx-pcihost" +/* +* Generic DCR device +*/ +#define TYPE_PPC4xx_DCR_DEVICE "ppc4xx-dcr-device" +OBJECT_DECLARE_SIMPLE_TYPE (Ppc4xxDcrDeviceState, PPC4xx_DCR_DEVICE); +struct Ppc4xxDcrDeviceState { +SysBusDevice parent_obj; + +PowerPCCPU *cpu; +}; + +void ppc4xx_dcr_register (Ppc4xxDcrDeviceState *dev,int dcrn,void *opaque, +dcr_read_cb dcr_read,dcr_write_cb dcr_write); +bool ppc4xx_dcr_realize (Ppc4xxDcrDeviceState *dev,PowerPCCPU *cpu, +Error **errp); +#endif /* PPC4XX_H */
Signature · 1 line
2.37.2
[PULL 36/60] ppc/ppc405: QOM'ify CPU
In reply to Daniel Henrique BarbozaFrom: Cédric Le Goater <[email protected]>
Drop the use of ppc4xx_init() and duplicate a bit of code related to clocks in the SoC realize routine. We will clean that up in the following patches.
ppc_dcr_init() simply allocates default DCR handlers for the CPU. Maybe this could be done in model initializer of the CPU families needing it.
Message-Id: <[email protected]>
--- hw/ppc/ppc405.h | 2 +- hw/ppc/ppc405_boards.c | 2 +- hw/ppc/ppc405_uc.c | 40 ++++++++++++++++++++++++++++++---------- hw/ppc/ppc4xx_devs.c | 32 -------------------------------- include/hw/ppc/ppc4xx.h | 5 ----- 5 files changed, 32 insertions(+), 49 deletions(-)
hw/ppc/ppc405.h +1 -1
@@ -79,7 +79,7 @@ struct Ppc405SoCState {hwaddr ram_size;uint32_t sysclk; -PowerPCCPU *cpu; +PowerPCCPU cpu;DeviceState *uic; };
hw/ppc/ppc405_boards.c +1 -1
@@ -313,7 +313,7 @@ static void ppc405_init(MachineState *machine)/* Load ELF kernel and rootfs.cpio */ }else if (kernel_filename && !machine->firmware) { -boot_from_kernel (machine, ppc405->soc.cpu); +boot_from_kernel (machine, &ppc405->soc.cpu); } }
hw/ppc/ppc405_uc.c +30 -10
@@ -1432,22 +1432,41 @@ static void ppc405ep_cpc_init (CPUPPCState *env, clk_setup_t clk_setup[8],#endif } +static void ppc405_soc_instance_init (Object *obj) +{ +Ppc405SoCState *s =PPC405_SOC (obj); + +object_initialize_child (obj,"cpu" , &s->cpu, +POWERPC_CPU_TYPE_NAME ("405ep" )); +} + +static void ppc405_reset (void *opaque) +{ +cpu_reset (CPU (opaque)); +} +static void ppc405_soc_realize (DeviceState *dev,Error **errp) {Ppc405SoCState *s =PPC405_SOC (dev); -clk_setup_t clk_setup[PPC405EP_CLK_NB ], tlb_clk_setup; +clk_setup_t clk_setup[PPC405EP_CLK_NB ];qemu_irq dma_irqs[4 ], gpt_irqs[5 ], mal_irqs[4 ];CPUPPCState *env;memset (clk_setup,0 ,sizeof (clk_setup));/* init CPUs */ - s->cpu =ppc4xx_init (POWERPC_CPU_TYPE_NAME ("405ep" ), - &clk_setup[PPC405EP_CPU_CLK ], - &tlb_clk_setup, s->sysclk); - env = &s->cpu->env; - clk_setup[PPC405EP_CPU_CLK ].cb = tlb_clk_setup.cb; - clk_setup[PPC405EP_CPU_CLK ].opaque = tlb_clk_setup.opaque; +if (!qdev_realize (DEVICE (&s->cpu),NULL , errp)) { +return ; + } +qemu_register_reset (ppc405_reset, &s->cpu); + + env = &s->cpu.env; + + clk_setup[PPC405EP_CPU_CLK ].cb = +ppc_40x_timers_init (env, s->sysclk,PPC_INTERRUPT_PIT ); + clk_setup[PPC405EP_CPU_CLK ].opaque = env; + +ppc_dcr_init (env,NULL ,NULL );/* CPU control */ ppc405ep_cpc_init (env, clk_setup, s->sysclk);
@@ -1464,16 +1483,16 @@ static void ppc405_soc_realize(DeviceState *dev, Error **errp)/* Universal interrupt controller */ s->uic =qdev_new (TYPE_PPC_UIC ); -object_property_set_link (OBJECT (s->uic),"cpu" ,OBJECT (s->cpu), +object_property_set_link (OBJECT (s->uic),"cpu" ,OBJECT (&s->cpu), &error_fatal);if (!sysbus_realize (SYS_BUS_DEVICE (s->uic), errp)) {return ; }sysbus_connect_irq (SYS_BUS_DEVICE (s->uic),PPCUIC_OUTPUT_INT , -qdev_get_gpio_in (DEVICE (s->cpu), PPC40x_INPUT_INT)); +qdev_get_gpio_in (DEVICE (&s->cpu), PPC40x_INPUT_INT));sysbus_connect_irq (SYS_BUS_DEVICE (s->uic),PPCUIC_OUTPUT_CINT , -qdev_get_gpio_in (DEVICE (s->cpu), PPC40x_INPUT_CINT)); +qdev_get_gpio_in (DEVICE (&s->cpu), PPC40x_INPUT_CINT));/* SDRAM controller */ /* XXX 405EP has no ECC interrupt */
@@ -1563,6 +1582,7 @@ static const TypeInfo ppc405_types[] = { .name = TYPE_PPC405_SOC, .parent = TYPE_DEVICE, .instance_size = sizeof(Ppc405SoCState), + .instance_init = ppc405_soc_instance_init, .class_init = ppc405_soc_class_init, } };
hw/ppc/ppc4xx_devs.c +0 -32
@@ -37,38 +37,6 @@#include "qapi/error.h" #include "trace.h" -static void ppc4xx_reset (void *opaque) -{ -PowerPCCPU *cpu = opaque; - -cpu_reset (CPU (cpu)); -} - -/*****************************************************************************/ -/* Generic PowerPC 4xx processor instantiation */ -PowerPCCPU *ppc4xx_init (const char *cpu_type, -clk_setup_t *cpu_clk,clk_setup_t *tb_clk, -uint32_t sysclk) -{ -PowerPCCPU *cpu; -CPUPPCState *env; - -/* init CPUs */ - cpu =POWERPC_CPU (cpu_create (cpu_type)); - env = &cpu->env; - - cpu_clk->cb =NULL ;/* We don't care about CPU clock frequency changes */ - cpu_clk->opaque = env; -/* Set time-base frequency to sysclk */ - tb_clk->cb =ppc_40x_timers_init (env, sysclk,PPC_INTERRUPT_PIT ); - tb_clk->opaque = env; -ppc_dcr_init (env,NULL ,NULL ); -/* Register qemu callbacks */ -qemu_register_reset (ppc4xx_reset, cpu); - -return cpu; -} -/*****************************************************************************/ /* SDRAM controller */ typedef struct ppc4xx_sdram_t ppc4xx_sdram_t ;
include/hw/ppc/ppc4xx.h +0 -5
@@ -28,11 +28,6 @@#include "hw/ppc/ppc.h" #include "exec/memory.h" -/* PowerPC 4xx core initialization */ -PowerPCCPU *ppc4xx_init (const char *cpu_model, -clk_setup_t *cpu_clk,clk_setup_t *tb_clk, -uint32_t sysclk); - void ppc4xx_sdram_banks(MemoryRegion *ram, int nr_banks, MemoryRegion ram_memories[], hwaddr ram_bases[], hwaddr ram_sizes[],
Signature · 1 line
2.37.2
[PULL 50/60] ppc4xx: Move EBC model to ppc4xx_devs.c
In reply to Daniel Henrique BarbozaFrom: BALATON Zoltan <[email protected]>
The EBC is shared between 405 and 440 so move it to shared file.
Message-Id: <10eae70509ca4bd74858fc2c0a0f0e4eb9330199.1660746880.git.balaton@eik.bme.hu>
--- hw/ppc/ppc405.h | 15 ---- hw/ppc/ppc405_uc.c | 191 ---------------------------------------- hw/ppc/ppc4xx_devs.c | 191 ++++++++++++++++++++++++++++++++++++++++ include/hw/ppc/ppc4xx.h | 15 ++++ 4 files changed, 206 insertions(+), 206 deletions(-)
hw/ppc/ppc405.h +0 -15
@@ -85,21 +85,6 @@ struct Ppc405OpbaState {uint8_t pr; }; -/* Peripheral controller */ -#define TYPE_PPC405_EBC "ppc405-ebc" -OBJECT_DECLARE_SIMPLE_TYPE (Ppc405EbcState,PPC405_EBC ); -struct Ppc405EbcState { -Ppc4xxDcrDeviceState parent_obj; - -uint32_t addr; -uint32_t bcr[8 ]; -uint32_t bap[8 ]; -uint32_t bear; -uint32_t besr0; -uint32_t besr1; -uint32_t cfg; -}; -/* DMA controller */ #define TYPE_PPC405_DMA "ppc405-dma"OBJECT_DECLARE_SIMPLE_TYPE (Ppc405DmaState,PPC405_DMA );
hw/ppc/ppc405_uc.c +0 -191
203 lines not on this page · raw message
hw/ppc/ppc4xx_devs.c +191 -0
203 lines not on this page · raw message
include/hw/ppc/ppc4xx.h +15 -0
@@ -94,4 +94,19 @@ struct Ppc4xxPlbState { uint32_t besr; }; +/* Peripheral controller */ +#define TYPE_PPC405_EBC "ppc405-ebc" +OBJECT_DECLARE_SIMPLE_TYPE (Ppc405EbcState,PPC405_EBC ); +struct Ppc405EbcState { +Ppc4xxDcrDeviceState parent_obj; + +uint32_t addr; +uint32_t bcr[8 ]; +uint32_t bap[8 ]; +uint32_t bear; +uint32_t besr0; +uint32_t besr1; +uint32_t cfg; +}; +#endif /* PPC4XX_H */
Signature · 1 line
2.37.2
[PULL 39/60] ppc/ppc405: QOM'ify GPT
In reply to Daniel Henrique BarbozaFrom: Cédric Le Goater <[email protected]>
The GPT controller is currently modeled as a SysBus device with a unique memory region, a couple of IRQs and a timer.
Message-Id: <8950ab26e78173f94ba65bc61bcfd0631de1fe61.1660746880.git.balaton@eik.bme.hu>
--- hw/ppc/ppc405.h | 22 ++++++++++ hw/ppc/ppc405_uc.c | 102 ++++++++++++++++++++++++-------------------- hw/ppc/trace-events | 1 - 3 files changed, 78 insertions(+), 47 deletions(-)
hw/ppc/ppc405.h +22 -0
@@ -63,6 +63,27 @@ struct ppc4xx_bd_info_t {uint32_t bi_iic_fast[2 ]; }; +/* General purpose timers */ +#define TYPE_PPC405_GPT "ppc405-gpt" +OBJECT_DECLARE_SIMPLE_TYPE (Ppc405GptState,PPC405_GPT ); +struct Ppc405GptState { +SysBusDevice parent_obj; + +MemoryRegion iomem; + +int64_t tb_offset; +uint32_t tb_freq; +QEMUTimer *timer; +qemu_irq irqs[5 ]; +uint32_t oe; +uint32_t ol; +uint32_t im; +uint32_t is; +uint32_t ie; +uint32_t comp[5 ]; +uint32_t mask[5 ]; +}; +#define TYPE_PPC405_CPC "ppc405-cpc"OBJECT_DECLARE_SIMPLE_TYPE (Ppc405CpcState,PPC405_CPC );
@@ -114,6 +135,7 @@ struct Ppc405SoCState {PowerPCCPU cpu;DeviceState *uic;Ppc405CpcState cpc; +Ppc405GptState gpt; };/* PowerPC 405 core */
hw/ppc/ppc405_uc.c +56 -46
193 lines not on this page · raw message
hw/ppc/trace-events +0 -1
@@ -173,7 +173,6 @@ ocm_unmap(const char* prefix, uint32_t isarc) "OCM unmap %s 0x%08" PRIx32 ppc4xx_gpt_read(uint64_t addr, uint32_t size) "addr 0x%" PRIx64 " size %d" ppc4xx_gpt_write(uint64_t addr, uint32_t size, uint64_t val) "addr 0x%" PRIx64 " size %d = 0x%" PRIx64 -ppc4xx_gpt_init(uint64_t addr) "offet 0x%" PRIx64 ppc405ep_clocks_compute(const char *param, uint32_t param2, uint32_t val) "%s 0x%1" PRIx32 " %d" ppc405ep_clocks_setup(const char *trace) "%s"
Signature · 1 line
2.37.2
[PULL 44/60] ppc/ppc405: QOM'ify OPBA
In reply to Daniel Henrique BarbozaFrom: Cédric Le Goater <[email protected]>
The OPB arbitrer is currently modeled as a simple SysBus device with a unique memory region.
Message-Id: <38476bc43d2332db2f09dbede9eff5234d6ce217.1660746880.git.balaton@eik.bme.hu>
--- hw/ppc/ppc405.h | 12 +++++++++++ hw/ppc/ppc405_uc.c | 49 +++++++++++++++++++++++++++------------------ hw/ppc/trace-events | 1 - 3 files changed, 41 insertions(+), 21 deletions(-)
hw/ppc/ppc405.h +12 -0
@@ -63,6 +63,17 @@ struct ppc4xx_bd_info_t {uint32_t bi_iic_fast[2 ]; }; +/* OPB arbitrer */ +#define TYPE_PPC405_OPBA "ppc405-opba" +OBJECT_DECLARE_SIMPLE_TYPE (Ppc405OpbaState,PPC405_OPBA ); +struct Ppc405OpbaState { +SysBusDevice parent_obj; + +MemoryRegion io; +uint8_t cr; +uint8_t pr; +}; +/* Peripheral controller */ #define TYPE_PPC405_EBC "ppc405-ebc"OBJECT_DECLARE_SIMPLE_TYPE (Ppc405EbcState,PPC405_EBC );
@@ -208,6 +219,7 @@ struct Ppc405SoCState {Ppc405GpioState gpio;Ppc405DmaState dma;Ppc405EbcState ebc; +Ppc405OpbaState opba; };/* PowerPC 405 core */
hw/ppc/ppc405_uc.c +29 -20
96 lines not on this page · raw message
hw/ppc/trace-events +0 -1
@@ -161,7 +161,6 @@ ppc440_pcix_reg_write(uint64_t addr, uint32_t val, uint32_t size) "addr 0x%" PRI # ppc405_boards.c opba_readb(uint64_t addr, uint32_t val) "addr 0x%" PRIx64 " = 0x%" PRIx32 opba_writeb(uint64_t addr, uint64_t val) "addr 0x%" PRIx64 " = 0x%" PRIx64 -opba_init(uint64_t addr) "offet 0x%" PRIx64 ppc405_gpio_read(uint64_t addr, uint32_t size) "addr 0x%" PRIx64 " size %d" ppc405_gpio_write(uint64_t addr, uint32_t size, uint64_t val) "addr 0x%" PRIx64 " size %d = 0x%" PRIx64
Signature · 1 line
2.37.2
[PULL 52/60] ppc/ppc405: Use an embedded PPCUIC model in SoC state
In reply to Daniel Henrique BarbozaFrom: Cédric Le Goater <[email protected]>
Message-Id: <ac5f010f4eb3ade061c65bc39a049f231f75574a.1660746880.git.balaton@eik.bme.hu>
--- hw/ppc/ppc405.h | 3 ++- hw/ppc/ppc405_uc.c | 28 ++++++++++++++-------------- 2 files changed, 16 insertions(+), 15 deletions(-)
hw/ppc/ppc405.h +2 -1
@@ -27,6 +27,7 @@#include "qom/object.h" #include "hw/ppc/ppc4xx.h" +#include "hw/intc/ppc-uic.h" #define PPC405EP_SDRAM_BASE 0x00000000#define PPC405EP_NVRAM_BASE 0xF0000000
@@ -208,7 +209,7 @@ struct Ppc405SoCState {hwaddr ram_size;PowerPCCPU cpu; -DeviceState *uic; +PPCUIC uic;Ppc405CpcState cpc;Ppc405GptState gpt;Ppc405OcmState ocm;
hw/ppc/ppc405_uc.c +14 -14
@@ -1083,6 +1083,8 @@ static void ppc405_soc_instance_init(Object *obj)object_initialize_child (obj,"cpu" , &s->cpu,POWERPC_CPU_TYPE_NAME ("405ep" )); +object_initialize_child (obj,"uic" , &s->uic,TYPE_PPC_UIC ); +object_initialize_child (obj,"cpc" , &s->cpc,TYPE_PPC405_CPC );object_property_add_alias (obj,"sys-clk" ,OBJECT (&s->cpc),"sys-clk" );
@@ -1150,17 +1152,15 @@ static void ppc405_soc_realize(DeviceState *dev, Error **errp)sysbus_mmio_map (sbd,0 ,0xef600600 );/* Universal interrupt controller */ - s->uic =qdev_new (TYPE_PPC_UIC ); - -object_property_set_link (OBJECT (s->uic),"cpu" ,OBJECT (&s->cpu), +object_property_set_link (OBJECT (&s->uic),"cpu" ,OBJECT (&s->cpu), &error_fatal); -if (!sysbus_realize (SYS_BUS_DEVICE (s->uic), errp)) { + sbd =SYS_BUS_DEVICE (&s->uic); +if (!sysbus_realize (sbd, errp)) {return ; } - -sysbus_connect_irq (SYS_BUS_DEVICE (s->uic),PPCUIC_OUTPUT_INT , +sysbus_connect_irq (sbd,PPCUIC_OUTPUT_INT ,qdev_get_gpio_in (DEVICE (&s->cpu), PPC40x_INPUT_INT)); -sysbus_connect_irq (SYS_BUS_DEVICE (s->uic),PPCUIC_OUTPUT_CINT , +sysbus_connect_irq (sbd,PPCUIC_OUTPUT_CINT ,qdev_get_gpio_in (DEVICE (&s->cpu), PPC40x_INPUT_CINT));/* SDRAM controller */
@@ -1171,7 +1171,7 @@ static void ppc405_soc_realize(DeviceState *dev, Error **errp)"ppc405.sdram0" , s->dram_mr, s->ram_bases[0], s->ram_sizes[0]); -ppc4xx_sdram_init (env,qdev_get_gpio_in (s->uic,17 ),1 , +ppc4xx_sdram_init (env,qdev_get_gpio_in (DEVICE (&s->uic),17 ),1 , s->ram_banks, s->ram_bases, s->ram_sizes, s->do_dram_init);
@@ -1186,12 +1186,12 @@ static void ppc405_soc_realize(DeviceState *dev, Error **errp) } sbd =SYS_BUS_DEVICE (&s->dma);for (i =0 ; i <ARRAY_SIZE (s->dma.irqs); i++) { -sysbus_connect_irq (sbd, i,qdev_get_gpio_in (s->uic,5 + i)); +sysbus_connect_irq (sbd, i,qdev_get_gpio_in (DEVICE (&s->uic),5 + i)); }/* I2C controller */ sysbus_create_simple (TYPE_PPC4xx_I2C,0xef600500 , -qdev_get_gpio_in (s->uic,2 )); +qdev_get_gpio_in (DEVICE (&s->uic),2 ));/* GPIO */ sbd =SYS_BUS_DEVICE (&s->gpio);
@@ -1203,13 +1203,13 @@ static void ppc405_soc_realize(DeviceState *dev, Error **errp)/* Serial ports */ if (serial_hd (0 ) !=NULL ) {serial_mm_init (get_system_memory (),0xef600300 ,0 , -qdev_get_gpio_in (s->uic,0 ), +qdev_get_gpio_in (DEVICE (&s->uic),0 ),PPC_SERIAL_MM_BAUDBASE ,serial_hd (0 ),DEVICE_BIG_ENDIAN ); }if (serial_hd (1 ) !=NULL ) {serial_mm_init (get_system_memory (),0xef600400 ,0 , -qdev_get_gpio_in (s->uic,1 ), +qdev_get_gpio_in (DEVICE (&s->uic),1 ),PPC_SERIAL_MM_BAUDBASE ,serial_hd (1 ),DEVICE_BIG_ENDIAN ); }
@@ -1226,7 +1226,7 @@ static void ppc405_soc_realize(DeviceState *dev, Error **errp) }sysbus_mmio_map (sbd,0 ,0xef600000 );for (i =0 ; i <ARRAY_SIZE (s->gpt.irqs); i++) { -sysbus_connect_irq (sbd, i,qdev_get_gpio_in (s->uic,19 + i)); +sysbus_connect_irq (sbd, i,qdev_get_gpio_in (DEVICE (&s->uic),19 + i)); }/* MAL */
@@ -1237,7 +1237,7 @@ static void ppc405_soc_realize(DeviceState *dev, Error **errp) } sbd =SYS_BUS_DEVICE (&s->mal);for (i =0 ; i <ARRAY_SIZE (s->mal.irqs); i++) { -sysbus_connect_irq (sbd, i,qdev_get_gpio_in (s->uic,11 + i)); +sysbus_connect_irq (sbd, i,qdev_get_gpio_in (DEVICE (&s->uic),11 + i)); }/* Ethernet */
Signature · 1 line
2.37.2
[PULL 40/60] ppc/ppc405: QOM'ify OCM
In reply to Daniel Henrique BarbozaFrom: Cédric Le Goater <[email protected]>
The OCM controller is currently modeled as a simple DCR device with a couple of memory regions.
Message-Id: <ecb93d2d5993bb7a970365744c7d342d4abcb017.1660746880.git.balaton@eik.bme.hu>
--- hw/ppc/ppc405.h | 16 ++++++++++ hw/ppc/ppc405_uc.c | 77 +++++++++++++++++++++++----------------------- 2 files changed, 55 insertions(+), 38 deletions(-)
hw/ppc/ppc405.h +16 -0
@@ -63,6 +63,21 @@ struct ppc4xx_bd_info_t {uint32_t bi_iic_fast[2 ]; }; +/* On Chip Memory */ +#define TYPE_PPC405_OCM "ppc405-ocm" +OBJECT_DECLARE_SIMPLE_TYPE (Ppc405OcmState,PPC405_OCM ); +struct Ppc405OcmState { +Ppc4xxDcrDeviceState parent_obj; + +MemoryRegion ram; +MemoryRegion isarc_ram; +MemoryRegion dsarc_ram; +uint32_t isarc; +uint32_t isacntl; +uint32_t dsarc; +uint32_t dsacntl; +}; +/* General purpose timers */ #define TYPE_PPC405_GPT "ppc405-gpt"OBJECT_DECLARE_SIMPLE_TYPE (Ppc405GptState,PPC405_GPT );
@@ -136,6 +151,7 @@ struct Ppc405SoCState {DeviceState *uic;Ppc405CpcState cpc;Ppc405GptState gpt; +Ppc405OcmState ocm; };/* PowerPC 405 core */
hw/ppc/ppc405_uc.c +39 -38
139 lines not on this page · raw message
Signature · 1 line
2.37.2
[PULL 51/60] ppc4xx: Rename ppc405-ebc to ppc4xx-ebc
In reply to Daniel Henrique BarbozaFrom: BALATON Zoltan <[email protected]>
This device is shared between different 4xx socs.
Message-Id: <63d9b14c8ff5f73e35bffca1036394b5235735ee.1660746880.git.balaton@eik.bme.hu>
--- hw/ppc/ppc405.h | 2 +- hw/ppc/ppc405_uc.c | 2 +- hw/ppc/ppc4xx_devs.c | 12 ++++++------ hw/ppc/sam460ex.c | 2 +- include/hw/ppc/ppc4xx.h | 6 +++--- 5 files changed, 12 insertions(+), 12 deletions(-)
hw/ppc/ppc405.h +1 -1
@@ -214,7 +214,7 @@ struct Ppc405SoCState {Ppc405OcmState ocm;Ppc405GpioState gpio;Ppc405DmaState dma; -Ppc405EbcState ebc; +Ppc4xxEbcState ebc;Ppc405OpbaState opba;Ppc405PobState pob;Ppc4xxPlbState plb;
hw/ppc/ppc405_uc.c +1 -1
@@ -1094,7 +1094,7 @@ static void ppc405_soc_instance_init(Object *obj)object_initialize_child (obj,"dma" , &s->dma,TYPE_PPC405_DMA ); -object_initialize_child (obj,"ebc" , &s->ebc,TYPE_PPC405_EBC ); +object_initialize_child (obj,"ebc" , &s->ebc, TYPE_PPC4xx_EBC);object_initialize_child (obj,"opba" , &s->opba,TYPE_PPC405_OPBA );
hw/ppc/ppc4xx_devs.c +6 -6
@@ -756,7 +756,7 @@ enum {static uint32_t dcr_read_ebc (void *opaque,int dcrn) { -Ppc405EbcState *ebc = opaque; +Ppc4xxEbcState *ebc = opaque;uint32_t ret;switch (dcrn) {
@@ -840,7 +840,7 @@ static uint32_t dcr_read_ebc(void *opaque, int dcrn)static void dcr_write_ebc (void *opaque,int dcrn,uint32_t val) { -Ppc405EbcState *ebc = opaque; +Ppc4xxEbcState *ebc = opaque;switch (dcrn) {case EBC0_CFGADDR :
@@ -899,7 +899,7 @@ static void dcr_write_ebc(void *opaque, int dcrn, uint32_t val)static void ppc405_ebc_reset (DeviceState *dev) { -Ppc405EbcState *ebc =PPC405_EBC (dev); +Ppc4xxEbcState *ebc =PPC4xx_EBC (dev);int i; ebc->addr =0x00000000 ;
@@ -916,7 +916,7 @@ static void ppc405_ebc_reset(DeviceState *dev)static void ppc405_ebc_realize (DeviceState *dev,Error **errp) { -Ppc405EbcState *ebc =PPC405_EBC (dev); +Ppc4xxEbcState *ebc =PPC4xx_EBC (dev);Ppc4xxDcrDeviceState *dcr =PPC4xx_DCR_DEVICE (dev);ppc4xx_dcr_register (dcr,EBC0_CFGADDR , ebc, &dcr_read_ebc, &dcr_write_ebc);
@@ -975,9 +975,9 @@ static const TypeInfo ppc4xx_types[] = { .instance_size = sizeof(Ppc4xxPlbState), .class_init = ppc405_plb_class_init, }, { - .name = TYPE_PPC405_EBC, + .name = TYPE_PPC4xx_EBC, .parent = TYPE_PPC4xx_DCR_DEVICE, - .instance_size = sizeof(Ppc405EbcState), + .instance_size = sizeof(Ppc4xxEbcState), .class_init = ppc405_ebc_class_init, }, { .name = TYPE_PPC4xx_DCR_DEVICE,
hw/ppc/sam460ex.c +1 -1
@@ -372,7 +372,7 @@ static void sam460ex_init(MachineState *machine) qdev_get_gpio_in(uic[0], 3));/* External bus controller */ - dev =qdev_new (TYPE_PPC405_EBC ); + dev =qdev_new (TYPE_PPC4xx_EBC);ppc4xx_dcr_realize (PPC4xx_DCR_DEVICE (dev), cpu, &error_fatal);object_unref (OBJECT (dev));
include/hw/ppc/ppc4xx.h +3 -3
@@ -95,9 +95,9 @@ struct Ppc4xxPlbState { };/* Peripheral controller */ -#define TYPE_PPC405_EBC "ppc405-ebc" -OBJECT_DECLARE_SIMPLE_TYPE (Ppc405EbcState,PPC405_EBC ); -struct Ppc405EbcState { +#define TYPE_PPC4xx_EBC "ppc4xx-ebc" +OBJECT_DECLARE_SIMPLE_TYPE (Ppc4xxEbcState, PPC4xx_EBC); +struct Ppc4xxEbcState {Ppc4xxDcrDeviceState parent_obj;uint32_t addr;
Signature · 1 line
2.37.2
[PULL 55/60] ppc/ppc405: QOM'ify FPGA
In reply to Daniel Henrique BarbozaFrom: Cédric Le Goater <[email protected]>
Message-Id: <ed6ff1705dadb46b456e424aa0f0420f1d18d92c.1660746880.git.balaton@eik.bme.hu>
--- hw/ppc/ppc405_boards.c | 56 +++++++++++++++++++++++++++++------------- 1 file changed, 39 insertions(+), 17 deletions(-)
hw/ppc/ppc405_boards.c +39 -17
@@ -71,18 +71,23 @@ struct Ppc405MachineState {* - NVRAM (0xF0000000) * - FPGA (0xF0300000) */ -typedef struct ref405ep_fpga_t ref405ep_fpga_t ; -struct ref405ep_fpga_t { + +#define TYPE_REF405EP_FPGA "ref405ep-fpga" +OBJECT_DECLARE_SIMPLE_TYPE (Ref405epFpgaState,REF405EP_FPGA ); +struct Ref405epFpgaState { +SysBusDevice parent_obj; + +MemoryRegion iomem; +uint8_t reg0;uint8_t reg1; };static uint64_t ref405ep_fpga_readb (void *opaque,hwaddr addr,unsigned size) { -ref405ep_fpga_t *fpga; +Ref405epFpgaState *fpga = opaque;uint32_t ret; - fpga = opaque;switch (addr) {case 0x0 : ret = fpga->reg0;
@@ -101,9 +106,8 @@ static uint64_t ref405ep_fpga_readb(void *opaque, hwaddr addr, unsigned size)static void ref405ep_fpga_writeb (void *opaque,hwaddr addr,uint64_t value,unsigned size) { -ref405ep_fpga_t *fpga; +Ref405epFpgaState *fpga = opaque; - fpga = opaque;switch (addr) {case 0x0 :/* Read only */
@@ -126,27 +130,40 @@ static const MemoryRegionOps ref405ep_fpga_ops = { .endianness = DEVICE_BIG_ENDIAN, }; -static void ref405ep_fpga_reset (void *opaque) +static void ref405ep_fpga_reset (DeviceState *dev) { -ref405ep_fpga_t *fpga; +Ref405epFpgaState *fpga =REF405EP_FPGA (dev); - fpga = opaque; fpga->reg0 =0x00 ; fpga->reg1 =0x0F ; } -static void ref405ep_fpga_init (MemoryRegion *sysmem,uint32_t base) +static void ref405ep_fpga_realize (DeviceState *dev,Error **errp) { -ref405ep_fpga_t *fpga; -MemoryRegion *fpga_memory =g_new (MemoryRegion,1 ); +Ref405epFpgaState *s =REF405EP_FPGA (dev); - fpga =g_new0 (ref405ep_fpga_t,1 ); -memory_region_init_io (fpga_memory,NULL , &ref405ep_fpga_ops, fpga, +memory_region_init_io (&s->iomem,OBJECT (s), &ref405ep_fpga_ops, s,"fpga" ,0x00000100 ); -memory_region_add_subregion (sysmem, base, fpga_memory); -qemu_register_reset (&ref405ep_fpga_reset, fpga); +sysbus_init_mmio (SYS_BUS_DEVICE (s), &s->iomem); +} + +static void ref405ep_fpga_class_init (ObjectClass *oc,void *data) +{ +DeviceClass *dc =DEVICE_CLASS (oc); + + dc->realize = ref405ep_fpga_realize; + dc->reset = ref405ep_fpga_reset; +/* Reason: only works as part of a ppc405 board */ + dc->user_creatable = false; } +static const TypeInfo ref405ep_fpga_type = { + .name =TYPE_REF405EP_FPGA , + .parent =TYPE_SYS_BUS_DEVICE , + .instance_size =sizeof (Ref405epFpgaState), + .class_init = ref405ep_fpga_class_init, +}; +/* * CPU reset handler when booting directly from a loaded kernel */
@@ -331,7 +348,11 @@ static void ref405ep_init(MachineState *machine)memory_region_add_subregion (get_system_memory (),PPC405EP_SRAM_BASE , sram);/* Register FPGA */ -ref405ep_fpga_init (get_system_memory (),PPC405EP_FPGA_BASE ); + dev =qdev_new (TYPE_REF405EP_FPGA ); +object_property_add_child (OBJECT (machine),"fpga" ,OBJECT (dev)); +sysbus_realize_and_unref (SYS_BUS_DEVICE (dev), &error_fatal); +sysbus_mmio_map (SYS_BUS_DEVICE (dev),0 ,PPC405EP_FPGA_BASE ); +/* Register NVRAM */ dev =qdev_new ("sysbus-m48t08" );qdev_prop_set_int32 (dev,"base-year" ,1968 );
@@ -376,6 +397,7 @@ static void ppc405_machine_init(void) {type_register_static (&ppc405_machine_type);type_register_static (&ref405ep_type); +type_register_static (&ref405ep_fpga_type); }type_init (ppc405_machine_init)
Signature · 1 line
2.37.2
[PULL 42/60] ppc/ppc405: QOM'ify DMA
In reply to Daniel Henrique BarbozaFrom: Cédric Le Goater <[email protected]>
The DMA controller is currently modeled as a DCR device with a couple of IRQs.
Message-Id: <4738b3c7cf18c328f05aaaddc555a46219431335.1660746880.git.balaton@eik.bme.hu>
--- hw/ppc/ppc405.h | 19 ++++++ hw/ppc/ppc405_uc.c | 141 ++++++++++++++++++++------------------------- 2 files changed, 81 insertions(+), 79 deletions(-)
hw/ppc/ppc405.h +19 -0
@@ -63,6 +63,24 @@ struct ppc4xx_bd_info_t {uint32_t bi_iic_fast[2 ]; }; +/* DMA controller */ +#define TYPE_PPC405_DMA "ppc405-dma" +OBJECT_DECLARE_SIMPLE_TYPE (Ppc405DmaState,PPC405_DMA ); +struct Ppc405DmaState { +Ppc4xxDcrDeviceState parent_obj; + +qemu_irq irqs[4 ]; +uint32_t cr[4 ]; +uint32_t ct[4 ]; +uint32_t da[4 ]; +uint32_t sa[4 ]; +uint32_t sg[4 ]; +uint32_t sr; +uint32_t sgc; +uint32_t slp; +uint32_t pol; +}; +/* GPIO */ #define TYPE_PPC405_GPIO "ppc405-gpio"OBJECT_DECLARE_SIMPLE_TYPE (Ppc405GpioState,PPC405_GPIO );
@@ -173,6 +191,7 @@ struct Ppc405SoCState {Ppc405GptState gpt;Ppc405OcmState ocm;Ppc405GpioState gpio; +Ppc405DmaState dma; };/* PowerPC 405 core */
hw/ppc/ppc405_uc.c +62 -79
188 lines not on this page · raw message
Signature · 1 line
2.37.2
[PULL 53/60] hw/intc/ppc-uic: Convert ppc-uic to a PPC4xx DCR device
In reply to Daniel Henrique BarbozaFrom: BALATON Zoltan <[email protected]>
Make ppc-uic a subclass of ppc4xx-dcr-device which will handle the cpu link and make it uniform with the other PPC4xx devices.
Message-Id: <eb548130cf60aea8a6ea4dba4dee1686b3cabc3d.1660746880.git.balaton@eik.bme.hu>
--- hw/intc/ppc-uic.c | 26 ++++++-------------------- hw/ppc/ppc405_uc.c | 6 ++---- hw/ppc/ppc440_bamboo.c | 7 ++----- hw/ppc/ppc4xx_devs.c | 1 - hw/ppc/sam460ex.c | 17 +++++++---------- hw/ppc/virtex_ml507.c | 7 ++----- include/hw/intc/ppc-uic.h | 6 ++---- 7 files changed, 21 insertions(+), 49 deletions(-)
hw/intc/ppc-uic.c +6 -20
@@ -25,11 +25,8 @@#include "qemu/osdep.h" #include "hw/intc/ppc-uic.h" #include "hw/irq.h" -#include "cpu.h" -#include "hw/ppc/ppc.h" #include "hw/qdev-properties.h" #include "migration/vmstate.h" -#include "qapi/error.h" enum {DCR_UICSR =0x000 ,
@@ -105,10 +102,9 @@ static void ppcuic_trigger_irq(PPCUIC *uic)static void ppcuic_set_irq (void *opaque,int irq_num,int level) { -PPCUIC *uic; +PPCUIC *uic = opaque;uint32_t mask, sr; - uic = opaque; mask =1U << (31 - irq_num); LOG_UIC("%s: irq %d level %d uicsr %08" PRIx32 " mask %08" PRIx32 " => %08" PRIx32 " %08" PRIx32 "\n",
@@ -144,10 +140,9 @@ static void ppcuic_set_irq(void *opaque, int irq_num, int level)static uint32_t dcr_read_uic (void *opaque,int dcrn) { -PPCUIC *uic; +PPCUIC *uic = opaque;uint32_t ret; - uic = opaque; dcrn -= uic->dcr_base;switch (dcrn) {case DCR_UICSR :
@@ -192,9 +187,8 @@ static uint32_t dcr_read_uic(void *opaque, int dcrn)static void dcr_write_uic (void *opaque,int dcrn,uint32_t val) { -PPCUIC *uic; +PPCUIC *uic = opaque; - uic = opaque; dcrn -= uic->dcr_base;LOG_UIC ("%s: dcr %d val 0x%x\n" , __func__, dcrn, val);switch (dcrn) {
@@ -251,19 +245,12 @@ static void ppc_uic_reset(DeviceState *dev)static void ppc_uic_realize (DeviceState *dev,Error **errp) {PPCUIC *uic =PPC_UIC (dev); +Ppc4xxDcrDeviceState *dcr =PPC4xx_DCR_DEVICE (dev);SysBusDevice *sbd =SYS_BUS_DEVICE (dev); -PowerPCCPU *cpu;int i; -if (!uic->cpu) { -/* This is a programming error in the code using this device */ -error_setg (errp,"ppc-uic 'cpu' link property was not set" ); -return ; - } - - cpu =POWERPC_CPU (uic->cpu);for (i =0 ; i <DCR_UICMAX ; i++) { -ppc_dcr_register (&cpu->env, uic->dcr_base + i, uic, +ppc4xx_dcr_register (dcr, uic->dcr_base + i, uic, &dcr_read_uic, &dcr_write_uic); }
@@ -273,7 +260,6 @@ static void ppc_uic_realize(DeviceState *dev, Error **errp) }static Property ppc_uic_properties[] = { - DEFINE_PROP_LINK("cpu", PPCUIC, cpu, TYPE_CPU, CPUState *),DEFINE_PROP_UINT32 ("dcr-base" ,PPCUIC , dcr_base,0xc0 ),DEFINE_PROP_BOOL ("use-vectors" ,PPCUIC , use_vectors, true),DEFINE_PROP_END_OF_LIST ()
@@ -308,7 +294,7 @@ static void ppc_uic_class_init(ObjectClass *klass, void *data)static const TypeInfo ppc_uic_info = { .name =TYPE_PPC_UIC , - .parent =TYPE_SYS_BUS_DEVICE , + .parent = TYPE_PPC4xx_DCR_DEVICE, .instance_size =sizeof (PPCUIC ), .class_init = ppc_uic_class_init, };
hw/ppc/ppc405_uc.c +2 -4
@@ -1152,12 +1152,10 @@ static void ppc405_soc_realize(DeviceState *dev, Error **errp)sysbus_mmio_map (sbd,0 ,0xef600600 );/* Universal interrupt controller */ -object_property_set_link (OBJECT (&s->uic),"cpu" ,OBJECT (&s->cpu), - &error_fatal); - sbd =SYS_BUS_DEVICE (&s->uic); -if (!sysbus_realize (sbd, errp)) { +if (!ppc4xx_dcr_realize (PPC4xx_DCR_DEVICE (&s->uic), &s->cpu, errp)) {return ; } + sbd =SYS_BUS_DEVICE (&s->uic);sysbus_connect_irq (sbd,PPCUIC_OUTPUT_INT ,qdev_get_gpio_in (DEVICE (&s->cpu), PPC40x_INPUT_INT)); sysbus_connect_irq(sbd, PPCUIC_OUTPUT_CINT,
hw/ppc/ppc440_bamboo.c +2 -5
@@ -193,12 +193,9 @@ static void bamboo_init(MachineState *machine)/* interrupt controller */ uicdev =qdev_new (TYPE_PPC_UIC ); +ppc4xx_dcr_realize (PPC4xx_DCR_DEVICE (uicdev), cpu, &error_fatal); +object_unref (OBJECT (uicdev)); uicsbd =SYS_BUS_DEVICE (uicdev); - -object_property_set_link (OBJECT (uicdev),"cpu" ,OBJECT (cpu), - &error_fatal); -sysbus_realize_and_unref (uicsbd, &error_fatal); -sysbus_connect_irq (uicsbd,PPCUIC_OUTPUT_INT ,qdev_get_gpio_in (DEVICE (cpu), PPC40x_INPUT_INT)); sysbus_connect_irq(uicsbd, PPCUIC_OUTPUT_CINT,
hw/ppc/ppc4xx_devs.c +0 -1
@@ -29,7 +29,6 @@#include "hw/irq.h" #include "hw/ppc/ppc.h" #include "hw/ppc/ppc4xx.h" -#include "hw/intc/ppc-uic.h" #include "hw/qdev-properties.h" #include "qemu/log.h" #include "exec/address-spaces.h"
hw/ppc/sam460ex.c +7 -10
@@ -314,7 +314,6 @@ static void sam460ex_init(MachineState *machine)/* interrupt controllers */ for (i =0 ; i <ARRAY_SIZE (uic); i++) { -SysBusDevice *sbd;/* * UICs 1, 2 and 3 are cascaded through UIC 0. * input_ints[n] is the interrupt number on UIC 0 which
@@ -326,22 +325,20 @@ static void sam460ex_init(MachineState *machine)const int input_ints[] = {-1 ,30 ,10 ,16 }; uic[i] =qdev_new (TYPE_PPC_UIC ); - sbd =SYS_BUS_DEVICE (uic[i]); -qdev_prop_set_uint32 (uic[i],"dcr-base" ,0xc0 + i *0x10 ); -object_property_set_link (OBJECT (uic[i]),"cpu" ,OBJECT (cpu), - &error_fatal); -sysbus_realize_and_unref (sbd, &error_fatal); +ppc4xx_dcr_realize (PPC4xx_DCR_DEVICE (uic[i]), cpu, &error_fatal); +object_unref (OBJECT (uic[i])); + sbdev =SYS_BUS_DEVICE (uic[i]);if (i ==0 ) { -sysbus_connect_irq (sbd,PPCUIC_OUTPUT_INT , +sysbus_connect_irq (sbdev,PPCUIC_OUTPUT_INT ,qdev_get_gpio_in (DEVICE (cpu), PPC40x_INPUT_INT)); -sysbus_connect_irq (sbd,PPCUIC_OUTPUT_CINT , +sysbus_connect_irq (sbdev,PPCUIC_OUTPUT_CINT ,qdev_get_gpio_in (DEVICE (cpu), PPC40x_INPUT_CINT)); }else { -sysbus_connect_irq (sbd,PPCUIC_OUTPUT_INT , +sysbus_connect_irq (sbdev,PPCUIC_OUTPUT_INT ,qdev_get_gpio_in (uic[0 ], input_ints[i])); -sysbus_connect_irq (sbd,PPCUIC_OUTPUT_CINT , +sysbus_connect_irq (sbdev,PPCUIC_OUTPUT_CINT ,qdev_get_gpio_in (uic[0 ], input_ints[i] +1 )); } }
hw/ppc/virtex_ml507.c +2 -5
@@ -104,12 +104,9 @@ static PowerPCCPU *ppc440_init_xilinx(const char *cpu_type, uint32_t sysclk)/* interrupt controller */ uicdev =qdev_new (TYPE_PPC_UIC ); +ppc4xx_dcr_realize (PPC4xx_DCR_DEVICE (uicdev), cpu, &error_fatal); +object_unref (OBJECT (uicdev)); uicsbd =SYS_BUS_DEVICE (uicdev); - -object_property_set_link (OBJECT (uicdev),"cpu" ,OBJECT (cpu), - &error_fatal); -sysbus_realize_and_unref (uicsbd, &error_fatal); -sysbus_connect_irq (uicsbd,PPCUIC_OUTPUT_INT ,qdev_get_gpio_in (DEVICE (cpu), PPC40x_INPUT_INT)); sysbus_connect_irq(uicsbd, PPCUIC_OUTPUT_CINT,
include/hw/intc/ppc-uic.h +2 -4
@@ -25,8 +25,7 @@#ifndef HW_INTC_PPC_UIC_H #define HW_INTC_PPC_UIC_H -#include "hw/sysbus.h" -#include "qom/object.h" +#include "hw/ppc/ppc4xx.h" #define TYPE_PPC_UIC "ppc-uic"OBJECT_DECLARE_SIMPLE_TYPE (PPCUIC ,PPC_UIC )
@@ -56,14 +55,13 @@ enum {struct PPCUIC {/*< private >*/ -SysBusDevice parent_obj; +Ppc4xxDcrDeviceState parent_obj;/*< public >*/ qemu_irq output_int;qemu_irq output_cint;/* properties */ -CPUState *cpu;uint32_t dcr_base;bool use_vectors;
Signature · 1 line
2.37.2
[PULL 57/60] hw/ppc/sam3460ex: Remove PPC405 dependency from sam460ex
In reply to Daniel Henrique BarbozaFrom: BALATON Zoltan <[email protected]>
Now that shared PPC4xx devices are separated from PPC405 ones we can drop this depencency.
Message-Id: <cf6c1d280f830beeea41128595c8c026d5126d2b.1660762465.git.balaton@eik.bme.hu>
--- hw/ppc/Kconfig | 1 - hw/ppc/sam460ex.c | 1 - 2 files changed, 2 deletions(-)
hw/ppc/Kconfig +0 -1
@@ -58,7 +58,6 @@ config PPC4XX config SAM460EX bool - select PPC405 select PFLASH_CFI01 select IDE_SII3112 select M41T80
hw/ppc/sam460ex.c +0 -1
@@ -25,7 +25,6 @@#include "elf.h" #include "exec/memory.h" #include "ppc440.h" -#include "ppc405.h" #include "hw/block/flash.h" #include "sysemu/sysemu.h" #include "sysemu/reset.h"
Signature · 1 line
2.37.2
[PULL 48/60] ppc4xx: Move PLB model to ppc4xx_devs.c
In reply to Daniel Henrique BarbozaFrom: BALATON Zoltan <[email protected]>
The PLB is shared between 405 and 440 so move it to the shared file.
Message-Id: <2498384bf3e18959ee8cb984d72fb66b8a6ecadc.1660746880.git.balaton@eik.bme.hu>
--- hw/ppc/ppc405.h | 11 ----- hw/ppc/ppc405_uc.c | 93 ---------------------------------------- hw/ppc/ppc4xx_devs.c | 94 +++++++++++++++++++++++++++++++++++++++++ include/hw/ppc/ppc4xx.h | 11 +++++ 4 files changed, 105 insertions(+), 104 deletions(-)
hw/ppc/ppc405.h +0 -11
@@ -63,17 +63,6 @@ struct ppc4xx_bd_info_t {uint32_t bi_iic_fast[2 ]; }; -/* Peripheral local bus arbitrer */ -#define TYPE_PPC405_PLB "ppc405-plb" -OBJECT_DECLARE_SIMPLE_TYPE (Ppc405PlbState,PPC405_PLB ); -struct Ppc405PlbState { -Ppc4xxDcrDeviceState parent_obj; - -uint32_t acr; -uint32_t bear; -uint32_t besr; -}; -/* PLB to OPB bridge */ #define TYPE_PPC405_POB "ppc405-pob"OBJECT_DECLARE_SIMPLE_TYPE (Ppc405PobState,PPC405_POB );
hw/ppc/ppc405_uc.c +0 -93
105 lines not on this page · raw message
hw/ppc/ppc4xx_devs.c +94 -0
106 lines not on this page · raw message
include/hw/ppc/ppc4xx.h +11 -0
@@ -83,4 +83,15 @@ struct Ppc4xxMalState { uint8_t rxcnum; }; +/* Peripheral local bus arbitrer */ +#define TYPE_PPC405_PLB "ppc405-plb" +OBJECT_DECLARE_SIMPLE_TYPE (Ppc405PlbState,PPC405_PLB ); +struct Ppc405PlbState { +Ppc4xxDcrDeviceState parent_obj; + +uint32_t acr; +uint32_t bear; +uint32_t besr; +}; +#endif /* PPC4XX_H */
Signature · 1 line
2.37.2
[PULL 60/60] ppc4xx: Fix code style problems reported by checkpatch
In reply to Daniel Henrique BarbozaFrom: BALATON Zoltan <[email protected]>
Message-Id: <62798fbe9c200da3e0c870601ed9162b1c3a50a5.1660746880.git.balaton@eik.bme.hu>
--- hw/ppc/ppc405_uc.c | 5 +++-- hw/ppc/ppc440_bamboo.c | 27 ++++++++++++++---------- hw/ppc/ppc440_uc.c | 3 ++- hw/ppc/ppc4xx_devs.c | 48 +++++++++++++++++++++++------------------- hw/ppc/ppc4xx_pci.c | 31 +++++++++++++++++---------- 5 files changed, 67 insertions(+), 47 deletions(-)
hw/ppc/ppc405_uc.c +3 -2
@@ -540,10 +540,11 @@ static void ppc4xx_gpt_set_irqs(Ppc405GptState *gpt) mask =0x00008000 ;for (i =0 ; i <5 ; i++) { -if (gpt->is & gpt->im & mask) +if (gpt->is & gpt->im & mask) {qemu_irq_raise (gpt->irqs[i]); -else + }else {qemu_irq_lower (gpt->irqs[i]); + } mask = mask >>1 ; } }
hw/ppc/ppc440_bamboo.c +16 -11
@@ -84,27 +84,30 @@ static int bamboo_load_device_tree(hwaddr addr, ret =qemu_fdt_setprop (fdt,"/memory" ,"reg" , mem_reg_property,sizeof (mem_reg_property)); -if (ret <0 ) +if (ret <0 ) {fprintf (stderr,"couldn't set /memory/reg\n" ); - + } ret =qemu_fdt_setprop_cell (fdt,"/chosen" ,"linux,initrd-start" , initrd_base); -if (ret <0 ) +if (ret <0 ) {fprintf (stderr,"couldn't set /chosen/linux,initrd-start\n" ); - + } ret =qemu_fdt_setprop_cell (fdt,"/chosen" ,"linux,initrd-end" , (initrd_base + initrd_size)); -if (ret <0 ) +if (ret <0 ) {fprintf (stderr,"couldn't set /chosen/linux,initrd-end\n" ); - + } ret =qemu_fdt_setprop_string (fdt,"/chosen" ,"bootargs" , kernel_cmdline); -if (ret <0 ) +if (ret <0 ) {fprintf (stderr,"couldn't set /chosen/bootargs\n" ); + } -/* Copy data from the host device tree into the guest. Since the guest can +/* +* Copy data from the host device tree into the guest. Since the guest can * directly access the timebase without host involvement, we must expose -* the correct frequencies. */ +* the correct frequencies. +*/ if (kvm_enabled ()) { tb_freq =kvmppc_get_tbfreq (); clock_freq =kvmppc_get_clockfreq ();
@@ -246,8 +249,10 @@ static void bamboo_init(MachineState *machine)if (pcibus) {/* Register network interfaces. */ for (i =0 ; i < nb_nics; i++) { -/* There are no PCI NICs on the Bamboo board, but there are -* PCI slots, so we can pick whatever default model we want. */ +/* +* There are no PCI NICs on the Bamboo board, but there are +* PCI slots, so we can pick whatever default model we want. +*/ pci_nic_init_nofail (&nd_table[i], pcibus,"e1000" ,NULL ); } }
hw/ppc/ppc440_uc.c +2 -1
@@ -1028,7 +1028,8 @@ void ppc4xx_dma_init(CPUPPCState *env, int dcr_base)/*****************************************************************************/ /* PCI Express controller */ -/* FIXME: This is not complete and does not work, only implemented partially +/* +* FIXME: This is not complete and does not work, only implemented partially * to allow firmware and guests to find an empty bus. Cards should use PCI. */ #include "hw/pci/pcie_host.h"
hw/ppc/ppc4xx_devs.c +26 -22
135 lines not on this page · raw message
hw/ppc/ppc4xx_pci.c +20 -11
@@ -16,8 +16,10 @@* Authors: Hollis Blanchard <[email protected]> */ -/* This file implements emulation of the 32-bit PCI controller found in some -* 4xx SoCs, such as the 440EP. */ +/* +* This file implements emulation of the 32-bit PCI controller found in some +* 4xx SoCs, such as the 440EP. +*/ #include "qemu/osdep.h" #include "qemu/log.h"
@@ -65,8 +67,10 @@ struct PPC4xxPCIState {#define PCIC0_CFGADDR 0x0#define PCIC0_CFGDATA 0x4 -/* PLB Memory Map (PMM) registers specify which PLB addresses are translated to -* PCI accesses. */ +/* +* PLB Memory Map (PMM) registers specify which PLB addresses are translated to +* PCI accesses. +*/ #define PCIL0_PMM0LA 0x0#define PCIL0_PMM0MA 0x4#define PCIL0_PMM0PCILA 0x8
@@ -80,8 +84,10 @@ struct PPC4xxPCIState {#define PCIL0_PMM2PCILA 0x28#define PCIL0_PMM2PCIHA 0x2c -/* PCI Target Map (PTM) registers specify which PCI addresses are translated to -* PLB accesses. */ +/* +* PCI Target Map (PTM) registers specify which PCI addresses are translated to +* PLB accesses. +*/ #define PCIL0_PTM1MS 0x30#define PCIL0_PTM1LA 0x34#define PCIL0_PTM2MS 0x38
@@ -96,9 +102,10 @@ static void ppc4xx_pci_reg_write4(void *opaque, hwaddr offset, {struct PPC4xxPCIState *pci = opaque; -/* We ignore all target attempts at PCI configuration, effectively -* assuming a bidirectional 1:1 mapping of PLB and PCI space. */ - +/* +* We ignore all target attempts at PCI configuration, effectively +* assuming a bidirectional 1:1 mapping of PLB and PCI space. +*/ switch (offset) {case PCIL0_PMM0LA : pci->pmm[0 ].la = value;
@@ -243,8 +250,10 @@ static void ppc4xx_pci_reset(void *opaque)memset (pci->ptm,0 ,sizeof (pci->ptm)); } -/* On Bamboo, all pins from each slot are tied to a single board IRQ. This -* may need further refactoring for other boards. */ +/* +* On Bamboo, all pins from each slot are tied to a single board IRQ. +* This may need further refactoring for other boards. +*/ static int ppc4xx_pci_map_irq (PCIDevice *pci_dev,int irq_num) {int slot =PCI_SLOT (pci_dev->devfn);
Signature · 1 line
2.37.2
[PULL 56/60] ppc405: Move machine specific code to ppc405_boards.c
In reply to Daniel Henrique BarbozaFrom: BALATON Zoltan <[email protected]>
These are only used by the board code so move out from the shared SoC model and put it in the boards file.
Message-Id: <2b23bcaaf191f96b217cbd06a6038694024862c3.1660746880.git.balaton@eik.bme.hu>
--- hw/ppc/ppc405.h | 38 ----- hw/ppc/ppc405_boards.c | 375 +++++++++++++++++++++++++++-------------- hw/ppc/ppc405_uc.c | 92 ---------- 3 files changed, 251 insertions(+), 254 deletions(-)
hw/ppc/ppc405.h +0 -38
@@ -30,41 +30,6 @@#include "hw/intc/ppc-uic.h" #include "hw/i2c/ppc4xx_i2c.h" -#define PPC405EP_SDRAM_BASE 0x00000000 -#define PPC405EP_NVRAM_BASE 0xF0000000 -#define PPC405EP_FPGA_BASE 0xF0300000 -#define PPC405EP_SRAM_BASE 0xFFF00000 -#define PPC405EP_SRAM_SIZE (512 * KiB) -#define PPC405EP_FLASH_BASE 0xFFF80000 - -/* Bootinfo as set-up by u-boot */ -typedef struct ppc4xx_bd_info_t ppc4xx_bd_info_t ; -struct ppc4xx_bd_info_t { -uint32_t bi_memstart; -uint32_t bi_memsize; -uint32_t bi_flashstart; -uint32_t bi_flashsize; -uint32_t bi_flashoffset;/* 0x10 */ -uint32_t bi_sramstart; -uint32_t bi_sramsize; -uint32_t bi_bootflags; -uint32_t bi_ipaddr;/* 0x20 */ -uint8_t bi_enetaddr[6 ]; -uint16_t bi_ethspeed; -uint32_t bi_intfreq; -uint32_t bi_busfreq;/* 0x30 */ -uint32_t bi_baudrate; -uint8_t bi_s_version[4 ]; -uint8_t bi_r_version[32 ]; -uint32_t bi_procfreq; -uint32_t bi_plb_busfreq; -uint32_t bi_pci_busfreq; -uint8_t bi_pci_enetaddr[6 ]; -uint8_t bi_pci_enetaddr2[6 ];/* PPC405EP specific */ -uint32_t bi_opbfreq; -uint32_t bi_iic_fast[2 ]; -}; -/* PLB to OPB bridge */ #define TYPE_PPC405_POB "ppc405-pob"OBJECT_DECLARE_SIMPLE_TYPE (Ppc405PobState,PPC405_POB );
@@ -224,7 +189,4 @@ struct Ppc405SoCState { Ppc4xxMalState mal; }; -/* PowerPC 405 core */ -ram_addr_t ppc405_set_bootinfo (CPUPPCState *env,ram_addr_t ram_size); -#endif /* PPC405_H */
hw/ppc/ppc405_boards.c +251 -124
405 lines not on this page · raw message
hw/ppc/ppc405_uc.c +0 -92
98 lines not on this page · raw message
Signature · 1 line
2.37.2
[PULL 49/60] ppc4xx: Rename ppc405-plb to ppc4xx-plb
In reply to Daniel Henrique BarbozaFrom: BALATON Zoltan <[email protected]>
This device is shared between different 4xx socs.
Message-Id: <5b13ebfd12a71a28035bed5a915cbeee81cf21d1.1660746880.git.balaton@eik.bme.hu>
--- hw/ppc/ppc405.h | 2 +- hw/ppc/ppc405_uc.c | 2 +- hw/ppc/ppc4xx_devs.c | 12 ++++++------ hw/ppc/sam460ex.c | 2 +- include/hw/ppc/ppc4xx.h | 6 +++--- 5 files changed, 12 insertions(+), 12 deletions(-)
hw/ppc/ppc405.h +1 -1
@@ -232,7 +232,7 @@ struct Ppc405SoCState {Ppc405EbcState ebc;Ppc405OpbaState opba;Ppc405PobState pob; -Ppc405PlbState plb; +Ppc4xxPlbState plb;Ppc4xxMalState mal; };
hw/ppc/ppc405_uc.c +1 -1
@@ -1286,7 +1286,7 @@ static void ppc405_soc_instance_init(Object *obj)object_initialize_child (obj,"pob" , &s->pob,TYPE_PPC405_POB ); -object_initialize_child (obj,"plb" , &s->plb,TYPE_PPC405_PLB ); +object_initialize_child (obj,"plb" , &s->plb, TYPE_PPC4xx_PLB);object_initialize_child (obj,"mal" , &s->mal, TYPE_PPC4xx_MAL); }
hw/ppc/ppc4xx_devs.c +6 -6
@@ -671,7 +671,7 @@ enum {static uint32_t dcr_read_plb (void *opaque,int dcrn) { -Ppc405PlbState *plb = opaque; +Ppc4xxPlbState *plb = opaque;uint32_t ret;switch (dcrn) {
@@ -695,7 +695,7 @@ static uint32_t dcr_read_plb(void *opaque, int dcrn)static void dcr_write_plb (void *opaque,int dcrn,uint32_t val) { -Ppc405PlbState *plb = opaque; +Ppc4xxPlbState *plb = opaque;switch (dcrn) {case PLB0_ACR :
@@ -717,7 +717,7 @@ static void dcr_write_plb(void *opaque, int dcrn, uint32_t val)static void ppc405_plb_reset (DeviceState *dev) { -Ppc405PlbState *plb =PPC405_PLB (dev); +Ppc4xxPlbState *plb =PPC4xx_PLB (dev); plb->acr =0x00000000 ; plb->bear =0x00000000 ;
@@ -726,7 +726,7 @@ static void ppc405_plb_reset(DeviceState *dev)static void ppc405_plb_realize (DeviceState *dev,Error **errp) { -Ppc405PlbState *plb =PPC405_PLB (dev); +Ppc4xxPlbState *plb =PPC4xx_PLB (dev);Ppc4xxDcrDeviceState *dcr =PPC4xx_DCR_DEVICE (dev);ppc4xx_dcr_register (dcr,PLB3A0_ACR , plb, &dcr_read_plb, &dcr_write_plb);
@@ -784,9 +784,9 @@ static const TypeInfo ppc4xx_types[] = { .instance_finalize = ppc4xx_mal_finalize, .class_init = ppc4xx_mal_class_init, }, { - .name = TYPE_PPC405_PLB, + .name = TYPE_PPC4xx_PLB, .parent = TYPE_PPC4xx_DCR_DEVICE, - .instance_size = sizeof(Ppc405PlbState), + .instance_size = sizeof(Ppc4xxPlbState), .class_init = ppc405_plb_class_init, }, { .name = TYPE_PPC4xx_DCR_DEVICE,
hw/ppc/sam460ex.c +1 -1
@@ -308,7 +308,7 @@ static void sam460ex_init(MachineState *machine)ppc_dcr_init (env,NULL ,NULL );/* PLB arbitrer */ - dev =qdev_new (TYPE_PPC405_PLB ); + dev =qdev_new (TYPE_PPC4xx_PLB);ppc4xx_dcr_realize (PPC4xx_DCR_DEVICE (dev), cpu, &error_fatal);object_unref (OBJECT (dev));
include/hw/ppc/ppc4xx.h +3 -3
@@ -84,9 +84,9 @@ struct Ppc4xxMalState { };/* Peripheral local bus arbitrer */ -#define TYPE_PPC405_PLB "ppc405-plb" -OBJECT_DECLARE_SIMPLE_TYPE (Ppc405PlbState,PPC405_PLB ); -struct Ppc405PlbState { +#define TYPE_PPC4xx_PLB "ppc4xx-plb" +OBJECT_DECLARE_SIMPLE_TYPE (Ppc4xxPlbState, PPC4xx_PLB); +struct Ppc4xxPlbState {Ppc4xxDcrDeviceState parent_obj;uint32_t acr;
Signature · 1 line
2.37.2
[PULL 54/60] ppc/ppc405: Use an explicit I2C object
In reply to Daniel Henrique BarbozaFrom: Cédric Le Goater <[email protected]>
Having an explicit I2C model object will help if one day we want to add I2C devices on the bus from the machine init routine.
Message-Id: <68eb8b5ac408ca8cc981ebf53a3e154c0d34c7f6.1660746880.git.balaton@eik.bme.hu>
--- hw/ppc/ppc405.h | 2 ++ hw/ppc/ppc405_uc.c | 10 ++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-)
hw/ppc/ppc405.h +2 -0
@@ -28,6 +28,7 @@#include "qom/object.h" #include "hw/ppc/ppc4xx.h" #include "hw/intc/ppc-uic.h" +#include "hw/i2c/ppc4xx_i2c.h" #define PPC405EP_SDRAM_BASE 0x00000000#define PPC405EP_NVRAM_BASE 0xF0000000
@@ -215,6 +216,7 @@ struct Ppc405SoCState {Ppc405OcmState ocm;Ppc405GpioState gpio;Ppc405DmaState dma; +PPC4xxI2CState i2c;Ppc4xxEbcState ebc;Ppc405OpbaState opba;Ppc405PobState pob;
hw/ppc/ppc405_uc.c +8 -2
@@ -1096,6 +1096,8 @@ static void ppc405_soc_instance_init(Object *obj)object_initialize_child (obj,"dma" , &s->dma,TYPE_PPC405_DMA ); +object_initialize_child (obj,"i2c" , &s->i2c, TYPE_PPC4xx_I2C); +object_initialize_child (obj,"ebc" , &s->ebc, TYPE_PPC4xx_EBC);object_initialize_child (obj,"opba" , &s->opba,TYPE_PPC405_OPBA );
@@ -1188,8 +1190,12 @@ static void ppc405_soc_realize(DeviceState *dev, Error **errp) }/* I2C controller */ -sysbus_create_simple (TYPE_PPC4xx_I2C,0xef600500 , -qdev_get_gpio_in (DEVICE (&s->uic),2 )); + sbd =SYS_BUS_DEVICE (&s->i2c); +if (!sysbus_realize (sbd, errp)) { +return ; + } +sysbus_mmio_map (sbd,0 ,0xef600500 ); +sysbus_connect_irq (sbd,0 ,qdev_get_gpio_in (DEVICE (&s->uic),2 ));/* GPIO */ sbd =SYS_BUS_DEVICE (&s->gpio);
Signature · 1 line
2.37.2
[PULL 58/60] hw/ppc/Kconfig: Move imply before select
In reply to Daniel Henrique BarbozaFrom: BALATON Zoltan <[email protected]>
In pegasos2 section move imply before select to match other sections.
Message-Id: <4d46dde64c2e5df6db3f92426fb3ae885939c2b0.1660746880.git.balaton@eik.bme.hu>
--- hw/ppc/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/ppc/Kconfig +1 -1
@@ -71,6 +71,7 @@ config SAM460EX config PEGASOS2 bool + imply ATI_VGA select MV64361 select VT82C686 select IDE_VIA
@@ -78,7 +79,6 @@ config PEGASOS2 select VOF # This should come with VT82C686 select ACPI_X86 - imply ATI_VGA config PREP bool
Signature · 1 line
2.37.2
[PULL 59/60] ppc/ppc4xx: Fix sdram trace events
In reply to Daniel Henrique BarbozaFrom: Cédric Le Goater <[email protected]>
Message-Id: <0a3e454eb7fd5f2b807a9c752c28693f27829f1d.1660746880.git.balaton@eik.bme.hu>
--- hw/ppc/ppc4xx_devs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/ppc/ppc4xx_devs.c +1 -1
@@ -142,7 +142,7 @@ static void sdram_set_bcr(ppc4xx_sdram_t *sdram, int i, } sdram->bcr[i] = bcr &0xFFDEE001 ;if (enabled && (bcr &0x00000001 )) { -trace_ppc4xx_sdram_unmap (sdram_base (bcr),sdram_size (bcr)); +trace_ppc4xx_sdram_map (sdram_base (bcr),sdram_size (bcr));memory_region_init (&sdram->containers[i],NULL ,"sdram-containers" ,sdram_size (bcr)); memory_region_add_subregion(&sdram->containers[i], 0,
Signature · 1 line
2.37.2
Quoted 23 lines · Daniel Henrique Barboza
The following changes since commit
93fac696d241dccb04ebb9d23da55fc1e9d8ee36:Open 7.2 development tree (2022-08-30 09:40:41 -0700)
are available in the Git repository at:
https://gitlab.com/danielhb/qemu.git tags/pull-ppc-20220831
for you to fetch changes up to
2d9c27ac5c035823315f68c227ca1cc6313e9842:ppc4xx: Fix code style problems reported by checkpatch (2022-08-31 14:08:06 -0300)
----------------------------------------------------------------
ppc patch queue for 2022-08-31:In the first 7.2 queue we have changes in the powernv pnv-phb handling, the start of the QOMification of the ppc405 model, the removal of the taihu machine, a new SLOF image and others.
----------------------------------------------------------------
Alexey Kardashevskiy (1):
pseries: Update SLOF firmware image
Quoted 8 lines
BALATON Zoltan (9):
ppc4xx: Move PLB model toppc4xx_devs.c
ppc4xx: Rename ppc405-plb to ppc4xx-plb
ppc4xx: Move EBC model toppc4xx_devs.c
ppc4xx: Rename ppc405-ebc to ppc4xx-ebc hw/intc/ppc-uic: Convert ppc-uic to a PPC4xx DCR device
ppc405: Move machine specific code toppc405_boards.chw/ppc/sam3460ex: Remove PPC405 dependency from sam460ex
Seems like we have a typo in this patch title, sam3460ex should be sam460ex
Regards,
BALATON Zoltan
Quoted 113 lines
hw/ppc/Kconfig: Move imply before select
ppc4xx: Fix code style problems reported by checkpatchCédric Le Goater (22):
ppc/ppc405: Remove taihu machine
ppc/ppc405: Introduce a PPC405 generic machine ppc/ppc405: Move devices under the ref405ep machine ppc/ppc405: Move SRAM under the ref405ep machine ppc/ppc405: Introduce a PPC405 SoC ppc/ppc405: Start QOMification of the SoC ppc/ppc405: QOM'ify CPU
ppc/ppc4xx: Introduce a DCR device model ppc/ppc405: QOM'ify CPC
ppc/ppc405: QOM'ify GPT
ppc/ppc405: QOM'ify OCM
ppc/ppc405: QOM'ify GPIO
ppc/ppc405: QOM'ify DMA
ppc/ppc405: QOM'ify EBC
ppc/ppc405: QOM'ify OPBA
ppc/ppc405: QOM'ify POB
ppc/ppc405: QOM'ify PLB
ppc/ppc405: QOM'ify MAL
ppc/ppc405: Use an embedded PPCUIC model in SoC state ppc/ppc405: Use an explicit I2C object ppc/ppc405: QOM'ify FPGA
ppc/ppc4xx: Fix sdram trace eventsDaniel Henrique Barboza (24):
ppc/pnv: add PHB3 bus init helper
ppc/pnv: add PnvPHB base/proxy device
ppc/pnv: turn PnvPHB3 into a PnvPHB backend
ppc/pnv: add PHB4 bus init helper
ppc/pnv: turn PnvPHB4 into a PnvPHB backend
ppc/pnv: add pnv-phb-root-port device
ppc/pnv: remove pnv-phb3-root-port
ppc/pnv: remove pnv-phb4-root-port
ppc/pnv: remove root port name frompnv_phb_attach_root_port()ppc/pnv: removepecc->rp_model
ppc/pnv: remove PnvPHB4.version
ppc/pnv: moveattach_root_porthelper topnv-phb.cppc/pnv: add phb-id/chip-id PnvPHB3RootBus properties ppc/pnv: add phb-id/chip-id PnvPHB4RootBus properties ppc/pnv: set root port chassis and slot using Bus properties ppc/pnv: add helpers for pnv-phb user devices ppc/pnv: turn chip8->phbs[] into a PnvPHB* array ppc/pnv: enable user created pnv-phb for powernv8 ppc/pnv: add PHB4 helpers for user created pnv-phb ppc/pnv: enable user created pnv-phb for powernv9 ppc/pnv: changepnv_phb4_get_pec()to also retrievechip10->pecsppc/pnv: user creatable pnv-phb for powernv10 ppc/pnv: consolidate pnv_parent_*_fixup() helpers ppc/pnv: fix QOM parenting of user creatable root portsLucas Mateus Castro (alqotel) (2):
fpu: Add rebias bool, value and operation
target/ppc: Bugfix FP when OE/UE are setNicholas Piggin (2):
target/ppc: Fix host PVR matching for KVM
ppc/pnv: Add initial P9/10 SBE modelMAINTAINERS | 2 +- docs/about/deprecated.rst | 9 - docs/about/removed-features.rst | 6 + docs/system/ppc/embedded.rst | 1 - docs/system/ppc/pseries.rst | 2 +- fpu/softfloat-parts.c.inc | 21 +- fpu/softfloat.c | 2 + hw/intc/ppc-uic.c | 26 +- hw/pci-host/meson.build | 3 +- hw/pci-host/pnv_phb.c | 337 ++++++++++++ hw/pci-host/pnv_phb.h | 55 ++ hw/pci-host/pnv_phb3.c | 152 +++-- hw/pci-host/pnv_phb4.c | 191 +++---- hw/pci-host/pnv_phb4_pec.c | 11 +- hw/ppc/Kconfig | 3 +- hw/ppc/meson.build | 1 + hw/ppc/pnv.c | 188 +++++-- hw/ppc/pnv_sbe.c | 414 ++++++++++++++ hw/ppc/pnv_xscom.c | 3 + hw/ppc/ppc405.h | 200 +++++-- hw/ppc/ppc405_boards.c | 552 +++++++++---------- hw/ppc/ppc405_uc.c | 1156 ++++++++++++++------------------------- hw/ppc/ppc440_bamboo.c | 34 +- hw/ppc/ppc440_uc.c | 3 +- hw/ppc/ppc4xx_devs.c | 554 ++++++++++++++----- hw/ppc/ppc4xx_pci.c | 31 +- hw/ppc/sam460ex.c | 38 +- hw/ppc/trace-events | 14 +- hw/ppc/virtex_ml507.c | 7 +- include/fpu/softfloat-types.h | 4 + include/hw/intc/ppc-uic.h | 6 +- include/hw/pci-host/pnv_phb3.h | 19 +- include/hw/pci-host/pnv_phb4.h | 22 +- include/hw/ppc/pnv.h | 13 +- include/hw/ppc/pnv_sbe.h | 55 ++ include/hw/ppc/pnv_xscom.h | 12 + include/hw/ppc/ppc4xx.h | 76 ++- pc-bios/README | 2 +- pc-bios/slof.bin | Bin 992384 -> 995176 bytes roms/SLOF | 2 +- target/ppc/cpu-qom.h | 6 +- target/ppc/cpu.c | 2 + target/ppc/cpu_init.c | 91 ++- target/ppc/fpu_helper.c | 2 - target/ppc/machine.c | 2 +- 45 files changed, 2736 insertions(+), 1594 deletions(-)create mode 100644
hw/pci-host/pnv_phb.c
create mode 100644hw/pci-host/pnv_phb.h
create mode 100644hw/ppc/pnv_sbe.c
create mode 100644include/hw/ppc/pnv_sbe.h
Quoted 33 lines · BALATON Zoltan
Quoted 23 lines · Daniel Henrique Barboza
The following changes since commit
93fac696d241dccb04ebb9d23da55fc1e9d8ee36:Open 7.2 development tree (2022-08-30 09:40:41 -0700)
are available in the Git repository at:
https://gitlab.com/danielhb/qemu.git tags/pull-ppc-20220831
for you to fetch changes up to
2d9c27ac5c035823315f68c227ca1cc6313e9842:ppc4xx: Fix code style problems reported by checkpatch (2022-08-31 14:08:06 -0300)
----------------------------------------------------------------
ppc patch queue for 2022-08-31:In the first 7.2 queue we have changes in the powernv pnv-phb handling, the start of the QOMification of the ppc405 model, the removal of the taihu machine, a new SLOF image and others.
----------------------------------------------------------------
Alexey Kardashevskiy (1):
pseries: Update SLOF firmware imageQuoted 8 lines
BALATON Zoltan (9):
ppc4xx: Move PLB model toppc4xx_devs.c
ppc4xx: Rename ppc405-plb to ppc4xx-plb
ppc4xx: Move EBC model toppc4xx_devs.c
ppc4xx: Rename ppc405-ebc to ppc4xx-ebc hw/intc/ppc-uic: Convert ppc-uic to a PPC4xx DCR device
ppc405: Move machine specific code toppc405_boards.chw/ppc/sam3460ex: Remove PPC405 dependency from sam460ex
Quoted 1 line
Seems like we have a typo in this patch title, sam3460ex should be sam460ex
That completely went under the radar during 2-3 reviewed versions. Impressive :)
Richard/Peter, I've fixed the commit name and recreated the tag. I'll send just the cover-letter as a v2 since there were no code changes made.
Thanks,
Daniel
Quoted 117 lines
Regards,
BALATON ZoltanQuoted 113 lines
hw/ppc/Kconfig: Move imply before select
ppc4xx: Fix code style problems reported by checkpatchCédric Le Goater (22):
ppc/ppc405: Remove taihu machine
ppc/ppc405: Introduce a PPC405 generic machine ppc/ppc405: Move devices under the ref405ep machine ppc/ppc405: Move SRAM under the ref405ep machine ppc/ppc405: Introduce a PPC405 SoC ppc/ppc405: Start QOMification of the SoC ppc/ppc405: QOM'ify CPU
ppc/ppc4xx: Introduce a DCR device model ppc/ppc405: QOM'ify CPC
ppc/ppc405: QOM'ify GPT
ppc/ppc405: QOM'ify OCM
ppc/ppc405: QOM'ify GPIO
ppc/ppc405: QOM'ify DMA
ppc/ppc405: QOM'ify EBC
ppc/ppc405: QOM'ify OPBA
ppc/ppc405: QOM'ify POB
ppc/ppc405: QOM'ify PLB
ppc/ppc405: QOM'ify MAL
ppc/ppc405: Use an embedded PPCUIC model in SoC state ppc/ppc405: Use an explicit I2C object ppc/ppc405: QOM'ify FPGA
ppc/ppc4xx: Fix sdram trace eventsDaniel Henrique Barboza (24):
ppc/pnv: add PHB3 bus init helper
ppc/pnv: add PnvPHB base/proxy device
ppc/pnv: turn PnvPHB3 into a PnvPHB backend
ppc/pnv: add PHB4 bus init helper
ppc/pnv: turn PnvPHB4 into a PnvPHB backend
ppc/pnv: add pnv-phb-root-port device
ppc/pnv: remove pnv-phb3-root-port
ppc/pnv: remove pnv-phb4-root-port
ppc/pnv: remove root port name frompnv_phb_attach_root_port()ppc/pnv: removepecc->rp_model
ppc/pnv: remove PnvPHB4.version
ppc/pnv: moveattach_root_porthelper topnv-phb.cppc/pnv: add phb-id/chip-id PnvPHB3RootBus properties ppc/pnv: add phb-id/chip-id PnvPHB4RootBus properties ppc/pnv: set root port chassis and slot using Bus properties ppc/pnv: add helpers for pnv-phb user devices ppc/pnv: turn chip8->phbs[] into a PnvPHB* array ppc/pnv: enable user created pnv-phb for powernv8 ppc/pnv: add PHB4 helpers for user created pnv-phb ppc/pnv: enable user created pnv-phb for powernv9 ppc/pnv: changepnv_phb4_get_pec()to also retrievechip10->pecsppc/pnv: user creatable pnv-phb for powernv10 ppc/pnv: consolidate pnv_parent_*_fixup() helpers ppc/pnv: fix QOM parenting of user creatable root portsLucas Mateus Castro (alqotel) (2):
fpu: Add rebias bool, value and operation
target/ppc: Bugfix FP when OE/UE are setNicholas Piggin (2):
target/ppc: Fix host PVR matching for KVM
ppc/pnv: Add initial P9/10 SBE modelMAINTAINERS | 2 +- docs/about/deprecated.rst | 9 -
docs/about/removed-features.rst| 6 + docs/system/ppc/embedded.rst | 1 - docs/system/ppc/pseries.rst | 2 +- fpu/softfloat-parts.c.inc | 21 +-
fpu/softfloat.c | 2 +
hw/intc/ppc-uic.c | 26 +-
hw/pci-host/meson.build | 3 +-
hw/pci-host/pnv_phb.c | 337 ++++++++++++ hw/pci-host/pnv_phb.h | 55 ++
hw/pci-host/pnv_phb3.c | 152 +++-- hw/pci-host/pnv_phb4.c | 191 +++---- hw/pci-host/pnv_phb4_pec.c | 11 +-
hw/ppc/Kconfig | 3 +-
hw/ppc/meson.build | 1 +
hw/ppc/pnv.c | 188 +++++--
hw/ppc/pnv_sbe.c | 414 ++++++++++++++ hw/ppc/pnv_xscom.c | 3 +
hw/ppc/ppc405.h | 200 +++++-- hw/ppc/ppc405_boards.c | 552 +++++++++---------- hw/ppc/ppc405_uc.c | 1156 ++++++++++++++------------------------- hw/ppc/ppc440_bamboo.c | 34 +-
hw/ppc/ppc440_uc.c | 3 +-
hw/ppc/ppc4xx_devs.c | 554 ++++++++++++++----- hw/ppc/ppc4xx_pci.c | 31 +-
hw/ppc/sam460ex.c | 38 +-
hw/ppc/trace-events | 14 +-
hw/ppc/virtex_ml507.c | 7 +- include/fpu/softfloat-types.h | 4 + include/hw/intc/ppc-uic.h | 6 +- include/hw/pci-host/pnv_phb3.h | 19 +- include/hw/pci-host/pnv_phb4.h | 22 +-
include/hw/ppc/pnv.h | 13 +- include/hw/ppc/pnv_sbe.h | 55 ++ include/hw/ppc/pnv_xscom.h | 12 +
include/hw/ppc/ppc4xx.h | 76 ++-
pc-bios/README | 2 +-
pc-bios/slof.bin | Bin 992384 -> 995176 bytes roms/SLOF | 2 +-
target/ppc/cpu-qom.h | 6 +-
target/ppc/cpu.c | 2 +
target/ppc/cpu_init.c | 91 ++- target/ppc/fpu_helper.c | 2 -
target/ppc/machine.c | 2 +-45 files changed, 2736 insertions(+), 1594 deletions(-)create mode 100644
hw/pci-host/pnv_phb.c
create mode 100644hw/pci-host/pnv_phb.h
create mode 100644hw/ppc/pnv_sbe.c
create mode 100644include/hw/ppc/pnv_sbe.h