162306a36Sopenharmony_ci===============================================================
262306a36Sopenharmony_ciHVCS IBM "Hypervisor Virtual Console Server" Installation Guide
362306a36Sopenharmony_ci===============================================================
462306a36Sopenharmony_ci
562306a36Sopenharmony_cifor Linux Kernel 2.6.4+
662306a36Sopenharmony_ci
762306a36Sopenharmony_ciCopyright (C) 2004 IBM Corporation
862306a36Sopenharmony_ci
962306a36Sopenharmony_ci.. ===========================================================================
1062306a36Sopenharmony_ci.. NOTE:Eight space tabs are the optimum editor setting for reading this file.
1162306a36Sopenharmony_ci.. ===========================================================================
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_ci
1462306a36Sopenharmony_ciAuthor(s): Ryan S. Arnold <rsa@us.ibm.com>
1562306a36Sopenharmony_ci
1662306a36Sopenharmony_ciDate Created: March, 02, 2004
1762306a36Sopenharmony_ciLast Changed: August, 24, 2004
1862306a36Sopenharmony_ci
1962306a36Sopenharmony_ci.. Table of contents:
2062306a36Sopenharmony_ci
2162306a36Sopenharmony_ci	1.  Driver Introduction:
2262306a36Sopenharmony_ci	2.  System Requirements
2362306a36Sopenharmony_ci	3.  Build Options:
2462306a36Sopenharmony_ci		3.1  Built-in:
2562306a36Sopenharmony_ci		3.2  Module:
2662306a36Sopenharmony_ci	4.  Installation:
2762306a36Sopenharmony_ci	5.  Connection:
2862306a36Sopenharmony_ci	6.  Disconnection:
2962306a36Sopenharmony_ci	7.  Configuration:
3062306a36Sopenharmony_ci	8.  Questions & Answers:
3162306a36Sopenharmony_ci	9.  Reporting Bugs:
3262306a36Sopenharmony_ci
3362306a36Sopenharmony_ci1. Driver Introduction:
3462306a36Sopenharmony_ci=======================
3562306a36Sopenharmony_ci
3662306a36Sopenharmony_ciThis is the device driver for the IBM Hypervisor Virtual Console Server,
3762306a36Sopenharmony_ci"hvcs".  The IBM hvcs provides a tty driver interface to allow Linux user
3862306a36Sopenharmony_cispace applications access to the system consoles of logically partitioned
3962306a36Sopenharmony_cioperating systems (Linux and AIX) running on the same partitioned Power5
4062306a36Sopenharmony_cippc64 system.  Physical hardware consoles per partition are not practical
4162306a36Sopenharmony_cion this hardware so system consoles are accessed by this driver using
4262306a36Sopenharmony_cifirmware interfaces to virtual terminal devices.
4362306a36Sopenharmony_ci
4462306a36Sopenharmony_ci2. System Requirements:
4562306a36Sopenharmony_ci=======================
4662306a36Sopenharmony_ci
4762306a36Sopenharmony_ciThis device driver was written using 2.6.4 Linux kernel APIs and will only
4862306a36Sopenharmony_cibuild and run on kernels of this version or later.
4962306a36Sopenharmony_ci
5062306a36Sopenharmony_ciThis driver was written to operate solely on IBM Power5 ppc64 hardware
5162306a36Sopenharmony_cithough some care was taken to abstract the architecture dependent firmware
5262306a36Sopenharmony_cicalls from the driver code.
5362306a36Sopenharmony_ci
5462306a36Sopenharmony_ciSysfs must be mounted on the system so that the user can determine which
5562306a36Sopenharmony_cimajor and minor numbers are associated with each vty-server.  Directions
5662306a36Sopenharmony_cifor sysfs mounting are outside the scope of this document.
5762306a36Sopenharmony_ci
5862306a36Sopenharmony_ci3. Build Options:
5962306a36Sopenharmony_ci=================
6062306a36Sopenharmony_ci
6162306a36Sopenharmony_ciThe hvcs driver registers itself as a tty driver.  The tty layer
6262306a36Sopenharmony_cidynamically allocates a block of major and minor numbers in a quantity
6362306a36Sopenharmony_cirequested by the registering driver.  The hvcs driver asks the tty layer
6462306a36Sopenharmony_cifor 64 of these major/minor numbers by default to use for hvcs device node
6562306a36Sopenharmony_cientries.
6662306a36Sopenharmony_ci
6762306a36Sopenharmony_ciIf the default number of device entries is adequate then this driver can be
6862306a36Sopenharmony_cibuilt into the kernel.  If not, the default can be over-ridden by inserting
6962306a36Sopenharmony_cithe driver as a module with insmod parameters.
7062306a36Sopenharmony_ci
7162306a36Sopenharmony_ci3.1 Built-in:
7262306a36Sopenharmony_ci-------------
7362306a36Sopenharmony_ci
7462306a36Sopenharmony_ciThe following menuconfig example demonstrates selecting to build this
7562306a36Sopenharmony_cidriver into the kernel::
7662306a36Sopenharmony_ci
7762306a36Sopenharmony_ci	Device Drivers  --->
7862306a36Sopenharmony_ci		Character devices  --->
7962306a36Sopenharmony_ci			<*> IBM Hypervisor Virtual Console Server Support
8062306a36Sopenharmony_ci
8162306a36Sopenharmony_ciBegin the kernel make process.
8262306a36Sopenharmony_ci
8362306a36Sopenharmony_ci3.2 Module:
8462306a36Sopenharmony_ci-----------
8562306a36Sopenharmony_ci
8662306a36Sopenharmony_ciThe following menuconfig example demonstrates selecting to build this
8762306a36Sopenharmony_cidriver as a kernel module::
8862306a36Sopenharmony_ci
8962306a36Sopenharmony_ci	Device Drivers  --->
9062306a36Sopenharmony_ci		Character devices  --->
9162306a36Sopenharmony_ci			<M> IBM Hypervisor Virtual Console Server Support
9262306a36Sopenharmony_ci
9362306a36Sopenharmony_ciThe make process will build the following kernel modules:
9462306a36Sopenharmony_ci
9562306a36Sopenharmony_ci	- hvcs.ko
9662306a36Sopenharmony_ci	- hvcserver.ko
9762306a36Sopenharmony_ci
9862306a36Sopenharmony_ciTo insert the module with the default allocation execute the following
9962306a36Sopenharmony_cicommands in the order they appear::
10062306a36Sopenharmony_ci
10162306a36Sopenharmony_ci	insmod hvcserver.ko
10262306a36Sopenharmony_ci	insmod hvcs.ko
10362306a36Sopenharmony_ci
10462306a36Sopenharmony_ciThe hvcserver module contains architecture specific firmware calls and must
10562306a36Sopenharmony_cibe inserted first, otherwise the hvcs module will not find some of the
10662306a36Sopenharmony_cisymbols it expects.
10762306a36Sopenharmony_ci
10862306a36Sopenharmony_ciTo override the default use an insmod parameter as follows (requesting 4
10962306a36Sopenharmony_citty devices as an example)::
11062306a36Sopenharmony_ci
11162306a36Sopenharmony_ci	insmod hvcs.ko hvcs_parm_num_devs=4
11262306a36Sopenharmony_ci
11362306a36Sopenharmony_ciThere is a maximum number of dev entries that can be specified on insmod.
11462306a36Sopenharmony_ciWe think that 1024 is currently a decent maximum number of server adapters
11562306a36Sopenharmony_cito allow.  This can always be changed by modifying the constant in the
11662306a36Sopenharmony_cisource file before building.
11762306a36Sopenharmony_ci
11862306a36Sopenharmony_ciNOTE: The length of time it takes to insmod the driver seems to be related
11962306a36Sopenharmony_cito the number of tty interfaces the registering driver requests.
12062306a36Sopenharmony_ci
12162306a36Sopenharmony_ciIn order to remove the driver module execute the following command::
12262306a36Sopenharmony_ci
12362306a36Sopenharmony_ci	rmmod hvcs.ko
12462306a36Sopenharmony_ci
12562306a36Sopenharmony_ciThe recommended method for installing hvcs as a module is to use depmod to
12662306a36Sopenharmony_cibuild a current modules.dep file in /lib/modules/`uname -r` and then
12762306a36Sopenharmony_ciexecute::
12862306a36Sopenharmony_ci
12962306a36Sopenharmony_ci	modprobe hvcs hvcs_parm_num_devs=4
13062306a36Sopenharmony_ci
13162306a36Sopenharmony_ciThe modules.dep file indicates that hvcserver.ko needs to be inserted
13262306a36Sopenharmony_cibefore hvcs.ko and modprobe uses this file to smartly insert the modules in
13362306a36Sopenharmony_cithe proper order.
13462306a36Sopenharmony_ci
13562306a36Sopenharmony_ciThe following modprobe command is used to remove hvcs and hvcserver in the
13662306a36Sopenharmony_ciproper order::
13762306a36Sopenharmony_ci
13862306a36Sopenharmony_ci	modprobe -r hvcs
13962306a36Sopenharmony_ci
14062306a36Sopenharmony_ci4. Installation:
14162306a36Sopenharmony_ci================
14262306a36Sopenharmony_ci
14362306a36Sopenharmony_ciThe tty layer creates sysfs entries which contain the major and minor
14462306a36Sopenharmony_cinumbers allocated for the hvcs driver.  The following snippet of "tree"
14562306a36Sopenharmony_cioutput of the sysfs directory shows where these numbers are presented::
14662306a36Sopenharmony_ci
14762306a36Sopenharmony_ci	sys/
14862306a36Sopenharmony_ci	|-- *other sysfs base dirs*
14962306a36Sopenharmony_ci	|
15062306a36Sopenharmony_ci	|-- class
15162306a36Sopenharmony_ci	|   |-- *other classes of devices*
15262306a36Sopenharmony_ci	|   |
15362306a36Sopenharmony_ci	|   `-- tty
15462306a36Sopenharmony_ci	|       |-- *other tty devices*
15562306a36Sopenharmony_ci	|       |
15662306a36Sopenharmony_ci	|       |-- hvcs0
15762306a36Sopenharmony_ci	|       |   `-- dev
15862306a36Sopenharmony_ci	|       |-- hvcs1
15962306a36Sopenharmony_ci	|       |   `-- dev
16062306a36Sopenharmony_ci	|       |-- hvcs2
16162306a36Sopenharmony_ci	|       |   `-- dev
16262306a36Sopenharmony_ci	|       |-- hvcs3
16362306a36Sopenharmony_ci	|       |   `-- dev
16462306a36Sopenharmony_ci	|       |
16562306a36Sopenharmony_ci	|       |-- *other tty devices*
16662306a36Sopenharmony_ci	|
16762306a36Sopenharmony_ci	|-- *other sysfs base dirs*
16862306a36Sopenharmony_ci
16962306a36Sopenharmony_ciFor the above examples the following output is a result of cat'ing the
17062306a36Sopenharmony_ci"dev" entry in the hvcs directory::
17162306a36Sopenharmony_ci
17262306a36Sopenharmony_ci	Pow5:/sys/class/tty/hvcs0/ # cat dev
17362306a36Sopenharmony_ci	254:0
17462306a36Sopenharmony_ci
17562306a36Sopenharmony_ci	Pow5:/sys/class/tty/hvcs1/ # cat dev
17662306a36Sopenharmony_ci	254:1
17762306a36Sopenharmony_ci
17862306a36Sopenharmony_ci	Pow5:/sys/class/tty/hvcs2/ # cat dev
17962306a36Sopenharmony_ci	254:2
18062306a36Sopenharmony_ci
18162306a36Sopenharmony_ci	Pow5:/sys/class/tty/hvcs3/ # cat dev
18262306a36Sopenharmony_ci	254:3
18362306a36Sopenharmony_ci
18462306a36Sopenharmony_ciThe output from reading the "dev" attribute is the char device major and
18562306a36Sopenharmony_ciminor numbers that the tty layer has allocated for this driver's use.  Most
18662306a36Sopenharmony_cisystems running hvcs will already have the device entries created or udev
18762306a36Sopenharmony_ciwill do it automatically.
18862306a36Sopenharmony_ci
18962306a36Sopenharmony_ciGiven the example output above, to manually create a /dev/hvcs* node entry
19062306a36Sopenharmony_cimknod can be used as follows::
19162306a36Sopenharmony_ci
19262306a36Sopenharmony_ci	mknod /dev/hvcs0 c 254 0
19362306a36Sopenharmony_ci	mknod /dev/hvcs1 c 254 1
19462306a36Sopenharmony_ci	mknod /dev/hvcs2 c 254 2
19562306a36Sopenharmony_ci	mknod /dev/hvcs3 c 254 3
19662306a36Sopenharmony_ci
19762306a36Sopenharmony_ciUsing mknod to manually create the device entries makes these device nodes
19862306a36Sopenharmony_cipersistent.  Once created they will exist prior to the driver insmod.
19962306a36Sopenharmony_ci
20062306a36Sopenharmony_ciAttempting to connect an application to /dev/hvcs* prior to insertion of
20162306a36Sopenharmony_cithe hvcs module will result in an error message similar to the following::
20262306a36Sopenharmony_ci
20362306a36Sopenharmony_ci	"/dev/hvcs*: No such device".
20462306a36Sopenharmony_ci
20562306a36Sopenharmony_ciNOTE: Just because there is a device node present doesn't mean that there
20662306a36Sopenharmony_ciis a vty-server device configured for that node.
20762306a36Sopenharmony_ci
20862306a36Sopenharmony_ci5. Connection
20962306a36Sopenharmony_ci=============
21062306a36Sopenharmony_ci
21162306a36Sopenharmony_ciSince this driver controls devices that provide a tty interface a user can
21262306a36Sopenharmony_ciinteract with the device node entries using any standard tty-interactive
21362306a36Sopenharmony_cimethod (e.g. "cat", "dd", "echo").  The intent of this driver however, is
21462306a36Sopenharmony_cito provide real time console interaction with a Linux partition's console,
21562306a36Sopenharmony_ciwhich requires the use of applications that provide bi-directional,
21662306a36Sopenharmony_ciinteractive I/O with a tty device.
21762306a36Sopenharmony_ci
21862306a36Sopenharmony_ciApplications (e.g. "minicom" and "screen") that act as terminal emulators
21962306a36Sopenharmony_cior perform terminal type control sequence conversion on the data being
22062306a36Sopenharmony_cipassed through them are NOT acceptable for providing interactive console
22162306a36Sopenharmony_ciI/O.  These programs often emulate antiquated terminal types (vt100 and
22262306a36Sopenharmony_ciANSI) and expect inbound data to take the form of one of these supported
22362306a36Sopenharmony_citerminal types but they either do not convert, or do not _adequately_
22462306a36Sopenharmony_ciconvert, outbound data into the terminal type of the terminal which invoked
22562306a36Sopenharmony_cithem (though screen makes an attempt and can apparently be configured with
22662306a36Sopenharmony_cimuch termcap wrestling.)
22762306a36Sopenharmony_ci
22862306a36Sopenharmony_ciFor this reason kermit and cu are two of the recommended applications for
22962306a36Sopenharmony_ciinteracting with a Linux console via an hvcs device.  These programs simply
23062306a36Sopenharmony_ciact as a conduit for data transfer to and from the tty device.  They do not
23162306a36Sopenharmony_cirequire inbound data to take the form of a particular terminal type, nor do
23262306a36Sopenharmony_cithey cook outbound data to a particular terminal type.
23362306a36Sopenharmony_ci
23462306a36Sopenharmony_ciIn order to ensure proper functioning of console applications one must make
23562306a36Sopenharmony_cisure that once connected to a /dev/hvcs console that the console's $TERM
23662306a36Sopenharmony_cienv variable is set to the exact terminal type of the terminal emulator
23762306a36Sopenharmony_ciused to launch the interactive I/O application.  If one is using xterm and
23862306a36Sopenharmony_cikermit to connect to /dev/hvcs0 when the console prompt becomes available
23962306a36Sopenharmony_cione should "export TERM=xterm" on the console.  This tells ncurses
24062306a36Sopenharmony_ciapplications that are invoked from the console that they should output
24162306a36Sopenharmony_cicontrol sequences that xterm can understand.
24262306a36Sopenharmony_ci
24362306a36Sopenharmony_ciAs a precautionary measure an hvcs user should always "exit" from their
24462306a36Sopenharmony_cisession before disconnecting an application such as kermit from the device
24562306a36Sopenharmony_cinode.  If this is not done, the next user to connect to the console will
24662306a36Sopenharmony_cicontinue using the previous user's logged in session which includes
24762306a36Sopenharmony_ciusing the $TERM variable that the previous user supplied.
24862306a36Sopenharmony_ci
24962306a36Sopenharmony_ciHotplug add and remove of vty-server adapters affects which /dev/hvcs* node
25062306a36Sopenharmony_ciis used to connect to each vty-server adapter.  In order to determine which
25162306a36Sopenharmony_civty-server adapter is associated with which /dev/hvcs* node a special sysfs
25262306a36Sopenharmony_ciattribute has been added to each vty-server sysfs entry.  This entry is
25362306a36Sopenharmony_cicalled "index" and showing it reveals an integer that refers to the
25462306a36Sopenharmony_ci/dev/hvcs* entry to use to connect to that device.  For instance cating the
25562306a36Sopenharmony_ciindex attribute of vty-server adapter 30000004 shows the following::
25662306a36Sopenharmony_ci
25762306a36Sopenharmony_ci	Pow5:/sys/bus/vio/drivers/hvcs/30000004 # cat index
25862306a36Sopenharmony_ci	2
25962306a36Sopenharmony_ci
26062306a36Sopenharmony_ciThis index of '2' means that in order to connect to vty-server adapter
26162306a36Sopenharmony_ci30000004 the user should interact with /dev/hvcs2.
26262306a36Sopenharmony_ci
26362306a36Sopenharmony_ciIt should be noted that due to the system hotplug I/O capabilities of a
26462306a36Sopenharmony_cisystem the /dev/hvcs* entry that interacts with a particular vty-server
26562306a36Sopenharmony_ciadapter is not guaranteed to remain the same across system reboots.  Look
26662306a36Sopenharmony_ciin the Q & A section for more on this issue.
26762306a36Sopenharmony_ci
26862306a36Sopenharmony_ci6. Disconnection
26962306a36Sopenharmony_ci================
27062306a36Sopenharmony_ci
27162306a36Sopenharmony_ciAs a security feature to prevent the delivery of stale data to an
27262306a36Sopenharmony_ciunintended target the Power5 system firmware disables the fetching of data
27362306a36Sopenharmony_ciand discards that data when a connection between a vty-server and a vty has
27462306a36Sopenharmony_cibeen severed.  As an example, when a vty-server is immediately disconnected
27562306a36Sopenharmony_cifrom a vty following output of data to the vty the vty adapter may not have
27662306a36Sopenharmony_cienough time between when it received the data interrupt and when the
27762306a36Sopenharmony_ciconnection was severed to fetch the data from firmware before the fetch is
27862306a36Sopenharmony_cidisabled by firmware.
27962306a36Sopenharmony_ci
28062306a36Sopenharmony_ciWhen hvcs is being used to serve consoles this behavior is not a huge issue
28162306a36Sopenharmony_cibecause the adapter stays connected for large amounts of time following
28262306a36Sopenharmony_cialmost all data writes.  When hvcs is being used as a tty conduit to tunnel
28362306a36Sopenharmony_cidata between two partitions [see Q & A below] this is a huge problem
28462306a36Sopenharmony_cibecause the standard Linux behavior when cat'ing or dd'ing data to a device
28562306a36Sopenharmony_ciis to open the tty, send the data, and then close the tty.  If this driver
28662306a36Sopenharmony_cimanually terminated vty-server connections on tty close this would close
28762306a36Sopenharmony_cithe vty-server and vty connection before the target vty has had a chance to
28862306a36Sopenharmony_cifetch the data.
28962306a36Sopenharmony_ci
29062306a36Sopenharmony_ciAdditionally, disconnecting a vty-server and vty only on module removal or
29162306a36Sopenharmony_ciadapter removal is impractical because other vty-servers in other
29262306a36Sopenharmony_cipartitions may require the usage of the target vty at any time.
29362306a36Sopenharmony_ci
29462306a36Sopenharmony_ciDue to this behavioral restriction disconnection of vty-servers from the
29562306a36Sopenharmony_ciconnected vty is a manual procedure using a write to a sysfs attribute
29662306a36Sopenharmony_cioutlined below, on the other hand the initial vty-server connection to a
29762306a36Sopenharmony_civty is established automatically by this driver.  Manual vty-server
29862306a36Sopenharmony_ciconnection is never required.
29962306a36Sopenharmony_ci
30062306a36Sopenharmony_ciIn order to terminate the connection between a vty-server and vty the
30162306a36Sopenharmony_ci"vterm_state" sysfs attribute within each vty-server's sysfs entry is used.
30262306a36Sopenharmony_ciReading this attribute reveals the current connection state of the
30362306a36Sopenharmony_civty-server adapter.  A zero means that the vty-server is not connected to a
30462306a36Sopenharmony_civty.  A one indicates that a connection is active.
30562306a36Sopenharmony_ci
30662306a36Sopenharmony_ciWriting a '0' (zero) to the vterm_state attribute will disconnect the VTERM
30762306a36Sopenharmony_ciconnection between the vty-server and target vty ONLY if the vterm_state
30862306a36Sopenharmony_cipreviously read '1'.  The write directive is ignored if the vterm_state
30962306a36Sopenharmony_ciread '0' or if any value other than '0' was written to the vterm_state
31062306a36Sopenharmony_ciattribute.  The following example will show the method used for verifying
31162306a36Sopenharmony_cithe vty-server connection status and disconnecting a vty-server connection::
31262306a36Sopenharmony_ci
31362306a36Sopenharmony_ci	Pow5:/sys/bus/vio/drivers/hvcs/30000004 # cat vterm_state
31462306a36Sopenharmony_ci	1
31562306a36Sopenharmony_ci
31662306a36Sopenharmony_ci	Pow5:/sys/bus/vio/drivers/hvcs/30000004 # echo 0 > vterm_state
31762306a36Sopenharmony_ci
31862306a36Sopenharmony_ci	Pow5:/sys/bus/vio/drivers/hvcs/30000004 # cat vterm_state
31962306a36Sopenharmony_ci	0
32062306a36Sopenharmony_ci
32162306a36Sopenharmony_ciAll vty-server connections are automatically terminated when the device is
32262306a36Sopenharmony_cihotplug removed and when the module is removed.
32362306a36Sopenharmony_ci
32462306a36Sopenharmony_ci7. Configuration
32562306a36Sopenharmony_ci================
32662306a36Sopenharmony_ci
32762306a36Sopenharmony_ciEach vty-server has a sysfs entry in the /sys/devices/vio directory, which
32862306a36Sopenharmony_ciis symlinked in several other sysfs tree directories, notably under the
32962306a36Sopenharmony_cihvcs driver entry, which looks like the following example::
33062306a36Sopenharmony_ci
33162306a36Sopenharmony_ci	Pow5:/sys/bus/vio/drivers/hvcs # ls
33262306a36Sopenharmony_ci	.  ..  30000003  30000004  rescan
33362306a36Sopenharmony_ci
33462306a36Sopenharmony_ciBy design, firmware notifies the hvcs driver of vty-server lifetimes and
33562306a36Sopenharmony_cipartner vty removals but not the addition of partner vtys.  Since an HMC
33662306a36Sopenharmony_ciSuper Admin can add partner info dynamically we have provided the hvcs
33762306a36Sopenharmony_cidriver sysfs directory with the "rescan" update attribute which will query
33862306a36Sopenharmony_cifirmware and update the partner info for all the vty-servers that this
33962306a36Sopenharmony_cidriver manages.  Writing a '1' to the attribute triggers the update.  An
34062306a36Sopenharmony_ciexplicit example follows:
34162306a36Sopenharmony_ci
34262306a36Sopenharmony_ci	Pow5:/sys/bus/vio/drivers/hvcs # echo 1 > rescan
34362306a36Sopenharmony_ci
34462306a36Sopenharmony_ciReading the attribute will indicate a state of '1' or '0'.  A one indicates
34562306a36Sopenharmony_cithat an update is in process.  A zero indicates that an update has
34662306a36Sopenharmony_cicompleted or was never executed.
34762306a36Sopenharmony_ci
34862306a36Sopenharmony_ciVty-server entries in this directory are a 32 bit partition unique unit
34962306a36Sopenharmony_ciaddress that is created by firmware.  An example vty-server sysfs entry
35062306a36Sopenharmony_cilooks like the following::
35162306a36Sopenharmony_ci
35262306a36Sopenharmony_ci	Pow5:/sys/bus/vio/drivers/hvcs/30000004 # ls
35362306a36Sopenharmony_ci	.   current_vty   devspec       name          partner_vtys
35462306a36Sopenharmony_ci	..  index         partner_clcs  vterm_state
35562306a36Sopenharmony_ci
35662306a36Sopenharmony_ciEach entry is provided, by default with a "name" attribute.  Reading the
35762306a36Sopenharmony_ci"name" attribute will reveal the device type as shown in the following
35862306a36Sopenharmony_ciexample::
35962306a36Sopenharmony_ci
36062306a36Sopenharmony_ci	Pow5:/sys/bus/vio/drivers/hvcs/30000003 # cat name
36162306a36Sopenharmony_ci	vty-server
36262306a36Sopenharmony_ci
36362306a36Sopenharmony_ciEach entry is also provided, by default, with a "devspec" attribute which
36462306a36Sopenharmony_cireveals the full device specification when read, as shown in the following
36562306a36Sopenharmony_ciexample::
36662306a36Sopenharmony_ci
36762306a36Sopenharmony_ci	Pow5:/sys/bus/vio/drivers/hvcs/30000004 # cat devspec
36862306a36Sopenharmony_ci	/vdevice/vty-server@30000004
36962306a36Sopenharmony_ci
37062306a36Sopenharmony_ciEach vty-server sysfs dir is provided with two read-only attributes that
37162306a36Sopenharmony_ciprovide lists of easily parsed partner vty data: "partner_vtys" and
37262306a36Sopenharmony_ci"partner_clcs"::
37362306a36Sopenharmony_ci
37462306a36Sopenharmony_ci	Pow5:/sys/bus/vio/drivers/hvcs/30000004 # cat partner_vtys
37562306a36Sopenharmony_ci	30000000
37662306a36Sopenharmony_ci	30000001
37762306a36Sopenharmony_ci	30000002
37862306a36Sopenharmony_ci	30000000
37962306a36Sopenharmony_ci	30000000
38062306a36Sopenharmony_ci
38162306a36Sopenharmony_ci	Pow5:/sys/bus/vio/drivers/hvcs/30000004 # cat partner_clcs
38262306a36Sopenharmony_ci	U5112.428.103048A-V3-C0
38362306a36Sopenharmony_ci	U5112.428.103048A-V3-C2
38462306a36Sopenharmony_ci	U5112.428.103048A-V3-C3
38562306a36Sopenharmony_ci	U5112.428.103048A-V4-C0
38662306a36Sopenharmony_ci	U5112.428.103048A-V5-C0
38762306a36Sopenharmony_ci
38862306a36Sopenharmony_ciReading partner_vtys returns a list of partner vtys.  Vty unit address
38962306a36Sopenharmony_cinumbering is only per-partition-unique so entries will frequently repeat.
39062306a36Sopenharmony_ci
39162306a36Sopenharmony_ciReading partner_clcs returns a list of "converged location codes" which are
39262306a36Sopenharmony_cicomposed of a system serial number followed by "-V*", where the '*' is the
39362306a36Sopenharmony_citarget partition number, and "-C*", where the '*' is the slot of the
39462306a36Sopenharmony_ciadapter.  The first vty partner corresponds to the first clc item, the
39562306a36Sopenharmony_cisecond vty partner to the second clc item, etc.
39662306a36Sopenharmony_ci
39762306a36Sopenharmony_ciA vty-server can only be connected to a single vty at a time.  The entry,
39862306a36Sopenharmony_ci"current_vty" prints the clc of the currently selected partner vty when
39962306a36Sopenharmony_ciread.
40062306a36Sopenharmony_ci
40162306a36Sopenharmony_ciThe current_vty can be changed by writing a valid partner clc to the entry
40262306a36Sopenharmony_cias in the following example::
40362306a36Sopenharmony_ci
40462306a36Sopenharmony_ci	Pow5:/sys/bus/vio/drivers/hvcs/30000004 # echo U5112.428.10304
40562306a36Sopenharmony_ci	8A-V4-C0 > current_vty
40662306a36Sopenharmony_ci
40762306a36Sopenharmony_ciChanging the current_vty when a vty-server is already connected to a vty
40862306a36Sopenharmony_cidoes not affect the current connection.  The change takes effect when the
40962306a36Sopenharmony_cicurrently open connection is freed.
41062306a36Sopenharmony_ci
41162306a36Sopenharmony_ciInformation on the "vterm_state" attribute was covered earlier on the
41262306a36Sopenharmony_cichapter entitled "disconnection".
41362306a36Sopenharmony_ci
41462306a36Sopenharmony_ci8. Questions & Answers:
41562306a36Sopenharmony_ci=======================
41662306a36Sopenharmony_ci
41762306a36Sopenharmony_ciQ: What are the security concerns involving hvcs?
41862306a36Sopenharmony_ci
41962306a36Sopenharmony_ciA: There are three main security concerns:
42062306a36Sopenharmony_ci
42162306a36Sopenharmony_ci	1. The creator of the /dev/hvcs* nodes has the ability to restrict
42262306a36Sopenharmony_ci	the access of the device entries to certain users or groups.  It
42362306a36Sopenharmony_ci	may be best to create a special hvcs group privilege for providing
42462306a36Sopenharmony_ci	access to system consoles.
42562306a36Sopenharmony_ci
42662306a36Sopenharmony_ci	2. To provide network security when grabbing the console it is
42762306a36Sopenharmony_ci	suggested that the user connect to the console hosting partition
42862306a36Sopenharmony_ci	using a secure method, such as SSH or sit at a hardware console.
42962306a36Sopenharmony_ci
43062306a36Sopenharmony_ci	3. Make sure to exit the user session when done with a console or
43162306a36Sopenharmony_ci	the next vty-server connection (which may be from another
43262306a36Sopenharmony_ci	partition) will experience the previously logged in session.
43362306a36Sopenharmony_ci
43462306a36Sopenharmony_ci---------------------------------------------------------------------------
43562306a36Sopenharmony_ci
43662306a36Sopenharmony_ciQ: How do I multiplex a console that I grab through hvcs so that other
43762306a36Sopenharmony_cipeople can see it:
43862306a36Sopenharmony_ci
43962306a36Sopenharmony_ciA: You can use "screen" to directly connect to the /dev/hvcs* device and
44062306a36Sopenharmony_cisetup a session on your machine with the console group privileges.  As
44162306a36Sopenharmony_cipointed out earlier by default screen doesn't provide the termcap settings
44262306a36Sopenharmony_cifor most terminal emulators to provide adequate character conversion from
44362306a36Sopenharmony_citerm type "screen" to others.  This means that curses based programs may
44462306a36Sopenharmony_cinot display properly in screen sessions.
44562306a36Sopenharmony_ci
44662306a36Sopenharmony_ci---------------------------------------------------------------------------
44762306a36Sopenharmony_ci
44862306a36Sopenharmony_ciQ: Why are the colors all messed up?
44962306a36Sopenharmony_ciQ: Why are the control characters acting strange or not working?
45062306a36Sopenharmony_ciQ: Why is the console output all strange and unintelligible?
45162306a36Sopenharmony_ci
45262306a36Sopenharmony_ciA: Please see the preceding section on "Connection" for a discussion of how
45362306a36Sopenharmony_ciapplications can affect the display of character control sequences.
45462306a36Sopenharmony_ciAdditionally, just because you logged into the console using and xterm
45562306a36Sopenharmony_cidoesn't mean someone else didn't log into the console with the HMC console
45662306a36Sopenharmony_ci(vt320) before you and leave the session logged in.  The best thing to do
45762306a36Sopenharmony_ciis to export TERM to the terminal type of your terminal emulator when you
45862306a36Sopenharmony_ciget the console.  Additionally make sure to "exit" the console before you
45962306a36Sopenharmony_cidisconnect from the console.  This will ensure that the next user gets
46062306a36Sopenharmony_citheir own TERM type set when they login.
46162306a36Sopenharmony_ci
46262306a36Sopenharmony_ci---------------------------------------------------------------------------
46362306a36Sopenharmony_ci
46462306a36Sopenharmony_ciQ: When I try to CONNECT kermit to an hvcs device I get:
46562306a36Sopenharmony_ci"Sorry, can't open connection: /dev/hvcs*"What is happening?
46662306a36Sopenharmony_ci
46762306a36Sopenharmony_ciA: Some other Power5 console mechanism has a connection to the vty and
46862306a36Sopenharmony_ciisn't giving it up.  You can try to force disconnect the consoles from the
46962306a36Sopenharmony_ciHMC by right clicking on the partition and then selecting "close terminal".
47062306a36Sopenharmony_ciOtherwise you have to hunt down the people who have console authority.  It
47162306a36Sopenharmony_ciis possible that you already have the console open using another kermit
47262306a36Sopenharmony_cisession and just forgot about it.  Please review the console options for
47362306a36Sopenharmony_ciPower5 systems to determine the many ways a system console can be held.
47462306a36Sopenharmony_ci
47562306a36Sopenharmony_ciOR
47662306a36Sopenharmony_ci
47762306a36Sopenharmony_ciA: Another user may not have a connectivity method currently attached to a
47862306a36Sopenharmony_ci/dev/hvcs device but the vterm_state may reveal that they still have the
47962306a36Sopenharmony_civty-server connection established.  They need to free this using the method
48062306a36Sopenharmony_cioutlined in the section on "Disconnection" in order for others to connect
48162306a36Sopenharmony_cito the target vty.
48262306a36Sopenharmony_ci
48362306a36Sopenharmony_ciOR
48462306a36Sopenharmony_ci
48562306a36Sopenharmony_ciA: The user profile you are using to execute kermit probably doesn't have
48662306a36Sopenharmony_cipermissions to use the /dev/hvcs* device.
48762306a36Sopenharmony_ci
48862306a36Sopenharmony_ciOR
48962306a36Sopenharmony_ci
49062306a36Sopenharmony_ciA: You probably haven't inserted the hvcs.ko module yet but the /dev/hvcs*
49162306a36Sopenharmony_cientry still exists (on systems without udev).
49262306a36Sopenharmony_ci
49362306a36Sopenharmony_ciOR
49462306a36Sopenharmony_ci
49562306a36Sopenharmony_ciA: There is not a corresponding vty-server device that maps to an existing
49662306a36Sopenharmony_ci/dev/hvcs* entry.
49762306a36Sopenharmony_ci
49862306a36Sopenharmony_ci---------------------------------------------------------------------------
49962306a36Sopenharmony_ci
50062306a36Sopenharmony_ciQ: When I try to CONNECT kermit to an hvcs device I get:
50162306a36Sopenharmony_ci"Sorry, write access to UUCP lockfile directory denied."
50262306a36Sopenharmony_ci
50362306a36Sopenharmony_ciA: The /dev/hvcs* entry you have specified doesn't exist where you said it
50462306a36Sopenharmony_cidoes?  Maybe you haven't inserted the module (on systems with udev).
50562306a36Sopenharmony_ci
50662306a36Sopenharmony_ci---------------------------------------------------------------------------
50762306a36Sopenharmony_ci
50862306a36Sopenharmony_ciQ: If I already have one Linux partition installed can I use hvcs on said
50962306a36Sopenharmony_cipartition to provide the console for the install of a second Linux
51062306a36Sopenharmony_cipartition?
51162306a36Sopenharmony_ci
51262306a36Sopenharmony_ciA: Yes granted that your are connected to the /dev/hvcs* device using
51362306a36Sopenharmony_cikermit or cu or some other program that doesn't provide terminal emulation.
51462306a36Sopenharmony_ci
51562306a36Sopenharmony_ci---------------------------------------------------------------------------
51662306a36Sopenharmony_ci
51762306a36Sopenharmony_ciQ: Can I connect to more than one partition's console at a time using this
51862306a36Sopenharmony_cidriver?
51962306a36Sopenharmony_ci
52062306a36Sopenharmony_ciA: Yes.  Of course this means that there must be more than one vty-server
52162306a36Sopenharmony_ciconfigured for this partition and each must point to a disconnected vty.
52262306a36Sopenharmony_ci
52362306a36Sopenharmony_ci---------------------------------------------------------------------------
52462306a36Sopenharmony_ci
52562306a36Sopenharmony_ciQ: Does the hvcs driver support dynamic (hotplug) addition of devices?
52662306a36Sopenharmony_ci
52762306a36Sopenharmony_ciA: Yes, if you have dlpar and hotplug enabled for your system and it has
52862306a36Sopenharmony_cibeen built into the kernel the hvcs drivers is configured to dynamically
52962306a36Sopenharmony_cihandle additions of new devices and removals of unused devices.
53062306a36Sopenharmony_ci
53162306a36Sopenharmony_ci---------------------------------------------------------------------------
53262306a36Sopenharmony_ci
53362306a36Sopenharmony_ciQ: For some reason /dev/hvcs* doesn't map to the same vty-server adapter
53462306a36Sopenharmony_ciafter a reboot.  What happened?
53562306a36Sopenharmony_ci
53662306a36Sopenharmony_ciA: Assignment of vty-server adapters to /dev/hvcs* entries is always done
53762306a36Sopenharmony_ciin the order that the adapters are exposed.  Due to hotplug capabilities of
53862306a36Sopenharmony_cithis driver assignment of hotplug added vty-servers may be in a different
53962306a36Sopenharmony_ciorder than how they would be exposed on module load.  Rebooting or
54062306a36Sopenharmony_cireloading the module after dynamic addition may result in the /dev/hvcs*
54162306a36Sopenharmony_ciand vty-server coupling changing if a vty-server adapter was added in a
54262306a36Sopenharmony_cislot between two other vty-server adapters.  Refer to the section above
54362306a36Sopenharmony_cion how to determine which vty-server goes with which /dev/hvcs* node.
54462306a36Sopenharmony_ciHint; look at the sysfs "index" attribute for the vty-server.
54562306a36Sopenharmony_ci
54662306a36Sopenharmony_ci---------------------------------------------------------------------------
54762306a36Sopenharmony_ci
54862306a36Sopenharmony_ciQ: Can I use /dev/hvcs* as a conduit to another partition and use a tty
54962306a36Sopenharmony_cidevice on that partition as the other end of the pipe?
55062306a36Sopenharmony_ci
55162306a36Sopenharmony_ciA: Yes, on Power5 platforms the hvc_console driver provides a tty interface
55262306a36Sopenharmony_cifor extra /dev/hvc* devices (where /dev/hvc0 is most likely the console).
55362306a36Sopenharmony_ciIn order to get a tty conduit working between the two partitions the HMC
55462306a36Sopenharmony_ciSuper Admin must create an additional "serial server" for the target
55562306a36Sopenharmony_cipartition with the HMC gui which will show up as /dev/hvc* when the target
55662306a36Sopenharmony_cipartition is rebooted.
55762306a36Sopenharmony_ci
55862306a36Sopenharmony_ciThe HMC Super Admin then creates an additional "serial client" for the
55962306a36Sopenharmony_cicurrent partition and points this at the target partition's newly created
56062306a36Sopenharmony_ci"serial server" adapter (remember the slot).  This shows up as an
56162306a36Sopenharmony_ciadditional /dev/hvcs* device.
56262306a36Sopenharmony_ci
56362306a36Sopenharmony_ciNow a program on the target system can be configured to read or write to
56462306a36Sopenharmony_ci/dev/hvc* and another program on the current partition can be configured to
56562306a36Sopenharmony_ciread or write to /dev/hvcs*.  Now you have a tty conduit between two
56662306a36Sopenharmony_cipartitions.
56762306a36Sopenharmony_ci
56862306a36Sopenharmony_ci---------------------------------------------------------------------------
56962306a36Sopenharmony_ci
57062306a36Sopenharmony_ci9. Reporting Bugs:
57162306a36Sopenharmony_ci==================
57262306a36Sopenharmony_ci
57362306a36Sopenharmony_ciThe proper channel for reporting bugs is either through the Linux OS
57462306a36Sopenharmony_cidistribution company that provided your OS or by posting issues to the
57562306a36Sopenharmony_ciPowerPC development mailing list at:
57662306a36Sopenharmony_ci
57762306a36Sopenharmony_cilinuxppc-dev@lists.ozlabs.org
57862306a36Sopenharmony_ci
57962306a36Sopenharmony_ciThis request is to provide a documented and searchable public exchange
58062306a36Sopenharmony_ciof the problems and solutions surrounding this driver for the benefit of
58162306a36Sopenharmony_ciall users.
582