Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp477702pxf; Wed, 10 Mar 2021 09:59:35 -0800 (PST) X-Google-Smtp-Source: ABdhPJz7AoxFwdrkqjrLcY2jVKU3qq9OCEbbYNGSLZla5CfGf2tCj889agNGCbTRZWMt4K/9XrEL X-Received: by 2002:a17:906:66cf:: with SMTP id k15mr4886268ejp.296.1615399175436; Wed, 10 Mar 2021 09:59:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615399175; cv=none; d=google.com; s=arc-20160816; b=hhn4hyY5e5JNFiGis1RKVgS+qgVmFwh94FqYvBOVDXCgWY87pUaAyOdj/qZMQoT/vT bdneMIjg2UctbcUwyZnkpszmaKH4K8QJ0Oom/CyPmb9t56V9LFuQYcTcmIO4D2C0k3jW OkPqCEmZfWT1hckxEagKNZo49j1E1392oKuR5fkIAzAOs+Mi8qrU0gqzq3LxDdYGkRlM f2fa9Hfge0OigfZnd5feFKihTAjCxQ9Yh/EgyWLRL4i9lOD8QH6n+y8EwaJO+8xB931b g3Dc67zJ7YSNX1t0MofX67niG4mHKiYFVTSzEZyiYT9gbJSglWKXDck84ApXIw/e867z imSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:references:mime-version :message-id:in-reply-to:date:dkim-signature; bh=dxCzN3RMauKWh2fvqFWMKg2laCezvVx9+eyFyeOVXIM=; b=c7qZfwQloucSjQuTP3MU+BA0fOVb8C5lgqXD9/LlGQieuAVeSq3mjVhpdtOIHg6Qft FD5P5LbHT7YVVAZDlcBXtwZhzKmAWI8Sh7+Cxhx3NxKMcgAKidjN7fVLbXVqmFpk1jzv a+9z/KrLOPQn04z2rPOfaev2CeHpX9g9yWxv157huxGN0ATDFCjXgoYKzKSQY6NxETPP eYqYupVoEqxB1jmulxcqKhouoUd2NBrOxksj8cRivpfHpJ1Qxnag++yBdIbL9GwejyY9 VRjOAsajA40sdFXEIfZXiuHngF97eK+wLtugNVSWgEGciyym4mHRwj5IIPbVGwCjCyL3 /6Yw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="Pb/keeFM"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dj7si85894edb.378.2021.03.10.09.59.12; Wed, 10 Mar 2021 09:59:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="Pb/keeFM"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233542AbhCJR6T (ORCPT + 99 others); Wed, 10 Mar 2021 12:58:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48672 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233591AbhCJR57 (ORCPT ); Wed, 10 Mar 2021 12:57:59 -0500 Received: from mail-qk1-x749.google.com (mail-qk1-x749.google.com [IPv6:2607:f8b0:4864:20::749]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F3DEC061760 for ; Wed, 10 Mar 2021 09:57:59 -0800 (PST) Received: by mail-qk1-x749.google.com with SMTP id b127so11625295qkf.19 for ; Wed, 10 Mar 2021 09:57:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=dxCzN3RMauKWh2fvqFWMKg2laCezvVx9+eyFyeOVXIM=; b=Pb/keeFM6FLTObUZ0vCj8r+u4fGlhfurmJ1BDbmQmSEHz4lE1RmPC9dWhtSUH4ursS dMPYP6E31+WNt7F1w+2XsVL1GTNJkRRfUu7PxKUuIp2JvUceMsSdTUIGueMRxU5SA+K0 53rJE19I5YooOpMQfpqkoOid8LwrEUhstQoTEknAdifmfG417EI+b1y3EhsQfA+WLskR LFQdY140E4mgZqa+6Tuxpk+zuxstuuf4LH97W+qopGdatwH8lkKy3DsR1kN7gDWuldJt 3YAx44ZgdVrQNiMxH0VwJPb3tEtfDnjjZ64pJIWelpAwol/CTOYdpCy8JiYYnvQDewv+ Xliw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=dxCzN3RMauKWh2fvqFWMKg2laCezvVx9+eyFyeOVXIM=; b=k4SpgHTzVPrAAKG279zIFY0QleWhbPAOP1tNCTpc1t17Ec0KoFsm/D8B7SosFjGkYA UwgK8FmXR8oJCpsSeOub1SLUrE7f67ptmgR0dSxBxEp9kFkBzll2fWYu7q5QVB+qN0FJ hp88iFTlD44MXr++xqdxRQ2kpIizr6ZgK4ZVIEhy56AHeXYjsVlrndYz8jLaed/201cz otbpem/nHO1wUEd45euEY4nY5CLOrx/Wa8EKG2f20sjKLOYWrG6D6i5aKjgoCQohsImc v3EhfzXJkE6ZlH8KMrlI4MOXgqAt7iF/ZAwjAIVM89BPBMzRrxWEfv7DJ8TN0CIVEAcm M19w== X-Gm-Message-State: AOAM531JNu3k9UZujcYfTW7aX/QYwxXcgjR+FTZD8ji8oeNxnzAcnhyu VD22HXjq2u0Q4Irghqek7abH4KtQVqbk X-Received: from r2d2-qp.c.googlers.com ([fda3:e722:ac3:10:28:9cb1:c0a8:1652]) (user=qperret job=sendgmr) by 2002:ad4:4eae:: with SMTP id ed14mr4180391qvb.52.1615399078778; Wed, 10 Mar 2021 09:57:58 -0800 (PST) Date: Wed, 10 Mar 2021 17:57:19 +0000 In-Reply-To: <20210310175751.3320106-1-qperret@google.com> Message-Id: <20210310175751.3320106-3-qperret@google.com> Mime-Version: 1.0 References: <20210310175751.3320106-1-qperret@google.com> X-Mailer: git-send-email 2.30.1.766.gb4fecdf3b7-goog Subject: [PATCH v4 02/34] KVM: arm64: Link position-independent string routines into .hyp.text From: Quentin Perret To: catalin.marinas@arm.com, will@kernel.org, maz@kernel.org, james.morse@arm.com, julien.thierry.kdev@gmail.com, suzuki.poulose@arm.com Cc: android-kvm@google.com, linux-kernel@vger.kernel.org, kernel-team@android.com, kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, tabba@google.com, mark.rutland@arm.com, dbrazdil@google.com, mate.toth-pal@arm.com, seanjc@google.com, qperret@google.com, robh+dt@kernel.org, ardb@kernel.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Will Deacon Pull clear_page(), copy_page(), memcpy() and memset() into the nVHE hyp code and ensure that we always execute the '__pi_' entry point on the offchance that it changes in future. [ qperret: Commit title nits and added linker script alias ] Signed-off-by: Will Deacon Signed-off-by: Quentin Perret --- arch/arm64/include/asm/hyp_image.h | 3 +++ arch/arm64/kernel/image-vars.h | 11 +++++++++++ arch/arm64/kvm/hyp/nvhe/Makefile | 4 ++++ 3 files changed, 18 insertions(+) diff --git a/arch/arm64/include/asm/hyp_image.h b/arch/arm64/include/asm/hyp_image.h index 737ded6b6d0d..78cd77990c9c 100644 --- a/arch/arm64/include/asm/hyp_image.h +++ b/arch/arm64/include/asm/hyp_image.h @@ -56,6 +56,9 @@ */ #define KVM_NVHE_ALIAS(sym) kvm_nvhe_sym(sym) = sym; +/* Defines a linker script alias for KVM nVHE hyp symbols */ +#define KVM_NVHE_ALIAS_HYP(first, sec) kvm_nvhe_sym(first) = kvm_nvhe_sym(sec); + #endif /* LINKER_SCRIPT */ #endif /* __ARM64_HYP_IMAGE_H__ */ diff --git a/arch/arm64/kernel/image-vars.h b/arch/arm64/kernel/image-vars.h index 5aa9ed1e9ec6..4eb7a15c8b60 100644 --- a/arch/arm64/kernel/image-vars.h +++ b/arch/arm64/kernel/image-vars.h @@ -104,6 +104,17 @@ KVM_NVHE_ALIAS(kvm_arm_hyp_percpu_base); /* PMU available static key */ KVM_NVHE_ALIAS(kvm_arm_pmu_available); +/* Position-independent library routines */ +KVM_NVHE_ALIAS_HYP(clear_page, __pi_clear_page); +KVM_NVHE_ALIAS_HYP(copy_page, __pi_copy_page); +KVM_NVHE_ALIAS_HYP(memcpy, __pi_memcpy); +KVM_NVHE_ALIAS_HYP(memset, __pi_memset); + +#ifdef CONFIG_KASAN +KVM_NVHE_ALIAS_HYP(__memcpy, __pi_memcpy); +KVM_NVHE_ALIAS_HYP(__memset, __pi_memset); +#endif + #endif /* CONFIG_KVM */ #endif /* __ARM64_KERNEL_IMAGE_VARS_H */ diff --git a/arch/arm64/kvm/hyp/nvhe/Makefile b/arch/arm64/kvm/hyp/nvhe/Makefile index a6707df4f6c0..bc98f8e3d1da 100644 --- a/arch/arm64/kvm/hyp/nvhe/Makefile +++ b/arch/arm64/kvm/hyp/nvhe/Makefile @@ -9,10 +9,14 @@ ccflags-y := -D__KVM_NVHE_HYPERVISOR__ -D__DISABLE_EXPORTS hostprogs := gen-hyprel HOST_EXTRACFLAGS += -I$(objtree)/include +lib-objs := clear_page.o copy_page.o memcpy.o memset.o +lib-objs := $(addprefix ../../../lib/, $(lib-objs)) + obj-y := timer-sr.o sysreg-sr.o debug-sr.o switch.o tlb.o hyp-init.o host.o \ hyp-main.o hyp-smp.o psci-relay.o obj-y += ../vgic-v3-sr.o ../aarch32.o ../vgic-v2-cpuif-proxy.o ../entry.o \ ../fpsimd.o ../hyp-entry.o ../exception.o +obj-y += $(lib-objs) ## ## Build rules for compiling nVHE hyp code -- 2.30.1.766.gb4fecdf3b7-goog