Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp2730084pxb; Mon, 31 Jan 2022 03:06:00 -0800 (PST) X-Google-Smtp-Source: ABdhPJw0y552andp6K17Xh5cwpUzpihJIkdrFCRV2MSbn1W/0V1mRZVqkDe4wWfUnqRyzp2WefvP X-Received: by 2002:a63:1666:: with SMTP id 38mr16039085pgw.499.1643627160614; Mon, 31 Jan 2022 03:06:00 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1643627160; cv=pass; d=google.com; s=arc-20160816; b=NWxpQUEAdNG4d1XIECk3q0fPoSVoCYknQf9HNBoKLgLfIynwvk64XfPMd1pn6/Fnk/ 7vVXA8d4WPi1HCyteNPa1+09EGI5u42wd8ky3AW9cKUJ94bQoLVaEaQgff0uZM3LOOLa 6qla728q/bxxmuxm+50GEow76bByhAqxn3QUTWBVM+zQ/Kbx8WkUlKgmriSyhB/zhy6G Cm/kRW7XEc3mlsd8ge3ln9nGqJ4vHieAOJUQFcjmnoH4uH2Yvd68fMPy4JAJvx6qCM+A RlsBf9NYbx3gLeGdRf0MfZJr62ZDT/H5Chb65/msPbYIE1PTM0j+9r0u+i18cHpcwhju tRQg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :in-reply-to:from:references:cc:to:content-language:subject :user-agent:date:message-id:dkim-signature; bh=SMyOTMCxnh4OQPROyddIIZnzyn8jFTfcj1CYbGw4/wo=; b=P57L/HPFs141jrurXkOVSN/OH6y+iyaZ7AHmUiEt038/8mf6GF+HLyxWum7NNJbL0M N5STpZrIZeCDnSlxe0aCaarc3kTh6ou7oA4FXOXX9i4BJ0vz7F7b3z3VMiv4MivWIdhf T4nyRHy7JiQs2nCm4p3JgdfE+DGFdtsmaH14ef/YPnhzwt3NxlWgADNd9IwYhOLOZUvI xBgYY/+/rXW1QX2XmJtRF/lZQkNY06goLJSu1rugQyPLb1o7fZZwoJOrPUXF9c1cvbw/ yBmSdQao/chpENCxGPt596f4GhnvTT2cx61JECje+bkb22i4Mqq0oipJ2CRgcSvvRc0V PTaA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nokia.onmicrosoft.com header.s=selector1-nokia-onmicrosoft-com header.b=s7PFjL0D; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q12si14143322pfj.260.2022.01.31.03.05.50; Mon, 31 Jan 2022 03:06:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@nokia.onmicrosoft.com header.s=selector1-nokia-onmicrosoft-com header.b=s7PFjL0D; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1349053AbiA1OVm (ORCPT + 99 others); Fri, 28 Jan 2022 09:21:42 -0500 Received: from mail-eopbgr130113.outbound.protection.outlook.com ([40.107.13.113]:40566 "EHLO EUR01-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S245136AbiA1OVk (ORCPT ); Fri, 28 Jan 2022 09:21:40 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WmD9AUy1eu60dkws6fIYdri4m39WVuzd0hnu5sXpAuAx1fTYhtwQGDCW/doszZ/spCyCEtT8Kescb5Xop1XX0uCPPiXtZLGs8MHmCvdK3jfvdXjBEpWOT4zIdMb1hYn6oOv6cXfEGcOlh3j41AtiBJX5IWhWJdobQv3UlApksuwAgVjv28wXMPyLuytmgunqtFun1FoBIChm9ClElJOwu+r60RB/WbByUc3mAdpDQMpKNtpwAr55uPPk6QoM6Qkh44dNTVUOCPi3coRE8QQMPr9RjUcHR/Ks4sdsP0xPseeoJXdguRD9PqNiKPeSeob/bASbDuqxG4WctkjATc1Ylg== 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=SMyOTMCxnh4OQPROyddIIZnzyn8jFTfcj1CYbGw4/wo=; b=VlOWfDMnqoQoa95g3GIQvkPeYEPvtkpFqdcYFCi1YjnG0rElbdr7a6Rh2PxkbGfzyzZ6pIv9/EntSH8ogRqJwZGe5EkVmA6EgUO9pwcWqePLLQdOeQ6UnoqM72sT9xWQb5J4CPP9aV/BA58AjQTTqh4wMOUewZ0fANYcikeBVO93BJ3bRbjwh7WSRCNICauf0I2TMfg9QI4B3t64b1DFrzlXGO5b6bj+OJ/w2jMRvxMxCXCKp0vl7lPEiGxPkvR5H8AdgH9Gk5M3VHja7PWXAQ1wxgvkaRLhG3SQ+3yMZ7qBwOc2p9+BUgtHd3wSfP8rY7m9AISPU7s/QQx/okbouA== 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=SMyOTMCxnh4OQPROyddIIZnzyn8jFTfcj1CYbGw4/wo=; b=s7PFjL0DZqs5kCWBYQtzASElQPNoE4UXZtE2hj0i3ceCQ9s6KduVzDEVlE8spN181wr2EQBAMzSB9cRfLukKe7Fx5FBGKzeSuzCAcWU88j0AQQWXi2DCRRAOUPuxzvdQzAiQYTwGGEUicgnweJEEKggMEkaGE3dWUZ6r2tzA5Wo= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nokia.com; Received: from AM0PR07MB4531.eurprd07.prod.outlook.com (2603:10a6:208:6e::15) by AS8PR07MB7591.eurprd07.prod.outlook.com (2603:10a6:20b:28a::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4930.8; Fri, 28 Jan 2022 14:21:36 +0000 Received: from AM0PR07MB4531.eurprd07.prod.outlook.com ([fe80::7c27:bca0:d64:d78b]) by AM0PR07MB4531.eurprd07.prod.outlook.com ([fe80::7c27:bca0:d64:d78b%5]) with mapi id 15.20.4951.007; Fri, 28 Jan 2022 14:21:36 +0000 Message-ID: Date: Fri, 28 Jan 2022 15:21:30 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.3.0 Subject: Re: [PATCH v2] arm64: move efi_reboot to restart handler Content-Language: en-US To: Krzysztof Adamski , Catalin Marinas , Will Deacon , Mark Rutland , Peter Collingbourne , Guenter Roeck , Wolfram Sang Cc: Matija Glavinic-Pecotic , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org References: From: Alexander Sverdlin In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: AS9PR06CA0254.eurprd06.prod.outlook.com (2603:10a6:20b:45f::29) To AM0PR07MB4531.eurprd07.prod.outlook.com (2603:10a6:208:6e::15) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c6052a97-9fb8-4b84-ac07-08d9e2697dd3 X-MS-TrafficTypeDiagnostic: AS8PR07MB7591:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: K41iprmasxgtfNMYT2MYxvib42M/8a9lPGGJtrklYDgh9PETyGL1DFau+3CSHevHQUttMPjMgjQsa3Y19f4WsKpHwrn12Hr93zkGQai2LRMtnIWyrDcq7eb2+RXkant9M2wyY5+uSxIpJRw5mGWSkmWriers8ME+xKYwXgjm6Sn4GUF/+cFTLZxy4QM5z6qIUwhsFbhszjgdi4CWnTYkFcHMnt5YQSoU15PrqK5aFzkdbgqVMGUc8Hut1vKNPoffYQHmmnPcYkPm0j5ThR0lbdh5Dci3gBpZxJBzdFXJ6XHGNtVgITfZX+s9TjPEV97Qi1OmdKv6ZNJxI2tML/bWrjk2+RMb2ZXBorDeWW6m03rkZaHjTRPGKHqmSzCKEv9FulHCh2OGaEDqlGRU6L5mJKyfJ+BfWv/X4hCJJsm67Ay9JHWSrvDlKnhMlTvADAczL3pBmDPYGWmJX5z9dY6xu9YY9OQA3nmDhPrVF7eo1bchtEU2bHTJD9jjNZmk/LsXIG/jBPgy1eqSjGgO+RvBH7ndIrTaCpRdcnjymG9ZemFD42iF82PlDbPUj5oTIEE7ElId2f1NwqLuC4Lr3s55s/DfMRcUrJTr24i3LOTFtHexhF2wGU4l/R1S981jwWcX5URf+MipdeLdyeuhixZYuhMAqI3aqQ+YO2mUao6f5gLP9Y7/yw8AaTmczOWFGcEgZF0amXOtVU7hDiWgNnFkGMDW5DLZhx87uMSU8K6mibKmEP3OyFTD22gLK9i/xRxZKvd/oG0CoF5bvoONLWjMGA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM0PR07MB4531.eurprd07.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(31696002)(2616005)(6512007)(110136005)(26005)(186003)(6666004)(83380400001)(6486002)(52116002)(86362001)(2906002)(6506007)(508600001)(53546011)(5660300002)(82960400001)(66556008)(44832011)(38100700002)(38350700002)(66476007)(4326008)(8936002)(8676002)(66946007)(36756003)(31686004)(316002)(45980500001)(43740500002)(20210929001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?THRBbkhyMzR6S09vbVRlcWUzK1R1dmQwQVBYUHhLTjFYRHlWWElYcTJTa0lz?= =?utf-8?B?R0pPTEUvNmlDTDBhL0x2eHdYR2xIWXN2a0RsSlRiL01JaWhQTkhwcjNTNUhI?= =?utf-8?B?M1dwQ0ZsRGl5L3B2TXYrSVlUODBsZHpNaFc4OFdGaHV4NVJGR0FXOXpDSElE?= =?utf-8?B?R2lzejhteENYaUdEVnFFU2FzaXVlOHhFb1V0bUpqeEpWeTdNRCtvN2hDUm5k?= =?utf-8?B?MGJsUjVROHNjSHEwMnh3YXp0OVJGdzRRTm53OFRCRU9kSkZiVVFnZmdkTWVx?= =?utf-8?B?ZzQ5NmdJblBEYzBGSGdXVU5yTjRtc2J5SkRIWG1GR1F6VmR6ZzM3azBmMEZp?= =?utf-8?B?a042NGRyTTVZMUIyREwva3hITW9MRU1LUjZWcEw3aWxrdFdyUWF4REUvWmEy?= =?utf-8?B?cUJMNThUZ05LVmtCdWlmZG5aSDRPY3lHZjNjMExaNHN2RGlFWU96VWhTSmNG?= =?utf-8?B?NjR4TndQOGhzRTZqWmFyelpuRHJqR3B3UWF4ZzB2TWxORVdnZ0dmQmk4UkxI?= =?utf-8?B?NEtxaWh5QnkwSXBjbVhWbXJnZkZZUHpZd3E5bHhYM3JucUNEQko4VnFQbG03?= =?utf-8?B?aUViNjFCcVlkTG9zNVoxMjJHSHBVWXg5TzhWbzVOMGE4NFM0dzVPWDBpQmg2?= =?utf-8?B?ZUYrcDZBTG12NWsxN0NqYkJaS3lrRjBSelBiMDc3RFo4dWhZbVFrVG4wbXBz?= =?ut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FFdVJh?= =?utf-8?B?di9zaDhSYmtPbC9sc3FIc29INFBBZm1OU0s0MFQ4cnQveC8rN2dpOXRPUXUy?= =?utf-8?B?RThKZDhNb1FJV3UvN0FkLzd5T3duMmZ1S09ML2dMZ3ZCVnhwc0NMVjh0RWwy?= =?utf-8?B?SUh0MjRKdUdHOWludEhkTDFjcU05TzJiZHJ6VEtobFRaTFdiaU9UNkNuaW1T?= =?utf-8?B?R2RvRWlpOC95SU4raGN3ZXJLODIzbndRcWlTdEpUa2FDYkZsZE8zay82em5B?= =?utf-8?B?K3dOTU40NktBZTV1a2M3V2x6QVJtSkxncjRKbkU4Z3Z2VkJNdm5VemE1dWlz?= =?utf-8?B?NGNyeHQxeHB3S3JKdi9GbExXaFhkV09Eb0N6cmQrbnA0OHZzR2JWcXhWSTRk?= =?utf-8?B?UlMwRFlLSEp4OUpZY1hTVWV0bG9ObUdQdWNLdG14Vm9Ub1llVVEzdHJPcXV6?= =?utf-8?B?M21xNFhtTnFReEMvc1hFS0E2VWJRNmZNdmcyNjlJNERycHlTemJkRldSWng4?= =?utf-8?B?MlVUL3BsNDBSM3U2YUdUZmF5MGM4cDJOdUFOdVIyYWZjSTRWTGFIV0RWSmpG?= =?utf-8?B?bWZUcmhaajhaOWhTWmtDUUdXTUt2aUR5azhWMnpKd0VFWlAwUWlrTHNMZktH?= =?utf-8?Q?fNyfFZU40eYIs8a8FGSCg2EPhIOqO/6/XJaG7XTRTk=3D?= X-OriginatorOrg: nokia.com X-MS-Exchange-CrossTenant-Network-Message-Id: c6052a97-9fb8-4b84-ac07-08d9e2697dd3 X-MS-Exchange-CrossTenant-AuthSource: AM0PR07MB4531.eurprd07.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Jan 2022 14:21:36.1665 (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: m29u+ALdTfnae9pla49gvqdO12Q/qpyuOqWHjXeApSabg7THMq1nyGDYOE2S8YNt0NR61e8JOS7pa9yo+yQ12AwwEb9EY3yVgXqPZwlNEzI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR07MB7591 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi! On 28/01/2022 14:50, Krzysztof Adamski wrote: > On EFI enabled arm64 systems, efi_reboot was called before > do_kernel_restart, completely omitting the reset_handlers functionality. > By registering efi_reboot as part of the chain with slightly elevated > priority, we make it run before the default handler but still allow > plugging in other handlers. > Thanks to that, things like gpio_restart, restart handlers in > watchdog_core, mmc or mtds are working on those platforms. > > The priority 130 is one higher than PSCI, to overrule that but still > allow to easily register higher prio handlers, if needed. > > Signed-off-by: Krzysztof Adamski Reviewed-by: Alexander Sverdlin > --- > > Changes in v2: > - Register the handler in EFI code, instead of arm64 setup.c > - Remove the contdition from the handler - it should be run in all > cases when it is registered > - Bump the priority to 130 to make it completly obious this should be > run before PSCI (which has priority of 129) > > arch/arm64/kernel/process.c | 7 ------- > drivers/firmware/efi/arm-runtime.c | 21 +++++++++++++++++++++ > 2 files changed, 21 insertions(+), 7 deletions(-) > > diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c > index 5369e649fa79..b86ef77bb0c8 100644 > --- a/arch/arm64/kernel/process.c > +++ b/arch/arm64/kernel/process.c > @@ -130,13 +130,6 @@ void machine_restart(char *cmd) > local_irq_disable(); > smp_send_stop(); > > - /* > - * UpdateCapsule() depends on the system being reset via > - * ResetSystem(). > - */ > - if (efi_enabled(EFI_RUNTIME_SERVICES)) > - efi_reboot(reboot_mode, NULL); > - > /* Now call the architecture specific reboot code. */ > do_kernel_restart(cmd); > > diff --git a/drivers/firmware/efi/arm-runtime.c b/drivers/firmware/efi/arm-runtime.c > index 3359ae2adf24..b9a2cdbe80b4 100644 > --- a/drivers/firmware/efi/arm-runtime.c > +++ b/drivers/firmware/efi/arm-runtime.c > @@ -80,6 +80,24 @@ static bool __init efi_virtmap_init(void) > return true; > } > > +static int efi_restart(struct notifier_block *nb, unsigned long action, > + void *data) > +{ > + /* > + * UpdateCapsule() depends on the system being reset via > + * ResetSystem(). > + */ > + efi_reboot(reboot_mode, NULL); > + > + return NOTIFY_DONE; > +} > + > +static struct notifier_block efi_restart_nb = { > + .notifier_call = efi_restart, > + /* We want this to take priority over PSCI which has priority of 129. */ > + .priority = 130, > +}; > + > /* > * Enable the UEFI Runtime Services if all prerequisites are in place, i.e., > * non-early mapping of the UEFI system table and virtual mappings for all > @@ -148,6 +166,9 @@ static int __init arm_enable_runtime_services(void) > efi_native_runtime_setup(); > set_bit(EFI_RUNTIME_SERVICES, &efi.flags); > > + if (IS_ENABLED(CONFIG_ARM64)) > + register_restart_handler(&efi_restart_nb); > + > return 0; > } > early_initcall(arm_enable_runtime_services); -- Best regards, Alexander Sverdlin.