Print this page
8622 panic in PTE_set_all()
8623 IMMU_CONTIG_PADDR is broken for cookies with more than one page
8625 nvme causes bad free panic in IOMMU
Reviewed by: Robert Mustacchi <rm@joyent.com>
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>


   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright (c) 1992, 2010, Oracle and/or its affiliates. All rights reserved.
  23  */
  24 /*
  25  * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
  26  * Copyright (c) 2011 Bayard G. Bell.  All rights reserved.
  27  * Copyright 2012 Garrett D'Amore <garrett@damore.org>.  All rights reserved.

  28  */
  29 
  30 /*
  31  * x86 root nexus driver
  32  */
  33 
  34 #include <sys/sysmacros.h>
  35 #include <sys/conf.h>
  36 #include <sys/autoconf.h>
  37 #include <sys/sysmacros.h>
  38 #include <sys/debug.h>
  39 #include <sys/psw.h>
  40 #include <sys/ddidmareq.h>
  41 #include <sys/promif.h>
  42 #include <sys/devops.h>
  43 #include <sys/kmem.h>
  44 #include <sys/cmn_err.h>
  45 #include <vm/seg.h>
  46 #include <vm/seg_kmem.h>
  47 #include <vm/seg_dev.h>


2319                         ASSERT(0);
2320                         return (DDI_FAILURE);
2321                 }
2322         }
2323 
2324         /* sync the current window before unbinding the buffer */
2325         if (dma->dp_window && dma->dp_window[dma->dp_current_win].wd_dosync &&
2326             (hp->dmai_rflags & DDI_DMA_READ)) {
2327                 (void) rootnex_coredma_sync(dip, rdip, handle, 0, 0,
2328                     DDI_DMA_SYNC_FORCPU);
2329         }
2330 
2331         /*
2332          * cleanup and copy buffer or window state. if we didn't use the copy
2333          * buffer or windows, there won't be much to do :-)
2334          */
2335         rootnex_teardown_copybuf(dma);
2336         rootnex_teardown_windows(dma);
2337 
2338 #if defined(__amd64) && !defined(__xpv)
2339         if (IOMMU_USED(rdip))
2340                 (void) iommulib_nexdma_unmapobject(dip, rdip, handle,
2341                     &dma->dp_dvma);
2342 #endif
2343 
2344         /*
2345          * If we had to allocate space to for the worse case sgl (it didn't
2346          * fit into our pre-allocate buffer), free that up now
2347          */
2348         if (dma->dp_need_to_free_cookie) {
2349                 kmem_free(dma->dp_cookies, dma->dp_cookie_size);
2350         }
2351 
2352         /*
2353          * clean up the handle so it's ready for the next bind (i.e. if the
2354          * handle is reused).
2355          */
2356         rootnex_clean_dmahdl(hp);
2357         hp->dmai_error.err_cf = NULL;
2358 
2359         ROOTNEX_DPROF_DEC(&rootnex_cnt[ROOTNEX_CNT_ACTIVE_BINDS]);




   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright (c) 1992, 2010, Oracle and/or its affiliates. All rights reserved.
  23  */
  24 /*
  25  * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
  26  * Copyright (c) 2011 Bayard G. Bell.  All rights reserved.
  27  * Copyright 2012 Garrett D'Amore <garrett@damore.org>.  All rights reserved.
  28  * Copyright 2017 Joyent, Inc.
  29  */
  30 
  31 /*
  32  * x86 root nexus driver
  33  */
  34 
  35 #include <sys/sysmacros.h>
  36 #include <sys/conf.h>
  37 #include <sys/autoconf.h>
  38 #include <sys/sysmacros.h>
  39 #include <sys/debug.h>
  40 #include <sys/psw.h>
  41 #include <sys/ddidmareq.h>
  42 #include <sys/promif.h>
  43 #include <sys/devops.h>
  44 #include <sys/kmem.h>
  45 #include <sys/cmn_err.h>
  46 #include <vm/seg.h>
  47 #include <vm/seg_kmem.h>
  48 #include <vm/seg_dev.h>


2320                         ASSERT(0);
2321                         return (DDI_FAILURE);
2322                 }
2323         }
2324 
2325         /* sync the current window before unbinding the buffer */
2326         if (dma->dp_window && dma->dp_window[dma->dp_current_win].wd_dosync &&
2327             (hp->dmai_rflags & DDI_DMA_READ)) {
2328                 (void) rootnex_coredma_sync(dip, rdip, handle, 0, 0,
2329                     DDI_DMA_SYNC_FORCPU);
2330         }
2331 
2332         /*
2333          * cleanup and copy buffer or window state. if we didn't use the copy
2334          * buffer or windows, there won't be much to do :-)
2335          */
2336         rootnex_teardown_copybuf(dma);
2337         rootnex_teardown_windows(dma);
2338 
2339 #if defined(__amd64) && !defined(__xpv)
2340         if (IOMMU_USED(rdip) && dma->dp_dvma_used)
2341                 (void) iommulib_nexdma_unmapobject(dip, rdip, handle,
2342                     &dma->dp_dvma);
2343 #endif
2344 
2345         /*
2346          * If we had to allocate space to for the worse case sgl (it didn't
2347          * fit into our pre-allocate buffer), free that up now
2348          */
2349         if (dma->dp_need_to_free_cookie) {
2350                 kmem_free(dma->dp_cookies, dma->dp_cookie_size);
2351         }
2352 
2353         /*
2354          * clean up the handle so it's ready for the next bind (i.e. if the
2355          * handle is reused).
2356          */
2357         rootnex_clean_dmahdl(hp);
2358         hp->dmai_error.err_cf = NULL;
2359 
2360         ROOTNEX_DPROF_DEC(&rootnex_cnt[ROOTNEX_CNT_ACTIVE_BINDS]);