linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] arm64/kexec: Test page size support with new TGRAN range values
@ 2021-07-12  3:02 Anshuman Khandual
  2021-07-12 16:07 ` kernel test robot
  0 siblings, 1 reply; 3+ messages in thread
From: Anshuman Khandual @ 2021-07-12  3:02 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Anshuman Khandual, Catalin Marinas, Will Deacon, James Morse,
	linux-kernel

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: Catalin Marinas <catalin.marinas@arm.com>
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>
---
This applies on 5.14-rc1.

 arch/arm64/include/asm/cpufeature.h |  9 ++++++---
 arch/arm64/include/asm/sysreg.h     | 28 ++++++++++++++++------------
 2 files changed, 22 insertions(+), 15 deletions(-)

diff --git a/arch/arm64/include/asm/cpufeature.h b/arch/arm64/include/asm/cpufeature.h
index 9bb9d11750d7..2395527a1bba 100644
--- a/arch/arm64/include/asm/cpufeature.h
+++ b/arch/arm64/include/asm/cpufeature.h
@@ -657,7 +657,8 @@ static inline bool system_supports_4kb_granule(void)
 	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)
@@ -669,7 +670,8 @@ static inline bool system_supports_64kb_granule(void)
 	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)
@@ -681,7 +683,8 @@ static inline bool system_supports_16kb_granule(void)
 	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)
diff --git a/arch/arm64/include/asm/sysreg.h b/arch/arm64/include/asm/sysreg.h
index 7b9c3acba684..e4a69ea8d886 100644
--- a/arch/arm64/include/asm/sysreg.h
+++ b/arch/arm64/include/asm/sysreg.h
@@ -847,12 +847,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
 
@@ -1028,16 +1032,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_TGRAM64_SUPPORTED_MAX
 #endif
 
 #define MVFR2_FPMISC_SHIFT		4
-- 
2.20.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] arm64/kexec: Test page size support with new TGRAN range values
  2021-07-12  3:02 [PATCH] arm64/kexec: Test page size support with new TGRAN range values Anshuman Khandual
@ 2021-07-12 16:07 ` kernel test robot
  2021-07-14  2:32   ` Anshuman Khandual
  0 siblings, 1 reply; 3+ messages in thread
From: kernel test robot @ 2021-07-12 16:07 UTC (permalink / raw)
  To: Anshuman Khandual, linux-arm-kernel
  Cc: kbuild-all, Anshuman Khandual, Catalin Marinas, Will Deacon,
	James Morse, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 5857 bytes --]

Hi Anshuman,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on arm64/for-next/core]
[also build test ERROR on arm/for-next soc/for-next kvmarm/next v5.14-rc1 next-20210712]
[cannot apply to xlnx/master]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Anshuman-Khandual/arm64-kexec-Test-page-size-support-with-new-TGRAN-range-values/20210712-110329
base:   https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-next/core
config: arm64-buildonly-randconfig-r005-20210712 (attached as .config)
compiler: aarch64-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/48b74d46210916db21b8f568b92f1771827bffe9
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Anshuman-Khandual/arm64-kexec-Test-page-size-support-with-new-TGRAN-range-values/20210712-110329
        git checkout 48b74d46210916db21b8f568b92f1771827bffe9
        # save the attached .config to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross O=build_dir ARCH=arm64 SHELL=/bin/bash

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   arch/arm64/kernel/head.S: Assembler messages:
>> arch/arm64/kernel/head.S:705: Error: undefined symbol ID_AA64MMFR0_TGRAM64_SUPPORTED_MAX used as an immediate value


vim +705 arch/arm64/kernel/head.S

5b1cfe3a0ba74c Will Deacon       2019-08-27  669  
bb9052744f4b7a Suzuki K Poulose  2016-02-23  670  /*
bb9052744f4b7a Suzuki K Poulose  2016-02-23  671   * The booting CPU updates the failed status @__early_cpu_boot_status,
bb9052744f4b7a Suzuki K Poulose  2016-02-23  672   * with MMU turned off.
bb9052744f4b7a Suzuki K Poulose  2016-02-23  673   *
bb9052744f4b7a Suzuki K Poulose  2016-02-23  674   * update_early_cpu_boot_status tmp, status
bb9052744f4b7a Suzuki K Poulose  2016-02-23  675   *  - Corrupts tmp1, tmp2
bb9052744f4b7a Suzuki K Poulose  2016-02-23  676   *  - Writes 'status' to __early_cpu_boot_status and makes sure
bb9052744f4b7a Suzuki K Poulose  2016-02-23  677   *    it is committed to memory.
bb9052744f4b7a Suzuki K Poulose  2016-02-23  678   */
bb9052744f4b7a Suzuki K Poulose  2016-02-23  679  
bb9052744f4b7a Suzuki K Poulose  2016-02-23  680  	.macro	update_early_cpu_boot_status status, tmp1, tmp2
bb9052744f4b7a Suzuki K Poulose  2016-02-23  681  	mov	\tmp2, #\status
adb4907007445a Ard Biesheuvel    2016-04-15  682  	adr_l	\tmp1, __early_cpu_boot_status
adb4907007445a Ard Biesheuvel    2016-04-15  683  	str	\tmp2, [\tmp1]
bb9052744f4b7a Suzuki K Poulose  2016-02-23  684  	dmb	sy
bb9052744f4b7a Suzuki K Poulose  2016-02-23  685  	dc	ivac, \tmp1			// Invalidate potentially stale cache line
bb9052744f4b7a Suzuki K Poulose  2016-02-23  686  	.endm
bb9052744f4b7a Suzuki K Poulose  2016-02-23  687  
9703d9d7f77ce1 Catalin Marinas   2012-03-05  688  /*
8b0a95753a34b5 Ard Biesheuvel    2015-03-17  689   * Enable the MMU.
9703d9d7f77ce1 Catalin Marinas   2012-03-05  690   *
8b0a95753a34b5 Ard Biesheuvel    2015-03-17  691   *  x0  = SCTLR_EL1 value for turning on the MMU.
693d5639b44a8f Jun Yao           2018-09-24  692   *  x1  = TTBR1_EL1 value
8b0a95753a34b5 Ard Biesheuvel    2015-03-17  693   *
9dcf7914ae2386 Ard Biesheuvel    2016-08-31  694   * Returns to the caller via x30/lr. This requires the caller to be covered
9dcf7914ae2386 Ard Biesheuvel    2016-08-31  695   * by the .idmap.text section.
4bf8b96ed3f7e1 Suzuki K. Poulose 2015-10-19  696   *
4bf8b96ed3f7e1 Suzuki K. Poulose 2015-10-19  697   * Checks if the selected granule size is supported by the CPU.
4bf8b96ed3f7e1 Suzuki K. Poulose 2015-10-19  698   * If it isn't, park the CPU
9703d9d7f77ce1 Catalin Marinas   2012-03-05  699   */
c63d9f82db9439 Mark Brown        2020-02-18  700  SYM_FUNC_START(__enable_mmu)
693d5639b44a8f Jun Yao           2018-09-24  701  	mrs	x2, ID_AA64MMFR0_EL1
693d5639b44a8f Jun Yao           2018-09-24  702  	ubfx	x2, x2, #ID_AA64MMFR0_TGRAN_SHIFT, 4
26f55386f964ce James Morse       2021-03-10  703  	cmp     x2, #ID_AA64MMFR0_TGRAN_SUPPORTED_MIN
26f55386f964ce James Morse       2021-03-10  704  	b.lt    __no_granule_support
26f55386f964ce James Morse       2021-03-10 @705  	cmp     x2, #ID_AA64MMFR0_TGRAN_SUPPORTED_MAX
26f55386f964ce James Morse       2021-03-10  706  	b.gt    __no_granule_support
693d5639b44a8f Jun Yao           2018-09-24  707  	update_early_cpu_boot_status 0, x2, x3
693d5639b44a8f Jun Yao           2018-09-24  708  	adrp	x2, idmap_pg_dir
693d5639b44a8f Jun Yao           2018-09-24  709  	phys_to_ttbr x1, x1
693d5639b44a8f Jun Yao           2018-09-24  710  	phys_to_ttbr x2, x2
693d5639b44a8f Jun Yao           2018-09-24  711  	msr	ttbr0_el1, x2			// load TTBR0
c812026c54cfae Steve Capper      2019-08-07  712  	offset_ttbr1 x1, x3
693d5639b44a8f Jun Yao           2018-09-24  713  	msr	ttbr1_el1, x1			// load TTBR1
9703d9d7f77ce1 Catalin Marinas   2012-03-05  714  	isb
8cc8a32415364e Marc Zyngier      2021-02-08  715  
8cc8a32415364e Marc Zyngier      2021-02-08  716  	set_sctlr_el1	x0
8cc8a32415364e Marc Zyngier      2021-02-08  717  
9dcf7914ae2386 Ard Biesheuvel    2016-08-31  718  	ret
c63d9f82db9439 Mark Brown        2020-02-18  719  SYM_FUNC_END(__enable_mmu)
4bf8b96ed3f7e1 Suzuki K. Poulose 2015-10-19  720  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 35644 bytes --]

[-- Attachment #3: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] arm64/kexec: Test page size support with new TGRAN range values
  2021-07-12 16:07 ` kernel test robot
@ 2021-07-14  2:32   ` Anshuman Khandual
  0 siblings, 0 replies; 3+ messages in thread
From: Anshuman Khandual @ 2021-07-14  2:32 UTC (permalink / raw)
  To: kernel test robot, linux-arm-kernel
  Cc: kbuild-all, Catalin Marinas, Will Deacon, James Morse,
	linux-kernel



On 7/12/21 9:37 PM, kernel test robot wrote:
> Hi Anshuman,
> 
> Thank you for the patch! Yet something to improve:
> 
> [auto build test ERROR on arm64/for-next/core]
> [also build test ERROR on arm/for-next soc/for-next kvmarm/next v5.14-rc1 next-20210712]
> [cannot apply to xlnx/master]
> [If your patch is applied to the wrong git tree, kindly drop us a note.
> And when submitting patch, we suggest to use '--base' as documented in
> https://git-scm.com/docs/git-format-patch]
> 
> url:    https://github.com/0day-ci/linux/commits/Anshuman-Khandual/arm64-kexec-Test-page-size-support-with-new-TGRAN-range-values/20210712-110329
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-next/core
> config: arm64-buildonly-randconfig-r005-20210712 (attached as .config)
> compiler: aarch64-linux-gcc (GCC) 9.3.0
> reproduce (this is a W=1 build):
>         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>         chmod +x ~/bin/make.cross
>         # https://github.com/0day-ci/linux/commit/48b74d46210916db21b8f568b92f1771827bffe9
>         git remote add linux-review https://github.com/0day-ci/linux
>         git fetch --no-tags linux-review Anshuman-Khandual/arm64-kexec-Test-page-size-support-with-new-TGRAN-range-values/20210712-110329
>         git checkout 48b74d46210916db21b8f568b92f1771827bffe9
>         # save the attached .config to linux build tree
>         mkdir build_dir
>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross O=build_dir ARCH=arm64 SHELL=/bin/bash
> 
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
> 
> All errors (new ones prefixed by >>):
> 
>    arch/arm64/kernel/head.S: Assembler messages:
>>> arch/arm64/kernel/head.S:705: Error: undefined symbol ID_AA64MMFR0_TGRAM64_SUPPORTED_MAX used as an immediate value

Needs a typo fix. Missed 64K build I guess, will fix it.

s/ID_AA64MMFR0_TGRAM64_SUPPORTED_MAX/ID_AA64MMFR0_TGRAN64_SUPPORTED_MAX

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2021-07-14  2:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-07-12  3:02 [PATCH] arm64/kexec: Test page size support with new TGRAN range values Anshuman Khandual
2021-07-12 16:07 ` kernel test robot
2021-07-14  2:32   ` Anshuman Khandual

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).