Skip to content

Conversation

EricGao2015
Copy link

@EricGao2015 EricGao2015 commented Oct 10, 2025

#3294

This patch adds support for loongarch64 architecture.
Currently, three toolchains are supported for loongarch64 architecture: GCC, CLANG and LOONGARCH64_GNU.

@EricGao2015 EricGao2015 marked this pull request as draft October 10, 2025 07:50
Copy link

@MarsDoge MarsDoge left a comment

Choose a reason for hiding this comment

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

qiandongyan@aosc-qdy ~/github/libspdm/build/bin $ uname -a
Linux aosc-qdy 6.15.0-aosc-rc #1 SMP PREEMPT_DYNAMIC Tue May 20 16:35:17 UTC 2025 loongarch64 GNU/Linux
qiandongyan@aosc-qdy ~/github/libspdm/build/bin $ ./test_spdm_common
[==========] spdm_common_context_data_tests: Running 22 test(s).
[ RUN ] libspdm_test_common_context_data_case1
[ OK ] libspdm_test_common_context_data_case1
[ RUN ] libspdm_test_common_context_data_case2
[ OK ] libspdm_test_common_context_data_case2
[ RUN ] libspdm_test_common_context_data_case3
[ OK ] libspdm_test_common_context_data_case3
[ RUN ] libspdm_test_common_context_data_case4
[ OK ] libspdm_test_common_context_data_case4
[ RUN ] libspdm_test_verify_peer_cert_chain_buffer_case5
[ OK ] libspdm_test_verify_peer_cert_chain_buffer_case5
[ RUN ] libspdm_test_verify_peer_cert_chain_buffer_case6
[ OK ] libspdm_test_verify_peer_cert_chain_buffer_case6
[ RUN ] libspdm_test_verify_peer_cert_chain_buffer_case7
[ OK ] libspdm_test_verify_peer_cert_chain_buffer_case7
[ RUN ] libspdm_test_verify_peer_cert_chain_buffer_case8
[ OK ] libspdm_test_verify_peer_cert_chain_buffer_case8
[ RUN ] libspdm_test_set_data_case9
[ OK ] libspdm_test_set_data_case9
[ RUN ] libspdm_test_process_opaque_data_supported_version_data_case10
[ OK ] libspdm_test_process_opaque_data_supported_version_data_case10
[ RUN ] libspdm_test_process_opaque_data_supported_version_data_case11
[ OK ] libspdm_test_process_opaque_data_supported_version_data_case11
[ RUN ] libspdm_test_process_opaque_data_supported_version_data_case12
[ OK ] libspdm_test_process_opaque_data_supported_version_data_case12
[ RUN ] libspdm_test_process_opaque_data_supported_version_data_case13
[ OK ] libspdm_test_process_opaque_data_supported_version_data_case13
[ RUN ] libspdm_test_process_opaque_data_selection_version_data_case14
[ OK ] libspdm_test_process_opaque_data_selection_version_data_case14
[ RUN ] libspdm_test_process_opaque_data_selection_version_data_case15
[ OK ] libspdm_test_process_opaque_data_selection_version_data_case15
[ RUN ] libspdm_test_process_opaque_data_selection_version_data_case16
[ OK ] libspdm_test_process_opaque_data_selection_version_data_case16
[ RUN ] libspdm_test_process_opaque_data_selection_version_data_case17
[ OK ] libspdm_test_process_opaque_data_selection_version_data_case17
[ RUN ] libspdm_test_secured_message_context_location_selection_case18
[ OK ] libspdm_test_secured_message_context_location_selection_case18
[ RUN ] libspdm_test_export_master_secret_case19
[ OK ] libspdm_test_export_master_secret_case19
[ RUN ] libspdm_test_check_context_case20
[ OK ] libspdm_test_check_context_case20
[ RUN ] libspdm_test_max_session_count_case21
[ OK ] libspdm_test_max_session_count_case21
[ RUN ] libspdm_test_process_opaque_data_case22
[ OK ] libspdm_test_process_opaque_data_case22
[==========] spdm_common_context_data_tests: 22 test(s) run.
[ PASSED ] 22 test(s).
[==========] spdm_common_context_data_tests: Running 1 test(s).
[ RUN ] libspdm_test_common_context_data_case1
[ OK ] libspdm_test_common_context_data_case1
[==========] spdm_common_context_data_tests: 1 test(s) run.
[ PASSED ] 1 test(s).

For compatibility, it is recommended to roll back the compiler so that it can support non-cross compilation environments. I can already build it normally.
For example: The distribution's gcc points to loongarch64-aosc-linux-gnu-gcc.

@MarsDoge
Copy link

Qihang, please test -DCRYPTO=openssl build param, Can it be supported?

target_compile_options(cryptlib_openssl PRIVATE ${OPENSSL_FLAGS})

if(ARCH STREQUAL "x64")
    target_compile_options(cryptlib_openssl PRIVATE -DLIBSPDM_CPU_X64)
elseif(ARCH STREQUAL "ia32")
    target_compile_options(cryptlib_openssl PRIVATE -DLIBSPDM_CPU_IA32)
elseif(ARCH STREQUAL "aarch64")
    target_compile_options(cryptlib_openssl PRIVATE -DLIBSPDM_CPU_AARCH64)
elseif(ARCH STREQUAL "riscv32")
    target_compile_options(cryptlib_openssl PRIVATE -DLIBSPDM_CPU_RISCV32)
elseif(ARCH STREQUAL "riscv64")
    target_compile_options(cryptlib_openssl PRIVATE -DLIBSPDM_CPU_RISCV64)
elseif((ARCH STREQUAL "arm") OR (ARCH STREQUAL "aarch64"))
    target_compile_options(cryptlib_openssl PRIVATE -DLIBSPDM_CPU_ARM)
else()
    message(FATAL_ERROR "Unknown ARCH")
endif()

I don't see any valid loongarch64 branches above.

@EricGao2015 EricGao2015 changed the title Add LOONGARCH64_GNU toolchain Add support for loongarch64 architecture Oct 14, 2025
@EricGao2015
Copy link
Author

Qihang, please test -DCRYPTO=openssl build param, Can it be supported?

target_compile_options(cryptlib_openssl PRIVATE ${OPENSSL_FLAGS})

if(ARCH STREQUAL "x64")
    target_compile_options(cryptlib_openssl PRIVATE -DLIBSPDM_CPU_X64)
elseif(ARCH STREQUAL "ia32")
    target_compile_options(cryptlib_openssl PRIVATE -DLIBSPDM_CPU_IA32)
elseif(ARCH STREQUAL "aarch64")
    target_compile_options(cryptlib_openssl PRIVATE -DLIBSPDM_CPU_AARCH64)
elseif(ARCH STREQUAL "riscv32")
    target_compile_options(cryptlib_openssl PRIVATE -DLIBSPDM_CPU_RISCV32)
elseif(ARCH STREQUAL "riscv64")
    target_compile_options(cryptlib_openssl PRIVATE -DLIBSPDM_CPU_RISCV64)
elseif((ARCH STREQUAL "arm") OR (ARCH STREQUAL "aarch64"))
    target_compile_options(cryptlib_openssl PRIVATE -DLIBSPDM_CPU_ARM)
else()
    message(FATAL_ERROR "Unknown ARCH")
endif()

I don't see any valid loongarch64 branches above.

New code has supported openssl option.

@EricGao2015 EricGao2015 reopened this Oct 14, 2025
Copy link

@MarsDoge MarsDoge left a comment

Choose a reason for hiding this comment

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

LGTM

@jyao1
Copy link
Member

jyao1 commented Oct 15, 2025

is it still draft?

Copy link

@kilaterlee kilaterlee left a comment

Choose a reason for hiding this comment

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

LGTM, good job! :)

@EricGao2015 EricGao2015 marked this pull request as ready for review October 15, 2025 06:53
@EricGao2015
Copy link
Author

is it still draft?
@jyao1 @steven-bellock Dear reviewers, thank you for your attention to this PR. Now this patch is ready for review, please give some suggestions.

@steven-bellock steven-bellock linked an issue Oct 15, 2025 that may be closed by this pull request
Copy link
Contributor

@steven-bellock steven-bellock left a comment

Choose a reason for hiding this comment

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

DMTF#3294

This patch adds support for loongarch64 architecture.
Currently, three toolchains are supported for loongarch64 architecture: GCC,
CLANG and LOONGARCH64_GNU.

Signed-off-by: Qihang Gao <[email protected]>
Cc: Chao Li <[email protected]>
CC: Dongyan Qian <[email protected]>
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.

Add support for loongarch64 architecture

5 participants