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

From: Miao, Jun

Date: Tue Jun 23 2026 - 21:53:51 EST


Warm regards
Jun Miao
>On Wed, Jun 24, 2026 at 01:22:33AM +0000, Miao, Jun wrote:
>> >> 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.
>^^^^^^^^^^^^
>
>You need to read the whole email.
Oh, I am so sorry . Aakarsh sent a single email to me writing that:

Hi Jun,

I think the commit message should indeed be updated to reflect that this change benefits all x86 encrypted guests, not just TDX. The condition `CC_ATTR_GUEST_MEM_ENCRYPT` covers AMD SEV, SEV-ES, SEV-SNP, and Intel TDX. I have tested this on AMD SEV-SNP and it works correctly.

Thanks,
Aakarsh

I replied to him as follows, could you take a look and see how my revisions turned out?
Thank you all for pointing this out.

Good suggestion and thank you for testing the ADM SEV-SNP.
I will try V4 adding those to commit with your encouragement O(∩_∩)O. Like this ?

Confidential Virtual Machines (CVMs) include Intel TDX and AMD SEV, SEV-ES, SEV-SNP
want 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.

>
>--
>Regards/Gruss,
> Boris.
>
>https://people.kernel.org/tglx/notes-about-netiquette