-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add aarch64 support, and more responsive qemu interaction #23
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,12 +28,24 @@ def strip_special(line): | |
|
||
|
||
def generate_qemu_cmd(args, readonly, *extra_args): | ||
if args.disable_smm: | ||
is_x86 = True | ||
arch_args = [] | ||
if os.path.basename(args.qemu_binary) == 'qemu-system-aarch64': | ||
machinetype = 'virt' | ||
arch_args.extend(['-cpu', 'cortex-a57']) | ||
is_x86 = False | ||
elif args.disable_smm: | ||
machinetype = 'pc' | ||
else: | ||
machinetype = 'q35,smm=on' | ||
machinetype += ',accel=%s' % ('kvm' if args.enable_kvm else 'tcg') | ||
|
||
if is_x86 == True: | ||
arch_args.extend(['-chardev', 'pty,id=charserial1', | ||
'-device', 'isa-serial,chardev=charserial1,id=serial1', | ||
'-global', 'driver=cfi.pflash01,property=secure,value=%s' % ( | ||
'off' if args.disable_smm else 'on')]) | ||
|
||
if args.oem_string is None: | ||
oemstrings = [] | ||
else: | ||
|
@@ -51,18 +63,14 @@ def generate_qemu_cmd(args, readonly, *extra_args): | |
'-no-user-config', | ||
'-nodefaults', | ||
'-m', '768', | ||
'-smp', '2,sockets=2,cores=1,threads=1', | ||
'-chardev', 'pty,id=charserial1', | ||
'-device', 'isa-serial,chardev=charserial1,id=serial1', | ||
'-global', 'driver=cfi.pflash01,property=secure,value=%s' % ( | ||
'off' if args.disable_smm else 'on'), | ||
'-smp', '1,sockets=1,cores=1,threads=1', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why have less CPUs on ARM? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can't remember exactly why I reduced that, but IIRC it was because initially I was testing this in a VM with only a single core. Frankly, a better question is why have more than 1 core, the entire firmware stack is single threaded. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
OVMF includes modules for providing EFI_PEI_MP_SERVICES_PPI, EFI_MP_SERVICES_PROTOCOL, and EFI_MM_MP_PROTOCOL. So the general statement that the entire firmware stack is single threaded is incorrect. It is true that PI / UEFI services are generally only usable on the BSP. It is also true that, for this particular use case, we do not need more than 1 VCPU. |
||
'-drive', | ||
'file=%s,if=pflash,format=raw,unit=0,readonly=on' % ( | ||
args.ovmf_binary), | ||
'-drive', | ||
'file=%s,if=pflash,format=raw,unit=1,readonly=%s' % ( | ||
args.out_temp, 'on' if readonly else 'off'), | ||
'-serial', 'stdio'] + oemstrings + list(extra_args) | ||
'-serial', 'stdio'] + oemstrings + arch_args + list(extra_args) | ||
|
||
|
||
def download(url, target, suffix, no_download): | ||
|
@@ -96,11 +104,8 @@ def enroll_keys(args): | |
args, | ||
False, | ||
'-drive', | ||
'file=%s,format=raw,if=none,media=cdrom,id=drive-cd1,' | ||
'readonly=on' % args.uefi_shell_iso, | ||
'-device', | ||
'ide-cd,drive=drive-cd1,id=cd1,' | ||
'bootindex=1') | ||
'file=%s,format=raw,if=virtio,media=cdrom,id=drive-cd1,' | ||
'readonly=on' % args.uefi_shell_iso) | ||
p = subprocess.Popen(cmd, | ||
stdin=subprocess.PIPE, | ||
stdout=subprocess.PIPE, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd suggest keying off of
args.arch
instead. Say if someone were to save off a copy ofqemu-system-aarch64
toqemu-system-aarch64.working
and re-run with that - a change in behavior would seem unexpected.