Commit 88197e6a authored by 彭浩(Richard)'s avatar 彭浩(Richard) Committed by Paolo Bonzini

kvm/x86: Remove redundant function implementations

pic_in_kernel(), ioapic_in_kernel() and irqchip_kernel() have the
same implementation.
Signed-off-by: default avatarPeng Hao <richard.peng@oppo.com>
Message-Id: <HKAPR02MB4291D5926EA10B8BFE9EA0D3E0B70@HKAPR02MB4291.apcprd02.prod.outlook.com>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent 80bc97f2
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
#define __KVM_IO_APIC_H #define __KVM_IO_APIC_H
#include <linux/kvm_host.h> #include <linux/kvm_host.h>
#include <kvm/iodev.h> #include <kvm/iodev.h>
#include "irq.h"
struct kvm; struct kvm;
struct kvm_vcpu; struct kvm_vcpu;
...@@ -108,11 +108,7 @@ do { \ ...@@ -108,11 +108,7 @@ do { \
static inline int ioapic_in_kernel(struct kvm *kvm) static inline int ioapic_in_kernel(struct kvm *kvm)
{ {
int mode = kvm->arch.irqchip_mode; return irqchip_kernel(kvm);
/* Matches smp_wmb() when setting irqchip_mode */
smp_rmb();
return mode == KVM_IRQCHIP_KERNEL;
} }
void kvm_rtc_eoi_tracking_restore_one(struct kvm_vcpu *vcpu); void kvm_rtc_eoi_tracking_restore_one(struct kvm_vcpu *vcpu);
......
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <kvm/iodev.h> #include <kvm/iodev.h>
#include "ioapic.h"
#include "lapic.h" #include "lapic.h"
#define PIC_NUM_PINS 16 #define PIC_NUM_PINS 16
...@@ -66,15 +65,6 @@ void kvm_pic_destroy(struct kvm *kvm); ...@@ -66,15 +65,6 @@ void kvm_pic_destroy(struct kvm *kvm);
int kvm_pic_read_irq(struct kvm *kvm); int kvm_pic_read_irq(struct kvm *kvm);
void kvm_pic_update_irq(struct kvm_pic *s); void kvm_pic_update_irq(struct kvm_pic *s);
static inline int pic_in_kernel(struct kvm *kvm)
{
int mode = kvm->arch.irqchip_mode;
/* Matches smp_wmb() when setting irqchip_mode */
smp_rmb();
return mode == KVM_IRQCHIP_KERNEL;
}
static inline int irqchip_split(struct kvm *kvm) static inline int irqchip_split(struct kvm *kvm)
{ {
int mode = kvm->arch.irqchip_mode; int mode = kvm->arch.irqchip_mode;
...@@ -93,6 +83,11 @@ static inline int irqchip_kernel(struct kvm *kvm) ...@@ -93,6 +83,11 @@ static inline int irqchip_kernel(struct kvm *kvm)
return mode == KVM_IRQCHIP_KERNEL; return mode == KVM_IRQCHIP_KERNEL;
} }
static inline int pic_in_kernel(struct kvm *kvm)
{
return irqchip_kernel(kvm);
}
static inline int irqchip_in_kernel(struct kvm *kvm) static inline int irqchip_in_kernel(struct kvm *kvm)
{ {
int mode = kvm->arch.irqchip_mode; int mode = kvm->arch.irqchip_mode;
......
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
#include <linux/jump_label.h> #include <linux/jump_label.h>
#include "kvm_cache_regs.h" #include "kvm_cache_regs.h"
#include "irq.h" #include "irq.h"
#include "ioapic.h"
#include "trace.h" #include "trace.h"
#include "x86.h" #include "x86.h"
#include "cpuid.h" #include "cpuid.h"
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
*/ */
#include "irq.h" #include "irq.h"
#include "ioapic.h"
#include "mmu.h" #include "mmu.h"
#include "x86.h" #include "x86.h"
#include "kvm_cache_regs.h" #include "kvm_cache_regs.h"
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include <linux/kvm_host.h> #include <linux/kvm_host.h>
#include "irq.h" #include "irq.h"
#include "ioapic.h"
#include "mmu.h" #include "mmu.h"
#include "i8254.h" #include "i8254.h"
#include "tss.h" #include "tss.h"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment