RE: [PATCH 47/56] KVM: arm64: timers: Move timer registers to the sys_regs file
From: Jianyong Wu <hidden>
Date: 2020-08-19 13:00:57
Also in:
kvm, kvmarm
-----Original Message----- From: Marc Zyngier <maz@kernel.org> Sent: Wednesday, August 19, 2020 6:39 PM To: Jianyong Wu <redacted> Cc: Paolo Bonzini <pbonzini@redhat.com>; Peng Hao [off-list ref]; kernel-team@android.com; kvm@vger.kernel.org; Will Deacon [off-list ref]; Catalin Marinas [off-list ref]; Alexander Graf [off-list ref]; kvmarm@lists.cs.columbia.edu; linux- arm-kernel@lists.infradead.org Subject: Re: [PATCH 47/56] KVM: arm64: timers: Move timer registers to the sys_regs file On 2020-08-19 11:18, Jianyong Wu wrote:quoted
quoted
-----Original Message----- From: Marc Zyngier <maz@kernel.org> Sent: Wednesday, August 19, 2020 6:00 PM To: Jianyong Wu <redacted> Cc: Paolo Bonzini <pbonzini@redhat.com>; Peng Hao [off-list ref]; kernel-team@android.com; kvm@vger.kernel.org; Will Deacon [off-list ref]; Catalin Marinas [off-list ref]; Alexander Graf [off-list ref]; kvmarm@lists.cs.columbia.edu; linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH 47/56] KVM: arm64: timers: Move timer registers to the sys_regs file On 2020-08-19 10:24, Jianyong Wu wrote:quoted
Hi Marc, -----Original Message----- From: kvmarm-bounces@lists.cs.columbia.edu [off-list ref] On Behalf Of Marc Zyngier Sent: Thursday, August 6, 2020 1:57 AM To: Paolo Bonzini <pbonzini@redhat.com> Cc: Peng Hao <redacted>; kernel-team@android.com; kvm@vger.kernel.org; Will Deacon [off-list ref]; Catalin Marinas [off-list ref]; Alexander Graf [off-list ref]; kvmarm@lists.cs.columbia.edu; linux-arm-kernel@lists.infradead.org Subject: [PATCH 47/56] KVM: arm64: timers: Move timer registers to the sys_regs file Move the timer gsisters to the sysreg file. This will further help when they are directly changed by a nesting hypervisor in the VNCR page. This requires moving the initialisation of the timer struct so that some of the helpers (such as arch_timer_ctx_index) can work correctly at an early stage. Signed-off-by: Marc Zyngier <maz@kernel.org> --- arch/arm64/include/asm/kvm_host.h | 6 ++ arch/arm64/kvm/arch_timer.c | 155 +++++++++++++++++++++++------- arch/arm64/kvm/trace_arm.h | 8 +- include/kvm/arm_arch_timer.h | 11 +-- 4 files changed, 136 insertions(+), 44 deletions(-) +static u64 timer_get_offset(struct arch_timer_context *ctxt) { + struct kvm_vcpu *vcpu = ctxt->vcpu; + + switch(arch_timer_ctx_index(ctxt)) { + case TIMER_VTIMER: + return __vcpu_sys_reg(vcpu, CNTVOFF_EL2); + default: + return 0; + } +} + Can I export this helper? As in my ptp_kvm implementation I need get VCNT offset value separately not just give me a result of VCNT.Sorry, you need to give me a bit more context. What do you need the offset for exactly?Yeah, In my ptp_kvm implementation, I need acquire wall time and counter cycle in the same time in host. After get host counter cycle, I need subtract it by VCNT offset to obtain VCNT. See https://lkml.org/lkml/2020/6/19/441 https://lkml.org/lkml/2020/6/19/441 But now I can't get the VCNT offset easily like before using " vcpu_vtimer(vcpu)->cntvoff" and I can't use the helper like "kvm_arm_timer_read" as I need acquire the counter cycle in the same time with the host wall time.I must be missing something. CNTVOFF_EL2 is now implemented as a standard system register, and has the same visibility as any other vcpu sysreg. Why doesn't vcpu_read_sys_reg(vcpu, CNTVOFF_EL2) work for you?
Maybe it serves me, let me try it, thanks. Thanks Jianyong
M.
--
Jazz is not dead. It just smells funny..._______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel