Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp3507419pxb; Fri, 4 Feb 2022 09:57:32 -0800 (PST) X-Google-Smtp-Source: ABdhPJyNM3gX1vQgxySvLsURXSqvbkZ/v8HHjPfNSF0lr5dJborgj02cboI78dvDXWpjKy6VcOjm X-Received: by 2002:a17:902:c10c:: with SMTP id 12mr4356473pli.158.1643997451911; Fri, 04 Feb 2022 09:57:31 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1643997451; cv=pass; d=google.com; s=arc-20160816; b=UMgd1M3ZJYa9QiDjbxwBEjrz833TYT9KeW3IPo07i81anhXQJoqWYmi4kSMWGoNFEs zyVbYR9G+WirEgSevZ9EuqtU31OmTERRvOrWxEYhHWZlAKDaGi8hSsIqzsszXH1RRs9a qH0kccjHdEXuuSBePeDg51el/ezKyZBNrJifDP8fHjUcDaobnZhNCtjOcp3YxPcOZHL6 0cmGSgFo2HiG+cGBuUdSqdmvuzdgl70/nhyW39WZJMZdpufN8Qo0RwuNb10kd2Z2di/3 RVGRJYNyO2gG5y7pOo2sdgC1SppN2afdddCm7vhPvC7OTMJ6mjT39i7wYH/ba6SozjaJ TIcQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:in-reply-to :content-transfer-encoding:content-disposition:references:message-id :subject:cc:to:from:date:dkim-signature; bh=c+f6I9jWg82oiXTIiTDru6eHwgIXZSXfk7HqDYjbQkk=; b=VBcEsuG3kMSejTiecs5cAgLNDE8+pNHvadbflt7Q0FYGU82oGlKl1iItu8t5CPdngM Rsx1VGSChYAcRE0w8wWFa0wJ9LM2g+gkXJ+QO4/m2o6oBTmor53iLfjsJnIjql6Dm/D3 w2rutrBJ2qmoNHr/N5FoIWYL4qqk0irM+Hwzo7O8TJcHdU0Rn/2JJbeQUdubZ1WY2zlR IKlGqA4HlhzfrGqYgcI4zaRvquAgZBzKdjtk3P9f5KGcqg+Ua1deKXyOgNJVzQX9ltFD QJvwRy9VKa8YsDV/ssDRX3k2SjHdkmXJGAzHBf0sfcqC5JQErORF/OeyxZm2CYmL1+GQ PxhQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nokia.onmicrosoft.com header.s=selector1-nokia-onmicrosoft-com header.b=ChWg0feo; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nokia.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f21si2839022pfe.317.2022.02.04.09.57.20; Fri, 04 Feb 2022 09:57:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@nokia.onmicrosoft.com header.s=selector1-nokia-onmicrosoft-com header.b=ChWg0feo; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nokia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346365AbiBBRwW (ORCPT + 99 others); Wed, 2 Feb 2022 12:52:22 -0500 Received: from mail-eopbgr70107.outbound.protection.outlook.com ([40.107.7.107]:61250 "EHLO EUR04-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1346366AbiBBRwT (ORCPT ); Wed, 2 Feb 2022 12:52:19 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Lp7biC+ugE0H6BI0OgRQe0gNYrNT/oj8MLM70Ixmj0p/bNla0jUj2PlWQVWIdK8vZnV9rklsYtpvocgJswf3Czvo1yGocJ0EZ5rJjSLV4WeGRMtfol9bT7tHCmzfSikG/eJGchkU3T9rHcPuaNNtmawbsuIIGSfx372QYlYGkDBCP/Q1RjbZv3twkKrGJN1jXdnWHrb9z8U/ROPJ/NZrGcIj9z9lOr39DHeSfRLNyA8G0uv7mVbtB+Njlt7sO6v0C0JUc1ZztQCYdnY68WADHiN76+qzInpSr+JHm8KMqQR4pDz36gud9l0QaK7DBK4zZRAF6Zx1FzkhCjLswkPvgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=c+f6I9jWg82oiXTIiTDru6eHwgIXZSXfk7HqDYjbQkk=; b=c/MxfBLO3dzaUPs8ueSBXDbtp0s3pmDGS1x8jKqtKFLUhRI3VUq1s3vaWvAAW9A/wM/FIVOXo0CrD1Lbd0X/gL3JUq20AMT8PX8dqh5NKNttXJMf9szNCeiJURYm62hv9gsHbIbv1wW1vcASLcLDG0P4297fexTXgf1MGzdDsGDf7T2dGTtogXa6tnWa3jUO7KmtPyGr1g0GrBKyI8fs/fuX/R/PlY+pLawy+TpX9tdx1jO6I+KP8ha38zp83z5oeXHBrBDMl7XcMDtRiVmRY/W5K/mAJsqDZuO7WWB3f6qRmUtVcW+AN+sLntmJk+vdR+wK8oNjwdeaQg3/PrC+Dg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nokia.onmicrosoft.com; s=selector1-nokia-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=c+f6I9jWg82oiXTIiTDru6eHwgIXZSXfk7HqDYjbQkk=; b=ChWg0feoRM/nUUOkkAj9L8OzdI5Uppb0z0sXBS5oLJZiEdi8IbZGsctpe2H+LpnetmBxv1p007cIU/LJo3xqtyShdW3B0ZHimnvqgdX+SgYXriEi6XoKSVY0RQ0SW7WRF4mNdomBEzD4O7jLBr/jV+pEVh9ZsGhS3n8vlbkmjOY= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nokia.com; Received: from DU2PR07MB8110.eurprd07.prod.outlook.com (2603:10a6:10:239::15) by AM0PR0702MB3745.eurprd07.prod.outlook.com (2603:10a6:208:16::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4951.5; Wed, 2 Feb 2022 17:52:16 +0000 Received: from DU2PR07MB8110.eurprd07.prod.outlook.com ([fe80::adfc:7f91:31e5:f103]) by DU2PR07MB8110.eurprd07.prod.outlook.com ([fe80::adfc:7f91:31e5:f103%9]) with mapi id 15.20.4951.012; Wed, 2 Feb 2022 17:52:16 +0000 Date: Wed, 2 Feb 2022 18:52:10 +0100 From: Krzysztof Adamski To: Ard Biesheuvel Cc: Mark Rutland , Catalin Marinas , Will Deacon , Peter Collingbourne , Guenter Roeck , Wolfram Sang , Alexander Sverdlin , Matija Glavinic-Pecotic , Linux ARM , Linux Kernel Mailing List Subject: Re: [PATCH v2] arm64: move efi_reboot to restart handler Message-ID: References: Content-Type: text/plain; charset=utf-8; format=flowed Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-ClientProxiedBy: HE1P195CA0003.EURP195.PROD.OUTLOOK.COM (2603:10a6:3:fd::13) To DU2PR07MB8110.eurprd07.prod.outlook.com (2603:10a6:10:239::15) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4c5351c2-5212-434e-4744-08d9e674c035 X-MS-TrafficTypeDiagnostic: AM0PR0702MB3745:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9t6eeCliBUvin4+A2n0BY8UR8gfpx6o/czi6YnR4ZAeTUxPM/WOjfWmAP1a5kT5x7UYggfwJ/0hunxr+Va36VqnFHc7ZTDwEhd23Ji8sMcumqP0fCXhOX7U0x4Wa5WDvP+Gq2F3XvE2V8nj0fIS1vV57tkDNm98TmMS62oOItOyASIdsGj91BWzyOdNWOTu8KGPdvMHsyur8R+0TVqVtBTjEc32tvygkhx29YNp4KDnqfudqRVNhG9eEwC+6WTxQh91D7ZVv3OR6SvcYY8LqXsTHypn+EAscR4RNr2faMOqrvW4NxXl7YLz5rXSz8uJWjYysZUCYjbcCzvoQWXaFfhreZoIs8xsmsGLcuRxAX5ER+/UyZglRJT+kjJQPqIlqriGJRh+3Pi09zz1XdnV82glrhGrdSBax/ahWa3YS2bG+IIZV4Vk5+pfUE2xBJMeeT8crVaEg1n/X5y1e54mKSjkwOwNf++M8iPA3xdkEuro7hAQsDRYBYA2rNOrrYCMOqn0Vg65UHOrZeKQhALNcCQJ2u18t6dI0WE8COXuOzcHGh1s4kI9JLiZFE2ha5/d+KlY27W2Fin+rG6zGq9cVsvXWfBTLkj5nviL57004YK8547r6q7kv2V01xqg+PVd3YYiet7IN4FdCS2tD8q1KqJDLakH6RHHWqG+xk/UkFDLMRIeoYJrdu8+2zrBiQfWuSiHfnMkTKXFNmN2aI+6rdQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DU2PR07MB8110.eurprd07.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(4326008)(38350700002)(66946007)(54906003)(38100700002)(6916009)(8936002)(66556008)(186003)(316002)(86362001)(83380400001)(6512007)(9686003)(66476007)(6486002)(508600001)(26005)(82960400001)(8676002)(2906002)(6506007)(6666004)(44832011)(52116002)(5660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Tm0vVythd2JQb2hrNVZSNXdSb1RiN3AxUDN0?= =?utf-8?B?NXBSNzhPZXJIYXBPQjZ0OE1OcjlGQVhUaWZuTkxHd0xEMS9yMGZsRGJNVkFF?= =?utf-8?B?VVhGMlNHVURzZmFscUErSmNDNEd1S2R3SkJBZXZZbVlad1NBMHpiWVpJWFdk?= =?utf-8?B?ZVo4SGcyamVRcnRUbkdWZTluWGVPclAwWTZQd3h0V0ROVFhrWGU4YnFUKzBo?= =?utf-8?B?Q3B0M3hUa0lNd05QSEFBVzlhd1phZTdMRi9FUnMremlqWDF1SnFMYlpiNXFu?= =?utf-8?B?d3l3OUVEejVSa210SXhOYk56dGxDVU83TkZaK3hpZ21WYUdpc2pHQUFLNVM4?= =?utf-8?B?Q1EvTmxrdXNlNGRENVFKZVBhYktGdzlLTFpOSFVsV1JOTHpDeXdFSitFNFJC?= =?utf-8?B?dWdnQnVlRXptQm5VRXpvSm1yOGluUlFVdHNXNzNBR0lxUUtZa0FUeHZpcDhI?= =?utf-8?B?c1lEOWhuSnlQMlZBcmJyNGdPQVpUejZDUDNQci82Z2ZiZTdyUUluSEpCcUxn?= =?utf-8?B?cStjaGxPNU80OFh5NWtRRWNQVUtnPT0=?= X-OriginatorOrg: nokia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4c5351c2-5212-434e-4744-08d9e674c035 X-MS-Exchange-CrossTenant-AuthSource: DU2PR07MB8110.eurprd07.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Feb 2022 17:52:16.6978 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 5d471751-9675-428d-917b-70f44f9630b0 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: qGPuOO4E1v76k4s/pSsX2JqSlfKKPNnea3rtVD+YO33MYhLGzG3iQWhD9nlYIhMjOdpxNCHRnkdLQEAPJ3tttKe8zs4FR1halc8COMeXjiY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR0702MB3745 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Dnia Wed, Feb 02, 2022 at 05:47:33PM +0100, Krzysztof Adamski napisał(a): >Dnia Wed, Feb 02, 2022 at 03:01:37PM +0100, Ard Biesheuvel napisał(a): >>On Wed, 2 Feb 2022 at 13:41, Krzysztof Adamski >> wrote: >>> >>>Dnia Tue, Feb 01, 2022 at 01:58:29PM +0000, Mark Rutland napisał(a): >>>>> If we use the restart handlers only to reset the system, this is indeed >>>>> true. But technically, restart handlers support the scenario where the >>>>> handler does some action that does not do reset of the whole system and >>>>> passes the control further down the chain, eventually reaching a handler >>>>> that will reset the whole system. >>>>> This can be done on non-uefi systems without problems but it doesn't >>>>> work on UEFI bases arm64 systems and this is a problem for us. >>>>> >>>>> In other words, I would like to be able to run a restart handler on EFI >>>>> based ARM64 systems, just like I can on other systems, just for its >>>>> "side effects", not to do the actual reboot. Current code disables this >>>>> possibility on an ARM64 EFI system. >>>> >>>>It sounds like two things are being conflated here: >>>> >>>>1) A *notification* that a restart will subsequently occur. >>>>2) A *request* to initiate a restart. >>>> >>>>IIUC (1) is supposed to be handled by the existing reboot notifier mechanism >>>>(see the reboot_notifier_list) which *is* invoked prior to the EFI reboot >>>>today. >>>> >>>>IMO, using restart handlers as notifiers is an abuse of the interface, and >>>>that's the fundamental problem. >>>> >>>>What am I missing? >>> >>>You are completly right. It is possible that I would like to be able to >>>*abuse* the restart handlers as notifier. You are right that we have a >>>reboot_notifier but it is not good enough for my usecase - it is only >>>called, well, on reboot. It is not called in case of emergency_restart() >>>so in case of a panic, this won't happen. It also is called much earlier >>>than restart handlers which also makes a difference in some cases. So I >>>see no other choice than to abuse the restart_handler mechanism for that. >>> >> >>Why would such a platform implement ResetSystem() in the first place >>if it cannot be used? >> >>So the right solution here is for the firmware to publish a >>EFI_RT_PROPERTIES_TABLE that describes ResetSystem() as unsupported, >>and Linux will happily disregard it and try something else. > >The firmware is generic but the problem is specific to one usecase of >such a platform. In other words, the firmware is written for the SoC and >it does not know about other parts on the board, outside of SoC. It >doesn't make much sense to provide the support for such custom device in >the firmware. > >Please also note that the ResetSystem is supported. As I said, the >normal, typical reset is done via EFI, via ResetSystem. Ony if you have >a special case, where not only SoC, but also some other components in >the system have to be reset, then you want to change the reset type. > >We also have one case of abusing the restart_handler as restart notifier >in the kernel in the form of drivers/mmc/core/pwrseq_emmc.c. I would >just like to be able to do this also on EFI based ARM64 systems. Is that >crazy? :) Sorry, I forgot to mention another argument - doing that in the firmware is SoC specific while doing that in the kernel is platform agnostic. We use the same code on different platforms, architectures, etc. Now, I don't understand why it is sane to have this functionality on other archs, when we use PSCI or whatever else reset mechanism, but it isn't if we use EFI. For the notification purpose, we acknowledge it might be beneficial to notify some code about the reboot (this is why we have the reboot_notifier functionality) but having such a notifier on reset, instead of reboot (i.e. at the end of the whole process and at all possible cases where we reset our machine), seems strange. I don't get it. Krzysztof