diff options
author | Vikram Hegde <Vikram.Hegde@Sun.COM> | 2009-07-01 08:42:32 -0700 |
---|---|---|
committer | Vikram Hegde <Vikram.Hegde@Sun.COM> | 2009-07-01 08:42:32 -0700 |
commit | e085f1530a2b52c62d916408e99d66a557855d42 (patch) | |
tree | 54bb93bba554441cdc78936400595fc20a7bfcf3 | |
parent | 2ce278eb5cbdc9cfe3f361f2144877964b5a35cb (diff) | |
download | illumos-joyent-e085f1530a2b52c62d916408e99d66a557855d42.tar.gz |
6855752 panic(BAD TRAP) on lynx/wasp/X2270 platforms installing snv_118r1
-rw-r--r-- | usr/src/uts/i86pc/io/rootnex.c | 28 | ||||
-rw-r--r-- | usr/src/uts/intel/io/iommulib.c | 4 | ||||
-rw-r--r-- | usr/src/uts/intel/sys/iommulib.h | 15 |
3 files changed, 24 insertions, 23 deletions
diff --git a/usr/src/uts/i86pc/io/rootnex.c b/usr/src/uts/i86pc/io/rootnex.c index c5b41c82ba..b4ae6eba8e 100644 --- a/usr/src/uts/i86pc/io/rootnex.c +++ b/usr/src/uts/i86pc/io/rootnex.c @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -1764,7 +1764,7 @@ rootnex_dma_allochdl(dev_info_t *dip, dev_info_t *rdip, ddi_dma_attr_t *attr, return (DDI_FAILURE); } - ASSERT(IOMMU_USED(rdip)); + ASSERT(IOMMULIB_HDL(rdip)); /* has an IOMMU */ return (iommulib_nexdma_allochdl(dip, rdip, attr, @@ -1811,7 +1811,7 @@ static int rootnex_dma_freehdl(dev_info_t *dip, dev_info_t *rdip, ddi_dma_handle_t handle) { #if !defined(__xpv) - if (IOMMU_USED(rdip)) { + if (IOMMU_USED(handle)) { return (iommulib_nexdma_freehdl(dip, rdip, handle)); } #endif @@ -2085,7 +2085,7 @@ rootnex_dma_bindhdl(dev_info_t *dip, dev_info_t *rdip, ddi_dma_cookie_t *cookiep, uint_t *ccountp) { #if !defined(__xpv) - if (IOMMU_USED(rdip)) { + if (IOMMU_USED(handle)) { return (iommulib_nexdma_bindhdl(dip, rdip, handle, dmareq, cookiep, ccountp)); } @@ -2183,7 +2183,7 @@ rootnex_dma_unbindhdl(dev_info_t *dip, dev_info_t *rdip, ddi_dma_handle_t handle) { #if !defined(__xpv) - if (IOMMU_USED(rdip)) { + if (IOMMU_USED(handle)) { return (iommulib_nexdma_unbindhdl(dip, rdip, handle)); } #endif @@ -4239,7 +4239,7 @@ rootnex_dma_sync(dev_info_t *dip, dev_info_t *rdip, ddi_dma_handle_t handle, off_t off, size_t len, uint_t cache_flags) { #if !defined(__xpv) - if (IOMMU_USED(rdip)) { + if (IOMMU_USED(handle)) { return (iommulib_nexdma_sync(dip, rdip, handle, off, len, cache_flags)); } @@ -4526,7 +4526,7 @@ rootnex_dma_win(dev_info_t *dip, dev_info_t *rdip, ddi_dma_handle_t handle, uint_t *ccountp) { #if !defined(__xpv) - if (IOMMU_USED(rdip)) { + if (IOMMU_USED(handle)) { return (iommulib_nexdma_win(dip, rdip, handle, win, offp, lenp, cookiep, ccountp)); } @@ -4628,11 +4628,7 @@ static int rootnex_dma_map(dev_info_t *dip, dev_info_t *rdip, struct ddi_dma_req *dmareq, ddi_dma_handle_t *handlep) { -#if !defined(__xpv) - if (IOMMU_USED(rdip)) { - return (iommulib_nexdma_map(dip, rdip, dmareq, handlep)); - } -#endif + /* NO IOMMU in 32 bit mode */ return (rootnex_coredma_map(dip, rdip, dmareq, handlep)); } @@ -4837,13 +4833,7 @@ rootnex_dma_mctl(dev_info_t *dip, dev_info_t *rdip, ddi_dma_handle_t handle, enum ddi_dma_ctlops request, off_t *offp, size_t *lenp, caddr_t *objpp, uint_t cache_flags) { -#if !defined(__xpv) - if (IOMMU_USED(rdip)) { - return (iommulib_nexdma_mctl(dip, rdip, handle, request, offp, - lenp, objpp, cache_flags)); - } -#endif - + /* NO IOMMU in 32 bit mode */ return (rootnex_coredma_mctl(dip, rdip, handle, request, offp, lenp, objpp, cache_flags)); } diff --git a/usr/src/uts/intel/io/iommulib.c b/usr/src/uts/intel/io/iommulib.c index e86d2a3bfd..2a7482e1d8 100644 --- a/usr/src/uts/intel/io/iommulib.c +++ b/usr/src/uts/intel/io/iommulib.c @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -576,7 +576,7 @@ iommulib_nex_open(dev_info_t *rdip, uint_t *errorp) *errorp = 0; - if (IOMMU_USED(rdip)) + if (IOMMULIB_HDL(rdip)) return (DDI_SUCCESS); ASSERT(DEVI(rdip)->devi_iommulib_handle == NULL); diff --git a/usr/src/uts/intel/sys/iommulib.h b/usr/src/uts/intel/sys/iommulib.h index d65b71caa0..a13864f5f7 100644 --- a/usr/src/uts/intel/sys/iommulib.h +++ b/usr/src/uts/intel/sys/iommulib.h @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -96,7 +96,18 @@ typedef struct iommulib_ops { } iommulib_ops_t; -#define IOMMU_USED(dip) (DEVI(dip)->devi_iommulib_handle != NULL) + +/* + * IOMMULIB_HDL() checks if there is an IOMMU controlling the dip's DMA + * IOMMU_USED() checks if the dip associated with the DMA handle has DMA + * controlled by an IOMMU. + * This ensures that we use the right dip associated with the + * DMA handle irrespective of which dip's context we call + * ddi_dma_* routines in. + */ +#define IOMMULIB_HDL(dip) (DEVI(dip)->devi_iommulib_handle) +#define IOMMU_USED(dmahdl) \ +(DEVI(((struct ddi_dma_impl *)(dmahdl))->dmai_rdip)->devi_iommulib_handle) typedef enum { IOMMU_NEXOPS_VERSION_INVALID = 0, |