Skip to contentSkip to conversation

linux: address broken PAT drivers

PATCH Superseded Luis R. Rodriguez 4 participants 7 messages Jun 11, 2015 – Jun 12, 2015

Subsystems (4)

v6 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

v6 cover linux: address broken PAT drivers

From: "Luis R. Rodriguez" <[email protected]>

Mauro,

since the ivtv patch is already acked by the driver maintainer and depends on an x86 symbol that went through Boris' tree are you OK in it going through Boris' tree?

Boris,

provided the outcome of the above maintainer's preference for you to merge these please consider these patches for your tree. The maintainer path is the only thing pending for the 1 ivtv patch. The Infiniband subsystem maintainer, Doug, already provided his ACK for the ipath driver and for this to go through you.

Luis R. Rodriguez (3):
ivtv: use arch_phys_wc_add() and require PAT disabled IB/ipath: add counting for MTRR
IB/ipath: use arch_phys_wc_add() and require PAT disabled

 drivers/infiniband/hw/ipath/Kconfig           |  3 ++
 drivers/infiniband/hw/ipath/ipath_driver.c    | 18 ++++++---
 drivers/infiniband/hw/ipath/ipath_kernel.h    |  4 +-
 drivers/infiniband/hw/ipath/ipath_wc_x86_64.c | 43 +++++---------------
 drivers/media/pci/ivtv/Kconfig                |  3 ++
 drivers/media/pci/ivtv/ivtvfb.c               | 58 +++++++++++----------------
 6 files changed, 52 insertions(+), 77 deletions(-)
Signature · 1 line
2.3.2.209.gd67f9d5.dirty
#1 lore raw

PATCH v6 1/3 ivtv: use arch_phys_wc_add() and require PAT disabled

From: "Luis R. Rodriguez" <[email protected]>

We are burrying direct access to MTRR code support on x86 in order to take advantage of PAT. In the future we also want to make the default behaviour of ioremap_nocache() to use strong UC, use of mtrr_add() on those systems would make write-combining void.

In order to help both enable us to later make strong UC default and in order to phase out direct MTRR access code port the driver over to arch_phys_wc_add() and annotate that the device driver requires systems to boot with PAT disabled, with the nopat kernel parameter.

This is a worthy comprmise given that the hardware is really rare these days, and perhaps only some lost souls in some third world country are expected to be using this feature of the device driver.

Cc Andy Walls <[email protected]>
Cc Doug Ledford <[email protected]>
Cc Mauro Carvalho Chehab <[email protected]>
Cc Andy Lutomirski <[email protected]>
Cc Suresh Siddha <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Juergen Gross <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Dave Airlie <[email protected]>
Cc Bjorn Helgaas <[email protected]>
Cc Antonino Daplas <[email protected]>
Cc Jean-Christophe Plagniol-Villard <[email protected]>
Cc Tomi Valkeinen <[email protected]>
Cc Dave Hansen <[email protected]>
Cc Arnd Bergmann <[email protected]>
Cc Michael S. Tsirkin <[email protected]>
Cc Stefan Bader <[email protected]>
Cc Ville Syrjälä <[email protected]>
Cc Mel Gorman <[email protected]>
Cc Vlastimil Babka <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Davidlohr Bueso <[email protected]>
Cc Roger Pau Monné <[email protected]>
---
 drivers/media/pci/ivtv/Kconfig  |  3 +++
 drivers/media/pci/ivtv/ivtvfb.c | 58 ++++++++++++++++-------------------------
 2 files changed, 26 insertions(+), 35 deletions(-)
drivers/media/pci/ivtv/Kconfig +3 -0
index dd6ee57e..b2a7f88 100644
@@ -57,5 +57,8 @@ config VIDEO_FB_IVTV
 	  This is used in the Hauppauge PVR-350 card. There is a driver
 	  homepage at <http://www.ivtvdriver.org>.
 
+	  If you have this hardware you will need to boot with PAT disabled
+	  on your x86 systems, use the nopat kernel parameter.
+
 	  To compile this driver as a module, choose M here: the
 	  module will be called ivtvfb.
drivers/media/pci/ivtv/ivtvfb.c +23 -35

98 lines not on this page · raw message

Signature · 1 line
2.3.2.209.gd67f9d5.dirty
#2 lore raw

PATCH v6 2/3 IB/ipath: add counting for MTRR

In reply to Luis R. Rodriguez

From: "Luis R. Rodriguez" <[email protected]>

There is no good reason not to, we eventually delete it as well.

Cc Toshi Kani <[email protected]>
Cc Roland Dreier <[email protected]>
Cc Sean Hefty <[email protected]>
Cc Hal Rosenstock <[email protected]>
Cc Suresh Siddha <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Juergen Gross <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Andy Lutomirski <[email protected]>
Cc Dave Airlie <[email protected]>
Cc Antonino Daplas <[email protected]>
Cc Jean-Christophe Plagniol-Villard <[email protected]>
Cc Tomi Valkeinen <[email protected]>
---
 drivers/infiniband/hw/ipath/ipath_wc_x86_64.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/hw/ipath/ipath_wc_x86_64.c +1 -1
index 4ad0b93..70c1f3a 100644
@@ -127,7 +127,7 @@ int ipath_enable_wc(struct ipath_devdata *dd)
 			   "(addr %llx, len=0x%llx)\n",
 			   (unsigned long long) pioaddr,
 			   (unsigned long long) piolen);
-		cookie = mtrr_add(pioaddr, piolen, MTRR_TYPE_WRCOMB, 0);
+		cookie = mtrr_add(pioaddr, piolen, MTRR_TYPE_WRCOMB, 1);
 		if (cookie < 0) {
 			{
 				dev_info(&dd->pcidev->dev,
Signature · 1 line
2.3.2.209.gd67f9d5.dirty
#5 lore raw

PATCH v6 3/3 IB/ipath: use arch_phys_wc_add() and require PAT disabled

In reply to Luis R. Rodriguez

From: "Luis R. Rodriguez" <[email protected]>

We are burrying direct access to MTRR code support on x86 in order to take advantage of PAT. In the future we also want to make the default behaviour of ioremap_nocache() to use strong UC, use of mtrr_add() on those systems would make write-combining void.

In order to help both enable us to later make strong UC default and in order to phase out direct MTRR access code port the driver over to arch_phys_wc_add() and annotate that the device driver requires systems to boot with PAT disabled, with the nopat kernel parameter.

This is a worthy compromise given that the ipath device driver powers the old HTX bus cards that only work in AMD systems, while the newer IB/qib device driver powers all PCI-e cards. The ipath device driver is obsolete, hardware hard to find and because of this this its a reasonable compromise to make to require users of ipath to boot with nopat.

Cc Doug Ledford <[email protected]>
Cc Andy Walls <[email protected]>
Cc Hal Rosenstock <[email protected]>
Cc Sean Hefty <[email protected]>
Cc Suresh Siddha <[email protected]>
Cc Rickard Strandqvist <[email protected]>
Cc Mike Marciniszyn <[email protected]>
Cc Roland Dreier <[email protected]>
Cc Andy Lutomirski <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Linus Torvalds <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Juergen Gross <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Dave Airlie <[email protected]>
Cc Bjorn Helgaas <[email protected]>
Cc Antonino Daplas <[email protected]>
Cc Jean-Christophe Plagniol-Villard <[email protected]>
Cc Tomi Valkeinen <[email protected]>
Cc Ville Syrjälä <[email protected]>
Cc Mel Gorman <[email protected]>
Cc Vlastimil Babka <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Davidlohr Bueso <[email protected]>
Cc Dave Hansen <[email protected]>
Cc Arnd Bergmann <[email protected]>
Cc Michael S. Tsirkin <[email protected]>
Cc Stefan Bader <[email protected]>
Cc Roger Pau Monné <[email protected]>
---
 drivers/infiniband/hw/ipath/Kconfig           |  3 ++
 drivers/infiniband/hw/ipath/ipath_driver.c    | 18 +++++++----
 drivers/infiniband/hw/ipath/ipath_kernel.h    |  4 +--
 drivers/infiniband/hw/ipath/ipath_wc_x86_64.c | 43 ++++++---------------------
 4 files changed, 26 insertions(+), 42 deletions(-)
drivers/infiniband/hw/ipath/Kconfig +3 -0
index 1d9bb11..8fe54ff 100644
@@ -9,3 +9,6 @@ config INFINIBAND_IPATH
 	as IP-over-InfiniBand as well as with userspace applications
 	(in conjunction with InfiniBand userspace access).
 	For QLogic PCIe QLE based cards, use the QIB driver instead.
+
+	If you have this hardware you will need to boot with PAT disabled
+	on your x86-64 systems, use the nopat kernel parameter.
drivers/infiniband/hw/ipath/ipath_driver.c +13 -5
index bd0caed..441cfe5 100644
@@ -42,6 +42,9 @@
 #include <linux/bitmap.h>
 #include <linux/slab.h>
 #include <linux/module.h>
+#ifdef CONFIG_X86_64
+#include <asm/pat.h>
+#endif
 
 #include "ipath_kernel.h"
 #include "ipath_verbs.h"
@@ -395,6 +398,14 @@ static int ipath_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 	unsigned long long addr;
 	u32 bar0 = 0, bar1 = 0;
 
+#ifdef CONFIG_X86_64
+	if (WARN(pat_enabled(),
+		 "ipath needs PAT disabled, boot with nopat kernel parameter\n")) {
+		ret = EINVAL;
+		goto bail;
+	}
+#endif
+
 	dd = ipath_alloc_devdata(pdev);
 	if (IS_ERR(dd)) {
 		ret = PTR_ERR(dd);
@@ -542,6 +553,7 @@ static int ipath_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 	dd->ipath_kregbase = __ioremap(addr, len,
 		(_PAGE_NO_CACHE|_PAGE_WRITETHRU));
 #else
+	/* XXX: split this properly to enable on PAT */
 	dd->ipath_kregbase = ioremap_nocache(addr, len);
 #endif
 
@@ -587,12 +599,8 @@ static int ipath_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 
 	ret = ipath_enable_wc(dd);
 
-	if (ret) {
-		ipath_dev_err(dd, "Write combining not enabled "
-			      "(err %d): performance may be poor\n",
-			      -ret);
+	if (ret)
 		ret = 0;
-	}
 
 	ipath_verify_pioperf(dd);
 
drivers/infiniband/hw/ipath/ipath_kernel.h +1 -3
index e08db70..f0f9471 100644
@@ -463,9 +463,7 @@ struct ipath_devdata {
 	/* offset in HT config space of slave/primary interface block */
 	u8 ipath_ht_slave_off;
 	/* for write combining settings */
-	unsigned long ipath_wc_cookie;
-	unsigned long ipath_wc_base;
-	unsigned long ipath_wc_len;
+	int wc_cookie;
 	/* ref count for each pkey */
 	atomic_t ipath_pkeyrefs[4];
 	/* shadow copy of struct page *'s for exp tid pages */
drivers/infiniband/hw/ipath/ipath_wc_x86_64.c +9 -34

59 lines not on this page · raw message

Signature · 1 line
2.3.2.209.gd67f9d5.dirty
#3 lore raw

Re: [PATCH v6 2/3] IB/ipath: add counting for MTRR

In reply to Luis R. Rodriguez
Quoted 32 lines · Luis R. Rodriguez

From: "Luis R. Rodriguez" <[email protected]>

There is no good reason not to, we eventually delete it as well.

Cc Toshi Kani <[email protected]>
Cc Roland Dreier <[email protected]>
Cc Sean Hefty <[email protected]>
Cc Hal Rosenstock <[email protected]>
Cc Suresh Siddha <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Juergen Gross <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Andy Lutomirski <[email protected]>
Cc Dave Airlie <[email protected]>
Cc Antonino Daplas <[email protected]>
Cc Jean-Christophe Plagniol-Villard <[email protected]>
Cc Tomi Valkeinen <[email protected]>
---
 drivers/infiniband/hw/ipath/ipath_wc_x86_64.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/hw/ipath/ipath_wc_x86_64.c +0 -0
index 4ad0b93..70c1f3a 100644

drivers/infiniband/hw/ipath/ipath_wc_x86_64.c int ipath_enable_wc(struct ipath_devdata *dd)

Quoted 9 lines
drivers/infiniband/hw/ipath/ipath_wc_x86_64.c +1 -2
@@ -127,7 +127,7 @@ int ipath_enable_wc(struct ipath_devdata *dd)
 			   "(addr %llx, len=0x%llx)\n",
 			   (unsigned long long) pioaddr,
 			   (unsigned long long) piolen);
-		cookie = mtrr_add(pioaddr, piolen, MTRR_TYPE_WRCOMB, 0);
+		cookie = mtrr_add(pioaddr, piolen, MTRR_TYPE_WRCOMB, 1);
 		if (cookie < 0) {
 			{
 				dev_info(&dd->pcidev->dev,
--

Doug, ack?

Signature · 5 lines
Regards/Gruss,
    Boris.

ECO tip #101: Trim your mails when you reply.
--
#6 lore raw
In reply to Luis R. Rodriguez
Quoted 7 lines · Luis R. Rodriguez

From: "Luis R. Rodriguez" <mcgrof-IBi9RG/[email protected]>

Mauro,

since the ivtv patch is already acked by the driver maintainer and depends on an x86 symbol that went through Boris' tree are you OK in it going through Boris' tree?

Sorry I resent v6 by mistake, will send the v7 with the fix you requested.

Luis
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#4 lore raw

Re: [PATCH v6 2/3] IB/ipath: add counting for MTRR

In reply to Borislav Petkov
Quoted 28 lines · Borislav Petkov
Quoted 27 lines · Luis R. Rodriguez

From: "Luis R. Rodriguez" <[email protected]>

There is no good reason not to, we eventually delete it as well.

Cc Toshi Kani <[email protected]>
Cc Roland Dreier <[email protected]>
Cc Sean Hefty <[email protected]>
Cc Hal Rosenstock <[email protected]>
Cc Suresh Siddha <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Juergen Gross <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Andy Lutomirski <[email protected]>
Cc Dave Airlie <[email protected]>
Cc Antonino Daplas <[email protected]>
Cc Jean-Christophe Plagniol-Villard <[email protected]>
Cc Tomi Valkeinen <[email protected]>
---
 drivers/infiniband/hw/ipath/ipath_wc_x86_64.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 17 lines
Quoted 5 lines
drivers/infiniband/hw/ipath/ipath_wc_x86_64.c +0 -0
index 4ad0b93..70c1f3a 100644

drivers/infiniband/hw/ipath/ipath_wc_x86_64.c int ipath_enable_wc(struct ipath_devdata *dd)

Quoted 9 lines
drivers/infiniband/hw/ipath/ipath_wc_x86_64.c +1 -2
@@ -127,7 +127,7 @@ int ipath_enable_wc(struct ipath_devdata *dd)
 			   "(addr %llx, len=0x%llx)\n",
 			   (unsigned long long) pioaddr,
 			   (unsigned long long) piolen);
-		cookie = mtrr_add(pioaddr, piolen, MTRR_TYPE_WRCOMB, 0);
+		cookie = mtrr_add(pioaddr, piolen, MTRR_TYPE_WRCOMB, 1);
 		if (cookie < 0) {
 			{
 				dev_info(&dd->pcidev->dev,
--

Doug, ack?

Ack.