Skip to content
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

isa_defs.h: fix freebsd loongarch compilation errors("ISA not support… #16821

Closed
wants to merge 1 commit into from

Conversation

haowuge
Copy link

@haowuge haowuge commented Nov 30, 2024

Motivation and Context

Attempting to port freebsd to loongarch architecture, compilation error occurred

Description

Added LoongArch related code with reference to RISC-V

How Has This Been Tested?

===> libsa (all)
mkdir -p xlocale arpa;  for i in a.out.h assert.h elf.h inttypes.h limits.h nlist.h setjmp.h stddef.h stdbool.h string.h strings.h time.h unistd.h uuid.h; do  ln -sf /usr/src/include/$i $i;  done;  ln -sf /usr/src/sys/loongarch/include/stdarg.h stdarg.h;  ln -sf /usr/src/sys/sys/errno.h errno.h;  ln -sf /usr/src/sys/sys/stdint.h stdint.h;  ln -sf /usr/src/include/arpa/inet.h arpa/inet.h;  ln -sf /usr/src/include/arpa/tftp.h arpa/tftp.h;  for i in _time.h _strings.h _string.h; do  [ -f xlocale/$i ] || :> xlocale/$i;  done;  for i in ctype.h fcntl.h signal.h stdio.h stdlib.h; do  ln -sf /usr/src/stand/libsa/stand.h $i;  done
/usr/local/bin/ccache cc -target loongarch64-unknown-freebsd14.2 --sysroot=/usr/obj/usr/src/loongarch.loongarch64/tmp -B/usr/obj/usr/src/loongarch.loongarch64/tmp/usr/bin -ftls-model=initial-exec -O2 -pipe -fno-common -march=loongarch64 -mabi=lp64d   -nostdinc  -I/usr/src/stand/libsa/zfs/spl                                  -I/usr/src/sys/contrib/openzfs/include/os/freebsd                   -I/usr/src/sys/contrib/openzfs/include/os/freebsd/spl                            -I/usr/src/sys/contrib/openzfs/include/os/freebsd/zfs  -I/usr/obj/usr/src/loongarch.loongarch64/stand/libsa -I/usr/src/stand/libsa -D_STANDALONE -I/usr/src/sys -Ddouble=jagged-little-pill -Dfloat=floaty-mcfloatface -DLOADER_GELI_SUPPORT -I/usr/src/stand/libsa/geli -DLOADER_DISK_SUPPORT -ffreestanding  -march=loongarch64 -mabi=lp64d -fPIC -mno-relax -I. -Iinclude -g -gz=zlib -MD  -MF.depend.zfs_zstd.o -MTzfs_zstd.o -std=gnu99 -Wno-format-zero-length -Wsystem-headers -Werror -Wno-pointer-sign -Wdate-time -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable -Wno-error=unused-but-set-parameter -Wno-tautological-compare -Wno-unused-value -Wno-parentheses-equality -Wno-unused-function -Wno-enum-conversion -Wno-unused-local-typedef -Wno-address-of-packed-member -Wno-switch -Wno-switch-enum -Wno-knr-promoted-parameter -Wno-parentheses  -Qunused-arguments -include /usr/src/sys/contrib/openzfs/include/os/freebsd/spl/sys/ccompile.h -Wformat -Wall -I/usr/src/sys/contrib/openzfs/include  -DNEED_SOLARIS_BOOLEAN -DIN_BASE -DIN_LIBSA   -c /usr/src/sys/contrib/openzfs/module/zstd/zfs_zstd.c -o zfs_zstd.o
In file included from /usr/src/sys/contrib/openzfs/module/zstd/zfs_zstd.c:43:
In file included from /usr/src/sys/contrib/openzfs/include/os/freebsd/spl/sys/sysmacros.h:35:
/usr/src/sys/contrib/openzfs/include/os/freebsd/spl/sys/isa_defs.h:288:2: error: "ISA not supported"
  288 | #error "ISA not supported"
      |  ^
1 error generated.
*** Error code 1

Stop.
make[3]: stopped in /usr/src/stand/libsa
*** Error code 1

Stop.
make[2]: stopped in /usr/src/stand

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Performance enhancement (non-breaking change which improves efficiency)
  • Code cleanup (non-breaking change which makes code smaller or more readable)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Library ABI change (libzfs, libzfs_core, libnvpair, libuutil and libzfsbootenv)
  • Documentation (a change to man pages or other documentation)

Checklist:

@snajpa
Copy link
Contributor

snajpa commented Nov 30, 2024

checkstyle says

error: missing "Signed-off-by"
error: commit message body contains line over 72 characters

but what I really wanted - you can ignore the replacement/resilver_restart_001 failure, I have no idea why FreeBSD 14+ acts differently from the rest of the pack, will need to figure this out. But it might take a few days before I can get to this. If anyone could get me zfs_dbgmsg after that failure that would be most awesome :) (ref: #16822)

@haowuge
Copy link
Author

haowuge commented Nov 30, 2024

checkstyle says

error: missing "Signed-off-by"
error: commit message body contains line over 72 characters

I have resubmitted.

but what I really wanted - you can ignore the replacement/resilver_restart_001 failure, I have no idea why FreeBSD 14+ acts differently from the rest of the pack, will need to figure this out. But it might take a few days before I can get to this. If anyone could get me zfs_dbgmsg after that failure that would be most awesome :) (ref: #16822)

I am unable to run resilver_restart_001
View details ref: #16822

@@ -159,6 +159,16 @@ extern "C" {
#endif
#define _SUNOS_VTOC_16

#elif defined(__loongarch__)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On Linux this line is spelled as #elif defined(__loongarch__) && defined(__loongarch_lp64). Should here be the same or lp64 is the only option there now and forever?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your suggestion. I have updated the code to be consistent with the Linux version.
It compiles successfully (the porting work is not yet complete, and it has not been tested for normal operation).
Currently, Loongson has not released any high-performance devices using loongarch32 (compared to desktop or server hardware),
so 32-bit loongarch can actually be temporarily disregarded.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Though the question now is whether __loongarch_lp64 will be defined on FreeBSD. So far is is not. I can see only __loongarch__. So it feels like we need OS side to stabilize first.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

We are attempting to enable support for the LoongArch architecture
in FreeBSD.

The following error occurred:
freebsd/spl/sys/isa_defs.h:288:2: error: "ISA not supported"
    288 | #error "ISA not supported"
        |  ^
    1 error generated.
    *** Error code 1

I referenced the RISC-V and LoongArch for Linux code to
create the LoongArch patch.

Signed-off-by: Haowu Ge <[email protected]>
@RevySR
Copy link
Contributor

RevySR commented Dec 1, 2024

Does freebsd-kernel already support loongarch? There is no mailing list for it.

Can you provide information about freebsd loongarch support?

haowuge added a commit to haowuge/pull_requests_images that referenced this pull request Dec 1, 2024
@haowuge
Copy link
Author

haowuge commented Dec 1, 2024

Does freebsd-kernel already support loongarch? There is no mailing list for it.

Can you provide information about freebsd loongarch support?

We are working hard to make it a reality.
Currently, loader.efi is ready to run.
(The loader.efi dependency contains zfs)
输出
https://haowuge.github.io/pull_requests_images/2024-12-01/2024-12-01_21-09-35.mkv

@haowuge haowuge closed this Dec 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants