Skip to contentSkip to conversation

x86/pci-dma: add a SWIOTLB_ANY flag to lift the low mem limitation

PATCH Superseded Jun Miao 5 participants 15 messages Feb 12 – Jun 24 x86

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Jun Miao

author
#0 lore raw

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

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.
Commit: 8ba2ed1be9 (swiotlb: add a SWIOTLB_ANY flag to lift the low memory restriction)

---

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(-)
arch/x86/kernel/pci-dma.c +1 -1
index 6267363e0189..73b9320c4a7d 100644
@@ -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
Signature · 1 line
2.47.1
Acked-by on v3 1/1
#1 lore raw
Quoted 11 lines · Jun Miao

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.
Commit: 8ba2ed1be9 (swiotlb: add a SWIOTLB_ANY flag to lift the low memory restriction)

Quoted 21 lines

---

V1 -> V2:
1.Updated commit message and description.
2.Add Reviewed and Tested.

V1 Latest Feedback : https://protect2.fireeye.com/v1/url?k=f35668f3-92dd7dc5-f357e3bc-74fe485cbff1-e6ff63e2f942f6a7&q=1&e=66eee4e1-a18d-47f9-ad21-f3dfab1d6f09&u=https%3A%2F%2Flists.openwall.net%2Flinux-kernel%2F2026%2F02%2F11%2F483

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(-)
arch/x86/kernel/pci-dma.c +0 -0
index 6267363e0189..73b9320c4a7d 100644

arch/x86/kernel/pci-dma.c static void __init pci_swiotlb_detect(void) · line 67

Quoted 8 lines
arch/x86/kernel/pci-dma.c +1 -1
@@ -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

Best regards

Signature · 2 lines
Marek Szyprowski, PhD
Samsung R&D Institute Poland
author
#2 lore raw

Hi Marek
Thanks a lot for the ACK on the swiotlb.
It is very important to confirm the functionality. I really appreciate your review @ Marek

Maybe x86 maintainers would also like to hear your thoughts on this, especially since architectures like powerpc already have support for this. Any additional feedback or suggestions on X86 might have would be greatly appreciated.

Best regards,
Jun Miao

Quoted 55 lines · Jun Miao
Quoted 5 lines

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.

Quoted 7 lines

Power SVM already supports this, but X86 still faces the same limitation.
Commit: 8ba2ed1be9 (swiotlb: add a SWIOTLB_ANY flag to lift the low memory restriction)

Quoted 9 lines

---

V1 -> V2:
1.Updated commit message and description.
2.Add Reviewed and Tested.

V1 Latest Feedback :
https://protect2.fireeye.com/v1/url?k=f35668f3-92dd7dc5-f357e3bc-74fe4
85cbff1-e6ff63e2f942f6a7&q=1&e=66eee4e1-a18d-47f9-ad21-

f3dfab1d6f09&u=

Quoted 1 line

https%3A%2F%2Flists.openwall.net%2Flinux-

kernel%2F2026%2F02%2F11%2F483

Quoted 14 lines

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(-)
arch/x86/kernel/pci-dma.c +0 -0
index 6267363e0189..73b9320c4a7d 100644

arch/x86/kernel/pci-dma.c static void __init pci_swiotlb_detect(void) · line 67

Quoted 8 lines
arch/x86/kernel/pci-dma.c +1 -1
@@ -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

Best regards
--
Marek Szyprowski, PhD
Samsung R&D Institute Poland

#3 lore raw

Hi,

Kindly requesting feedback from the x86 maintainers on this patch at your earliest convenience.

Thanks,
Aakarsh

Quoted 66 lines · Jun

Hi Marek
Thanks a lot for the ACK on the swiotlb.
It is very important to confirm the functionality. I really appreciate your review @ Marek

Maybe x86 maintainers would also like to hear your thoughts on this, especially since architectures like powerpc already have support for this. Any additional feedback or suggestions on X86 might have would be greatly appreciated.

Best regards,
Jun Miao

Quoted 55 lines · Jun Miao
Quoted 5 lines

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.

Quoted 7 lines

Power SVM already supports this, but X86 still faces the same limitation.
Commit: 8ba2ed1be9 (swiotlb: add a SWIOTLB_ANY flag to lift the low memory restriction)

Quoted 9 lines

---

V1 -> V2:
1.Updated commit message and description.
2.Add Reviewed and Tested.

V1 Latest Feedback :
https://protect2.fireeye.com/v1/url?k=f35668f3-92dd7dc5-f357e3bc-74fe4
85cbff1-e6ff63e2f942f6a7&q=1&e=66eee4e1-a18d-47f9-ad21-

f3dfab1d6f09&u=

Quoted 1 line

https%3A%2F%2Flists.openwall.net%2Flinux-

kernel%2F2026%2F02%2F11%2F483

Quoted 14 lines

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(-)
arch/x86/kernel/pci-dma.c +0 -0
index 6267363e0189..73b9320c4a7d 100644

arch/x86/kernel/pci-dma.c static void __init pci_swiotlb_detect(void) · line 67

Quoted 8 lines
arch/x86/kernel/pci-dma.c +1 -1
@@ -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

Best regards
--
Marek Szyprowski, PhD
Samsung R&D Institute Poland

maintainer
#4 lore raw
In reply to Jun Miao

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

+ Rick.

Quoted 6 lines

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?

Quoted 25 lines

Commit: 8ba2ed1be9 (swiotlb: add a SWIOTLB_ANY flag to lift the low memory restriction)

---

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(-)
arch/x86/kernel/pci-dma.c +0 -0
index 6267363e0189..73b9320c4a7d 100644

arch/x86/kernel/pci-dma.c static void __init pci_swiotlb_detect(void) · line 64

Quoted 5 lines
arch/x86/kernel/pci-dma.c +1 -1
@@ -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.

Signature · 4 lines
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette
author
#5 lore raw
Quoted 13 lines · Jun Miao

+ Rick.

Quoted 6 lines

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?

Hi, Boris.
Right, please see 8ba2ed1be90f ("swiotlb: add a SWIOTLB_ANY flag to lift the low memory restriction")

Warm regards
Jun Miao

Quoted 41 lines
Quoted 28 lines

Commit: 8ba2ed1be9 (swiotlb: add a SWIOTLB_ANY flag to lift the low memory restriction)

---

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(-)
arch/x86/kernel/pci-dma.c +0 -0
index 6267363e0189..73b9320c4a7d 100644

arch/x86/kernel/pci-dma.c static void __init pci_swiotlb_detect(void) · line 64

Quoted 5 lines
arch/x86/kernel/pci-dma.c +1 -1
@@ -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

maintainer
#6 lore raw
Quoted 4 lines · Jun
Quoted 4 lines
Quoted 4 lines
arch/x86/kernel/pci-dma.c +0 -0
index 6267363e0189..73b9320c4a7d 100644
Quoted 8 lines
Quoted 8 lines

arch/x86/kernel/pci-dma.c static void __init pci_swiotlb_detect(void) · line 64

Quoted 6 lines
arch/x86/kernel/pci-dma.c +1 -1
@@ -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.

Signature · 4 lines
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette
author
#7 lore raw

Warm regards
Jun Miao

Quoted 13 lines · Jun
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
arch/x86/kernel/pci-dma.c +0 -0
index 6267363e0189..73b9320c4a7d 100644
Quoted 8 lines
Quoted 8 lines

arch/x86/kernel/pci-dma.c static void __init pci_swiotlb_detect(void) · line 64

Quoted 6 lines
arch/x86/kernel/pci-dma.c +1 -1
@@ -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.

Quoted 3 lines

^^^^^^^^^^^^

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.

Quoted 6 lines

--
Regards/Gruss,
Boris.

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

maintainer
#8 lore raw
Quoted 1 line · Jun

Good suggestion and thank you for testing the ADM SEV-SNP.

I don't think anyone tested it on SNP yet.

Quoted 2 lines

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

Why do they want that? The "why" is what I am missing in all this text.

Quoted 1 line

the trusted hypervisor scheme.

What is the "trusted hypervisor scheme"?

Quoted 2 lines

Adding a new flag will be used in swiotlb_memblock_alloc() to allow allocation of SWIOTLB memory beyond low memory restriction.

That you don't need to explain - that's visible from the diff.

Thx.

Signature · 4 lines
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette
author
#9 lore raw
Quoted 4 lines · Jun
Quoted 1 line

Good suggestion and thank you for testing the ADM SEV-SNP.

I don't think anyone tested it on SNP yet.

I only know that SEV-SNP is a more advanced, third-generation feature. Are we using "SEV" here as a shorthand for these?

Quoted 6 lines
Quoted 4 lines

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

Why do they want that? The "why" is what I am missing in all this text.

This was an oversight on my part. I failed to explain the usage context:

When using confidential VMs, users want to pass through both the high-speed network interface card (NIC) or an 8-GPUs setup into the CVMs. During data transfer, the SWIOTLB bounce buffer becomes a
critical "hot path" acting as an intermediary for convertor between private and shared memory. consequently, the capacity requirement increases—otherwise, network or data transfer performance would be adversely affected.

Quoted 4 lines
Quoted 2 lines

the trusted hypervisor scheme.

What is the "trusted hypervisor scheme"?

What I mean to convey is that in TEE environments based on AMD SEV or Intel TDX, the core issue is the lack of trust in the hypervisor's VMM.

Quoted 5 lines
Quoted 3 lines

Adding a new flag will be used in swiotlb_memblock_alloc() to allow allocation of SWIOTLB memory beyond low memory restriction.

That you don't need to explain - that's visible from the diff.

Ok drop it!
What about the commit description like this in V4 ?

When using confidential VMs, users want to pass through both the high-speed network interface card (NIC) or an 8-GPUs setup into the CVMs. During data transfer, the SWIOTLB bounce buffer becomes a
critical "hot path" acting as an intermediary for convertor between private and shared memory. consequently, the capacity requirement increases—otherwise, network or data transfer performance would be adversely affected

Confidential VMs include AMD SEV and Intel TDX guests want to allocate a swiotlb buffer that is not restricted to low memory in TEE.

Power SVM already supports this, but X86 still faces the same limitation.
Commit: 8ba2ed1be9 ( "swiotlb: add a SWIOTLB_ANY flag to lift the low memory restriction" )

Quoted 8 lines

Thx.

--
Regards/Gruss,
Boris.

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

maintainer
#10 lore raw
Quoted 7 lines · Jun
Quoted 4 lines · Jun
Quoted 1 line

Good suggestion and thank you for testing the ADM SEV-SNP.

I don't think anyone tested it on SNP yet.

I only know that SEV-SNP is a more advanced, third-generation feature. Are we using "SEV" here as a shorthand for these?

You have SEV, SEV-ES and SEV-SNP in the order of their appearance and in the order they have gotten additional features. SNP is the one which is has addressed the most if not all? confidential VM attack vectors. And that's the one I care about as the other two are just the prerequisites to the SNP thing. In my opinion only anyway.

Quoted 6 lines

When using confidential VMs, users want to pass through both the high-speed network interface card (NIC) or an 8-GPUs setup into the CVMs. During data transfer, the SWIOTLB bounce buffer becomes a critical "hot path" acting as an intermediary for convertor between private and shared memory. consequently, the capacity requirement increases—otherwise, network or data transfer performance would be adversely affected.

Yes, that makes more sense. Pls add it to the commit message.

Quoted 2 lines

What I mean to convey is that in TEE environments based on AMD SEV or Intel TDX, the core issue is the lack of trust in the hypervisor's VMM.

Then say it this way. Trusted hypervisor sounds like we trust the HV. Which we absolutely do not.

Quoted 9 lines

When using confidential VMs, users want to pass through both the high-speed network interface card (NIC) or an 8-GPUs setup into the CVMs. During data transfer, the SWIOTLB bounce buffer becomes a critical "hot path" acting as an intermediary for convertor between private and shared memory. consequently, the capacity requirement increases—otherwise, network or data transfer performance would be adversely affected

Confidential VMs include AMD SEV and Intel TDX guests want to allocate a swiotlb buffer that is not restricted to low memory in TEE.

Sounds better, yes.

Except that we still need to test it on SNP.

Adding some folks on Cc who can do that and take a look at your patch and vet it for SNP - my guest is still broken. :-\

Thx.

Signature · 4 lines
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette
#11 lore raw

Hi Borislav,

Quoted 40 lines · Borislav Petkov
Quoted 7 lines · Jun
Quoted 4 lines · Jun
Quoted 1 line

Good suggestion and thank you for testing the ADM SEV-SNP.

I don't think anyone tested it on SNP yet.

I only know that SEV-SNP is a more advanced, third-generation feature. Are we using "SEV" here as a shorthand for these?

You have SEV, SEV-ES and SEV-SNP in the order of their appearance and in the order they have gotten additional features. SNP is the one which is has addressed the most if not all? confidential VM attack vectors. And that's the one I care about as the other two are just the prerequisites to the SNP thing. In my opinion only anyway.

Quoted 6 lines

When using confidential VMs, users want to pass through both the high-speed network interface card (NIC) or an 8-GPUs setup into the CVMs. During data transfer, the SWIOTLB bounce buffer becomes a critical "hot path" acting as an intermediary for convertor between private and shared memory. consequently, the capacity requirement increases—otherwise, network or data transfer performance would be adversely affected.

Yes, that makes more sense. Pls add it to the commit message.

Quoted 2 lines

What I mean to convey is that in TEE environments based on AMD SEV or Intel TDX, the core issue is the lack of trust in the hypervisor's VMM.

Then say it this way. Trusted hypervisor sounds like we trust the HV. Which we absolutely do not.

Quoted 9 lines

When using confidential VMs, users want to pass through both the high-speed network interface card (NIC) or an 8-GPUs setup into the CVMs. During data transfer, the SWIOTLB bounce buffer becomes a critical "hot path" acting as an intermediary for convertor between private and shared memory. consequently, the capacity requirement increases—otherwise, network or data transfer performance would be adversely affected

Confidential VMs include AMD SEV and Intel TDX guests want to allocate a swiotlb buffer that is not restricted to low memory in TEE.

Quoted 7 lines

Sounds better, yes.

Except that we still need to test it on SNP.

Adding some folks on Cc who can do that and take a look at your patch and vet it for SNP - my guest is still broken. :-\

I tested this patch on a SEV-SNP guest and it works as expected. The SWIOTLB buffer is now allocated above the 4 GB low-memory boundary, confirming that the SWIOTLB_ANY flag takes effect on SNP as well. I was also able to scale the bounce buffer size up to support larger networking workloads.

From kernel dmesg logs:

root@ubuntu:/home/ubuntu# dmesg | grep -i sev
[   21.191917] Memory Encryption Features active: AMD SEV SEV-ES SEV-SNP
[   21.192883] SEV: Status: SEV SEV-ES SEV-SNP
[   21.401897] SEV: APIC: wakeup_secondary_cpu() replaced with wakeup_cpu_via_vmgexit()
[   22.117267] SEV: Using SNP CPUID table, 28 entries present.
[   22.117884] SEV: SNP running at VMPL0.
[   24.164260] SEV: SNP guest platform devices initialized.
[   28.815142] systemd[1]: Detected confidential virtualization sev-snp.
[   30.063831] sev-guest sev-guest: Initialized SEV guest driver (using VMPCK0 communication key)
root@ubuntu:/home/ubuntu# dmesg | grep -i "IO TLB"
[    6.743607] software IO TLB: area num 4.
[   24.164169] software IO TLB: mapped [mem 0x0000001df9c00000-0x0000001ff9c00000] (8192MB)
[   24.331266] software IO TLB: Memory encryption is active and system is using DMA bounce buffers
root@ubuntu:/home/ubuntu#

Thanks,
Aakarsh> Thx.

Quoted 1 line
maintainer
#12 lore raw
Quoted 4 lines · Aakarsh Jain

I tested this patch on a SEV-SNP guest and it works as expected. The SWIOTLB buffer is now allocated above the 4 GB low-memory boundary, confirming that the SWIOTLB_ANY flag takes effect on SNP as well. I was also able to scale the bounce buffer size up to support larger networking workloads.

Ok, pls send a Tested-by when Jun sends a new version of the patch.

Thx.

Signature · 4 lines
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette
author
#13 lore raw
In reply to Borislav Petkov
Quoted 6 lines

Sounds better, yes.

Except that we still need to test it on SNP.

Adding some folks on Cc who can do that and take a look at your patch and vet it for SNP - my guest is still broken. :-\

Hi Boris,
Thanks for getting involved and showing your support, I look forward to further updates from CC folks :-)

I would also like to further thank Aakarsh for the detailed dmesg information about SEV-SNP:
From kernel dmesg logs:

root@ubuntu:/home/ubuntu# dmesg | grep -i sev
[   21.191917] Memory Encryption Features active: AMD SEV SEV-ES SEV-SNP
[   21.192883] SEV: Status: SEV SEV-ES SEV-SNP
... ...
root@ubuntu:/home/ubuntu# dmesg | grep -i "IO TLB"
[    6.743607] software IO TLB: area num 4.
[   24.164169] software IO TLB: mapped [mem 
0x0000001df9c00000-0x0000001ff9c00000] (8192MB)

Warm regards
Jun Miao

#14 lore raw
In reply to Jun Miao
Quoted 4 lines · Jun Miao

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.

What about those devices with DMA masks < 64bit which needed swiotlb in the first place?

The DMA layer on coco VMs shares coherent memory (from anywhere), why focus on swiotlb alone?

Here is ongoing work to get rid of SWIOTLB_FORCE and do other things with swiotlb:
https://lore.kernel.org/r/[email protected]

so this patch is likely to conflict with that series. Thanks,

Quoted 35 lines

Power SVM already supports this, but X86 still faces the same limitation.
Commit: 8ba2ed1be9 (swiotlb: add a SWIOTLB_ANY flag to lift the low memory restriction)

---

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(-)
arch/x86/kernel/pci-dma.c +1 -1
index 6267363e0189..73b9320c4a7d 100644
@@ -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
Signature · 1 line
Alexey