[PATCH v1 0/4] virt: vmgenid: Add devicetree bindings support

Sudan Landge
2024-03-19T14:33:14Z

This small series of patches aims to add devicetree bindings support for
the Virtual Machine Generation ID (vmgenid) driver.

Virtual Machine Generation ID driver was introduced in commit af6b54e2b5ba
("virt: vmgenid: notify RNG of VM fork and supply generation ID") as an
ACPI only device.
We would like to extend vmgenid to support devicetree bindings because:
1. A device should not be defined as an ACPI or DT only device.
2. Technically there's no issue with adding devicetree support to vmgenid.
3. This would allow Hypervisors to use vmgenid without the need to
enable ACPI. This is important for hypervisors that want to
keep things minimalistic and enable ACPI only when they have
no other alternative.

While adding the devicetree support we considered re-using existing
structures/code to avoid duplication code and reduce maintenance; so,
we used the same driver to be configured either by ACPI or by DT.
This also meant reimplementing the existing vmgenid ACPI bus driver as a
platform driver and making it discoverable using `driver.of_match_table`
and `driver.acpi_match_table`.

There is no user impact or change in vmgenid functionality when used
with ACPI. We verified ACPI support of these patches on X86 and DT
support on ARM using Firecracker hypervisor
https://github.com/firecracker-microvm/firecracker.

To check schema and syntax errors, the bindings file is verified with:
```
make dt_binding_check \
DT_SCHEMA_FILES=Documentation/devicetree/bindings/vmgenid/vmgenid.yaml
```
and the patches were verified with:
`scripts/checkpatch.pl --strict v1-000*`.

Sudan Landge (4):
virt: vmgenid: rearrange code to make review easier
virt: vmgenid: change implementation to use a platform driver
dt-bindings: Add bindings for vmgenid
virt: vmgenid: add support for devicetree bindings

.../devicetree/bindings/vmgenid/vmgenid.yaml | 57 +++++
MAINTAINERS | 1 +
drivers/virt/Kconfig | 2 +-
drivers/virt/vmgenid.c | 197 ++++++++++++++----
4 files changed, 221 insertions(+), 36 deletions(-)
create mode 100644 Documentation/devicetree/bindings/vmgenid/vmgenid.yaml

--
2.40.1