From patchwork Wed Mar 10 17:57:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Quentin Perret X-Patchwork-Id: 12128887 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2D83FC433DB for ; Wed, 10 Mar 2021 18:01:08 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9189364F3A for ; Wed, 10 Mar 2021 18:01:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9189364F3A Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Cc:To:From:Subject:References:Mime-Version: Message-Id:In-Reply-To:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=U45u+rdb6t/3/geF3CD8HdXMiWK41NPPcmk7186mgZ4=; b=l/FWpB495sZhAr +TWA4lcN7WhIlsmUFFqI7y40hDmJ4fjXMbijQlkSBAvcCzZ3nh8qqmDRyE2XIBQPFmO8YeK6Mm54Q +LVz/+P311b5Zz02VomQIdZM9Xt+fRgujCOmvzSLegdc4vDcCZEO2CjjiCb81a2UL90wwlWtkG5RZ zkPKG9vn7teAraC12o631+OupGCtXOe2Std642ngjFDmNKDx36veP/tAAHcXu9Jz7UVwQuIqv8JX0 jgJ0YPKhIyx+ccep2jvH3oeOEsuYu90CApuSZ67uGgqj+GOyvsp4WYxG5KnRV8uZTMLQKNkxfX5bm rQzpXtuqNMpUx67vaAdA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lK37W-007Oub-0S; Wed, 10 Mar 2021 17:59:42 +0000 Received: from mail-wr1-x44a.google.com ([2a00:1450:4864:20::44a]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lK365-007OB9-I1 for linux-arm-kernel@lists.infradead.org; Wed, 10 Mar 2021 17:58:15 +0000 Received: by mail-wr1-x44a.google.com with SMTP id m23so3318351wrh.7 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=uN7JaApCILvREVtjb8AC+FaT9wFKMHR1bmXeSJq6XRXDCF9t2FYTh0hZem8nViIC6t 3eidswP0N/dUw/3BpYsgxeNpLVrOPgH3kB8nMRcy+BjzjjDOgkUquveeaXzeWIXVSxgp e59Sr1+lwyDdWWRMmu8/QfrpkC/IhuWO9D1+ZTsQT8oVw0hAsNGAaGxc1o4zonM+0weP uVR4IYdsMinM8Al14BCxXH3IqOiKXMM7QDmJBl9UG+XElqOxMjfmtAC4EIGX4mpeIRTv mp0Fa5gN26jFl06eZxubiqNA3xSXRO6LqP49TBvC4mFZEQNJ36p+qphS8lIgd52uoU8H x1hg== X-Gm-Message-State: AOAM532DDosqkftRcVw0ANSdu01fT2jD1Sn1bsaqNW/n5fUbtzUJR21L cmEieNssUSQw8w4Tu8eldbpvHG7qUnPK X-Google-Smtp-Source: ABdhPJw1jFJ2uambxxtcgPuAbKpIituWx/uYJZ6wnBrvmsU1lXHbtQHSpkrolAxbBPbUyRL7xj955m5ZQfKl 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210310_175813_884816_229755C3 X-CRM114-Status: GOOD ( 11.71 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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);