From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 80F123CF030 for ; Thu, 2 Apr 2026 18:35:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775154946; cv=none; b=C5MbghjevgO7KwsUbzYsF+hrh+rutKmQd8DzSeH9OZ19z2xr1ow6PcAxNLcabqpfKiYEfQ+/mZ1G79Q4XyuGNvQ1B4LLQSQtp5JJn3BXVmDC0iDrIkvyBXizpF0dH4k/MdxxOdBN5vG9nuhwXC/7fCSNY1IRSiNyz6Ub1Siap1c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775154946; c=relaxed/simple; bh=iLcy23eHNghMwYNBfzI52/vo3cRBzHqHxysNAGrl0DY=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=t0vfBryfqggRI8SKEwdaNW8GoxvduMxlWyre9p5zt+Qgr75H0QHcC54u71hdW66VCCeQv6khLFGvwqmiIB7DuiAwzVSTvI8melzNZhRhDc1i9his3Tk8mQFQp482QBsXbbpQ/+aO/q3H4rXVM93d0cNwKeaZTqFGt0oTFhF1awg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=ggQAGIHP; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=ggcejm7I; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="ggQAGIHP"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="ggcejm7I" Received: from pps.filterd (m0279869.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 632I2QVg3772892 for ; Thu, 2 Apr 2026 18:35:42 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= 0QqT2QmWrzzKobTW3iRiFUwu6lcuslU23UpBZdmqACA=; b=ggQAGIHPY1zcbnhk s04hS8AHC9F0cRJbNP6lfxLZYL3/PquleW5RiP+vNcKFHExRRYnWwiTaLsSkghWP kMOMcZHq8lGDs7fLpb5S2k8vVQnppeszDlenPzbi4uBQMAjfinCx9gXfvFXnF/t5 lLic+O9eg7M/JAH/K1Nz1Ridk9/ACcesMxmU7zItT+n3t90PGcXc4a8bBwDB2ZFL XMB8BBHx1FcUg6//grzAURO4/wWPOJGlK69GX7qzA1alJXbO2Xdpd6s/L20EaWZ7 gBQ5QKwhzWq1KXJjxV/HFQWWsB77oEhLNH/3MAK3w693lBKd1AHmq/f9GniSb9wP e73JxQ== Received: from mail-pj1-f70.google.com (mail-pj1-f70.google.com [209.85.216.70]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4d9wcs03sa-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 02 Apr 2026 18:35:42 +0000 (GMT) Received: by mail-pj1-f70.google.com with SMTP id 98e67ed59e1d1-35678f99c6eso735399a91.1 for ; Thu, 02 Apr 2026 11:35:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1775154941; x=1775759741; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=0QqT2QmWrzzKobTW3iRiFUwu6lcuslU23UpBZdmqACA=; b=ggcejm7Ila1ayXfd8WqY5W4N3pYNi9UUj3Cpx6rMmawaGon7DKiYHG1ajzEYnUPfbd zldgnZeztS1GkgJyriyyo0BoJqRln8JO0k84eeX2J6v559jGMULXro7ob4q01odPcsWF Bm4GkEPf0KyDglN0DRea583qS0JwzgrYxu1NM3xiZFM6EeHoPcpx8EzzWz+DD+Wwde+C p2dPMTgLAFfejMJ4qZZKQkk/b+YVd7g9XG3vNSAwLs3CUerZAP1OkLdkdUH9xMYMXbxS 7syt3bPIxHqIjW+1WhbaCRDb6N/U0fEvFhj3mvdLaosXWd6wEJCxIM9npD8jsjbPX94M /nqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775154941; x=1775759741; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=0QqT2QmWrzzKobTW3iRiFUwu6lcuslU23UpBZdmqACA=; b=cmgcgyQtXbY9w/qQXNbvwkJUOMkgGcMK3hqdZ4IohpnUrvSiG6OI8zAdXsza8gysb8 TPCT6ssGHLJBZEpeGQPRTWImzU3jxoncraEZR9KhFqZpZ+kgIYzayzYeHsdf3Gy/e/4E 71JDil3w3ru3HJ6na/HqtcWx1/ynt/sjUYu2RSu8lhniiNId+XNbFZxwxhQYXGJ3lMo6 BLm87/XrViiXfddrl3EiuCYblEDYRYX7aKFRI4nlRvuFWvz1yTcf/kclqsLfIobdO+cp zN30d5EawP+d3OWputGcBcVh5RTvTgmzKZM8qeFfUw8ePvVsArnGLFUrO97RNdUO7dzD F9Pg== X-Forwarded-Encrypted: i=1; AJvYcCVch50grHbmomAqCK46y8uZHnhPvFrcsv9Rq4cm1L0F5s2tX5JKkou/IKJz78C4sQNI+Mcy074NvbODdlA=@vger.kernel.org X-Gm-Message-State: AOJu0Yz3oynxGypBQYAMuzhQxnICyHEIuH0PEO/SjXxpeOgU6XzBHq6K rJykjMSmlWvuISlXXj1rrvOXYOFo6abYbweNkX6vCWGbCTSZOtBSt3VBTCseoL/+28IpsKJs/uM m3KZzOt3S4ARy67Cb6du/43Ddt40A5w4+bAIxYSVGNvYzodRtyLjWc0BAotXCH+Ma3fI= X-Gm-Gg: AeBDievBfTCoGvIDbBhaG73C8srprVmgiOi8gHGEWMLxlIdLGKttaDwHkhMusvbbMY3 AAbxzl7aFm9rYwFXrnXAf3KjJk+mowR406OSy3/iqkBEMtpXy8fTQj041i8Ef1sTDnfOyYoE3Q9 UhckIguWGQaeS5aQ1FIQIYTI7ZuuwChgEBScicNiQ3iH3cAbDWOOoUOvGhA7nNqhrGVdvTPmvYB g3t7dDqsYh6ogjI/ISEPBA0bJJvGaC6MQO+GkiNECFz0usmx+NL1SbffIa5lz9xeosKbH4sq084 NSV6Yetn/QmUmje2szqmbMl1SwAWEQkINgHy2fWu07QfaensvEr88J2DQnX39whgNhF3KT/G7qC 45hNCRqdBz0BrhSohDOducfoSMjQvylYHp7r2aEQduKQh1p7bDwZE+nM0Gg== X-Received: by 2002:a17:90b:1b4b:b0:35b:e51b:1935 with SMTP id 98e67ed59e1d1-35dc6f7ad00mr7904015a91.17.1775154941197; Thu, 02 Apr 2026 11:35:41 -0700 (PDT) X-Received: by 2002:a17:90b:1b4b:b0:35b:e51b:1935 with SMTP id 98e67ed59e1d1-35dc6f7ad00mr7903972a91.17.1775154940621; Thu, 02 Apr 2026 11:35:40 -0700 (PDT) Received: from [192.168.29.31] ([49.43.227.254]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-35dd367c142sm3549034a91.11.2026.04.02.11.35.30 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 02 Apr 2026 11:35:40 -0700 (PDT) Message-ID: Date: Fri, 3 Apr 2026 00:05:27 +0530 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v20 06/10] power: reset: Add psci-reboot-mode driver To: Lorenzo Pieralisi Cc: Arnd Bergmann , Bjorn Andersson , Sebastian Reichel , Rob Herring , Souvik Chakravarty , Krzysztof Kozlowski , Andy Yan , Matthias Brugger , Mark Rutland , Conor Dooley , Konrad Dybcio , John Stultz , Moritz Fischer , Bartosz Golaszewski , Sudeep Holla , Florian Fainelli , Krzysztof Kozlowski , Dmitry Baryshkov , Mukesh Ojha , Andre Draszik , Kathiravan Thirumoorthy , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, Srinivas Kandagatla References: <20260304-arm-psci-system_reset2-vendor-reboots-v20-0-cf7d346b8372@oss.qualcomm.com> <20260304-arm-psci-system_reset2-vendor-reboots-v20-6-cf7d346b8372@oss.qualcomm.com> <93a78bc2-4fd1-41bd-bf4a-b433b06fc218@oss.qualcomm.com> Content-Language: en-US From: Shivendra Pratap In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Proofpoint-ORIG-GUID: AiXUcJBWSw2lsdTEz9nxeKMRUuu0ADbx X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNDAyMDE2NyBTYWx0ZWRfX+9WqDlYjgiA/ loWRtAjKhq7baGJgHD/RDMUajtr+6yR7T0qxRrSDmM7AX/sfCkkRtREjpxsBrek+rU2eb2rXdd4 gilnnwJW/47+QXlpRKh1973zisSIc9/GltPmxTDJ94LurtrFfWM25EZkINpqL4+DHQ2+uPrSQES CdsQp/UkrJOGeQd6SaICDCIY8T69tUIisSJ3nXsvgOzW9D0tKxuV2669IsilZn86ff1sIbeBmzr c6jlHGBUBggtYZkK+RbJUhIHbY1R2t3Y+QMrUUA79TpF8Jnz+XbOQeb+tbo4DZP0XzuFenzuiYg QYurhHLXnN10vJejmKWaRzGMmBxIun58q+bdGH0NYOeOYBTrv5+83wxHyjKy4JrXFKTK1ac96QG dErnXPxGTgNSJ4+nPIqKA6wafB2uUgg+gBStVVeIxGdmdmVsPgx6yoL1u9TLDu9Tgo6hPiZ0QjF 49rtm+g5vxCKs845yRQ== X-Authority-Analysis: v=2.4 cv=ZuPg6t7G c=1 sm=1 tr=0 ts=69ceb6fe cx=c_pps a=0uOsjrqzRL749jD1oC5vDA==:117 a=xCZvIt4Xq4xTzMb426/Gcg==:17 a=IkcTkHD0fZMA:10 a=A5OVakUREuEA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=_glEPmIy2e8OvE2BGh3C:22 a=5_yrRdH-cSa_xDgWEkIA:9 a=QEXdDO2ut3YA:10 a=mQ_c8vxmzFEMiUWkPHU9:22 X-Proofpoint-GUID: AiXUcJBWSw2lsdTEz9nxeKMRUuu0ADbx X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-04-02_03,2026-04-02_05,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 bulkscore=0 spamscore=0 lowpriorityscore=0 phishscore=0 priorityscore=1501 malwarescore=0 clxscore=1015 impostorscore=0 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2603050001 definitions=main-2604020167 On 01-04-2026 20:07, Lorenzo Pieralisi wrote: > On Tue, Mar 31, 2026 at 11:30:09PM +0530, Shivendra Pratap wrote: >> >> >> On 27-03-2026 19:25, Lorenzo Pieralisi wrote: >>> On Wed, Mar 04, 2026 at 11:33:06PM +0530, Shivendra Pratap wrote: >>>> PSCI supports different types of resets like COLD reset, ARCH WARM [snip..] >>>> + * Predefined reboot-modes are defined as per the values >>>> + * of enum reboot_mode defined in the kernel: reboot.c. >>>> + */ >>>> +static struct mode_info psci_resets[] = { >>>> + { .mode = "warm", .magic = REBOOT_WARM}, >>>> + { .mode = "soft", .magic = REBOOT_SOFT}, >>>> + { .mode = "cold", .magic = REBOOT_COLD}, > > These strings match the command userspace issue right ? I think that we > should make them match the corresponding PSCI reset types, the list above > maps command to reboot_mode values and those can belong to any reboot > mode driver to be honest they don't make much sense in a PSCI reboot > mode driver only. > > It is a question for everyone here: would it make sense to make these > predefined resets a set of strings, eg: > > psci-system-reset > psci-system-reset2-arch-warm-reset > > and then vendor resets: > > psci-system-reset2-vendor-reset Can you share bit more details on this? We are already defining the string from userspace in the struct - eg: ".mode = "warm". yes we can move away from enum reboot_mode and use custom psci defines one - Ack. > [snip ..] >>>> + >>>> +/* >>>> + * arg1 is reset_type(Low 32 bit of magic). >>>> + * arg2 is cookie(High 32 bit of magic). >>>> + * If reset_type is 0, cookie will be used to decide the reset command. >>>> + */ >>>> +static int psci_reboot_mode_write(struct reboot_mode_driver *reboot, u64 magic) >>>> +{ >>>> + u32 reset_type = REBOOT_MODE_ARG1(magic); >>>> + u32 cookie = REBOOT_MODE_ARG2(magic); >>>> + >>>> + if (reset_type == 0) { >>>> + if (cookie == REBOOT_WARM || cookie == REBOOT_SOFT) >>>> + psci_set_reset_cmd(true, 0, 0); >>>> + else >>>> + psci_set_reset_cmd(false, 0, 0); >>>> + } else { >>>> + psci_set_reset_cmd(true, reset_type, cookie); >>>> + } >>> >>> I don't think that psci_set_reset_cmd() has the right interface (and this >>> nested if is too complicated for my taste). All we need to pass is reset-type >>> and cookie (and if the reset is one of the predefined ones, reset-type is 0 >>> and cookie is the REBOOT_* cookie). >>> >>> Then the PSCI firmware driver will take the action according to what >>> resets are available. >>> >>> How does it sound ? >> >> So we mean these checks will move to the psci driver? Sorry for re-iterating >> the question. > > Given what I say above, I believe that something we can do is mapping the magic > to an enum like: > > PSCI_SYSTEM_RESET > PSCI_SYSTEM_RESET2_ARCH_SYSTEM_WARM_RESET > PSCI_SYSTEM_RESET2_VENDOR_RESET > > and can add a probe function into PSCI driver similar to psci_has_osi_support() but > to probe for SYSTEM_RESET2 and initialize the predefined strings accordingly, > depending on its presence. Not able to get it cleanly. 1. Will move away from reboot_mode enum for pre-defined modes and define new enum defining these modes- fine. 2. get SYSTEM_RESET2 is supported from psci exported function -- fine, but how we use it here now, as we do not want to send the reset_cmd from psci_set_reset_cmd now? 3. For pre-defined modes, warm/soft or cold - reset_type and cookie, both are zero, sys_reset2 or sys_reset2 decides the ARCH reset vs cold reset. 4. For vendor-rest , we use sys_reset2 with reset_type and cookie. All above is done in reboot_notifier call at psci-reboot-mode. -- Now in the final restart_notifier->psci_sys_reset -- If panic is in progress, we do not use any of the cmd based reset params and go with the legacy reset. So we need to preserve the values that were set from psci-reboot-mode. Did not understand the proposed suggestion in above usecase. Need more input on this. -- One other option is to have a restart_notifier in psci-reboot-mode, with lesser priority than psci_sys_rest and then handle all the case including panic and sys_reset2. thanks, Shivendra