ppc-for-2.12 queue 20180111
The following changes since commit 3cee4db661ab9c0fce7937b3bbfa188a1845f31f:
Merge remote-tracking branch 'remotes/ericb/tags/pull-nbd-2018-01-08' into staging (2018-01-09 15:22:47 +0000)
are available in the Git repository at:
git://github.com/dgibson/qemu.git tags/ppc-for-2.12-20180111
for you to fetch changes up to 51f84465dd985fc21589b2eac1f18658fc9783e9:
spapr: Correct compatibility mode setting for hotplugged CPUs (2018-01-10 12:53:00 +1100)
----------------------------------------------------------------
ppc patch queue 2018-01-11
This pull request supersedes ppc-for-2.12-20180108 and several before it. The earlier pull request included a patch which exposed a bug in the ARM TCG backend. I've pulled that out and will repost once the ARM bug is fixed (a patch has been posted by Richard Henderson).
Higlights from this series:
* SLOF update
* Several new devices for embedded platforms
* Fix to correctly set compatiblity mode for hotplugged CPUs
* dtc compile fix for older MacOS versions
----------------------------------------------------------------
Alexey Kardashevskiy (1):
pseries: Update SLOF firmware image to qemu-slof-20171214
BALATON Zoltan (4):
sm501: Add panel hardware cursor registers also to read function
sm501: Add some more unimplemented registers
ppc4xx_i2c: Implement basic I2C functions
hw/ide: Emulate SiI3112 SATA controller
Cédric Le Goater (2):
ppc/pnv: change powernv_ prefix to pnv_ for overall naming consistency target/ppc: more use of the PPC_*() macros
David Gibson (1):
spapr: Correct compatibility mode setting for hotplugged CPUs
Greg Kurz (1):
spapr_pci: use warn_report()
John Arbuckle (1):
Update dtc to fix compilation problem on Mac OS 10.6
Thomas Huth (1):
hw/ppc: Remove the deprecated spapr-pci-vfio-host-bridge device
MAINTAINERS | 6 + default-configs/ppcemb-softmmu.mak | 1 + dtc | 2 +- hw/display/sm501.c | 30 +++ hw/i2c/ppc4xx_i2c.c | 198 +++++++++++++++++--- hw/ide/Makefile.objs | 1 + hw/ide/sii3112.c | 368 +++++++++++++++++++++++++++++++++++++ hw/ide/trace-events | 5 + hw/ppc/pnv.c | 94 +++++----- hw/ppc/pnv_bmc.c | 2 +- hw/ppc/pnv_core.c | 8 +- hw/ppc/pnv_lpc.c | 16 +- hw/ppc/pnv_psi.c | 4 +- hw/ppc/pnv_xscom.c | 10 +- hw/ppc/spapr.c | 2 +- hw/ppc/spapr_pci.c | 6 +- hw/ppc/spapr_pci_vfio.c | 47 ----- hw/ppc/spapr_rtas.c | 9 + include/hw/i2c/ppc4xx_i2c.h | 3 + include/hw/ppc/pnv.h | 10 +- include/hw/ppc/pnv_xscom.h | 4 +- pc-bios/README | 2 +- pc-bios/slof.bin | Bin 905200 -> 913880 bytes qemu-doc.texi | 5 - roms/SLOF | 2 +- scripts/device-crash-test | 1 - target/ppc/cpu.h | 56 +++--- target/ppc/int_helper.c | 2 +- 28 files changed, 705 insertions(+), 189 deletions(-) create mode 100644 hw/ide/sii3112.c
[Qemu-devel] [PULL 02/11] sm501: Add panel hardware cursor registers also to read function
From: BALATON Zoltan <[email protected]>
These were forgotten when adding panel layer support in ffd39257018 "SM501 emulation for R2D-SH4".
--- hw/display/sm501.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
hw/display/sm501.c +13 -0
@@ -956,6 +956,19 @@ static uint64_t sm501_disp_ctrl_read(void *opaque, hwaddr addr, ret = s->dc_panel_v_sync;break ; +case SM501_DC_PANEL_HWC_ADDR : + ret = s->dc_panel_hwc_addr; +break ; +case SM501_DC_PANEL_HWC_LOC : + ret = s->dc_panel_hwc_location; +break ; +case SM501_DC_PANEL_HWC_COLOR_1_2 : + ret = s->dc_panel_hwc_color_1_2; +break ; +case SM501_DC_PANEL_HWC_COLOR_3 : + ret = s->dc_panel_hwc_color_3; +break ; +case SM501_DC_VIDEO_CONTROL : ret = s->dc_video_control;break ;
Signature · 1 line
2.14.3
[Qemu-devel] [PULL 09/11] Update dtc to fix compilation problem on Mac OS 10.6
In reply to David GibsonFrom: John Arbuckle <[email protected]>
Currently QEMU does not build on Mac OS 10.6
because of a missing patch in the dtc
subproject. Updating dtc to make the patch
available fixes this problem.
--- dtc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
dtc +1 -1
@@ -1 +1 @@ -Subproject commit 558cd81bdd432769b59bff01240c44f82cfb1a9d +Subproject commit e54388015af1fb4bf04d0bca99caba1074d9cc42
Signature · 1 line
2.14.3
[Qemu-devel] [PULL 10/11] hw/ppc: Remove the deprecated spapr-pci-vfio-host-bridge device
In reply to David GibsonFrom: Thomas Huth <[email protected]>
It's a deprecated dummy device since QEMU v2.6.0. That should have been enough time to allow the users to update their scripts in case they still use it, so let's remove this legacy code now.
--- hw/ppc/spapr_pci_vfio.c | 47 ----------------------------------------------- qemu-doc.texi | 5 ----- scripts/device-crash-test | 1 - 3 files changed, 53 deletions(-)
hw/ppc/spapr_pci_vfio.c +0 -47
@@ -29,31 +29,6 @@#include "qemu/error-report.h" #include "sysemu/qtest.h" -#define TYPE_SPAPR_PCI_VFIO_HOST_BRIDGE "spapr-pci-vfio-host-bridge" - -#define SPAPR_PCI_VFIO_HOST_BRIDGE (obj) \ - OBJECT_CHECK(sPAPRPHBVFIOState, (obj), TYPE_SPAPR_PCI_VFIO_HOST_BRIDGE) - -typedef struct sPAPRPHBVFIOState sPAPRPHBVFIOState ; - -struct sPAPRPHBVFIOState { -sPAPRPHBState phb; - -int32_t iommugroupid; -}; - -static Property spapr_phb_vfio_properties[] = { -DEFINE_PROP_INT32 ("iommu" , sPAPRPHBVFIOState, iommugroupid,-1 ), -DEFINE_PROP_END_OF_LIST (), -}; - -static void spapr_phb_vfio_instance_init (Object *obj) -{ -if (!qtest_enabled ()) { -warn_report ("spapr-pci-vfio-host-bridge is deprecated" ); - } -} -bool spapr_phb_eeh_available (sPAPRPHBState *sphb) {return vfio_eeh_as_ok (&sphb->iommu_as);
@@ -218,25 +193,3 @@ int spapr_phb_vfio_eeh_configure(sPAPRPHBState *sphb)return RTAS_OUT_SUCCESS ; } - -static void spapr_phb_vfio_class_init (ObjectClass *klass,void *data) -{ -DeviceClass *dc =DEVICE_CLASS (klass); - - dc->props = spapr_phb_vfio_properties; -} - -static const TypeInfo spapr_phb_vfio_info = { - .name =TYPE_SPAPR_PCI_VFIO_HOST_BRIDGE , - .parent =TYPE_SPAPR_PCI_HOST_BRIDGE , - .instance_size =sizeof (sPAPRPHBVFIOState), - .instance_init = spapr_phb_vfio_instance_init, - .class_init = spapr_phb_vfio_class_init, -}; - -static void spapr_pci_vfio_register_types (void ) -{ -type_register_static (&spapr_phb_vfio_info); -} - -type_init (spapr_pci_vfio_register_types)
qemu-doc.texi +0 -5
@@ -2757,11 +2757,6 @@ The ``host_net_remove'' command is replaced by the ``netdev_del'' command. The ``ivshmem'' device type is replaced by either the ``ivshmem-plain'' or ``ivshmem-doorbell`` device types. -@subsection spapr-pci-vfio-host-bridge (since 2.6.0) - -The ``spapr-pci-vfio-host-bridge'' device type is replaced by -the ``spapr-pci-host-bridge'' device type. - @section System emulator machines @subsection Xilinx EP108 (since 2.11.0)
scripts/device-crash-test +0 -1
@@ -119,7 +119,6 @@ ERROR_WHITELIST = [ {'device':'scsi-generic', 'expected':True}, # drive property not set {'device':'scsi-hd', 'expected':True}, # drive property not set {'device':'spapr-pci-host-bridge', 'expected':True}, # BUID not specified for PHB - {'device':'spapr-pci-vfio-host-bridge', 'expected':True}, # BUID not specified for PHB {'device':'spapr-rng', 'expected':True}, # spapr-rng needs an RNG backend! {'device':'spapr-vty', 'expected':True}, # chardev property not set {'device':'tpm-tis', 'expected':True}, # tpm_tis: backend driver with id (null) could not be found
Signature · 1 line
2.14.3
[Qemu-devel] [PULL 11/11] spapr: Correct compatibility mode setting for hotplugged CPUs
In reply to David GibsonCurrently the pseries machine sets the compatibility mode for the guest's cpus in two places: 1) at machine reset and 2) after CAS negotiation.
This means that if we set or negotiate a compatiblity mode, then hotplug a cpu, the hotplugged cpu doesn't get the right mode set and will incorrectly have the full native features.
To correct this, we set the compatibility mode on a cpu when it is brought online with the 'start-cpu' RTAS call. Given that we no longer need to set the compatibility mode on all CPUs at machine reset, so we change that to only set the mode for the boot cpu.
--- hw/ppc/spapr.c | 2 +- hw/ppc/spapr_rtas.c | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-)
hw/ppc/spapr.c +1 -1
@@ -1504,7 +1504,7 @@ static void spapr_machine_reset(void)spapr_ovec_cleanup (spapr->ov5_cas); spapr->ov5_cas =spapr_ovec_new (); -ppc_set_compat_all (spapr->max_compat_pvr, &error_fatal); +ppc_set_compat (first_ppc_cpu, spapr->max_compat_pvr, &error_fatal); } fdt =spapr_build_fdt (spapr, rtas_addr, spapr->rtas_size);
hw/ppc/spapr_rtas.c +9 -0
@@ -163,6 +163,7 @@ static void rtas_start_cpu(PowerPCCPU *cpu_, sPAPRMachineState *spapr,CPUState *cs =CPU (cpu);CPUPPCState *env = &cpu->env;PowerPCCPUClass *pcc =POWERPC_CPU_GET_CLASS (cpu); +Error *local_err =NULL ;if (!cs->halted) {rtas_st (rets,0 ,RTAS_OUT_HW_ERROR );
@@ -174,6 +175,14 @@ static void rtas_start_cpu(PowerPCCPU *cpu_, sPAPRMachineState *spapr,* new cpu enters */ kvm_cpu_synchronize_state (cs); +/* Set compatibility mode to match existing cpus */ +ppc_set_compat (cpu,POWERPC_CPU (first_cpu)->compat_pvr, &local_err); +if (local_err) { +error_report_err (local_err); +rtas_st (rets,0 ,RTAS_OUT_HW_ERROR ); +return ; + } + env->msr = (1ULL <<MSR_SF ) | (1ULL <<MSR_ME );/* Enable Power-saving mode Exit Cause exceptions for the new CPU */
Signature · 1 line
2.14.3
[Qemu-devel] [PULL 03/11] sm501: Add some more unimplemented registers
In reply to David GibsonFrom: BALATON Zoltan <[email protected]>
These are not really implemented (just return zero or default values) but add these so guests accessing them can run.
--- hw/display/sm501.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
hw/display/sm501.c +17 -0
@@ -795,6 +795,8 @@ static uint64_t sm501_system_config_read(void *opaque, hwaddr addr,case SM501_ARBTRTN_CONTROL : ret = s->arbitration_control;break ; +case SM501_COMMAND_LIST_STATUS : + ret =0x00180002 ;/* FIFOs are empty, everything idle */ case SM501_IRQ_MASK : ret = s->irq_mask;break ;
@@ -812,6 +814,9 @@ static uint64_t sm501_system_config_read(void *opaque, hwaddr addr,case SM501_POWER_MODE_CONTROL : ret = s->power_mode_control;break ; +case SM501_ENDIAN_CONTROL : + ret =0 ;/* Only default little endian mode is supported */ +break ;default : printf("sm501 system config : not implemented register read."
@@ -865,6 +870,12 @@ static void sm501_system_config_write(void *opaque, hwaddr addr,case SM501_POWER_MODE_CONTROL : s->power_mode_control = value &0x00000003 ;break ; +case SM501_ENDIAN_CONTROL : +if (value &0x00000001 ) { +printf ("sm501 system config : big endian mode not implemented.\n" ); +abort (); + } +break ;default : printf("sm501 system config : not implemented register write."
@@ -924,6 +935,9 @@ static uint64_t sm501_disp_ctrl_read(void *opaque, hwaddr addr,case SM501_DC_PANEL_PANNING_CONTROL : ret = s->dc_panel_panning_control;break ; +case SM501_DC_PANEL_COLOR_KEY : +/* Not implemented yet */ +break ;case SM501_DC_PANEL_FB_ADDR : ret = s->dc_panel_fb_addr;break ;
@@ -1035,6 +1049,9 @@ static void sm501_disp_ctrl_write(void *opaque, hwaddr addr,case SM501_DC_PANEL_PANNING_CONTROL : s->dc_panel_panning_control = value &0xFF3FFF3F ;break ; +case SM501_DC_PANEL_COLOR_KEY : +/* Not implemented yet */ +break ;case SM501_DC_PANEL_FB_ADDR : s->dc_panel_fb_addr = value &0x8FFFFFF0 ;break ;
Signature · 1 line
2.14.3
Re: [Qemu-devel] [PULL 03/11] sm501: Add some more unimplemented registers
Quoted 16 lines · David Gibson
From: BALATON Zoltan <[email protected]>
These are not really implemented (just return zero or default values) but add these so guests accessing them can run.
Signed-off-by BALATON Zoltan <[email protected]>Signed-off-by David Gibson <[email protected]>--- hw/display/sm501.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)hw/display/sm501.c +0
-0
hw/display/sm501.c static uint64_t sm501_system_config_read(void *opaque, hwaddr addr, · line 802
Quoted 8 lines
hw/display/sm501.c +2
-0@@ -795,6 +795,8 @@ static uint64_t sm501_system_config_read(void *opaque, hwaddr addr,case SM501_ARBTRTN_CONTROL : ret = s->arbitration_control;break ; +case SM501_COMMAND_LIST_STATUS : + ret =0x00180002 ;/* FIFOs are empty, everything idle */ case SM501_IRQ_MASK : ret = s->irq_mask;break ;
Is this new case missing a "break;" statement? Coverity points out that we fall through and overwrite the previous assignment to 'ret' (CID 1385154).
thanks
-- PMM
Re: [Qemu-devel] [PULL 03/11] sm501: Add some more unimplemented registers
Quoted 21 lines · Peter Maydell
Quoted 20 lines · David Gibson
From: BALATON Zoltan <[email protected]>
These are not really implemented (just return zero or default values) but add these so guests accessing them can run.
Signed-off-by BALATON Zoltan <[email protected]>Signed-off-by David Gibson <[email protected]>--- hw/display/sm501.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)hw/display/sm501.c +1
-0@@ -795,6 +795,8 @@ static uint64_t sm501_system_config_read(void *opaque, hwaddr addr,case SM501_ARBTRTN_CONTROL : ret = s->arbitration_control;break ; +case SM501_COMMAND_LIST_STATUS :
Quoted 8 lines
hw/display/sm501.c static uint64_t sm501_system_config_read(void *opaque, hwaddr addr, · line 802
Quoted 4 lines
hw/display/sm501.c +1
-0+ ret =0x00180002 ;/* FIFOs are empty, everything idle */ case SM501_IRQ_MASK : ret = s->irq_mask;break ;Is this new case missing a "break;" statement? Coverity points out that we fall through and overwrite the previous assignment to 'ret' (CID 1385154).
Oops, stupid mistake. Indeed, Coverity is right, fall through is not intended here. Sent a patch, thank you for spotting it.
Regards,
BALATON Zoltan
[Qemu-devel] [PULL 05/11] spapr_pci: use warn_report()
In reply to David GibsonFrom: Greg Kurz <[email protected]>
These two are definitely warnings. Let's use the appropriate API.
--- hw/ppc/spapr_pci.c | 6 +++--- hw/ppc/spapr_pci_vfio.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-)
hw/ppc/spapr_pci.c +3 -3
@@ -1696,9 +1696,9 @@ static void spapr_phb_realize(DeviceState *dev, Error **errp)/* DMA setup */ if (((sphb->page_size_mask &qemu_getrampagesize ()) ==0 ) &&kvm_enabled ()) { -error_report ("System page size 0x%lx is not enabled in page_size_mask " -"(0x%" PRIx64"). Performance may be slow" , -qemu_getrampagesize (), sphb->page_size_mask); +warn_report ("System page size 0x%lx is not enabled in page_size_mask " +"(0x%" PRIx64"). Performance may be slow" , +qemu_getrampagesize (), sphb->page_size_mask); }for (i =0 ; i < windows_supported; ++i) {
hw/ppc/spapr_pci_vfio.c +1 -1
@@ -50,7 +50,7 @@ static Property spapr_phb_vfio_properties[] = {static void spapr_phb_vfio_instance_init (Object *obj) {if (!qtest_enabled ()) { -error_report ("spapr-pci-vfio-host-bridge is deprecated" ); +warn_report ("spapr-pci-vfio-host-bridge is deprecated" ); } }
Signature · 1 line
2.14.3
[Qemu-devel] [PULL 08/11] target/ppc: more use of the PPC_*() macros
In reply to David GibsonFrom: Cédric Le Goater <[email protected]>
Also introduce utilities to manipulate bitmasks (originaly from OPAL) which be will be used in the model of the XIVE interrupt controller.
--- hw/ppc/pnv_lpc.c | 10 ++++----- target/ppc/cpu.h | 56 ++++++++++++++++++++++++++++++------------------- target/ppc/int_helper.c | 2 +- 3 files changed, 40 insertions(+), 28 deletions(-)
hw/ppc/pnv_lpc.c +5 -5
@@ -146,13 +146,13 @@ static bool opb_write(PnvLpcController *lpc, uint32_t addr, uint8_t *data,return success; } -#define ECCB_CTL_READ (1ull << (63 - 15)) +#define ECCB_CTL_READ PPC_BIT(15)#define ECCB_CTL_SZ_LSH (63 - 7) -#define ECCB_CTL_SZ_MASK (0xfull << ECCB_CTL_SZ_LSH) -#define ECCB_CTL_ADDR_MASK 0xffffffffu; +#define ECCB_CTL_SZ_MASK PPC_BITMASK(4, 7) +#define ECCB_CTL_ADDR_MASK PPC_BITMASK(32, 63) -#define ECCB_STAT_OP_DONE (1ull << (63 - 52)) -#define ECCB_STAT_OP_ERR (1ull << (63 - 52)) +#define ECCB_STAT_OP_DONE PPC_BIT(52) +#define ECCB_STAT_OP_ERR PPC_BIT(52)#define ECCB_STAT_RD_DATA_LSH (63 - 37)#define ECCB_STAT_RD_DATA_MASK (0xffffffff << ECCB_STAT_RD_DATA_LSH)
target/ppc/cpu.h +34 -22
72 lines not on this page · raw message
target/ppc/int_helper.c +1 -1
@@ -183,7 +183,7 @@ uint64_t helper_bpermd(uint64_t rs, uint64_t rb)for (i =0 ; i <8 ; i++) {int index = (rs >> (i*8 )) &0xFF ;if (index <64 ) { -if (rb & (1ull << (63 -index))) { +if (rb &PPC_BIT (index)) { ra |=1 << i; } }
Signature · 1 line
2.14.3
[Qemu-devel] [PULL 04/11] ppc4xx_i2c: Implement basic I2C functions
In reply to David GibsonFrom: BALATON Zoltan <[email protected]>
Enough to please U-Boot and make it able to detect SDRAM SPD EEPROMs
--- hw/i2c/ppc4xx_i2c.c | 198 +++++++++++++++++++++++++++++++++++++------- include/hw/i2c/ppc4xx_i2c.h | 3 + 2 files changed, 171 insertions(+), 30 deletions(-)
hw/i2c/ppc4xx_i2c.c +168 -30
@@ -2,6 +2,8 @@* PPC4xx I2C controller emulation * * Copyright (c) 2007 Jocelyn Mayer +* Copyright (c) 2012 François Revol +* Copyright (c) 2016 BALATON Zoltan * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal
@@ -25,26 +27,118 @@#include "qemu/osdep.h" #include "qapi/error.h" #include "qemu-common.h" +#include "qemu/log.h" #include "cpu.h" #include "hw/hw.h" #include "hw/i2c/ppc4xx_i2c.h" -/*#define DEBUG_I2C*/ +#define PPC4xx_I2C_MEM_SIZE 0x12 -#define PPC4xx_I2C_MEM_SIZE 0x11 +#define IIC_CNTL_PT (1 << 0) +#define IIC_CNTL_READ (1 << 1) +#define IIC_CNTL_CHT (1 << 2) +#define IIC_CNTL_RPST (1 << 3) + +#define IIC_STS_PT (1 << 0) +#define IIC_STS_ERR (1 << 2) +#define IIC_STS_MDBS (1 << 5) + +#define IIC_EXTSTS_XFRA (1 << 0) + +#define IIC_XTCNTLSS_SRST (1 << 0) + +static void ppc4xx_i2c_reset (DeviceState *s) +{ +PPC4xxI2CState *i2c =PPC4xx_I2C (s); + +/* FIXME: Should also reset bus? +*if (s->address != ADDR_RESET) { +* i2c_end_transfer(s->bus); +*} +*/ + + i2c->mdata =0 ; + i2c->lmadr =0 ; + i2c->hmadr =0 ; + i2c->cntl =0 ; + i2c->mdcntl =0 ; + i2c->sts =0 ; + i2c->extsts =0x8f ; + i2c->sdata =0 ; + i2c->lsadr =0 ; + i2c->hsadr =0 ; + i2c->clkdiv =0 ; + i2c->intrmsk =0 ; + i2c->xfrcnt =0 ; + i2c->xtcntlss =0 ; + i2c->directcntl =0x0f ; + i2c->intr =0 ; +} + +static inline bool ppc4xx_i2c_is_master (PPC4xxI2CState *i2c) +{ +return true; +}static uint64_t ppc4xx_i2c_readb (void *opaque,hwaddr addr,unsigned int size) {PPC4xxI2CState *i2c =PPC4xx_I2C (opaque);uint64_t ret; -#ifdef DEBUG_I2C -printf ("%s: addr " TARGET_FMT_plx"\n" , __func__, addr); -#endif switch (addr) {case 0x00 : -/*i2c_readbyte(&i2c->mdata);*/ ret = i2c->mdata; +if (ppc4xx_i2c_is_master (i2c)) { + ret =0xff ; + +if (!(i2c->sts &IIC_STS_MDBS )) { +qemu_log_mask (LOG_GUEST_ERROR ,"[%s]%s: Trying to read " +"without starting transfer\n" , + TYPE_PPC4xx_I2C, __func__); + }else { +int pending = (i2c->cntl >>4 ) &3 ; + +/* get the next byte */ +int byte =i2c_recv (i2c->bus); + +if (byte <0 ) { +qemu_log_mask (LOG_GUEST_ERROR ,"[%s]%s: read failed " +"for device 0x%02x\n" , TYPE_PPC4xx_I2C, + __func__, i2c->lmadr); + ret =0xff ; + }else { + ret = byte; +/* Raise interrupt if enabled */ +/*ppc4xx_i2c_raise_interrupt(i2c)*/ ; + } + +if (!pending) { + i2c->sts &= ~IIC_STS_MDBS ; +/*i2c_end_transfer(i2c->bus);*/ +/*} else if (i2c->cntl & (IIC_CNTL_RPST | IIC_CNTL_CHT)) {*/ + }else if (pending) { +/* current smbus implementation doesn't like +multibyte xfer repeated start */ +i2c_end_transfer (i2c->bus); +if (i2c_start_transfer (i2c->bus, i2c->lmadr >>1 ,1 )) { +/* if non zero is returned, the adress is not valid */ + i2c->sts &= ~IIC_STS_PT ; + i2c->sts |=IIC_STS_ERR ; + i2c->extsts |=IIC_EXTSTS_XFRA ; + }else { +/*i2c->sts |= IIC_STS_PT;*/ + i2c->sts |=IIC_STS_MDBS ; + i2c->sts &= ~IIC_STS_ERR ; + i2c->extsts =0 ; + } + } + pending--; + i2c->cntl = (i2c->cntl &0xcf ) | (pending <<4 ); + } + }else { +qemu_log_mask (LOG_UNIMP ,"[%s]%s: slave mode not implemented\n" , + TYPE_PPC4xx_I2C, __func__); + }break ;case 0x02 : ret = i2c->sdata;
@@ -88,13 +182,15 @@ static uint64_t ppc4xx_i2c_readb(void *opaque, hwaddr addr, unsigned int size)case 0x10 : ret = i2c->directcntl;break ; +case 0x11 : + ret = i2c->intr; +break ;default : - ret =0x00 ; +qemu_log_mask (LOG_GUEST_ERROR ,"[%s]%s: Bad address at offset 0x%" + HWADDR_PRIx"\n" , TYPE_PPC4xx_I2C, __func__, addr); + ret =0 ;break ; } -#ifdef DEBUG_I2C -printf ("%s: addr " TARGET_FMT_plx" %02" PRIx64"\n" , __func__, addr, ret); -#endif return ret; }
@@ -103,26 +199,70 @@ static void ppc4xx_i2c_writeb(void *opaque, hwaddr addr, uint64_t value, unsigned int size) {PPC4xxI2CState *i2c = opaque; -#ifdef DEBUG_I2C -printf ("%s: addr " TARGET_FMT_plx" val %08" PRIx64"\n" , - __func__, addr, value); -#endif +switch (addr) {case 0x00 : i2c->mdata = value; -/*i2c_sendbyte(&i2c->mdata);*/ +if (!i2c_bus_busy (i2c->bus)) { +/* assume we start a write transfer */ +if (i2c_start_transfer (i2c->bus, i2c->lmadr >>1 ,0 )) { +/* if non zero is returned, the adress is not valid */ + i2c->sts &= ~IIC_STS_PT ; + i2c->sts |=IIC_STS_ERR ; + i2c->extsts |=IIC_EXTSTS_XFRA ; + }else { + i2c->sts |=IIC_STS_PT ; + i2c->sts &= ~IIC_STS_ERR ; + i2c->extsts =0 ; + } + } +if (i2c_bus_busy (i2c->bus)) { +if (i2c_send (i2c->bus, i2c->mdata)) { +/* if the target return non zero then end the transfer */ + i2c->sts &= ~IIC_STS_PT ; + i2c->sts |=IIC_STS_ERR ; + i2c->extsts |=IIC_EXTSTS_XFRA ; +i2c_end_transfer (i2c->bus); + } + }break ;case 0x02 : i2c->sdata = value;break ;case 0x04 : i2c->lmadr = value; +if (i2c_bus_busy (i2c->bus)) { +i2c_end_transfer (i2c->bus); + }break ;case 0x05 : i2c->hmadr = value;break ;case 0x06 : i2c->cntl = value; +if (i2c->cntl &IIC_CNTL_PT ) { +if (i2c->cntl &IIC_CNTL_READ ) { +if (i2c_bus_busy (i2c->bus)) { +/* end previous transfer */ + i2c->sts &= ~IIC_STS_PT ; +i2c_end_transfer (i2c->bus); + } +if (i2c_start_transfer (i2c->bus, i2c->lmadr >>1 ,1 )) { +/* if non zero is returned, the adress is not valid */ + i2c->sts &= ~IIC_STS_PT ; + i2c->sts |=IIC_STS_ERR ; + i2c->extsts |=IIC_EXTSTS_XFRA ; + }else { +/*i2c->sts |= IIC_STS_PT;*/ + i2c->sts |=IIC_STS_MDBS ; + i2c->sts &= ~IIC_STS_ERR ; + i2c->extsts =0 ; + } + }else { +/* we actually already did the write transfer... */ + i2c->sts &= ~IIC_STS_PT ; + } + }break ;case 0x07 : i2c->mdcntl = value &0xDF ;
@@ -135,6 +275,7 @@ static void ppc4xx_i2c_writeb(void *opaque, hwaddr addr, uint64_t value,break ;case 0x0A : i2c->lsadr = value; +/*i2c_set_slave_address(i2c->bus, i2c->lsadr);*/ break ;case 0x0B : i2c->hsadr = value;
@@ -149,11 +290,23 @@ static void ppc4xx_i2c_writeb(void *opaque, hwaddr addr, uint64_t value, i2c->xfrcnt = value &0x77 ;break ;case 0x0F : +if (value &IIC_XTCNTLSS_SRST ) { +/* Is it actually a full reset? U-Boot sets some regs before */ +ppc4xx_i2c_reset (DEVICE (i2c)); +break ; + } i2c->xtcntlss = value;break ;case 0x10 : i2c->directcntl = value &0x7 ;break ; +case 0x11 : + i2c->intr = value; +break ; +default : +qemu_log_mask (LOG_GUEST_ERROR ,"[%s]%s: Bad address at offset 0x%" + HWADDR_PRIx"\n" , TYPE_PPC4xx_I2C, __func__, addr); +break ; } }
@@ -167,21 +320,6 @@ static const MemoryRegionOps ppc4xx_i2c_ops = { .endianness = DEVICE_NATIVE_ENDIAN, }; -static void ppc4xx_i2c_reset (DeviceState *s) -{ -PPC4xxI2CState *i2c =PPC4xx_I2C (s); - - i2c->mdata =0x00 ; - i2c->sdata =0x00 ; - i2c->cntl =0x00 ; - i2c->mdcntl =0x00 ; - i2c->sts =0x00 ; - i2c->extsts =0x00 ; - i2c->clkdiv =0x00 ; - i2c->xfrcnt =0x00 ; - i2c->directcntl =0x0F ; -} -static void ppc4xx_i2c_init (Object *o) {PPC4xxI2CState *s =PPC4xx_I2C (o);
include/hw/i2c/ppc4xx_i2c.h +3 -0
@@ -2,6 +2,8 @@* PPC4xx I2C controller emulation * * Copyright (c) 2007 Jocelyn Mayer +* Copyright (c) 2012 François Revol +* Copyright (c) 2016 BALATON Zoltan * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal
@@ -55,6 +57,7 @@ typedef struct PPC4xxI2CState {uint8_t xfrcnt;uint8_t xtcntlss;uint8_t directcntl; + uint8_t intr; } PPC4xxI2CState;#endif /* PPC4XX_I2C_H */
Signature · 1 line
2.14.3
[Qemu-devel] [PULL 06/11] hw/ide: Emulate SiI3112 SATA controller
In reply to David GibsonFrom: BALATON Zoltan <[email protected]>
This is a common generic PCI SATA controller that is also used in PCs but more importantly guests running on the Sam460ex board prefer this card and have a driver for it (unlike for other SATA controllers already emulated).
--- MAINTAINERS | 6 + default-configs/ppcemb-softmmu.mak | 1 + hw/ide/Makefile.objs | 1 + hw/ide/sii3112.c | 368 +++++++++++++++++++++++++++++++++++++ hw/ide/trace-events | 5 + 5 files changed, 381 insertions(+) create mode 100644 hw/ide/sii3112.c
MAINTAINERS +6 -0
@@ -765,6 +765,12 @@ L: [email protected] S: Odd Fixes F: hw/ppc/virtex_ml507.c +sam460ex +M: BALATON Zoltan <[email protected]> +L: [email protected] +S: Maintained +F: hw/ide/sii3112.c + SH4 Machines ------------ R2D
default-configs/ppcemb-softmmu.mak +1 -0
@@ -16,3 +16,4 @@ CONFIG_I8259=y CONFIG_XILINX=y CONFIG_XILINX_ETHLITE=y CONFIG_SM501=y +CONFIG_IDE_SII3112=y
hw/ide/Makefile.objs +1 -0
@@ -11,3 +11,4 @@ common-obj-$(CONFIG_MICRODRIVE) += microdrive.o common-obj-$(CONFIG_AHCI) += ahci.o common-obj-$(CONFIG_AHCI) += ich.o common-obj-$(CONFIG_ALLWINNER_A10) += ahci-allwinner.o +common-obj-$(CONFIG_IDE_SII3112) += sii3112.o
hw/ide/sii3112.c new file +368 -0
368 lines not on this page · raw message
hw/ide/trace-events +5 -0
@@ -37,6 +37,11 @@ bmdma_addr_write(uint64_t data) "data: 0x%016"PRIx64 bmdma_read(uint64_t addr, uint8_t val) "bmdma: readb 0x%"PRIx64" : 0x%02x" bmdma_write(uint64_t addr, uint64_t val) "bmdma: writeb 0x%"PRIx64" : 0x%02"PRIx64 +# hw/ide/sii3112.c +sii3112_read(int size, uint64_t addr, uint64_t val) "bmdma: read (size %d) 0x%"PRIx64" : 0x%02"PRIx64 +sii3112_write(int size, uint64_t addr, uint64_t val) "bmdma: write (size %d) 0x%"PRIx64" : 0x%02"PRIx64 +sii3112_set_irq(int channel, int level) "channel %d level %d" + # hw/ide/via.c bmdma_read_via(uint64_t addr, uint32_t val) "bmdma: readb 0x%"PRIx64" : 0x%02x" bmdma_write_via(uint64_t addr, uint64_t val) "bmdma: writeb 0x%"PRIx64" : 0x%02"PRIx64
Signature · 1 line
2.14.3
Re: [Qemu-devel] [PULL 06/11] hw/ide: Emulate SiI3112 SATA controller
Quoted 12 lines · David Gibson
From: BALATON Zoltan <[email protected]>
This is a common generic PCI SATA controller that is also used in PCs but more importantly guests running on the Sam460ex board prefer this card and have a driver for it (unlike for other SATA controllers already emulated).
Signed-off-by BALATON Zoltan <[email protected]>Acked-by John Snow <[email protected]>Signed-off-by David Gibson <[email protected]>---
hw/ide/sii3112.c line 84
Quoted 8 lines
hw/ide/sii3112.c new file +8
-0+case 0x10 : + val = d->i.bmdma[0 ].cmd; + val |= (d->regs[0 ].confstat & (1UL <<11 ) ? (1 <<4 ) :0 );/*SATAINT0*/ + val |= (d->regs[1 ].confstat & (1UL <<11 ) ? (1 <<6 ) :0 );/*SATAINT1*/ + val |= (d->i.bmdma[1 ].status &BM_STATUS_INT ? (1 <<14 ) :0 ); + val |= d->i.bmdma[0 ].status <<16 ; + val |= d->i.bmdma[1 ].status <<24 ; +break ;
Hi. Coverity points out (CID 1385151) that the << 24 here will potentially inadvertently set the high 32 bits of val if the top bit in bmdma[1].status is 1. (This is because in x << 24 where x is uint8_t x gets promoted to signed int, and then when that signed int with a high bit set is converted to uint64_t for the logical or it's done by sign-extending.
Adding a cast, like
val |= (uint32_t)d->i.bmdma[1].status << 24;
should fix this.
thanks
-- PMM
Re: [Qemu-devel] [PULL 06/11] hw/ide: Emulate SiI3112 SATA controller
Quoted 29 lines · Peter Maydell
Quoted 12 lines · David Gibson
From: BALATON Zoltan <[email protected]>
This is a common generic PCI SATA controller that is also used in PCs but more importantly guests running on the Sam460ex board prefer this card and have a driver for it (unlike for other SATA controllers already emulated).
Signed-off-by BALATON Zoltan <[email protected]>Acked-by John Snow <[email protected]>Signed-off-by David Gibson <[email protected]>---
hw/ide/sii3112.c line 84
Quoted 8 lines
hw/ide/sii3112.c new file +8
-0+case 0x10 : + val = d->i.bmdma[0 ].cmd; + val |= (d->regs[0 ].confstat & (1UL <<11 ) ? (1 <<4 ) :0 );/*SATAINT0*/ + val |= (d->regs[1 ].confstat & (1UL <<11 ) ? (1 <<6 ) :0 );/*SATAINT1*/ + val |= (d->i.bmdma[1 ].status &BM_STATUS_INT ? (1 <<14 ) :0 ); + val |= d->i.bmdma[0 ].status <<16 ; + val |= d->i.bmdma[1 ].status <<24 ; +break ;Hi. Coverity points out (CID 1385151) that the << 24 here will potentially inadvertently set the high 32 bits of val if the top bit in bmdma[1].status is 1. (This is because in x << 24 where x is
uint8_tx gets promoted to signed int, and then when that signed int with a high bit set is converted touint64_tfor the logical or it's done by sign-extending.
Quoted 4 lines
Adding a cast, like
val |= (uint32_t)d->i.bmdma[1].status << 24;should fix this.
Sent another patch for this. Also adding casts to similar places (some of which might not be needed but should not hurt and there for symmetry).
Thank you,
BALATON Zoltan
Re: [Qemu-devel] [PULL 06/11] hw/ide: Emulate SiI3112 SATA controller
In reply to David GibsonQuoted 11 lines · David Gibson
From: BALATON Zoltan <[email protected]>
This is a common generic PCI SATA controller that is also used in PCs but more importantly guests running on the Sam460ex board prefer this card and have a driver for it (unlike for other SATA controllers already emulated).
Signed-off-by BALATON Zoltan <[email protected]>Acked-by John Snow <[email protected]>Signed-off-by David Gibson <[email protected]>
hw/ide/sii3112.c line 141
Quoted 3 lines
hw/ide/sii3112.c new file +3
-0+case 0x1c8 : + val = d->regs[1 ].sien <<16 ; +break ;
There's a similar unintended-sign-extension issue here (CID 1385145); again, a cast should fix.
thanks
-- PMM
Re: [Qemu-devel] [Qemu-ppc] [PULL 06/11] hw/ide: Emulate SiI3112 SATA controller
In reply to David GibsonQuoted 6 lines · David Gibson
From: BALATON Zoltan <[email protected]>
This is a common generic PCI SATA controller that is also used in PCs but more importantly guests running on the Sam460ex board prefer this card and have a driver for it (unlike for other SATA controllers already emulated).
Hi,
looks like this new device can now be used to crash QEMU in certain circumstances:
$ ppc64-softmmu/qemu-system-ppc64 -monitor stdio QEMU 2.11.50 monitor - type 'help' for more information (qemu) device_add sii3112,id=x (qemu) device_del x qemu-system-ppc64: /home/thuth/devel/qemu/memory.c:2346: memory_region_del_subregion: Assertion `subregion->container == mr' failed. Aborted (core dumped)
Any ideas how to fix this?
Thomas
Re: [Qemu-devel] [Qemu-ppc] [PULL 06/11] hw/ide: Emulate SiI3112 SATA controller
Quoted 21 lines · Thomas Huth
Quoted 6 lines · David Gibson
From: BALATON Zoltan <[email protected]>
This is a common generic PCI SATA controller that is also used in PCs but more importantly guests running on the Sam460ex board prefer this card and have a driver for it (unlike for other SATA controllers already emulated).
Hi,
looks like this new device can now be used to crash QEMU in certain circumstances:
$ ppc64-softmmu/qemu-system-ppc64 -monitor stdio QEMU 2.11.50 monitor - type 'help' for more information (qemu) device_add sii3112,id=x (qemu) device_del x qemu-system-ppc64: /home/thuth/devel/qemu/memory.c:2346: memory_region_del_subregion: Assertion `subregion->container == mr' failed. Aborted (core dumped)
Quoted 1 line
Any ideas how to fix this?
Looks like the exit function that causes this crash was left there by mistake and is not needed. I've sent a patch to remove it.
Thank you,
BALATON Zoltan
[Qemu-devel] [PULL 07/11] ppc/pnv: change powernv_ prefix to pnv_ for overall naming consistency
In reply to David GibsonFrom: Cédric Le Goater <[email protected]>
The 'pnv' prefix is now used for all and the routines populating the device tree start with 'pnv_dt'. The handler of the PnvXScomInterface is also renamed to 'dt_xscom' which should reflect that it is populating the device tree under the 'xscom@' node of the chip.
--- hw/ppc/pnv.c | 94 ++++++++++++++++++++++------------------------ hw/ppc/pnv_bmc.c | 2 +- hw/ppc/pnv_core.c | 8 ++-- hw/ppc/pnv_lpc.c | 6 +-- hw/ppc/pnv_psi.c | 4 +- hw/ppc/pnv_xscom.c | 10 ++--- include/hw/ppc/pnv.h | 10 ++--- include/hw/ppc/pnv_xscom.h | 4 +- 8 files changed, 67 insertions(+), 71 deletions(-)
hw/ppc/pnv.c +45 -49
@@ -77,8 +77,7 @@ static const char *pnv_chip_core_typename(const PnvChip *o)* that has a different "affinity". In practice, it means one range * per chip. */ -static void powernv_populate_memory_node (void *fdt,int chip_id,hwaddr start, -hwaddr size) +static void pnv_dt_memory (void *fdt,int chip_id,hwaddr start,hwaddr size) {char *mem_name;uint64_t mem_reg_property[2 ];
@@ -119,7 +118,7 @@ static int get_cpus_node(void *fdt)* device tree, used in XSCOM to address cores and in interrupt * servers. */ -static void powernv_create_core_node (PnvChip *chip,PnvCore *pc,void *fdt) +static void pnv_dt_core (PnvChip *chip,PnvCore *pc,void *fdt) {CPUState *cs =CPU (DEVICE (pc->threads));DeviceClass *dc =DEVICE_GET_CLASS (cs);
@@ -228,8 +227,8 @@ static void powernv_create_core_node(PnvChip *chip, PnvCore *pc, void *fdt) servers_prop, sizeof(servers_prop)))); } -static void powernv_populate_icp (PnvChip *chip,void *fdt,uint32_t pir, -uint32_t nr_threads) +static void pnv_dt_icp (PnvChip *chip,void *fdt,uint32_t pir, +uint32_t nr_threads) {uint64_t addr =PNV_ICP_BASE (chip) | (pir <<12 );char *name;
@@ -277,13 +276,13 @@ static int pnv_chip_lpc_offset(PnvChip *chip, void *fdt)return offset; } -static void powernv_populate_chip (PnvChip *chip,void *fdt) +static void pnv_dt_chip (PnvChip *chip,void *fdt) {const char *typename =pnv_chip_core_typename (chip);size_t typesize =object_type_get_instance_size (typename);int i; -pnv_xscom_populate (chip, fdt,0 ); +pnv_dt_xscom (chip, fdt,0 );/* The default LPC bus of a multichip system is on chip 0. It's * recognized by the firmware (skiboot) using a "primary"
@@ -298,20 +297,18 @@ static void powernv_populate_chip(PnvChip *chip, void *fdt)for (i =0 ; i < chip->nr_cores; i++) {PnvCore *pnv_core =PNV_CORE (chip->cores + i * typesize); -powernv_create_core_node (chip, pnv_core, fdt); +pnv_dt_core (chip, pnv_core, fdt);/* Interrupt Control Presenters (ICP). One per core. */ -powernv_populate_icp (chip, fdt, pnv_core->pir, -CPU_CORE (pnv_core)->nr_threads); +pnv_dt_icp (chip, fdt, pnv_core->pir,CPU_CORE (pnv_core)->nr_threads); }if (chip->ram_size) { -powernv_populate_memory_node (fdt, chip->chip_id, chip->ram_start, - chip->ram_size); +pnv_dt_memory (fdt, chip->chip_id, chip->ram_start, chip->ram_size); } } -static void powernv_populate_rtc (ISADevice *d,void *fdt,int lpc_off) +static void pnv_dt_rtc (ISADevice *d,void *fdt,int lpc_off) {uint32_t io_base = d->ioport_id;uint32_t io_regs[] = {
@@ -331,7 +328,7 @@ static void powernv_populate_rtc(ISADevice *d, void *fdt, int lpc_off)_FDT ((fdt_setprop_string (fdt, node,"compatible" ,"pnpPNP,b00" ))); } -static void powernv_populate_serial (ISADevice *d,void *fdt,int lpc_off) +static void pnv_dt_serial (ISADevice *d,void *fdt,int lpc_off) {const char compatible[] ="ns16550\0pnpPNP,501" ;uint32_t io_base = d->ioport_id;
@@ -362,7 +359,7 @@ static void powernv_populate_serial(ISADevice *d, void *fdt, int lpc_off)_FDT ((fdt_setprop_string (fdt, node,"device_type" ,"serial" ))); } -static void powernv_populate_ipmi_bt (ISADevice *d,void *fdt,int lpc_off) +static void pnv_dt_ipmi_bt (ISADevice *d,void *fdt,int lpc_off) {const char compatible[] ="bt\0ipmi-bt" ;uint32_t io_base;
@@ -401,17 +398,17 @@ typedef struct ForeachPopulateArgs {int offset; } ForeachPopulateArgs; -static int powernv_populate_isa_device (DeviceState *dev,void *opaque) +static int pnv_dt_isa_device (DeviceState *dev,void *opaque) {ForeachPopulateArgs *args = opaque;ISADevice *d =ISA_DEVICE (dev);if (object_dynamic_cast (OBJECT (dev),TYPE_MC146818_RTC )) { -powernv_populate_rtc (d, args->fdt, args->offset); +pnv_dt_rtc (d, args->fdt, args->offset); }else if (object_dynamic_cast (OBJECT (dev),TYPE_ISA_SERIAL )) { -powernv_populate_serial (d, args->fdt, args->offset); +pnv_dt_serial (d, args->fdt, args->offset); }else if (object_dynamic_cast (OBJECT (dev),"isa-ipmi-bt" )) { -powernv_populate_ipmi_bt (d, args->fdt, args->offset); +pnv_dt_ipmi_bt (d, args->fdt, args->offset); }else {error_report ("unknown isa device %s@i%x" ,qdev_fw_name (dev), d->ioport_id);
@@ -420,7 +417,7 @@ static int powernv_populate_isa_device(DeviceState *dev, void *opaque)return 0 ; } -static void powernv_populate_isa (ISABus *bus,void *fdt,int lpc_offset) +static void pnv_dt_isa (ISABus *bus,void *fdt,int lpc_offset) {ForeachPopulateArgs args = { .fdt = fdt,
@@ -429,14 +426,13 @@ static void powernv_populate_isa(ISABus *bus, void *fdt, int lpc_offset)/* ISA devices are not necessarily parented to the ISA bus so we * can not use object_child_foreach() */ -qbus_walk_children (BUS (bus), powernv_populate_isa_device, -NULL ,NULL ,NULL , &args); +qbus_walk_children (BUS (bus), pnv_dt_isa_device,NULL ,NULL ,NULL , &args); } -static void *powernv_create_fdt (MachineState *machine) +static void *pnv_dt_create (MachineState *machine) {const char plat_compat[] ="qemu,powernv\0ibm,powernv" ; -PnvMachineState *pnv =POWERNV_MACHINE (machine); +PnvMachineState *pnv =PNV_MACHINE (machine);void *fdt;char *buf;int off;
@@ -479,15 +475,15 @@ static void *powernv_create_fdt(MachineState *machine)/* Populate device tree for each chip */ for (i =0 ; i < pnv->num_chips; i++) { -powernv_populate_chip (pnv->chips[i], fdt); +pnv_dt_chip (pnv->chips[i], fdt); }/* Populate ISA devices on chip 0 */ lpc_offset =pnv_chip_lpc_offset (pnv->chips[0 ], fdt); -powernv_populate_isa (pnv->isa_bus, fdt, lpc_offset); +pnv_dt_isa (pnv->isa_bus, fdt, lpc_offset);if (pnv->bmc) { -pnv_bmc_populate_sensors (pnv->bmc, fdt); +pnv_dt_bmc_sensors (pnv->bmc, fdt); }return fdt;
@@ -495,17 +491,17 @@ static void *powernv_create_fdt(MachineState *machine)static void pnv_powerdown_notify (Notifier *n,void *opaque) { -PnvMachineState *pnv =POWERNV_MACHINE (qdev_get_machine ()); +PnvMachineState *pnv =PNV_MACHINE (qdev_get_machine ());if (pnv->bmc) {pnv_bmc_powerdown (pnv->bmc); } } -static void ppc_powernv_reset (void ) +static void pnv_reset (void ) {MachineState *machine =MACHINE (qdev_get_machine ()); -PnvMachineState *pnv =POWERNV_MACHINE (machine); +PnvMachineState *pnv =PNV_MACHINE (machine);void *fdt;Object *obj;
@@ -524,7 +520,7 @@ static void ppc_powernv_reset(void) pnv->bmc =IPMI_BMC (obj); } - fdt =powernv_create_fdt (machine); + fdt =pnv_dt_create (machine);/* Pack resulting tree */ _FDT ((fdt_pack (fdt)));
@@ -552,9 +548,9 @@ static ISABus *pnv_isa_create(PnvChip *chip)return isa_bus; } -static void ppc_powernv_init (MachineState *machine) +static void pnv_init (MachineState *machine) { -PnvMachineState *pnv =POWERNV_MACHINE (machine); +PnvMachineState *pnv =PNV_MACHINE (machine);MemoryRegion *ram;char *fw_filename;long fw_size;
@@ -567,7 +563,7 @@ static void ppc_powernv_init(MachineState *machine) } ram =g_new (MemoryRegion,1 ); -memory_region_allocate_system_memory (ram,NULL ,"ppc_powernv.ram" , +memory_region_allocate_system_memory (ram,NULL ,"pnv.ram" , machine->ram_size);memory_region_add_subregion (get_system_memory (),0 , ram);
@@ -974,7 +970,7 @@ static void pnv_chip_class_init(ObjectClass *klass, void *data)static ICSState *pnv_ics_get (XICSFabric *xi,int irq) { -PnvMachineState *pnv =POWERNV_MACHINE (xi); +PnvMachineState *pnv =PNV_MACHINE (xi);int i;for (i =0 ; i < pnv->num_chips; i++) {
@@ -987,7 +983,7 @@ static ICSState *pnv_ics_get(XICSFabric *xi, int irq)static void pnv_ics_resend (XICSFabric *xi) { -PnvMachineState *pnv =POWERNV_MACHINE (xi); +PnvMachineState *pnv =PNV_MACHINE (xi);int i;for (i =0 ; i < pnv->num_chips; i++) {
@@ -1021,7 +1017,7 @@ static ICPState *pnv_icp_get(XICSFabric *xi, int pir)static void pnv_pic_print_info (InterruptStatsProvider *obj,Monitor *mon) { -PnvMachineState *pnv =POWERNV_MACHINE (obj); +PnvMachineState *pnv =PNV_MACHINE (obj);int i;CPUState *cs;
@@ -1039,13 +1035,13 @@ static void pnv_pic_print_info(InterruptStatsProvider *obj,static void pnv_get_num_chips (Object *obj,Visitor *v,const char *name,void *opaque,Error **errp) { -visit_type_uint32 (v, name, &POWERNV_MACHINE (obj)->num_chips, errp); +visit_type_uint32 (v, name, &PNV_MACHINE (obj)->num_chips, errp); }static void pnv_set_num_chips (Object *obj,Visitor *v,const char *name,void *opaque,Error **errp) { -PnvMachineState *pnv =POWERNV_MACHINE (obj); +PnvMachineState *pnv =PNV_MACHINE (obj);uint32_t num_chips;Error *local_err =NULL ;
@@ -1067,13 +1063,13 @@ static void pnv_set_num_chips(Object *obj, Visitor *v, const char *name, pnv->num_chips = num_chips; } -static void powernv_machine_initfn (Object *obj) +static void pnv_machine_initfn (Object *obj) { -PnvMachineState *pnv =POWERNV_MACHINE (obj); +PnvMachineState *pnv =PNV_MACHINE (obj); pnv->num_chips =1 ; } -static void powernv_machine_class_props_init (ObjectClass *oc) +static void pnv_machine_class_props_init (ObjectClass *oc) { object_class_property_add(oc, "num-chips", "uint32", pnv_get_num_chips, pnv_set_num_chips,
@@ -1083,15 +1079,15 @@ static void powernv_machine_class_props_init(ObjectClass *oc) NULL); } -static void powernv_machine_class_init (ObjectClass *oc,void *data) +static void pnv_machine_class_init (ObjectClass *oc,void *data) {MachineClass *mc =MACHINE_CLASS (oc);XICSFabricClass *xic =XICS_FABRIC_CLASS (oc);InterruptStatsProviderClass *ispc =INTERRUPT_STATS_PROVIDER_CLASS (oc); mc->desc ="IBM PowerNV (Non-Virtualized)" ; - mc->init = ppc_powernv_init; - mc->reset = ppc_powernv_reset; + mc->init = pnv_init; + mc->reset = pnv_reset; mc->max_cpus =MAX_CPUS ; mc->default_cpu_type =POWERPC_CPU_TYPE_NAME ("power8_v2.0" ); mc->block_default_type =IF_IDE ;/* Pnv provides a AHCI device for
@@ -1104,7 +1100,7 @@ static void powernv_machine_class_init(ObjectClass *oc, void *data) xic->ics_resend = pnv_ics_resend; ispc->print_info = pnv_pic_print_info; -powernv_machine_class_props_init (oc); +pnv_machine_class_props_init (oc); }#define DEFINE_PNV_CHIP_TYPE (type, class_initfn) \
@@ -1116,11 +1112,11 @@ static void powernv_machine_class_init(ObjectClass *oc, void *data)static const TypeInfo types[] = { { - .name =TYPE_POWERNV_MACHINE , + .name =TYPE_PNV_MACHINE , .parent =TYPE_MACHINE , .instance_size =sizeof (PnvMachineState), - .instance_init = powernv_machine_initfn, - .class_init = powernv_machine_class_init, + .instance_init = pnv_machine_initfn, + .class_init = pnv_machine_class_init, .interfaces = (InterfaceInfo []) { {TYPE_XICS_FABRIC }, {TYPE_INTERRUPT_STATS_PROVIDER },
hw/ppc/pnv_bmc.c +1 -1
@@ -73,7 +73,7 @@ void pnv_bmc_powerdown(IPMIBmc *bmc)pnv_gen_oem_sel (bmc,SOFT_OFF ); } -void pnv_bmc_populate_sensors (IPMIBmc *bmc,void *fdt) +void pnv_dt_bmc_sensors (IPMIBmc *bmc,void *fdt) {int offset;int i;
hw/ppc/pnv_core.c +4 -4
@@ -37,7 +37,7 @@ static const char *pnv_core_cpu_typename(PnvCore *pc)return cpu_type; } -static void powernv_cpu_reset (void *opaque) +static void pnv_cpu_reset (void *opaque) {PowerPCCPU *cpu = opaque;CPUState *cs =CPU (cpu);
@@ -54,7 +54,7 @@ static void powernv_cpu_reset(void *opaque) env->msr |=MSR_HVB ;/* Hypervisor mode */ } -static void powernv_cpu_init (PowerPCCPU *cpu,Error **errp) +static void pnv_cpu_init (PowerPCCPU *cpu,Error **errp) {CPUPPCState *env = &cpu->env;int core_pir;
@@ -73,7 +73,7 @@ static void powernv_cpu_init(PowerPCCPU *cpu, Error **errp)/* Set time-base frequency to 512 MHz */ cpu_ppc_tb_init (env,PNV_TIMEBASE_FREQ ); -qemu_register_reset (powernv_cpu_reset, cpu); +qemu_register_reset (pnv_cpu_reset, cpu); }/*
@@ -139,7 +139,7 @@ static void pnv_core_realize_child(Object *child, XICSFabric *xi, Error **errp)return ; } -powernv_cpu_init (cpu, &local_err); +pnv_cpu_init (cpu, &local_err);if (local_err) {error_propagate (errp, local_err);return ;
hw/ppc/pnv_lpc.c +3 -3
@@ -92,7 +92,7 @@ enum {#define LPC_HC_REGS_OPB_SIZE 0x00001000 -static int pnv_lpc_populate (PnvXScomInterface *dev,void *fdt,int xscom_offset) +static int pnv_lpc_dt_xscom (PnvXScomInterface *dev,void *fdt,int xscom_offset) {const char compat[] ="ibm,power8-lpc\0ibm,lpc" ;char *name;
@@ -482,7 +482,7 @@ static void pnv_lpc_class_init(ObjectClass *klass, void *data)DeviceClass *dc =DEVICE_CLASS (klass);PnvXScomInterfaceClass *xdc =PNV_XSCOM_INTERFACE_CLASS (klass); - xdc->populate = pnv_lpc_populate; + xdc->dt_xscom = pnv_lpc_dt_xscom; dc->realize = pnv_lpc_realize; }
@@ -515,7 +515,7 @@ type_init(pnv_lpc_register_types)*/ static void pnv_lpc_isa_irq_handler_cpld (void *opaque,int n,int level) { -PnvMachineState *pnv =POWERNV_MACHINE (qdev_get_machine ()); +PnvMachineState *pnv =PNV_MACHINE (qdev_get_machine ());uint32_t old_state = pnv->cpld_irqstate;PnvLpcController *lpc =PNV_LPC (opaque);
hw/ppc/pnv_psi.c +2 -2
@@ -510,7 +510,7 @@ static void pnv_psi_realize(DeviceState *dev, Error **errp) } } -static int pnv_psi_populate (PnvXScomInterface *dev,void *fdt,int xscom_offset) +static int pnv_psi_dt_xscom (PnvXScomInterface *dev,void *fdt,int xscom_offset) {const char compat[] ="ibm,power8-psihb-x\0ibm,psihb-x" ;char *name;
@@ -546,7 +546,7 @@ static void pnv_psi_class_init(ObjectClass *klass, void *data)DeviceClass *dc =DEVICE_CLASS (klass);PnvXScomInterfaceClass *xdc =PNV_XSCOM_INTERFACE_CLASS (klass); - xdc->populate = pnv_psi_populate; + xdc->dt_xscom = pnv_psi_dt_xscom; dc->realize = pnv_psi_realize; dc->props = pnv_psi_properties;
hw/ppc/pnv_xscom.c +5 -5
@@ -207,15 +207,15 @@ typedef struct ForeachPopulateArgs {int xscom_offset; } ForeachPopulateArgs; -static int xscom_populate_child (Object *child,void *opaque) +static int xscom_dt_child (Object *child,void *opaque) {if (object_dynamic_cast (child,TYPE_PNV_XSCOM_INTERFACE )) {ForeachPopulateArgs *args = opaque;PnvXScomInterface *xd =PNV_XSCOM_INTERFACE (child);PnvXScomInterfaceClass *xc =PNV_XSCOM_INTERFACE_GET_CLASS (xd); -if (xc->populate) { -_FDT ((xc->populate (xd, args->fdt, args->xscom_offset))); +if (xc->dt_xscom) { +_FDT ((xc->dt_xscom (xd, args->fdt, args->xscom_offset))); } }return 0 ;
@@ -224,7 +224,7 @@ static int xscom_populate_child(Object *child, void *opaque)static const char compat_p8[] ="ibm,power8-xscom\0ibm,xscom" ;static const char compat_p9[] ="ibm,power9-xscom\0ibm,xscom" ; -int pnv_xscom_populate (PnvChip *chip,void *fdt,int root_offset) +int pnv_dt_xscom (PnvChip *chip,void *fdt,int root_offset) {uint64_t reg[] = {cpu_to_be64 (PNV_XSCOM_BASE (chip)),cpu_to_be64 (PNV_XSCOM_SIZE ) };
@@ -255,7 +255,7 @@ int pnv_xscom_populate(PnvChip *chip, void *fdt, int root_offset) args.fdt = fdt; args.xscom_offset = xscom_offset; -object_child_foreach (OBJECT (chip), xscom_populate_child, &args); +object_child_foreach (OBJECT (chip), xscom_dt_child, &args);return 0 ; }
include/hw/ppc/pnv.h +5 -5
@@ -26,7 +26,7 @@#include "hw/ppc/pnv_psi.h" #include "hw/ppc/pnv_occ.h" -#define TYPE_PNV_CHIP "powernv-chip" +#define TYPE_PNV_CHIP "pnv-chip"#define PNV_CHIP (obj) OBJECT_CHECK(PnvChip, (obj), TYPE_PNV_CHIP)#define PNV_CHIP_CLASS (klass) \ OBJECT_CLASS_CHECK(PnvChipClass, (klass), TYPE_PNV_CHIP)
@@ -117,9 +117,9 @@ typedef struct PnvChipClass {#define PNV_CHIP_INDEX (chip) \ (((chip)->chip_id >> 2) * 2 + ((chip)->chip_id & 0x3)) -#define TYPE_POWERNV_MACHINE MACHINE_TYPE_NAME("powernv") -#define POWERNV_MACHINE (obj) \ - OBJECT_CHECK(PnvMachineState, (obj), TYPE_POWERNV_MACHINE) +#define TYPE_PNV_MACHINE MACHINE_TYPE_NAME("powernv") +#define PNV_MACHINE (obj) \ + OBJECT_CHECK(PnvMachineState, (obj), TYPE_PNV_MACHINE) typedef struct PnvMachineState { /*< private >*/
@@ -144,7 +144,7 @@ typedef struct PnvMachineState {/* * BMC helpers */ -void pnv_bmc_populate_sensors (IPMIBmc *bmc,void *fdt); +void pnv_dt_bmc_sensors (IPMIBmc *bmc,void *fdt);void pnv_bmc_powerdown (IPMIBmc *bmc);/*
include/hw/ppc/pnv_xscom.h +2 -2
@@ -36,7 +36,7 @@ typedef struct PnvXScomInterface {typedef struct PnvXScomInterfaceClass {InterfaceClass parent; -int (*populate)(PnvXScomInterface *dev,void *fdt,int offset); +int (*dt_xscom)(PnvXScomInterface *dev,void *fdt,int offset); }PnvXScomInterfaceClass ;/*
@@ -67,7 +67,7 @@ typedef struct PnvXScomInterfaceClass {#define PNV_XSCOM_OCC_SIZE 0x6000extern void pnv_xscom_realize (PnvChip *chip,Error **errp); -extern int pnv_xscom_populate (PnvChip *chip,void *fdt,int offset); +extern int pnv_dt_xscom (PnvChip *chip,void *fdt,int offset);extern void pnv_xscom_add_subregion (PnvChip *chip,hwaddr offset,MemoryRegion *mr);
Signature · 1 line
2.14.3
[Qemu-devel] [PULL 01/11] pseries: Update SLOF firmware image to qemu-slof-20171214
In reply to David GibsonFrom: Alexey Kardashevskiy <[email protected]>
The main changes are:
- able to handle more devices with specified bootindex;
- implements flatten device tree rendering, for both QEMU and guest kernel.
The full list is:
Quoted 9 lines
boot: use a temporary bootdev-buf
boot: do not concatenate bootdev
libvirtio: Mark structvirtio_scsi_req_cmdas packed
fdt: Implement "fdt-fetch" method for client interface
rtas: Store RTAS address and entry in the device tree
board-qemu: Fix slof-build-id length
fdt: Pass the resulting device tree to QEMU
fdt: Fix version and add a word for FDT header size
tree: Rework set-chosen-cpu and store /chosen ihandle and phandle
Quoted 8 lines
node: Add some documentation
Revert various SLOF-to-QEMU private hypercalls
Use input-device and output-device
netboot: Create bootp-response when bootp is used libnet/ipv6: assigntimes_askedvalue directly
usb-xhci: Reset ERSTSZ together with ERSTBA
virtio-net: rework the driver to support multiple open
board-qemu: add private hcall to inform host on "phandle" update
--- pc-bios/README | 2 +- pc-bios/slof.bin | Bin 905200 -> 913880 bytes roms/SLOF | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-)
pc-bios/README +1 -1
@@ -17,7 +17,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-20170724. + built from git tag qemu-slof-20171214. - sgabios (the Serial Graphics Adapter option ROM) provides a means for legacy x86 software to communicate with an attached serial console as
pc-bios/slof.bin binary +0 -0
roms/SLOF +1 -1
@@ -1 +1 @@ -Subproject commit 89f519f09bf850918b60526e50409afb663418aa +Subproject commit fa981320a1e0968d6fc1b8de319723ff8212b337
Signature · 1 line
2.14.3
Peter Maydell
AppliedQuoted 20 lines · David Gibson
The following changes since commit
3cee4db661ab9c0fce7937b3bbfa188a1845f31f:Merge remote-tracking branch 'remotes/ericb/tags/pull-nbd-2018-01-08' into staging (2018-01-09 15:22:47 +0000)
are available in the Git repository at:
git://github.com/dgibson/qemu.gittags/ppc-for-2.12-20180111for you to fetch changes up to
51f84465dd985fc21589b2eac1f18658fc9783e9:spapr: Correct compatibility mode setting for hotplugged CPUs (2018-01-10 12:53:00 +1100)
----------------------------------------------------------------
ppc patch queue 2018-01-11This pull request supersedes ppc-for-2.12-20180108 and several before it. The earlier pull request included a patch which exposed a bug in the ARM TCG backend. I've pulled that out and will repost once the ARM bug is fixed (a patch has been posted by Richard Henderson).
Quoted 5 lines
Higlights from this series:
* SLOF update
* Several new devices for embedded platforms
* Fix to correctly set compatiblity mode for hotplugged CPUs
* dtc compile fix for older MacOS versions
Applied, thanks.
-- PMM