Re: [PATCH] swiotlb: add a SWIOTLB_ANY flag to lift restricted low memory for encryption

From: Aakarsh Jain

Date: Wed Feb 11 2026 - 04:38:25 EST


Hi Jun,

On 4/29/2025 10:23 PM, Jun Miao wrote:
TDX guest wants to allocate a swiotlb buffer that is not restricted
to low memory for the trusted hypervisor scheme. So that allow to pick
a location everywhere for hypervisors with guest memory encryption in
swiotlb_memblock_alloc() interface by adding a new flag.

Signed-off-by: Jun Miao <jun.miao@xxxxxxxxx>
---
arch/x86/kernel/pci-dma.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kernel/pci-dma.c b/arch/x86/kernel/pci-dma.c
index 6267363e0189..73b9320c4a7d 100644
--- a/arch/x86/kernel/pci-dma.c
+++ b/arch/x86/kernel/pci-dma.c
@@ -61,7 +61,7 @@ static void __init pci_swiotlb_detect(void)
*/
if (cc_platform_has(CC_ATTR_GUEST_MEM_ENCRYPT)) {
x86_swiotlb_enable = true;
- x86_swiotlb_flags |= SWIOTLB_FORCE;
+ x86_swiotlb_flags |= SWIOTLB_ANY | SWIOTLB_FORCE;
}
}
#else


Thanks for working on this patch.

We ran into the same limitation where the SWIOTLB bounce buffer cannot
be increased beyond 1GB without this change.

I reviewed the change and tested it on our setup. With this patch applied, we are able to successfully configure and use SWIOTLB bounce buffer size greater than 1GB, and the previous allocation failures are resolved.

Since, I wanted to bring more visibility to this patch.

Feel free to add
Reviewed-by: Aakarsh Jain <aakarsh.jain@xxxxxxxxxxxxxxxx>
Tested-by: Aakarsh Jain <aakarsh.jain@xxxxxxxxxxxxxxxx>


Thanks,
Aakarsh