From: "Suthikulpanit, Suravee" <suravee.suthikulpanit@amd.com>
To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, x86@kernel.org
Cc: seanjc@google.com, mlevitsk@redhat.com, pbonzini@redhat.com,
joro@8bytes.org, tglx@linutronix.de, mingo@redhat.com,
bp@alien8.de, peterz@infradead.org, hpa@zytor.com,
jon.grimm@amd.com
Subject: Re: [PATCH v4 1/3] KVM: SVM: Only call vcpu_(un)blocking when AVIC is enabled.
Date: Wed, 2 Feb 2022 13:26:08 +0700 [thread overview]
Message-ID: <b9fc1081-98b8-64e8-b4a6-fdd5809c1255@amd.com> (raw)
In-Reply-To: <20220202041112.273017-2-suravee.suthikulpanit@amd.com>
On 2/2/2022 11:11 AM, Suravee Suthikulpanit wrote:
> The kvm_x86_ops.vcpu_(un)blocking are needed by AVIC only.
> Therefore, set the ops only when AVIC is enabled.
>
> Also, refactor AVIC hardware setup logic into helper function
> To prepare for upcoming AVIC changes.
>
> Suggested-by: Sean Christopherson <seanjc@google.com>
> Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
> ---
> arch/x86/kvm/svm/avic.c | 17 +++++++++++++++--
> arch/x86/kvm/svm/svm.c | 10 ++--------
> arch/x86/kvm/svm/svm.h | 3 +--
> 3 files changed, 18 insertions(+), 12 deletions(-)
>
> diff --git a/arch/x86/kvm/svm/avic.c b/arch/x86/kvm/svm/avic.c
> index 90364d02f22a..f5c6cab42d74 100644
> --- a/arch/x86/kvm/svm/avic.c
> +++ b/arch/x86/kvm/svm/avic.c
> @@ -1027,7 +1027,7 @@ void avic_vcpu_put(struct kvm_vcpu *vcpu)
> WRITE_ONCE(*(svm->avic_physical_id_cache), entry);
> }
>
> -void avic_vcpu_blocking(struct kvm_vcpu *vcpu)
> +static void avic_vcpu_blocking(struct kvm_vcpu *vcpu)
> {
> if (!kvm_vcpu_apicv_active(vcpu))
> return;
> @@ -1052,7 +1052,7 @@ void avic_vcpu_blocking(struct kvm_vcpu *vcpu)
> preempt_enable();
> }
>
> -void avic_vcpu_unblocking(struct kvm_vcpu *vcpu)
> +static void avic_vcpu_unblocking(struct kvm_vcpu *vcpu)
> {
> int cpu;
>
> @@ -1066,3 +1066,16 @@ void avic_vcpu_unblocking(struct kvm_vcpu *vcpu)
>
> put_cpu();
> }
> +
> +bool avic_hardware_setup(struct kvm_x86_ops *x86_ops)
> +{
> + if (!npt_enabled || !boot_cpu_has(X86_FEATURE_AVIC))
> + return false;
> +
> + x86_ops->vcpu_blocking = avic_vcpu_blocking,
> + x86_ops->vcpu_unblocking = avic_vcpu_unblocking,
Sorry for confusion, I made a mistake during patch re basing. I'll send out V5.
Suravee
next prev parent reply other threads:[~2022-02-02 6:52 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-02 4:11 [PATCH v4 0/3] svm: avic: Allow AVIC support on system w/ physical APIC ID > 255 Suravee Suthikulpanit
2022-02-02 4:11 ` [PATCH v4 1/3] KVM: SVM: Only call vcpu_(un)blocking when AVIC is enabled Suravee Suthikulpanit
2022-02-02 6:26 ` Suthikulpanit, Suravee [this message]
2022-02-02 4:11 ` [PATCH v4 2/3] x86/apic: Add helper function to get maximum physical APIC ID Suravee Suthikulpanit
2022-02-02 4:11 ` [PATCH v4 3/3] KVM: SVM: Add support for 12-bit host " Suravee Suthikulpanit
2022-02-02 15:58 ` [PATCH v4 0/3] svm: avic: Allow AVIC support on system w/ physical APIC ID > 255 Sean Christopherson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b9fc1081-98b8-64e8-b4a6-fdd5809c1255@amd.com \
--to=suravee.suthikulpanit@amd.com \
--cc=bp@alien8.de \
--cc=hpa@zytor.com \
--cc=jon.grimm@amd.com \
--cc=joro@8bytes.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=mlevitsk@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peterz@infradead.org \
--cc=seanjc@google.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®