Skip to content

Commit b9bd231

Browse files
neerajupadhyasean-jc
authored andcommitted
KVM: x86: Rename lapic get/set_reg() helpers
In preparation for moving kvm-internal __kvm_lapic_set_reg(), __kvm_lapic_get_reg() to apic.h for use in Secure AVIC APIC driver, rename them as part of the APIC API. 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-8-Neeraj.Upadhyay@amd.com Signed-off-by: Sean Christopherson <seanjc@google.com>
1 parent bdaccfe commit b9bd231

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

arch/x86/kvm/lapic.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,14 @@ module_param(lapic_timer_advance, bool, 0444);
7979
static int kvm_lapic_msr_read(struct kvm_lapic *apic, u32 reg, u64 *data);
8080
static int kvm_lapic_msr_write(struct kvm_lapic *apic, u32 reg, u64 data);
8181

82-
static inline void __kvm_lapic_set_reg(void *regs, int reg_off, u32 val)
82+
static inline void apic_set_reg(void *regs, int reg_off, u32 val)
8383
{
8484
*((u32 *) (regs + reg_off)) = val;
8585
}
8686

8787
static inline void kvm_lapic_set_reg(struct kvm_lapic *apic, int reg_off, u32 val)
8888
{
89-
__kvm_lapic_set_reg(apic->regs, reg_off, val);
89+
apic_set_reg(apic->regs, reg_off, val);
9090
}
9191

9292
static __always_inline u64 __kvm_lapic_get_reg64(void *regs, int reg)
@@ -3080,12 +3080,12 @@ static int kvm_apic_state_fixup(struct kvm_vcpu *vcpu,
30803080

30813081
if (!kvm_x86_ops.x2apic_icr_is_split) {
30823082
if (set) {
3083-
icr = __kvm_lapic_get_reg(s->regs, APIC_ICR) |
3084-
(u64)__kvm_lapic_get_reg(s->regs, APIC_ICR2) << 32;
3083+
icr = apic_get_reg(s->regs, APIC_ICR) |
3084+
(u64)apic_get_reg(s->regs, APIC_ICR2) << 32;
30853085
__kvm_lapic_set_reg64(s->regs, APIC_ICR, icr);
30863086
} else {
30873087
icr = __kvm_lapic_get_reg64(s->regs, APIC_ICR);
3088-
__kvm_lapic_set_reg(s->regs, APIC_ICR2, icr >> 32);
3088+
apic_set_reg(s->regs, APIC_ICR2, icr >> 32);
30893089
}
30903090
}
30913091
}
@@ -3101,8 +3101,7 @@ int kvm_apic_get_state(struct kvm_vcpu *vcpu, struct kvm_lapic_state *s)
31013101
* Get calculated timer current count for remaining timer period (if
31023102
* any) and store it in the returned register set.
31033103
*/
3104-
__kvm_lapic_set_reg(s->regs, APIC_TMCCT,
3105-
__apic_read(vcpu->arch.apic, APIC_TMCCT));
3104+
apic_set_reg(s->regs, APIC_TMCCT, __apic_read(vcpu->arch.apic, APIC_TMCCT));
31063105

31073106
return kvm_apic_state_fixup(vcpu, s, false);
31083107
}

arch/x86/kvm/lapic.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,14 +165,14 @@ static inline void kvm_lapic_set_irr(int vec, struct kvm_lapic *apic)
165165
apic->irr_pending = true;
166166
}
167167

168-
static inline u32 __kvm_lapic_get_reg(void *regs, int reg_off)
168+
static inline u32 apic_get_reg(void *regs, int reg_off)
169169
{
170170
return *((u32 *) (regs + reg_off));
171171
}
172172

173173
static inline u32 kvm_lapic_get_reg(struct kvm_lapic *apic, int reg_off)
174174
{
175-
return __kvm_lapic_get_reg(apic->regs, reg_off);
175+
return apic_get_reg(apic->regs, reg_off);
176176
}
177177

178178
DECLARE_STATIC_KEY_FALSE(kvm_has_noapic_vcpu);

0 commit comments

Comments
 (0)