3 * Copyright (C) 2010 - 2013 UNISYS CORPORATION
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or (at
9 * your option) any later version.
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
14 * NON INFRINGEMENT. See the GNU General Public License for more
19 #include "visorchipset.h"
20 #include "procobjecttree.h"
21 #include "visorchannel.h"
22 #include "periodic_work.h"
28 #include "controlvmcompletionstatus.h"
29 #include "guestlinuxdebug.h"
31 #include <linux/nls.h>
32 #include <linux/netdevice.h>
33 #include <linux/platform_device.h>
34 #include <linux/uuid.h>
36 #define CURRENT_FILE_PC VISOR_CHIPSET_PC_visorchipset_main_c
37 #define TEST_VNIC_PHYSITF "eth0" /* physical network itf for
38 * vnic loopback test */
39 #define TEST_VNIC_SWITCHNO 1
40 #define TEST_VNIC_BUSNO 9
42 #define MAX_NAME_SIZE 128
43 #define MAX_IP_SIZE 50
44 #define MAXOUTSTANDINGCHANNELCOMMAND 256
45 #define POLLJIFFIES_CONTROLVMCHANNEL_FAST 1
46 #define POLLJIFFIES_CONTROLVMCHANNEL_SLOW 100
48 /* When the controlvm channel is idle for at least MIN_IDLE_SECONDS,
49 * we switch to slow polling mode. As soon as we get a controlvm
50 * message, we switch back to fast polling mode.
52 #define MIN_IDLE_SECONDS 10
53 static ulong Poll_jiffies
= POLLJIFFIES_CONTROLVMCHANNEL_FAST
;
54 static ulong Most_recent_message_jiffies
; /* when we got our last
55 * controlvm message */
64 static int serverregistered
;
65 static int clientregistered
;
67 #define MAX_CHIPSET_EVENTS 2
68 static u8 chipset_events
[MAX_CHIPSET_EVENTS
] = { 0, 0 };
70 static struct delayed_work Periodic_controlvm_work
;
71 static struct workqueue_struct
*Periodic_controlvm_workqueue
;
72 static DEFINE_SEMAPHORE(NotifierLock
);
75 CONTROLVM_MESSAGE message
;
79 static CONTROLVM_MESSAGE_HEADER g_DiagMsgHdr
;
80 static CONTROLVM_MESSAGE_HEADER g_ChipSetMsgHdr
;
81 static CONTROLVM_MESSAGE_HEADER g_DelDumpMsgHdr
;
82 static const uuid_le UltraDiagPoolChannelProtocolGuid
=
83 ULTRA_DIAG_POOL_CHANNEL_PROTOCOL_GUID
;
84 /* 0xffffff is an invalid Bus/Device number */
85 static ulong g_diagpoolBusNo
= 0xffffff;
86 static ulong g_diagpoolDevNo
= 0xffffff;
87 static CONTROLVM_MESSAGE_PACKET g_DeviceChangeStatePacket
;
89 /* Only VNIC and VHBA channels are sent to visorclientbus (aka
92 #define FOR_VISORHACKBUS(channel_type_guid) \
93 (((uuid_le_cmp(channel_type_guid, UltraVnicChannelProtocolGuid) == 0)\
94 || (uuid_le_cmp(channel_type_guid, UltraVhbaChannelProtocolGuid) == 0)))
95 #define FOR_VISORBUS(channel_type_guid) (!(FOR_VISORHACKBUS(channel_type_guid)))
97 #define is_diagpool_channel(channel_type_guid) \
98 (uuid_le_cmp(channel_type_guid, UltraDiagPoolChannelProtocolGuid) == 0)
100 static LIST_HEAD(BusInfoList
);
101 static LIST_HEAD(DevInfoList
);
103 static VISORCHANNEL
*ControlVm_channel
;
106 u8 __iomem
*ptr
; /* pointer to base address of payload pool */
107 u64 offset
; /* offset from beginning of controlvm
108 * channel to beginning of payload * pool */
109 u32 bytes
; /* number of bytes in payload pool */
110 } CONTROLVM_PAYLOAD_INFO
;
112 /* Manages the request payload in the controlvm channel */
113 static CONTROLVM_PAYLOAD_INFO ControlVm_payload_info
;
115 static pCHANNEL_HEADER Test_Vnic_channel
;
118 CONTROLVM_MESSAGE_HEADER Dumpcapture_header
;
119 CONTROLVM_MESSAGE_HEADER Gettextdump_header
;
120 CONTROLVM_MESSAGE_HEADER Dumpcomplete_header
;
121 BOOL Gettextdump_outstanding
;
124 atomic_t buffers_in_use
;
127 /* Manages the info for a CONTROLVM_DUMP_CAPTURESTATE /
128 * CONTROLVM_DUMP_GETTEXTDUMP / CONTROLVM_DUMP_COMPLETE conversation.
130 static LIVEDUMP_INFO LiveDump_info
;
132 /* The following globals are used to handle the scenario where we are unable to
133 * offload the payload from a controlvm message due to memory requirements. In
134 * this scenario, we simply stash the controlvm message, then attempt to
135 * process it again the next time controlvm_periodic_work() runs.
137 static CONTROLVM_MESSAGE ControlVm_Pending_Msg
;
138 static BOOL ControlVm_Pending_Msg_Valid
= FALSE
;
140 /* Pool of struct putfile_buffer_entry, for keeping track of pending (incoming)
141 * TRANSMIT_FILE PutFile payloads.
143 static struct kmem_cache
*Putfile_buffer_list_pool
;
144 static const char Putfile_buffer_list_pool_name
[] =
145 "controlvm_putfile_buffer_list_pool";
147 /* This identifies a data buffer that has been received via a controlvm messages
148 * in a remote --> local CONTROLVM_TRANSMIT_FILE conversation.
150 struct putfile_buffer_entry
{
151 struct list_head next
; /* putfile_buffer_entry list */
152 PARSER_CONTEXT
*parser_ctx
; /* points to buffer containing input data */
155 /* List of struct putfile_request *, via next_putfile_request member.
156 * Each entry in this list identifies an outstanding TRANSMIT_FILE
159 static LIST_HEAD(Putfile_request_list
);
161 /* This describes a buffer and its current state of transfer (e.g., how many
162 * bytes have already been supplied as putfile data, and how many bytes are
163 * remaining) for a putfile_request.
165 struct putfile_active_buffer
{
166 /* a payload from a controlvm message, containing a file data buffer */
167 PARSER_CONTEXT
*parser_ctx
;
168 /* points within data area of parser_ctx to next byte of data */
170 /* # bytes left from <pnext> to the end of this data buffer */
171 size_t bytes_remaining
;
174 #define PUTFILE_REQUEST_SIG 0x0906101302281211
175 /* This identifies a single remote --> local CONTROLVM_TRANSMIT_FILE
176 * conversation. Structs of this type are dynamically linked into
177 * <Putfile_request_list>.
179 struct putfile_request
{
180 u64 sig
; /* PUTFILE_REQUEST_SIG */
182 /* header from original TransmitFile request */
183 CONTROLVM_MESSAGE_HEADER controlvm_header
;
184 u64 file_request_number
; /* from original TransmitFile request */
186 /* link to next struct putfile_request */
187 struct list_head next_putfile_request
;
189 /* most-recent sequence number supplied via a controlvm message */
190 u64 data_sequence_number
;
192 /* head of putfile_buffer_entry list, which describes the data to be
193 * supplied as putfile data;
194 * - this list is added to when controlvm messages come in that supply
196 * - this list is removed from via the hotplug program that is actually
197 * consuming these buffers to write as file data */
198 struct list_head input_buffer_list
;
199 spinlock_t req_list_lock
; /* lock for input_buffer_list */
201 /* waiters for input_buffer_list to go non-empty */
202 wait_queue_head_t input_buffer_wq
;
204 /* data not yet read within current putfile_buffer_entry */
205 struct putfile_active_buffer active_buf
;
207 /* <0 = failed, 0 = in-progress, >0 = successful; */
208 /* note that this must be set with req_list_lock, and if you set <0, */
209 /* it is your responsibility to also free up all of the other objects */
210 /* in this struct (like input_buffer_list, active_buf.parser_ctx) */
211 /* before releasing the lock */
212 int completion_status
;
215 static atomic_t Visorchipset_cache_buffers_in_use
= ATOMIC_INIT(0);
217 struct parahotplug_request
{
218 struct list_head list
;
220 unsigned long expiration
;
221 CONTROLVM_MESSAGE msg
;
224 static LIST_HEAD(Parahotplug_request_list
);
225 static DEFINE_SPINLOCK(Parahotplug_request_list_lock
); /* lock for above */
226 static void parahotplug_process_list(void);
228 /* Manages the info for a CONTROLVM_DUMP_CAPTURESTATE /
229 * CONTROLVM_REPORTEVENT.
231 static VISORCHIPSET_BUSDEV_NOTIFIERS BusDev_Server_Notifiers
;
232 static VISORCHIPSET_BUSDEV_NOTIFIERS BusDev_Client_Notifiers
;
234 static void bus_create_response(ulong busNo
, int response
);
235 static void bus_destroy_response(ulong busNo
, int response
);
236 static void device_create_response(ulong busNo
, ulong devNo
, int response
);
237 static void device_destroy_response(ulong busNo
, ulong devNo
, int response
);
238 static void device_resume_response(ulong busNo
, ulong devNo
, int response
);
240 static VISORCHIPSET_BUSDEV_RESPONDERS BusDev_Responders
= {
241 .bus_create
= bus_create_response
,
242 .bus_destroy
= bus_destroy_response
,
243 .device_create
= device_create_response
,
244 .device_destroy
= device_destroy_response
,
245 .device_pause
= visorchipset_device_pause_response
,
246 .device_resume
= device_resume_response
,
249 /* info for /dev/visorchipset */
250 static dev_t MajorDev
= -1; /**< indicates major num for device */
252 /* prototypes for attributes */
253 static ssize_t
toolaction_show(struct device
*dev
,
254 struct device_attribute
*attr
, char *buf
);
255 static ssize_t
toolaction_store(struct device
*dev
,
256 struct device_attribute
*attr
, const char *buf
, size_t count
);
257 static DEVICE_ATTR_RW(toolaction
);
259 static ssize_t
boottotool_show(struct device
*dev
,
260 struct device_attribute
*attr
, char *buf
);
261 static ssize_t
boottotool_store(struct device
*dev
,
262 struct device_attribute
*attr
, const char *buf
, size_t count
);
263 static DEVICE_ATTR_RW(boottotool
);
265 static ssize_t
error_show(struct device
*dev
, struct device_attribute
*attr
,
267 static ssize_t
error_store(struct device
*dev
, struct device_attribute
*attr
,
268 const char *buf
, size_t count
);
269 static DEVICE_ATTR_RW(error
);
271 static ssize_t
textid_show(struct device
*dev
, struct device_attribute
*attr
,
273 static ssize_t
textid_store(struct device
*dev
, struct device_attribute
*attr
,
274 const char *buf
, size_t count
);
275 static DEVICE_ATTR_RW(textid
);
277 static ssize_t
remaining_steps_show(struct device
*dev
,
278 struct device_attribute
*attr
, char *buf
);
279 static ssize_t
remaining_steps_store(struct device
*dev
,
280 struct device_attribute
*attr
, const char *buf
, size_t count
);
281 static DEVICE_ATTR_RW(remaining_steps
);
283 static ssize_t
chipsetready_store(struct device
*dev
,
284 struct device_attribute
*attr
, const char *buf
, size_t count
);
285 static DEVICE_ATTR_WO(chipsetready
);
287 static ssize_t
devicedisabled_store(struct device
*dev
,
288 struct device_attribute
*attr
, const char *buf
, size_t count
);
289 static DEVICE_ATTR_WO(devicedisabled
);
291 static ssize_t
deviceenabled_store(struct device
*dev
,
292 struct device_attribute
*attr
, const char *buf
, size_t count
);
293 static DEVICE_ATTR_WO(deviceenabled
);
295 static struct attribute
*visorchipset_install_attrs
[] = {
296 &dev_attr_toolaction
.attr
,
297 &dev_attr_boottotool
.attr
,
298 &dev_attr_error
.attr
,
299 &dev_attr_textid
.attr
,
300 &dev_attr_remaining_steps
.attr
,
304 static struct attribute_group visorchipset_install_group
= {
306 .attrs
= visorchipset_install_attrs
309 static struct attribute
*visorchipset_guest_attrs
[] = {
310 &dev_attr_chipsetready
.attr
,
314 static struct attribute_group visorchipset_guest_group
= {
316 .attrs
= visorchipset_guest_attrs
319 static struct attribute
*visorchipset_parahotplug_attrs
[] = {
320 &dev_attr_devicedisabled
.attr
,
321 &dev_attr_deviceenabled
.attr
,
325 static struct attribute_group visorchipset_parahotplug_group
= {
326 .name
= "parahotplug",
327 .attrs
= visorchipset_parahotplug_attrs
330 static const struct attribute_group
*visorchipset_dev_groups
[] = {
331 &visorchipset_install_group
,
332 &visorchipset_guest_group
,
333 &visorchipset_parahotplug_group
,
337 /* /sys/devices/platform/visorchipset */
338 static struct platform_device Visorchipset_platform_device
= {
339 .name
= "visorchipset",
341 .dev
.groups
= visorchipset_dev_groups
,
344 /* Function prototypes */
345 static void controlvm_respond(CONTROLVM_MESSAGE_HEADER
*msgHdr
, int response
);
346 static void controlvm_respond_chipset_init(CONTROLVM_MESSAGE_HEADER
*msgHdr
,
348 ULTRA_CHIPSET_FEATURE features
);
349 static void controlvm_respond_physdev_changestate(CONTROLVM_MESSAGE_HEADER
*
350 msgHdr
, int response
,
351 ULTRA_SEGMENT_STATE state
);
353 static ssize_t
toolaction_show(struct device
*dev
,
354 struct device_attribute
*attr
,
359 visorchannel_read(ControlVm_channel
,
360 offsetof(ULTRA_CONTROLVM_CHANNEL_PROTOCOL
,
361 ToolAction
), &toolAction
, sizeof(u8
));
362 return scnprintf(buf
, PAGE_SIZE
, "%u\n", toolAction
);
365 static ssize_t
toolaction_store(struct device
*dev
,
366 struct device_attribute
*attr
,
367 const char *buf
, size_t count
)
372 if (kstrtou8(buf
, 10, &toolAction
) != 0)
375 ret
= visorchannel_write(ControlVm_channel
,
376 offsetof(ULTRA_CONTROLVM_CHANNEL_PROTOCOL
, ToolAction
),
377 &toolAction
, sizeof(u8
));
384 static ssize_t
boottotool_show(struct device
*dev
,
385 struct device_attribute
*attr
,
388 ULTRA_EFI_SPAR_INDICATION efiSparIndication
;
390 visorchannel_read(ControlVm_channel
,
391 offsetof(ULTRA_CONTROLVM_CHANNEL_PROTOCOL
,
392 EfiSparIndication
), &efiSparIndication
,
393 sizeof(ULTRA_EFI_SPAR_INDICATION
));
394 return scnprintf(buf
, PAGE_SIZE
, "%u\n",
395 efiSparIndication
.BootToTool
);
398 static ssize_t
boottotool_store(struct device
*dev
,
399 struct device_attribute
*attr
,
400 const char *buf
, size_t count
)
403 ULTRA_EFI_SPAR_INDICATION efiSparIndication
;
405 if (kstrtoint(buf
, 10, &val
) != 0)
408 efiSparIndication
.BootToTool
= val
;
409 ret
= visorchannel_write(ControlVm_channel
,
410 offsetof(ULTRA_CONTROLVM_CHANNEL_PROTOCOL
,
412 &(efiSparIndication
),
413 sizeof(ULTRA_EFI_SPAR_INDICATION
));
420 static ssize_t
error_show(struct device
*dev
, struct device_attribute
*attr
,
425 visorchannel_read(ControlVm_channel
, offsetof(
426 ULTRA_CONTROLVM_CHANNEL_PROTOCOL
, InstallationError
),
427 &error
, sizeof(u32
));
428 return scnprintf(buf
, PAGE_SIZE
, "%i\n", error
);
431 static ssize_t
error_store(struct device
*dev
, struct device_attribute
*attr
,
432 const char *buf
, size_t count
)
437 if (kstrtou32(buf
, 10, &error
) != 0)
440 ret
= visorchannel_write(ControlVm_channel
,
441 offsetof(ULTRA_CONTROLVM_CHANNEL_PROTOCOL
,
443 &error
, sizeof(u32
));
449 static ssize_t
textid_show(struct device
*dev
, struct device_attribute
*attr
,
454 visorchannel_read(ControlVm_channel
, offsetof(
455 ULTRA_CONTROLVM_CHANNEL_PROTOCOL
, InstallationTextId
),
456 &textId
, sizeof(u32
));
457 return scnprintf(buf
, PAGE_SIZE
, "%i\n", textId
);
460 static ssize_t
textid_store(struct device
*dev
, struct device_attribute
*attr
,
461 const char *buf
, size_t count
)
466 if (kstrtou32(buf
, 10, &textId
) != 0)
469 ret
= visorchannel_write(ControlVm_channel
,
470 offsetof(ULTRA_CONTROLVM_CHANNEL_PROTOCOL
,
472 &textId
, sizeof(u32
));
479 static ssize_t
remaining_steps_show(struct device
*dev
,
480 struct device_attribute
*attr
, char *buf
)
484 visorchannel_read(ControlVm_channel
,
485 offsetof(ULTRA_CONTROLVM_CHANNEL_PROTOCOL
,
486 InstallationRemainingSteps
),
489 return scnprintf(buf
, PAGE_SIZE
, "%hu\n", remainingSteps
);
492 static ssize_t
remaining_steps_store(struct device
*dev
,
493 struct device_attribute
*attr
, const char *buf
, size_t count
)
498 if (kstrtou16(buf
, 10, &remainingSteps
) != 0)
501 ret
= visorchannel_write(ControlVm_channel
,
502 offsetof(ULTRA_CONTROLVM_CHANNEL_PROTOCOL
,
503 InstallationRemainingSteps
),
504 &remainingSteps
, sizeof(u16
));
514 wchar_t unicodeString
[] = { 'a', 'b', 'c', 0 };
515 char s
[sizeof(unicodeString
) * NLS_MAX_CHARSET_SIZE
];
516 wchar_t unicode2
[99];
518 /* NOTE: Either due to a bug, or feature I don't understand, the
519 * kernel utf8_mbstowcs() and utf_wcstombs() do NOT copy the
520 * trailed NUL byte!! REALLY!!!!! Arrrrgggghhhhh
523 LOGINF("sizeof(wchar_t) = %d", sizeof(wchar_t));
524 LOGINF("utf8_wcstombs=%d",
525 chrs
= utf8_wcstombs(s
, unicodeString
, sizeof(s
)));
527 s
[chrs
] = '\0'; /* GRRRRRRRR */
529 LOGINF("utf8_mbstowcs=%d", chrs
= utf8_mbstowcs(unicode2
, s
, 100));
531 unicode2
[chrs
] = 0; /* GRRRRRRRR */
532 if (memcmp(unicodeString
, unicode2
, sizeof(unicodeString
)) == 0)
533 LOGINF("strings match... good");
535 LOGINF("strings did not match!!");
540 busInfo_clear(void *v
)
542 VISORCHIPSET_BUS_INFO
*p
= (VISORCHIPSET_BUS_INFO
*) (v
);
545 visor_proc_DestroyObject(p
->procObject
);
546 p
->procObject
= NULL
;
551 kfree(p
->description
);
552 p
->description
= NULL
;
554 p
->state
.created
= 0;
555 memset(p
, 0, sizeof(VISORCHIPSET_BUS_INFO
));
559 devInfo_clear(void *v
)
561 VISORCHIPSET_DEVICE_INFO
*p
= (VISORCHIPSET_DEVICE_INFO
*) (v
);
563 p
->state
.created
= 0;
564 memset(p
, 0, sizeof(VISORCHIPSET_DEVICE_INFO
));
568 check_chipset_events(void)
572 /* Check events to determine if response should be sent */
573 for (i
= 0; i
< MAX_CHIPSET_EVENTS
; i
++)
574 send_msg
&= chipset_events
[i
];
579 clear_chipset_events(void)
582 /* Clear chipset_events */
583 for (i
= 0; i
< MAX_CHIPSET_EVENTS
; i
++)
584 chipset_events
[i
] = 0;
588 visorchipset_register_busdev_server(VISORCHIPSET_BUSDEV_NOTIFIERS
*notifiers
,
589 VISORCHIPSET_BUSDEV_RESPONDERS
*responders
,
590 ULTRA_VBUS_DEVICEINFO
*driverInfo
)
593 if (notifiers
== NULL
) {
594 memset(&BusDev_Server_Notifiers
, 0,
595 sizeof(BusDev_Server_Notifiers
));
596 serverregistered
= 0; /* clear flag */
598 BusDev_Server_Notifiers
= *notifiers
;
599 serverregistered
= 1; /* set flag */
602 *responders
= BusDev_Responders
;
604 bus_device_info_init(driverInfo
, "chipset", "visorchipset",
609 EXPORT_SYMBOL_GPL(visorchipset_register_busdev_server
);
612 visorchipset_register_busdev_client(VISORCHIPSET_BUSDEV_NOTIFIERS
*notifiers
,
613 VISORCHIPSET_BUSDEV_RESPONDERS
*responders
,
614 ULTRA_VBUS_DEVICEINFO
*driverInfo
)
617 if (notifiers
== NULL
) {
618 memset(&BusDev_Client_Notifiers
, 0,
619 sizeof(BusDev_Client_Notifiers
));
620 clientregistered
= 0; /* clear flag */
622 BusDev_Client_Notifiers
= *notifiers
;
623 clientregistered
= 1; /* set flag */
626 *responders
= BusDev_Responders
;
628 bus_device_info_init(driverInfo
, "chipset(bolts)", "visorchipset",
632 EXPORT_SYMBOL_GPL(visorchipset_register_busdev_client
);
635 cleanup_controlvm_structures(void)
637 VISORCHIPSET_BUS_INFO
*bi
, *tmp_bi
;
638 VISORCHIPSET_DEVICE_INFO
*di
, *tmp_di
;
640 list_for_each_entry_safe(bi
, tmp_bi
, &BusInfoList
, entry
) {
642 list_del(&bi
->entry
);
646 list_for_each_entry_safe(di
, tmp_di
, &DevInfoList
, entry
) {
648 list_del(&di
->entry
);
654 chipset_init(CONTROLVM_MESSAGE
*inmsg
)
656 static int chipset_inited
;
657 ULTRA_CHIPSET_FEATURE features
= 0;
658 int rc
= CONTROLVM_RESP_SUCCESS
;
660 POSTCODE_LINUX_2(CHIPSET_INIT_ENTRY_PC
, POSTCODE_SEVERITY_INFO
);
661 if (chipset_inited
) {
662 LOGERR("CONTROLVM_CHIPSET_INIT Failed: Already Done.");
663 rc
= -CONTROLVM_RESP_ERROR_ALREADY_DONE
;
667 POSTCODE_LINUX_2(CHIPSET_INIT_EXIT_PC
, POSTCODE_SEVERITY_INFO
);
669 /* Set features to indicate we support parahotplug (if Command
670 * also supports it). */
672 inmsg
->cmd
.initChipset
.
673 features
& ULTRA_CHIPSET_FEATURE_PARA_HOTPLUG
;
675 /* Set the "reply" bit so Command knows this is a
676 * features-aware driver. */
677 features
|= ULTRA_CHIPSET_FEATURE_REPLY
;
681 cleanup_controlvm_structures();
682 if (inmsg
->hdr
.Flags
.responseExpected
)
683 controlvm_respond_chipset_init(&inmsg
->hdr
, rc
, features
);
687 controlvm_init_response(CONTROLVM_MESSAGE
*msg
,
688 CONTROLVM_MESSAGE_HEADER
*msgHdr
, int response
)
690 memset(msg
, 0, sizeof(CONTROLVM_MESSAGE
));
691 memcpy(&msg
->hdr
, msgHdr
, sizeof(CONTROLVM_MESSAGE_HEADER
));
692 msg
->hdr
.PayloadBytes
= 0;
693 msg
->hdr
.PayloadVmOffset
= 0;
694 msg
->hdr
.PayloadMaxBytes
= 0;
696 msg
->hdr
.Flags
.failed
= 1;
697 msg
->hdr
.CompletionStatus
= (u32
) (-response
);
702 controlvm_respond(CONTROLVM_MESSAGE_HEADER
*msgHdr
, int response
)
704 CONTROLVM_MESSAGE outmsg
;
706 controlvm_init_response(&outmsg
, msgHdr
, response
);
707 /* For DiagPool channel DEVICE_CHANGESTATE, we need to send
708 * back the deviceChangeState structure in the packet. */
709 if (msgHdr
->Id
== CONTROLVM_DEVICE_CHANGESTATE
710 && g_DeviceChangeStatePacket
.deviceChangeState
.busNo
==
712 && g_DeviceChangeStatePacket
.deviceChangeState
.devNo
==
714 outmsg
.cmd
= g_DeviceChangeStatePacket
;
715 if (outmsg
.hdr
.Flags
.testMessage
== 1) {
716 LOGINF("%s controlvm_msg=0x%x response=%d for test message",
717 __func__
, outmsg
.hdr
.Id
, response
);
720 if (!visorchannel_signalinsert(ControlVm_channel
,
721 CONTROLVM_QUEUE_REQUEST
, &outmsg
)) {
722 LOGERR("signalinsert failed!");
728 controlvm_respond_chipset_init(CONTROLVM_MESSAGE_HEADER
*msgHdr
, int response
,
729 ULTRA_CHIPSET_FEATURE features
)
731 CONTROLVM_MESSAGE outmsg
;
733 controlvm_init_response(&outmsg
, msgHdr
, response
);
734 outmsg
.cmd
.initChipset
.features
= features
;
735 if (!visorchannel_signalinsert(ControlVm_channel
,
736 CONTROLVM_QUEUE_REQUEST
, &outmsg
)) {
737 LOGERR("signalinsert failed!");
743 controlvm_respond_physdev_changestate(CONTROLVM_MESSAGE_HEADER
*msgHdr
,
744 int response
, ULTRA_SEGMENT_STATE state
)
746 CONTROLVM_MESSAGE outmsg
;
748 controlvm_init_response(&outmsg
, msgHdr
, response
);
749 outmsg
.cmd
.deviceChangeState
.state
= state
;
750 outmsg
.cmd
.deviceChangeState
.flags
.physicalDevice
= 1;
751 if (!visorchannel_signalinsert(ControlVm_channel
,
752 CONTROLVM_QUEUE_REQUEST
, &outmsg
)) {
753 LOGERR("signalinsert failed!");
759 visorchipset_save_message(CONTROLVM_MESSAGE
*msg
, CRASH_OBJ_TYPE type
)
761 u32 localSavedCrashMsgOffset
;
762 u16 localSavedCrashMsgCount
;
764 /* get saved message count */
765 if (visorchannel_read(ControlVm_channel
,
766 offsetof(ULTRA_CONTROLVM_CHANNEL_PROTOCOL
,
768 &localSavedCrashMsgCount
, sizeof(u16
)) < 0) {
769 LOGERR("failed to get Saved Message Count");
770 POSTCODE_LINUX_2(CRASH_DEV_CTRL_RD_FAILURE_PC
,
771 POSTCODE_SEVERITY_ERR
);
775 if (localSavedCrashMsgCount
!= CONTROLVM_CRASHMSG_MAX
) {
776 LOGERR("Saved Message Count incorrect %d",
777 localSavedCrashMsgCount
);
778 POSTCODE_LINUX_3(CRASH_DEV_COUNT_FAILURE_PC
,
779 localSavedCrashMsgCount
,
780 POSTCODE_SEVERITY_ERR
);
784 /* get saved crash message offset */
785 if (visorchannel_read(ControlVm_channel
,
786 offsetof(ULTRA_CONTROLVM_CHANNEL_PROTOCOL
,
787 SavedCrashMsgOffset
),
788 &localSavedCrashMsgOffset
, sizeof(u32
)) < 0) {
789 LOGERR("failed to get Saved Message Offset");
790 POSTCODE_LINUX_2(CRASH_DEV_CTRL_RD_FAILURE_PC
,
791 POSTCODE_SEVERITY_ERR
);
795 if (type
== CRASH_bus
) {
796 if (visorchannel_write(ControlVm_channel
,
797 localSavedCrashMsgOffset
,
798 msg
, sizeof(CONTROLVM_MESSAGE
)) < 0) {
799 LOGERR("SAVE_MSG_BUS_FAILURE: Failed to write CrashCreateBusMsg!");
800 POSTCODE_LINUX_2(SAVE_MSG_BUS_FAILURE_PC
,
801 POSTCODE_SEVERITY_ERR
);
805 if (visorchannel_write(ControlVm_channel
,
806 localSavedCrashMsgOffset
+
807 sizeof(CONTROLVM_MESSAGE
), msg
,
808 sizeof(CONTROLVM_MESSAGE
)) < 0) {
809 LOGERR("SAVE_MSG_DEV_FAILURE: Failed to write CrashCreateDevMsg!");
810 POSTCODE_LINUX_2(SAVE_MSG_DEV_FAILURE_PC
,
811 POSTCODE_SEVERITY_ERR
);
816 EXPORT_SYMBOL_GPL(visorchipset_save_message
);
819 bus_responder(CONTROLVM_ID cmdId
, ulong busNo
, int response
)
821 VISORCHIPSET_BUS_INFO
*p
= NULL
;
822 BOOL need_clear
= FALSE
;
824 p
= findbus(&BusInfoList
, busNo
);
826 LOGERR("internal error busNo=%lu", busNo
);
830 if ((cmdId
== CONTROLVM_BUS_CREATE
) &&
831 (response
!= (-CONTROLVM_RESP_ERROR_ALREADY_DONE
)))
832 /* undo the row we just created... */
833 delbusdevices(&DevInfoList
, busNo
);
835 if (cmdId
== CONTROLVM_BUS_CREATE
)
836 p
->state
.created
= 1;
837 if (cmdId
== CONTROLVM_BUS_DESTROY
)
841 if (p
->pendingMsgHdr
.Id
== CONTROLVM_INVALID
) {
842 LOGERR("bus_responder no pending msg");
843 return; /* no controlvm response needed */
845 if (p
->pendingMsgHdr
.Id
!= (u32
) cmdId
) {
846 LOGERR("expected=%d, found=%d", cmdId
, p
->pendingMsgHdr
.Id
);
849 controlvm_respond(&p
->pendingMsgHdr
, response
);
850 p
->pendingMsgHdr
.Id
= CONTROLVM_INVALID
;
853 delbusdevices(&DevInfoList
, busNo
);
858 device_changestate_responder(CONTROLVM_ID cmdId
,
859 ulong busNo
, ulong devNo
, int response
,
860 ULTRA_SEGMENT_STATE responseState
)
862 VISORCHIPSET_DEVICE_INFO
*p
= NULL
;
863 CONTROLVM_MESSAGE outmsg
;
865 p
= finddevice(&DevInfoList
, busNo
, devNo
);
867 LOGERR("internal error; busNo=%lu, devNo=%lu", busNo
, devNo
);
870 if (p
->pendingMsgHdr
.Id
== CONTROLVM_INVALID
) {
871 LOGERR("device_responder no pending msg");
872 return; /* no controlvm response needed */
874 if (p
->pendingMsgHdr
.Id
!= cmdId
) {
875 LOGERR("expected=%d, found=%d", cmdId
, p
->pendingMsgHdr
.Id
);
879 controlvm_init_response(&outmsg
, &p
->pendingMsgHdr
, response
);
881 outmsg
.cmd
.deviceChangeState
.busNo
= busNo
;
882 outmsg
.cmd
.deviceChangeState
.devNo
= devNo
;
883 outmsg
.cmd
.deviceChangeState
.state
= responseState
;
885 if (!visorchannel_signalinsert(ControlVm_channel
,
886 CONTROLVM_QUEUE_REQUEST
, &outmsg
)) {
887 LOGERR("signalinsert failed!");
891 p
->pendingMsgHdr
.Id
= CONTROLVM_INVALID
;
895 device_responder(CONTROLVM_ID cmdId
, ulong busNo
, ulong devNo
, int response
)
897 VISORCHIPSET_DEVICE_INFO
*p
= NULL
;
898 BOOL need_clear
= FALSE
;
900 p
= finddevice(&DevInfoList
, busNo
, devNo
);
902 LOGERR("internal error; busNo=%lu, devNo=%lu", busNo
, devNo
);
906 if (cmdId
== CONTROLVM_DEVICE_CREATE
)
907 p
->state
.created
= 1;
908 if (cmdId
== CONTROLVM_DEVICE_DESTROY
)
912 if (p
->pendingMsgHdr
.Id
== CONTROLVM_INVALID
) {
913 LOGERR("device_responder no pending msg");
914 return; /* no controlvm response needed */
916 if (p
->pendingMsgHdr
.Id
!= (u32
) cmdId
) {
917 LOGERR("expected=%d, found=%d", cmdId
, p
->pendingMsgHdr
.Id
);
920 controlvm_respond(&p
->pendingMsgHdr
, response
);
921 p
->pendingMsgHdr
.Id
= CONTROLVM_INVALID
;
927 bus_epilog(u32 busNo
,
928 u32 cmd
, CONTROLVM_MESSAGE_HEADER
*msgHdr
,
929 int response
, BOOL needResponse
)
931 BOOL notified
= FALSE
;
933 VISORCHIPSET_BUS_INFO
*pBusInfo
= findbus(&BusInfoList
, busNo
);
936 LOGERR("HUH? bad busNo=%d", busNo
);
940 memcpy(&pBusInfo
->pendingMsgHdr
, msgHdr
,
941 sizeof(CONTROLVM_MESSAGE_HEADER
));
943 pBusInfo
->pendingMsgHdr
.Id
= CONTROLVM_INVALID
;
946 if (response
== CONTROLVM_RESP_SUCCESS
) {
948 case CONTROLVM_BUS_CREATE
:
949 /* We can't tell from the bus_create
950 * information which of our 2 bus flavors the
951 * devices on this bus will ultimately end up.
952 * FORTUNATELY, it turns out it is harmless to
953 * send the bus_create to both of them. We can
954 * narrow things down a little bit, though,
955 * because we know: - BusDev_Server can handle
956 * either server or client devices
957 * - BusDev_Client can handle ONLY client
959 if (BusDev_Server_Notifiers
.bus_create
) {
960 (*BusDev_Server_Notifiers
.bus_create
) (busNo
);
963 if ((!pBusInfo
->flags
.server
) /*client */ &&
964 BusDev_Client_Notifiers
.bus_create
) {
965 (*BusDev_Client_Notifiers
.bus_create
) (busNo
);
969 case CONTROLVM_BUS_DESTROY
:
970 if (BusDev_Server_Notifiers
.bus_destroy
) {
971 (*BusDev_Server_Notifiers
.bus_destroy
) (busNo
);
974 if ((!pBusInfo
->flags
.server
) /*client */ &&
975 BusDev_Client_Notifiers
.bus_destroy
) {
976 (*BusDev_Client_Notifiers
.bus_destroy
) (busNo
);
983 /* The callback function just called above is responsible
984 * for calling the appropriate VISORCHIPSET_BUSDEV_RESPONDERS
985 * function, which will call bus_responder()
989 bus_responder(cmd
, busNo
, response
);
994 device_epilog(u32 busNo
, u32 devNo
, ULTRA_SEGMENT_STATE state
, u32 cmd
,
995 CONTROLVM_MESSAGE_HEADER
*msgHdr
, int response
,
996 BOOL needResponse
, BOOL for_visorbus
)
998 VISORCHIPSET_BUSDEV_NOTIFIERS
*notifiers
= NULL
;
999 BOOL notified
= FALSE
;
1001 VISORCHIPSET_DEVICE_INFO
*pDevInfo
=
1002 finddevice(&DevInfoList
, busNo
, devNo
);
1004 "SPARSP_DIAGPOOL_PAUSED_STATE = 1",
1009 LOGERR("HUH? bad busNo=%d, devNo=%d", busNo
, devNo
);
1013 notifiers
= &BusDev_Server_Notifiers
;
1015 notifiers
= &BusDev_Client_Notifiers
;
1017 memcpy(&pDevInfo
->pendingMsgHdr
, msgHdr
,
1018 sizeof(CONTROLVM_MESSAGE_HEADER
));
1020 pDevInfo
->pendingMsgHdr
.Id
= CONTROLVM_INVALID
;
1022 down(&NotifierLock
);
1023 if (response
>= 0) {
1025 case CONTROLVM_DEVICE_CREATE
:
1026 if (notifiers
->device_create
) {
1027 (*notifiers
->device_create
) (busNo
, devNo
);
1031 case CONTROLVM_DEVICE_CHANGESTATE
:
1032 /* ServerReady / ServerRunning / SegmentStateRunning */
1033 if (state
.Alive
== SegmentStateRunning
.Alive
&&
1034 state
.Operating
== SegmentStateRunning
.Operating
) {
1035 if (notifiers
->device_resume
) {
1036 (*notifiers
->device_resume
) (busNo
,
1041 /* ServerNotReady / ServerLost / SegmentStateStandby */
1042 else if (state
.Alive
== SegmentStateStandby
.Alive
&&
1044 SegmentStateStandby
.Operating
) {
1045 /* technically this is standby case
1046 * where server is lost
1048 if (notifiers
->device_pause
) {
1049 (*notifiers
->device_pause
) (busNo
,
1053 } else if (state
.Alive
== SegmentStatePaused
.Alive
&&
1055 SegmentStatePaused
.Operating
) {
1056 /* this is lite pause where channel is
1057 * still valid just 'pause' of it
1059 if (busNo
== g_diagpoolBusNo
1060 && devNo
== g_diagpoolDevNo
) {
1061 LOGINF("DEVICE_CHANGESTATE(DiagpoolChannel busNo=%d devNo=%d is pausing...)",
1063 /* this will trigger the
1064 * diag_shutdown.sh script in
1065 * the visorchipset hotplug */
1067 (&Visorchipset_platform_device
.dev
.
1068 kobj
, KOBJ_ONLINE
, envp
);
1072 case CONTROLVM_DEVICE_DESTROY
:
1073 if (notifiers
->device_destroy
) {
1074 (*notifiers
->device_destroy
) (busNo
, devNo
);
1081 /* The callback function just called above is responsible
1082 * for calling the appropriate VISORCHIPSET_BUSDEV_RESPONDERS
1083 * function, which will call device_responder()
1087 device_responder(cmd
, busNo
, devNo
, response
);
1092 bus_create(CONTROLVM_MESSAGE
*inmsg
)
1094 CONTROLVM_MESSAGE_PACKET
*cmd
= &inmsg
->cmd
;
1095 ulong busNo
= cmd
->createBus
.busNo
;
1096 int rc
= CONTROLVM_RESP_SUCCESS
;
1097 VISORCHIPSET_BUS_INFO
*pBusInfo
= NULL
;
1100 pBusInfo
= findbus(&BusInfoList
, busNo
);
1101 if (pBusInfo
&& (pBusInfo
->state
.created
== 1)) {
1102 LOGERR("CONTROLVM_BUS_CREATE Failed: bus %lu already exists",
1104 POSTCODE_LINUX_3(BUS_CREATE_FAILURE_PC
, busNo
,
1105 POSTCODE_SEVERITY_ERR
);
1106 rc
= -CONTROLVM_RESP_ERROR_ALREADY_DONE
;
1109 pBusInfo
= kzalloc(sizeof(VISORCHIPSET_BUS_INFO
), GFP_KERNEL
);
1110 if (pBusInfo
== NULL
) {
1111 LOGERR("CONTROLVM_BUS_CREATE Failed: bus %lu kzalloc failed",
1113 POSTCODE_LINUX_3(BUS_CREATE_FAILURE_PC
, busNo
,
1114 POSTCODE_SEVERITY_ERR
);
1115 rc
= -CONTROLVM_RESP_ERROR_KMALLOC_FAILED
;
1119 INIT_LIST_HEAD(&pBusInfo
->entry
);
1120 pBusInfo
->busNo
= busNo
;
1121 pBusInfo
->devNo
= cmd
->createBus
.deviceCount
;
1123 POSTCODE_LINUX_3(BUS_CREATE_ENTRY_PC
, busNo
, POSTCODE_SEVERITY_INFO
);
1125 if (inmsg
->hdr
.Flags
.testMessage
== 1)
1126 pBusInfo
->chanInfo
.addrType
= ADDRTYPE_localTest
;
1128 pBusInfo
->chanInfo
.addrType
= ADDRTYPE_localPhysical
;
1130 pBusInfo
->flags
.server
= inmsg
->hdr
.Flags
.server
;
1131 pBusInfo
->chanInfo
.channelAddr
= cmd
->createBus
.channelAddr
;
1132 pBusInfo
->chanInfo
.nChannelBytes
= cmd
->createBus
.channelBytes
;
1133 pBusInfo
->chanInfo
.channelTypeGuid
= cmd
->createBus
.busDataTypeGuid
;
1134 pBusInfo
->chanInfo
.channelInstGuid
= cmd
->createBus
.busInstGuid
;
1136 list_add(&pBusInfo
->entry
, &BusInfoList
);
1138 POSTCODE_LINUX_3(BUS_CREATE_EXIT_PC
, busNo
, POSTCODE_SEVERITY_INFO
);
1141 bus_epilog(busNo
, CONTROLVM_BUS_CREATE
, &inmsg
->hdr
,
1142 rc
, inmsg
->hdr
.Flags
.responseExpected
== 1);
1146 bus_destroy(CONTROLVM_MESSAGE
*inmsg
)
1148 CONTROLVM_MESSAGE_PACKET
*cmd
= &inmsg
->cmd
;
1149 ulong busNo
= cmd
->destroyBus
.busNo
;
1150 VISORCHIPSET_BUS_INFO
*pBusInfo
;
1151 int rc
= CONTROLVM_RESP_SUCCESS
;
1153 pBusInfo
= findbus(&BusInfoList
, busNo
);
1155 LOGERR("CONTROLVM_BUS_DESTROY Failed: bus %lu invalid", busNo
);
1156 rc
= -CONTROLVM_RESP_ERROR_BUS_INVALID
;
1159 if (pBusInfo
->state
.created
== 0) {
1160 LOGERR("CONTROLVM_BUS_DESTROY Failed: bus %lu already destroyed",
1162 rc
= -CONTROLVM_RESP_ERROR_ALREADY_DONE
;
1167 bus_epilog(busNo
, CONTROLVM_BUS_DESTROY
, &inmsg
->hdr
,
1168 rc
, inmsg
->hdr
.Flags
.responseExpected
== 1);
1172 bus_configure(CONTROLVM_MESSAGE
*inmsg
, PARSER_CONTEXT
*parser_ctx
)
1174 CONTROLVM_MESSAGE_PACKET
*cmd
= &inmsg
->cmd
;
1175 ulong busNo
= cmd
->configureBus
.busNo
;
1176 VISORCHIPSET_BUS_INFO
*pBusInfo
= NULL
;
1177 int rc
= CONTROLVM_RESP_SUCCESS
;
1180 busNo
= cmd
->configureBus
.busNo
;
1181 POSTCODE_LINUX_3(BUS_CONFIGURE_ENTRY_PC
, busNo
, POSTCODE_SEVERITY_INFO
);
1183 pBusInfo
= findbus(&BusInfoList
, busNo
);
1185 LOGERR("CONTROLVM_BUS_CONFIGURE Failed: bus %lu invalid",
1187 POSTCODE_LINUX_3(BUS_CONFIGURE_FAILURE_PC
, busNo
,
1188 POSTCODE_SEVERITY_ERR
);
1189 rc
= -CONTROLVM_RESP_ERROR_BUS_INVALID
;
1192 if (pBusInfo
->state
.created
== 0) {
1193 LOGERR("CONTROLVM_BUS_CONFIGURE Failed: Invalid bus %lu - not created yet",
1195 POSTCODE_LINUX_3(BUS_CONFIGURE_FAILURE_PC
, busNo
,
1196 POSTCODE_SEVERITY_ERR
);
1197 rc
= -CONTROLVM_RESP_ERROR_BUS_INVALID
;
1200 /* TBD - add this check to other commands also... */
1201 if (pBusInfo
->pendingMsgHdr
.Id
!= CONTROLVM_INVALID
) {
1202 LOGERR("CONTROLVM_BUS_CONFIGURE Failed: bus %lu MsgId=%u outstanding",
1203 busNo
, (uint
) pBusInfo
->pendingMsgHdr
.Id
);
1204 POSTCODE_LINUX_3(BUS_CONFIGURE_FAILURE_PC
, busNo
,
1205 POSTCODE_SEVERITY_ERR
);
1206 rc
= -CONTROLVM_RESP_ERROR_MESSAGE_ID_INVALID_FOR_CLIENT
;
1210 pBusInfo
->partitionHandle
= cmd
->configureBus
.guestHandle
;
1211 pBusInfo
->partitionGuid
= parser_id_get(parser_ctx
);
1212 parser_param_start(parser_ctx
, PARSERSTRING_NAME
);
1213 pBusInfo
->name
= parser_string_get(parser_ctx
);
1215 visorchannel_uuid_id(&pBusInfo
->partitionGuid
, s
);
1216 POSTCODE_LINUX_3(BUS_CONFIGURE_EXIT_PC
, busNo
, POSTCODE_SEVERITY_INFO
);
1218 bus_epilog(busNo
, CONTROLVM_BUS_CONFIGURE
, &inmsg
->hdr
,
1219 rc
, inmsg
->hdr
.Flags
.responseExpected
== 1);
1223 my_device_create(CONTROLVM_MESSAGE
*inmsg
)
1225 CONTROLVM_MESSAGE_PACKET
*cmd
= &inmsg
->cmd
;
1226 ulong busNo
= cmd
->createDevice
.busNo
;
1227 ulong devNo
= cmd
->createDevice
.devNo
;
1228 VISORCHIPSET_DEVICE_INFO
*pDevInfo
= NULL
;
1229 VISORCHIPSET_BUS_INFO
*pBusInfo
= NULL
;
1230 int rc
= CONTROLVM_RESP_SUCCESS
;
1232 pDevInfo
= finddevice(&DevInfoList
, busNo
, devNo
);
1233 if (pDevInfo
&& (pDevInfo
->state
.created
== 1)) {
1234 LOGERR("CONTROLVM_DEVICE_CREATE Failed: busNo=%lu, devNo=%lu already exists",
1236 POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC
, devNo
, busNo
,
1237 POSTCODE_SEVERITY_ERR
);
1238 rc
= -CONTROLVM_RESP_ERROR_ALREADY_DONE
;
1241 pBusInfo
= findbus(&BusInfoList
, busNo
);
1243 LOGERR("CONTROLVM_DEVICE_CREATE Failed: Invalid bus %lu - out of range",
1245 POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC
, devNo
, busNo
,
1246 POSTCODE_SEVERITY_ERR
);
1247 rc
= -CONTROLVM_RESP_ERROR_BUS_INVALID
;
1250 if (pBusInfo
->state
.created
== 0) {
1251 LOGERR("CONTROLVM_DEVICE_CREATE Failed: Invalid bus %lu - not created yet",
1253 POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC
, devNo
, busNo
,
1254 POSTCODE_SEVERITY_ERR
);
1255 rc
= -CONTROLVM_RESP_ERROR_BUS_INVALID
;
1258 pDevInfo
= kzalloc(sizeof(VISORCHIPSET_DEVICE_INFO
), GFP_KERNEL
);
1259 if (pDevInfo
== NULL
) {
1260 LOGERR("CONTROLVM_DEVICE_CREATE Failed: busNo=%lu, devNo=%lu kmaloc failed",
1262 POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC
, devNo
, busNo
,
1263 POSTCODE_SEVERITY_ERR
);
1264 rc
= -CONTROLVM_RESP_ERROR_KMALLOC_FAILED
;
1268 INIT_LIST_HEAD(&pDevInfo
->entry
);
1269 pDevInfo
->busNo
= busNo
;
1270 pDevInfo
->devNo
= devNo
;
1271 pDevInfo
->devInstGuid
= cmd
->createDevice
.devInstGuid
;
1272 POSTCODE_LINUX_4(DEVICE_CREATE_ENTRY_PC
, devNo
, busNo
,
1273 POSTCODE_SEVERITY_INFO
);
1275 if (inmsg
->hdr
.Flags
.testMessage
== 1)
1276 pDevInfo
->chanInfo
.addrType
= ADDRTYPE_localTest
;
1278 pDevInfo
->chanInfo
.addrType
= ADDRTYPE_localPhysical
;
1279 pDevInfo
->chanInfo
.channelAddr
= cmd
->createDevice
.channelAddr
;
1280 pDevInfo
->chanInfo
.nChannelBytes
= cmd
->createDevice
.channelBytes
;
1281 pDevInfo
->chanInfo
.channelTypeGuid
= cmd
->createDevice
.dataTypeGuid
;
1282 pDevInfo
->chanInfo
.intr
= cmd
->createDevice
.intr
;
1283 list_add(&pDevInfo
->entry
, &DevInfoList
);
1284 POSTCODE_LINUX_4(DEVICE_CREATE_EXIT_PC
, devNo
, busNo
,
1285 POSTCODE_SEVERITY_INFO
);
1287 /* get the bus and devNo for DiagPool channel */
1288 if (is_diagpool_channel(pDevInfo
->chanInfo
.channelTypeGuid
)) {
1289 g_diagpoolBusNo
= busNo
;
1290 g_diagpoolDevNo
= devNo
;
1291 LOGINF("CONTROLVM_DEVICE_CREATE for DiagPool channel: busNo=%lu, devNo=%lu",
1292 g_diagpoolBusNo
, g_diagpoolDevNo
);
1294 device_epilog(busNo
, devNo
, SegmentStateRunning
,
1295 CONTROLVM_DEVICE_CREATE
, &inmsg
->hdr
, rc
,
1296 inmsg
->hdr
.Flags
.responseExpected
== 1,
1297 FOR_VISORBUS(pDevInfo
->chanInfo
.channelTypeGuid
));
1301 my_device_changestate(CONTROLVM_MESSAGE
*inmsg
)
1303 CONTROLVM_MESSAGE_PACKET
*cmd
= &inmsg
->cmd
;
1304 ulong busNo
= cmd
->deviceChangeState
.busNo
;
1305 ulong devNo
= cmd
->deviceChangeState
.devNo
;
1306 ULTRA_SEGMENT_STATE state
= cmd
->deviceChangeState
.state
;
1307 VISORCHIPSET_DEVICE_INFO
*pDevInfo
= NULL
;
1308 int rc
= CONTROLVM_RESP_SUCCESS
;
1310 pDevInfo
= finddevice(&DevInfoList
, busNo
, devNo
);
1312 LOGERR("CONTROLVM_DEVICE_CHANGESTATE Failed: busNo=%lu, devNo=%lu invalid (doesn't exist)",
1314 POSTCODE_LINUX_4(DEVICE_CHANGESTATE_FAILURE_PC
, devNo
, busNo
,
1315 POSTCODE_SEVERITY_ERR
);
1316 rc
= -CONTROLVM_RESP_ERROR_DEVICE_INVALID
;
1319 if (pDevInfo
->state
.created
== 0) {
1320 LOGERR("CONTROLVM_DEVICE_CHANGESTATE Failed: busNo=%lu, devNo=%lu invalid (not created)",
1322 POSTCODE_LINUX_4(DEVICE_CHANGESTATE_FAILURE_PC
, devNo
, busNo
,
1323 POSTCODE_SEVERITY_ERR
);
1324 rc
= -CONTROLVM_RESP_ERROR_DEVICE_INVALID
;
1327 if ((rc
>= CONTROLVM_RESP_SUCCESS
) && pDevInfo
)
1328 device_epilog(busNo
, devNo
, state
, CONTROLVM_DEVICE_CHANGESTATE
,
1330 inmsg
->hdr
.Flags
.responseExpected
== 1,
1331 FOR_VISORBUS(pDevInfo
->chanInfo
.channelTypeGuid
));
1335 my_device_destroy(CONTROLVM_MESSAGE
*inmsg
)
1337 CONTROLVM_MESSAGE_PACKET
*cmd
= &inmsg
->cmd
;
1338 ulong busNo
= cmd
->destroyDevice
.busNo
;
1339 ulong devNo
= cmd
->destroyDevice
.devNo
;
1340 VISORCHIPSET_DEVICE_INFO
*pDevInfo
= NULL
;
1341 int rc
= CONTROLVM_RESP_SUCCESS
;
1343 pDevInfo
= finddevice(&DevInfoList
, busNo
, devNo
);
1345 LOGERR("CONTROLVM_DEVICE_DESTROY Failed: busNo=%lu, devNo=%lu invalid",
1347 rc
= -CONTROLVM_RESP_ERROR_DEVICE_INVALID
;
1350 if (pDevInfo
->state
.created
== 0) {
1351 LOGERR("CONTROLVM_DEVICE_DESTROY Failed: busNo=%lu, devNo=%lu already destroyed",
1353 rc
= -CONTROLVM_RESP_ERROR_ALREADY_DONE
;
1357 if ((rc
>= CONTROLVM_RESP_SUCCESS
) && pDevInfo
)
1358 device_epilog(busNo
, devNo
, SegmentStateRunning
,
1359 CONTROLVM_DEVICE_DESTROY
, &inmsg
->hdr
, rc
,
1360 inmsg
->hdr
.Flags
.responseExpected
== 1,
1361 FOR_VISORBUS(pDevInfo
->chanInfo
.channelTypeGuid
));
1364 /* When provided with the physical address of the controlvm channel
1365 * (phys_addr), the offset to the payload area we need to manage
1366 * (offset), and the size of this payload area (bytes), fills in the
1367 * CONTROLVM_PAYLOAD_INFO struct. Returns TRUE for success or FALSE
1371 initialize_controlvm_payload_info(HOSTADDRESS phys_addr
, u64 offset
, u32 bytes
,
1372 CONTROLVM_PAYLOAD_INFO
*info
)
1374 u8 __iomem
*payload
= NULL
;
1375 int rc
= CONTROLVM_RESP_SUCCESS
;
1378 LOGERR("HUH ? CONTROLVM_PAYLOAD_INIT Failed : Programmer check at %s:%d",
1379 __FILE__
, __LINE__
);
1380 rc
= -CONTROLVM_RESP_ERROR_PAYLOAD_INVALID
;
1383 memset(info
, 0, sizeof(CONTROLVM_PAYLOAD_INFO
));
1384 if ((offset
== 0) || (bytes
== 0)) {
1385 LOGERR("CONTROLVM_PAYLOAD_INIT Failed: RequestPayloadOffset=%llu RequestPayloadBytes=%llu!",
1386 (u64
) offset
, (u64
) bytes
);
1387 rc
= -CONTROLVM_RESP_ERROR_PAYLOAD_INVALID
;
1390 payload
= ioremap_cache(phys_addr
+ offset
, bytes
);
1391 if (payload
== NULL
) {
1392 LOGERR("CONTROLVM_PAYLOAD_INIT Failed: ioremap_cache %llu for %llu bytes failed",
1393 (u64
) offset
, (u64
) bytes
);
1394 rc
= -CONTROLVM_RESP_ERROR_IOREMAP_FAILED
;
1398 info
->offset
= offset
;
1399 info
->bytes
= bytes
;
1400 info
->ptr
= payload
;
1401 LOGINF("offset=%llu, bytes=%lu, ptr=%p",
1402 (u64
) (info
->offset
), (ulong
) (info
->bytes
), info
->ptr
);
1406 if (payload
!= NULL
) {
1415 destroy_controlvm_payload_info(CONTROLVM_PAYLOAD_INFO
*info
)
1417 if (info
->ptr
!= NULL
) {
1421 memset(info
, 0, sizeof(CONTROLVM_PAYLOAD_INFO
));
1425 initialize_controlvm_payload(void)
1427 HOSTADDRESS phys_addr
= visorchannel_get_physaddr(ControlVm_channel
);
1428 u64 payloadOffset
= 0;
1429 u32 payloadBytes
= 0;
1431 if (visorchannel_read(ControlVm_channel
,
1432 offsetof(ULTRA_CONTROLVM_CHANNEL_PROTOCOL
,
1433 RequestPayloadOffset
),
1434 &payloadOffset
, sizeof(payloadOffset
)) < 0) {
1435 LOGERR("CONTROLVM_PAYLOAD_INIT Failed to read controlvm channel!");
1436 POSTCODE_LINUX_2(CONTROLVM_INIT_FAILURE_PC
,
1437 POSTCODE_SEVERITY_ERR
);
1440 if (visorchannel_read(ControlVm_channel
,
1441 offsetof(ULTRA_CONTROLVM_CHANNEL_PROTOCOL
,
1442 RequestPayloadBytes
),
1443 &payloadBytes
, sizeof(payloadBytes
)) < 0) {
1444 LOGERR("CONTROLVM_PAYLOAD_INIT Failed to read controlvm channel!");
1445 POSTCODE_LINUX_2(CONTROLVM_INIT_FAILURE_PC
,
1446 POSTCODE_SEVERITY_ERR
);
1449 initialize_controlvm_payload_info(phys_addr
,
1450 payloadOffset
, payloadBytes
,
1451 &ControlVm_payload_info
);
1454 /* Send ACTION=online for DEVPATH=/sys/devices/platform/visorchipset.
1455 * Returns CONTROLVM_RESP_xxx code.
1458 visorchipset_chipset_ready(void)
1460 kobject_uevent(&Visorchipset_platform_device
.dev
.kobj
, KOBJ_ONLINE
);
1461 return CONTROLVM_RESP_SUCCESS
;
1463 EXPORT_SYMBOL_GPL(visorchipset_chipset_ready
);
1466 visorchipset_chipset_selftest(void)
1468 char env_selftest
[20];
1469 char *envp
[] = { env_selftest
, NULL
};
1471 sprintf(env_selftest
, "SPARSP_SELFTEST=%d", 1);
1472 kobject_uevent_env(&Visorchipset_platform_device
.dev
.kobj
, KOBJ_CHANGE
,
1474 return CONTROLVM_RESP_SUCCESS
;
1476 EXPORT_SYMBOL_GPL(visorchipset_chipset_selftest
);
1478 /* Send ACTION=offline for DEVPATH=/sys/devices/platform/visorchipset.
1479 * Returns CONTROLVM_RESP_xxx code.
1482 visorchipset_chipset_notready(void)
1484 kobject_uevent(&Visorchipset_platform_device
.dev
.kobj
, KOBJ_OFFLINE
);
1485 return CONTROLVM_RESP_SUCCESS
;
1487 EXPORT_SYMBOL_GPL(visorchipset_chipset_notready
);
1490 chipset_ready(CONTROLVM_MESSAGE_HEADER
*msgHdr
)
1492 int rc
= visorchipset_chipset_ready();
1494 if (rc
!= CONTROLVM_RESP_SUCCESS
)
1496 if (msgHdr
->Flags
.responseExpected
&& !visorchipset_holdchipsetready
)
1497 controlvm_respond(msgHdr
, rc
);
1498 if (msgHdr
->Flags
.responseExpected
&& visorchipset_holdchipsetready
) {
1499 /* Send CHIPSET_READY response when all modules have been loaded
1500 * and disks mounted for the partition
1502 g_ChipSetMsgHdr
= *msgHdr
;
1503 LOGINF("Holding CHIPSET_READY response");
1508 chipset_selftest(CONTROLVM_MESSAGE_HEADER
*msgHdr
)
1510 int rc
= visorchipset_chipset_selftest();
1512 if (rc
!= CONTROLVM_RESP_SUCCESS
)
1514 if (msgHdr
->Flags
.responseExpected
)
1515 controlvm_respond(msgHdr
, rc
);
1519 chipset_notready(CONTROLVM_MESSAGE_HEADER
*msgHdr
)
1521 int rc
= visorchipset_chipset_notready();
1523 if (rc
!= CONTROLVM_RESP_SUCCESS
)
1525 if (msgHdr
->Flags
.responseExpected
)
1526 controlvm_respond(msgHdr
, rc
);
1529 /* This is your "one-stop" shop for grabbing the next message from the
1530 * CONTROLVM_QUEUE_EVENT queue in the controlvm channel.
1533 read_controlvm_event(CONTROLVM_MESSAGE
*msg
)
1535 if (visorchannel_signalremove(ControlVm_channel
,
1536 CONTROLVM_QUEUE_EVENT
, msg
)) {
1538 if (msg
->hdr
.Flags
.testMessage
== 1) {
1539 LOGERR("ignoring bad CONTROLVM_QUEUE_EVENT msg with controlvm_msg_id=0x%x because Flags.testMessage is nonsensical (=1)", msg
->hdr
.Id
);
1548 * The general parahotplug flow works as follows. The visorchipset
1549 * driver receives a DEVICE_CHANGESTATE message from Command
1550 * specifying a physical device to enable or disable. The CONTROLVM
1551 * message handler calls parahotplug_process_message, which then adds
1552 * the message to a global list and kicks off a udev event which
1553 * causes a user level script to enable or disable the specified
1554 * device. The udev script then writes to
1555 * /proc/visorchipset/parahotplug, which causes parahotplug_proc_write
1556 * to get called, at which point the appropriate CONTROLVM message is
1557 * retrieved from the list and responded to.
1560 #define PARAHOTPLUG_TIMEOUT_MS 2000
1563 * Generate unique int to match an outstanding CONTROLVM message with a
1564 * udev script /proc response
1567 parahotplug_next_id(void)
1569 static atomic_t id
= ATOMIC_INIT(0);
1571 return atomic_inc_return(&id
);
1575 * Returns the time (in jiffies) when a CONTROLVM message on the list
1576 * should expire -- PARAHOTPLUG_TIMEOUT_MS in the future
1578 static unsigned long
1579 parahotplug_next_expiration(void)
1581 return jiffies
+ PARAHOTPLUG_TIMEOUT_MS
* HZ
/ 1000;
1585 * Create a parahotplug_request, which is basically a wrapper for a
1586 * CONTROLVM_MESSAGE that we can stick on a list
1588 static struct parahotplug_request
*
1589 parahotplug_request_create(CONTROLVM_MESSAGE
*msg
)
1591 struct parahotplug_request
*req
=
1592 kmalloc(sizeof(struct parahotplug_request
),
1593 GFP_KERNEL
|__GFP_NORETRY
);
1597 req
->id
= parahotplug_next_id();
1598 req
->expiration
= parahotplug_next_expiration();
1605 * Free a parahotplug_request.
1608 parahotplug_request_destroy(struct parahotplug_request
*req
)
1614 * Cause uevent to run the user level script to do the disable/enable
1615 * specified in (the CONTROLVM message in) the specified
1616 * parahotplug_request
1619 parahotplug_request_kickoff(struct parahotplug_request
*req
)
1621 CONTROLVM_MESSAGE_PACKET
*cmd
= &req
->msg
.cmd
;
1622 char env_cmd
[40], env_id
[40], env_state
[40], env_bus
[40], env_dev
[40],
1625 env_cmd
, env_id
, env_state
, env_bus
, env_dev
, env_func
, NULL
1628 sprintf(env_cmd
, "SPAR_PARAHOTPLUG=1");
1629 sprintf(env_id
, "SPAR_PARAHOTPLUG_ID=%d", req
->id
);
1630 sprintf(env_state
, "SPAR_PARAHOTPLUG_STATE=%d",
1631 cmd
->deviceChangeState
.state
.Active
);
1632 sprintf(env_bus
, "SPAR_PARAHOTPLUG_BUS=%d",
1633 cmd
->deviceChangeState
.busNo
);
1634 sprintf(env_dev
, "SPAR_PARAHOTPLUG_DEVICE=%d",
1635 cmd
->deviceChangeState
.devNo
>> 3);
1636 sprintf(env_func
, "SPAR_PARAHOTPLUG_FUNCTION=%d",
1637 cmd
->deviceChangeState
.devNo
& 0x7);
1639 LOGINF("parahotplug_request_kickoff: state=%d, bdf=%d/%d/%d, id=%u\n",
1640 cmd
->deviceChangeState
.state
.Active
,
1641 cmd
->deviceChangeState
.busNo
, cmd
->deviceChangeState
.devNo
>> 3,
1642 cmd
->deviceChangeState
.devNo
& 7, req
->id
);
1644 kobject_uevent_env(&Visorchipset_platform_device
.dev
.kobj
, KOBJ_CHANGE
,
1649 * Remove any request from the list that's been on there too long and
1650 * respond with an error.
1653 parahotplug_process_list(void)
1655 struct list_head
*pos
= NULL
;
1656 struct list_head
*tmp
= NULL
;
1658 spin_lock(&Parahotplug_request_list_lock
);
1660 list_for_each_safe(pos
, tmp
, &Parahotplug_request_list
) {
1661 struct parahotplug_request
*req
=
1662 list_entry(pos
, struct parahotplug_request
, list
);
1663 if (time_after_eq(jiffies
, req
->expiration
)) {
1665 if (req
->msg
.hdr
.Flags
.responseExpected
)
1666 controlvm_respond_physdev_changestate(
1668 CONTROLVM_RESP_ERROR_DEVICE_UDEV_TIMEOUT
,
1669 req
->msg
.cmd
.deviceChangeState
.state
);
1670 parahotplug_request_destroy(req
);
1674 spin_unlock(&Parahotplug_request_list_lock
);
1678 * Called from the /proc handler, which means the user script has
1679 * finished the enable/disable. Find the matching identifier, and
1680 * respond to the CONTROLVM message with success.
1683 parahotplug_request_complete(int id
, u16 active
)
1685 struct list_head
*pos
= NULL
;
1686 struct list_head
*tmp
= NULL
;
1688 spin_lock(&Parahotplug_request_list_lock
);
1690 /* Look for a request matching "id". */
1691 list_for_each_safe(pos
, tmp
, &Parahotplug_request_list
) {
1692 struct parahotplug_request
*req
=
1693 list_entry(pos
, struct parahotplug_request
, list
);
1694 if (req
->id
== id
) {
1695 /* Found a match. Remove it from the list and
1699 spin_unlock(&Parahotplug_request_list_lock
);
1700 req
->msg
.cmd
.deviceChangeState
.state
.Active
= active
;
1701 if (req
->msg
.hdr
.Flags
.responseExpected
)
1702 controlvm_respond_physdev_changestate(
1703 &req
->msg
.hdr
, CONTROLVM_RESP_SUCCESS
,
1704 req
->msg
.cmd
.deviceChangeState
.state
);
1705 parahotplug_request_destroy(req
);
1710 spin_unlock(&Parahotplug_request_list_lock
);
1715 * Enables or disables a PCI device by kicking off a udev script
1718 parahotplug_process_message(CONTROLVM_MESSAGE
*inmsg
)
1720 struct parahotplug_request
*req
;
1722 req
= parahotplug_request_create(inmsg
);
1725 LOGERR("parahotplug_process_message: couldn't allocate request");
1729 if (inmsg
->cmd
.deviceChangeState
.state
.Active
) {
1730 /* For enable messages, just respond with success
1731 * right away. This is a bit of a hack, but there are
1732 * issues with the early enable messages we get (with
1733 * either the udev script not detecting that the device
1734 * is up, or not getting called at all). Fortunately
1735 * the messages that get lost don't matter anyway, as
1736 * devices are automatically enabled at
1739 parahotplug_request_kickoff(req
);
1740 controlvm_respond_physdev_changestate(&inmsg
->hdr
,
1741 CONTROLVM_RESP_SUCCESS
,
1743 deviceChangeState
.state
);
1744 parahotplug_request_destroy(req
);
1746 /* For disable messages, add the request to the
1747 * request list before kicking off the udev script. It
1748 * won't get responded to until the script has
1749 * indicated it's done.
1751 spin_lock(&Parahotplug_request_list_lock
);
1752 list_add_tail(&(req
->list
), &Parahotplug_request_list
);
1753 spin_unlock(&Parahotplug_request_list_lock
);
1755 parahotplug_request_kickoff(req
);
1759 /* Process a controlvm message.
1761 * FALSE - this function will return FALSE only in the case where the
1762 * controlvm message was NOT processed, but processing must be
1763 * retried before reading the next controlvm message; a
1764 * scenario where this can occur is when we need to throttle
1765 * the allocation of memory in which to copy out controlvm
1767 * TRUE - processing of the controlvm message completed,
1768 * either successfully or with an error.
1771 handle_command(CONTROLVM_MESSAGE inmsg
, HOSTADDRESS channel_addr
)
1773 CONTROLVM_MESSAGE_PACKET
*cmd
= &inmsg
.cmd
;
1774 u64 parametersAddr
= 0;
1775 u32 parametersBytes
= 0;
1776 PARSER_CONTEXT
*parser_ctx
= NULL
;
1777 BOOL isLocalAddr
= FALSE
;
1778 CONTROLVM_MESSAGE ackmsg
;
1780 /* create parsing context if necessary */
1781 isLocalAddr
= (inmsg
.hdr
.Flags
.testMessage
== 1);
1782 if (channel_addr
== 0) {
1783 LOGERR("HUH? channel_addr is 0!");
1786 parametersAddr
= channel_addr
+ inmsg
.hdr
.PayloadVmOffset
;
1787 parametersBytes
= inmsg
.hdr
.PayloadBytes
;
1789 /* Parameter and channel addresses within test messages actually lie
1790 * within our OS-controlled memory. We need to know that, because it
1791 * makes a difference in how we compute the virtual address.
1793 if (parametersAddr
!= 0 && parametersBytes
!= 0) {
1797 parser_init_byteStream(parametersAddr
, parametersBytes
,
1798 isLocalAddr
, &retry
);
1801 LOGWRN("throttling to copy payload");
1804 LOGWRN("parsing failed");
1805 LOGWRN("inmsg.hdr.Id=0x%lx", (ulong
) inmsg
.hdr
.Id
);
1806 LOGWRN("parametersAddr=0x%llx", (u64
) parametersAddr
);
1807 LOGWRN("parametersBytes=%lu", (ulong
) parametersBytes
);
1808 LOGWRN("isLocalAddr=%d", isLocalAddr
);
1813 controlvm_init_response(&ackmsg
, &inmsg
.hdr
,
1814 CONTROLVM_RESP_SUCCESS
);
1815 if ((ControlVm_channel
)
1817 (!visorchannel_signalinsert
1818 (ControlVm_channel
, CONTROLVM_QUEUE_ACK
, &ackmsg
)))
1819 LOGWRN("failed to send ACK failed");
1821 switch (inmsg
.hdr
.Id
) {
1822 case CONTROLVM_CHIPSET_INIT
:
1823 LOGINF("CHIPSET_INIT(#busses=%lu,#switches=%lu)",
1824 (ulong
) inmsg
.cmd
.initChipset
.busCount
,
1825 (ulong
) inmsg
.cmd
.initChipset
.switchCount
);
1826 chipset_init(&inmsg
);
1828 case CONTROLVM_BUS_CREATE
:
1829 LOGINF("BUS_CREATE(%lu,#devs=%lu)",
1830 (ulong
) cmd
->createBus
.busNo
,
1831 (ulong
) cmd
->createBus
.deviceCount
);
1834 case CONTROLVM_BUS_DESTROY
:
1835 LOGINF("BUS_DESTROY(%lu)", (ulong
) cmd
->destroyBus
.busNo
);
1836 bus_destroy(&inmsg
);
1838 case CONTROLVM_BUS_CONFIGURE
:
1839 LOGINF("BUS_CONFIGURE(%lu)", (ulong
) cmd
->configureBus
.busNo
);
1840 bus_configure(&inmsg
, parser_ctx
);
1842 case CONTROLVM_DEVICE_CREATE
:
1843 LOGINF("DEVICE_CREATE(%lu,%lu)",
1844 (ulong
) cmd
->createDevice
.busNo
,
1845 (ulong
) cmd
->createDevice
.devNo
);
1846 my_device_create(&inmsg
);
1848 case CONTROLVM_DEVICE_CHANGESTATE
:
1849 if (cmd
->deviceChangeState
.flags
.physicalDevice
) {
1850 LOGINF("DEVICE_CHANGESTATE for physical device (%lu,%lu, active=%lu)",
1851 (ulong
) cmd
->deviceChangeState
.busNo
,
1852 (ulong
) cmd
->deviceChangeState
.devNo
,
1853 (ulong
) cmd
->deviceChangeState
.state
.Active
);
1854 parahotplug_process_message(&inmsg
);
1856 LOGINF("DEVICE_CHANGESTATE for virtual device (%lu,%lu, state.Alive=0x%lx)",
1857 (ulong
) cmd
->deviceChangeState
.busNo
,
1858 (ulong
) cmd
->deviceChangeState
.devNo
,
1859 (ulong
) cmd
->deviceChangeState
.state
.Alive
);
1860 /* save the hdr and cmd structures for later use */
1861 /* when sending back the response to Command */
1862 my_device_changestate(&inmsg
);
1863 g_DiagMsgHdr
= inmsg
.hdr
;
1864 g_DeviceChangeStatePacket
= inmsg
.cmd
;
1868 case CONTROLVM_DEVICE_DESTROY
:
1869 LOGINF("DEVICE_DESTROY(%lu,%lu)",
1870 (ulong
) cmd
->destroyDevice
.busNo
,
1871 (ulong
) cmd
->destroyDevice
.devNo
);
1872 my_device_destroy(&inmsg
);
1874 case CONTROLVM_DEVICE_CONFIGURE
:
1875 LOGINF("DEVICE_CONFIGURE(%lu,%lu)",
1876 (ulong
) cmd
->configureDevice
.busNo
,
1877 (ulong
) cmd
->configureDevice
.devNo
);
1878 /* no op for now, just send a respond that we passed */
1879 if (inmsg
.hdr
.Flags
.responseExpected
)
1880 controlvm_respond(&inmsg
.hdr
, CONTROLVM_RESP_SUCCESS
);
1882 case CONTROLVM_CHIPSET_READY
:
1883 LOGINF("CHIPSET_READY");
1884 chipset_ready(&inmsg
.hdr
);
1886 case CONTROLVM_CHIPSET_SELFTEST
:
1887 LOGINF("CHIPSET_SELFTEST");
1888 chipset_selftest(&inmsg
.hdr
);
1890 case CONTROLVM_CHIPSET_STOP
:
1891 LOGINF("CHIPSET_STOP");
1892 chipset_notready(&inmsg
.hdr
);
1895 LOGERR("unrecognized controlvm cmd=%d", (int) inmsg
.hdr
.Id
);
1896 if (inmsg
.hdr
.Flags
.responseExpected
)
1897 controlvm_respond(&inmsg
.hdr
,
1898 -CONTROLVM_RESP_ERROR_MESSAGE_ID_UNKNOWN
);
1902 if (parser_ctx
!= NULL
) {
1903 parser_done(parser_ctx
);
1909 static HOSTADDRESS
controlvm_get_channel_address(void)
1914 if (!VMCALL_SUCCESSFUL(issue_vmcall_io_controlvm_addr(&addr
, &size
))) {
1915 ERRDRV("%s - vmcall to determine controlvm channel addr failed",
1919 INFODRV("controlvm addr=%Lx", addr
);
1924 controlvm_periodic_work(struct work_struct
*work
)
1926 VISORCHIPSET_CHANNEL_INFO chanInfo
;
1927 CONTROLVM_MESSAGE inmsg
;
1928 BOOL gotACommand
= FALSE
;
1929 BOOL handle_command_failed
= FALSE
;
1930 static u64 Poll_Count
;
1932 /* make sure visorbus server is registered for controlvm callbacks */
1933 if (visorchipset_serverregwait
&& !serverregistered
)
1935 /* make sure visorclientbus server is regsitered for controlvm
1938 if (visorchipset_clientregwait
&& !clientregistered
)
1941 memset(&chanInfo
, 0, sizeof(VISORCHIPSET_CHANNEL_INFO
));
1944 if (Poll_Count
>= 250)
1949 /* Check events to determine if response to CHIPSET_READY
1952 if (visorchipset_holdchipsetready
1953 && (g_ChipSetMsgHdr
.Id
!= CONTROLVM_INVALID
)) {
1954 if (check_chipset_events() == 1) {
1955 LOGINF("Sending CHIPSET_READY response");
1956 controlvm_respond(&g_ChipSetMsgHdr
, 0);
1957 clear_chipset_events();
1958 memset(&g_ChipSetMsgHdr
, 0,
1959 sizeof(CONTROLVM_MESSAGE_HEADER
));
1963 while (visorchannel_signalremove(ControlVm_channel
,
1964 CONTROLVM_QUEUE_RESPONSE
,
1966 if (inmsg
.hdr
.PayloadMaxBytes
!= 0) {
1967 LOGERR("Payload of size %lu returned @%lu with unexpected message id %d.",
1968 (ulong
) inmsg
.hdr
.PayloadMaxBytes
,
1969 (ulong
) inmsg
.hdr
.PayloadVmOffset
,
1974 if (ControlVm_Pending_Msg_Valid
) {
1975 /* we throttled processing of a prior
1976 * msg, so try to process it again
1977 * rather than reading a new one
1979 inmsg
= ControlVm_Pending_Msg
;
1980 ControlVm_Pending_Msg_Valid
= FALSE
;
1983 gotACommand
= read_controlvm_event(&inmsg
);
1986 handle_command_failed
= FALSE
;
1987 while (gotACommand
&& (!handle_command_failed
)) {
1988 Most_recent_message_jiffies
= jiffies
;
1989 if (handle_command(inmsg
,
1990 visorchannel_get_physaddr
1991 (ControlVm_channel
)))
1992 gotACommand
= read_controlvm_event(&inmsg
);
1994 /* this is a scenario where throttling
1995 * is required, but probably NOT an
1996 * error...; we stash the current
1997 * controlvm msg so we will attempt to
1998 * reprocess it on our next loop
2000 handle_command_failed
= TRUE
;
2001 ControlVm_Pending_Msg
= inmsg
;
2002 ControlVm_Pending_Msg_Valid
= TRUE
;
2006 /* parahotplug_worker */
2007 parahotplug_process_list();
2011 if (time_after(jiffies
,
2012 Most_recent_message_jiffies
+ (HZ
* MIN_IDLE_SECONDS
))) {
2013 /* it's been longer than MIN_IDLE_SECONDS since we
2014 * processed our last controlvm message; slow down the
2017 if (Poll_jiffies
!= POLLJIFFIES_CONTROLVMCHANNEL_SLOW
) {
2018 LOGINF("switched to slow controlvm polling");
2019 Poll_jiffies
= POLLJIFFIES_CONTROLVMCHANNEL_SLOW
;
2022 if (Poll_jiffies
!= POLLJIFFIES_CONTROLVMCHANNEL_FAST
) {
2023 Poll_jiffies
= POLLJIFFIES_CONTROLVMCHANNEL_FAST
;
2024 LOGINF("switched to fast controlvm polling");
2028 queue_delayed_work(Periodic_controlvm_workqueue
,
2029 &Periodic_controlvm_work
, Poll_jiffies
);
2033 setup_crash_devices_work_queue(struct work_struct
*work
)
2036 CONTROLVM_MESSAGE localCrashCreateBusMsg
;
2037 CONTROLVM_MESSAGE localCrashCreateDevMsg
;
2038 CONTROLVM_MESSAGE msg
;
2039 u32 localSavedCrashMsgOffset
;
2040 u16 localSavedCrashMsgCount
;
2042 /* make sure visorbus server is registered for controlvm callbacks */
2043 if (visorchipset_serverregwait
&& !serverregistered
)
2046 /* make sure visorclientbus server is regsitered for controlvm
2049 if (visorchipset_clientregwait
&& !clientregistered
)
2052 POSTCODE_LINUX_2(CRASH_DEV_ENTRY_PC
, POSTCODE_SEVERITY_INFO
);
2054 /* send init chipset msg */
2055 msg
.hdr
.Id
= CONTROLVM_CHIPSET_INIT
;
2056 msg
.cmd
.initChipset
.busCount
= 23;
2057 msg
.cmd
.initChipset
.switchCount
= 0;
2061 /* get saved message count */
2062 if (visorchannel_read(ControlVm_channel
,
2063 offsetof(ULTRA_CONTROLVM_CHANNEL_PROTOCOL
,
2064 SavedCrashMsgCount
),
2065 &localSavedCrashMsgCount
, sizeof(u16
)) < 0) {
2066 LOGERR("failed to get Saved Message Count");
2067 POSTCODE_LINUX_2(CRASH_DEV_CTRL_RD_FAILURE_PC
,
2068 POSTCODE_SEVERITY_ERR
);
2072 if (localSavedCrashMsgCount
!= CONTROLVM_CRASHMSG_MAX
) {
2073 LOGERR("Saved Message Count incorrect %d",
2074 localSavedCrashMsgCount
);
2075 POSTCODE_LINUX_3(CRASH_DEV_COUNT_FAILURE_PC
,
2076 localSavedCrashMsgCount
,
2077 POSTCODE_SEVERITY_ERR
);
2081 /* get saved crash message offset */
2082 if (visorchannel_read(ControlVm_channel
,
2083 offsetof(ULTRA_CONTROLVM_CHANNEL_PROTOCOL
,
2084 SavedCrashMsgOffset
),
2085 &localSavedCrashMsgOffset
, sizeof(u32
)) < 0) {
2086 LOGERR("failed to get Saved Message Offset");
2087 POSTCODE_LINUX_2(CRASH_DEV_CTRL_RD_FAILURE_PC
,
2088 POSTCODE_SEVERITY_ERR
);
2092 /* read create device message for storage bus offset */
2093 if (visorchannel_read(ControlVm_channel
,
2094 localSavedCrashMsgOffset
,
2095 &localCrashCreateBusMsg
,
2096 sizeof(CONTROLVM_MESSAGE
)) < 0) {
2097 LOGERR("CRASH_DEV_RD_BUS_FAIULRE: Failed to read CrashCreateBusMsg!");
2098 POSTCODE_LINUX_2(CRASH_DEV_RD_BUS_FAIULRE_PC
,
2099 POSTCODE_SEVERITY_ERR
);
2103 /* read create device message for storage device */
2104 if (visorchannel_read(ControlVm_channel
,
2105 localSavedCrashMsgOffset
+
2106 sizeof(CONTROLVM_MESSAGE
),
2107 &localCrashCreateDevMsg
,
2108 sizeof(CONTROLVM_MESSAGE
)) < 0) {
2109 LOGERR("CRASH_DEV_RD_DEV_FAIULRE: Failed to read CrashCreateDevMsg!");
2110 POSTCODE_LINUX_2(CRASH_DEV_RD_DEV_FAIULRE_PC
,
2111 POSTCODE_SEVERITY_ERR
);
2115 /* reuse IOVM create bus message */
2116 if (localCrashCreateBusMsg
.cmd
.createBus
.channelAddr
!= 0)
2117 bus_create(&localCrashCreateBusMsg
);
2119 LOGERR("CrashCreateBusMsg is null, no dump will be taken");
2120 POSTCODE_LINUX_2(CRASH_DEV_BUS_NULL_FAILURE_PC
,
2121 POSTCODE_SEVERITY_ERR
);
2125 /* reuse create device message for storage device */
2126 if (localCrashCreateDevMsg
.cmd
.createDevice
.channelAddr
!= 0)
2127 my_device_create(&localCrashCreateDevMsg
);
2129 LOGERR("CrashCreateDevMsg is null, no dump will be taken");
2130 POSTCODE_LINUX_2(CRASH_DEV_DEV_NULL_FAILURE_PC
,
2131 POSTCODE_SEVERITY_ERR
);
2134 LOGINF("Bus and device ready for dumping");
2135 POSTCODE_LINUX_2(CRASH_DEV_EXIT_PC
, POSTCODE_SEVERITY_INFO
);
2140 Poll_jiffies
= POLLJIFFIES_CONTROLVMCHANNEL_SLOW
;
2142 queue_delayed_work(Periodic_controlvm_workqueue
,
2143 &Periodic_controlvm_work
, Poll_jiffies
);
2147 bus_create_response(ulong busNo
, int response
)
2149 bus_responder(CONTROLVM_BUS_CREATE
, busNo
, response
);
2153 bus_destroy_response(ulong busNo
, int response
)
2155 bus_responder(CONTROLVM_BUS_DESTROY
, busNo
, response
);
2159 device_create_response(ulong busNo
, ulong devNo
, int response
)
2161 device_responder(CONTROLVM_DEVICE_CREATE
, busNo
, devNo
, response
);
2165 device_destroy_response(ulong busNo
, ulong devNo
, int response
)
2167 device_responder(CONTROLVM_DEVICE_DESTROY
, busNo
, devNo
, response
);
2171 visorchipset_device_pause_response(ulong busNo
, ulong devNo
, int response
)
2174 device_changestate_responder(CONTROLVM_DEVICE_CHANGESTATE
,
2175 busNo
, devNo
, response
,
2176 SegmentStateStandby
);
2178 EXPORT_SYMBOL_GPL(visorchipset_device_pause_response
);
2181 device_resume_response(ulong busNo
, ulong devNo
, int response
)
2183 device_changestate_responder(CONTROLVM_DEVICE_CHANGESTATE
,
2184 busNo
, devNo
, response
,
2185 SegmentStateRunning
);
2189 visorchipset_get_bus_info(ulong busNo
, VISORCHIPSET_BUS_INFO
*busInfo
)
2191 void *p
= findbus(&BusInfoList
, busNo
);
2194 LOGERR("(%lu) failed", busNo
);
2197 memcpy(busInfo
, p
, sizeof(VISORCHIPSET_BUS_INFO
));
2200 EXPORT_SYMBOL_GPL(visorchipset_get_bus_info
);
2203 visorchipset_set_bus_context(ulong busNo
, void *context
)
2205 VISORCHIPSET_BUS_INFO
*p
= findbus(&BusInfoList
, busNo
);
2208 LOGERR("(%lu) failed", busNo
);
2211 p
->bus_driver_context
= context
;
2214 EXPORT_SYMBOL_GPL(visorchipset_set_bus_context
);
2217 visorchipset_get_device_info(ulong busNo
, ulong devNo
,
2218 VISORCHIPSET_DEVICE_INFO
*devInfo
)
2220 void *p
= finddevice(&DevInfoList
, busNo
, devNo
);
2223 LOGERR("(%lu,%lu) failed", busNo
, devNo
);
2226 memcpy(devInfo
, p
, sizeof(VISORCHIPSET_DEVICE_INFO
));
2229 EXPORT_SYMBOL_GPL(visorchipset_get_device_info
);
2232 visorchipset_set_device_context(ulong busNo
, ulong devNo
, void *context
)
2234 VISORCHIPSET_DEVICE_INFO
*p
= finddevice(&DevInfoList
, busNo
, devNo
);
2237 LOGERR("(%lu,%lu) failed", busNo
, devNo
);
2240 p
->bus_driver_context
= context
;
2243 EXPORT_SYMBOL_GPL(visorchipset_set_device_context
);
2245 /* Generic wrapper function for allocating memory from a kmem_cache pool.
2248 visorchipset_cache_alloc(struct kmem_cache
*pool
, BOOL ok_to_block
,
2258 /* __GFP_NORETRY means "ok to fail", meaning
2259 * kmem_cache_alloc() can return NULL, implying the caller CAN
2260 * cope with failure. If you do NOT specify __GFP_NORETRY,
2261 * Linux will go to extreme measures to get memory for you
2262 * (like, invoke oom killer), which will probably cripple the
2265 gfp
|= __GFP_NORETRY
;
2266 p
= kmem_cache_alloc(pool
, gfp
);
2268 LOGERR("kmem_cache_alloc failed early @%s:%d\n", fn
, ln
);
2271 atomic_inc(&Visorchipset_cache_buffers_in_use
);
2275 /* Generic wrapper function for freeing memory from a kmem_cache pool.
2278 visorchipset_cache_free(struct kmem_cache
*pool
, void *p
, char *fn
, int ln
)
2281 LOGERR("NULL pointer @%s:%d\n", fn
, ln
);
2284 atomic_dec(&Visorchipset_cache_buffers_in_use
);
2285 kmem_cache_free(pool
, p
);
2288 static ssize_t
chipsetready_store(struct device
*dev
,
2289 struct device_attribute
*attr
, const char *buf
, size_t count
)
2293 if (sscanf(buf
, "%63s", msgtype
) != 1)
2296 if (strcmp(msgtype
, "CALLHOMEDISK_MOUNTED") == 0) {
2297 chipset_events
[0] = 1;
2299 } else if (strcmp(msgtype
, "MODULES_LOADED") == 0) {
2300 chipset_events
[1] = 1;
2306 /* The parahotplug/devicedisabled interface gets called by our support script
2307 * when an SR-IOV device has been shut down. The ID is passed to the script
2308 * and then passed back when the device has been removed.
2310 static ssize_t
devicedisabled_store(struct device
*dev
,
2311 struct device_attribute
*attr
, const char *buf
, size_t count
)
2315 if (kstrtouint(buf
, 10, &id
) != 0)
2318 parahotplug_request_complete(id
, 0);
2322 /* The parahotplug/deviceenabled interface gets called by our support script
2323 * when an SR-IOV device has been recovered. The ID is passed to the script
2324 * and then passed back when the device has been brought back up.
2326 static ssize_t
deviceenabled_store(struct device
*dev
,
2327 struct device_attribute
*attr
, const char *buf
, size_t count
)
2331 if (kstrtouint(buf
, 10, &id
) != 0)
2334 parahotplug_request_complete(id
, 1);
2339 visorchipset_init(void)
2345 if (!unisys_spar_platform
)
2348 LOGINF("chipset driver version %s loaded", VERSION
);
2349 /* process module options */
2350 POSTCODE_LINUX_2(DRIVER_ENTRY_PC
, POSTCODE_SEVERITY_INFO
);
2352 LOGINF("option - testvnic=%d", visorchipset_testvnic
);
2353 LOGINF("option - testvnicclient=%d", visorchipset_testvnicclient
);
2354 LOGINF("option - testmsg=%d", visorchipset_testmsg
);
2355 LOGINF("option - testteardown=%d", visorchipset_testteardown
);
2356 LOGINF("option - major=%d", visorchipset_major
);
2357 LOGINF("option - serverregwait=%d", visorchipset_serverregwait
);
2358 LOGINF("option - clientregwait=%d", visorchipset_clientregwait
);
2359 LOGINF("option - holdchipsetready=%d", visorchipset_holdchipsetready
);
2361 memset(&BusDev_Server_Notifiers
, 0, sizeof(BusDev_Server_Notifiers
));
2362 memset(&BusDev_Client_Notifiers
, 0, sizeof(BusDev_Client_Notifiers
));
2363 memset(&ControlVm_payload_info
, 0, sizeof(ControlVm_payload_info
));
2364 memset(&LiveDump_info
, 0, sizeof(LiveDump_info
));
2365 atomic_set(&LiveDump_info
.buffers_in_use
, 0);
2367 if (visorchipset_testvnic
) {
2368 ERRDRV("testvnic option no longer supported: (status = %d)\n",
2370 POSTCODE_LINUX_3(CHIPSET_INIT_FAILURE_PC
, x
, DIAG_SEVERITY_ERR
);
2375 addr
= controlvm_get_channel_address();
2378 visorchannel_create_with_lock
2380 sizeof(ULTRA_CONTROLVM_CHANNEL_PROTOCOL
),
2381 UltraControlvmChannelProtocolGuid
);
2382 if (ULTRA_CONTROLVM_CHANNEL_OK_CLIENT
2383 (visorchannel_get_header(ControlVm_channel
),
2385 LOGINF("Channel %s (ControlVm) discovered",
2386 visorchannel_id(ControlVm_channel
, s
));
2387 initialize_controlvm_payload();
2389 LOGERR("controlvm channel is invalid");
2390 visorchannel_destroy(ControlVm_channel
);
2391 ControlVm_channel
= NULL
;
2395 LOGERR("no controlvm channel discovered");
2399 MajorDev
= MKDEV(visorchipset_major
, 0);
2400 rc
= visorchipset_file_init(MajorDev
, &ControlVm_channel
);
2402 ERRDRV("visorchipset_file_init(MajorDev, &ControlVm_channel): error (status=%d)\n", rc
);
2403 POSTCODE_LINUX_2(CHIPSET_INIT_FAILURE_PC
, DIAG_SEVERITY_ERR
);
2407 memset(&g_DiagMsgHdr
, 0, sizeof(CONTROLVM_MESSAGE_HEADER
));
2409 memset(&g_ChipSetMsgHdr
, 0, sizeof(CONTROLVM_MESSAGE_HEADER
));
2411 memset(&g_DelDumpMsgHdr
, 0, sizeof(CONTROLVM_MESSAGE_HEADER
));
2413 Putfile_buffer_list_pool
=
2414 kmem_cache_create(Putfile_buffer_list_pool_name
,
2415 sizeof(struct putfile_buffer_entry
),
2416 0, SLAB_HWCACHE_ALIGN
, NULL
);
2417 if (!Putfile_buffer_list_pool
) {
2418 ERRDRV("failed to alloc Putfile_buffer_list_pool: (status=-1)\n");
2419 POSTCODE_LINUX_2(CHIPSET_INIT_FAILURE_PC
, DIAG_SEVERITY_ERR
);
2423 if (visorchipset_disable_controlvm
) {
2424 LOGINF("visorchipset_init:controlvm disabled");
2426 /* if booting in a crash kernel */
2427 if (visorchipset_crash_kernel
)
2428 INIT_DELAYED_WORK(&Periodic_controlvm_work
,
2429 setup_crash_devices_work_queue
);
2431 INIT_DELAYED_WORK(&Periodic_controlvm_work
,
2432 controlvm_periodic_work
);
2433 Periodic_controlvm_workqueue
=
2434 create_singlethread_workqueue("visorchipset_controlvm");
2436 if (Periodic_controlvm_workqueue
== NULL
) {
2437 ERRDRV("cannot create controlvm workqueue: (status=%d)\n",
2439 POSTCODE_LINUX_2(CREATE_WORKQUEUE_FAILED_PC
,
2444 Most_recent_message_jiffies
= jiffies
;
2445 Poll_jiffies
= POLLJIFFIES_CONTROLVMCHANNEL_FAST
;
2446 rc
= queue_delayed_work(Periodic_controlvm_workqueue
,
2447 &Periodic_controlvm_work
, Poll_jiffies
);
2449 ERRDRV("queue_delayed_work(Periodic_controlvm_workqueue, &Periodic_controlvm_work, Poll_jiffies): error (status=%d)\n", rc
);
2450 POSTCODE_LINUX_2(QUEUE_DELAYED_WORK_PC
,
2457 Visorchipset_platform_device
.dev
.devt
= MajorDev
;
2458 if (platform_device_register(&Visorchipset_platform_device
) < 0) {
2459 ERRDRV("platform_device_register(visorchipset) failed: (status=-1)\n");
2460 POSTCODE_LINUX_2(DEVICE_REGISTER_FAILURE_PC
, DIAG_SEVERITY_ERR
);
2464 LOGINF("visorchipset device created");
2465 POSTCODE_LINUX_2(CHIPSET_INIT_SUCCESS_PC
, POSTCODE_SEVERITY_INFO
);
2469 LOGERR("visorchipset_init failed");
2470 POSTCODE_LINUX_3(CHIPSET_INIT_FAILURE_PC
, rc
,
2471 POSTCODE_SEVERITY_ERR
);
2477 visorchipset_exit(void)
2481 POSTCODE_LINUX_2(DRIVER_EXIT_PC
, POSTCODE_SEVERITY_INFO
);
2483 if (visorchipset_disable_controlvm
) {
2486 cancel_delayed_work(&Periodic_controlvm_work
);
2487 flush_workqueue(Periodic_controlvm_workqueue
);
2488 destroy_workqueue(Periodic_controlvm_workqueue
);
2489 Periodic_controlvm_workqueue
= NULL
;
2490 destroy_controlvm_payload_info(&ControlVm_payload_info
);
2492 Test_Vnic_channel
= NULL
;
2493 if (Putfile_buffer_list_pool
) {
2494 kmem_cache_destroy(Putfile_buffer_list_pool
);
2495 Putfile_buffer_list_pool
= NULL
;
2498 cleanup_controlvm_structures();
2500 memset(&g_DiagMsgHdr
, 0, sizeof(CONTROLVM_MESSAGE_HEADER
));
2502 memset(&g_ChipSetMsgHdr
, 0, sizeof(CONTROLVM_MESSAGE_HEADER
));
2504 memset(&g_DelDumpMsgHdr
, 0, sizeof(CONTROLVM_MESSAGE_HEADER
));
2506 LOGINF("Channel %s (ControlVm) disconnected",
2507 visorchannel_id(ControlVm_channel
, s
));
2508 visorchannel_destroy(ControlVm_channel
);
2510 visorchipset_file_cleanup();
2511 POSTCODE_LINUX_2(DRIVER_EXIT_PC
, POSTCODE_SEVERITY_INFO
);
2512 LOGINF("chipset driver unloaded");
2515 module_param_named(testvnic
, visorchipset_testvnic
, int, S_IRUGO
);
2516 MODULE_PARM_DESC(visorchipset_testvnic
, "1 to test vnic, using dummy VNIC connected via a loopback to a physical ethernet");
2517 int visorchipset_testvnic
= 0;
2519 module_param_named(testvnicclient
, visorchipset_testvnicclient
, int, S_IRUGO
);
2520 MODULE_PARM_DESC(visorchipset_testvnicclient
, "1 to test vnic, using real VNIC channel attached to a separate IOVM guest");
2521 int visorchipset_testvnicclient
= 0;
2523 module_param_named(testmsg
, visorchipset_testmsg
, int, S_IRUGO
);
2524 MODULE_PARM_DESC(visorchipset_testmsg
,
2525 "1 to manufacture the chipset, bus, and switch messages");
2526 int visorchipset_testmsg
= 0;
2528 module_param_named(major
, visorchipset_major
, int, S_IRUGO
);
2529 MODULE_PARM_DESC(visorchipset_major
, "major device number to use for the device node");
2530 int visorchipset_major
= 0;
2532 module_param_named(serverregwait
, visorchipset_serverregwait
, int, S_IRUGO
);
2533 MODULE_PARM_DESC(visorchipset_serverreqwait
,
2534 "1 to have the module wait for the visor bus to register");
2535 int visorchipset_serverregwait
= 0; /* default is off */
2536 module_param_named(clientregwait
, visorchipset_clientregwait
, int, S_IRUGO
);
2537 MODULE_PARM_DESC(visorchipset_clientregwait
, "1 to have the module wait for the visorclientbus to register");
2538 int visorchipset_clientregwait
= 1; /* default is on */
2539 module_param_named(testteardown
, visorchipset_testteardown
, int, S_IRUGO
);
2540 MODULE_PARM_DESC(visorchipset_testteardown
,
2541 "1 to test teardown of the chipset, bus, and switch");
2542 int visorchipset_testteardown
= 0; /* default is off */
2543 module_param_named(disable_controlvm
, visorchipset_disable_controlvm
, int,
2545 MODULE_PARM_DESC(visorchipset_disable_controlvm
,
2546 "1 to disable polling of controlVm channel");
2547 int visorchipset_disable_controlvm
= 0; /* default is off */
2548 module_param_named(crash_kernel
, visorchipset_crash_kernel
, int, S_IRUGO
);
2549 MODULE_PARM_DESC(visorchipset_crash_kernel
,
2550 "1 means we are running in crash kernel");
2551 int visorchipset_crash_kernel
= 0; /* default is running in non-crash kernel */
2552 module_param_named(holdchipsetready
, visorchipset_holdchipsetready
,
2554 MODULE_PARM_DESC(visorchipset_holdchipsetready
,
2555 "1 to hold response to CHIPSET_READY");
2556 int visorchipset_holdchipsetready
= 0; /* default is to send CHIPSET_READY
2557 * response immediately */
2558 module_init(visorchipset_init
);
2559 module_exit(visorchipset_exit
);
2561 MODULE_AUTHOR("Unisys");
2562 MODULE_LICENSE("GPL");
2563 MODULE_DESCRIPTION("Supervisor chipset driver for service partition: ver "
2565 MODULE_VERSION(VERSION
);