xref: /OK3568_Linux_fs/kernel/Documentation/powerpc/hvcs.rst (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun===============================================================
2*4882a593SmuzhiyunHVCS IBM "Hypervisor Virtual Console Server" Installation Guide
3*4882a593Smuzhiyun===============================================================
4*4882a593Smuzhiyun
5*4882a593Smuzhiyunfor Linux Kernel 2.6.4+
6*4882a593Smuzhiyun
7*4882a593SmuzhiyunCopyright (C) 2004 IBM Corporation
8*4882a593Smuzhiyun
9*4882a593Smuzhiyun.. ===========================================================================
10*4882a593Smuzhiyun.. NOTE:Eight space tabs are the optimum editor setting for reading this file.
11*4882a593Smuzhiyun.. ===========================================================================
12*4882a593Smuzhiyun
13*4882a593Smuzhiyun
14*4882a593SmuzhiyunAuthor(s): Ryan S. Arnold <rsa@us.ibm.com>
15*4882a593Smuzhiyun
16*4882a593SmuzhiyunDate Created: March, 02, 2004
17*4882a593SmuzhiyunLast Changed: August, 24, 2004
18*4882a593Smuzhiyun
19*4882a593Smuzhiyun.. Table of contents:
20*4882a593Smuzhiyun
21*4882a593Smuzhiyun	1.  Driver Introduction:
22*4882a593Smuzhiyun	2.  System Requirements
23*4882a593Smuzhiyun	3.  Build Options:
24*4882a593Smuzhiyun		3.1  Built-in:
25*4882a593Smuzhiyun		3.2  Module:
26*4882a593Smuzhiyun	4.  Installation:
27*4882a593Smuzhiyun	5.  Connection:
28*4882a593Smuzhiyun	6.  Disconnection:
29*4882a593Smuzhiyun	7.  Configuration:
30*4882a593Smuzhiyun	8.  Questions & Answers:
31*4882a593Smuzhiyun	9.  Reporting Bugs:
32*4882a593Smuzhiyun
33*4882a593Smuzhiyun1. Driver Introduction:
34*4882a593Smuzhiyun=======================
35*4882a593Smuzhiyun
36*4882a593SmuzhiyunThis is the device driver for the IBM Hypervisor Virtual Console Server,
37*4882a593Smuzhiyun"hvcs".  The IBM hvcs provides a tty driver interface to allow Linux user
38*4882a593Smuzhiyunspace applications access to the system consoles of logically partitioned
39*4882a593Smuzhiyunoperating systems (Linux and AIX) running on the same partitioned Power5
40*4882a593Smuzhiyunppc64 system.  Physical hardware consoles per partition are not practical
41*4882a593Smuzhiyunon this hardware so system consoles are accessed by this driver using
42*4882a593Smuzhiyunfirmware interfaces to virtual terminal devices.
43*4882a593Smuzhiyun
44*4882a593Smuzhiyun2. System Requirements:
45*4882a593Smuzhiyun=======================
46*4882a593Smuzhiyun
47*4882a593SmuzhiyunThis device driver was written using 2.6.4 Linux kernel APIs and will only
48*4882a593Smuzhiyunbuild and run on kernels of this version or later.
49*4882a593Smuzhiyun
50*4882a593SmuzhiyunThis driver was written to operate solely on IBM Power5 ppc64 hardware
51*4882a593Smuzhiyunthough some care was taken to abstract the architecture dependent firmware
52*4882a593Smuzhiyuncalls from the driver code.
53*4882a593Smuzhiyun
54*4882a593SmuzhiyunSysfs must be mounted on the system so that the user can determine which
55*4882a593Smuzhiyunmajor and minor numbers are associated with each vty-server.  Directions
56*4882a593Smuzhiyunfor sysfs mounting are outside the scope of this document.
57*4882a593Smuzhiyun
58*4882a593Smuzhiyun3. Build Options:
59*4882a593Smuzhiyun=================
60*4882a593Smuzhiyun
61*4882a593SmuzhiyunThe hvcs driver registers itself as a tty driver.  The tty layer
62*4882a593Smuzhiyundynamically allocates a block of major and minor numbers in a quantity
63*4882a593Smuzhiyunrequested by the registering driver.  The hvcs driver asks the tty layer
64*4882a593Smuzhiyunfor 64 of these major/minor numbers by default to use for hvcs device node
65*4882a593Smuzhiyunentries.
66*4882a593Smuzhiyun
67*4882a593SmuzhiyunIf the default number of device entries is adequate then this driver can be
68*4882a593Smuzhiyunbuilt into the kernel.  If not, the default can be over-ridden by inserting
69*4882a593Smuzhiyunthe driver as a module with insmod parameters.
70*4882a593Smuzhiyun
71*4882a593Smuzhiyun3.1 Built-in:
72*4882a593Smuzhiyun-------------
73*4882a593Smuzhiyun
74*4882a593SmuzhiyunThe following menuconfig example demonstrates selecting to build this
75*4882a593Smuzhiyundriver into the kernel::
76*4882a593Smuzhiyun
77*4882a593Smuzhiyun	Device Drivers  --->
78*4882a593Smuzhiyun		Character devices  --->
79*4882a593Smuzhiyun			<*> IBM Hypervisor Virtual Console Server Support
80*4882a593Smuzhiyun
81*4882a593SmuzhiyunBegin the kernel make process.
82*4882a593Smuzhiyun
83*4882a593Smuzhiyun3.2 Module:
84*4882a593Smuzhiyun-----------
85*4882a593Smuzhiyun
86*4882a593SmuzhiyunThe following menuconfig example demonstrates selecting to build this
87*4882a593Smuzhiyundriver as a kernel module::
88*4882a593Smuzhiyun
89*4882a593Smuzhiyun	Device Drivers  --->
90*4882a593Smuzhiyun		Character devices  --->
91*4882a593Smuzhiyun			<M> IBM Hypervisor Virtual Console Server Support
92*4882a593Smuzhiyun
93*4882a593SmuzhiyunThe make process will build the following kernel modules:
94*4882a593Smuzhiyun
95*4882a593Smuzhiyun	- hvcs.ko
96*4882a593Smuzhiyun	- hvcserver.ko
97*4882a593Smuzhiyun
98*4882a593SmuzhiyunTo insert the module with the default allocation execute the following
99*4882a593Smuzhiyuncommands in the order they appear::
100*4882a593Smuzhiyun
101*4882a593Smuzhiyun	insmod hvcserver.ko
102*4882a593Smuzhiyun	insmod hvcs.ko
103*4882a593Smuzhiyun
104*4882a593SmuzhiyunThe hvcserver module contains architecture specific firmware calls and must
105*4882a593Smuzhiyunbe inserted first, otherwise the hvcs module will not find some of the
106*4882a593Smuzhiyunsymbols it expects.
107*4882a593Smuzhiyun
108*4882a593SmuzhiyunTo override the default use an insmod parameter as follows (requesting 4
109*4882a593Smuzhiyuntty devices as an example)::
110*4882a593Smuzhiyun
111*4882a593Smuzhiyun	insmod hvcs.ko hvcs_parm_num_devs=4
112*4882a593Smuzhiyun
113*4882a593SmuzhiyunThere is a maximum number of dev entries that can be specified on insmod.
114*4882a593SmuzhiyunWe think that 1024 is currently a decent maximum number of server adapters
115*4882a593Smuzhiyunto allow.  This can always be changed by modifying the constant in the
116*4882a593Smuzhiyunsource file before building.
117*4882a593Smuzhiyun
118*4882a593SmuzhiyunNOTE: The length of time it takes to insmod the driver seems to be related
119*4882a593Smuzhiyunto the number of tty interfaces the registering driver requests.
120*4882a593Smuzhiyun
121*4882a593SmuzhiyunIn order to remove the driver module execute the following command::
122*4882a593Smuzhiyun
123*4882a593Smuzhiyun	rmmod hvcs.ko
124*4882a593Smuzhiyun
125*4882a593SmuzhiyunThe recommended method for installing hvcs as a module is to use depmod to
126*4882a593Smuzhiyunbuild a current modules.dep file in /lib/modules/`uname -r` and then
127*4882a593Smuzhiyunexecute::
128*4882a593Smuzhiyun
129*4882a593Smuzhiyun	modprobe hvcs hvcs_parm_num_devs=4
130*4882a593Smuzhiyun
131*4882a593SmuzhiyunThe modules.dep file indicates that hvcserver.ko needs to be inserted
132*4882a593Smuzhiyunbefore hvcs.ko and modprobe uses this file to smartly insert the modules in
133*4882a593Smuzhiyunthe proper order.
134*4882a593Smuzhiyun
135*4882a593SmuzhiyunThe following modprobe command is used to remove hvcs and hvcserver in the
136*4882a593Smuzhiyunproper order::
137*4882a593Smuzhiyun
138*4882a593Smuzhiyun	modprobe -r hvcs
139*4882a593Smuzhiyun
140*4882a593Smuzhiyun4. Installation:
141*4882a593Smuzhiyun================
142*4882a593Smuzhiyun
143*4882a593SmuzhiyunThe tty layer creates sysfs entries which contain the major and minor
144*4882a593Smuzhiyunnumbers allocated for the hvcs driver.  The following snippet of "tree"
145*4882a593Smuzhiyunoutput of the sysfs directory shows where these numbers are presented::
146*4882a593Smuzhiyun
147*4882a593Smuzhiyun	sys/
148*4882a593Smuzhiyun	|-- *other sysfs base dirs*
149*4882a593Smuzhiyun	|
150*4882a593Smuzhiyun	|-- class
151*4882a593Smuzhiyun	|   |-- *other classes of devices*
152*4882a593Smuzhiyun	|   |
153*4882a593Smuzhiyun	|   `-- tty
154*4882a593Smuzhiyun	|       |-- *other tty devices*
155*4882a593Smuzhiyun	|       |
156*4882a593Smuzhiyun	|       |-- hvcs0
157*4882a593Smuzhiyun	|       |   `-- dev
158*4882a593Smuzhiyun	|       |-- hvcs1
159*4882a593Smuzhiyun	|       |   `-- dev
160*4882a593Smuzhiyun	|       |-- hvcs2
161*4882a593Smuzhiyun	|       |   `-- dev
162*4882a593Smuzhiyun	|       |-- hvcs3
163*4882a593Smuzhiyun	|       |   `-- dev
164*4882a593Smuzhiyun	|       |
165*4882a593Smuzhiyun	|       |-- *other tty devices*
166*4882a593Smuzhiyun	|
167*4882a593Smuzhiyun	|-- *other sysfs base dirs*
168*4882a593Smuzhiyun
169*4882a593SmuzhiyunFor the above examples the following output is a result of cat'ing the
170*4882a593Smuzhiyun"dev" entry in the hvcs directory::
171*4882a593Smuzhiyun
172*4882a593Smuzhiyun	Pow5:/sys/class/tty/hvcs0/ # cat dev
173*4882a593Smuzhiyun	254:0
174*4882a593Smuzhiyun
175*4882a593Smuzhiyun	Pow5:/sys/class/tty/hvcs1/ # cat dev
176*4882a593Smuzhiyun	254:1
177*4882a593Smuzhiyun
178*4882a593Smuzhiyun	Pow5:/sys/class/tty/hvcs2/ # cat dev
179*4882a593Smuzhiyun	254:2
180*4882a593Smuzhiyun
181*4882a593Smuzhiyun	Pow5:/sys/class/tty/hvcs3/ # cat dev
182*4882a593Smuzhiyun	254:3
183*4882a593Smuzhiyun
184*4882a593SmuzhiyunThe output from reading the "dev" attribute is the char device major and
185*4882a593Smuzhiyunminor numbers that the tty layer has allocated for this driver's use.  Most
186*4882a593Smuzhiyunsystems running hvcs will already have the device entries created or udev
187*4882a593Smuzhiyunwill do it automatically.
188*4882a593Smuzhiyun
189*4882a593SmuzhiyunGiven the example output above, to manually create a /dev/hvcs* node entry
190*4882a593Smuzhiyunmknod can be used as follows::
191*4882a593Smuzhiyun
192*4882a593Smuzhiyun	mknod /dev/hvcs0 c 254 0
193*4882a593Smuzhiyun	mknod /dev/hvcs1 c 254 1
194*4882a593Smuzhiyun	mknod /dev/hvcs2 c 254 2
195*4882a593Smuzhiyun	mknod /dev/hvcs3 c 254 3
196*4882a593Smuzhiyun
197*4882a593SmuzhiyunUsing mknod to manually create the device entries makes these device nodes
198*4882a593Smuzhiyunpersistent.  Once created they will exist prior to the driver insmod.
199*4882a593Smuzhiyun
200*4882a593SmuzhiyunAttempting to connect an application to /dev/hvcs* prior to insertion of
201*4882a593Smuzhiyunthe hvcs module will result in an error message similar to the following::
202*4882a593Smuzhiyun
203*4882a593Smuzhiyun	"/dev/hvcs*: No such device".
204*4882a593Smuzhiyun
205*4882a593SmuzhiyunNOTE: Just because there is a device node present doesn't mean that there
206*4882a593Smuzhiyunis a vty-server device configured for that node.
207*4882a593Smuzhiyun
208*4882a593Smuzhiyun5. Connection
209*4882a593Smuzhiyun=============
210*4882a593Smuzhiyun
211*4882a593SmuzhiyunSince this driver controls devices that provide a tty interface a user can
212*4882a593Smuzhiyuninteract with the device node entries using any standard tty-interactive
213*4882a593Smuzhiyunmethod (e.g. "cat", "dd", "echo").  The intent of this driver however, is
214*4882a593Smuzhiyunto provide real time console interaction with a Linux partition's console,
215*4882a593Smuzhiyunwhich requires the use of applications that provide bi-directional,
216*4882a593Smuzhiyuninteractive I/O with a tty device.
217*4882a593Smuzhiyun
218*4882a593SmuzhiyunApplications (e.g. "minicom" and "screen") that act as terminal emulators
219*4882a593Smuzhiyunor perform terminal type control sequence conversion on the data being
220*4882a593Smuzhiyunpassed through them are NOT acceptable for providing interactive console
221*4882a593SmuzhiyunI/O.  These programs often emulate antiquated terminal types (vt100 and
222*4882a593SmuzhiyunANSI) and expect inbound data to take the form of one of these supported
223*4882a593Smuzhiyunterminal types but they either do not convert, or do not _adequately_
224*4882a593Smuzhiyunconvert, outbound data into the terminal type of the terminal which invoked
225*4882a593Smuzhiyunthem (though screen makes an attempt and can apparently be configured with
226*4882a593Smuzhiyunmuch termcap wrestling.)
227*4882a593Smuzhiyun
228*4882a593SmuzhiyunFor this reason kermit and cu are two of the recommended applications for
229*4882a593Smuzhiyuninteracting with a Linux console via an hvcs device.  These programs simply
230*4882a593Smuzhiyunact as a conduit for data transfer to and from the tty device.  They do not
231*4882a593Smuzhiyunrequire inbound data to take the form of a particular terminal type, nor do
232*4882a593Smuzhiyunthey cook outbound data to a particular terminal type.
233*4882a593Smuzhiyun
234*4882a593SmuzhiyunIn order to ensure proper functioning of console applications one must make
235*4882a593Smuzhiyunsure that once connected to a /dev/hvcs console that the console's $TERM
236*4882a593Smuzhiyunenv variable is set to the exact terminal type of the terminal emulator
237*4882a593Smuzhiyunused to launch the interactive I/O application.  If one is using xterm and
238*4882a593Smuzhiyunkermit to connect to /dev/hvcs0 when the console prompt becomes available
239*4882a593Smuzhiyunone should "export TERM=xterm" on the console.  This tells ncurses
240*4882a593Smuzhiyunapplications that are invoked from the console that they should output
241*4882a593Smuzhiyuncontrol sequences that xterm can understand.
242*4882a593Smuzhiyun
243*4882a593SmuzhiyunAs a precautionary measure an hvcs user should always "exit" from their
244*4882a593Smuzhiyunsession before disconnecting an application such as kermit from the device
245*4882a593Smuzhiyunnode.  If this is not done, the next user to connect to the console will
246*4882a593Smuzhiyuncontinue using the previous user's logged in session which includes
247*4882a593Smuzhiyunusing the $TERM variable that the previous user supplied.
248*4882a593Smuzhiyun
249*4882a593SmuzhiyunHotplug add and remove of vty-server adapters affects which /dev/hvcs* node
250*4882a593Smuzhiyunis used to connect to each vty-server adapter.  In order to determine which
251*4882a593Smuzhiyunvty-server adapter is associated with which /dev/hvcs* node a special sysfs
252*4882a593Smuzhiyunattribute has been added to each vty-server sysfs entry.  This entry is
253*4882a593Smuzhiyuncalled "index" and showing it reveals an integer that refers to the
254*4882a593Smuzhiyun/dev/hvcs* entry to use to connect to that device.  For instance cating the
255*4882a593Smuzhiyunindex attribute of vty-server adapter 30000004 shows the following::
256*4882a593Smuzhiyun
257*4882a593Smuzhiyun	Pow5:/sys/bus/vio/drivers/hvcs/30000004 # cat index
258*4882a593Smuzhiyun	2
259*4882a593Smuzhiyun
260*4882a593SmuzhiyunThis index of '2' means that in order to connect to vty-server adapter
261*4882a593Smuzhiyun30000004 the user should interact with /dev/hvcs2.
262*4882a593Smuzhiyun
263*4882a593SmuzhiyunIt should be noted that due to the system hotplug I/O capabilities of a
264*4882a593Smuzhiyunsystem the /dev/hvcs* entry that interacts with a particular vty-server
265*4882a593Smuzhiyunadapter is not guaranteed to remain the same across system reboots.  Look
266*4882a593Smuzhiyunin the Q & A section for more on this issue.
267*4882a593Smuzhiyun
268*4882a593Smuzhiyun6. Disconnection
269*4882a593Smuzhiyun================
270*4882a593Smuzhiyun
271*4882a593SmuzhiyunAs a security feature to prevent the delivery of stale data to an
272*4882a593Smuzhiyununintended target the Power5 system firmware disables the fetching of data
273*4882a593Smuzhiyunand discards that data when a connection between a vty-server and a vty has
274*4882a593Smuzhiyunbeen severed.  As an example, when a vty-server is immediately disconnected
275*4882a593Smuzhiyunfrom a vty following output of data to the vty the vty adapter may not have
276*4882a593Smuzhiyunenough time between when it received the data interrupt and when the
277*4882a593Smuzhiyunconnection was severed to fetch the data from firmware before the fetch is
278*4882a593Smuzhiyundisabled by firmware.
279*4882a593Smuzhiyun
280*4882a593SmuzhiyunWhen hvcs is being used to serve consoles this behavior is not a huge issue
281*4882a593Smuzhiyunbecause the adapter stays connected for large amounts of time following
282*4882a593Smuzhiyunalmost all data writes.  When hvcs is being used as a tty conduit to tunnel
283*4882a593Smuzhiyundata between two partitions [see Q & A below] this is a huge problem
284*4882a593Smuzhiyunbecause the standard Linux behavior when cat'ing or dd'ing data to a device
285*4882a593Smuzhiyunis to open the tty, send the data, and then close the tty.  If this driver
286*4882a593Smuzhiyunmanually terminated vty-server connections on tty close this would close
287*4882a593Smuzhiyunthe vty-server and vty connection before the target vty has had a chance to
288*4882a593Smuzhiyunfetch the data.
289*4882a593Smuzhiyun
290*4882a593SmuzhiyunAdditionally, disconnecting a vty-server and vty only on module removal or
291*4882a593Smuzhiyunadapter removal is impractical because other vty-servers in other
292*4882a593Smuzhiyunpartitions may require the usage of the target vty at any time.
293*4882a593Smuzhiyun
294*4882a593SmuzhiyunDue to this behavioral restriction disconnection of vty-servers from the
295*4882a593Smuzhiyunconnected vty is a manual procedure using a write to a sysfs attribute
296*4882a593Smuzhiyunoutlined below, on the other hand the initial vty-server connection to a
297*4882a593Smuzhiyunvty is established automatically by this driver.  Manual vty-server
298*4882a593Smuzhiyunconnection is never required.
299*4882a593Smuzhiyun
300*4882a593SmuzhiyunIn order to terminate the connection between a vty-server and vty the
301*4882a593Smuzhiyun"vterm_state" sysfs attribute within each vty-server's sysfs entry is used.
302*4882a593SmuzhiyunReading this attribute reveals the current connection state of the
303*4882a593Smuzhiyunvty-server adapter.  A zero means that the vty-server is not connected to a
304*4882a593Smuzhiyunvty.  A one indicates that a connection is active.
305*4882a593Smuzhiyun
306*4882a593SmuzhiyunWriting a '0' (zero) to the vterm_state attribute will disconnect the VTERM
307*4882a593Smuzhiyunconnection between the vty-server and target vty ONLY if the vterm_state
308*4882a593Smuzhiyunpreviously read '1'.  The write directive is ignored if the vterm_state
309*4882a593Smuzhiyunread '0' or if any value other than '0' was written to the vterm_state
310*4882a593Smuzhiyunattribute.  The following example will show the method used for verifying
311*4882a593Smuzhiyunthe vty-server connection status and disconnecting a vty-server connection::
312*4882a593Smuzhiyun
313*4882a593Smuzhiyun	Pow5:/sys/bus/vio/drivers/hvcs/30000004 # cat vterm_state
314*4882a593Smuzhiyun	1
315*4882a593Smuzhiyun
316*4882a593Smuzhiyun	Pow5:/sys/bus/vio/drivers/hvcs/30000004 # echo 0 > vterm_state
317*4882a593Smuzhiyun
318*4882a593Smuzhiyun	Pow5:/sys/bus/vio/drivers/hvcs/30000004 # cat vterm_state
319*4882a593Smuzhiyun	0
320*4882a593Smuzhiyun
321*4882a593SmuzhiyunAll vty-server connections are automatically terminated when the device is
322*4882a593Smuzhiyunhotplug removed and when the module is removed.
323*4882a593Smuzhiyun
324*4882a593Smuzhiyun7. Configuration
325*4882a593Smuzhiyun================
326*4882a593Smuzhiyun
327*4882a593SmuzhiyunEach vty-server has a sysfs entry in the /sys/devices/vio directory, which
328*4882a593Smuzhiyunis symlinked in several other sysfs tree directories, notably under the
329*4882a593Smuzhiyunhvcs driver entry, which looks like the following example::
330*4882a593Smuzhiyun
331*4882a593Smuzhiyun	Pow5:/sys/bus/vio/drivers/hvcs # ls
332*4882a593Smuzhiyun	.  ..  30000003  30000004  rescan
333*4882a593Smuzhiyun
334*4882a593SmuzhiyunBy design, firmware notifies the hvcs driver of vty-server lifetimes and
335*4882a593Smuzhiyunpartner vty removals but not the addition of partner vtys.  Since an HMC
336*4882a593SmuzhiyunSuper Admin can add partner info dynamically we have provided the hvcs
337*4882a593Smuzhiyundriver sysfs directory with the "rescan" update attribute which will query
338*4882a593Smuzhiyunfirmware and update the partner info for all the vty-servers that this
339*4882a593Smuzhiyundriver manages.  Writing a '1' to the attribute triggers the update.  An
340*4882a593Smuzhiyunexplicit example follows:
341*4882a593Smuzhiyun
342*4882a593Smuzhiyun	Pow5:/sys/bus/vio/drivers/hvcs # echo 1 > rescan
343*4882a593Smuzhiyun
344*4882a593SmuzhiyunReading the attribute will indicate a state of '1' or '0'.  A one indicates
345*4882a593Smuzhiyunthat an update is in process.  A zero indicates that an update has
346*4882a593Smuzhiyuncompleted or was never executed.
347*4882a593Smuzhiyun
348*4882a593SmuzhiyunVty-server entries in this directory are a 32 bit partition unique unit
349*4882a593Smuzhiyunaddress that is created by firmware.  An example vty-server sysfs entry
350*4882a593Smuzhiyunlooks like the following::
351*4882a593Smuzhiyun
352*4882a593Smuzhiyun	Pow5:/sys/bus/vio/drivers/hvcs/30000004 # ls
353*4882a593Smuzhiyun	.   current_vty   devspec       name          partner_vtys
354*4882a593Smuzhiyun	..  index         partner_clcs  vterm_state
355*4882a593Smuzhiyun
356*4882a593SmuzhiyunEach entry is provided, by default with a "name" attribute.  Reading the
357*4882a593Smuzhiyun"name" attribute will reveal the device type as shown in the following
358*4882a593Smuzhiyunexample::
359*4882a593Smuzhiyun
360*4882a593Smuzhiyun	Pow5:/sys/bus/vio/drivers/hvcs/30000003 # cat name
361*4882a593Smuzhiyun	vty-server
362*4882a593Smuzhiyun
363*4882a593SmuzhiyunEach entry is also provided, by default, with a "devspec" attribute which
364*4882a593Smuzhiyunreveals the full device specification when read, as shown in the following
365*4882a593Smuzhiyunexample::
366*4882a593Smuzhiyun
367*4882a593Smuzhiyun	Pow5:/sys/bus/vio/drivers/hvcs/30000004 # cat devspec
368*4882a593Smuzhiyun	/vdevice/vty-server@30000004
369*4882a593Smuzhiyun
370*4882a593SmuzhiyunEach vty-server sysfs dir is provided with two read-only attributes that
371*4882a593Smuzhiyunprovide lists of easily parsed partner vty data: "partner_vtys" and
372*4882a593Smuzhiyun"partner_clcs"::
373*4882a593Smuzhiyun
374*4882a593Smuzhiyun	Pow5:/sys/bus/vio/drivers/hvcs/30000004 # cat partner_vtys
375*4882a593Smuzhiyun	30000000
376*4882a593Smuzhiyun	30000001
377*4882a593Smuzhiyun	30000002
378*4882a593Smuzhiyun	30000000
379*4882a593Smuzhiyun	30000000
380*4882a593Smuzhiyun
381*4882a593Smuzhiyun	Pow5:/sys/bus/vio/drivers/hvcs/30000004 # cat partner_clcs
382*4882a593Smuzhiyun	U5112.428.103048A-V3-C0
383*4882a593Smuzhiyun	U5112.428.103048A-V3-C2
384*4882a593Smuzhiyun	U5112.428.103048A-V3-C3
385*4882a593Smuzhiyun	U5112.428.103048A-V4-C0
386*4882a593Smuzhiyun	U5112.428.103048A-V5-C0
387*4882a593Smuzhiyun
388*4882a593SmuzhiyunReading partner_vtys returns a list of partner vtys.  Vty unit address
389*4882a593Smuzhiyunnumbering is only per-partition-unique so entries will frequently repeat.
390*4882a593Smuzhiyun
391*4882a593SmuzhiyunReading partner_clcs returns a list of "converged location codes" which are
392*4882a593Smuzhiyuncomposed of a system serial number followed by "-V*", where the '*' is the
393*4882a593Smuzhiyuntarget partition number, and "-C*", where the '*' is the slot of the
394*4882a593Smuzhiyunadapter.  The first vty partner corresponds to the first clc item, the
395*4882a593Smuzhiyunsecond vty partner to the second clc item, etc.
396*4882a593Smuzhiyun
397*4882a593SmuzhiyunA vty-server can only be connected to a single vty at a time.  The entry,
398*4882a593Smuzhiyun"current_vty" prints the clc of the currently selected partner vty when
399*4882a593Smuzhiyunread.
400*4882a593Smuzhiyun
401*4882a593SmuzhiyunThe current_vty can be changed by writing a valid partner clc to the entry
402*4882a593Smuzhiyunas in the following example::
403*4882a593Smuzhiyun
404*4882a593Smuzhiyun	Pow5:/sys/bus/vio/drivers/hvcs/30000004 # echo U5112.428.10304
405*4882a593Smuzhiyun	8A-V4-C0 > current_vty
406*4882a593Smuzhiyun
407*4882a593SmuzhiyunChanging the current_vty when a vty-server is already connected to a vty
408*4882a593Smuzhiyundoes not affect the current connection.  The change takes effect when the
409*4882a593Smuzhiyuncurrently open connection is freed.
410*4882a593Smuzhiyun
411*4882a593SmuzhiyunInformation on the "vterm_state" attribute was covered earlier on the
412*4882a593Smuzhiyunchapter entitled "disconnection".
413*4882a593Smuzhiyun
414*4882a593Smuzhiyun8. Questions & Answers:
415*4882a593Smuzhiyun=======================
416*4882a593Smuzhiyun
417*4882a593SmuzhiyunQ: What are the security concerns involving hvcs?
418*4882a593Smuzhiyun
419*4882a593SmuzhiyunA: There are three main security concerns:
420*4882a593Smuzhiyun
421*4882a593Smuzhiyun	1. The creator of the /dev/hvcs* nodes has the ability to restrict
422*4882a593Smuzhiyun	the access of the device entries to certain users or groups.  It
423*4882a593Smuzhiyun	may be best to create a special hvcs group privilege for providing
424*4882a593Smuzhiyun	access to system consoles.
425*4882a593Smuzhiyun
426*4882a593Smuzhiyun	2. To provide network security when grabbing the console it is
427*4882a593Smuzhiyun	suggested that the user connect to the console hosting partition
428*4882a593Smuzhiyun	using a secure method, such as SSH or sit at a hardware console.
429*4882a593Smuzhiyun
430*4882a593Smuzhiyun	3. Make sure to exit the user session when done with a console or
431*4882a593Smuzhiyun	the next vty-server connection (which may be from another
432*4882a593Smuzhiyun	partition) will experience the previously logged in session.
433*4882a593Smuzhiyun
434*4882a593Smuzhiyun---------------------------------------------------------------------------
435*4882a593Smuzhiyun
436*4882a593SmuzhiyunQ: How do I multiplex a console that I grab through hvcs so that other
437*4882a593Smuzhiyunpeople can see it:
438*4882a593Smuzhiyun
439*4882a593SmuzhiyunA: You can use "screen" to directly connect to the /dev/hvcs* device and
440*4882a593Smuzhiyunsetup a session on your machine with the console group privileges.  As
441*4882a593Smuzhiyunpointed out earlier by default screen doesn't provide the termcap settings
442*4882a593Smuzhiyunfor most terminal emulators to provide adequate character conversion from
443*4882a593Smuzhiyunterm type "screen" to others.  This means that curses based programs may
444*4882a593Smuzhiyunnot display properly in screen sessions.
445*4882a593Smuzhiyun
446*4882a593Smuzhiyun---------------------------------------------------------------------------
447*4882a593Smuzhiyun
448*4882a593SmuzhiyunQ: Why are the colors all messed up?
449*4882a593SmuzhiyunQ: Why are the control characters acting strange or not working?
450*4882a593SmuzhiyunQ: Why is the console output all strange and unintelligible?
451*4882a593Smuzhiyun
452*4882a593SmuzhiyunA: Please see the preceding section on "Connection" for a discussion of how
453*4882a593Smuzhiyunapplications can affect the display of character control sequences.
454*4882a593SmuzhiyunAdditionally, just because you logged into the console using and xterm
455*4882a593Smuzhiyundoesn't mean someone else didn't log into the console with the HMC console
456*4882a593Smuzhiyun(vt320) before you and leave the session logged in.  The best thing to do
457*4882a593Smuzhiyunis to export TERM to the terminal type of your terminal emulator when you
458*4882a593Smuzhiyunget the console.  Additionally make sure to "exit" the console before you
459*4882a593Smuzhiyundisconnect from the console.  This will ensure that the next user gets
460*4882a593Smuzhiyuntheir own TERM type set when they login.
461*4882a593Smuzhiyun
462*4882a593Smuzhiyun---------------------------------------------------------------------------
463*4882a593Smuzhiyun
464*4882a593SmuzhiyunQ: When I try to CONNECT kermit to an hvcs device I get:
465*4882a593Smuzhiyun"Sorry, can't open connection: /dev/hvcs*"What is happening?
466*4882a593Smuzhiyun
467*4882a593SmuzhiyunA: Some other Power5 console mechanism has a connection to the vty and
468*4882a593Smuzhiyunisn't giving it up.  You can try to force disconnect the consoles from the
469*4882a593SmuzhiyunHMC by right clicking on the partition and then selecting "close terminal".
470*4882a593SmuzhiyunOtherwise you have to hunt down the people who have console authority.  It
471*4882a593Smuzhiyunis possible that you already have the console open using another kermit
472*4882a593Smuzhiyunsession and just forgot about it.  Please review the console options for
473*4882a593SmuzhiyunPower5 systems to determine the many ways a system console can be held.
474*4882a593Smuzhiyun
475*4882a593SmuzhiyunOR
476*4882a593Smuzhiyun
477*4882a593SmuzhiyunA: Another user may not have a connectivity method currently attached to a
478*4882a593Smuzhiyun/dev/hvcs device but the vterm_state may reveal that they still have the
479*4882a593Smuzhiyunvty-server connection established.  They need to free this using the method
480*4882a593Smuzhiyunoutlined in the section on "Disconnection" in order for others to connect
481*4882a593Smuzhiyunto the target vty.
482*4882a593Smuzhiyun
483*4882a593SmuzhiyunOR
484*4882a593Smuzhiyun
485*4882a593SmuzhiyunA: The user profile you are using to execute kermit probably doesn't have
486*4882a593Smuzhiyunpermissions to use the /dev/hvcs* device.
487*4882a593Smuzhiyun
488*4882a593SmuzhiyunOR
489*4882a593Smuzhiyun
490*4882a593SmuzhiyunA: You probably haven't inserted the hvcs.ko module yet but the /dev/hvcs*
491*4882a593Smuzhiyunentry still exists (on systems without udev).
492*4882a593Smuzhiyun
493*4882a593SmuzhiyunOR
494*4882a593Smuzhiyun
495*4882a593SmuzhiyunA: There is not a corresponding vty-server device that maps to an existing
496*4882a593Smuzhiyun/dev/hvcs* entry.
497*4882a593Smuzhiyun
498*4882a593Smuzhiyun---------------------------------------------------------------------------
499*4882a593Smuzhiyun
500*4882a593SmuzhiyunQ: When I try to CONNECT kermit to an hvcs device I get:
501*4882a593Smuzhiyun"Sorry, write access to UUCP lockfile directory denied."
502*4882a593Smuzhiyun
503*4882a593SmuzhiyunA: The /dev/hvcs* entry you have specified doesn't exist where you said it
504*4882a593Smuzhiyundoes?  Maybe you haven't inserted the module (on systems with udev).
505*4882a593Smuzhiyun
506*4882a593Smuzhiyun---------------------------------------------------------------------------
507*4882a593Smuzhiyun
508*4882a593SmuzhiyunQ: If I already have one Linux partition installed can I use hvcs on said
509*4882a593Smuzhiyunpartition to provide the console for the install of a second Linux
510*4882a593Smuzhiyunpartition?
511*4882a593Smuzhiyun
512*4882a593SmuzhiyunA: Yes granted that your are connected to the /dev/hvcs* device using
513*4882a593Smuzhiyunkermit or cu or some other program that doesn't provide terminal emulation.
514*4882a593Smuzhiyun
515*4882a593Smuzhiyun---------------------------------------------------------------------------
516*4882a593Smuzhiyun
517*4882a593SmuzhiyunQ: Can I connect to more than one partition's console at a time using this
518*4882a593Smuzhiyundriver?
519*4882a593Smuzhiyun
520*4882a593SmuzhiyunA: Yes.  Of course this means that there must be more than one vty-server
521*4882a593Smuzhiyunconfigured for this partition and each must point to a disconnected vty.
522*4882a593Smuzhiyun
523*4882a593Smuzhiyun---------------------------------------------------------------------------
524*4882a593Smuzhiyun
525*4882a593SmuzhiyunQ: Does the hvcs driver support dynamic (hotplug) addition of devices?
526*4882a593Smuzhiyun
527*4882a593SmuzhiyunA: Yes, if you have dlpar and hotplug enabled for your system and it has
528*4882a593Smuzhiyunbeen built into the kernel the hvcs drivers is configured to dynamically
529*4882a593Smuzhiyunhandle additions of new devices and removals of unused devices.
530*4882a593Smuzhiyun
531*4882a593Smuzhiyun---------------------------------------------------------------------------
532*4882a593Smuzhiyun
533*4882a593SmuzhiyunQ: For some reason /dev/hvcs* doesn't map to the same vty-server adapter
534*4882a593Smuzhiyunafter a reboot.  What happened?
535*4882a593Smuzhiyun
536*4882a593SmuzhiyunA: Assignment of vty-server adapters to /dev/hvcs* entries is always done
537*4882a593Smuzhiyunin the order that the adapters are exposed.  Due to hotplug capabilities of
538*4882a593Smuzhiyunthis driver assignment of hotplug added vty-servers may be in a different
539*4882a593Smuzhiyunorder than how they would be exposed on module load.  Rebooting or
540*4882a593Smuzhiyunreloading the module after dynamic addition may result in the /dev/hvcs*
541*4882a593Smuzhiyunand vty-server coupling changing if a vty-server adapter was added in a
542*4882a593Smuzhiyunslot between two other vty-server adapters.  Refer to the section above
543*4882a593Smuzhiyunon how to determine which vty-server goes with which /dev/hvcs* node.
544*4882a593SmuzhiyunHint; look at the sysfs "index" attribute for the vty-server.
545*4882a593Smuzhiyun
546*4882a593Smuzhiyun---------------------------------------------------------------------------
547*4882a593Smuzhiyun
548*4882a593SmuzhiyunQ: Can I use /dev/hvcs* as a conduit to another partition and use a tty
549*4882a593Smuzhiyundevice on that partition as the other end of the pipe?
550*4882a593Smuzhiyun
551*4882a593SmuzhiyunA: Yes, on Power5 platforms the hvc_console driver provides a tty interface
552*4882a593Smuzhiyunfor extra /dev/hvc* devices (where /dev/hvc0 is most likely the console).
553*4882a593SmuzhiyunIn order to get a tty conduit working between the two partitions the HMC
554*4882a593SmuzhiyunSuper Admin must create an additional "serial server" for the target
555*4882a593Smuzhiyunpartition with the HMC gui which will show up as /dev/hvc* when the target
556*4882a593Smuzhiyunpartition is rebooted.
557*4882a593Smuzhiyun
558*4882a593SmuzhiyunThe HMC Super Admin then creates an additional "serial client" for the
559*4882a593Smuzhiyuncurrent partition and points this at the target partition's newly created
560*4882a593Smuzhiyun"serial server" adapter (remember the slot).  This shows up as an
561*4882a593Smuzhiyunadditional /dev/hvcs* device.
562*4882a593Smuzhiyun
563*4882a593SmuzhiyunNow a program on the target system can be configured to read or write to
564*4882a593Smuzhiyun/dev/hvc* and another program on the current partition can be configured to
565*4882a593Smuzhiyunread or write to /dev/hvcs*.  Now you have a tty conduit between two
566*4882a593Smuzhiyunpartitions.
567*4882a593Smuzhiyun
568*4882a593Smuzhiyun---------------------------------------------------------------------------
569*4882a593Smuzhiyun
570*4882a593Smuzhiyun9. Reporting Bugs:
571*4882a593Smuzhiyun==================
572*4882a593Smuzhiyun
573*4882a593SmuzhiyunThe proper channel for reporting bugs is either through the Linux OS
574*4882a593Smuzhiyundistribution company that provided your OS or by posting issues to the
575*4882a593SmuzhiyunPowerPC development mailing list at:
576*4882a593Smuzhiyun
577*4882a593Smuzhiyunlinuxppc-dev@lists.ozlabs.org
578*4882a593Smuzhiyun
579*4882a593SmuzhiyunThis request is to provide a documented and searchable public exchange
580*4882a593Smuzhiyunof the problems and solutions surrounding this driver for the benefit of
581*4882a593Smuzhiyunall users.
582