0001 ===============================================================
0002 HVCS IBM "Hypervisor Virtual Console Server" Installation Guide
0003 ===============================================================
0004
0005 for Linux Kernel 2.6.4+
0006
0007 Copyright (C) 2004 IBM Corporation
0008
0009 .. ===========================================================================
0010 .. NOTE:Eight space tabs are the optimum editor setting for reading this file.
0011 .. ===========================================================================
0012
0013
0014 Author(s): Ryan S. Arnold <rsa@us.ibm.com>
0015
0016 Date Created: March, 02, 2004
0017 Last Changed: August, 24, 2004
0018
0019 .. Table of contents:
0020
0021 1. Driver Introduction:
0022 2. System Requirements
0023 3. Build Options:
0024 3.1 Built-in:
0025 3.2 Module:
0026 4. Installation:
0027 5. Connection:
0028 6. Disconnection:
0029 7. Configuration:
0030 8. Questions & Answers:
0031 9. Reporting Bugs:
0032
0033 1. Driver Introduction:
0034 =======================
0035
0036 This is the device driver for the IBM Hypervisor Virtual Console Server,
0037 "hvcs". The IBM hvcs provides a tty driver interface to allow Linux user
0038 space applications access to the system consoles of logically partitioned
0039 operating systems (Linux and AIX) running on the same partitioned Power5
0040 ppc64 system. Physical hardware consoles per partition are not practical
0041 on this hardware so system consoles are accessed by this driver using
0042 firmware interfaces to virtual terminal devices.
0043
0044 2. System Requirements:
0045 =======================
0046
0047 This device driver was written using 2.6.4 Linux kernel APIs and will only
0048 build and run on kernels of this version or later.
0049
0050 This driver was written to operate solely on IBM Power5 ppc64 hardware
0051 though some care was taken to abstract the architecture dependent firmware
0052 calls from the driver code.
0053
0054 Sysfs must be mounted on the system so that the user can determine which
0055 major and minor numbers are associated with each vty-server. Directions
0056 for sysfs mounting are outside the scope of this document.
0057
0058 3. Build Options:
0059 =================
0060
0061 The hvcs driver registers itself as a tty driver. The tty layer
0062 dynamically allocates a block of major and minor numbers in a quantity
0063 requested by the registering driver. The hvcs driver asks the tty layer
0064 for 64 of these major/minor numbers by default to use for hvcs device node
0065 entries.
0066
0067 If the default number of device entries is adequate then this driver can be
0068 built into the kernel. If not, the default can be over-ridden by inserting
0069 the driver as a module with insmod parameters.
0070
0071 3.1 Built-in:
0072 -------------
0073
0074 The following menuconfig example demonstrates selecting to build this
0075 driver into the kernel::
0076
0077 Device Drivers --->
0078 Character devices --->
0079 <*> IBM Hypervisor Virtual Console Server Support
0080
0081 Begin the kernel make process.
0082
0083 3.2 Module:
0084 -----------
0085
0086 The following menuconfig example demonstrates selecting to build this
0087 driver as a kernel module::
0088
0089 Device Drivers --->
0090 Character devices --->
0091 <M> IBM Hypervisor Virtual Console Server Support
0092
0093 The make process will build the following kernel modules:
0094
0095 - hvcs.ko
0096 - hvcserver.ko
0097
0098 To insert the module with the default allocation execute the following
0099 commands in the order they appear::
0100
0101 insmod hvcserver.ko
0102 insmod hvcs.ko
0103
0104 The hvcserver module contains architecture specific firmware calls and must
0105 be inserted first, otherwise the hvcs module will not find some of the
0106 symbols it expects.
0107
0108 To override the default use an insmod parameter as follows (requesting 4
0109 tty devices as an example)::
0110
0111 insmod hvcs.ko hvcs_parm_num_devs=4
0112
0113 There is a maximum number of dev entries that can be specified on insmod.
0114 We think that 1024 is currently a decent maximum number of server adapters
0115 to allow. This can always be changed by modifying the constant in the
0116 source file before building.
0117
0118 NOTE: The length of time it takes to insmod the driver seems to be related
0119 to the number of tty interfaces the registering driver requests.
0120
0121 In order to remove the driver module execute the following command::
0122
0123 rmmod hvcs.ko
0124
0125 The recommended method for installing hvcs as a module is to use depmod to
0126 build a current modules.dep file in /lib/modules/`uname -r` and then
0127 execute::
0128
0129 modprobe hvcs hvcs_parm_num_devs=4
0130
0131 The modules.dep file indicates that hvcserver.ko needs to be inserted
0132 before hvcs.ko and modprobe uses this file to smartly insert the modules in
0133 the proper order.
0134
0135 The following modprobe command is used to remove hvcs and hvcserver in the
0136 proper order::
0137
0138 modprobe -r hvcs
0139
0140 4. Installation:
0141 ================
0142
0143 The tty layer creates sysfs entries which contain the major and minor
0144 numbers allocated for the hvcs driver. The following snippet of "tree"
0145 output of the sysfs directory shows where these numbers are presented::
0146
0147 sys/
0148 |-- *other sysfs base dirs*
0149 |
0150 |-- class
0151 | |-- *other classes of devices*
0152 | |
0153 | `-- tty
0154 | |-- *other tty devices*
0155 | |
0156 | |-- hvcs0
0157 | | `-- dev
0158 | |-- hvcs1
0159 | | `-- dev
0160 | |-- hvcs2
0161 | | `-- dev
0162 | |-- hvcs3
0163 | | `-- dev
0164 | |
0165 | |-- *other tty devices*
0166 |
0167 |-- *other sysfs base dirs*
0168
0169 For the above examples the following output is a result of cat'ing the
0170 "dev" entry in the hvcs directory::
0171
0172 Pow5:/sys/class/tty/hvcs0/ # cat dev
0173 254:0
0174
0175 Pow5:/sys/class/tty/hvcs1/ # cat dev
0176 254:1
0177
0178 Pow5:/sys/class/tty/hvcs2/ # cat dev
0179 254:2
0180
0181 Pow5:/sys/class/tty/hvcs3/ # cat dev
0182 254:3
0183
0184 The output from reading the "dev" attribute is the char device major and
0185 minor numbers that the tty layer has allocated for this driver's use. Most
0186 systems running hvcs will already have the device entries created or udev
0187 will do it automatically.
0188
0189 Given the example output above, to manually create a /dev/hvcs* node entry
0190 mknod can be used as follows::
0191
0192 mknod /dev/hvcs0 c 254 0
0193 mknod /dev/hvcs1 c 254 1
0194 mknod /dev/hvcs2 c 254 2
0195 mknod /dev/hvcs3 c 254 3
0196
0197 Using mknod to manually create the device entries makes these device nodes
0198 persistent. Once created they will exist prior to the driver insmod.
0199
0200 Attempting to connect an application to /dev/hvcs* prior to insertion of
0201 the hvcs module will result in an error message similar to the following::
0202
0203 "/dev/hvcs*: No such device".
0204
0205 NOTE: Just because there is a device node present doesn't mean that there
0206 is a vty-server device configured for that node.
0207
0208 5. Connection
0209 =============
0210
0211 Since this driver controls devices that provide a tty interface a user can
0212 interact with the device node entries using any standard tty-interactive
0213 method (e.g. "cat", "dd", "echo"). The intent of this driver however, is
0214 to provide real time console interaction with a Linux partition's console,
0215 which requires the use of applications that provide bi-directional,
0216 interactive I/O with a tty device.
0217
0218 Applications (e.g. "minicom" and "screen") that act as terminal emulators
0219 or perform terminal type control sequence conversion on the data being
0220 passed through them are NOT acceptable for providing interactive console
0221 I/O. These programs often emulate antiquated terminal types (vt100 and
0222 ANSI) and expect inbound data to take the form of one of these supported
0223 terminal types but they either do not convert, or do not _adequately_
0224 convert, outbound data into the terminal type of the terminal which invoked
0225 them (though screen makes an attempt and can apparently be configured with
0226 much termcap wrestling.)
0227
0228 For this reason kermit and cu are two of the recommended applications for
0229 interacting with a Linux console via an hvcs device. These programs simply
0230 act as a conduit for data transfer to and from the tty device. They do not
0231 require inbound data to take the form of a particular terminal type, nor do
0232 they cook outbound data to a particular terminal type.
0233
0234 In order to ensure proper functioning of console applications one must make
0235 sure that once connected to a /dev/hvcs console that the console's $TERM
0236 env variable is set to the exact terminal type of the terminal emulator
0237 used to launch the interactive I/O application. If one is using xterm and
0238 kermit to connect to /dev/hvcs0 when the console prompt becomes available
0239 one should "export TERM=xterm" on the console. This tells ncurses
0240 applications that are invoked from the console that they should output
0241 control sequences that xterm can understand.
0242
0243 As a precautionary measure an hvcs user should always "exit" from their
0244 session before disconnecting an application such as kermit from the device
0245 node. If this is not done, the next user to connect to the console will
0246 continue using the previous user's logged in session which includes
0247 using the $TERM variable that the previous user supplied.
0248
0249 Hotplug add and remove of vty-server adapters affects which /dev/hvcs* node
0250 is used to connect to each vty-server adapter. In order to determine which
0251 vty-server adapter is associated with which /dev/hvcs* node a special sysfs
0252 attribute has been added to each vty-server sysfs entry. This entry is
0253 called "index" and showing it reveals an integer that refers to the
0254 /dev/hvcs* entry to use to connect to that device. For instance cating the
0255 index attribute of vty-server adapter 30000004 shows the following::
0256
0257 Pow5:/sys/bus/vio/drivers/hvcs/30000004 # cat index
0258 2
0259
0260 This index of '2' means that in order to connect to vty-server adapter
0261 30000004 the user should interact with /dev/hvcs2.
0262
0263 It should be noted that due to the system hotplug I/O capabilities of a
0264 system the /dev/hvcs* entry that interacts with a particular vty-server
0265 adapter is not guaranteed to remain the same across system reboots. Look
0266 in the Q & A section for more on this issue.
0267
0268 6. Disconnection
0269 ================
0270
0271 As a security feature to prevent the delivery of stale data to an
0272 unintended target the Power5 system firmware disables the fetching of data
0273 and discards that data when a connection between a vty-server and a vty has
0274 been severed. As an example, when a vty-server is immediately disconnected
0275 from a vty following output of data to the vty the vty adapter may not have
0276 enough time between when it received the data interrupt and when the
0277 connection was severed to fetch the data from firmware before the fetch is
0278 disabled by firmware.
0279
0280 When hvcs is being used to serve consoles this behavior is not a huge issue
0281 because the adapter stays connected for large amounts of time following
0282 almost all data writes. When hvcs is being used as a tty conduit to tunnel
0283 data between two partitions [see Q & A below] this is a huge problem
0284 because the standard Linux behavior when cat'ing or dd'ing data to a device
0285 is to open the tty, send the data, and then close the tty. If this driver
0286 manually terminated vty-server connections on tty close this would close
0287 the vty-server and vty connection before the target vty has had a chance to
0288 fetch the data.
0289
0290 Additionally, disconnecting a vty-server and vty only on module removal or
0291 adapter removal is impractical because other vty-servers in other
0292 partitions may require the usage of the target vty at any time.
0293
0294 Due to this behavioral restriction disconnection of vty-servers from the
0295 connected vty is a manual procedure using a write to a sysfs attribute
0296 outlined below, on the other hand the initial vty-server connection to a
0297 vty is established automatically by this driver. Manual vty-server
0298 connection is never required.
0299
0300 In order to terminate the connection between a vty-server and vty the
0301 "vterm_state" sysfs attribute within each vty-server's sysfs entry is used.
0302 Reading this attribute reveals the current connection state of the
0303 vty-server adapter. A zero means that the vty-server is not connected to a
0304 vty. A one indicates that a connection is active.
0305
0306 Writing a '0' (zero) to the vterm_state attribute will disconnect the VTERM
0307 connection between the vty-server and target vty ONLY if the vterm_state
0308 previously read '1'. The write directive is ignored if the vterm_state
0309 read '0' or if any value other than '0' was written to the vterm_state
0310 attribute. The following example will show the method used for verifying
0311 the vty-server connection status and disconnecting a vty-server connection::
0312
0313 Pow5:/sys/bus/vio/drivers/hvcs/30000004 # cat vterm_state
0314 1
0315
0316 Pow5:/sys/bus/vio/drivers/hvcs/30000004 # echo 0 > vterm_state
0317
0318 Pow5:/sys/bus/vio/drivers/hvcs/30000004 # cat vterm_state
0319 0
0320
0321 All vty-server connections are automatically terminated when the device is
0322 hotplug removed and when the module is removed.
0323
0324 7. Configuration
0325 ================
0326
0327 Each vty-server has a sysfs entry in the /sys/devices/vio directory, which
0328 is symlinked in several other sysfs tree directories, notably under the
0329 hvcs driver entry, which looks like the following example::
0330
0331 Pow5:/sys/bus/vio/drivers/hvcs # ls
0332 . .. 30000003 30000004 rescan
0333
0334 By design, firmware notifies the hvcs driver of vty-server lifetimes and
0335 partner vty removals but not the addition of partner vtys. Since an HMC
0336 Super Admin can add partner info dynamically we have provided the hvcs
0337 driver sysfs directory with the "rescan" update attribute which will query
0338 firmware and update the partner info for all the vty-servers that this
0339 driver manages. Writing a '1' to the attribute triggers the update. An
0340 explicit example follows:
0341
0342 Pow5:/sys/bus/vio/drivers/hvcs # echo 1 > rescan
0343
0344 Reading the attribute will indicate a state of '1' or '0'. A one indicates
0345 that an update is in process. A zero indicates that an update has
0346 completed or was never executed.
0347
0348 Vty-server entries in this directory are a 32 bit partition unique unit
0349 address that is created by firmware. An example vty-server sysfs entry
0350 looks like the following::
0351
0352 Pow5:/sys/bus/vio/drivers/hvcs/30000004 # ls
0353 . current_vty devspec name partner_vtys
0354 .. index partner_clcs vterm_state
0355
0356 Each entry is provided, by default with a "name" attribute. Reading the
0357 "name" attribute will reveal the device type as shown in the following
0358 example::
0359
0360 Pow5:/sys/bus/vio/drivers/hvcs/30000003 # cat name
0361 vty-server
0362
0363 Each entry is also provided, by default, with a "devspec" attribute which
0364 reveals the full device specification when read, as shown in the following
0365 example::
0366
0367 Pow5:/sys/bus/vio/drivers/hvcs/30000004 # cat devspec
0368 /vdevice/vty-server@30000004
0369
0370 Each vty-server sysfs dir is provided with two read-only attributes that
0371 provide lists of easily parsed partner vty data: "partner_vtys" and
0372 "partner_clcs"::
0373
0374 Pow5:/sys/bus/vio/drivers/hvcs/30000004 # cat partner_vtys
0375 30000000
0376 30000001
0377 30000002
0378 30000000
0379 30000000
0380
0381 Pow5:/sys/bus/vio/drivers/hvcs/30000004 # cat partner_clcs
0382 U5112.428.103048A-V3-C0
0383 U5112.428.103048A-V3-C2
0384 U5112.428.103048A-V3-C3
0385 U5112.428.103048A-V4-C0
0386 U5112.428.103048A-V5-C0
0387
0388 Reading partner_vtys returns a list of partner vtys. Vty unit address
0389 numbering is only per-partition-unique so entries will frequently repeat.
0390
0391 Reading partner_clcs returns a list of "converged location codes" which are
0392 composed of a system serial number followed by "-V*", where the '*' is the
0393 target partition number, and "-C*", where the '*' is the slot of the
0394 adapter. The first vty partner corresponds to the first clc item, the
0395 second vty partner to the second clc item, etc.
0396
0397 A vty-server can only be connected to a single vty at a time. The entry,
0398 "current_vty" prints the clc of the currently selected partner vty when
0399 read.
0400
0401 The current_vty can be changed by writing a valid partner clc to the entry
0402 as in the following example::
0403
0404 Pow5:/sys/bus/vio/drivers/hvcs/30000004 # echo U5112.428.10304
0405 8A-V4-C0 > current_vty
0406
0407 Changing the current_vty when a vty-server is already connected to a vty
0408 does not affect the current connection. The change takes effect when the
0409 currently open connection is freed.
0410
0411 Information on the "vterm_state" attribute was covered earlier on the
0412 chapter entitled "disconnection".
0413
0414 8. Questions & Answers:
0415 =======================
0416
0417 Q: What are the security concerns involving hvcs?
0418
0419 A: There are three main security concerns:
0420
0421 1. The creator of the /dev/hvcs* nodes has the ability to restrict
0422 the access of the device entries to certain users or groups. It
0423 may be best to create a special hvcs group privilege for providing
0424 access to system consoles.
0425
0426 2. To provide network security when grabbing the console it is
0427 suggested that the user connect to the console hosting partition
0428 using a secure method, such as SSH or sit at a hardware console.
0429
0430 3. Make sure to exit the user session when done with a console or
0431 the next vty-server connection (which may be from another
0432 partition) will experience the previously logged in session.
0433
0434 ---------------------------------------------------------------------------
0435
0436 Q: How do I multiplex a console that I grab through hvcs so that other
0437 people can see it:
0438
0439 A: You can use "screen" to directly connect to the /dev/hvcs* device and
0440 setup a session on your machine with the console group privileges. As
0441 pointed out earlier by default screen doesn't provide the termcap settings
0442 for most terminal emulators to provide adequate character conversion from
0443 term type "screen" to others. This means that curses based programs may
0444 not display properly in screen sessions.
0445
0446 ---------------------------------------------------------------------------
0447
0448 Q: Why are the colors all messed up?
0449 Q: Why are the control characters acting strange or not working?
0450 Q: Why is the console output all strange and unintelligible?
0451
0452 A: Please see the preceding section on "Connection" for a discussion of how
0453 applications can affect the display of character control sequences.
0454 Additionally, just because you logged into the console using and xterm
0455 doesn't mean someone else didn't log into the console with the HMC console
0456 (vt320) before you and leave the session logged in. The best thing to do
0457 is to export TERM to the terminal type of your terminal emulator when you
0458 get the console. Additionally make sure to "exit" the console before you
0459 disconnect from the console. This will ensure that the next user gets
0460 their own TERM type set when they login.
0461
0462 ---------------------------------------------------------------------------
0463
0464 Q: When I try to CONNECT kermit to an hvcs device I get:
0465 "Sorry, can't open connection: /dev/hvcs*"What is happening?
0466
0467 A: Some other Power5 console mechanism has a connection to the vty and
0468 isn't giving it up. You can try to force disconnect the consoles from the
0469 HMC by right clicking on the partition and then selecting "close terminal".
0470 Otherwise you have to hunt down the people who have console authority. It
0471 is possible that you already have the console open using another kermit
0472 session and just forgot about it. Please review the console options for
0473 Power5 systems to determine the many ways a system console can be held.
0474
0475 OR
0476
0477 A: Another user may not have a connectivity method currently attached to a
0478 /dev/hvcs device but the vterm_state may reveal that they still have the
0479 vty-server connection established. They need to free this using the method
0480 outlined in the section on "Disconnection" in order for others to connect
0481 to the target vty.
0482
0483 OR
0484
0485 A: The user profile you are using to execute kermit probably doesn't have
0486 permissions to use the /dev/hvcs* device.
0487
0488 OR
0489
0490 A: You probably haven't inserted the hvcs.ko module yet but the /dev/hvcs*
0491 entry still exists (on systems without udev).
0492
0493 OR
0494
0495 A: There is not a corresponding vty-server device that maps to an existing
0496 /dev/hvcs* entry.
0497
0498 ---------------------------------------------------------------------------
0499
0500 Q: When I try to CONNECT kermit to an hvcs device I get:
0501 "Sorry, write access to UUCP lockfile directory denied."
0502
0503 A: The /dev/hvcs* entry you have specified doesn't exist where you said it
0504 does? Maybe you haven't inserted the module (on systems with udev).
0505
0506 ---------------------------------------------------------------------------
0507
0508 Q: If I already have one Linux partition installed can I use hvcs on said
0509 partition to provide the console for the install of a second Linux
0510 partition?
0511
0512 A: Yes granted that your are connected to the /dev/hvcs* device using
0513 kermit or cu or some other program that doesn't provide terminal emulation.
0514
0515 ---------------------------------------------------------------------------
0516
0517 Q: Can I connect to more than one partition's console at a time using this
0518 driver?
0519
0520 A: Yes. Of course this means that there must be more than one vty-server
0521 configured for this partition and each must point to a disconnected vty.
0522
0523 ---------------------------------------------------------------------------
0524
0525 Q: Does the hvcs driver support dynamic (hotplug) addition of devices?
0526
0527 A: Yes, if you have dlpar and hotplug enabled for your system and it has
0528 been built into the kernel the hvcs drivers is configured to dynamically
0529 handle additions of new devices and removals of unused devices.
0530
0531 ---------------------------------------------------------------------------
0532
0533 Q: For some reason /dev/hvcs* doesn't map to the same vty-server adapter
0534 after a reboot. What happened?
0535
0536 A: Assignment of vty-server adapters to /dev/hvcs* entries is always done
0537 in the order that the adapters are exposed. Due to hotplug capabilities of
0538 this driver assignment of hotplug added vty-servers may be in a different
0539 order than how they would be exposed on module load. Rebooting or
0540 reloading the module after dynamic addition may result in the /dev/hvcs*
0541 and vty-server coupling changing if a vty-server adapter was added in a
0542 slot between two other vty-server adapters. Refer to the section above
0543 on how to determine which vty-server goes with which /dev/hvcs* node.
0544 Hint; look at the sysfs "index" attribute for the vty-server.
0545
0546 ---------------------------------------------------------------------------
0547
0548 Q: Can I use /dev/hvcs* as a conduit to another partition and use a tty
0549 device on that partition as the other end of the pipe?
0550
0551 A: Yes, on Power5 platforms the hvc_console driver provides a tty interface
0552 for extra /dev/hvc* devices (where /dev/hvc0 is most likely the console).
0553 In order to get a tty conduit working between the two partitions the HMC
0554 Super Admin must create an additional "serial server" for the target
0555 partition with the HMC gui which will show up as /dev/hvc* when the target
0556 partition is rebooted.
0557
0558 The HMC Super Admin then creates an additional "serial client" for the
0559 current partition and points this at the target partition's newly created
0560 "serial server" adapter (remember the slot). This shows up as an
0561 additional /dev/hvcs* device.
0562
0563 Now a program on the target system can be configured to read or write to
0564 /dev/hvc* and another program on the current partition can be configured to
0565 read or write to /dev/hvcs*. Now you have a tty conduit between two
0566 partitions.
0567
0568 ---------------------------------------------------------------------------
0569
0570 9. Reporting Bugs:
0571 ==================
0572
0573 The proper channel for reporting bugs is either through the Linux OS
0574 distribution company that provided your OS or by posting issues to the
0575 PowerPC development mailing list at:
0576
0577 linuxppc-dev@lists.ozlabs.org
0578
0579 This request is to provide a documented and searchable public exchange
0580 of the problems and solutions surrounding this driver for the benefit of
0581 all users.