linux-arch.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/2] hyperv: Move some features to common code
@ 2025-02-07 19:03 Nuno Das Neves
  2025-02-07 19:03 ` [PATCH v3 1/2] hyperv: Move hv_current_partition_id to arch-generic code Nuno Das Neves
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Nuno Das Neves @ 2025-02-07 19:03 UTC (permalink / raw)
  To: linux-hyperv, linux-arm-kernel, linux-kernel, linux-arch, wei.liu,
	mhklinux
  Cc: kys, haiyangz, decui, catalin.marinas, will, tglx, mingo, bp,
	dave.hansen, x86, hpa, arnd, jinankjain, muminulrussell,
	skinsburskii, mukeshrathor

There are several bits of Hyper-V-related code that today live in
arch/x86 but are not really specific to x86_64 and will work on arm64
too.

Some of these will be needed in the upcoming mshv driver code (for
Linux as root partition on Hyper-V). So this is a good time to move
them to drivers/hv.

Signed-off-by: Nuno Das Neves <nunodasneves@linux.microsoft.com>
---
Changes in v3:
* Just use percpu input page for the hypercall [Michael Kelley]
* Move the calls to hv_get_partition_id() back to arch code [Michael Kelley]
* Rename struct hv_get_partition_id to hv_output_get_partition_id
  [Michael Kelley]

Changes in v2:
* Fix dependence on percpu output page by using a stack variable for the
  hypercall output [Michael Kelley]
* Remove unnecessary WARN()s [Michael Kelley]
* Define hv_current_partition_id in hv_common.c [Michael Kelley]
* Move entire hv_proc.c to drivers/hv [Michael Kelley]

Nuno Das Neves (2):
  hyperv: Move hv_current_partition_id to arch-generic code
  hyperv: Move arch/x86/hyperv/hv_proc.c to drivers/hv

 arch/arm64/hyperv/mshyperv.c              |  3 +++
 arch/x86/hyperv/Makefile                  |  2 +-
 arch/x86/hyperv/hv_init.c                 | 25 +----------------------
 arch/x86/include/asm/mshyperv.h           |  6 ------
 drivers/hv/Makefile                       |  2 +-
 drivers/hv/hv_common.c                    | 22 ++++++++++++++++++++
 {arch/x86/hyperv => drivers/hv}/hv_proc.c |  4 ----
 include/asm-generic/mshyperv.h            |  6 ++++++
 include/hyperv/hvgdk_mini.h               |  2 +-
 9 files changed, 35 insertions(+), 37 deletions(-)
 rename {arch/x86/hyperv => drivers/hv}/hv_proc.c (98%)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v3 1/2] hyperv: Move hv_current_partition_id to arch-generic code
  2025-02-07 19:03 [PATCH v3 0/2] hyperv: Move some features to common code Nuno Das Neves
@ 2025-02-07 19:03 ` Nuno Das Neves
  2025-02-08 15:44   ` Michael Kelley
  2025-02-07 19:03 ` [PATCH v3 2/2] hyperv: Move arch/x86/hyperv/hv_proc.c to drivers/hv Nuno Das Neves
  2025-02-12  4:10 ` [PATCH v3 0/2] hyperv: Move some features to common code Wei Liu
  2 siblings, 1 reply; 6+ messages in thread
From: Nuno Das Neves @ 2025-02-07 19:03 UTC (permalink / raw)
  To: linux-hyperv, linux-arm-kernel, linux-kernel, linux-arch, wei.liu,
	mhklinux
  Cc: kys, haiyangz, decui, catalin.marinas, will, tglx, mingo, bp,
	dave.hansen, x86, hpa, arnd, jinankjain, muminulrussell,
	skinsburskii, mukeshrathor

Move hv_current_partition_id and hv_get_partition_id() to hv_common.c,
and call hv_get_partition_id() on arm64 in hyperv_init(). These aren't
specific to x86_64 and will be needed by common code.

Set hv_current_partition_id to HV_PARTITION_ID_SELF by default.

Rename struct hv_get_partition_id to hv_output_get_partition_id, to
make it distinct from the function hv_get_partition_id(), and match
the original Hyper-V struct name.

Remove the BUG()s. Failing to get the id need not crash the machine.

Signed-off-by: Nuno Das Neves <nunodasneves@linux.microsoft.com>
---
 arch/arm64/hyperv/mshyperv.c    |  3 +++
 arch/x86/hyperv/hv_init.c       | 25 +------------------------
 arch/x86/include/asm/mshyperv.h |  2 --
 drivers/hv/hv_common.c          | 22 ++++++++++++++++++++++
 include/asm-generic/mshyperv.h  |  2 ++
 include/hyperv/hvgdk_mini.h     |  2 +-
 6 files changed, 29 insertions(+), 27 deletions(-)

diff --git a/arch/arm64/hyperv/mshyperv.c b/arch/arm64/hyperv/mshyperv.c
index fc49949b7df6..29fcfd595f48 100644
--- a/arch/arm64/hyperv/mshyperv.c
+++ b/arch/arm64/hyperv/mshyperv.c
@@ -72,6 +72,9 @@ static int __init hyperv_init(void)
 		return ret;
 	}
 
+	if (ms_hyperv.priv_high & HV_ACCESS_PARTITION_ID)
+		hv_get_partition_id();
+
 	ms_hyperv_late_init();
 
 	hyperv_initialized = true;
diff --git a/arch/x86/hyperv/hv_init.c b/arch/x86/hyperv/hv_init.c
index 173005e6a95d..9be1446f5bd3 100644
--- a/arch/x86/hyperv/hv_init.c
+++ b/arch/x86/hyperv/hv_init.c
@@ -34,9 +34,6 @@
 #include <clocksource/hyperv_timer.h>
 #include <linux/highmem.h>
 
-u64 hv_current_partition_id = ~0ull;
-EXPORT_SYMBOL_GPL(hv_current_partition_id);
-
 void *hv_hypercall_pg;
 EXPORT_SYMBOL_GPL(hv_hypercall_pg);
 
@@ -393,24 +390,6 @@ static void __init hv_stimer_setup_percpu_clockev(void)
 		old_setup_percpu_clockev();
 }
 
-static void __init hv_get_partition_id(void)
-{
-	struct hv_get_partition_id *output_page;
-	u64 status;
-	unsigned long flags;
-
-	local_irq_save(flags);
-	output_page = *this_cpu_ptr(hyperv_pcpu_output_arg);
-	status = hv_do_hypercall(HVCALL_GET_PARTITION_ID, NULL, output_page);
-	if (!hv_result_success(status)) {
-		/* No point in proceeding if this failed */
-		pr_err("Failed to get partition ID: %lld\n", status);
-		BUG();
-	}
-	hv_current_partition_id = output_page->partition_id;
-	local_irq_restore(flags);
-}
-
 #if IS_ENABLED(CONFIG_HYPERV_VTL_MODE)
 static u8 __init get_vtl(void)
 {
@@ -605,11 +584,9 @@ void __init hyperv_init(void)
 
 	register_syscore_ops(&hv_syscore_ops);
 
-	if (cpuid_ebx(HYPERV_CPUID_FEATURES) & HV_ACCESS_PARTITION_ID)
+	if (ms_hyperv.priv_high & HV_ACCESS_PARTITION_ID)
 		hv_get_partition_id();
 
-	BUG_ON(hv_root_partition && hv_current_partition_id == ~0ull);
-
 #ifdef CONFIG_PCI_MSI
 	/*
 	 * If we're running as root, we want to create our own PCI MSI domain.
diff --git a/arch/x86/include/asm/mshyperv.h b/arch/x86/include/asm/mshyperv.h
index f91ab1e75f9f..8d3ada3e8d0d 100644
--- a/arch/x86/include/asm/mshyperv.h
+++ b/arch/x86/include/asm/mshyperv.h
@@ -43,8 +43,6 @@ extern bool hyperv_paravisor_present;
 
 extern void *hv_hypercall_pg;
 
-extern u64 hv_current_partition_id;
-
 extern union hv_ghcb * __percpu *hv_ghcb_pg;
 
 bool hv_isolation_type_snp(void);
diff --git a/drivers/hv/hv_common.c b/drivers/hv/hv_common.c
index af5d1dc451f6..cb3ea49020ef 100644
--- a/drivers/hv/hv_common.c
+++ b/drivers/hv/hv_common.c
@@ -31,6 +31,9 @@
 #include <hyperv/hvhdk.h>
 #include <asm/mshyperv.h>
 
+u64 hv_current_partition_id = HV_PARTITION_ID_SELF;
+EXPORT_SYMBOL_GPL(hv_current_partition_id);
+
 /*
  * hv_root_partition, ms_hyperv and hv_nested are defined here with other
  * Hyper-V specific globals so they are shared across all architectures and are
@@ -283,6 +286,25 @@ static inline bool hv_output_page_exists(void)
 	return hv_root_partition || IS_ENABLED(CONFIG_HYPERV_VTL_MODE);
 }
 
+void __init hv_get_partition_id(void)
+{
+	struct hv_output_get_partition_id *output;
+	unsigned long flags;
+	u64 status, pt_id;
+
+	local_irq_save(flags);
+	output = *this_cpu_ptr(hyperv_pcpu_input_arg);
+	status = hv_do_hypercall(HVCALL_GET_PARTITION_ID, NULL, &output);
+	pt_id = output->partition_id;
+	local_irq_restore(flags);
+
+	if (hv_result_success(status))
+		hv_current_partition_id = pt_id;
+	else
+		pr_err("Hyper-V: failed to get partition ID: %#lx\n",
+		       hv_result(status));
+}
+
 int __init hv_common_init(void)
 {
 	int i;
diff --git a/include/asm-generic/mshyperv.h b/include/asm-generic/mshyperv.h
index a7bbe504e4f3..febeddf6cd8a 100644
--- a/include/asm-generic/mshyperv.h
+++ b/include/asm-generic/mshyperv.h
@@ -58,6 +58,7 @@ struct ms_hyperv_info {
 };
 extern struct ms_hyperv_info ms_hyperv;
 extern bool hv_nested;
+extern u64 hv_current_partition_id;
 
 extern void * __percpu *hyperv_pcpu_input_arg;
 extern void * __percpu *hyperv_pcpu_output_arg;
@@ -207,6 +208,7 @@ extern u64 (*hv_read_reference_counter)(void);
 #define VP_INVAL	U32_MAX
 
 int __init hv_common_init(void);
+void __init hv_get_partition_id(void);
 void __init hv_common_free(void);
 void __init ms_hyperv_late_init(void);
 int hv_common_cpu_init(unsigned int cpu);
diff --git a/include/hyperv/hvgdk_mini.h b/include/hyperv/hvgdk_mini.h
index 155615175965..58895883f636 100644
--- a/include/hyperv/hvgdk_mini.h
+++ b/include/hyperv/hvgdk_mini.h
@@ -182,7 +182,7 @@ struct hv_tsc_emulation_control {	 /* HV_TSC_INVARIANT_CONTROL */
 
 #endif /* CONFIG_X86 */
 
-struct hv_get_partition_id {	 /* HV_OUTPUT_GET_PARTITION_ID */
+struct hv_output_get_partition_id {
 	u64 partition_id;
 } __packed;
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v3 2/2] hyperv: Move arch/x86/hyperv/hv_proc.c to drivers/hv
  2025-02-07 19:03 [PATCH v3 0/2] hyperv: Move some features to common code Nuno Das Neves
  2025-02-07 19:03 ` [PATCH v3 1/2] hyperv: Move hv_current_partition_id to arch-generic code Nuno Das Neves
@ 2025-02-07 19:03 ` Nuno Das Neves
  2025-02-12  4:11   ` Wei Liu
  2025-02-12  4:10 ` [PATCH v3 0/2] hyperv: Move some features to common code Wei Liu
  2 siblings, 1 reply; 6+ messages in thread
From: Nuno Das Neves @ 2025-02-07 19:03 UTC (permalink / raw)
  To: linux-hyperv, linux-arm-kernel, linux-kernel, linux-arch, wei.liu,
	mhklinux
  Cc: kys, haiyangz, decui, catalin.marinas, will, tglx, mingo, bp,
	dave.hansen, x86, hpa, arnd, jinankjain, muminulrussell,
	skinsburskii, mukeshrathor

These helpers are not specific to x86_64 and will be needed by common code.
Remove some unnecessary #includes.

Reviewed-by: Michael Kelley <mhklinux@outlook.com>
Signed-off-by: Nuno Das Neves <nunodasneves@linux.microsoft.com>
---
 arch/x86/hyperv/Makefile                  | 2 +-
 arch/x86/include/asm/mshyperv.h           | 4 ----
 drivers/hv/Makefile                       | 2 +-
 {arch/x86/hyperv => drivers/hv}/hv_proc.c | 4 ----
 include/asm-generic/mshyperv.h            | 4 ++++
 5 files changed, 6 insertions(+), 10 deletions(-)
 rename {arch/x86/hyperv => drivers/hv}/hv_proc.c (98%)

diff --git a/arch/x86/hyperv/Makefile b/arch/x86/hyperv/Makefile
index 3a1548054b48..d55f494f471d 100644
--- a/arch/x86/hyperv/Makefile
+++ b/arch/x86/hyperv/Makefile
@@ -1,6 +1,6 @@
 # SPDX-License-Identifier: GPL-2.0-only
 obj-y			:= hv_init.o mmu.o nested.o irqdomain.o ivm.o
-obj-$(CONFIG_X86_64)	+= hv_apic.o hv_proc.o
+obj-$(CONFIG_X86_64)	+= hv_apic.o
 obj-$(CONFIG_HYPERV_VTL_MODE)	+= hv_vtl.o
 
 ifdef CONFIG_X86_64
diff --git a/arch/x86/include/asm/mshyperv.h b/arch/x86/include/asm/mshyperv.h
index 8d3ada3e8d0d..7dfca93ef048 100644
--- a/arch/x86/include/asm/mshyperv.h
+++ b/arch/x86/include/asm/mshyperv.h
@@ -56,10 +56,6 @@ u64 hv_tdx_hypercall(u64 control, u64 param1, u64 param2);
 #define HV_AP_INIT_GPAT_DEFAULT		0x0007040600070406ULL
 #define HV_AP_SEGMENT_LIMIT		0xffffffff
 
-int hv_call_deposit_pages(int node, u64 partition_id, u32 num_pages);
-int hv_call_add_logical_proc(int node, u32 lp_index, u32 acpi_id);
-int hv_call_create_vp(int node, u64 partition_id, u32 vp_index, u32 flags);
-
 /*
  * If the hypercall involves no input or output parameters, the hypervisor
  * ignores the corresponding GPA pointer.
diff --git a/drivers/hv/Makefile b/drivers/hv/Makefile
index b992c0ed182b..9afcabb3fbd2 100644
--- a/drivers/hv/Makefile
+++ b/drivers/hv/Makefile
@@ -13,4 +13,4 @@ hv_vmbus-$(CONFIG_HYPERV_TESTING)	+= hv_debugfs.o
 hv_utils-y := hv_util.o hv_kvp.o hv_snapshot.o hv_utils_transport.o
 
 # Code that must be built-in
-obj-$(subst m,y,$(CONFIG_HYPERV)) += hv_common.o
+obj-$(subst m,y,$(CONFIG_HYPERV)) += hv_common.o hv_proc.o
diff --git a/arch/x86/hyperv/hv_proc.c b/drivers/hv/hv_proc.c
similarity index 98%
rename from arch/x86/hyperv/hv_proc.c
rename to drivers/hv/hv_proc.c
index ac4c834d4435..3e410489f480 100644
--- a/arch/x86/hyperv/hv_proc.c
+++ b/drivers/hv/hv_proc.c
@@ -6,11 +6,7 @@
 #include <linux/slab.h>
 #include <linux/cpuhotplug.h>
 #include <linux/minmax.h>
-#include <asm/hypervisor.h>
 #include <asm/mshyperv.h>
-#include <asm/apic.h>
-
-#include <asm/trace/hyperv.h>
 
 /*
  * See struct hv_deposit_memory. The first u64 is partition ID, the rest
diff --git a/include/asm-generic/mshyperv.h b/include/asm-generic/mshyperv.h
index febeddf6cd8a..7adc10a4fa3e 100644
--- a/include/asm-generic/mshyperv.h
+++ b/include/asm-generic/mshyperv.h
@@ -218,6 +218,10 @@ void *hv_alloc_hyperv_page(void);
 void *hv_alloc_hyperv_zeroed_page(void);
 void hv_free_hyperv_page(void *addr);
 
+int hv_call_deposit_pages(int node, u64 partition_id, u32 num_pages);
+int hv_call_add_logical_proc(int node, u32 lp_index, u32 acpi_id);
+int hv_call_create_vp(int node, u64 partition_id, u32 vp_index, u32 flags);
+
 /**
  * hv_cpu_number_to_vp_number() - Map CPU to VP.
  * @cpu_number: CPU number in Linux terms
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* RE: [PATCH v3 1/2] hyperv: Move hv_current_partition_id to arch-generic code
  2025-02-07 19:03 ` [PATCH v3 1/2] hyperv: Move hv_current_partition_id to arch-generic code Nuno Das Neves
@ 2025-02-08 15:44   ` Michael Kelley
  0 siblings, 0 replies; 6+ messages in thread
From: Michael Kelley @ 2025-02-08 15:44 UTC (permalink / raw)
  To: Nuno Das Neves, linux-hyperv@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org,
	wei.liu@kernel.org
  Cc: kys@microsoft.com, haiyangz@microsoft.com, decui@microsoft.com,
	catalin.marinas@arm.com, will@kernel.org, tglx@linutronix.de,
	mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com,
	x86@kernel.org, hpa@zytor.com, arnd@arndb.de,
	jinankjain@linux.microsoft.com, muminulrussell@gmail.com,
	skinsburskii@linux.microsoft.com, mukeshrathor@microsoft.com

From: Nuno Das Neves <nunodasneves@linux.microsoft.com> Sent: Friday, February 7, 2025 11:03 AM
> 
> Move hv_current_partition_id and hv_get_partition_id() to hv_common.c,
> and call hv_get_partition_id() on arm64 in hyperv_init(). These aren't
> specific to x86_64 and will be needed by common code.
> 
> Set hv_current_partition_id to HV_PARTITION_ID_SELF by default.
> 
> Rename struct hv_get_partition_id to hv_output_get_partition_id, to
> make it distinct from the function hv_get_partition_id(), and match
> the original Hyper-V struct name.
> 
> Remove the BUG()s. Failing to get the id need not crash the machine.
> 
> Signed-off-by: Nuno Das Neves <nunodasneves@linux.microsoft.com>

Looks good now.

Reviewed-by: Michael Kelley <mhklinux@outlook.com>

> ---
>  arch/arm64/hyperv/mshyperv.c    |  3 +++
>  arch/x86/hyperv/hv_init.c       | 25 +------------------------
>  arch/x86/include/asm/mshyperv.h |  2 --
>  drivers/hv/hv_common.c          | 22 ++++++++++++++++++++++
>  include/asm-generic/mshyperv.h  |  2 ++
>  include/hyperv/hvgdk_mini.h     |  2 +-
>  6 files changed, 29 insertions(+), 27 deletions(-)
> 
> diff --git a/arch/arm64/hyperv/mshyperv.c b/arch/arm64/hyperv/mshyperv.c
> index fc49949b7df6..29fcfd595f48 100644
> --- a/arch/arm64/hyperv/mshyperv.c
> +++ b/arch/arm64/hyperv/mshyperv.c
> @@ -72,6 +72,9 @@ static int __init hyperv_init(void)
>  		return ret;
>  	}
> 
> +	if (ms_hyperv.priv_high & HV_ACCESS_PARTITION_ID)
> +		hv_get_partition_id();
> +
>  	ms_hyperv_late_init();
> 
>  	hyperv_initialized = true;
> diff --git a/arch/x86/hyperv/hv_init.c b/arch/x86/hyperv/hv_init.c
> index 173005e6a95d..9be1446f5bd3 100644
> --- a/arch/x86/hyperv/hv_init.c
> +++ b/arch/x86/hyperv/hv_init.c
> @@ -34,9 +34,6 @@
>  #include <clocksource/hyperv_timer.h>
>  #include <linux/highmem.h>
> 
> -u64 hv_current_partition_id = ~0ull;
> -EXPORT_SYMBOL_GPL(hv_current_partition_id);
> -
>  void *hv_hypercall_pg;
>  EXPORT_SYMBOL_GPL(hv_hypercall_pg);
> 
> @@ -393,24 +390,6 @@ static void __init hv_stimer_setup_percpu_clockev(void)
>  		old_setup_percpu_clockev();
>  }
> 
> -static void __init hv_get_partition_id(void)
> -{
> -	struct hv_get_partition_id *output_page;
> -	u64 status;
> -	unsigned long flags;
> -
> -	local_irq_save(flags);
> -	output_page = *this_cpu_ptr(hyperv_pcpu_output_arg);
> -	status = hv_do_hypercall(HVCALL_GET_PARTITION_ID, NULL, output_page);
> -	if (!hv_result_success(status)) {
> -		/* No point in proceeding if this failed */
> -		pr_err("Failed to get partition ID: %lld\n", status);
> -		BUG();
> -	}
> -	hv_current_partition_id = output_page->partition_id;
> -	local_irq_restore(flags);
> -}
> -
>  #if IS_ENABLED(CONFIG_HYPERV_VTL_MODE)
>  static u8 __init get_vtl(void)
>  {
> @@ -605,11 +584,9 @@ void __init hyperv_init(void)
> 
>  	register_syscore_ops(&hv_syscore_ops);
> 
> -	if (cpuid_ebx(HYPERV_CPUID_FEATURES) & HV_ACCESS_PARTITION_ID)
> +	if (ms_hyperv.priv_high & HV_ACCESS_PARTITION_ID)
>  		hv_get_partition_id();
> 
> -	BUG_ON(hv_root_partition && hv_current_partition_id == ~0ull);
> -
>  #ifdef CONFIG_PCI_MSI
>  	/*
>  	 * If we're running as root, we want to create our own PCI MSI domain.
> diff --git a/arch/x86/include/asm/mshyperv.h b/arch/x86/include/asm/mshyperv.h
> index f91ab1e75f9f..8d3ada3e8d0d 100644
> --- a/arch/x86/include/asm/mshyperv.h
> +++ b/arch/x86/include/asm/mshyperv.h
> @@ -43,8 +43,6 @@ extern bool hyperv_paravisor_present;
> 
>  extern void *hv_hypercall_pg;
> 
> -extern u64 hv_current_partition_id;
> -
>  extern union hv_ghcb * __percpu *hv_ghcb_pg;
> 
>  bool hv_isolation_type_snp(void);
> diff --git a/drivers/hv/hv_common.c b/drivers/hv/hv_common.c
> index af5d1dc451f6..cb3ea49020ef 100644
> --- a/drivers/hv/hv_common.c
> +++ b/drivers/hv/hv_common.c
> @@ -31,6 +31,9 @@
>  #include <hyperv/hvhdk.h>
>  #include <asm/mshyperv.h>
> 
> +u64 hv_current_partition_id = HV_PARTITION_ID_SELF;
> +EXPORT_SYMBOL_GPL(hv_current_partition_id);
> +
>  /*
>   * hv_root_partition, ms_hyperv and hv_nested are defined here with other
>   * Hyper-V specific globals so they are shared across all architectures and are
> @@ -283,6 +286,25 @@ static inline bool hv_output_page_exists(void)
>  	return hv_root_partition || IS_ENABLED(CONFIG_HYPERV_VTL_MODE);
>  }
> 
> +void __init hv_get_partition_id(void)
> +{
> +	struct hv_output_get_partition_id *output;
> +	unsigned long flags;
> +	u64 status, pt_id;
> +
> +	local_irq_save(flags);
> +	output = *this_cpu_ptr(hyperv_pcpu_input_arg);
> +	status = hv_do_hypercall(HVCALL_GET_PARTITION_ID, NULL, &output);
> +	pt_id = output->partition_id;
> +	local_irq_restore(flags);
> +
> +	if (hv_result_success(status))
> +		hv_current_partition_id = pt_id;
> +	else
> +		pr_err("Hyper-V: failed to get partition ID: %#lx\n",
> +		       hv_result(status));
> +}
> +
>  int __init hv_common_init(void)
>  {
>  	int i;
> diff --git a/include/asm-generic/mshyperv.h b/include/asm-generic/mshyperv.h
> index a7bbe504e4f3..febeddf6cd8a 100644
> --- a/include/asm-generic/mshyperv.h
> +++ b/include/asm-generic/mshyperv.h
> @@ -58,6 +58,7 @@ struct ms_hyperv_info {
>  };
>  extern struct ms_hyperv_info ms_hyperv;
>  extern bool hv_nested;
> +extern u64 hv_current_partition_id;
> 
>  extern void * __percpu *hyperv_pcpu_input_arg;
>  extern void * __percpu *hyperv_pcpu_output_arg;
> @@ -207,6 +208,7 @@ extern u64 (*hv_read_reference_counter)(void);
>  #define VP_INVAL	U32_MAX
> 
>  int __init hv_common_init(void);
> +void __init hv_get_partition_id(void);
>  void __init hv_common_free(void);
>  void __init ms_hyperv_late_init(void);
>  int hv_common_cpu_init(unsigned int cpu);
> diff --git a/include/hyperv/hvgdk_mini.h b/include/hyperv/hvgdk_mini.h
> index 155615175965..58895883f636 100644
> --- a/include/hyperv/hvgdk_mini.h
> +++ b/include/hyperv/hvgdk_mini.h
> @@ -182,7 +182,7 @@ struct hv_tsc_emulation_control {	 /*
> HV_TSC_INVARIANT_CONTROL */
> 
>  #endif /* CONFIG_X86 */
> 
> -struct hv_get_partition_id {	 /* HV_OUTPUT_GET_PARTITION_ID */
> +struct hv_output_get_partition_id {
>  	u64 partition_id;
>  } __packed;
> 
> --
> 2.34.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v3 0/2] hyperv: Move some features to common code
  2025-02-07 19:03 [PATCH v3 0/2] hyperv: Move some features to common code Nuno Das Neves
  2025-02-07 19:03 ` [PATCH v3 1/2] hyperv: Move hv_current_partition_id to arch-generic code Nuno Das Neves
  2025-02-07 19:03 ` [PATCH v3 2/2] hyperv: Move arch/x86/hyperv/hv_proc.c to drivers/hv Nuno Das Neves
@ 2025-02-12  4:10 ` Wei Liu
  2 siblings, 0 replies; 6+ messages in thread
From: Wei Liu @ 2025-02-12  4:10 UTC (permalink / raw)
  To: Nuno Das Neves
  Cc: linux-hyperv, linux-arm-kernel, linux-kernel, linux-arch, wei.liu,
	mhklinux, kys, haiyangz, decui, catalin.marinas, will, tglx,
	mingo, bp, dave.hansen, x86, hpa, arnd, jinankjain,
	muminulrussell, skinsburskii, mukeshrathor

On Fri, Feb 07, 2025 at 11:03:20AM -0800, Nuno Das Neves wrote:
> There are several bits of Hyper-V-related code that today live in
> arch/x86 but are not really specific to x86_64 and will work on arm64
> too.
> 
> Some of these will be needed in the upcoming mshv driver code (for
> Linux as root partition on Hyper-V). So this is a good time to move
> them to drivers/hv.
> 
> Signed-off-by: Nuno Das Neves <nunodasneves@linux.microsoft.com>
> ---
> Changes in v3:
> * Just use percpu input page for the hypercall [Michael Kelley]
> * Move the calls to hv_get_partition_id() back to arch code [Michael Kelley]
> * Rename struct hv_get_partition_id to hv_output_get_partition_id
>   [Michael Kelley]
> 
> Changes in v2:
> * Fix dependence on percpu output page by using a stack variable for the
>   hypercall output [Michael Kelley]
> * Remove unnecessary WARN()s [Michael Kelley]
> * Define hv_current_partition_id in hv_common.c [Michael Kelley]
> * Move entire hv_proc.c to drivers/hv [Michael Kelley]
> 
> Nuno Das Neves (2):
>   hyperv: Move hv_current_partition_id to arch-generic code
>   hyperv: Move arch/x86/hyperv/hv_proc.c to drivers/hv

Applied to hyperv-next. Thanks.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v3 2/2] hyperv: Move arch/x86/hyperv/hv_proc.c to drivers/hv
  2025-02-07 19:03 ` [PATCH v3 2/2] hyperv: Move arch/x86/hyperv/hv_proc.c to drivers/hv Nuno Das Neves
@ 2025-02-12  4:11   ` Wei Liu
  0 siblings, 0 replies; 6+ messages in thread
From: Wei Liu @ 2025-02-12  4:11 UTC (permalink / raw)
  To: Nuno Das Neves
  Cc: linux-hyperv, linux-arm-kernel, linux-kernel, linux-arch, wei.liu,
	mhklinux, kys, haiyangz, decui, catalin.marinas, will, tglx,
	mingo, bp, dave.hansen, x86, hpa, arnd, jinankjain,
	muminulrussell, skinsburskii, mukeshrathor

On Fri, Feb 07, 2025 at 11:03:22AM -0800, Nuno Das Neves wrote:
> These helpers are not specific to x86_64 and will be needed by common code.
> Remove some unnecessary #includes.
> 
> Reviewed-by: Michael Kelley <mhklinux@outlook.com>
> Signed-off-by: Nuno Das Neves <nunodasneves@linux.microsoft.com>

One comment about the ordering of the tag. You should order them in
chronological order in the future, so the "Reviewed-by" should be after
your SoB.

Thanks,
Wei.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-02-12  4:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-07 19:03 [PATCH v3 0/2] hyperv: Move some features to common code Nuno Das Neves
2025-02-07 19:03 ` [PATCH v3 1/2] hyperv: Move hv_current_partition_id to arch-generic code Nuno Das Neves
2025-02-08 15:44   ` Michael Kelley
2025-02-07 19:03 ` [PATCH v3 2/2] hyperv: Move arch/x86/hyperv/hv_proc.c to drivers/hv Nuno Das Neves
2025-02-12  4:11   ` Wei Liu
2025-02-12  4:10 ` [PATCH v3 0/2] hyperv: Move some features to common code Wei Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).