I/O, I/O, It's Off To Virtual Work We Go

April 27, 2007
Virtualization in microcontrollers has progressed from memory management units (MMU) toward virtualizing the entire environment. There have been a number of attempts at getting this right in an x86 environment, starting with the 16-bit virtual machi

Virtualization in microcontrollers has progressed from memory management units (MMU) toward virtualizing the entire environment. There have been a number of attempts at getting this right in an x86 environment, starting with the 16-bit virtual machine (VM) support in the 80386. Subsequent VM enhancements have moved toward virtualizing the 32-bit and now 64-bit environments.

A hypervisor like Xen is the layer that controls the VM hardware and essentially sits between a logical VM and the hardware. The ideal hypervisor would utilize zero time and memory overhead. In practice, the current and forthcoming AMD and Intel 64-bit processor architectures are designed to minimize this overhead (see figure).

Some of the changes that will be showing up later this year include better handling of virtual memory page tables that must be changed when a VM context switch occurs. This is akin to a process switch in an operating system, but the overhead tends to be higher on the VM side. Part of the issue of this added overhead is what a VM must do to hide the fact that an operating system and its programs are running in a virtual environment. Changes within the processor architecture can address these contexts to improve performance.

VIRTUALIZING I/O
Things get a little dicier when dealing with I/O. Low-level device drivers can perform I/O by bit-banging registers. This is handy for doing things like reading the output of analog-to-digital converters or serial ports when interrupts occur. A hypervisor can take two approaches to control I/O access.

One is to trap accesses and emulate the device interface. Most systems take this approach. Hardware enhancements will let device drivers directly access devices. This improves performance since there is no intermediary, but this approach only works for some devices.

Higher-performance devices like Ethernet adapters typically use DMA controllers to offload processing by the host processor. The processor's VM support can be used to limit the access of device drivers to memory and I/O ports, but DMA controllers tend to be outside the CPU. Providing device drivers direct access to DMA controllers opens a security hole.

The answer is the I/O MMU, which is typically placed in the Northbridge subsystem that handles peripheral access. The I/O MMU is under the control of the processors, typically the hypervisor. A DMA access goes through the I/O MMU so it's accessing memory in a logical fashion instead of using a physical address.

VIRTUALIZING DEVICES
The I/O MMU isn't the end of the line for virtualization. Devices still like to be controlled by a single host. The PCISIG is working on standardizing PCI Express virtualization. These changes will result in devices that know how to handle multiple hosts. Essentially, one device looks like many. Applications can ignore the underlying details, but device driver developers will need to keep their eyes on these upcoming enhancements.

AMD www.amd.com
Intel www.intel.com
PCISIG www.pcisig.com

About the Author

William G. Wong | Senior Content Director - Electronic Design and Microwaves & RF

I am Editor of Electronic Design focusing on embedded, software, and systems. As Senior Content Director, I also manage Microwaves & RF and I work with a great team of editors to provide engineers, programmers, developers and technical managers with interesting and useful articles and videos on a regular basis. Check out our free newsletters to see the latest content.

You can send press releases for new products for possible coverage on the website. I am also interested in receiving contributed articles for publishing on our website. Use our template and send to me along with a signed release form. 

Check out my blog, AltEmbedded on Electronic Design, as well as his latest articles on this site that are listed below. 

You can visit my social media via these links:

I earned a Bachelor of Electrical Engineering at the Georgia Institute of Technology and a Masters in Computer Science from Rutgers University. I still do a bit of programming using everything from C and C++ to Rust and Ada/SPARK. I do a bit of PHP programming for Drupal websites. I have posted a few Drupal modules.  

I still get a hand on software and electronic hardware. Some of this can be found on our Kit Close-Up video series. You can also see me on many of our TechXchange Talk videos. I am interested in a range of projects from robotics to artificial intelligence. 

Sponsored Recommendations

Comments

To join the conversation, and become an exclusive member of Electronic Design, create an account today!