This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
Home Products Support Community News


[Xen-devel] [PATCH] [xen/swiotlb] Enable Xen-SWIOTLB only if running in

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH] [xen/swiotlb] Enable Xen-SWIOTLB only if running in privileged domain or if in non-privileged with iommu=soft.
From: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
Date: Tue, 22 Dec 2009 14:05:00 -0500
Cc: Jeremy Fitzhardinge <jeremy@xxxxxxxx>, Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
Delivery-date: Tue, 22 Dec 2009 11:14:09 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <1261508700-5622-1-git-send-email-konrad.wilk@xxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <1261508700-5622-1-git-send-email-konrad.wilk@xxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Previous to this patch we would unconditionally enable Xen-SWIOTLB
if running in PV context. That does not work with Xen 3.4.2 as it has a
security check to disable exchanging of MFNs if no PCI devices have been
passed through. In 4.0 there is an additional check to allow 2MB super-pages
- we accidentally circumvented that by exchanging pages under the 2MB chunk size
even without any PCI devices passed through.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
 arch/x86/xen/pci-swiotlb.c |    6 ++++--
 drivers/pci/xen-pcifront.c |    2 ++
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/arch/x86/xen/pci-swiotlb.c b/arch/x86/xen/pci-swiotlb.c
index ecdbfe2..6195eb9 100644
--- a/arch/x86/xen/pci-swiotlb.c
+++ b/arch/x86/xen/pci-swiotlb.c
@@ -960,7 +960,8 @@ xen_swiotlb_fixup(void *buf, size_t size, unsigned long 
                } while (rc && dma_bits++ < max_dma_bits);
                if (rc)
-                       panic(KERN_ERR "xen_create_contiguous_region failed\n");
+                       panic(KERN_ERR "xen_create_contiguous_region failed: "
+                               "rc: %d\n", rc);
                i += slabs;
        } while(i < nslabs);
@@ -984,7 +985,8 @@ static struct dma_map_ops xen_swiotlb_dma_ops = {
 void __init xen_swiotlb_init(void)
-       if (xen_domain()) {
+       /* For PV guest, only if iommu=soft is passed in. */
+       if (xen_pv_domain() && (xen_initial_domain() || swiotlb)) {
                printk(KERN_INFO "PCI-DMA: Using Xen software bounce buffering 
for IO (Xen-SWIOTLB)\n");
                xen_swiotlb_init_with_default_size(64 * (1<<20));       /* 
default to 64MB */
                dma_ops = &xen_swiotlb_dma_ops;
diff --git a/drivers/pci/xen-pcifront.c b/drivers/pci/xen-pcifront.c
index cc3b51b..3436202 100644
--- a/drivers/pci/xen-pcifront.c
+++ b/drivers/pci/xen-pcifront.c
@@ -1052,6 +1052,8 @@ static void __init_refok pcifront_backend_changed(struct 
xenbus_device *xdev,
        case XenbusStateInitWait:
        case XenbusStateInitialised:
        case XenbusStateClosed:
+               dev_warn(&xdev->dev, "Device is in %d state. Need to change "
+                       "state on the privileged domain.\n", be_state);
        case XenbusStateConnected:

Xen-devel mailing list

<Prev in Thread] Current Thread [Next in Thread>