Skip to content

Commit efb357d

Browse files
committed
images: Add intel-dsa-initcontainer
Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
1 parent 3a35a75 commit efb357d

File tree

4 files changed

+193
-0
lines changed

4 files changed

+193
-0
lines changed

.github/workflows/ci.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ jobs:
7777
- intel-sgx-plugin
7878
- intel-sgx-initcontainer
7979
- intel-dsa-plugin
80+
- intel-dsa-initcontainer
8081

8182
# Demo images
8283
- crypto-perf
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Copyright 2021 Intel Corporation. All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
FROM debian:unstable AS builder
16+
17+
RUN apt-get update && apt-get install -y \
18+
build-essential autoconf automake autotools-dev libtool \
19+
pkgconf asciidoc xmlto uuid-dev libjson-c-dev libkmod-dev \
20+
libudev-dev libkeyutils-dev curl
21+
22+
ARG ACCEL_CONFIG_VERSION="3.4.2"
23+
ARG ACCEL_CONFIG_DOWNLOAD_URL="https://github.com/intel/idxd-config/archive/accel-config-v$ACCEL_CONFIG_VERSION.tar.gz"
24+
ARG ACCEL_CONFIG_SHA256="9cb2151e86f83949a28f06a885be3bf3100906f9e3af667fa01b56e7666a3c1c"
25+
26+
RUN curl -fsSL "$ACCEL_CONFIG_DOWNLOAD_URL" -o accel-config.tar.gz \
27+
&& echo "$ACCEL_CONFIG_SHA256 accel-config.tar.gz" | sha256sum -c - \
28+
&& tar -xzf accel-config.tar.gz \
29+
&& rm accel-config.tar.gz
30+
31+
RUN cd idxd-config-accel-config-v$ACCEL_CONFIG_VERSION && \
32+
mkdir m4 && \
33+
./autogen.sh && \
34+
./configure CFLAGS='-g -O2' --prefix=/usr --sysconfdir=/etc --libdir=/usr/lib64 --disable-test --disable-docs && \
35+
make && \
36+
make install
37+
38+
FROM debian:unstable
39+
40+
RUN apt-get update && apt-get install -y uuid libjson-c5 kmod udev jq
41+
42+
COPY --from=builder /usr/lib64/libaccel-config.so.1.0.0 /lib/x86_64-linux-gnu/
43+
RUN ldconfig
44+
45+
COPY --from=builder /usr/bin/accel-config /usr/bin/
46+
47+
ADD demo/dsa-init.sh /dsa-init/
48+
ADD demo/dsa.conf /dsa-init/
49+
50+
WORKDIR /dsa-init
51+
ENTRYPOINT bash dsa-init.sh

demo/dsa-init.sh

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
5+
ndev=$(accel-config list --idle | jq '.[].dev' | grep -c dsa)
6+
nwq=4
7+
8+
function cmd() {
9+
10+
echo "$@"
11+
12+
"${@}"
13+
}
14+
15+
for (( i = 0; i < ndev; i++ )); do
16+
17+
dev="dsa${i}"
18+
19+
sed "s/X/${i}/g" < dsa.conf > $dev.conf
20+
21+
cmd accel-config load-config -c "$dev.conf"
22+
23+
cmd accel-config enable-device "$dev"
24+
25+
for (( j = 0; j < nwq; j++ )); do
26+
27+
wq="$dev/wq${i}.${j}"
28+
29+
cmd accel-config enable-wq "$wq"
30+
31+
done
32+
33+
done

demo/dsa.conf

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
[
2+
{
3+
"dev":"dsaX",
4+
"token_limit":0,
5+
"groups":[
6+
{
7+
"dev":"groupX.0",
8+
"tokens_reserved":0,
9+
"use_token_limit":0,
10+
"tokens_allowed":8,
11+
"grouped_workqueues":[
12+
{
13+
"dev":"wqX.0",
14+
"mode":"dedicated",
15+
"size":16,
16+
"group_id":0,
17+
"priority":10,
18+
"block_on_fault":1,
19+
"type":"user",
20+
"name":"appX0",
21+
"threshold":15
22+
}
23+
],
24+
"grouped_engines":[
25+
{
26+
"dev":"engineX.0",
27+
"group_id":0
28+
},
29+
]
30+
},
31+
{
32+
"dev":"groupX.1",
33+
"tokens_reserved":0,
34+
"use_token_limit":0,
35+
"tokens_allowed":8,
36+
"grouped_workqueues":[
37+
{
38+
"dev":"wqX.1",
39+
"mode":"dedicated",
40+
"size":16,
41+
"group_id":1,
42+
"priority":10,
43+
"block_on_fault":1,
44+
"type":"user",
45+
"name":"appX1",
46+
"threshold":15
47+
}
48+
],
49+
"grouped_engines":[
50+
{
51+
"dev":"engineX.1",
52+
"group_id":1
53+
},
54+
]
55+
},
56+
{
57+
"dev":"groupX.2",
58+
"tokens_reserved":0,
59+
"use_token_limit":0,
60+
"tokens_allowed":8,
61+
"grouped_workqueues":[
62+
{
63+
"dev":"wqX.2",
64+
"mode":"dedicated",
65+
"size":16,
66+
"group_id":2,
67+
"priority":10,
68+
"block_on_fault":1,
69+
"type":"user",
70+
"name":"appX2",
71+
"threshold":15
72+
}
73+
],
74+
"grouped_engines":[
75+
{
76+
"dev":"engineX.2",
77+
"group_id":2
78+
},
79+
]
80+
},
81+
{
82+
"dev":"groupX.3",
83+
"tokens_reserved":0,
84+
"use_token_limit":0,
85+
"tokens_allowed":8,
86+
"grouped_workqueues":[
87+
{
88+
"dev":"wqX.3",
89+
"mode":"dedicated",
90+
"size":16,
91+
"group_id":3,
92+
"priority":10,
93+
"block_on_fault":1,
94+
"type":"user",
95+
"name":"appX3",
96+
"threshold":15
97+
}
98+
],
99+
"grouped_engines":[
100+
{
101+
"dev":"engineX.3",
102+
"group_id":3
103+
},
104+
]
105+
},
106+
]
107+
}
108+
]

0 commit comments

Comments
 (0)