On 07-02-2025 10:16 pm, Ganapatrao Kulkarni wrote:
On 07-02-2025 07:29 pm, Marc Zyngier wrote:
On Fri, 07 Feb 2025 13:26:41 +0000, Ganapatrao Kulkarni gankulkarni@os.amperecomputing.com wrote:
+ if (is_vcpu_nested(vcpu)) { + vcpu_set_reg(vcpu, KVM_ARM64_SYS_REG(SYS_CPTR_EL2), fpen); + vcpu_set_reg(vcpu, KVM_ARM64_SYS_REG(SYS_SCTLR_EL2), sctlr_el1); + vcpu_set_reg(vcpu, KVM_ARM64_SYS_REG(SYS_TCR_EL2), tcr_el1); + vcpu_set_reg(vcpu, KVM_ARM64_SYS_REG(SYS_MAIR_EL2), DEFAULT_MAIR_EL1); + vcpu_set_reg(vcpu, KVM_ARM64_SYS_REG(SYS_TTBR0_EL2), ttbr0_el1); + vcpu_set_reg(vcpu, KVM_ARM64_SYS_REG(SYS_TPIDR_EL2), vcpu-
id);
How about some of the basics such as HCR_EL2, MDCR_EL2? A bunch of things there do have an impact on how the guest behaves, and relying on defaults feels like a bad idea.
Sure, I will try to have these registers also set to required value explicitly.
This also assumes VHE, without trying to enforce it.
Ok, I will try to set specific bits of HCR_EL2 to force it run in VHE.
Finally, how to you plan to make all the existing tests run as EL2 guests if TPIDR_EL1 isn't populated with the expected value? Surely you need to change the read side...
IIUC, we need not write to TPIDR_EL2, instead write always to TPIDR_EL1 and in guest code(like function cpu_copy_el2regs in Linux kernel) copy TPIDR_EL1 value to TPIDR_EL2.
OR, Write to both TPIDR_EL1 and TPIDR_EL2 in the test code itself during vcpu setup.