From: "Jan Beulich" <JBeulich@suse.com>
To: xen-devel <xen-devel@lists.xenproject.org>
Cc: Keir Fraser <keir@xen.org>, xiantao.zhang@intel.com
Subject: [PATCH] x86: correct MSI_ADDR_DEST_ID_MASK
Date: Mon, 12 May 2014 14:52:48 +0100 [thread overview]
Message-ID: <5370EE50020000780001172D@mail.emea.novell.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1929 bytes --]
This should only cover bits 12-19, in line with MSI_ADDR_DEST_ID_SHIFT.
Also replace a couple of open-coded uses of this shift and mask.
Signed-off-by: Jan Beulich <jbeulich@suse.com>
--- a/xen/arch/x86/hvm/irq.c
+++ b/xen/arch/x86/hvm/irq.c
@@ -283,7 +283,8 @@ int hvm_inject_msi(struct domain *d, uin
if ( !vector )
{
- int pirq = ((addr >> 32) & 0xffffff00) | ((addr >> 12) & 0xff);
+ int pirq = ((addr >> 32) & 0xffffff00) | dest;
+
if ( pirq > 0 )
{
struct pirq *info = pirq_info(d, pirq);
--- a/xen/drivers/passthrough/vtd/intremap.c
+++ b/xen/drivers/passthrough/vtd/intremap.c
@@ -535,7 +535,7 @@ static int remap_entry_to_msi_msg(
msg->dest32 = iremap_entry->lo.dst;
else
msg->dest32 = (iremap_entry->lo.dst >> 8) & 0xff;
- msg->address_lo |= (msg->dest32 & 0xff) << MSI_ADDR_DEST_ID_SHIFT;
+ msg->address_lo |= MSI_ADDR_DEST_ID(msg->dest32);
msg->data =
MSI_DATA_TRIGGER_EDGE |
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -1044,7 +1044,7 @@ static void dma_msi_set_affinity(struct
if (x2apic_enabled)
msg.address_hi = dest & 0xFFFFFF00;
msg.address_lo &= ~MSI_ADDR_DEST_ID_MASK;
- msg.address_lo |= MSI_ADDR_DEST_ID(dest & 0xff);
+ msg.address_lo |= MSI_ADDR_DEST_ID(dest);
iommu->msi.msg = msg;
spin_lock_irqsave(&iommu->register_lock, flags);
--- a/xen/include/asm-x86/msi.h
+++ b/xen/include/asm-x86/msi.h
@@ -49,7 +49,7 @@
#define MSI_ADDR_REDIRECTION_LOWPRI (1 << MSI_ADDR_REDIRECTION_SHIFT)
#define MSI_ADDR_DEST_ID_SHIFT 12
-#define MSI_ADDR_DEST_ID_MASK 0x00ffff0
+#define MSI_ADDR_DEST_ID_MASK 0x00ff000
#define MSI_ADDR_DEST_ID(dest) (((dest) << MSI_ADDR_DEST_ID_SHIFT) & MSI_ADDR_DEST_ID_MASK)
/* MAX fixed pages reserved for mapping MSIX tables. */
[-- Attachment #2: x86-MSI-addr-dest-ID-mask.patch --]
[-- Type: text/plain, Size: 1961 bytes --]
x86: correct MSI_ADDR_DEST_ID_MASK
This should only cover bits 12-19, in line with MSI_ADDR_DEST_ID_SHIFT.
Also replace a couple of open-coded uses of this shift and mask.
Signed-off-by: Jan Beulich <jbeulich@suse.com>
--- a/xen/arch/x86/hvm/irq.c
+++ b/xen/arch/x86/hvm/irq.c
@@ -283,7 +283,8 @@ int hvm_inject_msi(struct domain *d, uin
if ( !vector )
{
- int pirq = ((addr >> 32) & 0xffffff00) | ((addr >> 12) & 0xff);
+ int pirq = ((addr >> 32) & 0xffffff00) | dest;
+
if ( pirq > 0 )
{
struct pirq *info = pirq_info(d, pirq);
--- a/xen/drivers/passthrough/vtd/intremap.c
+++ b/xen/drivers/passthrough/vtd/intremap.c
@@ -535,7 +535,7 @@ static int remap_entry_to_msi_msg(
msg->dest32 = iremap_entry->lo.dst;
else
msg->dest32 = (iremap_entry->lo.dst >> 8) & 0xff;
- msg->address_lo |= (msg->dest32 & 0xff) << MSI_ADDR_DEST_ID_SHIFT;
+ msg->address_lo |= MSI_ADDR_DEST_ID(msg->dest32);
msg->data =
MSI_DATA_TRIGGER_EDGE |
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -1044,7 +1044,7 @@ static void dma_msi_set_affinity(struct
if (x2apic_enabled)
msg.address_hi = dest & 0xFFFFFF00;
msg.address_lo &= ~MSI_ADDR_DEST_ID_MASK;
- msg.address_lo |= MSI_ADDR_DEST_ID(dest & 0xff);
+ msg.address_lo |= MSI_ADDR_DEST_ID(dest);
iommu->msi.msg = msg;
spin_lock_irqsave(&iommu->register_lock, flags);
--- a/xen/include/asm-x86/msi.h
+++ b/xen/include/asm-x86/msi.h
@@ -49,7 +49,7 @@
#define MSI_ADDR_REDIRECTION_LOWPRI (1 << MSI_ADDR_REDIRECTION_SHIFT)
#define MSI_ADDR_DEST_ID_SHIFT 12
-#define MSI_ADDR_DEST_ID_MASK 0x00ffff0
+#define MSI_ADDR_DEST_ID_MASK 0x00ff000
#define MSI_ADDR_DEST_ID(dest) (((dest) << MSI_ADDR_DEST_ID_SHIFT) & MSI_ADDR_DEST_ID_MASK)
/* MAX fixed pages reserved for mapping MSIX tables. */
[-- Attachment #3: Type: text/plain, Size: 126 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
reply other threads:[~2014-05-12 13:52 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=5370EE50020000780001172D@mail.emea.novell.com \
--to=jbeulich@suse.com \
--cc=keir@xen.org \
--cc=xen-devel@lists.xenproject.org \
--cc=xiantao.zhang@intel.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;
as well as URLs for NNTP newsgroup(s).