arm: Fixes and preparatory cleanups for split-accel
Subsystems (3)
v2 cover arm: Fixes and preparatory cleanups for split-accel
Since v1:
- Addressed rth's review comments
Omnibus series of ARM-related patches (noticed during the "split accel" PoC work).
- Usual prototypes cleanups
- Check TCG for EL2/EL3 features (and not !KVM or !HVF)
- Improve HVF debugging
- Correct HVF 'dtb_compatible' value for Linux
- Fix HVF GTimer frequency (My M1 hardware has 24 MHz) (this implies accel/ rework w.r.t. QDev vCPU REALIZE)
- Expand functional tests w.r.t. HVF
Regards,
Phil.
Philippe Mathieu-Daudé (26):
target/arm: Remove arm_handle_psci_call() stub
target/arm: Reduce arm_cpu_post_init() declaration scope target/arm: Unify gen_exception_internal()
target/arm/hvf: Simplify GIC hvf_arch_init_vcpu() target/arm/hvf: Directly re-lock BQL after hv_vcpu_run() target/arm/hvf: Trace hv_vcpu_run() failures
accel/hvf: Trace VM memory mapping
target/arm/hvf: Log $pc in hvf_unknown_hvc() trace event target/arm: Correct KVM & HVF dtb_compatible value accel/hvf: Model PhysTimer register
target/arm/hvf: Pass @target_el argument to hvf_raise_exception() target/arm: Restrict system register properties to system binary target/arm: Create GTimers *after* features finalized / accel realized
accel: Keep reference to AccelOpsClass in AccelClass
accel: Introduce AccelOpsClass::cpu_target_realize() hook accel/hvf: Add hvf_arch_cpu_realize() stubs target/arm/hvf: Really set Generic Timer counter frequency target/arm/hvf: Trace host processor features
hw/arm/virt: Only require TCG || QTest to use TrustZone hw/arm/virt: Only require TCG || QTest to use virtualization extension
hw/arm/virt: Rename cpu_post_init() -> post_cpus_gic_realized() hw/arm/sbsa-ref: Tidy up use of RAMLIMIT_GB definition tests/functional: Restrict nexted Aarch64 Xen test to TCG tests/functional: Require TCG to run Aarch64 imx8mp-evk test tests/functional: Add hvf_available() helper tests/functional: Expand Aarch64 SMMU tests to run on HVF accelerator
meson.build | 1 + accel/hvf/trace.h | 2 + include/qemu/accel.h | 3 + include/system/accel-ops.h | 4 +- include/system/hvf.h | 3 + target/arm/cpu.h | 2 - target/arm/internals.h | 6 +- target/arm/tcg/translate.h | 1 + accel/accel-common.c | 4 + accel/accel-system.c | 3 +- accel/hvf/hvf-accel-ops.c | 8 ++ accel/tcg/tcg-accel-ops.c | 4 +- hw/arm/sbsa-ref.c | 8 +- hw/arm/virt.c | 9 +- target/arm/cpu.c | 78 ++++++------ target/arm/hvf/hvf.c | 129 +++++++++++++++----- target/arm/kvm.c | 2 +- target/arm/tcg/translate-a64.c | 6 - target/arm/tcg/translate.c | 2 +- target/i386/hvf/hvf.c | 5 + accel/hvf/trace-events | 7 ++ python/qemu/utils/__init__.py | 2 +- python/qemu/utils/accel.py | 8 ++ target/arm/hvf/trace-events | 6 +- tests/functional/qemu_test/testcase.py | 6 +- tests/functional/test_aarch64_imx8mp_evk.py | 1 + tests/functional/test_aarch64_smmu.py | 9 +- tests/functional/test_aarch64_xen.py | 1 + 28 files changed, 221 insertions(+), 99 deletions(-) create mode 100644 accel/hvf/trace.h create mode 100644 accel/hvf/trace-events
Signature · 1 line
2.49.0
PATCH v2 1/26 target/arm: Remove arm_handle_psci_call() stub
Since commit 0c1aaa66c24 ("target/arm: wrap psci call with tcg_enabled") the arm_handle_psci_call() call is elided when TCG is disabled.
--- target/arm/internals.h | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
target/arm/internals.h +1 -5
@@ -650,16 +650,12 @@ static inline bool arm_is_psci_call(ARMCPU *cpu, int excp_type) {return false; } -static inline void arm_handle_psci_call (ARMCPU *cpu) -{ -g_assert_not_reached (); -}#else /* Return true if the r0/x0 value indicates that this SMC/HVC is a PSCI call. */ bool arm_is_psci_call (ARMCPU *cpu,int excp_type); +#endif /* Actually handle a PSCI call */ void arm_handle_psci_call (ARMCPU *cpu); -#endif /** * arm_clear_exclusive: clear the exclusive monitor
Signature · 1 line
2.49.0
PATCH v2 2/26 target/arm: Reduce arm_cpu_post_init() declaration scope
In reply to Philippe Mathieu-Daudéarm_cpu_post_init() is only used within the same file unit.
--- target/arm/cpu.h | 2 -- target/arm/cpu.c | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-)
target/arm/cpu.h +0 -2
@@ -1150,8 +1150,6 @@ void arm_gt_sel2vtimer_cb(void *opaque);unsigned int gt_cntfrq_period_ns (ARMCPU *cpu);void gt_rme_post_el_change (ARMCPU *cpu,void *opaque); -void arm_cpu_post_init (Object *obj); -#define ARM_AFF0_SHIFT 0#define ARM_AFF0_MASK (0xFFULL << ARM_AFF0_SHIFT)#define ARM_AFF1_SHIFT 8
target/arm/cpu.c +1 -1
@@ -1713,7 +1713,7 @@ static void arm_cpu_propagate_feature_implications(ARMCPU *cpu) } } -void arm_cpu_post_init (Object *obj) +static void arm_cpu_post_init (Object *obj) {ARMCPU *cpu =ARM_CPU (obj);
Signature · 1 line
2.49.0
PATCH v2 3/26 target/arm: Unify gen_exception_internal()
In reply to Philippe Mathieu-DaudéSame code, use the generic variant.
--- target/arm/tcg/translate.h | 1 + target/arm/tcg/translate-a64.c | 6 ------ target/arm/tcg/translate.c | 2 +- 3 files changed, 2 insertions(+), 7 deletions(-)
target/arm/tcg/translate.h +1 -0
@@ -347,6 +347,7 @@ void arm_jump_cc(DisasCompare *cmp, TCGLabel *label);void arm_gen_test_cc (int cc,TCGLabel *label);MemOp pow2_align (unsigned i);void unallocated_encoding (DisasContext *s); +void gen_exception_internal (int excp);void gen_exception_insn_el (DisasContext *s,target_long pc_diff,int excp,uint32_t syn,uint32_t target_el); void gen_exception_insn(DisasContext *s, target_long pc_diff,
target/arm/tcg/translate-a64.c +0 -6
@@ -433,12 +433,6 @@ static void gen_rebuild_hflags(DisasContext *s)gen_helper_rebuild_hflags_a64 (tcg_env,tcg_constant_i32 (s->current_el)); } -static void gen_exception_internal (int excp) -{ -assert (excp_is_internal (excp)); -gen_helper_exception_internal (tcg_env,tcg_constant_i32 (excp)); -} -static void gen_exception_internal_insn (DisasContext *s,int excp) {gen_a64_update_pc (s,0 );
target/arm/tcg/translate.c +1 -1
@@ -372,7 +372,7 @@ static void gen_rebuild_hflags(DisasContext *s, bool new_el) } } -static void gen_exception_internal (int excp) +void gen_exception_internal (int excp) {assert (excp_is_internal (excp));gen_helper_exception_internal (tcg_env,tcg_constant_i32 (excp));
Signature · 1 line
2.49.0
PATCH v2 4/26 target/arm/hvf: Simplify GIC hvf_arch_init_vcpu()
In reply to Philippe Mathieu-DaudéOnly update the ID_AA64PFR0_EL1 register when a GIC is provided.
--- target/arm/hvf/hvf.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
target/arm/hvf/hvf.c +9 -5
@@ -1057,11 +1057,15 @@ int hvf_arch_init_vcpu(CPUState *cpu) arm_cpu->mp_affinity);assert_hvf_ok (ret); - ret =hv_vcpu_get_sys_reg (cpu->accel->fd,HV_SYS_REG_ID_AA64PFR0_EL1 , &pfr); -assert_hvf_ok (ret); - pfr |= env->gicv3state ? (1 <<24 ) :0 ; - ret =hv_vcpu_set_sys_reg (cpu->accel->fd,HV_SYS_REG_ID_AA64PFR0_EL1 , pfr); -assert_hvf_ok (ret); +if (env->gicv3state) { + ret =hv_vcpu_get_sys_reg (cpu->accel->fd, +HV_SYS_REG_ID_AA64PFR0_EL1 , &pfr); +assert_hvf_ok (ret); + pfr =FIELD_DP64 (pfr,ID_AA64PFR0 ,GIC ,1 ); + ret =hv_vcpu_set_sys_reg (cpu->accel->fd, +HV_SYS_REG_ID_AA64PFR0_EL1 , pfr); +assert_hvf_ok (ret); + }/* We're limited to underlying hardware caps, override internal versions */ ret = hv_vcpu_get_sys_reg(cpu->accel->fd, HV_SYS_REG_ID_AA64MMFR0_EL1,
Signature · 1 line
2.49.0
Re: [PATCH v2 04/26] target/arm/hvf: Simplify GIC hvf_arch_init_vcpu()
Quoted 6 lines · Philippe Mathieu-Daudé
Only update the
ID_AA64PFR0_EL1register when a GIC is provided.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- target/arm/hvf/hvf.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
r~
PATCH v2 5/26 target/arm/hvf: Directly re-lock BQL after hv_vcpu_run()
In reply to Philippe Mathieu-DaudéKeep bql_unlock() / bql_lock() close.
--- target/arm/hvf/hvf.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
target/arm/hvf/hvf.c +3 -2
@@ -1914,7 +1914,9 @@ int hvf_vcpu_exec(CPUState *cpu)flush_cpu_state (cpu);bql_unlock (); -assert_hvf_ok (hv_vcpu_run (cpu->accel->fd)); + r =hv_vcpu_run (cpu->accel->fd); +bql_lock (); +assert_hvf_ok (r);/* handle VMEXIT */ uint64_t exit_reason = hvf_exit->reason;
@@ -1922,7 +1924,6 @@ int hvf_vcpu_exec(CPUState *cpu)uint32_t ec =syn_get_ec (syndrome); ret =0 ; -bql_lock ();switch (exit_reason) {case HV_EXIT_REASON_EXCEPTION :/* This is the main one, handle below. */
Signature · 1 line
2.49.0
Re: [PATCH v2 05/26] target/arm/hvf: Directly re-lock BQL after hv_vcpu_run()
Quoted 6 lines · Philippe Mathieu-Daudé
Keep
bql_unlock()/bql_lock()close.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- target/arm/hvf/hvf.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
r~
Quoted 24 lines
target/arm/hvf/hvf.c +3
-2@@ -1914,7 +1914,9 @@ int hvf_vcpu_exec(CPUState *cpu)flush_cpu_state (cpu);bql_unlock (); -assert_hvf_ok (hv_vcpu_run (cpu->accel->fd)); + r =hv_vcpu_run (cpu->accel->fd); +bql_lock (); +assert_hvf_ok (r);/* handle VMEXIT */ uint64_t exit_reason = hvf_exit->reason;@@ -1922,7 +1924,6 @@ int hvf_vcpu_exec(CPUState *cpu)uint32_t ec =syn_get_ec (syndrome); ret =0 ; -bql_lock ();switch (exit_reason) {case HV_EXIT_REASON_EXCEPTION :/* This is the main one, handle below. */
PATCH v2 6/26 target/arm/hvf: Trace hv_vcpu_run() failures
In reply to Philippe Mathieu-DaudéAllow distinguishing HV_ILLEGAL_GUEST_STATE in trace events.
--- target/arm/hvf/hvf.c | 10 +++++++++- target/arm/hvf/trace-events | 1 + 2 files changed, 10 insertions(+), 1 deletion(-)
target/arm/hvf/hvf.c +9 -1
@@ -1916,7 +1916,15 @@ int hvf_vcpu_exec(CPUState *cpu)bql_unlock (); r =hv_vcpu_run (cpu->accel->fd);bql_lock (); -assert_hvf_ok (r); +switch (r) { +case HV_SUCCESS : +break ; +case HV_ILLEGAL_GUEST_STATE : +trace_hvf_illegal_guest_state (); +/* fall through */ +default : +g_assert_not_reached (); + }/* handle VMEXIT */ uint64_t exit_reason = hvf_exit->reason;
target/arm/hvf/trace-events +1 -0
@@ -11,3 +11,4 @@ hvf_exit(uint64_t syndrome, uint32_t ec, uint64_t pc) "exit: 0x%"PRIx64" [ec=0x% hvf_psci_call(uint64_t x0, uint64_t x1, uint64_t x2, uint64_t x3, uint32_t cpuid) "PSCI Call x0=0x%016"PRIx64" x1=0x%016"PRIx64" x2=0x%016"PRIx64" x3=0x%016"PRIx64" cpu=0x%x" hvf_vgic_write(const char *name, uint64_t val) "vgic write to %s [val=0x%016"PRIx64"]" hvf_vgic_read(const char *name, uint64_t val) "vgic read from %s [val=0x%016"PRIx64"]" +hvf_illegal_guest_state(void) "HV_ILLEGAL_GUEST_STATE"
Signature · 1 line
2.49.0
PATCH v2 7/26 accel/hvf: Trace VM memory mapping
In reply to Philippe Mathieu-DaudéTrace memory mapped / unmapped in the guest.
--- meson.build | 1 + accel/hvf/trace.h | 2 ++ accel/hvf/hvf-accel-ops.c | 6 ++++++ accel/hvf/trace-events | 7 +++++++ 4 files changed, 16 insertions(+) create mode 100644 accel/hvf/trace.h create mode 100644 accel/hvf/trace-events
meson.build +1 -0
@@ -3633,6 +3633,7 @@ if have_block endif if have_system trace_events_subdirs += [ + 'accel/hvf', 'accel/kvm', 'audio', 'backends',
accel/hvf/trace.h new file +2 -0
@@ -0,0 +1,2 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +#include "trace/trace-accel_hvf.h"
accel/hvf/hvf-accel-ops.c +6 -0
@@ -59,6 +59,7 @@#include "system/hvf_int.h" #include "system/runstate.h" #include "qemu/guest-random.h" +#include "trace.h" HVFState *hvf_state;
@@ -97,6 +98,7 @@ static int do_hvf_set_memory(hvf_slot *slot, hv_memory_flags_t flags)if (macslot->present) {if (macslot->size != slot->size) { macslot->present =0 ; +trace_hvf_vm_unmap (macslot->gpa_start, macslot->size); ret =hv_vm_unmap (macslot->gpa_start, macslot->size);assert_hvf_ok (ret); }
@@ -109,6 +111,10 @@ static int do_hvf_set_memory(hvf_slot *slot, hv_memory_flags_t flags) macslot->present =1 ; macslot->gpa_start = slot->start; macslot->size = slot->size; +trace_hvf_vm_map (slot->start, slot->size, slot->mem, flags, + flags &HV_MEMORY_READ ?'R' :'-' , + flags &HV_MEMORY_WRITE ?'W' :'-' , + flags &HV_MEMORY_EXEC ?'E' :'-' ); ret =hv_vm_map (slot->mem, slot->start, slot->size, flags);assert_hvf_ok (ret);return 0 ;
accel/hvf/trace-events new file +7 -0
@@ -0,0 +1,7 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# +# See docs/devel/tracing.rst for syntax documentation. + +# hvf-accel-ops.c +hvf_vm_map(uint64_t paddr, uint64_t size, void *vaddr, uint8_t flags, const char r, const char w, const char e) "paddr:0x%016"PRIx64" size:0x%08"PRIx64" vaddr:%p flags:0x%02x/%c%c%c" +hvf_vm_unmap(uint64_t paddr, uint64_t size) "paddr:0x%016"PRIx64" size:0x%08"PRIx64
Signature · 1 line
2.49.0
Re: [PATCH v2 07/26] accel/hvf: Trace VM memory mapping
Quoted 11 lines · Philippe Mathieu-Daudé
Trace memory mapped / unmapped in the guest.
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- meson.build | 1 + accel/hvf/trace.h | 2 ++ accel/hvf/hvf-accel-ops.c | 6 ++++++ accel/hvf/trace-events | 7 +++++++ 4 files changed, 16 insertions(+)create mode 100644
accel/hvf/trace.h
create mode 100644 accel/hvf/trace-events
r~
PATCH v2 8/26 target/arm/hvf: Log $pc in hvf_unknown_hvc() trace event
In reply to Philippe Mathieu-DaudéTracing $PC for unknown HVC instructions to not have to look at the disassembled flow of instructions.
--- target/arm/hvf/hvf.c | 4 ++-- target/arm/hvf/trace-events | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
target/arm/hvf/hvf.c +2 -2
@@ -2071,12 +2071,12 @@ int hvf_vcpu_exec(CPUState *cpu)cpu_synchronize_state (cpu);if (arm_cpu->psci_conduit ==QEMU_PSCI_CONDUIT_HVC ) {if (!hvf_handle_psci_call (cpu)) { -trace_hvf_unknown_hvc (env->xregs[0 ]); +trace_hvf_unknown_hvc (env->pc, env->xregs[0 ]);/* SMCCC 1.3 section 5.2 says every unknown SMCCC call returns -1 */ env->xregs[0 ] =-1 ; } }else { -trace_hvf_unknown_hvc (env->xregs[0 ]); +trace_hvf_unknown_hvc (env->pc, env->xregs[0 ]);hvf_raise_exception (cpu,EXCP_UDEF ,syn_uncategorized ()); }break ;
target/arm/hvf/trace-events +2 -2
@@ -5,10 +5,10 @@ hvf_inject_irq(void) "injecting IRQ" hvf_data_abort(uint64_t pc, uint64_t va, uint64_t pa, bool isv, bool iswrite, bool s1ptw, uint32_t len, uint32_t srt) "data abort: [pc=0x%"PRIx64" va=0x%016"PRIx64" pa=0x%016"PRIx64" isv=%d iswrite=%d s1ptw=%d len=%d srt=%d]" hvf_sysreg_read(uint32_t reg, uint32_t op0, uint32_t op1, uint32_t crn, uint32_t crm, uint32_t op2, uint64_t val) "sysreg read 0x%08x (op0=%d op1=%d crn=%d crm=%d op2=%d) = 0x%016"PRIx64 hvf_sysreg_write(uint32_t reg, uint32_t op0, uint32_t op1, uint32_t crn, uint32_t crm, uint32_t op2, uint64_t val) "sysreg write 0x%08x (op0=%d op1=%d crn=%d crm=%d op2=%d, val=0x%016"PRIx64")" -hvf_unknown_hvc(uint64_t x0) "unknown HVC! 0x%016"PRIx64 +hvf_unknown_hvc(uint64_t pc, uint64_t x0) "pc=0x%"PRIx64" unknown HVC! 0x%016"PRIx64 hvf_unknown_smc(uint64_t x0) "unknown SMC! 0x%016"PRIx64 hvf_exit(uint64_t syndrome, uint32_t ec, uint64_t pc) "exit: 0x%"PRIx64" [ec=0x%x pc=0x%"PRIx64"]" -hvf_psci_call(uint64_t x0, uint64_t x1, uint64_t x2, uint64_t x3, uint32_t cpuid) "PSCI Call x0=0x%016"PRIx64" x1=0x%016"PRIx64" x2=0x%016"PRIx64" x3=0x%016"PRIx64" cpu=0x%x" +hvf_psci_call(uint64_t x0, uint64_t x1, uint64_t x2, uint64_t x3, uint32_t cpuid) "PSCI Call x0=0x%016"PRIx64" x1=0x%016"PRIx64" x2=0x%016"PRIx64" x3=0x%016"PRIx64" cpuid=0x%x" hvf_vgic_write(const char *name, uint64_t val) "vgic write to %s [val=0x%016"PRIx64"]" hvf_vgic_read(const char *name, uint64_t val) "vgic read from %s [val=0x%016"PRIx64"]" hvf_illegal_guest_state(void) "HV_ILLEGAL_GUEST_STATE"
Signature · 1 line
2.49.0
PATCH v2 9/26 target/arm: Correct KVM & HVF dtb_compatible value
In reply to Philippe Mathieu-DaudéLinux kernel knows how to parse "arm,armv8", not "arm,arm-v8".
See arch/arm64/boot/dts/foundation-v8.dts:
https://github.com/torvalds/linux/commit/90556ca1ebdd
--- target/arm/hvf/hvf.c | 2 +- target/arm/kvm.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
target/arm/hvf/hvf.c +1 -1
@@ -879,7 +879,7 @@ static bool hvf_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf)hv_vcpu_exit_t *exit;int i; - ahcf->dtb_compatible ="arm,arm-v8" ; + ahcf->dtb_compatible ="arm,armv8" ; ahcf->features = (1ULL <<ARM_FEATURE_V8 ) | (1ULL <<ARM_FEATURE_NEON ) | (1ULL << ARM_FEATURE_AARCH64) |
target/arm/kvm.c +1 -1
@@ -266,7 +266,7 @@ static bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf) } ahcf->target = init.target; - ahcf->dtb_compatible ="arm,arm-v8" ; + ahcf->dtb_compatible ="arm,armv8" ; err =read_sys_reg64 (fdarray[2 ], &ahcf->isar.id_aa64pfr0,ARM64_SYS_REG (3 ,0 ,0 ,4 ,0 ));
Signature · 1 line
2.49.0
Re: [PATCH v2 09/26] target/arm: Correct KVM & HVF dtb_compatible value
Quoted 6 lines · Philippe Mathieu-Daudé
Linux kernel knows how to parse "arm,armv8", not "arm,arm-v8".
See
arch/arm64/boot/dts/foundation-v8.dts:https://github.com/torvalds/linux/commit/90556ca1ebdd
Quoted 7 lines
Fixes 26861c7ce06 ("target-arm: Add minimal KVM AArch64 support")Fixes 585df85efea ("hvf: arm: Implement -cpu host")Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- target/arm/hvf/hvf.c | 2 +- target/arm/kvm.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
r~
PATCH v2 10/26 accel/hvf: Model PhysTimer register
In reply to Philippe Mathieu-DaudéEmulate PhysTimer dispatching to TCG, like we do with GIC registers.
--- target/arm/hvf/hvf.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-)
target/arm/hvf/hvf.c +8 -11
@@ -187,6 +187,7 @@ void hvf_arm_init_debug(void)#define SYSREG_OSDLR_EL1 SYSREG(2, 0, 1, 3, 4)#define SYSREG_CNTPCT_EL0 SYSREG(3, 3, 14, 0, 1)#define SYSREG_CNTP_CTL_EL0 SYSREG(3, 3, 14, 2, 1) +#define SYSREG_CNTP_CVAL_EL0 SYSREG(3, 3, 14, 2, 2)#define SYSREG_PMCR_EL0 SYSREG(3, 3, 9, 12, 0)#define SYSREG_PMUSERENR_EL0 SYSREG(3, 3, 9, 14, 0)#define SYSREG_PMCNTENSET_EL0 SYSREG(3, 3, 9, 12, 1)
@@ -198,6 +199,7 @@ void hvf_arm_init_debug(void)#define SYSREG_PMCEID0_EL0 SYSREG(3, 3, 9, 12, 6)#define SYSREG_PMCEID1_EL0 SYSREG(3, 3, 9, 12, 7)#define SYSREG_PMCCNTR_EL0 SYSREG(3, 3, 9, 13, 0) +#define SYSREG_CNTP_TVAL_EL0 SYSREG(3, 3, 14, 2, 0)#define SYSREG_PMCCFILTR_EL0 SYSREG(3, 3, 14, 15, 7)#define SYSREG_ICC_AP0R0_EL1 SYSREG(3, 0, 12, 8, 4)
@@ -1326,16 +1328,15 @@ static int hvf_sysreg_read(CPUState *cpu, uint32_t reg, uint64_t *val) }switch (reg) { -case SYSREG_CNTPCT_EL0 : - *val =qemu_clock_get_ns (QEMU_CLOCK_VIRTUAL ) / -gt_cntfrq_period_ns (arm_cpu); -return 0 ;case SYSREG_OSLSR_EL1 : *val = env->cp15.oslsr_el1;return 0 ;case SYSREG_OSDLR_EL1 :/* Dummy register */ return 0 ; +case SYSREG_CNTP_CTL_EL0 : +case SYSREG_CNTP_TVAL_EL0 : +case SYSREG_CNTPCT_EL0 :case SYSREG_ICC_AP0R0_EL1 :case SYSREG_ICC_AP0R1_EL1 :case SYSREG_ICC_AP0R2_EL1 :
@@ -1639,16 +1640,12 @@ static int hvf_sysreg_write(CPUState *cpu, uint32_t reg, uint64_t val)case SYSREG_OSLAR_EL1 : env->cp15.oslsr_el1 = val &1 ;return 0 ; -case SYSREG_CNTP_CTL_EL0 : -/* -* Guests should not rely on the physical counter, but macOS emits -* disable writes to it. Let it do so, but ignore the requests. -*/ -qemu_log_mask (LOG_UNIMP ,"Unsupported write to CNTP_CTL_EL0\n" ); -return 0 ;case SYSREG_OSDLR_EL1 :/* Dummy register */ return 0 ; +case SYSREG_CNTP_CTL_EL0 : +case SYSREG_CNTP_CVAL_EL0 : +case SYSREG_CNTP_TVAL_EL0 :case SYSREG_ICC_AP0R0_EL1 :case SYSREG_ICC_AP0R1_EL1 :case SYSREG_ICC_AP0R2_EL1 :
Signature · 1 line
2.49.0
Re: [PATCH v2 10/26] accel/hvf: Model PhysTimer register
Quoted 6 lines · Philippe Mathieu-Daudé
Emulate PhysTimer dispatching to TCG, like we do with GIC registers.
Signed-off-by Philippe Mathieu-Daudé<[email protected]>--- target/arm/hvf/hvf.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-)
r~
PATCH v2 11/26 target/arm/hvf: Pass @target_el argument to hvf_raise_exception()
In reply to Philippe Mathieu-DaudéIn preparation of raising exceptions at EL2, add the 'target_el' argument to hvf_raise_exception().
--- target/arm/hvf/hvf.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
target/arm/hvf/hvf.c +7 -7
@@ -1089,13 +1089,13 @@ void hvf_kick_vcpu_thread(CPUState *cpu) }static void hvf_raise_exception (CPUState *cpu,uint32_t excp, -uint32_t syndrome) +uint32_t syndrome,int target_el) {ARMCPU *arm_cpu =ARM_CPU (cpu);CPUARMState *env = &arm_cpu->env; cpu->exception_index = excp; - env->exception.target_el =1 ; + env->exception.target_el = target_el; env->exception.syndrome = syndrome;arm_cpu_do_interrupt (cpu);
@@ -1454,7 +1454,7 @@ static int hvf_sysreg_read(CPUState *cpu, uint32_t reg, uint64_t *val)SYSREG_CRN (reg),SYSREG_CRM (reg), SYSREG_OP2(reg)); -hvf_raise_exception (cpu,EXCP_UDEF ,syn_uncategorized ()); +hvf_raise_exception (cpu,EXCP_UDEF ,syn_uncategorized (),1 );return 1 ; }
@@ -1760,7 +1760,7 @@ static int hvf_sysreg_write(CPUState *cpu, uint32_t reg, uint64_t val)SYSREG_CRN (reg),SYSREG_CRM (reg), SYSREG_OP2(reg)); -hvf_raise_exception (cpu,EXCP_UDEF ,syn_uncategorized ()); +hvf_raise_exception (cpu,EXCP_UDEF ,syn_uncategorized (),1 );return 1 ; }
@@ -1963,7 +1963,7 @@ int hvf_vcpu_exec(CPUState *cpu)if (!hvf_find_sw_breakpoint (cpu, env->pc)) {/* Re-inject into the guest */ ret =0 ; -hvf_raise_exception (cpu,EXCP_BKPT ,syn_aa64_bkpt (0 )); +hvf_raise_exception (cpu,EXCP_BKPT ,syn_aa64_bkpt (0 ),1 ); }break ; }
@@ -2074,7 +2074,7 @@ int hvf_vcpu_exec(CPUState *cpu) } }else {trace_hvf_unknown_hvc (env->pc, env->xregs[0 ]); -hvf_raise_exception (cpu,EXCP_UDEF ,syn_uncategorized ()); +hvf_raise_exception (cpu,EXCP_UDEF ,syn_uncategorized (),1 ); }break ;case EC_AA64_SMC :
@@ -2089,7 +2089,7 @@ int hvf_vcpu_exec(CPUState *cpu) } }else {trace_hvf_unknown_smc (env->xregs[0 ]); -hvf_raise_exception (cpu,EXCP_UDEF ,syn_uncategorized ()); +hvf_raise_exception (cpu,EXCP_UDEF ,syn_uncategorized (),1 ); }break ;default :
Signature · 1 line
2.49.0
Re: [PATCH v2 11/26] target/arm/hvf: Pass @target_el argument to hvf_raise_exception()
Quoted 7 lines · Philippe Mathieu-Daudé
In preparation of raising exceptions at EL2, add the '
target_el' argument tohvf_raise_exception().Signed-off-by Philippe Mathieu-Daudé<[email protected]>--- target/arm/hvf/hvf.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
r~
PATCH v2 12/26 target/arm: Restrict system register properties to system binary
In reply to Philippe Mathieu-DaudéDo not expose the following system-specific properties on user-mode binaries:
- psci-conduit
- cntfrq (ARM_FEATURE_GENERIC_TIMER)
- rvbar (ARM_FEATURE_V8)
- has-mpu (ARM_FEATURE_PMSA)
- pmsav7-dregion (ARM_FEATURE_PMSA)
- reset-cbar (ARM_FEATURE_CBAR)
- reset-hivecs (ARM_FEATURE_M)
- init-nsvtor (ARM_FEATURE_M)
- init-svtor (ARM_FEATURE_M_SECURITY)
- idau (ARM_FEATURE_M_SECURITY)
--- target/arm/cpu.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
target/arm/cpu.c +6 -5
@@ -1500,6 +1500,7 @@ static void arm_cpu_initfn(Object *obj)* 0 means "unset, use the default value". That default might vary depending * on the CPU type, and is set in the realize fn. */ +#ifndef CONFIG_USER_ONLY static const Property arm_cpu_gt_cntfrq_property =DEFINE_PROP_UINT64 ("cntfrq" ,ARMCPU , gt_cntfrq_hz,0 );
@@ -1509,7 +1510,6 @@ static const Property arm_cpu_reset_cbar_property =static const Property arm_cpu_reset_hivecs_property =DEFINE_PROP_BOOL ("reset-hivecs" ,ARMCPU , reset_hivecs, false); -#ifndef CONFIG_USER_ONLY static const Property arm_cpu_has_el2_property =DEFINE_PROP_BOOL ("has_el2" ,ARMCPU , has_el2, true);
@@ -1532,6 +1532,7 @@ static const Property arm_cpu_has_neon_property =static const Property arm_cpu_has_dsp_property =DEFINE_PROP_BOOL ("dsp" ,ARMCPU , has_dsp, true); +#ifndef CONFIG_USER_ONLY static const Property arm_cpu_has_mpu_property =DEFINE_PROP_BOOL ("has-mpu" ,ARMCPU , has_mpu, true);
@@ -1544,6 +1545,7 @@ static const Property arm_cpu_pmsav7_dregion_property =DEFINE_PROP_UNSIGNED_NODEFAULT ("pmsav7-dregion" ,ARMCPU , pmsav7_dregion, qdev_prop_uint32, uint32_t); +#endif static bool arm_get_pmu (Object *obj,Error **errp) {
@@ -1731,6 +1733,7 @@ static void arm_cpu_post_init(Object *obj)"Set on/off to enable/disable aarch64 " "execution state "); } +#ifndef CONFIG_USER_ONLY if (arm_feature (&cpu->env,ARM_FEATURE_CBAR ) ||arm_feature (&cpu->env,ARM_FEATURE_CBAR_RO )) {qdev_property_add_static (DEVICE (obj), &arm_cpu_reset_cbar_property);
@@ -1746,7 +1749,6 @@ static void arm_cpu_post_init(Object *obj) OBJ_PROP_FLAG_READWRITE); } -#ifndef CONFIG_USER_ONLY if (arm_feature (&cpu->env,ARM_FEATURE_EL3 )) {/* Add the has_el3 state CPU property only if EL3 is allowed. This will * prevent "has_el3" from existing on CPUs which cannot support EL3.
@@ -1818,6 +1820,7 @@ static void arm_cpu_post_init(Object *obj)qdev_property_add_static (DEVICE (obj), &arm_cpu_has_dsp_property); } +#ifndef CONFIG_USER_ONLY if (arm_feature (&cpu->env,ARM_FEATURE_PMSA )) {qdev_property_add_static (DEVICE (obj), &arm_cpu_has_mpu_property);if (arm_feature (&cpu->env,ARM_FEATURE_V7 )) {
@@ -1854,8 +1857,6 @@ static void arm_cpu_post_init(Object *obj) &cpu->psci_conduit, OBJ_PROP_FLAG_READWRITE); -qdev_property_add_static (DEVICE (obj), &arm_cpu_cfgend_property); -if (arm_feature (&cpu->env,ARM_FEATURE_GENERIC_TIMER )) {qdev_property_add_static (DEVICE (cpu), &arm_cpu_gt_cntfrq_property); }
@@ -1864,7 +1865,6 @@ static void arm_cpu_post_init(Object *obj)kvm_arm_add_vcpu_properties (cpu); } -#ifndef CONFIG_USER_ONLY if (arm_feature (&cpu->env,ARM_FEATURE_AARCH64 ) &&cpu_isar_feature (aa64_mte, cpu)) { object_property_add_link(obj, "tag-memory",
@@ -1882,6 +1882,7 @@ static void arm_cpu_post_init(Object *obj) } }#endif +qdev_property_add_static (DEVICE (obj), &arm_cpu_cfgend_property); }static void arm_cpu_finalizefn (Object *obj)
Signature · 1 line
2.49.0
Re: [PATCH v2 12/26] target/arm: Restrict system register properties to system binary
Quoted 14 lines · Philippe Mathieu-Daudé
Do not expose the following system-specific properties on user-mode binaries:
- psci-conduit
- cntfrq (ARM_FEATURE_GENERIC_TIMER)
- rvbar (ARM_FEATURE_V8)
- has-mpu (ARM_FEATURE_PMSA)
- pmsav7-dregion (ARM_FEATURE_PMSA)
- reset-cbar (ARM_FEATURE_CBAR)
- reset-hivecs (ARM_FEATURE_M)
- init-nsvtor (ARM_FEATURE_M)
- init-svtor (ARM_FEATURE_M_SECURITY)
- idau (ARM_FEATURE_M_SECURITY)
Quoted 4 lines
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- target/arm/cpu.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
r~
PATCH v2 13/26 target/arm: Create GTimers *after* features finalized / accel realized
In reply to Philippe Mathieu-DaudéCall generic (including accelerator) cpu_realize() handlers *before* setting @gt_cntfrq_hz default
--- target/arm/cpu.c | 65 ++++++++++++++++++++++++------------------------ 1 file changed, 33 insertions(+), 32 deletions(-)
target/arm/cpu.c +33 -32
@@ -1985,26 +1985,6 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp)return ; } -if (!cpu->gt_cntfrq_hz) { -/* -* 0 means "the board didn't set a value, use the default". (We also -* get here for the CONFIG_USER_ONLY case.) -* ARMv8.6 and later CPUs architecturally must use a 1GHz timer; before -* that it was an IMPDEF choice, and QEMU initially picked 62.5MHz, -* which gives a 16ns tick period. -* -* We will use the back-compat value: -* - for QEMU CPU types added before we standardized on 1GHz -* - for versioned machine types with a version of 9.0 or earlier -*/ -if (arm_feature (env,ARM_FEATURE_BACKCOMPAT_CNTFRQ ) || - cpu->backcompat_cntfrq) { - cpu->gt_cntfrq_hz =GTIMER_BACKCOMPAT_HZ ; - }else { - cpu->gt_cntfrq_hz =GTIMER_DEFAULT_HZ ; - } - } -#ifndef CONFIG_USER_ONLY /* The NVIC and M-profile CPU are two halves of a single piece of * hardware; trying to use one without the other is a command line
@@ -2051,7 +2031,40 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp) return; } } +#endif +cpu_exec_realizefn (cs, &local_err); +if (local_err !=NULL ) { +error_propagate (errp, local_err); +return ; + } + +arm_cpu_finalize_features (cpu, &local_err); +if (local_err !=NULL ) { +error_propagate (errp, local_err); +return ; + } + +#ifndef CONFIG_USER_ONLY +if (!cpu->gt_cntfrq_hz) { +/* +* 0 means "the board didn't set a value, use the default". (We also +* get here for the CONFIG_USER_ONLY case.) +* ARMv8.6 and later CPUs architecturally must use a 1GHz timer; before +* that it was an IMPDEF choice, and QEMU initially picked 62.5MHz, +* which gives a 16ns tick period. +* +* We will use the back-compat value: +* - for QEMU CPU types added before we standardized on 1GHz +* - for versioned machine types with a version of 9.0 or earlier +*/ +if (arm_feature (env,ARM_FEATURE_BACKCOMPAT_CNTFRQ ) || + cpu->backcompat_cntfrq) { + cpu->gt_cntfrq_hz =GTIMER_BACKCOMPAT_HZ ; + }else { + cpu->gt_cntfrq_hz =GTIMER_DEFAULT_HZ ; + } + } {uint64_t scale =gt_cntfrq_period_ns (cpu);
@@ -2072,18 +2085,6 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp) }#endif -cpu_exec_realizefn (cs, &local_err); -if (local_err !=NULL ) { -error_propagate (errp, local_err); -return ; - } - -arm_cpu_finalize_features (cpu, &local_err); -if (local_err !=NULL ) { -error_propagate (errp, local_err); -return ; - } -#ifdef CONFIG_USER_ONLY /* * User mode relies on IC IVAU instructions to catch modification of
Signature · 1 line
2.49.0
Re: [PATCH v2 13/26] target/arm: Create GTimers *after* features finalized / accel realized
Quoted 7 lines · Philippe Mathieu-Daudé
Call generic (including accelerator)
cpu_realize()handlers *before* setting @gt_cntfrq_hz defaultSigned-off-by Philippe Mathieu-Daudé<[email protected]>--- target/arm/cpu.c | 65 ++++++++++++++++++++++++------------------------ 1 file changed, 33 insertions(+), 32 deletions(-)
r~
PATCH v2 14/26 accel: Keep reference to AccelOpsClass in AccelClass
In reply to Philippe Mathieu-DaudéAllow dereferencing AccelOpsClass outside of accel/accel-system.c.
--- include/qemu/accel.h | 3 +++ include/system/accel-ops.h | 3 ++- accel/accel-common.c | 1 + accel/accel-system.c | 3 ++- accel/tcg/tcg-accel-ops.c | 4 +++- 5 files changed, 11 insertions(+), 3 deletions(-)
include/qemu/accel.h +3 -0
@@ -37,6 +37,9 @@ typedef struct AccelClass {/*< public >*/ const char *name; +/* Cached by accel_init_ops_interfaces() when created */ +AccelOpsClass *ops; +int (*init_machine)(MachineState *ms);bool (*cpu_common_realize)(CPUState *cpu,Error **errp);void (*cpu_common_unrealize)(CPUState *cpu);
include/system/accel-ops.h +2 -1
@@ -10,6 +10,7 @@#ifndef ACCEL_OPS_H #define ACCEL_OPS_H +#include "qemu/accel.h" #include "exec/vaddr.h" #include "qom/object.h"
@@ -31,7 +32,7 @@ struct AccelOpsClass {/*< public >*/ /* initialization function called when accel is chosen */ -void (*ops_init)(AccelOpsClass *ops); +void (*ops_init)(AccelClass *ac);bool (*cpus_are_resettable)(void );void (*cpu_reset_hold)(CPUState *cpu);
accel/accel-common.c +1 -0
@@ -10,6 +10,7 @@#include "qemu/osdep.h" #include "qemu/accel.h" #include "qemu/target-info.h" +#include "system/accel-ops.h" #include "accel/accel-cpu.h" #include "accel-internal.h"
accel/accel-system.c +2 -1
@@ -85,8 +85,9 @@ void accel_init_ops_interfaces(AccelClass *ac)* non-NULL create_vcpu_thread operation. */ ops =ACCEL_OPS_CLASS (oc); + ac->ops = ops;if (ops->ops_init) { - ops->ops_init (ops); + ops->ops_init (ac); }cpus_register_accel (ops); }
accel/tcg/tcg-accel-ops.c +3 -1
@@ -198,8 +198,10 @@ static inline void tcg_remove_all_breakpoints(CPUState *cpu)cpu_watchpoint_remove_all (cpu,BP_GDB ); } -static void tcg_accel_ops_init (AccelOpsClass *ops) +static void tcg_accel_ops_init (AccelClass *ac) { +AccelOpsClass *ops = ac->ops; +if (qemu_tcg_mttcg_enabled ()) { ops->create_vcpu_thread = mttcg_start_vcpu_thread; ops->kick_vcpu_thread = mttcg_kick_vcpu_thread;
Signature · 1 line
2.49.0
PATCH v2 15/26 accel: Introduce AccelOpsClass::cpu_target_realize() hook
In reply to Philippe Mathieu-DaudéAllow accelerators to set vCPU properties before its realization.
--- include/system/accel-ops.h | 1 + accel/accel-common.c | 3 +++ 2 files changed, 4 insertions(+)
include/system/accel-ops.h +1 -0
@@ -35,6 +35,7 @@ struct AccelOpsClass {void (*ops_init)(AccelClass *ac);bool (*cpus_are_resettable)(void ); +bool (*cpu_target_realize)(CPUState *cpu,Error **errp);void (*cpu_reset_hold)(CPUState *cpu);void (*create_vcpu_thread)(CPUState *cpu);/* MANDATORY NON-NULL */
accel/accel-common.c +3 -0
@@ -105,6 +105,9 @@ bool accel_cpu_common_realize(CPUState *cpu, Error **errp)if (acc->cpu_common_realize && !acc->cpu_common_realize (cpu, errp)) {return false; } +if (acc->ops->cpu_target_realize && !acc->ops->cpu_target_realize (cpu, errp)) { +return false; + }return true; }
Signature · 1 line
2.49.0
Re: [PATCH v2 15/26] accel: Introduce AccelOpsClass::cpu_target_realize() hook
Quoted 7 lines · Philippe Mathieu-Daudé
Allow accelerators to set vCPU properties before its realization.
Signed-off-by Philippe Mathieu-Daudé<[email protected]>--- include/system/accel-ops.h | 1 + accel/accel-common.c | 3 +++ 2 files changed, 4 insertions(+)
r~
PATCH v2 16/26 accel/hvf: Add hvf_arch_cpu_realize() stubs
In reply to Philippe Mathieu-DaudéImplement HVF AccelOpsClass::cpu_target_realize() hook as empty stubs. Target implementations will come separately.
--- include/system/hvf.h | 3 +++ accel/hvf/hvf-accel-ops.c | 2 ++ target/arm/hvf/hvf.c | 5 +++++ target/i386/hvf/hvf.c | 5 +++++ 4 files changed, 15 insertions(+)
include/system/hvf.h +3 -0
@@ -72,6 +72,9 @@ void hvf_arch_update_guest_debug(CPUState *cpu);* Return whether the guest supports debugging. */ bool hvf_arch_supports_guest_debug (void ); + +bool hvf_arch_cpu_realize (CPUState *cpu,Error **errp); +#endif /* COMPILING_PER_TARGET */ #endif
accel/hvf/hvf-accel-ops.c +2 -0
@@ -588,6 +588,8 @@ static void hvf_accel_ops_class_init(ObjectClass *oc, const void *data) {AccelOpsClass *ops =ACCEL_OPS_CLASS (oc); + ops->cpu_target_realize = hvf_arch_cpu_realize; + ops->create_vcpu_thread = hvf_start_vcpu_thread; ops->kick_vcpu_thread = hvf_kick_vcpu_thread;
target/arm/hvf/hvf.c +5 -0
@@ -1082,6 +1082,11 @@ int hvf_arch_init_vcpu(CPUState *cpu)return 0 ; } +bool hvf_arch_cpu_realize (CPUState *cs,Error **errp) +{ +return true; +} +void hvf_kick_vcpu_thread (CPUState *cpu) {cpus_kick_thread (cpu);
target/i386/hvf/hvf.c +5 -0
@@ -367,6 +367,11 @@ int hvf_arch_init_vcpu(CPUState *cpu)return 0 ; } +bool hvf_arch_cpu_realize (CPUState *cs,Error **errp) +{ +return true; +} +static void hvf_store_events (CPUState *cpu,uint32_t ins_len,uint64_t idtvec_info) {X86CPU *x86_cpu =X86_CPU (cpu);
Signature · 1 line
2.49.0
Re: [PATCH v2 16/26] accel/hvf: Add hvf_arch_cpu_realize() stubs
Quoted 10 lines · Philippe Mathieu-Daudé
Implement
HVFAccelOpsClass::cpu_target_realize()hook as empty stubs. Target implementations will come separately.Signed-off-by Philippe Mathieu-Daudé<[email protected]>--- include/system/hvf.h | 3 +++ accel/hvf/hvf-accel-ops.c | 2 ++ target/arm/hvf/hvf.c | 5 +++++ target/i386/hvf/hvf.c | 5 +++++ 4 files changed, 15 insertions(+)
r~
PATCH v2 17/26 target/arm/hvf: Really set Generic Timer counter frequency
In reply to Philippe Mathieu-DaudéSetting ARMCPU::gt_cntfrq_hz in hvf_arch_init_vcpu() is not correct because the timers have already be initialized with the default frequency.
Set it earlier in the AccelOpsClass::cpu_target_realize() handler instead, and assert the value is correct when reaching hvf_arch_init_vcpu().
--- target/arm/hvf/hvf.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)
target/arm/hvf/hvf.c +14 -1
@@ -1004,6 +1004,13 @@ cleanup:return ret; } +static uint64_t get_cntfrq_el0 (void ) +{ +uint64_t freq_hz =0 ; + asmvolatile ("mrs %0, cntfrq_el0" :"=r" (freq_hz)); +return freq_hz; +} +int hvf_arch_init_vcpu (CPUState *cpu) {ARMCPU *arm_cpu =ARM_CPU (cpu);
@@ -1015,7 +1022,9 @@ int hvf_arch_init_vcpu(CPUState *cpu)int i; env->aarch64 = true; - asmvolatile ("mrs %0, cntfrq_el0" :"=r" (arm_cpu->gt_cntfrq_hz)); + +/* system count frequency sanity check */ +assert (arm_cpu->gt_cntfrq_hz ==get_cntfrq_el0 ());/* Allocate enough space for our sysreg sync */ arm_cpu->cpreg_indexes = g_renew(uint64_t, arm_cpu->cpreg_indexes,
@@ -1084,6 +1093,10 @@ int hvf_arch_init_vcpu(CPUState *cpu)bool hvf_arch_cpu_realize (CPUState *cs,Error **errp) { +ARMCPU *cpu =ARM_CPU (cs); + + cpu->gt_cntfrq_hz =get_cntfrq_el0 (); +return true; }
Signature · 1 line
2.49.0
PATCH v2 18/26 target/arm/hvf: Trace host processor features
In reply to Philippe Mathieu-DaudéTracing an Apple M1 (Icestorm core, ARMv8.4-A):
hvf_processor_feature_register EL0: 1
hvf_processor_feature_register EL1: 1
hvf_processor_feature_register EL2: 0
hvf_processor_feature_register FP: 1
hvf_processor_feature_register AdvSIMD: 1
hvf_processor_feature_register GIC: 0
hvf_processor_feature_register SVE: 0
hvf_processor_feature_register MTE: 0
hvf_processor_feature_register SME: 0
--- target/arm/hvf/hvf.c | 43 +++++++++++++++++++++++++++++++++++++ target/arm/hvf/trace-events | 1 + 2 files changed, 44 insertions(+)
target/arm/hvf/hvf.c +43 -0
@@ -2160,8 +2160,51 @@ static void hvf_vm_state_change(void *opaque, bool running, RunState state) } } +static void trace_processor_feature_register (void ) +{ +hv_return_t ret =HV_SUCCESS ; +hv_vcpu_exit_t *exit; +hv_vcpu_t fd; +uint64_t pfr; + +if (!trace_event_get_state_backends (TRACE_HVF_PROCESSOR_FEATURE_REGISTER )) { +return ; + } + +/* We set up a small vcpu to extract host registers */ + ret =hv_vcpu_create (&fd, &exit,NULL ); +assert_hvf_ok (ret); + + ret =hv_vcpu_get_sys_reg (fd,HV_SYS_REG_ID_AA64PFR0_EL1 , &pfr); +assert_hvf_ok (ret); +trace_hvf_processor_feature_register ("EL0" , +FIELD_EX64 (pfr,ID_AA64PFR0 ,EL0 )); +trace_hvf_processor_feature_register ("EL1" , +FIELD_EX64 (pfr,ID_AA64PFR0 ,EL1 )); +trace_hvf_processor_feature_register ("EL2" , +FIELD_EX64 (pfr,ID_AA64PFR0 ,EL2 )); +trace_hvf_processor_feature_register ("FP" , +FIELD_EX64 (pfr,ID_AA64PFR0 ,FP )); +trace_hvf_processor_feature_register ("AdvSIMD" ,FIELD_EX64 (pfr, +ID_AA64PFR0 ,ADVSIMD )); +trace_hvf_processor_feature_register ("GIC" ,FIELD_EX64 (pfr, +ID_AA64PFR0 ,GIC )); +trace_hvf_processor_feature_register ("SVE" ,FIELD_EX64 (pfr, +ID_AA64PFR0 ,SVE )); + + ret =hv_vcpu_get_sys_reg (fd,HV_SYS_REG_ID_AA64PFR1_EL1 , &pfr); +assert_hvf_ok (ret); +trace_hvf_processor_feature_register ("MTE" , +FIELD_EX64 (pfr,ID_AA64PFR1 ,MTE )); +trace_hvf_processor_feature_register ("SME" , +FIELD_EX64 (pfr,ID_AA64PFR1 ,SME )); + ret =hv_vcpu_destroy (fd); +assert_hvf_ok (ret); +} +int hvf_arch_init (void ) { +trace_processor_feature_register (); hvf_state->vtimer_offset =mach_absolute_time ();vmstate_register (NULL ,0 , &vmstate_hvf_vtimer, &vtimer);qemu_add_vm_change_state_handler (hvf_vm_state_change, &vtimer);
target/arm/hvf/trace-events +1 -0
@@ -12,3 +12,4 @@ hvf_psci_call(uint64_t x0, uint64_t x1, uint64_t x2, uint64_t x3, uint32_t cpuid hvf_vgic_write(const char *name, uint64_t val) "vgic write to %s [val=0x%016"PRIx64"]" hvf_vgic_read(const char *name, uint64_t val) "vgic read from %s [val=0x%016"PRIx64"]" hvf_illegal_guest_state(void) "HV_ILLEGAL_GUEST_STATE" +hvf_processor_feature_register(const char *regname, unsigned value) "%s: %u"
Signature · 1 line
2.49.0
Re: [PATCH v2 18/26] target/arm/hvf: Trace host processor features
Quoted 12 lines · Philippe Mathieu-Daudé
Tracing an Apple M1 (Icestorm core, ARMv8.4-A):
hvf_processor_feature_registerEL0: 1
hvf_processor_feature_registerEL1: 1
hvf_processor_feature_registerEL2: 0
hvf_processor_feature_registerFP: 1
hvf_processor_feature_registerAdvSIMD: 1
hvf_processor_feature_registerGIC: 0
hvf_processor_feature_registerSVE: 0
hvf_processor_feature_registerMTE: 0
hvf_processor_feature_registerSME: 0
Quoted 2 lines
Suggested-by Richard Henderson <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>
I'm not sure why you want this? When you asked if you could emulate aarch32, I suggested you have gdb stop after the host probe and examine the values. I'm not sure why you'd want to keep this logging around forever.
Anyway, from EL0/EL1, the answer is no, the M1 only supports aarch64.
r~
PATCH v2 19/26 hw/arm/virt: Only require TCG || QTest to use TrustZone
In reply to Philippe Mathieu-DaudéWe only need TCG (or QTest) to use TrustZone, whether KVM or HVF are used is not relevant.
--- hw/arm/virt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/arm/virt.c +1 -1
@@ -2203,7 +2203,7 @@ static void machvirt_init(MachineState *machine)exit (1 ); } -if (vms->secure && (kvm_enabled () ||hvf_enabled ())) { +if (vms->secure && !tcg_enabled () && !qtest_enabled ()) {error_report ("mach-virt: %s does not support providing " "Security extensions (TrustZone) to the guest CPU" ,current_accel_name ());
Signature · 1 line
2.49.0
PATCH v2 20/26 hw/arm/virt: Only require TCG || QTest to use virtualization extension
In reply to Philippe Mathieu-DaudéWe can not start in EL2 / EL3 with anything but TCG (or QTest); whether KVM or HVF are used is not relevant.
--- hw/arm/virt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/arm/virt.c +1 -1
@@ -2210,7 +2210,7 @@ static void machvirt_init(MachineState *machine)exit (1 ); } -if (vms->virt && (kvm_enabled () ||hvf_enabled ())) { +if (vms->virt && !tcg_enabled () && !qtest_enabled ()) {error_report ("mach-virt: %s does not support providing " "Virtualization extensions to the guest CPU" ,current_accel_name ());
Signature · 1 line
2.49.0
PATCH v2 21/26 hw/arm/virt: Rename cpu_post_init() -> post_cpus_gic_realized()
In reply to Philippe Mathieu-DaudéQDev uses _post_init() during instance creation, before being realized. Since here both vCPUs and GIC are REALIZED, rename as virt_post_cpus_gic_realized() for clarity.
--- hw/arm/virt.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
hw/arm/virt.c +3 -2
@@ -2032,7 +2032,8 @@ static void finalize_gic_version(VirtMachineState *vms)* virt_cpu_post_init() must be called after the CPUs have * been realized and the GIC has been created. */ -static void virt_cpu_post_init (VirtMachineState *vms,MemoryRegion *sysmem) +static void virt_post_cpus_gic_realized (VirtMachineState *vms, +MemoryRegion *sysmem) {int max_cpus =MACHINE (vms)->smp.max_cpus;bool aarch64, pmu, steal_time;
@@ -2349,7 +2350,7 @@ static void machvirt_init(MachineState *machine)create_gic (vms, sysmem); -virt_cpu_post_init (vms, sysmem); +virt_post_cpus_gic_realized (vms, sysmem);fdt_add_pmu_nodes (vms);
Signature · 1 line
2.49.0
Re: [PATCH v2 21/26] hw/arm/virt: Rename cpu_post_init() -> post_cpus_gic_realized()
Quoted 8 lines · Philippe Mathieu-Daudé
QDev uses
_post_init()during instance creation, before being realized. Since here both vCPUs and GIC are REALIZED, rename asvirt_post_cpus_gic_realized()for clarity.Signed-off-by Philippe Mathieu-Daudé<[email protected]>--- hw/arm/virt.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
r~
PATCH v2 22/26 hw/arm/sbsa-ref: Tidy up use of RAMLIMIT_GB definition
In reply to Philippe Mathieu-DaudéDefine RAMLIMIT_BYTES using the TiB definition and display the error parsed with size_to_str():
$ qemu-system-aarch64-unsigned -M sbsa-ref -m 9T qemu-system-aarch64-unsigned: sbsa-ref: cannot model more than 8 TiB of RAM
--- hw/arm/sbsa-ref.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
hw/arm/sbsa-ref.c +5 -3
@@ -19,6 +19,7 @@*/ #include "qemu/osdep.h" +#include "qemu/cutils.h" #include "qemu/datadir.h" #include "qapi/error.h" #include "qemu/error-report.h"
@@ -53,8 +54,7 @@#include "target/arm/cpu-qom.h" #include "target/arm/gtimer.h" -#define RAMLIMIT_GB 8192 -#define RAMLIMIT_BYTES (RAMLIMIT_GB * GiB) +#define RAMLIMIT_BYTES (8 * TiB)#define NUM_IRQS 256#define NUM_SMMU_IRQS 4
@@ -756,7 +756,9 @@ static void sbsa_ref_init(MachineState *machine) sms->smp_cpus = smp_cpus;if (machine->ram_size > sbsa_ref_memmap[SBSA_MEM ].size) { -error_report ("sbsa-ref: cannot model more than %dGB RAM" ,RAMLIMIT_GB ); +char *size_str =size_to_str (RAMLIMIT_BYTES ); + +error_report ("sbsa-ref: cannot model more than %s of RAM" , size_str);exit (1 ); }
Signature · 1 line
2.49.0
Re: [PATCH v2 22/26] hw/arm/sbsa-ref: Tidy up use of RAMLIMIT_GB definition
Quoted 10 lines · Philippe Mathieu-Daudé
Define
RAMLIMIT_BYTESusing the TiB definition and display the error parsed withsize_to_str():$ qemu-system-aarch64-unsigned -M sbsa-ref -m 9T qemu-system-aarch64-unsigned: sbsa-ref: cannot model more than 8 TiB of RAMSigned-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/arm/sbsa-ref.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
r~
PATCH v2 23/26 tests/functional: Restrict nexted Aarch64 Xen test to TCG
In reply to Philippe Mathieu-DaudéOn macOS this test fails:
qemu-system-aarch64: mach-virt: HVF does not support providing Virtualization extensions to the guest CPU
--- tests/functional/test_aarch64_xen.py | 1 + 1 file changed, 1 insertion(+)
tests/functional/test_aarch64_xen.py +1 -0
@@ -33,6 +33,7 @@ def launch_xen(self, xen_path): """ Launch Xen with a dom0 guest kernel """ + self.require_accelerator("tcg") # virtualization=on self.set_machine('virt') self.cpu = "cortex-a57" self.kernel_path = self.ASSET_KERNEL.fetch()
Signature · 1 line
2.49.0
Re: [PATCH v2 23/26] tests/functional: Restrict nexted Aarch64 Xen test to TCG
Quoted 14 lines · Philippe Mathieu-Daudé
On macOS this test fails:
qemu-system-aarch64: mach-virt: HVF does not support providing Virtualization extensions to the guest CPU
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- tests/functional/test_aarch64_xen.py | 1 + 1 file changed, 1 insertion(+)tests/functional/test_aarch64_xen.py +0
-0
tests/functional/test_aarch64_xen.py def launch_xen(self, xen_path): · line 39
Quoted 7 lines
tests/functional/test_aarch64_xen.py +1
-0@@ -33,6 +33,7 @@ def launch_xen(self, xen_path): """ Launch Xen with a dom0 guest kernel """ + self.require_accelerator("tcg") # virtualization=on self.set_machine('virt') self.cpu = "cortex-a57" self.kernel_path = self.ASSET_KERNEL.fetch()
r~
Re: [PATCH v2 23/26] tests/functional: Restrict nexted Aarch64 Xen test to TCG
In reply to Philippe Mathieu-DaudéQuoted 14 lines · Philippe Mathieu-Daudé
On macOS this test fails:
qemu-system-aarch64: mach-virt: HVF does not support providing Virtualization extensions to the guest CPU
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- tests/functional/test_aarch64_xen.py | 1 + 1 file changed, 1 insertion(+)tests/functional/test_aarch64_xen.py +0
-0
tests/functional/test_aarch64_xen.py def launch_xen(self, xen_path): · line 36
Quoted 4 lines
tests/functional/test_aarch64_xen.py +1
-0@@ -33,6 +33,7 @@ def launch_xen(self, xen_path): """ Launch Xen with a dom0 guest kernel """ + self.require_accelerator("tcg") # virtualization=on
What about kvm (or xen) as accelerator? Would that work?
Thomas
Re: [PATCH v2 23/26] tests/functional: Restrict nexted Aarch64 Xen test to TCG
Quoted 10 lines · Thomas Huth
Quoted 9 lines · Philippe Mathieu-Daudé
On macOS this test fails:
qemu-system-aarch64: mach-virt: HVF does not support providing Virtualization extensions to the guest CPU
Signed-off-by Philippe Mathieu-Daudé <[email protected]>---
tests/functional/test_aarch64_xen.py| 1 +1 file changed, 1 insertion(+)
Quoted 11 lines
Quoted 9 lines
tests/functional/test_aarch64_xen.py +0
-0@@ -33,6 +33,7 @@ def launch_xen(self, xen_path):"""
Launch Xen with a dom0 guest kernel
"""
+self.require_accelerator("tcg")# virtualization=onWhat about kvm (or xen) as accelerator? Would that work?
IIUC this tests boots a nested Xen guest running at Aarch64 EL2, and at this point we can only run EL2/EL3 on TCG. HVF and KVM can not for now (we are working on it).
I don't know if Xen can accelerate EL2, it would need support for such hardware (like the Apple Silicon M4). Cc'ing Xen folks to figure it out.
Re: [PATCH v2 23/26] tests/functional: Restrict nexted Aarch64 Xen test to TCG
Quoted 23 lines · Philippe Mathieu-Daudé
Quoted 10 lines · Thomas Huth
Quoted 9 lines · Philippe Mathieu-Daudé
On macOS this test fails:
qemu-system-aarch64: mach-virt: HVF does not support providing Virtualization extensions to the guest CPU
Signed-off-by Philippe Mathieu-Daudé <[email protected]>---
tests/functional/test_aarch64_xen.py| 1 +1 file changed, 1 insertion(+)Quoted 11 lines
Quoted 9 lines
tests/functional/test_aarch64_xen.py +0
-0@@ -33,6 +33,7 @@ def launch_xen(self, xen_path):"""
Launch Xen with a dom0 guest kernel
"""
+self.require_accelerator("tcg")# virtualization=onWhat about kvm (or xen) as accelerator? Would that work?
Quoted 3 lines
IIUC this tests boots a nested Xen guest running at Aarch64 EL2, and at this point we can only run EL2/EL3 on TCG. HVF and KVM can not for now (we are working on it).
I'll update the description with:
Currently QEMU only support accelerating EL0 and EL1, so features requiring EL2 (like virtualization) or EL3 must be emulated with TCG.
Quoted 3 lines
I don't know if Xen can accelerate EL2, it would need support for such hardware (like the Apple Silicon M4). Cc'ing Xen folks to figure it out.
PATCH v2 24/26 tests/functional: Require TCG to run Aarch64 imx8mp-evk test
In reply to Philippe Mathieu-DaudéThe imx8mp-evk machine is only built when TCG is available.
--- tests/functional/test_aarch64_imx8mp_evk.py | 1 + 1 file changed, 1 insertion(+)
tests/functional/test_aarch64_imx8mp_evk.py +1 -0
@@ -49,6 +49,7 @@ def setUp(self): self.DTB_OFFSET, self.DTB_SIZE) def test_aarch64_imx8mp_evk_usdhc(self): + self.require_accelerator("tcg") self.set_machine('imx8mp-evk') self.vm.set_console(console_index=1) self.vm.add_args('-m', '2G',
Signature · 1 line
2.49.0
Re: [PATCH v2 24/26] tests/functional: Require TCG to run Aarch64 imx8mp-evk test
Quoted 6 lines · Philippe Mathieu-Daudé
The imx8mp-evk machine is only built when TCG is available.
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- tests/functional/test_aarch64_imx8mp_evk.py | 1 + 1 file changed, 1 insertion(+)
r~
Re: [PATCH v2 24/26] tests/functional: Require TCG to run Aarch64 imx8mp-evk test
In reply to Philippe Mathieu-DaudéQuoted 1 line · Philippe Mathieu-Daudé
The imx8mp-evk machine is only built when TCG is available.
The rationale here sounds wrong. If the machine is only built with TCG, then the set_machine() should be good enough to check whether it's available. So I'd rather say:
"The imx8mp-evk machine can only run with the TCG accelerator".
With that update:
Quoted 17 lines
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- tests/functional/test_aarch64_imx8mp_evk.py | 1 + 1 file changed, 1 insertion(+)tests/functional/test_aarch64_imx8mp_evk.py +1
-0@@ -49,6 +49,7 @@ def setUp(self): self.DTB_OFFSET, self.DTB_SIZE) def test_aarch64_imx8mp_evk_usdhc(self): + self.require_accelerator("tcg") self.set_machine('imx8mp-evk') self.vm.set_console(console_index=1) self.vm.add_args('-m', '2G',
Re: [PATCH v2 24/26] tests/functional: Require TCG to run Aarch64 imx8mp-evk test
Quoted 7 lines · Thomas Huth
Quoted 1 line · Philippe Mathieu-Daudé
The imx8mp-evk machine is only built when TCG is available.
The rationale here sounds wrong. If the machine is only built with TCG, then the
set_machine()should be good enough to check whether it's available. So I'd rather say:"The imx8mp-evk machine can only run with the TCG accelerator".
Yes, you are correct.
Quoted 3 lines
With that update:
Reviewed-by Thomas Huth <[email protected]>
Thanks :)
Quoted 4 lines
Quoted 4 lines
Signed-off-by Philippe Mathieu-Daudé <[email protected]>---
tests/functional/test_aarch64_imx8mp_evk.py| 1 +1 file changed, 1 insertion(+)
PATCH v2 25/26 tests/functional: Add hvf_available() helper
In reply to Philippe Mathieu-Daudé--- python/qemu/utils/__init__.py | 2 +- python/qemu/utils/accel.py | 8 ++++++++ tests/functional/qemu_test/testcase.py | 6 ++++-- 3 files changed, 13 insertions(+), 3 deletions(-)
python/qemu/utils/__init__.py +1 -1
@@ -23,7 +23,7 @@ from typing import Optional # pylint: disable=import-error -from .accel import kvm_available, list_accel, tcg_available +from .accel import hvf_available, kvm_available, list_accel, tcg_available __all__ = (
python/qemu/utils/accel.py +8 -0
@@ -82,3 +82,11 @@ def tcg_available(qemu_bin: str) -> bool: @param qemu_bin (str): path to the QEMU binary """ return 'tcg' in list_accel(qemu_bin) + +def hvf_available(qemu_bin: str) -> bool: + """ + Check if HVF is available. + + @param qemu_bin (str): path to the QEMU binary + """ + return 'hvf' in list_accel(qemu_bin)
tests/functional/qemu_test/testcase.py +4 -2
@@ -23,7 +23,7 @@ import uuid from qemu.machine import QEMUMachine -from qemu.utils import kvm_available, tcg_available +from qemu.utils import hvf_available, kvm_available, tcg_available from .archive import archive_extract from .asset import Asset
@@ -317,7 +317,9 @@ def require_accelerator(self, accelerator): :type accelerator: str """ checker = {'tcg': tcg_available, - 'kvm': kvm_available}.get(accelerator) + 'kvm': kvm_available, + 'hvf': hvf_available, + }.get(accelerator) if checker is None: self.skipTest("Don't know how to check for the presence " "of accelerator %s" % accelerator)
Signature · 1 line
2.49.0
Re: [PATCH v2 25/26] tests/functional: Add hvf_available() helper
Quoted 6 lines · Philippe Mathieu-Daudé
Signed-off-by Philippe Mathieu-Daudé<[email protected]>--- python/qemu/utils/__init__.py | 2 +- python/qemu/utils/accel.py | 8 ++++++++ tests/functional/qemu_test/testcase.py | 6 ++++-- 3 files changed, 13 insertions(+), 3 deletions(-)
r~
Re: [PATCH v2 25/26] tests/functional: Add hvf_available() helper
In reply to Philippe Mathieu-DaudéQuoted 50 lines · Philippe Mathieu-Daudé
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- python/qemu/utils/__init__.py | 2 +- python/qemu/utils/accel.py | 8 ++++++++ tests/functional/qemu_test/testcase.py | 6 ++++-- 3 files changed, 13 insertions(+), 3 deletions(-)python/qemu/utils/__init__.py +1
-1@@ -23,7 +23,7 @@ from typing import Optional # pylint: disable=import-error -from .accel import kvm_available, list_accel, tcg_available +from .accel import hvf_available, kvm_available, list_accel, tcg_available __all__ = (python/qemu/utils/accel.py +8
-0@@ -82,3 +82,11 @@ def tcg_available(qemu_bin: str) -> bool: @param qemu_bin (str): path to the QEMU binary """ return 'tcg' in list_accel(qemu_bin) + +def hvf_available(qemu_bin: str) -> bool: + """ + Check if HVF is available. + + @param qemu_bin (str): path to the QEMU binary + """ + return 'hvf' in list_accel(qemu_bin)tests/functional/qemu_test/testcase.py +1
-1@@ -23,7 +23,7 @@ import uuid from qemu.machine import QEMUMachine -from qemu.utils import kvm_available, tcg_available +from qemu.utils import hvf_available, kvm_available, tcg_available from .archive import archive_extract from .asset import Asset
tests/functional/qemu_test/testcase.py def require_accelerator(self, accelerator): · line 325
Quoted 10 lines
tests/functional/qemu_test/testcase.py +3
-1@@ -317,7 +317,9 @@ def require_accelerator(self, accelerator): :type accelerator: str """ checker = {'tcg': tcg_available, - 'kvm': kvm_available}.get(accelerator) + 'kvm': kvm_available, + 'hvf': hvf_available, + }.get(accelerator) if checker is None: self.skipTest("Don't know how to check for the presence " "of accelerator %s" % accelerator)
PATCH v2 26/26 tests/functional: Expand Aarch64 SMMU tests to run on HVF accelerator
In reply to Philippe Mathieu-Daudé--- tests/functional/test_aarch64_smmu.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
tests/functional/test_aarch64_smmu.py +7 -2
@@ -22,6 +22,7 @@ class SMMU(LinuxKernelTest): + accel = 'kvm' default_kernel_params = ('earlyprintk=pl011,0x9000000 no_timer_check ' 'printk.time=1 rd_NO_PLYMOUTH net.ifnames=0 ' 'console=ttyAMA0 rd.rescue')
@@ -45,11 +46,11 @@ def set_up_boot(self, path): self.vm.add_args('-device', 'virtio-net,netdev=n1' + self.IOMMU_ADDON) def common_vm_setup(self, kernel, initrd, disk): - self.require_accelerator("kvm") + self.require_accelerator(self.accel) self.require_netdev('user') self.set_machine("virt") self.vm.add_args('-m', '1G') - self.vm.add_args("-accel", "kvm") + self.vm.add_args("-accel", self.accel) self.vm.add_args("-cpu", "host") self.vm.add_args("-machine", "iommu=smmuv3") self.vm.add_args("-d", "guest_errors")
@@ -201,5 +202,9 @@ def test_smmu_ril_nostrict(self): self.run_and_check(self.F33_FILENAME, self.F33_HSUM) +class SMMU_HVF(SMMU): + accel = 'hvf' + + if __name__ == '__main__': LinuxKernelTest.main()
Signature · 1 line
2.49.0
Re: [PATCH v2 26/26] tests/functional: Expand Aarch64 SMMU tests to run on HVF accelerator
Quoted 18 lines · Philippe Mathieu-Daudé
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- tests/functional/test_aarch64_smmu.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)tests/functional/test_aarch64_smmu.py +1
-0@@ -22,6 +22,7 @@ class SMMU(LinuxKernelTest): + accel = 'kvm' default_kernel_params = ('earlyprintk=pl011,0x9000000 no_timer_check ' 'printk.time=1 rd_NO_PLYMOUTH net.ifnames=0 ' 'console=ttyAMA0 rd.rescue')
tests/functional/test_aarch64_smmu.py def set_up_boot(self, path): · line 48
Quoted 3 lines
tests/functional/test_aarch64_smmu.py +0
-0@@ -45,11 +46,11 @@ def set_up_boot(self, path): self.vm.add_args('-device', 'virtio-net,netdev=n1' + self.IOMMU_ADDON) def common_vm_setup(self, kernel, initrd, disk):
Wouldn't it be more straight-forward to do something like this here:
if hvf_available():
accel = "hvf"
else:
accel = "kvm"
... IMHO that's nicer than duplicating the test classes below.
Thomas
Quoted 16 lines
tests/functional/test_aarch64_smmu.py +4
-2- self.require_accelerator("kvm") + self.require_accelerator(self.accel) self.require_netdev('user') self.set_machine("virt") self.vm.add_args('-m', '1G') - self.vm.add_args("-accel", "kvm") + self.vm.add_args("-accel", self.accel) self.vm.add_args("-cpu", "host") self.vm.add_args("-machine", "iommu=smmuv3") self.vm.add_args("-d", "guest_errors")@@ -201,5 +202,9 @@ def test_smmu_ril_nostrict(self): self.run_and_check(self.F33_FILENAME, self.F33_HSUM) +class SMMU_HVF(SMMU): + accel = 'hvf'
Re: [PATCH v2 26/26] tests/functional: Expand Aarch64 SMMU tests to run on HVF accelerator
Quoted 22 lines · Thomas Huth
Quoted 17 lines · Philippe Mathieu-Daudé
Signed-off-by Philippe Mathieu-Daudé <[email protected]>---
tests/functional/test_aarch64_smmu.py| 9 +++++++--1 file changed, 7 insertions(+), 2 deletions(-)tests/functional/test_aarch64_smmu.py +0
-0@@ -22,6 +22,7 @@class SMMU(LinuxKernelTest):
+ accel = 'kvm'
default_kernel_params= ('earlyprintk=pl011,0x9000000no_timer_check' 'printk.time=1rd_NO_PLYMOUTHnet.ifnames=0 ' 'console=ttyAMA0 rd.rescue')tests/functional/test_aarch64_smmu.py +0
-0@@ -45,11 +46,11 @@ def set_up_boot(self, path): self.vm.add_args('-device', 'virtio-net,netdev=n1' + self.IOMMU_ADDON)Quoted 1 line
def
common_vm_setup(self, kernel, initrd, disk):Wouldn't it be more straight-forward to do something like this here:
Quoted 6 lines
if
hvf_available():
accel = "hvf"
else:
accel = "kvm"... IMHO that's nicer than duplicating the test classes below.
Good idea, thank you :)