public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: "Dr. David Alan Gilbert (git)" <dgilbert@redhat.com>
To: kvm@vger.kernel.org
Cc: pbonzini@redhat.com
Subject: [PATCH 1/2] KVM: lapic: Split out x2apic ldr calculation
Date: Fri, 17 Nov 2017 11:52:49 +0000	[thread overview]
Message-ID: <20171117115250.7564-2-dgilbert@redhat.com> (raw)
In-Reply-To: <20171117115250.7564-1-dgilbert@redhat.com>

From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>

Split out the ldr calculation from kvm_apic_set_x2apic_id
since we're about to reuse it in the following patch.

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
 arch/x86/kvm/lapic.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
index 36c90d631096..4991e9e51611 100644
--- a/arch/x86/kvm/lapic.c
+++ b/arch/x86/kvm/lapic.c
@@ -266,9 +266,14 @@ static inline void kvm_apic_set_ldr(struct kvm_lapic *apic, u32 id)
 	recalculate_apic_map(apic->vcpu->kvm);
 }
 
+static inline u32 kvm_apic_calc_x2apic_ldr(u32 id)
+{
+	return ((id >> 4) << 16) | (1 << (id & 0xf));
+}
+
 static inline void kvm_apic_set_x2apic_id(struct kvm_lapic *apic, u32 id)
 {
-	u32 ldr = ((id >> 4) << 16) | (1 << (id & 0xf));
+	u32 ldr = kvm_apic_calc_x2apic_ldr(id);
 
 	WARN_ON_ONCE(id != apic->vcpu->vcpu_id);
 
-- 
2.14.3

  reply	other threads:[~2017-11-17 11:52 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-17 11:52 [PATCH 0/2] Lapic LDR fixup Dr. David Alan Gilbert (git)
2017-11-17 11:52 ` Dr. David Alan Gilbert (git) [this message]
2017-11-23 15:31   ` [PATCH 1/2] KVM: lapic: Split out x2apic ldr calculation David Hildenbrand
2017-11-17 11:52 ` [PATCH 2/2] KVM: lapic: Fixup LDR on load in x2apic Dr. David Alan Gilbert (git)
2017-11-17 21:01   ` Liran Alon
2017-11-17 21:03     ` Liran Alon
2017-11-20  0:53       ` Wanpeng Li
2017-11-20  1:04         ` Liran Alon
2017-11-20 20:48           ` Paolo Bonzini
2017-11-20 10:48       ` Dr. David Alan Gilbert
2017-11-17 12:29 ` [PATCH 0/2] Lapic LDR fixup Paolo Bonzini
2017-11-17 19:37   ` Dr. David Alan Gilbert
2017-11-17 20:27     ` Paolo Bonzini

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=20171117115250.7564-2-dgilbert@redhat.com \
    --to=dgilbert@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox