Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 59177
b: refs/heads/master
c: 694625c
h: refs/heads/master
i:
  59175: 237df98
v: v3
  • Loading branch information
Randy Dunlap authored and Greg Kroah-Hartman committed Jul 11, 2007
1 parent 54647cd commit 72aef5f
Show file tree
Hide file tree
Showing 12 changed files with 39 additions and 19 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f5609d7e679db3f29433f56e1f2e397a2f815288
refs/heads/master: 694625c0b322905d6892fad873029f764cd4823f
5 changes: 4 additions & 1 deletion trunk/Documentation/pci.txt
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,10 @@ If the PCI device can use the PCI Memory-Write-Invalidate transaction,
call pci_set_mwi(). This enables the PCI_COMMAND bit for Mem-Wr-Inval
and also ensures that the cache line size register is set correctly.
Check the return value of pci_set_mwi() as not all architectures
or chip-sets may support Memory-Write-Invalidate.
or chip-sets may support Memory-Write-Invalidate. Alternatively,
if Mem-Wr-Inval would be nice to have but is not required, call
pci_try_set_mwi() to have the system do its best effort at enabling
Mem-Wr-Inval.


3.2 Request MMIO/IOP resources
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/ata/pata_cs5530.c
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ static int cs5530_init_chip(void)
}

pci_set_master(cs5530_0);
pci_set_mwi(cs5530_0);
pci_try_set_mwi(cs5530_0);

/*
* Set PCI CacheLineSize to 16-bytes:
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/ide/pci/cs5530.c
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ static unsigned int __devinit init_chipset_cs5530 (struct pci_dev *dev, const ch
*/

pci_set_master(cs5530_0);
pci_set_mwi(cs5530_0);
pci_try_set_mwi(cs5530_0);

/*
* Set PCI CacheLineSize to 16-bytes:
Expand Down
4 changes: 2 additions & 2 deletions trunk/drivers/net/cassini.c
Original file line number Diff line number Diff line change
Expand Up @@ -4917,13 +4917,13 @@ static int __devinit cas_init_one(struct pci_dev *pdev,
pci_cmd &= ~PCI_COMMAND_SERR;
pci_cmd |= PCI_COMMAND_PARITY;
pci_write_config_word(pdev, PCI_COMMAND, pci_cmd);
if (pci_set_mwi(pdev))
if (pci_try_set_mwi(pdev))
printk(KERN_WARNING PFX "Could not enable MWI for %s\n",
pci_name(pdev));

/*
* On some architectures, the default cache line size set
* by pci_set_mwi reduces perforamnce. We have to increase
* by pci_try_set_mwi reduces perforamnce. We have to increase
* it for this case. To start, we'll print some configuration
* data.
*/
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/net/starfire.c
Original file line number Diff line number Diff line change
Expand Up @@ -740,7 +740,7 @@ static int __devinit starfire_init_one(struct pci_dev *pdev,
pci_set_master(pdev);

/* enable MWI -- it vastly improves Rx performance on sparc64 */
pci_set_mwi(pdev);
pci_try_set_mwi(pdev);

#ifdef ZEROCOPY
/* Starfire can do TCP/UDP checksumming */
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/net/tulip/tulip_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1155,7 +1155,7 @@ static void __devinit tulip_mwi_config (struct pci_dev *pdev,
/* set or disable MWI in the standard PCI command bit.
* Check for the case where mwi is desired but not available
*/
if (csr0 & MWI) pci_set_mwi(pdev);
if (csr0 & MWI) pci_try_set_mwi(pdev);
else pci_clear_mwi(pdev);

/* read result from hardware (in case bit refused to enable) */
Expand Down
3 changes: 1 addition & 2 deletions trunk/drivers/net/wireless/prism54/islpci_hotplug.c
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,7 @@ prism54_probe(struct pci_dev *pdev, const struct pci_device_id *id)
pci_set_master(pdev);

/* enable MWI */
if (!pci_set_mwi(pdev))
printk(KERN_INFO "%s: pci_set_mwi(pdev) succeeded\n", DRV_NAME);
pci_try_set_mwi(pdev);

/* setup the network device interface and its structure */
if (!(ndev = islpci_setup(pdev))) {
Expand Down
28 changes: 24 additions & 4 deletions trunk/drivers/pci/pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -1186,6 +1186,11 @@ int pci_set_mwi(struct pci_dev *dev)
return 0;
}

int pci_try_set_mwi(struct pci_dev *dev)
{
return 0;
}

void pci_clear_mwi(struct pci_dev *dev)
{
}
Expand Down Expand Up @@ -1242,9 +1247,7 @@ pci_set_cacheline_size(struct pci_dev *dev)
* pci_set_mwi - enables memory-write-invalidate PCI transaction
* @dev: the PCI device for which MWI is enabled
*
* Enables the Memory-Write-Invalidate transaction in %PCI_COMMAND,
* and then calls @pcibios_set_mwi to do the needed arch specific
* operations or a generic mwi-prep function.
* Enables the Memory-Write-Invalidate transaction in %PCI_COMMAND.
*
* RETURNS: An appropriate -ERRNO error value on error, or zero for success.
*/
Expand All @@ -1260,14 +1263,30 @@ pci_set_mwi(struct pci_dev *dev)

pci_read_config_word(dev, PCI_COMMAND, &cmd);
if (! (cmd & PCI_COMMAND_INVALIDATE)) {
pr_debug("PCI: Enabling Mem-Wr-Inval for device %s\n", pci_name(dev));
pr_debug("PCI: Enabling Mem-Wr-Inval for device %s\n",
pci_name(dev));
cmd |= PCI_COMMAND_INVALIDATE;
pci_write_config_word(dev, PCI_COMMAND, cmd);
}

return 0;
}

/**
* pci_try_set_mwi - enables memory-write-invalidate PCI transaction
* @dev: the PCI device for which MWI is enabled
*
* Enables the Memory-Write-Invalidate transaction in %PCI_COMMAND.
* Callers are not required to check the return value.
*
* RETURNS: An appropriate -ERRNO error value on error, or zero for success.
*/
int pci_try_set_mwi(struct pci_dev *dev)
{
int rc = pci_set_mwi(dev);
return rc;
}

/**
* pci_clear_mwi - disables Memory-Write-Invalidate for device dev
* @dev: the PCI device to disable
Expand Down Expand Up @@ -1600,6 +1619,7 @@ EXPORT_SYMBOL(pci_release_selected_regions);
EXPORT_SYMBOL(pci_request_selected_regions);
EXPORT_SYMBOL(pci_set_master);
EXPORT_SYMBOL(pci_set_mwi);
EXPORT_SYMBOL(pci_try_set_mwi);
EXPORT_SYMBOL(pci_clear_mwi);
EXPORT_SYMBOL_GPL(pci_intx);
EXPORT_SYMBOL(pci_set_dma_mask);
Expand Down
5 changes: 1 addition & 4 deletions trunk/drivers/scsi/lpfc/lpfc_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -1578,10 +1578,7 @@ lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid)
INIT_LIST_HEAD(&phba->fc_nodes);

pci_set_master(pdev);
retval = pci_set_mwi(pdev);
if (retval)
dev_printk(KERN_WARNING, &pdev->dev,
"Warning: pci_set_mwi returned %d\n", retval);
pci_try_set_mwi(pdev);

if (pci_set_dma_mask(phba->pcidev, DMA_64BIT_MASK) != 0)
if (pci_set_dma_mask(phba->pcidev, DMA_32BIT_MASK) != 0)
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/usb/gadget/net2280.c
Original file line number Diff line number Diff line change
Expand Up @@ -2964,7 +2964,7 @@ static int net2280_probe (struct pci_dev *pdev, const struct pci_device_id *id)
, &dev->pci->pcimstctl);
/* erratum 0115 shouldn't appear: Linux inits PCI_LATENCY_TIMER */
pci_set_master (pdev);
pci_set_mwi (pdev);
pci_try_set_mwi (pdev);

/* ... also flushes any posted pci writes */
dev->chiprev = get_idx_reg (dev->regs, REG_CHIPREV) & 0xffff;
Expand Down
1 change: 1 addition & 0 deletions trunk/include/linux/pci.h
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,7 @@ void pci_set_master(struct pci_dev *dev);
int pci_set_pcie_reset_state(struct pci_dev *dev, enum pcie_reset_state state);
#define HAVE_PCI_SET_MWI
int __must_check pci_set_mwi(struct pci_dev *dev);
int pci_try_set_mwi(struct pci_dev *dev);
void pci_clear_mwi(struct pci_dev *dev);
void pci_intx(struct pci_dev *dev, int enable);
void pci_msi_off(struct pci_dev *dev);
Expand Down

0 comments on commit 72aef5f

Please sign in to comment.