Skip to contentSkip to conversation

Drivers: hv: vmbus: Support PCI Express pass-through driver

PATCH In review K. Y. Srinivasan 2 participants 13 messages Sep 15, 2015 – Sep 22, 2015 Hyper-V/Azure core and drivers

lore
Share & tools
lore
#0 lore raw

cover Drivers: hv: vmbus: Support PCI Express pass-through driver

The patch set for supporting PCI Express pass through on Hyper-V has been posted and is currently under review. These vmbus patches are needed for the PCI Express pass through driver. Since these need to go through Greg's tree, I am posting these separately here.

Jake Oshins (3):
drivers:hv: Export a function that maps Linux CPU num onto Hyper-V
proc num
drivers:hv: Export the API to invoke a hypercall on Hyper-V drivers:hv: Define the channel type for Hyper-V PCI Express
pass-through

 drivers/hv/hv.c        |    9 +++++----
 drivers/hv/vmbus_drv.c |   17 +++++++++++++++++
 include/linux/hyperv.h |   14 ++++++++++++++
 3 files changed, 36 insertions(+), 4 deletions(-)
Signature · 1 line
1.7.4.1
#1 lore raw

PATCH 1/3 drivers:hv: Export a function that maps Linux CPU num onto Hyper-V proc num

From: Jake Oshins <[email protected]>

This patch exposes the mapping between Linux CPU number and Hyper-V virtual processor number. This is necessary because the hypervisor needs to know which virtual processors to target when making a mapping in the Interrupt Redirection Table in the I/O MMU.

---
 drivers/hv/vmbus_drv.c |   17 +++++++++++++++++
 include/linux/hyperv.h |    2 ++
 2 files changed, 19 insertions(+), 0 deletions(-)
drivers/hv/vmbus_drv.c +17 -0
index 0a344fa..1a45302 100644
@@ -1191,6 +1191,23 @@ int vmbus_allocate_mmio(struct resource **new, struct hv_device *device_obj,
 }
 EXPORT_SYMBOL_GPL(vmbus_allocate_mmio);
 
+/**
+ * vmbus_cpu_number_to_vp_number() - Map CPU to VP.
+ * @cpu_number: CPU number in Linux terms
+ *
+ * This function returns the mapping between the Linux processor
+ * number and the hypervisor's virtual processor number, useful
+ * in making hypercalls and such that talk about specific
+ * processors.
+ *
+ * Return: Virtual processor number in Hyper-V terms
+ */
+int vmbus_cpu_number_to_vp_number(int cpu_number)
+{
+	return hv_context.vp_index[cpu_number];
+}
+EXPORT_SYMBOL_GPL(vmbus_cpu_number_to_vp_number);
+
 static int vmbus_acpi_add(struct acpi_device *device)
 {
 	acpi_status result;
include/linux/hyperv.h +2 -0
index 54733d5..02393b6 100644
@@ -982,6 +982,8 @@ int vmbus_allocate_mmio(struct resource **new, struct hv_device *device_obj,
 			resource_size_t size, resource_size_t align,
 			bool fb_overlap_ok);
 
+int vmbus_cpu_number_to_vp_number(int cpu_number);
+
 /**
  * VMBUS_DEVICE - macro used to describe a specific hyperv vmbus device
  *
Signature · 1 line
1.7.4.1
#2 lore raw

PATCH 2/3 drivers:hv: Export the API to invoke a hypercall on Hyper-V

From: Jake Oshins <[email protected]>

This patch exposes the function that hv_vmbus.ko uses to make hypercalls. This is necessary for retargeting an interrupt when it is given a new affinity.

Since we are exporting this API, rename the API as it will be visible outside the hv.c file.

---
 drivers/hv/hv.c        |    9 +++++----
 include/linux/hyperv.h |    1 +
 2 files changed, 6 insertions(+), 4 deletions(-)
drivers/hv/hv.c +5 -4
index 6341be8..a7b6c6a 100644
@@ -89,9 +89,9 @@ static int query_hypervisor_info(void)
 }
 
 /*
- * do_hypercall- Invoke the specified hypercall
+ * hv_do_hypercall- Invoke the specified hypercall
  */
-static u64 do_hypercall(u64 control, void *input, void *output)
+u64 hv_do_hypercall(u64 control, void *input, void *output)
 {
 	u64 input_address = (input) ? virt_to_phys(input) : 0;
 	u64 output_address = (output) ? virt_to_phys(output) : 0;
@@ -132,6 +132,7 @@ static u64 do_hypercall(u64 control, void *input, void *output)
 	return hv_status_lo | ((u64)hv_status_hi << 32);
 #endif /* !x86_64 */
 }
+EXPORT_SYMBOL_GPL(hv_do_hypercall);
 
 #ifdef CONFIG_X86_64
 static cycle_t read_hv_clock_tsc(struct clocksource *arg)
@@ -329,7 +330,7 @@ int hv_post_message(union hv_connection_id connection_id,
 	aligned_msg->payload_size = payload_size;
 	memcpy((void *)aligned_msg->payload, payload, payload_size);
 
-	status = do_hypercall(HVCALL_POST_MESSAGE, aligned_msg, NULL)
+	status = hv_do_hypercall(HVCALL_POST_MESSAGE, aligned_msg, NULL)
 		& 0xFFFF;
 
 	put_cpu();
@@ -347,7 +348,7 @@ u16 hv_signal_event(void *con_id)
 {
 	u16 status;
 
-	status = (do_hypercall(HVCALL_SIGNAL_EVENT, con_id, NULL) & 0xFFFF);
+	status = (hv_do_hypercall(HVCALL_SIGNAL_EVENT, con_id, NULL) & 0xFFFF);
 
 	return status;
 }
include/linux/hyperv.h +1 -0
index 02393b6..ea0a0e3 100644
@@ -983,6 +983,7 @@ int vmbus_allocate_mmio(struct resource **new, struct hv_device *device_obj,
 			bool fb_overlap_ok);
 
 int vmbus_cpu_number_to_vp_number(int cpu_number);
+u64 hv_do_hypercall(u64 control, void *input, void *output);
 
 /**
  * VMBUS_DEVICE - macro used to describe a specific hyperv vmbus device
Signature · 1 line
1.7.4.1
#3 lore raw

Re: [PATCH 2/3] drivers:hv: Export the API to invoke a hypercall on Hyper-V

Quoted 49 lines · K. Y. Srinivasan

From: Jake Oshins <[email protected]>

This patch exposes the function that hv_vmbus.ko uses to make hypercalls. This is necessary for retargeting an interrupt when it is given a new affinity.

Since we are exporting this API, rename the API as it will be visible outside the hv.c file.

---
 drivers/hv/hv.c        |    9 +++++----
 include/linux/hyperv.h |    1 +
 2 files changed, 6 insertions(+), 4 deletions(-)
drivers/hv/hv.c +4 -3
index 6341be8..a7b6c6a 100644
@@ -89,9 +89,9 @@ static int query_hypervisor_info(void)
 }
 
 /*
- * do_hypercall- Invoke the specified hypercall
+ * hv_do_hypercall- Invoke the specified hypercall
  */
-static u64 do_hypercall(u64 control, void *input, void *output)
+u64 hv_do_hypercall(u64 control, void *input, void *output)
 {
 	u64 input_address = (input) ? virt_to_phys(input) : 0;
 	u64 output_address = (output) ? virt_to_phys(output) : 0;
@@ -132,6 +132,7 @@ static u64 do_hypercall(u64 control, void *input, void *output)
 	return hv_status_lo | ((u64)hv_status_hi << 32);
 #endif /* !x86_64 */
 }
+EXPORT_SYMBOL_GPL(hv_do_hypercall);
 
 #ifdef CONFIG_X86_64
 static cycle_t read_hv_clock_tsc(struct clocksource *arg)
@@ -329,7 +330,7 @@ int hv_post_message(union hv_connection_id connection_id,
 	aligned_msg->payload_size = payload_size;
 	memcpy((void *)aligned_msg->payload, payload, payload_size);
 
-	status = do_hypercall(HVCALL_POST_MESSAGE, aligned_msg, NULL)
+	status = hv_do_hypercall(HVCALL_POST_MESSAGE, aligned_msg, NULL)
 		& 0xFFFF;
 
 	put_cpu();

drivers/hv/hv.c u16 hv_signal_event(void *con_id) · line 351

Quoted 5 lines
drivers/hv/hv.c +1 -1
@@ -347,7 +348,7 @@ u16 hv_signal_event(void *con_id)
 {
 	u16 status;
 
-	status = (do_hypercall(HVCALL_SIGNAL_EVENT, con_id, NULL) & 0xFFFF);
+	status = (hv_do_hypercall(HVCALL_SIGNAL_EVENT, con_id, NULL) & 0xFFFF);

What's with the crazy () around a function call?

And why are you passing a 64bit return value into a 16bit status value? That seems like something is broken.

#4 lore raw

RE: [PATCH 2/3] drivers:hv: Export the API to invoke a hypercall on Hyper-V

Quoted 69 lines

-----Original Message-----
From: Greg KH [mailto:[email protected]]
Sent: Sunday, September 20, 2015 10:28 PM
To: KY Srinivasan <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Jake Oshins <[email protected]>
Subject: Re: [PATCH 2/3] drivers:hv: Export the API to invoke a hypercall on Hyper-V

Quoted 3 lines · K. Y. Srinivasan

From: Jake Oshins <[email protected]>

This patch exposes the function that hv_vmbus.ko uses to make hypercalls.

This

drivers/hv/hv.c static u64 do_hypercall(u64 control, void *input,

Quoted 29 lines

is necessary for retargeting an interrupt when it is given a new affinity.

Since we are exporting this API, rename the API as it will be visible outside the hv.c file.

---
 drivers/hv/hv.c        |    9 +++++----
 include/linux/hyperv.h |    1 +
 2 files changed, 6 insertions(+), 4 deletions(-)
drivers/hv/hv.c +2 -2
index 6341be8..a7b6c6a 100644
@@ -89,9 +89,9 @@ static int query_hypervisor_info(void)
 }
 
 /*
- * do_hypercall- Invoke the specified hypercall
+ * hv_do_hypercall- Invoke the specified hypercall
  */
-static u64 do_hypercall(u64 control, void *input, void *output)
+u64 hv_do_hypercall(u64 control, void *input, void *output)
 {
 	u64 input_address = (input) ? virt_to_phys(input) : 0;
 	u64 output_address = (output) ? virt_to_phys(output) : 0;
@@ -132,6 +132,7 @@ static u64 do_hypercall(u64 control, void *input,

void *output)

drivers/hv/hv.c int hv_post_message(union hv_connection_id

Quoted 8 lines
drivers/hv/hv.c +1 -0
 	return hv_status_lo | ((u64)hv_status_hi << 32);
 #endif /* !x86_64 */
 }
+EXPORT_SYMBOL_GPL(hv_do_hypercall);
 
 #ifdef CONFIG_X86_64
 static cycle_t read_hv_clock_tsc(struct clocksource *arg)
@@ -329,7 +330,7 @@ int hv_post_message(union hv_connection_id

connection_id,

drivers/hv/hv.c int hv_post_message(union hv_connection_id connection_id,

Quoted 5 lines
drivers/hv/hv.c +1 -1
 	aligned_msg->payload_size = payload_size;
 	memcpy((void *)aligned_msg->payload, payload, payload_size);
 
-	status = do_hypercall(HVCALL_POST_MESSAGE, aligned_msg, NULL)
+	status = hv_do_hypercall(HVCALL_POST_MESSAGE, aligned_msg,

NULL)

Quoted 7 lines
drivers/hv/hv.c +0 -0
 		& 0xFFFF;
 
 	put_cpu();
@@ -347,7 +348,7 @@ u16 hv_signal_event(void *con_id)
 {
 	u16 status;
 
Quoted 6 lines

drivers/hv/hv.c u16 hv_signal_event(void *con_id) · line 350

Quoted 1 line
drivers/hv/hv.c +0 -1
-	status = (do_hypercall(HVCALL_SIGNAL_EVENT, con_id, NULL) &

0xFFFF);

drivers/hv/hv.c u16 hv_signal_event(void *con_id) · line 351

Quoted 1 line
drivers/hv/hv.c +1 -0
+	status = (hv_do_hypercall(HVCALL_SIGNAL_EVENT, con_id, NULL) &

0xFFFF);

What's with the crazy () around a function call?

I will address this and resend.

Quoted 3 lines

And why are you passing a 64bit return value into a 16bit status value? That seems like something is broken.

The low order 16 bits have the valid status codes we are interested in.

K. Y

#5 lore raw

Re: [PATCH 2/3] drivers:hv: Export the API to invoke a hypercall on Hyper-V

Quoted 74 lines · KY Srinivasan
Quoted 74 lines

-----Original Message-----
From: Greg KH [mailto:[email protected]]
Sent: Sunday, September 20, 2015 10:28 PM
To: KY Srinivasan <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Jake Oshins <[email protected]>
Subject: Re: [PATCH 2/3] drivers:hv: Export the API to invoke a hypercall on Hyper-V

Quoted 3 lines · K. Y. Srinivasan

From: Jake Oshins <[email protected]>

This patch exposes the function that hv_vmbus.ko uses to make hypercalls.

This

drivers/hv/hv.c static u64 do_hypercall(u64 control, void *input,

Quoted 29 lines

is necessary for retargeting an interrupt when it is given a new affinity.

Since we are exporting this API, rename the API as it will be visible outside the hv.c file.

---
 drivers/hv/hv.c        |    9 +++++----
 include/linux/hyperv.h |    1 +
 2 files changed, 6 insertions(+), 4 deletions(-)
drivers/hv/hv.c +2 -2
index 6341be8..a7b6c6a 100644
@@ -89,9 +89,9 @@ static int query_hypervisor_info(void)
 }
 
 /*
- * do_hypercall- Invoke the specified hypercall
+ * hv_do_hypercall- Invoke the specified hypercall
  */
-static u64 do_hypercall(u64 control, void *input, void *output)
+u64 hv_do_hypercall(u64 control, void *input, void *output)
 {
 	u64 input_address = (input) ? virt_to_phys(input) : 0;
 	u64 output_address = (output) ? virt_to_phys(output) : 0;
@@ -132,6 +132,7 @@ static u64 do_hypercall(u64 control, void *input,

void *output)

drivers/hv/hv.c int hv_post_message(union hv_connection_id

Quoted 8 lines
drivers/hv/hv.c +1 -0
 	return hv_status_lo | ((u64)hv_status_hi << 32);
 #endif /* !x86_64 */
 }
+EXPORT_SYMBOL_GPL(hv_do_hypercall);
 
 #ifdef CONFIG_X86_64
 static cycle_t read_hv_clock_tsc(struct clocksource *arg)
@@ -329,7 +330,7 @@ int hv_post_message(union hv_connection_id

connection_id,

drivers/hv/hv.c int hv_post_message(union hv_connection_id connection_id,

Quoted 5 lines
drivers/hv/hv.c +1 -1
 	aligned_msg->payload_size = payload_size;
 	memcpy((void *)aligned_msg->payload, payload, payload_size);
 
-	status = do_hypercall(HVCALL_POST_MESSAGE, aligned_msg, NULL)
+	status = hv_do_hypercall(HVCALL_POST_MESSAGE, aligned_msg,

NULL)

drivers/hv/hv.c u16 hv_signal_event(void *con_id) · line 350

Quoted 8 lines
drivers/hv/hv.c +0 -1
 		& 0xFFFF;
 
 	put_cpu();
@@ -347,7 +348,7 @@ u16 hv_signal_event(void *con_id)
 {
 	u16 status;
 
-	status = (do_hypercall(HVCALL_SIGNAL_EVENT, con_id, NULL) &

0xFFFF);

drivers/hv/hv.c u16 hv_signal_event(void *con_id) · line 351

Quoted 1 line
drivers/hv/hv.c +1 -0
+	status = (hv_do_hypercall(HVCALL_SIGNAL_EVENT, con_id, NULL) &

0xFFFF);

Quoted 8 lines
Quoted 1 line

What's with the crazy () around a function call?

I will address this and resend.

Quoted 3 lines

And why are you passing a 64bit return value into a 16bit status value? That seems like something is broken.

The low order 16 bits have the valid status codes we are interested in.

Then why even return a 64bit number if no one uses it?

greg k-h

#6 lore raw

RE: [PATCH 2/3] drivers:hv: Export the API to invoke a hypercall on Hyper-V

Quoted 92 lines

-----Original Message-----
From: Greg KH [mailto:[email protected]]
Sent: Monday, September 21, 2015 9:41 AM
To: KY Srinivasan <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Jake Oshins <[email protected]>
Subject: Re: [PATCH 2/3] drivers:hv: Export the API to invoke a hypercall on Hyper-V

Quoted 10 lines · KY Srinivasan
Quoted 10 lines

-----Original Message-----
From: Greg KH [mailto:[email protected]]
Sent: Sunday, September 20, 2015 10:28 PM
To: KY Srinivasan <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Jake Oshins <[email protected]>
Subject: Re: [PATCH 2/3] drivers:hv: Export the API to invoke a hypercall

on

Quoted 6 lines
Quoted 6 lines

Hyper-V

Quoted 3 lines · K. Y. Srinivasan

From: Jake Oshins <[email protected]>

This patch exposes the function that hv_vmbus.ko uses to make

hypercalls.

Quoted 4 lines
Quoted 4 lines

This

Quoted 3 lines

is necessary for retargeting an interrupt when it is given a new affinity.

Since we are exporting this API, rename the API as it will be visible

outside

Quoted 56 lines
Quoted 55 lines

drivers/hv/hv.c static u64 do_hypercall(u64 control, void *input,

Quoted 26 lines

the hv.c file.

---
 drivers/hv/hv.c        |    9 +++++----
 include/linux/hyperv.h |    1 +
 2 files changed, 6 insertions(+), 4 deletions(-)
drivers/hv/hv.c +2 -2
index 6341be8..a7b6c6a 100644
@@ -89,9 +89,9 @@ static int query_hypervisor_info(void)
 }
 
 /*
- * do_hypercall- Invoke the specified hypercall
+ * hv_do_hypercall- Invoke the specified hypercall
  */
-static u64 do_hypercall(u64 control, void *input, void *output)
+u64 hv_do_hypercall(u64 control, void *input, void *output)
 {
 	u64 input_address = (input) ? virt_to_phys(input) : 0;
 	u64 output_address = (output) ? virt_to_phys(output) : 0;
@@ -132,6 +132,7 @@ static u64 do_hypercall(u64 control, void *input,

void *output)

drivers/hv/hv.c int hv_post_message(union hv_connection_id

Quoted 8 lines
drivers/hv/hv.c +1 -0
 	return hv_status_lo | ((u64)hv_status_hi << 32);
 #endif /* !x86_64 */
 }
+EXPORT_SYMBOL_GPL(hv_do_hypercall);
 
 #ifdef CONFIG_X86_64
 static cycle_t read_hv_clock_tsc(struct clocksource *arg)
@@ -329,7 +330,7 @@ int hv_post_message(union hv_connection_id

connection_id,

drivers/hv/hv.c int hv_post_message(union hv_connection_id connection_id,

Quoted 5 lines
drivers/hv/hv.c +1 -1
 	aligned_msg->payload_size = payload_size;
 	memcpy((void *)aligned_msg->payload, payload, payload_size);
 
-	status = do_hypercall(HVCALL_POST_MESSAGE, aligned_msg, NULL)
+	status = hv_do_hypercall(HVCALL_POST_MESSAGE, aligned_msg,

NULL)

drivers/hv/hv.c u16 hv_signal_event(void *con_id) · line 350

Quoted 8 lines
drivers/hv/hv.c +0 -1
 		& 0xFFFF;
 
 	put_cpu();
@@ -347,7 +348,7 @@ u16 hv_signal_event(void *con_id)
 {
 	u16 status;
 
-	status = (do_hypercall(HVCALL_SIGNAL_EVENT, con_id, NULL) &

0xFFFF);

drivers/hv/hv.c u16 hv_signal_event(void *con_id) · line 351

Quoted 1 line
drivers/hv/hv.c +1 -0
+	status = (hv_do_hypercall(HVCALL_SIGNAL_EVENT, con_id, NULL) &

0xFFFF);

What's with the crazy () around a function call?

Quoted 8 lines
Quoted 6 lines

I will address this and resend.

Quoted 3 lines

And why are you passing a 64bit return value into a 16bit status value? That seems like something is broken.

The low order 16 bits have the valid status codes we are interested in.

Then why even return a 64bit number if no one uses it?

The hypervisor ABI specifies a 64 bit return value.

K. Y

Quoted 2 lines

greg k-h

#7 lore raw

Re: [PATCH 2/3] drivers:hv: Export the API to invoke a hypercall on Hyper-V

Quoted 94 lines · KY Srinivasan
Quoted 94 lines

-----Original Message-----
From: Greg KH [mailto:[email protected]]
Sent: Monday, September 21, 2015 9:41 AM
To: KY Srinivasan <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Jake Oshins <[email protected]>
Subject: Re: [PATCH 2/3] drivers:hv: Export the API to invoke a hypercall on Hyper-V

Quoted 10 lines · KY Srinivasan
Quoted 10 lines

-----Original Message-----
From: Greg KH [mailto:[email protected]]
Sent: Sunday, September 20, 2015 10:28 PM
To: KY Srinivasan <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Jake Oshins <[email protected]>
Subject: Re: [PATCH 2/3] drivers:hv: Export the API to invoke a hypercall

on

Quoted 6 lines
Quoted 6 lines

Hyper-V

Quoted 3 lines · K. Y. Srinivasan

From: Jake Oshins <[email protected]>

This patch exposes the function that hv_vmbus.ko uses to make

hypercalls.

Quoted 4 lines
Quoted 4 lines

This

Quoted 3 lines

is necessary for retargeting an interrupt when it is given a new affinity.

Since we are exporting this API, rename the API as it will be visible

outside

Quoted 58 lines
Quoted 49 lines

drivers/hv/hv.c static u64 do_hypercall(u64 control, void *input,

Quoted 26 lines

the hv.c file.

---
 drivers/hv/hv.c        |    9 +++++----
 include/linux/hyperv.h |    1 +
 2 files changed, 6 insertions(+), 4 deletions(-)
drivers/hv/hv.c +2 -2
index 6341be8..a7b6c6a 100644
@@ -89,9 +89,9 @@ static int query_hypervisor_info(void)
 }
 
 /*
- * do_hypercall- Invoke the specified hypercall
+ * hv_do_hypercall- Invoke the specified hypercall
  */
-static u64 do_hypercall(u64 control, void *input, void *output)
+u64 hv_do_hypercall(u64 control, void *input, void *output)
 {
 	u64 input_address = (input) ? virt_to_phys(input) : 0;
 	u64 output_address = (output) ? virt_to_phys(output) : 0;
@@ -132,6 +132,7 @@ static u64 do_hypercall(u64 control, void *input,

void *output)

drivers/hv/hv.c int hv_post_message(union hv_connection_id

Quoted 8 lines
drivers/hv/hv.c +1 -0
 	return hv_status_lo | ((u64)hv_status_hi << 32);
 #endif /* !x86_64 */
 }
+EXPORT_SYMBOL_GPL(hv_do_hypercall);
 
 #ifdef CONFIG_X86_64
 static cycle_t read_hv_clock_tsc(struct clocksource *arg)
@@ -329,7 +330,7 @@ int hv_post_message(union hv_connection_id

connection_id,

drivers/hv/hv.c int hv_post_message(union hv_connection_id connection_id,

Quoted 5 lines
drivers/hv/hv.c +1 -1
 	aligned_msg->payload_size = payload_size;
 	memcpy((void *)aligned_msg->payload, payload, payload_size);
 
-	status = do_hypercall(HVCALL_POST_MESSAGE, aligned_msg, NULL)
+	status = hv_do_hypercall(HVCALL_POST_MESSAGE, aligned_msg,

NULL)

Quoted 7 lines
drivers/hv/hv.c +0 -0
 		& 0xFFFF;
 
 	put_cpu();
@@ -347,7 +348,7 @@ u16 hv_signal_event(void *con_id)
 {
 	u16 status;
 
Quoted 6 lines

drivers/hv/hv.c u16 hv_signal_event(void *con_id) · line 350

Quoted 1 line
drivers/hv/hv.c +0 -1
-	status = (do_hypercall(HVCALL_SIGNAL_EVENT, con_id, NULL) &

0xFFFF);

drivers/hv/hv.c u16 hv_signal_event(void *con_id) · line 351

Quoted 1 line
drivers/hv/hv.c +1 -0
+	status = (hv_do_hypercall(HVCALL_SIGNAL_EVENT, con_id, NULL) &

0xFFFF);

What's with the crazy () around a function call?

I will address this and resend.

Quoted 1 line
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

And why are you passing a 64bit return value into a 16bit status value? That seems like something is broken.

The low order 16 bits have the valid status codes we are interested in.

Then why even return a 64bit number if no one uses it?

The hypervisor ABI specifies a 64 bit return value.

Then just fricken return a 32bit value, don't force everyone who calls it to do themselves...

greg k-h

#8 lore raw

RE: [PATCH 2/3] drivers:hv: Export the API to invoke a hypercall on Hyper-V

Quoted 120 lines

-----Original Message-----
From: Greg KH [mailto:[email protected]]
Sent: Monday, September 21, 2015 1:45 PM
To: KY Srinivasan <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; Jake Oshins <[email protected]>; [email protected]; [email protected]
Subject: Re: [PATCH 2/3] drivers:hv: Export the API to invoke a hypercall on Hyper-V

Quoted 10 lines · KY Srinivasan
Quoted 10 lines

-----Original Message-----
From: Greg KH [mailto:[email protected]]
Sent: Monday, September 21, 2015 9:41 AM
To: KY Srinivasan <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Jake Oshins <[email protected]>
Subject: Re: [PATCH 2/3] drivers:hv: Export the API to invoke a hypercall

on

Quoted 5 lines
Quoted 5 lines

Hyper-V

Quoted 2 lines · KY Srinivasan
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

-----Original Message-----
From: Greg KH [mailto:[email protected]]
Sent: Sunday, September 20, 2015 10:28 PM
To: KY Srinivasan <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Jake Oshins <[email protected]>
Subject: Re: [PATCH 2/3] drivers:hv: Export the API to invoke a

hypercall

Quoted 10 lines
Quoted 10 lines

on

Quoted 6 lines
Quoted 6 lines

Hyper-V

Quoted 3 lines · K. Y. Srinivasan

From: Jake Oshins <[email protected]>

This patch exposes the function that hv_vmbus.ko uses to make

hypercalls.

Quoted 2 lines
Quoted 2 lines

This

Quoted 1 line

is necessary for retargeting an interrupt when it is given a new

affinity.

Quoted 19 lines
Quoted 19 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

Since we are exporting this API, rename the API as it will be visible

outside

Quoted 16 lines
Quoted 16 lines
Quoted 16 lines

the hv.c file.

---
 drivers/hv/hv.c        |    9 +++++----
 include/linux/hyperv.h |    1 +
 2 files changed, 6 insertions(+), 4 deletions(-)
drivers/hv/hv.c +0 -0
index 6341be8..a7b6c6a 100644
@@ -89,9 +89,9 @@ static int query_hypervisor_info(void)
 }
 
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines

drivers/hv/hv.c static u64 do_hypercall(u64 control, void

Quoted 10 lines
drivers/hv/hv.c +2 -2
 /*
- * do_hypercall- Invoke the specified hypercall
+ * hv_do_hypercall- Invoke the specified hypercall
  */
-static u64 do_hypercall(u64 control, void *input, void *output)
+u64 hv_do_hypercall(u64 control, void *input, void *output)
 {
 	u64 input_address = (input) ? virt_to_phys(input) : 0;
 	u64 output_address = (output) ? virt_to_phys(output) : 0;
@@ -132,6 +132,7 @@ static u64 do_hypercall(u64 control, void

*input,

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

void *output)

drivers/hv/hv.c int hv_post_message(union

Quoted 8 lines
drivers/hv/hv.c +1 -0
 	return hv_status_lo | ((u64)hv_status_hi << 32);
 #endif /* !x86_64 */
 }
+EXPORT_SYMBOL_GPL(hv_do_hypercall);
 
 #ifdef CONFIG_X86_64
 static cycle_t read_hv_clock_tsc(struct clocksource *arg)
@@ -329,7 +330,7 @@ int hv_post_message(union

hv_connection_id

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

connection_id,

Quoted 2 lines
drivers/hv/hv.c +0 -0
 	aligned_msg->payload_size = payload_size;
 	memcpy((void *)aligned_msg->payload, payload,

payload_size);

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

drivers/hv/hv.c int hv_post_message(union · line 331

Quoted 2 lines
drivers/hv/hv.c +0 -1
-	status = do_hypercall(HVCALL_POST_MESSAGE,

aligned_msg, NULL)

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

drivers/hv/hv.c int hv_post_message(union · line 332

Quoted 1 line
drivers/hv/hv.c +1 -0
+	status = hv_do_hypercall(HVCALL_POST_MESSAGE,

aligned_msg,

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

NULL)

drivers/hv/hv.c u16 hv_signal_event(void *con_id) · line 350

Quoted 8 lines
drivers/hv/hv.c +0 -1
 		& 0xFFFF;
 
 	put_cpu();
@@ -347,7 +348,7 @@ u16 hv_signal_event(void *con_id)
 {
 	u16 status;
 
-	status = (do_hypercall(HVCALL_SIGNAL_EVENT, con_id,

NULL) &

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

0xFFFF);

drivers/hv/hv.c u16 hv_signal_event(void *con_id) · line 351

Quoted 1 line
drivers/hv/hv.c +1 -0
+	status = (hv_do_hypercall(HVCALL_SIGNAL_EVENT, con_id,

NULL) &

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 3 lines

0xFFFF);

What's with the crazy () around a function call?

I will address this and resend.

Quoted 3 lines

And why are you passing a 64bit return value into a 16bit status value? That seems like something is broken.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

The low order 16 bits have the valid status codes we are interested in.

Then why even return a 64bit number if no one uses it?

The hypervisor ABI specifies a 64 bit return value.

Then just fricken return a 32bit value, don't force everyone who calls it to do themselves...

Sorry for the confusion. The generic hypercall primitive will return a 64 bit value that includes the status bits and other information. As we export the ability to invoke the hypercall, we should preserve the 64 bits of the return value as the potential consumers of this hypercall interface may care about the other information in the return value.

Currently, we have a couple of wrappers built on the hypercall primitive that just need to return the status value and don't care about other bits in the return value. I will cleanup the code in these wrappers functions (two to be precise).

Regards,

K. Y

Quoted 2 lines

greg k-h

#9 lore raw

PATCH 3/3 drivers:hv: Define the channel type for Hyper-V PCI Express pass-through

In reply to K. Y. Srinivasan

From: Jake Oshins <[email protected]>

This defines the channel type for PCI front-ends in Hyper-V VMs.

---
 include/linux/hyperv.h |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
include/linux/hyperv.h +11 -0
index ea0a0e3..5587899 100644
@@ -1140,6 +1140,17 @@ u64 hv_do_hypercall(u64 control, void *input, void *output);
 		}
 
 /*
+ * PCI Express Pass Through
+ * {44C4F61D-4444-4400-9D52-802E27EDE19F}
+ */
+
+#define HV_PCIE_GUID \
+	.guid = { \
+			0x1D, 0xF6, 0xC4, 0x44, 0x44, 0x44, 0x00, 0x44, \
+			0x9D, 0x52, 0x80, 0x2E, 0x27, 0xED, 0xE1, 0x9F \
+		}
+
+/*
  * Common header for Hyper-V ICs
  */
 
Signature · 1 line
1.7.4.1
#10 lore raw

Re: [PATCH 3/3] drivers:hv: Define the channel type for Hyper-V PCI Express pass-through

Quoted 21 lines · K. Y. Srinivasan

From: Jake Oshins <[email protected]>

This defines the channel type for PCI front-ends in Hyper-V VMs.

---
 include/linux/hyperv.h |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
include/linux/hyperv.h +3 -0
index ea0a0e3..5587899 100644
@@ -1140,6 +1140,17 @@ u64 hv_do_hypercall(u64 control, void *input, void *output);
 		}
 
 /*
+ * PCI Express Pass Through
+ * {44C4F61D-4444-4400-9D52-802E27EDE19F}
+ */

include/linux/hyperv.h u64 hv_do_hypercall(u64 control, void *input, void *output); · line 1155

Quoted 10 lines
include/linux/hyperv.h +8 -0
+
+#define HV_PCIE_GUID \
+	.guid = { \
+			0x1D, 0xF6, 0xC4, 0x44, 0x44, 0x44, 0x00, 0x44, \
+			0x9D, 0x52, 0x80, 0x2E, 0x27, 0xED, 0xE1, 0x9F \
+		}
+
+/*
  * Common header for Hyper-V ICs
  */

Yet you do nothing with this, so why add it to the code at this point in time? I can't take pointless things like this...

#11 lore raw

RE: [PATCH 3/3] drivers:hv: Define the channel type for Hyper-V PCI Express pass-through

Quoted 40 lines

-----Original Message-----
From: Greg KH [mailto:[email protected]]
Sent: Sunday, September 20, 2015 10:29 PM
To: KY Srinivasan <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Jake Oshins <[email protected]>
Subject: Re: [PATCH 3/3] drivers:hv: Define the channel type for Hyper-V PCI Express pass-through

include/linux/hyperv.h u64 hv_do_hypercall(u64 control, void *input,

Quoted 15 lines · K. Y. Srinivasan

From: Jake Oshins <[email protected]>

This defines the channel type for PCI front-ends in Hyper-V VMs.

---
 include/linux/hyperv.h |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
include/linux/hyperv.h +0 -0
index ea0a0e3..5587899 100644
@@ -1140,6 +1140,17 @@ u64 hv_do_hypercall(u64 control, void *input,

void *output);

Quoted 11 lines
include/linux/hyperv.h +8 -0
 		}
 
 /*
+ * PCI Express Pass Through
+ * {44C4F61D-4444-4400-9D52-802E27EDE19F}
+ */
+
+#define HV_PCIE_GUID \
+	.guid = { \
+			0x1D, 0xF6, 0xC4, 0x44, 0x44, 0x44, 0x00, 0x44, \
+			0x9D, 0x52, 0x80, 0x2E, 0x27, 0xED, 0xE1, 0x9F \
Quoted 8 lines

include/linux/hyperv.h u64 hv_do_hypercall(u64 control, void *input, void *output); · line 1155

Quoted 5 lines
include/linux/hyperv.h +3 -0
+		}
+
+/*
  * Common header for Hyper-V ICs
  */

Yet you do nothing with this, so why add it to the code at this point in time? I can't take pointless things like this...

Greg,

This is a valid GUID that the host can offer us today. The driver to handle this is currently under review (Jake has posted the code). Traditionally, we have kept our header files in synch with the host functionality.

Regards,

K. Y

#12 lore raw

Re: [PATCH 3/3] drivers:hv: Define the channel type for Hyper-V PCI Express pass-through

Quoted 49 lines · KY Srinivasan
Quoted 40 lines

-----Original Message-----
From: Greg KH [mailto:[email protected]]
Sent: Sunday, September 20, 2015 10:29 PM
To: KY Srinivasan <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Jake Oshins <[email protected]>
Subject: Re: [PATCH 3/3] drivers:hv: Define the channel type for Hyper-V PCI Express pass-through

include/linux/hyperv.h u64 hv_do_hypercall(u64 control, void *input,

Quoted 15 lines · K. Y. Srinivasan

From: Jake Oshins <[email protected]>

This defines the channel type for PCI front-ends in Hyper-V VMs.

---
 include/linux/hyperv.h |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
include/linux/hyperv.h +0 -0
index ea0a0e3..5587899 100644
@@ -1140,6 +1140,17 @@ u64 hv_do_hypercall(u64 control, void *input,

void *output);

Quoted 11 lines
include/linux/hyperv.h +8 -0
 		}
 
 /*
+ * PCI Express Pass Through
+ * {44C4F61D-4444-4400-9D52-802E27EDE19F}
+ */
+
+#define HV_PCIE_GUID \
+	.guid = { \
+			0x1D, 0xF6, 0xC4, 0x44, 0x44, 0x44, 0x00, 0x44, \
+			0x9D, 0x52, 0x80, 0x2E, 0x27, 0xED, 0xE1, 0x9F \
Quoted 8 lines

include/linux/hyperv.h u64 hv_do_hypercall(u64 control, void *input, void *output); · line 1155

Quoted 5 lines
include/linux/hyperv.h +3 -0
+		}
+
+/*
  * Common header for Hyper-V ICs
  */

Yet you do nothing with this, so why add it to the code at this point in time? I can't take pointless things like this...

Quoted 4 lines

Greg,

This is a valid GUID that the host can offer us today. The driver to handle this is currently under review (Jake has posted the code). Traditionally, we have kept our header files in synch with the host functionality.

But please don't add things that are not used, that's pretty pointless.

Also wrap your email lines properly :)

thanks,

greg k-h