Skip to content

Commit bea5c7d

Browse files
committed
boot-qemu.py: Eliminate _can_use_kvm() for arm64 and x86
The subclasses of QEMURunner can just initialize use_kvm in their constructors. ARMV7QEMURunner continues to use a separate method for initialization of use_kvm because of the check for 32-bit EL1. Signed-off-by: Nathan Chancellor <nathan@kernel.org>
1 parent 2ca85ba commit bea5c7d

1 file changed

Lines changed: 7 additions & 10 deletions

File tree

boot-qemu.py

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def __init__(self):
5353
# subclasses to set certain properties but the user can explicitly opt
5454
# out of KVM after instantiation, so any decisions based on it should
5555
# be confined to run().
56-
self.use_kvm = self._can_use_kvm()
56+
self.use_kvm = False
5757
self.smp = 0
5858
self.timeout = ''
5959

@@ -72,9 +72,6 @@ def __init__(self):
7272
self._qemu_path = None
7373
self._ram = '512m'
7474

75-
def _can_use_kvm(self):
76-
return False
77-
7875
def _find_dtb(self):
7976
if not self._dtb:
8077
raise RuntimeError('No dtb set?')
@@ -360,6 +357,8 @@ class ARMV7QEMURunner(ARMQEMURunner):
360357
def __init__(self):
361358
super().__init__()
362359

360+
self.use_kvm = self._can_use_kvm()
361+
363362
self.cmdline += ['console=ttyAMA0', 'earlycon']
364363

365364
def _can_use_kvm(self):
@@ -394,14 +393,13 @@ def __init__(self):
394393

395394
self.cmdline += ['console=ttyAMA0', 'earlycon']
396395
self.supports_efi = True
396+
self.use_kvm = platform.machine() == 'aarch64' and \
397+
self._have_dev_kvm_access()
397398

398399
self._default_kernel_path = Path('arch/arm64/boot/Image.gz')
399400
self._initrd_arch = 'arm64'
400401
self._qemu_arch = 'aarch64'
401402

402-
def _can_use_kvm(self):
403-
return platform.machine() == 'aarch64' and self._have_dev_kvm_access()
404-
405403
def _get_cpu_val(self):
406404
cpu = ['max']
407405

@@ -605,14 +603,13 @@ def __init__(self):
605603
super().__init__()
606604

607605
self.cmdline += ['console=ttyS0', 'earlycon=uart8250,io,0x3f8']
606+
self.use_kvm = platform.machine() == 'x86_64' and \
607+
self._have_dev_kvm_access()
608608

609609
self._default_kernel_path = Path('arch/x86/boot/bzImage')
610610
self._initrd_arch = 'x86'
611611
self._qemu_arch = 'i386'
612612

613-
def _can_use_kvm(self):
614-
return platform.machine() == 'x86_64' and self._have_dev_kvm_access()
615-
616613
def run(self):
617614
if self.use_kvm and not self.efi:
618615
# There are a lot of messages along the line of

0 commit comments

Comments
 (0)