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

From: Miao, Jun

Date: Wed Feb 11 2026 - 22:18:34 EST


Hi Aakarsh,

I’m glad to hear that this patch helps solve a real issue on your side, as this was also a problem I encountered.
I appreciate your support and the Reviewed-by/Tested-by tags.

Hi Maintainers,
I am not sure whether I should send a v2 of the patch to add the Reviewed-by/Tested-by tags myself?
or if the maintainer will add them when applying the patch ?

Also, if there are any incorrect or misleading descriptions in commit log? I would really appreciate your guidance and suggestions.

Thanks
Jun Miao

>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>
>
Hi Aakarsh,

I’m glad to hear that this patch helps solve a real issue on your side, as this was also a problem I encountered.
I appreciate your support and the Reviewed-by/Tested-by tags.

Hi Maintainers,
I am not sure whether I should send a v2 of the patch to add the Reviewed-by/Tested-by tags myself?
or if the maintainer will add them when applying the patch ?

Also, if there are any incorrect or misleading descriptions in commit log? I would really appreciate your guidance and suggestions.

Thanks
Jun Miao

>
>Thanks,
>Aakarsh