Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3354786pxb; Mon, 17 Jan 2022 18:25:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJyawzg/GMmkkPoT5UySu2q984/fZlKrERK9e7yE6UzUYJBhX6X34lMGujxBH7SH0S47QhCL X-Received: by 2002:a17:902:ab12:b0:149:c5a5:5323 with SMTP id ik18-20020a170902ab1200b00149c5a55323mr25760514plb.97.1642472720364; Mon, 17 Jan 2022 18:25:20 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1642472720; cv=pass; d=google.com; s=arc-20160816; b=Uc/Ad38QmA6sfyBIFsfglz1f7AiKIEVvTbrXpePeM+EomrzgFWMMKQRvJrdAW6QT2I dLW8kmzM2jKUWggoxVzPeYd+y57+92hlQ7AbkIjDTflqM1F1nMH27rkpvi4RsV+w93Hl i8QfVwj0cOTGYfZ3X7zdznq6DjDGOrrCa96ESlVZaTNENESUSz/DMJrLrF35lYiAVeRy l9AbK5UKIqVEB3cmvIH/4wW9+sHMYmsLJNSriHiZgs7nlzKZj5PEv4+7Zv3iWjpLbXgA 5rqm8z5cEj0SSmG3WQZ2rycD5nFXjMvD5jT5sUnGg1WhgAZzMSDOrVSaUwhF50cEk2kF Onng== 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=lw54/Cj2W4TuWgXUrzuGcMVdDwqlsVEwuSXh355TPrI=; b=wC8v5lhjjDZFqpf/xZlP1eelUeDFn+lSbpfDc68img8UdvCnFR2oXsBKyQmmS3fbnH shtmI3o65PERc4IWThb6yt1noMvyN9MMU1mBL1GWVZ2vxLR02Jte9bdfQpz1AA5sDej7 7deIX4xrE1OcEFnk2iDuquOelUjdpSjrBPPer68UauaqJB7gm+tLN0Mu5sYDThXHOpoG 8iAmNNePWSTHuAr+mL3BR9peTcZRinqXhxRwQrOdnwNoZVZwQtRw203iGiHNRs4vCnND NjJck/HDKi0FMGBozeCKw+VktmQ66+3MgcF52ZJX6K1sO+S1zqJ4zhzER4w0On3UQEjh J1GQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nokia.onmicrosoft.com header.s=selector1-nokia-onmicrosoft-com header.b=Beiwf9nE; arc=pass (i=1 spf=pass spfdomain=nokia.com dkim=pass dkdomain=nokia.com dmarc=pass fromdomain=nokia.com); 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 n3si18416314plh.441.2022.01.17.18.25.08; Mon, 17 Jan 2022 18:25:20 -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=Beiwf9nE; arc=pass (i=1 spf=pass spfdomain=nokia.com dkim=pass dkdomain=nokia.com dmarc=pass fromdomain=nokia.com); 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 S240035AbiAQMo5 (ORCPT + 99 others); Mon, 17 Jan 2022 07:44:57 -0500 Received: from mail-eopbgr140117.outbound.protection.outlook.com ([40.107.14.117]:52711 "EHLO EUR01-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S240007AbiAQMov (ORCPT ); Mon, 17 Jan 2022 07:44:51 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nODpUDDlXmotwOL5xybCdUYHOJN3u7F+6tVq2eprW7q1q9PM0EiPVjP7xbCBVotGi0HToDimkNQY51rGEXbYDWa2f/0mLPTbmCCM/yvqFgf/5RyTMBiCePH8YTOTV20VxDa2F1NA8MK+4e2WDS+AsKPbOZ/cr9+nQsiUcKmQ/gYPaMK5rIlbLjeGJIKM4fIcRaB2FvweHdmzDZf+ZIszFaklzgt6CWF3SkV/bixnKwVlTGIujtrRlhSJ/nZ42UBwH+MNvkirmJfCxpvOb2Q5/XdJKiyrtSz/kLqp/Ckhq5/oR0niZJVLWFtOL6CVXWHuaU5qt9E8uEd/4QWJnwsdhw== 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=lw54/Cj2W4TuWgXUrzuGcMVdDwqlsVEwuSXh355TPrI=; b=I3aOHy+JNX0DmrLwGM6PjvK6e7nBr09DrxHsfz0W7HTl2V3Y40vjukdPqqQLHXipYXeB2Auc5toruDHaZaORY9U9IVbnx+rCXKxlEAyg86npzdBPlm3xziqJHCWaudxKKx0TAdi0k6jiVLRAOZqAuXEqY88JH62p8DDf6/KmDhGhtoiXJPAl8aYAcg/RQQUuZXiYzLdKyG/mhbyAEJBl8CQh+EGvqhfpguc25+prxphPmEOMjlfotaLekWS1uHSBu/CVbbIoz1dbF6NEpiuWUiuE3176bCQpnuYs2F4N2ZVNHyeKH2x0rKUHnUWz1sL8+rN775wkr/RMpL2vLxKk8A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nokia.com; dmarc=pass action=none header.from=nokia.com; dkim=pass header.d=nokia.com; 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=lw54/Cj2W4TuWgXUrzuGcMVdDwqlsVEwuSXh355TPrI=; b=Beiwf9nE/Kg1FnSAbFOsh/YH/VPOHwpTna54Fyjl2mrWNZQJYTbK+NrCDZIA9BNz5/MZtDJvBD5AjcffH/Ta7sqcFafolkSEMLvSztSo/VBs7KlC2olYTsqf7IfGRwwYkEFv1mjVbUaXlVfiTSViZjpF8kFlYSr2YxS/p4tW4gI= 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 AM5PR0701MB2961.eurprd07.prod.outlook.com (2603:10a6:203:47::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4909.7; Mon, 17 Jan 2022 12:44:48 +0000 Received: from AM0PR07MB4531.eurprd07.prod.outlook.com ([fe80::6008:d588:5745:4877]) by AM0PR07MB4531.eurprd07.prod.outlook.com ([fe80::6008:d588:5745:4877%3]) with mapi id 15.20.4909.006; Mon, 17 Jan 2022 12:44:48 +0000 Message-ID: Date: Mon, 17 Jan 2022 13:44:41 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.3.0 Subject: Re: [PATCH] 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: AM5PR0202CA0015.eurprd02.prod.outlook.com (2603:10a6:203:69::25) 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: 50970c0b-ed31-416c-a361-08d9d9b725d4 X-MS-TrafficTypeDiagnostic: AM5PR0701MB2961:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8882; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Kk0AxtL6L5G72QvZsGuNojsMyJxYb7+6d1oLMp9AA4+4JLw422g6kpudfYcINnfOrhFkp9LYuKwF/xGFnlLXLRBfgp8OqryKCDFxmtLGVvtlUXR/8Qwa+/e4x3uqzD8elHVbJBQaEIJ7XhYdvPWYBV3Jpo6Glvwz9BUrCQms9qcSJPFXsHUhEXcPJWfCzqIeeECjpujPFcwKrtX2dOKzPh5qObMri7xdXbd1ikAe//Qt2Noh+g1RGsRRNATRnXZjm1YwobcNs4+lU8NHcfQy5juXQCGmnZZxVGPWhOB5dvEg827SF0RYF2lyBzXNVgbzbyrxfj1Ab3qemVp/c0RpPYuzNJM+TnNAUFAzZPm5viBrgAU3unbm/21w+815xF27zKGQyZYeczFsF98qMoN9J8ugmoQjXXus8Pq5xqc9bvGRUhIqygE8F4W6C9/McmqEnY+klIBX/LxdDyHA8QkCAHjWxVmQ/F+Ou7nSoDP5ClgVaYCnEkoDJuSBlHeIHM39G4BXAiWrsNREmGdfXfePTjcT4a+pPE374DB6PB9jYPEgd+091+EC05AbzgbP9z+XmqXrEjQkfH2Yd4nxJL3i8GGNl/8SjNRSQ4nGzcJl6xXFB0Q1E5OU2RYZiC5feYpmK6IO7bKjDXnWVIek3UDRt0yK/iAyp5aKEZxziWlPj7mb06KJAwvxU82Fnd3NVcJWXo9jDEernsmTX8aFRwS86AY4Wo9cozHUmIwg/2B+wy1O73s503kD3kK6Ov8z8p+3k5dY6Z8mnHPmf6RFqtosAVr4bECFg2BQxVRxqd6VsioJxj+cVCT8eHoZ6Rq6Bjbc 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)(38100700002)(508600001)(6486002)(82960400001)(31696002)(83380400001)(38350700002)(86362001)(53546011)(52116002)(2906002)(2616005)(4326008)(186003)(26005)(44832011)(66946007)(6666004)(6512007)(6506007)(316002)(110136005)(31686004)(5660300002)(8676002)(36756003)(66476007)(66556008)(8936002)(45980500001)(43740500002)(20210929001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?MTVTZE5WQktPZVZQOTV1YWN0Vm92VnhkcVAwTnJGSGdLb1JiZlFScll2ZU11?= =?utf-8?B?WHlPK1VPZzIxNktibUNqUFRrRVA2a1dtSy92NmcvUE5HSHRUbENlaUdqYnBF?= =?utf-8?B?TWFCd0RtQkhoc2p4SEpQSmtuVll2em0vYWs3YzBMU3dieWovSk0yMndudkNC?= =?utf-8?B?VWdHV1pXQWpFY2M0VGY3SURjamFDMlZzMU1FOWI3b2lQOVI5ZGR0NG1XTGVR?= =?utf-8?B?SlNYNGJqNVQyNDdhVHBiS0NSakh4S0hLSlgrS2dsZWlJY0g0QlZXbDM5Umx5?= =?utf-8?B?K1ptSnpMWXJsL0p2empaMTBnQ3c3dTl2OE5icC9IT3dqZ0hyTlY1U1JkVWpG?= =?utf-8?B?Qkp1bXlxdEI1czByd2Zqb0tMSXQzc3pMdENPczFQdnc2OEE1K3ZXKzViMlFY?= =?utf-8?B?ODEzY2xlWHhHL3JqOWJrdkg2b0dSZWhJYUtFb0tTeFpCZEVUVEgyYUFXL3ZU?= =?utf-8?B?c2FVK3BxelpibmNyOGtwUWhOQkQrV1FMdUhKOVlsU3o5dzkvSEJxblpQM2Yw?= =?utf-8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Exchange-CrossTenant-AuthSource: AM0PR07MB4531.eurprd07.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jan 2022 12:44:48.8289 (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: aH7tg0DeeJ3HfZ2DEPdhnfXc1JdKf2/vKx9OvM3+qI/zu6QvC4yH5rFJ7pPMjk+7SJdTdXBjwKbrRES9gKM1kS68XmqxK4ArxtyOBmrGcHU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0701MB2961 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi! On 17/01/2022 13:31, 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 129 should be high enough as we will likely be the first > one to register on this prio so we will be called before others, like > PSCI handler. > > Signed-off-by: Krzysztof Adamski Reviewed-by: Alexander Sverdlin > --- > arch/arm64/kernel/process.c | 7 ------- > arch/arm64/kernel/setup.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/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c > index f70573928f1b..5fa95980ba73 100644 > --- a/arch/arm64/kernel/setup.c > +++ b/arch/arm64/kernel/setup.c > @@ -12,6 +12,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -298,6 +299,24 @@ u64 cpu_logical_map(unsigned int cpu) > return __cpu_logical_map[cpu]; > } > > +static int efi_restart(struct notifier_block *nb, unsigned long action, > + void *data) > +{ > + /* > + * UpdateCapsule() depends on the system being reset via > + * ResetSystem(). > + */ > + if (efi_enabled(EFI_RUNTIME_SERVICES)) > + efi_reboot(reboot_mode, NULL); > + > + return NOTIFY_DONE; > +} > + > +static struct notifier_block efi_restart_nb = { > + .notifier_call = efi_restart, > + .priority = 129, > +}; > + > void __init __no_sanitize_address setup_arch(char **cmdline_p) > { > setup_initial_init_mm(_stext, _etext, _edata, _end); > @@ -346,6 +365,8 @@ void __init __no_sanitize_address setup_arch(char **cmdline_p) > > paging_init(); > > + register_restart_handler(&efi_restart_nb); > + > acpi_table_upgrade(); > > /* Parse the ACPI tables for possible boot-time configuration */ -- Best regards, Alexander Sverdlin.