AMD Zen 4 CPUs to support Virtual NMI (VNMI) for efficiency optimization

On Thursday, AMD released an open-source patch for the Linux kernel that would enable Virtual NMI, or Non-Maskable Interrupt, support on its Zen 4 CPUs. This particular feature for the processor in Linux OS is something that rival Intel has been supporting with its CPUs for well over the last decade.

AMD Zen 4 CPUs will support VNMI for their new CPUs to enable virtualization, which competitor Intel has offered support for over the past decade

The VNMI support allows the CPU ID to detect the feature, but due to AMD’s severely delayed release, it’s possible that the company decided not to fully implement it until the new Zen 4 architecture later this year .

AYANEO brings AMD RDNA 2 to another handheld gaming console: Meet AYANEO 2 Geek Gaming with up to 8 Core Ryzen 6000U APUs

AMD’s Santosh Shukla summarizes the company’s Virtual NMI implementation below:

Currently, NMI is delivered to the guest using Event Injection mechanism. The event injection mechanism does not block the delivery of subsequent NMIs. Therefore, the hypervisor must track the NMI delivery and its completion (by intercepting IRET) before sending a new NMI.

Virtual NMI (VNMI) allows the hypervisor to inject the NMI into the guest without using the event injection mechanism, meaning there is no need to track the guest NMI and intercept the IRET. To achieve this, the VNMI function provides virtualized NMI and NMI_MASK capability bits
VMCB intr_control –
V_NMI(11) – Indicates whether a virtual NMI is pending in the guest.
V_NMI_MASK(12) – Indicates whether virtual NMI is masked in the guest.
V_NMI_ENABLE(26) – Enables the NMI virtualization feature for the guest.

When hypervisor wants to inject NMI, it sets V_NMI bit, processor clears V_NMI bit and sets V_NMI_MASK, which means guest is processing NMI. After the guest has processed the NMI, the processor clears the V_NMI_MASK upon successful completion of IRET instruction or if VMEXIT occurs while the virtual NMI is being delivered.

Phoronix’s Michael Larabel explains that the VNMI is only useful for optimizing efficiency in AMD’s own virtualized guests that don’t need to follow the NMI state themselves, without concerns about intercepting the interrupt return or IRET when the NMI processing is complete. Intel had this usage for virtualization as early as 2008 on Linux platforms.

AMD’s inclusion now suggests that the new set of patches will see action in the next Zen 4-powered Ryzen 7000 series alongside the company’s EPYC 7004 series.

News Sources: Phoronix, Linux kernel info page,

About Willie Ash

Check Also

Ubuntu running on a Google Nest Hub, wait a minute?

I just discovered a story about Ubuntu running on a Google Nest Hub (2nd gen). …