Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp4066387pxb; Tue, 17 Nov 2020 10:20:04 -0800 (PST) X-Google-Smtp-Source: ABdhPJylCoFWbSC8+b+XsfiFW8eTcg9ZE7xRWnaVNRf31q4+2g84Ko31/3MQ/IsAUSKeRzcR7Rrq X-Received: by 2002:a17:906:3191:: with SMTP id 17mr20414293ejy.396.1605637203779; Tue, 17 Nov 2020 10:20:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605637203; cv=none; d=google.com; s=arc-20160816; b=q7ng84lpH/u1dhbher9BAK7fWxcB9qGTq6KX2pmoD3T5BxMSnLrsaGMoX3SbzWO5n6 sHV+x1krptK4d+8BiotkRhDGpAMnBkvjHU5LdzQX1hN1PR6MUQ3kpNrtd5rlal8c/Gup 97Y1G8SJBWStbWFLFLKYhEfBjw2D7GOdGfuq3RqRLrnCnfZyV939wSXuz16p1Hjj4yGI Ryw/d4FAo1mgiNQ2L8LaVf2LN6OULufFEIyuexVIbqzMAd15rO56o01+JSQaKgPB7QaZ zBhJBOIQOXx5ekfmwqlmLh915Kx3ZMKTXux3WDbxPRobeGQorTF8aOheWx5Dq4eQ5oNa Ddmg== 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:sender:dkim-signature; bh=lh2wfGLmmAYfouTWYrt95KjC1/ZF6WAi7ZBhV5AjDD0=; b=n93QkdQq6Vl22VVZB9+Oy34cshemfK+rPNRqb7lenhp+Hj9vFEti5zfnkrVtoW1iZ7 t1jWo4cvP2/bgXMT0LN1BOOoFpU/oFVCemS9hO/YlmnSOYuAd7qq5RdFqPeHx0IZC0UC kcjLG+PBKJUzHZRnfc+cwV0+A0BfvCR251rvOVVYnJhV/5PwGwxRzhjNltIKiRnpQ+8C uJpsZa308J5ksY2djTenDUj2SR3mX0lt35KavvWeaJsP0EsFoDX99AVOZSshcCY5w8Or ejXUvb8vV8TAzT2j3erT/A0HVP5gO0S3UnfHPKewXvvCZKkZc1R4qXL2qnuoZ86HFU4Q OKXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=nNRoD2M9; 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 y63si7181196ede.581.2020.11.17.10.19.32; Tue, 17 Nov 2020 10:20:03 -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=nNRoD2M9; 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 S1730831AbgKQSQk (ORCPT + 99 others); Tue, 17 Nov 2020 13:16:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48854 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730812AbgKQSQi (ORCPT ); Tue, 17 Nov 2020 13:16:38 -0500 Received: from mail-qt1-x84a.google.com (mail-qt1-x84a.google.com [IPv6:2607:f8b0:4864:20::84a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7A730C0613CF for ; Tue, 17 Nov 2020 10:16:38 -0800 (PST) Received: by mail-qt1-x84a.google.com with SMTP id i14so12969538qtq.18 for ; Tue, 17 Nov 2020 10:16:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:in-reply-to:message-id:mime-version:references:subject :from:to:cc; bh=lh2wfGLmmAYfouTWYrt95KjC1/ZF6WAi7ZBhV5AjDD0=; b=nNRoD2M9XXWoWM8NgpAlnEhXBoYa9xn/smGakcLCZJxBll99tRVH7XlZ6kpAfLmDzS YEBOp/igtTiXRZTz+j56GXi5pzEcTsxtC69P2Bv0KA1AZUyCDWPY853b0xcR0BXqNsjY zzoThHvrbMLTNPm/8mNuW8sATGGuqFD6NUWfoAWRd9Krb9CmjdTe3yBuDe1UP2ALLPRo K9J+hEQ46hZWlOQ5xsj57z6jJFoBPfuEglscL+ZMWfWKy3HK4Aci7rdN/cI80VZX34fB Q8O1Od1+22A+zc26YZLJls0NZORus1Ag2kLC1/y6w0rVECW+qKDUHu2XDuWGww78dUnJ 85Tg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=lh2wfGLmmAYfouTWYrt95KjC1/ZF6WAi7ZBhV5AjDD0=; b=LmfeFBsHHtkr8GMP6zFdS7JLqT92eBUl/SztcMkCvziMn0rmJDa0K5GgPv+hSqoByh ji06DK5YkwAVqTWAypedE8NXVgX1LnA7d6J7EyLdYGSNaZox2G+r8PYXbPsjDQeDjBCC rY+VMsqzUzA+ZuFekhXbWbrBzRZ5e/C+tyntCTIa5lrL63dBKtSVI4krm0qeUDyr3T4f X/+9RnkJYqq5yEoMkH/Ldr6eebIxUrRinkwwABimwKwGo9hlH2jew22iDdMXfAPmjJmI b+zeIKffH7iwjD1TGlyj29UlX6oOX/MvkIWjJ0tqZ4nwKqII+b7ywnHy746/L2stF1hl uoxQ== X-Gm-Message-State: AOAM5320HdQkkTYwQY52+kKE9fQmRAcDxvTRR5KJ251LqTFDiXYiSwsH cMeg4uw9dsMeJiBhJIZjcQNLOlMc+NGT Sender: "qperret via sendgmr" X-Received: from luke.lon.corp.google.com ([2a00:79e0:d:210:f693:9fff:fef4:a7ef]) (user=qperret job=sendgmr) by 2002:a0c:80e1:: with SMTP id 88mr995546qvb.10.1605636997650; Tue, 17 Nov 2020 10:16:37 -0800 (PST) Date: Tue, 17 Nov 2020 18:15:48 +0000 In-Reply-To: <20201117181607.1761516-1-qperret@google.com> Message-Id: <20201117181607.1761516-9-qperret@google.com> Mime-Version: 1.0 References: <20201117181607.1761516-1-qperret@google.com> X-Mailer: git-send-email 2.29.2.299.gdc1121823c-goog Subject: [RFC PATCH 08/27] KVM: arm64: Make kvm_call_hyp() a function call at Hyp From: Quentin Perret To: Catalin Marinas , Will Deacon , Marc Zyngier , James Morse , Julien Thierry , Suzuki K Poulose , Rob Herring , Frank Rowand Cc: "moderated list:ARM64 PORT (AARCH64 ARCHITECTURE)" , open list , "open list:KERNEL VIRTUAL MACHINE FOR ARM64 (KVM/arm64)" , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE" , kernel-team@android.com, android-kvm@google.com, Quentin Perret 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 the EL at which the kernel is running. However, all the code compiled under __KVM_NVHE_HYPERVISOR__ is guaranteed to run only at EL2, and in this case a simple function call is needed. Add ifdefery to kvm_host.h to symplify kvm_call_hyp() in .hyp.text. 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 ac11adab6602..7a5d5f4b3351 100644 --- a/arch/arm64/include/asm/kvm_host.h +++ b/arch/arm64/include/asm/kvm_host.h @@ -557,6 +557,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; \ @@ -596,6 +597,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.29.2.299.gdc1121823c-goog