mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Re: [PATCH 5.10 88/91] arm64/kexec: Test page size support with new TGRAN range values
@ 2023-02-15 10:58 heyuqiang
  2023-02-15 11:41 ` Greg KH
  0 siblings, 1 reply; 3+ messages in thread
From: heyuqiang @ 2023-02-15 10:58 UTC (permalink / raw)
  To: gregkh, anshuman.khandual, catalin.marinas, james.morse,
	linux-arm-kernel, linux-kernel, patches, stable, will, yuzenghui
  Cc: nixiaoming, lijiahuan5

There is an error

tree: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git 
master
head: c911f03f8d444e623724fddd82b07a7e1af42338
commit: d5924531dd8ad012ad13eb4d6a5e120c3dadfc05 arm64/kexec: Test page 
size support with new TGRAN range values
# 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=d5924531dd8ad012ad13eb4d6a5e120c3dadfc05

When I compile the ko file, I add [-Werror=type-limits] compilation 
options, an error is reported during compilation.

The log is as follows:

./arch/arm64/include/asm/cpufeature.h: In function 
‘system_supports_4kb_granule’:
./arch/arm64/include/asm/cpufeature.h:653:14: error:
comparison of unsigned expression >= 0 is always true [-Werror=type-limits]
return (val >= ID_AA64MMFR0_TGRAN4_SUPPORTED_MIN) &&
^~
./arch/arm64/include/asm/cpufeature.h: In function 
‘system_supports_64kb_granule’:
./arch/arm64/include/asm/cpufeature.h:666:14: error:
comparison of unsigned expression >= 0 is always true [-Werror=type-limits]
return (val >= ID_AA64MMFR0_TGRAN64_SUPPORTED_MIN) &&
^~

"val" variable type is "u32"
"#define ID_AA64MMFR0_TGRAN4_SUPPORTED_MIN 0x0"
"#define ID_AA64MMFR0_TGRAN64_SUPPORTED_MIN 0x0"
comparison of val >= 0 is always true.

If you fix the issue, kindly add following tag where applicable
Reported-by: heyuqiang <heyuqiang1@huawei.com>

Thanks


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

* Re: [PATCH 5.10 88/91] arm64/kexec: Test page size support with new TGRAN range values
  2023-02-15 10:58 [PATCH 5.10 88/91] arm64/kexec: Test page size support with new TGRAN range values heyuqiang
@ 2023-02-15 11:41 ` Greg KH
  0 siblings, 0 replies; 3+ messages in thread
From: Greg KH @ 2023-02-15 11:41 UTC (permalink / raw)
  To: heyuqiang
  Cc: anshuman.khandual, catalin.marinas, james.morse,
	linux-arm-kernel, linux-kernel, patches, stable, will, yuzenghui,
	nixiaoming, lijiahuan5

On Wed, Feb 15, 2023 at 06:58:13PM +0800, heyuqiang wrote:
> There is an error
> 
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
> master
> head: c911f03f8d444e623724fddd82b07a7e1af42338
> commit: d5924531dd8ad012ad13eb4d6a5e120c3dadfc05 arm64/kexec: Test page size
> support with new TGRAN range values
> # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=d5924531dd8ad012ad13eb4d6a5e120c3dadfc05
> 
> When I compile the ko file, I add [-Werror=type-limits] compilation options,
> an error is reported during compilation.

Why add that option?  Is that a valid option for the 5.10.y kernel?  Is
this something new?

And note, you are responding to a commit from last November, with no
context at all.  Is this an issue in Linus's tree too?

> 
> The log is as follows:
> 
> ./arch/arm64/include/asm/cpufeature.h: In function
> ‘system_supports_4kb_granule’:
> ./arch/arm64/include/asm/cpufeature.h:653:14: error:
> comparison of unsigned expression >= 0 is always true [-Werror=type-limits]
> return (val >= ID_AA64MMFR0_TGRAN4_SUPPORTED_MIN) &&
> ^~
> ./arch/arm64/include/asm/cpufeature.h: In function
> ‘system_supports_64kb_granule’:
> ./arch/arm64/include/asm/cpufeature.h:666:14: error:
> comparison of unsigned expression >= 0 is always true [-Werror=type-limits]
> return (val >= ID_AA64MMFR0_TGRAN64_SUPPORTED_MIN) &&
> ^~
> 
> "val" variable type is "u32"
> "#define ID_AA64MMFR0_TGRAN4_SUPPORTED_MIN 0x0"
> "#define ID_AA64MMFR0_TGRAN64_SUPPORTED_MIN 0x0"
> comparison of val >= 0 is always true.
> 
> If you fix the issue, kindly add following tag where applicable
> Reported-by: heyuqiang <heyuqiang1@huawei.com>

Please provide a valid fix for this if you wish for it to be resolved.

thanks,

greg k-h

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

* [PATCH 5.10 88/91] arm64/kexec: Test page size support with new TGRAN range values
  2022-11-02  2:32 [PATCH 5.10 00/91] 5.10.153-rc1 review Greg Kroah-Hartman
@ 2022-11-02  2:34 ` Greg Kroah-Hartman
  0 siblings, 0 replies; 3+ messages in thread
From: Greg Kroah-Hartman @ 2022-11-02  2:34 UTC (permalink / raw)
  To: stable
  Cc: Greg Kroah-Hartman, patches, Will Deacon, James Morse,
	linux-arm-kernel, linux-kernel, Anshuman Khandual,
	Catalin Marinas, Zenghui Yu

From: Anshuman Khandual <anshuman.khandual@arm.com>

commit 79d82cbcbb3d2a56c009ad6a6df92c5dee061dad upstream.

The commit 26f55386f964 ("arm64/mm: Fix __enable_mmu() for new TGRAN range
values") had already switched into testing ID_AA64MMFR0_TGRAN range values.
This just changes system_supports_[4|16|64]kb_granule() helpers to perform
similar range tests as well. While here, it standardizes page size specific
supported min and max TGRAN values.

Cc: Will Deacon <will@kernel.org>
Cc: James Morse <james.morse@arm.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
Link: https://lore.kernel.org/r/1626237975-1909-1-git-send-email-anshuman.khandual@arm.com
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Zenghui Yu <yuzenghui@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 arch/arm64/include/asm/cpufeature.h |    9 ++++++---
 arch/arm64/include/asm/sysreg.h     |   28 ++++++++++++++++------------
 2 files changed, 22 insertions(+), 15 deletions(-)

--- a/arch/arm64/include/asm/cpufeature.h
+++ b/arch/arm64/include/asm/cpufeature.h
@@ -648,7 +648,8 @@ static inline bool system_supports_4kb_g
 	val = cpuid_feature_extract_unsigned_field(mmfr0,
 						ID_AA64MMFR0_TGRAN4_SHIFT);
 
-	return val == ID_AA64MMFR0_TGRAN4_SUPPORTED;
+	return (val >= ID_AA64MMFR0_TGRAN4_SUPPORTED_MIN) &&
+	       (val <= ID_AA64MMFR0_TGRAN4_SUPPORTED_MAX);
 }
 
 static inline bool system_supports_64kb_granule(void)
@@ -660,7 +661,8 @@ static inline bool system_supports_64kb_
 	val = cpuid_feature_extract_unsigned_field(mmfr0,
 						ID_AA64MMFR0_TGRAN64_SHIFT);
 
-	return val == ID_AA64MMFR0_TGRAN64_SUPPORTED;
+	return (val >= ID_AA64MMFR0_TGRAN64_SUPPORTED_MIN) &&
+	       (val <= ID_AA64MMFR0_TGRAN64_SUPPORTED_MAX);
 }
 
 static inline bool system_supports_16kb_granule(void)
@@ -672,7 +674,8 @@ static inline bool system_supports_16kb_
 	val = cpuid_feature_extract_unsigned_field(mmfr0,
 						ID_AA64MMFR0_TGRAN16_SHIFT);
 
-	return val == ID_AA64MMFR0_TGRAN16_SUPPORTED;
+	return (val >= ID_AA64MMFR0_TGRAN16_SUPPORTED_MIN) &&
+	       (val <= ID_AA64MMFR0_TGRAN16_SUPPORTED_MAX);
 }
 
 static inline bool system_supports_mixed_endian_el0(void)
--- a/arch/arm64/include/asm/sysreg.h
+++ b/arch/arm64/include/asm/sysreg.h
@@ -786,12 +786,16 @@
 #define ID_AA64MMFR0_ASID_SHIFT		4
 #define ID_AA64MMFR0_PARANGE_SHIFT	0
 
-#define ID_AA64MMFR0_TGRAN4_NI		0xf
-#define ID_AA64MMFR0_TGRAN4_SUPPORTED	0x0
-#define ID_AA64MMFR0_TGRAN64_NI		0xf
-#define ID_AA64MMFR0_TGRAN64_SUPPORTED	0x0
-#define ID_AA64MMFR0_TGRAN16_NI		0x0
-#define ID_AA64MMFR0_TGRAN16_SUPPORTED	0x1
+#define ID_AA64MMFR0_TGRAN4_NI			0xf
+#define ID_AA64MMFR0_TGRAN4_SUPPORTED_MIN	0x0
+#define ID_AA64MMFR0_TGRAN4_SUPPORTED_MAX	0x7
+#define ID_AA64MMFR0_TGRAN64_NI			0xf
+#define ID_AA64MMFR0_TGRAN64_SUPPORTED_MIN	0x0
+#define ID_AA64MMFR0_TGRAN64_SUPPORTED_MAX	0x7
+#define ID_AA64MMFR0_TGRAN16_NI			0x0
+#define ID_AA64MMFR0_TGRAN16_SUPPORTED_MIN	0x1
+#define ID_AA64MMFR0_TGRAN16_SUPPORTED_MAX	0xf
+
 #define ID_AA64MMFR0_PARANGE_48		0x5
 #define ID_AA64MMFR0_PARANGE_52		0x6
 
@@ -961,16 +965,16 @@
 
 #if defined(CONFIG_ARM64_4K_PAGES)
 #define ID_AA64MMFR0_TGRAN_SHIFT		ID_AA64MMFR0_TGRAN4_SHIFT
-#define ID_AA64MMFR0_TGRAN_SUPPORTED_MIN	ID_AA64MMFR0_TGRAN4_SUPPORTED
-#define ID_AA64MMFR0_TGRAN_SUPPORTED_MAX	0x7
+#define ID_AA64MMFR0_TGRAN_SUPPORTED_MIN	ID_AA64MMFR0_TGRAN4_SUPPORTED_MIN
+#define ID_AA64MMFR0_TGRAN_SUPPORTED_MAX	ID_AA64MMFR0_TGRAN4_SUPPORTED_MAX
 #elif defined(CONFIG_ARM64_16K_PAGES)
 #define ID_AA64MMFR0_TGRAN_SHIFT		ID_AA64MMFR0_TGRAN16_SHIFT
-#define ID_AA64MMFR0_TGRAN_SUPPORTED_MIN	ID_AA64MMFR0_TGRAN16_SUPPORTED
-#define ID_AA64MMFR0_TGRAN_SUPPORTED_MAX	0xF
+#define ID_AA64MMFR0_TGRAN_SUPPORTED_MIN	ID_AA64MMFR0_TGRAN16_SUPPORTED_MIN
+#define ID_AA64MMFR0_TGRAN_SUPPORTED_MAX	ID_AA64MMFR0_TGRAN16_SUPPORTED_MAX
 #elif defined(CONFIG_ARM64_64K_PAGES)
 #define ID_AA64MMFR0_TGRAN_SHIFT		ID_AA64MMFR0_TGRAN64_SHIFT
-#define ID_AA64MMFR0_TGRAN_SUPPORTED_MIN	ID_AA64MMFR0_TGRAN64_SUPPORTED
-#define ID_AA64MMFR0_TGRAN_SUPPORTED_MAX	0x7
+#define ID_AA64MMFR0_TGRAN_SUPPORTED_MIN	ID_AA64MMFR0_TGRAN64_SUPPORTED_MIN
+#define ID_AA64MMFR0_TGRAN_SUPPORTED_MAX	ID_AA64MMFR0_TGRAN64_SUPPORTED_MAX
 #endif
 
 #define MVFR2_FPMISC_SHIFT		4



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

end of thread, other threads:[~2023-02-15 11:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-15 10:58 [PATCH 5.10 88/91] arm64/kexec: Test page size support with new TGRAN range values heyuqiang
2023-02-15 11:41 ` Greg KH
  -- strict thread matches above, loose matches on Subject: below --
2022-11-02  2:32 [PATCH 5.10 00/91] 5.10.153-rc1 review Greg Kroah-Hartman
2022-11-02  2:34 ` [PATCH 5.10 88/91] arm64/kexec: Test page size support with new TGRAN range values Greg Kroah-Hartman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®