staging: unisys: remove server crust from visorchipset.

The visorchipset driver originally serviced both servers and
clients. This implementation is client only so remove some
more server side implementation.

Signed-off-by: David Kershner <david.kershner@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
David Kershner 2015-05-05 18:36:39 -04:00 committed by Greg Kroah-Hartman
parent 1452f37015
commit 4da3336c25
3 changed files with 61 additions and 182 deletions

View File

@ -2066,9 +2066,9 @@ visorbus_init(void)
/* This enables us to receive notifications when devices appear for /* This enables us to receive notifications when devices appear for
* which this service partition is to be a server for. * which this service partition is to be a server for.
*/ */
visorchipset_register_busdev_server(&chipset_notifiers, visorchipset_register_busdev(&chipset_notifiers,
&chipset_responders, &chipset_responders,
&chipset_driverinfo); &chipset_driverinfo);
rc = 0; rc = 0;
@ -2084,7 +2084,7 @@ visorbus_exit(void)
{ {
struct list_head *listentry, *listtmp; struct list_head *listentry, *listtmp;
visorchipset_register_busdev_server(NULL, NULL, NULL); visorchipset_register_busdev(NULL, NULL, NULL);
remove_all_visor_devices(); remove_all_visor_devices();
flush_workqueue(periodic_dev_workqueue); /* better not be any work! */ flush_workqueue(periodic_dev_workqueue); /* better not be any work! */

View File

@ -138,13 +138,12 @@ struct visorchipset_busdev_responders {
}; };
/** Register functions (in the bus driver) to get called by visorchipset /** Register functions (in the bus driver) to get called by visorchipset
* whenever a bus or device appears for which this service partition is * whenever a bus or device appears for which this guest is to be the
* to be the client for. visorchipset will fill in <responders>, to * client for. visorchipset will fill in <responders>, to indicate
* indicate functions the bus driver should call to indicate message * functions the bus driver should call to indicate message responses.
* responses.
*/ */
void void
visorchipset_register_busdev_server( visorchipset_register_busdev(
struct visorchipset_busdev_notifiers *notifiers, struct visorchipset_busdev_notifiers *notifiers,
struct visorchipset_busdev_responders *responders, struct visorchipset_busdev_responders *responders,
struct ultra_vbus_deviceinfo *driver_info); struct ultra_vbus_deviceinfo *driver_info);

View File

@ -25,7 +25,6 @@
#include "guestlinuxdebug.h" #include "guestlinuxdebug.h"
#include "visorbus_private.h" #include "visorbus_private.h"
#include <linux/ctype.h> #include <linux/ctype.h>
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/mm.h> #include <linux/mm.h>
@ -36,10 +35,6 @@
#include <linux/crash_dump.h> #include <linux/crash_dump.h>
#define CURRENT_FILE_PC VISOR_CHIPSET_PC_visorchipset_main_c #define CURRENT_FILE_PC VISOR_CHIPSET_PC_visorchipset_main_c
#define TEST_VNIC_PHYSITF "eth0" /* physical network itf for
* vnic loopback test */
#define TEST_VNIC_SWITCHNO 1
#define TEST_VNIC_BUSNO 9
#define MAX_NAME_SIZE 128 #define MAX_NAME_SIZE 128
#define MAX_IP_SIZE 50 #define MAX_IP_SIZE 50
@ -54,14 +49,8 @@
/* /*
* Module parameters * Module parameters
*/ */
static int visorchipset_testvnic;
static int visorchipset_testvnicclient;
static int visorchipset_testmsg;
static int visorchipset_major; static int visorchipset_major;
static int visorchipset_serverregwait; static int visorchipset_visorbusregwait = 1; /* default is on */
static int visorchipset_clientregwait = 1; /* default is on */
static int visorchipset_testteardown;
static int visorchipset_disable_controlvm;
static int visorchipset_holdchipsetready; static int visorchipset_holdchipsetready;
static unsigned long controlvm_payload_bytes_buffered; static unsigned long controlvm_payload_bytes_buffered;
@ -90,8 +79,7 @@ visorchipset_release(struct inode *inode, struct file *file)
static unsigned long poll_jiffies = POLLJIFFIES_CONTROLVMCHANNEL_FAST; static unsigned long poll_jiffies = POLLJIFFIES_CONTROLVMCHANNEL_FAST;
static unsigned long most_recent_message_jiffies; /* when we got our last static unsigned long most_recent_message_jiffies; /* when we got our last
* controlvm message */ * controlvm message */
static int serverregistered; static int visorbusregistered;
static int clientregistered;
#define MAX_CHIPSET_EVENTS 2 #define MAX_CHIPSET_EVENTS 2
static u8 chipset_events[MAX_CHIPSET_EVENTS] = { 0, 0 }; static u8 chipset_events[MAX_CHIPSET_EVENTS] = { 0, 0 };
@ -119,16 +107,6 @@ static u32 g_diagpool_bus_no = 0xffffff;
static u32 g_diagpool_dev_no = 0xffffff; static u32 g_diagpool_dev_no = 0xffffff;
static struct controlvm_message_packet g_devicechangestate_packet; static struct controlvm_message_packet g_devicechangestate_packet;
/* Only VNIC and VHBA channels are sent to visorclientbus (aka
* "visorhackbus")
*/
#define FOR_VISORHACKBUS(channel_type_guid) \
(((uuid_le_cmp(channel_type_guid,\
spar_vnic_channel_protocol_uuid) == 0) ||\
(uuid_le_cmp(channel_type_guid,\
spar_vhba_channel_protocol_uuid) == 0)))
#define FOR_VISORBUS(channel_type_guid) (!(FOR_VISORHACKBUS(channel_type_guid)))
#define is_diagpool_channel(channel_type_guid) \ #define is_diagpool_channel(channel_type_guid) \
(uuid_le_cmp(channel_type_guid,\ (uuid_le_cmp(channel_type_guid,\
spar_diag_pool_channel_protocol_uuid) == 0) spar_diag_pool_channel_protocol_uuid) == 0)
@ -254,8 +232,7 @@ static void parahotplug_process_list(void);
/* Manages the info for a CONTROLVM_DUMP_CAPTURESTATE / /* Manages the info for a CONTROLVM_DUMP_CAPTURESTATE /
* CONTROLVM_REPORTEVENT. * CONTROLVM_REPORTEVENT.
*/ */
static struct visorchipset_busdev_notifiers busdev_server_notifiers; static struct visorchipset_busdev_notifiers busdev_notifiers;
static struct visorchipset_busdev_notifiers busdev_client_notifiers;
static void bus_create_response(u32 bus_no, int response); static void bus_create_response(u32 bus_no, int response);
static void bus_destroy_response(u32 bus_no, int response); static void bus_destroy_response(u32 bus_no, int response);
@ -1028,19 +1005,19 @@ clear_chipset_events(void)
} }
void void
visorchipset_register_busdev_server( visorchipset_register_busdev(
struct visorchipset_busdev_notifiers *notifiers, struct visorchipset_busdev_notifiers *notifiers,
struct visorchipset_busdev_responders *responders, struct visorchipset_busdev_responders *responders,
struct ultra_vbus_deviceinfo *driver_info) struct ultra_vbus_deviceinfo *driver_info)
{ {
down(&notifier_lock); down(&notifier_lock);
if (!notifiers) { if (!notifiers) {
memset(&busdev_server_notifiers, 0, memset(&busdev_notifiers, 0,
sizeof(busdev_server_notifiers)); sizeof(busdev_notifiers));
serverregistered = 0; /* clear flag */ visorbusregistered = 0; /* clear flag */
} else { } else {
busdev_server_notifiers = *notifiers; busdev_notifiers = *notifiers;
serverregistered = 1; /* set flag */ visorbusregistered = 1; /* set flag */
} }
if (responders) if (responders)
*responders = busdev_responders; *responders = busdev_responders;
@ -1050,37 +1027,7 @@ visorchipset_register_busdev_server(
up(&notifier_lock); up(&notifier_lock);
} }
EXPORT_SYMBOL_GPL(visorchipset_register_busdev_server); EXPORT_SYMBOL_GPL(visorchipset_register_busdev);
/** Register functions (in the bus driver) to get called by visorchipset
* whenever a bus or device appears for which this service partition is
* to be the server for. visorchipset will fill in <responders>, to
* indicate functions the bus driver should call to indicate message
* responses.
*/
void
visorchipset_register_busdev_client(
struct visorchipset_busdev_notifiers *notifiers,
struct visorchipset_busdev_responders *responders,
struct ultra_vbus_deviceinfo *driver_info)
{
down(&notifier_lock);
if (!notifiers) {
memset(&busdev_client_notifiers, 0,
sizeof(busdev_client_notifiers));
clientregistered = 0; /* clear flag */
} else {
busdev_client_notifiers = *notifiers;
clientregistered = 1; /* set flag */
}
if (responders)
*responders = busdev_responders;
if (driver_info)
bus_device_info_init(driver_info, "chipset(bolts)",
"visorchipset", VERSION, NULL);
up(&notifier_lock);
}
EXPORT_SYMBOL_GPL(visorchipset_register_busdev_client);
static void static void
cleanup_controlvm_structures(void) cleanup_controlvm_structures(void)
@ -1377,34 +1324,14 @@ bus_epilog(u32 bus_no,
if (response == CONTROLVM_RESP_SUCCESS) { if (response == CONTROLVM_RESP_SUCCESS) {
switch (cmd) { switch (cmd) {
case CONTROLVM_BUS_CREATE: case CONTROLVM_BUS_CREATE:
/* We can't tell from the bus_create if (busdev_notifiers.bus_create) {
* information which of our 2 bus flavors the (*busdev_notifiers.bus_create) (bus_no);
* devices on this bus will ultimately end up.
* FORTUNATELY, it turns out it is harmless to
* send the bus_create to both of them. We can
* narrow things down a little bit, though,
* because we know: - BusDev_Server can handle
* either server or client devices
* - BusDev_Client can handle ONLY client
* devices */
if (busdev_server_notifiers.bus_create) {
(*busdev_server_notifiers.bus_create) (bus_no);
notified = true;
}
if ((!bus_info->flags.server) /*client */ &&
busdev_client_notifiers.bus_create) {
(*busdev_client_notifiers.bus_create) (bus_no);
notified = true; notified = true;
} }
break; break;
case CONTROLVM_BUS_DESTROY: case CONTROLVM_BUS_DESTROY:
if (busdev_server_notifiers.bus_destroy) { if (busdev_notifiers.bus_destroy) {
(*busdev_server_notifiers.bus_destroy) (bus_no); (*busdev_notifiers.bus_destroy) (bus_no);
notified = true;
}
if ((!bus_info->flags.server) /*client */ &&
busdev_client_notifiers.bus_destroy) {
(*busdev_client_notifiers.bus_destroy) (bus_no);
notified = true; notified = true;
} }
break; break;
@ -1439,10 +1366,8 @@ device_epilog(u32 bus_no, u32 dev_no, struct spar_segment_state state, u32 cmd,
if (!dev_info) if (!dev_info)
return; return;
if (for_visorbus) notifiers = &busdev_notifiers;
notifiers = &busdev_server_notifiers;
else
notifiers = &busdev_client_notifiers;
if (need_response) { if (need_response) {
memcpy(&dev_info->pending_msg_hdr, msg_hdr, memcpy(&dev_info->pending_msg_hdr, msg_hdr,
sizeof(struct controlvm_message_header)); sizeof(struct controlvm_message_header));
@ -1692,8 +1617,7 @@ my_device_create(struct controlvm_message *inmsg)
} }
device_epilog(bus_no, dev_no, segment_state_running, device_epilog(bus_no, dev_no, segment_state_running,
CONTROLVM_DEVICE_CREATE, &inmsg->hdr, rc, CONTROLVM_DEVICE_CREATE, &inmsg->hdr, rc,
inmsg->hdr.flags.response_expected == 1, inmsg->hdr.flags.response_expected == 1, 1);
FOR_VISORBUS(dev_info->chan_info.channel_type_uuid));
} }
static void static void
@ -1719,9 +1643,7 @@ my_device_changestate(struct controlvm_message *inmsg)
if ((rc >= CONTROLVM_RESP_SUCCESS) && dev_info) if ((rc >= CONTROLVM_RESP_SUCCESS) && dev_info)
device_epilog(bus_no, dev_no, state, device_epilog(bus_no, dev_no, state,
CONTROLVM_DEVICE_CHANGESTATE, &inmsg->hdr, rc, CONTROLVM_DEVICE_CHANGESTATE, &inmsg->hdr, rc,
inmsg->hdr.flags.response_expected == 1, inmsg->hdr.flags.response_expected == 1, 1);
FOR_VISORBUS(
dev_info->chan_info.channel_type_uuid));
} }
static void static void
@ -1742,9 +1664,7 @@ my_device_destroy(struct controlvm_message *inmsg)
if ((rc >= CONTROLVM_RESP_SUCCESS) && dev_info) if ((rc >= CONTROLVM_RESP_SUCCESS) && dev_info)
device_epilog(bus_no, dev_no, segment_state_running, device_epilog(bus_no, dev_no, segment_state_running,
CONTROLVM_DEVICE_DESTROY, &inmsg->hdr, rc, CONTROLVM_DEVICE_DESTROY, &inmsg->hdr, rc,
inmsg->hdr.flags.response_expected == 1, inmsg->hdr.flags.response_expected == 1, 1);
FOR_VISORBUS(
dev_info->chan_info.channel_type_uuid));
} }
/* When provided with the physical address of the controlvm channel /* When provided with the physical address of the controlvm channel
@ -2251,12 +2171,7 @@ controlvm_periodic_work(struct work_struct *work)
static u64 poll_count; static u64 poll_count;
/* make sure visorbus server is registered for controlvm callbacks */ /* make sure visorbus server is registered for controlvm callbacks */
if (visorchipset_serverregwait && !serverregistered) if (visorchipset_visorbusregwait && !visorbusregistered)
goto cleanup;
/* make sure visorclientbus server is regsitered for controlvm
* callbacks
*/
if (visorchipset_clientregwait && !clientregistered)
goto cleanup; goto cleanup;
poll_count++; poll_count++;
@ -2347,14 +2262,8 @@ setup_crash_devices_work_queue(struct work_struct *work)
u32 local_crash_msg_offset; u32 local_crash_msg_offset;
u16 local_crash_msg_count; u16 local_crash_msg_count;
/* make sure visorbus server is registered for controlvm callbacks */ /* make sure visorbus is registered for controlvm callbacks */
if (visorchipset_serverregwait && !serverregistered) if (visorchipset_visorbusregwait && !visorbusregistered)
goto cleanup;
/* make sure visorclientbus server is regsitered for controlvm
* callbacks
*/
if (visorchipset_clientregwait && !clientregistered)
goto cleanup; goto cleanup;
POSTCODE_LINUX_2(CRASH_DEV_ENTRY_PC, POSTCODE_SEVERITY_INFO); POSTCODE_LINUX_2(CRASH_DEV_ENTRY_PC, POSTCODE_SEVERITY_INFO);
@ -2739,18 +2648,11 @@ visorchipset_init(void)
if (!unisys_spar_platform) if (!unisys_spar_platform)
return -ENODEV; return -ENODEV;
memset(&busdev_server_notifiers, 0, sizeof(busdev_server_notifiers)); memset(&busdev_notifiers, 0, sizeof(busdev_notifiers));
memset(&busdev_client_notifiers, 0, sizeof(busdev_client_notifiers));
memset(&controlvm_payload_info, 0, sizeof(controlvm_payload_info)); memset(&controlvm_payload_info, 0, sizeof(controlvm_payload_info));
memset(&livedump_info, 0, sizeof(livedump_info)); memset(&livedump_info, 0, sizeof(livedump_info));
atomic_set(&livedump_info.buffers_in_use, 0); atomic_set(&livedump_info.buffers_in_use, 0);
if (visorchipset_testvnic) {
POSTCODE_LINUX_3(CHIPSET_INIT_FAILURE_PC, x, DIAG_SEVERITY_ERR);
rc = x;
goto cleanup;
}
addr = controlvm_get_channel_address(); addr = controlvm_get_channel_address();
if (addr) { if (addr) {
controlvm_channel = controlvm_channel =
@ -2779,32 +2681,30 @@ visorchipset_init(void)
memset(&g_chipset_msg_hdr, 0, sizeof(struct controlvm_message_header)); memset(&g_chipset_msg_hdr, 0, sizeof(struct controlvm_message_header));
if (!visorchipset_disable_controlvm) { /* if booting in a crash kernel */
/* if booting in a crash kernel */ if (is_kdump_kernel())
if (is_kdump_kernel()) INIT_DELAYED_WORK(&periodic_controlvm_work,
INIT_DELAYED_WORK(&periodic_controlvm_work, setup_crash_devices_work_queue);
setup_crash_devices_work_queue); else
else INIT_DELAYED_WORK(&periodic_controlvm_work,
INIT_DELAYED_WORK(&periodic_controlvm_work, controlvm_periodic_work);
controlvm_periodic_work); periodic_controlvm_workqueue =
periodic_controlvm_workqueue = create_singlethread_workqueue("visorchipset_controlvm");
create_singlethread_workqueue("visorchipset_controlvm");
if (!periodic_controlvm_workqueue) { if (!periodic_controlvm_workqueue) {
POSTCODE_LINUX_2(CREATE_WORKQUEUE_FAILED_PC, POSTCODE_LINUX_2(CREATE_WORKQUEUE_FAILED_PC,
DIAG_SEVERITY_ERR); DIAG_SEVERITY_ERR);
rc = -ENOMEM; rc = -ENOMEM;
goto cleanup; goto cleanup;
} }
most_recent_message_jiffies = jiffies; most_recent_message_jiffies = jiffies;
poll_jiffies = POLLJIFFIES_CONTROLVMCHANNEL_FAST; poll_jiffies = POLLJIFFIES_CONTROLVMCHANNEL_FAST;
rc = queue_delayed_work(periodic_controlvm_workqueue, rc = queue_delayed_work(periodic_controlvm_workqueue,
&periodic_controlvm_work, poll_jiffies); &periodic_controlvm_work, poll_jiffies);
if (rc < 0) { if (rc < 0) {
POSTCODE_LINUX_2(QUEUE_DELAYED_WORK_PC, POSTCODE_LINUX_2(QUEUE_DELAYED_WORK_PC,
DIAG_SEVERITY_ERR); DIAG_SEVERITY_ERR);
goto cleanup; goto cleanup;
}
} }
visorchipset_platform_device.dev.devt = major_dev; visorchipset_platform_device.dev.devt = major_dev;
@ -2840,15 +2740,11 @@ visorchipset_exit(void)
visorbus_exit(); visorbus_exit();
if (visorchipset_disable_controlvm) { cancel_delayed_work(&periodic_controlvm_work);
; flush_workqueue(periodic_controlvm_workqueue);
} else { destroy_workqueue(periodic_controlvm_workqueue);
cancel_delayed_work(&periodic_controlvm_work); periodic_controlvm_workqueue = NULL;
flush_workqueue(periodic_controlvm_workqueue); destroy_controlvm_payload_info(&controlvm_payload_info);
destroy_workqueue(periodic_controlvm_workqueue);
periodic_controlvm_workqueue = NULL;
destroy_controlvm_payload_info(&controlvm_payload_info);
}
cleanup_controlvm_structures(); cleanup_controlvm_structures();
@ -2860,28 +2756,12 @@ visorchipset_exit(void)
POSTCODE_LINUX_2(DRIVER_EXIT_PC, POSTCODE_SEVERITY_INFO); POSTCODE_LINUX_2(DRIVER_EXIT_PC, POSTCODE_SEVERITY_INFO);
} }
module_param_named(testvnic, visorchipset_testvnic, int, S_IRUGO);
MODULE_PARM_DESC(visorchipset_testvnic, "1 to test vnic, using dummy VNIC connected via a loopback to a physical ethernet");
module_param_named(testvnicclient, visorchipset_testvnicclient, int, S_IRUGO);
MODULE_PARM_DESC(visorchipset_testvnicclient, "1 to test vnic, using real VNIC channel attached to a separate IOVM guest");
module_param_named(testmsg, visorchipset_testmsg, int, S_IRUGO);
MODULE_PARM_DESC(visorchipset_testmsg,
"1 to manufacture the chipset, bus, and switch messages");
module_param_named(major, visorchipset_major, int, S_IRUGO); module_param_named(major, visorchipset_major, int, S_IRUGO);
MODULE_PARM_DESC(visorchipset_major, MODULE_PARM_DESC(visorchipset_major,
"major device number to use for the device node"); "major device number to use for the device node");
module_param_named(serverregwait, visorchipset_serverregwait, int, S_IRUGO); module_param_named(visorbusregwait, visorchipset_visorbusregwait, int, S_IRUGO);
MODULE_PARM_DESC(visorchipset_serverreqwait, MODULE_PARM_DESC(visorchipset_visorbusreqwait,
"1 to have the module wait for the visor bus to register"); "1 to have the module wait for the visor bus to register");
module_param_named(clientregwait, visorchipset_clientregwait, int, S_IRUGO);
MODULE_PARM_DESC(visorchipset_clientregwait, "1 to have the module wait for the visorclientbus to register");
module_param_named(testteardown, visorchipset_testteardown, int, S_IRUGO);
MODULE_PARM_DESC(visorchipset_testteardown,
"1 to test teardown of the chipset, bus, and switch");
module_param_named(disable_controlvm, visorchipset_disable_controlvm, int,
S_IRUGO);
MODULE_PARM_DESC(visorchipset_disable_controlvm,
"1 to disable polling of controlVm channel");
module_param_named(holdchipsetready, visorchipset_holdchipsetready, module_param_named(holdchipsetready, visorchipset_holdchipsetready,
int, S_IRUGO); int, S_IRUGO);
MODULE_PARM_DESC(visorchipset_holdchipsetready, MODULE_PARM_DESC(visorchipset_holdchipsetready,