All of lore.kernel.org
 help / color / mirror / Atom feed
From: Geert Uytterhoeven <geert@linux-m68k.org>
To: Stafford Horne <shorne@gmail.com>
Cc: Karol Gugala <kgugala@antmicro.com>,
	Mateusz Holenko <mholenko@antmicro.com>,
	Gabriel Somlo <gsomlo@gmail.com>,
	linux-riscv <linux-riscv@lists.infradead.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Joel Stanley <joel@jms.id.au>
Subject: Re: [PATCH v4] drivers/soc/litex: Add restart handler
Date: Wed, 20 Jan 2021 09:20:39 +0100	[thread overview]
Message-ID: <CAMuHMdVpogc=oEgCCq8N__RJkujJX47OaZZcyaRgjSJV2+SZ-Q@mail.gmail.com> (raw)
In-Reply-To: <20210119221110.GM2002709@lianli.shorne-pla.net>

Hi Stafford,

On Tue, Jan 19, 2021 at 11:11 PM Stafford Horne <shorne@gmail.com> wrote:
> On Wed, Jan 20, 2021 at 06:34:44AM +0900, Stafford Horne wrote:
> > On Tue, Jan 19, 2021 at 09:09:38AM +0100, Geert Uytterhoeven wrote:
> > > Let the LiteX SoC Controller register a restart handler, which resets
> > > the LiteX SoC by writing 1 to CSR_CTRL_RESET_ADDR.
> > >
> > > Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
> >
> > Thanks, this looks good to me, queued to my linux-next branch.
> >
> > -Stafford
> >
> > > @@ -66,8 +71,19 @@ static int litex_check_csr_access(void __iomem *reg_addr)
> > >
> > >  struct litex_soc_ctrl_device {
> > >     void __iomem *base;
> > > +   struct notifier_block reset_nb;
> > >  };
> > >
> > > +static int litex_reset_handler(struct notifier_block *this, unsigned long mode,
> > > +                          void *cmd)
> > > +{
> > > +   struct litex_soc_ctrl_device *soc_ctrl_dev =
> > > +           container_of(this, struct litex_soc_ctrl_device, reset_nb);
> >
> > Nice.
> >
> > > +   litex_write32(soc_ctrl_dev->base + RESET_REG_OFF, RESET_REG_VALUE);
> > > +   return NOTIFY_DONE;
> > > +}
> > > +
>
> Actually, I tested this out on the latest (2-weeks ago) Litex and
> openrisc/for-next and it didn't seem to work correctly.
>
> I will look into it a bit closer, but if you see or can think of anything let
> me know.  Note There are a few failures below related to network services as my
> for-next kernel doesnt have a network driver (yet).

Hmmm, openrisc/for-next does have commit 131172a4a8ce3fcc ("openrisc:
restart: Call common handlers before hanging").

It's been a few years I used an OpenRISC setup.
Do you have a link to Linux on mor1kx/LiteX setup instructions?

>
> Using my buildroot rootfs: http://shorne.noip.me/downloads/or1k-glibc-rootfs.cpio.gz
>
>     # shutdown -r now
>
>     Broadcast message from root@buildroot (console) (Thu Jan  1 00:00:48 1970):
>     The system is going down for reboot NOW!
>     INIT: Switching to runlevel: 6
>     # mounting home work nfs ...
>     mount: mounting 10.0.0.27:/home/shorne/work on /home/shorne/work failed: No such device
>     enabling login for shorne ...
>     setting coredumps ...
>     Stopping dropbear sshd: FAIL
>     Stopping ntpd: FAIL
>     Nothing to do, sntp is not a daemon.
>     Stopping network: ifdown: interface lo not configured
>     ifdown: interface eth0 not configured
>     OK
>     Saving random seed: [   52.020000] random: dd: uninitialized urandom read (512 bytes read)
>     OK
>     Stopping klogd: OK
>     Stopping syslogd: start-stop-daemon: warning: killing process 51: No such process
>     FAIL
>     umount: devtmpfs busy - remounted read-only
>     umount: can't unmount /: Invalid argument
>     [   53.710000] reboot: Restarting system
>     [   54.710000] Reboot failed -- System halted
>     [   76.040000] watchdog: BUG: soft lockup - CPU#0 stuck for 22s! [reboot:131]
>     [   76.040000] CPU: 0 PID: 131 Comm: reboot Not tainted 5.11.0-rc1-00009-gff28dae0bc90 #418
>     [   76.040000] CPU #: 0
>     [   76.040000]    PC: c00050b8    SR: 0000827f    SP: c180fdb0
>     [   76.040000] GPR00: 00000000 GPR01: c180fdb0 GPR02: c180fdc0 GPR03: 0000827f
>     [   76.040000] GPR04: c0348944 GPR05: 00000000 GPR06: c180fc70 GPR07: 00000000
>     [   76.040000] GPR08: c180fdb0 GPR09: c00050b8 GPR10: c180e000 GPR11: 0000001e
>     [   76.040000] GPR12: 00000000 GPR13: 00000020 GPR14: 00000001 GPR15: 00000000
>     [   76.040000] GPR16: 00000000 GPR17: c02e48d4 GPR18: 00418958 GPR19: c02e48d4
>     [   76.040000] GPR20: 00000000 GPR21: 00000000 GPR22: c02e4018 GPR23: fffffffe
>     [   76.040000] GPR24: ffffffff GPR25: 00000000 GPR26: 00000000 GPR27: 00000000
>     [   76.040000] GPR28: 00000000 GPR29: ffffffff GPR30: 00000000 GPR31: ffffffff
>     [   76.040000]   RES: 0000001e oGPR11: ffffffff
>     [   76.040000] Process reboot (pid: 131, stackpage=c180a000)
>     [   76.040000]
>     [   76.040000] Stack:
>     [   76.040000] Call trace:
>     [   76.040000] [<(ptrval)>] machine_restart+0x44/0x5c
>     [   76.040000] [<(ptrval)>] kernel_restart+0x78/0xa4
>     [   76.040000] [<(ptrval)>] ? mutex_lock+0x24/0x50
>     [   76.040000] [<(ptrval)>] __do_sys_reboot+0x1a8/0x21c
>     [   76.040000] [<(ptrval)>] ? do_filp_open+0x40/0xa0
>     [   76.040000] [<(ptrval)>] ? slab_free_freelist_hook+0x6c/0x14c
>     [   76.040000] [<(ptrval)>] ? arch_local_irq_save+0x24/0x3c
>     [   76.040000] [<(ptrval)>] ? kmem_cache_free+0x130/0x194
>     [   76.040000] [<(ptrval)>] ? call_rcu+0x50/0x8c
>     [   76.040000] [<(ptrval)>] ? __fput+0x2d0/0x2f4
>     [   76.040000] [<(ptrval)>] ? do_sys_openat2+0xd8/0x134
>     [   76.040000] [<(ptrval)>] ? task_work_run+0xbc/0xf4
>     [   76.040000] [<(ptrval)>] ? do_work_pending+0x60/0x12c
>     [   76.040000] [<(ptrval)>] sys_reboot+0x14/0x24
>     [   76.040000] [<(ptrval)>] ? _syscall_return+0x0/0x4
>
>
> -Stafford



-- 
Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

WARNING: multiple messages have this Message-ID (diff)
From: Geert Uytterhoeven <geert@linux-m68k.org>
To: Stafford Horne <shorne@gmail.com>
Cc: Mateusz Holenko <mholenko@antmicro.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Gabriel Somlo <gsomlo@gmail.com>, Joel Stanley <joel@jms.id.au>,
	linux-riscv <linux-riscv@lists.infradead.org>,
	Karol Gugala <kgugala@antmicro.com>
Subject: Re: [PATCH v4] drivers/soc/litex: Add restart handler
Date: Wed, 20 Jan 2021 09:20:39 +0100	[thread overview]
Message-ID: <CAMuHMdVpogc=oEgCCq8N__RJkujJX47OaZZcyaRgjSJV2+SZ-Q@mail.gmail.com> (raw)
In-Reply-To: <20210119221110.GM2002709@lianli.shorne-pla.net>

Hi Stafford,

On Tue, Jan 19, 2021 at 11:11 PM Stafford Horne <shorne@gmail.com> wrote:
> On Wed, Jan 20, 2021 at 06:34:44AM +0900, Stafford Horne wrote:
> > On Tue, Jan 19, 2021 at 09:09:38AM +0100, Geert Uytterhoeven wrote:
> > > Let the LiteX SoC Controller register a restart handler, which resets
> > > the LiteX SoC by writing 1 to CSR_CTRL_RESET_ADDR.
> > >
> > > Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
> >
> > Thanks, this looks good to me, queued to my linux-next branch.
> >
> > -Stafford
> >
> > > @@ -66,8 +71,19 @@ static int litex_check_csr_access(void __iomem *reg_addr)
> > >
> > >  struct litex_soc_ctrl_device {
> > >     void __iomem *base;
> > > +   struct notifier_block reset_nb;
> > >  };
> > >
> > > +static int litex_reset_handler(struct notifier_block *this, unsigned long mode,
> > > +                          void *cmd)
> > > +{
> > > +   struct litex_soc_ctrl_device *soc_ctrl_dev =
> > > +           container_of(this, struct litex_soc_ctrl_device, reset_nb);
> >
> > Nice.
> >
> > > +   litex_write32(soc_ctrl_dev->base + RESET_REG_OFF, RESET_REG_VALUE);
> > > +   return NOTIFY_DONE;
> > > +}
> > > +
>
> Actually, I tested this out on the latest (2-weeks ago) Litex and
> openrisc/for-next and it didn't seem to work correctly.
>
> I will look into it a bit closer, but if you see or can think of anything let
> me know.  Note There are a few failures below related to network services as my
> for-next kernel doesnt have a network driver (yet).

Hmmm, openrisc/for-next does have commit 131172a4a8ce3fcc ("openrisc:
restart: Call common handlers before hanging").

It's been a few years I used an OpenRISC setup.
Do you have a link to Linux on mor1kx/LiteX setup instructions?

>
> Using my buildroot rootfs: http://shorne.noip.me/downloads/or1k-glibc-rootfs.cpio.gz
>
>     # shutdown -r now
>
>     Broadcast message from root@buildroot (console) (Thu Jan  1 00:00:48 1970):
>     The system is going down for reboot NOW!
>     INIT: Switching to runlevel: 6
>     # mounting home work nfs ...
>     mount: mounting 10.0.0.27:/home/shorne/work on /home/shorne/work failed: No such device
>     enabling login for shorne ...
>     setting coredumps ...
>     Stopping dropbear sshd: FAIL
>     Stopping ntpd: FAIL
>     Nothing to do, sntp is not a daemon.
>     Stopping network: ifdown: interface lo not configured
>     ifdown: interface eth0 not configured
>     OK
>     Saving random seed: [   52.020000] random: dd: uninitialized urandom read (512 bytes read)
>     OK
>     Stopping klogd: OK
>     Stopping syslogd: start-stop-daemon: warning: killing process 51: No such process
>     FAIL
>     umount: devtmpfs busy - remounted read-only
>     umount: can't unmount /: Invalid argument
>     [   53.710000] reboot: Restarting system
>     [   54.710000] Reboot failed -- System halted
>     [   76.040000] watchdog: BUG: soft lockup - CPU#0 stuck for 22s! [reboot:131]
>     [   76.040000] CPU: 0 PID: 131 Comm: reboot Not tainted 5.11.0-rc1-00009-gff28dae0bc90 #418
>     [   76.040000] CPU #: 0
>     [   76.040000]    PC: c00050b8    SR: 0000827f    SP: c180fdb0
>     [   76.040000] GPR00: 00000000 GPR01: c180fdb0 GPR02: c180fdc0 GPR03: 0000827f
>     [   76.040000] GPR04: c0348944 GPR05: 00000000 GPR06: c180fc70 GPR07: 00000000
>     [   76.040000] GPR08: c180fdb0 GPR09: c00050b8 GPR10: c180e000 GPR11: 0000001e
>     [   76.040000] GPR12: 00000000 GPR13: 00000020 GPR14: 00000001 GPR15: 00000000
>     [   76.040000] GPR16: 00000000 GPR17: c02e48d4 GPR18: 00418958 GPR19: c02e48d4
>     [   76.040000] GPR20: 00000000 GPR21: 00000000 GPR22: c02e4018 GPR23: fffffffe
>     [   76.040000] GPR24: ffffffff GPR25: 00000000 GPR26: 00000000 GPR27: 00000000
>     [   76.040000] GPR28: 00000000 GPR29: ffffffff GPR30: 00000000 GPR31: ffffffff
>     [   76.040000]   RES: 0000001e oGPR11: ffffffff
>     [   76.040000] Process reboot (pid: 131, stackpage=c180a000)
>     [   76.040000]
>     [   76.040000] Stack:
>     [   76.040000] Call trace:
>     [   76.040000] [<(ptrval)>] machine_restart+0x44/0x5c
>     [   76.040000] [<(ptrval)>] kernel_restart+0x78/0xa4
>     [   76.040000] [<(ptrval)>] ? mutex_lock+0x24/0x50
>     [   76.040000] [<(ptrval)>] __do_sys_reboot+0x1a8/0x21c
>     [   76.040000] [<(ptrval)>] ? do_filp_open+0x40/0xa0
>     [   76.040000] [<(ptrval)>] ? slab_free_freelist_hook+0x6c/0x14c
>     [   76.040000] [<(ptrval)>] ? arch_local_irq_save+0x24/0x3c
>     [   76.040000] [<(ptrval)>] ? kmem_cache_free+0x130/0x194
>     [   76.040000] [<(ptrval)>] ? call_rcu+0x50/0x8c
>     [   76.040000] [<(ptrval)>] ? __fput+0x2d0/0x2f4
>     [   76.040000] [<(ptrval)>] ? do_sys_openat2+0xd8/0x134
>     [   76.040000] [<(ptrval)>] ? task_work_run+0xbc/0xf4
>     [   76.040000] [<(ptrval)>] ? do_work_pending+0x60/0x12c
>     [   76.040000] [<(ptrval)>] sys_reboot+0x14/0x24
>     [   76.040000] [<(ptrval)>] ? _syscall_return+0x0/0x4
>
>
> -Stafford



-- 
Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

  reply	other threads:[~2021-01-20  8:26 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-19  8:09 [PATCH v4] drivers/soc/litex: Add restart handler Geert Uytterhoeven
2021-01-19  8:09 ` Geert Uytterhoeven
2021-01-19  8:17 ` Anup Patel
2021-01-19  8:17   ` Anup Patel
2021-01-20  8:21   ` Geert Uytterhoeven
2021-01-20  8:21     ` Geert Uytterhoeven
2021-01-19 21:34 ` Stafford Horne
2021-01-19 21:34   ` Stafford Horne
2021-01-19 22:11   ` Stafford Horne
2021-01-19 22:11     ` Stafford Horne
2021-01-20  8:20     ` Geert Uytterhoeven [this message]
2021-01-20  8:20       ` Geert Uytterhoeven
2021-01-20 13:06       ` Stafford Horne
2021-01-20 13:06         ` Stafford Horne
2021-01-20 21:46 ` Joel Stanley
2021-01-20 21:46   ` Joel Stanley

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='CAMuHMdVpogc=oEgCCq8N__RJkujJX47OaZZcyaRgjSJV2+SZ-Q@mail.gmail.com' \
    --to=geert@linux-m68k.org \
    --cc=gsomlo@gmail.com \
    --cc=joel@jms.id.au \
    --cc=kgugala@antmicro.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=mholenko@antmicro.com \
    --cc=shorne@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.