]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
arm64: Get rid of __smccc_workaround_1_hvc_*
authorMarc Zyngier <marc.zyngier@arm.com>
Wed, 11 Dec 2019 21:45:49 +0000 (14:45 -0700)
committerKhalid Elmously <khalid.elmously@canonical.com>
Wed, 18 Dec 2019 03:45:05 +0000 (22:45 -0500)
BugLink: https://bugs.launchpad.net/bugs/1854207
[ Upstream commit 22765f30dbaf1118c6ff0fcb8b99c9f2b4d396d5 ]

The very existence of __smccc_workaround_1_hvc_* is a thinko, as
KVM will never use a HVC call to perform the branch prediction
invalidation. Even as a nested hypervisor, it would use an SMC
instruction.

Let's get rid of it.

Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: dann frazier <dann.frazier@canonical.com>
Acked-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Connor Kuehl <connor.kuehl@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
arch/arm64/kernel/bpi.S
arch/arm64/kernel/cpu_errata.c

index 0af46cfdbbf3fa1b4aaea81284eeb0e2e725eba6..4cae34e5a24e296c2401336858a2405c5f817caa 100644 (file)
@@ -56,21 +56,13 @@ ENTRY(__bp_harden_hyp_vecs_start)
 ENTRY(__bp_harden_hyp_vecs_end)
 
 
-.macro smccc_workaround_1 inst
+ENTRY(__smccc_workaround_1_smc_start)
        sub     sp, sp, #(8 * 4)
        stp     x2, x3, [sp, #(8 * 0)]
        stp     x0, x1, [sp, #(8 * 2)]
        mov     w0, #ARM_SMCCC_ARCH_WORKAROUND_1
-       \inst   #0
+       smc     #0
        ldp     x2, x3, [sp, #(8 * 0)]
        ldp     x0, x1, [sp, #(8 * 2)]
        add     sp, sp, #(8 * 4)
-.endm
-
-ENTRY(__smccc_workaround_1_smc_start)
-       smccc_workaround_1      smc
 ENTRY(__smccc_workaround_1_smc_end)
-
-ENTRY(__smccc_workaround_1_hvc_start)
-       smccc_workaround_1      hvc
-ENTRY(__smccc_workaround_1_hvc_end)
index 03208dad6635d9d1d4afac170db64ca88b5e215a..dd0a3dd0b6c36519dcbc171e481b261859f58c38 100644 (file)
@@ -86,8 +86,6 @@ DEFINE_PER_CPU_READ_MOSTLY(struct bp_hardening_data, bp_hardening_data);
 #ifdef CONFIG_KVM
 extern char __smccc_workaround_1_smc_start[];
 extern char __smccc_workaround_1_smc_end[];
-extern char __smccc_workaround_1_hvc_start[];
-extern char __smccc_workaround_1_hvc_end[];
 
 static void __copy_hyp_vect_bpi(int slot, const char *hyp_vecs_start,
                                const char *hyp_vecs_end)
@@ -132,8 +130,6 @@ static void install_bp_hardening_cb(bp_hardening_cb_t fn,
 #else
 #define __smccc_workaround_1_smc_start         NULL
 #define __smccc_workaround_1_smc_end           NULL
-#define __smccc_workaround_1_hvc_start         NULL
-#define __smccc_workaround_1_hvc_end           NULL
 
 static void install_bp_hardening_cb(bp_hardening_cb_t fn,
                                      const char *hyp_vecs_start,
@@ -199,8 +195,9 @@ static int detect_harden_bp_fw(void)
                if ((int)res.a0 < 0)
                        return -1;
                cb = call_hvc_arch_workaround_1;
-               smccc_start = __smccc_workaround_1_hvc_start;
-               smccc_end = __smccc_workaround_1_hvc_end;
+               /* This is a guest, no need to patch KVM vectors */
+               smccc_start = NULL;
+               smccc_end = NULL;
                break;
 
        case PSCI_CONDUIT_SMC: