Mercurial > illumos > illumos-gate
changeset 10007:1b2a9b424228
6855752 panic(BAD TRAP) on lynx/wasp/X2270 platforms installing snv_118r1
author | Vikram Hegde <Vikram.Hegde@Sun.COM> |
---|---|
date | Wed, 01 Jul 2009 08:42:32 -0700 |
parents | 54ed6e960d71 |
children | b5d6e292a984 |
files | usr/src/uts/i86pc/io/rootnex.c usr/src/uts/intel/io/iommulib.c usr/src/uts/intel/sys/iommulib.h |
diffstat | 3 files changed, 24 insertions(+), 23 deletions(-) [+] |
line wrap: on
line diff
--- a/usr/src/uts/i86pc/io/rootnex.c Wed Jul 01 14:14:31 2009 +0800 +++ b/usr/src/uts/i86pc/io/rootnex.c Wed Jul 01 08:42:32 2009 -0700 @@ -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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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)); }
--- a/usr/src/uts/intel/io/iommulib.c Wed Jul 01 14:14:31 2009 +0800 +++ b/usr/src/uts/intel/io/iommulib.c Wed Jul 01 08:42:32 2009 -0700 @@ -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 @@ *errorp = 0; - if (IOMMU_USED(rdip)) + if (IOMMULIB_HDL(rdip)) return (DDI_SUCCESS); ASSERT(DEVI(rdip)->devi_iommulib_handle == NULL);
--- a/usr/src/uts/intel/sys/iommulib.h Wed Jul 01 14:14:31 2009 +0800 +++ b/usr/src/uts/intel/sys/iommulib.h Wed Jul 01 08:42:32 2009 -0700 @@ -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 @@ } 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,