Re: [PATCH v6 17/21] KVM: arm64: Allow userspace to configure a guest's counter-timer offset
On Tue, 10 Aug 2021 18:55:12 +0100, Oliver Upton wrote: > > On Tue, Aug 10, 2021 at 3:56 AM Marc Zyngier wrote: > > > > On Wed, 04 Aug 2021 09:58:15 +0100, > > Oliver Upton wrote: [...] > > > diff --git a/include/clocksource/arm_arch_timer.h > > > b/include/clocksource/arm_arch_timer.h > > > index 73c7139c866f..7252ffa3d675 100644 > > > --- a/include/clocksource/arm_arch_timer.h > > > +++ b/include/clocksource/arm_arch_timer.h > > > @@ -21,6 +21,7 @@ > > > #define CNTHCTL_EVNTEN (1 << 2) > > > #define CNTHCTL_EVNTDIR (1 << 3) > > > #define CNTHCTL_EVNTI(0xF << 4) > > > +#define CNTHCTL_ECV (1 << 12) > > > > > > enum arch_timer_reg { > > > ARCH_TIMER_REG_CTRL, > > > > You also want to document that SCR_EL3.ECVEn has to be set to 1 for > > this to work (see Documentation/arm64/booting.txt). And if it isn't, > > the firmware better handle the CNTPOFF_EL2 traps correctly... > > I'll grab the popcorn now ;-) Adding docs for this, good idea. > > > What firmware did you use for this? I think we need to update the boot > > wrapper, but that's something that can be done in parallel. > > I had actually just done a direct boot from ARM-TF -> Linux, nothing > else in between. Ah, right. I tend to use the boot-wrapper[1] to build a single binary that contains the 'boot loader', DT and kernel. Using ATF is probably more representative of the final thing, but the boot-wrapper is dead easy to hack on... Thanks, M. [1] git://git.kernel.org/pub/scm/linux/kernel/git/mark/boot-wrapper-aarch64.git -- Without deviation from the norm, progress is not possible. ___ kvmarm mailing list kvmarm@lists.cs.columbia.edu https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
Re: [PATCH v6 17/21] KVM: arm64: Allow userspace to configure a guest's counter-timer offset
On Tue, Aug 10, 2021 at 3:56 AM Marc Zyngier wrote: > > On Wed, 04 Aug 2021 09:58:15 +0100, > Oliver Upton wrote: > > > > Presently, KVM provides no facilities for correctly migrating a guest > > that depends on the physical counter-timer. Whie most guests (barring > > nit: While Ack. > > > NV, of course) should not depend on the physical counter-timer, an > > operator may wish to provide a consistent view of the physical > > counter-timer across migrations. > > > > Provide userspace with a new vCPU attribute to modify the guest > > counter-timer offset. Unlike KVM_REG_ARM_TIMER_OFFSET, this attribute is > > hidden from the guest's architectural state. The value offsets *both* > > the virtual and physical counter-timer views for the guest. Only support > > this attribute on ECV systems as ECV is required for hardware offsetting > > of the physical counter-timer. > > > > Signed-off-by: Oliver Upton > > --- > > Documentation/virt/kvm/devices/vcpu.rst | 28 ++ > > arch/arm64/include/asm/kvm_asm.h| 2 + > > arch/arm64/include/asm/sysreg.h | 2 + > > arch/arm64/include/uapi/asm/kvm.h | 1 + > > arch/arm64/kvm/arch_timer.c | 122 +++- > > arch/arm64/kvm/hyp/nvhe/hyp-main.c | 6 ++ > > arch/arm64/kvm/hyp/nvhe/timer-sr.c | 5 + > > arch/arm64/kvm/hyp/vhe/timer-sr.c | 5 + > > include/clocksource/arm_arch_timer.h| 1 + > > 9 files changed, 169 insertions(+), 3 deletions(-) > > > > diff --git a/Documentation/virt/kvm/devices/vcpu.rst > > b/Documentation/virt/kvm/devices/vcpu.rst > > index 3b399d727c11..3ba35b9d9d03 100644 > > --- a/Documentation/virt/kvm/devices/vcpu.rst > > +++ b/Documentation/virt/kvm/devices/vcpu.rst > > @@ -139,6 +139,34 @@ configured values on other VCPUs. Userspace should > > configure the interrupt > > numbers on at least one VCPU after creating all VCPUs and before running > > any > > VCPUs. > > > > +2.2. ATTRIBUTE: KVM_ARM_VCPU_TIMER_OFFSET > > +- > > + > > +:Parameters: in kvm_device_attr.addr the address for the timer offset is a > > + pointer to a __u64 > > + > > +Returns: > > + > > + === == > > + -EFAULT Error reading/writing the provided > > + parameter address > > + -ENXIO Timer offsetting not implemented > > + === == > > + > > +Specifies the guest's counter-timer offset from the host's virtual counter. > > +The guest's physical counter value is then derived by the following > > +equation: > > + > > + guest_cntpct = host_cntvct - KVM_ARM_VCPU_TIMER_OFFSET > > + > > +The guest's virtual counter value is derived by the following equation: > > + > > + guest_cntvct = host_cntvct - KVM_REG_ARM_TIMER_OFFSET > > + - KVM_ARM_VCPU_TIMER_OFFSET > > + > > +KVM does not allow the use of varying offset values for different vCPUs; > > +the last written offset value will be broadcasted to all vCPUs in a VM. > > + > > 3. GROUP: KVM_ARM_VCPU_PVTIME_CTRL > > == > > > > diff --git a/arch/arm64/include/asm/kvm_asm.h > > b/arch/arm64/include/asm/kvm_asm.h > > index 9f0bf2109be7..ab1c8fdb0177 100644 > > --- a/arch/arm64/include/asm/kvm_asm.h > > +++ b/arch/arm64/include/asm/kvm_asm.h > > @@ -65,6 +65,7 @@ > > #define __KVM_HOST_SMCCC_FUNC___pkvm_prot_finalize 19 > > #define __KVM_HOST_SMCCC_FUNC___pkvm_mark_hyp20 > > #define __KVM_HOST_SMCCC_FUNC___kvm_adjust_pc21 > > +#define __KVM_HOST_SMCCC_FUNC___kvm_timer_set_cntpoff22 > > > > #ifndef __ASSEMBLY__ > > > > @@ -200,6 +201,7 @@ extern void __kvm_tlb_flush_vmid_ipa(struct kvm_s2_mmu > > *mmu, phys_addr_t ipa, > > extern void __kvm_tlb_flush_vmid(struct kvm_s2_mmu *mmu); > > > > extern void __kvm_timer_set_cntvoff(u64 cntvoff); > > +extern void __kvm_timer_set_cntpoff(u64 cntpoff); > > > > extern int __kvm_vcpu_run(struct kvm_vcpu *vcpu); > > > > diff --git a/arch/arm64/include/asm/sysreg.h > > b/arch/arm64/include/asm/sysreg.h > > index 4dfc44066dfb..c34672aa65b9 100644 > > --- a/arch/arm64/include/asm/sysreg.h > > +++ b/arch/arm64/include/asm/sysreg.h > > @@ -586,6 +586,8 @@ > > #define SYS_ICH_LR14_EL2 __SYS__LR8_EL2(6) > > #define SYS_ICH_LR15_EL2 __SYS__LR8_EL2(7) > > > > +#define SYS_CNTPOFF_EL2 sys_reg(3, 4, 14, 0, 6) > > + > > /* VHE encodings for architectural EL0/1 system registers */ > > #define SYS_SCTLR_EL12 sys_reg(3, 5, 1, 0, 0) > > #define SYS_CPACR_EL12 sys_reg(3, 5, 1, 0, 2) > > diff --git a/arch/arm64/include/uapi/asm/kvm.h > > b/arch/arm64/include/uapi/asm/kvm.h > > index 949a31bc10f0..15150f8224a1 100644 > > --- a/arch/arm64/include/uapi/asm/kvm.h > > +++ b/arch/arm64/include/uapi/asm/kvm.h > > @@ -366,6 +366,7 @@ struct kvm_arm_copy_mte_tags { >
Re: [PATCH v6 17/21] KVM: arm64: Allow userspace to configure a guest's counter-timer offset
On Wed, 04 Aug 2021 09:58:15 +0100, Oliver Upton wrote: > > Presently, KVM provides no facilities for correctly migrating a guest > that depends on the physical counter-timer. Whie most guests (barring nit: While > NV, of course) should not depend on the physical counter-timer, an > operator may wish to provide a consistent view of the physical > counter-timer across migrations. > > Provide userspace with a new vCPU attribute to modify the guest > counter-timer offset. Unlike KVM_REG_ARM_TIMER_OFFSET, this attribute is > hidden from the guest's architectural state. The value offsets *both* > the virtual and physical counter-timer views for the guest. Only support > this attribute on ECV systems as ECV is required for hardware offsetting > of the physical counter-timer. > > Signed-off-by: Oliver Upton > --- > Documentation/virt/kvm/devices/vcpu.rst | 28 ++ > arch/arm64/include/asm/kvm_asm.h| 2 + > arch/arm64/include/asm/sysreg.h | 2 + > arch/arm64/include/uapi/asm/kvm.h | 1 + > arch/arm64/kvm/arch_timer.c | 122 +++- > arch/arm64/kvm/hyp/nvhe/hyp-main.c | 6 ++ > arch/arm64/kvm/hyp/nvhe/timer-sr.c | 5 + > arch/arm64/kvm/hyp/vhe/timer-sr.c | 5 + > include/clocksource/arm_arch_timer.h| 1 + > 9 files changed, 169 insertions(+), 3 deletions(-) > > diff --git a/Documentation/virt/kvm/devices/vcpu.rst > b/Documentation/virt/kvm/devices/vcpu.rst > index 3b399d727c11..3ba35b9d9d03 100644 > --- a/Documentation/virt/kvm/devices/vcpu.rst > +++ b/Documentation/virt/kvm/devices/vcpu.rst > @@ -139,6 +139,34 @@ configured values on other VCPUs. Userspace should > configure the interrupt > numbers on at least one VCPU after creating all VCPUs and before running any > VCPUs. > > +2.2. ATTRIBUTE: KVM_ARM_VCPU_TIMER_OFFSET > +- > + > +:Parameters: in kvm_device_attr.addr the address for the timer offset is a > + pointer to a __u64 > + > +Returns: > + > + === == > + -EFAULT Error reading/writing the provided > + parameter address > + -ENXIO Timer offsetting not implemented > + === == > + > +Specifies the guest's counter-timer offset from the host's virtual counter. > +The guest's physical counter value is then derived by the following > +equation: > + > + guest_cntpct = host_cntvct - KVM_ARM_VCPU_TIMER_OFFSET > + > +The guest's virtual counter value is derived by the following equation: > + > + guest_cntvct = host_cntvct - KVM_REG_ARM_TIMER_OFFSET > + - KVM_ARM_VCPU_TIMER_OFFSET > + > +KVM does not allow the use of varying offset values for different vCPUs; > +the last written offset value will be broadcasted to all vCPUs in a VM. > + > 3. GROUP: KVM_ARM_VCPU_PVTIME_CTRL > == > > diff --git a/arch/arm64/include/asm/kvm_asm.h > b/arch/arm64/include/asm/kvm_asm.h > index 9f0bf2109be7..ab1c8fdb0177 100644 > --- a/arch/arm64/include/asm/kvm_asm.h > +++ b/arch/arm64/include/asm/kvm_asm.h > @@ -65,6 +65,7 @@ > #define __KVM_HOST_SMCCC_FUNC___pkvm_prot_finalize 19 > #define __KVM_HOST_SMCCC_FUNC___pkvm_mark_hyp20 > #define __KVM_HOST_SMCCC_FUNC___kvm_adjust_pc21 > +#define __KVM_HOST_SMCCC_FUNC___kvm_timer_set_cntpoff22 > > #ifndef __ASSEMBLY__ > > @@ -200,6 +201,7 @@ extern void __kvm_tlb_flush_vmid_ipa(struct kvm_s2_mmu > *mmu, phys_addr_t ipa, > extern void __kvm_tlb_flush_vmid(struct kvm_s2_mmu *mmu); > > extern void __kvm_timer_set_cntvoff(u64 cntvoff); > +extern void __kvm_timer_set_cntpoff(u64 cntpoff); > > extern int __kvm_vcpu_run(struct kvm_vcpu *vcpu); > > diff --git a/arch/arm64/include/asm/sysreg.h b/arch/arm64/include/asm/sysreg.h > index 4dfc44066dfb..c34672aa65b9 100644 > --- a/arch/arm64/include/asm/sysreg.h > +++ b/arch/arm64/include/asm/sysreg.h > @@ -586,6 +586,8 @@ > #define SYS_ICH_LR14_EL2 __SYS__LR8_EL2(6) > #define SYS_ICH_LR15_EL2 __SYS__LR8_EL2(7) > > +#define SYS_CNTPOFF_EL2 sys_reg(3, 4, 14, 0, 6) > + > /* VHE encodings for architectural EL0/1 system registers */ > #define SYS_SCTLR_EL12 sys_reg(3, 5, 1, 0, 0) > #define SYS_CPACR_EL12 sys_reg(3, 5, 1, 0, 2) > diff --git a/arch/arm64/include/uapi/asm/kvm.h > b/arch/arm64/include/uapi/asm/kvm.h > index 949a31bc10f0..15150f8224a1 100644 > --- a/arch/arm64/include/uapi/asm/kvm.h > +++ b/arch/arm64/include/uapi/asm/kvm.h > @@ -366,6 +366,7 @@ struct kvm_arm_copy_mte_tags { > #define KVM_ARM_VCPU_TIMER_CTRL 1 > #define KVM_ARM_VCPU_TIMER_IRQ_VTIMER 0 > #define KVM_ARM_VCPU_TIMER_IRQ_PTIMER 1 > +#define KVM_ARM_VCPU_TIMER_OFFSET 2 > #define KVM_ARM_VCPU_PVTIME_CTRL 2 > #define
Re: [PATCH v6 17/21] KVM: arm64: Allow userspace to configure a guest's counter-timer offset
On Wed, Aug 4, 2021 at 3:17 AM Andrew Jones wrote: > > diff --git a/arch/arm64/kvm/arch_timer.c b/arch/arm64/kvm/arch_timer.c > > index a8815b09da3e..f15058612994 100644 > > --- a/arch/arm64/kvm/arch_timer.c > > +++ b/arch/arm64/kvm/arch_timer.c > > @@ -85,11 +85,15 @@ u64 timer_get_cval(struct arch_timer_context *ctxt) > > static u64 timer_get_offset(struct arch_timer_context *ctxt) > > { > > struct kvm_vcpu *vcpu = ctxt->vcpu; > > + struct arch_timer_cpu *timer = vcpu_timer(vcpu); > > This new timer variable doesn't appear to get used. Ooops, this is stale. Thanks for catching that. > > Reviewed-by: Andrew Jones > Thanks for the quick review! -- Oliver ___ kvmarm mailing list kvmarm@lists.cs.columbia.edu https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
[PATCH v6 17/21] KVM: arm64: Allow userspace to configure a guest's counter-timer offset
Presently, KVM provides no facilities for correctly migrating a guest that depends on the physical counter-timer. Whie most guests (barring NV, of course) should not depend on the physical counter-timer, an operator may wish to provide a consistent view of the physical counter-timer across migrations. Provide userspace with a new vCPU attribute to modify the guest counter-timer offset. Unlike KVM_REG_ARM_TIMER_OFFSET, this attribute is hidden from the guest's architectural state. The value offsets *both* the virtual and physical counter-timer views for the guest. Only support this attribute on ECV systems as ECV is required for hardware offsetting of the physical counter-timer. Signed-off-by: Oliver Upton --- Documentation/virt/kvm/devices/vcpu.rst | 28 ++ arch/arm64/include/asm/kvm_asm.h| 2 + arch/arm64/include/asm/sysreg.h | 2 + arch/arm64/include/uapi/asm/kvm.h | 1 + arch/arm64/kvm/arch_timer.c | 122 +++- arch/arm64/kvm/hyp/nvhe/hyp-main.c | 6 ++ arch/arm64/kvm/hyp/nvhe/timer-sr.c | 5 + arch/arm64/kvm/hyp/vhe/timer-sr.c | 5 + include/clocksource/arm_arch_timer.h| 1 + 9 files changed, 169 insertions(+), 3 deletions(-) diff --git a/Documentation/virt/kvm/devices/vcpu.rst b/Documentation/virt/kvm/devices/vcpu.rst index 3b399d727c11..3ba35b9d9d03 100644 --- a/Documentation/virt/kvm/devices/vcpu.rst +++ b/Documentation/virt/kvm/devices/vcpu.rst @@ -139,6 +139,34 @@ configured values on other VCPUs. Userspace should configure the interrupt numbers on at least one VCPU after creating all VCPUs and before running any VCPUs. +2.2. ATTRIBUTE: KVM_ARM_VCPU_TIMER_OFFSET +- + +:Parameters: in kvm_device_attr.addr the address for the timer offset is a + pointer to a __u64 + +Returns: + +=== == +-EFAULT Error reading/writing the provided +parameter address +-ENXIO Timer offsetting not implemented +=== == + +Specifies the guest's counter-timer offset from the host's virtual counter. +The guest's physical counter value is then derived by the following +equation: + + guest_cntpct = host_cntvct - KVM_ARM_VCPU_TIMER_OFFSET + +The guest's virtual counter value is derived by the following equation: + + guest_cntvct = host_cntvct - KVM_REG_ARM_TIMER_OFFSET + - KVM_ARM_VCPU_TIMER_OFFSET + +KVM does not allow the use of varying offset values for different vCPUs; +the last written offset value will be broadcasted to all vCPUs in a VM. + 3. GROUP: KVM_ARM_VCPU_PVTIME_CTRL == diff --git a/arch/arm64/include/asm/kvm_asm.h b/arch/arm64/include/asm/kvm_asm.h index 9f0bf2109be7..ab1c8fdb0177 100644 --- a/arch/arm64/include/asm/kvm_asm.h +++ b/arch/arm64/include/asm/kvm_asm.h @@ -65,6 +65,7 @@ #define __KVM_HOST_SMCCC_FUNC___pkvm_prot_finalize 19 #define __KVM_HOST_SMCCC_FUNC___pkvm_mark_hyp 20 #define __KVM_HOST_SMCCC_FUNC___kvm_adjust_pc 21 +#define __KVM_HOST_SMCCC_FUNC___kvm_timer_set_cntpoff 22 #ifndef __ASSEMBLY__ @@ -200,6 +201,7 @@ extern void __kvm_tlb_flush_vmid_ipa(struct kvm_s2_mmu *mmu, phys_addr_t ipa, extern void __kvm_tlb_flush_vmid(struct kvm_s2_mmu *mmu); extern void __kvm_timer_set_cntvoff(u64 cntvoff); +extern void __kvm_timer_set_cntpoff(u64 cntpoff); extern int __kvm_vcpu_run(struct kvm_vcpu *vcpu); diff --git a/arch/arm64/include/asm/sysreg.h b/arch/arm64/include/asm/sysreg.h index 4dfc44066dfb..c34672aa65b9 100644 --- a/arch/arm64/include/asm/sysreg.h +++ b/arch/arm64/include/asm/sysreg.h @@ -586,6 +586,8 @@ #define SYS_ICH_LR14_EL2 __SYS__LR8_EL2(6) #define SYS_ICH_LR15_EL2 __SYS__LR8_EL2(7) +#define SYS_CNTPOFF_EL2sys_reg(3, 4, 14, 0, 6) + /* VHE encodings for architectural EL0/1 system registers */ #define SYS_SCTLR_EL12 sys_reg(3, 5, 1, 0, 0) #define SYS_CPACR_EL12 sys_reg(3, 5, 1, 0, 2) diff --git a/arch/arm64/include/uapi/asm/kvm.h b/arch/arm64/include/uapi/asm/kvm.h index 949a31bc10f0..15150f8224a1 100644 --- a/arch/arm64/include/uapi/asm/kvm.h +++ b/arch/arm64/include/uapi/asm/kvm.h @@ -366,6 +366,7 @@ struct kvm_arm_copy_mte_tags { #define KVM_ARM_VCPU_TIMER_CTRL1 #define KVM_ARM_VCPU_TIMER_IRQ_VTIMER0 #define KVM_ARM_VCPU_TIMER_IRQ_PTIMER1 +#define KVM_ARM_VCPU_TIMER_OFFSET2 #define KVM_ARM_VCPU_PVTIME_CTRL 2 #define KVM_ARM_VCPU_PVTIME_IPA 0 diff --git a/arch/arm64/kvm/arch_timer.c b/arch/arm64/kvm/arch_timer.c index a8815b09da3e..f15058612994 100644 --- a/arch/arm64/kvm/arch_timer.c +++ b/arch/arm64/kvm/arch_timer.c @@ -85,11 +85,15 @@ u64 timer_get_cval(struct arch_timer_context *ctxt) static u64
Re: [PATCH v6 17/21] KVM: arm64: Allow userspace to configure a guest's counter-timer offset
On Wed, Aug 04, 2021 at 08:58:15AM +, Oliver Upton wrote: > Presently, KVM provides no facilities for correctly migrating a guest > that depends on the physical counter-timer. Whie most guests (barring > NV, of course) should not depend on the physical counter-timer, an > operator may wish to provide a consistent view of the physical > counter-timer across migrations. > > Provide userspace with a new vCPU attribute to modify the guest > counter-timer offset. Unlike KVM_REG_ARM_TIMER_OFFSET, this attribute is > hidden from the guest's architectural state. The value offsets *both* > the virtual and physical counter-timer views for the guest. Only support > this attribute on ECV systems as ECV is required for hardware offsetting > of the physical counter-timer. > > Signed-off-by: Oliver Upton > --- > Documentation/virt/kvm/devices/vcpu.rst | 28 ++ > arch/arm64/include/asm/kvm_asm.h| 2 + > arch/arm64/include/asm/sysreg.h | 2 + > arch/arm64/include/uapi/asm/kvm.h | 1 + > arch/arm64/kvm/arch_timer.c | 122 +++- > arch/arm64/kvm/hyp/nvhe/hyp-main.c | 6 ++ > arch/arm64/kvm/hyp/nvhe/timer-sr.c | 5 + > arch/arm64/kvm/hyp/vhe/timer-sr.c | 5 + > include/clocksource/arm_arch_timer.h| 1 + > 9 files changed, 169 insertions(+), 3 deletions(-) > > diff --git a/Documentation/virt/kvm/devices/vcpu.rst > b/Documentation/virt/kvm/devices/vcpu.rst > index 3b399d727c11..3ba35b9d9d03 100644 > --- a/Documentation/virt/kvm/devices/vcpu.rst > +++ b/Documentation/virt/kvm/devices/vcpu.rst > @@ -139,6 +139,34 @@ configured values on other VCPUs. Userspace should > configure the interrupt > numbers on at least one VCPU after creating all VCPUs and before running any > VCPUs. > > +2.2. ATTRIBUTE: KVM_ARM_VCPU_TIMER_OFFSET > +- > + > +:Parameters: in kvm_device_attr.addr the address for the timer offset is a > + pointer to a __u64 > + > +Returns: > + > + === == > + -EFAULT Error reading/writing the provided > + parameter address > + -ENXIO Timer offsetting not implemented > + === == > + > +Specifies the guest's counter-timer offset from the host's virtual counter. > +The guest's physical counter value is then derived by the following > +equation: > + > + guest_cntpct = host_cntvct - KVM_ARM_VCPU_TIMER_OFFSET > + > +The guest's virtual counter value is derived by the following equation: > + > + guest_cntvct = host_cntvct - KVM_REG_ARM_TIMER_OFFSET > + - KVM_ARM_VCPU_TIMER_OFFSET > + > +KVM does not allow the use of varying offset values for different vCPUs; > +the last written offset value will be broadcasted to all vCPUs in a VM. > + > 3. GROUP: KVM_ARM_VCPU_PVTIME_CTRL > == > > diff --git a/arch/arm64/include/asm/kvm_asm.h > b/arch/arm64/include/asm/kvm_asm.h > index 9f0bf2109be7..ab1c8fdb0177 100644 > --- a/arch/arm64/include/asm/kvm_asm.h > +++ b/arch/arm64/include/asm/kvm_asm.h > @@ -65,6 +65,7 @@ > #define __KVM_HOST_SMCCC_FUNC___pkvm_prot_finalize 19 > #define __KVM_HOST_SMCCC_FUNC___pkvm_mark_hyp20 > #define __KVM_HOST_SMCCC_FUNC___kvm_adjust_pc21 > +#define __KVM_HOST_SMCCC_FUNC___kvm_timer_set_cntpoff22 > > #ifndef __ASSEMBLY__ > > @@ -200,6 +201,7 @@ extern void __kvm_tlb_flush_vmid_ipa(struct kvm_s2_mmu > *mmu, phys_addr_t ipa, > extern void __kvm_tlb_flush_vmid(struct kvm_s2_mmu *mmu); > > extern void __kvm_timer_set_cntvoff(u64 cntvoff); > +extern void __kvm_timer_set_cntpoff(u64 cntpoff); > > extern int __kvm_vcpu_run(struct kvm_vcpu *vcpu); > > diff --git a/arch/arm64/include/asm/sysreg.h b/arch/arm64/include/asm/sysreg.h > index 4dfc44066dfb..c34672aa65b9 100644 > --- a/arch/arm64/include/asm/sysreg.h > +++ b/arch/arm64/include/asm/sysreg.h > @@ -586,6 +586,8 @@ > #define SYS_ICH_LR14_EL2 __SYS__LR8_EL2(6) > #define SYS_ICH_LR15_EL2 __SYS__LR8_EL2(7) > > +#define SYS_CNTPOFF_EL2 sys_reg(3, 4, 14, 0, 6) > + > /* VHE encodings for architectural EL0/1 system registers */ > #define SYS_SCTLR_EL12 sys_reg(3, 5, 1, 0, 0) > #define SYS_CPACR_EL12 sys_reg(3, 5, 1, 0, 2) > diff --git a/arch/arm64/include/uapi/asm/kvm.h > b/arch/arm64/include/uapi/asm/kvm.h > index 949a31bc10f0..15150f8224a1 100644 > --- a/arch/arm64/include/uapi/asm/kvm.h > +++ b/arch/arm64/include/uapi/asm/kvm.h > @@ -366,6 +366,7 @@ struct kvm_arm_copy_mte_tags { > #define KVM_ARM_VCPU_TIMER_CTRL 1 > #define KVM_ARM_VCPU_TIMER_IRQ_VTIMER 0 > #define KVM_ARM_VCPU_TIMER_IRQ_PTIMER 1 > +#define KVM_ARM_VCPU_TIMER_OFFSET 2 > #define KVM_ARM_VCPU_PVTIME_CTRL 2 > #define