Re: [PATCH v2 6/8] arm64: alternatives: have callbacks take a cap

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Mark,

On 12/09/2022 17:22, Mark Rutland wrote:
Today, callback alternatives are special-cased within
__apply_alternatives(), and are applied alongside patching for system
capabilities as ARM64_NCAPS is not part of the boot_capabilities feature
mask.

This special-casing is less than ideal. Giving special meaning to
ARM64_NCAPS for this requires some structures and loops to use
ARM64_NCAPS + 1 (AKA ARM64_NPATCHABLE), while others use ARM64_NCAPS.
It's also not immediately clear callback alternatives are only applied
when applying alternatives for system-wide features.

To make this a bit clearer, changes the way that callback alternatives
are identified to remove the special-casing of ARM64_NCAPS, and to allow
callback alternatives to be associated with a cpucap as with all other
alternatives.

New cpucaps, ARM64_ALWAYS_BOOT and ARM64_ALWAYS_SYSTEM are added which
are always detected alongside boot cpu capabilities and system
capabilities respectively. All existing callback alternatives are made
to use ARM64_ALWAYS_SYSTEM, and so will be patched at the same point
during the boot flow as before.

Subsequent patches will make more use of these new cpucaps.

There should be no functional change as a result of this patch.

Signed-off-by: Mark Rutland <mark.rutland@xxxxxxx>
Cc: Ard Biesheuvel <ardb@xxxxxxxxxx>
Cc: Catalin Marinas <catalin.marinas@xxxxxxx>
Cc: James Morse <james.morse@xxxxxxx>
Cc: Joey Gouly <joey.gouly@xxxxxxx>
Cc: Marc Zyngier <maz@xxxxxxxxxx>
Cc: Will Deacon <will@xxxxxxxxxx>
---
  arch/arm64/include/asm/alternative-macros.h | 18 +++++++++-----
  arch/arm64/include/asm/assembler.h          | 10 ++++----
  arch/arm64/include/asm/cpufeature.h         |  4 +---
  arch/arm64/include/asm/kvm_mmu.h            |  5 ++--
  arch/arm64/kernel/alternative.c             | 26 +++++++++++----------
  arch/arm64/kernel/cpufeature.c              | 19 +++++++++++++--
  arch/arm64/kernel/entry.S                   |  8 +++----
  arch/arm64/kvm/hyp/hyp-entry.S              |  4 ++--
  arch/arm64/tools/cpucaps                    |  2 ++
  9 files changed, 60 insertions(+), 36 deletions(-)

diff --git a/arch/arm64/include/asm/alternative-macros.h b/arch/arm64/include/asm/alternative-macros.h
index 7e157ab6cd505..189c31be163ce 100644
--- a/arch/arm64/include/asm/alternative-macros.h
+++ b/arch/arm64/include/asm/alternative-macros.h
@@ -2,10 +2,16 @@
  #ifndef __ASM_ALTERNATIVE_MACROS_H
  #define __ASM_ALTERNATIVE_MACROS_H
+#include <linux/const.h>
+
  #include <asm/cpucaps.h>
  #include <asm/insn-def.h>
-#define ARM64_CB_PATCH ARM64_NCAPS
+#define ARM64_CB_BIT	(UL(1) << 15)
+
+#if ARM64_NCAPS >= ARM64_CB_BIT
+#error "cpucaps have overflown ARM64_CB_BIT"
+#endif


Some of our builders are failing and bisect is pointing to this commit. Looks like they don't like the above and I see the following errors ...

  CC      arch/arm64/kvm/hyp/vhe/debug-sr.o
/tmp/ccY3kbki.s: Assembler messages:
/tmp/ccY3kbki.s:1600: Error: found 'L', expected: ')'
/tmp/ccY3kbki.s:1600: Error: found 'L', expected: ')'
/tmp/ccY3kbki.s:1600: Error: found 'L', expected: ')'
/tmp/ccY3kbki.s:1600: Error: found 'L', expected: ')'
/tmp/ccY3kbki.s:1600: Error: junk at end of line, first unrecognized character is `L'
/tmp/ccY3kbki.s:1723: Error: found 'L', expected: ')'
/tmp/ccY3kbki.s:1723: Error: found 'L', expected: ')'
/tmp/ccY3kbki.s:1723: Error: found 'L', expected: ')'
/tmp/ccY3kbki.s:1723: Error: found 'L', expected: ')'
/tmp/ccY3kbki.s:1723: Error: junk at end of line, first unrecognized character is `L' scripts/Makefile.build:249: recipe for target 'arch/arm64/kvm/hyp/vhe/debug-sr.o' failed

Seems that it does not like the 'UL' macro for some reason. Any thoughts?

Thanks
Jon

--
nvpublic



[Index of Archives]     [ARM Kernel]     [Linux ARM]     [Linux ARM MSM]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux