Project

General

Profile

Bug #8624

xhci and nvme can't bind DMA memory with IOMMU enabled

Added by Hans Rosenfeld over 3 years ago. Updated over 3 years ago.

Status:
Closed
Priority:
Normal
Category:
kernel
Start date:
2017-09-07
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:
needs-triage
Gerrit CR:

Description

Both xhci and nvme have problems when allocating DMA memory with IOMMU enabled.

This happens when the size of the DMA buffer is the same as the specified maximum DMA transfer size in the DMA attributes (dma_attr_maxxfer). After most of the work for DMA binding is done, roonex_coredma_bindhdl() will check whether the DMA size is less than the maximum size. If it isn't, it will either go through a "slow path" when IOMMU is disabled, or fail the request if IOMMU is enabled.

This seems to be wrong, the code should check for the DMA size to be less or equal than the maximum size. Other places in rootnex always check for the DMA size to not be larger than the maximum size, which also makes much more sense.

#1

Updated by Hans Rosenfeld over 3 years ago

Webrev: https://grumpf.hope-2000.org/illumos-8624/

This was tested by running it on a single machine with IOMMU enabled. The previously failing nvme driver would suddenly work with this fix. Other drivers used on this machine (mpt_sas, e1000g, ahci) didn't suffer from any regressions.

This change has been in illumos-joyent since around June.

#2

Updated by Electric Monk over 3 years ago

  • Status changed from New to Closed
  • % Done changed from 0 to 100

git commit 6667d029bb28f9a4d1cb7f3366aad23b59e7dca4

commit  6667d029bb28f9a4d1cb7f3366aad23b59e7dca4
Author: Hans Rosenfeld <hans.rosenfeld@joyent.com>
Date:   2017-09-20T18:35:31.000Z

    8624 xhci and nvme can't bind DMA memory with IOMMU enabled
    Reviewed by: Robert Mustacchi <rm@joyent.com>
    Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
    Reviewed by: Garrett D'Amore <garrett@damore.org>
    Approved by: Richard Lowe <richlowe@richlowe.net>

Also available in: Atom PDF