Skip to content

Commit 5f9e169

Browse files
committed
KVM: arm64, x86: make kvm_arch_has_irq_bypass() inline
kvm_arch_has_irq_bypass() is a small function and even though it does not appear in any *really* hot paths, it's also not entirely rare. Make it inline---it also works out nicely in preparation for using it in kvm-intel.ko and kvm-amd.ko, since the function is not currently exported. Suggested-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
1 parent 8ffd015 commit 5f9e169

File tree

4 files changed

+11
-10
lines changed

4 files changed

+11
-10
lines changed

arch/arm64/include/asm/kvm_host.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1588,4 +1588,9 @@ void kvm_set_vm_id_reg(struct kvm *kvm, u32 reg, u64 val);
15881588
#define kvm_has_s1poe(k) \
15891589
(kvm_has_feat((k), ID_AA64MMFR3_EL1, S1POE, IMP))
15901590

1591+
static inline bool kvm_arch_has_irq_bypass(void)
1592+
{
1593+
return true;
1594+
}
1595+
15911596
#endif /* __ARM64_KVM_HOST_H__ */

arch/arm64/kvm/arm.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2743,11 +2743,6 @@ bool kvm_arch_irqchip_in_kernel(struct kvm *kvm)
27432743
return irqchip_in_kernel(kvm);
27442744
}
27452745

2746-
bool kvm_arch_has_irq_bypass(void)
2747-
{
2748-
return true;
2749-
}
2750-
27512746
int kvm_arch_irq_bypass_add_producer(struct irq_bypass_consumer *cons,
27522747
struct irq_bypass_producer *prod)
27532748
{

arch/x86/include/asm/kvm_host.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
#include <asm/mtrr.h>
3636
#include <asm/msr-index.h>
3737
#include <asm/asm.h>
38+
#include <asm/irq_remapping.h>
3839
#include <asm/kvm_page_track.h>
3940
#include <asm/kvm_vcpu_regs.h>
4041
#include <asm/reboot.h>
@@ -2423,4 +2424,9 @@ int memslot_rmap_alloc(struct kvm_memory_slot *slot, unsigned long npages);
24232424
*/
24242425
#define KVM_EXIT_HYPERCALL_MBZ GENMASK_ULL(31, 1)
24252426

2427+
static inline bool kvm_arch_has_irq_bypass(void)
2428+
{
2429+
return enable_apicv && irq_remapping_cap(IRQ_POSTING_CAP);
2430+
}
2431+
24262432
#endif /* _ASM_X86_KVM_HOST_H */

arch/x86/kvm/x86.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13556,11 +13556,6 @@ bool kvm_arch_has_noncoherent_dma(struct kvm *kvm)
1355613556
}
1355713557
EXPORT_SYMBOL_GPL(kvm_arch_has_noncoherent_dma);
1355813558

13559-
bool kvm_arch_has_irq_bypass(void)
13560-
{
13561-
return enable_apicv && irq_remapping_cap(IRQ_POSTING_CAP);
13562-
}
13563-
1356413559
int kvm_arch_irq_bypass_add_producer(struct irq_bypass_consumer *cons,
1356513560
struct irq_bypass_producer *prod)
1356613561
{

0 commit comments

Comments
 (0)