Skip to content

Guidelines of Virtualizing MMIO

Zero Tang edited this page Jan 25, 2023 · 1 revision

Introduction

This page briefly describes how to virtualize Memory-Mapped I/O for CVM guests.

Preparation

To handle MMIO, you should clear any page permissions for the MMIO range so that any MMIOs can be intercepted as Memory-Access interceptions.
NoirVisor implements an internal emulator. You may specify the vCPU to use the internal emulator to decode the MMIO instruction.
If the internal emulator fails to emulate the MMIO instruction you want, you may either submit an issue to NoirVisor repository or disable the internal emulator and use your own emulator to decode memory-access instructions. NoirVisor provides the raw content of the fetched instruction. When you submit the issue, please provide the raw data of the MMIO instruction.

Handling Interceptions

Any reads from or writes to the MMIO range will result in Memory-Access interceptions. User Hypervisors must emulate the instructions to obtain the contents of output or to fill in the contents of input.
The operand and instruction information is provided by NoirVisor's internal emulator. Check the exit context.
If the information is insufficient, submit an issue to NoirVisor repository.

As the User Hypervisor obtains all information, it should emulate the I/O operation properly.