Re: [PATCH v3] x86/pci-dma: add a SWIOTLB_ANY flag to lift the low mem limitation

From: Borislav Petkov

Date: Mon Jun 01 2026 - 01:55:21 EST


On Thu, Feb 12, 2026 at 05:37:01PM +0800, Jun Miao wrote:

+ Rick.

> Intel TDX guest wants to allocate a swiotlb buffer that is not restricted to
> low memory for the trusted hypervisor scheme. Adding a new flag will be used
> in swiotlb_memblock_alloc() to allow allocation of SWIOTLB memory beyond low
> memory restriction.
>
> Power SVM already supports this, but X86 still faces the same limitation.

So?

> Commit: 8ba2ed1be9 (swiotlb: add a SWIOTLB_ANY flag to lift the low memory restriction)
> Reviewed-by: Aakarsh Jain <aakarsh.jain@xxxxxxxxxxxxxxxx>
> Tested-by: Aakarsh Jain <aakarsh.jain@xxxxxxxxxxxxxxxx>
> Signed-off-by: Jun Miao <jun.miao@xxxxxxxxx>
> ---
>
> V1 -> V2:
> 1.Updated commit message and description.
> 2.Add Reviewed and Tested.
>
> V1 Latest Feedback : https://lists.openwall.net/linux-kernel/2026/02/11/483
>
> v2 -> v3:
> We can alloc 4GB with the dynamic swiotlb, rather than 1GB.
> 1G is not correct. So change the commit log.
>
> ---
> 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;

This is not TDX-specific but introduces a change for all encrypted guests.

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette