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=-15.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, 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_SANE_1 autolearn=unavailable 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 10D17C3E8C5 for ; Fri, 27 Nov 2020 16:53:26 +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 AFA5C20795 for ; Fri, 27 Nov 2020 16:53:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="s/LS4wxi" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AFA5C20795 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.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=tD/C78DzS6jWoexI8cwQfdRL0YhvShDsjMtWXk0QA9Y=; b=s/LS4wxiEs6aMvdChYu0Ot+9g Y4VLkSN2f3OiZGh0SaxY2Zj0pzldvoDTvG0po6lRk1jYKQlEy8ensDqv4bk35S4feIa7f4yv1xr8W YHx7fgx93M/+tuE/pM+K24NC9fAUPEVd5/Bd4HXqYj5S1TvGW7sh0MI4fltk4+GR6XK4tFayE9Sz+ TrgzTvR8fl4OYI5q5Kg+yBN68xJXzBvb0mRfyBuk3yo1H+uRLT3qyLu4cIpH/Xrm5mp9FSElzWYgx eHZUckDusI/edZc1I/pkc7Z5gPET05VFR+WoKWfqsw3jqPnpVfMTC2CDGuv9DpdsxzcfXN5nACgHo rNAemeesQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kigyg-00068l-F3; Fri, 27 Nov 2020 16:52:10 +0000 Received: from foss.arm.com ([217.140.110.172]) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kigyb-0005zC-Pc for linux-arm-kernel@lists.infradead.org; Fri, 27 Nov 2020 16:52:07 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 1848731B; Fri, 27 Nov 2020 08:52:05 -0800 (PST) Received: from bogus (unknown [10.57.59.53]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 7EF3D3F71F; Fri, 27 Nov 2020 08:52:01 -0800 (PST) Date: Fri, 27 Nov 2020 16:51:59 +0000 From: Sudeep Holla To: David Brazdil Subject: Re: [PATCH v3 16/23] kvm: arm64: Forward safe PSCI SMCs coming from host Message-ID: <20201127165159.3s7hob5tgjcrbz33@bogus> References: <20201126155421.14901-1-dbrazdil@google.com> <20201126155421.14901-17-dbrazdil@google.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20201126155421.14901-17-dbrazdil@google.com> User-Agent: NeoMutt/20171215 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201127_115206_030994_81665C05 X-CRM114-Status: GOOD ( 26.02 ) 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: Mark Rutland , Lorenzo Pieralisi , kernel-team@android.com, Jonathan Corbet , Catalin Marinas , Suzuki K Poulose , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, James Morse , linux-arm-kernel@lists.infradead.org, Marc Zyngier , Tejun Heo , Dennis Zhou , Christoph Lameter , Will Deacon , kvmarm@lists.cs.columbia.edu, Julien Thierry 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 Thu, Nov 26, 2020 at 03:54:14PM +0000, David Brazdil wrote: > Forward the following PSCI SMCs issued by host to EL3 as they do not > require the hypervisor's intervention. This assumes that EL3 correctly > implements the PSCI specification. > > Only function IDs implemented in Linux are included. > > Where both 32-bit and 64-bit variants exist, it is assumed that the host > will always use the 64-bit variant. > > * SMCs that only return information about the system > * PSCI_VERSION - PSCI version implemented by EL3 > * PSCI_FEATURES - optional features supported by EL3 > * AFFINITY_INFO - power state of core/cluster > * MIGRATE_INFO_TYPE - whether Trusted OS can be migrated > * MIGRATE_INFO_UP_CPU - resident core of Trusted OS > * operations which do not affect the hypervisor > * MIGRATE - migrate Trusted OS to a different core > * SET_SUSPEND_MODE - toggle OS-initiated mode > * system shutdown/reset > * SYSTEM_OFF > * SYSTEM_RESET > * SYSTEM_RESET2 > > Signed-off-by: David Brazdil > --- > arch/arm64/kvm/hyp/nvhe/psci-relay.c | 43 +++++++++++++++++++++++++++- > 1 file changed, 42 insertions(+), 1 deletion(-) > > diff --git a/arch/arm64/kvm/hyp/nvhe/psci-relay.c b/arch/arm64/kvm/hyp/nvhe/psci-relay.c > index e7091d89f0fc..7aa87ab7f5ce 100644 > --- a/arch/arm64/kvm/hyp/nvhe/psci-relay.c > +++ b/arch/arm64/kvm/hyp/nvhe/psci-relay.c > @@ -57,14 +57,51 @@ static bool is_psci_call(u64 func_id) > } > } > > +static unsigned long psci_call(unsigned long fn, unsigned long arg0, > + unsigned long arg1, unsigned long arg2) > +{ > + struct arm_smccc_res res; > + > + arm_smccc_1_1_smc(fn, arg0, arg1, arg2, &res); > + return res.a0; > +} > + > +static unsigned long psci_forward(struct kvm_cpu_context *host_ctxt) > +{ > + return psci_call(cpu_reg(host_ctxt, 0), cpu_reg(host_ctxt, 1), > + cpu_reg(host_ctxt, 2), cpu_reg(host_ctxt, 3)); > +} > + > +static __noreturn unsigned long psci_forward_noreturn(struct kvm_cpu_context *host_ctxt) > +{ > + psci_forward(host_ctxt); > + hyp_panic(); /* unreachable */ > +} > + > static unsigned long psci_0_1_handler(u64 func_id, struct kvm_cpu_context *host_ctxt) > { > - return PSCI_RET_NOT_SUPPORTED; > + if (func_id == kvm_host_psci_function_id[PSCI_FN_CPU_OFF]) > + return psci_forward(host_ctxt); > + else if (func_id == kvm_host_psci_function_id[PSCI_FN_MIGRATE]) > + return psci_forward(host_ctxt); Looks weird or I am not seeing something right ? Same action for both right ? Can't they be combined ? -- Regards, Sudeep _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel