Re: [kvm-unit-tests PATCH v1 5/7] x86 UEFI: Exit QEMU with return code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Oct 31, 2021 at 3:02 AM Paolo Bonzini <pbonzini@xxxxxxxxxx> wrote:
>
> On 31/10/21 06:56, Zixuan Wang wrote:
> > From: Zixuan Wang <zxwang42@xxxxxxxxx>
> >   efi_status_t efi_main(efi_handle_t handle, efi_system_table_t *sys_tab)
> >   {
> > -     int ret;
> > +     unsigned long ret;
>
> Why this change?

Didn't notice this, it should be int, thanks for pointing it out!

> >       efi_status_t status;
> >       efi_bootinfo_t efi_bootinfo;
> >
> > @@ -134,14 +134,14 @@ efi_status_t efi_main(efi_handle_t handle, efi_system_table_t *sys_tab)
> >       ret = main(__argc, __argv, __environ);
> >
> >       /* Shutdown the guest VM */
> > -     efi_rs_call(reset_system, EFI_RESET_SHUTDOWN, ret, 0, NULL);
> > +     exit(ret);
> >
> >       /* Unreachable */
> >       return EFI_UNSUPPORTED;
> >
> >   efi_main_error:
> >       /* Shutdown the guest with error EFI status */
> > -     efi_rs_call(reset_system, EFI_RESET_SHUTDOWN, status, 0, NULL);
> > +     exit(status);
> >
> >       /* Unreachable */
> >       return EFI_UNSUPPORTED;
>
> It's better to keep the exit() *and* the efi_rs_call(), I think, in case
> the testdev is missing and therefore the exit() does not work.
>
> Paolo
>

I agree, I think there are three possible solutions:

1. keep both exit() and efi_rs_call() here, or
2. define a new function efi_exit() that calls both exit() and efi_rs_call(), or
3. add efi_rs_call() to the end of exit() function (defined in
lib/x86/io.c), so many other calls to exit() can utilize EFI exit as a
backup

Best regards,
Zixuan



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux