Skip to contentSkip to conversation

hyper-v: allow access to vmbus from userspace driver

PATCH In review Stephen Hemminger 2 participants 3 messages Feb 4, 2015 – Feb 5, 2015 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 hyper-v: allow access to vmbus from userspace driver

This is enables the hyper-v driver for DPDK <[email protected]>. The hv_uio driver needs to access the shared vmbus monitor
pages.

I would also like to put hv_uio in upstream kernel like other uio drivers, but need to get API accepted with DPDK first.

---
v2 - simplify and rename to vmbus_get_monitor_pages

 drivers/hv/connection.c |   20 +++++++++++++++++---
 include/linux/hyperv.h  |    3 +++
 2 files changed, 20 insertions(+), 3 deletions(-)
drivers/hv/connection.c +9 -3
@@ -64,6 +64,15 @@ static __u32 vmbus_get_next_version(__u3
 	}
 }
 
+void vmbus_get_monitor_pages(unsigned long *int_page,
+			     unsigned long monitor_pages[2])
+{
+	*int_page = (unsigned long)vmbus_connection.int_page;
+	monitor_pages[0] = (unsigned long)vmbus_connection.monitor_pages[0];
+	monitor_pages[1] = (unsigned long)vmbus_connection.monitor_pages[1];
+}
+EXPORT_SYMBOL_GPL(vmbus_get_monitor_pages);
+
 static int vmbus_negotiate_version(struct vmbus_channel_msginfo *msginfo,
 					__u32 version)
 {
@@ -347,10 +356,7 @@ static void process_chn_event(u32 relid)
 			else
 				bytes_to_read = 0;
 		} while (read_state && (bytes_to_read != 0));
-	} else {
-		pr_err("no channel callback for relid - %u\n", relid);
 	}
-
 }
 
 /*
include/linux/hyperv.h +3 -0
@@ -868,6 +868,9 @@ extern int vmbus_recvpacket_raw(struct v
 
 extern void vmbus_ontimer(unsigned long data);
 
+extern void vmbus_get_monitor_pages(unsigned long *int_page,
+				    unsigned long monitor_pages[2]);
+
 /* Base driver object */
 struct hv_driver {
 	const char *name;
#1 lore raw
Quoted 3 lines · Stephen Hemminger

This is enables the hyper-v driver for DPDK <[email protected]>. The hv_uio driver needs to access the shared vmbus monitor pages.

Why can't we just make vmbus_connection struct public?

Quoted 17 lines

I would also like to put hv_uio in upstream kernel like other uio drivers, but need to get API accepted with DPDK first.

---
v2 - simplify and rename to vmbus_get_monitor_pages

 drivers/hv/connection.c |   20 +++++++++++++++++---
 include/linux/hyperv.h  |    3 +++
 2 files changed, 20 insertions(+), 3 deletions(-)

drivers/hv/connection.c static __u32 vmbus_get_next_version(__u3 · line 69

Quoted 6 lines
drivers/hv/connection.c +3 -0
@@ -64,6 +64,15 @@ static __u32 vmbus_get_next_version(__u3
 	}
 }
 
+void vmbus_get_monitor_pages(unsigned long *int_page,
+			     unsigned long monitor_pages[2])
+{

Too weird to be a public interface in my opinion.

Quoted 10 lines
drivers/hv/connection.c +6 -0
+	*int_page = (unsigned long)vmbus_connection.int_page;
+	monitor_pages[0] = (unsigned long)vmbus_connection.monitor_pages[0];
+	monitor_pages[1] = (unsigned long)vmbus_connection.monitor_pages[1];
+}
+EXPORT_SYMBOL_GPL(vmbus_get_monitor_pages);
+
 static int vmbus_negotiate_version(struct vmbus_channel_msginfo *msginfo,
 					__u32 version)
 {

drivers/hv/connection.c static void process_chn_event(u32 relid) · line 360

Quoted 8 lines
drivers/hv/connection.c +0 -3
@@ -347,10 +356,7 @@ static void process_chn_event(u32 relid)
 			else
 				bytes_to_read = 0;
 		} while (read_state && (bytes_to_read != 0));
-	} else {
-		pr_err("no channel callback for relid - %u\n", relid);
 	}
-
 }

This change wasn't mentioned in your commit msg.

Quoted 18 lines
drivers/hv/connection.c +0 -0
 /*
include/linux/hyperv.h +3 -0
@@ -868,6 +868,9 @@ extern int vmbus_recvpacket_raw(struct v
 
 extern void vmbus_ontimer(unsigned long data);
 
+extern void vmbus_get_monitor_pages(unsigned long *int_page,
+				    unsigned long monitor_pages[2]);
+
 /* Base driver object */
 struct hv_driver {
 	const char *name;

_______________________________________________
devel mailing list
[email protected]
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

Signature · 1 line
  Vitaly

A message that is not in the archive (sent off-list or not yet received): 87egq4r5ao.fsf-hpI3/L/TUU23oHxwIazZmlaTQe2KTcn/@public.gmane.org

#3 lore raw
Quoted 46 lines · On Thu, 05 Feb 2015 12:01:03 +0100 Vitaly Kuznetsov…
Quoted 3 lines · Stephen Hemminger

This is enables the hyper-v driver for DPDK <[email protected]>. The hv_uio driver needs to access the shared vmbus monitor
pages.

Why can't we just make vmbus_connection struct public?

Quoted 17 lines

I would also like to put hv_uio in upstream kernel like other uio drivers, but need to get API accepted with DPDK first.

---
v2 - simplify and rename to vmbus_get_monitor_pages

 drivers/hv/connection.c |   20 +++++++++++++++++---
 include/linux/hyperv.h  |    3 +++
 2 files changed, 20 insertions(+), 3 deletions(-)

drivers/hv/connection.c static __u32 vmbus_get_next_version(__u3 · line 69

Quoted 6 lines
drivers/hv/connection.c +3 -0
@@ -64,6 +64,15 @@ static __u32 vmbus_get_next_version(__u3
 	}
 }
 
+void vmbus_get_monitor_pages(unsigned long *int_page,
+			     unsigned long monitor_pages[2])
+{

Too weird to be a public interface in my opinion.

Quoted 12 lines
drivers/hv/connection.c +6 -0
+	*int_page = (unsigned long)vmbus_connection.int_page;
+	monitor_pages[0] = (unsigned long)vmbus_connection.monitor_pages[0];
+	monitor_pages[1] = (unsigned long)vmbus_connection.monitor_pages[1];
+}
+EXPORT_SYMBOL_GPL(vmbus_get_monitor_pages);
+
 static int vmbus_negotiate_version(struct vmbus_channel_msginfo *msginfo,
 					__u32 version)
 {
@@ -347,10 +356,7 @@ static void process_chn_event(u32 relid)
 			else
 				bytes_to_read = 0;
Quoted 8 lines

drivers/hv/connection.c static void process_chn_event(u32 relid) · line 360

Quoted 6 lines
drivers/hv/connection.c +0 -3
 		} while (read_state && (bytes_to_read != 0));
-	} else {
-		pr_err("no channel callback for relid - %u\n", relid);
 	}
-
 }

This change wasn't mentioned in your commit msg.

Was in earlier commit. Need to prevent driver from logging error when device is not claimed directly by existing kernel devices.