18c2ecf20Sopenharmony_ci===============================================================
28c2ecf20Sopenharmony_ciHVCS IBM "Hypervisor Virtual Console Server" Installation Guide
38c2ecf20Sopenharmony_ci===============================================================
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_cifor Linux Kernel 2.6.4+
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ciCopyright (C) 2004 IBM Corporation
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci.. ===========================================================================
108c2ecf20Sopenharmony_ci.. NOTE:Eight space tabs are the optimum editor setting for reading this file.
118c2ecf20Sopenharmony_ci.. ===========================================================================
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ciAuthor(s): Ryan S. Arnold <rsa@us.ibm.com>
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ciDate Created: March, 02, 2004
178c2ecf20Sopenharmony_ciLast Changed: August, 24, 2004
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ci.. Table of contents:
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ci	1.  Driver Introduction:
228c2ecf20Sopenharmony_ci	2.  System Requirements
238c2ecf20Sopenharmony_ci	3.  Build Options:
248c2ecf20Sopenharmony_ci		3.1  Built-in:
258c2ecf20Sopenharmony_ci		3.2  Module:
268c2ecf20Sopenharmony_ci	4.  Installation:
278c2ecf20Sopenharmony_ci	5.  Connection:
288c2ecf20Sopenharmony_ci	6.  Disconnection:
298c2ecf20Sopenharmony_ci	7.  Configuration:
308c2ecf20Sopenharmony_ci	8.  Questions & Answers:
318c2ecf20Sopenharmony_ci	9.  Reporting Bugs:
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_ci1. Driver Introduction:
348c2ecf20Sopenharmony_ci=======================
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_ciThis is the device driver for the IBM Hypervisor Virtual Console Server,
378c2ecf20Sopenharmony_ci"hvcs".  The IBM hvcs provides a tty driver interface to allow Linux user
388c2ecf20Sopenharmony_cispace applications access to the system consoles of logically partitioned
398c2ecf20Sopenharmony_cioperating systems (Linux and AIX) running on the same partitioned Power5
408c2ecf20Sopenharmony_cippc64 system.  Physical hardware consoles per partition are not practical
418c2ecf20Sopenharmony_cion this hardware so system consoles are accessed by this driver using
428c2ecf20Sopenharmony_cifirmware interfaces to virtual terminal devices.
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_ci2. System Requirements:
458c2ecf20Sopenharmony_ci=======================
468c2ecf20Sopenharmony_ci
478c2ecf20Sopenharmony_ciThis device driver was written using 2.6.4 Linux kernel APIs and will only
488c2ecf20Sopenharmony_cibuild and run on kernels of this version or later.
498c2ecf20Sopenharmony_ci
508c2ecf20Sopenharmony_ciThis driver was written to operate solely on IBM Power5 ppc64 hardware
518c2ecf20Sopenharmony_cithough some care was taken to abstract the architecture dependent firmware
528c2ecf20Sopenharmony_cicalls from the driver code.
538c2ecf20Sopenharmony_ci
548c2ecf20Sopenharmony_ciSysfs must be mounted on the system so that the user can determine which
558c2ecf20Sopenharmony_cimajor and minor numbers are associated with each vty-server.  Directions
568c2ecf20Sopenharmony_cifor sysfs mounting are outside the scope of this document.
578c2ecf20Sopenharmony_ci
588c2ecf20Sopenharmony_ci3. Build Options:
598c2ecf20Sopenharmony_ci=================
608c2ecf20Sopenharmony_ci
618c2ecf20Sopenharmony_ciThe hvcs driver registers itself as a tty driver.  The tty layer
628c2ecf20Sopenharmony_cidynamically allocates a block of major and minor numbers in a quantity
638c2ecf20Sopenharmony_cirequested by the registering driver.  The hvcs driver asks the tty layer
648c2ecf20Sopenharmony_cifor 64 of these major/minor numbers by default to use for hvcs device node
658c2ecf20Sopenharmony_cientries.
668c2ecf20Sopenharmony_ci
678c2ecf20Sopenharmony_ciIf the default number of device entries is adequate then this driver can be
688c2ecf20Sopenharmony_cibuilt into the kernel.  If not, the default can be over-ridden by inserting
698c2ecf20Sopenharmony_cithe driver as a module with insmod parameters.
708c2ecf20Sopenharmony_ci
718c2ecf20Sopenharmony_ci3.1 Built-in:
728c2ecf20Sopenharmony_ci-------------
738c2ecf20Sopenharmony_ci
748c2ecf20Sopenharmony_ciThe following menuconfig example demonstrates selecting to build this
758c2ecf20Sopenharmony_cidriver into the kernel::
768c2ecf20Sopenharmony_ci
778c2ecf20Sopenharmony_ci	Device Drivers  --->
788c2ecf20Sopenharmony_ci		Character devices  --->
798c2ecf20Sopenharmony_ci			<*> IBM Hypervisor Virtual Console Server Support
808c2ecf20Sopenharmony_ci
818c2ecf20Sopenharmony_ciBegin the kernel make process.
828c2ecf20Sopenharmony_ci
838c2ecf20Sopenharmony_ci3.2 Module:
848c2ecf20Sopenharmony_ci-----------
858c2ecf20Sopenharmony_ci
868c2ecf20Sopenharmony_ciThe following menuconfig example demonstrates selecting to build this
878c2ecf20Sopenharmony_cidriver as a kernel module::
888c2ecf20Sopenharmony_ci
898c2ecf20Sopenharmony_ci	Device Drivers  --->
908c2ecf20Sopenharmony_ci		Character devices  --->
918c2ecf20Sopenharmony_ci			<M> IBM Hypervisor Virtual Console Server Support
928c2ecf20Sopenharmony_ci
938c2ecf20Sopenharmony_ciThe make process will build the following kernel modules:
948c2ecf20Sopenharmony_ci
958c2ecf20Sopenharmony_ci	- hvcs.ko
968c2ecf20Sopenharmony_ci	- hvcserver.ko
978c2ecf20Sopenharmony_ci
988c2ecf20Sopenharmony_ciTo insert the module with the default allocation execute the following
998c2ecf20Sopenharmony_cicommands in the order they appear::
1008c2ecf20Sopenharmony_ci
1018c2ecf20Sopenharmony_ci	insmod hvcserver.ko
1028c2ecf20Sopenharmony_ci	insmod hvcs.ko
1038c2ecf20Sopenharmony_ci
1048c2ecf20Sopenharmony_ciThe hvcserver module contains architecture specific firmware calls and must
1058c2ecf20Sopenharmony_cibe inserted first, otherwise the hvcs module will not find some of the
1068c2ecf20Sopenharmony_cisymbols it expects.
1078c2ecf20Sopenharmony_ci
1088c2ecf20Sopenharmony_ciTo override the default use an insmod parameter as follows (requesting 4
1098c2ecf20Sopenharmony_citty devices as an example)::
1108c2ecf20Sopenharmony_ci
1118c2ecf20Sopenharmony_ci	insmod hvcs.ko hvcs_parm_num_devs=4
1128c2ecf20Sopenharmony_ci
1138c2ecf20Sopenharmony_ciThere is a maximum number of dev entries that can be specified on insmod.
1148c2ecf20Sopenharmony_ciWe think that 1024 is currently a decent maximum number of server adapters
1158c2ecf20Sopenharmony_cito allow.  This can always be changed by modifying the constant in the
1168c2ecf20Sopenharmony_cisource file before building.
1178c2ecf20Sopenharmony_ci
1188c2ecf20Sopenharmony_ciNOTE: The length of time it takes to insmod the driver seems to be related
1198c2ecf20Sopenharmony_cito the number of tty interfaces the registering driver requests.
1208c2ecf20Sopenharmony_ci
1218c2ecf20Sopenharmony_ciIn order to remove the driver module execute the following command::
1228c2ecf20Sopenharmony_ci
1238c2ecf20Sopenharmony_ci	rmmod hvcs.ko
1248c2ecf20Sopenharmony_ci
1258c2ecf20Sopenharmony_ciThe recommended method for installing hvcs as a module is to use depmod to
1268c2ecf20Sopenharmony_cibuild a current modules.dep file in /lib/modules/`uname -r` and then
1278c2ecf20Sopenharmony_ciexecute::
1288c2ecf20Sopenharmony_ci
1298c2ecf20Sopenharmony_ci	modprobe hvcs hvcs_parm_num_devs=4
1308c2ecf20Sopenharmony_ci
1318c2ecf20Sopenharmony_ciThe modules.dep file indicates that hvcserver.ko needs to be inserted
1328c2ecf20Sopenharmony_cibefore hvcs.ko and modprobe uses this file to smartly insert the modules in
1338c2ecf20Sopenharmony_cithe proper order.
1348c2ecf20Sopenharmony_ci
1358c2ecf20Sopenharmony_ciThe following modprobe command is used to remove hvcs and hvcserver in the
1368c2ecf20Sopenharmony_ciproper order::
1378c2ecf20Sopenharmony_ci
1388c2ecf20Sopenharmony_ci	modprobe -r hvcs
1398c2ecf20Sopenharmony_ci
1408c2ecf20Sopenharmony_ci4. Installation:
1418c2ecf20Sopenharmony_ci================
1428c2ecf20Sopenharmony_ci
1438c2ecf20Sopenharmony_ciThe tty layer creates sysfs entries which contain the major and minor
1448c2ecf20Sopenharmony_cinumbers allocated for the hvcs driver.  The following snippet of "tree"
1458c2ecf20Sopenharmony_cioutput of the sysfs directory shows where these numbers are presented::
1468c2ecf20Sopenharmony_ci
1478c2ecf20Sopenharmony_ci	sys/
1488c2ecf20Sopenharmony_ci	|-- *other sysfs base dirs*
1498c2ecf20Sopenharmony_ci	|
1508c2ecf20Sopenharmony_ci	|-- class
1518c2ecf20Sopenharmony_ci	|   |-- *other classes of devices*
1528c2ecf20Sopenharmony_ci	|   |
1538c2ecf20Sopenharmony_ci	|   `-- tty
1548c2ecf20Sopenharmony_ci	|       |-- *other tty devices*
1558c2ecf20Sopenharmony_ci	|       |
1568c2ecf20Sopenharmony_ci	|       |-- hvcs0
1578c2ecf20Sopenharmony_ci	|       |   `-- dev
1588c2ecf20Sopenharmony_ci	|       |-- hvcs1
1598c2ecf20Sopenharmony_ci	|       |   `-- dev
1608c2ecf20Sopenharmony_ci	|       |-- hvcs2
1618c2ecf20Sopenharmony_ci	|       |   `-- dev
1628c2ecf20Sopenharmony_ci	|       |-- hvcs3
1638c2ecf20Sopenharmony_ci	|       |   `-- dev
1648c2ecf20Sopenharmony_ci	|       |
1658c2ecf20Sopenharmony_ci	|       |-- *other tty devices*
1668c2ecf20Sopenharmony_ci	|
1678c2ecf20Sopenharmony_ci	|-- *other sysfs base dirs*
1688c2ecf20Sopenharmony_ci
1698c2ecf20Sopenharmony_ciFor the above examples the following output is a result of cat'ing the
1708c2ecf20Sopenharmony_ci"dev" entry in the hvcs directory::
1718c2ecf20Sopenharmony_ci
1728c2ecf20Sopenharmony_ci	Pow5:/sys/class/tty/hvcs0/ # cat dev
1738c2ecf20Sopenharmony_ci	254:0
1748c2ecf20Sopenharmony_ci
1758c2ecf20Sopenharmony_ci	Pow5:/sys/class/tty/hvcs1/ # cat dev
1768c2ecf20Sopenharmony_ci	254:1
1778c2ecf20Sopenharmony_ci
1788c2ecf20Sopenharmony_ci	Pow5:/sys/class/tty/hvcs2/ # cat dev
1798c2ecf20Sopenharmony_ci	254:2
1808c2ecf20Sopenharmony_ci
1818c2ecf20Sopenharmony_ci	Pow5:/sys/class/tty/hvcs3/ # cat dev
1828c2ecf20Sopenharmony_ci	254:3
1838c2ecf20Sopenharmony_ci
1848c2ecf20Sopenharmony_ciThe output from reading the "dev" attribute is the char device major and
1858c2ecf20Sopenharmony_ciminor numbers that the tty layer has allocated for this driver's use.  Most
1868c2ecf20Sopenharmony_cisystems running hvcs will already have the device entries created or udev
1878c2ecf20Sopenharmony_ciwill do it automatically.
1888c2ecf20Sopenharmony_ci
1898c2ecf20Sopenharmony_ciGiven the example output above, to manually create a /dev/hvcs* node entry
1908c2ecf20Sopenharmony_cimknod can be used as follows::
1918c2ecf20Sopenharmony_ci
1928c2ecf20Sopenharmony_ci	mknod /dev/hvcs0 c 254 0
1938c2ecf20Sopenharmony_ci	mknod /dev/hvcs1 c 254 1
1948c2ecf20Sopenharmony_ci	mknod /dev/hvcs2 c 254 2
1958c2ecf20Sopenharmony_ci	mknod /dev/hvcs3 c 254 3
1968c2ecf20Sopenharmony_ci
1978c2ecf20Sopenharmony_ciUsing mknod to manually create the device entries makes these device nodes
1988c2ecf20Sopenharmony_cipersistent.  Once created they will exist prior to the driver insmod.
1998c2ecf20Sopenharmony_ci
2008c2ecf20Sopenharmony_ciAttempting to connect an application to /dev/hvcs* prior to insertion of
2018c2ecf20Sopenharmony_cithe hvcs module will result in an error message similar to the following::
2028c2ecf20Sopenharmony_ci
2038c2ecf20Sopenharmony_ci	"/dev/hvcs*: No such device".
2048c2ecf20Sopenharmony_ci
2058c2ecf20Sopenharmony_ciNOTE: Just because there is a device node present doesn't mean that there
2068c2ecf20Sopenharmony_ciis a vty-server device configured for that node.
2078c2ecf20Sopenharmony_ci
2088c2ecf20Sopenharmony_ci5. Connection
2098c2ecf20Sopenharmony_ci=============
2108c2ecf20Sopenharmony_ci
2118c2ecf20Sopenharmony_ciSince this driver controls devices that provide a tty interface a user can
2128c2ecf20Sopenharmony_ciinteract with the device node entries using any standard tty-interactive
2138c2ecf20Sopenharmony_cimethod (e.g. "cat", "dd", "echo").  The intent of this driver however, is
2148c2ecf20Sopenharmony_cito provide real time console interaction with a Linux partition's console,
2158c2ecf20Sopenharmony_ciwhich requires the use of applications that provide bi-directional,
2168c2ecf20Sopenharmony_ciinteractive I/O with a tty device.
2178c2ecf20Sopenharmony_ci
2188c2ecf20Sopenharmony_ciApplications (e.g. "minicom" and "screen") that act as terminal emulators
2198c2ecf20Sopenharmony_cior perform terminal type control sequence conversion on the data being
2208c2ecf20Sopenharmony_cipassed through them are NOT acceptable for providing interactive console
2218c2ecf20Sopenharmony_ciI/O.  These programs often emulate antiquated terminal types (vt100 and
2228c2ecf20Sopenharmony_ciANSI) and expect inbound data to take the form of one of these supported
2238c2ecf20Sopenharmony_citerminal types but they either do not convert, or do not _adequately_
2248c2ecf20Sopenharmony_ciconvert, outbound data into the terminal type of the terminal which invoked
2258c2ecf20Sopenharmony_cithem (though screen makes an attempt and can apparently be configured with
2268c2ecf20Sopenharmony_cimuch termcap wrestling.)
2278c2ecf20Sopenharmony_ci
2288c2ecf20Sopenharmony_ciFor this reason kermit and cu are two of the recommended applications for
2298c2ecf20Sopenharmony_ciinteracting with a Linux console via an hvcs device.  These programs simply
2308c2ecf20Sopenharmony_ciact as a conduit for data transfer to and from the tty device.  They do not
2318c2ecf20Sopenharmony_cirequire inbound data to take the form of a particular terminal type, nor do
2328c2ecf20Sopenharmony_cithey cook outbound data to a particular terminal type.
2338c2ecf20Sopenharmony_ci
2348c2ecf20Sopenharmony_ciIn order to ensure proper functioning of console applications one must make
2358c2ecf20Sopenharmony_cisure that once connected to a /dev/hvcs console that the console's $TERM
2368c2ecf20Sopenharmony_cienv variable is set to the exact terminal type of the terminal emulator
2378c2ecf20Sopenharmony_ciused to launch the interactive I/O application.  If one is using xterm and
2388c2ecf20Sopenharmony_cikermit to connect to /dev/hvcs0 when the console prompt becomes available
2398c2ecf20Sopenharmony_cione should "export TERM=xterm" on the console.  This tells ncurses
2408c2ecf20Sopenharmony_ciapplications that are invoked from the console that they should output
2418c2ecf20Sopenharmony_cicontrol sequences that xterm can understand.
2428c2ecf20Sopenharmony_ci
2438c2ecf20Sopenharmony_ciAs a precautionary measure an hvcs user should always "exit" from their
2448c2ecf20Sopenharmony_cisession before disconnecting an application such as kermit from the device
2458c2ecf20Sopenharmony_cinode.  If this is not done, the next user to connect to the console will
2468c2ecf20Sopenharmony_cicontinue using the previous user's logged in session which includes
2478c2ecf20Sopenharmony_ciusing the $TERM variable that the previous user supplied.
2488c2ecf20Sopenharmony_ci
2498c2ecf20Sopenharmony_ciHotplug add and remove of vty-server adapters affects which /dev/hvcs* node
2508c2ecf20Sopenharmony_ciis used to connect to each vty-server adapter.  In order to determine which
2518c2ecf20Sopenharmony_civty-server adapter is associated with which /dev/hvcs* node a special sysfs
2528c2ecf20Sopenharmony_ciattribute has been added to each vty-server sysfs entry.  This entry is
2538c2ecf20Sopenharmony_cicalled "index" and showing it reveals an integer that refers to the
2548c2ecf20Sopenharmony_ci/dev/hvcs* entry to use to connect to that device.  For instance cating the
2558c2ecf20Sopenharmony_ciindex attribute of vty-server adapter 30000004 shows the following::
2568c2ecf20Sopenharmony_ci
2578c2ecf20Sopenharmony_ci	Pow5:/sys/bus/vio/drivers/hvcs/30000004 # cat index
2588c2ecf20Sopenharmony_ci	2
2598c2ecf20Sopenharmony_ci
2608c2ecf20Sopenharmony_ciThis index of '2' means that in order to connect to vty-server adapter
2618c2ecf20Sopenharmony_ci30000004 the user should interact with /dev/hvcs2.
2628c2ecf20Sopenharmony_ci
2638c2ecf20Sopenharmony_ciIt should be noted that due to the system hotplug I/O capabilities of a
2648c2ecf20Sopenharmony_cisystem the /dev/hvcs* entry that interacts with a particular vty-server
2658c2ecf20Sopenharmony_ciadapter is not guaranteed to remain the same across system reboots.  Look
2668c2ecf20Sopenharmony_ciin the Q & A section for more on this issue.
2678c2ecf20Sopenharmony_ci
2688c2ecf20Sopenharmony_ci6. Disconnection
2698c2ecf20Sopenharmony_ci================
2708c2ecf20Sopenharmony_ci
2718c2ecf20Sopenharmony_ciAs a security feature to prevent the delivery of stale data to an
2728c2ecf20Sopenharmony_ciunintended target the Power5 system firmware disables the fetching of data
2738c2ecf20Sopenharmony_ciand discards that data when a connection between a vty-server and a vty has
2748c2ecf20Sopenharmony_cibeen severed.  As an example, when a vty-server is immediately disconnected
2758c2ecf20Sopenharmony_cifrom a vty following output of data to the vty the vty adapter may not have
2768c2ecf20Sopenharmony_cienough time between when it received the data interrupt and when the
2778c2ecf20Sopenharmony_ciconnection was severed to fetch the data from firmware before the fetch is
2788c2ecf20Sopenharmony_cidisabled by firmware.
2798c2ecf20Sopenharmony_ci
2808c2ecf20Sopenharmony_ciWhen hvcs is being used to serve consoles this behavior is not a huge issue
2818c2ecf20Sopenharmony_cibecause the adapter stays connected for large amounts of time following
2828c2ecf20Sopenharmony_cialmost all data writes.  When hvcs is being used as a tty conduit to tunnel
2838c2ecf20Sopenharmony_cidata between two partitions [see Q & A below] this is a huge problem
2848c2ecf20Sopenharmony_cibecause the standard Linux behavior when cat'ing or dd'ing data to a device
2858c2ecf20Sopenharmony_ciis to open the tty, send the data, and then close the tty.  If this driver
2868c2ecf20Sopenharmony_cimanually terminated vty-server connections on tty close this would close
2878c2ecf20Sopenharmony_cithe vty-server and vty connection before the target vty has had a chance to
2888c2ecf20Sopenharmony_cifetch the data.
2898c2ecf20Sopenharmony_ci
2908c2ecf20Sopenharmony_ciAdditionally, disconnecting a vty-server and vty only on module removal or
2918c2ecf20Sopenharmony_ciadapter removal is impractical because other vty-servers in other
2928c2ecf20Sopenharmony_cipartitions may require the usage of the target vty at any time.
2938c2ecf20Sopenharmony_ci
2948c2ecf20Sopenharmony_ciDue to this behavioral restriction disconnection of vty-servers from the
2958c2ecf20Sopenharmony_ciconnected vty is a manual procedure using a write to a sysfs attribute
2968c2ecf20Sopenharmony_cioutlined below, on the other hand the initial vty-server connection to a
2978c2ecf20Sopenharmony_civty is established automatically by this driver.  Manual vty-server
2988c2ecf20Sopenharmony_ciconnection is never required.
2998c2ecf20Sopenharmony_ci
3008c2ecf20Sopenharmony_ciIn order to terminate the connection between a vty-server and vty the
3018c2ecf20Sopenharmony_ci"vterm_state" sysfs attribute within each vty-server's sysfs entry is used.
3028c2ecf20Sopenharmony_ciReading this attribute reveals the current connection state of the
3038c2ecf20Sopenharmony_civty-server adapter.  A zero means that the vty-server is not connected to a
3048c2ecf20Sopenharmony_civty.  A one indicates that a connection is active.
3058c2ecf20Sopenharmony_ci
3068c2ecf20Sopenharmony_ciWriting a '0' (zero) to the vterm_state attribute will disconnect the VTERM
3078c2ecf20Sopenharmony_ciconnection between the vty-server and target vty ONLY if the vterm_state
3088c2ecf20Sopenharmony_cipreviously read '1'.  The write directive is ignored if the vterm_state
3098c2ecf20Sopenharmony_ciread '0' or if any value other than '0' was written to the vterm_state
3108c2ecf20Sopenharmony_ciattribute.  The following example will show the method used for verifying
3118c2ecf20Sopenharmony_cithe vty-server connection status and disconnecting a vty-server connection::
3128c2ecf20Sopenharmony_ci
3138c2ecf20Sopenharmony_ci	Pow5:/sys/bus/vio/drivers/hvcs/30000004 # cat vterm_state
3148c2ecf20Sopenharmony_ci	1
3158c2ecf20Sopenharmony_ci
3168c2ecf20Sopenharmony_ci	Pow5:/sys/bus/vio/drivers/hvcs/30000004 # echo 0 > vterm_state
3178c2ecf20Sopenharmony_ci
3188c2ecf20Sopenharmony_ci	Pow5:/sys/bus/vio/drivers/hvcs/30000004 # cat vterm_state
3198c2ecf20Sopenharmony_ci	0
3208c2ecf20Sopenharmony_ci
3218c2ecf20Sopenharmony_ciAll vty-server connections are automatically terminated when the device is
3228c2ecf20Sopenharmony_cihotplug removed and when the module is removed.
3238c2ecf20Sopenharmony_ci
3248c2ecf20Sopenharmony_ci7. Configuration
3258c2ecf20Sopenharmony_ci================
3268c2ecf20Sopenharmony_ci
3278c2ecf20Sopenharmony_ciEach vty-server has a sysfs entry in the /sys/devices/vio directory, which
3288c2ecf20Sopenharmony_ciis symlinked in several other sysfs tree directories, notably under the
3298c2ecf20Sopenharmony_cihvcs driver entry, which looks like the following example::
3308c2ecf20Sopenharmony_ci
3318c2ecf20Sopenharmony_ci	Pow5:/sys/bus/vio/drivers/hvcs # ls
3328c2ecf20Sopenharmony_ci	.  ..  30000003  30000004  rescan
3338c2ecf20Sopenharmony_ci
3348c2ecf20Sopenharmony_ciBy design, firmware notifies the hvcs driver of vty-server lifetimes and
3358c2ecf20Sopenharmony_cipartner vty removals but not the addition of partner vtys.  Since an HMC
3368c2ecf20Sopenharmony_ciSuper Admin can add partner info dynamically we have provided the hvcs
3378c2ecf20Sopenharmony_cidriver sysfs directory with the "rescan" update attribute which will query
3388c2ecf20Sopenharmony_cifirmware and update the partner info for all the vty-servers that this
3398c2ecf20Sopenharmony_cidriver manages.  Writing a '1' to the attribute triggers the update.  An
3408c2ecf20Sopenharmony_ciexplicit example follows:
3418c2ecf20Sopenharmony_ci
3428c2ecf20Sopenharmony_ci	Pow5:/sys/bus/vio/drivers/hvcs # echo 1 > rescan
3438c2ecf20Sopenharmony_ci
3448c2ecf20Sopenharmony_ciReading the attribute will indicate a state of '1' or '0'.  A one indicates
3458c2ecf20Sopenharmony_cithat an update is in process.  A zero indicates that an update has
3468c2ecf20Sopenharmony_cicompleted or was never executed.
3478c2ecf20Sopenharmony_ci
3488c2ecf20Sopenharmony_ciVty-server entries in this directory are a 32 bit partition unique unit
3498c2ecf20Sopenharmony_ciaddress that is created by firmware.  An example vty-server sysfs entry
3508c2ecf20Sopenharmony_cilooks like the following::
3518c2ecf20Sopenharmony_ci
3528c2ecf20Sopenharmony_ci	Pow5:/sys/bus/vio/drivers/hvcs/30000004 # ls
3538c2ecf20Sopenharmony_ci	.   current_vty   devspec       name          partner_vtys
3548c2ecf20Sopenharmony_ci	..  index         partner_clcs  vterm_state
3558c2ecf20Sopenharmony_ci
3568c2ecf20Sopenharmony_ciEach entry is provided, by default with a "name" attribute.  Reading the
3578c2ecf20Sopenharmony_ci"name" attribute will reveal the device type as shown in the following
3588c2ecf20Sopenharmony_ciexample::
3598c2ecf20Sopenharmony_ci
3608c2ecf20Sopenharmony_ci	Pow5:/sys/bus/vio/drivers/hvcs/30000003 # cat name
3618c2ecf20Sopenharmony_ci	vty-server
3628c2ecf20Sopenharmony_ci
3638c2ecf20Sopenharmony_ciEach entry is also provided, by default, with a "devspec" attribute which
3648c2ecf20Sopenharmony_cireveals the full device specification when read, as shown in the following
3658c2ecf20Sopenharmony_ciexample::
3668c2ecf20Sopenharmony_ci
3678c2ecf20Sopenharmony_ci	Pow5:/sys/bus/vio/drivers/hvcs/30000004 # cat devspec
3688c2ecf20Sopenharmony_ci	/vdevice/vty-server@30000004
3698c2ecf20Sopenharmony_ci
3708c2ecf20Sopenharmony_ciEach vty-server sysfs dir is provided with two read-only attributes that
3718c2ecf20Sopenharmony_ciprovide lists of easily parsed partner vty data: "partner_vtys" and
3728c2ecf20Sopenharmony_ci"partner_clcs"::
3738c2ecf20Sopenharmony_ci
3748c2ecf20Sopenharmony_ci	Pow5:/sys/bus/vio/drivers/hvcs/30000004 # cat partner_vtys
3758c2ecf20Sopenharmony_ci	30000000
3768c2ecf20Sopenharmony_ci	30000001
3778c2ecf20Sopenharmony_ci	30000002
3788c2ecf20Sopenharmony_ci	30000000
3798c2ecf20Sopenharmony_ci	30000000
3808c2ecf20Sopenharmony_ci
3818c2ecf20Sopenharmony_ci	Pow5:/sys/bus/vio/drivers/hvcs/30000004 # cat partner_clcs
3828c2ecf20Sopenharmony_ci	U5112.428.103048A-V3-C0
3838c2ecf20Sopenharmony_ci	U5112.428.103048A-V3-C2
3848c2ecf20Sopenharmony_ci	U5112.428.103048A-V3-C3
3858c2ecf20Sopenharmony_ci	U5112.428.103048A-V4-C0
3868c2ecf20Sopenharmony_ci	U5112.428.103048A-V5-C0
3878c2ecf20Sopenharmony_ci
3888c2ecf20Sopenharmony_ciReading partner_vtys returns a list of partner vtys.  Vty unit address
3898c2ecf20Sopenharmony_cinumbering is only per-partition-unique so entries will frequently repeat.
3908c2ecf20Sopenharmony_ci
3918c2ecf20Sopenharmony_ciReading partner_clcs returns a list of "converged location codes" which are
3928c2ecf20Sopenharmony_cicomposed of a system serial number followed by "-V*", where the '*' is the
3938c2ecf20Sopenharmony_citarget partition number, and "-C*", where the '*' is the slot of the
3948c2ecf20Sopenharmony_ciadapter.  The first vty partner corresponds to the first clc item, the
3958c2ecf20Sopenharmony_cisecond vty partner to the second clc item, etc.
3968c2ecf20Sopenharmony_ci
3978c2ecf20Sopenharmony_ciA vty-server can only be connected to a single vty at a time.  The entry,
3988c2ecf20Sopenharmony_ci"current_vty" prints the clc of the currently selected partner vty when
3998c2ecf20Sopenharmony_ciread.
4008c2ecf20Sopenharmony_ci
4018c2ecf20Sopenharmony_ciThe current_vty can be changed by writing a valid partner clc to the entry
4028c2ecf20Sopenharmony_cias in the following example::
4038c2ecf20Sopenharmony_ci
4048c2ecf20Sopenharmony_ci	Pow5:/sys/bus/vio/drivers/hvcs/30000004 # echo U5112.428.10304
4058c2ecf20Sopenharmony_ci	8A-V4-C0 > current_vty
4068c2ecf20Sopenharmony_ci
4078c2ecf20Sopenharmony_ciChanging the current_vty when a vty-server is already connected to a vty
4088c2ecf20Sopenharmony_cidoes not affect the current connection.  The change takes effect when the
4098c2ecf20Sopenharmony_cicurrently open connection is freed.
4108c2ecf20Sopenharmony_ci
4118c2ecf20Sopenharmony_ciInformation on the "vterm_state" attribute was covered earlier on the
4128c2ecf20Sopenharmony_cichapter entitled "disconnection".
4138c2ecf20Sopenharmony_ci
4148c2ecf20Sopenharmony_ci8. Questions & Answers:
4158c2ecf20Sopenharmony_ci=======================
4168c2ecf20Sopenharmony_ci
4178c2ecf20Sopenharmony_ciQ: What are the security concerns involving hvcs?
4188c2ecf20Sopenharmony_ci
4198c2ecf20Sopenharmony_ciA: There are three main security concerns:
4208c2ecf20Sopenharmony_ci
4218c2ecf20Sopenharmony_ci	1. The creator of the /dev/hvcs* nodes has the ability to restrict
4228c2ecf20Sopenharmony_ci	the access of the device entries to certain users or groups.  It
4238c2ecf20Sopenharmony_ci	may be best to create a special hvcs group privilege for providing
4248c2ecf20Sopenharmony_ci	access to system consoles.
4258c2ecf20Sopenharmony_ci
4268c2ecf20Sopenharmony_ci	2. To provide network security when grabbing the console it is
4278c2ecf20Sopenharmony_ci	suggested that the user connect to the console hosting partition
4288c2ecf20Sopenharmony_ci	using a secure method, such as SSH or sit at a hardware console.
4298c2ecf20Sopenharmony_ci
4308c2ecf20Sopenharmony_ci	3. Make sure to exit the user session when done with a console or
4318c2ecf20Sopenharmony_ci	the next vty-server connection (which may be from another
4328c2ecf20Sopenharmony_ci	partition) will experience the previously logged in session.
4338c2ecf20Sopenharmony_ci
4348c2ecf20Sopenharmony_ci---------------------------------------------------------------------------
4358c2ecf20Sopenharmony_ci
4368c2ecf20Sopenharmony_ciQ: How do I multiplex a console that I grab through hvcs so that other
4378c2ecf20Sopenharmony_cipeople can see it:
4388c2ecf20Sopenharmony_ci
4398c2ecf20Sopenharmony_ciA: You can use "screen" to directly connect to the /dev/hvcs* device and
4408c2ecf20Sopenharmony_cisetup a session on your machine with the console group privileges.  As
4418c2ecf20Sopenharmony_cipointed out earlier by default screen doesn't provide the termcap settings
4428c2ecf20Sopenharmony_cifor most terminal emulators to provide adequate character conversion from
4438c2ecf20Sopenharmony_citerm type "screen" to others.  This means that curses based programs may
4448c2ecf20Sopenharmony_cinot display properly in screen sessions.
4458c2ecf20Sopenharmony_ci
4468c2ecf20Sopenharmony_ci---------------------------------------------------------------------------
4478c2ecf20Sopenharmony_ci
4488c2ecf20Sopenharmony_ciQ: Why are the colors all messed up?
4498c2ecf20Sopenharmony_ciQ: Why are the control characters acting strange or not working?
4508c2ecf20Sopenharmony_ciQ: Why is the console output all strange and unintelligible?
4518c2ecf20Sopenharmony_ci
4528c2ecf20Sopenharmony_ciA: Please see the preceding section on "Connection" for a discussion of how
4538c2ecf20Sopenharmony_ciapplications can affect the display of character control sequences.
4548c2ecf20Sopenharmony_ciAdditionally, just because you logged into the console using and xterm
4558c2ecf20Sopenharmony_cidoesn't mean someone else didn't log into the console with the HMC console
4568c2ecf20Sopenharmony_ci(vt320) before you and leave the session logged in.  The best thing to do
4578c2ecf20Sopenharmony_ciis to export TERM to the terminal type of your terminal emulator when you
4588c2ecf20Sopenharmony_ciget the console.  Additionally make sure to "exit" the console before you
4598c2ecf20Sopenharmony_cidisconnect from the console.  This will ensure that the next user gets
4608c2ecf20Sopenharmony_citheir own TERM type set when they login.
4618c2ecf20Sopenharmony_ci
4628c2ecf20Sopenharmony_ci---------------------------------------------------------------------------
4638c2ecf20Sopenharmony_ci
4648c2ecf20Sopenharmony_ciQ: When I try to CONNECT kermit to an hvcs device I get:
4658c2ecf20Sopenharmony_ci"Sorry, can't open connection: /dev/hvcs*"What is happening?
4668c2ecf20Sopenharmony_ci
4678c2ecf20Sopenharmony_ciA: Some other Power5 console mechanism has a connection to the vty and
4688c2ecf20Sopenharmony_ciisn't giving it up.  You can try to force disconnect the consoles from the
4698c2ecf20Sopenharmony_ciHMC by right clicking on the partition and then selecting "close terminal".
4708c2ecf20Sopenharmony_ciOtherwise you have to hunt down the people who have console authority.  It
4718c2ecf20Sopenharmony_ciis possible that you already have the console open using another kermit
4728c2ecf20Sopenharmony_cisession and just forgot about it.  Please review the console options for
4738c2ecf20Sopenharmony_ciPower5 systems to determine the many ways a system console can be held.
4748c2ecf20Sopenharmony_ci
4758c2ecf20Sopenharmony_ciOR
4768c2ecf20Sopenharmony_ci
4778c2ecf20Sopenharmony_ciA: Another user may not have a connectivity method currently attached to a
4788c2ecf20Sopenharmony_ci/dev/hvcs device but the vterm_state may reveal that they still have the
4798c2ecf20Sopenharmony_civty-server connection established.  They need to free this using the method
4808c2ecf20Sopenharmony_cioutlined in the section on "Disconnection" in order for others to connect
4818c2ecf20Sopenharmony_cito the target vty.
4828c2ecf20Sopenharmony_ci
4838c2ecf20Sopenharmony_ciOR
4848c2ecf20Sopenharmony_ci
4858c2ecf20Sopenharmony_ciA: The user profile you are using to execute kermit probably doesn't have
4868c2ecf20Sopenharmony_cipermissions to use the /dev/hvcs* device.
4878c2ecf20Sopenharmony_ci
4888c2ecf20Sopenharmony_ciOR
4898c2ecf20Sopenharmony_ci
4908c2ecf20Sopenharmony_ciA: You probably haven't inserted the hvcs.ko module yet but the /dev/hvcs*
4918c2ecf20Sopenharmony_cientry still exists (on systems without udev).
4928c2ecf20Sopenharmony_ci
4938c2ecf20Sopenharmony_ciOR
4948c2ecf20Sopenharmony_ci
4958c2ecf20Sopenharmony_ciA: There is not a corresponding vty-server device that maps to an existing
4968c2ecf20Sopenharmony_ci/dev/hvcs* entry.
4978c2ecf20Sopenharmony_ci
4988c2ecf20Sopenharmony_ci---------------------------------------------------------------------------
4998c2ecf20Sopenharmony_ci
5008c2ecf20Sopenharmony_ciQ: When I try to CONNECT kermit to an hvcs device I get:
5018c2ecf20Sopenharmony_ci"Sorry, write access to UUCP lockfile directory denied."
5028c2ecf20Sopenharmony_ci
5038c2ecf20Sopenharmony_ciA: The /dev/hvcs* entry you have specified doesn't exist where you said it
5048c2ecf20Sopenharmony_cidoes?  Maybe you haven't inserted the module (on systems with udev).
5058c2ecf20Sopenharmony_ci
5068c2ecf20Sopenharmony_ci---------------------------------------------------------------------------
5078c2ecf20Sopenharmony_ci
5088c2ecf20Sopenharmony_ciQ: If I already have one Linux partition installed can I use hvcs on said
5098c2ecf20Sopenharmony_cipartition to provide the console for the install of a second Linux
5108c2ecf20Sopenharmony_cipartition?
5118c2ecf20Sopenharmony_ci
5128c2ecf20Sopenharmony_ciA: Yes granted that your are connected to the /dev/hvcs* device using
5138c2ecf20Sopenharmony_cikermit or cu or some other program that doesn't provide terminal emulation.
5148c2ecf20Sopenharmony_ci
5158c2ecf20Sopenharmony_ci---------------------------------------------------------------------------
5168c2ecf20Sopenharmony_ci
5178c2ecf20Sopenharmony_ciQ: Can I connect to more than one partition's console at a time using this
5188c2ecf20Sopenharmony_cidriver?
5198c2ecf20Sopenharmony_ci
5208c2ecf20Sopenharmony_ciA: Yes.  Of course this means that there must be more than one vty-server
5218c2ecf20Sopenharmony_ciconfigured for this partition and each must point to a disconnected vty.
5228c2ecf20Sopenharmony_ci
5238c2ecf20Sopenharmony_ci---------------------------------------------------------------------------
5248c2ecf20Sopenharmony_ci
5258c2ecf20Sopenharmony_ciQ: Does the hvcs driver support dynamic (hotplug) addition of devices?
5268c2ecf20Sopenharmony_ci
5278c2ecf20Sopenharmony_ciA: Yes, if you have dlpar and hotplug enabled for your system and it has
5288c2ecf20Sopenharmony_cibeen built into the kernel the hvcs drivers is configured to dynamically
5298c2ecf20Sopenharmony_cihandle additions of new devices and removals of unused devices.
5308c2ecf20Sopenharmony_ci
5318c2ecf20Sopenharmony_ci---------------------------------------------------------------------------
5328c2ecf20Sopenharmony_ci
5338c2ecf20Sopenharmony_ciQ: For some reason /dev/hvcs* doesn't map to the same vty-server adapter
5348c2ecf20Sopenharmony_ciafter a reboot.  What happened?
5358c2ecf20Sopenharmony_ci
5368c2ecf20Sopenharmony_ciA: Assignment of vty-server adapters to /dev/hvcs* entries is always done
5378c2ecf20Sopenharmony_ciin the order that the adapters are exposed.  Due to hotplug capabilities of
5388c2ecf20Sopenharmony_cithis driver assignment of hotplug added vty-servers may be in a different
5398c2ecf20Sopenharmony_ciorder than how they would be exposed on module load.  Rebooting or
5408c2ecf20Sopenharmony_cireloading the module after dynamic addition may result in the /dev/hvcs*
5418c2ecf20Sopenharmony_ciand vty-server coupling changing if a vty-server adapter was added in a
5428c2ecf20Sopenharmony_cislot between two other vty-server adapters.  Refer to the section above
5438c2ecf20Sopenharmony_cion how to determine which vty-server goes with which /dev/hvcs* node.
5448c2ecf20Sopenharmony_ciHint; look at the sysfs "index" attribute for the vty-server.
5458c2ecf20Sopenharmony_ci
5468c2ecf20Sopenharmony_ci---------------------------------------------------------------------------
5478c2ecf20Sopenharmony_ci
5488c2ecf20Sopenharmony_ciQ: Can I use /dev/hvcs* as a conduit to another partition and use a tty
5498c2ecf20Sopenharmony_cidevice on that partition as the other end of the pipe?
5508c2ecf20Sopenharmony_ci
5518c2ecf20Sopenharmony_ciA: Yes, on Power5 platforms the hvc_console driver provides a tty interface
5528c2ecf20Sopenharmony_cifor extra /dev/hvc* devices (where /dev/hvc0 is most likely the console).
5538c2ecf20Sopenharmony_ciIn order to get a tty conduit working between the two partitions the HMC
5548c2ecf20Sopenharmony_ciSuper Admin must create an additional "serial server" for the target
5558c2ecf20Sopenharmony_cipartition with the HMC gui which will show up as /dev/hvc* when the target
5568c2ecf20Sopenharmony_cipartition is rebooted.
5578c2ecf20Sopenharmony_ci
5588c2ecf20Sopenharmony_ciThe HMC Super Admin then creates an additional "serial client" for the
5598c2ecf20Sopenharmony_cicurrent partition and points this at the target partition's newly created
5608c2ecf20Sopenharmony_ci"serial server" adapter (remember the slot).  This shows up as an
5618c2ecf20Sopenharmony_ciadditional /dev/hvcs* device.
5628c2ecf20Sopenharmony_ci
5638c2ecf20Sopenharmony_ciNow a program on the target system can be configured to read or write to
5648c2ecf20Sopenharmony_ci/dev/hvc* and another program on the current partition can be configured to
5658c2ecf20Sopenharmony_ciread or write to /dev/hvcs*.  Now you have a tty conduit between two
5668c2ecf20Sopenharmony_cipartitions.
5678c2ecf20Sopenharmony_ci
5688c2ecf20Sopenharmony_ci---------------------------------------------------------------------------
5698c2ecf20Sopenharmony_ci
5708c2ecf20Sopenharmony_ci9. Reporting Bugs:
5718c2ecf20Sopenharmony_ci==================
5728c2ecf20Sopenharmony_ci
5738c2ecf20Sopenharmony_ciThe proper channel for reporting bugs is either through the Linux OS
5748c2ecf20Sopenharmony_cidistribution company that provided your OS or by posting issues to the
5758c2ecf20Sopenharmony_ciPowerPC development mailing list at:
5768c2ecf20Sopenharmony_ci
5778c2ecf20Sopenharmony_cilinuxppc-dev@lists.ozlabs.org
5788c2ecf20Sopenharmony_ci
5798c2ecf20Sopenharmony_ciThis request is to provide a documented and searchable public exchange
5808c2ecf20Sopenharmony_ciof the problems and solutions surrounding this driver for the benefit of
5818c2ecf20Sopenharmony_ciall users.
582