]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
KVM: x86: Move vector_hashing into lapic.c
authorSean Christopherson <seanjc@google.com>
Thu, 21 Aug 2025 21:42:09 +0000 (14:42 -0700)
committerSean Christopherson <seanjc@google.com>
Wed, 10 Sep 2025 19:05:13 +0000 (12:05 -0700)
Move the vector_hashing module param into lapic.c now that all usage is
contained within the local APIC emulation code.

Opportunistically drop the accessor and append "_enabled" to the variable
to help capture that it's a boolean module param.

No functional change intended.

Link: https://lore.kernel.org/r/20250821214209.3463350-4-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
arch/x86/kvm/lapic.c
arch/x86/kvm/x86.c
arch/x86/kvm/x86.h

index 958ab7ff66b2bda103dc09d463a6b587f3d46cc1..ab48e057dbdc1ec87dff8712ae7248b4f6f0a4e7 100644 (file)
@@ -74,6 +74,10 @@ module_param(lapic_timer_advance, bool, 0444);
 #define LAPIC_TIMER_ADVANCE_NS_MAX     5000
 /* step-by-step approximation to mitigate fluctuation */
 #define LAPIC_TIMER_ADVANCE_ADJUST_STEP 8
+
+static bool __read_mostly vector_hashing_enabled = true;
+module_param_named(vector_hashing, vector_hashing_enabled, bool, 0444);
+
 static int kvm_lapic_msr_read(struct kvm_lapic *apic, u32 reg, u64 *data);
 static int kvm_lapic_msr_write(struct kvm_lapic *apic, u32 reg, u64 data);
 
@@ -1150,7 +1154,7 @@ static inline bool kvm_apic_map_get_dest_lapic(struct kvm *kvm,
        if (!kvm_lowest_prio_delivery(irq))
                return true;
 
-       if (!kvm_vector_hashing_enabled()) {
+       if (!vector_hashing_enabled) {
                lowest = -1;
                for_each_set_bit(i, bitmap, 16) {
                        if (!(*dst)[i])
@@ -1291,7 +1295,7 @@ int kvm_irq_delivery_to_apic(struct kvm *kvm, struct kvm_lapic *src,
                                r = 0;
                        r += kvm_apic_set_irq(vcpu, irq, dest_map);
                } else if (kvm_apic_sw_enabled(vcpu->arch.apic)) {
-                       if (!kvm_vector_hashing_enabled()) {
+                       if (!vector_hashing_enabled) {
                                if (!lowest)
                                        lowest = vcpu;
                                else if (kvm_apic_compare_prio(vcpu, lowest) < 0)
index 8bfba7d8f7509e06008a3c3bc3a1e52bdc9af690..bf386f2ebba3ef5fbea02e3fb0046dc922e48b6e 100644 (file)
@@ -164,9 +164,6 @@ module_param(kvmclock_periodic_sync, bool, 0444);
 static u32 __read_mostly tsc_tolerance_ppm = 250;
 module_param(tsc_tolerance_ppm, uint, 0644);
 
-static bool __read_mostly vector_hashing = true;
-module_param(vector_hashing, bool, 0444);
-
 bool __read_mostly enable_vmware_backdoor = false;
 module_param(enable_vmware_backdoor, bool, 0444);
 EXPORT_SYMBOL_GPL(enable_vmware_backdoor);
@@ -13549,11 +13546,6 @@ bool kvm_arch_has_noncoherent_dma(struct kvm *kvm)
 }
 EXPORT_SYMBOL_GPL(kvm_arch_has_noncoherent_dma);
 
-bool kvm_vector_hashing_enabled(void)
-{
-       return vector_hashing;
-}
-
 bool kvm_arch_no_poll(struct kvm_vcpu *vcpu)
 {
        return (vcpu->arch.msr_kvm_poll_control & 1) == 0;
index eb3088684e8a91e1d96c6db2bbc88807ac540dcf..786e36fcd0fbb31679f2d436ee1513e4bf252919 100644 (file)
@@ -431,7 +431,6 @@ void kvm_deliver_exception_payload(struct kvm_vcpu *vcpu,
 
 int kvm_mtrr_set_msr(struct kvm_vcpu *vcpu, u32 msr, u64 data);
 int kvm_mtrr_get_msr(struct kvm_vcpu *vcpu, u32 msr, u64 *pdata);
-bool kvm_vector_hashing_enabled(void);
 void kvm_fixup_and_inject_pf_error(struct kvm_vcpu *vcpu, gva_t gva, u16 error_code);
 int x86_decode_emulated_instruction(struct kvm_vcpu *vcpu, int emulation_type,
                                    void *insn, int insn_len);