target-arm queue
Mostly just bugfixes that accumulated over the course of the week; the only new feature in here is the 'pmu' property patches for the virt board.
thanks
-- PMM
The following changes since commit fd209e4a773dd5a7fea79eaaffd276ebcb99e92a:
Merge remote-tracking branch 'remotes/jnsnow/tags/ide-pull-request' into staging (2016-10-28 14:29:50 +0100)
are available in the git repository at:
git://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20161028
for you to fetch changes up to d26a10e232eb18bf9e32dc2366231715bfd1d5b4:
hw/arm/tosa: Fix reset handling (2016-10-28 15:51:27 +0100)
----------------------------------------------------------------
target-arm queue:
* Fix reset GPIO handling for spitz, tosa boards
* virt: add 'pmu' property for configuring whether to expose the vPMU to the guest
* char: cadence: correct reset value for baud rate registers
* versatilepb: do not run if user asks for more than 256MB RAM
* pxa2xx: Set value default values for CCCR and CKEN on PXA255
* arm: cubieboard: Add support for initrd
* i.MX: Fix GPIO ISR register write
----------------------------------------------------------------
Guenter Roeck (5):
i.MX: Fix GPIO ISR register write
arm: cubieboard: Add support for initrd
hw/arm/pxa2xx: Set value default values for CCCR and CKEN on PXA255 hw/arm/spitz: Fix reset handling
hw/arm/tosa: Fix reset handling
Jean-Christophe Dubois (1):
versatilepb: do not run if user asks for more than 256MB RAM
Prasad J Pandit (1):
char: cadence: correct reset value for baud rate registers
Wei Huang (2):
arm: Add an option to turn on/off vPMU support
arm: virt: add PMU property to mach-virt machine type
hw/arm/cubieboard.c | 1 + hw/arm/pxa2xx.c | 4 +++- hw/arm/spitz.c | 13 ++++++++++++- hw/arm/tosa.c | 12 +++++++++++- hw/arm/versatilepb.c | 9 +++++++++ hw/arm/virt-acpi-build.c | 2 +- hw/arm/virt.c | 9 ++++++++- hw/char/cadence_uart.c | 3 ++- hw/gpio/imx_gpio.c | 2 +- target-arm/cpu.c | 15 +++++++++++++++ target-arm/cpu.h | 1 + target-arm/cpu64.c | 2 ++ target-arm/kvm64.c | 17 ++++++++++++++--- 13 files changed, 80 insertions(+), 10 deletions(-)
[Qemu-devel] [PULL 7/9] arm: virt: add PMU property to mach-virt machine type
From: Wei Huang <[email protected]>
CPU vPMU is now turned ON by default, but this feature wasn't introduced until virt-2.7 machine type. To solve this problem, this patch adds a PMU option in machine state, which is used to control CPU's vPMU status. This PMU option is not exposed to command line and is turned off in virt-2.6 machine type.
Message-id: [email protected]
--- hw/arm/virt.c | 7 +++++++ 1 file changed, 7 insertions(+)
hw/arm/virt.c +7 -0
@@ -85,6 +85,7 @@ typedef struct {VirtBoardInfo *daughterboard;bool disallow_affinity_adjustment;bool no_its; +bool no_pmu; } VirtMachineClass; typedef struct {
@@ -1353,6 +1354,10 @@ static void machvirt_init(MachineState *machine) } } +if (vmc->no_pmu &&object_property_find (cpuobj,"pmu" ,NULL )) { +object_property_set_bool (cpuobj, false,"pmu" ,NULL ); + } +if (object_property_find (cpuobj,"reset-cbar" ,NULL )) {object_property_set_int (cpuobj, vbi->memmap[VIRT_CPUPERIPHS ].base,"reset-cbar" , &error_abort);
@@ -1592,5 +1597,7 @@ static void virt_machine_2_6_options(MachineClass *mc)virt_machine_2_7_options (mc);SET_MACHINE_COMPAT (mc,VIRT_COMPAT_2_6 ); vmc->disallow_affinity_adjustment = true; +/* Disable PMU for 2.6 as PMU support was first introduced in 2.7 */ + vmc->no_pmu = true; }DEFINE_VIRT_MACHINE (2 ,6 )
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 8/9] hw/arm/spitz: Fix reset handling
In reply to Peter MaydellFrom: Guenter Roeck <[email protected]>
Using the CPU reset handler for resets triggered by writing into gpio pins other than GPIO01 is not appropriate and does not work, since the reset triggered by writing into GPIO01 is configurable. Use a separate reset handler for spitz to reset the entire system and not just the CPU.
Message-id: [email protected]
--- hw/arm/spitz.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
hw/arm/spitz.c +12 -1
@@ -29,6 +29,7 @@#include "sysemu/block-backend.h" #include "hw/sysbus.h" #include "exec/address-spaces.h" +#include "sysemu/sysemu.h" #undef REG_FMT#define REG_FMT "0x%02lx"
@@ -844,9 +845,18 @@ static void spitz_lcd_hsync_handler(void *opaque, int line, int level) spitz_hsync ^=1 ; } +static void spitz_reset (void *opaque,int line,int level) +{ +if (level) { +qemu_system_reset_request (); + } +} +static void spitz_gpio_setup (PXA2xxState *cpu,int slots) {qemu_irq lcd_hsync; +qemu_irq reset; +/* * Bad hack: We toggle the LCD hsync GPIO on every GPIO status * read to satisfy broken guests that poll-wait for hsync.
@@ -867,7 +877,8 @@ static void spitz_gpio_setup(PXA2xxState *cpu, int slots)qemu_irq_raise (qdev_get_gpio_in (cpu->gpio,SPITZ_GPIO_BAT_COVER ));/* Handle reset */ -qdev_connect_gpio_out (cpu->gpio,SPITZ_GPIO_ON_RESET , cpu->reset); + reset =qemu_allocate_irq (spitz_reset, cpu,0 ); +qdev_connect_gpio_out (cpu->gpio,SPITZ_GPIO_ON_RESET , reset);/* PCMCIA signals: card's IRQ and Card-Detect */ if (slots >=1 )
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 9/9] hw/arm/tosa: Fix reset handling
In reply to Peter MaydellFrom: Guenter Roeck <[email protected]>
Using the CPU reset handler for resets triggered by writing into gpio pins other than GPIO01 is not appropriate and does not work, since the reset triggered by writing into GPIO01 is configurable. Use a separate reset handler for tosa to reset the entire system and not just the CPU.
Message-id: [email protected]
--- hw/arm/tosa.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
hw/arm/tosa.c +11 -1
@@ -25,6 +25,7 @@#include "sysemu/block-backend.h" #include "hw/sysbus.h" #include "exec/address-spaces.h" +#include "sysemu/sysemu.h" #define TOSA_RAM 0x04000000#define TOSA_ROM 0x00800000
@@ -86,6 +87,12 @@ static void tosa_out_switch(void *opaque, int line, int level) } } +static void tosa_reset (void *opaque,int line,int level) +{ +if (level) { +qemu_system_reset_request (); + } +} static void tosa_gpio_setup(PXA2xxState *cpu, DeviceState *scp0,
@@ -93,13 +100,16 @@ static void tosa_gpio_setup(PXA2xxState *cpu, TC6393xbState *tmio) {qemu_irq *outsignals =qemu_allocate_irqs (tosa_out_switch, cpu,4 ); +qemu_irq reset; +/* MMC/SD host */ pxa2xx_mmci_handlers (cpu->mmc,qdev_get_gpio_in (scp0,TOSA_GPIO_SD_WP ),qemu_irq_invert (qdev_get_gpio_in (cpu->gpio, TOSA_GPIO_nSD_DETECT)));/* Handle reset */ -qdev_connect_gpio_out (cpu->gpio,TOSA_GPIO_ON_RESET , cpu->reset); + reset =qemu_allocate_irq (tosa_reset, cpu,0 ); +qdev_connect_gpio_out (cpu->gpio,TOSA_GPIO_ON_RESET , reset);/* PCMCIA signals: card's IRQ and Card-Detect */ pxa2xx_pcmcia_set_irq_cb(cpu->pcmcia[0],
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 5/9] char: cadence: correct reset value for baud rate registers
In reply to Peter MaydellFrom: Prasad J Pandit <[email protected]>
The Cadence UART device emulator stores 'baud rate generator' and 'baud rate divider' values, used in computing speed, in two registers. The device specification defines their range and their reset value. Use their correct value when resetting the device in cadence_uart_reset.
Message-id: [email protected]
--- hw/char/cadence_uart.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
hw/char/cadence_uart.c +2 -1
@@ -450,7 +450,8 @@ static void cadence_uart_reset(DeviceState *dev) s->r[R_IMR ] =0 ; s->r[R_CISR ] =0 ; s->r[R_RTRIG ] =0x00000020 ; - s->r[R_BRGR ] =0x0000000F ; + s->r[R_BRGR ] =0x0000028B ; + s->r[R_BDIV ] =0x0000000F ; s->r[R_TTRIG ] =0x00000020 ;uart_rx_reset (s);
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 3/9] hw/arm/pxa2xx: Set value default values for CCCR and CKEN on PXA255
In reply to Peter MaydellFrom: Guenter Roeck <[email protected]>
The code used default values for PXA270 to configure CCCR. For PXA255, the resulting register value is invalid (unsupported) and resulted in a division by zero in the Linux kernel. Use default values from datasheet instead.
Message-id: [email protected]
--- hw/arm/pxa2xx.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
hw/arm/pxa2xx.c +3 -1
@@ -2267,7 +2267,9 @@ PXA2xxState *pxa255_init(MemoryRegion *address_space, unsigned int sdram_size) qdev_get_gpio_in(s->pic, PXA2XX_PIC_LCD)); s->cm_base =0x41300000 ; - s->cm_regs[CCCR >>2 ] =0x02000210 ;/* 416.0 MHz */ + s->cm_regs[CCCR >>2 ] =0x00000121 ;/* from datasheet */ + s->cm_regs[CKEN >>2 ] =0x00017def ;/* from datasheet */ + s->clkcfg =0x00000009 ;/* Turbo mode active */ memory_region_init_io (&s->cm_iomem,NULL , &pxa2xx_cm_ops, s,"pxa2xx-cm" ,0x1000 );memory_region_add_subregion (address_space, s->cm_base, &s->cm_iomem);
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 2/9] arm: cubieboard: Add support for initrd
In reply to Peter MaydellFrom: Guenter Roeck <[email protected]>
Message-id: [email protected]
--- hw/arm/cubieboard.c | 1 + 1 file changed, 1 insertion(+)
hw/arm/cubieboard.c +1 -0
@@ -74,6 +74,7 @@ static void cubieboard_init(MachineState *machine) cubieboard_binfo.ram_size = machine->ram_size; cubieboard_binfo.kernel_filename = machine->kernel_filename; cubieboard_binfo.kernel_cmdline = machine->kernel_cmdline; + cubieboard_binfo.initrd_filename = machine->initrd_filename;arm_load_kernel (&s->a10->cpu, &cubieboard_binfo); }
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 4/9] versatilepb: do not run if user asks for more than 256MB RAM
In reply to Peter MaydellFrom: Jean-Christophe Dubois <[email protected]>
The versatilepb physical address space layout only has a 256MB region for RAM before the devices. Without a guard on the amount of RAM requested by the user we would happily create a RAM area that overlapped with the devices, resulting in very confusing behaviour (typically a guest crash).
Report the problem to the user if they try to request more RAM than the board can handle (as we do already for some other board models).
Message-id: [email protected] [PMM: tidied up commit message, comments. Use error_report()
rather than fprintf(stderr, ...).]
--- hw/arm/versatilepb.c | 9 +++++++++ 1 file changed, 9 insertions(+)
hw/arm/versatilepb.c +9 -0
@@ -198,6 +198,15 @@ static void versatile_init(MachineState *machine, int board_id)int done_smc =0 ;DriveInfo *dinfo; +if (machine->ram_size >0x10000000 ) { +/* Device starting at address 0x10000000, +* and memory cannot overlap with devices. +* Refuse to run rather than behaving very confusingly. +*/ +error_report ("versatilepb: memory size must not exceed 256MB" ); +exit (1 ); + } +if (!machine->cpu_model) { machine->cpu_model ="arm926" ; }
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 6/9] arm: Add an option to turn on/off vPMU support
In reply to Peter MaydellFrom: Wei Huang <[email protected]>
This patch adds a pmu=[on/off] option to enable/disable vPMU support in guest vCPU. It allows virt tools, such as libvirt, to determine the exsitence of vPMU and configure it. Note this option is only available for cortex-a57/cortex-53/ host CPUs, but unavailable on ARMv7 and other processors. Also even though "pmu=" option is available for TCG mode, setting it doesn't turn PMU on.
Message-id: [email protected]
--- hw/arm/virt-acpi-build.c | 2 +- hw/arm/virt.c | 2 +- target-arm/cpu.c | 15 +++++++++++++++ target-arm/cpu.h | 1 + target-arm/cpu64.c | 2 ++ target-arm/kvm64.c | 17 ++++++++++++++--- 6 files changed, 34 insertions(+), 5 deletions(-)
hw/arm/virt-acpi-build.c +1 -1
@@ -594,7 +594,7 @@ build_madt(GArray *table_data, BIOSLinker *linker, VirtGuestInfo *guest_info) gicc->uid = i; gicc->flags =cpu_to_le32 (ACPI_GICC_ENABLED ); -if (armcpu->has_pmu) { +if (arm_feature (&armcpu->env,ARM_FEATURE_PMU )) { gicc->performance_interrupt =cpu_to_le32 (PPI (VIRTUAL_PMU_IRQ )); } }
hw/arm/virt.c +1 -1
@@ -490,7 +490,7 @@ static void fdt_add_pmu_nodes(const VirtBoardInfo *vbi, int gictype)CPU_FOREACH (cpu) { armcpu =ARM_CPU (cpu); -if (!armcpu->has_pmu || +if (!arm_feature (&armcpu->env,ARM_FEATURE_PMU ) || !kvm_arm_pmu_create (cpu,PPI (VIRTUAL_PMU_IRQ ))) {return ; }
target-arm/cpu.c +15 -0
@@ -19,6 +19,7 @@*/ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qapi/error.h" #include "cpu.h" #include "internals.h"
@@ -496,6 +497,10 @@ static Property arm_cpu_rvbar_property =static Property arm_cpu_has_el3_property =DEFINE_PROP_BOOL ("has_el3" ,ARMCPU , has_el3, true); +/* use property name "pmu" to match other archs and virt tools */ +static Property arm_cpu_has_pmu_property = +DEFINE_PROP_BOOL ("pmu" ,ARMCPU , has_pmu, true); +static Property arm_cpu_has_mpu_property =DEFINE_PROP_BOOL ("has-mpu" ,ARMCPU , has_mpu, true);
@@ -539,6 +544,11 @@ static void arm_cpu_post_init(Object *obj)#endif } +if (arm_feature (&cpu->env,ARM_FEATURE_PMU )) { +qdev_property_add_static (DEVICE (obj), &arm_cpu_has_pmu_property, + &error_abort); + } +if (arm_feature (&cpu->env,ARM_FEATURE_MPU )) {qdev_property_add_static (DEVICE (obj), &arm_cpu_has_mpu_property, &error_abort);
@@ -677,6 +687,11 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp) cpu->id_aa64pfr0 &= ~0xf000 ; } +if (!cpu->has_pmu || !kvm_enabled ()) { + cpu->has_pmu = false; +unset_feature (env,ARM_FEATURE_PMU ); + } +if (!arm_feature (env,ARM_FEATURE_EL2 )) {/* Disable the hypervisor feature bits in the processor feature * registers if we don't have EL2. These are id_pfr1[15:12] and
target-arm/cpu.h +1 -0
@@ -1124,6 +1124,7 @@ enum arm_features {ARM_FEATURE_V8_SHA256 ,/* implements SHA256 part of v8 Crypto Extensions */ ARM_FEATURE_V8_PMULL ,/* implements PMULL part of v8 Crypto Extensions */ ARM_FEATURE_THUMB_DSP ,/* DSP insns supported in the Thumb encodings */ + ARM_FEATURE_PMU, /* has PMU support */ };static inline int arm_feature (CPUARMState *env,int feature)
target-arm/cpu64.c +2 -0
@@ -111,6 +111,7 @@ static void aarch64_a57_initfn(Object *obj)set_feature (&cpu->env,ARM_FEATURE_V8_PMULL );set_feature (&cpu->env,ARM_FEATURE_CRC );set_feature (&cpu->env,ARM_FEATURE_EL3 ); +set_feature (&cpu->env,ARM_FEATURE_PMU ); cpu->kvm_target =QEMU_KVM_ARM_TARGET_CORTEX_A57 ; cpu->midr =0x411fd070 ; cpu->revidr =0x00000000 ;
@@ -166,6 +167,7 @@ static void aarch64_a53_initfn(Object *obj)set_feature (&cpu->env,ARM_FEATURE_V8_PMULL );set_feature (&cpu->env,ARM_FEATURE_CRC );set_feature (&cpu->env,ARM_FEATURE_EL3 ); +set_feature (&cpu->env,ARM_FEATURE_PMU ); cpu->kvm_target =QEMU_KVM_ARM_TARGET_CORTEX_A53 ; cpu->midr =0x410fd034 ; cpu->revidr =0x00000000 ;
target-arm/kvm64.c +14 -3
@@ -428,6 +428,11 @@ static inline void set_feature(uint64_t *features, int feature) *features |=1ULL << feature; } +static inline void unset_feature (uint64_t *features,int feature) +{ + *features &= ~(1ULL << feature); +} +bool kvm_arm_get_host_cpu_features (ARMHostCPUClass *ahcc) {/* Identify the feature bits corresponding to the host CPU, and
@@ -469,6 +474,7 @@ bool kvm_arm_get_host_cpu_features(ARMHostCPUClass *ahcc)set_feature (&features,ARM_FEATURE_VFP4 );set_feature (&features,ARM_FEATURE_NEON );set_feature (&features,ARM_FEATURE_AARCH64 ); +set_feature (&features,ARM_FEATURE_PMU ); ahcc->features = features;
@@ -482,6 +488,7 @@ int kvm_arch_init_vcpu(CPUState *cs)int ret;uint64_t mpidr;ARMCPU *cpu =ARM_CPU (cs); +CPUARMState *env = &cpu->env;if (cpu->kvm_target ==QEMU_KVM_ARM_TARGET_NONE || !object_dynamic_cast (OBJECT (cpu),TYPE_AARCH64_CPU )) {
@@ -501,10 +508,14 @@ 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; +if (!kvm_irqchip_in_kernel () || + !kvm_check_extension (cs->kvm_state,KVM_CAP_ARM_PMU_V3 )) { + cpu->has_pmu = false; + } +if (cpu->has_pmu) { cpu->kvm_init_features[0 ] |=1 <<KVM_ARM_VCPU_PMU_V3 ; + }else { +unset_feature (&env->features,ARM_FEATURE_PMU ); }/* Do KVM_ARM_VCPU_INIT ioctl */
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 1/9] i.MX: Fix GPIO ISR register write
In reply to Peter MaydellFrom: Guenter Roeck <[email protected]>
Writing the ISR register is supposed to clear interrupt status bits, not to set them.
This patch makes '-M sabrelite' work without devicetree changes (Linux kernel versions 3.18 to 4.7 with imx_v6_v7_defconfig and up to v4.8 with multi_v7_defconfig; mainline has different problems).
Message-id: [email protected]
--- hw/gpio/imx_gpio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/gpio/imx_gpio.c +1 -1
@@ -237,7 +237,7 @@ static void imx_gpio_write(void *opaque, hwaddr offset, uint64_t value,break ;case ISR_ADDR : - s->isr |= ~value; + s->isr &= ~value;imx_gpio_set_all_int_lines (s);break ;
Signature · 1 line
2.7.4
Peter Maydell
AppliedQuoted 20 lines · Peter Maydell
Mostly just bugfixes that accumulated over the course of the week; the only new feature in here is the 'pmu' property patches for the virt board.
thanks
-- PMMThe following changes since commit
fd209e4a773dd5a7fea79eaaffd276ebcb99e92a:Merge remote-tracking branch 'remotes/jnsnow/tags/ide-pull-request' into staging (2016-10-28 14:29:50 +0100)
are available in the git repository at:
git://git.linaro.org/people/pmaydell/qemu-arm.gittags/pull-target-arm-20161028for you to fetch changes up to
d26a10e232eb18bf9e32dc2366231715bfd1d5b4:hw/arm/tosa: Fix reset handling (2016-10-28 15:51:27 +0100)
Quoted 10 lines
----------------------------------------------------------------
target-arm queue:
* Fix reset GPIO handling for spitz, tosa boards
* virt: add 'pmu' property for configuring whether to expose the vPMU to the guest
* char: cadence: correct reset value for baud rate registers
* versatilepb: do not run if user asks for more than 256MB RAM
* pxa2xx: Set value default values for CCCR and CKEN on PXA255
* arm: cubieboard: Add support for initrd
* i.MX: Fix GPIO ISR register write
Applied, thanks.
-- PMM