Skip to content

Commit 83df1d6

Browse files
committed
RISC-V: KVM: Set initial value of hedeleg in kvm_arch_vcpu_create()
The hedeleg may be updated by ONE_REG interface before the VCPU is run at least once hence set the initial value of hedeleg in kvm_arch_vcpu_create() instead of kvm_riscv_vcpu_setup_config(). Signed-off-by: Anup Patel <apatel@ventanamicro.com> Reviewed-by: Andrew Jones <ajones@ventanamicro.com> Reviewed-by: Nutty Liu <nutty.liu@hotmail.com> Link: https://lore.kernel.org/r/20250823155947.1354229-2-apatel@ventanamicro.com Signed-off-by: Anup Patel <anup@brainfault.org>
1 parent b8d1394 commit 83df1d6

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

arch/riscv/kvm/vcpu.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,8 @@ int kvm_arch_vcpu_create(struct kvm_vcpu *vcpu)
133133

134134
/* Mark this VCPU never ran */
135135
vcpu->arch.ran_atleast_once = false;
136+
137+
vcpu->arch.cfg.hedeleg = KVM_HEDELEG_DEFAULT;
136138
vcpu->arch.mmu_page_cache.gfp_zero = __GFP_ZERO;
137139
bitmap_zero(vcpu->arch.isa, RISCV_ISA_EXT_MAX);
138140

@@ -570,7 +572,6 @@ static void kvm_riscv_vcpu_setup_config(struct kvm_vcpu *vcpu)
570572
cfg->hstateen0 |= SMSTATEEN0_SSTATEEN0;
571573
}
572574

573-
cfg->hedeleg = KVM_HEDELEG_DEFAULT;
574575
if (vcpu->guest_debug)
575576
cfg->hedeleg &= ~BIT(EXC_BREAKPOINT);
576577
}

0 commit comments

Comments
 (0)