target-arm queue
Subsystems (2)
target-arm queue; quite a lot of patches but nothing earthshaking.
thanks
-- PMM
The following changes since commit d32490ca74c700edc74f0b2f6b7536b52a644739:
Merge remote-tracking branch 'remotes/cohuck/tags/s390x-20160614' into staging (2016-06-14 13:14:55 +0100)
are available in the git repository at:
git://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20160614
for you to fetch changes up to ea924f729b7703c9d81f62b54bcaa75f9d9f314e:
target-arm: Don't permit ARMv8-only Neon insns on ARMv7 (2016-06-14 15:02:30 +0100)
----------------------------------------------------------------
target-arm queue:
* add PMU support for virt machine under KVM
* fix reset and migration of TTBCR(S)
* add virt-2.7 machine type
* QOMify various ARM devices
* implement xilinx DisplayPort device
* don't permit ARMv8-only Neon insns to work on ARMv7
----------------------------------------------------------------
Andrew Jones (4):
hw/arm/virt: separate versioned type-init code hw/arm/virt: introduce DEFINE_VIRT_MACHINE hw/arm/virt: introduce DEFINE_VIRT_MACHINE_AS_LATEST hw/arm/virt: create the 2.7 machine type
KONRAD Frederic (7):
i2cbus: remove unused dev field
i2c: implement broadcast write introduce aux-bus
introduce dpcd module
introduce xlnx-dpdma
introduce xlnx-dp
arm: xlnx-zynqmp: Add xlnx-dp and xlnx-dpdma
Peter Crosthwaite (1):
i2c: Factor our send() and recv() common logic
Peter Maydell (3):
target-arm: Fix reset and migration of TTBCR(S) hw/i2c-ddc.c: Implement DDC I2C slave
target-arm: Don't permit ARMv8-only Neon insns on ARMv7
Shannon Zhao (3):
target-arm: kvm64: set guest PMUv3 feature bit if supported hw/arm/virt: Add PMU node for virt machine hw/arm/virt-acpi-build: Add PMU IRQ number in ACPI table
xiaoqiang zhao (12):
hw/i2c: QOM'ify bitbang_i2c.c
hw/i2c: QOM'ify exynos4210_i2c.c
hw/i2c: QOM'ify omap_i2c.c
hw/i2c: QOM'ify versatile_i2c.c
hw/gpio: QOM'ify omap_gpio.c
hw/gpio: QOM'ify pl061.c
hw/gpio: QOM'ify zaurus.c
hw/misc: QOM'ify arm_l2x0.c
hw/misc: QOM'ify exynos4210_pmu.c
hw/misc: QOM'ify mst_fpga.c
hw/dma: QOM'ify pxa2xx_dma.c
hw/sd: QOM'ify pl181.c
default-configs/aarch64-softmmu.mak | 3 + hw/arm/virt-acpi-build.c | 4 + hw/arm/virt.c | 99 ++- hw/arm/xlnx-zynqmp.c | 32 +- hw/display/Makefile.objs | 2 + hw/display/dpcd.c | 173 +++++ hw/display/xlnx_dp.c | 1336 +++++++++++++++++++++++++++++++++++ hw/dma/Makefile.objs | 1 + hw/dma/pxa2xx_dma.c | 38 +- hw/dma/xlnx_dpdma.c | 794 +++++++++++++++++++++ hw/gpio/omap_gpio.c | 61 +- hw/gpio/pl061.c | 24 +- hw/gpio/zaurus.c | 14 +- hw/i2c/Makefile.objs | 1 + hw/i2c/bitbang_i2c.c | 14 +- hw/i2c/core.c | 161 +++-- hw/i2c/exynos4210_i2c.c | 13 +- hw/i2c/i2c-ddc.c | 307 ++++++++ hw/i2c/omap_i2c.c | 42 +- hw/i2c/versatile_i2c.c | 19 +- hw/misc/Makefile.objs | 1 + hw/misc/arm_l2x0.c | 11 +- hw/misc/aux.c | 292 ++++++++ hw/misc/exynos4210_pmu.c | 11 +- hw/misc/mst_fpga.c | 13 +- hw/sd/pl181.c | 26 +- include/hw/arm/virt.h | 4 + include/hw/arm/xlnx-zynqmp.h | 4 + include/hw/display/dpcd.h | 105 +++ include/hw/display/xlnx_dp.h | 109 +++ include/hw/dma/xlnx_dpdma.h | 85 +++ include/hw/i2c/i2c-ddc.h | 38 + include/hw/i2c/i2c.h | 1 + include/hw/misc/aux.h | 128 ++++ target-arm/cpu.h | 2 + target-arm/helper.c | 5 +- target-arm/kvm32.c | 6 + target-arm/kvm64.c | 46 ++ target-arm/kvm_arm.h | 7 + target-arm/translate.c | 28 + 40 files changed, 3837 insertions(+), 223 deletions(-) create mode 100644 hw/display/dpcd.c create mode 100644 hw/display/xlnx_dp.c create mode 100644 hw/dma/xlnx_dpdma.c create mode 100644 hw/i2c/i2c-ddc.c create mode 100644 hw/misc/aux.c create mode 100644 include/hw/display/dpcd.h create mode 100644 include/hw/display/xlnx_dp.h create mode 100644 include/hw/dma/xlnx_dpdma.h create mode 100644 include/hw/i2c/i2c-ddc.h create mode 100644 include/hw/misc/aux.h
[Qemu-devel] [PULL 01/30] target-arm: kvm64: set guest PMUv3 feature bit if supported
From: Shannon Zhao <[email protected]>
Check if kvm supports guest PMUv3. If so, set the corresponding feature bit for vcpu.
Message-id: [email protected]
--- target-arm/cpu.h | 2 ++ target-arm/kvm64.c | 5 +++++ 2 files changed, 7 insertions(+)
target-arm/cpu.h +2 -0
@@ -572,6 +572,8 @@ struct ARMCPU {bool powered_off;/* CPU has security extension */ bool has_el3; +/* CPU has PMU (Performance Monitor Unit) */ +bool has_pmu;/* CPU has memory protection unit */ bool has_mpu;
target-arm/kvm64.c +5 -0
@@ -461,6 +461,11 @@ int kvm_arch_init_vcpu(CPUState *cs)if (!arm_feature (&cpu->env,ARM_FEATURE_AARCH64 )) { cpu->kvm_init_features[0 ] |=1 <<KVM_ARM_VCPU_EL1_32BIT ; } +if (kvm_irqchip_in_kernel () && +kvm_check_extension (cs->kvm_state,KVM_CAP_ARM_PMU_V3 )) { + cpu->has_pmu = true; + cpu->kvm_init_features[0 ] |=1 <<KVM_ARM_VCPU_PMU_V3 ; + }/* Do KVM_ARM_VCPU_INIT ioctl */ ret =kvm_arm_vcpu_init (cs);
Signature · 1 line
1.9.1
[Qemu-devel] [PULL 04/30] target-arm: Fix reset and migration of TTBCR(S)
In reply to Peter MaydellCommit 6459b94c26dd666badb3 broke reset and migration of the AArch32 TTBCR(S) register if the guest used non-LPAE page tables. This is because the AArch32 TTBCR register definition is marked as ARM_CP_ALIAS, meaning that the AArch64 variant has to handle migration and reset. Although AArch64 TCR_EL3 doesn't need to care about the mask and base_mask fields, AArch32 may do so, and so we must use the special TTBCR reset and raw write functions to ensure they are set correctly.
This doesn't affect TCR_EL2, because the AArch32 equivalent of that is HTCR, which never uses the non-LPAE page table variant.
Message-id: [email protected]
--- target-arm/helper.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
target-arm/helper.c +4 -1
@@ -3765,8 +3765,11 @@ static const ARMCPRegInfo el3_cp_reginfo[] = { .opc0 = 3, .opc1 = 6, .crn = 2, .crm = 0, .opc2 = 2, .access = PL3_RW,/* no .writefn needed as this can't cause an ASID change; - * no .raw_writefn or .resetfn needed as we never use mask/base_mask +* we must provide a .raw_writefn and .resetfn because we handle +* reset and migration for the AArch32 TTBCR(S), which might be +* using mask and base_mask. */ + .resetfn = vmsa_ttbcr_reset, .raw_writefn = vmsa_ttbcr_raw_write, .fieldoffset = offsetof(CPUARMState, cp15.tcr_el[3]) }, { .name = "ELR_EL3", .state = ARM_CP_STATE_AA64, .type = ARM_CP_ALIAS,
Signature · 1 line
1.9.1
[Qemu-devel] [PULL 05/30] hw/arm/virt: separate versioned type-init code
In reply to Peter MaydellFrom: Andrew Jones <[email protected]>
Rename machvirt_info (which is specifically for 2.6 TypeInfo) to machvirt_2_6_info, and separate the type registration of the abstract machine type from the versioned type.
Message-id: [email protected]
--- hw/arm/virt.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
hw/arm/virt.c +10 -6
@@ -1420,6 +1420,12 @@ static const TypeInfo virt_machine_info = { .class_init = virt_machine_class_init, }; +static void machvirt_machine_init (void ) +{ +type_register_static (&virt_machine_info); +} +type_init (machvirt_machine_init); +static void virt_2_6_instance_init (Object *obj) {VirtMachineState *vms =VIRT_MACHINE (obj);
@@ -1461,17 +1467,15 @@ static void virt_2_6_class_init(ObjectClass *oc, void *data) mc->alias ="virt" ; } -static const TypeInfo machvirt_info = { +static const TypeInfo machvirt_2_6_info = { .name =MACHINE_TYPE_NAME ("virt-2.6" ), .parent =TYPE_VIRT_MACHINE , .instance_init = virt_2_6_instance_init, .class_init = virt_2_6_class_init, }; -static void machvirt_machine_init (void ) +static void machvirt_machine_2_6_init (void ) { -type_register_static (&virt_machine_info); -type_register_static (&machvirt_info); +type_register_static (&machvirt_2_6_info); } - -type_init (machvirt_machine_init); +type_init (machvirt_machine_2_6_init);
Signature · 1 line
1.9.1
[Qemu-devel] [PULL 10/30] hw/i2c: QOM'ify exynos4210_i2c.c
In reply to Peter MaydellFrom: xiaoqiang zhao <[email protected]>
* Rename the exynos4210_i2c_realize to exynos4210_i2c_init
* Drop the old SysBus init function and use instance_init
Message-id: [email protected]
--- hw/i2c/exynos4210_i2c.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
hw/i2c/exynos4210_i2c.c +6 -7
@@ -299,33 +299,32 @@ static void exynos4210_i2c_reset(DeviceState *d) s->scl_free = true; } -static int exynos4210_i2c_realize (SysBusDevice *sbd) +static void exynos4210_i2c_init (Object *obj) { -DeviceState *dev =DEVICE (sbd); -Exynos4210I2CState *s =EXYNOS4_I2C (dev); +DeviceState *dev =DEVICE (obj); +Exynos4210I2CState *s =EXYNOS4_I2C (obj); +SysBusDevice *sbd =SYS_BUS_DEVICE (obj); -memory_region_init_io (&s->iomem,OBJECT (s), &exynos4210_i2c_ops, s, +memory_region_init_io (&s->iomem, obj, &exynos4210_i2c_ops, s,TYPE_EXYNOS4_I2C ,EXYNOS4_I2C_MEM_SIZE );sysbus_init_mmio (sbd, &s->iomem);sysbus_init_irq (sbd, &s->irq); s->bus =i2c_init_bus (dev,"i2c" ); -return 0 ; }static void exynos4210_i2c_class_init (ObjectClass *klass,void *data) {DeviceClass *dc =DEVICE_CLASS (klass); -SysBusDeviceClass *sbdc =SYS_BUS_DEVICE_CLASS (klass); dc->vmsd = &exynos4210_i2c_vmstate; dc->reset = exynos4210_i2c_reset; - sbdc->init = exynos4210_i2c_realize; }static const TypeInfo exynos4210_i2c_type_info = { .name =TYPE_EXYNOS4_I2C , .parent =TYPE_SYS_BUS_DEVICE , .instance_size =sizeof (Exynos4210I2CState), + .instance_init = exynos4210_i2c_init, .class_init = exynos4210_i2c_class_init, };
Signature · 1 line
1.9.1
[Qemu-devel] [PULL 08/30] hw/arm/virt: create the 2.7 machine type
In reply to Peter MaydellFrom: Andrew Jones <[email protected]>
Message-id: [email protected]
--- hw/arm/virt.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-)
hw/arm/virt.c +18 -2
@@ -42,6 +42,7 @@#include "sysemu/sysemu.h" #include "sysemu/kvm.h" #include "hw/boards.h" +#include "hw/compat.h" #include "hw/loader.h" #include "exec/address-spaces.h" #include "qemu/bitops.h"
@@ -1456,7 +1457,7 @@ static void machvirt_machine_init(void) }type_init (machvirt_machine_init); -static void virt_2_6_instance_init (Object *obj) +static void virt_2_7_instance_init (Object *obj) {VirtMachineState *vms =VIRT_MACHINE (obj);
@@ -1489,7 +1490,22 @@ static void virt_2_6_instance_init(Object *obj) "Valid values are 2, 3 and host", NULL); } +static void virt_machine_2_7_options (MachineClass *mc) +{ +} +DEFINE_VIRT_MACHINE_AS_LATEST(2, 7) + +#define VIRT_COMPAT_2_6 \ + HW_COMPAT_2_6 + +static void virt_2_6_instance_init (Object *obj) +{ +virt_2_7_instance_init (obj); +} +static void virt_machine_2_6_options (MachineClass *mc) { +virt_machine_2_7_options (mc); +SET_MACHINE_COMPAT (mc,VIRT_COMPAT_2_6 ); } -DEFINE_VIRT_MACHINE_AS_LATEST (2 ,6 ) +DEFINE_VIRT_MACHINE (2 ,6 )
Signature · 1 line
1.9.1
[Qemu-devel] [PULL 11/30] hw/i2c: QOM'ify omap_i2c.c
In reply to Peter MaydellFrom: xiaoqiang zhao <[email protected]>
* Split the omap_i2c_init into an instance_init and realize function
* Drop the old SysBus init function and use instance_init
Message-id: [email protected]
--- hw/i2c/omap_i2c.c | 42 +++++++++++++++++++++++++----------------- 1 file changed, 25 insertions(+), 17 deletions(-)
hw/i2c/omap_i2c.c +25 -17
@@ -22,6 +22,7 @@#include "hw/arm/omap.h" #include "hw/sysbus.h" #include "qemu/error-report.h" +#include "qapi/error.h" #define TYPE_OMAP_I2C "omap_i2c"#define OMAP_I2C (obj) OBJECT_CHECK(OMAPI2CState, (obj), TYPE_OMAP_I2C)
@@ -445,29 +446,35 @@ static const MemoryRegionOps omap_i2c_ops = { .endianness = DEVICE_NATIVE_ENDIAN, }; -static int omap_i2c_init (SysBusDevice *sbd) +static void omap_i2c_init (Object *obj) +{ +DeviceState *dev =DEVICE (obj); +OMAPI2CState *s =OMAP_I2C (obj); +SysBusDevice *sbd =SYS_BUS_DEVICE (obj); + +sysbus_init_irq (sbd, &s->irq); +sysbus_init_irq (sbd, &s->drq[0 ]); +sysbus_init_irq (sbd, &s->drq[1 ]); +sysbus_init_mmio (sbd, &s->iomem); + s->bus =i2c_init_bus (dev,NULL ); +} + +static void omap_i2c_realize (DeviceState *dev,Error **errp) { -DeviceState *dev =DEVICE (sbd);OMAPI2CState *s =OMAP_I2C (dev); +memory_region_init_io (&s->iomem,OBJECT (dev), &omap_i2c_ops, s,"omap.i2c" , + (s->revision <OMAP2_INTR_REV ) ?0x800 :0x1000 ); +if (!s->fclk) { -error_report ("omap_i2c: fclk not connected" ); -return -1 ; +error_setg (errp,"omap_i2c: fclk not connected" ); +return ; }if (s->revision >=OMAP2_INTR_REV && !s->iclk) {/* Note that OMAP1 doesn't have a separate interface clock */ -error_report ("omap_i2c: iclk not connected" ); -return -1 ; +error_setg (errp,"omap_i2c: iclk not connected" ); +return ; } - -sysbus_init_irq (sbd, &s->irq); -sysbus_init_irq (sbd, &s->drq[0 ]); -sysbus_init_irq (sbd, &s->drq[1 ]); -memory_region_init_io (&s->iomem,OBJECT (s), &omap_i2c_ops, s,"omap.i2c" , - (s->revision <OMAP2_INTR_REV ) ?0x800 :0x1000 ); -sysbus_init_mmio (sbd, &s->iomem); - s->bus =i2c_init_bus (dev,NULL ); -return 0 ; }static Property omap_i2c_properties[] = {
@@ -480,18 +487,19 @@ static Property omap_i2c_properties[] = {static void omap_i2c_class_init (ObjectClass *klass,void *data) {DeviceClass *dc =DEVICE_CLASS (klass); -SysBusDeviceClass *k =SYS_BUS_DEVICE_CLASS (klass); - k->init = omap_i2c_init; + dc->props = omap_i2c_properties; dc->reset = omap_i2c_reset;/* Reason: pointer properties "iclk", "fclk" */ dc->cannot_instantiate_with_device_add_yet = true; + dc->realize = omap_i2c_realize; }static const TypeInfo omap_i2c_info = { .name =TYPE_OMAP_I2C , .parent =TYPE_SYS_BUS_DEVICE , .instance_size =sizeof (OMAPI2CState), + .instance_init = omap_i2c_init, .class_init = omap_i2c_class_init, };
Signature · 1 line
1.9.1
[Qemu-devel] [PULL 12/30] hw/i2c: QOM'ify versatile_i2c.c
In reply to Peter MaydellFrom: xiaoqiang zhao <[email protected]>
Drop the old SysBus init function and use instance_init
Message-id: [email protected]
--- hw/i2c/versatile_i2c.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-)
hw/i2c/versatile_i2c.c +6 -13
@@ -79,32 +79,25 @@ static const MemoryRegionOps versatile_i2c_ops = { .endianness = DEVICE_NATIVE_ENDIAN, }; -static int versatile_i2c_init (SysBusDevice *sbd) +static void versatile_i2c_init (Object *obj) { -DeviceState *dev =DEVICE (sbd); -VersatileI2CState *s =VERSATILE_I2C (dev); +DeviceState *dev =DEVICE (obj); +VersatileI2CState *s =VERSATILE_I2C (obj); +SysBusDevice *sbd =SYS_BUS_DEVICE (obj);I2CBus *bus; bus =i2c_init_bus (dev,"i2c" ); s->bitbang =bitbang_i2c_init (bus); -memory_region_init_io (&s->iomem,OBJECT (s), &versatile_i2c_ops, s, +memory_region_init_io (&s->iomem, obj, &versatile_i2c_ops, s,"versatile_i2c" ,0x1000 );sysbus_init_mmio (sbd, &s->iomem); -return 0 ; -} - -static void versatile_i2c_class_init (ObjectClass *klass,void *data) -{ -SysBusDeviceClass *k =SYS_BUS_DEVICE_CLASS (klass); - - k->init = versatile_i2c_init; }static const TypeInfo versatile_i2c_info = { .name =TYPE_VERSATILE_I2C , .parent =TYPE_SYS_BUS_DEVICE , .instance_size =sizeof (VersatileI2CState), - .class_init = versatile_i2c_class_init, + .instance_init = versatile_i2c_init, };static void versatile_i2c_register_types (void )
Signature · 1 line
1.9.1
[Qemu-devel] [PULL 14/30] hw/gpio: QOM'ify pl061.c
In reply to Peter MaydellFrom: xiaoqiang zhao <[email protected]>
* Merge the pl061_initfn into pl061_init
* Drop the old SysBus init function and use instance_init
Message-id: [email protected]
--- hw/gpio/pl061.c | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-)
hw/gpio/pl061.c +8 -16
@@ -341,20 +341,6 @@ static const MemoryRegionOps pl061_ops = { .endianness = DEVICE_NATIVE_ENDIAN, }; -static int pl061_initfn (SysBusDevice *sbd) -{ -DeviceState *dev =DEVICE (sbd); -PL061State *s =PL061 (dev); - -memory_region_init_io (&s->iomem,OBJECT (s), &pl061_ops, s,"pl061" ,0x1000 ); -sysbus_init_mmio (sbd, &s->iomem); -sysbus_init_irq (sbd, &s->irq); -qdev_init_gpio_in (dev, pl061_set_irq,8 ); -qdev_init_gpio_out (dev, s->out,8 ); - -return 0 ; -} -static void pl061_luminary_init (Object *obj) {PL061State *s =PL061 (obj);
@@ -366,17 +352,23 @@ static void pl061_luminary_init(Object *obj)static void pl061_init (Object *obj) {PL061State *s =PL061 (obj); +DeviceState *dev =DEVICE (obj); +SysBusDevice *sbd =SYS_BUS_DEVICE (obj); s->id = pl061_id; s->rsvd_start =0x424 ; + +memory_region_init_io (&s->iomem, obj, &pl061_ops, s,"pl061" ,0x1000 ); +sysbus_init_mmio (sbd, &s->iomem); +sysbus_init_irq (sbd, &s->irq); +qdev_init_gpio_in (dev, pl061_set_irq,8 ); +qdev_init_gpio_out (dev, s->out,8 ); }static void pl061_class_init (ObjectClass *klass,void *data) {DeviceClass *dc =DEVICE_CLASS (klass); -SysBusDeviceClass *k =SYS_BUS_DEVICE_CLASS (klass); - k->init = pl061_initfn; dc->vmsd = &vmstate_pl061; dc->reset = &pl061_reset; }
Signature · 1 line
1.9.1
[Qemu-devel] [PULL 09/30] hw/i2c: QOM'ify bitbang_i2c.c
In reply to Peter MaydellFrom: xiaoqiang zhao <[email protected]>
Drop the old SysBus init function and use instance_init
Message-id: [email protected]
--- hw/i2c/bitbang_i2c.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)
hw/i2c/bitbang_i2c.c +6 -8
@@ -210,13 +210,14 @@ static void bitbang_i2c_gpio_set(void *opaque, int irq, int level) } } -static int gpio_i2c_init (SysBusDevice *sbd) +static void gpio_i2c_init (Object *obj) { -DeviceState *dev =DEVICE (sbd); -GPIOI2CState *s =GPIO_I2C (dev); +DeviceState *dev =DEVICE (obj); +GPIOI2CState *s =GPIO_I2C (obj); +SysBusDevice *sbd =SYS_BUS_DEVICE (obj);I2CBus *bus; -memory_region_init (&s->dummy_iomem,OBJECT (s),"gpio_i2c" ,0 ); +memory_region_init (&s->dummy_iomem, obj,"gpio_i2c" ,0 );sysbus_init_mmio (sbd, &s->dummy_iomem); bus =i2c_init_bus (dev,"i2c" );
@@ -224,16 +225,12 @@ static int gpio_i2c_init(SysBusDevice *sbd)qdev_init_gpio_in (dev, bitbang_i2c_gpio_set,2 );qdev_init_gpio_out (dev, &s->out,1 ); - -return 0 ; }static void gpio_i2c_class_init (ObjectClass *klass,void *data) {DeviceClass *dc =DEVICE_CLASS (klass); -SysBusDeviceClass *k =SYS_BUS_DEVICE_CLASS (klass); - k->init = gpio_i2c_init;set_bit (DEVICE_CATEGORY_BRIDGE , dc->categories); dc->desc ="Virtual GPIO to I2C bridge" ; }
@@ -242,6 +239,7 @@ static const TypeInfo gpio_i2c_info = { .name = TYPE_GPIO_I2C, .parent = TYPE_SYS_BUS_DEVICE, .instance_size = sizeof(GPIOI2CState), + .instance_init = gpio_i2c_init, .class_init = gpio_i2c_class_init, };
Signature · 1 line
1.9.1
[Qemu-devel] [PULL 13/30] hw/gpio: QOM'ify omap_gpio.c
In reply to Peter MaydellFrom: xiaoqiang zhao <[email protected]>
* Split the old SysBus init into an instance_init and DeviceClass::realize function
* Drop the SysBus init function
Message-id: [email protected]
--- hw/gpio/omap_gpio.c | 61 +++++++++++++++++++++++++++-------------------------- 1 file changed, 31 insertions(+), 30 deletions(-)
hw/gpio/omap_gpio.c +31 -30
@@ -23,6 +23,7 @@#include "hw/arm/omap.h" #include "hw/sysbus.h" #include "qemu/error-report.h" +#include "qapi/error.h" struct omap_gpio_s {qemu_irq irq;
@@ -678,48 +679,46 @@ static const MemoryRegionOps omap2_gpif_top_ops = { .endianness = DEVICE_NATIVE_ENDIAN, }; -static int omap_gpio_init (SysBusDevice *sbd) +static void omap_gpio_init (Object *obj) { -DeviceState *dev =DEVICE (sbd); -struct omap_gpif_s *s =OMAP1_GPIO (dev); +DeviceState *dev =DEVICE (obj); +struct omap_gpif_s *s =OMAP1_GPIO (obj); +SysBusDevice *sbd =SYS_BUS_DEVICE (obj); -if (!s->clk) { -error_report ("omap-gpio: clk not connected" ); -return -1 ; - }qdev_init_gpio_in (dev, omap_gpio_set,16 );qdev_init_gpio_out (dev, s->omap1.handler,16 );sysbus_init_irq (sbd, &s->omap1.irq); -memory_region_init_io (&s->iomem,OBJECT (s), &omap_gpio_ops, &s->omap1, +memory_region_init_io (&s->iomem, obj, &omap_gpio_ops, &s->omap1,"omap.gpio" ,0x1000 );sysbus_init_mmio (sbd, &s->iomem); -return 0 ; } -static int omap2_gpio_init (SysBusDevice *sbd) +static void omap_gpio_realize (DeviceState *dev,Error **errp) +{ +struct omap_gpif_s *s =OMAP1_GPIO (dev); + +if (!s->clk) { +error_setg (errp,"omap-gpio: clk not connected" ); + } +} + +static void omap2_gpio_realize (DeviceState *dev,Error **errp) { -DeviceState *dev =DEVICE (sbd);struct omap2_gpif_s *s =OMAP2_GPIO (dev); +SysBusDevice *sbd =SYS_BUS_DEVICE (dev);int i;if (!s->iclk) { -error_report ("omap2-gpio: iclk not connected" ); -return -1 ; +error_setg (errp,"omap2-gpio: iclk not connected" ); +return ; } s->modulecount = s->mpu_model < omap2430 ?4 - : s->mpu_model < omap3430 ?5 - :6 ; - -for (i =0 ; i < s->modulecount; i++) { -if (!s->fclk[i]) { -error_report ("omap2-gpio: fclk%d not connected" , i); -return -1 ; - } - } + : s->mpu_model < omap3430 ?5 + :6 ;if (s->mpu_model < omap3430) { -memory_region_init_io (&s->iomem,OBJECT (s), &omap2_gpif_top_ops, s, +memory_region_init_io (&s->iomem,OBJECT (dev), &omap2_gpif_top_ops, s,"omap2.gpio" ,0x1000 );sysbus_init_mmio (sbd, &s->iomem); }
@@ -732,17 +731,20 @@ static int omap2_gpio_init(SysBusDevice *sbd)for (i =0 ; i < s->modulecount; i++) {struct omap2_gpio_s *m = &s->modules[i]; +if (!s->fclk[i]) { +error_setg (errp,"omap2-gpio: fclk%d not connected" , i); +return ; + } + m->revision = (s->mpu_model < omap3430) ?0x18 :0x25 ; m->handler = &s->handler[i *32 ];sysbus_init_irq (sbd, &m->irq[0 ]);/* mpu irq */ sysbus_init_irq (sbd, &m->irq[1 ]);/* dsp irq */ sysbus_init_irq (sbd, &m->wkup); -memory_region_init_io (&m->iomem,OBJECT (s), &omap2_gpio_module_ops, m, +memory_region_init_io (&m->iomem,OBJECT (dev), &omap2_gpio_module_ops, m,"omap.gpio-module" ,0x1000 );sysbus_init_mmio (sbd, &m->iomem); } - -return 0 ; }/* Using qdev pointer properties for the clocks is not ideal.
@@ -766,9 +768,8 @@ static Property omap_gpio_properties[] = {static void omap_gpio_class_init (ObjectClass *klass,void *data) {DeviceClass *dc =DEVICE_CLASS (klass); -SysBusDeviceClass *k =SYS_BUS_DEVICE_CLASS (klass); - k->init = omap_gpio_init; + dc->realize = omap_gpio_realize; dc->reset = omap_gpif_reset; dc->props = omap_gpio_properties;/* Reason: pointer property "clk" */
@@ -779,6 +780,7 @@ static const TypeInfo omap_gpio_info = { .name = TYPE_OMAP1_GPIO, .parent = TYPE_SYS_BUS_DEVICE, .instance_size = sizeof(struct omap_gpif_s), + .instance_init = omap_gpio_init, .class_init = omap_gpio_class_init, };
@@ -797,9 +799,8 @@ static Property omap2_gpio_properties[] = {static void omap2_gpio_class_init (ObjectClass *klass,void *data) {DeviceClass *dc =DEVICE_CLASS (klass); -SysBusDeviceClass *k =SYS_BUS_DEVICE_CLASS (klass); - k->init = omap2_gpio_init; + dc->realize = omap2_gpio_realize; dc->reset = omap2_gpif_reset; dc->props = omap2_gpio_properties;/* Reason: pointer properties "iclk", "fclk0", ..., "fclk5" */
Signature · 1 line
1.9.1
[Qemu-devel] [PULL 16/30] hw/misc: QOM'ify arm_l2x0.c
In reply to Peter MaydellFrom: xiaoqiang zhao <[email protected]>
Drop the old SysBus init function and use instance_init
Message-id: [email protected]
--- hw/misc/arm_l2x0.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
hw/misc/arm_l2x0.c +5 -6
@@ -159,14 +159,14 @@ static const MemoryRegionOps l2x0_mem_ops = { .endianness = DEVICE_NATIVE_ENDIAN, }; -static int l2x0_priv_init (SysBusDevice *dev) +static void l2x0_priv_init (Object *obj) { -L2x0State *s =ARM_L2X0 (dev); +L2x0State *s =ARM_L2X0 (obj); +SysBusDevice *dev =SYS_BUS_DEVICE (obj); -memory_region_init_io (&s->iomem,OBJECT (dev), &l2x0_mem_ops, s, +memory_region_init_io (&s->iomem, obj, &l2x0_mem_ops, s,"l2x0_cc" ,0x1000 );sysbus_init_mmio (dev, &s->iomem); -return 0 ; }static Property l2x0_properties[] = {
@@ -176,10 +176,8 @@ static Property l2x0_properties[] = {static void l2x0_class_init (ObjectClass *klass,void *data) { -SysBusDeviceClass *k =SYS_BUS_DEVICE_CLASS (klass);DeviceClass *dc =DEVICE_CLASS (klass); - k->init = l2x0_priv_init; dc->vmsd = &vmstate_l2x0; dc->props = l2x0_properties; dc->reset = l2x0_priv_reset;
@@ -189,6 +187,7 @@ static const TypeInfo l2x0_info = { .name = TYPE_ARM_L2X0, .parent = TYPE_SYS_BUS_DEVICE, .instance_size = sizeof(L2x0State), + .instance_init = l2x0_priv_init, .class_init = l2x0_class_init, };
Signature · 1 line
1.9.1
[Qemu-devel] [PULL 03/30] hw/arm/virt-acpi-build: Add PMU IRQ number in ACPI table
In reply to Peter MaydellFrom: Shannon Zhao <[email protected]>
Add PMU IRQ number in ACPI table, then we can use PMU in guest through ACPI.
Message-id: [email protected]
--- hw/arm/virt-acpi-build.c | 4 ++++ 1 file changed, 4 insertions(+)
hw/arm/virt-acpi-build.c +4 -0
@@ -538,6 +538,10 @@ build_madt(GArray *table_data, BIOSLinker *linker, VirtGuestInfo *guest_info) gicc->arm_mpidr = armcpu->mp_affinity; gicc->uid = i; gicc->flags =cpu_to_le32 (ACPI_GICC_ENABLED ); + +if (armcpu->has_pmu) { + gicc->performance_interrupt =cpu_to_le32 (PPI (VIRTUAL_PMU_IRQ )); + } }if (guest_info->gic_version ==3 ) {
Signature · 1 line
1.9.1
[Qemu-devel] [PULL 06/30] hw/arm/virt: introduce DEFINE_VIRT_MACHINE
In reply to Peter MaydellFrom: Andrew Jones <[email protected]>
Use DEFINE_VIRT_MACHINE to generate versioned machine type info.
Message-id: [email protected]
--- hw/arm/virt.c | 41 ++++++++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 17 deletions(-)
hw/arm/virt.c +24 -17
@@ -98,6 +98,28 @@ typedef struct {#define VIRT_MACHINE_CLASS (klass) \ OBJECT_CLASS_CHECK(VirtMachineClass, klass, TYPE_VIRT_MACHINE) + +#define DEFINE_VIRT_MACHINE (major, minor) \ + static void virt_##major##_##minor##_class_init(ObjectClass *oc, \ + void *data) \ + { \ + MachineClass *mc = MACHINE_CLASS(oc); \ + virt_machine_##major##_##minor##_options(mc); \ + mc->desc = "QEMU " # major "." # minor " ARM Virtual Machine"; \ + } \ + static const TypeInfo machvirt_##major##_##minor##_info = { \ + .name = MACHINE_TYPE_NAME("virt-" # major "." # minor), \ + .parent = TYPE_VIRT_MACHINE, \ + .instance_init = virt_##major##_##minor##_instance_init, \ + .class_init = virt_##major##_##minor##_class_init, \ + }; \ + static void machvirt_machine_##major##_##minor##_init(void) \ + { \ + type_register_static(&machvirt_##major##_##minor##_info); \ + } \ + type_init(machvirt_machine_##major##_##minor##_init); + +/* RAM limit in GB. Since VIRT_MEM starts at the 1GB mark, this means * RAM can go up to the 256GB mark, leaving 256GB of the physical * address space unallocated and free for future use between 256G and 512G.
@@ -1459,23 +1481,8 @@ static void virt_2_6_instance_init(Object *obj) "Valid values are 2, 3 and host", NULL); } -static void virt_2_6_class_init (ObjectClass *oc,void *data) +static void virt_machine_2_6_options (MachineClass *mc) { -MachineClass *mc =MACHINE_CLASS (oc); - - mc->desc ="QEMU 2.6 ARM Virtual Machine" ; mc->alias ="virt" ; } - -static const TypeInfo machvirt_2_6_info = { - .name =MACHINE_TYPE_NAME ("virt-2.6" ), - .parent =TYPE_VIRT_MACHINE , - .instance_init = virt_2_6_instance_init, - .class_init = virt_2_6_class_init, -}; - -static void machvirt_machine_2_6_init (void ) -{ -type_register_static (&machvirt_2_6_info); -} -type_init (machvirt_machine_2_6_init); +DEFINE_VIRT_MACHINE (2 ,6 )
Signature · 1 line
1.9.1
[Qemu-devel] [PULL 18/30] hw/misc: QOM'ify mst_fpga.c
In reply to Peter MaydellFrom: xiaoqiang zhao <[email protected]>
Drop the old SysBus init function and use instance_init
Message-id: [email protected]
--- hw/misc/mst_fpga.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
hw/misc/mst_fpga.c +6 -7
@@ -200,10 +200,11 @@ static int mst_fpga_post_load(void *opaque, int version_id)return 0 ; } -static int mst_fpga_init (SysBusDevice *sbd) +static void mst_fpga_init (Object *obj) { -DeviceState *dev =DEVICE (sbd); -mst_irq_state *s =MAINSTONE_FPGA (dev); +DeviceState *dev =DEVICE (obj); +mst_irq_state *s =MAINSTONE_FPGA (obj); +SysBusDevice *sbd =SYS_BUS_DEVICE (obj); s->pcmcia0 = MST_PCMCIAx_READY | MST_PCMCIAx_nCD; s->pcmcia1 = MST_PCMCIAx_READY | MST_PCMCIAx_nCD;
@@ -213,10 +214,9 @@ static int mst_fpga_init(SysBusDevice *sbd)/* alloc the external 16 irqs */ qdev_init_gpio_in (dev, mst_fpga_set_irq,MST_NUM_IRQS ); -memory_region_init_io (&s->iomem,OBJECT (s), &mst_fpga_ops, s, +memory_region_init_io (&s->iomem, obj, &mst_fpga_ops, s,"fpga" ,0x00100000 );sysbus_init_mmio (sbd, &s->iomem); -return 0 ; }static VMStateDescription vmstate_mst_fpga_regs = {
@@ -245,9 +245,7 @@ static VMStateDescription vmstate_mst_fpga_regs = {static void mst_fpga_class_init (ObjectClass *klass,void *data) {DeviceClass *dc =DEVICE_CLASS (klass); -SysBusDeviceClass *k =SYS_BUS_DEVICE_CLASS (klass); - k->init = mst_fpga_init; dc->desc ="Mainstone II FPGA" ; dc->vmsd = &vmstate_mst_fpga_regs; }
@@ -256,6 +254,7 @@ static const TypeInfo mst_fpga_info = { .name = TYPE_MAINSTONE_FPGA, .parent = TYPE_SYS_BUS_DEVICE, .instance_size = sizeof(mst_irq_state), + .instance_init = mst_fpga_init, .class_init = mst_fpga_class_init, };
Signature · 1 line
1.9.1
[Qemu-devel] [PULL 07/30] hw/arm/virt: introduce DEFINE_VIRT_MACHINE_AS_LATEST
In reply to Peter MaydellFrom: Andrew Jones <[email protected]>
Create two variants of DEFINE_VIRT_MACHINE. One, just called DEFINE_VIRT_MACHINE, that does not set properties that only the latest machine type should have, and another that does. This will hopefully reduce potential for errors when adding new versions.
Message-id: [email protected]
--- hw/arm/virt.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
hw/arm/virt.c +10 -3
@@ -99,13 +99,16 @@ typedef struct { OBJECT_CLASS_CHECK(VirtMachineClass, klass, TYPE_VIRT_MACHINE) -#define DEFINE_VIRT_MACHINE (major, minor) \ +#define DEFINE_VIRT_MACHINE_LATEST (major, minor, latest) \ static void virt_##major##_##minor##_class_init(ObjectClass *oc, \ void *data) \ { \ MachineClass *mc = MACHINE_CLASS(oc); \ virt_machine_##major##_##minor##_options(mc); \ mc->desc = "QEMU " # major "." # minor " ARM Virtual Machine"; \ + if (latest) { \ + mc->alias = "virt"; \ + } \ } \ static const TypeInfo machvirt_##major##_##minor##_info = { \ .name = MACHINE_TYPE_NAME("virt-" # major "." # minor), \
@@ -119,6 +122,11 @@ typedef struct { } \ type_init(machvirt_machine_##major##_##minor##_init); +#define DEFINE_VIRT_MACHINE_AS_LATEST (major, minor) \ + DEFINE_VIRT_MACHINE_LATEST(major, minor, true) +#define DEFINE_VIRT_MACHINE (major, minor) \ + DEFINE_VIRT_MACHINE_LATEST(major, minor, false) +/* RAM limit in GB. Since VIRT_MEM starts at the 1GB mark, this means * RAM can go up to the 256GB mark, leaving 256GB of the physical
@@ -1483,6 +1491,5 @@ static void virt_2_6_instance_init(Object *obj)static void virt_machine_2_6_options (MachineClass *mc) { - mc->alias ="virt" ; } -DEFINE_VIRT_MACHINE (2 ,6 ) +DEFINE_VIRT_MACHINE_AS_LATEST (2 ,6 )
Signature · 1 line
1.9.1
[Qemu-devel] [PULL 19/30] hw/dma: QOM'ify pxa2xx_dma.c
In reply to Peter MaydellFrom: xiaoqiang zhao <[email protected]>
split the old SysBus init function into an instance_init and a Device realize function
Message-id: [email protected]
--- hw/dma/pxa2xx_dma.c | 38 ++++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 16 deletions(-)
hw/dma/pxa2xx_dma.c +22 -16
@@ -12,6 +12,7 @@#include "hw/hw.h" #include "hw/arm/pxa.h" #include "hw/sysbus.h" +#include "qapi/error.h" #define PXA255_DMA_NUM_CHANNELS 16#define PXA27X_DMA_NUM_CHANNELS 32
@@ -450,31 +451,36 @@ static void pxa2xx_dma_request(void *opaque, int req_num, int on) } } -static int pxa2xx_dma_init (SysBusDevice *sbd) +static void pxa2xx_dma_init (Object *obj) +{ +DeviceState *dev =DEVICE (obj); +PXA2xxDMAState *s =PXA2XX_DMA (obj); +SysBusDevice *sbd =SYS_BUS_DEVICE (obj); + +memset (s->req,0 ,sizeof (uint8_t ) *PXA2XX_DMA_NUM_REQUESTS ); + +qdev_init_gpio_in (dev, pxa2xx_dma_request,PXA2XX_DMA_NUM_REQUESTS ); + +memory_region_init_io (&s->iomem, obj, &pxa2xx_dma_ops, s, +"pxa2xx.dma" ,0x00010000 ); +sysbus_init_mmio (sbd, &s->iomem); +sysbus_init_irq (sbd, &s->irq); +} + +static void pxa2xx_dma_realize (DeviceState *dev,Error **errp) { -DeviceState *dev =DEVICE (sbd);PXA2xxDMAState *s =PXA2XX_DMA (dev);int i;if (s->channels <=0 ) { -return -1 ; +error_setg (errp,"channels value invalid" ); +return ; } s->chan =g_new0 (PXA2xxDMAChannel, s->channels);for (i =0 ; i < s->channels; i ++) s->chan[i].state =DCSR_STOPINTR ; - -memset (s->req,0 ,sizeof (uint8_t ) *PXA2XX_DMA_NUM_REQUESTS ); - -qdev_init_gpio_in (dev, pxa2xx_dma_request,PXA2XX_DMA_NUM_REQUESTS ); - -memory_region_init_io (&s->iomem,OBJECT (s), &pxa2xx_dma_ops, s, -"pxa2xx.dma" ,0x00010000 ); -sysbus_init_mmio (sbd, &s->iomem); -sysbus_init_irq (sbd, &s->irq); - -return 0 ; }DeviceState *pxa27x_dma_init (hwaddr base,qemu_irq irq)
@@ -553,18 +559,18 @@ static Property pxa2xx_dma_properties[] = {static void pxa2xx_dma_class_init (ObjectClass *klass,void *data) {DeviceClass *dc =DEVICE_CLASS (klass); -SysBusDeviceClass *k =SYS_BUS_DEVICE_CLASS (klass); - k->init = pxa2xx_dma_init; dc->desc ="PXA2xx DMA controller" ; dc->vmsd = &vmstate_pxa2xx_dma; dc->props = pxa2xx_dma_properties; + dc->realize = pxa2xx_dma_realize; }static const TypeInfo pxa2xx_dma_info = { .name =TYPE_PXA2XX_DMA , .parent =TYPE_SYS_BUS_DEVICE , .instance_size =sizeof (PXA2xxDMAState), + .instance_init = pxa2xx_dma_init, .class_init = pxa2xx_dma_class_init, };
Signature · 1 line
1.9.1
[Qemu-devel] [PULL 21/30] i2cbus: remove unused dev field
In reply to Peter MaydellFrom: KONRAD Frederic <[email protected]>
The dev field in i2cbus is not used.
So just drop it.
Message-id: [email protected]
--- hw/i2c/core.c | 1 - 1 file changed, 1 deletion(-)
hw/i2c/core.c +0 -1
@@ -14,7 +14,6 @@ struct I2CBus {BusState qbus;I2CSlave *current_dev; -I2CSlave *dev;uint8_t saved_address; };
Signature · 1 line
1.9.1
[Qemu-devel] [PULL 02/30] hw/arm/virt: Add PMU node for virt machine
In reply to Peter MaydellFrom: Shannon Zhao <[email protected]>
Add a virtual PMU device for virt machine while use PPI 7 for PMU overflow interrupt number.
Message-id: [email protected]
--- hw/arm/virt.c | 33 +++++++++++++++++++++++++++++++++ include/hw/arm/virt.h | 4 ++++ target-arm/kvm32.c | 6 ++++++ target-arm/kvm64.c | 41 +++++++++++++++++++++++++++++++++++++++++ target-arm/kvm_arm.h | 7 +++++++ 5 files changed, 91 insertions(+)
hw/arm/virt.c +33 -0
@@ -436,6 +436,37 @@ static void fdt_add_gic_node(VirtBoardInfo *vbi, int type)qemu_fdt_setprop_cell (vbi->fdt,"/intc" ,"phandle" , vbi->gic_phandle); } +static void fdt_add_pmu_nodes (const VirtBoardInfo *vbi,int gictype) +{ +CPUState *cpu; +ARMCPU *armcpu; +uint32_t irqflags =GIC_FDT_IRQ_FLAGS_LEVEL_HI ; + +CPU_FOREACH (cpu) { + armcpu =ARM_CPU (cpu); +if (!armcpu->has_pmu || + !kvm_arm_pmu_create (cpu,PPI (VIRTUAL_PMU_IRQ ))) { +return ; + } + } + +if (gictype ==2 ) { + irqflags =deposit32 (irqflags,GIC_FDT_IRQ_PPI_CPU_START , +GIC_FDT_IRQ_PPI_CPU_WIDTH , + (1 << vbi->smp_cpus) -1 ); + } + + armcpu =ARM_CPU (qemu_get_cpu (0 )); +qemu_fdt_add_subnode (vbi->fdt,"/pmu" ); +if (arm_feature (&armcpu->env,ARM_FEATURE_V8 )) { +const char compat[] ="arm,armv8-pmuv3" ; +qemu_fdt_setprop (vbi->fdt,"/pmu" ,"compatible" , + compat,sizeof (compat)); +qemu_fdt_setprop_cells (vbi->fdt,"/pmu" ,"interrupts" , +GIC_FDT_IRQ_TYPE_PPI ,VIRTUAL_PMU_IRQ , irqflags); + } +} +static void create_v2m (VirtBoardInfo *vbi,qemu_irq *pic) {int i;
@@ -1259,6 +1290,8 @@ static void machvirt_init(MachineState *machine)create_gic (vbi, pic, gic_version, vms->secure); +fdt_add_pmu_nodes (vbi, gic_version); +create_uart (vbi, pic,VIRT_UART , sysmem, serial_hds[0 ]);if (vms->secure) {
include/hw/arm/virt.h +4 -0
@@ -41,6 +41,10 @@#define ARCH_TIMER_NS_EL1_IRQ 14#define ARCH_TIMER_NS_EL2_IRQ 10 +#define VIRTUAL_PMU_IRQ 7 + +#define PPI (irq) ((irq) + 16) +enum {VIRT_FLASH ,VIRT_MEM ,
target-arm/kvm32.c +6 -0
@@ -522,3 +522,9 @@ bool kvm_arm_hw_debug_active(CPUState *cs) {return false; } + +int kvm_arm_pmu_create (CPUState *cs,int irq) +{ +qemu_log_mask (LOG_UNIMP ,"%s: not implemented\n" , __func__); +return 0 ; +}
target-arm/kvm64.c +41 -0
47 lines not on this page · raw message
target-arm/kvm_arm.h +7 -0
@@ -194,6 +194,8 @@ int kvm_arm_sync_mpstate_to_qemu(ARMCPU *cpu);int kvm_arm_vgic_probe (void ); +int kvm_arm_pmu_create (CPUState *cs,int irq); +#else static inline int kvm_arm_vgic_probe (void )
@@ -201,6 +203,11 @@ static inline int kvm_arm_vgic_probe(void) return 0; } +static inline int kvm_arm_pmu_create (CPUState *cs,int irq) +{ +return 0 ; +} +#endif static inline const char *gic_class_name (void )
Signature · 1 line
1.9.1
[Qemu-devel] [PULL 15/30] hw/gpio: QOM'ify zaurus.c
In reply to Peter MaydellFrom: xiaoqiang zhao <[email protected]>
Drop the old SysBus init function and use instance_init
Message-id: [email protected]
--- hw/gpio/zaurus.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)
hw/gpio/zaurus.c +6 -8
@@ -167,19 +167,18 @@ static void scoop_gpio_set(void *opaque, int line, int level) s->gpio_level &= ~(1 << line); } -static int scoop_init (SysBusDevice *sbd) +static void scoop_init (Object *obj) { -DeviceState *dev =DEVICE (sbd); -ScoopInfo *s =SCOOP (dev); +DeviceState *dev =DEVICE (obj); +ScoopInfo *s =SCOOP (obj); +SysBusDevice *sbd =SYS_BUS_DEVICE (obj); s->status =0x02 ;qdev_init_gpio_out (dev, s->handler,16 );qdev_init_gpio_in (dev, scoop_gpio_set,16 ); -memory_region_init_io (&s->iomem,OBJECT (s), &scoop_ops, s,"scoop" ,0x1000 ); +memory_region_init_io (&s->iomem, obj, &scoop_ops, s,"scoop" ,0x1000 );sysbus_init_mmio (sbd, &s->iomem); - -return 0 ; }static int scoop_post_load (void *opaque,int version_id)
@@ -239,9 +238,7 @@ static const VMStateDescription vmstate_scoop_regs = {static void scoop_sysbus_class_init (ObjectClass *klass,void *data) {DeviceClass *dc =DEVICE_CLASS (klass); -SysBusDeviceClass *k =SYS_BUS_DEVICE_CLASS (klass); - k->init = scoop_init; dc->desc ="Scoop2 Sharp custom ASIC" ; dc->vmsd = &vmstate_scoop_regs; }
@@ -250,6 +247,7 @@ static const TypeInfo scoop_sysbus_info = { .name = TYPE_SCOOP, .parent = TYPE_SYS_BUS_DEVICE, .instance_size = sizeof(ScoopInfo), + .instance_init = scoop_init, .class_init = scoop_sysbus_class_init, };
Signature · 1 line
1.9.1
[Qemu-devel] [PULL 23/30] i2c: Factor our send() and recv() common logic
In reply to Peter MaydellFrom: Peter Crosthwaite <[email protected]>
Most of the control flow logic between send and recv (error checking etc) is the same. Factor this out into a common send_recv() API. This is then usable by clients, where the control logic for send and receive differs only by a boolean. E.g.
if (send)
i2c_send(...):
else
i2c_recv(...);
becomes:
i2c_send_recv(... , send);
Message-id: [email protected] Changes from FK:
* Rebased on master.
* Rebased on my i2c broadcast patch.
--- hw/i2c/core.c | 52 ++++++++++++++++++++++++++++++++++------------------ include/hw/i2c/i2c.h | 1 + 2 files changed, 35 insertions(+), 18 deletions(-)
hw/i2c/core.c +34 -18
@@ -149,36 +149,52 @@ void i2c_end_transfer(I2CBus *bus) bus->broadcast = false; } -int i2c_send (I2CBus *bus,uint8_t data) +int i2c_send_recv (I2CBus *bus,uint8_t *data,bool send) {I2CSlaveClass *sc;I2CNode *node;int ret =0 ; - QLIST_FOREACH(node, &bus->current_devs, next) { - sc =I2C_SLAVE_GET_CLASS (node->elt); -if (sc->send) { - ret = ret || sc->send (node->elt, data); - }else { - ret =-1 ; +if (send) { + QLIST_FOREACH(node, &bus->current_devs, next) { + sc =I2C_SLAVE_GET_CLASS (node->elt); +if (sc->send) { + ret = ret || sc->send (node->elt, *data); + }else { + ret =-1 ; + } + } +return ret ?-1 :0 ; + }else { +if ((QLIST_EMPTY (&bus->current_devs)) || (bus->broadcast)) { +return -1 ; } + + sc =I2C_SLAVE_GET_CLASS (QLIST_FIRST (&bus->current_devs)->elt); +if (sc->recv) { + ret = sc->recv (QLIST_FIRST (&bus->current_devs)->elt); +if (ret <0 ) { +return ret; + }else { + *data = ret; +return 0 ; + } + } +return -1 ; } -return ret ?-1 :0 ; } -int i2c_recv (I2CBus *bus) +int i2c_send (I2CBus *bus,uint8_t data) { -I2CSlaveClass *sc; +return i2c_send_recv (bus, &data, true); +} -if ((QLIST_EMPTY (&bus->current_devs)) || (bus->broadcast)) { -return -1 ; - } +int i2c_recv (I2CBus *bus) +{ +uint8_t data; +int ret =i2c_send_recv (bus, &data, false); - sc =I2C_SLAVE_GET_CLASS (QLIST_FIRST (&bus->current_devs)->elt); -if (sc->recv) { -return sc->recv (QLIST_FIRST (&bus->current_devs)->elt); - } -return -1 ; +return ret <0 ? ret : data; }void i2c_nack (I2CBus *bus)
include/hw/i2c/i2c.h +1 -0
@@ -56,6 +56,7 @@ int i2c_bus_busy(I2CBus *bus);int i2c_start_transfer (I2CBus *bus,uint8_t address,int recv);void i2c_end_transfer (I2CBus *bus);void i2c_nack (I2CBus *bus); +int i2c_send_recv (I2CBus *bus,uint8_t *data,bool send);int i2c_send (I2CBus *bus,uint8_t data);int i2c_recv (I2CBus *bus);
Signature · 1 line
1.9.1
[Qemu-devel] [PULL 17/30] hw/misc: QOM'ify exynos4210_pmu.c
In reply to Peter MaydellFrom: xiaoqiang zhao <[email protected]>
Drop the old SysBus init function and use instance_init
Message-id: [email protected]
--- hw/misc/exynos4210_pmu.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
hw/misc/exynos4210_pmu.c +5 -6
@@ -457,15 +457,15 @@ static void exynos4210_pmu_reset(DeviceState *dev) } } -static int exynos4210_pmu_init (SysBusDevice *dev) +static void exynos4210_pmu_init (Object *obj) { -Exynos4210PmuState *s =EXYNOS4210_PMU (dev); +Exynos4210PmuState *s =EXYNOS4210_PMU (obj); +SysBusDevice *dev =SYS_BUS_DEVICE (obj);/* memory mapping */ -memory_region_init_io (&s->iomem,OBJECT (dev), &exynos4210_pmu_ops, s, +memory_region_init_io (&s->iomem, obj, &exynos4210_pmu_ops, s,"exynos4210.pmu" ,EXYNOS4210_PMU_REGS_MEM_SIZE );sysbus_init_mmio (dev, &s->iomem); -return 0 ; }static const VMStateDescription exynos4210_pmu_vmstate = {
@@ -481,9 +481,7 @@ static const VMStateDescription exynos4210_pmu_vmstate = {static void exynos4210_pmu_class_init (ObjectClass *klass,void *data) {DeviceClass *dc =DEVICE_CLASS (klass); -SysBusDeviceClass *k =SYS_BUS_DEVICE_CLASS (klass); - k->init = exynos4210_pmu_init; dc->reset = exynos4210_pmu_reset; dc->vmsd = &exynos4210_pmu_vmstate; }
@@ -492,6 +490,7 @@ static const TypeInfo exynos4210_pmu_info = { .name = TYPE_EXYNOS4210_PMU, .parent = TYPE_SYS_BUS_DEVICE, .instance_size = sizeof(Exynos4210PmuState), + .instance_init = exynos4210_pmu_init, .class_init = exynos4210_pmu_class_init, };
Signature · 1 line
1.9.1
[Qemu-devel] [PULL 22/30] i2c: implement broadcast write
In reply to Peter MaydellFrom: KONRAD Frederic <[email protected]>
This does a write to every slaves when the I2C bus get a write to address 0.
Message-id: [email protected]
--- hw/i2c/core.c | 134 ++++++++++++++++++++++++++++++++++------------------------ 1 file changed, 79 insertions(+), 55 deletions(-)
hw/i2c/core.c +79 -55
@@ -10,11 +10,19 @@#include "qemu/osdep.h" #include "hw/i2c/i2c.h" +typedef struct I2CNode I2CNode ; + +struct I2CNode { +I2CSlave *elt; +QLIST_ENTRY (I2CNode) next; +}; +struct I2CBus {BusState qbus; -I2CSlave *current_dev; + QLIST_HEAD(, I2CNode) current_devs;uint8_t saved_address; +bool broadcast; };static Property i2c_props[] = {
@@ -35,17 +43,12 @@ static void i2c_bus_pre_save(void *opaque) {I2CBus *bus = opaque; - bus->saved_address = bus->current_dev ? bus->current_dev->address :-1 ; -} - -static int i2c_bus_post_load (void *opaque,int version_id) -{ -I2CBus *bus = opaque; - -/* The bus is loaded before attached devices, so load and save the -current device id. Devices will check themselves as loaded. */ - bus->current_dev =NULL ; -return 0 ; + bus->saved_address =-1 ; +if (!QLIST_EMPTY (&bus->current_devs)) { +if (!bus->broadcast) { + bus->saved_address =QLIST_FIRST (&bus->current_devs)->elt->address; + } + } }static const VMStateDescription vmstate_i2c_bus = {
@@ -53,9 +56,9 @@ static const VMStateDescription vmstate_i2c_bus = { .version_id = 1, .minimum_version_id = 1, .pre_save = i2c_bus_pre_save, - .post_load = i2c_bus_post_load, .fields = (VMStateField []) {VMSTATE_UINT8 (saved_address, I2CBus), +VMSTATE_BOOL (broadcast, I2CBus),VMSTATE_END_OF_LIST () } };
@@ -66,6 +69,7 @@ I2CBus *i2c_init_bus(DeviceState *parent, const char *name)I2CBus *bus; bus =I2C_BUS (qbus_create (TYPE_I2C_BUS , parent, name)); +QLIST_INIT (&bus->current_devs);vmstate_register (NULL ,-1 , &vmstate_i2c_bus, bus);return bus; }
@@ -78,7 +82,7 @@ void i2c_set_slave_address(I2CSlave *dev, uint8_t address)/* Return nonzero if bus is busy. */ int i2c_bus_busy (I2CBus *bus) { -return bus->current_dev !=NULL ; +return !QLIST_EMPTY (&bus->current_devs); }/* Returns non-zero if the address is not valid. */
@@ -86,95 +90,111 @@ int i2c_bus_busy(I2CBus *bus)int i2c_start_transfer (I2CBus *bus,uint8_t address,int recv) {BusChild *kid; -I2CSlave *slave =NULL ;I2CSlaveClass *sc; +I2CNode *node; + +if (address ==0x00 ) { +/* +* This is a broadcast, the current_devs will be all the devices of the +* bus. +*/ + bus->broadcast = true; + } QTAILQ_FOREACH(kid, &bus->qbus.children, sibling) {DeviceState *qdev = kid->child;I2CSlave *candidate =I2C_SLAVE (qdev); -if (candidate->address == address) { - slave = candidate; -break ; +if ((candidate->address == address) || (bus->broadcast)) { + node =g_malloc (sizeof (struct I2CNode )); + node->elt = candidate; +QLIST_INSERT_HEAD (&bus->current_devs, node, next); +if (!bus->broadcast) { +break ; + } } } -if (!slave) { +if (QLIST_EMPTY (&bus->current_devs)) {return 1 ; } - sc =I2C_SLAVE_GET_CLASS (slave); -/* If the bus is already busy, assume this is a repeated -start condition. */ - bus->current_dev = slave; -if (sc->event) { - sc->event (slave, recv ?I2C_START_RECV :I2C_START_SEND ); + QLIST_FOREACH(node, &bus->current_devs, next) { + sc =I2C_SLAVE_GET_CLASS (node->elt); +/* If the bus is already busy, assume this is a repeated +start condition. */ +if (sc->event) { + sc->event (node->elt, recv ?I2C_START_RECV :I2C_START_SEND ); + } }return 0 ; }void i2c_end_transfer (I2CBus *bus) { -I2CSlave *dev = bus->current_dev;I2CSlaveClass *sc; +I2CNode *node, *next; -if (!dev) { +if (QLIST_EMPTY (&bus->current_devs)) {return ; } - sc =I2C_SLAVE_GET_CLASS (dev); -if (sc->event) { - sc->event (dev,I2C_FINISH ); + QLIST_FOREACH_SAFE(node, &bus->current_devs, next, next) { + sc =I2C_SLAVE_GET_CLASS (node->elt); +if (sc->event) { + sc->event (node->elt,I2C_FINISH ); + } +QLIST_REMOVE (node, next); +g_free (node); } - - bus->current_dev =NULL ; + bus->broadcast = false; }int i2c_send (I2CBus *bus,uint8_t data) { -I2CSlave *dev = bus->current_dev;I2CSlaveClass *sc; - -if (!dev) { -return -1 ; - } - - sc =I2C_SLAVE_GET_CLASS (dev); -if (sc->send) { -return sc->send (dev, data); +I2CNode *node; +int ret =0 ; + + QLIST_FOREACH(node, &bus->current_devs, next) { + sc =I2C_SLAVE_GET_CLASS (node->elt); +if (sc->send) { + ret = ret || sc->send (node->elt, data); + }else { + ret =-1 ; + } } - -return -1 ; +return ret ?-1 :0 ; }int i2c_recv (I2CBus *bus) { -I2CSlave *dev = bus->current_dev;I2CSlaveClass *sc; -if (!dev) { +if ((QLIST_EMPTY (&bus->current_devs)) || (bus->broadcast)) {return -1 ; } - sc =I2C_SLAVE_GET_CLASS (dev); + sc =I2C_SLAVE_GET_CLASS (QLIST_FIRST (&bus->current_devs)->elt);if (sc->recv) { -return sc->recv (dev); +return sc->recv (QLIST_FIRST (&bus->current_devs)->elt); } -return -1 ; }void i2c_nack (I2CBus *bus) { -I2CSlave *dev = bus->current_dev;I2CSlaveClass *sc; +I2CNode *node; -if (!dev) { +if (QLIST_EMPTY (&bus->current_devs)) {return ; } - sc =I2C_SLAVE_GET_CLASS (dev); -if (sc->event) { - sc->event (dev,I2C_NACK ); + QLIST_FOREACH(node, &bus->current_devs, next) { + sc =I2C_SLAVE_GET_CLASS (node->elt); +if (sc->event) { + sc->event (node->elt,I2C_NACK ); + } } }
@@ -182,9 +202,13 @@ static int i2c_slave_post_load(void *opaque, int version_id) {I2CSlave *dev = opaque;I2CBus *bus; +I2CNode *node; + bus =I2C_BUS (qdev_get_parent_bus (DEVICE (dev))); -if (bus->saved_address == dev->address) { - bus->current_dev = dev; +if ((bus->saved_address == dev->address) || (bus->broadcast)) { + node =g_malloc (sizeof (struct I2CNode )); + node->elt = dev; +QLIST_INSERT_HEAD (&bus->current_devs, node, next); }return 0 ; }
Signature · 1 line
1.9.1
[Qemu-devel] [PULL 20/30] hw/sd: QOM'ify pl181.c
In reply to Peter MaydellFrom: xiaoqiang zhao <[email protected]>
split the old SysBus init function into an instance_init and a Device realize function
Message-id: [email protected]
--- hw/sd/pl181.c | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-)
hw/sd/pl181.c +16 -10
@@ -13,6 +13,7 @@#include "hw/sysbus.h" #include "hw/sd/sd.h" #include "qemu/log.h" +#include "qapi/error.h" //#define DEBUG_PL181 1
@@ -481,43 +482,48 @@ static void pl181_reset(DeviceState *d)sd_set_cb (s->card, s->cardstatus[0 ], s->cardstatus[1 ]); } -static int pl181_init (SysBusDevice *sbd) +static void pl181_init (Object *obj) { -DeviceState *dev =DEVICE (sbd); -PL181State *s =PL181 (dev); -DriveInfo *dinfo; +DeviceState *dev =DEVICE (obj); +PL181State *s =PL181 (obj); +SysBusDevice *sbd =SYS_BUS_DEVICE (obj); -memory_region_init_io (&s->iomem,OBJECT (s), &pl181_ops, s,"pl181" ,0x1000 ); +memory_region_init_io (&s->iomem, obj, &pl181_ops, s,"pl181" ,0x1000 );sysbus_init_mmio (sbd, &s->iomem);sysbus_init_irq (sbd, &s->irq[0 ]);sysbus_init_irq (sbd, &s->irq[1 ]);qdev_init_gpio_out (dev, s->cardstatus,2 ); +} + +static void pl181_realize (DeviceState *dev,Error **errp) +{ +PL181State *s =PL181 (dev); +DriveInfo *dinfo; +/* FIXME use a qdev drive property instead of drive_get_next() */ dinfo =drive_get_next (IF_SD ); s->card =sd_init (dinfo ?blk_by_legacy_dinfo (dinfo) :NULL , false);if (s->card ==NULL ) { -return -1 ; +error_setg (errp,"sd_init failed" ); } - -return 0 ; }static void pl181_class_init (ObjectClass *klass,void *data) { -SysBusDeviceClass *sdc =SYS_BUS_DEVICE_CLASS (klass);DeviceClass *k =DEVICE_CLASS (klass); - sdc->init = pl181_init; k->vmsd = &vmstate_pl181; k->reset = pl181_reset;/* Reason: init() method uses drive_get_next() */ k->cannot_instantiate_with_device_add_yet = true; + k->realize = pl181_realize; }static const TypeInfo pl181_info = { .name =TYPE_PL181 , .parent =TYPE_SYS_BUS_DEVICE , .instance_size =sizeof (PL181State), + .instance_init = pl181_init, .class_init = pl181_class_init, };
Signature · 1 line
1.9.1
[Qemu-devel] [PULL 24/30] introduce aux-bus
In reply to Peter MaydellFrom: KONRAD Frederic <[email protected]>
This introduces a new bus: aux-bus.
It contains an address space for aux slaves devices and a bridge to an I2C bus for I2C through AUX transactions.
Message-id: [email protected]
--- default-configs/aarch64-softmmu.mak | 1 + hw/misc/Makefile.objs | 1 + hw/misc/aux.c | 292 ++++++++++++++++++++++++++++++++++++ include/hw/misc/aux.h | 128 ++++++++++++++++ 4 files changed, 422 insertions(+) create mode 100644 hw/misc/aux.c create mode 100644 include/hw/misc/aux.h
default-configs/aarch64-softmmu.mak +1 -0
@@ -3,4 +3,5 @@ # We support all the 32 bit boards so need all their config include arm-softmmu.mak +CONFIG_AUX=y CONFIG_XLNX_ZYNQMP=y
hw/misc/Makefile.objs +1 -0
@@ -51,3 +51,4 @@ obj-$(CONFIG_MIPS_ITU) += mips_itu.o obj-$(CONFIG_PVPANIC) += pvpanic.o obj-$(CONFIG_EDU) += edu.o obj-$(CONFIG_HYPERV_TESTDEV) += hyperv_testdev.o +obj-$(CONFIG_AUX) += aux.o
hw/misc/aux.c new file +292 -0
292 lines not on this page · raw message
include/hw/misc/aux.h new file +128 -0
128 lines not on this page · raw message
Signature · 1 line
1.9.1
[Qemu-devel] [PULL 26/30] hw/i2c-ddc.c: Implement DDC I2C slave
In reply to Peter MaydellImplement an I2C slave which implements DDC and returns the EDID data for an attached monitor.
Message-id: [email protected]
- Rebased on the current master.
- Modified for QOM.
--- default-configs/aarch64-softmmu.mak | 1 + hw/i2c/Makefile.objs | 1 + hw/i2c/i2c-ddc.c | 307 ++++++++++++++++++++++++++++++++++++ include/hw/i2c/i2c-ddc.h | 38 +++++ 4 files changed, 347 insertions(+) create mode 100644 hw/i2c/i2c-ddc.c create mode 100644 include/hw/i2c/i2c-ddc.h
default-configs/aarch64-softmmu.mak +1 -0
@@ -4,5 +4,6 @@ include arm-softmmu.mak CONFIG_AUX=y +CONFIG_DDC=y CONFIG_DPCD=y CONFIG_XLNX_ZYNQMP=y
hw/i2c/Makefile.objs +1 -0
@@ -1,4 +1,5 @@ common-obj-y += core.o smbus.o smbus_eeprom.o +common-obj-$(CONFIG_DDC) += i2c-ddc.o common-obj-$(CONFIG_VERSATILE_I2C) += versatile_i2c.o common-obj-$(CONFIG_ACPI_X86) += smbus_ich9.o common-obj-$(CONFIG_APM) += pm_smbus.o
hw/i2c/i2c-ddc.c new file +307 -0
307 lines not on this page · raw message
include/hw/i2c/i2c-ddc.h new file +38 -0
@@ -0,0 +1,38 @@ +/* A simple I2C slave for returning monitor EDID data via DDC. +* +* Copyright (c) 2011 Linaro Limited +* Written by Peter Maydell +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License along +* with this program; if not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef I2C_DDC +#define I2C_DDC + +/* A simple I2C slave which just returns the contents of its EDID blob. */ + +struct I2CDDCState { +/*< private >*/ +I2CSlave i2c; +/*< public >*/ +bool firstbyte; +uint8_t reg; +uint8_t edid_blob[128 ]; +}; + +typedef struct I2CDDCState I2CDDCState ; + +#define TYPE_I2CDDC "i2c-ddc" +#define I2CDDC (obj) OBJECT_CHECK(I2CDDCState, (obj), TYPE_I2CDDC) + +#endif /* !I2C_DDC */
Signature · 1 line
1.9.1
[Qemu-devel] [PULL 29/30] arm: xlnx-zynqmp: Add xlnx-dp and xlnx-dpdma
In reply to Peter MaydellFrom: KONRAD Frederic <[email protected]>
This adds the DP and the DPDMA to the Zynq MP platform.
Message-id: [email protected]
--- hw/arm/xlnx-zynqmp.c | 32 +++++++++++++++++++++++++++++++- include/hw/arm/xlnx-zynqmp.h | 4 ++++ 2 files changed, 35 insertions(+), 1 deletion(-)
hw/arm/xlnx-zynqmp.c +31 -1
@@ -38,6 +38,12 @@#define SATA_ADDR 0xFD0C0000#define SATA_NUM_PORTS 2 +#define DP_ADDR 0xfd4a0000 +#define DP_IRQ 113 + +#define DPDMA_ADDR 0xfd4c0000 +#define DPDMA_IRQ 116 +static const uint64_t gem_addr[XLNX_ZYNQMP_NUM_GEMS ] = {0xFF0B0000 ,0xFF0C0000 ,0xFF0D0000 ,0xFF0E0000 , };
@@ -165,6 +171,12 @@ static void xlnx_zynqmp_init(Object *obj) TYPE_XILINX_SPIPS);qdev_set_parent_bus (DEVICE (&s->spi[i]),sysbus_get_default ()); } + +object_initialize (&s->dp,sizeof (s->dp),TYPE_XLNX_DP ); +qdev_set_parent_bus (DEVICE (&s->dp),sysbus_get_default ()); + +object_initialize (&s->dpdma,sizeof (s->dpdma),TYPE_XLNX_DPDMA ); +qdev_set_parent_bus (DEVICE (&s->dpdma),sysbus_get_default ()); }static void xlnx_zynqmp_realize (DeviceState *dev,Error **errp)
@@ -388,8 +400,26 @@ static void xlnx_zynqmp_realize(DeviceState *dev, Error **errp)object_property_add_alias (OBJECT (s), bus_name,OBJECT (&s->spi[i]),"spi0" , &error_abort); -g_free (bus_name); +g_free (bus_name); + } + +object_property_set_bool (OBJECT (&s->dp), true,"realized" , &err); +if (err) { +error_propagate (errp, err); +return ; + } +sysbus_mmio_map (SYS_BUS_DEVICE (&s->dp),0 ,DP_ADDR ); +sysbus_connect_irq (SYS_BUS_DEVICE (&s->dp),0 , gic_spi[DP_IRQ ]); + +object_property_set_bool (OBJECT (&s->dpdma), true,"realized" , &err); +if (err) { +error_propagate (errp, err); +return ; } +object_property_set_link (OBJECT (&s->dp),OBJECT (&s->dpdma),"dpdma" , + &error_abort); +sysbus_mmio_map (SYS_BUS_DEVICE (&s->dpdma),0 ,DPDMA_ADDR ); +sysbus_connect_irq (SYS_BUS_DEVICE (&s->dpdma),0 , gic_spi[DPDMA_IRQ ]); }static Property xlnx_zynqmp_props[] = {
include/hw/arm/xlnx-zynqmp.h +4 -0
@@ -26,6 +26,8 @@#include "hw/ide/ahci.h" #include "hw/sd/sdhci.h" #include "hw/ssi/xilinx_spips.h" +#include "hw/dma/xlnx_dpdma.h" +#include "hw/display/xlnx_dp.h" #define TYPE_XLNX_ZYNQMP "xlnx,zynqmp"#define XLNX_ZYNQMP (obj) OBJECT_CHECK(XlnxZynqMPState, (obj), \
@@ -81,6 +83,8 @@ typedef struct XlnxZynqMPState {SysbusAHCIState sata;SDHCIState sdhci[XLNX_ZYNQMP_NUM_SDHCI ];XilinxSPIPS spi[XLNX_ZYNQMP_NUM_SPIS ]; +XlnxDPState dp; +XlnxDPDMAState dpdma;char *boot_cpu;ARMCPU *boot_cpu_ptr;
Signature · 1 line
1.9.1
[Qemu-devel] [PULL 30/30] target-arm: Don't permit ARMv8-only Neon insns on ARMv7
In reply to Peter MaydellThe Neon instructions VCVTA, VCVTM, VCVTN, VCVTP, VRINTA, VRINTM, VRINTN, VRINTP, VRINTX, and VRINTZ were only introduced with ARMv8, so they need a guard to make them UNDEF if the CPU only supports ARMv7. (We got this right for all the other new-in-v8 insns, but forgot it for these Neon 2-reg-misc ops.)
Message-id: [email protected]
--- target-arm/translate.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)
target-arm/translate.c +28 -0
@@ -5311,6 +5311,30 @@ static int neon_2rm_is_float_op(int op) op >= NEON_2RM_VRECPE_F); } +static bool neon_2rm_is_v8_op (int op) +{ +/* Return true if this neon 2reg-misc op is ARMv8 and up */ +switch (op) { +case NEON_2RM_VRINTN : +case NEON_2RM_VRINTA : +case NEON_2RM_VRINTM : +case NEON_2RM_VRINTP : +case NEON_2RM_VRINTZ : +case NEON_2RM_VRINTX : +case NEON_2RM_VCVTAU : +case NEON_2RM_VCVTAS : +case NEON_2RM_VCVTNU : +case NEON_2RM_VCVTNS : +case NEON_2RM_VCVTPU : +case NEON_2RM_VCVTPS : +case NEON_2RM_VCVTMU : +case NEON_2RM_VCVTMS : +return true; +default : +return false; + } +} +/* Each entry in this array has bit n set if the insn allows * size value n (otherwise it will UNDEF). Since unallocated * op values will have no bits set they always UNDEF.
@@ -6798,6 +6822,10 @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn)if ((neon_2rm_sizes[op] & (1 << size)) ==0 ) {return 1 ; } +if (neon_2rm_is_v8_op (op) && + !arm_dc_feature (s,ARM_FEATURE_V8 )) { +return 1 ; + }if ((op !=NEON_2RM_VMOVN && op !=NEON_2RM_VQMOVN ) && q && ((rm | rd) &1 )) {return 1 ;
Signature · 1 line
1.9.1
[Qemu-devel] [PULL 27/30] introduce xlnx-dpdma
In reply to Peter MaydellFrom: KONRAD Frederic <[email protected]>
This is the implementation of the DPDMA.
Message-id: [email protected]
--- hw/dma/Makefile.objs | 1 + hw/dma/xlnx_dpdma.c | 794 ++++++++++++++++++++++++++++++++++++++++++++ include/hw/dma/xlnx_dpdma.h | 85 +++++ 3 files changed, 880 insertions(+) create mode 100644 hw/dma/xlnx_dpdma.c create mode 100644 include/hw/dma/xlnx_dpdma.h
hw/dma/Makefile.objs +1 -0
@@ -8,6 +8,7 @@ common-obj-$(CONFIG_XILINX_AXI) += xilinx_axidma.o common-obj-$(CONFIG_ETRAXFS) += etraxfs_dma.o common-obj-$(CONFIG_STP2000) += sparc32_dma.o common-obj-$(CONFIG_SUN4M) += sun4m_iommu.o +obj-$(CONFIG_XLNX_ZYNQMP) += xlnx_dpdma.o obj-$(CONFIG_OMAP) += omap_dma.o soc_dma.o obj-$(CONFIG_PXA2XX) += pxa2xx_dma.o
hw/dma/xlnx_dpdma.c new file +794 -0
794 lines not on this page · raw message
include/hw/dma/xlnx_dpdma.h new file +85 -0
85 lines not on this page · raw message
Signature · 1 line
1.9.1
[Qemu-devel] [PULL 25/30] introduce dpcd module
In reply to Peter MaydellFrom: KONRAD Frederic <[email protected]>
This introduces dpcd module.
It wires on a aux-bus and can be accessed by the driver to get lane-speed, etc.
Message-id: [email protected]
--- default-configs/aarch64-softmmu.mak | 1 + hw/display/Makefile.objs | 1 + hw/display/dpcd.c | 173 ++++++++++++++++++++++++++++++++++++ include/hw/display/dpcd.h | 105 ++++++++++++++++++++++ 4 files changed, 280 insertions(+) create mode 100644 hw/display/dpcd.c create mode 100644 include/hw/display/dpcd.h
default-configs/aarch64-softmmu.mak +1 -0
@@ -4,4 +4,5 @@ include arm-softmmu.mak CONFIG_AUX=y +CONFIG_DPCD=y CONFIG_XLNX_ZYNQMP=y
hw/display/Makefile.objs +1 -0
@@ -43,3 +43,4 @@ virtio-gpu.o-cflags := $(VIRGL_CFLAGS) virtio-gpu.o-libs += $(VIRGL_LIBS) virtio-gpu-3d.o-cflags := $(VIRGL_CFLAGS) virtio-gpu-3d.o-libs += $(VIRGL_LIBS) +obj-$(CONFIG_DPCD) += dpcd.o
hw/display/dpcd.c new file +173 -0
173 lines not on this page · raw message
include/hw/display/dpcd.h new file +105 -0
105 lines not on this page · raw message
Signature · 1 line
1.9.1
[Qemu-devel] [PULL 28/30] introduce xlnx-dp
In reply to Peter MaydellFrom: KONRAD Frederic <[email protected]>
This is the implementation of the DisplayPort.
It has an aux-bus to access dpcd and edid.
Graphic plane is connected to the channel 3. Video plane is connected to the channel 0. Audio stream are connected to the channels 4 and 5.
Message-id: [email protected]
--- hw/display/Makefile.objs | 1 + hw/display/xlnx_dp.c | 1336 ++++++++++++++++++++++++++++++++++++++++++ include/hw/display/xlnx_dp.h | 109 ++++ 3 files changed, 1446 insertions(+) create mode 100644 hw/display/xlnx_dp.c create mode 100644 include/hw/display/xlnx_dp.h
hw/display/Makefile.objs +1 -0
@@ -44,3 +44,4 @@ virtio-gpu.o-libs += $(VIRGL_LIBS) virtio-gpu-3d.o-cflags := $(VIRGL_CFLAGS) virtio-gpu-3d.o-libs += $(VIRGL_LIBS) obj-$(CONFIG_DPCD) += dpcd.o +obj-$(CONFIG_XLNX_ZYNQMP) += xlnx_dp.o
hw/display/xlnx_dp.c new file +1336 -0
1,336 lines not on this page · raw message
include/hw/display/xlnx_dp.h new file +109 -0
109 lines not on this page · raw message
Signature · 1 line
1.9.1
Re: [Qemu-devel] [PULL 28/30] introduce xlnx-dp
Quoted 9 lines · Peter Maydell
From: KONRAD Frederic <[email protected]>
This is the implementation of the DisplayPort. It has an aux-bus to access dpcd and edid.
Graphic plane is connected to the channel 3. Video plane is connected to the channel 0. Audio stream are connected to the channels 4 and 5.
Very old patch, but Coverity has just pointed out an array overrun in it (CID 1487260):
We define a set of offsets for V_BLEND registers, of which the largest is this one:
Quoted 8 lines
hw/display/xlnx_dp.c new file +7
-0+#define V_BLEND_CHROMA_KEY_COMP3 (0x01DC >> 2) +static void xlnx_dp_vblend_write (void *opaque,hwaddr offset, +uint64_t value,unsigned size) +{ +XlnxDPState *s =XLNX_DP (opaque); +bool alpha_was_enabled; +
hw/display/xlnx_dp.c
Quoted 10 lines
hw/display/xlnx_dp.c new file +9
-0+DPRINTF ("vblend: write @0x%" HWADDR_PRIX " = 0x%" PRIX32 "\n" , offset, + (uint32_t )value); + offset = offset >>2 ; + +switch (offset) { +case V_BLEND_CHROMA_KEY_COMP1 : +case V_BLEND_CHROMA_KEY_COMP2 : +case V_BLEND_CHROMA_KEY_COMP3 : + s->vblend_registers[offset] = value &0x0FFF0FFF ;
We use V_BLEND_CHROMA_KEY_COMP3 as an index into the vblend_registers array...
Review
Quoted 13 lines
(quoted diff) +11
-0+ break; + default: + s->vblend_registers[offset] = value; + break; + } +} +#define DP_CORE_REG_ARRAY_SIZE (0x3AF >> 2) +#define DP_AVBUF_REG_ARRAY_SIZE (0x238 >> 2) +#define DP_VBLEND_REG_ARRAY_SIZE (0x1DF >> 2) +#define DP_AUDIO_REG_ARRAY_SIZE (0x50 >> 2) + uint32_t vblend_registers[DP_VBLEND_REG_ARRAY_SIZE];
...but we have defined DP_VBLEND_REG_ARRAY_SIZE to 0x1DF >> 2, which is the same as 0x1DC >> 2, and so the array size is too small.
The size of the memory region is also suspicious:
+ memory_region_init_io(&s->vblend_iomem, obj, &vblend_ops, s, TYPE_XLNX_DP
+ ".v_blend", 0x1DF);
This is a "32-bit accesses only" region, but we have defined it with a size that is not a multiple of 4. That looks wrong... (It also means that rather than having an array overrun I think the actual effect is that the guest won't be able to access the last register, because it's not entirely within the memoryregion.)
Coverity doesn't complain about it, but the DP_CORE_REG_ARRAY_SIZE may also have a similar problem.
thanks
-- PMM
Re: [Qemu-devel] [PULL 28/30] introduce xlnx-dp
Le 4/7/22 à 12:32, Peter Maydell a écrit :
Quoted 60 lines · Peter Maydell
Quoted 9 lines
From: KONRAD Frederic <[email protected]>
This is the implementation of the DisplayPort. It has an aux-bus to access dpcd and edid.
Graphic plane is connected to the channel 3. Video plane is connected to the channel 0. Audio stream are connected to the channels 4 and 5.
Very old patch, but Coverity has just pointed out an array overrun in it (CID 1487260):
We define a set of offsets for
V_BLENDregisters, of which the largest is this one:Quoted 8 lines
hw/display/xlnx_dp.c new file +7
-0+#define V_BLEND_CHROMA_KEY_COMP3 (0x01DC >> 2) +static void xlnx_dp_vblend_write (void *opaque,hwaddr offset, +uint64_t value,unsigned size) +{ +XlnxDPState *s =XLNX_DP (opaque); +bool alpha_was_enabled; +hw/display/xlnx_dp.c
Quoted 10 lines
hw/display/xlnx_dp.c new file +9
-0+DPRINTF ("vblend: write @0x%" HWADDR_PRIX " = 0x%" PRIX32 "\n" , offset, + (uint32_t )value); + offset = offset >>2 ; + +switch (offset) { +case V_BLEND_CHROMA_KEY_COMP1 : +case V_BLEND_CHROMA_KEY_COMP2 : +case V_BLEND_CHROMA_KEY_COMP3 : + s->vblend_registers[offset] = value &0x0FFF0FFF ;We use
V_BLEND_CHROMA_KEY_COMP3as an index into thevblend_registersarray...Review
Quoted 13 lines
(quoted diff) +11
-0+ break; + default: + s->vblend_registers[offset] = value; + break; + } +} +#define DP_CORE_REG_ARRAY_SIZE (0x3AF >> 2) +#define DP_AVBUF_REG_ARRAY_SIZE (0x238 >> 2) +#define DP_VBLEND_REG_ARRAY_SIZE (0x1DF >> 2) +#define DP_AUDIO_REG_ARRAY_SIZE (0x50 >> 2) + uint32_t vblend_registers[DP_VBLEND_REG_ARRAY_SIZE];..but we have defined
DP_VBLEND_REG_ARRAY_SIZEto0x1DF>> 2, which is the same as0x1DC>> 2, and so the array size is too small.The size of the memory region is also suspicious:
hw/display/xlnx_dp.c new file +2
-0+memory_region_init_io (&s->vblend_iomem, obj, &vblend_ops, s,TYPE_XLNX_DP +".v_blend" ,0x1DF );
Quoted 5 lines
This is a "32-bit accesses only" region, but we have defined it with a size that is not a multiple of 4. That looks wrong... (It also means that rather than having an array overrun I think the actual effect is that the guest won't be able to access the last register, because it's not entirely within the memoryregion.)
arg, sorry for that..
I share your point, it should not be possible to access it, but using the monitor:
(qemu) info mtree
...
00000000fd4aa000-00000000fd4aa1de (prio 0, i/o): xlnx.v-dp.v_blend
...
I can actually read that register (at least it doesn't complain, on an older qemu version though):
(qemu) xp /w 0xfd4aa1dc00000000fd4aa1dc: 0x00000000
So I'm not totally sure.. do you need a patch for 7.0.0?
Quoted 3 lines
Coverity doesn't complain about it, but the
DP_CORE_REG_ARRAY_SIZEmay also have a similar problem.
I think it doesn't complain because writing to the last register doesn't actually write into the array but update the mask register instead:
case DP_INT_DS:
s->core_registers[DP_INT_MASK] |= ~value;
xlnx_dp_update_irq(s);
break;Quoted 3 lines
thanks
-- PMM
Best Regards,
Fred
Re: [Qemu-devel] [PULL 28/30] introduce xlnx-dp
Quoted 1 line · Frederic Konrad
So I'm not totally sure.. do you need a patch for 7.0.0?
It's not a regression, so we can fix this for 7.1.
thanks
-- PMM