From: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
To: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Matthew Wilcox <willy@linux.intel.com>,
Jesse Barnes <jbarnes@virtuousgeek.org>
Subject: [PATCH] PCI/MSI: fix msi_mask()
Date: Thu, 05 Feb 2009 11:47:36 +0900 [thread overview]
Message-ID: <498A5348.3090508@jp.fujitsu.com> (raw)
The commit bffac3c593eba1f9da3efd0199e49ea6558a40ce does:
- temp = (1 << multi_msi_capable(control));
- temp = ((temp - 1) & ~temp);
+ temp = msi_mask((control & PCI_MSI_FLAGS_QMASK) >> 1);
and provides msi_mask() to avoid undefined shift by 32.
According to PCI Local Bus Spec 3.0 "6.8.1.3 Message Control for MSI",
relations between the encoded bits in control register, the number of
vectors and the proper maskbits should be as following table:
control[3::1] | vectors | maskbits
--------------+----------+-----------
000b | 1 | 0x1
001b | 2 | 0x3
010b | 4 | 0xf
011b | 8 | 0xff
100b | 16 | 0xffff
101b | 32 | 0xffffffff
110b | Reserved | n/a
111b | Reserved | n/a
This patch fix the wrong array in the msi_mask().
Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
---
drivers/pci/msi.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
index 44f15ff..1c88958 100644
--- a/drivers/pci/msi.c
+++ b/drivers/pci/msi.c
@@ -109,7 +109,7 @@ static void msix_set_enable(struct pci_dev *dev, int enable)
*/
static inline __attribute_const__ u32 msi_mask(unsigned x)
{
- static const u32 mask[] = { 1, 2, 4, 0xf, 0xff, 0xffff, 0xffffffff };
+ static const u32 mask[] = { 1, 3, 0xf, 0xff, 0xffff, 0xffffffff };
return mask[x];
}
--
1.6.0
next reply other threads:[~2009-02-05 2:47 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-05 2:47 Hidetoshi Seto [this message]
2009-02-08 11:26 ` [PATCH] PCI/MSI: fix msi_mask() Matthew Wilcox
2009-02-09 1:38 ` Hidetoshi Seto
2009-02-09 1:40 ` [PATCH] PCI/MSI: fix msi_mask() (rev. 2) Hidetoshi Seto
2009-02-09 3:27 ` Matthew Wilcox
2009-02-09 4:31 ` Hidetoshi Seto
2009-02-09 17:23 ` Jesse Barnes
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=498A5348.3090508@jp.fujitsu.com \
--to=seto.hidetoshi@jp.fujitsu.com \
--cc=jbarnes@virtuousgeek.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=willy@linux.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