[<prev] [next>] [day] [month] [year] [list]
Message-ID: <HKAPR02MB4291B0991BF57A5CCB1C7437E0BE0@HKAPR02MB4291.apcprd02.prod.outlook.com>
Date: Tue, 12 May 2020 11:02:56 +0000
From: 彭浩(Richard) <richard.peng@...o.com>
To: Paolo Bonzini <pbonzini@...hat.com>
CC: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"kvm@...r.kernel.org" <kvm@...r.kernel.org>
Subject: [PATCH v2] kvm/x86 : Remove redundant function implement
pic_in_kernel(),ioapic_in_kernel() and irqchip_kernel() have the
same implementation.
Signed-off-by: Peng Hao <richard.peng@...o.com>
---
arch/x86/kvm/ioapic.h | 8 ++------
arch/x86/kvm/irq.h | 13 ++++---------
2 files changed, 6 insertions(+), 15 deletions(-)
diff --git a/arch/x86/kvm/ioapic.h b/arch/x86/kvm/ioapic.h
index 2fb2e3c..7a3c53b 100644
--- a/arch/x86/kvm/ioapic.h
+++ b/arch/x86/kvm/ioapic.h
@@ -5,7 +5,7 @@
#include <linux/kvm_host.h>
#include <kvm/iodev.h>
-
+#include "irq.h"
struct kvm;
struct kvm_vcpu;
@@ -108,11 +108,7 @@ do {\
static inline int ioapic_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;
+return irqchip_kernel(kvm);
}
void kvm_rtc_eoi_tracking_restore_one(struct kvm_vcpu *vcpu);
diff --git a/arch/x86/kvm/irq.h b/arch/x86/kvm/irq.h
index f173ab6..c0ad731 100644
--- a/arch/x86/kvm/irq.h
+++ b/arch/x86/kvm/irq.h
@@ -66,15 +66,6 @@ void kvm_pic_destroy(struct kvm *kvm);
int kvm_pic_read_irq(struct kvm *kvm);
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)
{
int mode = kvm->arch.irqchip_mode;
@@ -93,6 +84,10 @@ static inline int irqchip_kernel(struct kvm *kvm)
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)
{
int mode = kvm->arch.irqchip_mode;
--
2.7.4
________________________________
OPPO
本电子邮件及其附件含有OPPO公司的保密信息,仅限于邮件指明的收件人使用(包含个人及群组)。禁止任何人在未经授权的情况下以任何形式使用。如果您错收了本邮件,请立即以电子邮件通知发件人并删除本邮件及其附件。
This e-mail and its attachments contain confidential information from OPPO, which is intended only for the person or entity whose address is listed above. Any use of the information contained herein in any way (including, but not limited to, total or partial disclosure, reproduction, or dissemination) by persons other than the intended recipient(s) is prohibited. If you receive this e-mail in error, please notify the sender by phone or email immediately and delete it!
Powered by blists - more mailing lists