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

Andes/v6.1.80 #1

Open
wants to merge 169 commits into
base: stable/v6.1.80
Choose a base branch
from
Open

Andes/v6.1.80 #1

wants to merge 169 commits into from

Conversation

ycsin
Copy link
Owner

@ycsin ycsin commented Nov 6, 2024

No description provided.

lyctw and others added 30 commits March 6, 2024 17:14
It's not a SoC though, just for simplicity.

Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com>
Reviewed-by: Charles Ci-Jyun Wu <dminus@andestech.com>
Signed-off-by: Charles Ci-Jyun Wu <dminus@andestech.com>
Reformed from the following patches on RISCV-Linux-5.4:
- (d7d722e) Andes-specific relocation type support
- Reformed from the following patches:
- https://git.andestech.com/alankao/linux/commit/3cb9939499bcf862ed78bfd650701846f2edb966

Signed-off-by: Charles Ci-Jyun Wu <dminus@andestech.com>
Reformed from the following patches on RISCV-Linux-5.4:
- (77573fb) riscv: Add new readl_fixup() when driver probing
- (21033a8) riscv: Add shift_bits parameter on readl_fixup()
- (86c6918) riscv: Fix readl_fixup undefined problem

Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com>
Signed-off-by: Charles Ci-Jyun Wu <dminus@andestech.com>
Signed-off-by: Charles Ci-Jyun Wu <dminus@andestech.com>
Add required ports of the alternative scheme for Andes.

Signed-off-by: Charles Ci-Jyun Wu <dminus@andestech.com>
Apply the Andes legacy MMU errata. We need to flush TLB immediately after a
new PTE is allocated because the legacy MMU could retrieve stale data even if
the PTE is updated. Note that legacy MMU only exists in Andes 2X-series CPU.

Signed-off-by: Charles Ci-Jyun Wu <dminus@andestech.com>
Signed-off-by: Charles Ci-Jyun Wu <dminus@andestech.com>
…port

In the RISCV-Linux-5.4 branch, ioremap_nocache() is the function
that Andes uses to support noncache memory mapping.

But the Linux kernel ioremap_nocache() has been deprecated.
- (4bdc0d6) remove ioremap_nocache and devm_ioremap_nocache

And the generic RISCV ioremap() flow has also changed.
- (38af578) riscv: use the generic ioremap code

Signed-off-by: Charles Ci-Jyun Wu <dminus@andestech.com>
Signed-off-by: Charles Ci-Jyun Wu <dminus@andestech.com>
…ribute) in Linux 6.1

Reformed from the following patches on RISCV-Linux-5.4:
- (4e22888) riscv: Support PMA(Physical Memory Attribute) on linux5.4.
- (7dadad5) FTLCD100: Fix ioremap_nocache() causing LCD kernel panic issue.
- (496478d) Complete the programmable PMA implementation with IPI
- (0d56a5b) Fix compilation error for (884f011)
- (b4716ef) andes: rename sbi calls of andes vendor extension
- (313eb6a) riscv: fix compilation warnings
- (a1ca7a0) RISC-V: skip PMA setting for non-memory region

Signed-off-by: Charles Ci-Jyun Wu <dminus@andestech.com>
Signed-off-by: Charles Ci-Jyun Wu <dminus@andestech.com>
Reformed from the following patches on RISCV-Linux-5.4:
- (b455101) atcdmac300: support generic dma flow

Signed-off-by: Rick Chen <rick@andestech.com>
Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com>
Signed-off-by: Charles Ci-Jyun Wu <dminus@andestech.com>
Reformed from the following patches on RISCV-Linux-5.4:
- (b455101) atcdmac300: support generic dma flow
- (peter) Enable MMC_FTSDC_DMA by default to disable PIO mode
- (peter) ftsdc010g.c: fix missing NO_IRQ definition
- (peter) ftsdc010g.c: Use dma_request_chan() directly for channel request
- (52d263eb91e3) ftsdc010: Adjust tasklet_schedule position
- (4b995530bb71) atcdmac300g: remove DMAEngine driver dependency

Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com>
Reformed from the following patches on RISCV-Linux-5.4:
- (86c6918) riscv: Fix readl_fixup undefined problem
- (b2f4eef) riscv: Add error return code when readl_fixup() failed

Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com>
Reformed from the following patches on RISCV-Linux-5.4:
- (604c07b) Andes support for Faraday ATCMAC
- (d61585d) ftmac100.c: fix deprecated API
- (7c0206d) driver/net/ethernet/faraday: Support 64bit mac driver.
- (bb889b5) faraday/ftmac100.c: Solve NIC RPKT_LOST & NORXBUF issue
- (86aca05) driver/net/ethernet/faraday: Add ftmac100_debug control.
- (133384b) faraday/ftmac100.c: Support FTMAC100 with suspend & resume functions.

Signed-off-by: Alan Kao <alankao@andestech.com>
Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com>
Signed-off-by: Charles Ci-Jyun Wu <dminus@andestech.com>
Reformed from the following patches on RISCV-Linux-5.4:
- (77573fb) riscv: Add new readl_fixup() when driver probing
- (2c7bf75) Modify readl_fixup check register to Revision register
- (21033a8) riscv: Add shift_bits parameter on readl_fixup()
- (86c6918) riscv: Fix readl_fixup undefined problem
- (Create by Peter) fixup FTMAC100 riscv: Fix readl_fixup undefined problem

Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com>
Signed-off-by: Charles Ci-Jyun Wu <dminus@andestech.com>
Since RISC-V supports ioremap() with huge page (pud/pmd) mapping,
However, vmalloc_fault() assumes that the vmalloc range is limited
to pte mappings. To complete the vmalloc_fault() function by adding
huge page support.

Fixes: 310f541 ("riscv: Enable HAVE_ARCH_HUGE_VMAP for 64BIT")
Signed-off-by: Dylan Jhong <dylain@andestech.com>
Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com>
It has been changed exception table as relative after this commit

bb1f85d
riscv: switch to relative exception tables

Meanwhile struct exception_table_entry has been reconstruct.
Hence driver_access.S shall be reused __ex_table sections in
asm-extable.h , otherwise the ex_table searching will be out
of control and crush the system.

Signed-off-by: Rick Chen <rick@andestech.com>
Signed-off-by: Rick Chen <rick@andestech.com>
…nctions

This commit removes function declarations in include/soc/andes/proc.h
that are only used in RISCV-Linux-5.4 arch/riscv/andesv5/cctl.c and
arch/riscv/andesv5/sbi_proc_module.c.

It also moves include/soc/andes/proc.h cache-related functions to their
respective include files and removes the include/soc/andes/proc.h.

For more details, see:
[1] https://gitea.andestech.com/RD-SW/linux/issues/10

Signed-off-by: Charles Ci-Jyun Wu <dminus@andestech.com>
…ndes_defconfig

For more details, see:
https://gitea.andestech.com/RD-SW/linux/issues/3

Signed-off-by: Charles Ci-Jyun Wu <dminus@andestech.com>
Add 2 early command line parameters that allow to downgrade satp mode
(using the same naming as x86):
- "no5lvl": use a 4-level page table (down from sv57 to sv48)
- "no4lvl": use a 3-level page table (down from sv57/sv48 to sv39)

Note that going through the device tree to get the kernel command line
works with ACPI too since the efi stub creates a device tree anyway with
the command line.

In KASAN kernels, we can't use the libfdt that early in the boot process
since we are not ready to execute instrumented functions. So instead of
using the "generic" libfdt, we compile our own versions of those functions
that are not instrumented and that are prefixed so that they do not
conflict with the generic ones. We also need the non-instrumented versions
of the string functions and the prefixed versions of memcpy/memmove.

This is largely inspired by commit aacd149 ("arm64: head: avoid
relocating the kernel twice for KASLR") from which I removed compilation
flags that were not relevant to RISC-V at the moment (LTO, SCS). Also
note that we have to link with -z norelro to avoid ld.lld to throw a
warning with the new .got sections, like in commit 311bea3 ("arm64:
link with -z norelro for LLD or aarch64-elf").

Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com>
Tested-by: Björn Töpel <bjorn@rivosinc.com>
Reviewed-by: Björn Töpel <bjorn@rivosinc.com>
Link: https://lore.kernel.org/r/20230424092313.178699-2-alexghiti@rivosinc.com
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
Enable cpufreq kconfig menu for RISC-V.

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
Acked-by: Conor Dooley <conor.dooley@microchip.com>
Link: https://lore.kernel.org/r/20221115105135.1180490-2-prabhakar.mahadev-lad.rj@bp.renesas.com
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
Signed-off-by: Charles Ci-Jyun Wu <dminus@andestech.com>
Andes PMA is a per hart CSR. So when freeing PMA, it is necessary to
use the IPI mechanism to let each hart free its own PMA settings
through OpenSBI.

Signed-off-by: Dylan Jhong <dylan@andestech.com>
Reformed from the following patches on RISCV-Linux-5.4:
- (87831dd) Fix: inject feature
- (62754f1) Fix injection feature
- (42d4993) Fix: inject print message
- (6bb3adf) hijack rename to inject

Signed-off-by: Charles Ci-Jyun Wu <dminus@andestech.com>
Signed-off-by: Charles Ci-Jyun Wu <dminus@andestech.com>
Reformed from the following patches on RISCV-Linux-5.4:
-(15a3b9f) Fix DSP condition during context switch
-(43d9b4a) DSP support

Signed-off-by: Charles Ci-Jyun Wu <dminus@andestech.com>
Reformed from the following patches on RISCV-Linux-5.4:
- (d4bc170) Andes support for ATCRTC
- (4fe1359) ATCRTC100: Fix atcrtc100.c init fail due to kernel API change.
- (ae22823) ATCRTC100: Move request_irq() to the end of atc_rtc_probe().

Reformed from the following patches on v5.18.y_ae350-ax45mp:
- peter (c95b6e7) rtc-atcrtc100:c: update rtc APIs and use ioremap.

Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com>
Charles Ci-Jyun Wu and others added 30 commits March 6, 2024 17:19
…out cases to pass the tests

Board:
  A25MP_4C  >> Pass
  A27L2     >> Failed - timeout
  AX27L2    >> Failed case : futex_cmp_requeue01

QEMU:
  rv32 >>  Failed case : thp01, cve-2011-0999
  rv64 >>  Pass

Signed-off-by: Charles Ci-Jyun Wu <dminus@andestech.com>
…tion when flushing cache

It is possible that migration occurs when sync-ing kernel page table mappings
(i.e., sync_kernel_mappings). "sync_kernel_mappings" does two things, copy
the page table of kernel mapping and then flush the data using sfence.vma on
25 series bitmaps.

If the migration occurs between these two phases,
(e.g., the page table modifying core and the data-flushing core are not the same),
the page table data modification might not be sync-ed completely to L2 and memory.

This could cause the page table walker to use stale data and does the VA-PA translation
incorrectly. Therefore, we add preemption enable/disable pair when altering
page table and flushing the modified page table data to avoid this issue.

Fixes: Bugzilla 28230 ("[ASTv530_Beta] LTP failed on A25MP_4C")
Signed-off-by: Leo Yu-Chi Liang <ycliang@andestech.com>
This patch fixes the encoding of 0x32, which represents a different
event on the 25 and 65 series CPU.

- 25 series: Replay for load-after-store or store-after-store
             cases
- 45 series: No such event
- 65 series: Replay for load with memory-order violations or
             correctable ECC error

Fixes: 260bcf5 ("andes: perf: add andes event to JSON file")
Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com>
Andes 27-series CPUs follow the same event encoding with 25-series,
we also remove A{25|45} folders as they can share with json files
with AX{25|45}.

Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com>
--0000000000009a0c9905fd9173ad
Content-Transfer-Encoding: 8bit

After f15afbd ("fs: fix undefined behavior in bit shift for
SB_NOUSER") the constants were changed from plain integers which
LX_VALUE() can parse to constants using the BIT() macro which causes the
following:

Reading symbols from build/linux-custom/vmlinux...done.
Traceback (most recent call last):
  File "/home/fainelli/work/buildroot/output/arm64/build/linux-custom/vmlinux-gdb.py", line 25, in <module>
    import linux.constants
  File "/home/fainelli/work/buildroot/output/arm64/build/linux-custom/scripts/gdb/linux/constants.py", line 5
    LX_SB_RDONLY = ((((1UL))) << (0))

Use LX_GDBPARSED() which does not suffer from that issue.

f15afbd ("fs: fix undefined behavior in bit shift for SB_NOUSER")
Link: https://lkml.kernel.org/r/20230607221337.2781730-1-florian.fainelli@broadcom.com
Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
Acked-by: Christian Brauner <brauner@kernel.org>
Cc: Hao Ge <gehao@kylinos.cn>
Cc: Jan Kiszka <jan.kiszka@siemens.com>
Cc: Kieran Bingham <kbingham@kernel.org>
Cc: Luis Chamberlain <mcgrof@kernel.org>
Cc: Pankaj Raghav <p.raghav@samsung.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Hui Min Mina Chou <minachou@andestech.com>
… bash.

This testcase will create a long pathname to execute. However, in "sh"
Shell, it will fail to open the file due to the filename being too long.
Therefore, we will change it to use "bash" to execute the script.

execveat fail log:
/bin/sh: can't open
'/dev/fd/6/mnt/exec/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/xx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...': File name too long
Check success of execveat(6, 'mnt/exec/xxxxxxxxxxx...yyyyyyyyyyyyyyyyyyy',
0)... [FAIL] (child 370 exited with 2 not 127 nor 126)
1 tests failed

Signed-off-by: Hui Min Mina Chou <minachou@andestech.com>
Signed-off-by: Hui Min Mina Chou <minachou@andestech.com>
selftests/kselftest/runner.sh: Busybox's timeout command does not support "--foreground" option
    [Drop] cdd61a2 kselftest/runner.sh: Propagate SIGTERM to runner child (Upstream commit 9616cb3)
selftests/firmware: Busybox's diff command does not support "-Z" option
selftests/lkdtm: Busybox's comm does not support "--nocheck-order" option
selftests: Busybox's modprobe command does not support "-n" option
selftests/filesystems: Busybox does not support sudo command and already login as root

Signed-off-by: Hui Min Mina Chou <minachou@andestech.com>
In busybox, the mktemp requires that the generated filename be
suffixed with at least six consecutive 'X' characters. Otherwise,
it will return an "Invalid argument" error.

Signed-off-by: Hui Min Mina Chou <minachou@andestech.com>
In busybox, the default block size for mkfs.ext2 is 1024. This causes an
error when mounting zram as it does not meet the requirements.
Therefore, when running mkfs on /dev/zram, specify a block size of 4096.

  # ./zram.sh
  ...
  make ext2 filesystem on /dev/zram1
  zram mkfs.ext2: OK
  mount /dev/zram1
  [517.321021] EXT4-fs (zram1): bad block size 1024
  [517.323146] EXT4-fs (zram1): bad block size 1024
  [517.325233] EXT2-fs (zram1): error: bad blocksize 1024
  mount: mounting /dev/zram1 on zram1 failed: Invalid argument
  FAIL mount /dev/zram1 failed

Signed-off-by: Hui Min Mina Chou <minachou@andestech.com>
Signed-off-by: Hui Min Mina Chou <minachou@andestech.com>
Excluded test cases:
 * Build failed
    bpf
    seccomp
    alsa
    dma
    dmabuf-heaps
 * Not executed by default kselftest
    ia64
    kmod
    locking
    media_tests
    nolibc
    ntb
    perf_events
    prctl
    ptp
    rcutorture
    safesetid
    sched
    uevent
    user_events
    watchdog
    wireguar
 * Used some network utilities that BusyBox does not support
    drivers
    net
 * No virtual machine
    vm

Signed-off-by: Hui Min Mina Chou <minachou@andestech.com>
This testcase 'tools/testing/selftests/ptrace/vmaccess.c' still can not
pass on the newest v6.4 kernel. Thus, remove this test case.

Link: https://patchwork.kernel.org/project/linux-kselftest/patch/20221128070454.1850273-1-limin100@huawei.com/
Signed-off-by: Hui Min Mina Chou <minachou@andestech.com>
Skipped test case:
 * Used some network utilities that BusyBox does not support
    drivers/dma-buf
    drivers/s390x/uvdevice
    drivers/net/bonding
    drivers/net/team
    net
    net/af_unix
    net/forwarding
    net/mptcp
    net/openvswitch
 * Causes the system to hang
    lkdtm
    breakpoints
    firmware
 * Need to add reserved memory for ramoops in DTS
    pstore

Signed-off-by: Hui Min Mina Chou <minachou@andestech.com>
selftests/zram: Enable CONFIG_CRYPTO_LZO and CONFIG_SWAP config
selftests/syscall_user_dispatch: Enable CONFIG_SYSCALL_USER_DISPATCH config
selftests/kvm: Enable CONFIG_VIRTUALIZATION config
selftests/fpu:Enable CONFIG_RUNTIME_TESTING_MEN and CONFIG_TEST_FPU config
selftests/firmware: Enable CONFIG_RUNTIME_TESTING_MENU config
selftests/ftrace: Enable CONFIG_FTRACE_SYSCALL and CONFIG_SYNTH_EVENTS config

Signed-off-by: Hui Min Mina Chou <minachou@andestech.com>
When multiple events cause a trap to be taken with the same scause value,
we need to know the sdcause value that records the detailed cause.
The "print_detailed_cause" method is utilised to print out the detailed
cause when the trap occurs.

Signed-off-by: Ben Zong-You Xie <ben717@andestech.com>
Register the L2-cache IRQ. The IRQ will first clear the error status,
and then print the error messages according to the asynchronous error
register and the error register.

Signed-off-by: Ben Zong-You Xie <ben717@andestech.com>
…cise exception (torvalds#101)

To print error messages for imprecise exception, extract the field sdcause
in the CSR sdcause instead of reading the whole register.

Signed-off-by: Ben Zong-You Xie <ben717@andestech.com>

Reviewed-on: https://gitea.andestech.com/RD-SW/linux/pulls/101
Reviewed-by: Tim Shih-Ting OuYang <tim609@andestech.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
Reviewed-by: Dylan Dai-Rong Jhong <dylan@andestech.com>
Co-authored-by: Ben Zong-You Xie <ben717@andestech.com>
Co-committed-by: Ben Zong-You Xie <ben717@andestech.com>
…ework for slave device initialization.

Signed-off-by: CL Wang <cl634@andestech.com>
A few of the other page table level helpers are defined on rv32, but not
pgtable_l5_enabled.  This adds the definition as a constant and converts
pgtable_l4_enabled to a constant as well.

Link: https://lore.kernel.org/r/20230830044129.11481-2-palmer@rivosinc.com
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
The commit e9b5e1f :

modules: only allow symbol_get of EXPORT_SYMBOL_GPL modules

Signed-off-by: charles <dminus@andestech.com>
Register the interrupt but currently do nothing.
The reason for this is that the ads7846 probe checks
whether the SPI interrupt is registered

Signed-off-by: Locus Wei-Han Chen <locus84@andestech.com>
Extend the SPI driver to eliminate the need for the cpe_ts_ae350 driver.
Use the upstream ads7846.c and the SPI framework to operate the
touchscreen currently.

1. Can accurately obtain the values of the x-axis and y-axis.
2. Since different devices require distinct environmental
   configurations, during the probe stage, different initialization
   settings are applied based on the compatible string.

Signed-off-by: Locus Wei-Han Chen <locus84@andestech.com>
1. Since the SFDP table doesn't define quad page program, a fixup hook
   has been added to enable its support.
2. Currently, the ATCSPI200 supports regular mode read and write, as
   well as quad read and write. Additionally, it utilizes the exec_op
   method to replace the one-transfer approach.

Signed-off-by: Locus Wei-Han Chen <locus84@andestech.com>
… registers.

1. Use the native Linux IO APIs to read and write registers.
2. Change the register definition of hour from HOR_OFF to HOUR_OFF.
3. Change the register definition of WriteDone from WD to WRITE_DONE.
4. Update the copyright information.

Signed off by: CL Wang <cl634@andestech.com>
… is insufficient to represent the date.

The Andes internal implementation of the RTC on FPGA cannot count more
than 32 days because the day counter is 5 bits long, so use a variable
to hold the date in the situation where the size of the day is
insufficient to represent the date.

Signed-off-by: CL Wang <cl634@andestech.com>
…range.

The maximum day counter available for the ATCRTC100 hardware is 15 bits
long and can count up to 32767 days. This means that the ATCRTC100 hardware
can count up to about 89 years, so we set range_min to 2000 and range_max
to the end of the year 2089.

Signed-off-by: CL Wang <cl634@andestech.com>
…it physical address

Bug 30361 - L2 cache operation does not support physical memory larger than 4 GB

This issue stemmed from using writel for writing 64-bit physical addresses (PA)
to the L2 CCTL access line register, as writel is limited to 32-bit operations.
The solution involved replacing writel with writeq, enabling the correct
handling of 64-bit PAs.

Signed-off-by: charles <dminus@andestech.com>
Because the i2c bus driver needs to bring up other drivers, it should
use subsys_initcall. The procedure declared as subsys_initcall is
guaranteed to be executed before the procedure declared as module_init.

http://e-andes.andestech.com/bugzilla5/show_bug.cgi?id=30592

Test on Bigorca with Ax27L2 bitmap

Reviewed-on: https://gitea.andestech.com/RD-SW/linux/pulls/136
Reviewed-by: Tim Shih-Ting OuYang <tim609@andestech.com>
Reviewed-by: CL Chin-Long Wang <cl634@andestech.com>
Signed-off-by: Randolph <randolph@andestech.com>
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.