xref: /illumos-gate/usr/src/man/man4d/vio9p.4d (revision 64439ec0071c576648f76b4466ad6ee7a580ed33)
1*64439ec0SJoshua M. Clulow.\"
2*64439ec0SJoshua M. Clulow.\" This file and its contents are supplied under the terms of the
3*64439ec0SJoshua M. Clulow.\" Common Development and Distribution License ("CDDL"), version 1.0.
4*64439ec0SJoshua M. Clulow.\" You may only use this file in accordance with the terms of version
5*64439ec0SJoshua M. Clulow.\" 1.0 of the CDDL.
6*64439ec0SJoshua M. Clulow.\"
7*64439ec0SJoshua M. Clulow.\" A full copy of the text of the CDDL should have accompanied this
8*64439ec0SJoshua M. Clulow.\" source.  A copy of the CDDL is also available via the Internet at
9*64439ec0SJoshua M. Clulow.\" http://www.illumos.org/license/CDDL.
10*64439ec0SJoshua M. Clulow.\"
11*64439ec0SJoshua M. Clulow.\"
12*64439ec0SJoshua M. Clulow.\" Copyright 2022 Oxide Computer Company
13*64439ec0SJoshua M. Clulow.\"
14*64439ec0SJoshua M. Clulow.Dd August 1, 2022
15*64439ec0SJoshua M. Clulow.Dt VIO9P 4D
16*64439ec0SJoshua M. Clulow.Os
17*64439ec0SJoshua M. Clulow.Sh NAME
18*64439ec0SJoshua M. Clulow.Nm vio9p
19*64439ec0SJoshua M. Clulow.Nd Virtio 9P Transport Driver
20*64439ec0SJoshua M. Clulow.Sh SYNOPSIS
21*64439ec0SJoshua M. Clulow.Pa /dev/9p/*
22*64439ec0SJoshua M. Clulow.Sh DESCRIPTION
23*64439ec0SJoshua M. ClulowThe
24*64439ec0SJoshua M. Clulow.Nm
25*64439ec0SJoshua M. Clulowdriver provides access to 9P transport devices commonly used by hypervisors
26*64439ec0SJoshua M. Clulowand emulators to expose a shared file system.
27*64439ec0SJoshua M. Clulow.Pp
28*64439ec0SJoshua M. ClulowThe
29*64439ec0SJoshua M. Clulow.Nm
30*64439ec0SJoshua M. Clulowdriver is not a
31*64439ec0SJoshua M. Clulow.Sy Committed
32*64439ec0SJoshua M. Clulowinterface, and may change at any time.
33*64439ec0SJoshua M. Clulow.Sh APPLICATION PROGRAMMING INTERFACE
34*64439ec0SJoshua M. ClulowEach device corresponds to a specific 9P channel, providing exclusive access to
35*64439ec0SJoshua M. Clulowone consumer at a time.
36*64439ec0SJoshua M. ClulowThe device may be opened with an
37*64439ec0SJoshua M. Clulow.Xr open 2
38*64439ec0SJoshua M. Clulowcall, which must include at least the
39*64439ec0SJoshua M. Clulow.Dv O_EXCL
40*64439ec0SJoshua M. Clulowand
41*64439ec0SJoshua M. Clulow.Dv O_RDWR
42*64439ec0SJoshua M. Clulowflags.
43*64439ec0SJoshua M. ClulowThe
44*64439ec0SJoshua M. Clulow.Dv O_NONBLOCK
45*64439ec0SJoshua M. Clulowor
46*64439ec0SJoshua M. Clulow.Dv O_NDELAY
47*64439ec0SJoshua M. Clulowflags may be used if non-blocking reads and writes are required.
48*64439ec0SJoshua M. Clulow.Pp
49*64439ec0SJoshua M. ClulowOnce open,
50*64439ec0SJoshua M. Clulow.Xr read 2
51*64439ec0SJoshua M. Clulowand
52*64439ec0SJoshua M. Clulow.Xr write 2
53*64439ec0SJoshua M. Clulowcalls may be made against the resulting file descriptor.
54*64439ec0SJoshua M. ClulowWrites represent a 9P request message sent to the hypervisor, and reads
55*64439ec0SJoshua M. Clulowrepresent responses to those requests.
56*64439ec0SJoshua M. Clulow.Pp
57*64439ec0SJoshua M. ClulowUnlike with other transports like TCP, the channel is not explicitly reset when
58*64439ec0SJoshua M. Clulowthe device is opened or closed.
59*64439ec0SJoshua M. ClulowAfter a call to
60*64439ec0SJoshua M. Clulow.Xr open 2 ,
61*64439ec0SJoshua M. Clulowthe application should use a
62*64439ec0SJoshua M. Clulow.Sy version
63*64439ec0SJoshua M. Clulowmessage to open a new session.
64*64439ec0SJoshua M. ClulowThis will explicitly discard any previous session, clunking any active fids in
65*64439ec0SJoshua M. Clulowthe process and negotiating an appropriate protocol version with the
66*64439ec0SJoshua M. Clulowhypervisor.
67*64439ec0SJoshua M. ClulowIt is likely also appropriate to do this as part of closing the device, to
68*64439ec0SJoshua M. Clulowallow the hypervisor to free any session tracking resources.
69*64439ec0SJoshua M. Clulow.Pp
70*64439ec0SJoshua M. ClulowWrites must be well-formed 9P messages, conforming to whichever 9P protocol
71*64439ec0SJoshua M. Clulowspecification is used by the hypervisor.
72*64439ec0SJoshua M. ClulowIn particular, each message must include a minimum of seven bytes, representing
73*64439ec0SJoshua M. Clulowthe message
74*64439ec0SJoshua M. Clulow.Em size[4] ,
75*64439ec0SJoshua M. Clulow.Em type[1] ,
76*64439ec0SJoshua M. Clulowand
77*64439ec0SJoshua M. Clulow.Em tag[2] .
78*64439ec0SJoshua M. ClulowIn most or all available protocol specifications, these fields are unsigned
79*64439ec0SJoshua M. Clulowintegers in little-endian order.
80*64439ec0SJoshua M. ClulowThe driver limits request and response size to 8192 bytes, and will fail larger
81*64439ec0SJoshua M. Clulowwrites with
82*64439ec0SJoshua M. Clulow.Er EMSGSIZE .
83*64439ec0SJoshua M. ClulowApplications should, in their initial
84*64439ec0SJoshua M. Clulow.Sy version
85*64439ec0SJoshua M. Clulowmessage,
86*64439ec0SJoshua M. Clulownegotiate an
87*64439ec0SJoshua M. Clulow.Em msize[4]
88*64439ec0SJoshua M. Clulowvalue less than or equal to 8192 bytes.
89*64439ec0SJoshua M. Clulow.Pp
90*64439ec0SJoshua M. ClulowReads are interruptible and will block waiting for a response to a request sent
91*64439ec0SJoshua M. Clulowin a previous write.
92*64439ec0SJoshua M. ClulowIf insufficient buffer space is provided to the read call to receive the
93*64439ec0SJoshua M. Clulowmessage, the call will fail with
94*64439ec0SJoshua M. Clulow.Er EOVERFLOW
95*64439ec0SJoshua M. Clulowand the message will remain available for a subsequent read.
96*64439ec0SJoshua M. ClulowMessages are provided as-is to the application, including the
97*64439ec0SJoshua M. Clulow.Em size[4] ,
98*64439ec0SJoshua M. Clulow.Em type[1] ,
99*64439ec0SJoshua M. Clulowand
100*64439ec0SJoshua M. Clulow.Em tag[2] .
101*64439ec0SJoshua M. Clulow.Pp
102*64439ec0SJoshua M. ClulowDepending on the 9P server provided by the hypervisor, requests that are issued
103*64439ec0SJoshua M. Clulowconcurrently may result in responses that arrive out of order.
104*64439ec0SJoshua M. ClulowApplications should develop a strategy for allocating unique
105*64439ec0SJoshua M. Clulow.Em tag[2]
106*64439ec0SJoshua M. Clulowvalues, so that request and response messages can be correlated.
107*64439ec0SJoshua M. Clulow.Sh IOCTLS
108*64439ec0SJoshua M. ClulowThe driver provides an ioctl,
109*64439ec0SJoshua M. Clulow.Dv VIO9P_IOC_MOUNT_TAG ,
110*64439ec0SJoshua M. Clulowto expose the
111*64439ec0SJoshua M. Clulow.Em Mount Tag
112*64439ec0SJoshua M. Clulowstring if one was provided by the hypervisor.
113*64439ec0SJoshua M. ClulowThe ioctl is defined in
114*64439ec0SJoshua M. Clulow.In sys/vio9p.h .
115*64439ec0SJoshua M. ClulowThe argument must be a
116*64439ec0SJoshua M. Clulow.Vt "char *" ,
117*64439ec0SJoshua M. Clulowpointing to a buffer of
118*64439ec0SJoshua M. Clulow.Dv VIO9P_MOUNT_TAG_SIZE
119*64439ec0SJoshua M. Clulowbytes.
120*64439ec0SJoshua M. ClulowOn success, the buffer will contain the mount tag string as read from the
121*64439ec0SJoshua M. Clulowhypervisor, followed by a null-terminating zero byte added by the driver to
122*64439ec0SJoshua M. Clulowensure the result can always be treated as a C string.
123*64439ec0SJoshua M. ClulowWhile the hypervisor is expected to provide a human-readable C string,
124*64439ec0SJoshua M. Clulowapplications should take care to verify that the contents are valid for display
125*64439ec0SJoshua M. Clulowor other purposes.
126*64439ec0SJoshua M. ClulowNote that even if successfully read, the string may be empty.
127*64439ec0SJoshua M. Clulow.Sh FILES
128*64439ec0SJoshua M. Clulow.Bl -tag -width Pa
129*64439ec0SJoshua M. Clulow.It Pa /dev/9p/*
130*64439ec0SJoshua M. ClulowCharacter device for access to a 9P channel.
131*64439ec0SJoshua M. Clulow.It Pa /kernel/drv/amd64/vio9p
132*64439ec0SJoshua M. ClulowDevice driver (x86)
133*64439ec0SJoshua M. Clulow.El
134*64439ec0SJoshua M. Clulow.Sh INTERFACE STABILITY
135*64439ec0SJoshua M. Clulow.Sy Uncommitted
136*64439ec0SJoshua M. Clulow.Sh SEE ALSO
137*64439ec0SJoshua M. Clulow.Xr close 2 ,
138*64439ec0SJoshua M. Clulow.Xr ioctl 2 ,
139*64439ec0SJoshua M. Clulow.Xr open 2 ,
140*64439ec0SJoshua M. Clulow.Xr read 2 ,
141*64439ec0SJoshua M. Clulow.Xr write 2
142