From mboxrd@z Thu Jan 1 00:00:00 1970 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=-7.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,FSL_HELO_FAKE, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no 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 77452C43461 for ; Wed, 9 Sep 2020 08:32:08 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 2C4F421D7A for ; Wed, 9 Sep 2020 08:32:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="xoRVNsWj"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="PoOUXp6N" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2C4F421D7A 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=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=aj5UadLiWea5vvUVFjhLGLl0nm0S1WlsxLi4ul4J2Ho=; b=xoRVNsWj7xULZKPowduWGgSze EJQBjGA+f0DKYqEznGCyjRsnP4ulnxhSgll17AvxkSvvITEJ5llGrWd47PgYRjHrZPBr52t76wOmq V1BeHVXU6qo1xh2vN78UsfwEShiRzBxwdpi3RCt3UlITKM5NKa73XGZgAcvINXOSxOxipTNhxyYiV 4iiC3fUiTMcEjLG67vTdUGgUk54rSk/p8VIkP0Bi6KqOfp/eS+BpszpQphMAYG8ImF7MF/f5lCe1S RjS3XZF1WyQdK7K5AwUOZUiXzXVYjloEkmiQGY1DiRBfALmazW+lNX3JLR6W++EXIPRTNm21O/Gu+ JR3tjgisA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kFvVA-0005Qp-IZ; Wed, 09 Sep 2020 08:30:48 +0000 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kFvV7-0005QO-LE for linux-arm-kernel@lists.infradead.org; Wed, 09 Sep 2020 08:30:46 +0000 Received: by mail-wr1-x444.google.com with SMTP id o5so1910627wrn.13 for ; Wed, 09 Sep 2020 01:30:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=vNr2Ku1gGljilbGPEXcAx4EZtt5jVI1d5RcXLInGtb4=; b=PoOUXp6NbO1PbgnGP/chdt9lnZCh95AhtuD3rox2+jyV9udkzI+tqmzOuBsywgaRox gnpwwMffZ0fAkR3+xn7wEju6UAZWSxk3yVHDrDsitM6IMGZonEXRXovNQ8sdOl5hYG3x E5r7YDVfX663k4hv/BGAHOWjMF8GMctg9gJh7SLxtGZjeV+fCPdS7kWkLbYFbW/q6uMC BvAnLHnxz8m3tbaomWp+TGOWAaUUEaMyDh7zPuJFyhEVcew9xzEY+L41AeHveLONrl8T y/prKnlsJq4zFq48GweKTMJiey7EtHcWdWbg8dS0zPgyG855wkVyVRUcpp9tTwxYm0Xt F1gg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=vNr2Ku1gGljilbGPEXcAx4EZtt5jVI1d5RcXLInGtb4=; b=TwQ+tyOV+RQD7Ik74kQ2J21bdMtEUQcUWCB5i9t/YIkIUCnkcyKkuc+HuWrhsJaAUp qF5OT7Cji+mc1Ty7ic/Zvw2CDKip2x1GZZM4x45E2MgtcygxizkaFsCscSI1GA5vyHH2 pGnXLNFpYN78nU4FGB6byMpgrBnPfT2hR21NPqy5CoNowhNpLCqRTq4KhK5ZjIVwQmFk vWpFalP100ENQwmyc6IgTm0CMsE6hPQczuDGiRQDSUlZ6Sj8MWwtYHgKexSw1OaVCHod uUyDwx1xWbvPm0RT56MLTWWNekRr7pVAOTOYDGhFj7Egx22sEql1P/Jq1kFlTRPSfwUa qwHQ== X-Gm-Message-State: AOAM532JTuzY+38wlOgjVRPdgvrHEHdEpbyTutHksglfsWs3c8tFYJFw tnk7/40C/ZLq00PBJlmL4qfkXg== X-Google-Smtp-Source: ABdhPJw+71hj8Nq8tqsAAF8sQjgZxHrQ2bOt+j5Y9np5WDNJVjmT47uqrLWSNezwkBA1xUJZ09fWKQ== X-Received: by 2002:a5d:67d2:: with SMTP id n18mr2614673wrw.223.1599640244388; Wed, 09 Sep 2020 01:30:44 -0700 (PDT) Received: from google.com ([2a00:79e0:d:109:4a0f:cfff:fe4a:6363]) by smtp.gmail.com with ESMTPSA id u66sm2872821wme.12.2020.09.09.01.30.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Sep 2020 01:30:43 -0700 (PDT) Date: Wed, 9 Sep 2020 09:30:39 +0100 From: Andrew Scull To: Marc Zyngier Subject: Re: [PATCH v3 16/18] KVM: arm64: nVHE: Migrate hyp interface to SMCCC Message-ID: <20200909083039.GA93664@google.com> References: <20200903135307.251331-1-ascull@google.com> <20200903135307.251331-17-ascull@google.com> <87o8mhlld4.wl-maz@kernel.org> <20200908110222.GF3268721@google.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200908110222.GF3268721@google.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200909_043045_735210_9E4102C2 X-CRM114-Status: GOOD ( 29.21 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kernel-team@android.com, suzuki.poulose@arm.com, catalin.marinas@arm.com, james.morse@arm.com, linux-arm-kernel@lists.infradead.org, Sudeep Holla , David Brazdil , will@kernel.org, kvmarm@lists.cs.columbia.edu, julien.thierry.kdev@gmail.com Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Sep 08, 2020 at 12:02:22PM +0100, Andrew Scull wrote: > On Mon, Sep 07, 2020 at 03:20:07PM +0100, Marc Zyngier wrote: > > On Thu, 03 Sep 2020 14:53:05 +0100, > > Andrew Scull wrote: > > > > > > Rather than passing arbitrary function pointers to run at hyp, define > > > and equivalent set of SMCCC functions. > > > > > > Since the SMCCC functions are strongly tied to the original function > > > prototypes, it is not expected for the host to ever call an invalid ID > > > but a warning is raised if this does ever occur. > > > > > > As __kvm_vcpu_run is used for every switch between the host and a guest, > > > it is explicitly singled out to be identified before the other function > > > IDs to improve the performance of the hot path. > > > > > > Signed-off-by: Andrew Scull > > > Signed-off-by: David Brazdil > > > --- > > > arch/arm64/include/asm/kvm_asm.h | 24 ++++++ > > > arch/arm64/include/asm/kvm_host.h | 25 ++++--- > > > arch/arm64/kvm/arm.c | 2 +- > > > arch/arm64/kvm/hyp.S | 24 ++---- > > > arch/arm64/kvm/hyp/nvhe/hyp-main.c | 113 +++++++++++++++++++++++++---- > > > 5 files changed, 145 insertions(+), 43 deletions(-) > > > > > > diff --git a/arch/arm64/include/asm/kvm_asm.h b/arch/arm64/include/asm/kvm_asm.h > > > index 4bbde3d3989c..4a73f1349151 100644 > > > --- a/arch/arm64/include/asm/kvm_asm.h > > > +++ b/arch/arm64/include/asm/kvm_asm.h > > > @@ -38,6 +38,30 @@ > > > > > > #define __SMCCC_WORKAROUND_1_SMC_SZ 36 > > > > > > +#define KVM_HOST_SMCCC_ID(id) \ > > > + ARM_SMCCC_CALL_VAL(ARM_SMCCC_FAST_CALL, \ > > > + ARM_SMCCC_SMC_64, \ > > > + ARM_SMCCC_OWNER_STANDARD_HYP, \ > > > + (id)) > > > + > > > +#define KVM_HOST_SMCCC_FUNC(name) KVM_HOST_SMCCC_ID(__KVM_HOST_SMCCC_FUNC_##name) > > > + > > > +#define __KVM_HOST_SMCCC_FUNC___kvm_hyp_init 0 > > > +#define __KVM_HOST_SMCCC_FUNC___kvm_flush_vm_context 1 > > > +#define __KVM_HOST_SMCCC_FUNC___kvm_tlb_flush_vmid_ipa 2 > > > +#define __KVM_HOST_SMCCC_FUNC___kvm_tlb_flush_vmid 3 > > > +#define __KVM_HOST_SMCCC_FUNC___kvm_tlb_flush_local_vmid 4 > > > +#define __KVM_HOST_SMCCC_FUNC___kvm_timer_set_cntvoff 5 > > > +#define __KVM_HOST_SMCCC_FUNC___kvm_vcpu_run 6 > > > +#define __KVM_HOST_SMCCC_FUNC___kvm_enable_ssbs 7 > > > +#define __KVM_HOST_SMCCC_FUNC___vgic_v3_get_ich_vtr_el2 8 > > > +#define __KVM_HOST_SMCCC_FUNC___vgic_v3_read_vmcr 9 > > > +#define __KVM_HOST_SMCCC_FUNC___vgic_v3_write_vmcr 10 > > > +#define __KVM_HOST_SMCCC_FUNC___vgic_v3_init_lrs 11 > > > +#define __KVM_HOST_SMCCC_FUNC___kvm_get_mdcr_el2 12 > > > +#define __KVM_HOST_SMCCC_FUNC___vgic_v3_save_aprs 13 > > > +#define __KVM_HOST_SMCCC_FUNC___vgic_v3_restore_aprs 14 > > > > Wait. This looks broken. How do you distinguish between these and the > > stubs? > > The __KVM_HOST_SMCCC_FUNC_* definitions are just the function ID part of > the SMCCC x0 argument. KVM_HOST_SMCCC_ID builds it into a 64-bit > fastcall owner by the hypervisor. The stubs fall into the legacy region > so these don't conflict. Looking again made me realize that I was using the service call region for hypervisor standards rather than vendor hypervisors so I'll be defining the vendor hyp region in arm-smccc.h to make use of here. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel