diff options
author | Paul Gortmaker <paul.gortmaker@windriver.com> | 2018-08-25 21:38:07 -0400 |
---|---|---|
committer | Paul Gortmaker <paul.gortmaker@windriver.com> | 2018-08-25 21:38:07 -0400 |
commit | 114e78d7e247f15f93ea151a690c1cb93323d133 (patch) | |
tree | 60c64859585118628f43029fc250832c9ae25c3c | |
parent | 576e6065beafa9fbc0c1b3da24a703cb3114be19 (diff) | |
download | longterm-queue-4.12-114e78d7e247f15f93ea151a690c1cb93323d133.tar.gz |
arm64: add additional shim commit
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
-rw-r--r-- | queue/arm64-fix-endianness-annotation-for-__apply_alternat.patch | 65 | ||||
-rw-r--r-- | queue/series | 1 |
2 files changed, 66 insertions, 0 deletions
diff --git a/queue/arm64-fix-endianness-annotation-for-__apply_alternat.patch b/queue/arm64-fix-endianness-annotation-for-__apply_alternat.patch new file mode 100644 index 0000000..644e8bb --- /dev/null +++ b/queue/arm64-fix-endianness-annotation-for-__apply_alternat.patch @@ -0,0 +1,65 @@ +From 15ad6ace52039c7e39435c4d712d147126604a97 Mon Sep 17 00:00:00 2001 +From: Luc Van Oostenryck <luc.vanoostenryck@gmail.com> +Date: Thu, 29 Jun 2017 16:40:12 +0200 +Subject: [PATCH] arm64: fix endianness annotation for + __apply_alternatives()/get_alt_insn() + +commit 15ad6ace52039c7e39435c4d712d147126604a97 upstream. + +get_alt_insn() is used to read and create ARM instructions, which +are always stored in memory in little-endian order. These values +are thus correctly converted to/from native order when processed +but the pointers used to hold the address of these instructions +are declared as for native order values. + +Fix this by declaring the pointers as __le32* instead of u32* and +make the few appropriate needed changes like removing the unneeded +cast '(u32*)' in front of __ALT_PTR()'s definition. + +Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com> +Signed-off-by: Will Deacon <will.deacon@arm.com> +Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> + +diff --git a/arch/arm64/kernel/alternative.c b/arch/arm64/kernel/alternative.c +index 8840c109c5d6..6dd0a3a3e5c9 100644 +--- a/arch/arm64/kernel/alternative.c ++++ b/arch/arm64/kernel/alternative.c +@@ -28,7 +28,7 @@ + #include <asm/sections.h> + #include <linux/stop_machine.h> + +-#define __ALT_PTR(a,f) (u32 *)((void *)&(a)->f + (a)->f) ++#define __ALT_PTR(a,f) ((void *)&(a)->f + (a)->f) + #define ALT_ORIG_PTR(a) __ALT_PTR(a, orig_offset) + #define ALT_REPL_PTR(a) __ALT_PTR(a, alt_offset) + +@@ -60,7 +60,7 @@ static bool branch_insn_requires_update(struct alt_instr *alt, unsigned long pc) + + #define align_down(x, a) ((unsigned long)(x) & ~(((unsigned long)(a)) - 1)) + +-static u32 get_alt_insn(struct alt_instr *alt, u32 *insnptr, u32 *altinsnptr) ++static u32 get_alt_insn(struct alt_instr *alt, __le32 *insnptr, __le32 *altinsnptr) + { + u32 insn; + +@@ -109,7 +109,7 @@ static void __apply_alternatives(void *alt_region, bool use_linear_alias) + { + struct alt_instr *alt; + struct alt_region *region = alt_region; +- u32 *origptr, *replptr, *updptr; ++ __le32 *origptr, *replptr, *updptr; + + for (alt = region->begin; alt < region->end; alt++) { + u32 insn; +@@ -124,7 +124,7 @@ static void __apply_alternatives(void *alt_region, bool use_linear_alias) + + origptr = ALT_ORIG_PTR(alt); + replptr = ALT_REPL_PTR(alt); +- updptr = use_linear_alias ? (u32 *)lm_alias(origptr) : origptr; ++ updptr = use_linear_alias ? lm_alias(origptr) : origptr; + nr_inst = alt->alt_len / sizeof(insn); + + for (i = 0; i < nr_inst; i++) { +-- +2.15.0 + diff --git a/queue/series b/queue/series index 97f7dc3..3df1087 100644 --- a/queue/series +++ b/queue/series @@ -76,6 +76,7 @@ tty-fix-tty_ldisc_receive_buf-documentation.patch KVM-arm64-Store-vcpu-on-the-stack-during-__guest_ent.patch KVM-arm-arm64-Convert-kvm_host_cpu_state-to-a-static.patch KVM-arm64-Change-hyp_panic-s-dependency-on-tpidr_el2.patch +arm64-fix-endianness-annotation-for-__apply_alternat.patch arm64-alternatives-use-tpidr_el2-on-VHE-hosts.patch KVM-arm64-Stop-save-restoring-host-tpidr_el1-on-VHE.patch arm64-alternatives-Add-dynamic-patching-feature.patch |