Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 22 Jun 2011 02:23:18 +0000 (UTC)
From:      Nathan Whitehorn <nwhitehorn@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r223406 - head/sys/powerpc/ps3
Message-ID:  <201106220223.p5M2NI11027754@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: nwhitehorn
Date: Wed Jun 22 02:23:18 2011
New Revision: 223406
URL: http://svn.freebsd.org/changeset/base/223406

Log:
  This is more complicated than I expected. Storage devices need the IOMMU
  set up, but must not use it.

Modified:
  head/sys/powerpc/ps3/ps3bus.c

Modified: head/sys/powerpc/ps3/ps3bus.c
==============================================================================
--- head/sys/powerpc/ps3/ps3bus.c	Wed Jun 22 02:18:45 2011	(r223405)
+++ head/sys/powerpc/ps3/ps3bus.c	Wed Jun 22 02:23:18 2011	(r223406)
@@ -631,7 +631,8 @@ ps3bus_get_dma_tag(device_t dev, device_
 	struct ps3bus_softc *sc = device_get_softc(dev);
 	int i, err, flags;
 
-	if (dinfo->bustype != PS3_BUSTYPE_SYSBUS)
+	if (dinfo->bustype != PS3_BUSTYPE_SYSBUS &&
+	    dinfo->bustype != PS3_BUSTYPE_STORAGE)
 		return (bus_get_dma_tag(dev));
 
 	mtx_lock(&dinfo->iommu_mtx);
@@ -671,7 +672,15 @@ ps3bus_get_dma_tag(device_t dev, device_
 	    NULL, NULL, BUS_SPACE_MAXSIZE, 0, BUS_SPACE_MAXSIZE,
 	    0, NULL, NULL, &dinfo->dma_tag);
 
-	bus_dma_tag_set_iommu(dinfo->dma_tag, dev, dinfo);
+	/*
+	 * Note: storage devices have IOMMU mappings set up by the hypervisor,
+	 * but use physical, non-translated addresses. The above IOMMU
+	 * initialization is necessary for the hypervisor to be able to set up
+	 * the mappings, but actual DMA mappings should not use the IOMMU
+	 * routines.
+	 */
+	if (dinfo->bustype != PS3_BUSTYPE_STORAGE)
+		bus_dma_tag_set_iommu(dinfo->dma_tag, dev, dinfo);
 
 fail:
 	mtx_unlock(&dinfo->iommu_mtx);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201106220223.p5M2NI11027754>