From patchwork Mon Mar 15 14:35:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Quentin Perret X-Patchwork-Id: 12139647 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, 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 949F5C43381 for ; Mon, 15 Mar 2021 14:39:07 +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 DFE8364E74 for ; Mon, 15 Mar 2021 14:39:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DFE8364E74 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=qO9bn8F0Yw7Y3IbNJzzbHkMX95cYPAKRB0ST4+yWIkQ=; b=KDhrT87rhXv6YT IBnc7KCBXiUG/gM5UFRIcxheyBOJb9VSkD6R0YKUwBIO1XYyJC8BYX+/L0+tiBcj6Iyl7JtpsKeGy iUT2sEYnMUpw0pjmBpmKKxPSGPXXyahb53ju4h/KLCZqqVziJl/R+9ENGBNrccLEbXbJ0ZiX5KinM eaF35p8VUyBtN1g35WOpt2PNXXw+PFm5lNEGuqn/5awm+TCZ9qKXzN30Oqoxt5LFzuXyAulg07XZ0 ItiU692m++1v50xm5tGRm47gggxX8T0JfxbTteKbBGH4d2gWa/K0wv1wuuwkwG+IQiQBVNhMjdR/p k5FWT1PocaJNSc+V3NIg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lLoLU-00G6Hv-FR; Mon, 15 Mar 2021 14:37:26 +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 1lLoK8-00G5jY-8P for linux-arm-kernel@lists.infradead.org; Mon, 15 Mar 2021 14:36:03 +0000 Received: by mail-wr1-x44a.google.com with SMTP id e13so15165526wrg.4 for ; Mon, 15 Mar 2021 07:35:57 -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=+iu0t5BZID9srTWBP+2VrUQDFbl6lTqyuwf0tKjg+JE=; b=eCfaDc/7sIi6ERqTbQYAo0T/MGESaou7EUDhXwnQrsDwamnC9YlqfgIGWyi8fqO8yO nTiawzHfVoaGMYlQk9s/eR4POgKLB8f5IkHNxi6muO5P+/FDSHukbR3UQzYNUZH+9RNt RI0isey48BJvIiy7xK7jk3qVM28DXl+YCeu3jI2fLFYrAWJqy0tzVaTanAh6qbjLcAlw eaFZc759FNLxBsxtgNJ4BfAQRFbHA5fOqbOU+BobykofhZI/QjUT3Zm/RCejnFg7Bv28 MzfvvCmCqN1yIauigRfpZiyXbb/q0yuJN8t/XhF4fSGvwRd53BMDgZoUAxXmwjS03SVW XjMw== 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=+iu0t5BZID9srTWBP+2VrUQDFbl6lTqyuwf0tKjg+JE=; b=hEw31SOKzeJv8W0ER9NENsCTkPbdFa3HWW3nzPdAFbM6reUv1tepRCguquD2zf2KCO +v/kdrZ22g8at3VmXVzz4feJNl5qj8FGdg+aWRE3OTzPPlJKf0UenC4tmdZ3IZ2QGyiE thD0U7HOvm56MPYz7NermLKecaaOyhadGplv5m4vDitnu/4u7Im/51sIMJim7+LAZQ/h YFezDJ6Y985N3ewqh1Yt6gGduCO9c+HLzRa2KS+4cb7a3n+JsQPrSe4oIP1qZSWenPvh kR3Kzzm3OP7WMZwoGdVX5sfg8+ncqim9hYdcCri6fNL2wVH6lrAjXge9YpJaNfBmHWQ/ 98BQ== X-Gm-Message-State: AOAM531PvPT1K4hbkLgcDkfCNno5yWX4psobt9tEQaJTVQrasX6evCa9 WqscDwt+sojo4naRlzIltp1CQY/O09ZF X-Google-Smtp-Source: ABdhPJxCgwITDTWF8jM+n9TA0U3rRomDUbTmfz8t0MMwY2a20uS8WWMoTr0wvdf1I/4Avmktbd6EQAwHuiCo X-Received: from r2d2-qp.c.googlers.com ([fda3:e722:ac3:10:28:9cb1:c0a8:1652]) (user=qperret job=sendgmr) by 2002:a1c:c20a:: with SMTP id s10mr21383wmf.144.1615818957308; Mon, 15 Mar 2021 07:35:57 -0700 (PDT) Date: Mon, 15 Mar 2021 14:35:08 +0000 In-Reply-To: <20210315143536.214621-1-qperret@google.com> Message-Id: <20210315143536.214621-9-qperret@google.com> Mime-Version: 1.0 References: <20210315143536.214621-1-qperret@google.com> X-Mailer: git-send-email 2.31.0.rc2.261.g7f71774620-goog Subject: [PATCH v5 08/36] 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210315_143601_520218_C59756DF X-CRM114-Status: GOOD ( 11.47 ) 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);