Thread (139 messages) 139 messages, 5 authors, 2022-01-27

Re: [PATCH v5 31/69] KVM: arm64: nv: Respect the virtual HCR_EL2.NV1 bit setting

From: Marc Zyngier <maz@kernel.org>
Date: 2021-12-20 09:41:23
Also in: kvm, kvmarm

On Mon, 20 Dec 2021 07:18:51 +0000,
Ganapatrao Kulkarni [off-list ref] wrote:


On 30-11-2021 01:31 am, Marc Zyngier wrote:
quoted
From: Jintack Lim <redacted>

Forward ELR_EL1, SPSR_EL1 and VBAR_EL1 traps to the virtual EL2 if the
virtual HCR_EL2.NV bit is set.

This is for recursive nested virtualization.

Signed-off-by: Jintack Lim <redacted>
Signed-off-by: Marc Zyngier <maz@kernel.org>
---
  arch/arm64/include/asm/kvm_arm.h |  1 +
  arch/arm64/kvm/sys_regs.c        | 28 +++++++++++++++++++++++++++-
  2 files changed, 28 insertions(+), 1 deletion(-)
diff --git a/arch/arm64/include/asm/kvm_arm.h b/arch/arm64/include/asm/kvm_arm.h
index 9759bc893a51..68af5509e4b0 100644
--- a/arch/arm64/include/asm/kvm_arm.h
+++ b/arch/arm64/include/asm/kvm_arm.h
@@ -20,6 +20,7 @@
  #define HCR_AMVOFFEN	(UL(1) << 51)
  #define HCR_FIEN	(UL(1) << 47)
  #define HCR_FWB		(UL(1) << 46)
+#define HCR_NV1		(UL(1) << 43)
  #define HCR_NV		(UL(1) << 42)
  #define HCR_API		(UL(1) << 41)
  #define HCR_APK		(UL(1) << 40)
diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c
index e96877fc3b2a..511e06b6f603 100644
--- a/arch/arm64/kvm/sys_regs.c
+++ b/arch/arm64/kvm/sys_regs.c
@@ -288,6 +288,22 @@ static bool access_rw(struct kvm_vcpu *vcpu,
  	return true;
  }
  +/* This function is to support the recursive nested
virtualization */
+static bool forward_nv1_traps(struct kvm_vcpu *vcpu, struct sys_reg_params *p)
+{
+	return forward_traps(vcpu, HCR_NV1);
+}
+
Shall we move this helper to emulate-nested.c?
Sure, that shouldn't be a problem.

	M.

-- 
Without deviation from the norm, progress is not possible.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help