From: Binbin Wu <binbin.wu@linux.intel.com>
To: Vishal Verma <vishal.l.verma@intel.com>,
Sean Christopherson <seanjc@google.com>,
Paolo Bonzini <pbonzini@redhat.com>
Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
Rick Edgecombe <rick.p.edgecombe@intel.com>
Subject: Re: [PATCH 1/4] KVM: TDX: Move apicv_pre_state_restore to posted_intr.c
Date: Fri, 14 Mar 2025 10:36:43 +0800 [thread overview]
Message-ID: <24ada86a-131f-4624-8333-baa37e2a4a67@linux.intel.com> (raw)
In-Reply-To: <20250313-vverma7-cleanup_x86_ops-v1-1-0346c8211a0c@intel.com>
On 3/14/2025 3:30 AM, Vishal Verma wrote:
> In preparation for a cleanup of the x86_ops struct for TDX, which turns
> several of the ops definitions to macros, move the
> vt_apicv_pre_state_restore() helper into posted_intr.c.
>
> Based on a patch by Sean Christopherson <seanjc@google.com>
>
> Link: https://lore.kernel.org/kvm/Z6v9yjWLNTU6X90d@google.com/
> Cc: Sean Christopherson <seanjc@google.com>
> Cc: Rick Edgecombe <rick.p.edgecombe@intel.com>
> Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
Reviewed-by: Binbin Wu <binbin.wu@linxu.intel.com>
> ---
> arch/x86/kvm/vmx/posted_intr.h | 1 +
> arch/x86/kvm/vmx/main.c | 10 +---------
> arch/x86/kvm/vmx/posted_intr.c | 8 ++++++++
> 3 files changed, 10 insertions(+), 9 deletions(-)
>
> diff --git a/arch/x86/kvm/vmx/posted_intr.h b/arch/x86/kvm/vmx/posted_intr.h
> index 68605ca7ef68..9d0677a2ba0e 100644
> --- a/arch/x86/kvm/vmx/posted_intr.h
> +++ b/arch/x86/kvm/vmx/posted_intr.h
> @@ -11,6 +11,7 @@ void vmx_vcpu_pi_load(struct kvm_vcpu *vcpu, int cpu);
> void vmx_vcpu_pi_put(struct kvm_vcpu *vcpu);
> void pi_wakeup_handler(void);
> void __init pi_init_cpu(int cpu);
> +void pi_apicv_pre_state_restore(struct kvm_vcpu *vcpu);
> bool pi_has_pending_interrupt(struct kvm_vcpu *vcpu);
> int vmx_pi_update_irte(struct kvm *kvm, unsigned int host_irq,
> uint32_t guest_irq, bool set);
> diff --git a/arch/x86/kvm/vmx/main.c b/arch/x86/kvm/vmx/main.c
> index 320c96e1e80a..9d201ddb794a 100644
> --- a/arch/x86/kvm/vmx/main.c
> +++ b/arch/x86/kvm/vmx/main.c
> @@ -315,14 +315,6 @@ static void vt_set_virtual_apic_mode(struct kvm_vcpu *vcpu)
> return vmx_set_virtual_apic_mode(vcpu);
> }
>
> -static void vt_apicv_pre_state_restore(struct kvm_vcpu *vcpu)
> -{
> - struct pi_desc *pi = vcpu_to_pi_desc(vcpu);
> -
> - pi_clear_on(pi);
> - memset(pi->pir, 0, sizeof(pi->pir));
> -}
> -
> static void vt_hwapic_isr_update(struct kvm_vcpu *vcpu, int max_isr)
> {
> if (is_td_vcpu(vcpu))
> @@ -983,7 +975,7 @@ struct kvm_x86_ops vt_x86_ops __initdata = {
> .set_apic_access_page_addr = vt_set_apic_access_page_addr,
> .refresh_apicv_exec_ctrl = vt_refresh_apicv_exec_ctrl,
> .load_eoi_exitmap = vt_load_eoi_exitmap,
> - .apicv_pre_state_restore = vt_apicv_pre_state_restore,
> + .apicv_pre_state_restore = pi_apicv_pre_state_restore,
> .required_apicv_inhibits = VMX_REQUIRED_APICV_INHIBITS,
> .hwapic_isr_update = vt_hwapic_isr_update,
> .sync_pir_to_irr = vt_sync_pir_to_irr,
> diff --git a/arch/x86/kvm/vmx/posted_intr.c b/arch/x86/kvm/vmx/posted_intr.c
> index f2ca37b3f606..a140af060bb8 100644
> --- a/arch/x86/kvm/vmx/posted_intr.c
> +++ b/arch/x86/kvm/vmx/posted_intr.c
> @@ -241,6 +241,14 @@ void __init pi_init_cpu(int cpu)
> raw_spin_lock_init(&per_cpu(wakeup_vcpus_on_cpu_lock, cpu));
> }
>
> +void pi_apicv_pre_state_restore(struct kvm_vcpu *vcpu)
> +{
> + struct pi_desc *pi = vcpu_to_pi_desc(vcpu);
> +
> + pi_clear_on(pi);
> + memset(pi->pir, 0, sizeof(pi->pir));
> +}
> +
> bool pi_has_pending_interrupt(struct kvm_vcpu *vcpu)
> {
> struct pi_desc *pi_desc = vcpu_to_pi_desc(vcpu);
>
next prev parent reply other threads:[~2025-03-14 2:36 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-13 19:30 [PATCH 0/4] KVM: TDX: Cleanup the kvm_x86_ops structure for vmx/tdx Vishal Verma
2025-03-13 19:30 ` [PATCH 1/4] KVM: TDX: Move apicv_pre_state_restore to posted_intr.c Vishal Verma
2025-03-14 2:36 ` Binbin Wu [this message]
2025-03-13 19:30 ` [PATCH 2/4] KVM: VMX: Move x86_ops wrappers under CONFIG_KVM_INTEL_TDX Vishal Verma
2025-03-14 2:42 ` Binbin Wu
2025-03-14 15:47 ` Verma, Vishal L
2025-03-13 19:30 ` [PATCH 3/4] KVM: VMX: Make naming consistent for kvm_complete_insn_gp via define Vishal Verma
2025-03-13 19:30 ` [PATCH 4/4] KVM: VMX: Clean up and macrofy x86_ops Vishal Verma
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=24ada86a-131f-4624-8333-baa37e2a4a67@linux.intel.com \
--to=binbin.wu@linux.intel.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=rick.p.edgecombe@intel.com \
--cc=seanjc@google.com \
--cc=vishal.l.verma@intel.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.