* [PATCH] swiotlb: add a SWIOTLB_ANY flag to lift restricted low memory for encryption
@ 2025-04-29 16:53 Jun Miao
2025-05-08 9:49 ` Miao, Jun
2026-02-11 9:35 ` Aakarsh Jain
0 siblings, 2 replies; 4+ messages in thread
From: Jun Miao @ 2025-04-29 16:53 UTC (permalink / raw)
To: tglx, mingo, bp, dave.hansen; +Cc: x86, linux-kernel, jun.miao, fan.du
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@intel.com>
---
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
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* RE: [PATCH] swiotlb: add a SWIOTLB_ANY flag to lift restricted low memory for encryption
2025-04-29 16:53 [PATCH] swiotlb: add a SWIOTLB_ANY flag to lift restricted low memory for encryption Jun Miao
@ 2025-05-08 9:49 ` Miao, Jun
2026-02-11 9:35 ` Aakarsh Jain
1 sibling, 0 replies; 4+ messages in thread
From: Miao, Jun @ 2025-05-08 9:49 UTC (permalink / raw)
To: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de,
dave.hansen@linux.intel.com
Cc: x86@kernel.org, linux-kernel@vger.kernel.org, Du, Fan, Miao, Jun
Hi maintainers and Big shot,
I would like to further explain my original intention:
The purpose is to solve the problem found by customers when inserting 8 NVMe disks - There will be a swiotlb buffer full warning.
When CONFIG_SWIOTLB_DYNAMIC is turned on, it is impossible to allocate more than 2G swiotlb buffer to meet the actual high throughput usage requirements.
Warm regards
Jun Miao
>
>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@intel.com>
>---
> 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
>--
>2.43.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] swiotlb: add a SWIOTLB_ANY flag to lift restricted low memory for encryption
2025-04-29 16:53 [PATCH] swiotlb: add a SWIOTLB_ANY flag to lift restricted low memory for encryption Jun Miao
2025-05-08 9:49 ` Miao, Jun
@ 2026-02-11 9:35 ` Aakarsh Jain
2026-02-12 3:18 ` Miao, Jun
1 sibling, 1 reply; 4+ messages in thread
From: Aakarsh Jain @ 2026-02-11 9:35 UTC (permalink / raw)
To: Jun Miao, tglx, mingo, bp, dave.hansen
Cc: x86, linux-kernel, fan.du, thomas.lendacky, aakarsh.jain
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@intel.com>
> ---
> 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@oss.qualcomm.com>
Tested-by: Aakarsh Jain <aakarsh.jain@oss.qualcomm.com>
Thanks,
Aakarsh
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH] swiotlb: add a SWIOTLB_ANY flag to lift restricted low memory for encryption
2026-02-11 9:35 ` Aakarsh Jain
@ 2026-02-12 3:18 ` Miao, Jun
0 siblings, 0 replies; 4+ messages in thread
From: Miao, Jun @ 2026-02-12 3:18 UTC (permalink / raw)
To: Aakarsh Jain, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de,
dave.hansen@linux.intel.com
Cc: x86@kernel.org, linux-kernel@vger.kernel.org, Du, Fan,
thomas.lendacky@amd.com, Miao, Jun
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@intel.com>
>> ---
>> 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@oss.qualcomm.com>
>Tested-by: Aakarsh Jain <aakarsh.jain@oss.qualcomm.com>
>
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
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-02-12 3:18 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-29 16:53 [PATCH] swiotlb: add a SWIOTLB_ANY flag to lift restricted low memory for encryption Jun Miao
2025-05-08 9:49 ` Miao, Jun
2026-02-11 9:35 ` Aakarsh Jain
2026-02-12 3:18 ` Miao, Jun
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox