From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gleb Natapov Subject: Re: [PATCH 2/3 v2] x2APIC interface to local apic Date: Mon, 29 Jun 2009 12:51:04 +0300 Message-ID: <20090629095104.GU20289@redhat.com> References: <1246191331-31085-1-git-send-email-gleb@redhat.com> <1246191331-31085-3-git-send-email-gleb@redhat.com> <4A488C6A.2040703@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: kvm@vger.kernel.org To: Avi Kivity Return-path: Received: from mx2.redhat.com ([66.187.237.31]:51834 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752848AbZF2JvE (ORCPT ); Mon, 29 Jun 2009 05:51:04 -0400 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n5T9p7qt025518 for ; Mon, 29 Jun 2009 05:51:07 -0400 Content-Disposition: inline In-Reply-To: <4A488C6A.2040703@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On Mon, Jun 29, 2009 at 12:42:02PM +0300, Avi Kivity wrote: > On 06/28/2009 03:15 PM, Gleb Natapov wrote: >> This patch implements MSR interface to a local apic as defines by x2APIC >> Intel specification. >> >> @@ -269,7 +275,12 @@ int kvm_apic_match_physical_addr(struct kvm_lapic *apic, u16 dest) >> int kvm_apic_match_logical_addr(struct kvm_lapic *apic, u8 mda) >> { >> int result = 0; >> - u8 logical_id; >> + u32 logical_id; >> + >> + if (apic_x2apic_mode(apic)) { >> + logical_id = apic_get_reg(apic, APIC_LDR); >> + return logical_id& (uint16_t)mda; >> + } >> > > mda is u8, why cast it? Is mda will be zero extended without any cast at all? I suppose it should. -- Gleb.