[PATCH 15/18] KVM: riscv: set HSTATUS big endian same as build
Ben Dooks
ben.dooks at codethink.co.uk
Fri Aug 22 09:52:45 PDT 2025
Start the guest in the same endian as the host.
Signed-off-by: Ben Dooks <ben.dooks at codethink.co.uk>
---
arch/riscv/kvm/vcpu.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/arch/riscv/kvm/vcpu.c b/arch/riscv/kvm/vcpu.c
index f001e56403f9..b47f12792f9d 100644
--- a/arch/riscv/kvm/vcpu.c
+++ b/arch/riscv/kvm/vcpu.c
@@ -75,6 +75,10 @@ static void kvm_riscv_vcpu_context_reset(struct kvm_vcpu *vcpu,
cntx->hstatus |= HSTATUS_VTW;
cntx->hstatus |= HSTATUS_SPVP;
cntx->hstatus |= HSTATUS_SPV;
+
+ /* If configured big-endian, start guest in big endian */
+ if (IS_ENABLED(CONFIG_CPU_BIG_ENDIAN))
+ cntx->hstatus |= HSTATUS_VSBE;
}
static void kvm_riscv_reset_vcpu(struct kvm_vcpu *vcpu, bool kvm_sbi_reset)
--
2.37.2.352.g3c44437643
More information about the linux-riscv
mailing list