The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
From: Warner Losh <imp@bsdimp.com>
To: Paul Ruizendaal <pnr@planet.nl>
Cc: The Unix Historical Society <tuhs@tuhs.org>
Subject: [TUHS] Re: Porting the SysIII kernel: boot, config & device drivers
Date: Sat, 31 Dec 2022 20:08:55 -0700	[thread overview]
Message-ID: <CANCZdfriOT4AJZfaL5YDY+J2tOdttthLTozp5Z-VbPK0tPbAtQ@mail.gmail.com> (raw)
In-Reply-To: <45C94BFE-693D-4D86-8E4A-8DCC8C88774C@planet.nl>

[-- Attachment #1: Type: text/plain, Size: 6199 bytes --]

On Sat, Dec 31, 2022 at 1:03 PM Paul Ruizendaal <pnr@planet.nl> wrote:

>
>
> > On 31 Dec 2022, at 15:59, Dan Cross <crossd@gmail.com> wrote:
> >
> > On Fri, Dec 30, 2022 at 1:26 PM Paul Ruizendaal <pnr@planet.nl> wrote:
> >> [snip]
> >> It would seem that the next step for Unix in the area of boot, config
> and device drivers came with Sun’s OpenBoot in 1988 or so. This also
> appears to be the first appearance of device trees to describe the hardware
> to the bios and the kernel. Moreover, it would seem to me that OpenBoot is
> a spiritual ancestor of the modern Risc-V SBI specification. Maybe by 1988
> the IO hardware had become sufficiently complex and/or diverse to warrant a
> break from tradition?
> >>
> >> Was there any other notable Unix work on better organising the boot
> process and the device drivers prior to OpenBoot?
> >
> > I think that BSD supported autoconfiguration on the VAX well before
> > OpenBoot; the OpenBSD man page says it dates from 4.1 (1981) and was
> > revamped in 4.4.
>
> That is interesting. Are you referring to this:
> https://www.tuhs.org/cgi-bin/utree.pl?file=4.1cBSD/a/sys/conf
> https://www.tuhs.org/cgi-bin/utree.pl?file=4.1cBSD/usr/man/man8/config.8
>
> Or is auto configuration something else?
>
> > SBI was/is an attempt to define a common interface to different
> > devices using RISC-V CPUs, but it's growing wildly and tending more
> > towards UEFI+ACPI than something like OpenBoot, which was much
> > simpler.
> >
> > In general, the idea of a BIOS isn't terrible: provide an interface
> > that decouples the OS and hardware. But in practice, no one has come
> > up with a particularly good set of interfaces yet. Ironically,
> > BSD-style autoconfig might have been the best yet.
>
> When it comes to abstracting devices, it would seem to me that virtio has
> gotten quite some traction in the last decade.
>
> Looking at both the systems of 40 years ago and the Risc-V SoC’s of last
> year, I could imagine something like:
>
> - A simple SBI, like the Berkeley Boot Loader (BBL) without the proxy
> kernel & host interface
> - Devices presented to the OS as virtio devices
> - MMU abstraction somewhat similar in idea to that in SYSV/68 [1]
>

Let's not forget that the diversity of systems is 1000s of times greater
than it was in the early days of Unix. There were just two busses (Unibus
and QBUS) in pdp-11 unix. There were a limited number of peripherals that
could live at a limited number of CSRs and compatibility requirements of
other DEC OSes meant that most of the 3rd party cards were compatible with
DEC gear, though there were exceptions. There was no hot plug, there was no
need to hierarchically assign address pools for things like PCIe hot-plug.
There was no USB. There were only a very limited number of keyboard and
graphics configurations. VAXen increased the number, but not by a huge
amount, at least in the early days before new busses were introduced).

As such, the unixes from the system III era simply didn't have any notion
of this diversity. So trying to layer it in will be quite difficult. The
SoC space has become huge, with memory being mapped in different locations,
busses being different, etc.

There's been much nasty said about FDT and ACPI, but they do solve real
problems: how to enumerate this diversity to the OS in a way that's sane
and might not always be as simple as returning a specific number but that
requires hardware access to answer even basic questions (because, say, the
CPUs were wired this way or that and you have to read those wirings).
Linux, even in Linuxboot environments, still uses ACPI, FDT and UEFI to get
the job done, and the code there isn't horrific.

V7 unix for the PDP-11 shipped with maybe 25 drivers total for the whole
system, and many of them were quite niche...


> Together this might be a usable Unix BIOS that could have worked in the
> early 80’s. One could also think of it as a simple hypervisor for only one
> client. The remaining BBL functionality is not all that different from the
> content in mch.s on 16-bit Unix (e.g. floating point emulation for CPU’s
> that don’t have it in hardware). A virtio device is not all that different
> from the interface presented by e.g. PDP-11 ethernet devices (e.g. DELUA),
> the MMU abstraction was contemporary.
>

virtio solves a different problem, though: It's goal is to provide THE
interface for mass storage, THE interface for networking, etc so that
hypervisor clients can limit their drivers substantially and not have to
deal with the thousands of drivers normally needed. ACPI/FDT just try to
make the non-self-describing aspects of the hardware described. Which is a
different target market (so that one can hook up the right driver of the
thousands to choose from when the OS autoconfig's the devices by whatever
means it does that, even Linux and System V have this concept, though with
radically different code than the BSDs).


> High end systems could have had device hardware that implemented the
> virtio interface directly, low end systems could use simpler hardware and
> use the BIOS to present this interface via software.
>

I'd worry that 'use the BIOS' bit here leads to the ugly UEFI/ACPI hybrid
to be generic enough to describe everything.

Now, I don't disagree with the org chart args for why they are so large
outside of linuxboot, but they do fill a vacuum that would otherwise exist.

Warner


>
> [1] From mmu.h in the SYSV/68 source tree:
>
> /*
>         @(#)mmu.h       2.26
>         This is the header file for the UNIX V/68 generic
>         MMU interface. This provides the information that
>         is used by the various routines that call:
>
>         mmufork ()
>         mmuexec ()
>         mmuexit ()
>         mmuread ()
>         mmuwrite ()
>         mmuattach ()
>         mmudetach ()
>         mmuregs ()
>         mmualloc ()
>         mmuinit ()
>         mmuint ()
>
>         The above routines and secondary routines called
>         by them are contained in io/mmu1.c and io/mmu2.c.
> */
>
>
>
>
>

[-- Attachment #2: Type: text/html, Size: 7712 bytes --]

  parent reply	other threads:[~2023-01-01  3:10 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-30 18:25 [TUHS] " Paul Ruizendaal
2022-12-30 18:56 ` [TUHS] " Steve Nickolas
2022-12-31 14:59 ` Dan Cross
2022-12-31 19:08   ` Clem Cole
2022-12-31 21:10     ` Dan Cross
2022-12-31 21:39       ` Clem Cole
2022-12-31 21:52         ` Dan Cross
2022-12-31 23:25         ` Dave Horsfall
2023-01-01  1:02           ` Rob Pike
2023-01-01  1:16             ` George Michaelson
2023-01-01  1:40               ` Larry McVoy
2023-01-01  2:29                 ` Warner Losh
2023-01-01  1:24             ` Larry McVoy
2022-12-31 22:38       ` Theodore Ts'o
2022-12-31 22:55         ` Marc Donner
2023-01-01  3:55         ` Dan Cross
2023-01-01 20:29         ` Paul Ruizendaal
2023-01-01 21:26           ` G. Branden Robinson
2023-01-01 21:31             ` Rob Pike
2022-12-31 21:11     ` Paul Ruizendaal
2022-12-31 20:02   ` Paul Ruizendaal
2022-12-31 21:04     ` Warner Losh
2022-12-31 21:41     ` Dan Cross
2023-01-01  3:08     ` Warner Losh [this message]
2023-01-01  4:40       ` Dan Cross
2023-01-01  8:05     ` Jonathan Gray

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=CANCZdfriOT4AJZfaL5YDY+J2tOdttthLTozp5Z-VbPK0tPbAtQ@mail.gmail.com \
    --to=imp@bsdimp.com \
    --cc=pnr@planet.nl \
    --cc=tuhs@tuhs.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
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).