Commit Graph

1152903 Commits

Author SHA1 Message Date
chunzhi.lin 6502f3a9ac riscv:dts:capricorn:add i2c-rtc device
Signed-off-by: chunzhi.lin <chunzhi.lin@sophgo.com>
2024-05-24 06:18:27 +08:00
chunzhi.lin e42e8fb84d dts:sophgo:x4evb:Apply top interrupt instead of msi on x16 slot
Signed-off-by: chunzhi.lin <chunzhi.lin@sophgo.com>
2024-05-20 15:11:59 +08:00
Jingyu Li ce9b87f536 drivers: rtc: disable BMC RTC device
Signed-off-by: Jingyu Li <jingyu.li01@sophgo.com>
2024-05-09 20:03:42 +08:00
chunzhi.lin 0c7a3fa6d5 dts:sophgo:add i2c-rtc ds1307 device node for single chip
Signed-off-by: chunzhi.lin <chunzhi.lin@sophgo.com>
2024-04-23 14:42:20 +08:00
chunzhi.lin 83ab3eda46 riscv:dts:modify dw gpio clock name
Modified the gpio clock-names in GPIO nodes so mango dts could
adapt to Designware gpio controller driver, then gpio bus clock
and gpio debounce clock would be enabled.
I also force enable the gpio interrupt clock in sophgo clock
system so that the gpio interrupt trigger could take effect.

Signed-off-by: chunzhi.lin <chunzhi.lin@sophgo.com>
2024-03-28 15:17:25 +08:00
Xiaoguang Xing fca42b033d riscv: defconfig: Add openeuler defconfig
Signed-off-by: Xiaoguang Xing <xiaoguang.xing@sophgo.com>
2024-03-26 11:27:26 +08:00
fengchun.li d56e918902 drivers:pci:remove the err log of parsing pci
dirvers:pci:remove the err log of parsing pci

Signed-off-by: fengchun.li <fengchun.li@sophgo.com>
2024-03-23 19:15:11 +08:00
zhaohui-yan 70b8024049 Modify the switchtec's PCIE whitelist deviceId
Signed-off-by: zhaohui-yan <zhaohui.yan@sophgo.com>
2024-03-22 15:47:29 +08:00
Samuel Holland 553e3f97e7 riscv: Fix build with CONFIG_CC_OPTIMIZE_FOR_SIZE=y
[sophgo] - Fix riscv go1.22 issue on Milk-v Pioneer
           https://www.reddit.com/r/RISCV/s/ip18lqfmWB

commit 8eb060e101 ("arch/riscv: add Zihintpause support") broke
building with CONFIG_CC_OPTIMIZE_FOR_SIZE enabled (gcc 11.1.0):

  CC      arch/riscv/kernel/vdso/vgettimeofday.o
In file included from <command-line>:
./arch/riscv/include/asm/jump_label.h: In function 'cpu_relax':
././include/linux/compiler_types.h:285:33: warning: 'asm' operand 0 probably does not match constraints
  285 | #define asm_volatile_goto(x...) asm goto(x)
      |                                 ^~~
./arch/riscv/include/asm/jump_label.h:41:9: note: in expansion of macro 'asm_volatile_goto'
   41 |         asm_volatile_goto(
      |         ^~~~~~~~~~~~~~~~~
././include/linux/compiler_types.h:285:33: error: impossible constraint in 'asm'
  285 | #define asm_volatile_goto(x...) asm goto(x)
      |                                 ^~~
./arch/riscv/include/asm/jump_label.h:41:9: note: in expansion of macro 'asm_volatile_goto'
   41 |         asm_volatile_goto(
      |         ^~~~~~~~~~~~~~~~~
make[1]: *** [scripts/Makefile.build:249: arch/riscv/kernel/vdso/vgettimeofday.o] Error 1
make: *** [arch/riscv/Makefile:128: vdso_prepare] Error 2

Having a static branch in cpu_relax() is problematic because that
function is widely inlined, including in some quite complex functions
like in the VDSO. A quick measurement shows this static branch is
responsible by itself for around 40% of the jump table.

Drop the static branch, which ends up being the same number of
instructions anyway. If Zihintpause is supported, we trade the nop from
the static branch for a div. If Zihintpause is unsupported, we trade the
jump from the static branch for (what gets interpreted as) a nop.

Fixes: 8eb060e101 ("arch/riscv: add Zihintpause support")
Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
Cc: stable@vger.kernel.org
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
2024-03-19 16:53:04 +08:00
Xiaoguang Xing 45af4b38be Revert "riscv: Fix set_memory_XX() and set_direct_map_XX() by splitting huge linear mappings"
This reverts commit b4f4d42765.

The reverted patch make panic when enable CONFIG_HIGHMEM.

[    8.137832] Unable to handle kernel paging request at virtual address ffffffd7fde00000
[    8.145798] Oops [#1]
[    8.148097] Modules linked in:
[    8.151164] CPU: 40 PID: 990 Comm: (udev-worker) Not tainted 6.1.80-pisces #2024.03.09.02.45+64611d3c7
[    8.160473] Hardware name: Sophgo Mango (DT)
[    8.164745] epc : __split_linear_mapping_pgd+0x308/0x4c8
[    8.170075]  ra : __set_memory+0x1fe/0x3cc
[    8.174177] epc : ffffffff8000e0f2 ra : ffffffff8000e4b0 sp : ffffffd90c503af0
[    8.181401]  gp : ffffffff81a449b0 tp : ffffffd90c4a2000 t0 : ffffffeffdfb0000
[    8.188622]  t1 : 0000000000000040 t2 : 2e003834324c2e00 s0 : ffffffd90c503bc0
[    8.195840]  s1 : 0000000000200000 a0 : ffffffd7fde00000 a1 : 0000000000000000
[    8.203058]  a2 : 000000003fffffff a3 : 0000000000200000 a4 : 0000000000000fff
[    8.210277]  a5 : 0000000000001000 a6 : 0000000000000000 a7 : ffffffff01b6a100
[    8.217495]  s2 : 0000000000001000 s3 : ffffffffffffffff s4 : ffc00000000003ff
[    8.224716]  s5 : ffffffd7fde00000 s6 : 0000000040000000 s7 : ffffffff81a67000
[    8.231936]  s8 : ffffffffffe00000 s9 : 0000000000000000 s10: 0000000000200000
[    8.239157]  s11: ffffffd7fde00000 t3 : ffffffffffffffff t4 : 0000000000000000
[    8.246378]  t5 : 0000e70000000000 t6 : 0000000000000000
[    8.251686] status: 0000000200000120 badaddr: ffffffd7fde00000 cause: 000000000000000d
[    8.259599] [<ffffffff8000e0f2>] __split_linear_mapping_pgd+0x308/0x4c8
[    8.266217] [<ffffffff8000e4b0>] __set_memory+0x1fe/0x3cc
[    8.271616] [<ffffffff8000e6be>] set_memory_ro+0x1c/0x24
[    8.276928] [<ffffffff800a5e7c>] module_enable_ro+0x6e/0x10c
[    8.282592] [<ffffffff800a4e24>] load_module+0x1748/0x1e38
[    8.288079] [<ffffffff800a574a>] __do_sys_finit_module+0x9e/0xfa
[    8.294086] [<ffffffff800a57c2>] sys_finit_module+0x1c/0x24
[    8.299659] [<ffffffff80003ee8>] ret_from_syscall+0x0/0x2
2024-03-11 13:45:10 +08:00
Xiaoguang Xing 580d379cf6 Revert "riscv: Fix set_direct_map_default_noflush() to reset _PAGE_EXEC"
This reverts commit add57b5298.
2024-03-11 13:44:32 +08:00
Xiaoguang Xing c02665abdd Revert "riscv: Fix wrong usage of lm_alias() when splitting a huge linear mapping"
This reverts commit b1cc57f976.
2024-03-11 13:44:06 +08:00
fengchun.li e7d0ed6651 drivers: pci: support msix in PCIe rc0 for milkv mainboard
arch: riscv: remove PCIe rc1 of milkv pioneer pcie dtsi according

to new mainbaord PCB

Signed-off-by: fengchun.li <fengchun.li@sophgo.com>
2024-03-07 17:05:53 +08:00
Samuel Holland 4973498c70 drm/amd/display: Support DRM_AMD_DC_FP on RISC-V
RISC-V uses kernel_fpu_begin()/kernel_fpu_end() like several other
architectures. Enabling hardware FP requires overriding the ISA string
for the relevant compilation units.

Signed-off-by: Samuel Holland <samuel.holland@sifive.com>
Signed-off-by: Icenowy Zheng <uwu@icenowy.me>
2024-03-04 09:58:30 +08:00
Samuel Holland 8b2d3e1500 riscv: Factor out riscv-march-y to a separate Makefile
Since it is not possible to incrementally add/remove extensions from the
compiler's ISA string by appending arguments, any code that wants to
modify the ISA string must recreate the whole thing. To support this,
factor out the logic for generating the -march argument so it can be
reused where needed.

Signed-off-by: Samuel Holland <samuel.holland@sifive.com>
Signed-off-by: Icenowy Zheng <uwu@icenowy.me>
2024-03-04 09:58:30 +08:00
Samuel Holland d3b593b59a riscv: Add support for kernel-mode FPU
This is needed to support recent hardware in the amdgpu DRM driver. The
FPU code in that driver is not performance-critical, so only provide the
minimal support.

Signed-off-by: Samuel Holland <samuel.holland@sifive.com>
Signed-off-by: Icenowy Zheng <uwu@icenowy.me>
2024-03-04 09:58:30 +08:00
Icenowy Zheng d650996db8 riscv: fix v0p7 hiding
The variable for hiding v0p7 needs to be set BEFORE the ISA set
initialzation, so use early_param instead of __setup .

Signed-off-by: Icenowy Zheng <uwu@icenowy.me>
2024-03-04 09:58:30 +08:00
Han Gao c9ff9244f0 fix: repair hwcap=0 in using hide_v0p7_ext
Signed-off-by: Han Gao <gaohan@iscas.ac.cn>
2024-03-04 09:58:30 +08:00
chunzhi.lin 066080d0ca riscv:dts:modify pisces ddr pcb type to x4
Signed-off-by: chunzhi.lin <chunzhi.lin@sophgo.com>
2024-03-04 09:58:30 +08:00
zhaohui-yan bfc3a21fe8 kernel drivers/rtc/rtc-astbmc.c:
1. Increase timeout return strategy when reading RTC time;
2. Detect the status of BMC before registering RTC devices.
2024-03-04 09:58:30 +08:00
chunzhi.lin 2b15286212 riscv:dts:add sg2042 capricorn server
Signed-off-by: chunzhi.lin <chunzhi.lin@sophgo.com>
2024-03-04 09:58:30 +08:00
haijiao.liu 5e71dee2be riscv: dts: gpio29's function mux for yixin
Signed-off-by: haijiao.liu <haijiao.liu@sophgo.com>
2024-03-04 09:58:30 +08:00
zhaohui-yan 926e0793f6 1. drivers/rtc: Add rtc-astbmc module.
2. drivers/char/ipmi: Initialize ipmi_si module using hardcode method.
3. Rtc-astbmc module is initialized before ipmi_si module.
2024-03-04 09:58:30 +08:00
peng.lin c625b83f55 pcie contronller msi-x whitelist add new device id 2024-03-04 09:58:30 +08:00
peng.lin 0d0ceb91cf pcie contronller msi-x whitelist add device_id condition 2024-03-04 09:58:29 +08:00
haijiao.liu 0c656134eb riscv: dts: sophgo: add dts for yixin-s2110
Signed-off-by: haijiao.liu <haijiao.liu@sophgo.com>
2024-03-04 09:58:29 +08:00
jingyu.li01 bfe03da9f2 riscv: dts: enable clint-mtimer nodes for CPU0
The clint-mtimer nodes of CPU0 do not work after entering the kernel when
enabling the config SOPHGO_MULTI_CHIP_CLOCK_SYNC. Re-enable them to keep the
sbi_ecall_time work in the pre-OS phase.

Signed-off-by: jingyu.li01 <jingyu.li01@sophgo.com>
2024-03-04 09:58:29 +08:00
chunzhi.lin 19746ef4e0 riscv:dts:remove dma-range restriction and change PCIe io space to 3-4G
Signed-off-by: chunzhi.lin <chunzhi.lin@sophgo.com>
2024-03-04 09:58:29 +08:00
haijiao.liu e489f6784f kernel: tick: filter unnecessary printing
set the print level of the switch_to oneshot function to DEBUG

Signed-off-by: haijiao.liu <haijiao.liu@sophgo.com>
2024-03-04 09:58:29 +08:00
Chen Wang 164baa8922 RISC-V: convert SOC_SOPHGO to ARCH_SOPHGO
SG2042 is now on upstreaminng, and on master, ARCH_FOO is replacing
SOC_FOO. Introduce this in advance for easy rebase with upstream code.

Just a straightforward string replacement in this change.

Signed-off-by: Chen Wang <unicorn_wang@outlook.com>
2024-03-04 09:58:29 +08:00
Khem Raj 63d8c06204 perf cpumap: Make counter as unsigned ints
These are loop counters which is inherently unsigned. Therefore make
them unsigned. Moreover it also fixes alloc-size-larger-than
error with gcc-13, where malloc can be called with (-1) due to tmp_len
being an int type.

Fixes
| cpumap.c:366:20: error: argument 1 range [18446744065119617024, 18446744073709551612] exceeds maximum object size 9223372036854775807 [-Werror=alloc-size-larger-than=]
|   366 |         tmp_cpus = malloc(tmp_len * sizeof(struct perf_cpu));
|       |                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>

Upstream-Status: Submitted [https://lore.kernel.org/linux-perf-users/20230123211310.127532-1-raj.khem@gmail.com/T/#u]
2024-03-04 09:58:29 +08:00
zhaohui-yan 25acdd2cd3 drivers: pcie: Add switchtec to the PCIE MSIX whitelist
riscv: dts: sophgo: Set PCIE1 to support msix

Signed-off-by: zhaohui-yan <zhaohui.yan@sophgo.com>
2024-03-04 09:58:29 +08:00
haijiao.liu 6cf4278a04 drivers: clk: turn off non-essential clocks by default
Signed-off-by: haijiao.liu <haijiao.liu@sophgo.com>
2024-03-04 09:58:29 +08:00
haijiao.liu eab264d0cc kernel: Adjust the log level of the tick_switch_to_oneshot function
Signed-off-by: haijiao.liu <haijiao.liu@sophgo.com>
2024-03-04 09:58:29 +08:00
haijiao.liu e02cfca913 riscv: spinlock: Fix deadlock issue
Fix T-Head C9xx store merge buffer delay problem

Signed-off-by: haijiao.liu <haijiao.liu@sophgo.com>
2024-03-04 09:58:29 +08:00
Xiaoguang Xing 2dbaee75b0 riscv: errata: thead: Make cache clean to flush
Signed-off-by: Xiaoguang Xing <xiaoguang.xing@sophgo.com>
2024-03-04 09:58:29 +08:00
Xiaoguang Xing f113e6e04e mm: memblock: Fix find_max_low_addr() bug for multi-chip
Signed-off-by: Xiaoguang Xing <xiaoguang.xing@sophgo.com>
2024-03-04 09:58:28 +08:00
Icenowy Zheng 69e3faab4a riscv: use VA+PA variant of CMO macros for DMA page preparation
When doing DMA page preparation, both the VA and the PA are easily
accessible from struct page.

Use the alternative macro variant that takes both VA and PA as
parameters, thus in case the ISA extension used support PA directly, the
overhead for re-converting VA to PA can be omitted.

Suggested-by: Guo Ren <guoren@kernel.org>
Signed-off-by: Icenowy Zheng <uwu@icenowy.me>
2024-03-04 09:58:28 +08:00
Icenowy Zheng 3e6ddb97b5 riscv: use VA+PA variant of CMO macros for DMA synchorization
DMA synchorization is done on PA and the VA is calculated from the PA.

Use the alternative macro variant that takes both VA and PA as
parameters, thus in case the ISA extension used support PA directly, the
overhead for re-converting VA to PA can be omitted.

Suggested-by: Guo Ren <guoren@kernel.org>
Signed-off-by: Icenowy Zheng <uwu@icenowy.me>
Reviewed-by: Guo Ren <guoren@kernel.org>
2024-03-04 09:58:28 +08:00
Icenowy Zheng e9303cd542 riscv: errata: cmo: add CMO macro variant with both VA and PA
The standardized Zicbom extension supports only VA, however there's some
vendor extensions (e.g. XtheadCmo) that can handle cache management
operations on PA directly, bypassing the TLB lookup.

Add a CMO alternatives macro variant that come with both VA and PA
supplied, and the code can be patched to use either the VA or the PA at
runtime. In this case the codepath is now patched to use VA for Zicbom
and PA for XtheadCmo.

Signed-off-by: Icenowy Zheng <uwu@icenowy.me>
Reviewed-by: Guo Ren <guoren@kernel.org>
2024-03-04 09:58:28 +08:00
fengchun.li 1779bde25f riscv: dts: modify the PCIe range
modify the PCIe range

Signed-off-by: fengchun.li <fengchun.li@sophgo.com>
2024-03-04 09:58:28 +08:00
haijiao.liu 2bf212deba riscv: dts: sophgo: Add timer apb clock
Signed-off-by: haijiao.liu <haijiao.liu@sophgo.com>
2024-03-04 09:58:28 +08:00
Xiaoguang Xing aef49870de riscv: dts: sophgo: Remove cma node
The cma range conflicts with the pcie swtich address space.

Signed-off-by: Xiaoguang Xing <xiaoguang.xing@sophgo.com>
2024-03-04 09:58:28 +08:00
haijiao.liu 5622c0bbd9 riscv: dts: sophgo: Add uart apb clock and remove sysdma clock
Signed-off-by: haijiao.liu <haijiao.liu@sophgo.com>
2024-03-04 09:58:28 +08:00
fengchun.li 855e81d6b1 riscv: dts: modify pcie ranges for x4evb
sm768 need a big address space

Signed-off-by: fengchun.li <fengchun.li@sophgo.com>
2024-03-04 09:58:28 +08:00
Xiaoguang Xing 58d55d43bc mm: memblock: Fix find_max_low_addr() bug
Signed-off-by: Xiaoguang Xing <xiaoguang.xing@sophgo.com>
2024-03-04 09:58:28 +08:00
fengchun.li ded5db2262 riscv: dts: resolve the address conflict between PCIe switch and CPU sys
reserve a spare area in the low 4G space for pcie switch

Signed-off-by: fengchun.li <fengchun.li@sophgo.com>
2024-03-04 09:58:28 +08:00
haijiao.liu 35a5b3e1a7 drivers: clk: mango: Avoid the problem of serial port garbled characters
Change the clock attribute of uart sclk to avoid the problem of
serial port garbled characters

Signed-off-by: haijiao.liu <haijiao.liu@sophgo.com>
2024-03-04 09:58:27 +08:00
haijiao.liu 65a2785653 Revert "dt-bindings: serial: snps-dw-apb-uart: Add Sophgo SG2042 uarts"
Signed-off-by: haijiao.liu <haijiao.liu@sophgo.com>
2024-03-04 09:58:27 +08:00
haijiao.liu 8e3c82c9d3 Revert "serial: 8250_dw: Add Sophgo SG2042 support"
Signed-off-by: haijiao.liu <haijiao.liu@sophgo.com>
2024-03-04 09:58:27 +08:00