lkml.org 
[lkml]   [2019]   [Jul]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [RFC PATCH 07/16] RISC-V: KVM: Implement VCPU world-switch
From
Date
On 29/07/19 13:57, Anup Patel wrote:
> void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
> {
> - /* TODO: */
> + struct kvm_vcpu_csr *csr = &vcpu->arch.guest_csr;
> +
> + csr_write(CSR_HIDELEG, csr->hideleg);
> + csr_write(CSR_HEDELEG, csr->hedeleg);

Writing HIDELEG and HEDELEG here seems either wrong or inefficient to me.

I don't remember the spec well enough, but there are two cases:

1) either they only matter while the guest runs and then you can set
them in kvm_arch_hardware_enable. KVM common code takes care of doing
this on all CPUs for you.

2) or they also matter while the host runs and then you need to set them
in vcpu_switch.S.

Paolo

\
 
 \ /
  Last update: 2019-07-30 11:35    [W:0.308 / U:0.140 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site