[PATCH] xen block: remove driver_data direct access of struct device
From: Greg Kroah-Hartman gre...@suse.de In the near future, the driver core is going to not allow direct access to the driver_data pointer in struct device. Instead, the functions dev_get_drvdata() and dev_set_drvdata() should be used. These functions have been around since the beginning, so are backwards compatible with all older kernel versions. Cc: xen-de...@lists.xensource.com Cc: virtualizat...@lists.osdl.org Cc: Chris Wright chr...@sous-sol.org Cc: Jeremy Fitzhardinge jer...@xensource.com Signed-off-by: Greg Kroah-Hartman gre...@suse.de --- drivers/block/xen-blkfront.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) --- a/drivers/block/xen-blkfront.c +++ b/drivers/block/xen-blkfront.c @@ -755,12 +755,12 @@ static int blkfront_probe(struct xenbus_ /* Front end dir is a number, which is used as the id. */ info-handle = simple_strtoul(strrchr(dev-nodename, '/')+1, NULL, 0); - dev-dev.driver_data = info; + dev_det_drvdata(dev-dev, info); err = talk_to_backend(dev, info); if (err) { kfree(info); - dev-dev.driver_data = NULL; + dev_det_drvdata(dev-dev, NULL); return err; } @@ -845,7 +845,7 @@ static int blkif_recover(struct blkfront */ static int blkfront_resume(struct xenbus_device *dev) { - struct blkfront_info *info = dev-dev.driver_data; + struct blkfront_info *info = dev_get_drvdata(dev-dev); int err; dev_dbg(dev-dev, blkfront_resume: %s\n, dev-nodename); @@ -924,7 +924,7 @@ static void blkfront_connect(struct blkf */ static void blkfront_closing(struct xenbus_device *dev) { - struct blkfront_info *info = dev-dev.driver_data; + struct blkfront_info *info = dev_get_drvdata(dev-dev); unsigned long flags; dev_dbg(dev-dev, blkfront_closing: %s removed\n, dev-nodename); @@ -959,7 +959,7 @@ static void blkfront_closing(struct xenb static void backend_changed(struct xenbus_device *dev, enum xenbus_state backend_state) { - struct blkfront_info *info = dev-dev.driver_data; + struct blkfront_info *info = dev_get_drvdata(dev-dev); struct block_device *bd; dev_dbg(dev-dev, blkfront:backend_changed.\n); @@ -997,7 +997,7 @@ static void backend_changed(struct xenbu static int blkfront_remove(struct xenbus_device *dev) { - struct blkfront_info *info = dev-dev.driver_data; + struct blkfront_info *info = dev_get_drvdata(dev-dev); dev_dbg(dev-dev, blkfront_remove: %s removed\n, dev-nodename); @@ -1010,7 +1010,7 @@ static int blkfront_remove(struct xenbus static int blkfront_is_ready(struct xenbus_device *dev) { - struct blkfront_info *info = dev-dev.driver_data; + struct blkfront_info *info = dev_get_drvdata(dev-dev); return info-is_ready; } ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/virtualization
[PATCH] xen: remove driver_data direct access of struct device from more drivers
From: Greg Kroah-Hartman gre...@suse.de In the near future, the driver core is going to not allow direct access to the driver_data pointer in struct device. Instead, the functions dev_get_drvdata() and dev_set_drvdata() should be used. These functions have been around since the beginning, so are backwards compatible with all older kernel versions. Cc: xen-de...@lists.xensource.com Cc: virtualizat...@lists.osdl.org Cc: Chris Wright chr...@sous-sol.org Cc: Jeremy Fitzhardinge jer...@xensource.com Signed-off-by: Greg Kroah-Hartman gre...@suse.de --- drivers/input/xen-kbdfront.c |8 drivers/net/xen-netfront.c | 10 +- drivers/video/xen-fbfront.c |8 3 files changed, 13 insertions(+), 13 deletions(-) --- a/drivers/input/xen-kbdfront.c +++ b/drivers/input/xen-kbdfront.c @@ -114,7 +114,7 @@ static int __devinit xenkbd_probe(struct xenbus_dev_fatal(dev, -ENOMEM, allocating info structure); return -ENOMEM; } - dev-dev.driver_data = info; + dev_set_drvdata(dev-dev, info); info-xbdev = dev; info-irq = -1; snprintf(info-phys, sizeof(info-phys), xenbus/%s, dev-nodename); @@ -186,7 +186,7 @@ static int __devinit xenkbd_probe(struct static int xenkbd_resume(struct xenbus_device *dev) { - struct xenkbd_info *info = dev-dev.driver_data; + struct xenkbd_info *info = dev_get_drvdata(dev-dev); xenkbd_disconnect_backend(info); memset(info-page, 0, PAGE_SIZE); @@ -195,7 +195,7 @@ static int xenkbd_resume(struct xenbus_d static int xenkbd_remove(struct xenbus_device *dev) { - struct xenkbd_info *info = dev-dev.driver_data; + struct xenkbd_info *info = dev_get_drvdata(dev-dev); xenkbd_disconnect_backend(info); if (info-kbd) @@ -266,7 +266,7 @@ static void xenkbd_disconnect_backend(st static void xenkbd_backend_changed(struct xenbus_device *dev, enum xenbus_state backend_state) { - struct xenkbd_info *info = dev-dev.driver_data; + struct xenkbd_info *info = dev_get_drvdata(dev-dev); int ret, val; switch (backend_state) { --- a/drivers/net/xen-netfront.c +++ b/drivers/net/xen-netfront.c @@ -1212,7 +1212,7 @@ static int __devinit netfront_probe(stru } info = netdev_priv(netdev); - dev-dev.driver_data = info; + dev_set_drvdata(dev-dev, info); err = register_netdev(info-netdev); if (err) { @@ -1233,7 +1233,7 @@ static int __devinit netfront_probe(stru fail: free_netdev(netdev); - dev-dev.driver_data = NULL; + dev_set_drvdata(dev-dev, NULL); return err; } @@ -1275,7 +1275,7 @@ static void xennet_disconnect_backend(st */ static int netfront_resume(struct xenbus_device *dev) { - struct netfront_info *info = dev-dev.driver_data; + struct netfront_info *info = dev_get_drvdata(dev-dev); dev_dbg(dev-dev, %s\n, dev-nodename); @@ -1600,7 +1600,7 @@ static int xennet_connect(struct net_dev static void backend_changed(struct xenbus_device *dev, enum xenbus_state backend_state) { - struct netfront_info *np = dev-dev.driver_data; + struct netfront_info *np = dev_get_drvdata(dev-dev); struct net_device *netdev = np-netdev; dev_dbg(dev-dev, %s\n, xenbus_strstate(backend_state)); @@ -1774,7 +1774,7 @@ static struct xenbus_device_id netfront_ static int __devexit xennet_remove(struct xenbus_device *dev) { - struct netfront_info *info = dev-dev.driver_data; + struct netfront_info *info = dev_get_drvdata(dev-dev); dev_dbg(dev-dev, %s\n, dev-nodename); --- a/drivers/video/xen-fbfront.c +++ b/drivers/video/xen-fbfront.c @@ -384,7 +384,7 @@ static int __devinit xenfb_probe(struct fb_size = XENFB_DEFAULT_FB_LEN; } - dev-dev.driver_data = info; + dev_set_drvdata(dev-dev, info); info-xbdev = dev; info-irq = -1; info-x1 = info-y1 = INT_MAX; @@ -503,7 +503,7 @@ xenfb_make_preferred_console(void) static int xenfb_resume(struct xenbus_device *dev) { - struct xenfb_info *info = dev-dev.driver_data; + struct xenfb_info *info = dev_get_drvdata(dev-dev); xenfb_disconnect_backend(info); xenfb_init_shared_page(info, info-fb_info); @@ -512,7 +512,7 @@ static int xenfb_resume(struct xenbus_de static int xenfb_remove(struct xenbus_device *dev) { - struct xenfb_info *info = dev-dev.driver_data; + struct xenfb_info *info = dev_get_drvdata(dev-dev); xenfb_disconnect_backend(info); if (info-fb_info) { @@ -621,7 +621,7 @@ static void xenfb_disconnect_backend(str static void xenfb_backend_changed(struct xenbus_device *dev, enum xenbus_state backend_state) { - struct xenfb_info *info = dev-dev.driver_data; + struct xenfb_info *info = dev_get_drvdata(dev
[PATCH 49/64] xen block: remove driver_data direct access of struct device
In the near future, the driver core is going to not allow direct access to the driver_data pointer in struct device. Instead, the functions dev_get_drvdata() and dev_set_drvdata() should be used. These functions have been around since the beginning, so are backwards compatible with all older kernel versions. Cc: xen-de...@lists.xensource.com Cc: virtualizat...@lists.osdl.org Acked-by: Chris Wright chr...@sous-sol.org Acked-by: Jeremy Fitzhardinge jeremy.fitzhardi...@citrix.com Signed-off-by: Greg Kroah-Hartman gre...@suse.de --- drivers/block/xen-blkfront.c | 14 +++--- 1 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c index c199682..e532847 100644 --- a/drivers/block/xen-blkfront.c +++ b/drivers/block/xen-blkfront.c @@ -753,12 +753,12 @@ static int blkfront_probe(struct xenbus_device *dev, /* Front end dir is a number, which is used as the id. */ info-handle = simple_strtoul(strrchr(dev-nodename, '/')+1, NULL, 0); - dev-dev.driver_data = info; + dev_set_drvdata(dev-dev, info); err = talk_to_backend(dev, info); if (err) { kfree(info); - dev-dev.driver_data = NULL; + dev_set_drvdata(dev-dev, NULL); return err; } @@ -843,7 +843,7 @@ static int blkif_recover(struct blkfront_info *info) */ static int blkfront_resume(struct xenbus_device *dev) { - struct blkfront_info *info = dev-dev.driver_data; + struct blkfront_info *info = dev_get_drvdata(dev-dev); int err; dev_dbg(dev-dev, blkfront_resume: %s\n, dev-nodename); @@ -922,7 +922,7 @@ static void blkfront_connect(struct blkfront_info *info) */ static void blkfront_closing(struct xenbus_device *dev) { - struct blkfront_info *info = dev-dev.driver_data; + struct blkfront_info *info = dev_get_drvdata(dev-dev); unsigned long flags; dev_dbg(dev-dev, blkfront_closing: %s removed\n, dev-nodename); @@ -957,7 +957,7 @@ static void blkfront_closing(struct xenbus_device *dev) static void backend_changed(struct xenbus_device *dev, enum xenbus_state backend_state) { - struct blkfront_info *info = dev-dev.driver_data; + struct blkfront_info *info = dev_get_drvdata(dev-dev); struct block_device *bd; dev_dbg(dev-dev, blkfront:backend_changed.\n); @@ -997,7 +997,7 @@ static void backend_changed(struct xenbus_device *dev, static int blkfront_remove(struct xenbus_device *dev) { - struct blkfront_info *info = dev-dev.driver_data; + struct blkfront_info *info = dev_get_drvdata(dev-dev); dev_dbg(dev-dev, blkfront_remove: %s removed\n, dev-nodename); @@ -1010,7 +1010,7 @@ static int blkfront_remove(struct xenbus_device *dev) static int blkfront_is_ready(struct xenbus_device *dev) { - struct blkfront_info *info = dev-dev.driver_data; + struct blkfront_info *info = dev_get_drvdata(dev-dev); return info-is_ready; } -- 1.6.3.2 ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/virtualization
[PATCH 62/64] xen: remove driver_data direct access of struct device from more drivers
In the near future, the driver core is going to not allow direct access to the driver_data pointer in struct device. Instead, the functions dev_get_drvdata() and dev_set_drvdata() should be used. These functions have been around since the beginning, so are backwards compatible with all older kernel versions. Cc: xen-de...@lists.xensource.com Cc: virtualizat...@lists.osdl.org Acked-by: Chris Wright chr...@sous-sol.org Cc: Jeremy Fitzhardinge jer...@xensource.com Signed-off-by: Greg Kroah-Hartman gre...@suse.de --- drivers/input/xen-kbdfront.c |8 drivers/net/xen-netfront.c | 10 +- drivers/video/xen-fbfront.c |8 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/drivers/input/xen-kbdfront.c b/drivers/input/xen-kbdfront.c index 928d2ed..b115726 100644 --- a/drivers/input/xen-kbdfront.c +++ b/drivers/input/xen-kbdfront.c @@ -114,7 +114,7 @@ static int __devinit xenkbd_probe(struct xenbus_device *dev, xenbus_dev_fatal(dev, -ENOMEM, allocating info structure); return -ENOMEM; } - dev-dev.driver_data = info; + dev_set_drvdata(dev-dev, info); info-xbdev = dev; info-irq = -1; snprintf(info-phys, sizeof(info-phys), xenbus/%s, dev-nodename); @@ -186,7 +186,7 @@ static int __devinit xenkbd_probe(struct xenbus_device *dev, static int xenkbd_resume(struct xenbus_device *dev) { - struct xenkbd_info *info = dev-dev.driver_data; + struct xenkbd_info *info = dev_get_drvdata(dev-dev); xenkbd_disconnect_backend(info); memset(info-page, 0, PAGE_SIZE); @@ -195,7 +195,7 @@ static int xenkbd_resume(struct xenbus_device *dev) static int xenkbd_remove(struct xenbus_device *dev) { - struct xenkbd_info *info = dev-dev.driver_data; + struct xenkbd_info *info = dev_get_drvdata(dev-dev); xenkbd_disconnect_backend(info); if (info-kbd) @@ -266,7 +266,7 @@ static void xenkbd_disconnect_backend(struct xenkbd_info *info) static void xenkbd_backend_changed(struct xenbus_device *dev, enum xenbus_state backend_state) { - struct xenkbd_info *info = dev-dev.driver_data; + struct xenkbd_info *info = dev_get_drvdata(dev-dev); int ret, val; switch (backend_state) { diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c index f673253..8d88dae 100644 --- a/drivers/net/xen-netfront.c +++ b/drivers/net/xen-netfront.c @@ -1212,7 +1212,7 @@ static int __devinit netfront_probe(struct xenbus_device *dev, } info = netdev_priv(netdev); - dev-dev.driver_data = info; + dev_set_drvdata(dev-dev, info); err = register_netdev(info-netdev); if (err) { @@ -1233,7 +1233,7 @@ static int __devinit netfront_probe(struct xenbus_device *dev, fail: free_netdev(netdev); - dev-dev.driver_data = NULL; + dev_set_drvdata(dev-dev, NULL); return err; } @@ -1275,7 +1275,7 @@ static void xennet_disconnect_backend(struct netfront_info *info) */ static int netfront_resume(struct xenbus_device *dev) { - struct netfront_info *info = dev-dev.driver_data; + struct netfront_info *info = dev_get_drvdata(dev-dev); dev_dbg(dev-dev, %s\n, dev-nodename); @@ -1600,7 +1600,7 @@ static int xennet_connect(struct net_device *dev) static void backend_changed(struct xenbus_device *dev, enum xenbus_state backend_state) { - struct netfront_info *np = dev-dev.driver_data; + struct netfront_info *np = dev_get_drvdata(dev-dev); struct net_device *netdev = np-netdev; dev_dbg(dev-dev, %s\n, xenbus_strstate(backend_state)); @@ -1774,7 +1774,7 @@ static struct xenbus_device_id netfront_ids[] = { static int __devexit xennet_remove(struct xenbus_device *dev) { - struct netfront_info *info = dev-dev.driver_data; + struct netfront_info *info = dev_get_drvdata(dev-dev); dev_dbg(dev-dev, %s\n, dev-nodename); diff --git a/drivers/video/xen-fbfront.c b/drivers/video/xen-fbfront.c index 2493f05..15502d5 100644 --- a/drivers/video/xen-fbfront.c +++ b/drivers/video/xen-fbfront.c @@ -384,7 +384,7 @@ static int __devinit xenfb_probe(struct xenbus_device *dev, fb_size = XENFB_DEFAULT_FB_LEN; } - dev-dev.driver_data = info; + dev_set_drvdata(dev-dev, info); info-xbdev = dev; info-irq = -1; info-x1 = info-y1 = INT_MAX; @@ -503,7 +503,7 @@ xenfb_make_preferred_console(void) static int xenfb_resume(struct xenbus_device *dev) { - struct xenfb_info *info = dev-dev.driver_data; + struct xenfb_info *info = dev_get_drvdata(dev-dev); xenfb_disconnect_backend(info); xenfb_init_shared_page(info, info-fb_info); @@ -512,7 +512,7 @@ static int xenfb_resume(struct xenbus_device *dev) static int xenfb_remove(struct xenbus_device *dev) { - struct xenfb_info
[patch 00/54] [Announce] Microsoft Hyper-V drivers for Linux
Hi all, I'm happy to announce, that after many months of discussions, Microsoft has released their Hyper-V Linux drivers under the GPLv2. Following this message, will be the patches that add the drivers to the drivers/staging/ tree, and a whole bunch of cleanups. It's taken a long road to get here, and I'd like to thank the following people who made this possible: - Steve Hemminger for the initial prodding and extreme patience - Hank Janssen for providing the code and working with me to get it into a workable and semi-mergable state. His involvement within Microsoft was also invaluable. - Sam Ramji for his push within Microsoft to make this happen in a manner that works with the Linux community. - Novell for sponsoring my work on the Linux Driver project, without which, this would not have even been possible. And there are many others both within Novell and Microsoft, who I do not want to slight by not naming, but the list would be too long to go into. These drivers are to enable Linux to work better when running as a guest on top of the Hyper-V system. There is still a lot of work to do in getting this into proper mergable state, and moving it out of the staging directory, but Hank and I will be undertaking this task. See the TODO file in the drivers/staging/hv/ directory if anyone wishes to help out with this task. The code should be showing up in the linux-next tree soon, as the patches are now in my public tree. If anyone has any questions about this code, please let me and Hank know about it. thanks, greg k-h ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/virtualization
[patch 02/54] Staging: hv: add the Hyper-V driver header files
From: Hank Janssen hjans...@microsoft.com These are the header files for the different Linux Hyper-V drivers to use. Signed-off-by: Hank Janssen hjans...@microsoft.com Signed-off-by: Haiyang Zhang haiya...@microsoft.com Signed-off-by: Greg Kroah-Hartman gre...@suse.de --- drivers/staging/hv/include/NetVscApi.h | 145 + drivers/staging/hv/include/StorVscApi.h | 137 drivers/staging/hv/include/VmbusApi.h | 262 +++ drivers/staging/hv/include/logging.h| 134 drivers/staging/hv/include/osd.h| 263 drivers/staging/hv/include/vmbus.h | 111 + 6 files changed, 1052 insertions(+) create mode 100644 drivers/staging/hv/include/NetVscApi.h create mode 100644 drivers/staging/hv/include/StorVscApi.h create mode 100644 drivers/staging/hv/include/VmbusApi.h create mode 100644 drivers/staging/hv/include/logging.h create mode 100644 drivers/staging/hv/include/osd.h create mode 100644 drivers/staging/hv/include/vmbus.h --- /dev/null +++ b/drivers/staging/hv/include/logging.h @@ -0,0 +1,134 @@ +/* + * + * Copyright (c) 2009, Microsoft Corporation. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place - Suite 330, Boston, MA 02111-1307 USA. + * + * Authors: + * Haiyang Zhang haiya...@microsoft.com + * Hank Janssen hjans...@microsoft.com + * + */ + + +#ifndef _LOGGING_H_ +#define _LOGGING_H_ + +//#include linux/init.h +//#include linux/module.h + +#include osd.h + +#define VMBUS 0x0001 +#define STORVSC0x0002 +#define NETVSC 0x0004 +#define INPUTVSC 0x0008 +#define BLKVSC 0x0010 +#define VMBUS_DRV 0x0100 +#define STORVSC_DRV0x0200 +#define NETVSC_DRV 0x0400 +#define INPUTVSC_DRV 0x0800 +#define BLKVSC_DRV 0x1000 + +#define ALL_MODULES(VMBUS |\ + STORVSC |\ + NETVSC |\ + INPUTVSC|\ + BLKVSC |\ + VMBUS_DRV |\ + STORVSC_DRV |\ + NETVSC_DRV |\ + INPUTVSC_DRV|\ + BLKVSC_DRV) + +// Logging Level +#define CRITICAL_LVL 2 +#define ERROR_LVL 3 +#define WARNING_LVL4 +#define INFO_LVL 6 +#define DEBUG_LVL 7 +#define DEBUG_LVL_ENTEREXIT8 +#define DEBUG_RING_LVL 9 + +extern unsigned int vmbus_loglevel; + +#define ASSERT(expr) \ +if (!(expr)) { \ + LogMsg(%dAssertion failed! %s,%s,%s,line=%d\n, CRITICAL_LVL, #expr,__FILE__,__FUNCTION__,__LINE__); \ + __asm__ __volatile__(int3); \ +} + +#define DPRINT(mod, lvl, fmt, args...) do {\ + if (mod (HIWORD(vmbus_loglevel))) \ + (lvl = LOWORD(vmbus_loglevel))?(LogMsg(%d #mod: %s() fmt \n, DEBUG_LVL, __FUNCTION__, ## args)):(0);\ + } while (0) + +#define DPRINT_DBG(mod, fmt, args...) do {\ + if (mod (HIWORD(vmbus_loglevel))) \ + (DEBUG_LVL = LOWORD(vmbus_loglevel))?(LogMsg(%d #mod: %s() fmt \n, DEBUG_LVL, __FUNCTION__, ## args)):(0);\ + } while (0) + +#define DPRINT_INFO(mod, fmt, args...) do {\ + if (mod (HIWORD(vmbus_loglevel))) \ + (INFO_LVL = LOWORD(vmbus_loglevel))?(LogMsg(%d #mod: fmt \n, INFO_LVL, ## args)):(0);\ + } while (0) + +#define DPRINT_WARN(mod, fmt, args...) do {\ + if (mod (HIWORD(vmbus_loglevel))) \ + (WARNING_LVL = LOWORD(vmbus_loglevel))?(LogMsg(%d #mod: WARNING! fmt \n, WARNING_LVL, ## args)):(0);\ + } while (0) + +#define DPRINT_ERR(mod, fmt, args...) do {\ + if (mod (HIWORD(vmbus_loglevel
[patch 04/54] Staging: hv: add the Hyper-V virtual block driver
From: Hank Janssen hjans...@microsoft.com This is the virtual block driver when running Linux on top of Hyper-V. Signed-off-by: Hank Janssen hjans...@microsoft.com Signed-off-by: Haiyang Zhang haiya...@microsoft.com Signed-off-by: Greg Kroah-Hartman gre...@suse.de --- drivers/staging/hv/BlkVsc.c | 107 ++ drivers/staging/hv/blkvsc_drv.c | 1547 2 files changed, 1654 insertions(+) create mode 100644 drivers/staging/hv/blkvsc.c --- /dev/null +++ b/drivers/staging/hv/BlkVsc.c @@ -0,0 +1,107 @@ +/* + * + * Copyright (c) 2009, Microsoft Corporation. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place - Suite 330, Boston, MA 02111-1307 USA. + * + * Authors: + * Hank Janssen hjans...@microsoft.com + * + */ + + +#include ../storvsc/StorVsc.c + +static const char* gBlkDriverName=blkvsc; + +//{32412632-86cb-44a2-9b5c-50d1417354f5} +static const GUID gBlkVscDeviceType={ + .Data = {0x32, 0x26, 0x41, 0x32, 0xcb, 0x86, 0xa2, 0x44, 0x9b, 0x5c, 0x50, 0xd1, 0x41, 0x73, 0x54, 0xf5} +}; + +// Static routines +static int +BlkVscOnDeviceAdd( + DEVICE_OBJECT *Device, + void*AdditionalInfo + ); + + +int +BlkVscInitialize( + DRIVER_OBJECT *Driver + ) +{ + STORVSC_DRIVER_OBJECT* storDriver = (STORVSC_DRIVER_OBJECT*)Driver; + int ret=0; + + DPRINT_ENTER(BLKVSC); + + // Make sure we are at least 2 pages since 1 page is used for control + ASSERT(storDriver-RingBufferSize = (PAGE_SIZE 1)); + + Driver-name = gBlkDriverName; + memcpy(Driver-deviceType, gBlkVscDeviceType, sizeof(GUID)); + + storDriver-RequestExtSize = sizeof(STORVSC_REQUEST_EXTENSION); + // Divide the ring buffer data size (which is 1 page less than the ring buffer size since that page is reserved for the ring buffer indices) + // by the max request size (which is VMBUS_CHANNEL_PACKET_MULITPAGE_BUFFER + VSTOR_PACKET + UINT64) + storDriver-MaxOutstandingRequestsPerChannel = + ((storDriver-RingBufferSize - PAGE_SIZE) / ALIGN_UP(MAX_MULTIPAGE_BUFFER_PACKET + sizeof(VSTOR_PACKET) + sizeof(UINT64),sizeof(UINT64))); + + DPRINT_INFO(BLKVSC, max io outstd %u, storDriver-MaxOutstandingRequestsPerChannel); + + // Setup the dispatch table + storDriver-Base.OnDeviceAdd= BlkVscOnDeviceAdd; + storDriver-Base.OnDeviceRemove = StorVscOnDeviceRemove; + storDriver-Base.OnCleanup = StorVscOnCleanup; + + storDriver-OnIORequest = StorVscOnIORequest; + + DPRINT_EXIT(BLKVSC); + + return ret; +} + +int +BlkVscOnDeviceAdd( + DEVICE_OBJECT *Device, + void*AdditionalInfo + ) +{ + int ret=0; + STORVSC_DEVICE_INFO *deviceInfo = (STORVSC_DEVICE_INFO*)AdditionalInfo; + + DPRINT_ENTER(BLKVSC); + + ret = StorVscOnDeviceAdd(Device, AdditionalInfo); + + if (ret != 0) + { + DPRINT_EXIT(BLKVSC); + + return ret; + } + + // We need to use the device instance guid to set the path and target id. For IDE devices, the + // device instance id is formatted as bus id - device id - 8899 - . + deviceInfo-PathId = Device-deviceInstance.Data[3] 24 | Device-deviceInstance.Data[2] 16 | + Device-deviceInstance.Data[1] 8 |Device-deviceInstance.Data[0]; + + deviceInfo-TargetId = Device-deviceInstance.Data[5] 8 | Device-deviceInstance.Data[4]; + + DPRINT_EXIT(BLKVSC); + + return ret; +} --- /dev/null +++ b/drivers/staging/hv/blkvsc_drv.c @@ -0,0 +1,1547 @@ +/* + * + * Copyright (c) 2009, Microsoft Corporation. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place - Suite 330
[patch 07/54] Staging: hv: add a TODO file
From: Greg Kroah-Hartman gre...@suse.de First cut at what needs to be done to this codebase. Cc: Hank Janssen hjans...@microsoft.com Cc: Haiyang Zhang haiya...@microsoft.com Signed-off-by: Greg Kroah-Hartman gre...@suse.de --- drivers/staging/hv/TODO | 15 +++ 1 file changed, 15 insertions(+) --- /dev/null +++ b/drivers/staging/hv/TODO @@ -0,0 +1,15 @@ +TODO: + - fix checkpatch warnings/errors + - fix sparse issues + - remove compatibility layer + - fix HANDLE usage to be real pointers + - audit the vmbus to verify it is working properly with the + driver model + - see if the vmbus can be merged with the other virtual busses + in the kernel + - audit the network driver + - audit the block driver + - audit the scsi driver + +Please send patches for this code to Greg Kroah-Hartman gre...@suse.de +and Hank Janssen hjans...@microsoft.com ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/virtualization
[patch 08/54] Staging: hv: make the Hyper-V virtual bus code build
From: Greg Kroah-Hartman gre...@suse.de The #define KERNEL_2_6_27 needs to be set, and I adjusted the include directories a bit to get things to build properly. I also fixed up the direct access of bus_id, as that field is now gone. The hv_vmbus code should now build properly, with no errors. Cc: Hank Janssen hjans...@microsoft.com Cc: Haiyang Zhang haiya...@microsoft.com Signed-off-by: Greg Kroah-Hartman gre...@suse.de --- drivers/staging/hv/Channel.c |4 ++-- drivers/staging/hv/Channel.h |2 +- drivers/staging/hv/ChannelInterface.h|2 +- drivers/staging/hv/ChannelMgmt.c |4 ++-- drivers/staging/hv/ChannelMgmt.h |8 drivers/staging/hv/Connection.c |2 +- drivers/staging/hv/Hv.c |2 +- drivers/staging/hv/Hv.h | 16 drivers/staging/hv/RingBuffer.c |2 +- drivers/staging/hv/RingBuffer.h |2 +- drivers/staging/hv/Sources.c |1 + drivers/staging/hv/Vmbus.c |2 +- drivers/staging/hv/VmbusPrivate.h|4 ++-- drivers/staging/hv/include/ChannelMessages.h |2 +- drivers/staging/hv/osd.c |3 ++- drivers/staging/hv/vmbus_drv.c | 15 --- 16 files changed, 37 insertions(+), 34 deletions(-) --- a/drivers/staging/hv/Channel.c +++ b/drivers/staging/hv/Channel.c @@ -22,8 +22,8 @@ */ -#include osd.h -#include logging.h +#include include/osd.h +#include include/logging.h #include VmbusPrivate.h --- a/drivers/staging/hv/Channel.h +++ b/drivers/staging/hv/Channel.h @@ -25,7 +25,7 @@ #ifndef _CHANNEL_H_ #define _CHANNEL_H_ -#include osd.h +#include include/osd.h #include ChannelMgmt.h #pragma pack(push,1) --- a/drivers/staging/hv/ChannelInterface.h +++ b/drivers/staging/hv/ChannelInterface.h @@ -25,7 +25,7 @@ #ifndef _CHANNEL_INTERFACE_H_ #define _CHANNEL_INTERFACE_H_ -#include VmbusApi.h +#include include/VmbusApi.h INTERNAL void GetChannelInterface( --- a/drivers/staging/hv/ChannelMgmt.c +++ b/drivers/staging/hv/ChannelMgmt.c @@ -22,8 +22,8 @@ */ -#include osd.h -#include logging.h +#include include/osd.h +#include include/logging.h #include VmbusPrivate.h --- a/drivers/staging/hv/ChannelMgmt.h +++ b/drivers/staging/hv/ChannelMgmt.h @@ -25,12 +25,12 @@ #ifndef _CHANNEL_MGMT_H_ #define _CHANNEL_MGMT_H_ -#include osd.h -#include List.h +#include include/osd.h +#include include/List.h #include RingBuffer.h -#include VmbusChannelInterface.h -#include ChannelMessages.h +#include include/VmbusChannelInterface.h +#include include/ChannelMessages.h --- a/drivers/staging/hv/Connection.c +++ b/drivers/staging/hv/Connection.c @@ -22,7 +22,7 @@ */ -#include logging.h +#include include/logging.h #include VmbusPrivate.h --- a/drivers/staging/hv/Hv.c +++ b/drivers/staging/hv/Hv.c @@ -22,7 +22,7 @@ */ -#include logging.h +#include include/logging.h #include VmbusPrivate.h // --- a/drivers/staging/hv/Hv.h +++ b/drivers/staging/hv/Hv.h @@ -25,23 +25,23 @@ #ifndef __HV_H__ #define __HV_H__ -#include osd.h +#include include/osd.h -#include HvTypes.h -#include HvStatus.h +#include include/HvTypes.h +#include include/HvStatus.h //#include HvVmApi.h //#include HvKeApi.h //#include HvMmApi.h //#include HvCpuApi.h -#include HvHalApi.h -#include HvVpApi.h +#include include/HvHalApi.h +#include include/HvVpApi.h //#include HvTrApi.h -#include HvSynicApi.h +#include include/HvSynicApi.h //#include HvAmApi.h //#include HvHkApi.h //#include HvValApi.h -#include HvHcApi.h -#include HvPtApi.h +#include include/HvHcApi.h +#include include/HvPtApi.h enum { --- a/drivers/staging/hv/include/ChannelMessages.h +++ b/drivers/staging/hv/include/ChannelMessages.h @@ -24,7 +24,7 @@ #pragma once -#include VmbusPacketFormat.h +#include VmbusPacketFormat.h #define C_ASSERT(x) typedef UINT32 NTSTATUS; --- a/drivers/staging/hv/osd.c +++ b/drivers/staging/hv/osd.c @@ -21,6 +21,7 @@ * */ +#define KERNEL_2_6_27 #include linux/module.h #include linux/init.h @@ -46,7 +47,7 @@ #include asm/kmap_types.h #include asm/atomic.h -#include osd.h +#include include/osd.h // // Data types --- a/drivers/staging/hv/RingBuffer.c +++ b/drivers/staging/hv/RingBuffer.c @@ -22,7 +22,7 @@ */ -#include logging.h +#include include/logging.h #include RingBuffer.h // --- a/drivers/staging/hv/RingBuffer.h +++ b/drivers/staging/hv/RingBuffer.h @@ -25,7 +25,7 @@ #ifndef _RING_BUFFER_H_ #define _RING_BUFFER_H_ -#include osd.h +#include include/osd.h typedef struct _SG_BUFFER_LIST { PVOID Data; --- a/drivers/staging/hv/Sources.c +++ b/drivers/staging/hv/Sources.c @@ -21,6 +21,7 @@ * */ +#define KERNEL_2_6_27 #include Vmbus.c #include Hv.c --- a/drivers/staging/hv/Vmbus.c +++ b/drivers/staging/hv/Vmbus.c @@ -22,7 +22,7
[patch 50/54] Staging: hv: osd: remove MemoryFence wrapper
From: Greg Kroah-Hartman gre...@suse.de Use the real mb call instead of a wrapper function. Cc: Hank Janssen hjans...@microsoft.com Cc: Haiyang Zhang haiya...@microsoft.com Signed-off-by: Greg Kroah-Hartman gre...@suse.de --- drivers/staging/hv/RingBuffer.c |4 ++-- drivers/staging/hv/Vmbus.c |2 +- drivers/staging/hv/include/osd.h |2 -- drivers/staging/hv/osd.c |5 - 4 files changed, 3 insertions(+), 10 deletions(-) --- a/drivers/staging/hv/include/osd.h +++ b/drivers/staging/hv/include/osd.h @@ -119,8 +119,6 @@ extern void PageFree(void* page, unsigne extern void* MemMapIO(unsigned long phys, unsigned long size); extern void MemUnmapIO(void* virt); -extern void MemoryFence(void); - extern HANDLE TimerCreate(PFN_TIMER_CALLBACK pfnTimerCB, void* context); extern void TimerClose(HANDLE hTimer); extern int TimerStop(HANDLE hTimer); --- a/drivers/staging/hv/osd.c +++ b/drivers/staging/hv/osd.c @@ -197,11 +197,6 @@ void MemUnmapIO(void *virt) //iounmap(virt); } -void MemoryFence() -{ - mb(); -} - void TimerCallback(unsigned long data) { TIMER* t = (TIMER*)data; --- a/drivers/staging/hv/RingBuffer.c +++ b/drivers/staging/hv/RingBuffer.c @@ -411,7 +411,7 @@ RingBufferWrite( sizeof(u64)); // Make sure we flush all writes before updating the writeIndex - MemoryFence(); + mb(); // Now, update the write location SetNextWriteLocation(OutRingInfo, nextWriteLocation); @@ -532,7 +532,7 @@ RingBufferRead( // Make sure all reads are done before we update the read index since // the writer may start writing to the read area once the read index is updated - MemoryFence(); + mb(); // Update the read index SetNextReadLocation(InRingInfo, nextReadLocation); --- a/drivers/staging/hv/Vmbus.c +++ b/drivers/staging/hv/Vmbus.c @@ -426,7 +426,7 @@ VmbusOnMsgDPC( // Make sure the write to MessageType (ie set to HvMessageTypeNone) happens // before we read the MessagePending and EOMing. Otherwise, the EOMing will not deliver // any more messages since there is no empty slot - MemoryFence(); + mb(); if (msg-Header.MessageFlags.MessagePending) { ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/virtualization
[patch 09/54] Staging: hv: use the correct #ifdef for x86-64
From: Greg Kroah-Hartman gre...@suse.de x86-64 needs a different config check. Thanks to Hank for the debugging to determine the fix for this. Cc: Hank Janssen hjans...@microsoft.com Cc: Haiyang Zhang haiya...@microsoft.com Signed-off-by: Greg Kroah-Hartman gre...@suse.de --- drivers/staging/hv/Hv.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/staging/hv/Hv.c +++ b/drivers/staging/hv/Hv.c @@ -165,7 +165,7 @@ HvDoHypercall ( void* Output ) { -#ifdef x86_64 +#ifdef CONFIG_X86_64 UINT64 hvStatus=0; UINT64 inputAddress = (Input)? GetPhysicalAddress(Input) : 0; UINT64 outputAddress = (Output)? GetPhysicalAddress(Output) : 0; ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/virtualization
[patch 16/54] Staging: hv: add the Hyper-V virtual network driver to the build
From: Greg Kroah-Hartman gre...@suse.de Add the Hyper-V virtual network driver to the kernel build system. Cc: Hank Janssen hjans...@microsoft.com Cc: Haiyang Zhang haiya...@microsoft.com Signed-off-by: Greg Kroah-Hartman gre...@suse.de --- drivers/staging/hv/Kconfig |7 +++ drivers/staging/hv/Makefile |2 ++ 2 files changed, 9 insertions(+) --- a/drivers/staging/hv/Kconfig +++ b/drivers/staging/hv/Kconfig @@ -19,3 +19,10 @@ config HYPERV_BLOCK default n help Select this option to enable the Hyper-V virtual block driver. + +config HYPERV_NET + tristate Microsoft Hyper-V virtual network driver + depends on NET + default n + help + Select this option to enable the Hyper-V virtual network driver. --- a/drivers/staging/hv/Makefile +++ b/drivers/staging/hv/Makefile @@ -1,7 +1,9 @@ obj-$(CONFIG_HYPERV) += hv_vmbus.o obj-$(CONFIG_HYPERV_STORAGE) += hv_storvsc.o obj-$(CONFIG_HYPERV_BLOCK) += hv_blkvsc.o +obj-$(CONFIG_HYPERV_NET) += hv_netvsc.o hv_vmbus-objs := vmbus_drv.o osd.o Sources.o hv_storvsc-objs := storvsc_drv.o osd.o StorVsc.o hv_blkvsc-objs := blkvsc_drv.o osd.o BlkVsc.o +hv_netvsc-objs := netvsc_drv.o osd.o NetVsc.o RndisFilter.o ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/virtualization
[patch 24/54] Staging: hv: remove USHORT typedef
From: Greg Kroah-Hartman gre...@suse.de The USHORT typedef is now removed from the Hyper-V driver code. Cc: Hank Janssen hjans...@microsoft.com Cc: Haiyang Zhang haiya...@microsoft.com Signed-off-by: Greg Kroah-Hartman gre...@suse.de --- drivers/staging/hv/include/osd.h |1 - drivers/staging/hv/include/vstorage.h |8 2 files changed, 4 insertions(+), 5 deletions(-) --- a/drivers/staging/hv/include/osd.h +++ b/drivers/staging/hv/include/osd.h @@ -100,7 +100,6 @@ typedef struct _DLIST_ENTRY { typedef unsigned long long ULONGLONG; typedef unsigned int ULONG; -typedef unsigned short USHORT; // // signed types --- a/drivers/staging/hv/include/vstorage.h +++ b/drivers/staging/hv/include/vstorage.h @@ -141,7 +141,7 @@ C_ASSERT(SENSE_BUFFER_SIZE == 0x12); typedef struct { -USHORT Length; +unsigned short Length; unsigned char SrbStatus; unsigned char ScsiStatus; @@ -178,7 +178,7 @@ C_ASSERT((sizeof(VMSCSI_REQUEST) % 4) == typedef struct { -USHORT ProtocolVersion; +unsigned short ProtocolVersion; unsigned char PathId; unsigned char TargetId; @@ -213,7 +213,7 @@ typedef struct // Major (MSW) and minor (LSW) version numbers. // -USHORT MajorMinor; +unsigned short MajorMinor; // @@ -222,7 +222,7 @@ typedef struct // indicate incompatibility--but it does indicate mismatched builds. // -USHORT Revision; +unsigned short Revision; } VMSTORAGE_PROTOCOL_VERSION, *PVMSTORAGE_PROTOCOL_VERSION; ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/virtualization
[patch 44/54] Staging: hv: make Device-RequestLock a real spinlock
From: Greg Kroah-Hartman gre...@suse.de Don't use the wrapper functions for this lock, make it a real lock so that we know what is going on. I don't think we really want to be doing a irqsave for this code, but I left it alone to preserve the original codepath. It should be reviewed later. Cc: Hank Janssen hjans...@microsoft.com Cc: Haiyang Zhang haiya...@microsoft.com Signed-off-by: Greg Kroah-Hartman gre...@suse.de --- drivers/staging/hv/RndisFilter.c | 26 -- 1 file changed, 12 insertions(+), 14 deletions(-) --- a/drivers/staging/hv/RndisFilter.c +++ b/drivers/staging/hv/RndisFilter.c @@ -54,7 +54,7 @@ typedef struct _RNDIS_DEVICE { u32 LinkStatus; u32 NewRequestId; - HANDLE RequestLock; + spinlock_t request_lock; LIST_ENTRY RequestList; unsigned char HwMacAddr[HW_MACADDR_LEN]; @@ -216,12 +216,7 @@ static inline RNDIS_DEVICE* GetRndisDevi return NULL; } - device-RequestLock = SpinlockCreate(); - if (!device-RequestLock) - { - kfree(device); - return NULL; - } + spin_lock_init(device-request_lock); INITIALIZE_LIST_HEAD(device-RequestList); @@ -232,7 +227,6 @@ static inline RNDIS_DEVICE* GetRndisDevi static inline void PutRndisDevice(RNDIS_DEVICE *Device) { - SpinlockClose(Device-RequestLock); kfree(Device); } @@ -241,6 +235,7 @@ static inline RNDIS_REQUEST* GetRndisReq RNDIS_REQUEST *request; RNDIS_MESSAGE *rndisMessage; RNDIS_SET_REQUEST *set; + unsigned long flags; request = kzalloc(sizeof(RNDIS_REQUEST), GFP_KERNEL); if (!request) @@ -265,18 +260,20 @@ static inline RNDIS_REQUEST* GetRndisReq set-RequestId = InterlockedIncrement((int*)Device-NewRequestId); // Add to the request list - SpinlockAcquire(Device-RequestLock); + spin_lock_irqsave(Device-request_lock, flags); INSERT_TAIL_LIST(Device-RequestList, request-ListEntry); - SpinlockRelease(Device-RequestLock); + spin_unlock_irqrestore(Device-request_lock, flags); return request; } static inline void PutRndisRequest(RNDIS_DEVICE *Device, RNDIS_REQUEST *Request) { - SpinlockAcquire(Device-RequestLock); + unsigned long flags; + + spin_lock_irqsave(Device-request_lock, flags); REMOVE_ENTRY_LIST(Request-ListEntry); - SpinlockRelease(Device-RequestLock); + spin_unlock_irqrestore(Device-request_lock, flags); WaitEventClose(Request-WaitEvent); kfree(Request); @@ -385,10 +382,11 @@ RndisFilterReceiveResponse( LIST_ENTRY *curr; RNDIS_REQUEST *request=NULL; bool found = false; + unsigned long flags; DPRINT_ENTER(NETVSC); - SpinlockAcquire(Device-RequestLock); + spin_lock_irqsave(Device-request_lock, flags); ITERATE_LIST_ENTRIES(anchor, curr, Device-RequestList) { request = CONTAINING_RECORD(curr, RNDIS_REQUEST, ListEntry); @@ -403,7 +401,7 @@ RndisFilterReceiveResponse( break; } } - SpinlockRelease(Device-RequestLock); + spin_unlock_irqrestore(Device-request_lock, flags); if (found) { ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/virtualization
[patch 25/54] Staging: hv: remove ULONGLONG and LONGLONG typedefs
From: Greg Kroah-Hartman gre...@suse.de The ULONGLONG and LONGLONG typedefs are now removed from the Hyper-V driver code. Cc: Hank Janssen hjans...@microsoft.com Cc: Haiyang Zhang haiya...@microsoft.com Signed-off-by: Greg Kroah-Hartman gre...@suse.de --- drivers/staging/hv/include/VmbusPacketFormat.h |2 +- drivers/staging/hv/include/osd.h |3 --- drivers/staging/hv/include/vstorage.h |2 +- 3 files changed, 2 insertions(+), 5 deletions(-) --- a/drivers/staging/hv/include/osd.h +++ b/drivers/staging/hv/include/osd.h @@ -97,15 +97,12 @@ typedef struct _DLIST_ENTRY { // // unsigned types // - -typedef unsigned long long ULONGLONG; typedef unsigned int ULONG; // // signed types // typedef intLONG; -typedef long long LONGLONG; // // Other types --- a/drivers/staging/hv/include/VmbusPacketFormat.h +++ b/drivers/staging/hv/include/VmbusPacketFormat.h @@ -44,7 +44,7 @@ typedef struct volatile u32 In;// Offset in bytes from the ring base volatile u32 Out; // Offset in bytes from the ring base }; -volatile LONGLONGInOut; +volatile long long InOut; }; // --- a/drivers/staging/hv/include/vstorage.h +++ b/drivers/staging/hv/include/vstorage.h @@ -196,7 +196,7 @@ typedef struct // vendor specific data in the inquirydata // -ULONGLONG UniqueId; +unsigned long long UniqueId; } VMSTORAGE_CHANNEL_PROPERTIES, *PVMSTORAGE_CHANNEL_PROPERTIES; ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/virtualization
[patch 21/54] Staging: hv: remove UINT16 and INT16 typedefs
From: Greg Kroah-Hartman gre...@suse.de The UINT16 and INT16 typedefs are now removed from the Hyper-V driver code. Cc: Hank Janssen hjans...@microsoft.com Cc: Haiyang Zhang haiya...@microsoft.com Signed-off-by: Greg Kroah-Hartman gre...@suse.de --- drivers/staging/hv/Channel.c |6 +++--- drivers/staging/hv/Channel.h | 16 drivers/staging/hv/include/ChannelMessages.h |4 ++-- drivers/staging/hv/include/HvHcApi.h |4 ++-- drivers/staging/hv/include/HvStatus.h |2 +- drivers/staging/hv/include/HvSynicApi.h| 10 +- drivers/staging/hv/include/VmbusChannelInterface.h |4 ++-- drivers/staging/hv/include/VmbusPacketFormat.h | 14 +++--- drivers/staging/hv/include/nvspprotocol.h |8 drivers/staging/hv/include/osd.h |2 -- 10 files changed, 34 insertions(+), 36 deletions(-) --- a/drivers/staging/hv/Channel.c +++ b/drivers/staging/hv/Channel.c @@ -777,7 +777,7 @@ VmbusChannelSendPacket( desc.Type = Type;//VmbusPacketTypeDataInBand; desc.Flags = Flags;//VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED; desc.DataOffset8 = sizeof(VMPACKET_DESCRIPTOR) 3; // in 8-bytes granularity -desc.Length8 = (UINT16)(packetLenAligned 3); +desc.Length8 = (u16)(packetLenAligned 3); desc.TransactionId = RequestId; bufferList[0].Data = desc; @@ -851,7 +851,7 @@ VmbusChannelSendPacketPageBuffer( desc.Type = VmbusPacketTypeDataUsingGpaDirect; desc.Flags = VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED; desc.DataOffset8 = descSize 3; // in 8-bytes grandularity -desc.Length8 = (UINT16)(packetLenAligned 3); +desc.Length8 = (u16)(packetLenAligned 3); desc.TransactionId = RequestId; desc.RangeCount = PageCount; @@ -936,7 +936,7 @@ VmbusChannelSendPacketMultiPageBuffer( desc.Type = VmbusPacketTypeDataUsingGpaDirect; desc.Flags = VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED; desc.DataOffset8 = descSize 3; // in 8-bytes grandularity -desc.Length8 = (UINT16)(packetLenAligned 3); +desc.Length8 = (u16)(packetLenAligned 3); desc.TransactionId = RequestId; desc.RangeCount = 1; --- a/drivers/staging/hv/Channel.h +++ b/drivers/staging/hv/Channel.h @@ -33,10 +33,10 @@ // The format must be the same as VMDATA_GPA_DIRECT typedef struct _VMBUS_CHANNEL_PACKET_PAGE_BUFFER { -UINT16 Type; -UINT16 DataOffset8; -UINT16 Length8; -UINT16 Flags; +u16Type; +u16DataOffset8; +u16Length8; +u16Flags; UINT64 TransactionId; UINT32 Reserved; UINT32 RangeCount; @@ -46,10 +46,10 @@ typedef struct _VMBUS_CHANNEL_PACKET_PAG // The format must be the same as VMDATA_GPA_DIRECT typedef struct _VMBUS_CHANNEL_PACKET_MULITPAGE_BUFFER { -UINT16 Type; -UINT16 DataOffset8; -UINT16 Length8; -UINT16 Flags; +u16Type; +u16DataOffset8; +u16Length8; +u16Flags; UINT64 TransactionId; UINT32 Reserved; UINT32 RangeCount; // Always 1 in this case --- a/drivers/staging/hv/include/ChannelMessages.h +++ b/drivers/staging/hv/include/ChannelMessages.h @@ -188,8 +188,8 @@ typedef struct _VMBUS_CHANNEL_GPADL_HEAD VMBUS_CHANNEL_MESSAGE_HEADER Header; UINT32 ChildRelId; UINT32 Gpadl; -UINT16 RangeBufLen; -UINT16 RangeCount; +u16 RangeBufLen; +u16 RangeCount; GPA_RANGE Range[0]; } VMBUS_CHANNEL_GPADL_HEADER, *PVMBUS_CHANNEL_GPADL_HEADER; --- a/drivers/staging/hv/include/HvHcApi.h +++ b/drivers/staging/hv/include/HvHcApi.h @@ -55,6 +55,6 @@ typedef struct _HV_INPUT_POST_MESSAGE typedef struct _HV_INPUT_SIGNAL_EVENT { HV_CONNECTION_ID ConnectionId; -UINT16 FlagNumber; -UINT16 RsvdZ; +u16 FlagNumber; +u16 RsvdZ; } HV_INPUT_SIGNAL_EVENT, *PHV_INPUT_SIGNAL_EVENT; --- a/drivers/staging/hv/include/HvStatus.h +++ b/drivers/staging/hv/include/HvStatus.h @@ -26,7 +26,7 @@ // // Status codes for hypervisor operations. // -typedef UINT16 HV_STATUS, *PHV_STATUS; +typedef u16 HV_STATUS, *PHV_STATUS; // // MessageId: HV_STATUS_SUCCESS --- a/drivers/staging/hv/include/HvSynicApi.h +++ b/drivers/staging/hv
[patch 17/54] Staging: hv: remove INTERNAL typedef
From: Greg Kroah-Hartman gre...@suse.de The INTERNAL typedef is now removed from the Hyper-V driver code. Cc: Hank Janssen hjans...@microsoft.com Cc: Haiyang Zhang haiya...@microsoft.com Signed-off-by: Greg Kroah-Hartman gre...@suse.de --- drivers/staging/hv/Channel.h | 24 drivers/staging/hv/ChannelInterface.c | 22 +++--- drivers/staging/hv/ChannelInterface.h |4 ++-- drivers/staging/hv/ChannelMgmt.h | 10 +- drivers/staging/hv/Hv.h | 12 ++-- drivers/staging/hv/RingBuffer.h | 16 drivers/staging/hv/VmbusPrivate.h | 24 ++-- 7 files changed, 54 insertions(+), 58 deletions(-) --- a/drivers/staging/hv/Channel.h +++ b/drivers/staging/hv/Channel.h @@ -62,7 +62,7 @@ typedef struct _VMBUS_CHANNEL_PACKET_MUL // Routines // -INTERNAL int +static int VmbusChannelOpen( VMBUS_CHANNEL *Channel, UINT32 SendRingBufferSize, @@ -73,12 +73,12 @@ VmbusChannelOpen( PVOID Context ); -INTERNAL void +static void VmbusChannelClose( VMBUS_CHANNEL *Channel ); -INTERNAL int +static int VmbusChannelSendPacket( VMBUS_CHANNEL *Channel, const PVOID Buffer, @@ -88,7 +88,7 @@ VmbusChannelSendPacket( UINT32 Flags ); -INTERNAL int +static int VmbusChannelSendPacketPageBuffer( VMBUS_CHANNEL *Channel, PAGE_BUFFER PageBuffers[], @@ -98,7 +98,7 @@ VmbusChannelSendPacketPageBuffer( UINT64 RequestId ); -INTERNAL int +static int VmbusChannelSendPacketMultiPageBuffer( VMBUS_CHANNEL *Channel, MULTIPAGE_BUFFER*MultiPageBuffer, @@ -107,7 +107,7 @@ VmbusChannelSendPacketMultiPageBuffer( UINT64 RequestId ); -INTERNAL int +static int VmbusChannelEstablishGpadl( VMBUS_CHANNEL *Channel, PVOID Kbuffer,// from kmalloc() @@ -115,13 +115,13 @@ VmbusChannelEstablishGpadl( UINT32 *GpadlHandle ); -INTERNAL int +static int VmbusChannelTeardownGpadl( VMBUS_CHANNEL *Channel, UINT32 GpadlHandle ); -INTERNAL int +static int VmbusChannelRecvPacket( VMBUS_CHANNEL *Channel, PVOID Buffer, @@ -130,7 +130,7 @@ VmbusChannelRecvPacket( UINT64* RequestId ); -INTERNAL int +static int VmbusChannelRecvPacketRaw( VMBUS_CHANNEL *Channel, PVOID Buffer, @@ -139,18 +139,18 @@ VmbusChannelRecvPacketRaw( UINT64* RequestId ); -INTERNAL void +static void VmbusChannelOnChannelEvent( VMBUS_CHANNEL *Channel ); -INTERNAL void +static void VmbusChannelGetDebugInfo( VMBUS_CHANNEL *Channel, VMBUS_CHANNEL_DEBUG_INFO*DebugInfo ); -INTERNAL void +static void VmbusChannelOnTimer( void*Context ); --- a/drivers/staging/hv/ChannelInterface.c +++ b/drivers/staging/hv/ChannelInterface.c @@ -23,7 +23,7 @@ #include VmbusPrivate.h -INTERNAL int +static int IVmbusChannelOpen( PDEVICE_OBJECT Device, UINT32 SendBufferSize, @@ -44,7 +44,7 @@ IVmbusChannelOpen( } -INTERNAL void +static void IVmbusChannelClose( PDEVICE_OBJECT Device ) @@ -53,7 +53,7 @@ IVmbusChannelClose( } -INTERNAL int +static int IVmbusChannelSendPacket( PDEVICE_OBJECT Device, const PVOID Buffer, @@ -71,7 +71,7 @@ IVmbusChannelSendPacket( Flags); } -INTERNAL int +static int IVmbusChannelSendPacketPageBuffer( PDEVICE_OBJECT Device, PAGE_BUFFER PageBuffers[], @@ -89,7 +89,7 @@ IVmbusChannelSendPacketPageBuffer( RequestId); } -INTERNAL int +static int IVmbusChannelSendPacketMultiPageBuffer( PDEVICE_OBJECT Device, MULTIPAGE_BUFFER*MultiPageBuffer, @@ -105,7 +105,7 @@ IVmbusChannelSendPacketMultiPageBuffer( RequestId); } -INTERNAL int +static int IVmbusChannelRecvPacket ( PDEVICE_OBJECT Device, PVOID Buffer, @@ -121,7 +121,7 @@ IVmbusChannelRecvPacket
[patch 48/54] Staging: hv: osd: remove spinlock wrapper functions
From: Greg Kroah-Hartman gre...@suse.de Now that there are no users of the wrapper functions for spinlocks, remove them. Cc: Hank Janssen hjans...@microsoft.com Cc: Haiyang Zhang haiya...@microsoft.com Signed-off-by: Greg Kroah-Hartman gre...@suse.de --- drivers/staging/hv/include/osd.h |5 - drivers/staging/hv/osd.c | 37 - 2 files changed, 42 deletions(-) --- a/drivers/staging/hv/include/osd.h +++ b/drivers/staging/hv/include/osd.h @@ -137,11 +137,6 @@ extern int WaitEventWait(HANDLE hWait); // If 0, hWait got signaled. If ==0, timeout. If 0, error extern int WaitEventWaitEx(HANDLE hWait, u32 TimeoutInMs); -extern HANDLE SpinlockCreate(void); -extern void SpinlockClose(HANDLE hSpin); -extern void SpinlockAcquire(HANDLE hSpin); -extern voidSpinlockRelease(HANDLE hSpin); - #define GetVirtualAddress Physical2LogicalAddr void* Physical2LogicalAddr(unsigned long PhysAddr); --- a/drivers/staging/hv/osd.c +++ b/drivers/staging/hv/osd.c @@ -61,11 +61,6 @@ typedef struct _WAITEVENT { wait_queue_head_t event; } WAITEVENT; -typedef struct _SPINLOCK { - spinlock_t lock; - unsigned long flags; -} SPINLOCK; - typedef struct _WORKQUEUE { struct workqueue_struct *queue; } WORKQUEUE; @@ -323,38 +318,6 @@ int WaitEventWaitEx(HANDLE hWait, u32 Ti return ret; } -HANDLE SpinlockCreate(void) -{ - SPINLOCK* spin = kmalloc(sizeof(SPINLOCK), GFP_KERNEL); - if (!spin) - { - return NULL; - } - spin_lock_init(spin-lock); - - return spin; -} - -void SpinlockAcquire(HANDLE hSpin) -{ - SPINLOCK* spin = (SPINLOCK* )hSpin; - - spin_lock_irqsave(spin-lock, spin-flags); -} - -void SpinlockRelease(HANDLE hSpin) -{ - SPINLOCK* spin = (SPINLOCK* )hSpin; - - spin_unlock_irqrestore(spin-lock, spin-flags); -} - -void SpinlockClose(HANDLE hSpin) -{ - SPINLOCK* spin = (SPINLOCK* )hSpin; - kfree(spin); -} - void* Physical2LogicalAddr(unsigned long PhysAddr) { void* logicalAddr = phys_to_virt(PhysAddr); ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/virtualization
[patch 20/54] Staging: hv: remove UINT8 and INT8 typedefs
From: Greg Kroah-Hartman gre...@suse.de The UINT8 and INT8 typedefs are now removed from the Hyper-V driver code. Had to include linux/kernel.h in a few places to get the build to work properly as well. Cc: Hank Janssen hjans...@microsoft.com Cc: Haiyang Zhang haiya...@microsoft.com Signed-off-by: Greg Kroah-Hartman gre...@suse.de --- drivers/staging/hv/BlkVsc.c|2 +- drivers/staging/hv/Channel.c |6 +++--- drivers/staging/hv/ChannelMgmt.c |4 ++-- drivers/staging/hv/ChannelMgmt.h |4 ++-- drivers/staging/hv/NetVsc.c|1 + drivers/staging/hv/RingBuffer.h|4 ++-- drivers/staging/hv/RndisFilter.c |1 + drivers/staging/hv/StorVsc.c |1 + drivers/staging/hv/Vmbus.c |2 +- drivers/staging/hv/include/ChannelMessages.h |2 +- drivers/staging/hv/include/HvSynicApi.h| 14 +++--- drivers/staging/hv/include/StorVscApi.h|2 +- drivers/staging/hv/include/VmbusPacketFormat.h |6 +++--- drivers/staging/hv/include/osd.h |2 -- 14 files changed, 26 insertions(+), 25 deletions(-) --- a/drivers/staging/hv/BlkVsc.c +++ b/drivers/staging/hv/BlkVsc.c @@ -20,7 +20,7 @@ * */ - +#include linux/kernel.h #include StorVsc.c static const char* gBlkDriverName=blkvsc; --- a/drivers/staging/hv/Channel.c +++ b/drivers/staging/hv/Channel.c @@ -21,7 +21,7 @@ * */ - +#include linux/kernel.h #include include/osd.h #include include/logging.h @@ -162,8 +162,8 @@ VmbusChannelGetDebugInfo( ) { HV_MONITOR_PAGE *monitorPage; -UINT8 monitorGroup= (UINT8)Channel-OfferMsg.MonitorId / 32; -UINT8 monitorOffset = (UINT8)Channel-OfferMsg.MonitorId % 32; +u8 monitorGroup= (u8)Channel-OfferMsg.MonitorId / 32; +u8 monitorOffset = (u8)Channel-OfferMsg.MonitorId % 32; //UINT32 monitorBit = 1 monitorOffset; DebugInfo-RelId = Channel-OfferMsg.ChildRelId; --- a/drivers/staging/hv/ChannelMgmt.c +++ b/drivers/staging/hv/ChannelMgmt.c @@ -396,8 +396,8 @@ VmbusChannelOnOffer( DPRINT_DBG(VMBUS, channel object allocated - %p, newChannel); memcpy(newChannel-OfferMsg, offer, sizeof(VMBUS_CHANNEL_OFFER_CHANNEL)); - newChannel-MonitorGroup = (UINT8)offer-MonitorId / 32; - newChannel-MonitorBit = (UINT8)offer-MonitorId % 32; + newChannel-MonitorGroup = (u8)offer-MonitorId / 32; + newChannel-MonitorBit = (u8)offer-MonitorId % 32; // TODO: Make sure the offer comes from our parent partition WorkQueueQueueWorkItem(newChannel-ControlWQ, VmbusChannelProcessOffer, newChannel); --- a/drivers/staging/hv/ChannelMgmt.h +++ b/drivers/staging/hv/ChannelMgmt.h @@ -53,8 +53,8 @@ typedef struct _VMBUS_CHANNEL { VMBUS_CHANNEL_OFFER_CHANNEL OfferMsg; // These are based on the OfferMsg.MonitorId. Save it here for easy access. - UINT8 MonitorGroup; - UINT8 MonitorBit; + u8 MonitorGroup; + u8 MonitorBit; UINT32 RingBufferGpadlHandle; --- a/drivers/staging/hv/include/ChannelMessages.h +++ b/drivers/staging/hv/include/ChannelMessages.h @@ -91,7 +91,7 @@ typedef struct _VMBUS_CHANNEL_OFFER_CHAN VMBUS_CHANNEL_MESSAGE_HEADER Header; VMBUS_CHANNEL_OFFER Offer; UINT32 ChildRelId; -UINT8 MonitorId; +u8 MonitorId; BOOLEAN MonitorAllocated; } VMBUS_CHANNEL_OFFER_CHANNEL, *PVMBUS_CHANNEL_OFFER_CHANNEL; --- a/drivers/staging/hv/include/HvSynicApi.h +++ b/drivers/staging/hv/include/HvSynicApi.h @@ -264,11 +264,11 @@ typedef const HV_CONNECTION_INFO *PCHV_C typedef union _HV_MESSAGE_FLAGS { -UINT8 AsUINT8; +u8 Asu8; struct { -UINT8 MessagePending:1; -UINT8 Reserved:7; +u8 MessagePending:1; +u8 Reserved:7; }; } HV_MESSAGE_FLAGS, *PHV_MESSAGE_FLAGS; @@ -280,9 +280,9 @@ typedef union _HV_MESSAGE_FLAGS typedef struct _HV_MESSAGE_HEADER { HV_MESSAGE_TYPE MessageType; -UINT8 PayloadSize; +u8 PayloadSize; HV_MESSAGE_FLAGSMessageFlags; -UINT8 Reserved[2]; +u8 Reserved[2]; union { HV_PARTITION_ID Sender; @@ -337,7 +337,7 @@ typedef struct _HV_MESSAGE_PAGE typedef union _HV_SYNIC_EVENT_FLAGS { -UINT8 Flags8[HV_EVENT_FLAGS_BYTE_COUNT]; +u8 Flags8[HV_EVENT_FLAGS_BYTE_COUNT]; UINT32 Flags32[HV_EVENT_FLAGS_DWORD_COUNT]; } HV_SYNIC_EVENT_FLAGS, *PHV_SYNIC_EVENT_FLAGS; @@ -483,7 +483,7 @@ typedef struct _HV_MONITOR_PAGE HV_MONITOR_PARAMETER Parameter[4][32]; -UINT8RsvdZ4[1984]; +u8
[patch 23/54] Staging: hv: remove UINT64 and INT64 and UCHAR typedefs
From: Greg Kroah-Hartman gre...@suse.de The UINT64 and INT64 and UCHAR typedefs are now removed from the Hyper-V driver code. Cc: Hank Janssen hjans...@microsoft.com Cc: Haiyang Zhang haiya...@microsoft.com Signed-off-by: Greg Kroah-Hartman gre...@suse.de --- drivers/staging/hv/BlkVsc.c|4 - drivers/staging/hv/Channel.c | 48 +-- drivers/staging/hv/Channel.h | 14 ++--- drivers/staging/hv/ChannelInterface.c | 10 ++-- drivers/staging/hv/Hv.c| 24 - drivers/staging/hv/Hv.h| 12 ++-- drivers/staging/hv/NetVsc.c| 12 ++-- drivers/staging/hv/NetVsc.h|2 drivers/staging/hv/RingBuffer.c| 16 +++--- drivers/staging/hv/RndisFilter.c |2 drivers/staging/hv/StorVsc.c | 12 ++-- drivers/staging/hv/include/ChannelMessages.h | 12 ++-- drivers/staging/hv/include/HvHalApi.h |4 - drivers/staging/hv/include/HvHcApi.h |2 drivers/staging/hv/include/HvPtApi.h | 22 drivers/staging/hv/include/HvSynicApi.h| 52 ++--- drivers/staging/hv/include/HvTypes.h |2 drivers/staging/hv/include/List.h |4 - drivers/staging/hv/include/NetVscApi.h |6 +- drivers/staging/hv/include/StorVscApi.h|6 +- drivers/staging/hv/include/VmbusApi.h | 14 ++--- drivers/staging/hv/include/VmbusChannelInterface.h |6 +- drivers/staging/hv/include/VmbusPacketFormat.h | 10 ++-- drivers/staging/hv/include/osd.h | 22 +--- drivers/staging/hv/include/rndis.h |8 +-- drivers/staging/hv/include/vstorage.h | 34 ++--- 26 files changed, 173 insertions(+), 187 deletions(-) --- a/drivers/staging/hv/BlkVsc.c +++ b/drivers/staging/hv/BlkVsc.c @@ -56,9 +56,9 @@ BlkVscInitialize( storDriver-RequestExtSize = sizeof(STORVSC_REQUEST_EXTENSION); // Divide the ring buffer data size (which is 1 page less than the ring buffer size since that page is reserved for the ring buffer indices) - // by the max request size (which is VMBUS_CHANNEL_PACKET_MULITPAGE_BUFFER + VSTOR_PACKET + UINT64) + // by the max request size (which is VMBUS_CHANNEL_PACKET_MULITPAGE_BUFFER + VSTOR_PACKET + u64) storDriver-MaxOutstandingRequestsPerChannel = - ((storDriver-RingBufferSize - PAGE_SIZE) / ALIGN_UP(MAX_MULTIPAGE_BUFFER_PACKET + sizeof(VSTOR_PACKET) + sizeof(UINT64),sizeof(UINT64))); + ((storDriver-RingBufferSize - PAGE_SIZE) / ALIGN_UP(MAX_MULTIPAGE_BUFFER_PACKET + sizeof(VSTOR_PACKET) + sizeof(u64),sizeof(u64))); DPRINT_INFO(BLKVSC, max io outstd %u, storDriver-MaxOutstandingRequestsPerChannel); --- a/drivers/staging/hv/Channel.c +++ b/drivers/staging/hv/Channel.c @@ -335,7 +335,7 @@ static void DumpGpadlBody( int i=0; int pfnCount=0; - pfnCount = (Len - sizeof(VMBUS_CHANNEL_GPADL_BODY))/ sizeof(UINT64); + pfnCount = (Len - sizeof(VMBUS_CHANNEL_GPADL_BODY))/ sizeof(u64); DPRINT_DBG(VMBUS, gpadl body - len %d pfn count %d, Len, pfnCount); for (i=0; i pfnCount; i++) @@ -416,12 +416,12 @@ VmbusChannelCreateGpadlHeader( // do we need a gpadl body msg pfnSize = MAX_SIZE_CHANNEL_MESSAGE - sizeof(VMBUS_CHANNEL_GPADL_HEADER) - sizeof(GPA_RANGE); - pfnCount = pfnSize / sizeof(UINT64); + pfnCount = pfnSize / sizeof(u64); if (pageCount pfnCount) // we need a gpadl body { // fill in the header - msgSize = sizeof(VMBUS_CHANNEL_MSGINFO) + sizeof(VMBUS_CHANNEL_GPADL_HEADER) + sizeof(GPA_RANGE) + pfnCount*sizeof(UINT64); + msgSize = sizeof(VMBUS_CHANNEL_MSGINFO) + sizeof(VMBUS_CHANNEL_GPADL_HEADER) + sizeof(GPA_RANGE) + pfnCount*sizeof(u64); msgHeader = MemAllocZeroed(msgSize); INITIALIZE_LIST_HEAD(msgHeader-SubMsgList); @@ -429,7 +429,7 @@ VmbusChannelCreateGpadlHeader( gpaHeader = (VMBUS_CHANNEL_GPADL_HEADER*)msgHeader-Msg; gpaHeader-RangeCount = 1; - gpaHeader-RangeBufLen = sizeof(GPA_RANGE) + pageCount*sizeof(UINT64); + gpaHeader-RangeBufLen = sizeof(GPA_RANGE) + pageCount*sizeof(u64); gpaHeader-Range[0].ByteOffset = 0; gpaHeader-Range[0].ByteCount = Size; for (i=0; ipfnCount; i++) @@ -444,7 +444,7 @@ VmbusChannelCreateGpadlHeader( // how many pfns can we fit pfnSize = MAX_SIZE_CHANNEL_MESSAGE - sizeof(VMBUS_CHANNEL_GPADL_BODY); - pfnCount = pfnSize / sizeof(UINT64); + pfnCount = pfnSize
[patch 34/54] Staging: hv: remove STRUCT_PACKED and STRUCT_ALIGNED defines
From: Greg Kroah-Hartman gre...@suse.de Use the correct __attribute__((packed)) one if it's really needed. Cc: Hank Janssen hjans...@microsoft.com Cc: Haiyang Zhang haiya...@microsoft.com Signed-off-by: Greg Kroah-Hartman gre...@suse.de --- drivers/staging/hv/RingBuffer.h |2 +- drivers/staging/hv/include/osd.h |3 --- 2 files changed, 1 insertion(+), 4 deletions(-) --- a/drivers/staging/hv/include/osd.h +++ b/drivers/staging/hv/include/osd.h @@ -30,9 +30,6 @@ // -#define STRUCT_PACKED __attribute__((__packed__)) -#define STRUCT_ALIGNED(x) __attribute__((__aligned__(x))) - #define UNUSED_VAR(v) v __attribute__((__unused__)) #define ALIGN_UP(value, align) ( ((value) (align-1))? ( ((value) + (align-1)) ~(align-1) ): (value) ) --- a/drivers/staging/hv/RingBuffer.h +++ b/drivers/staging/hv/RingBuffer.h @@ -43,7 +43,7 @@ typedef struct _RING_BUFFER { // volatile u32 InterruptMask; // Ring data starts here + RingDataStartOffset !!! DO NOT place any fields below this !!! u8 Buffer[0]; -} STRUCT_PACKED RING_BUFFER; +} __attribute__((packed)) RING_BUFFER; typedef struct _RING_BUFFER_INFO { RING_BUFFER* RingBuffer; ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/virtualization
[patch 18/54] Staging: hv: remove PVOID typedef
From: Greg Kroah-Hartman gre...@suse.de The PVOID typedef is now removed from the Hyper-V driver code. Cc: Hank Janssen hjans...@microsoft.com Cc: Haiyang Zhang haiya...@microsoft.com Signed-off-by: Greg Kroah-Hartman gre...@suse.de --- drivers/staging/hv/Channel.c | 20 ++-- drivers/staging/hv/Channel.h | 16 drivers/staging/hv/ChannelInterface.c | 16 drivers/staging/hv/ChannelMgmt.c |8 drivers/staging/hv/ChannelMgmt.h |4 ++-- drivers/staging/hv/Connection.c|6 +++--- drivers/staging/hv/Hv.c|2 +- drivers/staging/hv/Hv.h|2 +- drivers/staging/hv/NetVsc.c|8 drivers/staging/hv/NetVsc.h|4 ++-- drivers/staging/hv/RingBuffer.c| 18 +- drivers/staging/hv/RingBuffer.h|8 drivers/staging/hv/StorVsc.c |6 +++--- drivers/staging/hv/VmbusPrivate.h |2 +- drivers/staging/hv/include/NetVscApi.h |8 drivers/staging/hv/include/StorVscApi.h|4 ++-- drivers/staging/hv/include/VmbusApi.h | 18 +- drivers/staging/hv/include/VmbusPacketFormat.h |2 +- drivers/staging/hv/include/osd.h |5 ++--- drivers/staging/hv/include/rndis.h |4 ++-- drivers/staging/hv/osd.c |4 ++-- 21 files changed, 82 insertions(+), 83 deletions(-) --- a/drivers/staging/hv/Channel.c +++ b/drivers/staging/hv/Channel.c @@ -32,7 +32,7 @@ // static int VmbusChannelCreateGpadlHeader( - PVOID Kbuffer,// must be phys and virt contiguous + void * Kbuffer,// must be phys and virt contiguous UINT32 Size, // page-size multiple VMBUS_CHANNEL_MSGINFO **msgInfo, UINT32 *MessageCount @@ -204,10 +204,10 @@ VmbusChannelOpen( VMBUS_CHANNEL *NewChannel, UINT32 SendRingBufferSize, UINT32 RecvRingBufferSize, - PVOID UserData, + void * UserData, UINT32 UserDataLen, PFN_CHANNEL_CALLBACKpfnOnChannelCallback, - PVOID Context + void * Context ) { int ret=0; @@ -392,7 +392,7 @@ Description: --*/ static int VmbusChannelCreateGpadlHeader( - PVOID Kbuffer,// from kmalloc() + void * Kbuffer,// from kmalloc() UINT32 Size, // page-size multiple VMBUS_CHANNEL_MSGINFO **MsgInfo, UINT32 *MessageCount) @@ -515,7 +515,7 @@ Description: int VmbusChannelEstablishGpadl( VMBUS_CHANNEL *Channel, - PVOID Kbuffer,// from kmalloc() + void * Kbuffer,// from kmalloc() UINT32 Size, // page-size multiple UINT32 *GpadlHandle ) @@ -752,7 +752,7 @@ Description: int VmbusChannelSendPacket( VMBUS_CHANNEL *Channel, - const PVOID Buffer, + const void *Buffer, UINT32 BufferLen, UINT64 RequestId, VMBUS_PACKET_TYPE Type, @@ -820,7 +820,7 @@ VmbusChannelSendPacketPageBuffer( VMBUS_CHANNEL *Channel, PAGE_BUFFER PageBuffers[], UINT32 PageCount, - PVOID Buffer, + void * Buffer, UINT32 BufferLen, UINT64 RequestId ) @@ -902,7 +902,7 @@ int VmbusChannelSendPacketMultiPageBuffer( VMBUS_CHANNEL *Channel, MULTIPAGE_BUFFER*MultiPageBuffer, - PVOID Buffer, + void * Buffer, UINT32 BufferLen, UINT64 RequestId ) @@ -984,7 +984,7 @@ Description: int VmbusChannelRecvPacket( VMBUS_CHANNEL *Channel, - PVOID Buffer, + void * Buffer, UINT32 BufferLen, UINT32* BufferActualLen, UINT64
[patch 51/54] Staging: hv: osd: remove LogMsg wrapper
From: Greg Kroah-Hartman gre...@suse.de Use the real printk call instead of a wrapper function. Cc: Hank Janssen hjans...@microsoft.com Cc: Haiyang Zhang haiya...@microsoft.com Signed-off-by: Greg Kroah-Hartman gre...@suse.de --- drivers/staging/hv/include/logging.h | 54 --- drivers/staging/hv/include/osd.h |2 - drivers/staging/hv/osd.c | 13 3 files changed, 31 insertions(+), 38 deletions(-) --- a/drivers/staging/hv/include/logging.h +++ b/drivers/staging/hv/include/logging.h @@ -53,11 +53,10 @@ BLKVSC_DRV) // Logging Level -#define CRITICAL_LVL 2 -#define ERROR_LVL 3 -#define WARNING_LVL4 -#define INFO_LVL 6 -#define DEBUG_LVL 7 +#define ERROR_LVL 3 +#define WARNING_LVL4 +#define INFO_LVL 6 +#define DEBUG_LVL 7 #define DEBUG_LVL_ENTEREXIT8 #define DEBUG_RING_LVL 9 @@ -65,44 +64,53 @@ extern unsigned int vmbus_loglevel; #define ASSERT(expr) \ if (!(expr)) { \ - LogMsg(%dAssertion failed! %s,%s,%s,line=%d\n, CRITICAL_LVL, #expr,__FILE__,__FUNCTION__,__LINE__); \ + printk(KERN_CRIT Assertion failed! %s,%s,%s,line=%d\n, \ + #expr, __FILE__, __func__, __LINE__);\ __asm__ __volatile__(int3); \ } #define DPRINT(mod, lvl, fmt, args...) do {\ - if (mod (HIWORD(vmbus_loglevel))) \ - (lvl = LOWORD(vmbus_loglevel))?(LogMsg(%d #mod: %s() fmt \n, DEBUG_LVL, __FUNCTION__, ## args)):(0);\ + if ((mod (HIWORD(vmbus_loglevel))) \ + (lvl = LOWORD(vmbus_loglevel)))\ + printk(KERN_DEBUG #mod: %s() fmt \n, __func__, ## args);\ } while (0) #define DPRINT_DBG(mod, fmt, args...) do {\ - if (mod (HIWORD(vmbus_loglevel))) \ - (DEBUG_LVL = LOWORD(vmbus_loglevel))?(LogMsg(%d #mod: %s() fmt \n, DEBUG_LVL, __FUNCTION__, ## args)):(0);\ + if ((mod (HIWORD(vmbus_loglevel))) \ + (DEBUG_LVL = LOWORD(vmbus_loglevel))) \ + printk(KERN_DEBUG #mod: %s() fmt \n, __func__, ## args);\ } while (0) #define DPRINT_INFO(mod, fmt, args...) do {\ - if (mod (HIWORD(vmbus_loglevel))) \ - (INFO_LVL = LOWORD(vmbus_loglevel))?(LogMsg(%d #mod: fmt \n, INFO_LVL, ## args)):(0);\ + if ((mod (HIWORD(vmbus_loglevel))) \ + (INFO_LVL = LOWORD(vmbus_loglevel))) \ + printk(KERN_INFO #mod: fmt \n, ## args);\ } while (0) #define DPRINT_WARN(mod, fmt, args...) do {\ - if (mod (HIWORD(vmbus_loglevel))) \ - (WARNING_LVL = LOWORD(vmbus_loglevel))?(LogMsg(%d #mod: WARNING! fmt \n, WARNING_LVL, ## args)):(0);\ + if ((mod (HIWORD(vmbus_loglevel))) \ + (WARNING_LVL = LOWORD(vmbus_loglevel)))\ + printk(KERN_WARNING #mod: WARNING! fmt \n, ## args);\ } while (0) #define DPRINT_ERR(mod, fmt, args...) do {\ - if (mod (HIWORD(vmbus_loglevel))) \ - (ERROR_LVL = LOWORD(vmbus_loglevel))?(LogMsg(%d #mod: %s() ERROR!! fmt \n, ERROR_LVL, __FUNCTION__, ## args)):(0);\ + if ((mod (HIWORD(vmbus_loglevel))) \ + (ERROR_LVL = LOWORD(vmbus_loglevel))) \ + printk(KERN_ERR #mod: %s() ERROR!! fmt \n, \ + __func__, ## args);\ } while (0) #ifdef DEBUG #define DPRINT_ENTER(mod) do {\ - if (mod (HIWORD(vmbus_loglevel))) \ - (DEBUG_LVL_ENTEREXIT = LOWORD(vmbus_loglevel))?(LogMsg(%d [#mod]: %s() enter\n, DEBUG_LVL, __FUNCTION__)):(0);\ + if ((mod (HIWORD(vmbus_loglevel))) \ + (DEBUG_LVL_ENTEREXIT = LOWORD(vmbus_loglevel)))\ + printk(KERN_DEBUG [#mod]: %s() enter\n, __func__);\ } while (0) #define DPRINT_EXIT(mod) do {\ - if (mod (HIWORD(vmbus_loglevel))) \ - (DEBUG_LVL_ENTEREXIT = LOWORD(vmbus_loglevel))?(LogMsg(%d [#mod]: %s() exit\n, DEBUG_LVL, __FUNCTION__)):(0);\ + if ((mod (HIWORD(vmbus_loglevel))) \ + (DEBUG_LVL_ENTEREXIT = LOWORD(vmbus_loglevel)))\ + printk(KERN_DEBUG [#mod]: %s() exit\n, __func__);\ } while (0) #else #define DPRINT_ENTER(mod) @@ -113,12 +121,12 @@ static inline void PrintBytes(const unsi { int i=0; - LogMsg(\n ); + printk(\n ); for (i=0; i len; i++) { - LogMsg(0x%x , bytes[i]); + printk(0x%x , bytes[i]); } - LogMsg(\n); + printk(\n); } // --- a/drivers/staging/hv/include/osd.h +++ b/drivers/staging/hv
[patch 47/54] Staging: hv: make gVmbusConnection.ChannelLock a real spinlock
From: Greg Kroah-Hartman gre...@suse.de Don't use the wrapper functions for this lock, make it a real lock so that we know what is going on. I don't think we really want to be doing a irqsave for this code, but I left it alone to preserve the original codepath. It should be reviewed later. Cc: Hank Janssen hjans...@microsoft.com Cc: Haiyang Zhang haiya...@microsoft.com Signed-off-by: Greg Kroah-Hartman gre...@suse.de --- drivers/staging/hv/Channel.c |5 +++-- drivers/staging/hv/ChannelMgmt.c | 14 -- drivers/staging/hv/Connection.c |8 drivers/staging/hv/VmbusPrivate.h |2 +- 4 files changed, 16 insertions(+), 13 deletions(-) --- a/drivers/staging/hv/Channel.c +++ b/drivers/staging/hv/Channel.c @@ -686,6 +686,7 @@ VmbusChannelClose( int ret=0; VMBUS_CHANNEL_CLOSE_CHANNEL* msg; VMBUS_CHANNEL_MSGINFO* info; + unsigned long flags; DPRINT_ENTER(VMBUS); @@ -729,9 +730,9 @@ VmbusChannelClose( // since the caller will free the channel if (Channel-State == CHANNEL_OPEN_STATE) { - SpinlockAcquire(gVmbusConnection.ChannelLock); + spin_lock_irqsave(gVmbusConnection.channel_lock, flags); REMOVE_ENTRY_LIST(Channel-ListEntry); - SpinlockRelease(gVmbusConnection.ChannelLock); + spin_unlock_irqrestore(gVmbusConnection.channel_lock, flags); FreeVmbusChannel(Channel); } --- a/drivers/staging/hv/ChannelMgmt.c +++ b/drivers/staging/hv/ChannelMgmt.c @@ -233,11 +233,12 @@ VmbusChannelProcessOffer( LIST_ENTRY* curr; bool fNew = true; VMBUS_CHANNEL* channel; + unsigned long flags; DPRINT_ENTER(VMBUS); // Make sure this is a new offer - SpinlockAcquire(gVmbusConnection.ChannelLock); + spin_lock_irqsave(gVmbusConnection.channel_lock, flags); ITERATE_LIST_ENTRIES(anchor, curr, gVmbusConnection.ChannelList) { @@ -255,7 +256,7 @@ VmbusChannelProcessOffer( { INSERT_TAIL_LIST(gVmbusConnection.ChannelList, newChannel-ListEntry); } - SpinlockRelease(gVmbusConnection.ChannelLock); + spin_unlock_irqrestore(gVmbusConnection.channel_lock, flags); if (!fNew) { @@ -282,9 +283,9 @@ VmbusChannelProcessOffer( DPRINT_ERR(VMBUS, unable to add child device object (relid %d), newChannel-OfferMsg.ChildRelId); - SpinlockAcquire(gVmbusConnection.ChannelLock); + spin_lock_irqsave(gVmbusConnection.channel_lock, flags); REMOVE_ENTRY_LIST(newChannel-ListEntry); - SpinlockRelease(gVmbusConnection.ChannelLock); + spin_unlock_irqrestore(gVmbusConnection.channel_lock, flags); FreeVmbusChannel(newChannel); } @@ -785,8 +786,9 @@ VmbusChannelReleaseUnattachedChannels( LIST_ENTRY *entry; VMBUS_CHANNEL *channel; VMBUS_CHANNEL *start=NULL; + unsigned long flags; - SpinlockAcquire(gVmbusConnection.ChannelLock); + spin_lock_irqsave(gVmbusConnection.channel_lock, flags); while (!IsListEmpty(gVmbusConnection.ChannelList)) { @@ -813,7 +815,7 @@ VmbusChannelReleaseUnattachedChannels( } } - SpinlockRelease(gVmbusConnection.ChannelLock); + spin_unlock_irqrestore(gVmbusConnection.channel_lock, flags); } // eof --- a/drivers/staging/hv/Connection.c +++ b/drivers/staging/hv/Connection.c @@ -69,7 +69,7 @@ VmbusConnect( spin_lock_init(gVmbusConnection.channelmsg_lock); INITIALIZE_LIST_HEAD(gVmbusConnection.ChannelList); - gVmbusConnection.ChannelLock = SpinlockCreate(); + spin_lock_init(gVmbusConnection.channel_lock); // Setup the vmbus event connection for channel interrupt abstraction stuff gVmbusConnection.InterruptPage = PageAlloc(1); @@ -156,7 +156,6 @@ Cleanup: gVmbusConnection.ConnectState = Disconnected; WorkQueueClose(gVmbusConnection.WorkQueue); - SpinlockClose(gVmbusConnection.ChannelLock); if (gVmbusConnection.InterruptPage) { @@ -258,8 +257,9 @@ GetChannelFromRelId( VMBUS_CHANNEL* foundChannel=NULL; LIST_ENTRY* anchor; LIST_ENTRY* curr; + unsigned long flags; - SpinlockAcquire(gVmbusConnection.ChannelLock); + spin_lock_irqsave(gVmbusConnection.channel_lock, flags); ITERATE_LIST_ENTRIES(anchor, curr, gVmbusConnection.ChannelList) { channel = CONTAINING_RECORD(curr, VMBUS_CHANNEL, ListEntry); @@ -270,7 +270,7 @@ GetChannelFromRelId( break; } } - SpinlockRelease(gVmbusConnection.ChannelLock); + spin_unlock_irqrestore(gVmbusConnection.channel_lock, flags); return foundChannel; } --- a/drivers/staging/hv/VmbusPrivate.h +++ b/drivers/staging/hv
[patch 54/54] Staging: hv: osd: remove GetTickCount and GetTimestamp wrappers
From: Greg Kroah-Hartman gre...@suse.de No one was even using them. Cc: Hank Janssen hjans...@microsoft.com Cc: Haiyang Zhang haiya...@microsoft.com Signed-off-by: Greg Kroah-Hartman gre...@suse.de --- drivers/staging/hv/include/osd.h |1 - drivers/staging/hv/osd.c | 14 -- 2 files changed, 15 deletions(-) --- a/drivers/staging/hv/include/osd.h +++ b/drivers/staging/hv/include/osd.h @@ -121,7 +121,6 @@ extern HANDLE TimerCreate(PFN_TIMER_CALL extern void TimerClose(HANDLE hTimer); extern int TimerStop(HANDLE hTimer); extern void TimerStart(HANDLE hTimer, u32 expirationInUs); -extern size_t GetTickCount(void); extern HANDLE WaitEventCreate(void); extern void WaitEventClose(HANDLE hWait); --- a/drivers/staging/hv/osd.c +++ b/drivers/staging/hv/osd.c @@ -232,20 +232,6 @@ void TimerClose(HANDLE hTimer) kfree(t); } -size_t GetTickCount(void) -{ - return jiffies; -} - -signed long long GetTimestamp(void) -{ - struct timeval t; - - do_gettimeofday(t); - - return timeval_to_ns(t); -} - HANDLE WaitEventCreate(void) { WAITEVENT* wait = kmalloc(sizeof(WAITEVENT), GFP_KERNEL); ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/virtualization
[patch 29/54] Staging: hv: remove DWORD and BYTE typedefs
From: Greg Kroah-Hartman gre...@suse.de No one was even using them... Cc: Hank Janssen hjans...@microsoft.com Cc: Haiyang Zhang haiya...@microsoft.com Signed-off-by: Greg Kroah-Hartman gre...@suse.de --- drivers/staging/hv/include/osd.h |2 -- 1 file changed, 2 deletions(-) --- a/drivers/staging/hv/include/osd.h +++ b/drivers/staging/hv/include/osd.h @@ -101,8 +101,6 @@ typedef struct _DLIST_ENTRY { typedef unsigned char BOOL; typedef unsigned char BOOLEAN; typedef void* HANDLE; -typedef u32DWORD; -typedef unsigned char BYTE; typedef struct { unsigned char Data[16]; ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/virtualization
[patch 27/54] Staging: hv: remove ULONG and LONG typedefs
From: Greg Kroah-Hartman gre...@suse.de The ULONG and LONG typedefs are now removed from the Hyper-V driver code. Cc: Hank Janssen hjans...@microsoft.com Cc: Haiyang Zhang haiya...@microsoft.com Signed-off-by: Greg Kroah-Hartman gre...@suse.de --- drivers/staging/hv/StorVsc.c|2 +- drivers/staging/hv/include/StorVscApi.h |2 +- drivers/staging/hv/include/osd.h| 10 -- drivers/staging/hv/include/vstorage.h | 12 ++-- 4 files changed, 8 insertions(+), 18 deletions(-) --- a/drivers/staging/hv/include/osd.h +++ b/drivers/staging/hv/include/osd.h @@ -95,16 +95,6 @@ typedef struct _DLIST_ENTRY { } DLIST_ENTRY; // -// unsigned types -// -typedef unsigned int ULONG; - -// -// signed types -// -typedef intLONG; - -// // Other types // typedef unsigned long SIZE_T; --- a/drivers/staging/hv/include/StorVscApi.h +++ b/drivers/staging/hv/include/StorVscApi.h @@ -117,7 +117,7 @@ typedef struct _STORVSC_DRIVER_OBJECT { } STORVSC_DRIVER_OBJECT; typedef struct _STORVSC_DEVICE_INFO { - ULONG PortNumber; + unsigned long PortNumber; unsigned char PathId; unsigned char TargetId; } STORVSC_DEVICE_INFO; --- a/drivers/staging/hv/include/vstorage.h +++ b/drivers/staging/hv/include/vstorage.h @@ -155,7 +155,7 @@ typedef struct unsigned char DataIn; unsigned char Reserved; -ULONG DataTransferLength; +unsigned long DataTransferLength; union { @@ -185,11 +185,11 @@ typedef struct // // Note: port number is only really known on the client side // -ULONG PortNumber; +unsigned long PortNumber; -ULONG Flags; +unsigned long Flags; -ULONG MaxTransferBytes; +unsigned long MaxTransferBytes; // // This id is unique for each channel and will correspond with @@ -249,13 +249,13 @@ typedef struct _VSTOR_PACKET // Flags - see below for values // -ULONG Flags; +unsigned long Flags; // // Status of the request returned from the server side. // -ULONG Status; +unsigned long Status; // // Data payload area --- a/drivers/staging/hv/StorVsc.c +++ b/drivers/staging/hv/StorVsc.c @@ -62,7 +62,7 @@ typedef struct _STORVSC_DEVICE{ // Each unique Port/Path/Target represents 1 channel ie scsi controller. In reality, the pathid, targetid is always 0 // and the port is set by us - ULONG PortNumber; + unsigned long PortNumber; unsigned char PathId; unsigned char TargetId; ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/virtualization
[patch 19/54] Staging: hv: remove VOID typedef
From: Greg Kroah-Hartman gre...@suse.de The VOID typedef is now removed from the Hyper-V driver code. Cc: Hank Janssen hjans...@microsoft.com Cc: Haiyang Zhang haiya...@microsoft.com Signed-off-by: Greg Kroah-Hartman gre...@suse.de --- drivers/staging/hv/Channel.c |2 +- drivers/staging/hv/ChannelMgmt.c |6 +++--- drivers/staging/hv/ChannelMgmt.h |2 +- drivers/staging/hv/Connection.c |6 +++--- drivers/staging/hv/Hv.c |4 ++-- drivers/staging/hv/Hv.h | 12 ++-- drivers/staging/hv/RingBuffer.c |2 +- drivers/staging/hv/RndisFilter.c |4 ++-- drivers/staging/hv/VmbusPrivate.h | 16 drivers/staging/hv/include/List.h | 14 +++--- drivers/staging/hv/include/osd.h |3 +-- drivers/staging/hv/osd.c |8 12 files changed, 39 insertions(+), 40 deletions(-) --- a/drivers/staging/hv/Channel.c +++ b/drivers/staging/hv/Channel.c @@ -677,7 +677,7 @@ Description: Close the specified channel --*/ -VOID +void VmbusChannelClose( VMBUS_CHANNEL *Channel ) --- a/drivers/staging/hv/ChannelMgmt.c +++ b/drivers/staging/hv/ChannelMgmt.c @@ -672,7 +672,7 @@ Description: This is invoked in the vmbus worker thread context. --*/ -VOID +void VmbusOnChannelMessage( void *Context ) @@ -722,7 +722,7 @@ Description: --*/ int VmbusChannelRequestOffers( - VOID + void ) { int ret=0; @@ -785,7 +785,7 @@ Description: --*/ void VmbusChannelReleaseUnattachedChannels( - VOID + void ) { LIST_ENTRY *entry; --- a/drivers/staging/hv/ChannelMgmt.h +++ b/drivers/staging/hv/ChannelMgmt.h @@ -59,7 +59,7 @@ typedef struct _VMBUS_CHANNEL { UINT32 RingBufferGpadlHandle; // Allocated memory for ring buffer - VOID* RingBufferPages; + void * RingBufferPages; UINT32 RingBufferPageCount; RING_BUFFER_INFOOutbound; // send to parent RING_BUFFER_INFOInbound;// receive from parent --- a/drivers/staging/hv/Connection.c +++ b/drivers/staging/hv/Connection.c @@ -195,7 +195,7 @@ Description: --*/ int VmbusDisconnect( - VOID + void ) { int ret=0; @@ -323,9 +323,9 @@ Description: Handler for events --*/ -VOID +void VmbusOnEvents( - VOID + void ) { int dword; --- a/drivers/staging/hv/Hv.c +++ b/drivers/staging/hv/Hv.c @@ -621,9 +621,9 @@ Description: Cleanup routine for HvSynicInit(). --*/ -VOID +void HvSynicCleanup( - VOID + void ) { HV_SYNIC_SINT sharedSint; --- a/drivers/staging/hv/Hv.h +++ b/drivers/staging/hv/Hv.h @@ -150,12 +150,12 @@ static inline void WriteMsr(int msr, UIN // static int HvInit( -VOID +void ); -static VOID +static void HvCleanup( -VOID +void ); static HV_STATUS @@ -168,7 +168,7 @@ HvPostMessage( static HV_STATUS HvSignalEvent( - VOID + void ); static int @@ -176,9 +176,9 @@ HvSynicInit( UINT32 irqVector ); -static VOID +static void HvSynicCleanup( - VOID + void ); #endif // __HV_H__ --- a/drivers/staging/hv/include/List.h +++ b/drivers/staging/hv/include/List.h @@ -44,7 +44,7 @@ typedef DLIST_ENTRY *PLIST_ENTRY; /* - * VOID + * void * InitializeListHead( * PLIST_ENTRY ListHead * ); @@ -132,7 +132,7 @@ typedef DLIST_ENTRY *PLIST_ENTRY; /* - * VOID + * void * RemoveEntryList( * PLIST_ENTRY Entry * ); @@ -148,7 +148,7 @@ typedef DLIST_ENTRY *PLIST_ENTRY; /* - * VOID + * void * AttachList( * PLIST_ENTRY ListHead, * PLIST_ENTRY ListEntry @@ -168,7 +168,7 @@ typedef DLIST_ENTRY *PLIST_ENTRY; /* - * VOID + * void * InsertTailList( * PLIST_ENTRY ListHead, * PLIST_ENTRY Entry @@ -188,7 +188,7 @@ typedef DLIST_ENTRY *PLIST_ENTRY; /* - * VOID + * void * InsertHeadList( * PLIST_ENTRY ListHead, * PLIST_ENTRY Entry @@ -207,7 +207,7 @@ typedef DLIST_ENTRY *PLIST_ENTRY; /* - * VOID + * void * IterateListEntries( * PLIST_ENTRY anchor, * PLIST_ENTRY index, @@ -245,7 +245,7 @@ typedef DLIST_ENTRY *PLIST_ENTRY; /* - * VOID + * void * PushEntryList( * PSINGLE_LIST_ENTRY ListHead, * PSINGLE_LIST_ENTRY Entry --- a/drivers/staging/hv/include/osd.h +++ b/drivers/staging/hv/include/osd.h @@ -131,7 +131,6 @@ typedef long long LONGLONG; // Other types // typedef unsigned long SIZE_T; -typedef void VOID; //typedef unsigned charGUID[16]; typedef unsigned char BOOL; typedef unsigned
[patch 26/54] Staging: hv: remove ULONG_PTR typedef
From: Greg Kroah-Hartman gre...@suse.de The ULONG_PTR typedef is now removed from the Hyper-V driver code. Cc: Hank Janssen hjans...@microsoft.com Cc: Haiyang Zhang haiya...@microsoft.com Signed-off-by: Greg Kroah-Hartman gre...@suse.de --- drivers/staging/hv/Channel.c |4 ++-- drivers/staging/hv/Connection.c |8 drivers/staging/hv/Hv.c |8 drivers/staging/hv/NetVsc.c | 34 +- drivers/staging/hv/RndisFilter.c | 16 drivers/staging/hv/StorVsc.c | 16 drivers/staging/hv/include/osd.h |8 +++- drivers/staging/hv/netvsc_drv.c |4 ++-- drivers/staging/hv/osd.c |8 9 files changed, 52 insertions(+), 54 deletions(-) --- a/drivers/staging/hv/Channel.c +++ b/drivers/staging/hv/Channel.c @@ -228,9 +228,9 @@ VmbusChannelOpen( out = PageAlloc((SendRingBufferSize + RecvRingBufferSize) PAGE_SHIFT); //out = MemAllocZeroed(sendRingBufferSize + recvRingBufferSize); ASSERT(out); - ASSERT(((ULONG_PTR)out (PAGE_SIZE-1)) == 0); + ASSERT(((unsigned long)out (PAGE_SIZE-1)) == 0); - in = (void*)((ULONG_PTR)out + SendRingBufferSize); + in = (void*)((unsigned long)out + SendRingBufferSize); NewChannel-RingBufferPages = out; NewChannel-RingBufferPageCount = (SendRingBufferSize + RecvRingBufferSize) PAGE_SHIFT; --- a/drivers/staging/hv/Connection.c +++ b/drivers/staging/hv/Connection.c @@ -79,7 +79,7 @@ VmbusConnect( } gVmbusConnection.RecvInterruptPage = gVmbusConnection.InterruptPage; - gVmbusConnection.SendInterruptPage = (void*)((ULONG_PTR)gVmbusConnection.InterruptPage + (PAGE_SIZE 1)); + gVmbusConnection.SendInterruptPage = (void*)((unsigned long)gVmbusConnection.InterruptPage + (PAGE_SIZE 1)); // Setup the monitor notification facility. The 1st page for parent-child and the 2nd page for child-parent gVmbusConnection.MonitorPages = PageAlloc(2); @@ -103,7 +103,7 @@ VmbusConnect( msg-VMBusVersionRequested = VMBUS_REVISION_NUMBER; msg-InterruptPage = GetPhysicalAddress(gVmbusConnection.InterruptPage); msg-MonitorPage1 = GetPhysicalAddress(gVmbusConnection.MonitorPages); - msg-MonitorPage2 = GetPhysicalAddress((void *)((ULONG_PTR)gVmbusConnection.MonitorPages + PAGE_SIZE)); + msg-MonitorPage2 = GetPhysicalAddress((void *)((unsigned long)gVmbusConnection.MonitorPages + PAGE_SIZE)); // Add to list before we send the request since we may receive the response // before returning from this routine @@ -294,7 +294,7 @@ VmbusProcessChannelEvent( ) { VMBUS_CHANNEL* channel; - u32 relId = (u32)(ULONG_PTR)context; + u32 relId = (u32)(unsigned long)context; ASSERT(relId 0); @@ -362,7 +362,7 @@ VmbusOnEvents( { //QueueWorkItem(VmbusProcessEvent, (void*)relid); //ret = WorkQueueQueueWorkItem(gVmbusConnection.workQueue, VmbusProcessChannelEvent, (void*)relid); - VmbusProcessChannelEvent((void*)(ULONG_PTR)relid); + VmbusProcessChannelEvent((void*)(unsigned long)relid); } } } --- a/drivers/staging/hv/Hv.c +++ b/drivers/staging/hv/Hv.c @@ -233,7 +233,7 @@ HvInit ( int maxLeaf; HV_X64_MSR_HYPERCALL_CONTENTS hypercallMsr; void* virtAddr=0; - ULONG_PTR physAddr=0; + unsigned long physAddr=0; DPRINT_ENTER(VMBUS); @@ -311,7 +311,7 @@ HvInit ( goto Cleanup; } - gHvContext.SignalEventParam = (PHV_INPUT_SIGNAL_EVENT)(ALIGN_UP((ULONG_PTR)gHvContext.SignalEventBuffer, HV_HYPERCALL_PARAM_ALIGN)); + gHvContext.SignalEventParam = (PHV_INPUT_SIGNAL_EVENT)(ALIGN_UP((unsigned long)gHvContext.SignalEventBuffer, HV_HYPERCALL_PARAM_ALIGN)); gHvContext.SignalEventParam-ConnectionId.Asu32 = 0; gHvContext.SignalEventParam-ConnectionId.u.Id = VMBUS_EVENT_CONNECTION_ID; gHvContext.SignalEventParam-FlagNumber = 0; @@ -407,14 +407,14 @@ HvPostMessage( PHV_INPUT_POST_MESSAGE alignedMsg; HV_STATUS status; - ULONG_PTR addr; + unsigned long addr; if (payloadSize HV_MESSAGE_PAYLOAD_BYTE_COUNT) { return -1; } - addr = (ULONG_PTR)MemAllocAtomic(sizeof(struct alignedInput)); + addr = (unsigned long)MemAllocAtomic(sizeof(struct alignedInput)); if (!addr) { --- a/drivers/staging/hv/include/osd.h +++ b/drivers/staging/hv/include/osd.h @@ -115,8 +115,6 @@ typedef void
[patch 38/54] Staging: hv: osd: remove MemAlloc wrapper
From: Greg Kroah-Hartman gre...@suse.de Use the real kmalloc call instead of a wrapper function. Cc: Hank Janssen hjans...@microsoft.com Cc: Haiyang Zhang haiya...@microsoft.com Signed-off-by: Greg Kroah-Hartman gre...@suse.de --- drivers/staging/hv/Channel.c |9 +++-- drivers/staging/hv/ChannelMgmt.c |3 +-- drivers/staging/hv/Hv.c |2 +- drivers/staging/hv/NetVsc.c |2 +- drivers/staging/hv/RndisFilter.c |1 - drivers/staging/hv/include/osd.h |1 - drivers/staging/hv/osd.c |5 - 7 files changed, 6 insertions(+), 17 deletions(-) --- a/drivers/staging/hv/Channel.c +++ b/drivers/staging/hv/Channel.c @@ -260,8 +260,7 @@ VmbusChannelOpen( SendRingBufferSize); // Create and init the channel open message - openInfo = - (VMBUS_CHANNEL_MSGINFO*)MemAlloc(sizeof(VMBUS_CHANNEL_MSGINFO) + sizeof(VMBUS_CHANNEL_OPEN_CHANNEL)); + openInfo = kmalloc(sizeof(VMBUS_CHANNEL_MSGINFO) + sizeof(VMBUS_CHANNEL_OPEN_CHANNEL), GFP_KERNEL); ASSERT(openInfo != NULL); openInfo-WaitEvent = WaitEventCreate(); @@ -630,8 +629,7 @@ VmbusChannelTeardownGpadl( ASSERT(GpadlHandle != 0); - info = - (VMBUS_CHANNEL_MSGINFO*)MemAlloc(sizeof(VMBUS_CHANNEL_MSGINFO) + sizeof(VMBUS_CHANNEL_GPADL_TEARDOWN)); + info = kmalloc(sizeof(VMBUS_CHANNEL_MSGINFO) + sizeof(VMBUS_CHANNEL_GPADL_TEARDOWN), GFP_KERNEL); ASSERT(info != NULL); info-WaitEvent = WaitEventCreate(); @@ -693,8 +691,7 @@ VmbusChannelClose( TimerStop(Channel-PollTimer); // Send a closing message - info = - (VMBUS_CHANNEL_MSGINFO*)MemAlloc(sizeof(VMBUS_CHANNEL_MSGINFO) + sizeof(VMBUS_CHANNEL_CLOSE_CHANNEL)); + info = kmalloc(sizeof(VMBUS_CHANNEL_MSGINFO) + sizeof(VMBUS_CHANNEL_CLOSE_CHANNEL), GFP_KERNEL); ASSERT(info != NULL); //info-waitEvent = WaitEventCreate(); --- a/drivers/staging/hv/ChannelMgmt.c +++ b/drivers/staging/hv/ChannelMgmt.c @@ -731,8 +731,7 @@ VmbusChannelRequestOffers( DPRINT_ENTER(VMBUS); - msgInfo = - (VMBUS_CHANNEL_MSGINFO*)MemAlloc(sizeof(VMBUS_CHANNEL_MSGINFO) + sizeof(VMBUS_CHANNEL_MESSAGE_HEADER)); + msgInfo = kmalloc(sizeof(VMBUS_CHANNEL_MSGINFO) + sizeof(VMBUS_CHANNEL_MESSAGE_HEADER), GFP_KERNEL); ASSERT(msgInfo != NULL); msgInfo-WaitEvent = WaitEventCreate(); --- a/drivers/staging/hv/Hv.c +++ b/drivers/staging/hv/Hv.c @@ -305,7 +305,7 @@ HvInit ( (unsigned long)hypercallMsr.GuestPhysicalAddress PAGE_SHIFT); // Setup the global signal event param for the signal event hypercall - gHvContext.SignalEventBuffer = MemAlloc(sizeof(HV_INPUT_SIGNAL_EVENT_BUFFER)); + gHvContext.SignalEventBuffer = kmalloc(sizeof(HV_INPUT_SIGNAL_EVENT_BUFFER), GFP_KERNEL); if (!gHvContext.SignalEventBuffer) { goto Cleanup; --- a/drivers/staging/hv/include/osd.h +++ b/drivers/staging/hv/include/osd.h @@ -121,7 +121,6 @@ extern void PageFree(void* page, unsigne extern void* MemMapIO(unsigned long phys, unsigned long size); extern void MemUnmapIO(void* virt); -extern void* MemAlloc(unsigned int size); extern void* MemAllocZeroed(unsigned int size); extern void* MemAllocAtomic(unsigned int size); extern void MemFree(void* buf); --- a/drivers/staging/hv/NetVsc.c +++ b/drivers/staging/hv/NetVsc.c @@ -361,7 +361,7 @@ NetVscInitializeReceiveBufferWithNetVsp( netDevice-ReceiveSectionCount = initPacket-Messages.Version1Messages.SendReceiveBufferComplete.NumSections; - netDevice-ReceiveSections = MemAlloc(netDevice-ReceiveSectionCount * sizeof(NVSP_1_RECEIVE_BUFFER_SECTION)); + netDevice-ReceiveSections = kmalloc(netDevice-ReceiveSectionCount * sizeof(NVSP_1_RECEIVE_BUFFER_SECTION), GFP_KERNEL); if (netDevice-ReceiveSections == NULL) { ret = -1; --- a/drivers/staging/hv/osd.c +++ b/drivers/staging/hv/osd.c @@ -189,11 +189,6 @@ void PageUnmapVirtualAddress(void* VirtA kunmap_atomic(VirtAddr, KM_IRQ0); } -void* MemAlloc(unsigned int size) -{ - return kmalloc(size, GFP_KERNEL); -} - void* MemAllocZeroed(unsigned int size) { void *p = kmalloc(size, GFP_KERNEL); --- a/drivers/staging/hv/RndisFilter.c +++ b/drivers/staging/hv/RndisFilter.c @@ -943,7 +943,6 @@ RndisFilterOnDeviceAdd( DPRINT_ENTER(NETVSC); - //rndisDevice = MemAlloc(sizeof(RNDIS_DEVICE)); rndisDevice = GetRndisDevice(); if (!rndisDevice) { ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/virtualization
[patch 15/54] Staging: hv: make the Hyper-V virtual network driver build
From: Greg Kroah-Hartman gre...@suse.de The #define KERNEL_2_6_27 needs to be set, and I adjusted the include directories a bit to get things to build properly. The driver was changed to use net_device_ops, as that is needed to build and operate properly now. The hv_netvsc code should now build with no errors. Cc: Hank Janssen hjans...@microsoft.com Cc: Haiyang Zhang haiya...@microsoft.com Signed-off-by: Greg Kroah-Hartman gre...@suse.de --- drivers/staging/hv/NetVsc.c |3 ++- drivers/staging/hv/NetVsc.h |8 drivers/staging/hv/RndisFilter.c |5 +++-- drivers/staging/hv/RndisFilter.h |4 ++-- drivers/staging/hv/include/nvspprotocol.h |2 +- drivers/staging/hv/netvsc_drv.c | 21 + 6 files changed, 25 insertions(+), 18 deletions(-) --- a/drivers/staging/hv/include/nvspprotocol.h +++ b/drivers/staging/hv/include/nvspprotocol.h @@ -24,7 +24,7 @@ #pragma once -#include VmbusChannelInterface.h +#include VmbusChannelInterface.h #define NVSP_INVALID_PROTOCOL_VERSION ((UINT32)0x) --- a/drivers/staging/hv/NetVsc.c +++ b/drivers/staging/hv/NetVsc.c @@ -20,8 +20,9 @@ * */ +#define KERNEL_2_6_27 -#include logging.h +#include include/logging.h #include NetVsc.h #include RndisFilter.h --- a/drivers/staging/hv/netvsc_drv.c +++ b/drivers/staging/hv/netvsc_drv.c @@ -20,6 +20,7 @@ * */ +#define KERNEL_2_6_27 #include linux/init.h #include linux/module.h @@ -41,10 +42,10 @@ #include net/sock.h #include net/pkt_sched.h -#include logging.h -#include vmbus.h +#include include/logging.h +#include include/vmbus.h -#include NetVscApi.h +#include include/NetVscApi.h MODULE_LICENSE(GPL); @@ -158,6 +159,14 @@ static void netvsc_set_multicast_list(UN } +static const struct net_device_ops device_ops = { + .ndo_open = netvsc_open, + .ndo_stop = netvsc_close, + .ndo_start_xmit = netvsc_start_xmit, + .ndo_get_stats = netvsc_get_stats, + .ndo_set_multicast_list = netvsc_set_multicast_list, +}; + /*++ Name: netvsc_probe() @@ -225,11 +234,7 @@ static int netvsc_probe(struct device *d memcpy(net-dev_addr, device_info.MacAddr, ETH_ALEN); - net-open = netvsc_open; - net-hard_start_xmit= netvsc_start_xmit; - net-stop = netvsc_close; - net-get_stats = netvsc_get_stats; - net-set_multicast_list = netvsc_set_multicast_list; + net-netdev_ops = device_ops; #if !defined(KERNEL_2_6_27) SET_MODULE_OWNER(net); --- a/drivers/staging/hv/NetVsc.h +++ b/drivers/staging/hv/NetVsc.h @@ -24,12 +24,12 @@ #ifndef _NETVSC_H_ #define _NETVSC_H_ -#include VmbusPacketFormat.h -#include nvspprotocol.h +#include include/VmbusPacketFormat.h +#include include/nvspprotocol.h -#include List.h +#include include/List.h -#include NetVscApi.h +#include include/NetVscApi.h // // #defines // --- a/drivers/staging/hv/RndisFilter.c +++ b/drivers/staging/hv/RndisFilter.c @@ -21,10 +21,11 @@ * */ +#define KERNEL_2_6_27 -#include logging.h +#include include/logging.h -#include NetVscApi.h +#include include/NetVscApi.h #include RndisFilter.h // --- a/drivers/staging/hv/RndisFilter.h +++ b/drivers/staging/hv/RndisFilter.h @@ -27,10 +27,10 @@ #define __struct_bcount(x) -#include osd.h +#include include/osd.h #include NetVsc.h -#include rndis.h +#include include/rndis.h #define RNDIS_HEADER_SIZE (sizeof(RNDIS_MESSAGE) - sizeof(RNDIS_MESSAGE_CONTAINER)) ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/virtualization
[patch 12/54] Staging: hv: add the Hyper-V virtual scsi driver to the build
From: Greg Kroah-Hartman gre...@suse.de Add the Hyper-V virtual scsi driver to the kernel build system. Cc: Hank Janssen hjans...@microsoft.com Cc: Haiyang Zhang haiya...@microsoft.com Signed-off-by: Greg Kroah-Hartman gre...@suse.de --- drivers/staging/hv/Kconfig |6 ++ drivers/staging/hv/Makefile |2 ++ 2 files changed, 8 insertions(+) --- a/drivers/staging/hv/Kconfig +++ b/drivers/staging/hv/Kconfig @@ -6,3 +6,9 @@ config HYPERV Select this option to run Linux as a Hyper-V client operating system. +config HYPERV_STORAGE + tristate Microsoft Hyper-V virtual storage driver + depends on SCSI + default n + help +Select this option to enable the Hyper-V virtual storage driver. --- a/drivers/staging/hv/Makefile +++ b/drivers/staging/hv/Makefile @@ -1,3 +1,5 @@ obj-$(CONFIG_HYPERV) += hv_vmbus.o +obj-$(CONFIG_HYPERV_STORAGE) += hv_storvsc.o hv_vmbus-objs := vmbus_drv.o osd.o Sources.o +hv_storvsc-objs := storvsc_drv.o osd.o StorVsc.o ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/virtualization
[patch 45/54] Staging: hv: make netDevice-ReceivePacketListLock a real spinlock
From: Greg Kroah-Hartman gre...@suse.de Don't use the wrapper functions for this lock, make it a real lock so that we know what is going on. I don't think we really want to be doing a irqsave for this code, but I left it alone to preserve the original codepath. It should be reviewed later. Cc: Hank Janssen hjans...@microsoft.com Cc: Haiyang Zhang haiya...@microsoft.com Signed-off-by: Greg Kroah-Hartman gre...@suse.de --- drivers/staging/hv/NetVsc.c | 19 +-- drivers/staging/hv/NetVsc.h |2 +- 2 files changed, 10 insertions(+), 11 deletions(-) --- a/drivers/staging/hv/NetVsc.c +++ b/drivers/staging/hv/NetVsc.c @@ -807,7 +807,7 @@ NetVscOnDeviceAdd( // Initialize the NetVSC channel extension netDevice-ReceiveBufferSize = NETVSC_RECEIVE_BUFFER_SIZE; - netDevice-ReceivePacketListLock = SpinlockCreate(); + spin_lock_init(netDevice-receive_packet_list_lock); netDevice-SendBufferSize = NETVSC_SEND_BUFFER_SIZE; @@ -876,8 +876,6 @@ Cleanup: kfree(packet); } - SpinlockClose(netDevice-ReceivePacketListLock); - ReleaseOutboundNetDevice(Device); ReleaseInboundNetDevice(Device); @@ -952,7 +950,6 @@ NetVscOnDeviceRemove( kfree(netvscPacket); } - SpinlockClose(netDevice-ReceivePacketListLock); WaitEventClose(netDevice-ChannelInitEvent); FreeNetDevice(netDevice); @@ -1118,6 +1115,7 @@ NetVscOnReceive( int i=0, j=0; int count=0, bytesRemain=0; + unsigned long flags; DPRINT_ENTER(NETVSC); @@ -1164,7 +1162,7 @@ NetVscOnReceive( // Grab free packets (range count + 1) to represent this xfer page packet. +1 to represent // the xfer page packet itself. We grab it here so that we know exactly how many we can fulfil - SpinlockAcquire(netDevice-ReceivePacketListLock); + spin_lock_irqsave(netDevice-receive_packet_list_lock, flags); while (!IsListEmpty(netDevice-ReceivePacketList)) { entry = REMOVE_HEAD_LIST(netDevice-ReceivePacketList); @@ -1175,7 +1173,7 @@ NetVscOnReceive( if (++count == vmxferpagePacket-RangeCount + 1) break; } - SpinlockRelease(netDevice-ReceivePacketListLock); + spin_unlock_irqrestore(netDevice-receive_packet_list_lock, flags); // We need at least 2 netvsc pkts (1 to represent the xfer page and at least 1 for the range) // i.e. we can handled some of the xfer page packet ranges... @@ -1184,7 +1182,7 @@ NetVscOnReceive( DPRINT_ERR(NETVSC, Got only %d netvsc pkt...needed %d pkts. Dropping this xfer page packet completely!, count, vmxferpagePacket-RangeCount+1); // Return it to the freelist - SpinlockAcquire(netDevice-ReceivePacketListLock); + spin_lock_irqsave(netDevice-receive_packet_list_lock, flags); for (i=count; i != 0; i--) { entry = REMOVE_HEAD_LIST(listHead); @@ -1192,7 +1190,7 @@ NetVscOnReceive( INSERT_TAIL_LIST(netDevice-ReceivePacketList, netvscPacket-ListEntry); } - SpinlockRelease(netDevice-ReceivePacketListLock); + spin_unlock_irqrestore(netDevice-receive_packet_list_lock, flags); NetVscSendReceiveCompletion(Device, vmxferpagePacket-d.TransactionId); @@ -1346,6 +1344,7 @@ NetVscOnReceiveCompletion( NETVSC_DEVICE* netDevice; u64 transactionId=0; bool fSendReceiveComp = false; + unsigned long flags; DPRINT_ENTER(NETVSC); @@ -1362,7 +1361,7 @@ NetVscOnReceiveCompletion( } // Overloading use of the lock. - SpinlockAcquire(netDevice-ReceivePacketListLock); + spin_lock_irqsave(netDevice-receive_packet_list_lock, flags); ASSERT(packet-XferPagePacket-Count 0); packet-XferPagePacket-Count--; @@ -1379,7 +1378,7 @@ NetVscOnReceiveCompletion( // Put the packet back INSERT_TAIL_LIST(netDevice-ReceivePacketList, packet-ListEntry); - SpinlockRelease(netDevice-ReceivePacketListLock); + spin_unlock_irqrestore(netDevice-receive_packet_list_lock, flags); // Send a receive completion for the xfer page packet if (fSendReceiveComp) --- a/drivers/staging/hv/NetVsc.h +++ b/drivers/staging/hv/NetVsc.h @@ -62,7 +62,7 @@ typedef struct _NETVSC_DEVICE { int NumOutstandingSends; // List of free preallocated NETVSC_PACKET to represent receive packet LIST_ENTRY ReceivePacketList; - HANDLE ReceivePacketListLock; + spinlock_t receive_packet_list_lock; // Send buffer allocated by us but manages
[patch 53/54] Staging: hv: fix up printk warnings
From: Greg Kroah-Hartman gre...@suse.de After LogMsg was converted to printk, lots of build warnings showed up as no one was checking the arguments to LogMsg. This patch fixes them all. Cc: Hank Janssen hjans...@microsoft.com Cc: Haiyang Zhang haiya...@microsoft.com Signed-off-by: Greg Kroah-Hartman gre...@suse.de --- drivers/staging/hv/Hv.c |6 +++--- drivers/staging/hv/StorVsc.c | 16 drivers/staging/hv/blkvsc_drv.c | 12 ++-- drivers/staging/hv/storvsc_drv.c |2 +- 4 files changed, 18 insertions(+), 18 deletions(-) --- a/drivers/staging/hv/blkvsc_drv.c +++ b/drivers/staging/hv/blkvsc_drv.c @@ -918,7 +918,7 @@ static int blkvsc_submit_request(struct STORVSC_REQUEST *storvsc_req; - DPRINT_DBG(BLKVSC_DRV, blkvsc_submit_request() - req %p type %s start_sector %llu count %d offset %d len %d\n, + DPRINT_DBG(BLKVSC_DRV, blkvsc_submit_request() - req %p type %s start_sector %llu count %ld offset %d len %d\n, blkvsc_req, (blkvsc_req-write)?WRITE:READ, blkvsc_req-sector_start, @@ -1087,7 +1087,7 @@ static int blkvsc_do_request(struct bloc { if (pending) { - DPRINT_DBG(BLKVSC_DRV, adding blkvsc_req to pending_list - blkvsc_req %p start_sect %llu sect_count %d (%llu %d)\n, + DPRINT_DBG(BLKVSC_DRV, adding blkvsc_req to pending_list - blkvsc_req %p start_sect %llu sect_count %ld (%llu %ld)\n, blkvsc_req, blkvsc_req-sector_start, blkvsc_req-sector_count, start_sector, num_sectors); list_add_tail(blkvsc_req-pend_entry, blkdev-pending_list); @@ -1101,7 +1101,7 @@ static int blkvsc_do_request(struct bloc list_add_tail(blkvsc_req-pend_entry, blkdev-pending_list); } - DPRINT_DBG(BLKVSC_DRV, submitted blkvsc_req %p start_sect %llu sect_count %d (%llu %d) ret %d\n, + DPRINT_DBG(BLKVSC_DRV, submitted blkvsc_req %p start_sect %llu sect_count %ld (%llu %ld) ret %d\n, blkvsc_req, blkvsc_req-sector_start, blkvsc_req-sector_count, start_sector, num_sectors, ret); } } @@ -1141,7 +1141,7 @@ static void blkvsc_request_completion(ST ASSERT(blkvsc_req-group); - DPRINT_DBG(BLKVSC_DRV, blkdev %p blkvsc_req %p group %p type %s sect_start %llu sect_count %d len %d group outstd %d total outstd %d\n, + DPRINT_DBG(BLKVSC_DRV, blkdev %p blkvsc_req %p group %p type %s sect_start %llu sect_count %ld len %d group outstd %d total outstd %d\n, blkdev, blkvsc_req, blkvsc_req-group, @@ -1163,7 +1163,7 @@ static void blkvsc_request_completion(ST { list_for_each_entry_safe(comp_req, tmp, blkvsc_req-group-blkvsc_req_list, req_entry) { - DPRINT_DBG(BLKVSC_DRV, completing blkvsc_req %p sect_start %llu sect_count %d \n, + DPRINT_DBG(BLKVSC_DRV, completing blkvsc_req %p sect_start %llu sect_count %ld \n, comp_req, comp_req-sector_start, comp_req-sector_count); @@ -1222,7 +1222,7 @@ static int blkvsc_cancel_pending_reqs(st // until we hit the pend_req list_for_each_entry_safe(comp_req, tmp2, pend_req-group-blkvsc_req_list, req_entry) { - DPRINT_DBG(BLKVSC_DRV, completing blkvsc_req %p sect_start %llu sect_count %d \n, + DPRINT_DBG(BLKVSC_DRV, completing blkvsc_req %p sect_start %llu sect_count %ld \n, comp_req, comp_req-sector_start, comp_req-sector_count); --- a/drivers/staging/hv/Hv.c +++ b/drivers/staging/hv/Hv.c @@ -300,9 +300,9 @@ HvInit ( goto Cleanup; } -DPRINT_INFO(VMBUS, Hypercall page VA=0x%08x, PA=0x%08x, - (unsigned long)gHvContext.HypercallPage, - (unsigned long)hypercallMsr.GuestPhysicalAddress PAGE_SHIFT); + DPRINT_INFO(VMBUS, Hypercall page VA=%p, PA=0x%0llx, + gHvContext.HypercallPage, + (u64)hypercallMsr.GuestPhysicalAddress PAGE_SHIFT); // Setup the global signal event param for the signal event hypercall gHvContext.SignalEventBuffer = kmalloc(sizeof(HV_INPUT_SIGNAL_EVENT_BUFFER), GFP_KERNEL); --- a/drivers/staging/hv/StorVsc.c +++ b/drivers/staging/hv/StorVsc.c @@ -348,7 +348,7 @@ StorVscOnDeviceAdd( deviceInfo-PathId = storDevice-PathId; deviceInfo-TargetId = storDevice-TargetId; - DPRINT_DBG(STORVSC, assigned port %u, path %u target %u\n, storDevice-PortNumber, storDevice-PathId, storDevice-TargetId); + DPRINT_DBG
[patch 35/54] Staging: hv: remove UNUSED_VAR usage
From: Greg Kroah-Hartman gre...@suse.de This isn't needed at all. Cc: Hank Janssen hjans...@microsoft.com Cc: Haiyang Zhang haiya...@microsoft.com Signed-off-by: Greg Kroah-Hartman gre...@suse.de --- drivers/staging/hv/include/osd.h |2 -- drivers/staging/hv/netvsc_drv.c |2 +- 2 files changed, 1 insertion(+), 3 deletions(-) --- a/drivers/staging/hv/include/osd.h +++ b/drivers/staging/hv/include/osd.h @@ -30,8 +30,6 @@ // -#define UNUSED_VAR(v) v __attribute__((__unused__)) - #define ALIGN_UP(value, align) ( ((value) (align-1))? ( ((value) + (align-1)) ~(align-1) ): (value) ) #define ALIGN_DOWN(value, align) ( (value) ~(align-1) ) #define NUM_PAGES_SPANNED(addr, len) ( (ALIGN_UP(addr+len, PAGE_SIZE) - ALIGN_DOWN(addr, PAGE_SIZE)) PAGE_SHIFT ) --- a/drivers/staging/hv/netvsc_drv.c +++ b/drivers/staging/hv/netvsc_drv.c @@ -154,7 +154,7 @@ Desc: Set the multicast list Remark:No-op here --*/ -static void netvsc_set_multicast_list(UNUSED_VAR(struct net_device *net)) +static void netvsc_set_multicast_list(struct net_device *net) { } ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/virtualization
[patch 46/54] Staging: hv: make gVmbusConnection.ChannelMsgLock a real spinlock
From: Greg Kroah-Hartman gre...@suse.de Don't use the wrapper functions for this lock, make it a real lock so that we know what is going on. I don't think we really want to be doing a irqsave for this code, but I left it alone to preserve the original codepath. It should be reviewed later. Cc: Hank Janssen hjans...@microsoft.com Cc: Haiyang Zhang haiya...@microsoft.com Signed-off-by: Greg Kroah-Hartman gre...@suse.de --- drivers/staging/hv/Channel.c | 27 +++ drivers/staging/hv/ChannelMgmt.c | 20 drivers/staging/hv/Connection.c | 10 -- drivers/staging/hv/VmbusPrivate.h |2 +- 4 files changed, 32 insertions(+), 27 deletions(-) --- a/drivers/staging/hv/Channel.c +++ b/drivers/staging/hv/Channel.c @@ -214,6 +214,7 @@ VmbusChannelOpen( VMBUS_CHANNEL_OPEN_CHANNEL* openMsg; VMBUS_CHANNEL_MSGINFO* openInfo; void *in, *out; + unsigned long flags; DPRINT_ENTER(VMBUS); @@ -280,9 +281,9 @@ VmbusChannelOpen( memcpy(openMsg-UserData, UserData, UserDataLen); } - SpinlockAcquire(gVmbusConnection.ChannelMsgLock); + spin_lock_irqsave(gVmbusConnection.channelmsg_lock, flags); INSERT_TAIL_LIST(gVmbusConnection.ChannelMsgList, openInfo-MsgListEntry); - SpinlockRelease(gVmbusConnection.ChannelMsgLock); + spin_unlock_irqrestore(gVmbusConnection.channelmsg_lock, flags); DPRINT_DBG(VMBUS, Sending channel open msg...); @@ -306,9 +307,9 @@ VmbusChannelOpen( } Cleanup: - SpinlockAcquire(gVmbusConnection.ChannelMsgLock); + spin_lock_irqsave(gVmbusConnection.channelmsg_lock, flags); REMOVE_ENTRY_LIST(openInfo-MsgListEntry); - SpinlockRelease(gVmbusConnection.ChannelMsgLock); + spin_unlock_irqrestore(gVmbusConnection.channelmsg_lock, flags); WaitEventClose(openInfo-WaitEvent); kfree(openInfo); @@ -531,6 +532,7 @@ VmbusChannelEstablishGpadl( LIST_ENTRY* anchor; LIST_ENTRY* curr; u32 nextGpadlHandle; + unsigned long flags; DPRINT_ENTER(VMBUS); @@ -549,9 +551,9 @@ VmbusChannelEstablishGpadl( DumpGpadlHeader(gpadlMsg); - SpinlockAcquire(gVmbusConnection.ChannelMsgLock); + spin_lock_irqsave(gVmbusConnection.channelmsg_lock, flags); INSERT_TAIL_LIST(gVmbusConnection.ChannelMsgList, msgInfo-MsgListEntry); - SpinlockRelease(gVmbusConnection.ChannelMsgLock); + spin_unlock_irqrestore(gVmbusConnection.channelmsg_lock, flags); DPRINT_DBG(VMBUS, buffer %p, size %d msg cnt %d, Kbuffer, Size, msgCount); @@ -592,9 +594,9 @@ VmbusChannelEstablishGpadl( *GpadlHandle = gpadlMsg-Gpadl; Cleanup: - SpinlockAcquire(gVmbusConnection.ChannelMsgLock); + spin_lock_irqsave(gVmbusConnection.channelmsg_lock, flags); REMOVE_ENTRY_LIST(msgInfo-MsgListEntry); - SpinlockRelease(gVmbusConnection.ChannelMsgLock); + spin_unlock_irqrestore(gVmbusConnection.channelmsg_lock, flags); WaitEventClose(msgInfo-WaitEvent); kfree(msgInfo); @@ -624,6 +626,7 @@ VmbusChannelTeardownGpadl( int ret=0; VMBUS_CHANNEL_GPADL_TEARDOWN *msg; VMBUS_CHANNEL_MSGINFO* info; + unsigned long flags; DPRINT_ENTER(VMBUS); @@ -640,9 +643,9 @@ VmbusChannelTeardownGpadl( msg-ChildRelId = Channel-OfferMsg.ChildRelId; msg-Gpadl = GpadlHandle; - SpinlockAcquire(gVmbusConnection.ChannelMsgLock); + spin_lock_irqsave(gVmbusConnection.channelmsg_lock, flags); INSERT_TAIL_LIST(gVmbusConnection.ChannelMsgList, info-MsgListEntry); - SpinlockRelease(gVmbusConnection.ChannelMsgLock); + spin_unlock_irqrestore(gVmbusConnection.channelmsg_lock, flags); ret = VmbusPostMessage(msg, sizeof(VMBUS_CHANNEL_GPADL_TEARDOWN)); if (ret != 0) @@ -653,9 +656,9 @@ VmbusChannelTeardownGpadl( WaitEventWait(info-WaitEvent); // Received a torndown response - SpinlockAcquire(gVmbusConnection.ChannelMsgLock); + spin_lock_irqsave(gVmbusConnection.channelmsg_lock, flags); REMOVE_ENTRY_LIST(info-MsgListEntry); - SpinlockRelease(gVmbusConnection.ChannelMsgLock); + spin_unlock_irqrestore(gVmbusConnection.channelmsg_lock, flags); WaitEventClose(info-WaitEvent); kfree(info); --- a/drivers/staging/hv/ChannelMgmt.c +++ b/drivers/staging/hv/ChannelMgmt.c @@ -472,13 +472,14 @@ VmbusChannelOnOpenResult( VMBUS_CHANNEL_MSGINFO* msgInfo; VMBUS_CHANNEL_MESSAGE_HEADER* requestHeader; VMBUS_CHANNEL_OPEN_CHANNEL* openMsg; + unsigned long flags; DPRINT_ENTER(VMBUS); DPRINT_DBG(VMBUS, vmbus open result - %d, result-Status); // Find the open msg, copy the result and signal/unblock the wait event - SpinlockAcquire(gVmbusConnection.ChannelMsgLock); + spin_lock_irqsave(gVmbusConnection.channelmsg_lock, flags
[patch 39/54] Staging: hv: osd: remove MemAllocZeroed wrapper
From: Greg Kroah-Hartman gre...@suse.de Use the real kzalloc call instead of a wrapper function. Cc: Hank Janssen hjans...@microsoft.com Cc: Haiyang Zhang haiya...@microsoft.com Signed-off-by: Greg Kroah-Hartman gre...@suse.de --- drivers/staging/hv/Channel.c |8 drivers/staging/hv/Connection.c |4 ++-- drivers/staging/hv/NetVsc.c |4 ++-- drivers/staging/hv/RndisFilter.c |4 ++-- drivers/staging/hv/StorVsc.c |2 +- drivers/staging/hv/include/osd.h |1 - drivers/staging/hv/osd.c |7 --- 7 files changed, 11 insertions(+), 19 deletions(-) --- a/drivers/staging/hv/Channel.c +++ b/drivers/staging/hv/Channel.c @@ -226,7 +226,7 @@ VmbusChannelOpen( // Allocate the ring buffer out = PageAlloc((SendRingBufferSize + RecvRingBufferSize) PAGE_SHIFT); - //out = MemAllocZeroed(sendRingBufferSize + recvRingBufferSize); + //out = kzalloc(sendRingBufferSize + recvRingBufferSize, GFP_KERNEL); ASSERT(out); ASSERT(((unsigned long)out (PAGE_SIZE-1)) == 0); @@ -421,7 +421,7 @@ VmbusChannelCreateGpadlHeader( { // fill in the header msgSize = sizeof(VMBUS_CHANNEL_MSGINFO) + sizeof(VMBUS_CHANNEL_GPADL_HEADER) + sizeof(GPA_RANGE) + pfnCount*sizeof(u64); - msgHeader = MemAllocZeroed(msgSize); + msgHeader = kzalloc(msgSize, GFP_KERNEL); INITIALIZE_LIST_HEAD(msgHeader-SubMsgList); msgHeader-MessageSize=msgSize; @@ -458,7 +458,7 @@ VmbusChannelCreateGpadlHeader( } msgSize = sizeof(VMBUS_CHANNEL_MSGINFO) + sizeof(VMBUS_CHANNEL_GPADL_BODY) + pfnCurr*sizeof(u64); - msgBody = MemAllocZeroed(msgSize); + msgBody = kzalloc(msgSize, GFP_KERNEL); ASSERT(msgBody); msgBody-MessageSize = msgSize; (*MessageCount)++; @@ -481,7 +481,7 @@ VmbusChannelCreateGpadlHeader( { // everything fits in a header msgSize = sizeof(VMBUS_CHANNEL_MSGINFO) + sizeof(VMBUS_CHANNEL_GPADL_HEADER) + sizeof(GPA_RANGE) + pageCount*sizeof(u64); - msgHeader = MemAllocZeroed(msgSize); + msgHeader = kzalloc(msgSize, GFP_KERNEL); msgHeader-MessageSize=msgSize; gpaHeader = (VMBUS_CHANNEL_GPADL_HEADER*)msgHeader-Msg; --- a/drivers/staging/hv/Connection.c +++ b/drivers/staging/hv/Connection.c @@ -89,7 +89,7 @@ VmbusConnect( goto Cleanup; } - msgInfo = (VMBUS_CHANNEL_MSGINFO*)MemAllocZeroed(sizeof(VMBUS_CHANNEL_MSGINFO) + sizeof(VMBUS_CHANNEL_INITIATE_CONTACT)); + msgInfo = kzalloc(sizeof(VMBUS_CHANNEL_MSGINFO) + sizeof(VMBUS_CHANNEL_INITIATE_CONTACT), GFP_KERNEL); if (msgInfo == NULL) { ret = -1; @@ -207,7 +207,7 @@ VmbusDisconnect( if (gVmbusConnection.ConnectState != Connected) return -1; - msg = MemAllocZeroed(sizeof(VMBUS_CHANNEL_UNLOAD)); + msg = kzalloc(sizeof(VMBUS_CHANNEL_UNLOAD), GFP_KERNEL); msg-MessageType = ChannelMessageUnload; --- a/drivers/staging/hv/include/osd.h +++ b/drivers/staging/hv/include/osd.h @@ -121,7 +121,6 @@ extern void PageFree(void* page, unsigne extern void* MemMapIO(unsigned long phys, unsigned long size); extern void MemUnmapIO(void* virt); -extern void* MemAllocZeroed(unsigned int size); extern void* MemAllocAtomic(unsigned int size); extern void MemFree(void* buf); extern void MemoryFence(void); --- a/drivers/staging/hv/NetVsc.c +++ b/drivers/staging/hv/NetVsc.c @@ -122,7 +122,7 @@ static inline NETVSC_DEVICE* AllocNetDev { NETVSC_DEVICE *netDevice; - netDevice = MemAllocZeroed(sizeof(NETVSC_DEVICE)); + netDevice = kzalloc(sizeof(NETVSC_DEVICE), GFP_KERNEL); if (!netDevice) return NULL; @@ -815,7 +815,7 @@ NetVscOnDeviceAdd( for (i=0; i NETVSC_RECEIVE_PACKETLIST_COUNT; i++) { - packet = MemAllocZeroed(sizeof(NETVSC_PACKET) + (NETVSC_RECEIVE_SG_COUNT* sizeof(PAGE_BUFFER))); + packet = kzalloc(sizeof(NETVSC_PACKET) + (NETVSC_RECEIVE_SG_COUNT* sizeof(PAGE_BUFFER)), GFP_KERNEL); if (!packet) { DPRINT_DBG(NETVSC, unable to allocate netvsc pkts for receive pool (wanted %d got %d), NETVSC_RECEIVE_PACKETLIST_COUNT, i); --- a/drivers/staging/hv/osd.c +++ b/drivers/staging/hv/osd.c @@ -189,13 +189,6 @@ void PageUnmapVirtualAddress(void* VirtA kunmap_atomic(VirtAddr, KM_IRQ0); } -void* MemAllocZeroed(unsigned int size) -{ - void *p = kmalloc(size, GFP_KERNEL); - if (p) memset(p, 0, size); - return p; -} - void* MemAllocAtomic(unsigned int size) { return kmalloc(size, GFP_ATOMIC); --- a/drivers/staging/hv/RndisFilter.c +++ b/drivers/staging/hv
[patch 31/54] Staging: hv: remove #defines from osd.c
From: Greg Kroah-Hartman gre...@suse.de Remove the unneeded #defines from osd.c Cc: Hank Janssen hjans...@microsoft.com Cc: Haiyang Zhang haiya...@microsoft.com Signed-off-by: Greg Kroah-Hartman gre...@suse.de --- drivers/staging/hv/osd.c | 42 -- 1 file changed, 42 deletions(-) --- a/drivers/staging/hv/osd.c +++ b/drivers/staging/hv/osd.c @@ -21,15 +21,12 @@ * */ -#define KERNEL_2_6_27 - #include linux/module.h #include linux/init.h #include linux/types.h #include linux/mm.h #include linux/highmem.h #include linux/vmalloc.h -//#include linux/config.h #include linux/ioport.h #include linux/irq.h #include linux/interrupt.h @@ -86,20 +83,11 @@ typedef struct _WORKITEM { void LogMsg(const char *fmt, ...) { -#ifdef KERNEL_2_6_5 - char buf[1024]; -#endif va_list args; va_start(args, fmt); -#ifdef KERNEL_2_6_5 - vsnprintf(buf, 1024, fmt, args); - va_end(args); - printk(buf); -#else vprintk(fmt, args); va_end(args); -#endif } void BitSet(unsigned int* addr, int bit) @@ -130,30 +118,12 @@ int BitTestAndSet(unsigned int* addr, in int InterlockedIncrement(int *val) { -#ifdef KERNEL_2_6_5 - int i; - local_irq_disable(); - i = atomic_read((atomic_t*)val); - atomic_set((atomic_t*)val, i+1); - local_irq_enable(); - return i+1; -#else return atomic_inc_return((atomic_t*)val); -#endif } int InterlockedDecrement(int *val) { -#ifdef KERNEL_2_6_5 - int i; - local_irq_disable(); - i = atomic_read((atomic_t*)val); - atomic_set((atomic_t*)val, i-1); - local_irq_enable(); - return i-1; -#else return atomic_dec_return((atomic_t*)val); -#endif } #ifndef atomic_cmpxchg @@ -428,11 +398,7 @@ unsigned long Virtual2Physical(void * Vi return pfn PAGE_SHIFT; } -#ifdef KERNEL_2_6_27 void WorkItemCallback(struct work_struct *work) -#else -void WorkItemCallback(void* work) -#endif { WORKITEM* w = (WORKITEM*)work; @@ -474,11 +440,7 @@ int WorkQueueQueueWorkItem(HANDLE hWorkQ w-callback = workItem, w-context = context; -#ifdef KERNEL_2_6_27 INIT_WORK(w-work, WorkItemCallback); -#else - INIT_WORK(w-work, WorkItemCallback, w); -#endif return queue_work(wq-queue, w-work); } @@ -492,10 +454,6 @@ void QueueWorkItem(PFN_WORKITEM_CALLBACK w-callback = workItem, w-context = context; -#ifdef KERNEL_2_6_27 INIT_WORK(w-work, WorkItemCallback); -#else - INIT_WORK(w-work, WorkItemCallback, w); -#endif schedule_work(w-work); } ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/virtualization
[patch 40/54] Staging: hv: osd: remove MemAllocAtomic wrapper
From: Greg Kroah-Hartman gre...@suse.de Use the real kmalloc call instead of a wrapper function. Cc: Hank Janssen hjans...@microsoft.com Cc: Haiyang Zhang haiya...@microsoft.com Signed-off-by: Greg Kroah-Hartman gre...@suse.de --- drivers/staging/hv/ChannelMgmt.c |3 +-- drivers/staging/hv/Hv.c |2 +- drivers/staging/hv/NetVsc.c |2 +- drivers/staging/hv/Vmbus.c |2 +- drivers/staging/hv/include/osd.h |1 - drivers/staging/hv/osd.c |5 - 6 files changed, 4 insertions(+), 11 deletions(-) --- a/drivers/staging/hv/ChannelMgmt.c +++ b/drivers/staging/hv/ChannelMgmt.c @@ -143,13 +143,12 @@ VMBUS_CHANNEL* AllocVmbusChannel(void) { VMBUS_CHANNEL* channel; - channel = (VMBUS_CHANNEL*) MemAllocAtomic(sizeof(VMBUS_CHANNEL)); + channel = kzalloc(sizeof(VMBUS_CHANNEL), GFP_ATOMIC); if (!channel) { return NULL; } - memset(channel, 0,sizeof(VMBUS_CHANNEL)); channel-InboundLock = SpinlockCreate(); if (!channel-InboundLock) { --- a/drivers/staging/hv/Hv.c +++ b/drivers/staging/hv/Hv.c @@ -414,7 +414,7 @@ HvPostMessage( return -1; } - addr = (unsigned long)MemAllocAtomic(sizeof(struct alignedInput)); + addr = (unsigned long)kmalloc(sizeof(struct alignedInput), GFP_ATOMIC); if (!addr) { --- a/drivers/staging/hv/include/osd.h +++ b/drivers/staging/hv/include/osd.h @@ -121,7 +121,6 @@ extern void PageFree(void* page, unsigne extern void* MemMapIO(unsigned long phys, unsigned long size); extern void MemUnmapIO(void* virt); -extern void* MemAllocAtomic(unsigned int size); extern void MemFree(void* buf); extern void MemoryFence(void); --- a/drivers/staging/hv/NetVsc.c +++ b/drivers/staging/hv/NetVsc.c @@ -1480,7 +1480,7 @@ NetVscOnChannelCallback( } else if (ret == -2) // Handle large packet { - buffer = MemAllocAtomic(bytesRecvd); + buffer = kmalloc(bytesRecvd, GFP_ATOMIC); if (buffer == NULL) { // Try again next time around --- a/drivers/staging/hv/osd.c +++ b/drivers/staging/hv/osd.c @@ -189,11 +189,6 @@ void PageUnmapVirtualAddress(void* VirtA kunmap_atomic(VirtAddr, KM_IRQ0); } -void* MemAllocAtomic(unsigned int size) -{ - return kmalloc(size, GFP_ATOMIC); -} - void MemFree(void* buf) { kfree(buf); --- a/drivers/staging/hv/Vmbus.c +++ b/drivers/staging/hv/Vmbus.c @@ -411,7 +411,7 @@ VmbusOnMsgDPC( } else { - copied = MemAllocAtomic(sizeof(HV_MESSAGE)); + copied = kmalloc(sizeof(HV_MESSAGE), GFP_ATOMIC); if (copied == NULL) { continue; ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/virtualization
[patch 28/54] Staging: hv: remove SIZE_T typedef
From: Greg Kroah-Hartman gre...@suse.de The SIZE_T typedef is now removed from the Hyper-V driver code. Cc: Hank Janssen hjans...@microsoft.com Cc: Haiyang Zhang haiya...@microsoft.com Signed-off-by: Greg Kroah-Hartman gre...@suse.de --- drivers/staging/hv/Connection.c |2 +- drivers/staging/hv/Hv.c |2 +- drivers/staging/hv/Hv.h |2 +- drivers/staging/hv/VmbusPrivate.h |2 +- drivers/staging/hv/include/osd.h |3 +-- drivers/staging/hv/osd.c |2 +- 6 files changed, 6 insertions(+), 7 deletions(-) --- a/drivers/staging/hv/Connection.c +++ b/drivers/staging/hv/Connection.c @@ -386,7 +386,7 @@ Description: int VmbusPostMessage( void * buffer, - SIZE_T bufferLen + size_t bufferLen ) { int ret=0; --- a/drivers/staging/hv/Hv.c +++ b/drivers/staging/hv/Hv.c @@ -397,7 +397,7 @@ HvPostMessage( HV_CONNECTION_ID connectionId, HV_MESSAGE_TYPE messageType, void *payload, - SIZE_T payloadSize + size_t payloadSize ) { struct alignedInput { --- a/drivers/staging/hv/Hv.h +++ b/drivers/staging/hv/Hv.h @@ -163,7 +163,7 @@ HvPostMessage( HV_CONNECTION_ID connectionId, HV_MESSAGE_TYPE messageType, void *payload, - SIZE_T payloadSize + size_t payloadSize ); static HV_STATUS --- a/drivers/staging/hv/include/osd.h +++ b/drivers/staging/hv/include/osd.h @@ -97,7 +97,6 @@ typedef struct _DLIST_ENTRY { // // Other types // -typedef unsigned long SIZE_T; //typedef unsigned charGUID[16]; typedef unsigned char BOOL; typedef unsigned char BOOLEAN; @@ -188,7 +187,7 @@ extern HANDLE TimerCreate(PFN_TIMER_CALL extern void TimerClose(HANDLE hTimer); extern int TimerStop(HANDLE hTimer); extern void TimerStart(HANDLE hTimer, u32 expirationInUs); -extern SIZE_T GetTickCount(void); +extern size_t GetTickCount(void); extern HANDLE WaitEventCreate(void); extern void WaitEventClose(HANDLE hWait); --- a/drivers/staging/hv/osd.c +++ b/drivers/staging/hv/osd.c @@ -312,7 +312,7 @@ void TimerClose(HANDLE hTimer) kfree(t); } -SIZE_T GetTickCount(void) +size_t GetTickCount(void) { return jiffies; } --- a/drivers/staging/hv/VmbusPrivate.h +++ b/drivers/staging/hv/VmbusPrivate.h @@ -149,7 +149,7 @@ VmbusDisconnect( static int VmbusPostMessage( void * buffer, - SIZE_T bufSize + size_t bufSize ); static int ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/virtualization
[patch 36/54] Staging: hv: remove FIELD_OFFSET usage
From: Greg Kroah-Hartman gre...@suse.de This isn't needed, or even used, at all. Cc: Hank Janssen hjans...@microsoft.com Cc: Haiyang Zhang haiya...@microsoft.com Signed-off-by: Greg Kroah-Hartman gre...@suse.de --- drivers/staging/hv/include/VmbusChannelInterface.h |9 - drivers/staging/hv/include/osd.h |2 -- 2 files changed, 11 deletions(-) --- a/drivers/staging/hv/include/osd.h +++ b/drivers/staging/hv/include/osd.h @@ -37,8 +37,6 @@ #define LOWORD(dw) ((unsigned short) (dw)) #define HIWORD(dw) ((unsigned short) (((unsigned int) (dw) 16) 0x)) -#define FIELD_OFFSET(t, f)((unsigned int)(unsigned long)(((t *)0)-f)) - #ifdef FALSE #undef FALSE #endif --- a/drivers/staging/hv/include/VmbusChannelInterface.h +++ b/drivers/staging/hv/include/VmbusChannelInterface.h @@ -98,15 +98,6 @@ typedef struct #pragma pack(pop) -// -// Verify the MAX_PIPE_USER_DEFINED_BYTES value. -// -//C_ASSERT(MAX_PIPE_USER_DEFINED_BYTES == -// MAX_USER_DEFINED_BYTES - -// (FIELD_OFFSET(VMBUS_CHANNEL_OFFER, u.Pipe.UserDefined) - -// FIELD_OFFSET(VMBUS_CHANNEL_OFFER, u.Standard.UserDefined))); -// - typedef u32 GPADL_HANDLE; // ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/virtualization
[patch 52/54] Staging: hv: osd: remove PrintBytes wrapper
From: Greg Kroah-Hartman gre...@suse.de Use the real print_hex_dump_bytes call instead of a wrapper function. Cc: Hank Janssen hjans...@microsoft.com Cc: Haiyang Zhang haiya...@microsoft.com Signed-off-by: Greg Kroah-Hartman gre...@suse.de --- drivers/staging/hv/ChannelMgmt.c |3 ++- drivers/staging/hv/StorVsc.c |2 +- drivers/staging/hv/blkvsc_drv.c |5 +++-- drivers/staging/hv/include/logging.h | 22 -- 4 files changed, 6 insertions(+), 26 deletions(-) --- a/drivers/staging/hv/blkvsc_drv.c +++ b/drivers/staging/hv/blkvsc_drv.c @@ -578,7 +578,7 @@ static int blkvsc_do_inquiry(struct bloc buf = kmap(page_buf); - //PrintBytes(buf, 64); + /* print_hex_dump_bytes(, DUMP_PREFIX_NONE, buf, 64); */ // be to le device_type = buf[0] 0x1F; @@ -603,7 +603,8 @@ static int blkvsc_do_inquiry(struct bloc blkdev-device_id_len = 64; memcpy(blkdev-device_id, buf[8], blkdev-device_id_len); - //PrintBytes(blkdev-device_id, blkdev-device_id_len); + /* printk_hex_dump_bytes(, DUMP_PREFIX_NONE, blkdev-device_id, +* blkdev-device_id_len); */ kunmap(page_buf); --- a/drivers/staging/hv/ChannelMgmt.c +++ b/drivers/staging/hv/ChannelMgmt.c @@ -687,7 +687,8 @@ VmbusOnChannelMessage( if (hdr-MessageType = ChannelMessageCount) { DPRINT_ERR(VMBUS, Received invalid channel message type %d size %d, hdr-MessageType, size); - PrintBytes((unsigned char *)msg-u.Payload, size); + print_hex_dump_bytes(, DUMP_PREFIX_NONE, +(unsigned char *)msg-u.Payload, size); kfree(msg); return; } --- a/drivers/staging/hv/include/logging.h +++ b/drivers/staging/hv/include/logging.h @@ -117,26 +117,4 @@ extern unsigned int vmbus_loglevel; #define DPRINT_EXIT(mod) #endif -static inline void PrintBytes(const unsigned char* bytes, int len) -{ - int i=0; - - printk(\n ); - for (i=0; i len; i++) - { - printk(0x%x , bytes[i]); - } - printk(\n); -} - -// -// Inline -// -//static inline void GuidToStr(const GUID g, char *str) -//{ -// sprintf(str, {%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x%02x%02x}, -// g[3], g[2], g[1], g[0], g[5], g[4], g[7], g[6], g[8], g[9], g[10], g[11], g[12], g[13], g[14], g[15]); -// -//} - #endif //_LOGGING_H_ --- a/drivers/staging/hv/StorVsc.c +++ b/drivers/staging/hv/StorVsc.c @@ -713,7 +713,7 @@ StorVscOnIORequest( return -2; } - //PrintBytes(Request-Cdb, Request-CdbLen); + /* print_hex_dump_bytes(, DUMP_PREFIX_NONE, Request-Cdb, Request-CdbLen); */ requestExtension-Request = Request; requestExtension-Device = Device; ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/virtualization
[patch 13/54] Staging: hv: make the Hyper-V virtual block driver build
From: Greg Kroah-Hartman gre...@suse.de The #define KERNEL_2_6_27 needs to be set, and I adjusted the include directories a bit to get things to build properly. I also fixed up the direct access of bus_id, as that field is now gone. Lots of block api changes were needed, and I don't think I got it all correct. It would be great of someone who knows the block api better could review it. The hv_blkvsc code should now build, with no errors. Cc: Hank Janssen hjans...@microsoft.com Cc: Haiyang Zhang haiya...@microsoft.com Signed-off-by: Greg Kroah-Hartman gre...@suse.de --- drivers/staging/hv/BlkVsc.c |2 +- drivers/staging/hv/blkvsc_drv.c | 23 --- 2 files changed, 13 insertions(+), 12 deletions(-) --- a/drivers/staging/hv/BlkVsc.c +++ b/drivers/staging/hv/BlkVsc.c @@ -21,7 +21,7 @@ */ -#include ../storvsc/StorVsc.c +#include StorVsc.c static const char* gBlkDriverName=blkvsc; --- a/drivers/staging/hv/blkvsc_drv.c +++ b/drivers/staging/hv/blkvsc_drv.c @@ -20,6 +20,7 @@ * */ +#define KERNEL_2_6_27 #include linux/init.h #include linux/module.h @@ -34,10 +35,10 @@ #include scsi/scsi_eh.h #include scsi/scsi_dbg.h -#include logging.h -#include vmbus.h +#include include/logging.h +#include include/vmbus.h -#include StorVscApi.h +#include include/StorVscApi.h // // #defines @@ -313,7 +314,7 @@ static int blkvsc_probe(struct device *d ASSERT(sizeof(struct blkvsc_request_group) = sizeof(struct blkvsc_request)); #ifdef KERNEL_2_6_27 -blkdev-request_pool = kmem_cache_create(device_ctx-device.bus_id, +blkdev-request_pool = kmem_cache_create(dev_name(device_ctx-device), sizeof(struct blkvsc_request) + storvsc_drv_obj-RequestExtSize, 0, SLAB_HWCACHE_ALIGN, NULL); #else @@ -426,7 +427,7 @@ static int blkvsc_probe(struct device *d } set_capacity(blkdev-gd, blkdev-capacity * (blkdev-sector_size/512)); - blk_queue_hardsect_size(blkdev-gd-queue, blkdev-sector_size); + blk_queue_logical_block_size(blkdev-gd-queue, blkdev-sector_size); // go! add_disk(blkdev-gd); @@ -982,7 +983,7 @@ static int blkvsc_do_request(struct bloc int pending=0; struct blkvsc_request_group *group=NULL; - DPRINT_DBG(BLKVSC_DRV, blkdev %p req %p sect %llu \n, blkdev, req, req-sector); + DPRINT_DBG(BLKVSC_DRV, blkdev %p req %p sect %llu \n, blkdev, req, blk_rq_pos(req)); // Create a group to tie req to list of blkvsc_reqs group = (struct blkvsc_request_group*)kmem_cache_alloc(blkdev-request_pool, GFP_ATOMIC); @@ -994,7 +995,7 @@ static int blkvsc_do_request(struct bloc INIT_LIST_HEAD(group-blkvsc_req_list); group-outstanding = group-status = 0; - start_sector = req-sector; + start_sector = blk_rq_pos(req); // foreach bio in the request if (req-bio) @@ -1314,13 +1315,13 @@ static void blkvsc_request(struct reques int ret=0; DPRINT_DBG(BLKVSC_DRV, - enter \n); - while ((req = elv_next_request(queue)) != NULL) + while ((req = blk_peek_request(queue)) != NULL) { DPRINT_DBG(BLKVSC_DRV, - req %p\n, req); blkdev = req-rq_disk-private_data; if (blkdev-shutting_down || !blk_fs_request(req) || blkdev-media_not_present) { - end_request(req, 0); + __blk_end_request_cur(req, 0); continue; } @@ -1333,7 +1334,7 @@ static void blkvsc_request(struct reques break; } - blkdev_dequeue_request(req); + blk_start_request(req); ret = blkvsc_do_request(blkdev, req); if (ret 0) @@ -1410,7 +1411,7 @@ static int blkvsc_revalidate_disk(struct { blkvsc_do_read_capacity(blkdev); set_capacity(blkdev-gd, blkdev-capacity * (blkdev-sector_size/512)); - blk_queue_hardsect_size(gd-queue, blkdev-sector_size); + blk_queue_logical_block_size(gd-queue, blkdev-sector_size); } return 0; } ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/virtualization
[patch 37/54] Staging: hv: remove TRUE, FALSE, and NULL usage
From: Greg Kroah-Hartman gre...@suse.de Don't define things that are either already provided (like NULL), or you shouldn't use (like TRUE and FALSE). Cc: Hank Janssen hjans...@microsoft.com Cc: Haiyang Zhang haiya...@microsoft.com Signed-off-by: Greg Kroah-Hartman gre...@suse.de --- drivers/staging/hv/ChannelMgmt.c |4 ++-- drivers/staging/hv/Hv.c |8 drivers/staging/hv/NetVsc.c |4 ++-- drivers/staging/hv/RndisFilter.c | 10 +- drivers/staging/hv/include/osd.h | 14 -- 5 files changed, 13 insertions(+), 27 deletions(-) --- a/drivers/staging/hv/ChannelMgmt.c +++ b/drivers/staging/hv/ChannelMgmt.c @@ -240,7 +240,7 @@ VmbusChannelProcessOffer( VMBUS_CHANNEL* newChannel=(VMBUS_CHANNEL*)context; LIST_ENTRY* anchor; LIST_ENTRY* curr; - bool fNew=TRUE; + bool fNew = true; VMBUS_CHANNEL* channel; DPRINT_ENTER(VMBUS); @@ -255,7 +255,7 @@ VmbusChannelProcessOffer( if (!memcmp(channel-OfferMsg.Offer.InterfaceType, newChannel-OfferMsg.Offer.InterfaceType,sizeof(GUID)) !memcmp(channel-OfferMsg.Offer.InterfaceInstance, newChannel-OfferMsg.Offer.InterfaceInstance, sizeof(GUID))) { - fNew = FALSE; + fNew = false; break; } } --- a/drivers/staging/hv/Hv.c +++ b/drivers/staging/hv/Hv.c @@ -31,7 +31,7 @@ // The one and only HV_CONTEXT gHvContext={ - .SynICInitialized = FALSE, + .SynICInitialized = false, .HypercallPage = NULL, .SignalEventParam = NULL, .SignalEventBuffer = NULL, @@ -571,8 +571,8 @@ HvSynicInit ( sharedSint.AsUINT64 = 0; sharedSint.Vector = irqVector; //HV_SHARED_SINT_IDT_VECTOR + 0x20; -sharedSint.Masked = FALSE; -sharedSint.AutoEoi = TRUE; +sharedSint.Masked = false; +sharedSint.AutoEoi = true; DPRINT_DBG(VMBUS, HV_X64_MSR_SINT1 msr set to: %llx, sharedSint.AsUINT64); @@ -584,7 +584,7 @@ HvSynicInit ( WriteMsr(HV_X64_MSR_SCONTROL, sctrl.AsUINT64); - gHvContext.SynICInitialized = TRUE; + gHvContext.SynICInitialized = true; DPRINT_EXIT(VMBUS); --- a/drivers/staging/hv/include/osd.h +++ b/drivers/staging/hv/include/osd.h @@ -37,20 +37,6 @@ #define LOWORD(dw) ((unsigned short) (dw)) #define HIWORD(dw) ((unsigned short) (((unsigned int) (dw) 16) 0x)) -#ifdef FALSE -#undef FALSE -#endif -#define FALSE 0 - -#ifdef TRUE -#undef TRUE -#endif -#define TRUE 1 - -#ifndef NULL -#define NULL (void *)0 -#endif - typedef struct _DLIST_ENTRY { struct _DLIST_ENTRY *Flink; struct _DLIST_ENTRY *Blink; --- a/drivers/staging/hv/NetVsc.c +++ b/drivers/staging/hv/NetVsc.c @@ -1345,7 +1345,7 @@ NetVscOnReceiveCompletion( DEVICE_OBJECT *device = (DEVICE_OBJECT*)packet-Device; NETVSC_DEVICE* netDevice; u64 transactionId=0; - bool fSendReceiveComp = FALSE; + bool fSendReceiveComp = false; DPRINT_ENTER(NETVSC); @@ -1371,7 +1371,7 @@ NetVscOnReceiveCompletion( // Return the xfer page packet itself to the freelist if (packet-XferPagePacket-Count == 0) { - fSendReceiveComp = TRUE; + fSendReceiveComp = true; transactionId = packet-Completion.Recv.ReceiveCompletionTid; INSERT_TAIL_LIST(netDevice-ReceivePacketList, packet-XferPagePacket-ListEntry); --- a/drivers/staging/hv/RndisFilter.c +++ b/drivers/staging/hv/RndisFilter.c @@ -357,7 +357,7 @@ RndisFilterSendRequest( // Setup the packet to send it packet = Request-Packet; - packet-IsDataPacket = FALSE; + packet-IsDataPacket = false; packet-TotalDataBufferLength = Request-RequestMessage.MessageLength; packet-PageBufferCount = 1; @@ -384,7 +384,7 @@ RndisFilterReceiveResponse( LIST_ENTRY *anchor; LIST_ENTRY *curr; RNDIS_REQUEST *request=NULL; - bool found=FALSE; + bool found = false; DPRINT_ENTER(NETVSC); @@ -399,7 +399,7 @@ RndisFilterReceiveResponse( DPRINT_DBG(NETVSC, found rndis request for this response (id 0x%x req type 0x%x res type 0x%x), request-RequestMessage.Message.InitializeRequest.RequestId, request-RequestMessage.NdisMessageType, Response-NdisMessageType); - found = TRUE; + found = true; break; } } @@ -485,7 +485,7 @@ RndisFilterReceiveData( Packet-PageBuffers[0].Offset += dataOffset; Packet-PageBuffers[0].Length -= dataOffset; - Packet-IsDataPacket = TRUE; + Packet-IsDataPacket = true; gRndisFilter.InnerDriver.OnReceiveCallback(Device-NetDevice-Device, Packet); @@ -1112,7 +1112,7 @@ RndisFilterOnSend( rndisPacket
[patch 49/54] Staging: hv: osd: remove Sleep wrapper
From: Greg Kroah-Hartman gre...@suse.de Use the real udelay call instead of a wrapper function. Cc: Hank Janssen hjans...@microsoft.com Cc: Haiyang Zhang haiya...@microsoft.com Signed-off-by: Greg Kroah-Hartman gre...@suse.de --- drivers/staging/hv/NetVsc.c |9 + drivers/staging/hv/StorVsc.c |7 --- drivers/staging/hv/include/osd.h |2 -- drivers/staging/hv/osd.c |5 - 4 files changed, 9 insertions(+), 14 deletions(-) --- a/drivers/staging/hv/include/osd.h +++ b/drivers/staging/hv/include/osd.h @@ -110,8 +110,6 @@ extern int InterlockedIncrement(int *val extern int InterlockedDecrement(int *val); extern int InterlockedCompareExchange(int *val, int new, int curr); -extern void Sleep(unsigned long usecs); - extern void* VirtualAllocExec(unsigned int size); extern void VirtualFree(void* VirtAddr); --- a/drivers/staging/hv/NetVsc.c +++ b/drivers/staging/hv/NetVsc.c @@ -24,6 +24,7 @@ #include linux/kernel.h #include linux/mm.h +#include linux/delay.h #include include/logging.h #include NetVsc.h #include RndisFilter.h @@ -200,7 +201,7 @@ static inline NETVSC_DEVICE* ReleaseOutb // Busy wait until the ref drop to 2, then set it to 1 while (InterlockedCompareExchange(netDevice-RefCount, 1, 2) != 2) { - Sleep(100); + udelay(100); } return netDevice; @@ -217,7 +218,7 @@ static inline NETVSC_DEVICE* ReleaseInbo // Busy wait until the ref drop to 1, then set it to 0 while (InterlockedCompareExchange(netDevice-RefCount, 0, 1) != 1) { - Sleep(100); + udelay(100); } Device-Extension = NULL; @@ -923,7 +924,7 @@ NetVscOnDeviceRemove( { DPRINT_INFO(NETVSC, waiting for %d requests to complete..., netDevice-NumOutstandingSends); - Sleep(100); + udelay(100); } DPRINT_INFO(NETVSC, Disconnecting from netvsp...); @@ -1318,7 +1319,7 @@ retry_send_cmplt: if (retries 4) { - Sleep(100); + udelay(100); goto retry_send_cmplt; } else --- a/drivers/staging/hv/osd.c +++ b/drivers/staging/hv/osd.c @@ -131,11 +131,6 @@ int InterlockedCompareExchange(int *val, } -void Sleep(unsigned long usecs) -{ - udelay(usecs); -} - void* VirtualAllocExec(unsigned int size) { #ifdef __x86_64__ --- a/drivers/staging/hv/StorVsc.c +++ b/drivers/staging/hv/StorVsc.c @@ -26,6 +26,7 @@ #include linux/kernel.h #include linux/string.h #include linux/mm.h +#include linux/delay.h #include include/logging.h #include include/StorVscApi.h @@ -225,7 +226,7 @@ static inline STORVSC_DEVICE* ReleaseSto // Busy wait until the ref drop to 2, then set it to 1 while (InterlockedCompareExchange(storDevice-RefCount, 1, 2) != 2) { - Sleep(100); + udelay(100); } return storDevice; @@ -242,7 +243,7 @@ static inline STORVSC_DEVICE* FinalRelea // Busy wait until the ref drop to 1, then set it to 0 while (InterlockedCompareExchange(storDevice-RefCount, 0, 1) != 1) { - Sleep(100); + udelay(100); } Device-Extension = NULL; @@ -582,7 +583,7 @@ StorVscOnDeviceRemove( { DPRINT_INFO(STORVSC, waiting for %d requests to complete..., storDevice-NumOutstandingRequests); - Sleep(100); + udelay(100); } DPRINT_INFO(STORVSC, removing storage device (%p)..., Device-Extension); ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/virtualization
[patch 11/54] Staging: hv: make the Hyper-V virtual storage driver build
From: Greg Kroah-Hartman gre...@suse.de The #define KERNEL_2_6_27 needs to be set, and I adjusted the include directories a bit to get things to build properly. I also fixed up the direct access of bus_id, as that field is now gone. Some minor scsi api changes were needed as well. The hv_storvsc code should now build properly, with no errors. Cc: Hank Janssen hjans...@microsoft.com Cc: Haiyang Zhang haiya...@microsoft.com Signed-off-by: Greg Kroah-Hartman gre...@suse.de --- drivers/staging/hv/StorVsc.c |9 + drivers/staging/hv/storvsc_drv.c | 11 ++- 2 files changed, 11 insertions(+), 9 deletions(-) --- a/drivers/staging/hv/StorVsc.c +++ b/drivers/staging/hv/StorVsc.c @@ -21,12 +21,13 @@ * */ +#define KERNEL_2_6_27 -#include logging.h +#include include/logging.h -#include StorVscApi.h -#include VmbusPacketFormat.h -#include vstorage.h +#include include/StorVscApi.h +#include include/VmbusPacketFormat.h +#include include/vstorage.h // --- a/drivers/staging/hv/storvsc_drv.c +++ b/drivers/staging/hv/storvsc_drv.c @@ -21,6 +21,7 @@ * */ +#define KERNEL_2_6_27 #include linux/init.h #include linux/module.h @@ -40,10 +41,10 @@ #include scsi/scsi_dbg.h #endif -#include logging.h -#include vmbus.h +#include include/logging.h +#include include/vmbus.h -#include StorVscApi.h +#include include/StorVscApi.h // // #defines @@ -296,7 +297,7 @@ static int storvsc_probe(struct device * #if defined(KERNEL_2_6_27) host_device_ctx-request_pool = kmem_cache_create - (device_ctx-device.bus_id, + (dev_name(device_ctx-device), sizeof(struct storvsc_cmd_request) + storvsc_drv_obj-RequestExtSize, 0, SLAB_HWCACHE_ALIGN, NULL); @@ -1250,7 +1251,7 @@ static int storvsc_report_luns(struct sc // cmd length *(unsigned int*)cmd[6] = cpu_to_be32(report_len); - result = scsi_execute_req(sdev, cmd, DMA_FROM_DEVICE, (unsigned char*)report_luns, report_len, sshdr, 30*HZ, 3); + result = scsi_execute_req(sdev, cmd, DMA_FROM_DEVICE, (unsigned char*)report_luns, report_len, sshdr, 30*HZ, 3, NULL); if (result != 0) { kfree(report_luns); ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/virtualization
[patch 10/54] Staging: hv: add the Hyper-V virtual bus to the build
From: Greg Kroah-Hartman gre...@suse.de Add the Hyper-V virtual bus to the kernel build system. Cc: Hank Janssen hjans...@microsoft.com Cc: Haiyang Zhang haiya...@microsoft.com Signed-off-by: Greg Kroah-Hartman gre...@suse.de --- drivers/staging/Kconfig |2 ++ drivers/staging/Makefile|1 + drivers/staging/hv/Kconfig |8 drivers/staging/hv/Makefile |3 +++ 4 files changed, 14 insertions(+) --- a/drivers/staging/Kconfig +++ b/drivers/staging/Kconfig @@ -129,5 +129,7 @@ source drivers/staging/pata_rdc/Kconfig source drivers/staging/udlfb/Kconfig +source drivers/staging/hv/Kconfig + endif # !STAGING_EXCLUDE_BUILD endif # STAGING --- a/drivers/staging/Makefile +++ b/drivers/staging/Makefile @@ -46,3 +46,4 @@ obj-$(CONFIG_VT6655) += vt6655/ obj-$(CONFIG_USB_CPC) += cpc-usb/ obj-$(CONFIG_RDC_17F3101X) += pata_rdc/ obj-$(CONFIG_FB_UDL) += udlfb/ +obj-$(CONFIG_HYPERV) += hv/ --- /dev/null +++ b/drivers/staging/hv/Kconfig @@ -0,0 +1,8 @@ +config HYPERV + tristate Microsoft Hyper-V client drivers + depends on X86 + default n + help + Select this option to run Linux as a Hyper-V client operating + system. + --- /dev/null +++ b/drivers/staging/hv/Makefile @@ -0,0 +1,3 @@ +obj-$(CONFIG_HYPERV) += hv_vmbus.o + +hv_vmbus-objs := vmbus_drv.o osd.o Sources.o ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/virtualization
[patch 33/54] Staging: hv: remove PAGE_SIZE and PAGE_SHIFT and __builtin functions
From: Greg Kroah-Hartman gre...@suse.de The kernel provides all of this, and actually gets it correct, so don't try to redefine these types of things. Cc: Hank Janssen hjans...@microsoft.com Cc: Haiyang Zhang haiya...@microsoft.com Signed-off-by: Greg Kroah-Hartman gre...@suse.de --- drivers/staging/hv/BlkVsc.c |1 + drivers/staging/hv/NetVsc.c |1 + drivers/staging/hv/RndisFilter.c |1 + drivers/staging/hv/StorVsc.c |2 ++ drivers/staging/hv/Vmbus.c |1 + drivers/staging/hv/include/osd.h | 28 6 files changed, 6 insertions(+), 28 deletions(-) --- a/drivers/staging/hv/BlkVsc.c +++ b/drivers/staging/hv/BlkVsc.c @@ -21,6 +21,7 @@ */ #include linux/kernel.h +#include linux/mm.h #include StorVsc.c static const char* gBlkDriverName=blkvsc; --- a/drivers/staging/hv/include/osd.h +++ b/drivers/staging/hv/include/osd.h @@ -29,34 +29,6 @@ // Defines // -#ifndef PAGE_SIZE -#define PAGE_SIZE 0x1000 -#endif - -#ifndef PAGE_SHIFT -#define PAGE_SHIFT 12 -#endif - -#ifndef memcpy -#define memcpy __builtin_memcpy -#endif - -#ifndef memset -#define memset __builtin_memset -#endif - -#ifndef memcmp -#define memcmp __builtin_memcmp -#endif - -#ifndef strcpy -#define strcpy __builtin_strcpy -#endif - -// -//#ifndef sprintf -//#define sprintf __builtin_sprintf -//#endif #define STRUCT_PACKED __attribute__((__packed__)) #define STRUCT_ALIGNED(x) __attribute__((__aligned__(x))) --- a/drivers/staging/hv/NetVsc.c +++ b/drivers/staging/hv/NetVsc.c @@ -23,6 +23,7 @@ #define KERNEL_2_6_27 #include linux/kernel.h +#include linux/mm.h #include include/logging.h #include NetVsc.h #include RndisFilter.h --- a/drivers/staging/hv/RndisFilter.c +++ b/drivers/staging/hv/RndisFilter.c @@ -24,6 +24,7 @@ #define KERNEL_2_6_27 #include linux/kernel.h +#include linux/mm.h #include include/logging.h #include include/NetVscApi.h --- a/drivers/staging/hv/StorVsc.c +++ b/drivers/staging/hv/StorVsc.c @@ -24,6 +24,8 @@ #define KERNEL_2_6_27 #include linux/kernel.h +#include linux/string.h +#include linux/mm.h #include include/logging.h #include include/StorVscApi.h --- a/drivers/staging/hv/Vmbus.c +++ b/drivers/staging/hv/Vmbus.c @@ -22,6 +22,7 @@ */ #include linux/kernel.h +#include linux/mm.h #include include/logging.h #include VersionInfo.h #include VmbusPrivate.h ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/virtualization
[patch 30/54] Staging: hv: remove BOOL and BOOLEAN typedefs
From: Greg Kroah-Hartman gre...@suse.de The BOOL and BOOLEAN typedefs are now removed from the Hyper-V driver code. Cc: Hank Janssen hjans...@microsoft.com Cc: Haiyang Zhang haiya...@microsoft.com Signed-off-by: Greg Kroah-Hartman gre...@suse.de --- drivers/staging/hv/ChannelMgmt.c |2 +- drivers/staging/hv/Hv.h|2 +- drivers/staging/hv/NetVsc.c|2 +- drivers/staging/hv/RndisFilter.c |2 +- drivers/staging/hv/include/ChannelMessages.h |6 +++--- drivers/staging/hv/include/List.h |2 +- drivers/staging/hv/include/NetVscApi.h |4 ++-- drivers/staging/hv/include/VmbusPacketFormat.h |2 +- drivers/staging/hv/include/osd.h |2 -- 9 files changed, 11 insertions(+), 13 deletions(-) --- a/drivers/staging/hv/ChannelMgmt.c +++ b/drivers/staging/hv/ChannelMgmt.c @@ -240,7 +240,7 @@ VmbusChannelProcessOffer( VMBUS_CHANNEL* newChannel=(VMBUS_CHANNEL*)context; LIST_ENTRY* anchor; LIST_ENTRY* curr; - BOOL fNew=TRUE; + bool fNew=TRUE; VMBUS_CHANNEL* channel; DPRINT_ENTER(VMBUS); --- a/drivers/staging/hv/Hv.h +++ b/drivers/staging/hv/Hv.h @@ -113,7 +113,7 @@ typedef struct { u64 GuestId;// XenLinux or native Linux. If XenLinux, the hypercall and synic pages has already been initialized void* HypercallPage; - BOOLSynICInitialized; + boolSynICInitialized; // This is used as an input param to HvCallSignalEvent hypercall. The input param is immutable // in our usage and must be dynamic mem (vs stack or global). HV_INPUT_SIGNAL_EVENT_BUFFER *SignalEventBuffer; --- a/drivers/staging/hv/include/ChannelMessages.h +++ b/drivers/staging/hv/include/ChannelMessages.h @@ -82,7 +82,7 @@ typedef struct _VMBUS_CHANNEL_QUERY_VMBU typedef struct _VMBUS_CHANNEL_VERSION_SUPPORTED { VMBUS_CHANNEL_MESSAGE_HEADER Header; -BOOLEAN VersionSupported; +bool VersionSupported; } VMBUS_CHANNEL_VERSION_SUPPORTED, *PVMBUS_CHANNEL_VERSION_SUPPORTED; // Offer Channel parameters @@ -92,7 +92,7 @@ typedef struct _VMBUS_CHANNEL_OFFER_CHAN VMBUS_CHANNEL_OFFER Offer; u32 ChildRelId; u8 MonitorId; -BOOLEAN MonitorAllocated; +bool MonitorAllocated; } VMBUS_CHANNEL_OFFER_CHANNEL, *PVMBUS_CHANNEL_OFFER_CHANNEL; // @@ -264,7 +264,7 @@ typedef struct _VMBUS_CHANNEL_INITIATE_C typedef struct _VMBUS_CHANNEL_VERSION_RESPONSE { VMBUS_CHANNEL_MESSAGE_HEADER Header; -BOOLEAN VersionSupported; +bool VersionSupported; } VMBUS_CHANNEL_VERSION_RESPONSE, *PVMBUS_CHANNEL_VERSION_RESPONSE; typedef VMBUS_CHANNEL_MESSAGE_HEADER VMBUS_CHANNEL_UNLOAD, *PVMBUS_CHANNEL_UNLOAD; --- a/drivers/staging/hv/include/List.h +++ b/drivers/staging/hv/include/List.h @@ -56,7 +56,7 @@ typedef DLIST_ENTRY *PLIST_ENTRY; /* - * BOOLEAN + * bool * IsListEmpty( * PLIST_ENTRY ListHead * ); --- a/drivers/staging/hv/include/NetVscApi.h +++ b/drivers/staging/hv/include/NetVscApi.h @@ -72,7 +72,7 @@ typedef struct _NETVSC_PACKET { DLIST_ENTRY ListEntry; DEVICE_OBJECT *Device; - BOOLIsDataPacket; + boolIsDataPacket; // Valid only for receives when we break a xfer page packet into multiple netvsc packets XFERPAGE_PACKET *XferPagePacket; @@ -131,7 +131,7 @@ typedef struct _NETVSC_DRIVER_OBJECT { typedef struct _NETVSC_DEVICE_INFO { unsigned char MacAddr[6]; -BOOL LinkState; // 0 - link up, 1 - link down +bool LinkState; // 0 - link up, 1 - link down } NETVSC_DEVICE_INFO; // --- a/drivers/staging/hv/include/osd.h +++ b/drivers/staging/hv/include/osd.h @@ -98,8 +98,6 @@ typedef struct _DLIST_ENTRY { // Other types // //typedef unsigned charGUID[16]; -typedef unsigned char BOOL; -typedef unsigned char BOOLEAN; typedef void* HANDLE; typedef struct { --- a/drivers/staging/hv/include/VmbusPacketFormat.h +++ b/drivers/staging/hv/include/VmbusPacketFormat.h @@ -113,7 +113,7 @@ typedef struct VMTRANSFER_PAGE_PACKET_HE #endif u16 TransferPageSetId; -BOOLEAN SenderOwnsSet; +bool SenderOwnsSet; u8 Reserved; u32 RangeCount; VMTRANSFER_PAGE_RANGE Ranges[1]; --- a/drivers/staging/hv/NetVsc.c +++ b/drivers/staging/hv/NetVsc.c @@ -1344,7 +1344,7 @@ NetVscOnReceiveCompletion( DEVICE_OBJECT *device = (DEVICE_OBJECT*)packet-Device; NETVSC_DEVICE* netDevice; u64 transactionId=0; - BOOL fSendReceiveComp = FALSE; + bool fSendReceiveComp = FALSE; DPRINT_ENTER(NETVSC); --- a/drivers/staging/hv
[patch 32/54] Staging: hv: remove MIN and MAX usages
From: Greg Kroah-Hartman gre...@suse.de The kernel has the correct min() and max() functions, so use those. Cc: Hank Janssen hjans...@microsoft.com Cc: Haiyang Zhang haiya...@microsoft.com Signed-off-by: Greg Kroah-Hartman gre...@suse.de --- drivers/staging/hv/include/osd.h |3 --- drivers/staging/hv/storvsc_drv.c |4 ++-- 2 files changed, 2 insertions(+), 5 deletions(-) --- a/drivers/staging/hv/include/osd.h +++ b/drivers/staging/hv/include/osd.h @@ -67,9 +67,6 @@ #define ALIGN_DOWN(value, align) ( (value) ~(align-1) ) #define NUM_PAGES_SPANNED(addr, len) ( (ALIGN_UP(addr+len, PAGE_SIZE) - ALIGN_DOWN(addr, PAGE_SIZE)) PAGE_SHIFT ) -#define MIN(a, b) ((a) (b)? (a): (b)) -#define MAX(a, b) ((a) (b)? (a): (b)) - #define LOWORD(dw) ((unsigned short) (dw)) #define HIWORD(dw) ((unsigned short) (((unsigned int) (dw) 16) 0x)) --- a/drivers/staging/hv/storvsc_drv.c +++ b/drivers/staging/hv/storvsc_drv.c @@ -623,7 +623,7 @@ static unsigned int copy_to_bounce_buffe dest = bounce_addr + bounce_sgl[j].length; destlen = PAGE_SIZE - bounce_sgl[j].length; - copylen = MIN(srclen, destlen); + copylen = min(srclen, destlen); memcpy((void*)dest, (void*)src, copylen); total_copied += copylen; @@ -698,7 +698,7 @@ static unsigned int copy_from_bounce_buf src = bounce_addr + bounce_sgl[j].offset; srclen = bounce_sgl[j].length - bounce_sgl[j].offset; - copylen = MIN(srclen, destlen); + copylen = min(srclen, destlen); memcpy((void*)dest, (void*)src, copylen); total_copied += copylen; ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/virtualization
[patch 41/54] Staging: hv: osd: remove MemFree wrapper
From: Greg Kroah-Hartman gre...@suse.de Use the real kfree call instead of a wrapper function. Cc: Hank Janssen hjans...@microsoft.com Cc: Haiyang Zhang haiya...@microsoft.com Signed-off-by: Greg Kroah-Hartman gre...@suse.de --- drivers/staging/hv/Channel.c |8 drivers/staging/hv/ChannelMgmt.c | 14 +++--- drivers/staging/hv/Connection.c |6 +++--- drivers/staging/hv/Hv.c |4 ++-- drivers/staging/hv/NetVsc.c | 12 ++-- drivers/staging/hv/RndisFilter.c |8 drivers/staging/hv/StorVsc.c |2 +- drivers/staging/hv/include/osd.h |1 - drivers/staging/hv/osd.c |5 - 9 files changed, 27 insertions(+), 33 deletions(-) --- a/drivers/staging/hv/Channel.c +++ b/drivers/staging/hv/Channel.c @@ -311,7 +311,7 @@ Cleanup: SpinlockRelease(gVmbusConnection.ChannelMsgLock); WaitEventClose(openInfo-WaitEvent); - MemFree(openInfo); + kfree(openInfo); DPRINT_EXIT(VMBUS); @@ -597,7 +597,7 @@ Cleanup: SpinlockRelease(gVmbusConnection.ChannelMsgLock); WaitEventClose(msgInfo-WaitEvent); - MemFree(msgInfo); + kfree(msgInfo); DPRINT_EXIT(VMBUS); @@ -658,7 +658,7 @@ VmbusChannelTeardownGpadl( SpinlockRelease(gVmbusConnection.ChannelMsgLock); WaitEventClose(info-WaitEvent); - MemFree(info); + kfree(info); DPRINT_EXIT(VMBUS); @@ -720,7 +720,7 @@ VmbusChannelClose( PageFree(Channel-RingBufferPages, Channel-RingBufferPageCount); - MemFree(info); + kfree(info); // If we are closing the channel during an error path in opening the channel, don't free the channel // since the caller will free the channel --- a/drivers/staging/hv/ChannelMgmt.c +++ b/drivers/staging/hv/ChannelMgmt.c @@ -152,7 +152,7 @@ VMBUS_CHANNEL* AllocVmbusChannel(void) channel-InboundLock = SpinlockCreate(); if (!channel-InboundLock) { - MemFree(channel); + kfree(channel); return NULL; } @@ -160,7 +160,7 @@ VMBUS_CHANNEL* AllocVmbusChannel(void) if (!channel-PollTimer) { SpinlockClose(channel-InboundLock); - MemFree(channel); + kfree(channel); return NULL; } @@ -170,7 +170,7 @@ VMBUS_CHANNEL* AllocVmbusChannel(void) { TimerClose(channel-PollTimer); SpinlockClose(channel-InboundLock); - MemFree(channel); + kfree(channel); return NULL; } @@ -196,7 +196,7 @@ static inline void ReleaseVmbusChannel(v WorkQueueClose(channel-ControlWQ); DPRINT_DBG(VMBUS, channel released (%p), channel); - MemFree(channel); + kfree(channel); DPRINT_EXIT(VMBUS); } @@ -691,7 +691,7 @@ VmbusOnChannelMessage( { DPRINT_ERR(VMBUS, Received invalid channel message type %d size %d, hdr-MessageType, size); PrintBytes((unsigned char *)msg-u.Payload, size); - MemFree(msg); + kfree(msg); return; } @@ -705,7 +705,7 @@ VmbusOnChannelMessage( } // Free the msg that was allocated in VmbusOnMsgDPC() - MemFree(msg); + kfree(msg); DPRINT_EXIT(VMBUS); } @@ -764,7 +764,7 @@ Cleanup: if (msgInfo) { WaitEventClose(msgInfo-WaitEvent); - MemFree(msgInfo); + kfree(msgInfo); } DPRINT_EXIT(VMBUS); --- a/drivers/staging/hv/Connection.c +++ b/drivers/staging/hv/Connection.c @@ -145,7 +145,7 @@ VmbusConnect( WaitEventClose(msgInfo-WaitEvent); - MemFree(msgInfo); + kfree(msgInfo); DPRINT_EXIT(VMBUS); return 0; @@ -175,7 +175,7 @@ Cleanup: if (msgInfo-WaitEvent) WaitEventClose(msgInfo-WaitEvent); - MemFree(msgInfo); + kfree(msgInfo); } DPRINT_EXIT(VMBUS); @@ -233,7 +233,7 @@ VmbusDisconnect( Cleanup: if (msg) { - MemFree(msg); + kfree(msg); } DPRINT_EXIT(VMBUS); --- a/drivers/staging/hv/Hv.c +++ b/drivers/staging/hv/Hv.c @@ -361,7 +361,7 @@ HvCleanup ( if (gHvContext.SignalEventBuffer) { - MemFree(gHvContext.SignalEventBuffer); + kfree(gHvContext.SignalEventBuffer); gHvContext.SignalEventBuffer = NULL; gHvContext.SignalEventParam = NULL; } @@ -430,7 +430,7 @@ HvPostMessage( status = HvDoHypercall(HvCallPostMessage, alignedMsg, 0) 0x; - MemFree((void*)addr); + kfree((void*)addr); return status; } --- a/drivers/staging/hv/include/osd.h +++ b/drivers/staging/hv/include/osd.h @@ -121,7 +121,6 @@ extern void PageFree(void* page, unsigne extern void
[patch 43/54] Staging: hv: make RingInfo-RingLock a real spinlock
From: Greg Kroah-Hartman gre...@suse.de Don't use the wrapper functions for this lock, make it a real lock so that we know what is going on. I don't think we really want to be doing a irqsave for this code, but I left it alone to preserve the original codepath. It should be reviewed later. Cc: Hank Janssen hjans...@microsoft.com Cc: Haiyang Zhang haiya...@microsoft.com Signed-off-by: Greg Kroah-Hartman gre...@suse.de --- drivers/staging/hv/RingBuffer.c | 24 +--- drivers/staging/hv/RingBuffer.h |2 +- 2 files changed, 14 insertions(+), 12 deletions(-) --- a/drivers/staging/hv/RingBuffer.c +++ b/drivers/staging/hv/RingBuffer.c @@ -315,7 +315,7 @@ RingBufferInit( RingInfo-RingSize = BufferLen; RingInfo-RingDataSize = BufferLen - sizeof(RING_BUFFER); - RingInfo-RingLock = SpinlockCreate(); + spin_lock_init(RingInfo-ring_lock); return 0; } @@ -334,7 +334,6 @@ RingBufferCleanup( RING_BUFFER_INFO* RingInfo ) { - SpinlockClose(RingInfo-RingLock); } /*++ @@ -360,6 +359,7 @@ RingBufferWrite( volatile u32 nextWriteLocation; u64 prevIndices=0; + unsigned long flags; DPRINT_ENTER(VMBUS); @@ -370,7 +370,7 @@ RingBufferWrite( totalBytesToWrite += sizeof(u64); - SpinlockAcquire(OutRingInfo-RingLock); + spin_lock_irqsave(OutRingInfo-ring_lock, flags); GetRingBufferAvailBytes(OutRingInfo, byteAvailToRead, byteAvailToWrite); @@ -384,7 +384,7 @@ RingBufferWrite( { DPRINT_DBG(VMBUS, No more space left on outbound ring buffer (needed %u, avail %u), totalBytesToWrite, byteAvailToWrite); - SpinlockRelease(OutRingInfo-RingLock); + spin_unlock_irqrestore(OutRingInfo-ring_lock, flags); DPRINT_EXIT(VMBUS); @@ -418,7 +418,7 @@ RingBufferWrite( //DumpRingInfo(OutRingInfo, AFTER ); - SpinlockRelease(OutRingInfo-RingLock); + spin_unlock_irqrestore(OutRingInfo-ring_lock, flags); DPRINT_EXIT(VMBUS); @@ -445,8 +445,9 @@ RingBufferPeek( u32 bytesAvailToWrite; u32 bytesAvailToRead; u32 nextReadLocation=0; + unsigned long flags; - SpinlockAcquire(InRingInfo-RingLock); + spin_lock_irqsave(InRingInfo-ring_lock, flags); GetRingBufferAvailBytes(InRingInfo, bytesAvailToRead, bytesAvailToWrite); @@ -455,7 +456,7 @@ RingBufferPeek( { //DPRINT_DBG(VMBUS, got callback but not enough to read avail to read %d read size %d!!, bytesAvailToRead, BufferLen); - SpinlockRelease(InRingInfo-RingLock); + spin_unlock_irqrestore(InRingInfo-ring_lock, flags); return -1; } @@ -468,7 +469,7 @@ RingBufferPeek( BufferLen, nextReadLocation); - SpinlockRelease(InRingInfo-RingLock); + spin_unlock_irqrestore(InRingInfo-ring_lock, flags); return 0; } @@ -495,10 +496,11 @@ RingBufferRead( u32 bytesAvailToRead; u32 nextReadLocation=0; u64 prevIndices=0; + unsigned long flags; ASSERT(BufferLen 0); - SpinlockAcquire(InRingInfo-RingLock); + spin_lock_irqsave(InRingInfo-ring_lock, flags); GetRingBufferAvailBytes(InRingInfo, bytesAvailToRead, bytesAvailToWrite); @@ -511,7 +513,7 @@ RingBufferRead( { DPRINT_DBG(VMBUS, got callback but not enough to read avail to read %d read size %d!!, bytesAvailToRead, BufferLen); - SpinlockRelease(InRingInfo-RingLock); + spin_unlock_irqrestore(InRingInfo-ring_lock, flags); return -1; } @@ -537,7 +539,7 @@ RingBufferRead( //DumpRingInfo(InRingInfo, AFTER ); - SpinlockRelease(InRingInfo-RingLock); + spin_unlock_irqrestore(InRingInfo-ring_lock, flags); return 0; } --- a/drivers/staging/hv/RingBuffer.h +++ b/drivers/staging/hv/RingBuffer.h @@ -48,7 +48,7 @@ typedef struct _RING_BUFFER { typedef struct _RING_BUFFER_INFO { RING_BUFFER* RingBuffer; u32RingSize; // Include the shared header - HANDLE RingLock; + spinlock_t ring_lock; u32RingDataSize; // ringSize u32 RingDataStartOffset; ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/virtualization
[PATCH 10/36] VIDEO: xen-fb, switch to for_each_console
From: Jiri Slaby jsl...@suse.cz Use newly added for_each_console for iterating consoles. Signed-off-by: Jiri Slaby jsl...@suse.cz Cc: Jeremy Fitzhardinge jer...@xensource.com Cc: Chris Wright chr...@sous-sol.org Cc: virtualizat...@lists.osdl.org Cc: xen-de...@lists.xensource.com Cc: linux-fb...@vger.kernel.org Signed-off-by: Greg Kroah-Hartman gre...@suse.de --- drivers/video/xen-fbfront.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/video/xen-fbfront.c b/drivers/video/xen-fbfront.c index 428d273..4abb0b9 100644 --- a/drivers/video/xen-fbfront.c +++ b/drivers/video/xen-fbfront.c @@ -492,7 +492,7 @@ xenfb_make_preferred_console(void) return; acquire_console_sem(); - for (c = console_drivers; c; c = c-next) { + for_each_console(c) { if (!strcmp(c-name, tty) c-index == 0) break; } -- 1.7.3.2 ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/virtualization
Re: [PATCH] tcm_vhost: Expose ABI version via VHOST_SCSI_GET_ABI_VERSION
On Tue, Jul 24, 2012 at 01:26:20AM +, Nicholas A. Bellinger wrote: From: Nicholas Bellinger n...@linux-iscsi.org As requested by Anthony, here is a patch against target-pending/for-next-merge to expose an ABI version to userspace via a new VHOST_SCSI_GET_ABI_VERSION ioctl operation. As mentioned in the comment, ABI Rev 0 is for pre 2012 out-of-tree code, and ABI Rev 1 (the current rev) is for current WIP v3.6 kernel merge candiate code. I think this is what you had in mind, and hopefully it will make MST happy too. The incremental vhost-scsi patches against Zhi's QEMU are going out shortly ahead of cutting a new vhost-scsi RFC over the next days. Please have a look and let me know if you have any concerns here. Thanks! Reported-by: Anthony Liguori aligu...@us.ibm.com Cc: Stefan Hajnoczi stefa...@linux.vnet.ibm.com Cc: Michael S. Tsirkin m...@redhat.com Cc: Paolo Bonzini pbonz...@redhat.com Cc: Zhi Yong Wu wu...@linux.vnet.ibm.com Signed-off-by: Nicholas Bellinger n...@linux-iscsi.org --- drivers/vhost/tcm_vhost.c |9 + drivers/vhost/tcm_vhost.h | 11 +++ 2 files changed, 20 insertions(+), 0 deletions(-) diff --git a/drivers/vhost/tcm_vhost.c b/drivers/vhost/tcm_vhost.c index dc7e024..3f04169 100644 --- a/drivers/vhost/tcm_vhost.c +++ b/drivers/vhost/tcm_vhost.c @@ -977,6 +977,15 @@ static long vhost_scsi_ioctl(struct file *f, unsigned int ioctl, return -EFAULT; return vhost_scsi_clear_endpoint(vs, backend); + case VHOST_SCSI_GET_ABI_VERSION: + if (copy_from_user(backend, argp, sizeof backend)) + return -EFAULT; + + backend.abi_version = VHOST_SCSI_ABI_VERSION; + + if (copy_to_user(argp, backend, sizeof backend)) + return -EFAULT; + return 0; case VHOST_GET_FEATURES: features = VHOST_FEATURES; if (copy_to_user(featurep, features, sizeof features)) diff --git a/drivers/vhost/tcm_vhost.h b/drivers/vhost/tcm_vhost.h index e942df9..3d5378f 100644 --- a/drivers/vhost/tcm_vhost.h +++ b/drivers/vhost/tcm_vhost.h @@ -80,7 +80,17 @@ struct tcm_vhost_tport { #include linux/vhost.h +/* + * Used by QEMU userspace to ensure a consistent vhost-scsi ABI. + * + * ABI Rev 0: All pre 2012 revisions used by prototype out-of-tree code + * ABI Rev 1: 2012 version for v3.6 kernel merge candiate + */ + +#define VHOST_SCSI_ABI_VERSION 1 + struct vhost_scsi_target { + int abi_version; unsigned char vhost_wwpn[TRANSPORT_IQN_LEN]; unsigned short vhost_tpgt; }; @@ -88,3 +98,4 @@ struct vhost_scsi_target { /* VHOST_SCSI specific defines */ #define VHOST_SCSI_SET_ENDPOINT _IOW(VHOST_VIRTIO, 0x40, struct vhost_scsi_target) #define VHOST_SCSI_CLEAR_ENDPOINT _IOW(VHOST_VIRTIO, 0x41, struct vhost_scsi_target) +#define VHOST_SCSI_GET_ABI_VERSION _IOW(VHOST_VIRTIO, 0x42, struct vhost_scsi_target) No, you just broke the ABI for version 0 here, that's not how you do this at all. greg k-h ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization
[ 01/82] virtio-blk: Call del_gendisk() before disable guest kick
From: Greg KH gre...@linuxfoundation.org 3.5-stable review patch. If anyone has any objections, please let me know. -- From: Asias He as...@redhat.com commit 02e2b124943648fba0a2ccee5c3656a5653e0151 upstream. del_gendisk() might not return due to failing to remove the /sys/block/vda/serial sysfs entry when another thread (udev) is trying to read it. virtblk_remove() vdev-config-reset() : guest will not kick us through interrupt del_gendisk() device_del() kobject_del(): got stuck, sysfs entry ref count non zero sysfs_open_file(): user space process read /sys/block/vda/serial sysfs_get_active() : got sysfs entry ref count dev_attr_show() virtblk_serial_show() blk_execute_rq() : got stuck, interrupt is disabled request cannot be finished This patch fixes it by calling del_gendisk() before we disable guest's interrupt so that the request sent in virtblk_serial_show() will be finished and del_gendisk() will success. This fixes another race in hot-unplug process. It is save to call del_gendisk(vblk-disk) before flush_work(vblk-config_work) which might access vblk-disk, because vblk-disk is not freed until put_disk(vblk-disk). Signed-off-by: Asias He as...@redhat.com Cc: virtualization@lists.linux-foundation.org Cc: k...@vger.kernel.org Acked-by: Michael S. Tsirkin m...@redhat.com Signed-off-by: Rusty Russell ru...@rustcorp.com.au Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org --- drivers/block/virtio_blk.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/block/virtio_blk.c +++ b/drivers/block/virtio_blk.c @@ -584,13 +584,13 @@ static void __devexit virtblk_remove(str vblk-config_enable = false; mutex_unlock(vblk-config_lock); + del_gendisk(vblk-disk); + /* Stop all the virtqueues. */ vdev-config-reset(vdev); flush_work(vblk-config_work); - del_gendisk(vblk-disk); - /* Abort requests dispatched to driver. */ spin_lock_irqsave(vblk-lock, flags); while ((vbr = virtqueue_detach_unused_buf(vblk-vq))) { ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization
[ 02/82] virtio-blk: Reset device after blk_cleanup_queue()
From: Greg KH gre...@linuxfoundation.org 3.5-stable review patch. If anyone has any objections, please let me know. -- From: Asias He as...@redhat.com commit 483001c765af6892b3fc3726576cb42f17d1d6b5 upstream. blk_cleanup_queue() will call blk_drian_queue() to drain all the requests before queue DEAD marking. If we reset the device before blk_cleanup_queue() the drain would fail. 1) if the queue is stopped in do_virtblk_request() because device is full, the q-request_fn() will not be called. blk_drain_queue() { while(true) { ... if (!list_empty(q-queue_head)) __blk_run_queue(q) { if (queue is not stoped) q-request_fn() } ... } } Do no reset the device before blk_cleanup_queue() gives the chance to start the queue in interrupt handler blk_done(). 2) In commit b79d866c8b7014a51f611a64c40546109beaf24a, We abort requests dispatched to driver before blk_cleanup_queue(). There is a race if requests are dispatched to driver after the abort and before the queue DEAD mark. To fix this, instead of aborting the requests explicitly, we can just reset the device after after blk_cleanup_queue so that the device can complete all the requests before queue DEAD marking in the drain process. Signed-off-by: Asias He as...@redhat.com Cc: Rusty Russell ru...@rustcorp.com.au Cc: virtualization@lists.linux-foundation.org Cc: k...@vger.kernel.org Acked-by: Michael S. Tsirkin m...@redhat.com Signed-off-by: Rusty Russell ru...@rustcorp.com.au Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org --- drivers/block/virtio_blk.c | 12 +--- 1 file changed, 1 insertion(+), 11 deletions(-) --- a/drivers/block/virtio_blk.c +++ b/drivers/block/virtio_blk.c @@ -576,8 +576,6 @@ static void __devexit virtblk_remove(str { struct virtio_blk *vblk = vdev-priv; int index = vblk-index; - struct virtblk_req *vbr; - unsigned long flags; /* Prevent config work handler from accessing the device. */ mutex_lock(vblk-config_lock); @@ -585,21 +583,13 @@ static void __devexit virtblk_remove(str mutex_unlock(vblk-config_lock); del_gendisk(vblk-disk); + blk_cleanup_queue(vblk-disk-queue); /* Stop all the virtqueues. */ vdev-config-reset(vdev); flush_work(vblk-config_work); - /* Abort requests dispatched to driver. */ - spin_lock_irqsave(vblk-lock, flags); - while ((vbr = virtqueue_detach_unused_buf(vblk-vq))) { - __blk_end_request_all(vbr-req, -EIO); - mempool_free(vbr, vblk-pool); - } - spin_unlock_irqrestore(vblk-lock, flags); - - blk_cleanup_queue(vblk-disk-queue); put_disk(vblk-disk); mempool_destroy(vblk-pool); vdev-config-del_vqs(vdev); ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization
[ 03/82] virtio-blk: Use block layer provided spinlock
From: Greg KH gre...@linuxfoundation.org 3.5-stable review patch. If anyone has any objections, please let me know. -- From: Asias He as...@redhat.com commit 2c95a3290919541b846bee3e0fbaa75860929f53 upstream. Block layer will allocate a spinlock for the queue if the driver does not provide one in blk_init_queue(). The reason to use the internal spinlock is that blk_cleanup_queue() will switch to use the internal spinlock in the cleanup code path. if (q-queue_lock != q-__queue_lock) q-queue_lock = q-__queue_lock; However, processes which are in D state might have taken the driver provided spinlock, when the processes wake up, they would release the block provided spinlock. = [ BUG: bad unlock balance detected! ] 3.4.0-rc7+ #238 Not tainted - fio/3587 is trying to release lock ((q-__queue_lock)-rlock) at: [813274d2] blk_queue_bio+0x2a2/0x380 but there are no more locks to release! other info that might help us debug this: 1 lock held by fio/3587: #0: ((vblk-lock)-rlock){..}, at: [8132661a] get_request_wait+0x19a/0x250 Other drivers use block layer provided spinlock as well, e.g. SCSI. Switching to the block layer provided spinlock saves a bit of memory and does not increase lock contention. Performance test shows no real difference is observed before and after this patch. Changes in v2: Improve commit log as Michael suggested. Signed-off-by: Asias He as...@redhat.com Cc: virtualization@lists.linux-foundation.org Cc: k...@vger.kernel.org Acked-by: Michael S. Tsirkin m...@redhat.com Signed-off-by: Rusty Russell ru...@rustcorp.com.au Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org --- drivers/block/virtio_blk.c |9 +++-- 1 file changed, 3 insertions(+), 6 deletions(-) --- a/drivers/block/virtio_blk.c +++ b/drivers/block/virtio_blk.c @@ -21,8 +21,6 @@ struct workqueue_struct *virtblk_wq; struct virtio_blk { - spinlock_t lock; - struct virtio_device *vdev; struct virtqueue *vq; @@ -65,7 +63,7 @@ static void blk_done(struct virtqueue *v unsigned int len; unsigned long flags; - spin_lock_irqsave(vblk-lock, flags); + spin_lock_irqsave(vblk-disk-queue-queue_lock, flags); while ((vbr = virtqueue_get_buf(vblk-vq, len)) != NULL) { int error; @@ -99,7 +97,7 @@ static void blk_done(struct virtqueue *v } /* In case queue is stopped waiting for more buffers. */ blk_start_queue(vblk-disk-queue); - spin_unlock_irqrestore(vblk-lock, flags); + spin_unlock_irqrestore(vblk-disk-queue-queue_lock, flags); } static bool do_req(struct request_queue *q, struct virtio_blk *vblk, @@ -431,7 +429,6 @@ static int __devinit virtblk_probe(struc goto out_free_index; } - spin_lock_init(vblk-lock); vblk-vdev = vdev; vblk-sg_elems = sg_elems; sg_init_table(vblk-sg, vblk-sg_elems); @@ -456,7 +453,7 @@ static int __devinit virtblk_probe(struc goto out_mempool; } - q = vblk-disk-queue = blk_init_queue(do_virtblk_request, vblk-lock); + q = vblk-disk-queue = blk_init_queue(do_virtblk_request, NULL); if (!q) { err = -ENOMEM; goto out_put_disk; ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Re: [PATCH] virtio_console: correct error message on failure of debugfs_create_dir
On Mon, Dec 24, 2012 at 11:55:46AM +, Arnd Bergmann wrote: On Friday 21 December 2012, Amit Shah wrote: On (Thu) 20 Dec 2012 [14:11:21], Sasha Levin wrote: debugfs_create_dir() returns NULL if it fails, there's little point in calling PTR_ERR on it. debugfs_create_dir() does return an error value if debugfs is not enabled. This check for !pdrvdata.debugfs_dir should infact use IS_ERR_OR_NULL(). Care to submit a patch for that? How about we fix the stub instead to return NULL when debugfs is disabled? No, please read debugfs.h for why I decided to not do this (i.e. we try to learn from our mistakes...) thanks, greg k-h ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Re: [PATCH] virtio_console: correct error message on failure of debugfs_create_dir
On Mon, Dec 24, 2012 at 01:24:52PM -0500, Sasha Levin wrote: On Mon, Dec 24, 2012 at 12:39 PM, Greg Kroah-Hartman gre...@linuxfoundation.org wrote: On Mon, Dec 24, 2012 at 11:55:46AM +, Arnd Bergmann wrote: On Friday 21 December 2012, Amit Shah wrote: On (Thu) 20 Dec 2012 [14:11:21], Sasha Levin wrote: debugfs_create_dir() returns NULL if it fails, there's little point in calling PTR_ERR on it. debugfs_create_dir() does return an error value if debugfs is not enabled. This check for !pdrvdata.debugfs_dir should infact use IS_ERR_OR_NULL(). Care to submit a patch for that? How about we fix the stub instead to return NULL when debugfs is disabled? No, please read debugfs.h for why I decided to not do this (i.e. we try to learn from our mistakes...) Why won't we fix it the other way around and return an actual error code instead of a NULL on failure? Again, no, that doesn't make your code simpler/faster. You really don't need to check the return value of debugfs, just handle it as if it always works, and look, the code handles it all properly, no matter if debugfs is enabled or not. It's only debugging code, you shouldn't really care if it is present or not, right? If you do, perhaps you shouldn't be using debugfs? greg k-h ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Re: [PATCH] arch/x86/xen: remove depends on CONFIG_EXPERIMENTAL
On Sun, Feb 24, 2013 at 05:51:44PM +0800, Dongsheng Song wrote: On Sun, Feb 24, 2013 at 1:03 AM, Kees Cook keesc...@chromium.org wrote: On Sat, Feb 23, 2013 at 3:59 AM, Dongsheng Song dongsheng.s...@gmail.com wrote: On Sat, Feb 23, 2013 at 3:29 PM, Kees Cook keesc...@chromium.org wrote: The CONFIG_EXPERIMENTAL config item has not carried much meaning for a while now and is almost always enabled by default. As agreed during the Linux kernel summit, remove it from any depends on lines in Kconfigs. Signed-off-by: Kees Cook keesc...@chromium.org Cc: Stefano Stabellini stefano.stabell...@eu.citrix.com Cc: Mukesh Rathor mukesh.rat...@oracle.com Cc: Konrad Rzeszutek Wilk konrad.w...@oracle.com --- arch/x86/xen/Kconfig |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/xen/Kconfig b/arch/x86/xen/Kconfig index 93ff4e1..8cada4c 100644 --- a/arch/x86/xen/Kconfig +++ b/arch/x86/xen/Kconfig @@ -53,7 +53,7 @@ config XEN_DEBUG_FS config XEN_X86_PVH bool Support for running as a PVH guest (EXPERIMENTAL) Why not remove this 'EXPERIMENTAL' too ? It was unclear to me if the feature was actually considered unstable. I can resend with the text removed from the title too, if that's the correct action here? -Kees If such a feature was considered unstable, it should depends on EXPERIMENTAL. CONFIG_EXPERIMENTAL is going away. We should not surprised users. You should not have unstable options in the kernel in the first place, sorry. greg k-h ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Re: [PATCH] arch/x86/xen: remove depends on CONFIG_EXPERIMENTAL
On Mon, Feb 25, 2013 at 12:39:27PM +, Stefano Stabellini wrote: On Sun, 24 Feb 2013, Greg Kroah-Hartman wrote: You should not have unstable options in the kernel in the first place, sorry. With the premise that the removal of CONFIG_EXPERIMENTAL is not an issue for me personally or my work, I am going to give you my 2 cents on the matter, but feel free to ignore them :) While I understand that CONFIG_EXPERIMENTAL has been abused, I feel that rejecting everything that is not fully stable and with external interfaces set in stones, might hinder the development of new features. It's been this way for _years_ this isn't something new (the you have to get it right really quickly problem). See Documentation/ABI/ for some words about how you can try to do this. After all, given how fast the kernel is moving nowadays, No faster than it has in the past. maintaining a project out-of-tree until is completely ready for production can be very expensive. Merging the project earlier and completing the development upstream can bring better results. Yes, but don't go changing user-visable apis when you do so. That's been a hard rule for a LONG time. But in these cases one wouldn't want to market the feature as stable yet, because it just isn't. If CONFIG_EXPERIMENTAL is going away, is there anything in the kernel that can be used to tag a feature as I wouldn't use it in production if I were you? Maybe just a comment in the kconfig description? I know this is hard, I've had my own problems with it in the past. You don't know if you get an api right until you have a lot of users. See our previous discussions about this topic on lkml if you are curious as to the eventual outcome of threads like this: Yes, it's hard, but that's kernel programming. Sorry, greg k-h ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Re: [PATCH] vhost-scsi: return -ENOENT when no matching tcm_vhost_tpg found
On Wed, Jun 12, 2013 at 09:39:50AM +0800, wenchao wrote: cc to Greg for 3.9. formletter This is not the correct way to submit patches for inclusion in the stable kernel tree. Please read Documentation/stable_kernel_rules.txt for how to do this properly. /formletter ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Re: [PATCH 3/3] PCI: mark pci_scan_bus_parented() as __deprecated
On Fri, Jun 21, 2013 at 01:01:05AM +0800, Jiang Liu wrote: From: Jiang Liu jiang@huawei.com Mark pci_scan_bus_parented() as __deprecated and clean up outdated comments. Why not just delete the function, if no in-kernel users are calling it, it's no longer needed at all. thanks, greg k-h ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Re: [patch] virtio: console: fix error handling for debugfs_create_dir()
On Sun, Jul 21, 2013 at 11:36:25AM +0200, Arnd Bergmann wrote: On Saturday 20 July 2013, Dan Carpenter wrote: On Fri, Jul 19, 2013 at 12:28:41PM +0200, Arnd Bergmann wrote: On Friday 19 July 2013, Dan Carpenter wrote: debugfs_create_dir() returns ERR_PTR(-ENODEV) if debugfs is disabled. Also my static checker doesn't like it when we print the error code, but it's always just NULL. Signed-off-by: Dan Carpenter dan.carpen...@oracle.com This looks wrong. debugfs_create_dir intentionally returns non-NULL so failing to create the directory does not trigger an error condition if debugfs is disabled. Yeah. You're right. But the original code is still wrong and will oops if debugfs is disabled. We should set the pointer to NULL if we get a ERR_PTR(). I will send a v2 patch. I don't see where that oops would happen. In the code I'm looking at, all uses of -debugfs_dir only ever get passed into other debugfs functions that are stubbed out to empty inline functions. It's not the most obvious interface design, but this all seems intentional and correct to me. It was the best interface design I could create, making it very easy for drivers to use and not really worry at all if debugfs was failing or not, or if it was even present in the system or not. That was the design goal I had for it when I wrote it. thanks, greg k-h ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Re: [patch v2] virtio: console: cleanup an error message
On Mon, Jul 22, 2013 at 11:41:00PM +0300, Dan Carpenter wrote: The PTR_ERR(NULL) here is not useful. Signed-off-by: Dan Carpenter dan.carpen...@oracle.com --- v2: completely different diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c index 1b456fe..4cf46d8 100644 --- a/drivers/char/virtio_console.c +++ b/drivers/char/virtio_console.c Rusty handles virtio stuff, please cc: him on these. thanks, greg k-h ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Re: [PATCH 4/5] Intel MIC Card Driver Changes for Virtio Devices.
On Wed, Jul 24, 2013 at 08:31:35PM -0700, Sudeep Dutt wrote: +/* + * Intel MIC Platform Software Stack (MPSS) + * + * Copyright(c) 2013 Intel Corporation. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License, version 2, as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 + * USA. + * + * The full GNU General Public License is included in this distribution in + * the file called COPYING. Someone needs to tell Intel to take out the address paragraph of thier standard template as it's annoying. Please remove it, unless you personally want to keep the file up to date with the address movements of the FSF for the next 40+ years. + * Disclaimer: The codes contained in these modules may be specific to + * the Intel Software Development Platform codenamed: Knights Ferry, and + * the Intel product codenamed: Knights Corner, and are not backward + * compatible with other Intel products. Additionally, Intel will NOT + * support the codes or instruction set in future products. What does this mean? That's a new one to me... +static inline struct device *dev(struct mic_vdev *mvdev) +{ + return mvdev-vdev.dev.parent; +} Can you pick a worse name? And you aren't returning the device, you are returning the parent, so the name (as short as it is), is wrong. ick. greg k-h ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Re: [patch v2] virtio: console: cleanup an error message
On Mon, Jul 29, 2013 at 12:41:31PM +0530, Amit Shah wrote: On (Mon) 22 Jul 2013 [23:41:00], Dan Carpenter wrote: The PTR_ERR(NULL) here is not useful. Signed-off-by: Dan Carpenter dan.carpen...@oracle.com --- v2: completely different diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c index 1b456fe..4cf46d8 100644 --- a/drivers/char/virtio_console.c +++ b/drivers/char/virtio_console.c @@ -2215,10 +2215,8 @@ static int __init init(void) } pdrvdata.debugfs_dir = debugfs_create_dir(virtio-ports, NULL); - if (!pdrvdata.debugfs_dir) { - pr_warning(Error %ld creating debugfs dir for virtio-ports\n, - PTR_ERR(pdrvdata.debugfs_dir)); - } + if (!pdrvdata.debugfs_dir) + pr_warning(Error creating debugfs dir for virtio-ports\n); When debugfs is enabled and creating the dir fails, we'll print this warning message. When debugfs is disabled, we'll get an error return, and not print any message. Not true, you will still print the message if debugfs is disabled, as .debugfs_dir will not be NULL. Why even print anything at all? It's debugfs, you shouldn't really care that much about it :) thanks, greg k-h ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Re: [patch v2] virtio: console: cleanup an error message
On Mon, Jul 29, 2013 at 04:35:38PM +0300, Dan Carpenter wrote: On Mon, Jul 29, 2013 at 06:12:31AM -0700, Greg Kroah-Hartman wrote: On Mon, Jul 29, 2013 at 12:41:31PM +0530, Amit Shah wrote: On (Mon) 22 Jul 2013 [23:41:00], Dan Carpenter wrote: The PTR_ERR(NULL) here is not useful. Signed-off-by: Dan Carpenter dan.carpen...@oracle.com --- v2: completely different diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c index 1b456fe..4cf46d8 100644 --- a/drivers/char/virtio_console.c +++ b/drivers/char/virtio_console.c @@ -2215,10 +2215,8 @@ static int __init init(void) } pdrvdata.debugfs_dir = debugfs_create_dir(virtio-ports, NULL); - if (!pdrvdata.debugfs_dir) { - pr_warning(Error %ld creating debugfs dir for virtio-ports\n, - PTR_ERR(pdrvdata.debugfs_dir)); - } + if (!pdrvdata.debugfs_dir) + pr_warning(Error creating debugfs dir for virtio-ports\n); When debugfs is enabled and creating the dir fails, we'll print this warning message. When debugfs is disabled, we'll get an error return, and not print any message. Not true, you will still print the message if debugfs is disabled, as .debugfs_dir will not be NULL. Why even print anything at all? It's debugfs, you shouldn't really care that much about it :) Yes yes. That's what this code does. It only checks for NULL. The debugfs was a little confusing at first but I get it now. Ugh, you are right, that's what I get for writing email before my morning coffee... ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Re: [PATCH 1/5] Intel MIC Host Driver for X100 family.
On Wed, Jul 24, 2013 at 08:31:32PM -0700, Sudeep Dutt wrote: This patch enables the following: a) Initializes the Intel MIC X100 PCIe devices. b) Boots and shuts down the card via sysfs entries. c) Allocates and maps a device page for communication with the card driver and updates the device page address via scratchpad registers. d) Provides sysfs entries for family, stepping, state, shutdown status, kernel command line, IP address, ramdisk and log buffer information. As you are creating sysfs entries, you also have to create Documentatin/ABI/ entries in the kernel source at the same time. Please do this in your next version of this patch. thanks, greg k-h ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Re: [PATCH 1/5] Intel MIC Host Driver for X100 family.
On Wed, Jul 24, 2013 at 08:31:32PM -0700, Sudeep Dutt wrote: This patch enables the following: a) Initializes the Intel MIC X100 PCIe devices. b) Boots and shuts down the card via sysfs entries. c) Allocates and maps a device page for communication with the card driver and updates the device page address via scratchpad registers. d) Provides sysfs entries for family, stepping, state, shutdown status, kernel command line, IP address, ramdisk and log buffer information. That's a lot to do in one patch, almost 4 thousand lines. Can't you break this up into some more smaller, logical, and reviewable, pieces? For example, I have no idea what b) is, and how to separate it from the things you do for a) and c). thanks, greg k-h ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Re: [PATCH 0/5] Enable Drivers for Intel MIC X100 Coprocessors.
On Wed, Jul 24, 2013 at 08:31:31PM -0700, Sudeep Dutt wrote: An Intel MIC X100 device is a PCIe form factor add-in coprocessor card based on the Intel Many Integrated Core (MIC) architecture that runs a Linux OS. It is a PCIe endpoint in a platform and therefore implements the three required standard address spaces i.e. configuration, memory and I/O. The host OS loads a device driver as is typical for PCIe devices. The card itself runs a bootstrap after reset that transfers control to the card OS downloaded from the host driver. The card OS as shipped by Intel is a Linux kernel with modifications for the X100 devices. Since it is a PCIe card, it does not have the ability to host hardware devices for networking, storage and console. We provide these devices on X100 coprocessors thus enabling a self-bootable equivalent environment for applications. A key benefit of our solution is that it leverages the standard virtio framework for network, disk and console devices, though in our case the virtio framework is used across a PCIe bus. Here is a block diagram of the various components described above. The virtio backends are situated on the host rather than the card given better single threaded performance for the host compared to MIC and the ability of the host to initiate DMA's to/from the card using the MIC DMA engine. | +--+ | +--+ | Card OS | | | Host OS | +--+ | +--+ | +---+ ++ +--+ | +-+ ++ ++ | Virtio| |Virtio | |Virtio| | |Virtio | |Virtio | |Virtio | | Net | |Console | |Block | | |Net | |Console | |Block | | Driver| |Driver | |Driver| | |backend | |backend | |backend | +---+ ++ +--+ | +-+ ++ ++ | | | | || | | | | |Ring 3|| | | | | |--||-|--- +---+ |Ring 0+--+ | | | Virtio over PCIe IOCTLs | | | +--+ +--+| | |Intel MIC ||+---+ |Card Driver |||Intel MIC | +--+||Host Driver| | |+---+ | | | +-+ | | |PCIe Bus | +-+ That's some nice information, why isn't it in one of the patches you sent, so that others can read it later on to try to figure out what is going on with this codebase? thanks, greg k-h ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Re: [PATCH 1/5] Intel MIC Host Driver for X100 family.
On Wed, Jul 24, 2013 at 08:31:32PM -0700, Sudeep Dutt wrote: --- /dev/null +++ b/drivers/misc/mic/common/mic_device.h @@ -0,0 +1,81 @@ +/* + * Intel MIC Platform Software Stack (MPSS) + * + * Copyright(c) 2013 Intel Corporation. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License, version 2, as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 + * USA. Ok, it's now your task as an Intel employee to get this paragraph stricken from the default template that GPL code in the kernel, written by Intel developers, has. It's pointless, and unless you want to be personally responsible for tracking the address changes of the FSF for the next 40+ years, not something I'm going to ever accept. I know you aren't responsible for this, but I'm getting really tired of pointing this out each-and-every-time I see a file from an Intel developer. So please work to fix this. thanks, greg k-h ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Re: [PATCH 1/5] Intel MIC Host Driver for X100 family.
On Thu, Aug 01, 2013 at 05:36:34PM -0700, Sudeep Dutt wrote: On Wed, 2013-07-31 at 18:51 -0700, Greg Kroah-Hartman wrote: On Wed, Jul 24, 2013 at 08:31:32PM -0700, Sudeep Dutt wrote: --- /dev/null +++ b/drivers/misc/mic/common/mic_device.h @@ -0,0 +1,81 @@ +/* + * Intel MIC Platform Software Stack (MPSS) + * + * Copyright(c) 2013 Intel Corporation. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License, version 2, as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 + * USA. Ok, it's now your task as an Intel employee to get this paragraph stricken from the default template that GPL code in the kernel, written by Intel developers, has. It's pointless, and unless you want to be personally responsible for tracking the address changes of the FSF for the next 40+ years, not something I'm going to ever accept. I know you aren't responsible for this, but I'm getting really tired of pointing this out each-and-every-time I see a file from an Intel developer. So please work to fix this. I brought up this issue today, with the team which reviews licenses for open source projects at Intel. The recommendation from them is to include the following wording instead of the FSF street address in the standard template. snip You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/. snip That's better, but, this is the kernel, and of course they got a copy of the license with it, it's part of the whole body of code. So that paragraph is not needed either. thanks, greg k-h ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Re: [PATCH v3 0/7] Enable Drivers for Intel MIC X100 Coprocessors.
On Wed, Sep 04, 2013 at 09:18:40AM -0700, Sudeep Dutt wrote: On Wed, 2013-08-21 at 10:51 -0700, Sudeep Dutt wrote: ChangeLog: = v2 = v3: a) Patch 1 data structure cleanups, header file include cleanups, IDA interface reuse and switching to device_create_with_groups(..) as per feedback from Greg Kroah-Hartman. b) Patch 7 signal documentation, sleep workaround removal and sysfs access API cleanups as per feedback from Michael S. Tsirkin. v1 = v2: @ http://lwn.net/Articles/563131/ a) License wording cleanup, sysfs ABI documentation, patch 1 refactoring into 3 smaller patches and function renames, as per feedback from Greg Kroah-Hartman. b) Use VRINGH infrastructure for accessing virtio rings from the host in patch 5, as per feedback from Michael S. Tsirkin. v1: Initial post @ https://lwn.net/Articles/561314/ Hi Greg, It has been a couple of weeks since we posted v3 @ https://lwn.net/Articles/564795 which addresses all feedback received so far. Have you had a chance to review this version? Please let us know your thoughts. I don't have this around anymore, I got 7 copies and thought your patch-send script went crazy so I deleted them :( Care to send them again? But note, this is the merge window, so I'll not be able to do anythign for at least 2 weeks with them. thanks, greg k-h ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Re: [PATCH RESEND v3 1/7] Intel MIC Host Driver for X100 family.
Very minor nits, you can change this in a future add-on patch: +static DEVICE_ATTR(family, S_IRUGO, mic_show_family, NULL); This should use DEVICE_ATTR_RO(), so that we don't have to audit the permissions of your DEVICE_ATTR() files. +static DEVICE_ATTR(stepping, S_IRUGO, mic_show_stepping, NULL); Same here. +static struct attribute *mic_default_attrs[] = { + dev_attr_family.attr, + dev_attr_stepping.attr, + + NULL +}; + +static struct attribute_group mic_attr_group = { + .attrs = mic_default_attrs, +}; + +static const struct attribute_group *__mic_attr_group[] = { + mic_attr_group, + NULL +}; These last two structures can be replaced with: ATTRIBUTE_GROUPS(mic_default); +void mic_sysfs_init(struct mic_device *mdev) +{ + mdev-attr_group = __mic_attr_group; +} This is odd, why not just export the data structure and reference it in the other code? The pci core does this, and so do other busses. Anyway, it's not a big deal, just a bit strange to me. thanks, greg k-h ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Re: [PATCH RESEND v3 1/7] Intel MIC Host Driver for X100 family.
On Thu, Sep 05, 2013 at 04:41:31PM -0700, Sudeep Dutt wrote: drivers/misc/mic/common/mic_device.h | 37 +++ drivers/misc/mic/host/mic_device.h| 109 + Two different files, with the same name? You are asking for trouble in the future, getting them confused :) Please try to pick a unique name, especially when you later do things like: +#include ../common/mic_device.h +#include mic_device.h Which just looks odd. Again, not a big deal, follow-on patch can fix this. thanks, greg k-h ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Re: [PATCH RESEND v3 3/7] Intel MIC Host Driver, card OS state management.
Again, very minor fixups for later (I can even do them...) +static DEVICE_ATTR(state, S_IRUGO|S_IWUSR, mic_show_state, mic_store_state); DEVICE_ATTR_RW() please. Same for the other attributes you create in this patch. thanks, greg k-h ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Re: [PATCH RESEND v3 3/7] Intel MIC Host Driver, card OS state management.
On Thu, Sep 05, 2013 at 04:41:55PM -0700, Sudeep Dutt wrote: +What:/sys/class/mic/mic(x)/cmdline +Date:August 2013 +KernelVersion: 3.11 +Contact: Sudeep Dutt sudeep.d...@intel.com +Description: + An Intel MIC device runs a Linux OS during its operation. Before + booting this card OS, it is possible to pass kernel command line + options to configure various features in it, similar to + self-bootable machines. When read, this entry provides + information about the current kernel command line options set to + boot the card OS. This entry can be written to change the + existing kernel command line options. Typically, the user would + want to read the current command line options, append new ones + or modify existing ones and then write the whole kernel command + line back to this entry. Is a PAGE_SIZE value going to be big enough for your command line? I know some embedded systems have horribly long command lines, hopefully this will be enough for you. thanks, greg k-h ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Re: [PATCH RESEND v3 3/7] Intel MIC Host Driver, card OS state management.
On Thu, Sep 05, 2013 at 04:41:55PM -0700, Sudeep Dutt wrote: +What:/sys/class/mic/mic(x)/firmware +Date:August 2013 +KernelVersion: 3.11 +Contact: Sudeep Dutt sudeep.d...@intel.com +Description: + When read, this sysfs entry provides the path name under + /lib/firmware/ where the firmware image to be booted on the + card can be found. The entry can be written to change the + firmware image location under /lib/firmware/. I don't understand, is the path under the HOST device, or the Client device's disk? Why do you need to change the path on the HOST? What's wrong with the existing firmware path selection we have in the kernel? thanks, greg k-h ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Re: [PATCH RESEND v3 3/7] Intel MIC Host Driver, card OS state management.
On Fri, Sep 06, 2013 at 11:41:03AM -0700, Sudeep Dutt wrote: On Thu, 2013-09-05 at 22:01 -0700, Greg Kroah-Hartman wrote: On Thu, Sep 05, 2013 at 04:41:55PM -0700, Sudeep Dutt wrote: +What:/sys/class/mic/mic(x)/firmware +Date:August 2013 +KernelVersion: 3.11 +Contact: Sudeep Dutt sudeep.d...@intel.com +Description: + When read, this sysfs entry provides the path name under + /lib/firmware/ where the firmware image to be booted on the + card can be found. The entry can be written to change the + firmware image location under /lib/firmware/. I don't understand, is the path under the HOST device, or the Client device's disk? Why do you need to change the path on the HOST? What's wrong with the existing firmware path selection we have in the kernel? The path is on the host. The card does not have a physical persistent disk device. Our customers like the flexibility of changing the card firmware/ramdisk contents and file names for individual MIC cards. This flexibility is not possible with a static set of firmware file names in the kernel for all cards. Once the firmware/ramdisk path under /lib/firmware/ is set up via sysfs, card boot is initiated via the state sysfs entry. The host driver then obtains the contents of the firmware and ramdisk via the standard request_firmware(..) interface, copies the contents to card memory and interrupts the card BIOS to initiate boot. So this is really a filename that might contain some directories as well, right? The fact you used path confused me, as that doesn't usually imply a filename. And is the firmware just the initramfs image for the kernel to boot? thanks, greg k-h ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Re: [PATCH RESEND v3 3/7] Intel MIC Host Driver, card OS state management.
On Fri, Sep 06, 2013 at 11:29:17AM -0700, Sudeep Dutt wrote: On Thu, 2013-09-05 at 21:58 -0700, Greg Kroah-Hartman wrote: Again, very minor fixups for later (I can even do them...) +static DEVICE_ATTR(state, S_IRUGO|S_IWUSR, mic_show_state, mic_store_state); DEVICE_ATTR_RW() please. Same for the other attributes you create in this patch. Sure, we will incorporate these changes along with your other feedback in patch 1 and post the next revision of this patch series. There's no need to repost just yet. I can take these as-is after the merge window closes, and you can send follow-on patches for these minor issues, keeping you from having to do a respin, and me trying to remember what parts I reviewed and didn't review. So give me some time (i.e. wait for after 3.12-rc1 is out) and if I have further problems with the patches, I'll let you know, otherwise you'll get an automated email from my patch collection system saying the patches are applied. thanks, greg k-h ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Re: [PATCH RESEND v3 0/7] Enable Drivers for Intel MIC X100 Coprocessors.
On Thu, Sep 05, 2013 at 04:41:20PM -0700, Sudeep Dutt wrote: ChangeLog: = v2 = v3: a) Patch 1 data structure cleanups, header file include cleanups, IDA interface reuse and switching to device_create_with_groups(..) as per feedback from Greg Kroah-Hartman. b) Patch 7 signal documentation, sleep workaround removal and sysfs access API cleanups as per feedback from Michael S. Tsirkin. Now applied, thanks. Note, I'm getting some odd warnings about the uapi .h files when doing a build, so a follow-on patch to fix those up would be appreciated, along with the other minor cleanups I discussed with you previously. thanks, greg k-h ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Re: [PATCH RESEND v3 0/7] Enable Drivers for Intel MIC X100 Coprocessors.
On Thu, Sep 05, 2013 at 06:36:08PM -0700, Joe Perches wrote: Whitespace neatening... Multiline statement argument alignment. Argument wrapping. Use kmalloc_array instead of kmalloc. --- -ENOSIGNEDOFFBY :( ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization
[PATCH 5/8] virtio: convert bus code to use dev_groups
The dev_attrs field of struct bus_type is going away soon, dev_groups should be used instead. This converts the virtio bus code to use the correct field. Cc: Rusty Russell ru...@rustcorp.com.au Cc: Michael S. Tsirkin m...@redhat.com Cc: virtualization@lists.linux-foundation.org Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org --- Rusty and Michael, I can take this through my driver-core tree if you don't want to take it through yours, just let me know what works best for you. drivers/virtio/virtio.c | 27 +++ 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c index ee59b74..fed0ce1 100644 --- a/drivers/virtio/virtio.c +++ b/drivers/virtio/virtio.c @@ -13,18 +13,24 @@ static ssize_t device_show(struct device *_d, struct virtio_device *dev = dev_to_virtio(_d); return sprintf(buf, 0x%04x\n, dev-id.device); } +static DEVICE_ATTR_RO(device); + static ssize_t vendor_show(struct device *_d, struct device_attribute *attr, char *buf) { struct virtio_device *dev = dev_to_virtio(_d); return sprintf(buf, 0x%04x\n, dev-id.vendor); } +static DEVICE_ATTR_RO(vendor); + static ssize_t status_show(struct device *_d, struct device_attribute *attr, char *buf) { struct virtio_device *dev = dev_to_virtio(_d); return sprintf(buf, 0x%08x\n, dev-config-get_status(dev)); } +static DEVICE_ATTR_RO(status); + static ssize_t modalias_show(struct device *_d, struct device_attribute *attr, char *buf) { @@ -32,6 +38,8 @@ static ssize_t modalias_show(struct device *_d, return sprintf(buf, virtio:d%08Xv%08X\n, dev-id.device, dev-id.vendor); } +static DEVICE_ATTR_RO(modalias); + static ssize_t features_show(struct device *_d, struct device_attribute *attr, char *buf) { @@ -47,14 +55,17 @@ static ssize_t features_show(struct device *_d, len += sprintf(buf+len, \n); return len; } -static struct device_attribute virtio_dev_attrs[] = { - __ATTR_RO(device), - __ATTR_RO(vendor), - __ATTR_RO(status), - __ATTR_RO(modalias), - __ATTR_RO(features), - __ATTR_NULL +static DEVICE_ATTR_RO(features); + +static struct attribute *virtio_dev_attrs[] = { + dev_attr_device.attr, + dev_attr_vendor.attr, + dev_attr_status.attr, + dev_attr_modalias.attr, + dev_attr_features.attr, + NULL, }; +ATTRIBUTE_GROUPS(virtio_dev); static inline int virtio_id_match(const struct virtio_device *dev, const struct virtio_device_id *id) @@ -165,7 +176,7 @@ static int virtio_dev_remove(struct device *_d) static struct bus_type virtio_bus = { .name = virtio, .match = virtio_dev_match, - .dev_attrs = virtio_dev_attrs, + .dev_groups = virtio_dev_groups, .uevent = virtio_uevent, .probe = virtio_dev_probe, .remove = virtio_dev_remove, -- 1.8.4.6.g82e253f.dirty ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Re: [PATCH char-misc-linus 4/5] misc: mic: Fix sparse warnings and other endianness issues.
On Tue, Nov 26, 2013 at 10:14:21AM -0800, Ashutosh Dixit wrote: Endianness issues are now consistent as per the documentation in host/mic_virtio.h. Note that the host can be both BE or LE whereas the card is always LE. Memory space sparse warnings are fixed for now by using __force. This is sufficient for now since the driver depends on x86 but will need to be revisited if we support other architectures which treat I/O memory differently from system memory. There's no need for this for 3.13-final, right? No bug fixes are here that I can tell. And don't use __force, really, can't you fix this some other way? diff --git a/drivers/misc/mic/card/mic_virtio.c b/drivers/misc/mic/card/mic_virtio.c index 4dce912..c975c36 100644 --- a/drivers/misc/mic/card/mic_virtio.c +++ b/drivers/misc/mic/card/mic_virtio.c @@ -248,17 +248,17 @@ static struct virtqueue *mic_find_vq(struct virtio_device *vdev, /* First assign the vring's allocated in host memory */ vqconfig = mic_vq_config(mvdev-desc) + index; memcpy_fromio(config, vqconfig, sizeof(config)); - _vr_size = vring_size(config.num, MIC_VIRTIO_RING_ALIGN); + _vr_size = vring_size(le16_to_cpu(config.num), MIC_VIRTIO_RING_ALIGN); vr_size = PAGE_ALIGN(_vr_size + sizeof(struct _mic_vring_info)); - va = mic_card_map(mvdev-mdev, config.address, vr_size); + va = mic_card_map(mvdev-mdev, le64_to_cpu(config.address), vr_size); if (!va) return ERR_PTR(-ENOMEM); mvdev-vr[index] = va; memset_io(va, 0x0, _vr_size); - vq = vring_new_virtqueue(index, - config.num, MIC_VIRTIO_RING_ALIGN, vdev, - false, - va, mic_notify, callback, name); + vq = vring_new_virtqueue(index, le16_to_cpu(config.num), + MIC_VIRTIO_RING_ALIGN, vdev, false, + (void __force *)va, mic_notify, callback, + name); Why __force a void * here? That feels wrong. Can you split the endian fixes up from the user pointer fixes to make it easier to review/apply? thanks, greg k-h ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Re: [PATCH char-misc-linus v3 0/6] misc: mic: Fixes for 3.13-final
On Wed, Nov 27, 2013 at 08:58:37AM -0800, Ashutosh Dixit wrote: These patches fix various issues which were reported or found with the MIC driver. All now applied, thanks. greg k-h ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Re: [PATCH net 1/3] kref: add kref_sub_return
On Wed, Feb 12, 2014 at 06:38:21PM +0200, Michael S. Tsirkin wrote: It is sometimes useful to get the value of the reference count after decrement. For example, vhost wants to execute some periodic cleanup operations once number of references drops below a specific value, before it reaches zero (for efficiency). You should never care about what the value of the kref is, if you are using it correctly :) So I really don't want to add this function, as I'm sure people will use it incorrectly. You should only care if the reference drops to 0, if not, then your usage doesn't really fit into the kref model, and so, just use an atomic variable. I really want to know why it matters for efficiency that you know this number. How does that help anything, as the number could then go up later on, and the work you did at a lower number is obsolete, right? thanks, greg k-h ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Re: [PATCH net 1/3] kref: add kref_sub_return
On Wed, Feb 12, 2014 at 07:35:24PM +0200, Michael S. Tsirkin wrote: On Wed, Feb 12, 2014 at 08:56:30AM -0800, Greg Kroah-Hartman wrote: On Wed, Feb 12, 2014 at 06:38:21PM +0200, Michael S. Tsirkin wrote: It is sometimes useful to get the value of the reference count after decrement. For example, vhost wants to execute some periodic cleanup operations once number of references drops below a specific value, before it reaches zero (for efficiency). You should never care about what the value of the kref is, if you are using it correctly :) So I really don't want to add this function, as I'm sure people will use it incorrectly. You should only care if the reference drops to 0, if not, then your usage doesn't really fit into the kref model, and so, just use an atomic variable. This happens when you have code that keeps reference itself implicitly or explicitly. foo(struct kref *k, int bar) { sub = kref_sub(k) if (sub == 1) FOO(k, bar) /* Here I am the only one with a reference */ Why do you care if you are the only one with a reference? If you do, then just don't grab that reference and do the work in the cleanup callback :) } kref_get(k) foo(k, bar); kref_put(k) Why not do FOO in destructor you ask? Absolutely but this will be called much later. Maybe you will reconsider if I document this as the only legal use? No one reads documentation :( I really want to know why it matters for efficiency that you know this number. How does that help anything, as the number could then go up later on, and the work you did at a lower number is obsolete, right? thanks, greg k-h The issue is that if number dropped to 1, this means we must do the cleanup work since there are no outstanding buffers, (last user is ourselves) if we do not cleanup, guest will hang waiting for us. This doesn't make sense, nor does it sound like a use for a kref (or you are using it wrong.) But it never drops to 0 since we have our own reference in the device. Then don't do that. If it goes up again this means we didn't have to do cleanup, but an alternative is doing it all the time and that is slow. Then just cleanup when it hits 0, like the rest of the world does. Yes I can rework vhost to open-code this kref use, it's no big deal. Alternatively since most of the use does match kref model, maybe __kref_sub_return with disclaimers that you must know what you are doing? No, no one reads documentation, sorry. Either fix your use of kref (i.e. don't care about the count), or do something else, as you don't want a kref, but rather, an atomic count of what is going on and 1 means something special to you. sorry, greg k-h ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization
[PATCH 3.4 22/24] virtio-blk: Use block layer provided spinlock
3.4-stable review patch. If anyone has any objections, please let me know. -- From: Asias He as...@redhat.com commit 2c95a3290919541b846bee3e0fbaa75860929f53 upstream. Block layer will allocate a spinlock for the queue if the driver does not provide one in blk_init_queue(). The reason to use the internal spinlock is that blk_cleanup_queue() will switch to use the internal spinlock in the cleanup code path. if (q-queue_lock != q-__queue_lock) q-queue_lock = q-__queue_lock; However, processes which are in D state might have taken the driver provided spinlock, when the processes wake up, they would release the block provided spinlock. = [ BUG: bad unlock balance detected! ] 3.4.0-rc7+ #238 Not tainted - fio/3587 is trying to release lock ((q-__queue_lock)-rlock) at: [813274d2] blk_queue_bio+0x2a2/0x380 but there are no more locks to release! other info that might help us debug this: 1 lock held by fio/3587: #0: ((vblk-lock)-rlock){..}, at: [8132661a] get_request_wait+0x19a/0x250 Other drivers use block layer provided spinlock as well, e.g. SCSI. Switching to the block layer provided spinlock saves a bit of memory and does not increase lock contention. Performance test shows no real difference is observed before and after this patch. Changes in v2: Improve commit log as Michael suggested. Cc: virtualization@lists.linux-foundation.org Cc: k...@vger.kernel.org Signed-off-by: Asias He as...@redhat.com Acked-by: Michael S. Tsirkin m...@redhat.com Signed-off-by: Rusty Russell ru...@rustcorp.com.au [bwh: Backported to 3.2: adjust context] Signed-off-by: Ben Hutchings b...@decadent.org.uk Cc: Li Zefan lize...@huawei.com Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org --- drivers/block/virtio_blk.c |9 +++-- 1 file changed, 3 insertions(+), 6 deletions(-) --- a/drivers/block/virtio_blk.c +++ b/drivers/block/virtio_blk.c @@ -21,8 +21,6 @@ struct workqueue_struct *virtblk_wq; struct virtio_blk { - spinlock_t lock; - struct virtio_device *vdev; struct virtqueue *vq; @@ -69,7 +67,7 @@ static void blk_done(struct virtqueue *v unsigned int len; unsigned long flags; - spin_lock_irqsave(vblk-lock, flags); + spin_lock_irqsave(vblk-disk-queue-queue_lock, flags); while ((vbr = virtqueue_get_buf(vblk-vq, len)) != NULL) { int error; @@ -104,7 +102,7 @@ static void blk_done(struct virtqueue *v } /* In case queue is stopped waiting for more buffers. */ blk_start_queue(vblk-disk-queue); - spin_unlock_irqrestore(vblk-lock, flags); + spin_unlock_irqrestore(vblk-disk-queue-queue_lock, flags); } static bool do_req(struct request_queue *q, struct virtio_blk *vblk, @@ -438,7 +436,6 @@ static int __devinit virtblk_probe(struc } INIT_LIST_HEAD(vblk-reqs); - spin_lock_init(vblk-lock); vblk-vdev = vdev; vblk-sg_elems = sg_elems; sg_init_table(vblk-sg, vblk-sg_elems); @@ -463,7 +460,7 @@ static int __devinit virtblk_probe(struc goto out_mempool; } - q = vblk-disk-queue = blk_init_queue(do_virtblk_request, vblk-lock); + q = vblk-disk-queue = blk_init_queue(do_virtblk_request, NULL); if (!q) { err = -ENOMEM; goto out_put_disk; ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Re: [PATCH] virtio-blk: make the queue depth configurable
On Wed, Mar 19, 2014 at 05:07:50PM +1030, Rusty Russell wrote: Joe Perches j...@perches.com writes: On Sun, 2014-03-16 at 22:00 -0700, Joe Perches wrote: On Mon, 2014-03-17 at 14:25 +1030, Rusty Russell wrote: Erk, our tests are insufficient. Testbuilding an allmodconfig with this now: Good idea. diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h [] @@ -188,6 +188,9 @@ struct kparam_array /* Default value instead of permissions? */ \ static int __param_perm_check_##name __attribute__((unused)) = \ BUILD_BUG_ON_ZERO((perm) 0 || (perm) 0777 || ((perm) 2)) \ +/* User perms = group perms = other perms. */ \ ++ BUILD_BUG_ON_ZERO(((perm) 6) (((perm) 3) 7)) \ ++ BUILD_BUG_ON_ZEROperm) 3) 7) ((perm) 7)) \ + BUILD_BUG_ON_ZERO(sizeof(prefix) MAX_PARAM_PREFIX_LEN); \ static const char __param_str_##name[] = prefix #name; \ static struct kernel_param __moduleparam_const __param_##name \ It might make sense to separate this octal permissions test into a new macro for other checks in macros like CLASS_ATTR, DEVICE_ATTR, SENSOR_ATTR and SENSOR_ATTR_2. OK, I took your bikeshed and re-painted it below. #define VERIFY_OCTAL_PERMISSIONS(perms) \ ({ \ if (__builtin_constant_p(perms)) { \ BUILD_BUG_ON((perms) 0); \ BUILD_BUG_ON((perms) 0777); \ /* User perms = group perms = other perms */ \ BUILD_BUG_ON(((perms) 6) (((perms) 3) 7));\ BUILD_BUG_ONperms) 3) 7) ((perms) 7)); \ } \ ; \ }) Subject: VERIFY_OCTAL_PERMISSIONS: stricter checking for sysfs perms. Summary of http://lkml.org/lkml/2014/3/14/363 : Ted: module_param(queue_depth, int, 444) Joe: 0444! Rusty: User perms = group perms = other perms? Joe: CLASS_ATTR, DEVICE_ATTR, SENSOR_ATTR and SENSOR_ATTR_2? Side effect of stricter permissions means removing the unnecessary S_IFREG from drivers/pci/slot.c. Suggested-by: Joe Perches j...@perches.com Cc: Bjorn Helgaas bhelg...@google.com Cc: Greg Kroah-Hartman gre...@linuxfoundation.org Signed-off-by: Rusty Russell ru...@rustcorp.com.au Acked-by: Greg Kroah-Hartman gre...@linuxfoundation.org ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization
[PATCH 3.4 46/88] virtio-blk: Reset device after blk_cleanup_queue()
3.4-stable review patch. If anyone has any objections, please let me know. -- From: Asias He as...@redhat.com commit 483001c765af6892b3fc3726576cb42f17d1d6b5 upstream. blk_cleanup_queue() will call blk_drian_queue() to drain all the requests before queue DEAD marking. If we reset the device before blk_cleanup_queue() the drain would fail. 1) if the queue is stopped in do_virtblk_request() because device is full, the q-request_fn() will not be called. blk_drain_queue() { while(true) { ... if (!list_empty(q-queue_head)) __blk_run_queue(q) { if (queue is not stoped) q-request_fn() } ... } } Do no reset the device before blk_cleanup_queue() gives the chance to start the queue in interrupt handler blk_done(). 2) In commit b79d866c8b7014a51f611a64c40546109beaf24a, We abort requests dispatched to driver before blk_cleanup_queue(). There is a race if requests are dispatched to driver after the abort and before the queue DEAD mark. To fix this, instead of aborting the requests explicitly, we can just reset the device after after blk_cleanup_queue so that the device can complete all the requests before queue DEAD marking in the drain process. Cc: Rusty Russell ru...@rustcorp.com.au Cc: virtualization@lists.linux-foundation.org Cc: k...@vger.kernel.org Signed-off-by: Asias He as...@redhat.com Acked-by: Michael S. Tsirkin m...@redhat.com Signed-off-by: Rusty Russell ru...@rustcorp.com.au Signed-off-by: Ben Hutchings b...@decadent.org.uk Cc: Yijing Wang wangyij...@huawei.com Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org --- drivers/block/virtio_blk.c | 12 +--- 1 file changed, 1 insertion(+), 11 deletions(-) --- a/drivers/block/virtio_blk.c +++ b/drivers/block/virtio_blk.c @@ -573,8 +573,6 @@ static void __devexit virtblk_remove(str { struct virtio_blk *vblk = vdev-priv; int index = vblk-index; - struct virtblk_req *vbr; - unsigned long flags; /* Prevent config work handler from accessing the device. */ mutex_lock(vblk-config_lock); @@ -582,21 +580,13 @@ static void __devexit virtblk_remove(str mutex_unlock(vblk-config_lock); del_gendisk(vblk-disk); + blk_cleanup_queue(vblk-disk-queue); /* Stop all the virtqueues. */ vdev-config-reset(vdev); flush_work(vblk-config_work); - /* Abort requests dispatched to driver. */ - spin_lock_irqsave(vblk-lock, flags); - while ((vbr = virtqueue_detach_unused_buf(vblk-vq))) { - __blk_end_request_all(vbr-req, -EIO); - mempool_free(vbr, vblk-pool); - } - spin_unlock_irqrestore(vblk-lock, flags); - - blk_cleanup_queue(vblk-disk-queue); put_disk(vblk-disk); mempool_destroy(vblk-pool); vdev-config-del_vqs(vdev); ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization
[PATCH 3.4 45/88] virtio-blk: Call del_gendisk() before disable guest kick
3.4-stable review patch. If anyone has any objections, please let me know. -- From: Asias He as...@redhat.com commit 02e2b124943648fba0a2ccee5c3656a5653e0151 upstream. del_gendisk() might not return due to failing to remove the /sys/block/vda/serial sysfs entry when another thread (udev) is trying to read it. virtblk_remove() vdev-config-reset() : guest will not kick us through interrupt del_gendisk() device_del() kobject_del(): got stuck, sysfs entry ref count non zero sysfs_open_file(): user space process read /sys/block/vda/serial sysfs_get_active() : got sysfs entry ref count dev_attr_show() virtblk_serial_show() blk_execute_rq() : got stuck, interrupt is disabled request cannot be finished This patch fixes it by calling del_gendisk() before we disable guest's interrupt so that the request sent in virtblk_serial_show() will be finished and del_gendisk() will success. This fixes another race in hot-unplug process. It is save to call del_gendisk(vblk-disk) before flush_work(vblk-config_work) which might access vblk-disk, because vblk-disk is not freed until put_disk(vblk-disk). Cc: virtualization@lists.linux-foundation.org Cc: k...@vger.kernel.org Signed-off-by: Asias He as...@redhat.com Acked-by: Michael S. Tsirkin m...@redhat.com Signed-off-by: Rusty Russell ru...@rustcorp.com.au Signed-off-by: Ben Hutchings b...@decadent.org.uk Cc: Yijing Wang wangyij...@huawei.com Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org --- drivers/block/virtio_blk.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/block/virtio_blk.c +++ b/drivers/block/virtio_blk.c @@ -581,13 +581,13 @@ static void __devexit virtblk_remove(str vblk-config_enable = false; mutex_unlock(vblk-config_lock); + del_gendisk(vblk-disk); + /* Stop all the virtqueues. */ vdev-config-reset(vdev); flush_work(vblk-config_work); - del_gendisk(vblk-disk); - /* Abort requests dispatched to driver. */ spin_lock_irqsave(vblk-lock, flags); while ((vbr = virtqueue_detach_unused_buf(vblk-vq))) { ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization
[PATCH 3.15 002/139] block: virtio_blk: dont hold spin lock during world switch
3.15-stable review patch. If anyone has any objections, please let me know. -- From: Ming Lei ming@canonical.com commit e8edca6f7f92234202d6dd163c118ef495244d7c upstream. Firstly, it isn't necessary to hold lock of vblk-vq_lock when notifying hypervisor about queued I/O. Secondly, virtqueue_notify() will cause world switch and it may take long time on some hypervisors(such as, qemu-arm), so it isn't good to hold the lock and block other vCPUs. On arm64 quad core VM(qemu-kvm), the patch can increase I/O performance a lot with VIRTIO_RING_F_EVENT_IDX enabled: - without the patch: 14K IOPS - with the patch: 34K IOPS fio script: [global] direct=1 bsrange=4k-4k timeout=10 numjobs=4 ioengine=libaio iodepth=64 filename=/dev/vdc group_reporting=1 [f1] rw=randread Cc: Rusty Russell ru...@rustcorp.com.au Cc: Michael S. Tsirkin m...@redhat.com Cc: virtualization@lists.linux-foundation.org Signed-off-by: Ming Lei ming@canonical.com Acked-by: Rusty Russell ru...@rustcorp.com.au Signed-off-by: Jens Axboe ax...@fb.com Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org --- drivers/block/virtio_blk.c |9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) --- a/drivers/block/virtio_blk.c +++ b/drivers/block/virtio_blk.c @@ -159,6 +159,7 @@ static int virtio_queue_rq(struct blk_mq unsigned int num; const bool last = (req-cmd_flags REQ_END) != 0; int err; + bool notify = false; BUG_ON(req-nr_phys_segments + 2 vblk-sg_elems); @@ -211,10 +212,12 @@ static int virtio_queue_rq(struct blk_mq return BLK_MQ_RQ_QUEUE_ERROR; } - if (last) - virtqueue_kick(vblk-vq); - + if (last virtqueue_kick_prepare(vblk-vq)) + notify = true; spin_unlock_irqrestore(vblk-vq_lock, flags); + + if (notify) + virtqueue_notify(vblk-vq); return BLK_MQ_RQ_QUEUE_OK; } ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Re: [PATCH driver-core-linus] kernfs: kernfs_notify() must be useable from non-sleepable contexts
On Tue, Jul 01, 2014 at 04:41:03PM -0400, Tejun Heo wrote: d911d9874801 (kernfs: make kernfs_notify() trigger inotify events too) added fsnotify triggering to kernfs_notify() which requires a sleepable context. There are already existing users of kernfs_notify() which invoke it from an atomic context and in general it's silly to require a sleepable context for triggering a notification. The following is an invalid context bug triggerd by md invoking sysfs_notify() from IO completion path. BUG: sleeping function called from invalid context at kernel/locking/mutex.c:586 in_atomic(): 1, irqs_disabled(): 1, pid: 0, name: swapper/1 2 locks held by swapper/1/0: #0: ((vblk-vq_lock)-rlock){-.-...}, at: [a0039042] virtblk_done+0x42/0xe0 [virtio_blk] #1: ((bitmap-counts.lock)-rlock){-.}, at: [81633718] bitmap_endwrite+0x68/0x240 irq event stamp: 33518 hardirqs last enabled at (33515): [8102544f] default_idle+0x1f/0x230 hardirqs last disabled at (33516): [818122ed] common_interrupt+0x6d/0x72 softirqs last enabled at (33518): [810a1272] _local_bh_enable+0x22/0x50 softirqs last disabled at (33517): [810a29e0] irq_enter+0x60/0x80 CPU: 1 PID: 0 Comm: swapper/1 Not tainted 3.16.0-0.rc2.git2.1.fc21.x86_64 #1 Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011 f90db13964f4ee05 88007d403b80 81807b4c 88007d403ba8 810d4f14 00441800 880078fa1780 88007d403c38 8180caf2 Call Trace: IRQ [81807b4c] dump_stack+0x4d/0x66 [810d4f14] __might_sleep+0x184/0x240 [8180caf2] mutex_lock_nested+0x42/0x440 [812d76a0] kernfs_notify+0x90/0x150 [8163377c] bitmap_endwrite+0xcc/0x240 [a00de863] close_write+0x93/0xb0 [raid1] [a00df029] r1_bio_write_done+0x29/0x50 [raid1] [a00e0474] raid1_end_write_request+0xe4/0x260 [raid1] [813acb8b] bio_endio+0x6b/0xa0 [813b46c4] blk_update_request+0x94/0x420 [813bf0ea] blk_mq_end_io+0x1a/0x70 [a00392c2] virtblk_request_done+0x32/0x80 [virtio_blk] [813c0648] __blk_mq_complete_request+0x88/0x120 [813c070a] blk_mq_complete_request+0x2a/0x30 [a0039066] virtblk_done+0x66/0xe0 [virtio_blk] [a002535a] vring_interrupt+0x3a/0xa0 [virtio_ring] [81116177] handle_irq_event_percpu+0x77/0x340 [8111647d] handle_irq_event+0x3d/0x60 [81119436] handle_edge_irq+0x66/0x130 [8101c3e4] handle_irq+0x84/0x150 [818146ad] do_IRQ+0x4d/0xe0 [818122f2] common_interrupt+0x72/0x72 EOI [8105f706] ? native_safe_halt+0x6/0x10 [81025454] default_idle+0x24/0x230 [81025f9f] arch_cpu_idle+0xf/0x20 [810f5adc] cpu_startup_entry+0x37c/0x7b0 [8104df1b] start_secondary+0x25b/0x300 This patch fixes it by punting the notification delivery through a work item. This ends up adding an extra pointer to kernfs_elem_attr enlarging kernfs_node by a pointer, which is not ideal but not a very big deal either. If this turns out to be an actual issue, we can move kernfs_elem_attr-size to kernfs_node-iattr later. Signed-off-by: Tejun Heo t...@kernel.org Reported-by: Josh Boyer jwbo...@fedoraproject.org Cc: Michael S. Tsirkin m...@redhat.com Cc: Jens Axboe ax...@kernel.dk --- fs/kernfs/file.c | 69 +++-- include/linux/kernfs.h |1 2 files changed, 56 insertions(+), 14 deletions(-) Looks good to me, do you want to take this with your other kernfs patches for 3.16-final? Or if you don't have that, I can take it through my tree, it's your choice, either is fine for me. If you want it in your tree, feel free to add: Acked-by: Greg Kroah-Hartman gre...@linuxfoundation.org ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Re: [PATCH driver-core-linus] kernfs: kernfs_notify() must be useable from non-sleepable contexts
On Wed, Jul 02, 2014 at 10:14:16AM -0400, Tejun Heo wrote: Hello, On Tue, Jul 01, 2014 at 01:51:48PM -0700, Greg Kroah-Hartman wrote: Looks good to me, do you want to take this with your other kernfs patches for 3.16-final? Or if you don't have that, I can take it through my tree, it's your choice, either is fine for me. If you want it in your tree, feel free to add: Acked-by: Greg Kroah-Hartman gre...@linuxfoundation.org The other kernfs changes are cgroup specific and in cgroup/for-3.16-fixes. I think this one fits better in the driver core tree. Can you please route it? Sure, will queue it up now. greg k-h ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Re: [PATCH 52/56] drivers/char/virtio: support compiling out splice
On Thu, Nov 13, 2014 at 10:23:29PM +0100, Pieter Smith wrote: Compile out splice support from virtio character driver when the splice-family of syscalls is not supported by the system (i.e. CONFIG_SYSCALL_SPLICE is undefined). Signed-off-by: Pieter Smith pie...@boesman.nl --- drivers/char/virtio_console.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c index b585b47..de5e2cb 100644 --- a/drivers/char/virtio_console.c +++ b/drivers/char/virtio_console.c @@ -870,6 +870,7 @@ struct sg_list { struct scatterlist *sg; }; +#ifdef CONFIG_SYSCALL_SPLICE static int pipe_to_sg(struct pipe_inode_info *pipe, struct pipe_buffer *buf, struct splice_desc *sd) { @@ -976,6 +977,7 @@ error_out: pipe_unlock(pipe); return ret; } +#endif /* #ifdef CONFIG_SYSCALL_SPLICE */ Not worth the #ifdef mess. ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Re: [PATCH] virtio_console: fix sparse warnings
On Mon, Dec 01, 2014 at 01:35:57PM +0200, Michael S. Tsirkin wrote: CHECK drivers/char/virtio_console.c drivers/char/virtio_console.c:687:36: warning: incorrect type in argument 1 (different address spaces) drivers/char/virtio_console.c:687:36:expected void [noderef] asn:1*to drivers/char/virtio_console.c:687:36:got char *out_buf drivers/char/virtio_console.c:790:35: warning: incorrect type in argument 2 (different address spaces) drivers/char/virtio_console.c:790:35:expected char *out_buf drivers/char/virtio_console.c:790:35:got char [noderef] asn:1*ubuf fill_readbuf is reused with both kernel and userspace pointers, depending on value of to_user flag. That's horrid, don't do that. Have two different functions for this type of thing, otherwise you defeat the whole purpose of trying to track __user pointers. thanks, greg k-h ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Re: [PATCH 3/6] Input: Update vmmouse.c to use the common VMW_PORT macros
On Tue, Dec 01, 2015 at 06:21:06PM -0800, Sinclair Yeh wrote: > On Tue, Dec 01, 2015 at 04:04:08PM -0800, Greg Kroah-Hartman wrote: > > On Tue, Dec 01, 2015 at 02:54:20PM -0800, Sinclair Yeh wrote: > > > Hi, > > > > > > On Tue, Dec 01, 2015 at 02:45:27PM -0800, Dmitry Torokhov wrote: > > > > On Tue, Dec 1, 2015 at 2:32 PM, Sinclair Yeh <s...@vmware.com> wrote: > > > > > Hi, > > > > > > > > > > > > > > > > > > >> > */ > > > > >> > -#define VMMOUSE_CMD(cmd, in1, out1, out2, out3, out4) \ > > > > >> > -({ \ > > > > >> > - unsigned long __dummy1, __dummy2; \ > > > > >> > - __asm__ __volatile__ ("inl %%dx" : \ > > > > >> > - "=a"(out1), \ > > > > >> > - "=b"(out2), \ > > > > >> > - "=c"(out3), \ > > > > >> > - "=d"(out4), \ > > > > >> > - "=S"(__dummy1), \ > > > > >> > - "=D"(__dummy2) :\ > > > > >> > - "a"(VMMOUSE_PROTO_MAGIC), \ > > > > >> > - "b"(in1), \ > > > > >> > - "c"(VMMOUSE_PROTO_CMD_##cmd), \ > > > > >> > - "d"(VMMOUSE_PROTO_PORT) : \ > > > > >> > - "memory"); \ > > > > >> > +#define VMMOUSE_CMD(cmd, in1, out1, out2, out3, out4) > > > > >> > \ > > > > >> > +({\ > > > > >> > + unsigned long __dummy1 = 0, __dummy2 = 0; \ > > > > >> > > > > >> Why do we need to initialize dummies? > > > > > > > > > > Because for some commands those parameters to VMW_PORT() can be both > > > > > input and outout. > > > > > > > > The vmmouse commands do not use them as input though, so it seems we > > > > are simply wasting CPU cycles setting them to 0 just because we are > > > > using the new VMW_PORT here. Why do we need to switch? What is the > > > > benefit of doing this? > > > > > > There are two reasons. One is to make the code more readable and > > > maintainable. Rather than having mostly similar inline assembly > > > code sprinkled across multiple modules, we can just use the macros > > > and document that. > > > > But the macro is only used here, and the variables aren't used at all, > > so it makes no sense in this file. > > Maybe it's because I didn't CC you on the rest of the series. I wasn't > sure what the proper distribution list is for each part. Use scripts/get_maintainer.pl, that's what it is there for. A number of those patches should go through me, if not all of them, if you want them merged... > > This new macro is also used in arch/x86/kernel/cpu/vmware.c and > vmw_balloon.c And it's used inconsistantly in those patches (you don't set the dummy variables to 0 in all of them...) Now maybe that's just how the asm functions work, but it's not very obvious as to why this is at all. > > > The second reason is this organization makes some on-going future > > > development easier. > > > > We don't plan for "future" development other than a single patch series, > > as we have no idea what that development is, nor if it will really > > happen. You can always change this file later if you need to, nothing > > is keeping that from happening. > > So the intent of this series is to centralize similar lines of inline > assembly code that are currently used by 3 different kernel modules > to a central place. The new vmware.h [patch 0/6] becomes the one header > to include for common guest-host communication needs. Why can't it go into vmw_vmci_defs.h instead, or your other .h file, why create yet-another-.h-file for your bus? You already have 2, this would make it 3, which seems like a lot... thanks, greg k-h ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Re: [PATCH 3/6] Input: Update vmmouse.c to use the common VMW_PORT macros
On Wed, Dec 02, 2015 at 09:26:34AM -0800, Dmitry Torokhov wrote: > On Wed, Dec 02, 2015 at 07:31:24AM -0800, Greg Kroah-Hartman wrote: > > On Tue, Dec 01, 2015 at 06:21:06PM -0800, Sinclair Yeh wrote: > > > On Tue, Dec 01, 2015 at 04:04:08PM -0800, Greg Kroah-Hartman wrote: > > > > On Tue, Dec 01, 2015 at 02:54:20PM -0800, Sinclair Yeh wrote: > > > > > Hi, > > > > > > > > > > On Tue, Dec 01, 2015 at 02:45:27PM -0800, Dmitry Torokhov wrote: > > > > > > On Tue, Dec 1, 2015 at 2:32 PM, Sinclair Yeh <s...@vmware.com> > > > > > > wrote: > > > > > > > Hi, > > > > > > > > > > > > > > > > > > > > > > > > > > > > >> > */ > > > > > > >> > -#define VMMOUSE_CMD(cmd, in1, out1, out2, out3, out4) \ > > > > > > >> > -({ \ > > > > > > >> > - unsigned long __dummy1, __dummy2; \ > > > > > > >> > - __asm__ __volatile__ ("inl %%dx" : \ > > > > > > >> > - "=a"(out1), \ > > > > > > >> > - "=b"(out2), \ > > > > > > >> > - "=c"(out3), \ > > > > > > >> > - "=d"(out4), \ > > > > > > >> > - "=S"(__dummy1), \ > > > > > > >> > - "=D"(__dummy2) :\ > > > > > > >> > - "a"(VMMOUSE_PROTO_MAGIC), \ > > > > > > >> > - "b"(in1), \ > > > > > > >> > - "c"(VMMOUSE_PROTO_CMD_##cmd), \ > > > > > > >> > - "d"(VMMOUSE_PROTO_PORT) : \ > > > > > > >> > - "memory"); \ > > > > > > >> > +#define VMMOUSE_CMD(cmd, in1, out1, out2, out3, out4) > > > > > > >> > \ > > > > > > >> > +({ > > > > > > >> > \ > > > > > > >> > + unsigned long __dummy1 = 0, __dummy2 = 0; > > > > > > >> > \ > > > > > > >> > > > > > > >> Why do we need to initialize dummies? > > > > > > > > > > > > > > Because for some commands those parameters to VMW_PORT() can be > > > > > > > both > > > > > > > input and outout. > > > > > > > > > > > > The vmmouse commands do not use them as input though, so it seems we > > > > > > are simply wasting CPU cycles setting them to 0 just because we are > > > > > > using the new VMW_PORT here. Why do we need to switch? What is the > > > > > > benefit of doing this? > > > > > > > > > > There are two reasons. One is to make the code more readable and > > > > > maintainable. Rather than having mostly similar inline assembly > > > > > code sprinkled across multiple modules, we can just use the macros > > > > > and document that. > > > > > > > > But the macro is only used here, and the variables aren't used at all, > > > > so it makes no sense in this file. > > > > > > Maybe it's because I didn't CC you on the rest of the series. I wasn't > > > sure what the proper distribution list is for each part. > > > > Use scripts/get_maintainer.pl, that's what it is there for. A number of > > those patches should go through me, if not all of them, if you want them > > merged... > > > > > > > > This new macro is also used in arch/x86/kernel/cpu/vmware.c and > > > vmw_balloon.c > > > > And it's used inconsistantly in those patches (you don't set the dummy > > variables to 0 in all of them...) Now maybe that's just how the asm > > functions work, but it's not very obvious as to why this is at all. > > > > > > > The second reason is this organization m
Re: [PATCH 3/6] Input: Update vmmouse.c to use the common VMW_PORT macros
On Tue, Dec 01, 2015 at 02:18:49PM -0800, Sinclair Yeh wrote: > v2: > Instead of replacing existing VMMOUSE defines, only modify enough > to use the new VMW_PORT define. > > v3: > Use updated VMWARE_PORT() which requires hypervisor magic as an added > parameter Why are these here and not below the --- line? And no changelog text at all? Not acceptable :( greg k-h ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization