linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ia64: simplify code flow around swiotlb init
@ 2021-03-25 23:35 Sergei Trofimovich
  2021-03-26  7:39 ` John Paul Adrian Glaubitz
  0 siblings, 1 reply; 3+ messages in thread
From: Sergei Trofimovich @ 2021-03-25 23:35 UTC (permalink / raw)
  To: Andrew Morton, linux-ia64; +Cc: linux-kernel, Sergei Trofimovich

Before the change CONFIG_INTEL_IOMMU && !CONFIG_SWIOTLB && !CONFIG_FLATMEM

could skip `set_max_mapnr(max_low_pfn);` is iommu is not present on system.

CC: Andrew Morton <akpm@linux-foundation.org>
CC: linux-ia64@vger.kernel.org
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
---
 arch/ia64/mm/init.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c
index 16d0d7d22657..a63585db94fe 100644
--- a/arch/ia64/mm/init.c
+++ b/arch/ia64/mm/init.c
@@ -644,13 +644,16 @@ mem_init (void)
 	 * _before_ any drivers that may need the PCI DMA interface are
 	 * initialized or bootmem has been freed.
 	 */
+	do {
 #ifdef CONFIG_INTEL_IOMMU
-	detect_intel_iommu();
-	if (!iommu_detected)
+		detect_intel_iommu();
+		if (iommu_detected)
+			break;
 #endif
 #ifdef CONFIG_SWIOTLB
 		swiotlb_init(1);
 #endif
+	} while (0);
 
 #ifdef CONFIG_FLATMEM
 	BUG_ON(!mem_map);
-- 
2.31.0


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

* Re: [PATCH] ia64: simplify code flow around swiotlb init
  2021-03-25 23:35 [PATCH] ia64: simplify code flow around swiotlb init Sergei Trofimovich
@ 2021-03-26  7:39 ` John Paul Adrian Glaubitz
  2021-03-28 20:24   ` [PATCH v2] " Sergei Trofimovich
  0 siblings, 1 reply; 3+ messages in thread
From: John Paul Adrian Glaubitz @ 2021-03-26  7:39 UTC (permalink / raw)
  To: Sergei Trofimovich, Andrew Morton, linux-ia64; +Cc: linux-kernel

Hi Sergei!

On 3/26/21 12:35 AM, Sergei Trofimovich wrote:
> Before the change CONFIG_INTEL_IOMMU && !CONFIG_SWIOTLB && !CONFIG_FLATMEM
> 
> could skip `set_max_mapnr(max_low_pfn);` is iommu is not present on system.
                                           ^^
                                       typo s/is/if/

I will test this patch to make sure it doesn't break on the BL870c i4.

Adrian

> CC: Andrew Morton <akpm@linux-foundation.org>
> CC: linux-ia64@vger.kernel.org
> Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
> ---
>  arch/ia64/mm/init.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c
> index 16d0d7d22657..a63585db94fe 100644
> --- a/arch/ia64/mm/init.c
> +++ b/arch/ia64/mm/init.c
> @@ -644,13 +644,16 @@ mem_init (void)
>  	 * _before_ any drivers that may need the PCI DMA interface are
>  	 * initialized or bootmem has been freed.
>  	 */
> +	do {
>  #ifdef CONFIG_INTEL_IOMMU
> -	detect_intel_iommu();
> -	if (!iommu_detected)
> +		detect_intel_iommu();
> +		if (iommu_detected)
> +			break;
>  #endif
>  #ifdef CONFIG_SWIOTLB
>  		swiotlb_init(1);
>  #endif
> +	} while (0);
>  
>  #ifdef CONFIG_FLATMEM
>  	BUG_ON(!mem_map);
> 
-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaubitz@debian.org
`. `'   Freie Universitaet Berlin - glaubitz@physik.fu-berlin.de
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913


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

* [PATCH v2] ia64: simplify code flow around swiotlb init
  2021-03-26  7:39 ` John Paul Adrian Glaubitz
@ 2021-03-28 20:24   ` Sergei Trofimovich
  0 siblings, 0 replies; 3+ messages in thread
From: Sergei Trofimovich @ 2021-03-28 20:24 UTC (permalink / raw)
  To: Andrew Morton, John Paul Adrian Glaubitz, inux-ia64
  Cc: linux-kernel, Sergei Trofimovich, linux-ia64

Before the change CONFIG_INTEL_IOMMU && !CONFIG_SWIOTLB && !CONFIG_FLATMEM
could skip `set_max_mapnr(max_low_pfn);` if iommu is not present on system.

CC: Andrew Morton <akpm@linux-foundation.org>
CC: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
CC: linux-ia64@vger.kernel.org
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
---
Change since v1: fixed a typo in commit mesage.

 arch/ia64/mm/init.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c
index 16d0d7d22657..a63585db94fe 100644
--- a/arch/ia64/mm/init.c
+++ b/arch/ia64/mm/init.c
@@ -644,13 +644,16 @@ mem_init (void)
 	 * _before_ any drivers that may need the PCI DMA interface are
 	 * initialized or bootmem has been freed.
 	 */
+	do {
 #ifdef CONFIG_INTEL_IOMMU
-	detect_intel_iommu();
-	if (!iommu_detected)
+		detect_intel_iommu();
+		if (iommu_detected)
+			break;
 #endif
 #ifdef CONFIG_SWIOTLB
 		swiotlb_init(1);
 #endif
+	} while (0);
 
 #ifdef CONFIG_FLATMEM
 	BUG_ON(!mem_map);
-- 
2.31.1


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

end of thread, other threads:[~2021-03-28 20:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-25 23:35 [PATCH] ia64: simplify code flow around swiotlb init Sergei Trofimovich
2021-03-26  7:39 ` John Paul Adrian Glaubitz
2021-03-28 20:24   ` [PATCH v2] " Sergei Trofimovich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).