mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* Issue CPU instructions to start watchdog?
@ 2020-01-20 11:33 Frederick Gotham
  2020-01-20 15:05 ` Ahmad Fatoum
  0 siblings, 1 reply; 2+ messages in thread
From: Frederick Gotham @ 2020-01-20 11:33 UTC (permalink / raw)
  To: barebox

I'm developing an embedded Linux device, and I'm using Barebox as a
part of Buildroot. The CPU is x64 with 4 cores, and it has an Intel
TCO watchdog timer.

The exact processor I'm using is the Intel Silver N5000, and the
datasheet for it says:
"TCO_TMR is the watchdog timer provided by the ACPI block. It is used
by an OS monitor for OS crashes."

When I boot up Barebox, it does not have the file "/dev/watchdog".
I've tried a few different things but I just simply can't get Barebox
to recognise the Intel watchdog timer.

Ideally I would like to have the watchdog timer start running at Power
On, however my current BIOS  hasn't got any watchdog settings, and so
until I get a new BIOS (which might never happen), I have to start the
watchdog timer from within Barebox in order to get the device to
reboot if the Linux kernel freezes while it's loading.

At this stage I think I might actually have to write assembler to
issue instructions to the CPU to start the Watchdog timer. I have
looked this up and it's definitely not straight-forward, e.g.
interfacing with the ACPI block and its registers... I would be pretty
much writing a device driver.

Anyone got any ideas?

I really need my device to reboot if the Linux kernel freezes while loading.

Frederick

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Issue CPU instructions to start watchdog?
  2020-01-20 11:33 Issue CPU instructions to start watchdog? Frederick Gotham
@ 2020-01-20 15:05 ` Ahmad Fatoum
  0 siblings, 0 replies; 2+ messages in thread
From: Ahmad Fatoum @ 2020-01-20 15:05 UTC (permalink / raw)
  To: cauldwell.thomas, barebox

Hello Thomas/Frederick,

On 1/20/20 12:33 PM, Frederick Gotham wrote:
> I'm developing an embedded Linux device, and I'm using Barebox as a
> part of Buildroot. The CPU is x64 with 4 cores, and it has an Intel
> TCO watchdog timer.
> 
> The exact processor I'm using is the Intel Silver N5000, and the
> datasheet for it says:
> "TCO_TMR is the watchdog timer provided by the ACPI block. It is used
> by an OS monitor for OS crashes."
> 
> When I boot up Barebox, it does not have the file "/dev/watchdog".
> I've tried a few different things but I just simply can't get Barebox
> to recognise the Intel watchdog timer.
Upstream barebox has no iTCO driver.
> Ideally I would like to have the watchdog timer start running at Power
> On, however my current BIOS  hasn't got any watchdog settings, and so
> until I get a new BIOS (which might never happen), I have to start the
> watchdog timer from within Barebox in order to get the device to
> reboot if the Linux kernel freezes while it's loading.
Ok.
> At this stage I think I might actually have to write assembler to
> issue instructions to the CPU to start the Watchdog timer. I have
> looked this up and it's definitely not straight-forward, e.g.
> interfacing with the ACPI block and its registers... I would be pretty
> much writing a device driver.
Yes, it needs a device driver. All the assembly you need is wrapped
in macros though, so you can write it completely in C, like nearly
all other drivers.
> Anyone got any ideas?
Check out my iTCO driver here:
https://github.com/a3f/barebox/tree/itco

I haven't posted it for upstream inclusion yet, because I don't have
a suitable target to test it on. In QEMU, it works, but the NO_REBOOT bit
that controls system restart doesn't work yet and I haven't yet managed
to find the time to debug it (or the project that needs it).

It doesn't use direct IO ports/IO memory access, but instead uses the PCI
Device I/O routines provided by EFI. The IO memory writes to enable the
NO_REBOOT give me an INVALID_PARAMETER error under QEMU.

Only two variants of the iTCO are supported. You can port support for your
variant from the Linux kernel code. It should be straight forward to port.

Note that you shouldn't use {read,write,out}[lwb], but the wrappers with
itco_ in front.

Happy Hacking,
Ahmad

> 
> I really need my device to reboot if the Linux kernel freezes while loading.
> 
> Frederick
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 
-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-01-20 15:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-20 11:33 Issue CPU instructions to start watchdog? Frederick Gotham
2020-01-20 15:05 ` Ahmad Fatoum

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox