Re: [PATCH v2 12/12] dt-bindings: mtd: raw-nand-chip: Relax node name pattern
Hello, On 07/02/2025 at 22:30:29 +01, J. Neuschäfer via B4 Relay wrote: > From: "J. Neuschäfer" > > In some scenarios, such as under the Freescale eLBC bus, there are raw > NAND chips with a unit address that has a comma in it (cs,offset). > Relax the $nodename pattern in raw-nand-chip.yaml to allow such unit > addresses. This is super specific to this controller, I'd rather avoid that in the main (shared) files. I believe you can force another node name in the controller's binding instead? Thanks, Miquèl
Re: [kvm-unit-tests PATCH v2 03/18] scripts: Refuse to run the tests if not configured for qemu
Hi Drew, On Tue, Jan 21, 2025 at 03:48:55PM +0100, Andrew Jones wrote: > On Mon, Jan 20, 2025 at 04:43:01PM +, Alexandru Elisei wrote: > > --- > > arm/efi/run | 8 > > arm/run | 9 + > > run_tests.sh| 8 > > scripts/mkstandalone.sh | 8 > > 4 files changed, 33 insertions(+) > > +case "$TARGET" in > > +qemu) > > +;; > > +*) > > +echo "'$TARGET' not supported for standlone tests" > > +exit 2 > > +esac > > I think we could put the check in a function in scripts/arch-run.bash and > just use the same error message for all cases. Coming back to the series. arm/efi/run and arm/run source scripts/arch-run.bash; run_tests.sh and scripts/mkstandalone.sh don't source scripts/arch-run.bash. There doesn't seem to be a common file that is sourced by all of them. How about creating a new file in scripts (vmm.bash?) with only this function? Thanks, Alex > > Thanks, > drew > > > > > -- > > kvm-riscv mailing list > > kvm-ri...@lists.infradead.org > > http://lists.infradead.org/mailman/listinfo/kvm-riscv
Re: [PATCH v3 5/9] powerpc: Use preempt_model_str().
On 2025-02-08 13:05:57 [+0530], Shrikanth Hegde wrote: > > > On 2/4/25 13:52, Sebastian Andrzej Siewior wrote: > > Use preempt_model_str() instead of manually conducting the preemption > > model. Use pr_emerg() instead of printk() to pass a loglevel. > > even on powerpc, i see __die ends up calling show_regs_print_info(). > Why print it twice? Thank you for noticing. I did remove it on other architectures, I somehow missed it here. Will remove it from from the arch code. Sebastian
Re: [PATCH 1/9] of: Add warpper function of_find_node_by_name_balanced()
Hi Zekun, On Mon, Feb 10, 2025 at 02:47:28PM +0800, zhangzekun (A) wrote: > > I think we all agree that of_find_node_by_name() is miused, and that it > > shows the API isn't optimal. What we have different opinions on is how > > to make the API less error-prone. I think adding a new > > of_find_node_by_name_balanced() function works around the issue and > > doesn't improve the situation much, I would argue it makes things even > > more confusing. > > > > We have only 20 calls to of_find_node_by_name() with a non-NULL first > > argument in v6.14-rc1: > > > > arch/powerpc/platforms/chrp/pci.c: rtas = of_find_node_by_name (root, > > "rtas"); > > > > The 'root' variable here is the result of a call to > > 'of_find_node_by_path("/")', so I think we could pass a null pointer > > instead to simplify things. > > > > arch/powerpc/platforms/powermac/pic.c: slave = > > of_find_node_by_name(master, "mac-io"); > > > > Here I believe of_find_node_by_name() is called to find a *child* node > > of 'master'. of_find_node_by_name() is the wrong function for that. > > > > arch/sparc/kernel/leon_kernel.c:np = of_find_node_by_name(rootnp, > > "GAISLER_IRQMP"); > > arch/sparc/kernel/leon_kernel.c:np = > > of_find_node_by_name(rootnp, "01_00d"); > > arch/sparc/kernel/leon_kernel.c:np = of_find_node_by_name(nnp, > > "GAISLER_GPTIMER"); > > arch/sparc/kernel/leon_kernel.c:np = > > of_find_node_by_name(nnp, "01_011"); > > > > Here too the code seems to be looking for child nodes only (but I > > couldn't find a DT example or binding in-tree, so I'm not entirely > > sure). > > > > drivers/clk/ti/clk.c: return of_find_node_by_name(from, tmp); > > > > Usage here seems correct, the reference-count decrement is intended. > > > > drivers/media/i2c/max9286.c:i2c_mux = > > of_find_node_by_name(dev->of_node, "i2c-mux"); > > drivers/media/platform/qcom/venus/core.c: enp = > > of_find_node_by_name(dev->of_node, node_name); > > drivers/net/dsa/bcm_sf2.c: ports = of_find_node_by_name(dn, "ports"); > > drivers/net/dsa/hirschmann/hellcreek_ptp.c: leds = > > of_find_node_by_name(hellcreek->dev->of_node, "leds"); > > drivers/net/ethernet/broadcom/asp2/bcmasp.c:ports_node = > > of_find_node_by_name(dev->of_node, "ethernet-ports"); > > drivers/net/ethernet/marvell/prestera/prestera_main.c: ports = > > of_find_node_by_name(sw->np, "ports"); > > drivers/net/pse-pd/tps23881.c: channels_node = > > of_find_node_by_name(priv->np, "channels"); > > drivers/regulator/scmi-regulator.c: np = > > of_find_node_by_name(handle->dev->of_node, "regulators"); > > drivers/regulator/tps6594-regulator.c: np = > > of_find_node_by_name(tps->dev->of_node, multi_regs[multi].supply_name); > > > > Incorrect usage, as far as I understand all those drivers are looking > > for child nodes only. > > > > drivers/of/unittest.c: found = of_find_node_by_name(nd->overlay, > > "test-unittest16"); > > drivers/of/unittest.c: found = of_find_node_by_name(nd->overlay, > > "test-unittest17"); > > drivers/of/unittest.c: found = of_find_node_by_name(nd->overlay, > > "test-unittest18"); > > drivers/of/unittest.c: found = of_find_node_by_name(nd->overlay, > > "test-unittest19"); > > > > Here too I think only child nodes are meant to be considered. > > > > of_find_node_by_name() is very much misused as most callers want to find > > child nodes, while of_find_node_by_name() will walk the whole DT from a > > given starting point. > > > > I think the right fix here is to > > > > - Replace of_find_node_by_name(root, ...) with > >of_find_node_by_name(NULL, ...) in arch/powerpc/platforms/chrp/pci.c > >(if my understanding of the code is correct). > > For arch/powerpc/platforms/chrp/pci.c, noticing that there is a comment > in setup_peg2(): > /* keep the reference to the root node */ > > It might can not be convert to of_find_node_by_name(NULL, ...), and the > origin use of of_find_node_by_name() put the ref count which want to be > kept. But the reference is dropped by of_find_node_by_name(). Unless I'm missing something, dropping the lien struct device_node *root = of_find_node_by_path("/"); and changing rtas = of_find_node_by_name (root, "rtas"); to rtas = of_find_node_by_name (NULL, "rtas"); will not change the behaviour of the code. > > > > - Replace of_find_node_by_name() with of_get_child_by_name() in callers > >that need to search immediate children only (I expected that to be the > >majority of the above call sites) > > Since there is no enough information about these DT nodes, it would take > time to prove if it is OK to make such convert. It will take a bit of time, yes. I'm afraid time is needed to improve things :-) In most cases, as DT bindings are available, it shouldn't be very difficult. > > > > - If there are other callers that need to find indirect children
[PATCH] powerpc/mm/fault: Use str_write_read() helper function
Remove hard-coded strings by using the str_write_read() helper function. Signed-off-by: Thorsten Blum --- arch/powerpc/mm/fault.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/mm/fault.c b/arch/powerpc/mm/fault.c index c156fe0d53c3..806c74e0d5ab 100644 --- a/arch/powerpc/mm/fault.c +++ b/arch/powerpc/mm/fault.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -218,7 +219,7 @@ static bool bad_kernel_fault(struct pt_regs *regs, unsigned long error_code, // Read/write fault blocked by KUAP is bad, it can never succeed. if (bad_kuap_fault(regs, address, is_write)) { pr_crit_ratelimited("Kernel attempted to %s user page (%lx) - exploit attempt? (uid: %d)\n", - is_write ? "write" : "read", address, + str_write_read(is_write), address, from_kuid(&init_user_ns, current_uid())); // Fault on user outside of certain regions (eg. copy_tofrom_user()) is bad @@ -625,7 +626,7 @@ static void __bad_page_fault(struct pt_regs *regs, int sig) case INTERRUPT_DATA_STORAGE: case INTERRUPT_H_DATA_STORAGE: pr_alert("BUG: %s on %s at 0x%08lx\n", msg, -is_write ? "write" : "read", regs->dar); +str_write_read(is_write), regs->dar); break; case INTERRUPT_DATA_SEGMENT: pr_alert("BUG: %s at 0x%08lx\n", msg, regs->dar); -- 2.48.0
Re: [PATCH v2 00/12] YAML conversion of several Freescale/PowerPC DT bindings
On Sat, Feb 08, 2025 at 02:20:47AM +, J. Neuschäfer wrote: > On Fri, Feb 07, 2025 at 09:38:05PM +, Mark Brown wrote: > > What's the story with dependencies here - why is all this stuff in one > > series? > The patches are independent of each other, except for the four elbc/nand > patches. They are in the same series because they came up during the > same project and achieve similar goals, but it isn't necessary. Please don't do this, it just makes it harder to merge things since it makes it look like there's cross tree merges needed when that's not the case, complicating merging, and puts the entire series in everyone's inbox which makes things more noisy. signature.asc Description: PGP signature
Re: [PATCH v3 5/9] powerpc: Use preempt_model_str().
On 2025-02-10 11:59:50 [+0100], To Shrikanth Hegde wrote: > Thank you for noticing. I did remove it on other architectures, I > somehow missed it here. Will remove it from from the arch code. This is what I have for powerpc now. I'm going to repost the series, currently waiting for arm/x86. >8--- Subject: [PATCH] powerpc: Rely on generic printing of preemption model. After the first printk in __die() there is show_regs() -> show_regs_print_info() which prints the current preemption model. Remove the preempion model from the arch code. Cc: Madhavan Srinivasan Cc: Michael Ellerman Cc: Nicholas Piggin Cc: Christophe Leroy Cc: Naveen N Rao Cc: linuxppc-dev@lists.ozlabs.org Reviewed-by: Christophe Leroy Signed-off-by: Sebastian Andrzej Siewior --- arch/powerpc/kernel/traps.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c index edf5cabe5dfdb..cb8e9357383e9 100644 --- a/arch/powerpc/kernel/traps.c +++ b/arch/powerpc/kernel/traps.c @@ -263,10 +263,9 @@ static int __die(const char *str, struct pt_regs *regs, long err) { printk("Oops: %s, sig: %ld [#%d]\n", str, err, ++die_counter); - printk("%s PAGE_SIZE=%luK%s%s%s%s%s%s %s\n", + printk("%s PAGE_SIZE=%luK%s %s%s%s%s %s\n", IS_ENABLED(CONFIG_CPU_LITTLE_ENDIAN) ? "LE" : "BE", PAGE_SIZE / 1024, get_mmu_str(), - IS_ENABLED(CONFIG_PREEMPT) ? " PREEMPT" : "", IS_ENABLED(CONFIG_SMP) ? " SMP" : "", IS_ENABLED(CONFIG_SMP) ? (" NR_CPUS=" __stringify(NR_CPUS)) : "", debug_pagealloc_enabled() ? " DEBUG_PAGEALLOC" : "", -- 2.47.2
Re: [PATCH v2 00/12] YAML conversion of several Freescale/PowerPC DT bindings
On Mon, Feb 10, 2025 at 12:59:35PM +, Mark Brown wrote: > On Sat, Feb 08, 2025 at 02:20:47AM +, J. Neuschäfer wrote: > > On Fri, Feb 07, 2025 at 09:38:05PM +, Mark Brown wrote: > > > > What's the story with dependencies here - why is all this stuff in one > > > series? > > > The patches are independent of each other, except for the four elbc/nand > > patches. They are in the same series because they came up during the > > same project and achieve similar goals, but it isn't necessary. > > Please don't do this, it just makes it harder to merge things since it > makes it look like there's cross tree merges needed when that's not the > case, complicating merging, and puts the entire series in everyone's > inbox which makes things more noisy. How should I proceed with this series, in your opinion? I see potential advantages (less of the issues you describe) and disadvantages (somewhat harder to track patches) of splitting it up before sending v3. (Outside of this series, the conclusion is clear and simple) J. Neuschäfer
Re: [PATCH v3 5/9] powerpc: Use preempt_model_str().
On 2/10/25 19:53, Sebastian Andrzej Siewior wrote: On 2025-02-10 11:59:50 [+0100], To Shrikanth Hegde wrote: Thank you for noticing. I did remove it on other architectures, I somehow missed it here. Will remove it from from the arch code. This is what I have for powerpc now. I'm going to repost the series, currently waiting for arm/x86. >8--- Subject: [PATCH] powerpc: Rely on generic printing of preemption model. After the first printk in __die() there is show_regs() -> show_regs_print_info() which prints the current preemption model. Remove the preempion model from the arch code. Cc: Madhavan Srinivasan Cc: Michael Ellerman Cc: Nicholas Piggin Cc: Christophe Leroy Cc: Naveen N Rao Cc: linuxppc-dev@lists.ozlabs.org Reviewed-by: Christophe Leroy Signed-off-by: Sebastian Andrzej Siewior --- arch/powerpc/kernel/traps.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c index edf5cabe5dfdb..cb8e9357383e9 100644 --- a/arch/powerpc/kernel/traps.c +++ b/arch/powerpc/kernel/traps.c @@ -263,10 +263,9 @@ static int __die(const char *str, struct pt_regs *regs, long err) { printk("Oops: %s, sig: %ld [#%d]\n", str, err, ++die_counter); - printk("%s PAGE_SIZE=%luK%s%s%s%s%s%s %s\n", + printk("%s PAGE_SIZE=%luK%s %s%s%s%s %s\n", IS_ENABLED(CONFIG_CPU_LITTLE_ENDIAN) ? "LE" : "BE", PAGE_SIZE / 1024, get_mmu_str(), - IS_ENABLED(CONFIG_PREEMPT) ? " PREEMPT" : "", IS_ENABLED(CONFIG_SMP) ? " SMP" : "", IS_ENABLED(CONFIG_SMP) ? (" NR_CPUS=" __stringify(NR_CPUS)) : "", debug_pagealloc_enabled() ? " DEBUG_PAGEALLOC" : "", Looks good to me. Reviewed-by: Shrikanth Hegde
Re: [PATCH v2 00/12] YAML conversion of several Freescale/PowerPC DT bindings
On Mon, Feb 10, 2025 at 03:57:42PM +, J. Neuschäfer wrote: > On Mon, Feb 10, 2025 at 12:59:35PM +, Mark Brown wrote: > > Please don't do this, it just makes it harder to merge things since it > > makes it look like there's cross tree merges needed when that's not the > > case, complicating merging, and puts the entire series in everyone's > > inbox which makes things more noisy. > How should I proceed with this series, in your opinion? > I see potential advantages (less of the issues you describe) and > disadvantages (somewhat harder to track patches) of splitting it up > before sending v3. I'd rather that at least the SPI stuff were sent separately (well, ideally what you've done already is fine and it doesn't need a resend at all). signature.asc Description: PGP signature
Re: [PATCH v2 0/4] seccomp: remove the 'sd' argument from __secure_computing()
On Tue, 28 Jan 2025 16:02:28 +0100, Oleg Nesterov wrote: > Link to v1: https://lore.kernel.org/all/20250120134409.ga21...@redhat.com/ > Only 2/4 was changed, please see interdiff at the end. > > I've included the acks I got on 1/4, 3/4, and 4/4 (thanks!). > > Oleg. > > [...] Applied to for-next/seccomp, thanks! [0/4] seccomp: remove the 'sd' argument from __secure_computing() https://git.kernel.org/kees/c/1027cd8084bb [1/4] seccomp/mips: change syscall_trace_enter() to use secure_computing() https://git.kernel.org/kees/c/0fe1ebf3f056 [2/4] seccomp: fix the __secure_computing() stub for !HAVE_ARCH_SECCOMP_FILTER https://git.kernel.org/kees/c/b37778bec82b [3/4] seccomp: remove the 'sd' argument from __secure_computing() https://git.kernel.org/kees/c/1027cd8084bb [4/4] seccomp: remove the 'sd' argument from __seccomp_filter() https://git.kernel.org/kees/c/e1cec5107c39 Take care, -- Kees Cook
[powerpc:fixes-test] BUILD SUCCESS 61bcc752d1b81fde3cae454ff20c1d3c359df500
tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git fixes-test branch HEAD: 61bcc752d1b81fde3cae454ff20c1d3c359df500 powerpc/64s: Rewrite __real_pte() and __rpte_to_hidx() as static inline elapsed time: 724m configs tested: 119 configs skipped: 138 The following configs have been built successfully. More configs may be tested in the coming days. tested configs: alpha allnoconfiggcc-14.2.0 arc allnoconfiggcc-14.2.0 arc randconfig-001-20250210clang-21 arc randconfig-002-20250210clang-21 arm allnoconfiggcc-14.2.0 arm bcm2835_defconfiggcc-14.2.0 arm ixp4xx_defconfiggcc-14.2.0 arm randconfig-001-20250210clang-21 arm randconfig-002-20250210clang-21 arm randconfig-003-20250210clang-21 arm randconfig-004-20250210clang-21 arm rpc_defconfiggcc-14.2.0 arm64 allnoconfiggcc-14.2.0 arm64 defconfiggcc-14.2.0 arm64 randconfig-001-20250210clang-21 arm64 randconfig-002-20250210clang-21 arm64 randconfig-003-20250210clang-21 arm64 randconfig-004-20250210clang-21 csky alldefconfiggcc-14.2.0 csky allnoconfiggcc-14.2.0 csky randconfig-001-20250210clang-21 csky randconfig-002-20250210clang-21 hexagon allnoconfiggcc-14.2.0 hexagon randconfig-001-20250210clang-21 hexagon randconfig-002-20250210clang-21 i386 allmodconfigclang-19 i386 allnoconfigclang-19 i386 allyesconfigclang-19 i386defconfigclang-19 i386 randconfig-011-20250210gcc-12 i386 randconfig-012-20250210gcc-12 i386 randconfig-013-20250210gcc-12 i386 randconfig-014-20250210gcc-12 i386 randconfig-015-20250210gcc-12 i386 randconfig-016-20250210gcc-12 i386 randconfig-017-20250210gcc-12 loongarch allnoconfiggcc-14.2.0 loongarch randconfig-001-20250210clang-21 loongarch randconfig-002-20250210clang-21 mips ip30_defconfiggcc-14.2.0 nios2 randconfig-001-20250210clang-21 nios2 randconfig-002-20250210clang-21 openrisc allnoconfigclang-21 openriscdefconfiggcc-12 pariscallnoconfigclang-21 parisc defconfiggcc-12 pariscrandconfig-001-20250210clang-21 pariscrandconfig-002-20250210clang-21 powerpc allmodconfiggcc-14.2.0 powerpc allnoconfigclang-21 powerpc allyesconfigclang-16 powerpc eiger_defconfiggcc-14.2.0 powerpc holly_defconfiggcc-14.2.0 powerpc mpc885_ads_defconfiggcc-14.2.0 powerpc randconfig-001-20250210clang-21 powerpc randconfig-002-20250210clang-21 powerpc randconfig-003-20250210clang-21 powerpc randconfig-003-20250210gcc-14.2.0 powerpc64 randconfig-001-20250210clang-21 powerpc64 randconfig-001-20250210gcc-14.2.0 powerpc64 randconfig-002-20250210clang-21 powerpc64 randconfig-002-20250210gcc-14.2.0 powerpc64 randconfig-003-20250210clang-21 powerpc64 randconfig-003-20250210gcc-14.2.0 riscv allnoconfigclang-21 riscv defconfiggcc-12 riscvnommu_k210_defconfiggcc-14.2.0 riscv randconfig-001-20250210clang-16 riscv randconfig-002-20250210clang-16 s390 allmodconfiggcc-14.2.0 s390 allnoconfigclang-21 s390 allyesconfiggcc-14.2.0 s390defconfiggcc-12 s390 randconfig-001-20250210clang-16 s390 randconfig-002-20250210clang-16 sh allmodconfiggcc-14.2.0 sh allyesconfiggcc-14.2.0 sh defconfiggcc-12 sh kfr2r09-romimage_defconfiggcc-14.2.0 sh lboxre2_defconfiggcc-14.2.0 sh r7780mp_defconfiggcc-14.2.0 shrandconfig-001-20250210clang-16 shrandconfig-002-20250210clang-16 sh se7751_defconfiggcc-14.2.0 sparcallmodconfiggcc-14.2.0 sparc randconfig-001-20250210clang-16 sparc randconfig-002-20250210clang-16 sparc64 defconfiggcc-12 sparc64 randconfig-001-20250210clang-16 sparc64 randconfig-002-20250210clang-16 umallnoconfigclang-21 um
Re: [PATCH v2 09/12] dt-bindings: memory-controllers: Convert fsl,elbc to YAML
On Sun, Feb 09, 2025 at 02:31:34PM -0600, Crystal Wood wrote: > On Fri, Feb 07, 2025 at 10:30:26PM +0100, J. Neuschäfer via B4 Relay wrote: > > From: "J. Neuschäfer" > > > > Convert the Freescale localbus controller bindings from text form to > > YAML. The updated list of compatible strings reflects current usage > > in arch/powerpc/boot/dts/, except that many existing device trees > > erroneously specify "simple-bus" in addition to fsl,*elbc. > > > > Changes compared to the txt version: > > - removed the board-control (fsl,mpc8272ads-bcsr) node because it only > >appears in this example and nowhere else > > - added a new example with NAND flash > > - updated list of compatible strings > > > > Signed-off-by: J. Neuschäfer > > --- > > > > V2: > > - fix order of properties in examples, according to dts coding style > > - move to Documentation/devicetree/bindings/memory-controllers > > - clarify the commit message a tiny bit > > - remove unnecessary multiline markers (|) > > - define address format in patternProperties > > - trim subject line (remove "binding") > > - remove use of "simple-bus", because it's technically incorrect > > While I admit I haven't been following recent developments in this area, > as someone who was involved when "simple-bus" was created (and was on the > ePAPR committee that standardized it) I'm surprised to hear simple-bus > being called "erroneous" or "technically incorrect" here. It is quite possible that my understanding of it is incomplete or wrong. > > For non-NAND devices this bus generally meets the definition of "an > internal I/O bus that cannot be probed for devices" where "devices on the > bus can be accessed directly without additional configuration > required". NAND flash is an exception, but those devices have > compatibles that are specific to the bus controller. > > The fact that the address encoding is non-linear is irrelevant; the > addresses can still be translated using the standard "ranges" mechanism. > This seems to be a disconnect between the schema verification and the way > the compatible has previously been defined and used. This is what led me to my assumptions: The simple-bus validation logic in dtc complains about unit addresses such as nand@1,0 which are quite appropriate for the eLBC. > > And as a practical matter, unless I'm missing something (which I might be > since I haven't been in devicetree-land for nearly a decade), Linux is > relying on simple-bus to probe these devices. There is a driver that > binds to the bus itself but that is just for error interrupts and NAND. As of now, yes, that's correct. Without simple-bus, a current Linux kernel doesn't find the device nodes inside such a localbus. > > You'd probably need something like commit 3e25f800afb82bd9e5f8 ("memory: > fsl_ifc: populate child devices without relying on simple-bus") and the > subsequent fix in dd8adc713b1656 ("memory: fsl_ifc: populate child > nodes of buses and mfd devices")... I have prepared such a patch, based on the same assumptions: [PATCH] powerpc/fsl_lbc: Explicitly populate bus https://lore.kernel.org/lkml/20250209-localbus-v1-1-efcd78015...@posteo.net/ > > I'm curious what the reasoning was for removing simple-bus from IFC. It > seems that the schema verification also played a role in that: > https://www.spinics.net/lists/devicetree/msg220418.html Yes, that's the same as my reasoning. > > ...but there's also the comment in 985ede63a045eabf3f9d ("dt-bindings: > memory: fsl: convert ifc binding to yaml schema") that "this will help to > enforce the correct probe order between parent device and child devices", > but was that really not already guaranteed by the parent/child > relationship (and again, it should only really matter for NAND except for > the possibility of missing error reports during early boot)? I'm inclined to agree with you, but it's somewhat beyond my skill level. I'll let Li Yang or Rob Herring comment on that. > > > + compatible: > > +oneOf: > > + - items: > > + - enum: > > + - fsl,mpc8313-elbc > > + - fsl,mpc8315-elbc > > + - fsl,mpc8377-elbc > > + - fsl,mpc8378-elbc > > + - fsl,mpc8379-elbc > > + - fsl,mpc8536-elbc > > + - fsl,mpc8569-elbc > > + - fsl,mpc8572-elbc > > + - fsl,p1020-elbc > > + - fsl,p1021-elbc > > + - fsl,p1023-elbc > > + - fsl,p2020-elbc > > + - fsl,p2041-elbc > > + - fsl,p3041-elbc > > + - fsl,p4080-elbc > > + - fsl,p5020-elbc > > + - fsl,p5040-elbc > > + - const: fsl,elbc > > Is it really necessary to list every single chip? > > And then it would need to be updated when new ones came out? I know this > particular line of chips is not going to see any new members at this > point, but as far as the general approach goes... As far as I'm aw
[PATCH v5 0/7] ptrace: introduce PTRACE_SET_SYSCALL_INFO API
PTRACE_SET_SYSCALL_INFO is a generic ptrace API that complements PTRACE_GET_SYSCALL_INFO by letting the ptracer modify details of system calls the tracee is blocked in. This API allows ptracers to obtain and modify system call details in a straightforward and architecture-agnostic way, providing a consistent way of manipulating the system call number and arguments across architectures. As in case of PTRACE_GET_SYSCALL_INFO, PTRACE_SET_SYSCALL_INFO also does not aim to address numerous architecture-specific system call ABI peculiarities, like differences in the number of system call arguments for such system calls as pread64 and preadv. The current implementation supports changing only those bits of system call information that are used by strace system call tampering, namely, syscall number, syscall arguments, and syscall return value. Support of changing additional details returned by PTRACE_GET_SYSCALL_INFO, such as instruction pointer and stack pointer, could be added later if needed, by using struct ptrace_syscall_info.flags to specify the additional details that should be set. Currently, "flags" and "reserved" fields of struct ptrace_syscall_info must be initialized with zeroes; "arch", "instruction_pointer", and "stack_pointer" fields are currently ignored. PTRACE_SET_SYSCALL_INFO currently supports only PTRACE_SYSCALL_INFO_ENTRY, PTRACE_SYSCALL_INFO_EXIT, and PTRACE_SYSCALL_INFO_SECCOMP operations. Other operations could be added later if needed. Ideally, PTRACE_SET_SYSCALL_INFO should have been introduced along with PTRACE_GET_SYSCALL_INFO, but it didn't happen. The last straw that convinced me to implement PTRACE_SET_SYSCALL_INFO was apparent failure to provide an API of changing the first system call argument on riscv architecture [1]. ptrace(2) man page: long ptrace(enum __ptrace_request request, pid_t pid, void *addr, void *data); ... PTRACE_SET_SYSCALL_INFO Modify information about the system call that caused the stop. The "data" argument is a pointer to struct ptrace_syscall_info that specifies the system call information to be set. The "addr" argument should be set to sizeof(struct ptrace_syscall_info)). [1] https://lore.kernel.org/all/59505464-c84a-403d-972f-d4b2055ee...@gmail.com/ Notes: v5: * ptrace: Extend the commit message to say that the new API does not aim to address numerous architecture-specific syscall ABI peculiarities * selftests: Add a workaround for s390 16-bit syscall numbers * Add more Acked-by * v4: https://lore.kernel.org/all/20250203065849.ga14...@strace.io/ v4: * Split out syscall_set_return_value() for hexagon into a separate patch * s390: Change the style of syscall_set_arguments() implementation as requested * Add more Reviewed-by * v3: https://lore.kernel.org/all/20250128091445.ga8...@strace.io/ v3: * powerpc: Submit syscall_set_return_value() fix for "sc" case separately * mips: Do not introduce erroneous argument truncation on mips n32, add a detailed description to the commit message of the mips_get_syscall_arg() change * ptrace: Add explicit padding to the end of struct ptrace_syscall_info, simplify obtaining of user ptrace_syscall_info, do not introduce PTRACE_SYSCALL_INFO_SIZE_VER0 * ptrace: Change the return type of ptrace_set_syscall_info_* functions from "unsigned long" to "int" * ptrace: Add -ERANGE check to ptrace_set_syscall_info_exit(), add comments to -ERANGE checks * ptrace: Update comments about supported syscall stops * selftests: Extend set_syscall_info test, fix for mips n32 * Add Tested-by and Reviewed-by v2: * Add patch to fix syscall_set_return_value() on powerpc * Add patch to fix mips_get_syscall_arg() on mips * Add syscall_set_return_value() implementation on hexagon * Add syscall_set_return_value() invocation to syscall_set_nr() on arm and arm64. * Fix syscall_set_nr() and mips_set_syscall_arg() on mips * Add a comment to syscall_set_nr() on arc, powerpc, s390, sh, and sparc * Remove redundant ptrace_syscall_info.op assignments in ptrace_get_syscall_info_* * Minor style tweaks in ptrace_get_syscall_info_op() * Remove syscall_set_return_value() invocation from ptrace_set_syscall_info_entry() * Skip syscall_set_arguments() invocation in case of syscall number -1 in ptrace_set_syscall_info_entry() * Split ptrace_syscall_info.reserved into ptrace_syscall_info.reserved and ptrace_syscall_info.flags * Use __kernel_ulong_t instead of unsigned long in set_syscall_info test Dmitry V. Levin (7): mips: fix mips_get_syscall_arg() for o32 hexagon: add syscall_set_return_value() syscall.h: add syscall_set_arguments() syscall.h: introduce syscall_set_nr() ptrace_get_syscall_info: factor out ptrace_get_syscall_info_op ptrace: introduce PTRACE_SET_SYSCALL_INFO request selftests/ptrace: add a
[PATCH v5 3/7] syscall.h: add syscall_set_arguments()
This function is going to be needed on all HAVE_ARCH_TRACEHOOK architectures to implement PTRACE_SET_SYSCALL_INFO API. This partially reverts commit 7962c2eddbfe ("arch: remove unused function syscall_set_arguments()") by reusing some of old syscall_set_arguments() implementations. Signed-off-by: Dmitry V. Levin Tested-by: Charlie Jenkins Reviewed-by: Charlie Jenkins Acked-by: Helge Deller # parisc --- arch/arc/include/asm/syscall.h| 14 +++ arch/arm/include/asm/syscall.h| 13 ++ arch/arm64/include/asm/syscall.h | 13 ++ arch/csky/include/asm/syscall.h | 13 ++ arch/hexagon/include/asm/syscall.h| 7 ++ arch/loongarch/include/asm/syscall.h | 8 ++ arch/mips/include/asm/syscall.h | 32 arch/nios2/include/asm/syscall.h | 11 arch/openrisc/include/asm/syscall.h | 7 ++ arch/parisc/include/asm/syscall.h | 12 + arch/powerpc/include/asm/syscall.h| 10 arch/riscv/include/asm/syscall.h | 9 +++ arch/s390/include/asm/syscall.h | 9 +++ arch/sh/include/asm/syscall_32.h | 12 + arch/sparc/include/asm/syscall.h | 10 arch/um/include/asm/syscall-generic.h | 14 +++ arch/x86/include/asm/syscall.h| 36 +++ arch/xtensa/include/asm/syscall.h | 11 include/asm-generic/syscall.h | 16 19 files changed, 257 insertions(+) diff --git a/arch/arc/include/asm/syscall.h b/arch/arc/include/asm/syscall.h index 9709256e31c8..89c1e1736356 100644 --- a/arch/arc/include/asm/syscall.h +++ b/arch/arc/include/asm/syscall.h @@ -67,6 +67,20 @@ syscall_get_arguments(struct task_struct *task, struct pt_regs *regs, } } +static inline void +syscall_set_arguments(struct task_struct *task, struct pt_regs *regs, + unsigned long *args) +{ + unsigned long *inside_ptregs = ®s->r0; + unsigned int n = 6; + unsigned int i = 0; + + while (n--) { + *inside_ptregs = args[i++]; + inside_ptregs--; + } +} + static inline int syscall_get_arch(struct task_struct *task) { diff --git a/arch/arm/include/asm/syscall.h b/arch/arm/include/asm/syscall.h index fe4326d938c1..21927fa0ae2b 100644 --- a/arch/arm/include/asm/syscall.h +++ b/arch/arm/include/asm/syscall.h @@ -80,6 +80,19 @@ static inline void syscall_get_arguments(struct task_struct *task, memcpy(args, ®s->ARM_r0 + 1, 5 * sizeof(args[0])); } +static inline void syscall_set_arguments(struct task_struct *task, +struct pt_regs *regs, +const unsigned long *args) +{ + memcpy(®s->ARM_r0, args, 6 * sizeof(args[0])); + /* +* Also copy the first argument into ARM_ORIG_r0 +* so that syscall_get_arguments() would return it +* instead of the previous value. +*/ + regs->ARM_ORIG_r0 = regs->ARM_r0; +} + static inline int syscall_get_arch(struct task_struct *task) { /* ARM tasks don't change audit architectures on the fly. */ diff --git a/arch/arm64/include/asm/syscall.h b/arch/arm64/include/asm/syscall.h index ab8e14b96f68..76020b66286b 100644 --- a/arch/arm64/include/asm/syscall.h +++ b/arch/arm64/include/asm/syscall.h @@ -73,6 +73,19 @@ static inline void syscall_get_arguments(struct task_struct *task, memcpy(args, ®s->regs[1], 5 * sizeof(args[0])); } +static inline void syscall_set_arguments(struct task_struct *task, +struct pt_regs *regs, +const unsigned long *args) +{ + memcpy(®s->regs[0], args, 6 * sizeof(args[0])); + /* +* Also copy the first argument into orig_x0 +* so that syscall_get_arguments() would return it +* instead of the previous value. +*/ + regs->orig_x0 = regs->regs[0]; +} + /* * We don't care about endianness (__AUDIT_ARCH_LE bit) here because * AArch64 has the same system calls both on little- and big- endian. diff --git a/arch/csky/include/asm/syscall.h b/arch/csky/include/asm/syscall.h index 0de5734950bf..30403f7a0487 100644 --- a/arch/csky/include/asm/syscall.h +++ b/arch/csky/include/asm/syscall.h @@ -59,6 +59,19 @@ syscall_get_arguments(struct task_struct *task, struct pt_regs *regs, memcpy(args, ®s->a1, 5 * sizeof(args[0])); } +static inline void +syscall_set_arguments(struct task_struct *task, struct pt_regs *regs, + const unsigned long *args) +{ + memcpy(®s->a0, args, 6 * sizeof(regs->a0)); + /* +* Also copy the first argument into orig_x0 +* so that syscall_get_arguments() would return it +* instead of the previous value. +*/ + regs->orig_a0 = regs->a0; +} + static inline int syscall_get_arch(struct task_struct *task) { diff --git a/arch/hexagon/inc
[PATCH v5 4/7] syscall.h: introduce syscall_set_nr()
Similar to syscall_set_arguments() that complements syscall_get_arguments(), introduce syscall_set_nr() that complements syscall_get_nr(). syscall_set_nr() is going to be needed along with syscall_set_arguments() on all HAVE_ARCH_TRACEHOOK architectures to implement PTRACE_SET_SYSCALL_INFO API. Signed-off-by: Dmitry V. Levin Tested-by: Charlie Jenkins Reviewed-by: Charlie Jenkins Acked-by: Helge Deller # parisc --- arch/arc/include/asm/syscall.h| 11 +++ arch/arm/include/asm/syscall.h| 24 arch/arm64/include/asm/syscall.h | 16 arch/hexagon/include/asm/syscall.h| 7 +++ arch/loongarch/include/asm/syscall.h | 7 +++ arch/m68k/include/asm/syscall.h | 7 +++ arch/microblaze/include/asm/syscall.h | 7 +++ arch/mips/include/asm/syscall.h | 14 ++ arch/nios2/include/asm/syscall.h | 5 + arch/openrisc/include/asm/syscall.h | 6 ++ arch/parisc/include/asm/syscall.h | 7 +++ arch/powerpc/include/asm/syscall.h| 10 ++ arch/riscv/include/asm/syscall.h | 7 +++ arch/s390/include/asm/syscall.h | 12 arch/sh/include/asm/syscall_32.h | 12 arch/sparc/include/asm/syscall.h | 12 arch/um/include/asm/syscall-generic.h | 5 + arch/x86/include/asm/syscall.h| 7 +++ arch/xtensa/include/asm/syscall.h | 7 +++ include/asm-generic/syscall.h | 14 ++ 20 files changed, 197 insertions(+) diff --git a/arch/arc/include/asm/syscall.h b/arch/arc/include/asm/syscall.h index 89c1e1736356..728d625a10f1 100644 --- a/arch/arc/include/asm/syscall.h +++ b/arch/arc/include/asm/syscall.h @@ -23,6 +23,17 @@ syscall_get_nr(struct task_struct *task, struct pt_regs *regs) return -1; } +static inline void +syscall_set_nr(struct task_struct *task, struct pt_regs *regs, int nr) +{ + /* +* Unlike syscall_get_nr(), syscall_set_nr() can be called only when +* the target task is stopped for tracing on entering syscall, so +* there is no need to have the same check syscall_get_nr() has. +*/ + regs->r8 = nr; +} + static inline void syscall_rollback(struct task_struct *task, struct pt_regs *regs) { diff --git a/arch/arm/include/asm/syscall.h b/arch/arm/include/asm/syscall.h index 21927fa0ae2b..18b102a30741 100644 --- a/arch/arm/include/asm/syscall.h +++ b/arch/arm/include/asm/syscall.h @@ -68,6 +68,30 @@ static inline void syscall_set_return_value(struct task_struct *task, regs->ARM_r0 = (long) error ? error : val; } +static inline void syscall_set_nr(struct task_struct *task, + struct pt_regs *regs, + int nr) +{ + if (nr == -1) { + task_thread_info(task)->abi_syscall = -1; + /* +* When the syscall number is set to -1, the syscall will be +* skipped. In this case the syscall return value has to be +* set explicitly, otherwise the first syscall argument is +* returned as the syscall return value. +*/ + syscall_set_return_value(task, regs, -ENOSYS, 0); + return; + } + if ((IS_ENABLED(CONFIG_AEABI) && !IS_ENABLED(CONFIG_OABI_COMPAT))) { + task_thread_info(task)->abi_syscall = nr; + return; + } + task_thread_info(task)->abi_syscall = + (task_thread_info(task)->abi_syscall & ~__NR_SYSCALL_MASK) | + (nr & __NR_SYSCALL_MASK); +} + #define SYSCALL_MAX_ARGS 7 static inline void syscall_get_arguments(struct task_struct *task, diff --git a/arch/arm64/include/asm/syscall.h b/arch/arm64/include/asm/syscall.h index 76020b66286b..712daa90e643 100644 --- a/arch/arm64/include/asm/syscall.h +++ b/arch/arm64/include/asm/syscall.h @@ -61,6 +61,22 @@ static inline void syscall_set_return_value(struct task_struct *task, regs->regs[0] = val; } +static inline void syscall_set_nr(struct task_struct *task, + struct pt_regs *regs, + int nr) +{ + regs->syscallno = nr; + if (nr == -1) { + /* +* When the syscall number is set to -1, the syscall will be +* skipped. In this case the syscall return value has to be +* set explicitly, otherwise the first syscall argument is +* returned as the syscall return value. +*/ + syscall_set_return_value(task, regs, -ENOSYS, 0); + } +} + #define SYSCALL_MAX_ARGS 6 static inline void syscall_get_arguments(struct task_struct *task, diff --git a/arch/hexagon/include/asm/syscall.h b/arch/hexagon/include/asm/syscall.h index 1024a6548d78..70637261817a 100644 --- a/arch/hexagon/include/asm/syscall.h +++ b/arch/hexagon/in
Re: [PATCH] powerpc/mm/fault: Use str_write_read() helper function
Le 10/02/2025 à 11:06, Thorsten Blum a écrit : Remove hard-coded strings by using the str_write_read() helper function. Signed-off-by: Thorsten Blum Reviewed-by: Christophe Leroy Not sure you saw it, there's also one in: linus/master:arch/powerpc/platforms/ps3/device-init.c:727: const char *op = write ? "write" : "read"; --- arch/powerpc/mm/fault.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/mm/fault.c b/arch/powerpc/mm/fault.c index c156fe0d53c3..806c74e0d5ab 100644 --- a/arch/powerpc/mm/fault.c +++ b/arch/powerpc/mm/fault.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -218,7 +219,7 @@ static bool bad_kernel_fault(struct pt_regs *regs, unsigned long error_code, // Read/write fault blocked by KUAP is bad, it can never succeed. if (bad_kuap_fault(regs, address, is_write)) { pr_crit_ratelimited("Kernel attempted to %s user page (%lx) - exploit attempt? (uid: %d)\n", - is_write ? "write" : "read", address, + str_write_read(is_write), address, from_kuid(&init_user_ns, current_uid())); // Fault on user outside of certain regions (eg. copy_tofrom_user()) is bad @@ -625,7 +626,7 @@ static void __bad_page_fault(struct pt_regs *regs, int sig) case INTERRUPT_DATA_STORAGE: case INTERRUPT_H_DATA_STORAGE: pr_alert("BUG: %s on %s at 0x%08lx\n", msg, -is_write ? "write" : "read", regs->dar); +str_write_read(is_write), regs->dar); break; case INTERRUPT_DATA_SEGMENT: pr_alert("BUG: %s at 0x%08lx\n", msg, regs->dar);
Re: [kvm-unit-tests PATCH v2 03/18] scripts: Refuse to run the tests if not configured for qemu
On Mon, Feb 10, 2025 at 10:41:53AM +, Alexandru Elisei wrote: > Hi Drew, > > On Tue, Jan 21, 2025 at 03:48:55PM +0100, Andrew Jones wrote: > > On Mon, Jan 20, 2025 at 04:43:01PM +, Alexandru Elisei wrote: > > > > --- > > > arm/efi/run | 8 > > > arm/run | 9 + > > > run_tests.sh| 8 > > > scripts/mkstandalone.sh | 8 > > > 4 files changed, 33 insertions(+) > > > > +case "$TARGET" in > > > +qemu) > > > +;; > > > +*) > > > +echo "'$TARGET' not supported for standlone tests" > > > +exit 2 > > > +esac > > > > I think we could put the check in a function in scripts/arch-run.bash and > > just use the same error message for all cases. > > Coming back to the series. > > arm/efi/run and arm/run source scripts/arch-run.bash; run_tests.sh and > scripts/mkstandalone.sh don't source scripts/arch-run.bash. There doesn't > seem to be a common file that is sourced by all of them. scripts/mkstandalone.sh uses arch-run.bash, see generate_test(). run_tests.sh doesn't, but I'm not sure it needs to validate TARGET since it can leave that to the lower-level scripts. > > How about creating a new file in scripts (vmm.bash?) with only this > function? If we need a new file, then we can add one, but I'd try using arch-run.bash or common.bash first. Thanks, drew
[PATCH] powerpc/ps3: Use str_write_read() in ps3_notification_read_write()
Remove hard-coded strings by using the str_write_read() helper function. Signed-off-by: Thorsten Blum Suggested-by: Christophe Leroy --- arch/powerpc/platforms/ps3/device-init.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/platforms/ps3/device-init.c b/arch/powerpc/platforms/ps3/device-init.c index 61722133eb2d..22d91ac424dd 100644 --- a/arch/powerpc/platforms/ps3/device-init.c +++ b/arch/powerpc/platforms/ps3/device-init.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include @@ -724,7 +725,7 @@ static irqreturn_t ps3_notification_interrupt(int irq, void *data) static int ps3_notification_read_write(struct ps3_notification_device *dev, u64 lpar, int write) { - const char *op = write ? "write" : "read"; + const char *op = str_write_read(write); unsigned long flags; int res; -- 2.48.1
Re: [kvm-unit-tests PATCH v2 03/18] scripts: Refuse to run the tests if not configured for qemu
Hi Drew, On Mon, Feb 10, 2025 at 02:56:25PM +0100, Andrew Jones wrote: > On Mon, Feb 10, 2025 at 10:41:53AM +, Alexandru Elisei wrote: > > Hi Drew, > > > > On Tue, Jan 21, 2025 at 03:48:55PM +0100, Andrew Jones wrote: > > > On Mon, Jan 20, 2025 at 04:43:01PM +, Alexandru Elisei wrote: > > > > > > --- > > > > arm/efi/run | 8 > > > > arm/run | 9 + > > > > run_tests.sh| 8 > > > > scripts/mkstandalone.sh | 8 > > > > 4 files changed, 33 insertions(+) > > > > > > +case "$TARGET" in > > > > +qemu) > > > > +;; > > > > +*) > > > > +echo "'$TARGET' not supported for standlone tests" > > > > +exit 2 > > > > +esac > > > > > > I think we could put the check in a function in scripts/arch-run.bash and > > > just use the same error message for all cases. > > > > Coming back to the series. > > > > arm/efi/run and arm/run source scripts/arch-run.bash; run_tests.sh and > > scripts/mkstandalone.sh don't source scripts/arch-run.bash. There doesn't > > seem to be a common file that is sourced by all of them. > > scripts/mkstandalone.sh uses arch-run.bash, see generate_test(). Are you referring to this bit: generate_test () { (echo "#!/usr/bin/env bash" cat scripts/arch-run.bash "$TEST_DIR/run") I think scripts/arch-run.bash would need to be sourced for any functions defined there to be usable in mkstandalone.sh. What I was thinking is something like this: if ! vmm_supported $TARGET; then echo "$0 does not support '$TARGET'" exit 2 fi Were you thinking of something else? I think mkstandalone should error at the top level (when you do make standalone), and not rely on the individual scripts to error if the VMM is not supported. That's because I think creating the test files, booting a machine and copying the files only to find out that kvm-unit-tests was misconfigured is a pretty suboptimal experience. > run_tests.sh doesn't, but I'm not sure it needs to validate TARGET > since it can leave that to the lower-level scripts. I put the check in arm/run, and removed it from run_tests.sh, and this is what I got: $ ./run_tests.sh selftest-setup SKIP selftest-setup (./arm/run does not supported 'kvmtool') which looks good to me. > > > > > How about creating a new file in scripts (vmm.bash?) with only this > > function? > > If we need a new file, then we can add one, but I'd try using > arch-run.bash or common.bash first. common.bash seems to work (and the name fits), so I'll give that a go. Thanks, Alex
[PATCH v3 1/2] printf: convert self-test to KUnit
Convert the printf() self-test to a KUnit test. In the interest of keeping the patch reasonably-sized this doesn't refactor the tests into proper parameterized tests - it's all one big test case. Signed-off-by: Tamir Duberstein --- Documentation/core-api/printk-formats.rst | 2 +- MAINTAINERS | 2 +- lib/Kconfig.debug | 12 +- lib/Makefile | 2 +- lib/{test_printf.c => printf_kunit.c} | 188 +- tools/testing/selftests/lib/config| 1 - tools/testing/selftests/lib/printf.sh | 4 - 7 files changed, 116 insertions(+), 95 deletions(-) diff --git a/Documentation/core-api/printk-formats.rst b/Documentation/core-api/printk-formats.rst index e0473da9..0d9461bd6964 100644 --- a/Documentation/core-api/printk-formats.rst +++ b/Documentation/core-api/printk-formats.rst @@ -661,7 +661,7 @@ Do *not* use it from C. Thanks == -If you add other %p extensions, please extend with +If you add other %p extensions, please extend with one or more test cases, if at all feasible. Thank you for your cooperation and attention. diff --git a/MAINTAINERS b/MAINTAINERS index 25c86f47353d..2d58914c7dd9 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -25411,7 +25411,7 @@ R: Sergey Senozhatsky S: Maintained T: git git://git.kernel.org/pub/scm/linux/kernel/git/printk/linux.git F: Documentation/core-api/printk-formats.rst -F: lib/test_printf.c +F: lib/printf_kunit.c F: lib/test_scanf.c F: lib/vsprintf.c diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index 1af972a92d06..9f1e0d3513fb 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug @@ -2427,6 +2427,15 @@ config ASYNC_RAID6_TEST config TEST_HEXDUMP tristate "Test functions located in the hexdump module at runtime" +config PRINTF_KUNIT_TEST + tristate "KUnit test printf() family of functions at runtime" if !KUNIT_ALL_TESTS + depends on KUNIT + default KUNIT_ALL_TESTS + help + Enable this option to test the printf functions at runtime. + + If unsure, say N. + config STRING_KUNIT_TEST tristate "KUnit test string functions at runtime" if !KUNIT_ALL_TESTS depends on KUNIT @@ -2440,9 +2449,6 @@ config STRING_HELPERS_KUNIT_TEST config TEST_KSTRTOX tristate "Test kstrto*() family of functions at runtime" -config TEST_PRINTF - tristate "Test printf() family of functions at runtime" - config TEST_SCANF tristate "Test scanf() family of functions at runtime" diff --git a/lib/Makefile b/lib/Makefile index d5cfc7afbbb8..844665b1f0e7 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -84,7 +84,7 @@ obj-$(CONFIG_TEST_SORT) += test_sort.o obj-$(CONFIG_TEST_STATIC_KEYS) += test_static_keys.o obj-$(CONFIG_TEST_STATIC_KEYS) += test_static_key_base.o obj-$(CONFIG_TEST_DYNAMIC_DEBUG) += test_dynamic_debug.o -obj-$(CONFIG_TEST_PRINTF) += test_printf.o +obj-$(CONFIG_PRINTF_KUNIT_TEST) += printf_kunit.o obj-$(CONFIG_TEST_SCANF) += test_scanf.o obj-$(CONFIG_TEST_BITMAP) += test_bitmap.o diff --git a/lib/test_printf.c b/lib/printf_kunit.c similarity index 87% rename from lib/test_printf.c rename to lib/printf_kunit.c index 59dbe4f9a4cb..287bbfb61148 100644 --- a/lib/test_printf.c +++ b/lib/printf_kunit.c @@ -3,9 +3,7 @@ * Test cases for printf facility. */ -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt - -#include +#include #include #include #include @@ -25,8 +23,6 @@ #include -#include "../tools/testing/selftests/kselftest_module.h" - #define BUF_SIZE 256 #define PAD_SIZE 16 #define FILL_CHAR '$' @@ -37,12 +33,17 @@ block \ __diag_pop(); -KSTM_MODULE_GLOBALS(); +static unsigned int total_tests; + +static char *test_buffer; +static char *alloced_buffer; + +static struct kunit *kunittest; -static char *test_buffer __initdata; -static char *alloced_buffer __initdata; +#define tc_fail(fmt, ...) \ + KUNIT_FAIL(kunittest, fmt, ##__VA_ARGS__) -static int __printf(4, 0) __init +static void __printf(4, 0) do_test(int bufsize, const char *expect, int elen, const char *fmt, va_list ap) { @@ -57,52 +58,50 @@ do_test(int bufsize, const char *expect, int elen, va_end(aq); if (ret != elen) { - pr_warn("vsnprintf(buf, %d, \"%s\", ...) returned %d, expected %d\n", + tc_fail("vsnprintf(buf, %d, \"%s\", ...) returned %d, expected %d", bufsize, fmt, ret, elen); - return 1; + return; } if (memchr_inv(alloced_buffer, FILL_CHAR, PAD_SIZE)) { - pr_warn("vsnprintf(buf, %d, \"%s\", ...) wrote before buffer\n", bufsize, fmt); - return 1; + tc_fail("vsnprintf(buf, %d, \"%s\", ...) wrote before buffer", + bufsize, fmt); + return; } if (!bufsize) { if (memchr_
[PATCH v3 0/2] printf: convert self-test to KUnit
This is one of just 3 remaining "Test Module" kselftests (the others being bitmap and scanf), the rest having been converted to KUnit. I tested this using: $ tools/testing/kunit/kunit.py run --arch arm64 --make_options LLVM=1 printf I have also sent out a series converting scanf[0]. Link: https://lore.kernel.org/all/20250204-scanf-kunit-convert-v3-0-386d7c3ee...@gmail.com/T/#u [0] Signed-off-by: Tamir Duberstein --- Changes in v3: - Remove extraneous trailing newlines from failure messages. - Replace `pr_warn` with `kunit_warn`. - Drop arch changes. - Remove KUnit boilerplate from CONFIG_PRINTF_KUNIT_TEST help text. - Restore `total_tests` counting. - Remove tc_fail macro in last patch. - Link to v2: https://lore.kernel.org/r/20250207-printf-kunit-convert-v2-0-057b23860...@gmail.com Changes in v2: - Incorporate code review from prior work[0] by Arpitha Raghunandan. - Link to v1: https://lore.kernel.org/r/20250204-printf-kunit-convert-v1-0-ecf1b846a...@gmail.com Link: https://lore.kernel.org/lkml/20200817043028.76502-1-98.a...@gmail.com/t/#u [0] --- Tamir Duberstein (2): printf: convert self-test to KUnit printf: break kunit into test cases Documentation/core-api/printk-formats.rst | 2 +- MAINTAINERS | 2 +- lib/Kconfig.debug | 12 +- lib/Makefile | 2 +- lib/{test_printf.c => printf_kunit.c} | 429 +- tools/testing/selftests/lib/config| 1 - tools/testing/selftests/lib/printf.sh | 4 - 7 files changed, 192 insertions(+), 260 deletions(-) --- base-commit: a64dcfb451e254085a7daee5fe51bf22959d52d3 change-id: 20250131-printf-kunit-convert-fd4012aa2ec6 Best regards, -- Tamir Duberstein
[PATCH v3 2/2] printf: break kunit into test cases
Move all tests into `printf_test_cases`. This gives us nicer output in the event of a failure. Combine `plain_format` and `plain_hash` into `hash_pointer` since they're testing the same scenario. Signed-off-by: Tamir Duberstein --- lib/printf_kunit.c | 331 - 1 file changed, 121 insertions(+), 210 deletions(-) diff --git a/lib/printf_kunit.c b/lib/printf_kunit.c index 287bbfb61148..00c35eb0abdc 100644 --- a/lib/printf_kunit.c +++ b/lib/printf_kunit.c @@ -38,13 +38,8 @@ static unsigned int total_tests; static char *test_buffer; static char *alloced_buffer; -static struct kunit *kunittest; - -#define tc_fail(fmt, ...) \ - KUNIT_FAIL(kunittest, fmt, ##__VA_ARGS__) - -static void __printf(4, 0) -do_test(int bufsize, const char *expect, int elen, +static void __printf(5, 0) +do_test(struct kunit *kunittest, int bufsize, const char *expect, int elen, const char *fmt, va_list ap) { va_list aq; @@ -58,59 +53,64 @@ do_test(int bufsize, const char *expect, int elen, va_end(aq); if (ret != elen) { - tc_fail("vsnprintf(buf, %d, \"%s\", ...) returned %d, expected %d", - bufsize, fmt, ret, elen); + KUNIT_FAIL(kunittest, "vsnprintf(buf, %d, \"%s\", ...) returned %d, expected %d", + bufsize, fmt, ret, elen); return; } if (memchr_inv(alloced_buffer, FILL_CHAR, PAD_SIZE)) { - tc_fail("vsnprintf(buf, %d, \"%s\", ...) wrote before buffer", - bufsize, fmt); + KUNIT_FAIL(kunittest, "vsnprintf(buf, %d, \"%s\", ...) wrote before buffer", + bufsize, fmt); return; } if (!bufsize) { if (memchr_inv(test_buffer, FILL_CHAR, BUF_SIZE + PAD_SIZE)) { - tc_fail("vsnprintf(buf, 0, \"%s\", ...) wrote to buffer", fmt); + KUNIT_FAIL(kunittest, "vsnprintf(buf, 0, \"%s\", ...) wrote to buffer", + fmt); } return; } written = min(bufsize-1, elen); if (test_buffer[written]) { - tc_fail("vsnprintf(buf, %d, \"%s\", ...) did not nul-terminate buffer", - bufsize, fmt); + KUNIT_FAIL(kunittest, + "vsnprintf(buf, %d, \"%s\", ...) did not nul-terminate buffer", + bufsize, fmt); return; } if (memchr_inv(test_buffer + written + 1, FILL_CHAR, bufsize - (written + 1))) { - tc_fail("vsnprintf(buf, %d, \"%s\", ...) wrote beyond the nul-terminator", - bufsize, fmt); + KUNIT_FAIL(kunittest, + "vsnprintf(buf, %d, \"%s\", ...) wrote beyond the nul-terminator", + bufsize, fmt); return; } if (memchr_inv(test_buffer + bufsize, FILL_CHAR, BUF_SIZE + PAD_SIZE - bufsize)) { - tc_fail("vsnprintf(buf, %d, \"%s\", ...) wrote beyond buffer", bufsize, fmt); + KUNIT_FAIL(kunittest, "vsnprintf(buf, %d, \"%s\", ...) wrote beyond buffer", + bufsize, fmt); return; } if (memcmp(test_buffer, expect, written)) { - tc_fail("vsnprintf(buf, %d, \"%s\", ...) wrote '%s', expected '%.*s'", - bufsize, fmt, test_buffer, written, expect); + KUNIT_FAIL(kunittest, "vsnprintf(buf, %d, \"%s\", ...) wrote '%s', expected '%.*s'", + bufsize, fmt, test_buffer, written, expect); return; } } -static void __printf(3, 4) -__test(const char *expect, int elen, const char *fmt, ...) +static void __printf(4, 5) +__test(struct kunit *kunittest, const char *expect, int elen, const char *fmt, ...) { va_list ap; int rand; char *p; if (elen >= BUF_SIZE) { - tc_fail("error in test suite: expected output length %d too long. Format was '%s'.", - elen, fmt); + KUNIT_FAIL(kunittest, + "error in test suite: expected length (%d) >= BUF_SIZE (%d). fmt=\"%s\"", + elen, BUF_SIZE, fmt); return; } @@ -122,18 +122,19 @@ __test(const char *expect, int elen, const char *fmt, ...) * enough and 0), and then we also test that kvasprintf would * be able to print it as expected. */ - do_test(BUF_SIZE, expect, elen, fmt, ap); + do_test(kunittest, BUF_SIZE, expect, elen, fmt, ap); rand = get_random_u32_inclusive(1, elen + 1); /* Since elen < BUF_SIZE, we have 1 <= rand <= BUF_SIZE. */ - do_test(rand, expect, elen, fmt, ap); - do_test(0, expect, elen, fmt, ap); + do_test(kunittes
Re: [PATCH v7 13/20] mm/memory: Add vmf_insert_page_mkwrite()
On 04.02.25 23:48, Alistair Popple wrote: Currently to map a DAX page the DAX driver calls vmf_insert_pfn. This creates a special devmap PTE entry for the pfn but does not take a reference on the underlying struct page for the mapping. This is because DAX page refcounts are treated specially, as indicated by the presence of a devmap entry. To allow DAX page refcounts to be managed the same as normal page refcounts introduce vmf_insert_page_mkwrite(). This will take a reference on the underlying page much the same as vmf_insert_page, except it also permits upgrading an existing mapping to be writable if requested/possible. Signed-off-by: Alistair Popple --- Changes for v7: - Fix vmf_insert_page_mkwrite by removing pfn gunk as suggested by David. Updates from v2: - Rename function to make not DAX specific - Split the insert_page_into_pte_locked() change into a separate patch. Updates from v1: - Re-arrange code in insert_page_into_pte_locked() based on comments from Jan Kara. - Call mkdrity/mkyoung for the mkwrite case, also suggested by Jan. --- include/linux/mm.h | 2 ++ mm/memory.c| 21 + 2 files changed, 23 insertions(+) diff --git a/include/linux/mm.h b/include/linux/mm.h index 7b1068d..6567ece 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -3544,6 +3544,8 @@ int vm_map_pages(struct vm_area_struct *vma, struct page **pages, unsigned long num); int vm_map_pages_zero(struct vm_area_struct *vma, struct page **pages, unsigned long num); +vm_fault_t vmf_insert_page_mkwrite(struct vm_fault *vmf, struct page *page, + bool write); vm_fault_t vmf_insert_pfn(struct vm_area_struct *vma, unsigned long addr, unsigned long pfn); vm_fault_t vmf_insert_pfn_prot(struct vm_area_struct *vma, unsigned long addr, diff --git a/mm/memory.c b/mm/memory.c index 41befd9..b88b488 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -2622,6 +2622,27 @@ static vm_fault_t __vm_insert_mixed(struct vm_area_struct *vma, return VM_FAULT_NOPAGE; } +vm_fault_t vmf_insert_page_mkwrite(struct vm_fault *vmf, struct page *page, + bool write) +{ + struct vm_area_struct *vma = vmf->vma; + pgprot_t pgprot = vma->vm_page_prot; Probably could have avoided that temp without harming readability Acked-by: David Hildenbrand -- Cheers, David / dhildenb
Re: [PATCH v7 15/20] huge_memory: Add vmf_insert_folio_pud()
On 04.02.25 23:48, Alistair Popple wrote: Currently DAX folio/page reference counts are managed differently to normal pages. To allow these to be managed the same as normal pages introduce vmf_insert_folio_pud. This will map the entire PUD-sized folio and take references as it would for a normally mapped page. This is distinct from the current mechanism, vmf_insert_pfn_pud, which simply inserts a special devmap PUD entry into the page table without holding a reference to the page for the mapping. Signed-off-by: Alistair Popple Reviewed-by: Dan Williams Nit: patch subject should start with "mm/huge_memory:" Acked-by: David Hildenbrand -- Cheers, David / dhildenb
[PATCH v4 1/1] powerpc: enable dynamic preemption
Once the lazy preemption is supported, it would be desirable to change the preemption models at runtime. So add support for dynamic preemption using DYNAMIC_KEY. ::Tested lightly on Power10 LPAR Performance numbers indicate that, preempt=none(no dynamic) and preempt=none(dynamic) are close. cat /sys/kernel/debug/sched/preempt (none) voluntary full lazy perf stat -e probe:__cond_resched -a sleep 1 Performance counter stats for 'system wide': 1,253 probe:__cond_resched echo full > /sys/kernel/debug/sched/preempt cat /sys/kernel/debug/sched/preempt none voluntary (full) lazy perf stat -e probe:__cond_resched -a sleep 1 Performance counter stats for 'system wide': 0 probe:__cond_resched Signed-off-by: Shrikanth Hegde --- arch/powerpc/Kconfig | 1 + arch/powerpc/include/asm/preempt.h | 16 arch/powerpc/kernel/interrupt.c| 6 +- arch/powerpc/lib/vmx-helper.c | 2 +- 4 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 arch/powerpc/include/asm/preempt.h diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index 424f188e62d9..364edaea1f88 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig @@ -275,6 +275,7 @@ config PPC select HAVE_PERF_EVENTS_NMI if PPC64 select HAVE_PERF_REGS select HAVE_PERF_USER_STACK_DUMP + select HAVE_PREEMPT_DYNAMIC_KEY select HAVE_RETHOOK if KPROBES select HAVE_REGS_AND_STACK_ACCESS_API select HAVE_RELIABLE_STACKTRACE diff --git a/arch/powerpc/include/asm/preempt.h b/arch/powerpc/include/asm/preempt.h new file mode 100644 index ..000e2b9681f3 --- /dev/null +++ b/arch/powerpc/include/asm/preempt.h @@ -0,0 +1,16 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __ASM_POWERPC_PREEMPT_H +#define __ASM_POWERPC_PREEMPT_H + +#include + +#if defined(CONFIG_PREEMPT_DYNAMIC) +#include +DECLARE_STATIC_KEY_TRUE(sk_dynamic_irqentry_exit_cond_resched); +#define need_irq_preemption() \ + (static_branch_unlikely(&sk_dynamic_irqentry_exit_cond_resched)) +#else +#define need_irq_preemption() (IS_ENABLED(CONFIG_PREEMPTION)) +#endif + +#endif /* __ASM_POWERPC_PREEMPT_H */ diff --git a/arch/powerpc/kernel/interrupt.c b/arch/powerpc/kernel/interrupt.c index 8f4acc55407b..e0c681d0b076 100644 --- a/arch/powerpc/kernel/interrupt.c +++ b/arch/powerpc/kernel/interrupt.c @@ -25,6 +25,10 @@ unsigned long global_dbcr0[NR_CPUS]; #endif +#if defined(CONFIG_PREEMPT_DYNAMIC) +DEFINE_STATIC_KEY_TRUE(sk_dynamic_irqentry_exit_cond_resched); +#endif + #ifdef CONFIG_PPC_BOOK3S_64 DEFINE_STATIC_KEY_FALSE(interrupt_exit_not_reentrant); static inline bool exit_must_hard_disable(void) @@ -396,7 +400,7 @@ notrace unsigned long interrupt_exit_kernel_prepare(struct pt_regs *regs) /* Returning to a kernel context with local irqs enabled. */ WARN_ON_ONCE(!(regs->msr & MSR_EE)); again: - if (IS_ENABLED(CONFIG_PREEMPTION)) { + if (need_irq_preemption()) { /* Return to preemptible kernel context */ if (unlikely(read_thread_flags() & _TIF_NEED_RESCHED)) { if (preempt_count() == 0) diff --git a/arch/powerpc/lib/vmx-helper.c b/arch/powerpc/lib/vmx-helper.c index 58ed6bd613a6..54340912398f 100644 --- a/arch/powerpc/lib/vmx-helper.c +++ b/arch/powerpc/lib/vmx-helper.c @@ -45,7 +45,7 @@ int exit_vmx_usercopy(void) * set and we are preemptible. The hack here is to schedule a * decrementer to fire here and reschedule for us if necessary. */ - if (IS_ENABLED(CONFIG_PREEMPTION) && need_resched()) + if (need_irq_preemption() && need_resched()) set_dec(1); return 0; } -- 2.39.3
Re: [PATCH v7 12/20] mm/memory: Enhance insert_page_into_pte_locked() to create writable mappings
On 04.02.25 23:48, Alistair Popple wrote: In preparation for using insert_page() for DAX, enhance insert_page_into_pte_locked() to handle establishing writable mappings. Recall that DAX returns VM_FAULT_NOPAGE after installing a PTE which bypasses the typical set_pte_range() in finish_fault. Signed-off-by: Alistair Popple Suggested-by: Dan Williams Reviewed-by: Dan Williams Acked-by: David Hildenbrand -- Cheers, David / dhildenb
[PATCH v4 0/1] powerpc: Enable dynamic preemption
Now that preempt=lazy patches are merged upstream, sending out the patch to support dynamic preemption based on DYNAMIC_KEY. Once the arch supports static inline calls, it would be needed to evaluate to see if that gives better performance. This makes the same code for arm64 and powerpc. Will be sending an RFC patch to move this static key into sched/core. v3->v4: - Use static key instead of using preempt_model_preemptible (Sebastian Andrzej Siewior and Christophe Leroy) - Dropped printing the preemption model, since it is addressed in a patchset from Sebastian Andrzej Siewior v2->v3: - fixed a build error reported by linux test robot by including jump label header. v1->v2: - Instead of copying asm-generic preempt.h content include it in arch/asm preempt.h. (Christophe Leroy) - Merge the patches into one patch (Christophe Leroy) v3: https://lore.kernel.org/all/20250106051919.55020-1-sshe...@linux.ibm.com/ Shrikanth Hegde (1): powerpc: enable dynamic preemption arch/powerpc/Kconfig | 1 + arch/powerpc/include/asm/preempt.h | 16 arch/powerpc/kernel/interrupt.c| 6 +- arch/powerpc/lib/vmx-helper.c | 2 +- 4 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 arch/powerpc/include/asm/preempt.h -- 2.39.3
Re: [PATCH v7 16/20] huge_memory: Add vmf_insert_folio_pmd()
On 04.02.25 23:48, Alistair Popple wrote: Currently DAX folio/page reference counts are managed differently to normal pages. To allow these to be managed the same as normal pages introduce vmf_insert_folio_pmd. This will map the entire PMD-sized folio and take references as it would for a normally mapped page. This is distinct from the current mechanism, vmf_insert_pfn_pmd, which simply inserts a special devmap PMD entry into the page table without holding a reference to the page for the mapping. It is not currently useful to implement a more generic vmf_insert_folio() which selects the correct behaviour based on folio_order(). This is because PTE faults require only a subpage of the folio to be PTE mapped rather than the entire folio. It would be possible to add this context somewhere but callers already need to handle PTE faults and PMD faults separately so a more generic function is not useful. Signed-off-by: Alistair Popple Nit: patch subject ;) --- Changes for v7: - Fix bad pgtable handling for PPC64 (Thanks Dan and Dave) Is it? ;) insert_pfn_pmd() still doesn't consume a "pgtable_t *" But maybe I am missing something ... -- Cheers, David / dhildenb
Re: [PATCH v2 08/12] dt-bindings: spi: Convert Freescale SPI bindings to YAML
On Fri, Feb 07, 2025 at 10:30:25PM +0100, J. Neuschäfer via B4 Relay wrote: > From: "J. Neuschäfer" > > fsl-spi.txt contains the bindings for the fsl,spi and fsl,espi > contollers. Convert them to YAML. > > Signed-off-by: J. Neuschäfer > --- > > V2: > - add missing end-of-document ("...") markers > - add missing constraints to interrupts, fsl,espi-num-chipselects, > fsl,csbef and fsl,csaft properties > - remove unnecessary type from clock-frequency property > - fix property order to comply with dts coding style > --- > .../devicetree/bindings/spi/fsl,espi.yaml | 64 +++ > Documentation/devicetree/bindings/spi/fsl,spi.yaml | 73 > ++ > Documentation/devicetree/bindings/spi/fsl-spi.txt | 62 -- > 3 files changed, 137 insertions(+), 62 deletions(-) > > diff --git a/Documentation/devicetree/bindings/spi/fsl,espi.yaml > b/Documentation/devicetree/bindings/spi/fsl,espi.yaml > new file mode 100644 > index > ..c504b7957dde39086ef7d7a7550d6169cf5ec407 > --- /dev/null > +++ b/Documentation/devicetree/bindings/spi/fsl,espi.yaml > @@ -0,0 +1,64 @@ > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) > +%YAML 1.2 > +--- > +$id: http://devicetree.org/schemas/spi/fsl,espi.yaml# > +$schema: http://devicetree.org/meta-schemas/core.yaml# > + > +title: Freescale eSPI (Enhanced Serial Peripheral Interface) controller > + > +maintainers: > + - J. Neuschäfer > + > +properties: > + compatible: > +const: fsl,mpc8536-espi > + > + reg: > +maxItems: 1 > + > + interrupts: > +maxItems: 1 > + > + fsl,espi-num-chipselects: > +$ref: /schemas/types.yaml#/definitions/uint32 > +enum: [ 1, 4 ] > +description: The number of the chipselect signals. > + > + fsl,csbef: > +$ref: /schemas/types.yaml#/definitions/uint32 > +minimum: 0 > +maximum: 15 > +description: Chip select assertion time in bits before frame starts > + > + fsl,csaft: > +$ref: /schemas/types.yaml#/definitions/uint32 > +minimum: 0 > +maximum: 15 > +description: Chip select negation time in bits after frame ends > + > +required: > + - compatible > + - reg > + - interrupts > + - fsl,espi-num-chipselects > + > +allOf: > + - $ref: spi-controller.yaml# > + > +unevaluatedProperties: false > + > +examples: > + - | > +spi@11 { > +compatible = "fsl,mpc8536-espi"; > +reg = <0x11 0x1000>; > +#address-cells = <1>; > +#size-cells = <0>; > +interrupts = <53 0x2>; Use predefine's irq type macro. > +interrupt-parent = <&mpic>; > +fsl,espi-num-chipselects = <4>; > +fsl,csbef = <1>; > +fsl,csaft = <1>; > +}; > + > +... > diff --git a/Documentation/devicetree/bindings/spi/fsl,spi.yaml > b/Documentation/devicetree/bindings/spi/fsl,spi.yaml > new file mode 100644 > index > ..db65c0560c32f32324a2aaaf53c0044a4b56f3d9 > --- /dev/null > +++ b/Documentation/devicetree/bindings/spi/fsl,spi.yaml > @@ -0,0 +1,73 @@ > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) > +%YAML 1.2 > +--- > +$id: http://devicetree.org/schemas/spi/fsl,spi.yaml# > +$schema: http://devicetree.org/meta-schemas/core.yaml# > + > +title: Freescale SPI (Serial Peripheral Interface) controller > + > +maintainers: > + - J. Neuschäfer > + > +properties: > + compatible: > +enum: > + - fsl,spi > + - aeroflexgaisler,spictrl > + > + reg: > +maxItems: 1 > + > + cell-index: > +$ref: /schemas/types.yaml#/definitions/uint32 > +description: | > + QE SPI subblock index. > + 0: QE subblock SPI1 > + 1: QE subblock SPI2 > + > + mode: > +description: SPI operation mode > +enum: > + - cpu > + - cpu-qe > + > + interrupts: > +maxItems: 1 > + > + clock-frequency: > +description: input clock frequency to non FSL_SOC cores > + > + cs-gpios: true > + > + fsl,spisel_boot: > +$ref: /schemas/types.yaml#/definitions/flag > +description: > + For the MPC8306 and MPC8309, specifies that the SPISEL_BOOT signal is > used > + as chip select for a slave device. Use reg = in the > + corresponding child node, i.e. 0 if the cs-gpios property is not > present. > + > +required: > + - compatible > + - reg > + - mode > + - interrupts > + > +allOf: > + - $ref: spi-controller.yaml# > + > +unevaluatedProperties: false > + > +examples: > + - | > +spi@4c0 { > +compatible = "fsl,spi"; > +reg = <0x4c0 0x40>; > +cell-index = <0>; > +interrupts = <82 0>; > +interrupt-parent = <&intc>; > +mode = "cpu"; > +cs-gpios = <&gpio 18 1 // device reg=<0> > +&gpio 19 1>;// device reg=<1> use predefine gpio level macro Frank > +}; > + > +... > diff --git a/Documentation/devicetree/bindings/spi/fsl-spi.txt > b/Documentation/devicetree/bindings/spi/fsl-spi.txt > dele
Re: [PATCH v2 03/12] dt-bindings: crypto: Convert fsl,sec-2.0 to YAMLy
On Fri, Feb 07, 2025 at 10:30:20PM +0100, J. Neuschäfer via B4 Relay wrote: > From: "J. Neuschäfer" > > Convert the Freescale security engine (crypto accelerator) binding from > text form to YAML. The list of compatible strings reflects what was > previously described in prose; not all combinations occur in existing > devicetrees. > > Signed-off-by: J. Neuschäfer Reviewed-by: Frank Li > --- > > V2: > - several improvements suggested by Rob Herring: > - remove unnecessary multiline markers > - constrain fsl,num-channels to enum: [1,4] > - constrain fsl,channel-fifo-len to plausible limits > - constrain fsl,exec-units-mask to maximum=0xfff > - trim subject line (remove "binding") > --- > .../devicetree/bindings/crypto/fsl,sec2.0.yaml | 142 > + > .../devicetree/bindings/crypto/fsl-sec2.txt| 65 -- > 2 files changed, 142 insertions(+), 65 deletions(-) > > diff --git a/Documentation/devicetree/bindings/crypto/fsl,sec2.0.yaml > b/Documentation/devicetree/bindings/crypto/fsl,sec2.0.yaml > new file mode 100644 > index > ..0b82f3b68b5f82e7fb52d292a623d452c1cdb059 > --- /dev/null > +++ b/Documentation/devicetree/bindings/crypto/fsl,sec2.0.yaml > @@ -0,0 +1,142 @@ > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) > +%YAML 1.2 > +--- > +$id: http://devicetree.org/schemas/crypto/fsl,sec2.0.yaml# > +$schema: http://devicetree.org/meta-schemas/core.yaml# > + > +title: Freescale SoC SEC Security Engines versions 1.x-2.x-3.x > + > +maintainers: > + - J. Neuschäfer + > +properties: > + compatible: > +description: > + Should contain entries for this and backward compatible SEC versions, > + high to low. Warning - SEC1 and SEC2 are mutually exclusive. > +oneOf: > + - items: > + - const: fsl,sec3.3 > + - const: fsl,sec3.1 > + - const: fsl,sec3.0 > + - const: fsl,sec2.4 > + - const: fsl,sec2.2 > + - const: fsl,sec2.1 > + - const: fsl,sec2.0 > + - items: > + - const: fsl,sec3.1 > + - const: fsl,sec3.0 > + - const: fsl,sec2.4 > + - const: fsl,sec2.2 > + - const: fsl,sec2.1 > + - const: fsl,sec2.0 > + - items: > + - const: fsl,sec3.0 > + - const: fsl,sec2.4 > + - const: fsl,sec2.2 > + - const: fsl,sec2.1 > + - const: fsl,sec2.0 > + - items: > + - const: fsl,sec2.4 > + - const: fsl,sec2.2 > + - const: fsl,sec2.1 > + - const: fsl,sec2.0 > + - items: > + - const: fsl,sec2.2 > + - const: fsl,sec2.1 > + - const: fsl,sec2.0 > + - items: > + - const: fsl,sec2.1 > + - const: fsl,sec2.0 > + - items: > + - const: fsl,sec2.0 > + - items: > + - const: fsl,sec1.2 > + - const: fsl,sec1.0 > + - items: > + - const: fsl,sec1.0 > + > + reg: > +maxItems: 1 > + > + interrupts: > +maxItems: 1 > + > + fsl,num-channels: > +$ref: /schemas/types.yaml#/definitions/uint32 > +enum: [ 1, 4 ] > +description: An integer representing the number of channels available. > + > + fsl,channel-fifo-len: > +$ref: /schemas/types.yaml#/definitions/uint32 > +maximum: 100 > +description: > + An integer representing the number of descriptor pointers each channel > + fetch fifo can hold. > + > + fsl,exec-units-mask: > +$ref: /schemas/types.yaml#/definitions/uint32 > +maximum: 0xfff > +description: | > + The bitmask representing what execution units (EUs) are available. > + EU information should be encoded following the SEC's Descriptor Header > + Dword EU_SEL0 field documentation, i.e. as follows: > + > +bit 0 = reserved - should be 0 > +bit 1 = set if SEC has the ARC4 EU (AFEU) > +bit 2 = set if SEC has the DES/3DES EU (DEU) > +bit 3 = set if SEC has the message digest EU (MDEU/MDEU-A) > +bit 4 = set if SEC has the random number generator EU (RNG) > +bit 5 = set if SEC has the public key EU (PKEU) > +bit 6 = set if SEC has the AES EU (AESU) > +bit 7 = set if SEC has the Kasumi EU (KEU) > +bit 8 = set if SEC has the CRC EU (CRCU) > +bit 11 = set if SEC has the message digest EU extended alg set > (MDEU-B) > + > + remaining bits are reserved for future SEC EUs. > + > + fsl,descriptor-types-mask: > +$ref: /schemas/types.yaml#/definitions/uint32 > +description: | > + The bitmask representing what descriptors are available. Descriptor > type > + information should be encoded following the SEC's Descriptor Header > Dword > + DESC_TYPE field documentation, i.e. as follows: > + > +bit 0 = set if SEC supports the aesu_ctr_nonsnoop desc. type > +bit 1 = set if SEC supports the ipsec_esp descriptor type > +bit 2 = set if
Re: distro support for CONFIG_KUNIT: [PATCH 0/3] bitmap: convert self-test to KUnit
On Mon, Feb 10, 2025 at 11:35:48AM -0800, John Hubbard wrote: > On 2/9/25 11:54 PM, Geert Uytterhoeven wrote: > > On Sat, 8 Feb 2025 at 18:53, Yury Norov wrote: > > > On Fri, Feb 07, 2025 at 03:14:01PM -0500, Tamir Duberstein wrote: > > > > On 7/27/24 12:35 AM, Shuah Khan wrote: > ... > > > > The crux of the argument seems to be that the config help text is taken > > > > to describe the author's intent with the fragment "at boot". I think > > > > IMO, "at boot" is a misnomer, as most tests can be either builtin > > or modular. > > Right. > > > > > > KUNIT is disabled in defconfig, at least on x86_64. It is also disabled > > > on my Ubuntu 24.04 machine. If I take your patches, I'll be unable to > > OK so I just bought a shiny new test machine, and installed one of the > big name distros on it, hoping they've moved ahead and bought into the kunit > story... > > $ grep KUNIT /boot/config-6.8.0-52-generic > # CONFIG_KUNIT is not set > > ...gagghh! No such luck. One more data point, in support of Yuri's complaint. > :) > > > > > I think distros should start setting CONFIG_KUNIT=m. > > Yes they should! kunit really does have important advantages for many use > cases, including bitmaps here, and "CONFIG_KUNIT is not set" is the main > obstacle. Hi John, Geert, Tamir, Can you please explain in details which advantages KUNIT brings to the test_bitmap.c, find_bit_benchmark.c and other low-level tests? I'm not strongly against moving under KUNIT's hat, but I do: - respect commitment of my contributors, so I don't want to wipe git history for no serious reason; - respect time of my testers, so no extra dependencies; - respect time of reviewers. Tamir, If it comes to v2, can you please begin your series with an exhaustive and clear answer to the following questions: - What do the tests miss now? - What do _you_ need from the tests? Describe your test scenario. - How exactly KUNIT helps you testing bitmaps and friends better? - Is there a way to meet your needs with a less invasive approach, particularly without run-time dependencies? Thanks, Yury
Re: distro support for CONFIG_KUNIT: [PATCH 0/3] bitmap: convert self-test to KUnit
On 2/10/25 3:10 PM, Nico Pache wrote: ... Fedora has it. CS-10 has it (-> RHEL-10): redhat/configs/common/generic/CONFIG_KUNIT:CONFIG_KUNIT=m https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-10/-/blob/main/redhat/configs/common/generic/CONFIG_KUNIT?ref_type=heads CS-9 has it (-> RHEL-9): redhat/configs/common/generic/CONFIG_KUNIT:CONFIG_KUNIT=m https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/blob/main/redhat/configs/common/generic/CONFIG_KUNIT?ref_type=heads So I think from the RH side everything is properly set? Let me CC Nico, he did some KUNIT work in the past. Yeah that is correct! I enabled KUNIT in our environments a few years ago. We enable it as a module and use our own wrapper to exercise the code. For RHEL and Centos these kunit modules are only shipped internally for testing; However fedora-rawhide makes these modules available in the kernel-modules-internal package. To test this you can follow this to install rawhide-vm: https://developer.fedoraproject.org/tools/virt-builder/about.html then inside the vm: yum install kernel-modules-internal add the kunit.enable=1 to the cmdline reboot vm modprobe kunit modprobe Hopefully that helps! -- Nico Great news, thanks for the quick answers for Red Hat. "Already done" is as good as it gets, for this kind of question. :) thanks, -- John Hubbard
Re: [PATCH v2 11/12] dt-bindings: nand: Add fsl,elbc-fcm-nand
On Fri, Feb 07, 2025 at 10:30:28PM +0100, J. Neuschäfer wrote: > Formalize the binding already supported by the fsl_elbc_nand.c driver > and used in several device trees in arch/powerpc/boot/dts/. > > Signed-off-by: J. Neuschäfer > --- > > V2: > - split out from fsl,elbc binding patch > - constrain #address-cells and #size-cells > - add a general description > - use unevaluatedProperties=false instead of additionalProperties=false > - fix property order to comply with dts coding style > - include raw-nand-chip.yaml instead of nand-chip.yaml Why? Doesn't look like you use anything from it. I think the correct thing to use here is just mtd.yaml to pick up partitions. > --- > .../devicetree/bindings/mtd/fsl,elbc-fcm-nand.yaml | 68 > ++ > 1 file changed, 68 insertions(+) > > diff --git a/Documentation/devicetree/bindings/mtd/fsl,elbc-fcm-nand.yaml > b/Documentation/devicetree/bindings/mtd/fsl,elbc-fcm-nand.yaml > new file mode 100644 > index > ..1de97bb24fa4a83e2ea5d94ab822dd0e37baa102 > --- /dev/null > +++ b/Documentation/devicetree/bindings/mtd/fsl,elbc-fcm-nand.yaml > @@ -0,0 +1,68 @@ > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) > +%YAML 1.2 > +--- > +$id: http://devicetree.org/schemas/mtd/fsl,elbc-fcm-nand.yaml# > +$schema: http://devicetree.org/meta-schemas/core.yaml# > + > +title: NAND flash attached to Freescale eLBC > + > +description: > + The Freescale Enhanced Local Bus controller (eLBC) contains logic to > + interface with NAND flash, called the NAND Flash Control Machine (FCM). > + This binding describes flash attached to an eLBC using the FCM. > + > +maintainers: > + - J. Neuschäfer > + > +allOf: > + - $ref: raw-nand-chip.yaml# > + > +properties: > + compatible: > +oneOf: > + - items: > + - enum: > + - fsl,mpc8313-fcm-nand > + - fsl,mpc8315-fcm-nand > + - fsl,mpc8377-fcm-nand > + - fsl,mpc8378-fcm-nand > + - fsl,mpc8379-fcm-nand > + - fsl,mpc8536-fcm-nand > + - fsl,mpc8569-fcm-nand > + - fsl,mpc8572-fcm-nand > + - fsl,p1020-fcm-nand > + - fsl,p1021-fcm-nand > + - fsl,p1025-fcm-nand > + - fsl,p2020-fcm-nand > + - const: fsl,elbc-fcm-nand > + - const: fsl,elbc-fcm-nand > + > + reg: > +maxItems: 1 > + > + "#address-cells": > +const: 1 > + > + "#size-cells": > +const: 1 > + > +required: > + - compatible > + - reg > + > +unevaluatedProperties: false > + > +examples: > + - | > +localbus { > +#address-cells = <2>; > +#size-cells = <1>; > + > +nand@1,0 { > +compatible = "fsl,mpc8315-fcm-nand", > + "fsl,elbc-fcm-nand"; > +reg = <0x1 0x0 0x2000>; > +#address-cells = <1>; > +#size-cells = <1>; > +}; > +}; > > -- > 2.48.0.rc1.219.gb6b6757d772 >
Re: distro support for CONFIG_KUNIT: [PATCH 0/3] bitmap: convert self-test to KUnit
On 10.02.25 20:35, John Hubbard wrote: On 2/9/25 11:54 PM, Geert Uytterhoeven wrote: On Sat, 8 Feb 2025 at 18:53, Yury Norov wrote: On Fri, Feb 07, 2025 at 03:14:01PM -0500, Tamir Duberstein wrote: On 7/27/24 12:35 AM, Shuah Khan wrote: ... The crux of the argument seems to be that the config help text is taken to describe the author's intent with the fragment "at boot". I think IMO, "at boot" is a misnomer, as most tests can be either builtin or modular. Right. KUNIT is disabled in defconfig, at least on x86_64. It is also disabled on my Ubuntu 24.04 machine. If I take your patches, I'll be unable to OK so I just bought a shiny new test machine, and installed one of the big name distros on it, hoping they've moved ahead and bought into the kunit story... $ grep KUNIT /boot/config-6.8.0-52-generic # CONFIG_KUNIT is not set ...gagghh! No such luck. One more data point, in support of Yuri's complaint. :) I think distros should start setting CONFIG_KUNIT=m. Yes they should! kunit really does have important advantages for many use cases, including bitmaps here, and "CONFIG_KUNIT is not set" is the main obstacle. > > Let me add a few people to Cc who might be able to influence some distros. thanks, Fedora has it. CS-10 has it (-> RHEL-10): redhat/configs/common/generic/CONFIG_KUNIT:CONFIG_KUNIT=m https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-10/-/blob/main/redhat/configs/common/generic/CONFIG_KUNIT?ref_type=heads CS-9 has it (-> RHEL-9): redhat/configs/common/generic/CONFIG_KUNIT:CONFIG_KUNIT=m https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/blob/main/redhat/configs/common/generic/CONFIG_KUNIT?ref_type=heads So I think from the RH side everything is properly set? Let me CC Nico, he did some KUNIT work in the past. -- Cheers, David / dhildenb
Re: [PATCH v2 06/12] dt-bindings: pci: Convert fsl,mpc83xx-pcie to YAML
On Sun, Feb 09, 2025 at 12:06:59AM +, J. Neuschäfer wrote: > On Fri, Feb 07, 2025 at 10:30:23PM +0100, J. Neuschäfer via B4 Relay wrote: > > From: "J. Neuschäfer" > > > > Formalise the binding for the PCI controllers in the Freescale MPC8xxx > > chip family. Information about PCI-X-specific properties was taken from > > fsl,pci.txt. The examples were taken from mpc8315erdb.dts and > > xpedite5200_xmon.dts. > > > > Signed-off-by: J. Neuschäfer > > --- > > > > V2: > > - merge fsl,pci.txt into fsl,mpc8xxx-pci.yaml > > - regroup compatible strings, list single-item values in one enum > > - trim subject line (remove "binding") > > - fix property order to comply with dts coding style > > --- > > .../devicetree/bindings/pci/fsl,mpc8xxx-pci.yaml | 115 > > + > > Documentation/devicetree/bindings/pci/fsl,pci.txt | 27 - > > 2 files changed, 115 insertions(+), 27 deletions(-) > > > > diff --git a/Documentation/devicetree/bindings/pci/fsl,mpc8xxx-pci.yaml > > b/Documentation/devicetree/bindings/pci/fsl,mpc8xxx-pci.yaml > > new file mode 100644 > > index > > ..57c5503cec47e6e90ed2b09835bfad10309db927 > > --- /dev/null > > +++ b/Documentation/devicetree/bindings/pci/fsl,mpc8xxx-pci.yaml > > @@ -0,0 +1,115 @@ > > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) > > +%YAML 1.2 > > +--- > > + > > +$id: http://devicetree.org/schemas/pci/fsl,mpc8xxx-pci.yaml# > > +$schema: http://devicetree.org/meta-schemas/core.yaml# > > + > > +title: Freescale MPC83xx PCI/PCI-X/PCIe controllers > > + > > +description: | > > + Binding for the PCI/PCI-X/PCIe host bridges on MPC8xxx SoCs. > > + See also: Documentation/devicetree/bindings/pci/fsl,pci.txt > > This is obviously a bit wrong; I ended up putting the information from > fsl,pci.txt entirely under the fsl,pci-agent-force-enum property, but > forgot to remove the reference to the old txt file. Looks fine other than that. Rob
Re: [PATCH v7 14/20] rmap: Add support for PUD sized mappings to rmap
On 04.02.25 23:48, Alistair Popple wrote: The rmap doesn't currently support adding a PUD mapping of a folio. This patch adds support for entire PUD mappings of folios, primarily to allow for more standard refcounting of device DAX folios. Currently DAX is the only user of this and it doesn't require support for partially mapped PUD-sized folios so we don't support for that for now. Signed-off-by: Alistair Popple Acked-by: David Hildenbrand Reviewed-by: Dan Williams Nit: patch subject should start with "mm/rmap:" -- Cheers, David / dhildenb
Re: [PATCH v7 19/20] fs/dax: Properly refcount fs dax pages
-static inline unsigned long dax_page_share_put(struct page *page) +static inline unsigned long dax_folio_put(struct folio *folio) { - WARN_ON_ONCE(!page->share); - return --page->share; + unsigned long ref; + + if (!dax_folio_is_shared(folio)) + ref = 0; + else + ref = --folio->share; + + WARN_ON_ONCE(ref < 0); + if (!ref) { + folio->mapping = NULL; + if (folio_order(folio)) { I'd have made this easier to read by doing if (ref) return ref; folio->mapping = NULL; order = folio_order(folio) if (!order) return 0; pgmap = page_pgmap(&folio->page); for (i = 0; i < (1UL << order); i++) { // loop body see below } return 0; In the context of similar split users and related discussions in the future with memdescs -- see 89a41a0263293856678189981e5407375261c4ff -- I would further do within the loop (avoiding messing with page-> completely): ... struct page *page = folio_page(folio, i); /* Careful: see __split_huge_page_tail() */ struct folio *new_folio = (struct folio *)page; ClearPageHead(page); clear_compound_head(page); new_folio->mapping = NULL; /* * Reset pgmap which was over-written by * prep_compound_page(). */ new_folio->pgmap = pgmap; new_folio->share = 0; WARN_ON_ONCE(folio_ref_count(new_folio)); ... I scanned over the other stuff in here, but I'm not an expert on the pfn_t etc thingies. -- Cheers, David / dhildenb
Re: [PATCH v2 10/12] dt-bindings: memory-controllers: Add fsl,elbc-gpcm-uio
On Fri, Feb 07, 2025 at 10:30:27PM +0100, J. Neuschäfer via B4 Relay wrote: > From: "J. Neuschäfer" > > Formalize the binding already supported by the uio_fsl_elbc_gpcm.c > driver. > > Signed-off-by: J. Neuschäfer Reviewed-by: Frank Li > --- > > V2: > - split out from fsl,elbc patch > - add description > - remove "device_type" property > - move to bindings/memory-controllers > --- > .../memory-controllers/fsl,elbc-gpcm-uio.yaml | 59 > ++ > 1 file changed, 59 insertions(+) > > diff --git > a/Documentation/devicetree/bindings/memory-controllers/fsl,elbc-gpcm-uio.yaml > b/Documentation/devicetree/bindings/memory-controllers/fsl,elbc-gpcm-uio.yaml > new file mode 100644 > index > ..381584b400a0ad98c6d9e0b38f2877d44603ed84 > --- /dev/null > +++ > b/Documentation/devicetree/bindings/memory-controllers/fsl,elbc-gpcm-uio.yaml > @@ -0,0 +1,59 @@ > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) > +%YAML 1.2 > +--- > +$id: http://devicetree.org/schemas/memory-controllers/fsl,elbc-gpcm-uio.yaml# > +$schema: http://devicetree.org/meta-schemas/core.yaml# > + > +title: Userspace I/O interface for Freescale eLBC devices > + > +description: > + The Freescale Enhanced Local Bus controller (eLBC) supports flexible access > + to memory devices, through the General-Purpose Chip-select Machine (GPCM). > + The purpose of this binding is to designate devices attached to eLBC/GPMC > for > + use by userspace. > + > +maintainers: > + - J. Neuschäfer > + > +properties: > + compatible: > +const: fsl,elbc-gpcm-uio > + > + reg: > +maxItems: 1 > + > + elbc-gpcm-br: > +description: Base Register (BR) value to set > +$ref: /schemas/types.yaml#/definitions/uint32 > + > + elbc-gpcm-or: > +description: Option Register (OR) value to set > +$ref: /schemas/types.yaml#/definitions/uint32 > + > + interrupts: > +maxItems: 1 > + > + uio_name: > +$ref: /schemas/types.yaml#/definitions/string > + > +required: > + - compatible > + - reg > + - elbc-gpcm-br > + - elbc-gpcm-or > + > +additionalProperties: false > + > +examples: > + - | > +localbus { > +#address-cells = <2>; > +#size-cells = <1>; > + > +simple-periph@2,0 { > +compatible = "fsl,elbc-gpcm-uio"; > +reg = <0x2 0x0 0x1>; > +elbc-gpcm-br = <0xfd810800>; > +elbc-gpcm-or = <0x09f7>; > +}; > +}; > > -- > 2.48.0.rc1.219.gb6b6757d772 > >
Re: [PATCH v2 05/12] dt-bindings: dma: Convert fsl,elo*-dma to YAML
On Fri, Feb 07, 2025 at 10:30:22PM +0100, J. Neuschäfer via B4 Relay wrote: > From: "J. Neuschäfer" > > The devicetree bindings for Freescale DMA engines have so far existed as > a text file. This patch converts them to YAML, and specifies all the > compatible strings currently in use in arch/powerpc/boot/dts. > > Signed-off-by: J. Neuschäfer > --- > > V2: > - remove unnecessary multiline markers > - fix additionalProperties to always be false > - add description/maxItems to interrupts > - add missing #address-cells/#size-cells properties > - convert "Note on DMA channel compatible properties" to YAML by listing > fsl,ssi-dma-channel as a valid compatible value > - fix property ordering in examples: compatible and reg come first > - add missing newlines in examples > - trim subject line (remove "bindings") > --- > .../devicetree/bindings/dma/fsl,elo-dma.yaml | 140 ++ > .../devicetree/bindings/dma/fsl,elo3-dma.yaml | 123 + > .../devicetree/bindings/dma/fsl,eloplus-dma.yaml | 134 ++ > .../devicetree/bindings/powerpc/fsl/dma.txt| 204 > - > 4 files changed, 397 insertions(+), 204 deletions(-) > > diff --git a/Documentation/devicetree/bindings/dma/fsl,elo-dma.yaml > b/Documentation/devicetree/bindings/dma/fsl,elo-dma.yaml > new file mode 100644 > index > ..3d8be9973fb98891a73cb701c1f983a63f444837 > --- /dev/null > +++ b/Documentation/devicetree/bindings/dma/fsl,elo-dma.yaml > @@ -0,0 +1,140 @@ > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) > +%YAML 1.2 > +--- > +$id: http://devicetree.org/schemas/dma/fsl,elo-dma.yaml# > +$schema: http://devicetree.org/meta-schemas/core.yaml# > + > +title: Freescale Elo DMA Controller > + > +maintainers: > + - J. Neuschäfer > + > +description: > + This is a little-endian 4-channel DMA controller, used in Freescale mpc83xx > + series chips such as mpc8315, mpc8349, mpc8379 etc. > + > +properties: > + compatible: > +items: > + - enum: > + - fsl,mpc8313-dma > + - fsl,mpc8315-dma > + - fsl,mpc8323-dma > + - fsl,mpc8347-dma > + - fsl,mpc8349-dma > + - fsl,mpc8360-dma > + - fsl,mpc8377-dma > + - fsl,mpc8378-dma > + - fsl,mpc8379-dma > + - const: fsl,elo-dma > + > + reg: > +maxItems: 1 > +description: > + DMA General Status Register, i.e. DGSR which contains status for > + all the 4 DMA channels. needn't maxItems items: - description: DMA ... > + > + cell-index: > +$ref: /schemas/types.yaml#/definitions/uint32 > +description: Controller index. 0 for controller @ 0x8100. > + > + ranges: true > + > + "#address-cells": > +const: 1 > + > + "#size-cells": > +const: 1 > + > + interrupts: > +maxItems: 1 > +description: Controller interrupt. Needn't description because no any additional informaiton. > + > +required: > + - compatible > + - reg > + > +patternProperties: > + "^dma-channel@.*$": > +type: object > +additionalProperties: false > + > +properties: > + compatible: > +oneOf: > + # native DMA channel > + - items: > + - enum: > + - fsl,mpc8315-dma-channel > + - fsl,mpc8323-dma-channel > + - fsl,mpc8347-dma-channel > + - fsl,mpc8349-dma-channel > + - fsl,mpc8360-dma-channel > + - fsl,mpc8377-dma-channel > + - fsl,mpc8378-dma-channel > + - fsl,mpc8379-dma-channel > + - const: fsl,elo-dma-channel > + > + # audio DMA channel, see fsl,ssi.yaml > + - const: fsl,ssi-dma-channel > + > + reg: > +maxItems: 1 > + > + cell-index: > +description: DMA channel index starts at 0. > + > + interrupts: > +maxItems: 1 > +description: > + Per-channel interrupt. Only necessary if no controller interrupt > has > + been provided. > + > +additionalProperties: false Need ref to dma-common.yaml? > + > +examples: > + - | > +dma@82a8 { > +compatible = "fsl,mpc8349-dma", "fsl,elo-dma"; > +reg = <0x82a8 4>; > +#address-cells = <1>; > +#size-cells = <1>; > +ranges = <0 0x8100 0x1a4>; > +interrupt-parent = <&ipic>; > +interrupts = <71 8>; > +cell-index = <0>; > + > +dma-channel@0 { > +compatible = "fsl,mpc8349-dma-channel", "fsl,elo-dma-channel"; > +reg = <0 0x80>; > +cell-index = <0>; > +interrupt-parent = <&ipic>; > +interrupts = <71 8>; '8', use predefine MACRO for irq type. Frank > +}; > + > +dma-channel@80 { > +compatible = "fsl,mpc8349-dma-channel", "fsl,elo-dma-channel"; > +reg = <0x80 0x80>; > +cell-index = <1>; > +interrupt-parent
Re: [PATCH v5 0/6] elf: Define note name macros
On Wed, 15 Jan 2025 14:47:57 +0900, Akihiko Odaki wrote: > elf.h had a comment saying: > > Notes used in ET_CORE. Architectures export some of the arch register > > sets using the corresponding note types via the PTRACE_GETREGSET and > > PTRACE_SETREGSET requests. > > The note name for these types is "LINUX", except NT_PRFPREG that is > > named "CORE". > > [...] I rebased this for changes introduced by commit 680e029fd62f ("proc/kcore: don't walk list on every read") Applied to for-next/execve, thanks! [1/6] elf: Define note name macros https://git.kernel.org/kees/c/7da8e4ad4df0 [2/6] binfmt_elf: Use note name macros https://git.kernel.org/kees/c/2fc4947bbd91 [3/6] powerpc: Use note name macros https://git.kernel.org/kees/c/609c8b309156 [4/6] crash: Use note name macros https://git.kernel.org/kees/c/0de47f28ec84 [5/6] s390/crash: Use note name macros https://git.kernel.org/kees/c/d4a760fb77fd [6/6] crash: Remove KEXEC_CORE_NOTE_NAME https://git.kernel.org/kees/c/7e620b56d958 Take care, -- Kees Cook
[PATCH] powerpc/iommu: Use str_disabled_enabled() helper
Remove hard-coded strings by using the str_disabled_enabled() helper. Signed-off-by: Thorsten Blum --- arch/powerpc/kernel/iommu.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/kernel/iommu.c b/arch/powerpc/kernel/iommu.c index 0ebae6e4c19d..244eb4857e7f 100644 --- a/arch/powerpc/kernel/iommu.c +++ b/arch/powerpc/kernel/iommu.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -769,8 +770,8 @@ struct iommu_table *iommu_init_table(struct iommu_table *tbl, int nid, iommu_table_clear(tbl); if (!welcomed) { - printk(KERN_INFO "IOMMU table initialized, virtual merging %s\n", - novmerge ? "disabled" : "enabled"); + pr_info("IOMMU table initialized, virtual merging %s\n", + str_disabled_enabled(novmerge)); welcomed = 1; } -- 2.48.0
Re: [PATCH v2 11/12] dt-bindings: nand: Add fsl,elbc-fcm-nandy
On Fri, Feb 07, 2025 at 10:30:28PM +0100, J. Neuschäfer via B4 Relay wrote: > From: "J. Neuschäfer" > > Formalize the binding already supported by the fsl_elbc_nand.c driver > and used in several device trees in arch/powerpc/boot/dts/. > > Signed-off-by: J. Neuschäfer > --- > > V2: > - split out from fsl,elbc binding patch > - constrain #address-cells and #size-cells > - add a general description > - use unevaluatedProperties=false instead of additionalProperties=false > - fix property order to comply with dts coding style > - include raw-nand-chip.yaml instead of nand-chip.yaml > --- > .../devicetree/bindings/mtd/fsl,elbc-fcm-nand.yaml | 68 > ++ > 1 file changed, 68 insertions(+) > > diff --git a/Documentation/devicetree/bindings/mtd/fsl,elbc-fcm-nand.yaml > b/Documentation/devicetree/bindings/mtd/fsl,elbc-fcm-nand.yaml > new file mode 100644 > index > ..1de97bb24fa4a83e2ea5d94ab822dd0e37baa102 > --- /dev/null > +++ b/Documentation/devicetree/bindings/mtd/fsl,elbc-fcm-nand.yaml > @@ -0,0 +1,68 @@ > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) > +%YAML 1.2 > +--- > +$id: http://devicetree.org/schemas/mtd/fsl,elbc-fcm-nand.yaml# > +$schema: http://devicetree.org/meta-schemas/core.yaml# > + > +title: NAND flash attached to Freescale eLBC > + > +description: > + The Freescale Enhanced Local Bus controller (eLBC) contains logic to > + interface with NAND flash, called the NAND Flash Control Machine (FCM). > + This binding describes flash attached to an eLBC using the FCM. > + > +maintainers: > + - J. Neuschäfer > + > +allOf: > + - $ref: raw-nand-chip.yaml# > + > +properties: > + compatible: > +oneOf: > + - items: > + - enum: > + - fsl,mpc8313-fcm-nand > + - fsl,mpc8315-fcm-nand > + - fsl,mpc8377-fcm-nand > + - fsl,mpc8378-fcm-nand > + - fsl,mpc8379-fcm-nand > + - fsl,mpc8536-fcm-nand > + - fsl,mpc8569-fcm-nand > + - fsl,mpc8572-fcm-nand > + - fsl,p1020-fcm-nand > + - fsl,p1021-fcm-nand > + - fsl,p1025-fcm-nand > + - fsl,p2020-fcm-nand > + - const: fsl,elbc-fcm-nand > + - const: fsl,elbc-fcm-nand > + > + reg: > +maxItems: 1 > + > + "#address-cells": > +const: 1 > + > + "#size-cells": > +const: 1 > + > +required: > + - compatible > + - reg > + > +unevaluatedProperties: false > + > +examples: > + - | > +localbus { > +#address-cells = <2>; > +#size-cells = <1>; > + > +nand@1,0 { > +compatible = "fsl,mpc8315-fcm-nand", > + "fsl,elbc-fcm-nand"; > +reg = <0x1 0x0 0x2000>; > +#address-cells = <1>; > +#size-cells = <1>; needn't #address-cells and #size-cells because no children nodes. Reviewed-by: Frank Li Frank > +}; > +}; > > -- > 2.48.0.rc1.219.gb6b6757d772 > >
Re: [PATCH v2 09/12] dt-bindings: memory-controllers: Convert fsl,elbc to YAML
On Sun, Feb 09, 2025 at 02:31:34PM -0600, Crystal Wood wrote: > On Fri, Feb 07, 2025 at 10:30:26PM +0100, J. Neuschäfer via B4 Relay wrote: > > From: "J. Neuschäfer" > > > > Convert the Freescale localbus controller bindings from text form to > > YAML. The updated list of compatible strings reflects current usage > > in arch/powerpc/boot/dts/, except that many existing device trees > > erroneously specify "simple-bus" in addition to fsl,*elbc. > > > > Changes compared to the txt version: > > - removed the board-control (fsl,mpc8272ads-bcsr) node because it only > >appears in this example and nowhere else > > - added a new example with NAND flash > > - updated list of compatible strings > > > > Signed-off-by: J. Neuschäfer > > --- > > > > V2: > > - fix order of properties in examples, according to dts coding style > > - move to Documentation/devicetree/bindings/memory-controllers > > - clarify the commit message a tiny bit > > - remove unnecessary multiline markers (|) > > - define address format in patternProperties > > - trim subject line (remove "binding") > > - remove use of "simple-bus", because it's technically incorrect > > While I admit I haven't been following recent developments in this area, > as someone who was involved when "simple-bus" was created (and was on the > ePAPR committee that standardized it) I'm surprised to hear simple-bus > being called "erroneous" or "technically incorrect" here. Erroneous because the binding did not say "simple-bus" was used. Not uncommon with the old .txt bindings. Generally, if a bus has control registers or resources like clocks, then we tend not to call them 'simple-bus'. And '"specific-bus", "simple-bus"' gives some problems around what driver if any do you bind to. If you have chip selects, then you have config registers for those. Not really "simple" if you ask me. That being said, you could keep 'simple-bus' here. I would tend to err on making the schema match the actual .dts rather than updating the .dts files on older platforms like these. > For non-NAND devices this bus generally meets the definition of "an > internal I/O bus that cannot be probed for devices" where "devices on the > bus can be accessed directly without additional configuration > required". NAND flash is an exception, but those devices have > compatibles that are specific to the bus controller. NAND bindings have evolved quite a bit if you haven't been paying attention. > The fact that the address encoding is non-linear is irrelevant; the > addresses can still be translated using the standard "ranges" mechanism. > This seems to be a disconnect between the schema verification and the way > the compatible has previously been defined and used. > > And as a practical matter, unless I'm missing something (which I might be > since I haven't been in devicetree-land for nearly a decade), Linux is > relying on simple-bus to probe these devices. There is a driver that > binds to the bus itself but that is just for error interrupts and NAND. > > You'd probably need something like commit 3e25f800afb82bd9e5f8 ("memory: > fsl_ifc: populate child devices without relying on simple-bus") and the > subsequent fix in dd8adc713b1656 ("memory: fsl_ifc: populate child > nodes of buses and mfd devices")... > > I'm curious what the reasoning was for removing simple-bus from IFC. It > seems that the schema verification also played a role in that: > https://www.spinics.net/lists/devicetree/msg220418.html If a kernel change is needed to support changed .dts files, then we shouldn't be doing that here (being mature platforms). That would mean new DTB will not work with existing kernels. > > ...but there's also the comment in 985ede63a045eabf3f9d ("dt-bindings: > memory: fsl: convert ifc binding to yaml schema") that "this will help to > enforce the correct probe order between parent device and child devices", > but was that really not already guaranteed by the parent/child > relationship (and again, it should only really matter for NAND except for > the possibility of missing error reports during early boot)? > > > + compatible: > > +oneOf: > > + - items: > > + - enum: > > + - fsl,mpc8313-elbc > > + - fsl,mpc8315-elbc > > + - fsl,mpc8377-elbc > > + - fsl,mpc8378-elbc > > + - fsl,mpc8379-elbc > > + - fsl,mpc8536-elbc > > + - fsl,mpc8569-elbc > > + - fsl,mpc8572-elbc > > + - fsl,p1020-elbc > > + - fsl,p1021-elbc > > + - fsl,p1023-elbc > > + - fsl,p2020-elbc > > + - fsl,p2041-elbc > > + - fsl,p3041-elbc > > + - fsl,p4080-elbc > > + - fsl,p5020-elbc > > + - fsl,p5040-elbc > > + - const: fsl,elbc > > Is it really necessary to list every single chip? Yes. If they exist, they have to be documented. > > And then it would need to
Re: distro support for CONFIG_KUNIT: [PATCH 0/3] bitmap: convert self-test to KUnit
On Mon, Feb 10, 2025 at 3:20 PM Yury Norov wrote: > > On Mon, Feb 10, 2025 at 11:35:48AM -0800, John Hubbard wrote: > > On 2/9/25 11:54 PM, Geert Uytterhoeven wrote: > > > On Sat, 8 Feb 2025 at 18:53, Yury Norov wrote: > > > > On Fri, Feb 07, 2025 at 03:14:01PM -0500, Tamir Duberstein wrote: > > > > > On 7/27/24 12:35 AM, Shuah Khan wrote: > > ... > > > > > The crux of the argument seems to be that the config help text is > > > > > taken > > > > > to describe the author's intent with the fragment "at boot". I think > > > > > > IMO, "at boot" is a misnomer, as most tests can be either builtin > > > or modular. > > > > Right. > > > > > > > > > KUNIT is disabled in defconfig, at least on x86_64. It is also disabled > > > > on my Ubuntu 24.04 machine. If I take your patches, I'll be unable to > > > > OK so I just bought a shiny new test machine, and installed one of the > > big name distros on it, hoping they've moved ahead and bought into the kunit > > story... > > > > $ grep KUNIT /boot/config-6.8.0-52-generic > > # CONFIG_KUNIT is not set > > > > ...gagghh! No such luck. One more data point, in support of Yuri's > > complaint. :) > > > > > > > > I think distros should start setting CONFIG_KUNIT=m. > > > > Yes they should! kunit really does have important advantages for many use > > cases, including bitmaps here, and "CONFIG_KUNIT is not set" is the main > > obstacle. > > Hi John, Geert, Tamir, > > Can you please explain in details which advantages KUNIT brings to > the test_bitmap.c, find_bit_benchmark.c and other low-level tests? I can try, but I'm not the expert, and David Gow can probably elaborate further. As I understand it the main benefit of KUnit is standardization and speed (and standardization _is_ speed). KUnit makes it very easy for me, a person who has not previously contributed to any of the bitmap code, to run those tests, and it requires zero configuration, it all just works. It's basically just `tools/testing/kunit/kunit.py run bitmap`, and I get the test results in a human-readable format. The same benefit applies on the author side: test facilities are standardized, so once you get to know the tools, all the tests start to look the same: you can jump in and contribute without having to first learn the so-called local "testing framework". The important part is that this all applies to ~all other tests written in KUnit. I can even run them *all* trivially: `tools/testing/kunit/kunit.py run`. Anecdotally I've also noticed there are bots running those KUnit tests e.g. see https://lore.kernel.org/all/20250207-blackholedev-kunit-convert-v1-1-8ef0dc1ff...@gmail.com/ where a test I converted was immediately flagged by a robot as having dubious type coercion. None of these are must-haves, they are just (to me) a nice way to make the kernel more approachable for new contributors. As for pure benchmarks like find_bit_benchmark.c and test_bitmap.c::`test_bitmap_{read,write}_perf` specifically: I believe the benefits are super limited or even negative: AFAIK KUnit is designed to generally suppress output (in the userspace reporter, not in the kernel) unless a test fails, so I wouldn't hurry to use it for these. > I'm not strongly against moving under KUNIT's hat, but I do: > - respect commitment of my contributors, so I don't want to wipe git >history for no serious reason; > - respect time of my testers, so no extra dependencies; > - respect time of reviewers. These are valid concerns. Certainly the testing case is the most compelling and folks are clearly interested in lowering those barriers. I don't have any influence in this area, but I am grateful to John for starting the conversation. As I mentioned in the previous thread: I think we could keep `test_bitmap_{read,write}_perf` in test_bitmap.c and get the best of both worlds. WDYT? > Tamir, > > If it comes to v2, can you please begin your series with an exhaustive > and clear answer to the following questions: > - What do the tests miss now? > - What do _you_ need from the tests? Describe your test scenario. > - How exactly KUNIT helps you testing bitmaps and friends better? > - Is there a way to meet your needs with a less invasive approach, >particularly without run-time dependencies? Hopefully I've answered these above. I can include some of it in a v2, but perhaps the general pitch for KUnit is better placed in documentation or slides from a conference? Cheers. Tamir
[PATCH 1/2] ASoC: dt-bindings: imx-card: Add playback-only and capture-only property
Refer to audio graph card, add playback-only and capture-only property for imx-audio-card.yaml for the case that only playback or capture is supported. Signed-off-by: Shengjiu Wang --- .../devicetree/bindings/sound/imx-audio-card.yaml | 8 1 file changed, 8 insertions(+) diff --git a/Documentation/devicetree/bindings/sound/imx-audio-card.yaml b/Documentation/devicetree/bindings/sound/imx-audio-card.yaml index f7ad5ea2491e..86571fa930f6 100644 --- a/Documentation/devicetree/bindings/sound/imx-audio-card.yaml +++ b/Documentation/devicetree/bindings/sound/imx-audio-card.yaml @@ -46,6 +46,14 @@ patternProperties: description: see tdm-slot.txt. $ref: /schemas/types.yaml#/definitions/uint32 + playback-only: +description: link is used only for playback +$ref: /schemas/types.yaml#/definitions/flag + + capture-only: +description: link is used only for capture +$ref: /schemas/types.yaml#/definitions/flag + cpu: description: Holds subnode which indicates cpu dai. type: object -- 2.34.1
[PATCH 2/2] ASoC: imx-card: Add playback_only or capture_only support
With the DPCM case, the backend only support capture or playback, then the linked frontend can only support capture or playback, but frontend can't automatically enable only capture or playback, it needs the input from dt-binding. Signed-off-by: Shengjiu Wang --- sound/soc/fsl/imx-card.c | 5 + 1 file changed, 5 insertions(+) diff --git a/sound/soc/fsl/imx-card.c b/sound/soc/fsl/imx-card.c index ac043ad367ac..905294682996 100644 --- a/sound/soc/fsl/imx-card.c +++ b/sound/soc/fsl/imx-card.c @@ -518,6 +518,7 @@ static int imx_card_parse_of(struct imx_card_data *data) struct snd_soc_dai_link *link; struct dai_link_data *link_data; struct of_phandle_args args; + bool playback_only, capture_only; int ret, num_links; u32 asrc_fmt = 0; u32 width; @@ -679,6 +680,10 @@ static int imx_card_parse_of(struct imx_card_data *data) link->ops = &imx_aif_ops; } + graph_util_parse_link_direction(np, &playback_only, &capture_only); + link->playback_only = playback_only; + link->capture_only = capture_only; + /* Get dai fmt */ ret = simple_util_parse_daifmt(dev, np, codec, NULL, &link->dai_fmt); -- 2.34.1
Re: distro support for CONFIG_KUNIT: [PATCH 0/3] bitmap: convert self-test to KUnit
On Tue, 11 Feb 2025 at 04:20, Yury Norov wrote: > > On Mon, Feb 10, 2025 at 11:35:48AM -0800, John Hubbard wrote: > > On 2/9/25 11:54 PM, Geert Uytterhoeven wrote: > > > On Sat, 8 Feb 2025 at 18:53, Yury Norov wrote: > > > > On Fri, Feb 07, 2025 at 03:14:01PM -0500, Tamir Duberstein wrote: > > > > > On 7/27/24 12:35 AM, Shuah Khan wrote: > > ... > > > > > The crux of the argument seems to be that the config help text is > > > > > taken > > > > > to describe the author's intent with the fragment "at boot". I think > > > > > > IMO, "at boot" is a misnomer, as most tests can be either builtin > > > or modular. > > > > Right. > > > > > > > > > KUNIT is disabled in defconfig, at least on x86_64. It is also disabled > > > > on my Ubuntu 24.04 machine. If I take your patches, I'll be unable to > > > > OK so I just bought a shiny new test machine, and installed one of the > > big name distros on it, hoping they've moved ahead and bought into the kunit > > story... > > > > $ grep KUNIT /boot/config-6.8.0-52-generic > > # CONFIG_KUNIT is not set > > > > ...gagghh! No such luck. One more data point, in support of Yuri's > > complaint. :) > > > > > > > > I think distros should start setting CONFIG_KUNIT=m. > > > > Yes they should! kunit really does have important advantages for many use > > cases, including bitmaps here, and "CONFIG_KUNIT is not set" is the main > > obstacle. > > Hi John, Geert, Tamir, > > Can you please explain in details which advantages KUNIT brings to > the test_bitmap.c, find_bit_benchmark.c and other low-level tests? > First, I'd agree with Tamir and others who've pointed out that KUnit is not really intended for benchmarks, so I definitely don't want to oversell it for find_bit_benchmark.c and others (though it has been used for benchmarks in a few cases, it's not perfect). The main advantages of KUnit are that: - it's already used for a bunch of lib/ tests (so quite familiar to a number of contributors/users), - tests can be run at boot without needing any userspace at all (if built-in), - KUnit tests are already being automatically run as regression tests, and it's relatively easy to run "all tests" associated with a config - there's a whole bunch of tooling which automates configuring, building, and running a kernel with these tests, across several architectures (e.g., passing --arch arm64 or --arch m68k to automatically build and run the tests in QEMU for those architectures) - there's tooling to nicely print, format, and summarise the results of any number of suites. - and, as a result of the above, it's very quick and easy to run a test (or whole bunch of tests) in an isolated environment. KUnit also has very few runtime dependencies from a developer point-of-view (python, optionally QEMU). It is, however, less focused on the "debug a running system" case, hence the requirement for CONFIG_KUNIT to be enabled, and the tooling largely being focused on the "run all of the tests in UML or a VM" case. > I'm not strongly against moving under KUNIT's hat, but I do: > - respect commitment of my contributors, so I don't want to wipe git >history for no serious reason; It should be possible to preserve the git history during a port, though it admittedly will have a bunch of porting changes which make it more difficult to navigate with git blame. But it should at least be better than a total wipe. > - respect time of my testers, so no extra dependencies; I think KUnit is a bit of a mixed bag here. In many cases, KUnit tests can be run pretty quickly, either because the tester's environment already has CONFIG_KUNIT enabled, or possibly under some kind of virtualization with the tooling (either QEMU, or on x86, User-Mode-Linux). But, as mentioned above, I'd not consider it ideal for performance testing. I am very sympathetic to not wanting to add a dependency here. I think KUnit is a pretty minimal dependency as far as they go (it selects CONFIG_GLOB and nothing else, needs no userspace, and even the tooling only really requires python on top of the basic toolchain), but it's definitely a further dependency for the 'test-the-currently-running-kernel' use-case. > - respect time of reviewers. This is an area where I think KUnit could be an advantage, as it'd be easy for reviewers to simply run ./tools/testing/kunit/kunit.py run bitmap as a spot check on the code. And if they want to test on other architectures, the --arch option can be used to do so quickly. (And, of course, it can still be loaded as a module (or even built-in) on a physical system or other VM, albeit with the requirement for CONFIG_KUNIT.) As for distros enabling CONFIG_KUNIT by default, as mentioned, my understanding is that the Fedora/Red Hat distros are doing it, as are some branches of Android, but I doubt anyone else is. This makes sense: enabling CONFIG_KUNIT isn't free (though the overhead should be very low if no test is running, just a few static branches and an extra check in the module loader), and
[PATCH 0/2] ASoC: imx-card: support playback or capture only
Be similar to audio graph card, support playback or capture only for imx-audio-card. Shengjiu Wang (2): ASoC: dt-bindings: imx-card: Add playback-only and capture-only property ASoC: imx-card: Add playback_only or capture_only support .../devicetree/bindings/sound/imx-audio-card.yaml | 8 sound/soc/fsl/imx-card.c | 5 + 2 files changed, 13 insertions(+) -- 2.34.1
Re: distro support for CONFIG_KUNIT: [PATCH 0/3] bitmap: convert self-test to KUnit
On Mon, Feb 10, 2025 at 12:46 PM David Hildenbrand wrote: > > On 10.02.25 20:35, John Hubbard wrote: > > On 2/9/25 11:54 PM, Geert Uytterhoeven wrote: > >> On Sat, 8 Feb 2025 at 18:53, Yury Norov wrote: > >>> On Fri, Feb 07, 2025 at 03:14:01PM -0500, Tamir Duberstein wrote: > On 7/27/24 12:35 AM, Shuah Khan wrote: > > ... > The crux of the argument seems to be that the config help text is taken > to describe the author's intent with the fragment "at boot". I think > >> > >> IMO, "at boot" is a misnomer, as most tests can be either builtin > >> or modular. > > > > Right. > > > >> > >>> KUNIT is disabled in defconfig, at least on x86_64. It is also disabled > >>> on my Ubuntu 24.04 machine. If I take your patches, I'll be unable to > > > > OK so I just bought a shiny new test machine, and installed one of the > > big name distros on it, hoping they've moved ahead and bought into the kunit > > story... > > > > $ grep KUNIT /boot/config-6.8.0-52-generic > > # CONFIG_KUNIT is not set > > > > ...gagghh! No such luck. One more data point, in support of Yuri's > > complaint. :) > > > >> > >> I think distros should start setting CONFIG_KUNIT=m. > > > > Yes they should! kunit really does have important advantages for many use > > cases, including bitmaps here, and "CONFIG_KUNIT is not set" is the main > > obstacle. > > > Let me add a few people to Cc who might be able to influence some > distros. > > > > thanks, > > > Fedora has it. > > CS-10 has it (-> RHEL-10): > redhat/configs/common/generic/CONFIG_KUNIT:CONFIG_KUNIT=m > > https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-10/-/blob/main/redhat/configs/common/generic/CONFIG_KUNIT?ref_type=heads > > CS-9 has it (-> RHEL-9): > redhat/configs/common/generic/CONFIG_KUNIT:CONFIG_KUNIT=m > > https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/blob/main/redhat/configs/common/generic/CONFIG_KUNIT?ref_type=heads > > So I think from the RH side everything is properly set? > > Let me CC Nico, he did some KUNIT work in the past. Yeah that is correct! I enabled KUNIT in our environments a few years ago. We enable it as a module and use our own wrapper to exercise the code. For RHEL and Centos these kunit modules are only shipped internally for testing; However fedora-rawhide makes these modules available in the kernel-modules-internal package. To test this you can follow this to install rawhide-vm: https://developer.fedoraproject.org/tools/virt-builder/about.html then inside the vm: yum install kernel-modules-internal add the kunit.enable=1 to the cmdline reboot vm modprobe kunit modprobe Hopefully that helps! -- Nico > > > -- > Cheers, > > David / dhildenb >
Re: [PATCH] powerpc/crash: Fix non-smp kexec preparation
Le 10/02/2025 à 20:52, Eddie James a écrit : [Vous ne recevez pas souvent de courriers de eaja...@linux.ibm.com. Découvrez pourquoi ceci est important à https://aka.ms/LearnAboutSenderIdentification ] In non-smp configurations, crash_kexec_prepare is never called in the crash shutdown path. One result of this is that the crashing_cpu variable is never set, preventing crash_save_cpu from storing the NT_PRSTATUS elf note in the core dump. Fixes: c7255058b543 ("powerpc/crash: save cpu register data in crash_smp_send_stop()") Signed-off-by: Eddie James --- arch/powerpc/kexec/crash.c | 4 1 file changed, 4 insertions(+) diff --git a/arch/powerpc/kexec/crash.c b/arch/powerpc/kexec/crash.c index 9ac3266e49652..8c11cfd19e734 100644 --- a/arch/powerpc/kexec/crash.c +++ b/arch/powerpc/kexec/crash.c @@ -359,7 +359,11 @@ void default_machine_crash_shutdown(struct pt_regs *regs) if (TRAP(regs) == INTERRUPT_SYSTEM_RESET) is_via_system_reset = 1; +#ifdef CONFIG_SMP I see no obvious reason to use #ifdef instead of IS_ENABLED(CONFIG_SMP), is there any ? Ref https://docs.kernel.org/process/coding-style.html#conditional-compilation crash_smp_send_stop(); +#else + crash_kexec_prepare(); +#endif crash_save_cpu(regs, crashing_cpu); -- 2.43.5
Re: [PATCH v3 2/4] powerpc/fadump: fix additional param memory reservation for HASH MMU
On 10/02/25 12:48, Hari Bathini wrote: Hi Sourabh, On 23/01/25 5:12 pm, Sourabh Jain wrote: Commit 683eab94da75bc ("powerpc/fadump: setup additional parameters for dump capture kernel") introduced the additional parameter feature in fadump for HASH MMU with the understanding that GRUB does not use the memory area between 640MB and 768MB for its operation. However, the third patch in this series ("powerpc: increase MIN RMA size for CAS negotiation") changes the MIN RMA size to 768MB, allowing GRUB to use memory up to 768MB. This makes the fadump reservation for the additional parameter feature for HASH MMU unreliable. To address this, adjust the memory range for the additional parameter in fadump for HASH MMU. This will ensure that GRUB does not overwrite the memory reserved for fadump's additional parameter in HASH MMU. The new policy for the memory range for the additional parameter in HASH MMU is that the first memory block must be larger than the MIN_RMA size, as the bootloader can use memory up to the MIN_RMA size. The range should be between MIN_RMA and the RMA size (ppc64_rma_size), and it must not overlap with the fadump reserved area. Cc: Avnish Chouhan Cc: Brian King Cc: Hari Bathini Cc: Madhavan Srinivasan Cc: Michael Ellerman Reviewed-by: Mahesh Salgaonkar Signed-off-by: Sourabh Jain --- arch/powerpc/kernel/fadump.c | 21 +++-- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/arch/powerpc/kernel/fadump.c b/arch/powerpc/kernel/fadump.c index 4b371c738213..26e3d151e048 100644 --- a/arch/powerpc/kernel/fadump.c +++ b/arch/powerpc/kernel/fadump.c @@ -33,6 +33,7 @@ #include #include #include +#include /* * The CPU who acquired the lock to trigger the fadump crash should @@ -1764,19 +1765,19 @@ void __init fadump_setup_param_area(void) range_end = memblock_end_of_DRAM(); } else { /* - * Passing additional parameters is supported for hash MMU only - * if the first memory block size is 768MB or higher. + * Memory range for passing additional parameters for HASH MMU + * must meet the following conditions: + * 1. The first memory block size must be higher than the + * minimum RMA (MIN_RMA) size. Bootloader can use memory + * upto RMA size. So it should be avoided. I believe you mean "upto MIN_RMA size." here? Yeah it should MIN_RMA. Rest looks good. Reviewed-by: Hari Bathini Thanks for the review. - Sourabh Jain
distro support for CONFIG_KUNIT: [PATCH 0/3] bitmap: convert self-test to KUnit
On 2/9/25 11:54 PM, Geert Uytterhoeven wrote: On Sat, 8 Feb 2025 at 18:53, Yury Norov wrote: On Fri, Feb 07, 2025 at 03:14:01PM -0500, Tamir Duberstein wrote: On 7/27/24 12:35 AM, Shuah Khan wrote: ... The crux of the argument seems to be that the config help text is taken to describe the author's intent with the fragment "at boot". I think IMO, "at boot" is a misnomer, as most tests can be either builtin or modular. Right. KUNIT is disabled in defconfig, at least on x86_64. It is also disabled on my Ubuntu 24.04 machine. If I take your patches, I'll be unable to OK so I just bought a shiny new test machine, and installed one of the big name distros on it, hoping they've moved ahead and bought into the kunit story... $ grep KUNIT /boot/config-6.8.0-52-generic # CONFIG_KUNIT is not set ...gagghh! No such luck. One more data point, in support of Yuri's complaint. :) I think distros should start setting CONFIG_KUNIT=m. Yes they should! kunit really does have important advantages for many use cases, including bitmaps here, and "CONFIG_KUNIT is not set" is the main obstacle. Let me add a few people to Cc who might be able to influence some distros. thanks, -- John Hubbard
[PATCH] powerpc/crash: Fix non-smp kexec preparation
In non-smp configurations, crash_kexec_prepare is never called in the crash shutdown path. One result of this is that the crashing_cpu variable is never set, preventing crash_save_cpu from storing the NT_PRSTATUS elf note in the core dump. Fixes: c7255058b543 ("powerpc/crash: save cpu register data in crash_smp_send_stop()") Signed-off-by: Eddie James --- arch/powerpc/kexec/crash.c | 4 1 file changed, 4 insertions(+) diff --git a/arch/powerpc/kexec/crash.c b/arch/powerpc/kexec/crash.c index 9ac3266e49652..8c11cfd19e734 100644 --- a/arch/powerpc/kexec/crash.c +++ b/arch/powerpc/kexec/crash.c @@ -359,7 +359,11 @@ void default_machine_crash_shutdown(struct pt_regs *regs) if (TRAP(regs) == INTERRUPT_SYSTEM_RESET) is_via_system_reset = 1; +#ifdef CONFIG_SMP crash_smp_send_stop(); +#else + crash_kexec_prepare(); +#endif crash_save_cpu(regs, crashing_cpu); -- 2.43.5