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=-23.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL 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 B763EC64E7B for ; Tue, 1 Dec 2020 13:21:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 61E3520857 for ; Tue, 1 Dec 2020 13:21:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="a5w9Ab02" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390805AbgLANVQ (ORCPT ); Tue, 1 Dec 2020 08:21:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35396 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728702AbgLANVQ (ORCPT ); Tue, 1 Dec 2020 08:21:16 -0500 Received: from mail-wr1-x443.google.com (mail-wr1-x443.google.com [IPv6:2a00:1450:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EEAC2C0613D4 for ; Tue, 1 Dec 2020 05:20:35 -0800 (PST) Received: by mail-wr1-x443.google.com with SMTP id 23so2578584wrc.8 for ; Tue, 01 Dec 2020 05:20:35 -0800 (PST) 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=2UsigzSoUrcWefZPVlh907PdAiwKvnJCxqM3bK865xE=; b=a5w9Ab02L7z/Ws6Swour5XHiDemqkyRoJMnrsjmQ7dP6ZLcdnSPl4rl7uCSoefsSgY CSEM/hSiuG2V+lMG6XWUBoFP+umx/Z1SVH3TjxButBNmxRpd+woEE6TVMNN9WHNpy5tJ ZEYGU8NtIHTuGypVh+KkDpgmLvcDC2pLG0Er10VjuCtRBenorREyUgLQLwVpFN6JBDEW ronnfqxfmwHhCPQ01dnSKmwWets/XfGXKFw/uOqsdAVJTRapDsOCz5sJzwWUOq1ktIfu 4cGDQDzbuGu30W2f/qjd8TvucoBxOFs8kFxke2+S46bX1rPSzpW/5asHiBqkHtlmriyV MPHg== 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=2UsigzSoUrcWefZPVlh907PdAiwKvnJCxqM3bK865xE=; b=AIeymdyfQdUZ+AxxlZ+Qm2FNslqvWF2NseZMoObq5zh0L9fmxI5zPn5JRW8N+WQJpv tnIZPDk2ph79BjYbwjZg3jhCLbr1cq3kZSrJuGjRNzneysgMwqBdyP67HCVWcnZjpBrL ZCzVi08Z98T1KCX4NV75fF0+cfq3KhM0SoRheNLzjyFHzZ9ssk7YbtJN0VJOb/lDB9H6 pudb69AgWTKh7eb0pJ8IhCUZZPH1fo39i7kHc8poosmlcmErlR88IMLYBfURAymcLXZA SVMObvYKEksGDIGd0kLWnreYziS/+CZ725N6RMNwlvEPPbv3gL0iw6Y6cNfHkEejSSpH ZCxw== X-Gm-Message-State: AOAM5331hGh6Q4QemylhuLB2rBbmZmEqHEaueYBxLMrpTSGLYYcBt9Ia dLFptjlfA8VwTMLQblI2EY0Orw== X-Google-Smtp-Source: ABdhPJyca9R4xKZARa2KQnxST/3CMFlBn6fpNOSPil/kBrj5VNBo6V2f44HqUyGs2N30XTmZGFFNLA== X-Received: by 2002:a05:6000:c7:: with SMTP id q7mr3842571wrx.137.1606828834384; Tue, 01 Dec 2020 05:20:34 -0800 (PST) Received: from google.com ([2a01:4b00:8523:2d03:7c5f:5ab5:ac1f:89ce]) by smtp.gmail.com with ESMTPSA id u66sm2979560wmg.2.2020.12.01.05.20.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Dec 2020 05:20:33 -0800 (PST) Date: Tue, 1 Dec 2020 13:20:32 +0000 From: David Brazdil To: Sudeep Holla Cc: kvmarm@lists.cs.columbia.edu, Jonathan Corbet , Catalin Marinas , Will Deacon , Marc Zyngier , James Morse , Julien Thierry , Suzuki K Poulose , Dennis Zhou , Tejun Heo , Christoph Lameter , Mark Rutland , Lorenzo Pieralisi , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kernel-team@android.com Subject: Re: [PATCH v3 16/23] kvm: arm64: Forward safe PSCI SMCs coming from host Message-ID: <20201201132032.we4jbsvtsngwixse@google.com> References: <20201126155421.14901-1-dbrazdil@google.com> <20201126155421.14901-17-dbrazdil@google.com> <20201127165159.3s7hob5tgjcrbz33@bogus> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201127165159.3s7hob5tgjcrbz33@bogus> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Nov 27, 2020 at 04:51:59PM +0000, Sudeep Holla wrote: > 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 ? Sure, happy to combine them. I thought visually it made sense to have one action per ID. 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=-13.5 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_INVALID,DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED 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 95386C64E7B for ; Tue, 1 Dec 2020 13:20:41 +0000 (UTC) Received: from mm01.cs.columbia.edu (mm01.cs.columbia.edu [128.59.11.253]) by mail.kernel.org (Postfix) with ESMTP id C5B56207FF for ; Tue, 1 Dec 2020 13:20:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="a5w9Ab02" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C5B56207FF Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvmarm-bounces@lists.cs.columbia.edu Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id E43B34BD0A; Tue, 1 Dec 2020 08:20:39 -0500 (EST) X-Virus-Scanned: at lists.cs.columbia.edu Authentication-Results: mm01.cs.columbia.edu (amavisd-new); dkim=softfail (fail, message has been altered) header.i=@google.com Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id O3JhUG+z+GwI; Tue, 1 Dec 2020 08:20:38 -0500 (EST) Received: from mm01.cs.columbia.edu (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id D1F1A4C1A1; Tue, 1 Dec 2020 08:20:38 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id BF34E4C1A1 for ; Tue, 1 Dec 2020 08:20:36 -0500 (EST) X-Virus-Scanned: at lists.cs.columbia.edu Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id X81vulUmyWds for ; Tue, 1 Dec 2020 08:20:35 -0500 (EST) Received: from mail-wr1-f68.google.com (mail-wr1-f68.google.com [209.85.221.68]) by mm01.cs.columbia.edu (Postfix) with ESMTPS id AADF94BD0A for ; Tue, 1 Dec 2020 08:20:35 -0500 (EST) Received: by mail-wr1-f68.google.com with SMTP id s8so2563592wrw.10 for ; Tue, 01 Dec 2020 05:20:35 -0800 (PST) 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=2UsigzSoUrcWefZPVlh907PdAiwKvnJCxqM3bK865xE=; b=a5w9Ab02L7z/Ws6Swour5XHiDemqkyRoJMnrsjmQ7dP6ZLcdnSPl4rl7uCSoefsSgY CSEM/hSiuG2V+lMG6XWUBoFP+umx/Z1SVH3TjxButBNmxRpd+woEE6TVMNN9WHNpy5tJ ZEYGU8NtIHTuGypVh+KkDpgmLvcDC2pLG0Er10VjuCtRBenorREyUgLQLwVpFN6JBDEW ronnfqxfmwHhCPQ01dnSKmwWets/XfGXKFw/uOqsdAVJTRapDsOCz5sJzwWUOq1ktIfu 4cGDQDzbuGu30W2f/qjd8TvucoBxOFs8kFxke2+S46bX1rPSzpW/5asHiBqkHtlmriyV MPHg== 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=2UsigzSoUrcWefZPVlh907PdAiwKvnJCxqM3bK865xE=; b=rI7/sHxlzApZNIhFqoa5WoTsNB7tvr0iwhA+RYRt3w4a61XbM2z+H7z/rN8BitLtYm 5zwNbxAUKn5Lt+bXu14z59YswonkvfDfpiTUfaDhUWVFh41aDqP9QIwFdrmdTwnef8CO 65KERHorgKUjdPyk4Rszq3nL+2fCMCXo5bVkx/OLg+KPqhnCfhAWNLO0LWDaq6raFLF3 aaKSJPx9csAf+K+r8rLRvVooqcL9qGB6wjGAJx3IlCTRI49JwKSC5+sLOrOnsxri2KZG MA3DZ89QMCBcBYvkNLTS4HGMjw9b2MLUrq+BZMi1uv0tqytRyx/JGSxxVwt3WVgnZJZ2 pJSQ== X-Gm-Message-State: AOAM5323R3jDDs7+tCvOKXxh951yaGR4Vj8mmaIUpMlWSI6YU80Wyjvb PFJkf0RcSAJk7VzE9dyu1t8iOA== X-Google-Smtp-Source: ABdhPJyca9R4xKZARa2KQnxST/3CMFlBn6fpNOSPil/kBrj5VNBo6V2f44HqUyGs2N30XTmZGFFNLA== X-Received: by 2002:a05:6000:c7:: with SMTP id q7mr3842571wrx.137.1606828834384; Tue, 01 Dec 2020 05:20:34 -0800 (PST) Received: from google.com ([2a01:4b00:8523:2d03:7c5f:5ab5:ac1f:89ce]) by smtp.gmail.com with ESMTPSA id u66sm2979560wmg.2.2020.12.01.05.20.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Dec 2020 05:20:33 -0800 (PST) Date: Tue, 1 Dec 2020 13:20:32 +0000 From: David Brazdil To: Sudeep Holla Subject: Re: [PATCH v3 16/23] kvm: arm64: Forward safe PSCI SMCs coming from host Message-ID: <20201201132032.we4jbsvtsngwixse@google.com> References: <20201126155421.14901-1-dbrazdil@google.com> <20201126155421.14901-17-dbrazdil@google.com> <20201127165159.3s7hob5tgjcrbz33@bogus> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20201127165159.3s7hob5tgjcrbz33@bogus> Cc: Lorenzo Pieralisi , kernel-team@android.com, Jonathan Corbet , Catalin Marinas , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Marc Zyngier , Tejun Heo , Dennis Zhou , Christoph Lameter , Will Deacon , kvmarm@lists.cs.columbia.edu X-BeenThere: kvmarm@lists.cs.columbia.edu X-Mailman-Version: 2.1.14 Precedence: list List-Id: Where KVM/ARM decisions are made List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kvmarm-bounces@lists.cs.columbia.edu Sender: kvmarm-bounces@lists.cs.columbia.edu On Fri, Nov 27, 2020 at 04:51:59PM +0000, Sudeep Holla wrote: > 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 ? Sure, happy to combine them. I thought visually it made sense to have one action per ID. _______________________________________________ kvmarm mailing list kvmarm@lists.cs.columbia.edu https://lists.cs.columbia.edu/mailman/listinfo/kvmarm 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_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 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 1C36CC64E7B for ; Tue, 1 Dec 2020 13:21:48 +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 5DD5120870 for ; Tue, 1 Dec 2020 13:21:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="R9L5piOk"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="a5w9Ab02" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5DD5120870 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=4zsC0ctUC9TxYA47nyqZNKWBsc7P/iLTEWqgiuu5VJc=; b=R9L5piOkv5LQTYRNLXbyesVfJ CyoQIhpeVERQqTtEd0enT26tj2jTtCC50mupVB4ZbwqerklaUJUtkgbKwdOmVXdLEcamLpPAx6RWs bC/9NRVCIE+uaHVh8NxV4uVyzeOvPIEw6ekoQd0+0VdoAyJM94JxKCVRQl7UQrW9jsc2XgRBEppSb RZWE1s6h+hn51AOYkk6UqCcOowiUZYL/omE1QNWK8AxT24MBfng2aws8Ea8WcKU6M3Jnu1Fp87HUp pOpCtn5GUnislyRWNE1F+lJIq2KH1UTrTiI9dGxGTJ8lUQzUrSiwsDJaWznXc63V8MuqW0xa/sUxo B9uTlUt3A==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kk5a9-0002YX-S2; Tue, 01 Dec 2020 13:20:37 +0000 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kk5a7-0002Xy-PW for linux-arm-kernel@lists.infradead.org; Tue, 01 Dec 2020 13:20:36 +0000 Received: by mail-wr1-x442.google.com with SMTP id t4so2553445wrr.12 for ; Tue, 01 Dec 2020 05:20:35 -0800 (PST) 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=2UsigzSoUrcWefZPVlh907PdAiwKvnJCxqM3bK865xE=; b=a5w9Ab02L7z/Ws6Swour5XHiDemqkyRoJMnrsjmQ7dP6ZLcdnSPl4rl7uCSoefsSgY CSEM/hSiuG2V+lMG6XWUBoFP+umx/Z1SVH3TjxButBNmxRpd+woEE6TVMNN9WHNpy5tJ ZEYGU8NtIHTuGypVh+KkDpgmLvcDC2pLG0Er10VjuCtRBenorREyUgLQLwVpFN6JBDEW ronnfqxfmwHhCPQ01dnSKmwWets/XfGXKFw/uOqsdAVJTRapDsOCz5sJzwWUOq1ktIfu 4cGDQDzbuGu30W2f/qjd8TvucoBxOFs8kFxke2+S46bX1rPSzpW/5asHiBqkHtlmriyV MPHg== 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=2UsigzSoUrcWefZPVlh907PdAiwKvnJCxqM3bK865xE=; b=YngyPTwgsN31tCKaYdMb1fhCAbvCispWEIeG1lzwpE5gFLq68hB40G9ww/XhbEQMU5 qgZCmenzmFNrqiQQYOjtOlfBBmm7jgnM9CyzWIQvVB7FqaQRaLTD5EWFdxrgsRoSS2uX 7xL8tq3smnLw9WzAqCvgJFZ/Idk2qHambafx1qupdrQ66W86gr2iT/VGtAEXS1SEbmba eH7gLPQGBRfWunZmnygq3oAU7+hJlJrNkumro/kFk84twi4bue3V2nDRKLiqnazPpy9c oCFmdhI2kTIsG2c6APZuQ2AfYeAcbd1Xe4qGbMLCc3pEGVQFxJxDN0hMSoKpZskglN5f 2kXA== X-Gm-Message-State: AOAM532o+CIUErnwyMLxazpoT/HWsY4blxpFvrii8R0zEUT1F+GYEJTc Jp+TQmf1Dx3+jUTJhb2y5xBhjQ== X-Google-Smtp-Source: ABdhPJyca9R4xKZARa2KQnxST/3CMFlBn6fpNOSPil/kBrj5VNBo6V2f44HqUyGs2N30XTmZGFFNLA== X-Received: by 2002:a05:6000:c7:: with SMTP id q7mr3842571wrx.137.1606828834384; Tue, 01 Dec 2020 05:20:34 -0800 (PST) Received: from google.com ([2a01:4b00:8523:2d03:7c5f:5ab5:ac1f:89ce]) by smtp.gmail.com with ESMTPSA id u66sm2979560wmg.2.2020.12.01.05.20.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Dec 2020 05:20:33 -0800 (PST) Date: Tue, 1 Dec 2020 13:20:32 +0000 From: David Brazdil To: Sudeep Holla Subject: Re: [PATCH v3 16/23] kvm: arm64: Forward safe PSCI SMCs coming from host Message-ID: <20201201132032.we4jbsvtsngwixse@google.com> References: <20201126155421.14901-1-dbrazdil@google.com> <20201126155421.14901-17-dbrazdil@google.com> <20201127165159.3s7hob5tgjcrbz33@bogus> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20201127165159.3s7hob5tgjcrbz33@bogus> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201201_082035_863925_F058540A X-CRM114-Status: GOOD ( 29.01 ) 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 Fri, Nov 27, 2020 at 04:51:59PM +0000, Sudeep Holla wrote: > 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 ? Sure, happy to combine them. I thought visually it made sense to have one action per ID. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel