RE: [PATCH v7 5/5] Driver: VMBus: Add Devicetree support

From: Michael Kelley (LINUX)
Date: Sun Mar 12 2023 - 22:34:05 EST


From: Saurabh Sengar <ssengar@xxxxxxxxxxxxxxxxxxx> Sent: Thursday, February 23, 2023 3:29 AM
>
> Update the driver to support Devicetree boot as well along with ACPI.
> At present the Devicetree parsing only provides the mmio region info
> and is not the exact copy of ACPI parsing. This is sufficient to cater
> all the current Devicetree usecases for VMBus.
>
> Currently Devicetree is supported only for x86 systems.
>
> Signed-off-by: Saurabh Sengar <ssengar@xxxxxxxxxxxxxxxxxxx>
> ---
> [V7]
> - Use cpu_addr instead of bus_addr
>
> drivers/hv/Kconfig | 6 +++--
> drivers/hv/vmbus_drv.c | 57 ++++++++++++++++++++++++++++++++++++++++--
> 2 files changed, 59 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/hv/Kconfig b/drivers/hv/Kconfig
> index 0747a8f1fcee..1a55bf32d195 100644
> --- a/drivers/hv/Kconfig
> +++ b/drivers/hv/Kconfig
> @@ -4,11 +4,13 @@ menu "Microsoft Hyper-V guest support"
>
> config HYPERV
> tristate "Microsoft Hyper-V client drivers"
> - depends on ACPI && ((X86 && X86_LOCAL_APIC && HYPERVISOR_GUEST) \
> - || (ARM64 && !CPU_BIG_ENDIAN))
> + depends on (X86 && X86_LOCAL_APIC && HYPERVISOR_GUEST) \
> + || (ACPI && ARM64 && !CPU_BIG_ENDIAN)
> select PARAVIRT
> select X86_HV_CALLBACK_VECTOR if X86
> select VMAP_PFN
> + select OF if !ACPI
> + select OF_EARLY_FLATTREE if !ACPI
> help
> Select this option to run Linux as a Hyper-V client operating
> system.

One further thing occurred to me. OF_EARLY_FLATTREE really depends
on OF instead of ACPI. The ACPI dependency is indirect through OF. So
I'd suggest doing

select OF_EARLY_FLATTRE if OF

to express the direct dependency.

Separately, I wonder if the "select OF if !ACPI" is even needed. It doesn't
hurt anything to leave it, but it seems like any config that doesn't
independently select either ACPI or OF is broken for reasons unrelated
to Hyper-V. I'm OK with leaving the select of OF if you want, so I'm
more just wondering than asserting it should be removed. I didn't
see "select OF if !ACPI" anywhere else in the Kconfig files, and it
seems like Hyper-V would not be the only environment where this
is the expectation.

Michael