From: "Jan Beulich" Subject: Re: [RFC v1 05/15] vmx: Initialize VT-d Posted-Interrupts Descriptor Date: Mon, 04 May 2015 09:10:12 +0100 Message-ID: <55474584020000780007629F@mail.emea.novell.com> References: <1427286717-4093-1-git-send-email-feng.wu@intel.com> <1427286717-4093-6-git-send-email-feng.wu@intel.com> <20150326192914.GB25340@x230.dumpdata.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Feng Wu Cc: Yang Z Zhang , Kevin Tian , "keir@xen.org" , "xen-devel@lists.xen.org" List-Id: xen-devel@lists.xenproject.org >>> On 04.05.15 at 07:32, wrote: >> From: Konrad Rzeszutek Wilk [mailto:konrad.wilk@oracle.com] >> Sent: Friday, March 27, 2015 3:29 AM >> On Wed, Mar 25, 2015 at 08:31:47PM +0800, Feng Wu wrote: >> > + v->arch.hvm_vmx.pi_desc.ndm = 0; >> > + dest = cpu_physical_id(v->processor); >> > + >> > + if ( x2apic_enabled ) >> > + v->arch.hvm_vmx.pi_desc.ndst = dest; >> > + else >> > + v->arch.hvm_vmx.pi_desc.ndst = (dest << 8) & 0xFF00; >> >> Surely there are some macros for that? > > I find some macros defined in xen/include/asm-x86/apicdef.h, but since > it is not a common format here, I cannot find one which can be used for it. > > In the above case (the 'else' branch), 'dest' will occupy bit 8:15 of 'ndst' > field. > > Either we add a macro in the file (it is a little strange, since the format > is not common), > or we remain the current solution. Any ideas? Adding a macro if really no suitable one exists is the minimum - recently I went through and replaced quite a few of such hard- coded numbers with something more understandable, and hence you shouldn't introduce new instances of such. Jan