Skip to content

Open Source Citrix Windows PV Drivers

Paul Durrant

Supply ChainThe Linux Foundation28 minOpen on YouTube ↗

Details open Source Citrix Windows PV Drivers and evaluates key implications for security practitioners.

Summary

## Overview

This talk presents the evolution and open-sourcing of Citrix's Windows PV (paravirtualized) drivers for XenServer, delivered by a principal software engineer from Citrix's XenServer group. The speaker covers the historical development from XenServer 6.0 through 6.1, the architectural redesign, the decision to open-source, and practical guidance for building and deploying the drivers.

## Why PV Drivers Matter

HVM guests using emulated devices face severe limitations: only 3 IDE disks (the 4th IDE slot reserved for CD-ROM), 8 100Mbps Realtek network devices, and slow emulation via IO port trapping and memory IO page faults. PV drivers eliminate these constraints by massively reducing VM exits, removing disk/network limits, and enabling reliable cooperative suspension and migration. This is particularly critical for compatibility—the code uses Realtek emulation because it's the only inbox driver Windows XP supports.

## Driver Architecture Evolution

The original XenServer 6.0 structure was complex: drivers hung off two parents (a routine-rated node created by installer and a synthesized PCI device), with interfaces split oddly between utility and interventions packages. This created cross-package dependencies making upgrades fragile. The new 6.1 architecture simplified to a single Zen parent node with cleaner separation: Zen (core interface library), Zen bus (Xen store communication and enumeration), storage drivers using StorPort instead of ScsiPort, and a Zen filter driver for emulated device unplugging.

## Open-Sourcing and Upstream Strategy

Drivers were open-sourced on GitHub under BSD 2-clause license (GPL was rejected because Microsoft's logo test agreement prohibits GPL drivers). However, the original implementation created problems: the Citrix kemel created custom PCI device IDs requiring patches, and build scripts assumed Citrix code-signing certificates. The solution was "upstream drivers" using existing emulated device unplugging mechanisms from Qemu (supporting kernels 3.4+), making them compatible with any hypervisor and avoiding forced Windows Update installation. Drivers bind to both old (emulated) and new (upstream PCI) device IDs; only new IDs receive Windows Update drivers, giving users control.

## Technical Implementation

The driver stack uses runtime discoverable interfaces via query_interface calls cascading through the device hierarchy. Zen bus implements most interfaces including store access, device unplugging detection (critical to prevent simultaneous PV/emulated storage), and network state management. Convenience macros wrap reference counting for power management. The stack requires careful coordination: emulated device unplugging was previously broken when netback relied on udev; the speaker submitted patches to fix this in Linux 3.12+.

## Building and Installation

Requirements: Visual Studio (paid version; Express Edition insufficient), Windows 8 WDK, Python 3.2+. Build scripts wrap msbuild; users must set environment variables specifying kit location, Visual Studio path, and symbol output directory. Installation is straightforward: either point Device Manager at driver INF files or run a redistributable installer executable. Critical for 64-bit VMs: test signing mode must be enabled before installing Xen PV drivers (required by file integrity checks). Test certificates are provided in each repository (PFX files, no password).

## Tested Compatibility

Upstream drivers tested on ARM and x86 from kernel 3.4 through 4.4 with 32-bit and 64-bit Debian dom0s. The only issue encountered was netback relying on udev for device reinsertion; patches submitted to stable branches (3.10+). Code is available in upstream branches of each GitHub repository; folding to master was pending final internal XenServer QA completion.

## Future Directions

Planned work includes: PV HID (addressing scaling tied to VNC console size and adding support for absolute coordinates and multi-touch), PV USB (currently no good passthrough story; occasional user requests), and potentially coordinating with upstream projects. The speaker noted that Windows PV USB might aid in upstreaming GNU/Linux USB backend work.

Related talks