Re: [PATCH 5/5] hyperv: Use hvhdk.h instead of hyperv-tlfs.h in Hyper-V code

From: Nuno Das Neves
Date: Fri Oct 04 2024 - 20:08:20 EST


On 10/4/2024 8:58 AM, Stanislav Kinsburskii wrote:
> Hi Nuno,
>
> On Thu, Oct 03, 2024 at 12:51:04PM -0700, Nuno Das Neves wrote:
>> diff --git a/arch/arm64/hyperv/hv_core.c b/arch/arm64/hyperv/hv_core.c
>> index 9d1969b875e9..bb7f28f74bf4 100644
>> --- a/arch/arm64/hyperv/hv_core.c
>> +++ b/arch/arm64/hyperv/hv_core.c
>> @@ -14,6 +14,7 @@
>> #include <linux/arm-smccc.h>
>> #include <linux/module.h>
>> #include <asm-generic/bug.h>
>> +#define HYPERV_NONTLFS_HEADERS
>> #include <asm/mshyperv.h>
>>
>
> Perhaps it would be cleaner to introduce a new header file to be
> included, containing the new define and including <asm/mshyperv.h> instead.
>
> Stas

If I understand correctly, you're suggesting adding another stub named e.g.
"hv_mshyperv.h", containing:

#define HYPERV_NONTLFS_HEADERS
#include<asm/mshyperv.h>

Then in the roughly 24 places in this patch where we have:

+#define HYPERV_NONTLFS_HEADERS

Instead, we'd have:

-#include <asm/mshyperv.h>
+#include <hyperv/hv_mshyperv.h>

I suppose the current version is a bit opaque - it's not immediately clear
why HYPERV_NONTLFs_HEADERS is defined, and that it must be defined before
including asm/mshyperv.h - someone reading the code would have to go find
hv_defs.h to puzzle that out.

This improves the situation slightly by associating the #define with
asm/mshyperv.h. I'll consider it for v2, thanks!

Nuno