aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci
diff options
context:
space:
mode:
authorKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>2012-07-31 06:26:59 -0400
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>2012-09-17 13:00:42 -0400
commit3d925320e9e2de162bd138bf97816bda8c3f71be (patch)
tree23b8b053e7094cbc220ced14a6a4173d4ade369f /drivers/pci
parentc468bdee28a1cb61d9b7a8ce9859d17dee43b7d7 (diff)
xen/pcifront: Use Xen-SWIOTLB when initting if required.
We piggyback on "xen/swiotlb: Use the swiotlb_late_init_with_tbl to init Xen-SWIOTLB late when PV PCI is used." functionality to start up the Xen-SWIOTLB if we are hot-plugged. This allows us to bypass the need to supply 'iommu=soft' on the Linux command line (mostly). With this patch, if a user forgot 'iommu=soft' on the command line, and hotplug a PCI device they will get: pcifront pci-0: Installing PCI frontend Warning: only able to allocate 4 MB for software IO TLB software IO TLB [mem 0x2a000000-0x2a3fffff] (4MB) mapped at [ffff88002a000000-ffff88002a3fffff] pcifront pci-0: Creating PCI Frontend Bus 0000:00 pcifront pci-0: PCI host bridge to bus 0000:00 pci_bus 0000:00: root bus resource [io 0x0000-0xffff] pci_bus 0000:00: root bus resource [mem 0x00000000-0xfffffffff] pci 0000:00:00.0: [8086:10d3] type 00 class 0x020000 pci 0000:00:00.0: reg 10: [mem 0xfe5c0000-0xfe5dffff] pci 0000:00:00.0: reg 14: [mem 0xfe500000-0xfe57ffff] pci 0000:00:00.0: reg 18: [io 0xe000-0xe01f] pci 0000:00:00.0: reg 1c: [mem 0xfe5e0000-0xfe5e3fff] pcifront pci-0: claiming resource 0000:00:00.0/0 pcifront pci-0: claiming resource 0000:00:00.0/1 pcifront pci-0: claiming resource 0000:00:00.0/2 pcifront pci-0: claiming resource 0000:00:00.0/3 e1000e: Intel(R) PRO/1000 Network Driver - 2.0.0-k e1000e: Copyright(c) 1999 - 2012 Intel Corporation. e1000e 0000:00:00.0: Disabling ASPM L0s L1 e1000e 0000:00:00.0: enabling device (0000 -> 0002) e1000e 0000:00:00.0: Xen PCI mapped GSI16 to IRQ34 e1000e 0000:00:00.0: (unregistered net_device): Interrupt Throttling Rate (ints/sec) set to dynamic conservative mode e1000e 0000:00:00.0: eth0: (PCI Express:2.5GT/s:Width x1) 00:1b:21:ab:c6:13 e1000e 0000:00:00.0: eth0: Intel(R) PRO/1000 Network Connection e1000e 0000:00:00.0: eth0: MAC: 3, PHY: 8, PBA No: E46981-005 The "Warning only" will go away if one supplies 'iommu=soft' instead as we have a higher chance of being able to allocate large swaths of memory. Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Diffstat (limited to 'drivers/pci')
-rw-r--r--drivers/pci/xen-pcifront.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/drivers/pci/xen-pcifront.c b/drivers/pci/xen-pcifront.c
index d6cc62cb4cf..0ad8ca32638 100644
--- a/drivers/pci/xen-pcifront.c
+++ b/drivers/pci/xen-pcifront.c
@@ -21,6 +21,7 @@
21#include <linux/bitops.h> 21#include <linux/bitops.h>
22#include <linux/time.h> 22#include <linux/time.h>
23 23
24#include <asm/xen/swiotlb-xen.h>
24#define INVALID_GRANT_REF (0) 25#define INVALID_GRANT_REF (0)
25#define INVALID_EVTCHN (-1) 26#define INVALID_EVTCHN (-1)
26 27
@@ -668,7 +669,7 @@ static irqreturn_t pcifront_handler_aer(int irq, void *dev)
668 schedule_pcifront_aer_op(pdev); 669 schedule_pcifront_aer_op(pdev);
669 return IRQ_HANDLED; 670 return IRQ_HANDLED;
670} 671}
671static int pcifront_connect(struct pcifront_device *pdev) 672static int pcifront_connect_and_init_dma(struct pcifront_device *pdev)
672{ 673{
673 int err = 0; 674 int err = 0;
674 675
@@ -681,9 +682,13 @@ static int pcifront_connect(struct pcifront_device *pdev)
681 dev_err(&pdev->xdev->dev, "PCI frontend already installed!\n"); 682 dev_err(&pdev->xdev->dev, "PCI frontend already installed!\n");
682 err = -EEXIST; 683 err = -EEXIST;
683 } 684 }
684
685 spin_unlock(&pcifront_dev_lock); 685 spin_unlock(&pcifront_dev_lock);
686 686
687 if (!err && !swiotlb_nr_tbl()) {
688 err = pci_xen_swiotlb_init_late();
689 if (err)
690 dev_err(&pdev->xdev->dev, "Could not setup SWIOTLB!\n");
691 }
687 return err; 692 return err;
688} 693}
689 694
@@ -842,10 +847,10 @@ static int __devinit pcifront_try_connect(struct pcifront_device *pdev)
842 XenbusStateInitialised) 847 XenbusStateInitialised)
843 goto out; 848 goto out;
844 849
845 err = pcifront_connect(pdev); 850 err = pcifront_connect_and_init_dma(pdev);
846 if (err) { 851 if (err) {
847 xenbus_dev_fatal(pdev->xdev, err, 852 xenbus_dev_fatal(pdev->xdev, err,
848 "Error connecting PCI Frontend"); 853 "Error setting up PCI Frontend");
849 goto out; 854 goto out;
850 } 855 }
851 856