Linux-RISC-V Archive on lore.kernel.org
 help / color / Atom feed
From: Rob Herring <robh@kernel.org>
To: Anup Patel <anup@brainfault.org>
Cc: Mark Rutland <mark.rutland@arm.com>,
	devicetree@vger.kernel.org, Paul Walmsley <paul@pwsan.com>,
	linux-pm@vger.kernel.org, Sebastian Reichel <sre@kernel.org>,
	Atish Patra <atish.patra@wdc.com>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	Paul Walmsley <paul.walmsley@sifive.com>,
	Alistair Francis <Alistair.Francis@wdc.com>,
	linux-riscv <linux-riscv@lists.infradead.org>,
	Christoph Hellwig <hch@lst.de>
Subject: Re: QEMU RISC-V virt machine poweroff driver
Date: Wed, 13 Nov 2019 19:50:25 -0600
Message-ID: <20191114015025.GB1748@bogus> (raw)
In-Reply-To: <CAAhSdy2Lki2rZeNJyH6p0RKWjd6O+DboDE_mq8rHzXA0JRQ=7g@mail.gmail.com>

On Tue, Nov 12, 2019 at 09:46:33AM +0530, Anup Patel wrote:
> On Mon, Nov 11, 2019 at 10:50 PM Paul Walmsley <paul@pwsan.com> wrote:
> >
> > On Mon, 11 Nov 2019, Christoph Hellwig wrote:
> >
> > > On Mon, Nov 11, 2019 at 05:06:24PM +0530, Anup Patel wrote:
> > > > We really don't need this driver. Instead, we can simply re-use
> > > > following drivers:
> > > > mfd/syscon
> > > > power/reset/syscon-reboot
> > > > power/reset/syscon-poweroff
> > > >
> > > > Just enable following to your defconfig:
> > > > CONFIG_POWER_RESET=y
> > > > CONFIG_POWER_RESET_SYSCON=y
> > > > CONFIG_POWER_RESET_SYSCON_POWEROFF=y
> > > > CONFIG_SYSCON_REBOOT_MODE=y
> > > >
> > > >
> > > > Once above drivers are enabled in your defconfig, make sure
> > > > test device DT nodes are described in the following way for virt machine:
> > >
> > > Oh well, that is a lot more churn than a just works driver, and
> > > will also pull it dependencies like regmap which quite blow up the
> > > kernel size.  But I guess that is where modern Linux drivers are
> > > heading, so I'm not going to complain too loud..
> >
> > The core issue is that putting random register writes in DT doesn't match
> > the hardware.  And the doctrine with DT has always been that it's supposed
> > to represent the actual hardware.  On FPGA bitstreams or ASICs that have
> > the teststatus/testfinisher IP block, there really is an IP block out
> > there - it's not just a bare register.
> >
> > If you update your driver to note that this is a SiFive IP block rather
> > than a "RISC-V" IP block, I'll ack it.
> >
> 
> The SiFive Test device has only one register at offset 0x0 and three
> possible magic values (0x3333, 0x5555, and 0x7777).
> 
> The SYSCON based Reboot and Poweroff driver do exactly the same
> thing what Christop's virt machine poweroff driver does so we are not
> doing "random register writes" via DT.
> 
> In fact, using SYSCON based Reboot and Poweroff we are actually
> describing the Reboot and Poweroff mechanism directly in DT without
> adding a complete driver for just one register write. This means we
> are totally aligned with "DT doctrine" and over here we going one-step
> more by describing Reboot and Poweroff mechanism in DT.
> 
> A quick GREP shows that the SYSCON Reboot and Poweroff drivers
> are quite widely used in ARM, ARM64 and MIPS architectures. Some of
> the  SOCs using these drivers are: Samsung Exynos, HiSilicon Hi3660,
> HiSilicon Hi6220, Rockchip RK3xxx, AppliedMicro XGene, Broadcom
> BCM33xx, Broadcom BCM63xx, etc. Majority of ARM/ARM64 SOCs
> these days use the PSCI based SYSTEM RESET and SHUTDOWN
> methods so we might not see more Reboot and Poweroff drivers for
> ARM world.
> 
> IMHO, we should definitely avoid adding a driver to Linux when there
> a generic driver already available. This helps in kernel maintenance
> in long-term.

I guess I should have finished reading the thread...

I agree with both of you. :) The DT binding should match the h/w as Paul 
says. However, a h/w specific binding can easily map to a generic driver 
if a given client OS has one. That probably hasn't been done yet for 
syscon-poweroff, but should.

Rob

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

  reply index

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-07 21:24 Christoph Hellwig
2019-11-07 21:24 ` [PATCH 1/2] dt-bindings: power: reset: document the QEMU RISC-V virt machine poweroff device Christoph Hellwig
2019-11-07 21:52   ` Palmer Dabbelt
2019-11-07 22:32   ` Paul Walmsley
2019-11-14  1:44     ` Rob Herring
2019-11-07 21:24 ` [PATCH 2/2] power: reset: add a QEMU RISC-V virt machine poweroff driver Christoph Hellwig
2019-11-07 21:53   ` Palmer Dabbelt
2019-11-07 22:33   ` Paul Walmsley
2019-11-07 21:56 ` Palmer Dabbelt
2019-11-11 11:36 ` Anup Patel
2019-11-11 16:12   ` Christoph Hellwig
2019-11-11 17:20     ` Paul Walmsley
2019-11-12  4:16       ` Anup Patel
2019-11-14  1:50         ` Rob Herring [this message]
2019-11-15 22:14 ` Nick Kossifidis
2019-11-18  6:12   ` Anup Patel

Reply instructions:

You may reply publically to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191114015025.GB1748@bogus \
    --to=robh@kernel.org \
    --cc=Alistair.Francis@wdc.com \
    --cc=anup@brainfault.org \
    --cc=atish.patra@wdc.com \
    --cc=devicetree@vger.kernel.org \
    --cc=hch@lst.de \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=mark.rutland@arm.com \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.com \
    --cc=paul@pwsan.com \
    --cc=sre@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Linux-RISC-V Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-riscv/0 linux-riscv/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-riscv linux-riscv/ https://lore.kernel.org/linux-riscv \
		linux-riscv@lists.infradead.org
	public-inbox-index linux-riscv

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.infradead.lists.linux-riscv


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git