From: Bin Meng <bmeng.cn@gmail.com>
To: Anup Patel <Anup.Patel@wdc.com>
Cc: Peter Maydell <peter.maydell@linaro.org>,
"qemu-riscv@nongnu.org" <qemu-riscv@nongnu.org>,
Sagar Karandikar <sagark@eecs.berkeley.edu>,
Anup Patel <anup@brainfault.org>,
"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
Atish Patra <Atish.Patra@wdc.com>,
Alistair Francis <Alistair.Francis@wdc.com>,
Palmer Dabbelt <palmer@dabbelt.com>,
Christoph Hellwig <hch@lst.de>
Subject: Re: [PATCH] riscv/virt: Add syscon reboot and poweroff DT nodes
Date: Mon, 11 Nov 2019 23:28:08 +0800 [thread overview]
Message-ID: <CAEUhbmVCjFHD6HbA1LS2xbbUGjL5goo3dZat_ZXWiTV=50LvTA@mail.gmail.com> (raw)
In-Reply-To: <MN2PR04MB60618CCC891177DC612532E98D740@MN2PR04MB6061.namprd04.prod.outlook.com>
On Mon, Nov 11, 2019 at 9:42 PM Anup Patel <Anup.Patel@wdc.com> wrote:
>
> Correct Palmer's email address.
>
> > -----Original Message-----
> > From: Anup Patel
> > Sent: Monday, November 11, 2019 7:08 PM
> > To: Peter Maydell <peter.maydell@linaro.org>; Palmer Dabbelt
> > <palmer@sifive.com>; Alistair Francis <Alistair.Francis@wdc.com>; Sagar
> > Karandikar <sagark@eecs.berkeley.edu>
> > Cc: Atish Patra <Atish.Patra@wdc.com>; Christoph Hellwig <hch@lst.de>;
> > Anup Patel <anup@brainfault.org>; qemu-riscv@nongnu.org; qemu-
> > devel@nongnu.org; Anup Patel <Anup.Patel@wdc.com>
> > Subject: [PATCH] riscv/virt: Add syscon reboot and poweroff DT nodes
> >
> > The SiFive test device found on virt machine can be used by generic syscon
> > reboot and poweroff drivers available in Linux kernel.
> >
> > This patch updates FDT generation in virt machine so that Linux kernel can
> > probe and use generic syscon drivers.
> >
> > Signed-off-by: Anup Patel <anup.patel@wdc.com>
> > ---
> > hw/riscv/virt.c | 28 ++++++++++++++++++++++++----
> > 1 file changed, 24 insertions(+), 4 deletions(-)
> >
> > diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c index cc8f311e6b..fdfa359713
> > 100644
> > --- a/hw/riscv/virt.c
> > +++ b/hw/riscv/virt.c
> > @@ -182,11 +182,11 @@ static void create_fdt(RISCVVirtState *s, const
> > struct MemmapEntry *memmap,
> > uint64_t mem_size, const char *cmdline) {
> > void *fdt;
> > - int cpu;
> > + int cpu, i;
> > uint32_t *cells;
> > char *nodename;
> > - uint32_t plic_phandle, phandle = 1;
> > - int i;
> > + const char test_compat[] = "sifive,test0\0syscon";
> > + uint32_t plic_phandle, test_phandle, phandle = 1;
> > hwaddr flashsize = virt_memmap[VIRT_FLASH].size / 2;
> > hwaddr flashbase = virt_memmap[VIRT_FLASH].base;
> >
> > @@ -356,13 +356,33 @@ static void create_fdt(RISCVVirtState *s, const
> > struct MemmapEntry *memmap,
> > create_pcie_irq_map(fdt, nodename, plic_phandle);
> > g_free(nodename);
> >
> > + test_phandle = phandle++;
> > nodename = g_strdup_printf("/test@%lx",
> > (long)memmap[VIRT_TEST].base);
> > qemu_fdt_add_subnode(fdt, nodename);
> > - qemu_fdt_setprop_string(fdt, nodename, "compatible", "sifive,test0");
> > + qemu_fdt_setprop(fdt, nodename, "compatible",
> > + test_compat, sizeof(test_compat));
> > qemu_fdt_setprop_cells(fdt, nodename, "reg",
> > 0x0, memmap[VIRT_TEST].base,
> > 0x0, memmap[VIRT_TEST].size);
> > + qemu_fdt_setprop_cell(fdt, nodename, "phandle", test_phandle);
> > + test_phandle = qemu_fdt_get_phandle(fdt, nodename);
Is this necessary?
> > + g_free(nodename);
> > +
> > + nodename = g_strdup_printf("/reboot");
> > + qemu_fdt_add_subnode(fdt, nodename);
> > + qemu_fdt_setprop_string(fdt, nodename, "compatible", "syscon-
> > reboot");
> > + qemu_fdt_setprop_cell(fdt, nodename, "regmap", test_phandle);
> > + qemu_fdt_setprop_cell(fdt, nodename, "offset", 0x0);
> > + qemu_fdt_setprop_cell(fdt, nodename, "value", FINISHER_RESET);
> > + g_free(nodename);
> > +
> > + nodename = g_strdup_printf("/poweroff");
> > + qemu_fdt_add_subnode(fdt, nodename);
> > + qemu_fdt_setprop_string(fdt, nodename, "compatible", "syscon-
> > poweroff");
> > + qemu_fdt_setprop_cell(fdt, nodename, "regmap", test_phandle);
> > + qemu_fdt_setprop_cell(fdt, nodename, "offset", 0x0);
> > + qemu_fdt_setprop_cell(fdt, nodename, "value", FINISHER_PASS);
> > g_free(nodename);
> >
> > nodename = g_strdup_printf("/uart@%lx",
> > --
Regards,
Bin
next prev parent reply other threads:[~2019-11-11 15:29 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-11 13:38 [PATCH] riscv/virt: Add syscon reboot and poweroff DT nodes Anup Patel
2019-11-11 13:42 ` Anup Patel
2019-11-11 15:28 ` Bin Meng [this message]
2019-11-11 16:49 ` Anup Patel
2019-11-11 19:14 ` Alistair Francis
Reply instructions:
You may reply publicly 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='CAEUhbmVCjFHD6HbA1LS2xbbUGjL5goo3dZat_ZXWiTV=50LvTA@mail.gmail.com' \
--to=bmeng.cn@gmail.com \
--cc=Alistair.Francis@wdc.com \
--cc=Anup.Patel@wdc.com \
--cc=Atish.Patra@wdc.com \
--cc=anup@brainfault.org \
--cc=hch@lst.de \
--cc=palmer@dabbelt.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-riscv@nongnu.org \
--cc=sagark@eecs.berkeley.edu \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).