diff options
author | Neeraj Upadhyay <Neeraj.Upadhyay@amd.com> | 2025-07-09 09:02:19 +0530 |
---|---|---|
committer | Sean Christopherson <seanjc@google.com> | 2025-07-10 09:44:43 -0700 |
commit | fe954bcd577e703acdef597903079c991740f6bf (patch) | |
tree | 36d22c75b5ce1384b5d9a716ab7d3a3ad40c3c69 | |
parent | 3d3a9083da1e7f5f933455411c1e96b37ae37772 (diff) |
x86/apic: KVM: Move lapic set/clear_vector() helpers to common code
Move apic_clear_vector() and apic_set_vector() helper functions to
apic.h in order to reuse them in the Secure AVIC guest APIC driver
in later patches to atomically set/clear vectors in the APIC backing
page.
No functional change intended.
Signed-off-by: Neeraj Upadhyay <Neeraj.Upadhyay@amd.com>
Acked-by: Sean Christopherson <seanjc@google.com>
Link: https://lore.kernel.org/r/20250709033242.267892-13-Neeraj.Upadhyay@amd.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
-rw-r--r-- | arch/x86/include/asm/apic.h | 10 | ||||
-rw-r--r-- | arch/x86/kvm/lapic.h | 10 |
2 files changed, 10 insertions, 10 deletions
diff --git a/arch/x86/include/asm/apic.h b/arch/x86/include/asm/apic.h index b8b5fe875bde..c6d1c51f71ec 100644 --- a/arch/x86/include/asm/apic.h +++ b/arch/x86/include/asm/apic.h @@ -547,6 +547,16 @@ static __always_inline void apic_set_reg64(void *regs, int reg, u64 val) *((u64 *) (regs + reg)) = val; } +static inline void apic_clear_vector(int vec, void *bitmap) +{ + clear_bit(APIC_VECTOR_TO_BIT_NUMBER(vec), bitmap + APIC_VECTOR_TO_REG_OFFSET(vec)); +} + +static inline void apic_set_vector(int vec, void *bitmap) +{ + set_bit(APIC_VECTOR_TO_BIT_NUMBER(vec), bitmap + APIC_VECTOR_TO_REG_OFFSET(vec)); +} + /* * Warm reset vector position: */ diff --git a/arch/x86/kvm/lapic.h b/arch/x86/kvm/lapic.h index 174df6996404..31284ec61a6a 100644 --- a/arch/x86/kvm/lapic.h +++ b/arch/x86/kvm/lapic.h @@ -147,16 +147,6 @@ void kvm_lapic_exit(void); u64 kvm_lapic_readable_reg_mask(struct kvm_lapic *apic); -static inline void apic_clear_vector(int vec, void *bitmap) -{ - clear_bit(APIC_VECTOR_TO_BIT_NUMBER(vec), bitmap + APIC_VECTOR_TO_REG_OFFSET(vec)); -} - -static inline void apic_set_vector(int vec, void *bitmap) -{ - set_bit(APIC_VECTOR_TO_BIT_NUMBER(vec), bitmap + APIC_VECTOR_TO_REG_OFFSET(vec)); -} - static inline void kvm_lapic_set_irr(int vec, struct kvm_lapic *apic) { apic_set_vector(vec, apic->regs + APIC_IRR); |