在 2023-04-28星期五的 22:36 -0500,Glenn Washburn写道:
> On Thu, 27 Apr 2023 15:46:22 +0800
> Xiaotian Wu <wuxiaot...@loongson.cn> wrote:
> 
> > I ran the test suite on a 3A5000 desktop, a LoongArch architecture
> > machine, using Archlinux for LoongArch distro, see
> > https://github.com/loongarchlinux.
> > 
> > Some software versions are:
> > * linux 6.3.0-rc4
> > * gcc 13.0.1 20230312
> > * binutils 2.40
> > * qemu 7.2.0
> > 
> > The test results of running "make check" with qemu 7.2 are as
> > follows:
> > 
> > =================================
> >    GRUB 2.11: ./test-suite.log
> > =================================
> > 
> >   # TOTAL: 85
> >   # PASS:  73
> >   # SKIP:  8
> >   # XFAIL: 0
> >   # FAIL:  2
> >   # XPASS: 0
> >   # ERROR: 2
> > 
> > .. contents:: :depth: 2
> > 
> > ERROR: f2fs_test
> > ================
> > 
> > mount: /tmp/grub-fs-
> > tester.20230418175640563815408.f2fs.UDs/f2fs_rw:
> > unknown filesystem type 'f2fs'. dmesg(1) may have more information
> > after failed mount system call. MOUNT FAILED.
> > ERROR f2fs_test (exit status: 99)
> > 
> > FAIL: hfs_test
> > ==============
> > 
> > recode: Request `utf8..macroman' is erroneous
> > mkfs.hfs: name required with -v option
> > FAIL hfs_test (exit status: 1)
> > 
> > ERROR: zfs_test
> > ===============
> > 
> > zpool not installed; cannot test zfs.
> > ERROR zfs_test (exit status: 99)
> > 
> > SKIP: pata_test
> > ===============
> > 
> > SKIP pata_test (exit status: 77)
> > 
> > SKIP: ahci_test
> > ===============
> > 
> > SKIP ahci_test (exit status: 77)
> > 
> > SKIP: uhci_test
> > ===============
> > 
> > SKIP uhci_test (exit status: 77)
> > 
> > SKIP: ohci_test
> > ===============
> > 
> > SKIP ohci_test (exit status: 77)
> > 
> > SKIP: ehci_test
> > ===============
> > 
> > SKIP ehci_test (exit status: 77)
> > 
> > SKIP: fddboot_test
> > ==================
> > 
> > SKIP fddboot_test (exit status: 77)
> > 
> > SKIP: netboot_test
> > ==================
> > 
> > SKIP netboot_test (exit status: 77)
> > 
> > SKIP: pseries_test
> > ==================
> > 
> > SKIP pseries_test (exit status: 77)
> > 
> > FAIL: grub_func_test
> > ====================
> > 
> > WARNING: Image format was not specified for
> > '/tmp/grub-shell.HeTAD8Ty3U/grub.iso' and probing guessed raw.
> > Automatically detecting the format is dangerous for raw images,
> > write
> > operations on block 0 will be restricted. Specify the 'raw' format
> > explicitly to remove the restrictions. Functional test failure:
> > shift_test: ... gfxterm_menu_640x480xi16:3 failed: 0xce34981e vs
> > 0xd9f04953 tests/video_checksum.c:checksum:615: assert failed: 0
> > Checksum gfxterm_menu_640x480xi16:2 failed: 0xa8fb749d vs
> > 0xbf3fa5d0
> >  tests/video_checksum.c:checksum:615: assert failed: 0 Checksum
> > gfxterm_menu_640x480xi16:1 failed: 0xce34981e vs 0xd9f04953
> > gfxterm_menu: FAIL
> > ...
> > videotest_checksum:
> > videotest_checksum: PASS
> > exfctest:
> > exfctest: PASS
> > TEST FAILURE
> > FAIL grub_func_test (exit status: 1)
> > 
> > We got 2 errors:
> > 
> > * f2fs_test
> > The kernel uses 16k pages, causing failures when loading the f2fs
> > kernel module, see
> > https://github.com/torvalds/linux/blob/master/fs/f2fs/super.c#L4670
> > This error can be ignored.
> > 
> > * zfs_test
> > zfs does not support the LoongArch architecture and is not
> > compatible
> > with the 6.3 kernel.
> > This error can be ignored.
> > 
> > We got 2 failures:
> > 
> > * hfs_test
> > I use recode 3.7.14-1 on Archlinux, running `recode -l` gives no
> > output `MacRoman`, so we get this error.
> > On Linux systems that support LoongArch, there is currently no need
> > to use HFS, so this failure can be ignored.
> 
> This might be because the "mac-roman" kernel module is not loaded.
> Regardless, I think its fine for the HFS tests to not work on this
> architecture.
> 
> > 
> > * grub_func_test
> > I don't know the reason for this failure. I guess it may be related
> > to qemu's edk2. In the previous review, I was told that the failure
> > here is the expected behavior. So, we can ignore this failure.
> 
> The above all seems good to me.
> 
> > Signed-off-by: Xiaotian Wu <wuxiaot...@loongson.cn>
> > ---
> >  tests/ahci_test.in                   |  2 +-
> >  tests/ehci_test.in                   |  2 +-
> >  tests/grub_func_test.in              |  2 ++
> >  tests/ohci_test.in                   |  2 +-
> >  tests/pata_test.in                   |  2 +-
> >  tests/uhci_test.in                   |  2 +-
> >  tests/util/grub-shell-luks-tester.in |  3 +++
> >  tests/util/grub-shell.in             | 15 +++++++++++++++
> >  8 files changed, 25 insertions(+), 5 deletions(-)
> > 
> > diff --git a/tests/ahci_test.in b/tests/ahci_test.in
> > index 6d2e61d4e..70646a24e 100644
> > --- a/tests/ahci_test.in
> > +++ b/tests/ahci_test.in
> > @@ -30,7 +30,7 @@ case
> > "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in mips*-arc
> > > 
> > mips*-qemu_mips) exit 77;;
> >      # FIXME: No native drivers are available for those
> > -    powerpc-ieee1275 | sparc64-ieee1275 | arm*-efi)
> > +    powerpc-ieee1275 | sparc64-ieee1275 | arm*-efi | loongarch64-
> > efi)
> >         exit 77;;
> >  esac
> >  
> > diff --git a/tests/ehci_test.in b/tests/ehci_test.in
> > index df671b4b6..bf823a5de 100644
> > --- a/tests/ehci_test.in
> > +++ b/tests/ehci_test.in
> > @@ -30,7 +30,7 @@ case
> > "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in mips*-arc
> > > 
> > mips*-qemu_mips) exit 77;;
> >      # FIXME: No native drivers are available for those
> > -    powerpc-ieee1275 | sparc64-ieee1275 | arm*-efi)
> > +    powerpc-ieee1275 | sparc64-ieee1275 | arm*-efi | loongarch64-
> > efi)
> >         exit 77;;
> >  esac
> >  
> > diff --git a/tests/grub_func_test.in b/tests/grub_func_test.in
> > index d43427c56..1fa3c4352 100644
> > --- a/tests/grub_func_test.in
> > +++ b/tests/grub_func_test.in
> > @@ -12,6 +12,8 @@ case
> > "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in #
> > PLATFORM:
> > Max RAM is 256M mips-qemu_mips | mipsel-qemu_mips)
> >         mem=256M;;
> > +    loongarch64-efi)
> > +       mem=3G;;
> >      *)
> >         mem=512M;;
> >  esac
> > diff --git a/tests/ohci_test.in b/tests/ohci_test.in
> > index 741ad881f..a40d3bc0a 100644
> > --- a/tests/ohci_test.in
> > +++ b/tests/ohci_test.in
> > @@ -30,7 +30,7 @@ case
> > "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in mips*-arc
> > > 
> > mips*-qemu_mips) exit 77;;
> >      # FIXME: No native drivers are available for those
> > -    powerpc-ieee1275 | sparc64-ieee1275 | arm*-efi)
> > +    powerpc-ieee1275 | sparc64-ieee1275 | arm*-efi | loongarch64-
> > efi)
> >         exit 77;;
> >  esac
> >  
> > diff --git a/tests/pata_test.in b/tests/pata_test.in
> > index 31144a8fd..4d0e7d573 100644
> > --- a/tests/pata_test.in
> > +++ b/tests/pata_test.in
> > @@ -33,7 +33,7 @@ case
> > "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in i386-efi)
> >         exit 77;;
> >      # FIXME: No native drivers are available for those
> > -    powerpc-ieee1275 | sparc64-ieee1275 | arm*-efi)
> > +    powerpc-ieee1275 | sparc64-ieee1275 | arm*-efi | loongarch64-
> > efi)
> >         exit 77;;
> >      i386-ieee1275)
> >         disk=hdb
> > diff --git a/tests/uhci_test.in b/tests/uhci_test.in
> > index 5aa5eb726..de199a281 100644
> > --- a/tests/uhci_test.in
> > +++ b/tests/uhci_test.in
> > @@ -30,7 +30,7 @@ case
> > "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in mips*-arc
> > > 
> > mips*-qemu_mips) exit 77;;
> >      # FIXME: No native drivers are available for those
> > -    powerpc-ieee1275 | sparc64-ieee1275 | arm*-efi)
> > +    powerpc-ieee1275 | sparc64-ieee1275 | arm*-efi | loongarch64-
> > efi)
> >         exit 77;;
> >  esac
> >  
> > diff --git a/tests/util/grub-shell-luks-tester.in
> > b/tests/util/grub-shell-luks-tester.in index 258f043a6..18920619a
> > 100644 --- a/tests/util/grub-shell-luks-tester.in
> > +++ b/tests/util/grub-shell-luks-tester.in
> > @@ -72,6 +72,9 @@ case
> > "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in i386-qemu)
> >         disk="ata0"
> >         ;;
> > +    loongarch64-efi)
> > +       disk="hd1"
> > +       ;;
> >  esac
> >  
> >  # Check the arguments.
> > diff --git a/tests/util/grub-shell.in b/tests/util/grub-shell.in
> > index 75f71dc1a..a0ca18e41 100644
> > --- a/tests/util/grub-shell.in
> > +++ b/tests/util/grub-shell.in
> > @@ -208,6 +208,17 @@ case
> > "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
> > disk="device
> > virtio-blk-device,drive=hd1 -drive if=none,id=hd1,file="
> > serial_port=efi0 ;;
> > +    loongarch64-efi)
> > +       qemu=qemu-system-loongarch64
> > +       boot=hd
> > +       console=console
> > +       trim=1
> > +       qemuopts="-machine virt -cpu la464-loongarch-cpu -smp 4
> > -nographic -m 3G \
> 
> Do we still need this to be 3G since you have it set to 3G in the
> functional tests already? The way you're running QEMU here, won't 3G
> of
> memory always be used? So that if you're running the tests in
> parallel,
> they might fail from not being able to allocate the needed memory?

Yes, to be honest, edk2 for qemu-system-loongarch64 has some
performance issues. I don't know the reason, but increasing memory can
solve it. It may be related to the fact that the kernel uses 16k pages
and edk2 uses 4k pages. I have tried to use 4G, 3G, 2G and 1G memory,
but only when the memory is larger than 3G, the test will pass,
otherwise most of the tests will time out and fail.
> 
> > +                 -bios QEMU_EFI.fd -L ${srcdir} -L
> > /usr/share/edk2/loongarch64  \
> 
> As I mentioned before, QEMU_EFI.fd is a bad name (because we want the
> source directory to be able to contain firmwares for many
> architectures). It should have the architecture encoded in it. See
> the
> Debian firmware files for ARM[1] and ARM64[2]. I can see how you just
> modeled the naming for ARM and ARM64 firmwares from grub-shell.in.
> Those are not correct for Debian and I have a patch that changes it,
> so
> they should not be used as a model.
> 
> [1] https://packages.debian.org/sid/all/qemu-efi-arm/filelist
> [2] https://packages.debian.org/sid/all/qemu-efi-aarch64/filelist
> 
The name of the FW compiled from EDK2 upstream source code is
QEMU_EFI.fd[1]. When DEBIAN packaged them, they were called
AAVMF_CODE.fd[2] and AAVMF32_CODE.fd[3] on aarch64 and arm, as far as I
know, renamed for compatibility with libvirt --- the paths are
hardcoded.

Because debian does not package qemu-efi-loongarch64 for edk2, I don't
know what it will be called, so it is recommended to keep the name of
the upstream output. If debian has this package, I will modify it here.
                                                                                
 
[1]
https://salsa.debian.org/qemu-team/edk2/-/blob/debian/debian/rules#L211
[2]:
https://salsa.debian.org/qemu-team/edk2/-/blob/debian/debian/rules#L216
[3]:
https://salsa.debian.org/qemu-team/edk2/-/blob/debian/debian/rules#L220


> > +                 -L /usr/share/qemu-efi-loongarch64 $qemuopts"
> > +       disk="device virtio-blk-pci,drive=hd1 -drive
> > if=none,id=hd1,file="
> 
> I believe if you make this hd0 instead of hd1, then you will not need
> the change in grub-shell-luks-tester.in. Please verify this, and if
> so
> change this.
> 
> Except for this...

I did this verification, but it didn't work; I modified "grubdisk" to
"hd0", but it didn't work either.

By adding the "--debug" parameter in the test script, I can get the
following information:
                                                                                
 
    kern/verifiers.c:212:verify: string: set debug=, type: 2          
    cmd: cryptomount -p testpass (hd0)                                
    devices: (proc) (hd0) (hd0,gpt3) (hd0,gpt2,msdos1) (hd0,gpt2)
(hd0,gpt1) (hd1)
    error: no cryptodisk module can handle this device.               
                                                                                
 
    1ZcwPhdTc7AV3zVLHshKnvyz4nKDLLKh                                  
    cryptomount failed: 2                                             
                                                                                
 
I think the encrypted disk is recognized as "(hd1)" in grub. If the
disk is set to "hd1" in "grub-shell-luks-tester", the correct test case
script can be generated.


> 
> Reviewed-by: Glenn Washburn <developm...@efficientek.com>
> 
> Glenn
> 
> > +       serial_port=
> > +       ;;
> >      *)
> >         boot=hd
> >         qemu=qemu-system-i386
> > @@ -423,6 +434,8 @@ fi
> >  if [ x$boot = xhd ]; then
> >      if [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" =
> > arm64-efi ] || [
> > "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = arm-efi ];
> > then device="device virtio-blk-device,drive=hd0 -drive
> > if=none,id=hd0,file="
> > +    elif [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" =
> > loongarch64-efi ]; then
> > +       device="device virtio-blk-pci,drive=grubdisk -drive
> > if=none,id=grubdisk,file=" elif [
> > "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = mips-arc ];
> > then device="hdb " else
> > @@ -433,6 +446,8 @@ fi
> >  if [ x$boot = xcd ]; then
> >      if [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" =
> > arm64-efi ] || [
> > "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = arm-efi ];
> > then device="device virtio-blk-device,drive=cd0 -drive
> > if=none,id=cd0,media=cdrom,file="
> > +    elif [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" =
> > loongarch64-efi ]; then
> > +       device="device virtio-blk-pci,drive=grubcd -drive
> > if=none,id=grubcd,media=cdrom,file=" elif [
> > "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" =
> > powerpc-ieee1275 ] && [ x$pseries != xy ] ; then device="-drive
> > if=ide,media=cdrom,file=" else
> 
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel



-- 
Best Regards
Xiaotian Wu


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to