Re: [PATCH v3 1/5] hyperv: Define struct hv_output_get_vp_registers

From: Roman Kisel
Date: Fri Dec 27 2024 - 12:25:31 EST




On 12/26/2024 2:11 PM, Easwar Hariharan wrote:
On 12/26/2024 1:31 PM, Roman Kisel wrote:

[...]

+#else
+ #error "This architecture is not supported"
+#endif
+};

I don't love the #error for unsupported architectures when Kconfig takes
care of that for us, but I suppose it's for completeness since the arm64
members have to be conditioned on CONFIG_ARM64?

Felt right to do that, but because it raises questions, it should carry
a comment or be removed as, if you pointed out, Kconfig is in charge of
that kind of validation. As Kconfig permits Hyper-V on the correct set
of arch'es, the best choice would be to remove I think.

+
+/* NOTE: Linux helper struct - NOT from Hyper-V code */
+struct hv_output_get_vp_registers {
+ DECLARE_FLEX_ARRAY(union hv_register_value, values);
};

I'm not super familiar with DECLARE_FLEX_ARRAY() but it appears this
needs to be wrapped in an anonymous struct at the least per this comment
for the definition of DECLARE_FLEX_ARRAY()

* In order to have a flexible array member [...] alone in a
* struct, it needs to be wrapped in an anonymous struct with at least 1
* named member, but that member can be empty.

Nuno, since you seem to be more familiar, can you provide some guidance?
I will wrap the struct member of the documentation requires, not to
make the code look suspicious.


Thanks,
Easwar

--
Thank you,
Roman