Skip to content

Commit 220374e

Browse files
tamirdshuahkh
authored andcommitted
kunit: enable hardware acceleration when available
Use KVM or HVF if supported by the QEMU binary and available on the system. This produces a nice improvement on my Apple M3 Pro running macOS 14.7: Before: ./tools/testing/kunit/kunit.py exec --arch arm64 [HH:MM:SS] Elapsed time: 10.145s After: ./tools/testing/kunit/kunit.py exec --arch arm64 [HH:MM:SS] Elapsed time: 1.773s Signed-off-by: Tamir Duberstein <tamird@gmail.com> Reviewed-by: David Gow <davidgow@google.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
1 parent 5653000 commit 220374e

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

tools/testing/kunit/kunit_kernel.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,9 @@ def start(self, params: List[str], build_dir: str) -> subprocess.Popen:
125125
'-append', ' '.join(params + [self._kernel_command_line]),
126126
'-no-reboot',
127127
'-nographic',
128+
'-accel', 'kvm',
129+
'-accel', 'hvf',
130+
'-accel', 'tcg',
128131
'-serial', self._serial] + self._extra_qemu_params
129132
# Note: shlex.join() does what we want, but requires python 3.8+.
130133
print('Running tests with:\n$', ' '.join(shlex.quote(arg) for arg in qemu_command))

tools/testing/kunit/qemu_configs/arm64.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@
99
qemu_arch='aarch64',
1010
kernel_path='arch/arm64/boot/Image.gz',
1111
kernel_command_line='console=ttyAMA0',
12-
extra_qemu_params=['-machine', 'virt', '-cpu', 'max,pauth-impdef=on'])
12+
extra_qemu_params=['-machine', 'virt', '-cpu', 'max'])

0 commit comments

Comments
 (0)