diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2018-12-19 18:16:17 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-12-19 18:16:17 -0800 |
commit | 2dd516ff7d852c2cda8c5b883d6625d1c812714e (patch) | |
tree | 83f0f72134a7b610940505c4ee4f2fcbc0d45a52 | |
parent | 62393dbcbe0f3001691e4bd479a25beb5941f2ed (diff) | |
parent | c92a54cfa0257e8ffd66b2a17d49e9c0bd4b769f (diff) | |
download | linux-2dd516ff7d852c2cda8c5b883d6625d1c812714e.tar.bz2 |
Merge tag 'dma-mapping-4.20-4' of git://git.infradead.org/users/hch/dma-mapping
Pull dma-mapping fix from Christoph Hellwig:
"Fix a regression in dma-direct that didn't take account the magic AMD
memory encryption mask in the DMA address"
* tag 'dma-mapping-4.20-4' of git://git.infradead.org/users/hch/dma-mapping:
dma-direct: do not include SME mask in the DMA supported check
-rw-r--r-- | kernel/dma/direct.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/kernel/dma/direct.c b/kernel/dma/direct.c index 22a12ab5a5e9..375c77e8d52f 100644 --- a/kernel/dma/direct.c +++ b/kernel/dma/direct.c @@ -309,7 +309,12 @@ int dma_direct_supported(struct device *dev, u64 mask) min_mask = min_t(u64, min_mask, (max_pfn - 1) << PAGE_SHIFT); - return mask >= phys_to_dma(dev, min_mask); + /* + * This check needs to be against the actual bit mask value, so + * use __phys_to_dma() here so that the SME encryption mask isn't + * part of the check. + */ + return mask >= __phys_to_dma(dev, min_mask); } int dma_direct_mapping_error(struct device *dev, dma_addr_t dma_addr) |