LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Like Xu <like.xu.linux@gmail.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: Sean Christopherson <seanjc@google.com>,
	Vitaly Kuznetsov <vkuznets@redhat.com>,
	Wanpeng Li <wanpengli@tencent.com>,
	Jim Mattson <jmattson@google.com>, Joerg Roedel <joro@8bytes.org>,
	Ingo Molnar <mingo@redhat.com>,
	kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 1/5] KVM: x86: Clean up redundant mod_64(x, y) macro definition
Date: Mon,  9 Aug 2021 17:34:06 +0800	[thread overview]
Message-ID: <20210809093410.59304-2-likexu@tencent.com> (raw)
In-Reply-To: <20210809093410.59304-1-likexu@tencent.com>

From: Like Xu <likexu@tencent.com>

The mod_64(x, y) macro is only defined and used in the kvm/x86 context.
It's safe to move the definition of mod_64(x, y) from x86/{i8254lapic}.c
to the generic x86.h without any intended functional change.

Signed-off-by: Like Xu <likexu@tencent.com>
---
 arch/x86/kvm/i8254.c | 6 ------
 arch/x86/kvm/lapic.c | 6 ------
 arch/x86/kvm/x86.h   | 6 ++++++
 3 files changed, 6 insertions(+), 12 deletions(-)

diff --git a/arch/x86/kvm/i8254.c b/arch/x86/kvm/i8254.c
index 5a69cce4d72d..81d2ba064dc3 100644
--- a/arch/x86/kvm/i8254.c
+++ b/arch/x86/kvm/i8254.c
@@ -40,12 +40,6 @@
 #include "i8254.h"
 #include "x86.h"
 
-#ifndef CONFIG_X86_64
-#define mod_64(x, y) ((x) - (y) * div64_u64(x, y))
-#else
-#define mod_64(x, y) ((x) % (y))
-#endif
-
 #define RW_STATE_LSB 1
 #define RW_STATE_MSB 2
 #define RW_STATE_WORD0 3
diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
index 76fb00921203..6b3d8feac1d0 100644
--- a/arch/x86/kvm/lapic.c
+++ b/arch/x86/kvm/lapic.c
@@ -42,12 +42,6 @@
 #include "cpuid.h"
 #include "hyperv.h"
 
-#ifndef CONFIG_X86_64
-#define mod_64(x, y) ((x) - (y) * div64_u64(x, y))
-#else
-#define mod_64(x, y) ((x) % (y))
-#endif
-
 #define PRId64 "d"
 #define PRIx64 "llx"
 #define PRIu64 "u"
diff --git a/arch/x86/kvm/x86.h b/arch/x86/kvm/x86.h
index 44ae10312740..6aac4a901b65 100644
--- a/arch/x86/kvm/x86.h
+++ b/arch/x86/kvm/x86.h
@@ -8,6 +8,12 @@
 #include "kvm_cache_regs.h"
 #include "kvm_emulate.h"
 
+#ifndef CONFIG_X86_64
+#define mod_64(x, y) ((x) - (y) * div64_u64(x, y))
+#else
+#define mod_64(x, y) ((x) % (y))
+#endif
+
 static __always_inline void kvm_guest_enter_irqoff(void)
 {
 	/*
-- 
2.32.0


  reply	other threads:[~2021-08-09  9:34 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-09  9:34 [PATCH 0/5] KVM: x86: Clean up redundant macro definitions Like Xu
2021-08-09  9:34 ` Like Xu [this message]
2021-08-09  9:34 ` [PATCH 2/5] KVM: x86: Clean up redundant CC macro definition Like Xu
2021-08-10 17:47   ` Paolo Bonzini
2021-08-09  9:34 ` [PATCH 3/5] KVM: x86: Clean up redundant ROL16(val, n) " Like Xu
2021-08-10 17:49   ` Paolo Bonzini
2021-08-09  9:34 ` [PATCH 4/5] KVM: x86: Clean up redundant __ex(x) " Like Xu
2021-08-09  9:34 ` [PATCH 5/5] KVM: x86: Clean up redundant pr_fmt(fmt) macro definition for svm Like Xu
2021-08-10 17:48   ` Paolo Bonzini
2021-08-12 13:00     ` Like Xu
2021-08-09 15:08 ` [PATCH 0/5] KVM: x86: Clean up redundant macro definitions Sean Christopherson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210809093410.59304-2-likexu@tencent.com \
    --to=like.xu.linux@gmail.com \
    --cc=jmattson@google.com \
    --cc=joro@8bytes.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=seanjc@google.com \
    --cc=vkuznets@redhat.com \
    --cc=wanpengli@tencent.com \
    --subject='Re: [PATCH 1/5] KVM: x86: Clean up redundant mod_64(x, y) macro definition' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).