Skip to contentSkip to conversation

use mmiowb in via-rhine

PATCH In review Matt Mackall 2 participants 3 messages Jan 19, 2005 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 use mmiowb in via-rhine

Use the generic PCI memory barrier. Test-compiled.

drivers/net/via-rhine.c +4 -7
Index: bk/drivers/net/via-rhine.c
===================================================================
@@ -351,9 +351,6 @@
  * indicator. In addition, Tx and Rx buffers need to 4 byte aligned.
  */
 
-/* Beware of PCI posted writes */
-#define IOSYNC	do { ioread8(ioaddr + StationAddr); } while (0)
-
 static struct pci_device_id rhine_pci_tbl[] =
 {
 	{0x1106, 0x3043, PCI_ANY_ID, PCI_ANY_ID, 0, 0, }, /* VT86C100A */
@@ -596,7 +593,7 @@
 	void __iomem *ioaddr = rp->base;
 
 	iowrite8(Cmd1Reset, ioaddr + ChipCmd1);
-	IOSYNC;
+	mmiowb();
 
 	if (ioread8(ioaddr + ChipCmd1) & Cmd1Reset) {
 		printk(KERN_INFO "%s: Reset not complete yet. "
@@ -1305,7 +1302,7 @@
 	/* Wake the potentially-idle transmit channel */
 	iowrite8(ioread8(ioaddr + ChipCmd1) | Cmd1TxDemand,
 	       ioaddr + ChipCmd1);
-	IOSYNC;
+	mmiowb();
 
 	if (rp->cur_tx == rp->dirty_tx + TX_QUEUE_LEN)
 		netif_stop_queue(dev);
@@ -1339,7 +1336,7 @@
 		if (intr_status & IntrTxDescRace)
 			iowrite8(0x08, ioaddr + IntrStatus2);
 		iowrite16(intr_status & 0xffff, ioaddr + IntrStatus);
-		IOSYNC;
+		mmiowb();
 
 		if (debug > 4)
 			printk(KERN_DEBUG "%s: Interrupt, status %8.8x.\n",
@@ -1602,7 +1599,7 @@
 		       ioaddr + ChipCmd);
 		iowrite8(ioread8(ioaddr + ChipCmd1) | Cmd1TxDemand,
 		       ioaddr + ChipCmd1);
-		IOSYNC;
+		mmiowb();
 	}
 	else {
 		/* This should never happen */
Signature · 1 line
Mathematics is the supreme nostalgia of our time.
#1 lore raw
Quoted 1 line · Matt Mackall

Use the generic PCI memory barrier. Test-compiled.

Ignore that, doesn't work as I thought. mmiowb prevents write reordering on multiple CPUs like Altix but doesn't prevent posting. Perhaps another barrier is needed.

Quoted 55 lines

Index: bk/drivers/net/via-rhine.c
===================================================================

drivers/net/via-rhine.c +4 -7
@@ -351,9 +351,6 @@
  * indicator. In addition, Tx and Rx buffers need to 4 byte aligned.
  */
 
-/* Beware of PCI posted writes */
-#define IOSYNC	do { ioread8(ioaddr + StationAddr); } while (0)
-
 static struct pci_device_id rhine_pci_tbl[] =
 {
 	{0x1106, 0x3043, PCI_ANY_ID, PCI_ANY_ID, 0, 0, }, /* VT86C100A */
@@ -596,7 +593,7 @@
 	void __iomem *ioaddr = rp->base;
 
 	iowrite8(Cmd1Reset, ioaddr + ChipCmd1);
-	IOSYNC;
+	mmiowb();
 
 	if (ioread8(ioaddr + ChipCmd1) & Cmd1Reset) {
 		printk(KERN_INFO "%s: Reset not complete yet. "
@@ -1305,7 +1302,7 @@
 	/* Wake the potentially-idle transmit channel */
 	iowrite8(ioread8(ioaddr + ChipCmd1) | Cmd1TxDemand,
 	       ioaddr + ChipCmd1);
-	IOSYNC;
+	mmiowb();
 
 	if (rp->cur_tx == rp->dirty_tx + TX_QUEUE_LEN)
 		netif_stop_queue(dev);
@@ -1339,7 +1336,7 @@
 		if (intr_status & IntrTxDescRace)
 			iowrite8(0x08, ioaddr + IntrStatus2);
 		iowrite16(intr_status & 0xffff, ioaddr + IntrStatus);
-		IOSYNC;
+		mmiowb();
 
 		if (debug > 4)
 			printk(KERN_DEBUG "%s: Interrupt, status %8.8x.\n",
@@ -1602,7 +1599,7 @@
 		       ioaddr + ChipCmd);
 		iowrite8(ioread8(ioaddr + ChipCmd1) | Cmd1TxDemand,
 		       ioaddr + ChipCmd1);
-		IOSYNC;
+		mmiowb();
 	}
 	else {
 		/* This should never happen */
Signature · 2 lines
-- 
Mathematics is the supreme nostalgia of our time.
Signature · 1 line
Mathematics is the supreme nostalgia of our time.
#2 lore raw
In reply to Matt Mackall
Quoted 1 line · Matt Mackall

Use the generic PCI memory barrier. Test-compiled.

This can't be right.

drivers/net/via-rhine.c line 356

Quoted 13 lines

Index: bk/drivers/net/via-rhine.c
===================================================================

drivers/net/via-rhine.c +0 -3
@@ -351,9 +351,6 @@
  * indicator. In addition, Tx and Rx buffers need to 4 byte aligned.
  */
 
-/* Beware of PCI posted writes */
-#define IOSYNC	do { ioread8(ioaddr + StationAddr); } while (0)
-

You're replacing a PCI ordering barrier with..

include/asm-i386/io.h:#define mmiowb()

nothing ?

Dave