Skip to content

[PW_SID:994749] [01/18] riscv: add initial kconfig and build flags for big-endian - #824

Closed
linux-riscv-bot wants to merge 18 commits into
workflow__riscv__fixesfrom
pw994749
Closed

[PW_SID:994749] [01/18] riscv: add initial kconfig and build flags for big-endian#824
linux-riscv-bot wants to merge 18 commits into
workflow__riscv__fixesfrom
pw994749

Conversation

@linux-riscv-bot

Copy link
Copy Markdown

PR for series 994749 applied to workflow__riscv__fixes

Name: [01/18] riscv: add initial kconfig and build flags for big-endian
URL: https://patchwork.kernel.org/project/linux-riscv/list/?series=994749
Version: 1

Add initial kconfig and makefile updates to get a base big-endian
build for arch/riscv. Will require header updates for IO code and
features whcih are known to not work.

Make this depend on CONFIG_EXPERIMENTAL for now as there are bits
that have not been fully fixed to work big-endian.

Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Add checks for big-endian, using BYTE_ORDER as
modern compilers should define this and anything
that isn't is probably too old to build a system.

Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
You can't build with vector enabled at the moment so remove
this until gcc is changed.

Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Use the generic word at a time code if we're running in big endian
for now otherwise this doesn't work. Add better support later.

Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Using .word breaks with big endian builds, making something which
is not a valid or worse an instruction or pair that does something
which is not intended.

Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
This code does not currently build with big-endian so disable it for now.

Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
The priveldged ISA spec says that all instructions should
be treated as little endian, so if we load them from memory
we should do le{16,32}_to_cpu on these and the reverse when
storing.

This fixes jump_label, bug and related functions for big endian
builds.

Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
If running big endian then the instruction stream needs to
be written le16/le323 and the BPF BSWAP instrictions need
to correctly set the endian.

Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Updated {k,u}probe code to deal with big endian mode where
the instruction stream is always in little endian.

Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Make the ftrace code work with big endian by ensuring the
instruction stream is accessed little endian.

Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Add the trapped instruction (insn) as the second argument to
riscv_v_first_use_handler() from the trap handler so when we
add more handlers we can do the fetch of the instruction just
once.

Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
If operating in big-endian, start all threads with UBE to keep
them the same endian as the system.

Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Update the unaligned handling of memory when in big-endian
and the byte positions inside a loaded word change. Do this
by wrapping the shift macros and swapping the left and right
shfits.

Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
It would seem sensible to add an ASM_INSN() wrapper for anyone to
use for hand assembly of instructions.

Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Start the guest in the same endian as the host.

Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
The instructions are always little endian, so ensure the
correct instruction endian.

Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
It seems a good idea if we get an undecoded instruction here to
at-least print an error.

Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[01/18] riscv: add initial kconfig and build flags for big-endian"
build-rv32-defconfig
Desc: Builds riscv32 defconfig
Duration: 102.92 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[01/18] riscv: add initial kconfig and build flags for big-endian"
build-rv64-clang-allmodconfig
Desc: Builds riscv64 allmodconfig with Clang, and checks for errors and added warnings
Duration: 1057.28 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[01/18] riscv: add initial kconfig and build flags for big-endian"
build-rv64-gcc-allmodconfig
Desc: Builds riscv64 allmodconfig with GCC, and checks for errors and added warnings
Duration: 1368.69 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[01/18] riscv: add initial kconfig and build flags for big-endian"
build-rv64-nommu-k210-defconfig
Desc: Builds riscv64 defconfig with NOMMU for K210
Duration: 21.22 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[01/18] riscv: add initial kconfig and build flags for big-endian"
build-rv64-nommu-k210-virt
Desc: Builds riscv64 defconfig with NOMMU for the virt platform
Duration: 21.95 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[01/18] riscv: add initial kconfig and build flags for big-endian"
checkpatch
Desc: Runs checkpatch.pl on the patch
Duration: 1.68 seconds
Result: ERROR
Output:

WARNING: 'whcih' may be misspelled - perhaps 'which'?
#8: 
features whcih are known to not work.
         ^^^^^

WARNING: please write a help paragraph that fully describes the config symbol with at least 4 lines
#28: FILE: arch/riscv/Kconfig:439:
+choice
+	prompt "Data endian"
+	default CPU_LITTLE_ENDIAN
+	help
+	  Configure the endiannes of data access performed by the CPU.
+	  This will require system to be booted from M mode in big endian
+	  and the userland to be compiled for the same endian-ness.
+

WARNING: please write a help paragraph that fully describes the config symbol with at least 4 lines
#36: FILE: arch/riscv/Kconfig:447:
+config CPU_BIG_ENDIAN
+	bool "Build big-endian kernel"
+	depends on EXPERT
+	help
+	  Say Y if you want to run big-endian kernel and userspace
+	  Set for expert as this experimental
+

WARNING: please write a help paragraph that fully describes the config symbol with at least 4 lines
#43: FILE: arch/riscv/Kconfig:454:
+config CPU_LITTLE_ENDIAN
+       bool "Build little-endian kernel (default)"
+       help
+	  Say  Y if you want to run little-endian kernel and userspace
+	  This is the default for most distributions

ERROR: trailing whitespace
#77: FILE: arch/riscv/Makefile:39:
+^Ielse^I$

total: 1 errors, 4 warnings, 0 checks, 59 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
      mechanically convert to the typical style using --fix or --fix-inplace.

NOTE: Whitespace errors detected.
      You may wish to use scripts/cleanpatch or scripts/cleanfile

Commit bbfdae3c0fd2 ("riscv: add initial kconfig and build flags for big-endian") has style problems, please review.

NOTE: Ignored message types: ALLOC_SIZEOF_STRUCT CAMELCASE COMMIT_LOG_LONG_LINE GIT_COMMIT_ID MACRO_ARG_REUSE NO_AUTHOR_SIGN_OFF

NOTE: If any of the errors are false positives, please report
      them to the maintainer, see CHECKPATCH in MAINTAINERS.
ERROR: trailing whitespace
WARNING: 'whcih' may be misspelled - perhaps 'which'?
WARNING: please write a help paragraph that fully describes the config symbol with at least 4 lines


@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[01/18] riscv: add initial kconfig and build flags for big-endian"
dtb-warn-rv64
Desc: Checks for Device Tree warnings/errors
Duration: 74.50 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[01/18] riscv: add initial kconfig and build flags for big-endian"
header-inline
Desc: Detects static functions without inline keyword in header files
Duration: 0.22 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[01/18] riscv: add initial kconfig and build flags for big-endian"
kdoc
Desc: Detects for kdoc errors
Duration: 0.84 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[01/18] riscv: add initial kconfig and build flags for big-endian"
module-param
Desc: Detect module_param changes
Duration: 0.24 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[01/18] riscv: add initial kconfig and build flags for big-endian"
verify-fixes
Desc: Verifies that the Fixes: tags exist
Duration: 0.21 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[01/18] riscv: add initial kconfig and build flags for big-endian"
verify-signedoff
Desc: Verifies that Signed-off-by: tags are correct
Duration: 0.29 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 16: "[16/18] KVM: riscv: add hstatus to allow endian control"
kdoc
Desc: Detects for kdoc errors
Duration: 0.86 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 16: "[16/18] KVM: riscv: add hstatus to allow endian control"
module-param
Desc: Detect module_param changes
Duration: 0.24 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 16: "[16/18] KVM: riscv: add hstatus to allow endian control"
verify-fixes
Desc: Verifies that the Fixes: tags exist
Duration: 0.21 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 16: "[16/18] KVM: riscv: add hstatus to allow endian control"
verify-signedoff
Desc: Verifies that Signed-off-by: tags are correct
Duration: 1.12 seconds
Result: ERROR
Output:

Commit e0d896541dac ("KVM: riscv: add hstatus to allow endian control")
	author Signed-off-by missing
	author email:    ben.dooks@codethink.co.uk
	committer email: linux.riscv.bot@gmail.com
	Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>

Errors in tree with Signed-off-by, please fix!


@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 17: "[17/18] KVM: riscv: instructions are little endian"
build-rv32-defconfig
Desc: Builds riscv32 defconfig
Duration: 104.44 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 17: "[17/18] KVM: riscv: instructions are little endian"
build-rv64-clang-allmodconfig
Desc: Builds riscv64 allmodconfig with Clang, and checks for errors and added warnings
Duration: 1051.71 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 17: "[17/18] KVM: riscv: instructions are little endian"
build-rv64-gcc-allmodconfig
Desc: Builds riscv64 allmodconfig with GCC, and checks for errors and added warnings
Duration: 1359.43 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 17: "[17/18] KVM: riscv: instructions are little endian"
build-rv64-nommu-k210-defconfig
Desc: Builds riscv64 defconfig with NOMMU for K210
Duration: 21.05 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 17: "[17/18] KVM: riscv: instructions are little endian"
build-rv64-nommu-k210-virt
Desc: Builds riscv64 defconfig with NOMMU for the virt platform
Duration: 22.60 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 17: "[17/18] KVM: riscv: instructions are little endian"
checkpatch
Desc: Runs checkpatch.pl on the patch
Duration: 0.72 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 17: "[17/18] KVM: riscv: instructions are little endian"
dtb-warn-rv64
Desc: Checks for Device Tree warnings/errors
Duration: 74.22 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 17: "[17/18] KVM: riscv: instructions are little endian"
header-inline
Desc: Detects static functions without inline keyword in header files
Duration: 0.22 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 17: "[17/18] KVM: riscv: instructions are little endian"
kdoc
Desc: Detects for kdoc errors
Duration: 0.88 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 17: "[17/18] KVM: riscv: instructions are little endian"
module-param
Desc: Detect module_param changes
Duration: 0.24 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 17: "[17/18] KVM: riscv: instructions are little endian"
verify-fixes
Desc: Verifies that the Fixes: tags exist
Duration: 0.54 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 17: "[17/18] KVM: riscv: instructions are little endian"
verify-signedoff
Desc: Verifies that Signed-off-by: tags are correct
Duration: 0.30 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 18: "[18/18] KVM: riscv: add warning if undecoded instruction"
build-rv32-defconfig
Desc: Builds riscv32 defconfig
Duration: 104.57 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 18: "[18/18] KVM: riscv: add warning if undecoded instruction"
build-rv64-clang-allmodconfig
Desc: Builds riscv64 allmodconfig with Clang, and checks for errors and added warnings
Duration: 1050.23 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 18: "[18/18] KVM: riscv: add warning if undecoded instruction"
build-rv64-gcc-allmodconfig
Desc: Builds riscv64 allmodconfig with GCC, and checks for errors and added warnings
Duration: 1360.85 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 18: "[18/18] KVM: riscv: add warning if undecoded instruction"
build-rv64-nommu-k210-defconfig
Desc: Builds riscv64 defconfig with NOMMU for K210
Duration: 21.29 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 18: "[18/18] KVM: riscv: add warning if undecoded instruction"
build-rv64-nommu-k210-virt
Desc: Builds riscv64 defconfig with NOMMU for the virt platform
Duration: 22.02 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 18: "[18/18] KVM: riscv: add warning if undecoded instruction"
checkpatch
Desc: Runs checkpatch.pl on the patch
Duration: 0.71 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 18: "[18/18] KVM: riscv: add warning if undecoded instruction"
dtb-warn-rv64
Desc: Checks for Device Tree warnings/errors
Duration: 75.40 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 18: "[18/18] KVM: riscv: add warning if undecoded instruction"
header-inline
Desc: Detects static functions without inline keyword in header files
Duration: 0.24 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 18: "[18/18] KVM: riscv: add warning if undecoded instruction"
kdoc
Desc: Detects for kdoc errors
Duration: 0.87 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 18: "[18/18] KVM: riscv: add warning if undecoded instruction"
module-param
Desc: Detect module_param changes
Duration: 0.26 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 18: "[18/18] KVM: riscv: add warning if undecoded instruction"
verify-fixes
Desc: Verifies that the Fixes: tags exist
Duration: 0.23 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 18: "[18/18] KVM: riscv: add warning if undecoded instruction"
verify-signedoff
Desc: Verifies that Signed-off-by: tags are correct
Duration: 0.33 seconds
Result: PASS

@linux-riscv-bot
linux-riscv-bot deleted the pw994749 branch August 30, 2025 00:58
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.

2 participants