blob: aeee80e26e359842336b612a42b6a86146109864 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
|
#!/bin/bash
# Quick validation script for the GSP vGPU-IO project
# Run this to verify structure before committing
set -e
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m'
log_info() { echo -e "${GREEN}[INFO]${NC} $1"; }
log_warn() { echo -e "${YELLOW}[WARN]${NC} $1"; }
log_error() { echo -e "${RED}[ERROR]${NC} $1"; }
PROJECT_ROOT="$OPEN_IOV_ROOT"
cd "$PROJECT_ROOT"
log_info "=== GSP vGPU-IO Project Validation ==="
# Check firmware
log_info "Checking firmware..."
FW="$PROJECT_ROOT/firmware/570-GSP/gsp-570.144.fwimage.bin"
if [ ! -f "$FW" ]; then
log_error "Firmware not found: $FW"
exit 1
fi
SIZE=$(stat -c%s "$FW")
MD5=$(md5sum "$FW" | cut -d' ' -f1)
log_info "Firmware size: $SIZE bytes"
log_info "Firmware MD5: $MD5"
if [ "$MD5" != "13ce12a392a31eeb79a2e6ebd3a4a93a" ]; then
log_error "MD5 mismatch!"
exit 1
fi
log_info "Firmware OK ✓"
# Check decompiled output
log_info "Checking decompiled output..."
DECOMP_DIR="$PROJECT_ROOT/firmware/570-GSP/decompiled"
COUNT=$(ls "$DECOMP_DIR"/*.c 2>/dev/null | wc -l)
log_info "Decompiled files: $COUNT"
if [ "$COUNT" -lt 80 ]; then
log_warn "Expected at least 80 files, got $COUNT"
fi
# Check key functions
for func in \
"FUN_ram_057a1ac0" \
"FUN_ram_04cb8188" \
"FUN_ram_04f00b0c" \
"FUN_ram_04f00c78" \
"FUN_ram_057e94ec" \
"FUN_ram_051efbf4" \
"FUN_ram_059be7f4"; do
if ! ls "$DECOMP_DIR/${func}_ram_"*.c 2>/dev/null | grep -q .; then
log_error "Missing key function: $func"
exit 1
fi
done
# Check entry point (different naming pattern)
if [ ! -f "$DECOMP_DIR/entry_ram_04009000.c" ]; then
log_error "Missing entry point"
exit 1
fi
log_info "Key functions present ✓"
# Check driver structure
log_info "Checking driver structure..."
DRIVER="$PROJECT_ROOT/driver"
for dir in core rpc vf bar wpr migration debugfs include; do
if [ ! -d "$DRIVER/$dir" ]; then
log_error "Missing driver directory: $dir"
exit 1
fi
done
log_info "Driver directories OK ✓"
# Check driver source files
for file in \
"core/gsp_core.c" \
"rpc/gsp_rpc.c" \
"vf/gsp_vf.c" \
"bar/gsp_bar.c" \
"wpr/gsp_wpr.c" \
"migration/gsp_migration.c" \
"debugfs/gsp_debugfs.c" \
"include/gsp_core.h" \
"Makefile"; do
if [ ! -f "$DRIVER/$file" ]; then
log_error "Missing driver file: $file"
exit 1
fi
done
log_info "Driver source files OK ✓"
# Check wiki documentation
log_info "Checking wiki documentation..."
WIKI="$PROJECT_ROOT/wiki"
for doc in \
"GSP-570.144W-Firmware-Analysis.md" \
"RPC-Message-Format.md" \
"BAR-Emulation-Specification.md" \
"WPR-Management.md" \
"Migration-Protocol.md" \
"vGPU-IO-Integration-Guide.md" \
"Address-Reference.md" \
"Error-Codes.md" \
"Glossary.md" \
"README.md"; do
if [ ! -f "$WIKI/$doc" ]; then
log_error "Missing wiki doc: $doc"
exit 1
fi
done
log_info "Wiki docs OK ✓"
# Check test structure
log_info "Checking test structure..."
TESTS="$PROJECT_ROOT/kernel/tests"
for test in \
"gsp_vgpu_comprehensive_test.c" \
"gsp_vgpu_kunit_test.c" \
"gsp_vgpu_mock_test.c" \
"gsp_rpc_test.c" \
"Makefile"; do
if [ ! -f "$TESTS/$test" ]; then
log_error "Missing test: $test"
exit 1
fi
done
log_info "Kernel tests OK ✓"
# Check userspace tests
USERS="$PROJECT_ROOT/userspace/tests"
for file in "test_vgpu_userspace.c" "Makefile"; do
if [ ! -f "$USERS/$file" ]; then
log_error "Missing userspace test: $file"
exit 1
fi
done
log_info "Userspace tests OK ✓"
# Check userspace library
USRLIB="$PROJECT_ROOT/userspace/lib"
USRINC="$PROJECT_ROOT/userspace/include"
for file in "libvgpu.c" "Makefile" "libvgpu.pc.in"; do
if [ ! -f "$USRLIB/$file" ]; then
log_error "Missing userspace lib: $file"
exit 1
fi
done
if [ ! -f "$USRINC/libvgpu.h" ]; then
log_error "Missing userspace lib: libvgpu.h"
exit 1
fi
log_info "Userspace lib OK ✓"
# Check examples
EXAMPLES="$PROJECT_ROOT/userspace/examples"
for file in "example_vgpu.c" "Makefile"; do
if [ ! -f "$EXAMPLES/$file" ]; then
log_error "Missing example: $file"
exit 1
fi
done
log_info "Examples OK ✓"
# Check userspace top-level Makefile
if [ ! -f "$PROJECT_ROOT/userspace/Makefile" ]; then
log_error "Missing userspace Makefile"
exit 1
fi
log_info "Userspace Makefile OK ✓"
# Check integration test runner
if [ ! -f "$PROJECT_ROOT/tools/test/run_integration_tests.sh" ]; then
log_error "Missing integration test runner"
exit 1
fi
log_info "Integration test runner OK ✓"
# Check CI/CD
if [ ! -f "$PROJECT_ROOT/.github/workflows/ci.yml" ]; then
log_error "Missing CI workflow"
exit 1
fi
log_info "CI/CD workflow OK ✓"
# Check top-level README
if [ ! -f "$PROJECT_ROOT/README.md" ]; then
log_error "Missing top-level README"
exit 1
fi
log_info "README OK ✓"
# Syntax check C files (basic)
log_info "Running basic syntax checks..."
for cfile in $(find "$DRIVER" -name "*.c" -o -name "*.h"); do
# Check for basic issues
if grep -q "TODO\|FIXME\|XXX" "$cfile"; then
log_warn "$cfile contains TODO/FIXME/XXX"
fi
done
log_info "Syntax check complete ✓"
# Summary
log_info "=== Validation Complete ==="
log_info "All checks passed! ✓"
log_info ""
log_info "Project structure:"
log_info " Firmware: $FW"
log_info " Decompiled: $COUNT files"
log_info " Driver modules: 7 (core, rpc, vf, bar, wpr, migration, debugfs)"
log_info " Wiki docs: 10 files"
log_info " Kernel tests: 4 test modules + Makefile"
log_info " Userspace tests: 1 test + Makefile"
log_info " Integration: run_integration_tests.sh"
log_info " CI/CD: GitHub Actions"
log_info " README: Project documentation"
exit 0
|