[Tech] Extending RISC-V core capabilities with virtualization support

Virtualization, as a term, appeared in the 1960s and at the time it was used to refer to the concept of dividing a mainframe resources between different Applications. Nowadays, it refers to creating a virtual machine, a software that emulates a real computer with its own operative system.

These virtual machines offer numerous advantages over their bare metal counterparts, such as being easy to deploy on different hardware configurations, and allowing a single machine to run many virtual machines. All cloud services (e.g. Amazon Web Services, Microsoft Azure, Google Cloud) use virtualization extensively [1,2].

However, virtualization itself can be quite slow if managed entirely via software. Consequently, most commercial CPU's offer hardware support to accelerate virtualization. This is done by implementing a Hardware level Hypervisor (a.k.a. bare metal hypervisor). A Hypervisor allows a computer system to run multiple guest virtual Machines inside one Host System.

In DRAC, we implemented the H (Hypervisor) extension as specified by the RISC-V Foundation [3]. The figure below describes the main additions to the baseline RISC-V ISA (i.e. without the hypervisor extensions).  The baseline RISC-V core has just three execution modes (Machine, Supervisor and User), whereas the hypervisor extension adds a Supervisor mode (S-mode), and then two virtualization modes (Virtualized supervisor and Virtualized User).

.

 

principals addicions a la línia base de RISC-V ISA

 

The Hypervisor Extension aims to improve virtualization performance, mainly by reducing the number of interrupts and exceptions that need to be handled by the Host OS. The approach taken is to virtualize the supervisor mode (S mode), replacing the existing supervisor mode into a Hypervisor-extended supervisor mode (HS mode) and adding both virtual user mode (VU mode) and virtual supervisor mode (VS mode). Additionally, a second stage is added to the address translation mechanism, virtualizing the memory and memory mapped I/O devices for the guest OS.

===

[1] Mahesh Chand, “Top 10 Cloud Service Providers In 2021”, https://www.c-sharpcorner.com/article/top-10-cloud-service-providers/

[2] Infopulse, “What is the Role of Virtualization in Cloud-based Services?, https://www.infopulse.com/blog/what-is-the-role-of-virtualization-in-cloud-based-services/

[3] Andrew Waterman, Krste Asanovic (editors), “The RISC-V Instruction Set Manual Volume II: Privileged Architecture”, Document Version 20190608-Priv-MSU-Ratified, https://github.com/riscv/riscv-isa-manual/releases/download/Ratified-IMFDQC-and-Priv-v1.11/riscv-privileged-20190608.pdf