diff options
author | Christoph Hellwig <hch@lst.de> | 2022-02-28 13:36:57 +0200 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2022-04-18 07:21:12 +0200 |
commit | 8ba2ed1be90fc210126f68186564707478552c95 (patch) | |
tree | 60e45049a4f38cc20ca83bc77af9495ddc9944f0 /kernel/dma | |
parent | c6af2aa9ffc9763826607bc2664ef3ea4475ed18 (diff) | |
download | lwn-8ba2ed1be90fc210126f68186564707478552c95.tar.gz lwn-8ba2ed1be90fc210126f68186564707478552c95.zip |
swiotlb: add a SWIOTLB_ANY flag to lift the low memory restriction
Power SVM wants to allocate a swiotlb buffer that is not restricted to
low memory for the trusted hypervisor scheme. Consolidate the support
for this into the swiotlb_init interface by adding a new flag.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Tested-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Diffstat (limited to 'kernel/dma')
-rw-r--r-- | kernel/dma/swiotlb.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/kernel/dma/swiotlb.c b/kernel/dma/swiotlb.c index 86e877a96b82..f6e091424af3 100644 --- a/kernel/dma/swiotlb.c +++ b/kernel/dma/swiotlb.c @@ -266,8 +266,15 @@ void __init swiotlb_init(bool addressing_limit, unsigned int flags) if (swiotlb_force_disable) return; - /* Get IO TLB memory from the low pages */ - tlb = memblock_alloc_low(bytes, PAGE_SIZE); + /* + * By default allocate the bounce buffer memory from low memory, but + * allow to pick a location everywhere for hypervisors with guest + * memory encryption. + */ + if (flags & SWIOTLB_ANY) + tlb = memblock_alloc(bytes, PAGE_SIZE); + else + tlb = memblock_alloc_low(bytes, PAGE_SIZE); if (!tlb) goto fail; if (swiotlb_init_with_tbl(tlb, default_nslabs, flags)) |