hv: Added new hv_utils driver with shutdown as first functionality - NO OUTLOOK
Subsystems (2)
PATCH 1/1 hv: Added new hv_utils driver with shutdown as first functionality - NO OUTLOOK
Resending this patch from my personal Linux server. Exchange server and outlook at Microsoft seems to badly munge my patch. :(
From: Hank Janssen <[email protected]>
Subject: [PATCH 1/1] hv: Added new hv_utils driver with shutdown as first functionality
Addition of new driver for Hyper-V called hv_utils.
This driver is intended to support things like KVP, Timesync, Heartbeat etc.
This first release has support for Gracefull shutdown.
e.g. Select shutdown from the Hyper-V main admin screen and the Linux VM will do a gracefull shutdown.
--- drivers/staging/hv/Channel.c | 34 ++++++- drivers/staging/hv/ChannelMgmt.c | 148 +++++++++++++++++++++++++++++++- drivers/staging/hv/Kconfig | 6 ++ drivers/staging/hv/Makefile | 2 + drivers/staging/hv/VmbusPacketFormat.h | 1 + drivers/staging/hv/ext_utils.c | 27 ++++++ drivers/staging/hv/hyperv_utils.c | 134 +++++++++++++++++++++++++++++ drivers/staging/hv/utils.h | 94 ++++++++++++++++++++ 8 files changed, 438 insertions(+), 8 deletions(-) create mode 100644 drivers/staging/hv/ext_utils.c create mode 100644 drivers/staging/hv/hyperv_utils.c create mode 100644 drivers/staging/hv/utils.h
drivers/staging/hv/Channel.c +29 -5
@@ -21,6 +21,7 @@#include <linux/kernel.h> #include <linux/mm.h> #include <linux/slab.h> +#include <linux/module.h> #include "osd.h" #include "logging.h" #include "VmbusPrivate.h"
@@ -666,8 +667,19 @@ void VmbusChannelClose(struct vmbus_channel *Channel)DPRINT_EXIT (VMBUS ); } -/* -* VmbusChannelSendPacket - Send the specified buffer on the given channel +/** +* VmbusChannelSendPacket() - Send the specified buffer on the given channel +* @Channel: Pointer to vmbus_channel structure. +* @Buffer: Pointer to the buffer you want to receive the data into. +* @BufferLen: Maximum size of what the the buffer will hold +* @RequestId: Identifier of the request +* @vmbus_packet_type: Type of packet that is being send e.g. negotiate, time +* packet etc. +* +* Sends data in @Buffer directly to hyper-v via the vmbus +* This will send the data unparsed to hyper-v. +* +* Mainly used by Hyper-V drivers. */ int VmbusChannelSendPacket(struct vmbus_channel *Channel, const void *Buffer, u32 BufferLen, u64 RequestId,
@@ -711,6 +723,7 @@ int VmbusChannelSendPacket(struct vmbus_channel *Channel, const void *Buffer,return ret; } +EXPORT_SYMBOL (VmbusChannelSendPacket);/* * VmbusChannelSendPacketPageBuffer - Send a range of single-page buffer
@@ -848,10 +861,20 @@ int VmbusChannelSendPacketMultiPageBuffer(struct vmbus_channel *Channel,return ret; } -/* -* VmbusChannelRecvPacket - Retrieve the user packet on the specified channel + +/** +* VmbusChannelRecvPacket() - Retrieve the user packet on the specified channel +* @Channel: Pointer to vmbus_channel structure. +* @Buffer: Pointer to the buffer you want to receive the data into. +* @BufferLen: Maximum size of what the the buffer will hold +* @BufferActualLen: The actual size of the data after it was received +* @RequestId: Identifier of the request +* +* Receives directly from the hyper-v vmbus and puts the data it received +* into Buffer. This will receive the data unparsed from hyper-v. +* +* Mainly used by Hyper-V drivers. */ -/* TODO: Do we ever receive a gpa direct packet other than the ones we send ? */ int VmbusChannelRecvPacket (struct vmbus_channel *Channel,void *Buffer,u32 BufferLen,u32 *BufferActualLen,u64 *RequestId) {
@@ -913,6 +936,7 @@ int VmbusChannelRecvPacket(struct vmbus_channel *Channel, void *Buffer,return 0 ; } +EXPORT_SYMBOL (VmbusChannelRecvPacket);/* * VmbusChannelRecvPacketRaw - Retrieve the raw packet on the specified channel
drivers/staging/hv/ChannelMgmt.c +145 -3
190 lines not on this page · raw message
drivers/staging/hv/Kconfig +6 -0
@@ -29,4 +29,10 @@ config HYPERV_NET help Select this option to enable the Hyper-V virtual network driver. +config HYPERV_UTILS + tristate "Microsoft Hyper-V Utilities driver" + default HYPERV + help + Select this option to enable the Hyper-V Utilities. + endif
drivers/staging/hv/Makefile +2 -0
@@ -2,6 +2,7 @@ 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 +obj-$(CONFIG_HYPERV_UTILS) += hv_utils.o hv_vmbus-objs := vmbus_drv.o osd.o \ Vmbus.o Hv.o Connection.o Channel.o \
@@ -9,3 +10,4 @@ hv_vmbus-objs := vmbus_drv.o osd.o \ hv_storvsc-objs := storvsc_drv.o StorVsc.o hv_blkvsc-objs := blkvsc_drv.o BlkVsc.o hv_netvsc-objs := netvsc_drv.o NetVsc.o RndisFilter.o +hv_utils-objs := hyperv_utils.o ext_utils.o
drivers/staging/hv/VmbusPacketFormat.h +1 -0
@@ -22,6 +22,7 @@*/ #ifndef _VMBUSPACKETFORMAT_H_ +#define _VMBUSPACKETFORMAT_H_ struct vmpacket_descriptor { u16 Type;
drivers/staging/hv/ext_utils.c new file +27 -0
@@ -0,0 +1,27 @@ +/* +* Copyright (c) 2010, 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 <[email protected]> +* Hank Janssen <[email protected]> +*/ +#include <linux/reboot.h> +#include "utils.h" + +void shutdown_linux_system () +{ +orderly_poweroff (false); +}
drivers/staging/hv/hyperv_utils.c new file +134 -0
134 lines not on this page · raw message
drivers/staging/hv/utils.h new file +94 -0
94 lines not on this page · raw message
Signature · 1 line
1.6.0.2
Quoted 5 lines · Hank Janssen
Resending this patch from my personal Linux server. Exchange server and outlook at Microsoft seems to badly munge my patch. :(
From: Hank Janssen <[email protected]>
In the future, please put your microsoft email address here.
Quoted 10 lines
Subject: [PATCH 1/1] hv: Added new
hv_utilsdriver with shutdown as first functionalityAddition of new driver for Hyper-V called
hv_utils.
This driver is intended to support things like KVP, Timesync, Heartbeat etc.This first release has support for Gracefull shutdown.
e.g. Select shutdown from the Hyper-V main admin screen and the Linux VM will do a gracefull shutdown.Signed-off-by Hank Janssen <microsoft.com>
That's not a valid email address.
Quoted 1 line
Signed-off-by Hank Janssen <sailtheuniverse.com>
Neither is that.
Also, you "signed-off" on a patch twice, not good.
Other than that, which I fixed up by hand, it looks good, and I've applied it and added some clean-up patches on top of it to resolve some issues.
thanks,
greg k-h
Quoted 10 lines
Quoted 10 lines
Greg Wrote
Signed-off-by Hank Janssen <microsoft.comThat's not a valid email address.
Quoted 1 line
Signed-off-by Hank Janssen <sailtheuniverse.com>Neither is that.
Sorry, by this time I was so frustrated arguing with lookout and Exchange that I did not properly Add the emails when I send it from my own server. :(
Thanks,
Hank.
PATCH 1/1 staging: hv: Added heartbeat functionality to hv_utils
In reply to Hank JanssenFrom: Hank Janssen <[email protected]>
Subject: [PATCH 1/1] staging: hv: Added heartbeat functionality to hv_utils
Add heartbeat functionality to hv_utils/Hyper-V
--- drivers/staging/hv/channel_mgmt.c | 23 ++++++++++++- drivers/staging/hv/hv_utils.c | 64 +++++++++++++++++++++++++++++++++++++ drivers/staging/hv/utils.h | 5 +++ drivers/staging/hv/version_info.h | 3 +- 4 files changed, 92 insertions(+), 3 deletions(-)
drivers/staging/hv/channel_mgmt.c +21 -2
@@ -33,8 +33,8 @@ struct vmbus_channel_message_table_entry {void (*messageHandler)(struct vmbus_channel_message_header *msg); }; -#define MAX_MSG_TYPES 2 -#define MAX_NUM_DEVICE_CLASSES_SUPPORTED 6 +#define MAX_MSG_TYPES 3 +#define MAX_NUM_DEVICE_CLASSES_SUPPORTED 7static const struct hv_guid gSupportedDeviceClasses[MAX_NUM_DEVICE_CLASSES_SUPPORTED ] = {
@@ -89,6 +89,14 @@ static const struct hv_guid 0xad, 0xce, 0xe8, 0x0a, 0xb0, 0x17, 0x5c, 0xaf } }, +/* {57164f39-9115-4e78-ab55-382f3bd5422d} */ +/* Heartbeat */ + { + .data = { + 0x39, 0x4f, 0x16, 0x57, 0x15, 0x91, 0x78, 0x4e, + 0xab, 0x55, 0x38, 0x2f, 0x3b, 0xd5, 0x42, 0x2d + } + }, };
@@ -211,6 +219,17 @@ struct hyperv_service_callback hv_cb_utils[MAX_MSG_TYPES] = { .callback = chn_cb_negotiate, .log_msg = "Timesync channel functionality initialized" }, +/* {57164f39-9115-4e78-ab55-382f3bd5422d} */ +/* Heartbeat */ + { + .msg_type = HV_HEARTBEAT_MSG, + .data = { + 0x39, 0x4f, 0x16, 0x57, 0x15, 0x91, 0x78, 0x4e, + 0xab, 0x55, 0x38, 0x2f, 0x3b, 0xd5, 0x42, 0x2d + }, + .callback = chn_cb_negotiate, + .log_msg = "Heartbeat channel functionality initialized" + }, }; EXPORT_SYMBOL(hv_cb_utils);
drivers/staging/hv/hv_utils.c +64 -0
82 lines not on this page · raw message
drivers/staging/hv/utils.h +5 -0
@@ -75,6 +75,10 @@ struct shutdown_msg_data {u8 display_message[2048 ]; } __attribute__((packed)); +struct heartbeat_msg_data { +u64 seq_num; +u32 reserved[8 ]; +} __attribute__((packed));/* Time Sync IC defs */ #define ICTIMESYNCFLAG_PROBE 0
@@ -97,6 +101,7 @@ struct ictimesync_data{/* Index for each IC struct in array hv_cb_utils[] */ #define HV_SHUTDOWN_MSG 0#define HV_TIMESYNC_MSG 1 +#define HV_HEARTBEAT_MSG 2struct hyperv_service_callback {u8 msg_type;
drivers/staging/hv/version_info.h +2 -1
@@ -40,8 +40,9 @@* Minor Number Changes when new functionality is added * to the Linux IC's that is not a bug fix. * +* 3.1 - Added completed hv_utils driver. Shutdown/Heartbeat/Timesync */ -#define HV_DRV_VERSION "3.0" +#define HV_DRV_VERSION "3.1"#endif
Signature · 1 line
1.6.0.2