diff options
| author | Neeraj Upadhyay <[email protected]> | 2025-07-09 03:32:19 +0000 |
|---|---|---|
| committer | Sean Christopherson <[email protected]> | 2025-07-10 16:44:43 +0000 |
| commit | fe954bcd577e703acdef597903079c991740f6bf (patch) | |
| tree | 36d22c75b5ce1384b5d9a716ab7d3a3ad40c3c69 | |
| parent | x86/apic: KVM: Move lapic get/set helpers to common code (diff) | |
| download | kernel-fe954bcd577e703acdef597903079c991740f6bf.tar.gz kernel-fe954bcd577e703acdef597903079c991740f6bf.zip | |
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 <[email protected]>
Acked-by: Sean Christopherson <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Sean Christopherson <[email protected]>
| -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); |
