From patchwork Fri Jun 4 14:03:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 454037 Delivered-To: patch@linaro.org Received: by 2002:a02:735a:0:0:0:0:0 with SMTP id a26csp448489jae; Fri, 4 Jun 2021 07:06:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyR5Iotuu9Kmbus0kyYJ7IS+t964LVioq9UoGymwAv3OsTCyxOFAmsz0rtcmrtkTPYVGy3g X-Received: by 2002:a05:6402:16db:: with SMTP id r27mr4659798edx.375.1622815569159; Fri, 04 Jun 2021 07:06:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622815569; cv=none; d=google.com; s=arc-20160816; b=eGC2TJ8dA9KhzStO1Xl4YBib1Oa7oNGG3rLbT4wetqs/bvFjc3Dv+rWZAFPm8RoR8K dQ+RTde5TwlwwDUz58SfnJWSo0A88KtECD9DQPGXjOLwBORixf93sMBeJZdvub0qQMwc 6wHXY1RBDDdxE36e95YD9q/KzlmFRK+Q73k1E6kerRboPnaTvhIqjToQhNQ/HUBCdBPr e4wJaTUV6DKGxpsAFvevQCc6LgDdJuWsd9te2UFaLO9BMTuRSAN866bE10i7ugjahwZ9 1l+HwxUoaOhFNKkYwWPFW5MCDFgpeRMuBfZgiASjCdJJyAAKacW/AyQx7JeycsNnC+kU hYhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature:sender:precedence :errors-to:list-subscribe:list-help:list-post:list-unsubscribe :list-id; bh=TEh1khdRrbKOISh67J2riVpfOYD6OGYoV3WdgW9rcJ0=; b=ENVLgNu25QpDe7XT9Ya9Hnq2S6+8xR6t1i5+a2hFRca1LVDVdvwaiB0HIV2v5bv6+5 hc71yp8C8KO4pb6W61VsCiCoOYUFxlR0sBezJrDfyrnc6r0ZBb10rZo5WvJS4kyVsm1t LdGB3Za8jb++Uj0EoqkTLwQF9tkVfMZ+TirY/hmeGOPSQ9DVria3tVMxkQNQuwJ57mYO g4puOO6G5n+kCgj+zD9swX5NIY5EX8SOGVzPX60NN1o4EJzrI8L8OWuhaj8T12Iaw0Qk +R+vo+eRb19EyfZP0P4k1c7ATR7ilsAkqchAcERBf2cq9KqfmCYJJrgCzUeS9uYtewNn F1fQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nbeaNWdB; spf=pass (google.com: domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id n6si4981977edo.119.2021.06.04.07.06.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Jun 2021 07:06:09 -0700 (PDT) Received-SPF: pass (google.com: domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nbeaNWdB; spf=pass (google.com: domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from list by lists.xenproject.org with outflank-mailman.136862.253643 (Exim 4.92) (envelope-from ) id 1lpAQo-0005cy-52; Fri, 04 Jun 2021 14:04:14 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 136862.253643; Fri, 04 Jun 2021 14:04:14 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lpAQo-0005cp-1D; Fri, 04 Jun 2021 14:04:14 +0000 Received: by outflank-mailman (input) for mailman id 136862; Fri, 04 Jun 2021 14:04:13 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lpAQn-0004yR-0S for xen-devel@lists.xenproject.org; Fri, 04 Jun 2021 14:04:13 +0000 Received: from mail-wr1-x42c.google.com (unknown [2a00:1450:4864:20::42c]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 508581bd-cdd7-44cf-a786-69867cd0155c; Fri, 04 Jun 2021 14:04:04 +0000 (UTC) Received: by mail-wr1-x42c.google.com with SMTP id a11so7563099wrt.13 for ; Fri, 04 Jun 2021 07:04:04 -0700 (PDT) Received: from dell.default ([91.110.221.214]) by smtp.gmail.com with ESMTPSA id m11sm5422559wmq.33.2021.06.04.07.04.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Jun 2021 07:04:02 -0700 (PDT) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 508581bd-cdd7-44cf-a786-69867cd0155c DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=TEh1khdRrbKOISh67J2riVpfOYD6OGYoV3WdgW9rcJ0=; b=nbeaNWdBnTcP7bz1VBo8ORkE7GXcmZ9WULwc9d53BO3FJsVDxfvMLco7Jdi8xDopSW rFy3A0cnyioI9Du7UwC11so/a/emXg9SmX89XwsXCX5PaimX++OUSF1pmOmzDjPSJ563 7KFOmY8D3Adm6+/EaZXeJifRRsQf4TM1fcsM4mdfUuAE8wpGiEtPHYeK25qBDNx3FX1l FVS9pptxb5ACR0S1LvelYbp3SQvbYCD1/z9hRSFTg44QPcwlGsK3ziy22bSbbPIeLBwq 2RB1U4q1ThxkuhSrx8E1G/ve/dmSXoAlyAyj1BJwgzWp2AZfBYGVio/AYt62J9+48+g7 WH9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=TEh1khdRrbKOISh67J2riVpfOYD6OGYoV3WdgW9rcJ0=; b=A8b5+y4h6zECFuB3MhGKNtGBw7Fps6K2Eb1/swJS2eO+lOD6jhVv5nPh663Dpy0h1r 5HPohO4mDXP7aCrSYb3HpUBwBkEQTTosyCb08r36etlTJKIQgYss59HqHLiRGrFJOxxH 39WnjAazWsoWzOtB3ve7G7gcCMwWAgcyfq2e0Z5EpfraIy5TmPZ2bf6YqInTVH49PnVa EFj3RLrr6mufmtcPTi+8OPT8jGskX2C/fE7jNJjD6IPer+6z6Hi4kV5o4pHLoP2v3rHT 2RxcAm8le0BcsOOI3SQDQDq1fG6xcoEpl3yTxRN9LSso77BbweKnh6MZ/AUOyUwhL10B XEXw== X-Gm-Message-State: AOAM532/oMuwOZBe8Rlf3wzWJxbQVKve2+uA6Ns1n0qitcP3JMMzgWrX WIXT+HzgyoMkQMb3H1g9KzdssA== X-Received: by 2002:a05:6000:18ac:: with SMTP id b12mr4005226wri.44.1622815443376; Fri, 04 Jun 2021 07:04:03 -0700 (PDT) From: Lee Jones To: lee.jones@linaro.org, linux@armlinux.org.uk, catalin.marinas@arm.com, will@kernel.org, mark.rutland@arm.com, lorenzo.pieralisi@arm.com, sstabellini@kernel.org Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, wsa+renesas@sang-engineering.com, linux@roeck-us.net, treding@nvidia.com, arnd@arndb.de, xen-devel@lists.xenproject.org, patches@armlinux.org.uk Subject: [PATCH 2/5] drivers: firmware: psci: Register with kernel restart handler Date: Fri, 4 Jun 2021 15:03:54 +0100 Message-Id: <20210604140357.2602028-3-lee.jones@linaro.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210604140357.2602028-1-lee.jones@linaro.org> References: <20210604140357.2602028-1-lee.jones@linaro.org> MIME-Version: 1.0 From: Guenter Roeck Register with kernel restart handler instead of setting arm_pm_restart directly. This enables support for replacing the PSCI restart handler with a different handler if necessary for a specific board. Select a priority of 129 to indicate a higher than default priority, but keep it as low as possible since PSCI reset is known to fail on some boards. Acked-by: Arnd Bergmann Reviewed-by: Wolfram Sang Tested-by: Wolfram Sang Signed-off-by: Guenter Roeck Acked-by: Lorenzo Pieralisi Signed-off-by: Thierry Reding Signed-off-by: Lee Jones --- drivers/firmware/psci/psci.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) -- 2.31.1 diff --git a/drivers/firmware/psci/psci.c b/drivers/firmware/psci/psci.c index 3c1c5daf6df2e..18a47c9d5b02b 100644 --- a/drivers/firmware/psci/psci.c +++ b/drivers/firmware/psci/psci.c @@ -296,7 +296,8 @@ static int get_set_conduit_method(struct device_node *np) return 0; } -static void psci_sys_reset(enum reboot_mode reboot_mode, const char *cmd) +static int psci_sys_reset(struct notifier_block *nb, unsigned long action, + void *data) { if ((reboot_mode == REBOOT_WARM || reboot_mode == REBOOT_SOFT) && psci_system_reset2_supported) { @@ -309,8 +310,15 @@ static void psci_sys_reset(enum reboot_mode reboot_mode, const char *cmd) } else { invoke_psci_fn(PSCI_0_2_FN_SYSTEM_RESET, 0, 0, 0); } + + return NOTIFY_DONE; } +static struct notifier_block psci_sys_reset_nb = { + .notifier_call = psci_sys_reset, + .priority = 129, +}; + static void psci_sys_poweroff(void) { invoke_psci_fn(PSCI_0_2_FN_SYSTEM_OFF, 0, 0, 0); @@ -472,7 +480,7 @@ static void __init psci_0_2_set_functions(void) .migrate_info_type = psci_migrate_info_type, }; - arm_pm_restart = psci_sys_reset; + register_restart_handler(&psci_sys_reset_nb); pm_power_off = psci_sys_poweroff; }