Commit 220374e7 authored by Tamir Duberstein's avatar Tamir Duberstein Committed by Shuah Khan
Browse files

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: default avatarTamir Duberstein <tamird@gmail.com>
Reviewed-by: default avatarDavid Gow <davidgow@google.com>
Signed-off-by: default avatarShuah Khan <skhan@linuxfoundation.org>
parent 56530007
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -125,6 +125,9 @@ class LinuxSourceTreeOperationsQemu(LinuxSourceTreeOperations):
				'-append', ' '.join(params + [self._kernel_command_line]),
				'-no-reboot',
				'-nographic',
				'-accel', 'kvm',
				'-accel', 'hvf',
				'-accel', 'tcg',
				'-serial', self._serial] + self._extra_qemu_params
		# Note: shlex.join() does what we want, but requires python 3.8+.
		print('Running tests with:\n$', ' '.join(shlex.quote(arg) for arg in qemu_command))
+1 −1
Original line number Diff line number Diff line
@@ -9,4 +9,4 @@ CONFIG_SERIAL_AMBA_PL011_CONSOLE=y''',
			   qemu_arch='aarch64',
			   kernel_path='arch/arm64/boot/Image.gz',
			   kernel_command_line='console=ttyAMA0',
			   extra_qemu_params=['-machine', 'virt', '-cpu', 'max,pauth-impdef=on'])
			   extra_qemu_params=['-machine', 'virt', '-cpu', 'max'])