All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] swiotlb: don't override user specified size in swiotlb_adjust_size
@ 2021-04-29  6:28 Christoph Hellwig
  2021-04-29 13:45 ` Tom Lendacky
  0 siblings, 1 reply; 3+ messages in thread
From: Christoph Hellwig @ 2021-04-29  6:28 UTC (permalink / raw)
  To: konrad.wilk; +Cc: thomas.lendacky, iommu

If the user already specified a swiotlb size on the command line,
swiotlb_adjust_size shoul not overwrite it.

Fixes: 2cbc2776efe4 ("swiotlb: remove swiotlb_nr_tbl")
Reported-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 kernel/dma/swiotlb.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/kernel/dma/swiotlb.c b/kernel/dma/swiotlb.c
index 8635a57f88e9..8ca7d505d61c 100644
--- a/kernel/dma/swiotlb.c
+++ b/kernel/dma/swiotlb.c
@@ -118,6 +118,8 @@ void __init swiotlb_adjust_size(unsigned long size)
 	 * architectures such as those supporting memory encryption to
 	 * adjust/expand SWIOTLB size for their use.
 	 */
+	if (default_nslabs != IO_TLB_DEFAULT_SIZE >> IO_TLB_SHIFT)
+		return;
 	size = ALIGN(size, IO_TLB_SIZE);
 	default_nslabs = ALIGN(size >> IO_TLB_SHIFT, IO_TLB_SEGSIZE);
 	pr_info("SWIOTLB bounce buffer size adjusted to %luMB", size >> 20);
-- 
2.30.2

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] swiotlb: don't override user specified size in swiotlb_adjust_size
  2021-04-29  6:28 [PATCH] swiotlb: don't override user specified size in swiotlb_adjust_size Christoph Hellwig
@ 2021-04-29 13:45 ` Tom Lendacky
  2021-04-29 18:55   ` Konrad Rzeszutek Wilk
  0 siblings, 1 reply; 3+ messages in thread
From: Tom Lendacky @ 2021-04-29 13:45 UTC (permalink / raw)
  To: Christoph Hellwig, konrad.wilk; +Cc: iommu

On 4/29/21 1:28 AM, Christoph Hellwig wrote:
> If the user already specified a swiotlb size on the command line,
> swiotlb_adjust_size shoul not overwrite it.
> 
> Fixes: 2cbc2776efe4 ("swiotlb: remove swiotlb_nr_tbl")
> Reported-by: Tom Lendacky <thomas.lendacky@amd.com>

Thanks, Christoph!

Tested-by: Tom Lendacky <thomas.lendacky@amd.com>

> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  kernel/dma/swiotlb.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/kernel/dma/swiotlb.c b/kernel/dma/swiotlb.c
> index 8635a57f88e9..8ca7d505d61c 100644
> --- a/kernel/dma/swiotlb.c
> +++ b/kernel/dma/swiotlb.c
> @@ -118,6 +118,8 @@ void __init swiotlb_adjust_size(unsigned long size)
>  	 * architectures such as those supporting memory encryption to
>  	 * adjust/expand SWIOTLB size for their use.
>  	 */
> +	if (default_nslabs != IO_TLB_DEFAULT_SIZE >> IO_TLB_SHIFT)
> +		return;
>  	size = ALIGN(size, IO_TLB_SIZE);
>  	default_nslabs = ALIGN(size >> IO_TLB_SHIFT, IO_TLB_SEGSIZE);
>  	pr_info("SWIOTLB bounce buffer size adjusted to %luMB", size >> 20);
> 
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] swiotlb: don't override user specified size in swiotlb_adjust_size
  2021-04-29 13:45 ` Tom Lendacky
@ 2021-04-29 18:55   ` Konrad Rzeszutek Wilk
  0 siblings, 0 replies; 3+ messages in thread
From: Konrad Rzeszutek Wilk @ 2021-04-29 18:55 UTC (permalink / raw)
  To: Tom Lendacky; +Cc: iommu, Christoph Hellwig

On Thu, Apr 29, 2021 at 08:45:51AM -0500, Tom Lendacky wrote:
> On 4/29/21 1:28 AM, Christoph Hellwig wrote:
> > If the user already specified a swiotlb size on the command line,
> > swiotlb_adjust_size shoul not overwrite it.
> > 
> > Fixes: 2cbc2776efe4 ("swiotlb: remove swiotlb_nr_tbl")
> > Reported-by: Tom Lendacky <thomas.lendacky@amd.com>
> 
> Thanks, Christoph!
> 
> Tested-by: Tom Lendacky <thomas.lendacky@amd.com>

Awesome!  I put on the stable/for-linus-5.13 and will send a GIT PULL to
Linus later on this week.

Thank you!
> 
> > Signed-off-by: Christoph Hellwig <hch@lst.de>
> > ---
> >  kernel/dma/swiotlb.c | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/kernel/dma/swiotlb.c b/kernel/dma/swiotlb.c
> > index 8635a57f88e9..8ca7d505d61c 100644
> > --- a/kernel/dma/swiotlb.c
> > +++ b/kernel/dma/swiotlb.c
> > @@ -118,6 +118,8 @@ void __init swiotlb_adjust_size(unsigned long size)
> >  	 * architectures such as those supporting memory encryption to
> >  	 * adjust/expand SWIOTLB size for their use.
> >  	 */
> > +	if (default_nslabs != IO_TLB_DEFAULT_SIZE >> IO_TLB_SHIFT)
> > +		return;
> >  	size = ALIGN(size, IO_TLB_SIZE);
> >  	default_nslabs = ALIGN(size >> IO_TLB_SHIFT, IO_TLB_SEGSIZE);
> >  	pr_info("SWIOTLB bounce buffer size adjusted to %luMB", size >> 20);
> > 
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-04-29 18:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-29  6:28 [PATCH] swiotlb: don't override user specified size in swiotlb_adjust_size Christoph Hellwig
2021-04-29 13:45 ` Tom Lendacky
2021-04-29 18:55   ` Konrad Rzeszutek Wilk

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.