linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [BUGFIX][PATCH] pci: check for 4k resource_size alignment in sriov_init
@ 2012-01-27 19:10 Vaidyanathan Srinivasan
  2012-01-27 21:05 ` Yinghai Lu
  2012-01-30  3:18 ` Ram Pai
  0 siblings, 2 replies; 9+ messages in thread
From: Vaidyanathan Srinivasan @ 2012-01-27 19:10 UTC (permalink / raw)
  To: Ram Pai, Jesse Barnes, Yinghai Lu; +Cc: linux-pci, linux-kernel

Hi Ram and Jesse,

I found a trivial issue with page size alignment check on IBM POWER
box with 64k base page size.  In sriov_init(), changing the check from
PAGE_SIZE (arch and config dependent) to HW_PAGE_SIZE (always 4k) was
required to use one of the sriov adapter as PF since the
resource_size() comes up as 0x8000 and PAGE_SIZE would be 0x10000 for
pseries boxes.

I think resource_size() could be less than SystemPageSize, but I would
like your comments/ack/nack on any consequences of checking for only
4k alignment here in a system with larger base page size.

Thanks,
Vaidy

---

    pci: check for 4k resource_size alignment in sriov_init
    
    pci sriov_init should check for 4k page size alignment of resource_size
    even if base page size is larger -- like 64k in powerpc.
    
    Signed-off-by: Vaidyanathan Srinivasan <svaidy@linux.vnet.ibm.com>

diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c
index 0321fa3..5816fa0 100644
--- a/drivers/pci/iov.c
+++ b/drivers/pci/iov.c
@@ -474,7 +474,7 @@ found:
 				     pos + PCI_SRIOV_BAR + i * 4);
 		if (!res->flags)
 			continue;
-		if (resource_size(res) & (PAGE_SIZE - 1)) {
+		if (resource_size(res) & (HW_PAGE_SIZE - 1)) {
 			rc = -EIO;
 			goto failed;
 		}


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2012-02-13  3:08 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-27 19:10 [BUGFIX][PATCH] pci: check for 4k resource_size alignment in sriov_init Vaidyanathan Srinivasan
2012-01-27 21:05 ` Yinghai Lu
2012-01-29 13:11   ` Vaidyanathan Srinivasan
2012-01-30  3:18 ` Ram Pai
2012-01-31 17:44   ` Vaidyanathan Srinivasan
2012-02-01  6:21     ` Ram Pai
2012-02-01 13:02       ` Vaidyanathan Srinivasan
2012-02-10 19:54         ` Jesse Barnes
2012-02-13  3:08           ` Ram Pai

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).