diff options
Diffstat (limited to 'drivers/staging/unisys/uislib')
-rw-r--r-- | drivers/staging/unisys/uislib/Kconfig | 2 | ||||
-rw-r--r-- | drivers/staging/unisys/uislib/Makefile | 2 | ||||
-rw-r--r-- | drivers/staging/unisys/uislib/uislib.c | 225 | ||||
-rw-r--r-- | drivers/staging/unisys/uislib/uisqueue.c | 6 | ||||
-rw-r--r-- | drivers/staging/unisys/uislib/uisthread.c | 30 | ||||
-rw-r--r-- | drivers/staging/unisys/uislib/uisutils.c | 197 |
6 files changed, 45 insertions, 417 deletions
diff --git a/drivers/staging/unisys/uislib/Kconfig b/drivers/staging/unisys/uislib/Kconfig index a712eb82224a..c39a0a21ae5f 100644 --- a/drivers/staging/unisys/uislib/Kconfig +++ b/drivers/staging/unisys/uislib/Kconfig @@ -4,7 +4,7 @@ config UNISYS_UISLIB tristate "Unisys uislib driver" - depends on UNISYSSPAR && UNISYS_VISORCHIPSET && HAS_IOMEM + select UNISYS_VISORCHIPSET ---help--- If you say Y here, you will enable the Unisys uislib driver. diff --git a/drivers/staging/unisys/uislib/Makefile b/drivers/staging/unisys/uislib/Makefile index 08e620d17497..860f494f132f 100644 --- a/drivers/staging/unisys/uislib/Makefile +++ b/drivers/staging/unisys/uislib/Makefile @@ -7,8 +7,6 @@ obj-$(CONFIG_UNISYS_UISLIB) += visoruislib.o visoruislib-y := uislib.o uisqueue.o uisthread.o uisutils.o ccflags-y += -Idrivers/staging/unisys/include -ccflags-y += -Idrivers/staging/unisys/channels ccflags-y += -Idrivers/staging/unisys/visorchipset -ccflags-y += -Idrivers/staging/unisys/sparstopdriver ccflags-y += -Idrivers/staging/unisys/common-spar/include ccflags-y += -Idrivers/staging/unisys/common-spar/include/channels diff --git a/drivers/staging/unisys/uislib/uislib.c b/drivers/staging/unisys/uislib/uislib.c index a9eeddeba735..f93d0bb11b12 100644 --- a/drivers/staging/unisys/uislib/uislib.c +++ b/drivers/staging/unisys/uislib/uislib.c @@ -29,7 +29,6 @@ #include <linux/uuid.h> #include <linux/version.h> -#include "uniklog.h" #include "diagnostics/appos_subsystems.h" #include "uisutils.h" #include "vbuschannel.h" @@ -132,14 +131,10 @@ static __iomem void *init_vbus_channel(u64 ch_addr, u32 ch_bytes) { void __iomem *ch = uislib_ioremap_cache(ch_addr, ch_bytes); - if (!ch) { - LOGERR("CONTROLVM_BUS_CREATE error: ioremap_cache of channelAddr:%Lx for channelBytes:%llu failed", - (unsigned long long)ch_addr, - (unsigned long long)ch_bytes); + if (!ch) return NULL; - } + if (!SPAR_VBUS_CHANNEL_OK_CLIENT(ch)) { - ERRDRV("%s channel cannot be used", __func__); uislib_iounmap(ch); return NULL; } @@ -154,8 +149,6 @@ create_bus(struct controlvm_message *msg, char *buf) size_t size; if (max_bus_count == bus_list_count) { - LOGERR("CONTROLVM_BUS_CREATE Failed: max buses:%d already created\n", - max_bus_count); POSTCODE_LINUX_3(BUS_CREATE_FAILURE_PC, max_bus_count, POSTCODE_SEVERITY_ERR); return CONTROLVM_RESP_ERROR_MAX_BUSES; @@ -172,7 +165,6 @@ create_bus(struct controlvm_message *msg, char *buf) (dev_count * sizeof(struct device_info *)); bus = kzalloc(size, GFP_ATOMIC); if (!bus) { - LOGERR("CONTROLVM_BUS_CREATE Failed: kmalloc for bus failed.\n"); POSTCODE_LINUX_3(BUS_CREATE_FAILURE_PC, bus_no, POSTCODE_SEVERITY_ERR); return CONTROLVM_RESP_ERROR_KMALLOC_FAILED; @@ -209,8 +201,6 @@ create_bus(struct controlvm_message *msg, char *buf) /* found a bus already in the list with same bus_no - * reject add */ - LOGERR("CONTROLVM_BUS_CREATE Failed: bus %d already exists.\n", - bus->bus_no); POSTCODE_LINUX_3(BUS_CREATE_FAILURE_PC, bus->bus_no, POSTCODE_SEVERITY_ERR); kfree(bus); @@ -234,14 +224,12 @@ create_bus(struct controlvm_message *msg, char *buf) cmd.add_vbus.bus_uuid = msg->cmd.create_bus.bus_data_type_uuid; cmd.add_vbus.instance_uuid = msg->cmd.create_bus.bus_inst_uuid; if (!virt_control_chan_func) { - LOGERR("CONTROLVM_BUS_CREATE Failed: virtpci callback not registered."); POSTCODE_LINUX_3(BUS_CREATE_FAILURE_PC, bus->bus_no, POSTCODE_SEVERITY_ERR); kfree(bus); return CONTROLVM_RESP_ERROR_VIRTPCI_DRIVER_FAILURE; } if (!virt_control_chan_func(&cmd)) { - LOGERR("CONTROLVM_BUS_CREATE Failed: virtpci GUEST_ADD_VBUS returned error."); POSTCODE_LINUX_3(BUS_CREATE_FAILURE_PC, bus->bus_no, POSTCODE_SEVERITY_ERR); kfree(bus); @@ -287,17 +275,13 @@ destroy_bus(struct controlvm_message *msg, char *buf) } if (!bus) { - LOGERR("CONTROLVM_BUS_DESTROY Failed: failed to find bus %d.\n", - bus_no); read_unlock(&bus_list_lock); return CONTROLVM_RESP_ERROR_ALREADY_DONE; } /* verify that this bus has no devices. */ for (i = 0; i < bus->device_count; i++) { - if (bus->device[i] != NULL) { - LOGERR("CONTROLVM_BUS_DESTROY Failed: device %i attached to bus %d.", - i, bus_no); + if (bus->device[i]) { read_unlock(&bus_list_lock); return CONTROLVM_RESP_ERROR_BUS_DEVICE_ATTACHED; } @@ -311,14 +295,11 @@ destroy_bus(struct controlvm_message *msg, char *buf) with this bus. */ cmd.msgtype = GUEST_DEL_VBUS; cmd.del_vbus.bus_no = bus_no; - if (!virt_control_chan_func) { - LOGERR("CONTROLVM_BUS_DESTROY Failed: virtpci callback not registered."); + if (!virt_control_chan_func) return CONTROLVM_RESP_ERROR_VIRTPCI_DRIVER_FAILURE; - } - if (!virt_control_chan_func(&cmd)) { - LOGERR("CONTROLVM_BUS_DESTROY Failed: virtpci GUEST_DEL_VBUS returned error."); + + if (!virt_control_chan_func(&cmd)) return CONTROLVM_RESP_ERROR_VIRTPCI_DRIVER_CALLBACK_ERROR; - } /* finally, remove the bus from the list */ remove: @@ -357,7 +338,6 @@ static int create_device(struct controlvm_message *msg, char *buf) dev = kzalloc(sizeof(*dev), GFP_ATOMIC); if (!dev) { - LOGERR("CONTROLVM_DEVICE_CREATE Failed: kmalloc for dev failed.\n"); POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, dev_no, bus_no, POSTCODE_SEVERITY_ERR); return CONTROLVM_RESP_ERROR_KMALLOC_FAILED; @@ -381,9 +361,6 @@ static int create_device(struct controlvm_message *msg, char *buf) */ min_size = req_handler->min_channel_bytes; if (min_size > msg->cmd.create_device.channel_bytes) { - LOGERR("CONTROLVM_DEVICE_CREATE Failed: channel size is too small, channel size:0x%lx, required size:0x%lx", - (ulong)msg->cmd.create_device.channel_bytes, - (ulong)min_size); POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, dev_no, bus_no, POSTCODE_SEVERITY_ERR); result = CONTROLVM_RESP_ERROR_CHANNEL_SIZE_TOO_SMALL; @@ -393,9 +370,6 @@ static int create_device(struct controlvm_message *msg, char *buf) uislib_ioremap_cache(dev->channel_addr, msg->cmd.create_device.channel_bytes); if (!dev->chanptr) { - LOGERR("CONTROLVM_DEVICE_CREATE Failed: ioremap_cache of channelAddr:%Lx for channelBytes:%llu failed", - dev->channel_addr, - msg->cmd.create_device.channel_bytes); result = CONTROLVM_RESP_ERROR_IOREMAP_FAILED; POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, dev_no, bus_no, POSTCODE_SEVERITY_ERR); @@ -411,8 +385,6 @@ static int create_device(struct controlvm_message *msg, char *buf) continue; /* make sure the device number is valid */ if (dev_no >= bus->device_count) { - LOGERR("CONTROLVM_DEVICE_CREATE Failed: device (%d) >= deviceCount (%d).", - dev_no, bus->device_count); result = CONTROLVM_RESP_ERROR_MAX_DEVICES; POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, dev_no, bus_no, POSTCODE_SEVERITY_ERR); @@ -421,8 +393,6 @@ static int create_device(struct controlvm_message *msg, char *buf) } /* make sure this device is not already set */ if (bus->device[dev_no]) { - LOGERR("CONTROLVM_DEVICE_CREATE Failed: device %d is already exists.", - dev_no); POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, dev_no, bus_no, POSTCODE_SEVERITY_ERR); @@ -445,8 +415,6 @@ static int create_device(struct controlvm_message *msg, char *buf) wait_for_valid_guid(&((struct channel_header __iomem *) (dev->chanptr))->chtype); if (!SPAR_VHBA_CHANNEL_OK_CLIENT(dev->chanptr)) { - LOGERR("CONTROLVM_DEVICE_CREATE Failed:[CLIENT]VHBA dev %d chan invalid.", - dev_no); POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, dev_no, bus_no, POSTCODE_SEVERITY_ERR); @@ -464,8 +432,6 @@ static int create_device(struct controlvm_message *msg, char *buf) wait_for_valid_guid(&((struct channel_header __iomem *) (dev->chanptr))->chtype); if (!SPAR_VNIC_CHANNEL_OK_CLIENT(dev->chanptr)) { - LOGERR("CONTROLVM_DEVICE_CREATE Failed: VNIC[CLIENT] dev %d chan invalid.", - dev_no); POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, dev_no, bus_no, POSTCODE_SEVERITY_ERR); @@ -479,7 +445,6 @@ static int create_device(struct controlvm_message *msg, char *buf) cmd.add_vnic.instance_uuid = dev->instance_uuid; cmd.add_vhba.intr = dev->intr; } else { - LOGERR("CONTROLVM_DEVICE_CREATE Failed: unknown channelTypeGuid.\n"); POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, dev_no, bus_no, POSTCODE_SEVERITY_ERR); result = CONTROLVM_RESP_ERROR_CHANNEL_TYPE_UNKNOWN; @@ -487,7 +452,6 @@ static int create_device(struct controlvm_message *msg, char *buf) } if (!virt_control_chan_func) { - LOGERR("CONTROLVM_DEVICE_CREATE Failed: virtpci callback not registered."); POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, dev_no, bus_no, POSTCODE_SEVERITY_ERR); result = CONTROLVM_RESP_ERROR_VIRTPCI_DRIVER_FAILURE; @@ -495,7 +459,6 @@ static int create_device(struct controlvm_message *msg, char *buf) } if (!virt_control_chan_func(&cmd)) { - LOGERR("CONTROLVM_DEVICE_CREATE Failed: virtpci GUEST_ADD_[VHBA||VNIC] returned error."); POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, dev_no, bus_no, POSTCODE_SEVERITY_ERR); result = @@ -510,8 +473,6 @@ static int create_device(struct controlvm_message *msg, char *buf) } read_unlock(&bus_list_lock); - LOGERR("CONTROLVM_DEVICE_CREATE Failed: failed to find bus %d.", - bus_no); POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, dev_no, bus_no, POSTCODE_SEVERITY_ERR); result = CONTROLVM_RESP_ERROR_BUS_INVALID; @@ -542,15 +503,11 @@ static int pause_device(struct controlvm_message *msg) if (bus->bus_no == bus_no) { /* make sure the device number is valid */ if (dev_no >= bus->device_count) { - LOGERR("CONTROLVM_DEVICE_CHANGESTATE:pause Failed: device(%d) >= deviceCount(%d).", - dev_no, bus->device_count); retval = CONTROLVM_RESP_ERROR_DEVICE_INVALID; } else { /* make sure this device exists */ dev = bus->device[dev_no]; if (!dev) { - LOGERR("CONTROLVM_DEVICE_CHANGESTATE:pause Failed: device %d does not exist.", - dev_no); retval = CONTROLVM_RESP_ERROR_ALREADY_DONE; } @@ -558,11 +515,9 @@ static int pause_device(struct controlvm_message *msg) break; } } - if (!bus) { - LOGERR("CONTROLVM_DEVICE_CHANGESTATE:pause Failed: bus %d does not exist", - bus_no); + if (!bus) retval = CONTROLVM_RESP_ERROR_BUS_INVALID; - } + read_unlock(&bus_list_lock); if (retval == CONTROLVM_RESP_SUCCESS) { /* the msg is bound for virtpci; send @@ -577,15 +532,11 @@ static int pause_device(struct controlvm_message *msg) cmd.msgtype = GUEST_PAUSE_VNIC; cmd.pause_vnic.chanptr = dev->chanptr; } else { - LOGERR("CONTROLVM_DEVICE_CHANGESTATE:pause Failed: unknown channelTypeGuid.\n"); return CONTROLVM_RESP_ERROR_CHANNEL_TYPE_UNKNOWN; } - if (!virt_control_chan_func) { - LOGERR("CONTROLVM_DEVICE_CHANGESTATE Failed: virtpci callback not registered."); + if (!virt_control_chan_func) return CONTROLVM_RESP_ERROR_VIRTPCI_DRIVER_FAILURE; - } if (!virt_control_chan_func(&cmd)) { - LOGERR("CONTROLVM_DEVICE_CHANGESTATE:pause Failed: virtpci GUEST_PAUSE_[VHBA||VNIC] returned error."); return CONTROLVM_RESP_ERROR_VIRTPCI_DRIVER_CALLBACK_ERROR; } @@ -609,15 +560,11 @@ static int resume_device(struct controlvm_message *msg) if (bus->bus_no == bus_no) { /* make sure the device number is valid */ if (dev_no >= bus->device_count) { - LOGERR("CONTROLVM_DEVICE_CHANGESTATE:resume Failed: device(%d) >= deviceCount(%d).", - dev_no, bus->device_count); retval = CONTROLVM_RESP_ERROR_DEVICE_INVALID; } else { /* make sure this device exists */ dev = bus->device[dev_no]; if (!dev) { - LOGERR("CONTROLVM_DEVICE_CHANGESTATE:resume Failed: device %d does not exist.", - dev_no); retval = CONTROLVM_RESP_ERROR_ALREADY_DONE; } @@ -626,11 +573,9 @@ static int resume_device(struct controlvm_message *msg) } } - if (!bus) { - LOGERR("CONTROLVM_DEVICE_CHANGESTATE:resume Failed: bus %d does not exist", - bus_no); + if (!bus) retval = CONTROLVM_RESP_ERROR_BUS_INVALID; - } + read_unlock(&bus_list_lock); /* the msg is bound for virtpci; send * guest_msgs struct to callback @@ -645,15 +590,11 @@ static int resume_device(struct controlvm_message *msg) cmd.msgtype = GUEST_RESUME_VNIC; cmd.resume_vnic.chanptr = dev->chanptr; } else { - LOGERR("CONTROLVM_DEVICE_CHANGESTATE:resume Failed: unknown channelTypeGuid.\n"); return CONTROLVM_RESP_ERROR_CHANNEL_TYPE_UNKNOWN; } - if (!virt_control_chan_func) { - LOGERR("CONTROLVM_DEVICE_CHANGESTATE Failed: virtpci callback not registered."); + if (!virt_control_chan_func) return CONTROLVM_RESP_ERROR_VIRTPCI_DRIVER_FAILURE; - } if (!virt_control_chan_func(&cmd)) { - LOGERR("CONTROLVM_DEVICE_CHANGESTATE:resume Failed: virtpci GUEST_RESUME_[VHBA||VNIC] returned error."); return CONTROLVM_RESP_ERROR_VIRTPCI_DRIVER_CALLBACK_ERROR; } @@ -673,21 +614,15 @@ static int destroy_device(struct controlvm_message *msg, char *buf) dev_no = msg->cmd.destroy_device.bus_no; read_lock(&bus_list_lock); - LOGINF("destroy_device called for bus_no=%u, dev_no=%u", bus_no, - dev_no); for (bus = bus_list; bus; bus = bus->next) { if (bus->bus_no == bus_no) { /* make sure the device number is valid */ if (dev_no >= bus->device_count) { - LOGERR("CONTROLVM_DEVICE_DESTROY Failed: device(%d) >= device_count(%d).", - dev_no, bus->device_count); retval = CONTROLVM_RESP_ERROR_DEVICE_INVALID; } else { /* make sure this device exists */ dev = bus->device[dev_no]; if (!dev) { - LOGERR("CONTROLVM_DEVICE_DESTROY Failed: device %d does not exist.", - dev_no); retval = CONTROLVM_RESP_ERROR_ALREADY_DONE; } @@ -696,11 +631,8 @@ static int destroy_device(struct controlvm_message *msg, char *buf) } } - if (!bus) { - LOGERR("CONTROLVM_DEVICE_DESTROY Failed: bus %d does not exist", - bus_no); + if (!bus) retval = CONTROLVM_RESP_ERROR_BUS_INVALID; - } read_unlock(&bus_list_lock); if (retval == CONTROLVM_RESP_SUCCESS) { /* the msg is bound for virtpci; send @@ -715,17 +647,14 @@ static int destroy_device(struct controlvm_message *msg, char *buf) cmd.msgtype = GUEST_DEL_VNIC; cmd.del_vnic.chanptr = dev->chanptr; } else { - LOGERR("CONTROLVM_DEVICE_DESTROY Failed: unknown channelTypeGuid.\n"); return CONTROLVM_RESP_ERROR_CHANNEL_TYPE_UNKNOWN; } if (!virt_control_chan_func) { - LOGERR("CONTROLVM_DEVICE_DESTROY Failed: virtpci callback not registered."); return CONTROLVM_RESP_ERROR_VIRTPCI_DRIVER_FAILURE; } if (!virt_control_chan_func(&cmd)) { - LOGERR("CONTROLVM_DEVICE_DESTROY Failed: virtpci GUEST_DEL_[VHBA||VNIC] returned error."); return CONTROLVM_RESP_ERROR_VIRTPCI_DRIVER_CALLBACK_ERROR; } @@ -734,15 +663,11 @@ static int destroy_device(struct controlvm_message *msg, char *buf) * on which accesses the channel and you will get a "unable to handle * kernel paging request" */ - if (dev->polling) { - LOGINF("calling uislib_disable_channel_interrupts"); + if (dev->polling) uislib_disable_channel_interrupts(bus_no, dev_no); - } /* unmap the channel memory for the device. */ - if (!msg->hdr.flags.test_message) { - LOGINF("destroy_device, doing iounmap"); + if (!msg->hdr.flags.test_message) uislib_iounmap(dev->chanptr); - } kfree(dev); bus->device[dev_no] = NULL; } @@ -780,10 +705,8 @@ static int delete_bus_glue(u32 bus_no) init_msg_header(&msg, CONTROLVM_BUS_DESTROY, 0, 0); msg.cmd.destroy_bus.bus_no = bus_no; - if (destroy_bus(&msg, NULL) != CONTROLVM_RESP_SUCCESS) { - LOGERR("destroy_bus failed. bus_no=0x%x\n", bus_no); + if (destroy_bus(&msg, NULL) != CONTROLVM_RESP_SUCCESS) return 0; - } return 1; } @@ -794,11 +717,8 @@ static int delete_device_glue(u32 bus_no, u32 dev_no) init_msg_header(&msg, CONTROLVM_DEVICE_DESTROY, 0, 0); msg.cmd.destroy_device.bus_no = bus_no; msg.cmd.destroy_device.dev_no = dev_no; - if (destroy_device(&msg, NULL) != CONTROLVM_RESP_SUCCESS) { - LOGERR("destroy_device failed. bus_no=0x%x dev_no=0x%x\n", - bus_no, dev_no); + if (destroy_device(&msg, NULL) != CONTROLVM_RESP_SUCCESS) return 0; - } return 1; } @@ -808,7 +728,6 @@ uislib_client_inject_add_bus(u32 bus_no, uuid_le inst_uuid, { struct controlvm_message msg; - LOGINF("enter busNo=0x%x\n", bus_no); /* step 0: init the chipset */ POSTCODE_LINUX_3(CHIPSET_INIT_ENTRY_PC, bus_no, POSTCODE_SEVERITY_INFO); @@ -824,11 +743,8 @@ uislib_client_inject_add_bus(u32 bus_no, uuid_le inst_uuid, */ msg.cmd.init_chipset.bus_count = 23; msg.cmd.init_chipset.switch_count = 0; - if (init_chipset(&msg, NULL) != CONTROLVM_RESP_SUCCESS) { - LOGERR("init_chipset failed.\n"); + if (init_chipset(&msg, NULL) != CONTROLVM_RESP_SUCCESS) return 0; - } - LOGINF("chipset initialized\n"); POSTCODE_LINUX_3(CHIPSET_INIT_EXIT_PC, bus_no, POSTCODE_SEVERITY_INFO); } @@ -842,7 +758,6 @@ uislib_client_inject_add_bus(u32 bus_no, uuid_le inst_uuid, msg.cmd.create_bus.channel_addr = channel_addr; msg.cmd.create_bus.channel_bytes = n_channel_bytes; if (create_bus(&msg, NULL) != CONTROLVM_RESP_SUCCESS) { - LOGERR("create_bus failed.\n"); POSTCODE_LINUX_3(BUS_CREATE_FAILURE_PC, bus_no, POSTCODE_SEVERITY_ERR); return 0; @@ -871,11 +786,8 @@ uislib_client_inject_pause_vhba(u32 bus_no, u32 dev_no) msg.cmd.device_change_state.dev_no = dev_no; msg.cmd.device_change_state.state = segment_state_standby; rc = pause_device(&msg); - if (rc != CONTROLVM_RESP_SUCCESS) { - LOGERR("VHBA pause_device failed. busNo=0x%x devNo=0x%x\n", - bus_no, dev_no); + if (rc != CONTROLVM_RESP_SUCCESS) return rc; - } return 0; } EXPORT_SYMBOL_GPL(uislib_client_inject_pause_vhba); @@ -891,11 +803,8 @@ uislib_client_inject_resume_vhba(u32 bus_no, u32 dev_no) msg.cmd.device_change_state.dev_no = dev_no; msg.cmd.device_change_state.state = segment_state_running; rc = resume_device(&msg); - if (rc != CONTROLVM_RESP_SUCCESS) { - LOGERR("VHBA resume_device failed. busNo=0x%x devNo=0x%x\n", - bus_no, dev_no); + if (rc != CONTROLVM_RESP_SUCCESS) return rc; - } return 0; } EXPORT_SYMBOL_GPL(uislib_client_inject_resume_vhba); @@ -908,7 +817,6 @@ uislib_client_inject_add_vhba(u32 bus_no, u32 dev_no, { struct controlvm_message msg; - LOGINF(" enter busNo=0x%x devNo=0x%x\n", bus_no, dev_no); /* chipset init'ed with bus bus has been previously created - * Verify it still exists step 2: create the VHBA device on the * bus @@ -932,8 +840,6 @@ uislib_client_inject_add_vhba(u32 bus_no, u32 dev_no, sizeof(struct irq_info)); msg.cmd.create_device.channel_addr = phys_chan_addr; if (chan_bytes < MIN_IO_CHANNEL_SIZE) { - LOGERR("wrong channel size.chan_bytes = 0x%x IO_CHANNEL_SIZE= 0x%x\n", - chan_bytes, (unsigned int)MIN_IO_CHANNEL_SIZE); POSTCODE_LINUX_4(VHBA_CREATE_FAILURE_PC, chan_bytes, MIN_IO_CHANNEL_SIZE, POSTCODE_SEVERITY_ERR); return 0; @@ -941,7 +847,6 @@ uislib_client_inject_add_vhba(u32 bus_no, u32 dev_no, msg.cmd.create_device.channel_bytes = chan_bytes; msg.cmd.create_device.data_type_uuid = spar_vhba_channel_protocol_uuid; if (create_device(&msg, NULL) != CONTROLVM_RESP_SUCCESS) { - LOGERR("VHBA create_device failed.\n"); POSTCODE_LINUX_4(VHBA_CREATE_FAILURE_PC, dev_no, bus_no, POSTCODE_SEVERITY_ERR); return 0; @@ -967,7 +872,6 @@ uislib_client_inject_add_vnic(u32 bus_no, u32 dev_no, { struct controlvm_message msg; - LOGINF(" enter busNo=0x%x devNo=0x%x\n", bus_no, dev_no); /* chipset init'ed with bus bus has been previously created - * Verify it still exists step 2: create the VNIC device on the * bus @@ -991,8 +895,6 @@ uislib_client_inject_add_vnic(u32 bus_no, u32 dev_no, sizeof(struct irq_info)); msg.cmd.create_device.channel_addr = phys_chan_addr; if (chan_bytes < MIN_IO_CHANNEL_SIZE) { - LOGERR("wrong channel size.chan_bytes = 0x%x IO_CHANNEL_SIZE= 0x%x\n", - chan_bytes, (unsigned int)MIN_IO_CHANNEL_SIZE); POSTCODE_LINUX_4(VNIC_CREATE_FAILURE_PC, chan_bytes, MIN_IO_CHANNEL_SIZE, POSTCODE_SEVERITY_ERR); return 0; @@ -1000,7 +902,6 @@ uislib_client_inject_add_vnic(u32 bus_no, u32 dev_no, msg.cmd.create_device.channel_bytes = chan_bytes; msg.cmd.create_device.data_type_uuid = spar_vnic_channel_protocol_uuid; if (create_device(&msg, NULL) != CONTROLVM_RESP_SUCCESS) { - LOGERR("VNIC create_device failed.\n"); POSTCODE_LINUX_4(VNIC_CREATE_FAILURE_PC, dev_no, bus_no, POSTCODE_SEVERITY_ERR); return 0; @@ -1023,11 +924,8 @@ uislib_client_inject_pause_vnic(u32 bus_no, u32 dev_no) msg.cmd.device_change_state.dev_no = dev_no; msg.cmd.device_change_state.state = segment_state_standby; rc = pause_device(&msg); - if (rc != CONTROLVM_RESP_SUCCESS) { - LOGERR("VNIC pause_device failed. busNo=0x%x devNo=0x%x\n", - bus_no, dev_no); + if (rc != CONTROLVM_RESP_SUCCESS) return -1; - } return 0; } EXPORT_SYMBOL_GPL(uislib_client_inject_pause_vnic); @@ -1043,11 +941,8 @@ uislib_client_inject_resume_vnic(u32 bus_no, u32 dev_no) msg.cmd.device_change_state.dev_no = dev_no; msg.cmd.device_change_state.state = segment_state_running; rc = resume_device(&msg); - if (rc != CONTROLVM_RESP_SUCCESS) { - LOGERR("VNIC resume_device failed. busNo=0x%x devNo=0x%x\n", - bus_no, dev_no); + if (rc != CONTROLVM_RESP_SUCCESS) return -1; - } return 0; } EXPORT_SYMBOL_GPL(uislib_client_inject_resume_vnic); @@ -1069,11 +964,8 @@ uislib_cache_alloc(struct kmem_cache *cur_pool, char *fn, int ln) */ void *p = kmem_cache_alloc(cur_pool, GFP_ATOMIC | __GFP_NORETRY); - if (p == NULL) { - LOGERR("uislib_malloc failed to alloc uiscmdrsp @%s:%d", - fn, ln); + if (!p) return NULL; - } return p; } EXPORT_SYMBOL_GPL(uislib_cache_alloc); @@ -1081,10 +973,8 @@ EXPORT_SYMBOL_GPL(uislib_cache_alloc); void uislib_cache_free(struct kmem_cache *cur_pool, void *p, char *fn, int ln) { - if (p == NULL) { - LOGERR("uislib_free NULL pointer @%s:%d", fn, ln); + if (!p) return; - } kmem_cache_free(cur_pool, p); } EXPORT_SYMBOL_GPL(uislib_cache_free); @@ -1162,20 +1052,16 @@ static ssize_t info_debugfs_read(struct file *file, char __user *buf, int remaining_bytes = PROC_READ_BUFFER_SIZE; /* *start = buf; */ - if (debug_buf == NULL) { - DBGINF("debug_buf == NULL; allocating buffer.\n."); + if (!debug_buf) { debug_buf = vmalloc(PROC_READ_BUFFER_SIZE); - if (debug_buf == NULL) { - LOGERR("failed to allocate buffer to provide proc data.\n"); + if (!debug_buf) return -ENOMEM; - } } temp = debug_buf; if ((*offset == 0) || (!debug_buf_valid)) { - DBGINF("calling info_debugfs_read_helper.\n"); /* if the read fails, then -1 will be returned */ total_bytes = info_debugfs_read_helper(&temp, &remaining_bytes); debug_buf_valid = 1; @@ -1196,17 +1082,9 @@ static struct device_info *find_dev(u32 bus_no, u32 dev_no) for (bus = bus_list; bus; bus = bus->next) { if (bus->bus_no == bus_no) { /* make sure the device number is valid */ - if (dev_no >= bus->device_count) { - LOGERR("%s bad bus_no, dev_no=%d,%d", - __func__, - (int)bus_no, (int)dev_no); + if (dev_no >= bus->device_count) break; - } dev = bus->device[dev_no]; - if (!dev) - LOGERR("%s bad bus_no, dev_no=%d,%d", - __func__, - (int)bus_no, (int)dev_no); break; } } @@ -1253,7 +1131,6 @@ static int process_incoming(void *v) wait_cycles = (cur_cycles - old_cycles); } } - LOGINF("wait_cycles=%llu", wait_cycles); cycles_before_wait = wait_cycles; idle_cycles = 0; poll_dev_start = 0; @@ -1281,7 +1158,7 @@ static int process_incoming(void *v) * Reschedule work to occur as soon as * possible. */ idle_cycles = 0; - if (new_tail == NULL) { + if (!new_tail) { dev->first_busy_cnt++; if (! (list_is_last @@ -1294,10 +1171,10 @@ static int process_incoming(void *v) } } } - if (incoming_ti.should_stop) + if (kthread_should_stop()) break; } - if (new_tail != NULL) { + if (new_tail) { tot_moved_to_tail_cnt++; list_move_tail(new_tail, &poll_dev_chan); } @@ -1311,12 +1188,10 @@ static int process_incoming(void *v) * - there is no input waiting on any of the channels * - we have received a signal to stop this thread */ - if (incoming_ti.should_stop) + if (kthread_should_stop()) break; - if (en_smart_wakeup == 0xFF) { - LOGINF("en_smart_wakeup set to 0xff, to force exiting process_incoming"); + if (en_smart_wakeup == 0xFF) break; - } /* wait for POLLJIFFIES_NORMAL jiffies, or until * someone wakes up poll_dev_wake_q, * whichever comes first only do a wait when we have @@ -1335,7 +1210,6 @@ static int process_incoming(void *v) idle_cycles = idle_cycles + delta_cycles; } } - DBGINF("exiting.\n"); complete_and_exit(&incoming_ti.has_stopped, 0); } @@ -1346,7 +1220,6 @@ initialize_incoming_thread(void) return TRUE; if (!uisthread_start(&incoming_ti, &process_incoming, NULL, "dev_incoming")) { - LOGERR("uisthread_start initialize_incoming_thread ****FAILED"); return FALSE; } incoming_started = TRUE; @@ -1367,11 +1240,9 @@ uislib_enable_channel_interrupts(u32 bus_no, u32 dev_no, struct device_info *dev; dev = find_dev(bus_no, dev_no); - if (!dev) { - LOGERR("%s busNo=%d, devNo=%d", __func__, (int)(bus_no), - (int)(dev_no)); + if (!dev) return; - } + down(&poll_dev_lock); initialize_incoming_thread(); dev->interrupt = interrupt; @@ -1392,11 +1263,8 @@ uislib_disable_channel_interrupts(u32 bus_no, u32 dev_no) struct device_info *dev; dev = find_dev(bus_no, dev_no); - if (!dev) { - LOGERR("%s busNo=%d, devNo=%d", __func__, (int)(bus_no), - (int)(dev_no)); + if (!dev) return; - } down(&poll_dev_lock); list_del(&dev->list_polling_device_channels); dev->polling = FALSE; @@ -1446,27 +1314,6 @@ uislib_mod_init(void) if (!unisys_spar_platform) return -ENODEV; - LOGINF("MONITORAPIS"); - - LOGINF("sizeof(struct uiscmdrsp):%lu bytes\n", - (ulong)sizeof(struct uiscmdrsp)); - LOGINF("sizeof(struct phys_info):%lu\n", - (ulong)sizeof(struct phys_info)); - LOGINF("sizeof(uiscmdrsp_scsi):%lu\n", - (ulong)sizeof(struct uiscmdrsp_scsi)); - LOGINF("sizeof(uiscmdrsp_net):%lu\n", - (ulong)sizeof(struct uiscmdrsp_net)); - LOGINF("sizeof(CONTROLVM_MESSAGE):%lu bytes\n", - (ulong)sizeof(struct controlvm_message)); - LOGINF("sizeof(struct spar_controlvm_channel_protocol):%lu bytes\n", - (ulong)sizeof(struct spar_controlvm_channel_protocol)); - LOGINF("sizeof(CHANNEL_HEADER):%lu bytes\n", - (ulong)sizeof(struct channel_header)); - LOGINF("sizeof(struct spar_io_channel_protocol):%lu bytes\n", - (ulong)sizeof(struct spar_io_channel_protocol)); - LOGINF("SIZEOF_CMDRSP:%lu bytes\n", SIZEOF_CMDRSP); - LOGINF("SIZEOF_PROTOCOL:%lu bytes\n", SIZEOF_PROTOCOL); - /* initialize global pointers to NULL */ bus_list = NULL; bus_list_count = 0; @@ -1514,8 +1361,6 @@ uislib_mod_exit(void) debugfs_remove(cycles_before_wait_debugfs_read); debugfs_remove(platformnumber_debugfs_read); debugfs_remove(dir_debugfs); - - DBGINF("goodbye.\n"); } module_init(uislib_mod_init); diff --git a/drivers/staging/unisys/uislib/uisqueue.c b/drivers/staging/unisys/uislib/uisqueue.c index 71bb7b608e9a..d46dd7428a30 100644 --- a/drivers/staging/unisys/uislib/uisqueue.c +++ b/drivers/staging/unisys/uislib/uisqueue.c @@ -295,12 +295,10 @@ uisqueue_put_cmdrsp_with_lock_client(struct uisqueue_info *queueinfo, while (!do_locked_client_insert(queueinfo, whichqueue, cmdrsp, (spinlock_t *)insertlock, channel_id)) { - if (oktowait != OK_TO_WAIT) { - LOGERR("****FAILED visor_signal_insert failed; cannot wait; insert aborted\n"); + if (oktowait != OK_TO_WAIT) return 0; /* failed to queue */ - } + /* try again */ - LOGERR("****FAILED visor_signal_insert failed; waiting to try again\n"); set_current_state(TASK_INTERRUPTIBLE); schedule_timeout(msecs_to_jiffies(10)); } diff --git a/drivers/staging/unisys/uislib/uisthread.c b/drivers/staging/unisys/uislib/uisthread.c index 25adf1a7307c..d3c973b617ee 100644 --- a/drivers/staging/unisys/uislib/uisthread.c +++ b/drivers/staging/unisys/uislib/uisthread.c @@ -20,12 +20,9 @@ #include <linux/signal.h> #include <linux/sched.h> #include <linux/kthread.h> -#include "uniklog.h" #include "uisutils.h" #include "uisthread.h" -#define KILL(a, b, c) kill_pid(find_vpid(a), b, c) - /* this is shorter than using __FILE__ (full path name) in * debug/info/error messages */ @@ -41,17 +38,14 @@ int uisthread_start(struct uisthread_info *thrinfo, int (*threadfn)(void *), void *thrcontext, char *name) { - thrinfo->should_stop = 0; /* used to stop the thread */ init_completion(&thrinfo->has_stopped); - thrinfo->task = kthread_create(threadfn, thrcontext, name, NULL); + thrinfo->task = kthread_run(threadfn, thrcontext, name); if (IS_ERR(thrinfo->task)) { thrinfo->id = 0; return 0; /* failure */ } thrinfo->id = thrinfo->task->pid; - wake_up_process(thrinfo->task); - LOGINF("started thread pid:%d\n", thrinfo->id); return 1; } EXPORT_SYMBOL_GPL(uisthread_start); @@ -59,27 +53,17 @@ EXPORT_SYMBOL_GPL(uisthread_start); void uisthread_stop(struct uisthread_info *thrinfo) { - int ret; int stopped = 0; if (thrinfo->id == 0) return; /* thread not running */ - LOGINF("uisthread_stop stopping id:%d\n", thrinfo->id); - thrinfo->should_stop = 1; - ret = KILL(thrinfo->id, SIGHUP, 1); - if (ret) { - LOGERR("unable to signal thread %d\n", ret); - } else { - /* give up if the thread has NOT died in 1 minute */ - if (wait_for_completion_timeout(&thrinfo->has_stopped, 60 * HZ)) - stopped = 1; - else - LOGERR("timed out trying to signal thread\n"); - } - if (stopped) { - LOGINF("uisthread_stop stopped id:%d\n", thrinfo->id); + kthread_stop(thrinfo->task); + /* give up if the thread has NOT died in 1 minute */ + if (wait_for_completion_timeout(&thrinfo->has_stopped, 60 * HZ)) + stopped = 1; + + if (stopped) thrinfo->id = 0; - } } EXPORT_SYMBOL_GPL(uisthread_stop); diff --git a/drivers/staging/unisys/uislib/uisutils.c b/drivers/staging/unisys/uislib/uisutils.c index 31318d246252..26ab76526813 100644 --- a/drivers/staging/unisys/uislib/uisutils.c +++ b/drivers/staging/unisys/uislib/uisutils.c @@ -21,7 +21,6 @@ #include <linux/uuid.h> #include <linux/spinlock.h> #include <linux/list.h> -#include "uniklog.h" #include "uisutils.h" #include "version.h" #include "vbushelper.h" @@ -53,7 +52,6 @@ uisutil_add_proc_line_ex(int *total, char **buffer, int *buffer_remaining, va_list args; int len; - DBGINF("buffer = 0x%p : *buffer = 0x%p.\n", buffer, *buffer); va_start(args, format); len = vsnprintf(*buffer, *buffer_remaining, format, args); va_end(args); @@ -61,7 +59,6 @@ uisutil_add_proc_line_ex(int *total, char **buffer, int *buffer_remaining, *buffer += *buffer_remaining; *total += *buffer_remaining; *buffer_remaining = 0; - LOGERR("bytes remaining is too small!\n"); return -1; } *buffer_remaining -= len; @@ -75,8 +72,6 @@ int uisctrl_register_req_handler(int type, void *fptr, struct ultra_vbus_deviceinfo *chipset_driver_info) { - LOGINF("type = %d, fptr = 0x%p.\n", type, fptr); - switch (type) { case 2: if (fptr) { @@ -91,7 +86,6 @@ uisctrl_register_req_handler(int type, void *fptr, break; default: - LOGERR("invalid type %d.\n", type); return 0; } if (chipset_driver_info) @@ -102,71 +96,6 @@ uisctrl_register_req_handler(int type, void *fptr, } EXPORT_SYMBOL_GPL(uisctrl_register_req_handler); -int -uisctrl_register_req_handler_ex(uuid_le switch_uuid, - const char *switch_type_name, - int (*controlfunc)(struct io_msgs *), - unsigned long min_channel_bytes, - int (*server_channel_ok)(unsigned long channel_bytes), - int (*server_channel_init)(void *x, - unsigned char *client_str, - u32 client_str_len, u64 bytes), - struct ultra_vbus_deviceinfo *chipset_driver_info) -{ - struct req_handler_info *req_handler; - - LOGINF("type=%pUL, controlfunc=0x%p.\n", - &switch_uuid, controlfunc); - if (!controlfunc) { - LOGERR("%pUL: controlfunc must be supplied\n", &switch_uuid); - return 0; - } - if (!server_channel_ok) { - LOGERR("%pUL: Server_Channel_Ok must be supplied\n", - &switch_uuid); - return 0; - } - if (!server_channel_init) { - LOGERR("%pUL: Server_Channel_Init must be supplied\n", - &switch_uuid); - return 0; - } - req_handler = req_handler_add(switch_uuid, - switch_type_name, - controlfunc, - min_channel_bytes, - server_channel_ok, server_channel_init); - if (!req_handler) { - LOGERR("failed to add %pUL to server list\n", &switch_uuid); - return 0; - } - - atomic_inc(&uisutils_registered_services); - if (chipset_driver_info) { - bus_device_info_init(chipset_driver_info, "chipset", - "uislib", VERSION, NULL); - return 1; - } - - LOGERR("failed to register type %pUL.\n", &switch_uuid); - return 0; -} -EXPORT_SYMBOL_GPL(uisctrl_register_req_handler_ex); - -int -uisctrl_unregister_req_handler_ex(uuid_le switch_uuid) -{ - LOGINF("type=%pUL.\n", &switch_uuid); - if (req_handler_del(switch_uuid) < 0) { - LOGERR("failed to remove %pUL from server list\n", - &switch_uuid); - return 0; - } - atomic_dec(&uisutils_registered_services); - return 1; -} -EXPORT_SYMBOL_GPL(uisctrl_unregister_req_handler_ex); - /* * unsigned int uisutil_copy_fragsinfo_from_skb(unsigned char *calling_ctx, * void *skb_in, @@ -185,117 +114,11 @@ EXPORT_SYMBOL_GPL(uisctrl_unregister_req_handler_ex); * return value indicates number of * entries filled in frags */ -unsigned int -uisutil_copy_fragsinfo_from_skb(unsigned char *calling_ctx, void *skb_in, - unsigned int firstfraglen, - unsigned int frags_max, - struct phys_info frags[]) -{ - unsigned int count = 0, ii, size, offset = 0, numfrags; - struct sk_buff *skb = skb_in; - - numfrags = skb_shinfo(skb)->nr_frags; - - while (firstfraglen) { - if (count == frags_max) { - LOGERR("%s frags array too small: max:%d count:%d\n", - calling_ctx, frags_max, count); - return -1; /* failure */ - } - frags[count].pi_pfn = - page_to_pfn(virt_to_page(skb->data + offset)); - frags[count].pi_off = - (unsigned long)(skb->data + offset) & PI_PAGE_MASK; - size = - min(firstfraglen, - (unsigned int)(PI_PAGE_SIZE - frags[count].pi_off)); - /* can take smallest of firstfraglen(what's left) OR - * bytes left in the page - */ - frags[count].pi_len = size; - firstfraglen -= size; - offset += size; - count++; - } - if (!numfrags) - goto dolist; - - if ((count + numfrags) > frags_max) { - LOGERR("**** FAILED %s frags array too small: max:%d count+nr_frags:%d\n", - calling_ctx, frags_max, count + numfrags); - return -1; /* failure */ - } - - for (ii = 0; ii < numfrags; ii++) { - count = add_physinfo_entries(page_to_pfn( - skb_frag_page(&skb_shinfo(skb)->frags[ii])), - skb_shinfo(skb)->frags[ii]. - page_offset, - skb_shinfo(skb)->frags[ii]. - size, count, frags_max, - frags); - if (count == 0) { - LOGERR("**** FAILED to add physinfo entries\n"); - return -1; /* failure */ - } - } - -dolist: if (skb_shinfo(skb)->frag_list) { - struct sk_buff *skbinlist; - int c; - - for (skbinlist = skb_shinfo(skb)->frag_list; skbinlist; - skbinlist = skbinlist->next) { - c = uisutil_copy_fragsinfo_from_skb("recursive", - skbinlist, - skbinlist->len - skbinlist->data_len, - frags_max - count, - &frags[count]); - if (c == -1) { - LOGERR("**** FAILED recursive call failed\n"); - return -1; - } - count += c; - } - } - return count; -} -EXPORT_SYMBOL_GPL(uisutil_copy_fragsinfo_from_skb); static LIST_HEAD(req_handler_info_list); /* list of struct req_handler_info */ static DEFINE_SPINLOCK(req_handler_info_list_lock); struct req_handler_info * -req_handler_add(uuid_le switch_uuid, - const char *switch_type_name, - int (*controlfunc)(struct io_msgs *), - unsigned long min_channel_bytes, - int (*server_channel_ok)(unsigned long channel_bytes), - int (*server_channel_init) - (void *x, unsigned char *clientstr, u32 clientstr_len, - u64 bytes)) -{ - struct req_handler_info *rc = NULL; - - rc = kzalloc(sizeof(*rc), GFP_ATOMIC); - if (!rc) - return NULL; - rc->switch_uuid = switch_uuid; - rc->controlfunc = controlfunc; - rc->min_channel_bytes = min_channel_bytes; - rc->server_channel_ok = server_channel_ok; - rc->server_channel_init = server_channel_init; - if (switch_type_name) - strncpy(rc->switch_type_name, switch_type_name, - sizeof(rc->switch_type_name) - 1); - spin_lock(&req_handler_info_list_lock); - list_add_tail(&rc->list_link, &req_handler_info_list); - spin_unlock(&req_handler_info_list_lock); - - return rc; -} - -struct req_handler_info * req_handler_find(uuid_le switch_uuid) { struct list_head *lelt, *tmp; @@ -312,23 +135,3 @@ req_handler_find(uuid_le switch_uuid) spin_unlock(&req_handler_info_list_lock); return NULL; } - -int -req_handler_del(uuid_le switch_uuid) -{ - struct list_head *lelt, *tmp; - struct req_handler_info *entry = NULL; - int rc = -1; - - spin_lock(&req_handler_info_list_lock); - list_for_each_safe(lelt, tmp, &req_handler_info_list) { - entry = list_entry(lelt, struct req_handler_info, list_link); - if (uuid_le_cmp(entry->switch_uuid, switch_uuid) == 0) { - list_del(lelt); - kfree(entry); - rc++; - } - } - spin_unlock(&req_handler_info_list_lock); - return rc; -} |