Skip to content

Commit a4aded1

Browse files
Sudan Landgezx2c4
authored andcommitted
dt-bindings: rng: Add vmgenid support
Virtual Machine Generation ID driver was introduced in commit af6b54e ("virt: vmgenid: notify RNG of VM fork and supply generation ID"), as an ACPI only device. VMGenID specification http://go.microsoft.com/fwlink/?LinkId=260709 defines a mechanism for the BIOS/hypervisors to communicate to the virtual machine that it is executed with a different configuration (e.g. snapshot execution or creation from a template). The guest operating system can use the notification for various purposes such as re-initializing its random number generator etc. As per the specs, hypervisor should provide a globally unique identified, or GUID via ACPI. This patch tries to mimic the mechanism to provide the same functionality which is for a hypervisor/BIOS to notify the virtual machine when it is executed with a different configuration. As part of this support the devicetree bindings requires the hypervisors or BIOS to provide a memory address which holds the GUID and an IRQ which is used to notify when there is a change in the GUID. The memory exposed in the DT should follow the rules defined in the vmgenid spec mentioned above. Reason for this change: Chosing ACPI or devicetree is an intrinsic part of an hypervisor design. Without going into details of why a hypervisor would chose DT over ACPI, we would like to highlight that the hypervisors that have chose devicetree and now want to make use of the vmgenid functionality cannot do so today because vmgenid is an ACPI only device. This forces these hypervisors to change their design which could have undesirable impacts on their use-cases, test-scenarios etc. The point of vmgenid is to provide a mechanism to discover a GUID when the execution state of a virtual machine changes and the simplest way to do it is pass a memory location and an interrupt via devicetree. It would complicate things unnecessarily if instead of using devicetree, we try to implement a new protocol or modify other protocols to somehow provide the same functionility. We believe that adding a devicetree binding for vmgenid is a simpler, better alternative to provide the same functionality and will allow such hypervisors as mentioned above to continue using devicetree. More references to the vmgenid specs are found below. Signed-off-by: Sudan Landge <sudanl@amazon.com> Reviewed-by: Rob Herring <robh@kernel.org> Reviewed-by: Alexander Graf <graf@amazon.com> Link: https://www.qemu.org/docs/master/specs/vmgenid.html Link: https://learn.microsoft.com/en-us/windows/win32/hyperv_v2/virtual-machine-generation-identifier Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
1 parent e076067 commit a4aded1

File tree

2 files changed

+50
-0
lines changed

2 files changed

+50
-0
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/rng/microsoft,vmgenid.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: Virtual Machine Generation ID
8+
9+
maintainers:
10+
- Jason A. Donenfeld <Jason@zx2c4.com>
11+
12+
description:
13+
Firmwares or hypervisors can use this devicetree to describe an
14+
interrupt and a shared resource to inject a Virtual Machine Generation ID.
15+
Virtual Machine Generation ID is a globally unique identifier (GUID) and
16+
the devicetree binding follows VMGenID specification defined in
17+
http://go.microsoft.com/fwlink/?LinkId=260709.
18+
19+
properties:
20+
compatible:
21+
const: microsoft,vmgenid
22+
23+
reg:
24+
description:
25+
Specifies a 16-byte VMGenID in endianness-agnostic hexadecimal format.
26+
maxItems: 1
27+
28+
interrupts:
29+
description:
30+
Interrupt used to notify that a new VMGenID is available.
31+
maxItems: 1
32+
33+
required:
34+
- compatible
35+
- reg
36+
- interrupts
37+
38+
additionalProperties: false
39+
40+
examples:
41+
- |
42+
#include <dt-bindings/interrupt-controller/arm-gic.h>
43+
rng@80000000 {
44+
compatible = "microsoft,vmgenid";
45+
reg = <0x80000000 0x1000>;
46+
interrupts = <GIC_SPI 35 IRQ_TYPE_EDGE_RISING>;
47+
};
48+
49+
...

MAINTAINERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18467,6 +18467,7 @@ M: "Theodore Ts'o" <tytso@mit.edu>
1846718467
M: Jason A. Donenfeld <Jason@zx2c4.com>
1846818468
S: Maintained
1846918469
T: git https://git.kernel.org/pub/scm/linux/kernel/git/crng/random.git
18470+
F: Documentation/devicetree/bindings/rng/microsoft,vmgenid.yaml
1847018471
F: drivers/char/random.c
1847118472
F: drivers/virt/vmgenid.c
1847218473

0 commit comments

Comments
 (0)