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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C09D5C52D7C for ; Thu, 15 Aug 2024 14:42:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To: Content-Transfer-Encoding:Content-Type:MIME-Version:References:Message-ID: Subject:Cc: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=b9S0Vy0wy1X4MTQ9+rOCP/+DFh2rZEPQqX4jeOK9pLA=; b=Yue+c8N0B4pqZpjH9q5/S0ZdXd Bc9pRqgc1pq5Hmz5fAxkyzp7h+SlwJghEnx3J0MoRbmK39jw9/IXaztaTQHKTkfEVjwGX+/ooNTVT tW1s4XzX39Kkgzt57VE4EbszMJp+fsjuFyx0cFdROIURmkwSjW2aKwQCs1AzTAnEKPdvGyx8JXTFL wtaVRkt3kE5BL+1UH4Gevf20k9JAm8l3xcKs/Pt6O7HmVvJ/jDdMJ/Qg9jo5jzUdCupUpHisZNB57 JemOX94cCkciP8kFzNrOZLuWRQ8m5s1nMNBS/VY1hQ71HKF9ijRPN2Hc6IBoRuFjXqVDEl51MFJ2g HJMJfoLA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sebgJ-0000000AFSJ-2iei; Thu, 15 Aug 2024 14:42:27 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sebey-0000000AF8t-3Dri for linux-arm-kernel@lists.infradead.org; Thu, 15 Aug 2024 14:41:12 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 6791961E8E; Thu, 15 Aug 2024 14:41:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3B317C4AF0D; Thu, 15 Aug 2024 14:40:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1723732863; bh=3YSMK39m8QgE55j6X/6z5EauxRWQybHWvnMADAKlagk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=e+JUIwVyr/kpOljPB9N6+HapKCW5JnZGdtWENfO+Vlf7fv1jVt4AWSxg7pbrGB1iy tiyjCicYP3ZiVYuP6Tas5n2TBNV6dJeH8uIK3aZBlSSdKCRjcDzU2MUCER0dN5fwx8 wfkwG1SbEAuSujlLjYwvqM+BPHh89/iCK+tMjDnXF5TRW6zp56QS9NRPqSPfaNlV/X 4JdvVTSOyflI3bwE+SyLebk7VQyQ6B3yrrkBKbxDU8Tem8bqwwkL6U9e/rYUGc3yIL 5SC6/6i4K5o45u3EuJj8rLsThb60EMKLATbfbU27ojLoKsHHG6AhCHxZb/48kd1OIE OXtaqCTo28NTA== Date: Thu, 15 Aug 2024 16:40:55 +0200 From: Lorenzo Pieralisi To: Shivendra Pratap Cc: Elliot Berman , Bjorn Andersson , Konrad Dybcio , Sebastian Reichel , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Vinod Koul , Andy Yan , Mark Rutland , Bartosz Golaszewski , Satya Durga Srinivasu Prabhala , Melody Olvera , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Florian Fainelli , linux-pm@vger.kernel.org, linux-arm-msm@vger.kernel.org, quic_spratap@qucinc.com Subject: Re: [PATCH v5 3/4] firmware: psci: Read and use vendor reset types Message-ID: References: <20240617-arm-psci-system_reset2-vendor-reboots-v5-0-086950f650c8@quicinc.com> <20240617-arm-psci-system_reset2-vendor-reboots-v5-3-086950f650c8@quicinc.com> <20240807103245593-0700.eberman@hu-eberman-lv.qualcomm.com> <20240809090339647-0700.eberman@hu-eberman-lv.qualcomm.com> <28c8bc92-4a55-8a07-1ece-333316d78410@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <28c8bc92-4a55-8a07-1ece-333316d78410@quicinc.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240815_074104_994435_A0B44543 X-CRM114-Status: GOOD ( 36.21 ) 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 On Mon, Aug 12, 2024 at 11:46:08PM +0530, Shivendra Pratap wrote: > > > On 8/9/2024 10:28 PM, Elliot Berman wrote: > > On Fri, Aug 09, 2024 at 03:30:38PM +0200, Lorenzo Pieralisi wrote: > >> On Wed, Aug 07, 2024 at 11:10:50AM -0700, Elliot Berman wrote: > >> > >> [...] > >> > >>>>> +static void psci_vendor_sys_reset2(unsigned long action, void *data) > >>>> > >>>> 'action' is unused and therefore it is not really needed. > >>>> > >>>>> +{ > >>>>> + const char *cmd = data; > >>>>> + unsigned long ret; > >>>>> + size_t i; > >>>>> + > >>>>> + for (i = 0; i < num_psci_reset_params; i++) { > >>>>> + if (!strcmp(psci_reset_params[i].mode, cmd)) { > >>>>> + ret = invoke_psci_fn(PSCI_FN_NATIVE(1_1, SYSTEM_RESET2), > >>>>> + psci_reset_params[i].reset_type, > >>>>> + psci_reset_params[i].cookie, 0); > >>>>> + pr_err("failed to perform reset \"%s\": %ld\n", > >>>>> + cmd, (long)ret); > >>>>> + } > >>>>> + } > >>>>> +} > >>>>> + > >>>>> static int psci_sys_reset(struct notifier_block *nb, unsigned long action, > >>>>> void *data) > >>>>> { > >>>>> + if (data && num_psci_reset_params) > >>>> > >>>> So, reboot_mode here is basically ignored; if there is a vendor defined > >>>> reset, we fire it off. > >>>> > >>>> I think Mark mentioned his concerns earlier related to REBOOT_* mode and > >>>> reset type (granted, the context was different): > >>>> > >>>> https://lore.kernel.org/all/20200320120105.GA36658@C02TD0UTHF1T.local/ > >>>> > >>>> I would like to understand if this is the right thing to do before > >>>> accepting this patchset. > >>>> > >>> > >>> I don't have any concerns to move this part below checking reboot_mode. > >>> Or, I could add reboot_mode == REBOOT_COLD check. > >> > >> The question is how can we map vendor specific reboot magic to Linux > >> reboot modes sensibly in generic PSCI code - that's by definition > >> vendor specific. > >> > > > > I don't think it's a reasonable thing to do. "reboot bootloader" or > > "reboot edl" don't make sense to the Linux reboot modes. > > > > I believe the Linux reboot modes enum is oriented to perspective of > > Linux itself and the vendor resets are oriented towards behavior of the > > SoC. > > > > Thanks, > > Elliot > > > > Agree. > > from perspective of linux reboot modes, kernel's current implementation in reset path is like: > __ > #1 If reboot_mode is WARM/SOFT and PSCI_SYSRESET2 is supported > Call PSCI - SYSTEM_RESET2 - ARCH RESET > #2 ELSE > Call PSCI - SYSTEM_RESET COLD RESET > ___ > > ARM SPECS for PSCI SYSTEM_RESET2 > This function extends SYSTEM_RESET. It provides: > • ARCH RESET: set Bit[31] to 0 = > This is already in place in condition #1. > • vendor-specific resets: set Bit[31] to 1. = > current patchset adds this part before kernel's reboot_mode reset at #0. > > > In current patchset, we see a condition added at #0-psci_vendor_reset2 being called before kernel’s current reboot_mode condition and it can take any action only if all below conditions are satisfied. > - PSCI SYSTEM_RESET2 is supported. > - psci dt node defines an entry "bootloader" as a reboot-modes. > - User issues reboot with a command say - (reboot bootloader). > - If vendor reset fails, default reboot mode will execute as is. > > Don't see if we will skip or break the kernel reboot_mode flow with this patch. > Also if user issues reboot and is supported on SOC vendor reset psci node, should cmd take precedence over kernel reboot mode enum? may be yes? > Please wrap lines when replying. I don't think it is a matter of precedence. reboot_mode and the reboot command passed to the reboot() syscall are there for different (?) reasons. What I am asking is whether it is always safe to execute a PSCI vendor reset irrispective of the reboot_mode value. Lorenzo