target-arm queue
Subsystems (2)
A surprisingly short target-arm queue, but no point in holding onto these waiting for more code to arrive :-)
thanks
-- PMM
The following changes since commit 3d0bf8dfdfebd7f2ae41b6f220444b8047d6b1ee:
Merge remote-tracking branch 'remotes/dgilbert/tags/pull-migration-20170710a' into staging (2017-07-10 18:13:03 +0100)
are available in the git repository at:
git://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20170711
for you to fetch changes up to 792dac309c8660306557ba058b8b5a6a75ab3c1f:
target-arm: v7M: ignore writes to CONTROL.SPSEL from Thread mode (2017-07-11 11:21:26 +0100)
----------------------------------------------------------------
target-arm queue:
* v7M: ignore writes to CONTROL.SPSEL from Thread mode
* KVM: Enable in-kernel timers with user space gic
* aspeed: Register all watchdogs
* hw/misc: Add Exynos4210 Pseudo Random Number Generator
----------------------------------------------------------------
Alexander Graf (1):
ARM: KVM: Enable in-kernel timers with user space gic
Joel Stanley (1):
aspeed: Register all watchdogs
Krzysztof Kozlowski (1):
hw/misc: Add Exynos4210 Pseudo Random Number Generator
Peter Maydell (1):
target-arm: v7M: ignore writes to CONTROL.SPSEL from Thread mode
hw/misc/Makefile.objs | 2 +- include/hw/arm/aspeed_soc.h | 4 +- include/sysemu/kvm.h | 11 ++ target/arm/cpu.h | 3 + accel/kvm/kvm-all.c | 5 + accel/stubs/kvm-stub.c | 5 + hw/arm/aspeed_soc.c | 25 ++-- hw/arm/exynos4210.c | 4 + hw/intc/arm_gic.c | 7 ++ hw/misc/exynos4210_rng.c | 277 ++++++++++++++++++++++++++++++++++++++++++++ target/arm/helper.c | 13 ++- target/arm/kvm.c | 51 ++++++++ 12 files changed, 394 insertions(+), 13 deletions(-) create mode 100644 hw/misc/exynos4210_rng.c
[Qemu-devel] [PULL 4/4] target-arm: v7M: ignore writes to CONTROL.SPSEL from Thread mode
For v7M, writes to the CONTROL register are only permitted for privileged code. However even if the code is privileged, the write must not affect the SPSEL bit in the CONTROL register if the CPU is in Thread mode (as documented in the pseudocode for the MSR instruction). Implement this, instead of permitting SPSEL to be written in all cases.
This was causing mbed applications not to run, because the RTX RTOS they use relies on this behaviour.
Message-id: [email protected]
--- target/arm/helper.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
target/arm/helper.c +10 -3
@@ -8768,9 +8768,16 @@ void HELPER(v7m_msr)(CPUARMState *env, uint32_t maskreg, uint32_t val) }break ;case 20 :/* CONTROL */ -switch_v7m_sp (env, (val &R_V7M_CONTROL_SPSEL_MASK ) !=0 ); - env->v7m.control = val & (R_V7M_CONTROL_SPSEL_MASK | -R_V7M_CONTROL_NPRIV_MASK ); +/* Writing to the SPSEL bit only has an effect if we are in +* thread mode; other bits can be updated by any privileged code. +* switch_v7m_sp() deals with updating the SPSEL bit in +* env->v7m.control, so we only need update the others. +*/ +if (env->v7m.exception ==0 ) { +switch_v7m_sp (env, (val &R_V7M_CONTROL_SPSEL_MASK ) !=0 ); + } + env->v7m.control &= ~R_V7M_CONTROL_NPRIV_MASK ; + env->v7m.control |= val &R_V7M_CONTROL_NPRIV_MASK ;break ;default : qemu_log_mask(LOG_GUEST_ERROR, "Attempt to write unknown special"
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 2/4] aspeed: Register all watchdogs
In reply to Peter MaydellFrom: Joel Stanley <[email protected]>
The ast2400 contains two and the ast2500 contains three watchdogs. Add this information to the AspeedSoCInfo and realise the correct number of watchdogs for that each SoC type.
--- include/hw/arm/aspeed_soc.h | 4 +++- hw/arm/aspeed_soc.c | 25 +++++++++++++++++-------- 2 files changed, 20 insertions(+), 9 deletions(-)
include/hw/arm/aspeed_soc.h +3 -1
@@ -23,6 +23,7 @@#include "hw/net/ftgmac100.h" #define ASPEED_SPIS_NUM 2 +#define ASPEED_WDTS_NUM 3 typedef struct AspeedSoCState { /*< private >*/
@@ -39,7 +40,7 @@ typedef struct AspeedSoCState {AspeedSMCState fmc;AspeedSMCState spi[ASPEED_SPIS_NUM ];AspeedSDMCState sdmc; -AspeedWDTState wdt; +AspeedWDTState wdt[ASPEED_WDTS_NUM ];FTGMAC100State ftgmac100; } AspeedSoCState;
@@ -56,6 +57,7 @@ typedef struct AspeedSoCInfo {const hwaddr *spi_bases;const char *fmc_typename;const char **spi_typename; +int wdts_num; } AspeedSoCInfo; typedef struct AspeedSoCClass {
hw/arm/aspeed_soc.c +17 -8
@@ -62,6 +62,7 @@ static const AspeedSoCInfo aspeed_socs[] = { .spi_bases = aspeed_soc_ast2400_spi_bases, .fmc_typename = "aspeed.smc.fmc", .spi_typename = aspeed_soc_ast2400_typenames, + .wdts_num = 2, }, { .name = "ast2400-a1", .cpu_model = "arm926",
@@ -72,6 +73,7 @@ static const AspeedSoCInfo aspeed_socs[] = { .spi_bases = aspeed_soc_ast2400_spi_bases, .fmc_typename = "aspeed.smc.fmc", .spi_typename = aspeed_soc_ast2400_typenames, + .wdts_num = 2, }, { .name = "ast2400", .cpu_model = "arm926",
@@ -82,6 +84,7 @@ static const AspeedSoCInfo aspeed_socs[] = { .spi_bases = aspeed_soc_ast2400_spi_bases, .fmc_typename = "aspeed.smc.fmc", .spi_typename = aspeed_soc_ast2400_typenames, + .wdts_num = 2, }, { .name = "ast2500-a1", .cpu_model = "arm1176",
@@ -92,6 +95,7 @@ static const AspeedSoCInfo aspeed_socs[] = { .spi_bases = aspeed_soc_ast2500_spi_bases, .fmc_typename = "aspeed.smc.ast2500-fmc", .spi_typename = aspeed_soc_ast2500_typenames, + .wdts_num = 3, }, };
@@ -175,9 +179,11 @@ static void aspeed_soc_init(Object *obj)object_property_add_alias (obj,"ram-size" ,OBJECT (&s->sdmc),"ram-size" , &error_abort); -object_initialize (&s->wdt,sizeof (s->wdt),TYPE_ASPEED_WDT ); -object_property_add_child (obj,"wdt" ,OBJECT (&s->wdt),NULL ); -qdev_set_parent_bus (DEVICE (&s->wdt),sysbus_get_default ()); +for (i =0 ; i < sc->info->wdts_num; i++) { +object_initialize (&s->wdt[i],sizeof (s->wdt[i]),TYPE_ASPEED_WDT ); +object_property_add_child (obj,"wdt[*]" ,OBJECT (&s->wdt[i]),NULL ); +qdev_set_parent_bus (DEVICE (&s->wdt[i]),sysbus_get_default ()); + }object_initialize (&s->ftgmac100,sizeof (s->ftgmac100),TYPE_FTGMAC100 );object_property_add_child (obj,"ftgmac100" ,OBJECT (&s->ftgmac100),NULL );
@@ -300,12 +306,15 @@ static void aspeed_soc_realize(DeviceState *dev, Error **errp)sysbus_mmio_map (SYS_BUS_DEVICE (&s->sdmc),0 ,ASPEED_SOC_SDMC_BASE );/* Watch dog */ -object_property_set_bool (OBJECT (&s->wdt), true,"realized" , &err); -if (err) { -error_propagate (errp, err); -return ; +for (i =0 ; i < sc->info->wdts_num; i++) { +object_property_set_bool (OBJECT (&s->wdt[i]), true,"realized" , &err); +if (err) { +error_propagate (errp, err); +return ; + } +sysbus_mmio_map (SYS_BUS_DEVICE (&s->wdt[i]),0 , +ASPEED_SOC_WDT_BASE + i *0x20 ); } -sysbus_mmio_map (SYS_BUS_DEVICE (&s->wdt),0 ,ASPEED_SOC_WDT_BASE );/* Net */ qdev_set_nic_properties (DEVICE (&s->ftgmac100), &nd_table[0 ]);
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 1/4] hw/misc: Add Exynos4210 Pseudo Random Number Generator
In reply to Peter MaydellFrom: Krzysztof Kozlowski <[email protected]>
Add emulation for Exynos4210 Pseudo Random Number Generator which could work on fixed seeds or with seeds provided by True Random Number Generator block inside the SoC.
Implement only the fixed seeds part of it in polling mode (no interrupts).
Emulation tested with two independent Linux kernel exynos-rng drivers:
1. New kcapi-rng interface (targeting Linux v4.12),
2. Old hwrng inteface
# echo "exynos" > /sys/class/misc/hw_random/rng_current # dd if=/dev/hwrng of=/dev/null bs=1 count=16
Message-id: [email protected]
[PMM: wrapped a few overlong lines; more efficient implementation
of exynos4210_rng_seed_ready()]
--- hw/misc/Makefile.objs | 2 +- hw/arm/exynos4210.c | 4 + hw/misc/exynos4210_rng.c | 277 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 282 insertions(+), 1 deletion(-) create mode 100644 hw/misc/exynos4210_rng.c
hw/misc/Makefile.objs +1 -1
@@ -28,7 +28,7 @@ obj-$(CONFIG_IVSHMEM) += ivshmem.o obj-$(CONFIG_REALVIEW) += arm_sysctl.o obj-$(CONFIG_NSERIES) += cbus.o obj-$(CONFIG_ECCMEMCTL) += eccmemctl.o -obj-$(CONFIG_EXYNOS4) += exynos4210_pmu.o exynos4210_clk.o +obj-$(CONFIG_EXYNOS4) += exynos4210_pmu.o exynos4210_clk.o exynos4210_rng.o obj-$(CONFIG_IMX) += imx_ccm.o obj-$(CONFIG_IMX) += imx31_ccm.o obj-$(CONFIG_IMX) += imx25_ccm.o
hw/arm/exynos4210.c +4 -0
@@ -87,6 +87,9 @@/* Clock controller SFR base address */ #define EXYNOS4210_CLK_BASE_ADDR 0x10030000 +/* PRNG/HASH SFR base address */ +#define EXYNOS4210_RNG_BASE_ADDR 0x10830400 +/* Display controllers (FIMD) */ #define EXYNOS4210_FIMD0_BASE_ADDR 0x11C00000
@@ -305,6 +308,7 @@ Exynos4210State *exynos4210_init(MemoryRegion *system_mem)sysbus_create_simple ("exynos4210.pmu" ,EXYNOS4210_PMU_BASE_ADDR ,NULL );sysbus_create_simple ("exynos4210.clk" ,EXYNOS4210_CLK_BASE_ADDR ,NULL ); +sysbus_create_simple ("exynos4210.rng" ,EXYNOS4210_RNG_BASE_ADDR ,NULL );/* PWM */ sysbus_create_varargs("exynos4210.pwm", EXYNOS4210_PWM_BASE_ADDR,
hw/misc/exynos4210_rng.c new file +277 -0
277 lines not on this page · raw message
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 3/4] ARM: KVM: Enable in-kernel timers with user space gic
In reply to Peter MaydellFrom: Alexander Graf <[email protected]>
When running with KVM enabled, you can choose between emulating the gic in kernel or user space. If the kernel supports in-kernel virtualization of the interrupt controller, it will default to that. If not, if will default to user space emulation.
Unfortunately when running in user mode gic emulation, we miss out on interrupt events which are only available from kernel space, such as the timer. This patch leverages the new kernel/user space pending line synchronization for timer events. It does not handle PMU events yet.
Message-id: [email protected]
--- include/sysemu/kvm.h | 11 +++++++++++ target/arm/cpu.h | 3 +++ accel/kvm/kvm-all.c | 5 +++++ accel/stubs/kvm-stub.c | 5 +++++ hw/intc/arm_gic.c | 7 +++++++ target/arm/kvm.c | 51 ++++++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 82 insertions(+)
include/sysemu/kvm.h +11 -0
@@ -220,6 +220,17 @@ int kvm_init_vcpu(CPUState *cpu);int kvm_cpu_exec (CPUState *cpu);int kvm_destroy_vcpu (CPUState *cpu); +/** +* kvm_arm_supports_user_irq +* +* Not all KVM implementations support notifications for kernel generated +* interrupt events to user space. This function indicates whether the current +* KVM implementation does support them. +* +* Returns: true if KVM supports using kernel generated IRQs from user space +*/ +bool kvm_arm_supports_user_irq (void ); +#ifdef NEED_CPU_H #include "cpu.h"
target/arm/cpu.h +3 -0
@@ -706,6 +706,9 @@ struct ARMCPU {void *el_change_hook_opaque;int32_t node_id;/* NUMA node this CPU belongs to */ + +/* Used to synchronize KVM and QEMU in-kernel device levels */ +uint8_t device_irq_level; };static inline ARMCPU *arm_env_get_cpu (CPUARMState *env)
accel/kvm/kvm-all.c +5 -0
@@ -2274,6 +2274,11 @@ int kvm_has_intx_set_mask(void)return kvm_state->intx_set_mask; } +bool kvm_arm_supports_user_irq (void ) +{ +return kvm_check_extension (kvm_state,KVM_CAP_ARM_USER_IRQ ); +} +#ifdef KVM_CAP_SET_GUEST_DEBUG struct kvm_sw_breakpoint *kvm_find_sw_breakpoint (CPUState *cpu,target_ulong pc)
accel/stubs/kvm-stub.c +5 -0
@@ -155,4 +155,9 @@ void kvm_init_cpu_signals(CPUState *cpu) {abort (); } + +bool kvm_arm_supports_user_irq (void ) +{ +return false; +}#endif
hw/intc/arm_gic.c +7 -0
@@ -25,6 +25,7 @@#include "qom/cpu.h" #include "qemu/log.h" #include "trace.h" +#include "sysemu/kvm.h" /* #define DEBUG_GIC */
@@ -1412,6 +1413,12 @@ static void arm_gic_realize(DeviceState *dev, Error **errp)return ; } +if (kvm_enabled () && !kvm_arm_supports_user_irq ()) { +error_setg (errp,"KVM with user space irqchip only works when the " +"host kernel supports KVM_CAP_ARM_USER_IRQ" ); +return ; + } +/* This creates distributor and main CPU interface (s->cpuiomem[0]) */ gic_init_irqs_and_mmio (s, gic_set_irq, gic_ops);
target/arm/kvm.c +51 -0
63 lines not on this page · raw message
Signature · 1 line
2.7.4
Peter Maydell
AppliedQuoted 16 lines · Peter Maydell
A surprisingly short target-arm queue, but no point in holding onto these waiting for more code to arrive :-)
thanks
-- PMMThe following changes since commit
3d0bf8dfdfebd7f2ae41b6f220444b8047d6b1ee:Merge remote-tracking branch 'remotes/dgilbert/tags/pull-migration-20170710a' into staging (2017-07-10 18:13:03 +0100)
are available in the git repository at:
git://git.linaro.org/people/pmaydell/qemu-arm.gittags/pull-target-arm-20170711for you to fetch changes up to
792dac309c8660306557ba058b8b5a6a75ab3c1f:
Quoted 9 lines
target-arm: v7M: ignore writes to CONTROL.SPSEL from Thread mode (2017-07-11 11:21:26 +0100)
----------------------------------------------------------------
target-arm queue:
* v7M: ignore writes to CONTROL.SPSEL from Thread mode
* KVM: Enable in-kernel timers with user space gic
* aspeed: Register all watchdogs
* hw/misc: Add Exynos4210 Pseudo Random Number Generator
Applied, thanks.
-- PMM