Inter-revision diff: patch 2

Comparing rfc (message) to v3 (message)

--- vrfc
+++ v3
@@ -4,63 +4,80 @@
 Signed-off-by: Nuno Das Neves <nunodasneves@linux.microsoft.com>
 ---
  arch/x86/hyperv/hv_init.c         |  2 +-
- arch/x86/hyperv/hv_proc.c         | 10 +++---
- include/asm-generic/hyperv-tlfs.h | 60 +++++++++++++++++++------------
- 3 files changed, 44 insertions(+), 28 deletions(-)
+ arch/x86/hyperv/hv_proc.c         | 19 ++++++++---
+ include/asm-generic/hyperv-tlfs.h | 52 ++++++++++++++++++-------------
+ include/asm-generic/mshyperv.h    |  1 +
+ 4 files changed, 46 insertions(+), 28 deletions(-)
 
 diff --git a/arch/x86/hyperv/hv_init.c b/arch/x86/hyperv/hv_init.c
-index 2c2189832da7..2a8cd2cf0745 100644
+index bb0ae4b5c00f..722bafdb2225 100644
 --- a/arch/x86/hyperv/hv_init.c
 +++ b/arch/x86/hyperv/hv_init.c
-@@ -363,7 +363,7 @@ void __init hv_get_partition_id(void)
- 	status = hv_do_hypercall(HVCALL_GET_PARTITION_ID, NULL, output_page) &
- 		HV_HYPERCALL_RESULT_MASK;
- 	if (status != HV_STATUS_SUCCESS)
--		pr_err("Failed to get partition ID: %d\n", status);
+@@ -349,7 +349,7 @@ static void __init hv_get_partition_id(void)
+ 	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);
 +		pr_err("Failed to get partition ID: %s\n", hv_status_to_string(status));
- 	else
- 		hv_current_partition_id = output_page->partition_id;
- 	local_irq_restore(flags);
+ 		BUG();
+ 	}
+ 	hv_current_partition_id = output_page->partition_id;
 diff --git a/arch/x86/hyperv/hv_proc.c b/arch/x86/hyperv/hv_proc.c
-index 8f86f8e86748..a88ed6873fbd 100644
+index 59cf9a9e0975..e75c78a243e7 100644
 --- a/arch/x86/hyperv/hv_proc.c
 +++ b/arch/x86/hyperv/hv_proc.c
-@@ -122,7 +122,7 @@ int hv_call_deposit_pages(int node, u64 partition_id, u32 num_pages)
+@@ -38,6 +38,15 @@ int hv_status_to_errno(u64 hv_status)
+ }
+ EXPORT_SYMBOL_GPL(hv_status_to_errno);
+ 
++const char *hv_status_to_string(u64 hv_status)
++{
++	switch (hv_result(hv_status)) {
++	__HV_STATUS_DEF(__HV_MAKE_HV_STATUS_CASE)
++	default : return "Unknown";
++	}
++}
++EXPORT_SYMBOL_GPL(hv_status_to_string);
++
+ /*
+  * See struct hv_deposit_memory. The first u64 is partition ID, the rest
+  * are GPAs.
+@@ -117,7 +126,7 @@ int hv_call_deposit_pages(int node, u64 partition_id, u32 num_pages)
+ 				     page_count, 0, input_page, NULL);
  	local_irq_restore(flags);
- 
- 	if (status != HV_STATUS_SUCCESS) {
--		pr_err("Failed to deposit pages: %d\n", status);
+ 	if (!hv_result_success(status)) {
+-		pr_err("Failed to deposit pages: %lld\n", status);
 +		pr_err("Failed to deposit pages: %s\n", hv_status_to_string(status));
- 		ret = -hv_status_to_errno(status);
+ 		ret = hv_status_to_errno(status);
  		goto err_free_allocations;
  	}
-@@ -177,8 +177,8 @@ int hv_call_add_logical_proc(int node, u32 lp_index, u32 apic_id)
+@@ -172,8 +181,8 @@ int hv_call_add_logical_proc(int node, u32 lp_index, u32 apic_id)
  
- 		if (status != HV_STATUS_INSUFFICIENT_MEMORY) {
- 			if (status != HV_STATUS_SUCCESS) {
--				pr_err("%s: cpu %u apic ID %u, %d\n", __func__,
+ 		if (hv_result(status) != HV_STATUS_INSUFFICIENT_MEMORY) {
+ 			if (!hv_result_success(status)) {
+-				pr_err("%s: cpu %u apic ID %u, %lld\n", __func__,
 -				       lp_index, apic_id, status);
 +				pr_err("%s: cpu %u apic ID %u, %s\n", __func__,
 +				       lp_index, apic_id, hv_status_to_string(status));
- 				ret = -hv_status_to_errno(status);
+ 				ret = hv_status_to_errno(status);
  			}
  			break;
-@@ -225,8 +225,8 @@ int hv_call_create_vp(int node, u64 partition_id, u32 vp_index, u32 flags)
+@@ -222,8 +231,8 @@ int hv_call_create_vp(int node, u64 partition_id, u32 vp_index, u32 flags)
  
- 		if (status != HV_STATUS_INSUFFICIENT_MEMORY) {
- 			if (status != HV_STATUS_SUCCESS) {
--				pr_err("%s: vcpu %u, lp %u, %d\n", __func__,
+ 		if (hv_result(status) != HV_STATUS_INSUFFICIENT_MEMORY) {
+ 			if (!hv_result_success(status)) {
+-				pr_err("%s: vcpu %u, lp %u, %lld\n", __func__,
 -				       vp_index, flags, status);
 +				pr_err("%s: vcpu %u, lp %u, %s\n", __func__,
 +				       vp_index, flags, hv_status_to_string(status));
- 				ret = -hv_status_to_errno(status);
+ 				ret = hv_status_to_errno(status);
  			}
  			break;
 diff --git a/include/asm-generic/hyperv-tlfs.h b/include/asm-generic/hyperv-tlfs.h
-index 445244192fa4..05b9dc9896ab 100644
+index fe6d41d0b114..40ff7cdd4a2b 100644
 --- a/include/asm-generic/hyperv-tlfs.h
 +++ b/include/asm-generic/hyperv-tlfs.h
-@@ -181,28 +181,44 @@ enum HV_GENERIC_SET_FORMAT {
+@@ -189,28 +189,36 @@ enum HV_GENERIC_SET_FORMAT {
  #define HV_HYPERCALL_REP_START_MASK	GENMASK_ULL(59, 48)
  
  /* hypercall status code */
@@ -116,17 +133,21 @@
 +enum hv_status {
 +	__HV_STATUS_DEF(__HV_MAKE_HV_STATUS_ENUM)
 +};
-+
-+static inline const char *hv_status_to_string(enum hv_status status)
-+{
-+	switch (status) {
-+	__HV_STATUS_DEF(__HV_MAKE_HV_STATUS_CASE)
-+	default : return "Unknown";
-+	}
-+}
  
  /*
   * The Hyper-V TimeRefCount register and the TSC
+diff --git a/include/asm-generic/mshyperv.h b/include/asm-generic/mshyperv.h
+index 9a000ba2bb75..672b08f79dae 100644
+--- a/include/asm-generic/mshyperv.h
++++ b/include/asm-generic/mshyperv.h
+@@ -219,6 +219,7 @@ static inline int cpumask_to_vpset(struct hv_vpset *vpset,
+ 	return nr_bank;
+ }
+ 
++const char *hv_status_to_string(u64 hv_status);
+ void hyperv_report_panic(struct pt_regs *regs, long err, bool in_die);
+ bool hv_is_hyperv_initialized(void);
+ bool hv_is_hibernation_supported(void);
 -- 
-2.25.1
+2.23.4
 
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help