Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp1312202ybg; Fri, 18 Oct 2019 15:43:05 -0700 (PDT) X-Google-Smtp-Source: APXvYqzNYVqoF5lE3tH6WvkbzmieCHdFfJ+/Pz6lKPpwLUTO4nNreetfNHxsbjMxsfh0GKW1OFIA X-Received: by 2002:aa7:c6cf:: with SMTP id b15mr12243014eds.215.1571438584938; Fri, 18 Oct 2019 15:43:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571438584; cv=none; d=google.com; s=arc-20160816; b=VcUWcnxKkWVS4Te1WMSVxTpScT0G33Os0aZ0s1WfSBVSWeAwN+Kg5yjNLgFGn09wub GgCztnpG8cfDbQMeyHP9K58/R1qDsEenyAarKfghRoZxYccFuNkWZ+b9uyhO/zUgq6XP BET04tV90zR6jgoRvAH7QLjGPLojqF466oiy06EcA6zKg1fES/pAzah2+2JxA2Vqri7W A+a0nMri/yRQlX90WF3dLKlSzXFnnRO0Fz4sUVwbkKz3swUaa/YJOnEq1KPjEsQR3pDr yLbyaprnVXxESDv8wfyDkMYmF59zbZ8MiuNeTqlTJGRhSGhyOtaL/xDcds13PWQRiQt0 wayw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=h73TqF5SoJ6GAIIKRG22eugF7D1cochNYSQVPWgygxk=; b=WA0GZw7MFSoeDHlMsT1WwV6obt7R2PFFubzffaZn3pbcau6ycD9jLrJxUu8KBP9VD6 7U19NLXMjuWmNj/pOMMhEtCPW7pzW+1lCy56WkTjP5pQisfTY8wJ7rx85OZ44p+d5sPa T6tKQiSKoDeluhOBcOBXQZQB0lS4EZmfaQPbBTPMdbgcw3yoH3xtqkcjgC8OnomsEnKG yePvEhRawOvQh80KzQa6DaSpfZrQv+/AZakBrw+822Db/Tr/5erLrrA6VjY4lDc1Jf0F mSw9RbDrVXOYwSrpgWDnwVO19w11VnHBdlNUIFsRLKEy7/Jgv92bbsH/3LUtc/KTyOjS t2kQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@brainfault-org.20150623.gappssmtp.com header.s=20150623 header.b=oT+ec34Q; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id gh12si4100050ejb.191.2019.10.18.15.42.42; Fri, 18 Oct 2019 15:43:04 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@brainfault-org.20150623.gappssmtp.com header.s=20150623 header.b=oT+ec34Q; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388980AbfJRF0z (ORCPT + 99 others); Fri, 18 Oct 2019 01:26:55 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:33997 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726458AbfJRF0z (ORCPT ); Fri, 18 Oct 2019 01:26:55 -0400 Received: by mail-wr1-f66.google.com with SMTP id j11so4766438wrp.1 for ; Thu, 17 Oct 2019 22:26:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brainfault-org.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=h73TqF5SoJ6GAIIKRG22eugF7D1cochNYSQVPWgygxk=; b=oT+ec34QQePEIN8AhUZGIGxnIWGt8bBJbEIgZPVeAawhIgHnNshdKFCxck2vhENTAr vbr2hWswQdFMhAFRLwWwvlEls+zsASyOIedKdO/I9WSbxqBIry0+LhvKUULxL+e/Tfuz l3dWDY9QlsHdcrJNMVeJkWCVuDUbu+n8Czh+/KZivTKW0pF0qJx3p44zF7ZYc0Fffiuk zj7uOIb5BcqssmkN44Hmde4nPeNCu0KnzWItOzKgfqz8/ZS4wDzatknooeMs8PcbDJ64 kiawb0PA8ePO9j31VtLaA2f16BXSL76nj/kQw8d3ySbGRDO9iKoGDTyuE85HmlXupXdt f/rQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=h73TqF5SoJ6GAIIKRG22eugF7D1cochNYSQVPWgygxk=; b=oiCHXoaIQN6pIBFXx+hdmM3FjK+JGYoGu3AEm6HZGbams/9eiD8/FmFwhfmccbiasB oWGUowsB+kgmkSevT/PX8dbhxsRDVHrgCm2cM0CssloOnyjR6REAWBMZngLN8Be4pxcq 9O0dqDGt28EA2yLOwg0e6xa2b5Dhly5wGFAmb7GjFnBVDbUAXfftmxAFw4I1dWEoMfak ZuAW8ehbqI5iC8RA2AlwqKcVOojPXaA0ZlxgNpAfHX3UldD44Xne2Rt57nngU8Ixz07O Jerk2uBoH5adLQ2/wXU7VFlb+NevPKqX2Vng0f95U7us+k+haZ0r9wLLGctBCRkAgpqq S/Ew== X-Gm-Message-State: APjAAAUZiUbELsga3ninKMZtdjlIfPVQmyDCt6oOUKqWm8Wi0/diAAJU L2mdyNyJ0jOMl4LmKgFhDInb46CPDGDASECz7B0eY63RAfQ= X-Received: by 2002:adf:a109:: with SMTP id o9mr5299771wro.96.1571367250161; Thu, 17 Oct 2019 19:54:10 -0700 (PDT) MIME-Version: 1.0 References: <20191017173743.5430-1-hch@lst.de> <20191017173743.5430-7-hch@lst.de> In-Reply-To: <20191017173743.5430-7-hch@lst.de> From: Anup Patel Date: Fri, 18 Oct 2019 08:23:59 +0530 Message-ID: Subject: Re: [PATCH 06/15] riscv: cleanup the default power off implementation To: Christoph Hellwig Cc: Palmer Dabbelt , Paul Walmsley , Atish Patra , Damien Le Moal , linux-riscv , "linux-kernel@vger.kernel.org List" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 17, 2019 at 11:08 PM Christoph Hellwig wrote: > > Move the sbi poweroff to a separate function and file that is only > compiled if CONFIG_SBI is set. Provide a new default fallback > power off that just sits in a wfi loop to save some power. > > Signed-off-by: Christoph Hellwig > Reviewed-by: Atish Patra > --- > arch/riscv/kernel/Makefile | 1 + > arch/riscv/kernel/reset.c | 5 ++--- > arch/riscv/kernel/sbi.c | 17 +++++++++++++++++ > 3 files changed, 20 insertions(+), 3 deletions(-) > create mode 100644 arch/riscv/kernel/sbi.c > > diff --git a/arch/riscv/kernel/Makefile b/arch/riscv/kernel/Makefile > index 696020ff72db..d8c35fa93cc6 100644 > --- a/arch/riscv/kernel/Makefile > +++ b/arch/riscv/kernel/Makefile > @@ -41,5 +41,6 @@ obj-$(CONFIG_DYNAMIC_FTRACE) += mcount-dyn.o > obj-$(CONFIG_PERF_EVENTS) += perf_event.o > obj-$(CONFIG_PERF_EVENTS) += perf_callchain.o > obj-$(CONFIG_HAVE_PERF_REGS) += perf_regs.o > +obj-$(CONFIG_RISCV_SBI) += sbi.o > > clean: > diff --git a/arch/riscv/kernel/reset.c b/arch/riscv/kernel/reset.c > index d0fe623bfb8f..5e4e69859af1 100644 > --- a/arch/riscv/kernel/reset.c > +++ b/arch/riscv/kernel/reset.c > @@ -4,12 +4,11 @@ > */ > > #include > -#include > > static void default_power_off(void) > { > - sbi_shutdown(); > - while (1); > + while (1) > + wait_for_interrupt(); > } > > void (*pm_power_off)(void) = default_power_off; > diff --git a/arch/riscv/kernel/sbi.c b/arch/riscv/kernel/sbi.c > new file mode 100644 > index 000000000000..f6c7c3e82d28 > --- /dev/null > +++ b/arch/riscv/kernel/sbi.c > @@ -0,0 +1,17 @@ > +// SPDX-License-Identifier: GPL-2.0-only > + > +#include > +#include > +#include > + > +static void sbi_power_off(void) > +{ > + sbi_shutdown(); > +} > + > +static int __init sbi_init(void) > +{ > + pm_power_off = sbi_power_off; > + return 0; > +} > +early_initcall(sbi_init); > -- > 2.20.1 > > > _______________________________________________ > linux-riscv mailing list > linux-riscv@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-riscv LGTM. Reviewed-by: Anup Patel Regards, Anup