rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: Geert Stappers <stappers@stappers.nl>
Cc: Sven Van Asbroeck <thesven73@gmail.com>, rust-for-linux@vger.kernel.org
Subject: Re: [RFC] Short Circuit simplest Rust driver that touches real hardware?
Date: Tue, 27 Apr 2021 08:49:40 +0200	[thread overview]
Message-ID: <YIe0BM9zsPVPkrO9@kroah.com> (raw)
In-Reply-To: <20210426205810.sahdkjyeueg3miug@gpm.stappers.nl>

On Mon, Apr 26, 2021 at 10:58:10PM +0200, Geert Stappers wrote:
> On Mon, Apr 26, 2021 at 03:47:59PM -0400, Sven Van Asbroeck wrote:
> >         ...
> > 2. implement the simplest `IoMemBlock` in Rust. Since we have a live
> > `struct device *`, the `IoMemBlock` constructor can simply call
> > `devm_platform_get_and_ioremap_resource(our struct device *)` in C,
> > which will automatically use the right method to retrieve the `void
> > __iomem *`: devicetree, platform data, etc, we don't have to care.
> > 3. use the `IoMemBlock` above to implement a trivial iomem-only driver
> > as a module. A few possible candidates:
> > * h/w random number generator in Raspberry Pi Zero: `brcm,bcm2835-rng`
> > * SoC thermal sensor in Raspberry Pi Zero: `brcm,bcm2835-thermal`
> > 4. we don't have `hwrng` or `thermal_hwmon` devices in Rust yet, but
> > we could perhaps expose this as a `misc_device`, which is something we
> > already have. A single temp or randnum readout might do the trick.
> > 
> > The Raspberry Pi Zero can be purchased for $10. There is [QEMU
> > support](https://qemu.readthedocs.io/en/latest/system/arm/raspi.html)
> > for the peripherals above.
> > 
> > Feedback and ideas welcome !
> 
> Hope that hardware manufactures see this opportunity.  Because I fear that
> this cool project might get botched due lack of knowledge on hardware.
> 
> 
> Implementing kernel module for 8250 UART in Rust is something that
> wouldn't get botched due lack of hardware knowledge.

Uarts are anything but simple, sorry, look at how "big" the kernel
driver is in C for the 8250 support.

And yes, I recommend doing a "simple" driver that touches the hardware,
there's no reason not to duplicate one of the existing C drivers, in
fact, it makes more sense so that people can help understand the
comparison between the ways the two languages will work.

thanks,

greg k-h

      parent reply	other threads:[~2021-04-27  6:49 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-26 19:47 Sven Van Asbroeck
2021-04-26 20:22 ` Miguel Ojeda
2021-04-26 20:58 ` Geert Stappers
2021-04-26 21:11   ` Sven Van Asbroeck
2021-04-27  8:17     ` Geert Stappers
2021-04-27  6:49   ` Greg KH [this message]

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=YIe0BM9zsPVPkrO9@kroah.com \
    --to=greg@kroah.com \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=stappers@stappers.nl \
    --cc=thesven73@gmail.com \
    --subject='Re: [RFC] Short Circuit simplest Rust driver that touches real hardware?' \
    /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

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).