This work was published at the IEEE/ACM Workshop on Computer Architecture Education (WCAE’2021). You can read the paper here and/or watch the presentation video if you’re interested in learning more. This article is a very brief summary of the paper.
Last summer, I started the development of an educational operating system. I routinely teach ECS 150, the undergrad OS course at UC Davis, and I’ve always liked the approach that the MIT seems to have in their undergrad OS course; they have an in-house OS called xv6 derived from the venerable Unix V6, which they use as teaching artifact. I wanted to replicate the same kind of idea, but using a more modern approach, by starting from an early version of Linux instead. But anyway… during the development I hit a road block.
In order to create an OS, you need a hardware platform that the OS will run onto. I started the development using a RISC-V based hardware platform defined by an old version of TinyEMU, which was called RISCVEMU. Turns out that this platform is actually very similar to the default RISC-V platform implemented by QEMU, which is what MIT use for their xv6 OS!
But long story short, this hardware platform is not education friendly. It
uses a mix of real I/O devices, such as the
CLINT (the timer device), or the
PLIC (the programmable interrupt controller), as well as some virtual devices
from the VirtIO collection, such as the
virtio-blk (for providing second-level
storage), all of which are too complicated to explain to students and require
the implementation of complex device drivers in the OS.
I looked around and didn’t find well-designed collection of devices to use in my hardware platform, so I decided to create one: the LupIO collection!
LupIO is an open-source collection of I/O devices which are designed to be education-friendly from the ground up. The goal is that some of these devices can be used by students as early as their first computer organization course (such as ECS 50 at UC Davis). At the same time, the collection must be complete enough that one can build simple, yet powerful multiprocessor hardware platforms, which can be used in graduate courses.
LupIO currently defines 7 devices for simple monoprocessor systems: a timer, a programmable interrupt controller (PIC) , a terminal (TTY), a block device, a real-time clock (RTC), a random-number generator, and a system controller.
LupIO supports multiprocessor systems by allowing certain devices to duplicate their interface (timer and PIC), in such a way that each processor gets its own private instance, and by introducing an eighth device to the collection: an interprocessor interrupt (IPI) controller.
One of the main reason for which LupIO is education-friendly is that the register map of each device was designed with great care. For example, registers are neatly separated by type (data vs control vs status) and they are consistently organized across devices (i.e., when applicable, they always appear in the same order).
The following figure shows the different devices of the collection:
All the specifications can be found here: https://gitlab.com/luplab/lupio/lupio-specs
In order to make sure that the specifications of the LupIO devices was sound, I implemented them as virtual devices in QEMU, the famous open-source machine emulator. I also developed device drivers in the Linux kernel.
This prototyping phase allowed me to find a few flaws in the specifications, but after a few iterations, I was able to successfully boot Linux on a RISC-V based dual-core hardware platform entirely equipped with LupIO devices!
Now begins what is probably the most difficult phase of this project: advertise it to the community and convince people it should become the standard of educational I/O devices.
As part of this push, I am currently working on implementing LupIO in other simulators and emulators. For example, Jason Lowe-Power and I just recruited two undergraduate students who will implement LupIO in the gem5, the popular research-oriented simulator for computer architecture.
Stay tuned for more!