From: Lan Tianyu Subject: Re: [RFC PATCH V2 1/2] xen-pt: bind/unbind interrupt remapping format MSI Date: Wed, 24 May 2017 09:40:56 +0800 Message-ID: References: <1495085580-10631-1-git-send-email-tianyu.lan@intel.com> <1495085580-10631-2-git-send-email-tianyu.lan@intel.com> <20170519111622.GA3260@perard.uk.xensource.com> <591EFB5D020000780015B47A@prv-mh.provo.novell.com> <3f3c2075-da6b-dd14-279f-23525f46b3c5@intel.com> <20170523170622.GD1591@perard.uk.xensource.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============6440838225487967540==" Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dDLRZ-0006ig-Mv for xen-devel@lists.xenproject.org; Wed, 24 May 2017 01:50:33 +0000 In-Reply-To: <20170523170622.GD1591@perard.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" To: Anthony PERARD Cc: kevin.tian@intel.com, sstabellini@kernel.org, mst@redhat.com, qemu-devel@nongnu.org, Jan Beulich , marcel@redhat.com, xen-devel@lists.xenproject.org, Chao Gao List-Id: xen-devel@lists.xenproject.org This is a multi-part message in MIME format. --===============6440838225487967540== Content-Type: multipart/alternative; boundary="------------C59484424B084CFC2D97394B" This is a multi-part message in MIME format. --------------C59484424B084CFC2D97394B Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit On 2017年05月24日 01:06, Anthony PERARD wrote: > On Tue, May 23, 2017 at 08:16:25PM +0800, Lan Tianyu wrote: >> On 2017年05月19日 20:04, Jan Beulich wrote: >>>>>> On 19.05.17 at 13:16, wrote: >>>> On Thu, May 18, 2017 at 01:32:59AM -0400, Lan Tianyu wrote: >>>>> --- a/include/hw/i386/apic-msidef.h >>>>> +++ b/include/hw/i386/apic-msidef.h >>>>> @@ -26,6 +26,7 @@ >>>>> >>>>> #define MSI_ADDR_DEST_ID_SHIFT 12 >>>>> #define MSI_ADDR_DEST_IDX_SHIFT 4 >>>>> -#define MSI_ADDR_DEST_ID_MASK 0x00ffff0 >>>>> +#define MSI_ADDR_DEST_ID_MASK 0x000fff00 >>>> The value of MSI_ADDR_DEST_ID_MASK is changed here. I think the patch >>>> should be: >>>> +#define MSI_ADDR_DEST_ID_MASK 0x000ffff0 >>> Judging from other sources, rather the other way around - the >>> mask needs to have further bits removed (should be 0x000ff000 >>> afaict). Xen sources confirm this, and while Linux has the value >>> you suggest, that contradicts >> Agree. Defining the mask as "0x000ff000" makes more sense. >> Just check Qemu source code. Only apic_send_msi() and msi_dest_id() use >> the mask >> to get dest apic id. They mask MSI address field with >> MSI_ADDR_DEST_ID_MASK and >> then right-shift 12bit. The low 12bit won't be used. >> >> Anthony, does this make sense? > Yes, it does. > The change to MSI_ADDR_DEST_ID_MASK should probably go in its own patch. > OK. Will update. -- Best regards Tianyu Lan --------------C59484424B084CFC2D97394B Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit
On 2017年05月24日 01:06, Anthony PERARD wrote:
On Tue, May 23, 2017 at 08:16:25PM +0800, Lan Tianyu wrote:
On 2017年05月19日 20:04, Jan Beulich wrote:
On 19.05.17 at 13:16, <anthony.perard@citrix.com> wrote:
On Thu, May 18, 2017 at 01:32:59AM -0400, Lan Tianyu wrote:
--- a/include/hw/i386/apic-msidef.h
+++ b/include/hw/i386/apic-msidef.h
@@ -26,6 +26,7 @@
 
 #define MSI_ADDR_DEST_ID_SHIFT          12
 #define MSI_ADDR_DEST_IDX_SHIFT         4
-#define  MSI_ADDR_DEST_ID_MASK          0x00ffff0
+#define  MSI_ADDR_DEST_ID_MASK          0x000fff00
The value of MSI_ADDR_DEST_ID_MASK is changed here. I think the patch
should be:
+#define  MSI_ADDR_DEST_ID_MASK          0x000ffff0
Judging from other sources, rather the other way around - the
mask needs to have further bits removed (should be 0x000ff000
afaict). Xen sources confirm this, and while Linux has the value
you suggest, that contradicts
Agree. Defining the mask as "0x000ff000" makes more sense.
Just check Qemu source code. Only apic_send_msi() and msi_dest_id() use
the mask
to get dest apic id. They mask MSI address field with 
MSI_ADDR_DEST_ID_MASK and
then right-shift 12bit. The low 12bit won't be used.

Anthony, does this make sense?
Yes, it does.
The change to MSI_ADDR_DEST_ID_MASK should probably go in its own patch.

OK. Will update.


-- 
Best regards
Tianyu Lan
--------------C59484424B084CFC2D97394B-- --===============6440838225487967540== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KWGVuLWRldmVs IG1haWxpbmcgbGlzdApYZW4tZGV2ZWxAbGlzdHMueGVuLm9yZwpodHRwczovL2xpc3RzLnhlbi5v cmcveGVuLWRldmVsCg== --===============6440838225487967540==--