Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1256806pxf; Fri, 19 Mar 2021 03:04:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzRdBZ5C8ZHkN9N5Om896u8bQSte6uLn18n5qzH/sffzYiNW8YpwgBR8skOufpTsu2xtZk9 X-Received: by 2002:a17:907:3e8a:: with SMTP id hs10mr3373354ejc.267.1616148245231; Fri, 19 Mar 2021 03:04:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616148245; cv=none; d=google.com; s=arc-20160816; b=Bg+uq2pcJ6raxAioMuFlTAkE/Jd5t+4ftLN1t1Xz2cqcoGC/wS4dKsW/xPHqAZyQhJ CLTQwL9YslcQWRh3djTZJO38blD+ZYv/2OcLx1nKqH4mo/KNqHGCX/zsPK/YphdVfbD/ e8JhRA22drpQVlxuZ2WupWtippDkzKpbOTQ2Nc3euZghzjAar/JzHBzX9jUtUnS5Foeo d216+rrsLd5ondmWNeBMiBf1w45T3nyKb2qpMGmHdxP8ZYwMeb8L5xXbTIyZvl8FiM/0 n9gxAKnJPUPHHHR7no9wWU3pNrz2EaM9xXuh8ZNccJLbjC/Z5g4dlQr73tovojxjZV2U 4dPg== 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=FHhOKlvH8BUgvSu8w1ogZTH6l5iURXLk02Ie2JUxorI=; b=I2wO7K2qGmE24byxUqtbCrB0G4bztgOE3vmpyuyg5WSEAFfNsvoIuz76ftpXH7hJzc v87BI7E8KQ0GmR6HzqOFjorb63Pa2Wvo3e0TwK9ZH4i28qf4nKz7lJciN6Y7gTmTXaXp O/t8J0HnhGbsQYV4VDhc7Uo34nhsz+U8im7lywcS22AAV3Ogo0PHlrpBas1sCoqVAP5Y /MhNsDXLPL/jo9Qf9ruWE0UZK2pWk742/WyfuzVhM9XwEnSSjZxp5Qju3wndmMvVAWfO qcl/EuCYy5zAG3NHAWge415x7ZXe1UbTC6TSFHxVc5KYeNT8YAqZCWDym/TZdJJBPCmp S06w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=qixyVDp2; 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 jp23si4018157ejb.643.2021.03.19.03.03.41; Fri, 19 Mar 2021 03:04:05 -0700 (PDT) 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=qixyVDp2; 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 S230010AbhCSKCl (ORCPT + 99 others); Fri, 19 Mar 2021 06:02:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54076 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230076AbhCSKCI (ORCPT ); Fri, 19 Mar 2021 06:02:08 -0400 Received: from mail-qv1-xf49.google.com (mail-qv1-xf49.google.com [IPv6:2607:f8b0:4864:20::f49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1FC3DC06174A for ; Fri, 19 Mar 2021 03:02:08 -0700 (PDT) Received: by mail-qv1-xf49.google.com with SMTP id ev19so14707286qvb.7 for ; Fri, 19 Mar 2021 03:02:08 -0700 (PDT) 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=FHhOKlvH8BUgvSu8w1ogZTH6l5iURXLk02Ie2JUxorI=; b=qixyVDp2kzHvkmDWySq9jBUdHw1gl4owgBvaGaZcBZnZJ3t0tbfIPvpnr/l0h2deyl 2EPkGOTsbSATaWOR5f/vBI+kFfGMcSFOmltFzs6oJl8frXJEaIW57uVoBFzxvj7efpej Km7kaJymPI6YHaaotbR7/CKArmpzCXEg7pMb+NNE62MGwntXknqbQwbUqCfwZeVJpOxO DGXawS5F6hpYD/m+wgEUgM3jp8DdXp7e4Jdtcs7QpjJM9H5atLC5LViAK6E791VUrkia lkGv1U5aVDqEVnL5hIxnUiyIOmLtYxelT+qUAgnrR32tl3EQE5CDB5VPnBGGC++t2uNL 8iSw== 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=FHhOKlvH8BUgvSu8w1ogZTH6l5iURXLk02Ie2JUxorI=; b=juLvEhmbmUwo/yZxYrbDrV0nIWGoF/NPAYI0pCyzEBHbRkWRAgOaQvqLyedc7svcXX KMe3q6jsviYij2SWuGJPR6T+R8iQDTHpIO6L66JJGfubDMr5RHsAB2lgsRPWl5+hcqtQ o9IUN53FzTFu+2/ajZRDi/+vAMNYEkaGDP/1MGp0q1lATi3sMhg2wGR8+mWxrnMBRZ5p 2N0IXdfQ9pLU76P7sfVxPLB0WoOoZJ8T7mzjmsnZnkfuzeY0yLMsmCYtsFzG7ayN6B+V CeyqOz1+HSW9gIKncAc7GeUQE1HtN8K0ve/HKLmlM2MCx4q+HsEzDb/AX7FZED8foOn2 FoKg== X-Gm-Message-State: AOAM531tmEy72CVYOsI3TYF4GLSkrlyq851dpb5CllFJXabX+QiJ4D+k S2uyZh8We4sv3tIPMRaYF2wy6QPyKVMJ X-Received: from r2d2-qp.c.googlers.com ([fda3:e722:ac3:10:28:9cb1:c0a8:1652]) (user=qperret job=sendgmr) by 2002:a0c:b410:: with SMTP id u16mr8628046qve.8.1616148127254; Fri, 19 Mar 2021 03:02:07 -0700 (PDT) Date: Fri, 19 Mar 2021 10:01:16 +0000 In-Reply-To: <20210319100146.1149909-1-qperret@google.com> Message-Id: <20210319100146.1149909-9-qperret@google.com> Mime-Version: 1.0 References: <20210319100146.1149909-1-qperret@google.com> X-Mailer: git-send-email 2.31.0.rc2.261.g7f71774620-goog Subject: [PATCH v6 08/38] KVM: arm64: Make kvm_call_hyp() a function call at Hyp 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, seanjc@google.com, mate.toth-pal@arm.com, linux-kernel@vger.kernel.org, robh+dt@kernel.org, linux-arm-kernel@lists.infradead.org, kernel-team@android.com, kvmarm@lists.cs.columbia.edu, tabba@google.com, ardb@kernel.org, mark.rutland@arm.com, dbrazdil@google.com, qperret@google.com Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org kvm_call_hyp() has some logic to issue a function call or a hypercall depending on the EL at which the kernel is running. However, all the code compiled under __KVM_NVHE_HYPERVISOR__ is guaranteed to only run at EL2 which allows us to simplify. Add ifdefery to kvm_host.h to simplify kvm_call_hyp() in .hyp.text. Acked-by: Will Deacon Signed-off-by: Quentin Perret --- arch/arm64/include/asm/kvm_host.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h index 08f500b2551a..6a2031af9562 100644 --- a/arch/arm64/include/asm/kvm_host.h +++ b/arch/arm64/include/asm/kvm_host.h @@ -593,6 +593,7 @@ int kvm_test_age_hva(struct kvm *kvm, unsigned long hva); void kvm_arm_halt_guest(struct kvm *kvm); void kvm_arm_resume_guest(struct kvm *kvm); +#ifndef __KVM_NVHE_HYPERVISOR__ #define kvm_call_hyp_nvhe(f, ...) \ ({ \ struct arm_smccc_res res; \ @@ -632,6 +633,11 @@ void kvm_arm_resume_guest(struct kvm *kvm); \ ret; \ }) +#else /* __KVM_NVHE_HYPERVISOR__ */ +#define kvm_call_hyp(f, ...) f(__VA_ARGS__) +#define kvm_call_hyp_ret(f, ...) f(__VA_ARGS__) +#define kvm_call_hyp_nvhe(f, ...) f(__VA_ARGS__) +#endif /* __KVM_NVHE_HYPERVISOR__ */ void force_vm_exit(const cpumask_t *mask); void kvm_mmu_wp_memory_region(struct kvm *kvm, int slot); -- 2.31.0.rc2.261.g7f71774620-goog