Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp478105pxf; Wed, 10 Mar 2021 10:00:06 -0800 (PST) X-Google-Smtp-Source: ABdhPJzlZysH+reI2fiVvQ6z+iWIi+ym+9LZf6Jy8DJH2USL/PJwzCb3h9OVBkSldUJaH3m9NH0H X-Received: by 2002:a17:907:3e8c:: with SMTP id hs12mr4955806ejc.105.1615399206742; Wed, 10 Mar 2021 10:00:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615399206; cv=none; d=google.com; s=arc-20160816; b=lVUpj6Gdx7B4t9dBMcJq5p8RoZw+e16t8uzXheW/R98OrUA/EcClQNqEcLJEpX4I7D TPE2wWhKw+nfWAmYHZWP+wSLV8poeSY88YxVuAB163CvaOtWxnJvinpPXSv0ju0hhDPI 8dqFQ84IvrKbSrJaUwEnca74nsa0HUrJ3lm/HTfQr0ChMj2fKjazY+4BpfWjLLV80AxZ ChLTbb/js4ytevfQWRT3cNa+CRCLGWACD6HbfZfAbC0HdNLQ6kyLFfgnLwg7sfiAeCKj IkTioRp0qrSJ+gmU/x5u097l7k83KwmxTgBVs7+7KjqitgrJYtz6rplYoGwVY44hOmlI prbQ== 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=FQ7gk+4i0GZUVGgKW9zQ6uuaT/h986N5brkzpgihVQ4=; b=T18yVHVkQ4q1M9D/dvVhlNS2IUtPTzjdrqxuwqJgsjUuyjYqR5WQAMctKa9zH0jx2W 3TS9wrfk2cKf/YboviYd5pVma8S/9xf4dmsVkJToLB4uddCRSp8inQgsJk5YHzxDMFC1 RDXQso13kQRLlxS0qdlp3UZJDLmPXokBjQUsU6Lg0nhC/7MdlPFi7YWC8+Awh7DB/gbl 8s3pZCeDv8Q4J0+iICxiL/qvvWH1h8QZ8FbWWtZ0iOD09ryIcvMokxj/lLLCyJxLeUc9 OUIYKt9cBWZtgiKEMNwkSuxqe7mPIz8uzXRoZ/ZL6YVjbOGtsSKrg8PYZRpf/kRtqhSm m2rg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="l2/JAssr"; 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 q3si118532edc.7.2021.03.10.09.59.44; Wed, 10 Mar 2021 10:00:06 -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="l2/JAssr"; 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 S233660AbhCJR60 (ORCPT + 99 others); Wed, 10 Mar 2021 12:58:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48736 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233653AbhCJR6N (ORCPT ); Wed, 10 Mar 2021 12:58:13 -0500 Received: from mail-wm1-x349.google.com (mail-wm1-x349.google.com [IPv6:2a00:1450:4864:20::349]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0BF36C061760 for ; Wed, 10 Mar 2021 09:58:13 -0800 (PST) Received: by mail-wm1-x349.google.com with SMTP id j8so1309932wmq.6 for ; Wed, 10 Mar 2021 09:58:12 -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=FQ7gk+4i0GZUVGgKW9zQ6uuaT/h986N5brkzpgihVQ4=; b=l2/JAssrCgiSVNWvv4xKwvbtNAJ4uVkYJ8t6QBmtVRzgoG35risu7QZVUsv1ZVEVVc d0cu6c8ao+zRESzgSYR0tOiVun97ubBgTvNljNr07rf0ZaBhRxxm3aeL4YQF0lrAWMd3 J6EHU6UjAWsuDfgdjF2Xy9kBIiLSqFoO/8/8jY1z0jZEnLVRSGHJdrgiLo4rMCXudmEy SmGdNMHEAxYX4BQ0m/Q8CpJ8tyO8EwGVTgfToo90g/wP1g66/b1nh7za3kbk5Dbi1OyZ cHdkyNd2U0aCwKGZLb5VJukCs5LMD1M2DzqKbuxUNl5vA15jwSiQVnBxV4noRW0uEN6X S3WQ== 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=FQ7gk+4i0GZUVGgKW9zQ6uuaT/h986N5brkzpgihVQ4=; b=k5uT+H7v8CATmydQwq299GyVJ7QrCTjoiQYUCvMO93hwIVUu/lAca2iiPUiSKQlnKg Amwsw9vLprUY4wd8W2NaP58+WzFu8bu5L05pyZ6cJEbNC+EwGTXA7UT1kp+/i1YzXs6q uXNmMhq+GIHdchsnumt10Oxm4ndyH6HA818iGye3/+aLQlDGBAUSwklg9vKC5vz9YCXD Mx3INFfOBE+vo9gMsXZZFgiQibWK2kUUqiViLnGc0d7nF/1dU8e/2+FIHSjUWIRM3FLO WqjOgvc4Mf7nCxRJLvIxVXod0OrVdaqESjAqi2J5hmm8z4Hkli5CRrCB3Nkfep26moFv g9kA== X-Gm-Message-State: AOAM5312nM5w3D1r0+OHaboo85B0djrr/46LFejk6vaBIfRw/VxaNAVZ 5RZMRefGeSzjADwa9T9rBXf0+USp0UPw X-Received: from r2d2-qp.c.googlers.com ([fda3:e722:ac3:10:28:9cb1:c0a8:1652]) (user=qperret job=sendgmr) by 2002:a7b:c18e:: with SMTP id y14mr1333539wmi.1.1615399091555; Wed, 10 Mar 2021 09:58:11 -0800 (PST) Date: Wed, 10 Mar 2021 17:57:25 +0000 In-Reply-To: <20210310175751.3320106-1-qperret@google.com> Message-Id: <20210310175751.3320106-9-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 08/34] 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, 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 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 3d10e6527f7d..06ca4828005f 100644 --- a/arch/arm64/include/asm/kvm_host.h +++ b/arch/arm64/include/asm/kvm_host.h @@ -591,6 +591,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; \ @@ -630,6 +631,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.30.1.766.gb4fecdf3b7-goog