From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Hildenbrand Subject: Re: [PATCH 1/2] KVM: lapic: Split out x2apic ldr calculation Date: Thu, 23 Nov 2017 16:31:29 +0100 Message-ID: References: <20171117115250.7564-1-dgilbert@redhat.com> <20171117115250.7564-2-dgilbert@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: pbonzini@redhat.com To: "Dr. David Alan Gilbert (git)" , kvm@vger.kernel.org Return-path: Received: from mx1.redhat.com ([209.132.183.28]:58988 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752841AbdKWPbb (ORCPT ); Thu, 23 Nov 2017 10:31:31 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5A0174903F for ; Thu, 23 Nov 2017 15:31:31 +0000 (UTC) In-Reply-To: <20171117115250.7564-2-dgilbert@redhat.com> Content-Language: en-US Sender: kvm-owner@vger.kernel.org List-ID: On 17.11.2017 12:52, Dr. David Alan Gilbert (git) wrote: > From: "Dr. David Alan Gilbert" > > 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 > --- > 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); > > Reviewed-by: David Hildenbrand -- Thanks, David / dhildenb