[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJhGHyBBnhaVRNHdot9j9o8QN_GJ2G0jjiPtpqd=Gmdm=OTf4g@mail.gmail.com>
Date: Mon, 23 Sep 2024 05:56:02 +0800
From: Lai Jiangshan <jiangshanlai@...il.com>
To: Melody Wang <huibo.wang@....com>
Cc: kvm@...r.kernel.org, linux-kernel@...r.kernel.org, x86@...nel.org,
Sean Christopherson <seanjc@...gle.com>, Paolo Bonzini <pbonzini@...hat.com>,
Tom Lendacky <thomas.lendacky@....com>, Ashish Kalra <ashish.kalra@....com>,
Michael Roth <michael.roth@....com>
Subject: Re: [PATCH v2 3/6] KVM: SVM: Inject #HV when restricted injection is active
Hello
On Tue, Sep 10, 2024 at 2:05 PM Melody Wang <huibo.wang@....com> wrote:
> +static bool __sev_snp_inject(enum inject_type type, struct kvm_vcpu *vcpu)
> +{
> + struct vcpu_svm *svm = to_svm(vcpu);
> + struct kvm_host_map hvdb_map;
> + struct hvdb *hvdb;
> +
> + hvdb = map_hvdb(vcpu, &hvdb_map);
> + if (!hvdb)
> + return false;
old_vector = hvdb->events.vector;
> +
> + hvdb->events.vector = vcpu->arch.interrupt.nr;
> +
> + prepare_hv_injection(svm, hvdb);
The specification recommends saving an HV injection on the following condition:
if (!(type == INJECT_IRQ && old_vector))
prepare_hv_injection(svm, hvdb)
If PendingEvent.Vector was previously non-zero, because the guest has
not yet chosen to acknowledge the interrupt, the previous vector
number can be overwritten by the new vector number without sending
another #HV (regardless of the value of PendingEvent.NoFurtherSignal),
because the guest should already have been informed that a vector was
pending.
> +
> + unmap_hvdb(vcpu, &hvdb_map);
> +
> + return true;
> +}
> +
Powered by blists - more mailing lists