Skip to content

Commit 8d49751

Browse files
Caz Yokoyamagregkh
authored andcommitted
Sample Implementation of Intel MIC User Space Daemon.
This patch introduces a sample user space daemon which implements the virtio device backends on the host. The daemon creates/removes/configures virtio device backends by communicating with the Intel MIC Host Driver. The virtio devices currently supported are virtio net, virtio console and virtio block. Virtio net supports TSO/GSO. The daemon also monitors card shutdown status and takes appropriate actions like killing the virtio backends and resetting the card upon card shutdown and crashes. Co-author: Ashutosh Dixit <ashutosh.dixit@intel.com> Co-author: Sudeep Dutt <sudeep.dutt@intel.com> Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com> Signed-off-by: Caz Yokoyama <Caz.Yokoyama@intel.com> Signed-off-by: Dasaratharaman Chandramouli <dasaratharaman.chandramouli@intel.com> Signed-off-by: Nikhil Rao <nikhil.rao@intel.com> Signed-off-by: Harshavardhan R Kharche <harshavardhan.r.kharche@intel.com> Signed-off-by: Sudeep Dutt <sudeep.dutt@intel.com> Acked-by: Yaozu (Eddie) Dong <eddie.dong@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 2141c7c commit 8d49751

8 files changed

Lines changed: 2347 additions & 0 deletions

File tree

‎Documentation/mic/mic_overview.txt‎

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
An Intel MIC X100 device is a PCIe form factor add-in coprocessor
2+
card based on the Intel Many Integrated Core (MIC) architecture
3+
that runs a Linux OS. It is a PCIe endpoint in a platform and therefore
4+
implements the three required standard address spaces i.e. configuration,
5+
memory and I/O. The host OS loads a device driver as is typical for
6+
PCIe devices. The card itself runs a bootstrap after reset that
7+
transfers control to the card OS downloaded from the host driver.
8+
The card OS as shipped by Intel is a Linux kernel with modifications
9+
for the X100 devices.
10+
11+
Since it is a PCIe card, it does not have the ability to host hardware
12+
devices for networking, storage and console. We provide these devices
13+
on X100 coprocessors thus enabling a self-bootable equivalent environment
14+
for applications. A key benefit of our solution is that it leverages
15+
the standard virtio framework for network, disk and console devices,
16+
though in our case the virtio framework is used across a PCIe bus.
17+
18+
Here is a block diagram of the various components described above. The
19+
virtio backends are situated on the host rather than the card given better
20+
single threaded performance for the host compared to MIC, the ability of
21+
the host to initiate DMA's to/from the card using the MIC DMA engine and
22+
the fact that the virtio block storage backend can only be on the host.
23+
24+
|
25+
+----------+ | +----------+
26+
| Card OS | | | Host OS |
27+
+----------+ | +----------+
28+
|
29+
+-------+ +--------+ +------+ | +---------+ +--------+ +--------+
30+
| Virtio| |Virtio | |Virtio| | |Virtio | |Virtio | |Virtio |
31+
| Net | |Console | |Block | | |Net | |Console | |Block |
32+
| Driver| |Driver | |Driver| | |backend | |backend | |backend |
33+
+-------+ +--------+ +------+ | +---------+ +--------+ +--------+
34+
| | | | | | |
35+
| | | |User | | |
36+
| | | |------|------------|---------|-------
37+
+-------------------+ |Kernel +--------------------------+
38+
| | | Virtio over PCIe IOCTLs |
39+
| | +--------------------------+
40+
+--------------+ | |
41+
|Intel MIC | | +---------------+
42+
|Card Driver | | |Intel MIC |
43+
+--------------+ | |Host Driver |
44+
| | +---------------+
45+
| | |
46+
+-------------------------------------------------------------+
47+
| |
48+
| PCIe Bus |
49+
+-------------------------------------------------------------+

‎Documentation/mic/mpssd/.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
mpssd

‎Documentation/mic/mpssd/Makefile‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#
2+
# Makefile - Intel MIC User Space Tools.
3+
# Copyright(c) 2013, Intel Corporation.
4+
#
5+
ifdef DEBUG
6+
CFLAGS += $(USERWARNFLAGS) -I. -g -Wall -DDEBUG=$(DEBUG)
7+
else
8+
CFLAGS += $(USERWARNFLAGS) -I. -g -Wall
9+
endif
10+
11+
mpssd: mpssd.o sysfs.o
12+
$(CC) $(CFLAGS) -o $@ $^ -lpthread
13+
14+
install:
15+
install mpssd /usr/sbin/mpssd
16+
install micctrl /usr/sbin/micctrl
17+
18+
clean:
19+
rm -f mpssd *.o

‎Documentation/mic/mpssd/micctrl‎

Lines changed: 173 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,173 @@
1+
#!/bin/bash
2+
# Intel MIC Platform Software Stack (MPSS)
3+
#
4+
# Copyright(c) 2013 Intel Corporation.
5+
#
6+
# This program is free software; you can redistribute it and/or modify
7+
# it under the terms of the GNU General Public License, version 2, as
8+
# published by the Free Software Foundation.
9+
#
10+
# This program is distributed in the hope that it will be useful, but
11+
# WITHOUT ANY WARRANTY; without even the implied warranty of
12+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13+
# General Public License for more details.
14+
#
15+
# The full GNU General Public License is included in this distribution in
16+
# the file called "COPYING".
17+
#
18+
# Intel MIC User Space Tools.
19+
#
20+
# micctrl - Controls MIC boot/start/stop.
21+
#
22+
# chkconfig: 2345 95 05
23+
# description: start MPSS stack processing.
24+
#
25+
### BEGIN INIT INFO
26+
# Provides: micctrl
27+
### END INIT INFO
28+
29+
# Source function library.
30+
. /etc/init.d/functions
31+
32+
sysfs="/sys/class/mic"
33+
34+
_status()
35+
{
36+
f=$sysfs/$1
37+
echo -e $1 state: "`cat $f/state`" shutdown_status: "`cat $f/shutdown_status`"
38+
}
39+
40+
status()
41+
{
42+
if [ "`echo $1 | head -c3`" == "mic" ]; then
43+
_status $1
44+
return $?
45+
fi
46+
for f in $sysfs/*
47+
do
48+
_status `basename $f`
49+
RETVAL=$?
50+
[ $RETVAL -ne 0 ] && return $RETVAL
51+
done
52+
return 0
53+
}
54+
55+
_reset()
56+
{
57+
f=$sysfs/$1
58+
echo reset > $f/state
59+
}
60+
61+
reset()
62+
{
63+
if [ "`echo $1 | head -c3`" == "mic" ]; then
64+
_reset $1
65+
return $?
66+
fi
67+
for f in $sysfs/*
68+
do
69+
_reset `basename $f`
70+
RETVAL=$?
71+
[ $RETVAL -ne 0 ] && return $RETVAL
72+
done
73+
return 0
74+
}
75+
76+
_boot()
77+
{
78+
f=$sysfs/$1
79+
echo "linux" > $f/bootmode
80+
echo "mic/uos.img" > $f/firmware
81+
echo "mic/$1.image" > $f/ramdisk
82+
echo "boot" > $f/state
83+
}
84+
85+
boot()
86+
{
87+
if [ "`echo $1 | head -c3`" == "mic" ]; then
88+
_boot $1
89+
return $?
90+
fi
91+
for f in $sysfs/*
92+
do
93+
_boot `basename $f`
94+
RETVAL=$?
95+
[ $RETVAL -ne 0 ] && return $RETVAL
96+
done
97+
return 0
98+
}
99+
100+
_shutdown()
101+
{
102+
f=$sysfs/$1
103+
echo shutdown > $f/state
104+
}
105+
106+
shutdown()
107+
{
108+
if [ "`echo $1 | head -c3`" == "mic" ]; then
109+
_shutdown $1
110+
return $?
111+
fi
112+
for f in $sysfs/*
113+
do
114+
_shutdown `basename $f`
115+
RETVAL=$?
116+
[ $RETVAL -ne 0 ] && return $RETVAL
117+
done
118+
return 0
119+
}
120+
121+
_wait()
122+
{
123+
f=$sysfs/$1
124+
while [ "`cat $f/state`" != "offline" -a "`cat $f/state`" != "online" ]
125+
do
126+
sleep 1
127+
echo -e "Waiting for $1 to go offline"
128+
done
129+
}
130+
131+
wait()
132+
{
133+
if [ "`echo $1 | head -c3`" == "mic" ]; then
134+
_wait $1
135+
return $?
136+
fi
137+
# Wait for the cards to go offline
138+
for f in $sysfs/*
139+
do
140+
_wait `basename $f`
141+
RETVAL=$?
142+
[ $RETVAL -ne 0 ] && return $RETVAL
143+
done
144+
return 0
145+
}
146+
147+
if [ ! -d "$sysfs" ]; then
148+
echo -e $"Module unloaded "
149+
exit 3
150+
fi
151+
152+
case $1 in
153+
-s)
154+
status $2
155+
;;
156+
-r)
157+
reset $2
158+
;;
159+
-b)
160+
boot $2
161+
;;
162+
-S)
163+
shutdown $2
164+
;;
165+
-w)
166+
wait $2
167+
;;
168+
*)
169+
echo $"Usage: $0 {-s (status) |-r (reset) |-b (boot) |-S (shutdown) |-w (wait)}"
170+
exit 2
171+
esac
172+
173+
exit $?

0 commit comments

Comments
 (0)