【暂缓合入,验证中】iommu/riscv: Fix inconsistencies with the latest spec revision(1)#146
【暂缓合入,验证中】iommu/riscv: Fix inconsistencies with the latest spec revision(1)#146GooTal wants to merge 895 commits intoRVCK-Project:OLK-nextfrom
Conversation
…ore}() mainline inclusion from mainline-v6.7 commit d6c78f1ca3e8ec3fd1afa1bc567cdf083e7af9fe category: feature bugzilla: RVCK-Project/rvck#86 -------------------------------- riscv_v_vstate_{save,restore}() can operate only on the knowlege of struct __riscv_v_ext_state, and struct pt_regs. Let the caller decides which should be passed into the function. Meanwhile, the kernel-mode Vector is going to introduce another vstate, so this also makes functions potentially able to be reused. Signed-off-by: Andy Chiu <andy.chiu@sifive.com> Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com> Signed-off-by: Gao Rui <gao.rui@zte.com.cn> Signed-off-by: Yanteng Si <si.yanteng@linux.dev> Signed-off-by: Mingzheng Xing <xingmingzheng@iscas.ac.cn>
mainline inclusion from mainline-v6.7 commit 5b6048f2ff710196c85ce14373febe8be5115bbe category: feature bugzilla: RVCK-Project/rvck#86 -------------------------------- riscv_v_ctrl_set() should only touch bits within PR_RISCV_V_VSTATE_CTRL_MASK. So, use the mask when we really set task's vstate_ctrl. Signed-off-by: Andy Chiu <andy.chiu@sifive.com> Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com> Signed-off-by: Gao Rui <gao.rui@zte.com.cn> Signed-off-by: Yanteng Si <si.yanteng@linux.dev> Signed-off-by: Mingzheng Xing <xingmingzheng@iscas.ac.cn>
mainline inclusion from mainline-v6.7 commit bd446f5df5afab212917f6732ba6442a5e8de85e category: feature bugzilla: RVCK-Project/rvck#86 -------------------------------- The allocation size of thread.vstate.datap is always riscv_v_vsize. So it is possbile to use kmem_cache_* to manage the allocation. This gives users more information regarding allocation of vector context via /proc/slabinfo. And it potentially reduces the latency of the first-use trap because of the allocation caches. Signed-off-by: Andy Chiu <andy.chiu@sifive.com> Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com> Signed-off-by: Gao Rui <gao.rui@zte.com.cn> Signed-off-by: Yanteng Si <si.yanteng@linux.dev> Signed-off-by: Mingzheng Xing <xingmingzheng@iscas.ac.cn>
mainline inclusion from mainline-v6.7 commit 2080ff9493072a94e42b1856d59f5f1bffb761b7 category: feature bugzilla: RVCK-Project/rvck#86 -------------------------------- Add kernel_vstate to keep track of kernel-mode Vector registers when trap introduced context switch happens. Also, provide riscv_v_flags to let context save/restore routine track context status. Context tracking happens whenever the core starts its in-kernel Vector executions. An active (dirty) kernel task's V contexts will be saved to memory whenever a trap-introduced context switch happens. Or, when a softirq, which happens to nest on top of it, uses Vector. Context retoring happens when the execution transfer back to the original Kernel context where it first enable preempt_v. Also, provide a config CONFIG_RISCV_ISA_V_PREEMPTIVE to give users an option to disable preemptible kernel-mode Vector at build time. Users with constraint memory may want to disable this config as preemptible kernel-mode Vector needs extra space for tracking of per thread's kernel-mode V context. Or, users might as well want to disable it if all kernel-mode Vector code is time sensitive and cannot tolerate context switch overhead. Signed-off-by: Andy Chiu <andy.chiu@sifive.com> Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com> Signed-off-by: Gao Rui <gao.rui@zte.com.cn> Signed-off-by: Yanteng Si <si.yanteng@linux.dev> Signed-off-by: Mingzheng Xing <xingmingzheng@iscas.ac.cn>
mainline inclusion from mainline-v6.7 commit c27fa53b858b4ee6552a719aa599c250cf98a586 category: feature bugzilla: RVCK-Project/rvck#86 -------------------------------- The RISC-V Vector specification states in "Appendix D: Calling Convention for Vector State" [1] that "Executing a system call causes all caller-saved vector registers (v0-v31, vl, vtype) and vstart to become unspecified.". In the RISC-V kernel this is called "discarding the vstate". Returning from a signal handler via the rt_sigreturn() syscall, vector discard is also performed. However, this is not an issue since the vector state should be restored from the sigcontext, and therefore not care about the vector discard. The "live state" is the actual vector register in the running context, and the "vstate" is the vector state of the task. A dirty live state, means that the vstate and live state are not in synch. When vectorized user_from_copy() was introduced, an bug sneaked in at the restoration code, related to the discard of the live state. An example when this go wrong: 1. A userland application is executing vector code 2. The application receives a signal, and the signal handler is entered. 3. The application returns from the signal handler, using the rt_sigreturn() syscall. 4. The live vector state is discarded upon entering the rt_sigreturn(), and the live state is marked as "dirty", indicating that the live state need to be synchronized with the current vstate. 5. rt_sigreturn() restores the vstate, except the Vector registers, from the sigcontext 6. rt_sigreturn() restores the Vector registers, from the sigcontext, and now the vectorized user_from_copy() is used. The dirty live state from the discard is saved to the vstate, making the vstate corrupt. 7. rt_sigreturn() returns to the application, which crashes due to corrupted vstate. Note that the vectorized user_from_copy() is invoked depending on the value of CONFIG_RISCV_ISA_V_UCOPY_THRESHOLD. Default is 768, which means that vlen has to be larger than 128b for this bug to trigger. The fix is simply to mark the live state as non-dirty/clean prior performing the vstate restore. Link: https://github.com/riscv/riscv-isa-manual/releases/download/riscv-isa-release-8abdb41-2024-03-26/unpriv-isa-asciidoc.pdf # [1] Reported-by: Charlie Jenkins <charlie@rivosinc.com> Reported-by: Vineet Gupta <vgupta@kernel.org> Fixes: c2a658d41924 ("riscv: lib: vectorize copy_to_user/copy_from_user") Signed-off-by: Björn Töpel <bjorn@rivosinc.com> Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com> Signed-off-by: Gao Rui <gao.rui@zte.com.cn> Signed-off-by: Yanteng Si <si.yanteng@linux.dev> Signed-off-by: Mingzheng Xing <xingmingzheng@iscas.ac.cn>
riscv inclusion category: feature bugzilla: RVCK-Project/rvck#86 -------------------------------- Enable the following configs: CONFIG_RISCV_ISA_V The following configs have been merged in the previous PR and are now enabled together: CONFIG_SERIAL_EARLYCON_RISCV_SBI CONFIG_PARAVIRT CONFIG_PARAVIRT_TIME_ACCOUNTING Then update openeuler_defconfig: make save_oedefconfig make update_oedefconfig Build and boot testing passed. Signed-off-by: Mingzheng Xing <xingmingzheng@iscas.ac.cn>
mainline inclusion from mainline-v6.7-rc6 commit cbc2fe9d9cb226347365753f50d81bc48cc3c52e category: bugfix bugzilla: RVCK-Project/rvck#76 -------------------------------- Patch series "kexec_file: print out debugging message if required", v4. Currently, specifying '-d' on kexec command will print a lot of debugging informationabout kexec/kdump loading with kexec_load interface. However, kexec_file_load prints nothing even though '-d' is specified. It's very inconvenient to debug or analyze the kexec/kdump loading when something wrong happened with kexec/kdump itself or develper want to check the kexec/kdump loading. In this patchset, a kexec_file flag is KEXEC_FILE_DEBUG added and checked in code. If it's passed in, debugging message of kexec_file code will be printed out and can be seen from console and dmesg. Otherwise, the debugging message is printed like beofre when pr_debug() is taken. Note: **** ===== 1) The code in kexec-tools utility also need be changed to support passing KEXEC_FILE_DEBUG to kernel when 'kexec -s -d' is specified. The patch link is here: ========= [PATCH] kexec_file: add kexec_file flag to support debug printing http://lists.infradead.org/pipermail/kexec/2023-November/028505.html 2) s390 also has kexec_file code, while I am not sure what debugging information is necessary. So leave it to s390 developer. Test: **** ==== Testing was done in v1 on x86_64 and arm64. For v4, tested on x86_64 again. And on x86_64, the printed messages look like below: -------------------------------------------------------------- kexec measurement buffer for the loaded kernel at 0x207fffe000. Loaded purgatory at 0x207fff9000 Loaded boot_param, command line and misc at 0x207fff3000 bufsz=0x1180 memsz=0x1180 Loaded 64bit kernel at 0x207c000000 bufsz=0xc88200 memsz=0x3c4a000 Loaded initrd at 0x2079e79000 bufsz=0x2186280 memsz=0x2186280 Final command line is: root=/dev/mapper/fedora_intel--knightslanding--lb--02-root ro rd.lvm.lv=fedora_intel-knightslanding-lb-02/root console=ttyS0,115200N81 crashkernel=256M E820 memmap: 0000000000000000-000000000009a3ff (1) 000000000009a400-000000000009ffff (2) 00000000000e0000-00000000000fffff (2) 0000000000100000-000000006ff83fff (1) 000000006ff84000-000000007ac50fff (2) ...... 000000207fff6150-000000207fff615f (128) 000000207fff6160-000000207fff714f (1) 000000207fff7150-000000207fff715f (128) 000000207fff7160-000000207fff814f (1) 000000207fff8150-000000207fff815f (128) 000000207fff8160-000000207fffffff (1) nr_segments = 5 segment[0]: buf=0x000000004e5ece74 bufsz=0x211 mem=0x207fffe000 memsz=0x1000 segment[1]: buf=0x000000009e871498 bufsz=0x4000 mem=0x207fff9000 memsz=0x5000 segment[2]: buf=0x00000000d879f1fe bufsz=0x1180 mem=0x207fff3000 memsz=0x2000 segment[3]: buf=0x000000001101cd86 bufsz=0xc88200 mem=0x207c000000 memsz=0x3c4a000 segment[4]: buf=0x00000000c6e38ac7 bufsz=0x2186280 mem=0x2079e79000 memsz=0x2187000 kexec_file_load: type:0, start:0x207fff91a0 head:0x109e004002 flags:0x8 --------------------------------------------------------------------------- This patch (of 7): When specifying 'kexec -c -d', kexec_load interface will print loading information, e.g the regions where kernel/initrd/purgatory/cmdline are put, the memmap passed to 2nd kernel taken as system RAM ranges, and printing all contents of struct kexec_segment, etc. These are very helpful for analyzing or positioning what's happening when kexec/kdump itself failed. The debugging printing for kexec_load interface is made in user space utility kexec-tools. Whereas, with kexec_file_load interface, 'kexec -s -d' print nothing. Because kexec_file code is mostly implemented in kernel space, and the debugging printing functionality is missed. It's not convenient when debugging kexec/kdump loading and jumping with kexec_file_load interface. Now add KEXEC_FILE_DEBUG to kexec_file flag to control the debugging message printing. And add global variable kexec_file_dbg_print and macro kexec_dprintk() to facilitate the printing. This is a preparation, later kexec_dprintk() will be used to replace the existing pr_debug(). Once 'kexec -s -d' is specified, it will print out kexec/kdump loading information. If '-d' is not specified, it regresses to pr_debug(). Link: https://lkml.kernel.org/r/20231213055747.61826-1-bhe@redhat.com Link: https://lkml.kernel.org/r/20231213055747.61826-2-bhe@redhat.com Signed-off-by: Baoquan He <bhe@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Gao Rui <gao.rui@zte.com.cn> Signed-off-by: Yanteng Si <si.yanteng@linux.dev> Signed-off-by: Mingzheng Xing <xingmingzheng@iscas.ac.cn>
mainline inclusion from mainline-v6.7-rc6 commit a85ee18c7900f001f42082d2fabce4eaf57e655f category: bugfix bugzilla: RVCK-Project/rvck#76 -------------------------------- Then when specifying '-d' for kexec_file_load interface, loaded locations of kernel/initrd/cmdline etc can be printed out to help debug. Here replace pr_debug() with the newly added kexec_dprintk() in kexec_file loading related codes. And also print out type/start/head of kimage and flags to help debug. Link: https://lkml.kernel.org/r/20231213055747.61826-3-bhe@redhat.com Signed-off-by: Baoquan He <bhe@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Gao Rui <gao.rui@zte.com.cn> Signed-off-by: Yanteng Si <si.yanteng@linux.dev> Signed-off-by: Mingzheng Xing <xingmingzheng@iscas.ac.cn>
mainline inclusion from mainline-v6.7-rc6 commit e687b2fabd824d06e1126378b386c104341515f3 category: bugfix bugzilla: RVCK-Project/rvck#76 -------------------------------- Then when specifying '-d' for kexec_file_load interface, loaded locations of kernel/initrd/cmdline etc can be printed out to help debug. Here replace pr_debug() with the newly added kexec_dprintk() in kexec_file loading related codes. And also print out e820 memmap passed to 2nd kernel just as kexec_load interface has been doing. Link: https://lkml.kernel.org/r/20231213055747.61826-4-bhe@redhat.com Signed-off-by: Baoquan He <bhe@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Gao Rui <gao.rui@zte.com.cn> Signed-off-by: Yanteng Si <si.yanteng@linux.dev> Signed-off-by: Mingzheng Xing <xingmingzheng@iscas.ac.cn>
mainline inclusion from mainline-v6.7-rc6 commit 6f8c1da071a46176966e377fb77a46366fb5af2d category: bugfix bugzilla: RVCK-Project/rvck#76 -------------------------------- Then when specifying '-d' for kexec_file_load interface, loaded locations of kernel/initrd/cmdline etc can be printed out to help debug. Here replace pr_debug() with the newly added kexec_dprintk() in kexec_file loading related codes. And also remove the kimage->segment[] printing because the generic code has done the printing. Link: https://lkml.kernel.org/r/20231213055747.61826-5-bhe@redhat.com Signed-off-by: Baoquan He <bhe@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Gao Rui <gao.rui@zte.com.cn> Signed-off-by: Yanteng Si <si.yanteng@linux.dev> Signed-off-by: Mingzheng Xing <xingmingzheng@iscas.ac.cn>
mainline inclusion from mainline-v6.7-rc6 commit eb7622d908a097fe0b845cb2dc4b579b99f04b59 category: bugfix bugzilla: RVCK-Project/rvck#76 -------------------------------- Then when specifying '-d' for kexec_file_load interface, loaded locations of kernel/initrd/cmdline etc can be printed out to help debug. Here replace pr_debug() with the newly added kexec_dprintk() in kexec_file loading related codes. And also replace pr_notice() with kexec_dprintk() in elf_kexec_load() because loaded location of purgatory and device tree are only printed out for debugging, it doesn't make sense to always print them out. And also remove kexec_image_info() because the content has been printed out in generic code. Link: https://lkml.kernel.org/r/20231213055747.61826-6-bhe@redhat.com Signed-off-by: Baoquan He <bhe@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Gao Rui <gao.rui@zte.com.cn> Signed-off-by: Yanteng Si <si.yanteng@linux.dev> Signed-off-by: Mingzheng Xing <xingmingzheng@iscas.ac.cn>
mainline inclusion from mainline-v6.7-rc6 commit 63b642e952f62b41033e34e81b74b9d9db33144b category: bugfix bugzilla: RVCK-Project/rvck#76 -------------------------------- Then when specifying '-d' for kexec_file_load interface, loaded locations of kernel/initrd/cmdline etc can be printed out to help debug. Here replace pr_debug() with the newly added kexec_dprintk() in kexec_file loading related codes. Link: https://lkml.kernel.org/r/20231213055747.61826-7-bhe@redhat.com Signed-off-by: Baoquan He <bhe@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Gao Rui <gao.rui@zte.com.cn> Signed-off-by: Yanteng Si <si.yanteng@linux.dev> Signed-off-by: Mingzheng Xing <xingmingzheng@iscas.ac.cn>
mainline inclusion from mainline-v6.7-rc6 commit d9e5a0ce2f16e57ccf2b91a213a5b434dcc1d88b category: bugfix bugzilla: RVCK-Project/rvck#76 -------------------------------- Currently, 8250_platform driver is used only for devices with fixed serial ports (plat_serial8250_port). Extend this driver for any generic 16550A platform devices which can be probed using standard hardware discovery mechanisms like ACPI. This is required in particular for RISC-V which has non-PNP generic 16550A compatible UART that needs to be enumerated as ACPI platform device. Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Baoquan He <bhe@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Gao Rui <gao.rui@zte.com.cn> Signed-off-by: Yanteng Si <si.yanteng@linux.dev> Signed-off-by: Mingzheng Xing <xingmingzheng@iscas.ac.cn>
mainline inclusion from mainline-v6.7-rc8 commit f4af41bf177add167e39e4b0203460b1d0b531f6 category: bugfix bugzilla: RVCK-Project/rvck#76 -------------------------------- Jiri reported that the current kexec_dprintk() always prints out debugging message whenever kexec/kdmmp loading is triggered. That is not wanted. The debugging message is supposed to be printed out when 'kexec -s -d' is specified for kexec/kdump loading. After investigating, the reason is the current kexec_dprintk() takes printk(KERN_INFO) or printk(KERN_DEBUG) depending on whether '-d' is specified. However, distros usually have defaulg log level like below: [~]# cat /proc/sys/kernel/printk 7 4 1 7 So, even though '-d' is not specified, printk(KERN_DEBUG) also always prints out. I thought printk(KERN_DEBUG) is equal to pr_debug(), it's not. Fix it by changing to use pr_info() instead which are expected to work. Link: https://lkml.kernel.org/r/20240409042238.1240462-1-bhe@redhat.com Fixes: cbc2fe9d9cb2 ("kexec_file: add kexec_file flag to control debug printing") Signed-off-by: Baoquan He <bhe@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Gao Rui <gao.rui@zte.com.cn> Signed-off-by: Yanteng Si <si.yanteng@linux.dev> Signed-off-by: Mingzheng Xing <xingmingzheng@iscas.ac.cn>
mainline inclusion from mainline-v6.16-rc1 commit 1df45f8a9fea5a7513bd1bad98604ce1fbefcaaf category: bugfix bugzilla: RVCK-Project/rvck#70 -------------------------------- This is the preparative patch for kexec_file_load Image support. It separates the elf_kexec_load() as two parts: - the first part loads the vmlinux (or Image) - the second part loads other segments (e.g. initrd,fdt,purgatory) And the second part is exported as the load_extra_segments() function which would be used in both kexec-elf.c and kexec-image.c. No functional change intended. Signed-off-by: Song Shuai <songshuaishuai@tinylab.org> Signed-off-by: Björn Töpel <bjorn@rivosinc.com> Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com> Signed-off-by: Palmer Dabbelt <palmer@dabbelt.com> Signed-off-by: Gao Rui <gao.rui@zte.com.cn> Signed-off-by: Yanteng Si <si.yanteng@linux.dev> Signed-off-by: Mingzheng Xing <xingmingzheng@iscas.ac.cn>
mainline inclusion from mainline-v6.16-rc1 commit 809a11eea8e8c80491e3ba3a286af25409c072d5 category: bugfix bugzilla: RVCK-Project/rvck#70 -------------------------------- This patch creates image_kexec_ops to load Image binary file for kexec_file_load() syscall. Signed-off-by: Song Shuai <songshuaishuai@tinylab.org> Signed-off-by: Björn Töpel <bjorn@rivosinc.com> Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com> Signed-off-by: Palmer Dabbelt <palmer@dabbelt.com> Signed-off-by: Gao Rui <gao.rui@zte.com.cn> Signed-off-by: Yanteng Si <si.yanteng@linux.dev> Signed-off-by: Mingzheng Xing <xingmingzheng@iscas.ac.cn>
mainline inclusion from mainline-v6.11-rc1 commit d9e5a0ce2f16e57ccf2b91a213a5b434dcc1d88b category: bugfix bugzilla: RVCK-Project/rvck#70 -------------------------------- Currently, 8250_platform driver is used only for devices with fixed serial ports (plat_serial8250_port). Extend this driver for any generic 16550A platform devices which can be probed using standard hardware discovery mechanisms like ACPI. This is required in particular for RISC-V which has non-PNP generic 16550A compatible UART that needs to be enumerated as ACPI platform device. Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Sunil V L <sunilvl@ventanamicro.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Gao Rui <gao.rui@zte.com.cn> Signed-off-by: Yanteng Si <si.yanteng@linux.dev> Signed-off-by: Mingzheng Xing <xingmingzheng@iscas.ac.cn>
mainline inclusion from Linux 6.6-rc6 commit fe0bab701e3b71a1d2db123c05b4f5c33098cc96 category: feature bugzilla: RVCK-Project/rvck#67 -------------------------------- Add a placeholder for all registers such as henvcfg, hstateen etc which have 'static' configurations depending on extensions supported by the guest. The values are derived once and are then subsequently written to the corresponding CSRs while switching to the vcpu. Signed-off-by: Mayuresh Chitale <mchitale@ventanamicro.com> Signed-off-by: Anup Patel <anup@brainfault.org> Signed-off-by: yechao-w <wang.yechao255@zte.com.cn> Signed-off-by: Mingzheng Xing <xingmingzheng@iscas.ac.cn>
mainline inclusion from Linux 6.6-rc6 commit d21b5d342fc12eb0a0f812864aa58aa9bb2c0599 category: feature bugzilla: RVCK-Project/rvck#67 -------------------------------- Configure hstateen0 register so that the AIA state and envcfg are accessible to the vcpus. This includes registers such as siselect, sireg, siph, sieh and all the IMISC registers. Signed-off-by: Mayuresh Chitale <mchitale@ventanamicro.com> Signed-off-by: Anup Patel <anup@brainfault.org> Signed-off-by: yechao-w <wang.yechao255@zte.com.cn> Signed-off-by: Mingzheng Xing <xingmingzheng@iscas.ac.cn>
mainline inclusion from Linux 6.6-rc6 commit db3c01c7a3081c6a6a50570e48bdbea509ba30e4 category: feature bugzilla: RVCK-Project/rvck#67 -------------------------------- Add senvcfg context save/restore for guest VCPUs and also add it to the ONE_REG interface to allow its access from user space. Signed-off-by: Mayuresh Chitale <mchitale@ventanamicro.com> Signed-off-by: Anup Patel <anup@brainfault.org> Signed-off-by: yechao-w <wang.yechao255@zte.com.cn> Signed-off-by: Mingzheng Xing <xingmingzheng@iscas.ac.cn>
mainline inclusion from Linux 6.6-rc6 commit 81f0f314fec92a69d6c4951b9d9db21d37419669 category: feature bugzilla: RVCK-Project/rvck#67 -------------------------------- Define sstateen0 and add sstateen0 save/restore for guest VCPUs. Signed-off-by: Mayuresh Chitale <mchitale@ventanamicro.com> Signed-off-by: Anup Patel <anup@brainfault.org> Signed-off-by: yechao-w <wang.yechao255@zte.com.cn> Signed-off-by: Mingzheng Xing <xingmingzheng@iscas.ac.cn>
mainline inclusion from Linux 6.6-rc6 commit c04913f2b54ee86be34d1a1e9df7b7876b12b8c0 category: feature bugzilla: RVCK-Project/rvck#67 -------------------------------- Add support for sstateen0 CSR to the ONE_REG interface to allow its access from user space. Signed-off-by: Mayuresh Chitale <mchitale@ventanamicro.com> Signed-off-by: Anup Patel <anup@brainfault.org> Signed-off-by: yechao-w <wang.yechao255@zte.com.cn> Signed-off-by: Mingzheng Xing <xingmingzheng@iscas.ac.cn>
mainline inclusion from Linux Linux 6.7-rc8 commit 4c460eb369514d53383a7c6ba1aefbca4914c68b category: feature bugzilla: RVCK-Project/rvck#67 -------------------------------- The indentation of "break" in kvm_riscv_vcpu_set_reg_csr() is inconsistent hence let us fix it. Fixes: c04913f2b54e ("RISCV: KVM: Add sstateen0 to ONE_REG") Reported-by: kernel test robot <lkp@intel.com> Closes: https://lore.kernel.org/oe-kbuild-all/202312190719.kBuYl6oJ-lkp@intel.com/ Signed-off-by: Anup Patel <apatel@ventanamicro.com> Signed-off-by: Anup Patel <anup@brainfault.org> Signed-off-by: yechao-w <wang.yechao255@zte.com.cn> Signed-off-by: Mingzheng Xing <xingmingzheng@iscas.ac.cn>
mainline inclusion from Linux 6.15-rc5 commit 87ec7d5249bb8ebf40261420da069fa238c21789 category: feature bugzilla: RVCK-Project/rvck#67 -------------------------------- Not resetting smstateen is a potential security hole, because VU might be able to access state that VS does not properly context-switch. Fixes: 81f0f314fec9 ("RISCV: KVM: Add sstateen0 context save/restore") Signed-off-by: Radim Krčmář <rkrcmar@ventanamicro.com> Signed-off-by: Anup Patel <anup@brainfault.org> Signed-off-by: yechao-w <wang.yechao255@zte.com.cn> Signed-off-by: Mingzheng Xing <xingmingzheng@iscas.ac.cn>
riscv inclusion category: bugfix bugzilla: ruyisdk/linux-xuantie-kernel#214 CVE: NA -------------------------------- Make VHA select SYNC_FILE to avoid KUnit test errors: ld: drivers/soc/xuantie/nna/vha/vha_common.o: in function `.L0 ': vha_common.c:(.text+0x4da): undefined reference to `dma_fence_release' ld: drivers/soc/xuantie/nna/vha/vha_common.o: in function `dma_fence_put.part.0': vha_common.c:(.text+0x52e): undefined reference to `dma_fence_release' ld: drivers/soc/xuantie/nna/vha/vha_common.o: in function `_vha_in_merged_sync_cb': vha_common.c:(.text+0x58c): undefined reference to `dma_fence_release' ... ld: vha_common.c:(.text+0x2cbe): undefined reference to `sync_file_create' ld: drivers/soc/xuantie/nna/vha/vha_common.o: in function `.L774': vha_common.c:(.text+0x2ce8): undefined reference to `dma_fence_add_callback' ld: drivers/soc/xuantie/nna/vha/vha_common.o: in function `vha_buf_needs_inval': vha_common.c:(.text+0x2ec6): undefined reference to `sync_file_get_fence' ld: vha_common.c:(.text+0x2ee6): undefined reference to `dma_fence_add_callback' ld: vha_common.c:(.text+0x2f2e): undefined reference to `dma_fence_context_alloc' ld: vha_common.c:(.text+0x2f40): undefined reference to `dma_fence_array_create' ld: vha_common.c:(.text+0x2f52): undefined reference to `sync_file_create' Signed-off-by: Yafen Fang <yafen@iscas.ac.cn> [Sync from rvck.] Signed-off-by: Mingzheng Xing <xingmingzheng@iscas.ac.cn>
mainline inclusion from mainline-v6.14-rc7 commit b46064a18810bad3aea089a79993ca5ea7a3d2b2 category: feature bugzilla: RVCK-Project/rvck#75 -------------------------------- It turns out that deferred default domain creation leaves a subtle race window during iommu_device_register() wherein a client driver may asynchronously probe in parallel and get as far as performing DMA API operations with dma-direct, only to be switched to iommu-dma underfoot once the default domain attachment finally happens, with obviously disastrous consequences. Even the wonky of_iommu_configure() path is at risk, since iommu_fwspec_init() will no longer defer client probe as the instance ops are (necessarily) already registered, and the "replay" iommu_probe_device() call can see dev->iommu_group already set and so think there's nothing to do either. Fortunately we already have the right tool in the right place in the form of iommu_device_use_default_domain(), which just needs to ensure that said default domain is actually ready to *be* used. Deferring the client probe shouldn't have too much impact, given that this only happens while the IOMMU driver is probing, and thus due to kick the deferred probe list again once it finishes. Reported-by: Charan Teja Kalla <quic_charante@quicinc.com> Fixes: 98ac73f99bc4 ("iommu: Require a default_domain for all iommu drivers") Reviewed-by: Jason Gunthorpe <jgg@nvidia.com> Signed-off-by: Robin Murphy <robin.murphy@arm.com> Link: https://lore.kernel.org/r/e88b94c9b575034a2c98a48b3d383654cbda7902.1740753261.git.robin.murphy@arm.com Signed-off-by: Joerg Roedel <jroedel@suse.de> [Backport to rvck.] Signed-off-by: Gao Rui <gao.rui@zte.com.cn> [Sync to rvck-olk.] Signed-off-by: Mingzheng Xing <xingmingzheng@iscas.ac.cn>
community inclusion category: feature bugzilla: RVCK-Project/rvck#71 ------------------------------------------------- Add PLIC early init supports and remove invalid timer nodes in dp1000.dts. Signed-off-by: Jia Wang <wangjia@ultrarisc.com> Signed-off-by: Mingzheng Xing <xingmingzheng@iscas.ac.cn>
community inclusion category: config bugzilla: RVCK-Project/rvck#71 Reference: RVCK-Project/rvck@cc4d46d ------------------------------------------------- Update UltraRISC platform configs: CONFIG_ARCH_ULTRARISC=y CONFIG_PCIE_ULTRARISC=y CONFIG_DWMAC_ULTRARISC=m CONFIG_PINCTRL_ULTRARISC=y CONFIG_PINCTRL_ULTRARISC_DP1000=y CONFIG_CMA_SIZE_MBYTES=256 Signed-off-by: Mingzheng Xing <xingmingzheng@iscas.ac.cn>
mainline inclusion from Linux 6.6-rc6 commit df68f4d8cb496ea31fa42cf2620366571c05376b category: feature bugzilla: RVCK-Project/rvck#79 -------------------------------- We extend the KVM ISA extension ONE_REG interface to allow KVM user space to detect and enable Zicond extension for Guest/VM. Signed-off-by: Anup Patel <apatel@ventanamicro.com> Signed-off-by: Anup Patel <anup@brainfault.org> Signed-off-by: yechao-w <wang.yechao255@zte.com.cn> Signed-off-by: Yanteng Si <si.yanteng@linux.dev> Signed-off-by: Mingzheng Xing <xingmingzheng@iscas.ac.cn>
mainline inclusion from Linux 6.6-rc6 commit 367188297254e7f81e3c3c94e6d6a623f757c4cb category: feature bugzilla: RVCK-Project/rvck#79 -------------------------------- We extend the KVM ISA extension ONE_REG interface to allow KVM user space to detect and enable Zbc extension for Guest/VM. Signed-off-by: Anup Patel <apatel@ventanamicro.com> Signed-off-by: Anup Patel <anup@brainfault.org> Signed-off-by: yechao-w <wang.yechao255@zte.com.cn> Signed-off-by: Yanteng Si <si.yanteng@linux.dev> Signed-off-by: Mingzheng Xing <xingmingzheng@iscas.ac.cn>
mainline inclusion from mainline-v6.17 commit 56737edda7db58549550776092da12fe03600399 category: feature bugzilla: RVCK-Project/rvck#155 -------------------------------- The round_rate() clk ops is deprecated, so migrate this driver from round_rate() to determine_rate() using the Coccinelle semantic patch on the cover letter of this series. Signed-off-by: Brian Masney <bmasney@redhat.com> Reviewed-by: Haylen Chu <heylenay@4d2.org> Reviewed-by: Yixun Lan <dlan@kernel.org> Link: https://lore.kernel.org/r/20250811-clk-for-stephen-round-rate-v1-50-b3bf97b038dc@redhat.com Signed-off-by: Yixun Lan <dlan@gentoo.org> Signed-off-by: Zhang Meng <zhangmeng.kevin@spacemit.com> Signed-off-by: Mingzheng Xing <xingmingzheng@iscas.ac.cn>
mainline inclusion from mainline-v6.17 commit d02c71cba7bba453d233a49497412ddbf2d44871 category: feature bugzilla: RVCK-Project/rvck#155 -------------------------------- The round_rate() clk ops is deprecated, so migrate this driver from round_rate() to determine_rate() using the Coccinelle semantic patch on the cover letter of this series. Signed-off-by: Brian Masney <bmasney@redhat.com> Reviewed-by: Haylen Chu <heylenay@4d2.org> Reviewed-by: Yixun Lan <dlan@kernel.org> Link: https://lore.kernel.org/r/20250811-clk-for-stephen-round-rate-v1-51-b3bf97b038dc@redhat.com Signed-off-by: Yixun Lan <dlan@gentoo.org> Signed-off-by: Zhang Meng <zhangmeng.kevin@spacemit.com> Signed-off-by: Mingzheng Xing <xingmingzheng@iscas.ac.cn>
mainline inclusion from mainline-v6.17 commit 8be1f299041220512195e40590bb4984f297ae48 category: feature bugzilla: RVCK-Project/rvck#155 -------------------------------- Previously, the K1 clock driver did not include the parent clocks of the I2S sysclk. Introduce pre-clock to fix I2S clock. Otherwise, the I2S clock may not work as expected. This patch adds their definitions to allow proper registration in the driver and usage in the device tree. Fixes: 1b72c59db0add ("clk: spacemit: Add clock support for SpacemiT K1 SoC") Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Signed-off-by: Troy Mitchell <troy.mitchell@linux.spacemit.com> Signed-off-by: Stephen Boyd <sboyd@kernel.org> Signed-off-by: Zhang Meng <zhangmeng.kevin@spacemit.com> Signed-off-by: Mingzheng Xing <xingmingzheng@iscas.ac.cn>
mainline inclusion from mainline-v6.17 commit 519cff1d85694cbdf33b27591740e7e37348e6b4 category: feature bugzilla: RVCK-Project/rvck#155 -------------------------------- Defining i2s_bclk and i2s_sysclk as fixed-rate clocks is insufficient for real I2S use cases. Moreover, the current I2S clock configuration does not work as expected due to missing parent clocks. This patch adds the missing parent clocks, defines i2s_sysclk as a DDN clock, and i2s_bclk as a DIV clock. A special note for i2s_bclk: From the register definition, the i2s_bclk divider always implies an additional 1/2 factor. The following table shows the correspondence between index and frequency division coefficients: | index | div | |-------|-------| | 0 | 2 | | 1 | 4 | | 2 | 6 | | 3 | 8 | From a software perspective, introducing i2s_bclk_factor as the parent of i2s_bclk is sufficient to address the issue. The I2S-related clock registers can be found here [1]. Link: https://developer.spacemit.com/documentation?token=LCrKwWDasiJuROkVNusc2pWTnEb [1] Fixes: 1b72c59db0add ("clk: spacemit: Add clock support for SpacemiT K1 SoC") Co-developer: Jinmei Wei <weijinmei@linux.spacemit.com> Suggested-by: Haylen Chu <heylenay@4d2.org> Signed-off-by: Jinmei Wei <weijinmei@linux.spacemit.com> Signed-off-by: Troy Mitchell <troy.mitchell@linux.spacemit.com> Signed-off-by: Stephen Boyd <sboyd@kernel.org> Signed-off-by: Zhang Meng <zhangmeng.kevin@spacemit.com> Signed-off-by: Mingzheng Xing <xingmingzheng@iscas.ac.cn>
mainline inclusion from mainline-v6.16 commit c479d7cf06c3d65532442fa368b058e05dbba1a2 category: feature bugzilla: RVCK-Project/rvck#155 -------------------------------- Implement reset support for SpacemiT CCUs. A SpacemiT reset controller device is an auxiliary device associated with a clock controller (CCU). This patch defines the reset controllers for the MPMU, APBC, and MPMU CCUs, which already define clock controllers. It also adds RCPU, RCPU2, and ACPB2 CCUs, which only define resets. Signed-off-by: Alex Elder <elder@riscstar.com> Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de> Reviewed-by: Yixun Lan <dlan@gentoo.org> Acked-by: Philipp Zabel <p.zabel@pengutronix.de> Link: https://lore.kernel.org/r/20250702113709.291748-6-elder@riscstar.com Signed-off-by: Yixun Lan <dlan@gentoo.org> Signed-off-by: Zhang Meng <zhangmeng.kevin@spacemit.com> Signed-off-by: Mingzheng Xing <xingmingzheng@iscas.ac.cn>
community inclusion category: feature bugzilla: RVCK-Project/rvck#155 -------------------------------- The clock and reset driver has been supported by linux 6.17, and the driver has been back-porting to linux rvck. Signed-off-by: Zhang Meng <zhangmeng.kevin@spacemit.com> Signed-off-by: Mingzheng Xing <xingmingzheng@iscas.ac.cn>
community inclusion category: feature bugzilla: RVCK-Project/rvck#155 -------------------------------- K3 is the 2nd generation edge-side SoC in of Spacemit, which contain 8 X100 cores in 2 clusters, and 8 A100 AI cores in 2 clusters. The X100 cores fully complies with the RVA23 profile. And the A100 cores partial complies with the RVA23 profile, but expand some matrix computing. Signed-off-by: Zhang Meng <zhangmeng.kevin@spacemit.com> Signed-off-by: Mingzheng Xing <xingmingzheng@iscas.ac.cn>
community inclusion category: feature bugzilla: RVCK-Project/rvck#155 -------------------------------- The clock tree of K3 SoC contains three main types of clock hardware (PLL/DDN/MIX) and has control registers split into several multifunction devices: APBS (PLLs), MPMU, APBC and APMU. All register operations are done through regmap to ensure atomicity between concurrent operations of clock driver and reset, power-domain driver that will be introduced in the future. Signed-off-by: Zhang Meng <zhangmeng.kevin@spacemit.com> Signed-off-by: Mingzheng Xing <xingmingzheng@iscas.ac.cn>
community inclusion category: feature bugzilla: RVCK-Project/rvck#155 -------------------------------- Implement reset support for spacemit k3, the reset controller device is an auxiliary device associated with a clock controller (CCU). This patch defines the reset controllers for the MPMU, APBC, and MPMU CCUs, which already define clock controllers. Signed-off-by: Zhang Meng <zhangmeng.kevin@spacemit.com> Signed-off-by: Mingzheng Xing <xingmingzheng@iscas.ac.cn>
community inclusion category: feature bugzilla: RVCK-Project/rvck#155 -------------------------------- Signed-off-by: Zhang Meng <zhangmeng.kevin@spacemit.com> Signed-off-by: Mingzheng Xing <xingmingzheng@iscas.ac.cn>
community inclusion category: feature bugzilla: RVCK-Project/rvck#155 -------------------------------- Describe the PLL and system controllers that are capable of generating clock signals in the devicetree. Signed-off-by: Zhang Meng <zhangmeng.kevin@spacemit.com> Signed-off-by: Mingzheng Xing <xingmingzheng@iscas.ac.cn>
community inclusion category: feature bugzilla: RVCK-Project/rvck#155 -------------------------------- Enable uart0 for system console. Signed-off-by: Zhang Meng <zhangmeng.kevin@spacemit.com> Signed-off-by: Mingzheng Xing <xingmingzheng@iscas.ac.cn>
community inclusion category: feature bugzilla: RVCK-Project/rvck#155 -------------------------------- Enable CONFIG_SOC_SPACEMIT_K3 and CONFIG_SPACEMIT_K3_CCU for spacemit k3 Signed-off-by: Zhang Meng <zhangmeng.kevin@spacemit.com> [Fix conflicts: arch/riscv/configs/defconfig] Signed-off-by: Mingzheng Xing <xingmingzheng@iscas.ac.cn>
riscv inclusion category: config bugzilla: RVCK-Project/rvck#155 -------------------------------- Enable the following k3_defconfig: CONFIG_SOC_SPACEMIT_K3=y CONFIG_SPACEMIT_CCU=y CONFIG_SPACEMIT_K3_CCU=y CONFIG_RESET_SPACEMIT=y CONFIG_RESET_SPACEMIT_K3=y Then update openeuler_defconfig: make save_oedefconfig make update_oedefconfig Signed-off-by: Mingzheng Xing <xingmingzheng@iscas.ac.cn>
community inclusion category: bugfix bugzilla: RVCK-Project/rvck#175 -------------------------------- When accessing the sysfs debug interface of I2S devices, for devices without the audio-cpr-regmap property (e.g., ap_i2s), will causing a kernel panic. So, check the validity of audio_cpr_regmap before reading CPR registers, and skip CPR register reading for invalid regmap. Fixes: 01d57b9 ("i2s: add i2s driver for XuanTie TH1520 SoC") Signed-off-by: Mingzheng Xing <xingmingzheng@iscas.ac.cn>
riscv inclusion category: config bugzilla: RVCK-Project/rvck#95 -------------------------------- Enable the following config: CONFIG_ACPI_APEI=y CONFIG_ACPI_APEI_GHES=y CONFIG_ACPI_APEI_SSE=y Then update openeuler_defconfig: make save_oedefconfig make update_oedefconfig Signed-off-by: Mingzheng Xing <xingmingzheng@iscas.ac.cn>
|
开始测试 log: https://github.com/RVCK-Project/rvck-olk/actions/runs/20507247964 参数解析结果
测试完成 详细结果:RVCK result
Kunit Test Result[15:33:18] Testing complete. Ran 454 tests: passed: 442, skipped: 12 Kernel Build ResultKernel build succeeded: RVCK-Project/rvck-olk/146/ 072135d616f730c1908667a2232671dd /srv/guix_result/8d109495b258de53c0b7763e80b22b076628d933/Image LAVA Checkargs:
result:Lava check done! lava log: https://lava.oerv.ac.cn/scheduler/job/1039 lava result count: [fail]: 20, [pass]: 1586, [skip]: 293 Check Patch Result
|
|
原补丁标题需要简化,建议: |
driver inclusion category: bugfix bugzilla: RVCK-Project#145 -------------------------------- According to the specification, for MSI interrupt migration, GSCID must be used to invalidate the TLB cache. Currently, in bare mode of gstage, GSCID 0 is being used for invalidation, which does not comply with the spec definition. Based on the latest community spec discussions and updates, the MSIX table must be in the off state when gstage is in bare mode. Signed-off-by: jinqi <jin.qi@zte.com.cn> Signed-off-by: liuqingtao <liu.qingtao2@zte.com.cn>
8d10949 to
94bb81c
Compare
|
开始测试 log: https://github.com/RVCK-Project/rvck-olk/actions/runs/20519307813 参数解析结果
测试完成 详细结果:RVCK result
Kunit Test Result[08:42:45] Testing complete. Ran 454 tests: passed: 442, skipped: 12 Kernel Build ResultKernel build succeeded: RVCK-Project/rvck-olk/146/ 02e3264a0a302aa113241a56a66eb873 /srv/guix_result/94bb81c295fdf18b9fd383c4c82db29b0c9bf0da/Image LAVA Checkargs:
result:Lava check done! lava log: https://lava.oerv.ac.cn/scheduler/job/1046 lava result count: [fail]: 20, [pass]: 1586, [skip]: 293 Check Patch Result
|
iommu/riscv: Fix inconsistencies with the latest spec revision
driver inclusion
category: bugfix
bugzilla: #145
According to the specification, for MSI interrupt migration,
GSCID must be used to invalidate the TLB cache.
Currently, in bare mode of gstage, GSCID 0 is being used for invalidation,
which does not comply with the spec definition.
Based on the latest community spec discussions and updates,
the MSIX table must be in the off state when gstage is in bare mode.
Signed-off-by: jinqi jin.qi@zte.com.cn
Signed-off-by: liuqingtao liu.qingtao2@zte.com.cn