* Re: [PATCH v2 3/3] powerpc/numa: Support coregroup on PowerNV
From: Ritesh Harjani @ 2026-07-10 5:48 UTC (permalink / raw)
To: Srikar Dronamraju, linuxppc-dev, Madhavan Srinivasan,
Michael Ellerman, Nicholas Piggin, Christophe Leroy, Naveen N Rao
Cc: skiboot, arbab, mahesh, chleroy, Srikar Dronamraju, linux-kernel
In-Reply-To: <20260605055242.1757485-8-srikar@linux.ibm.com>
Srikar Dronamraju <srikar@linux.ibm.com> writes:
> Coregroup support on powerpc has so far been limited to PowerVM LPARs.
> However, PowerNV can also support coregroups when firmware exposes the
> required coregroup information through the associativity hierarchy.
>
> Detect coregroup support by checking whether primary_domain_index is the
> penultimate domain in the CPU node's ibm,associativity property. On
> PowerNV, a non-penultimate primary_domain_index indicates that firmware
> provides an additional level for coregroup information.
>
> This keeps the logic compatible with PowerVM systems, where
> primary_domain_index is likewise not the penultimate associativity
> domain.
>
> Signed-off-by: Srikar Dronamraju <srikar@linux.ibm.com>
> ---
> Changelog from v1: https://lkml.kernel.org/r/20260524010017.140408-1-srikar@linux.ibm.com
> - Handle comments from Christophe Leroy; make code more flat
>
> arch/powerpc/mm/numa.c | 56 ++++++++++++++++++++++++++++++++++--------
> 1 file changed, 46 insertions(+), 10 deletions(-)
>
> diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
> index 9aa71eb7e96b..e97b624203ea 100644
> --- a/arch/powerpc/mm/numa.c
> +++ b/arch/powerpc/mm/numa.c
> @@ -889,12 +889,32 @@ static int __init numa_setup_drmem_lmb(struct drmem_lmb *lmb,
> return 0;
> }
>
> +/*
> + * If hierarchy extends beyond primary_domain_index + 1, then next
> + * level corresponds to coregroup.
> + */
> +static int detect_and_enable_coregroup(const __be32 *associativity, int index)
Do we care about it's return value? We are not reading that in the
patch.
this function is mainly only needed in __init, can we mark it so.
> +{
> + if (!associativity || index == -1)
> + goto out;
> +
> + index = of_read_number(associativity, 1);
> +
> + if (index > primary_domain_index + 1) {
> + coregroup_enabled = 1;
> + return index;
> + }
> +out:
> + coregroup_enabled = 0;
> + return -1;
> +}
For PowerVM, we now have two places which will enable coregroup_enabled
during mem_topology_setup(). Is there some way we can unify that?
This also means we enable coregroup in case of PowerVM with SPLPAR when
per-cpu VPHN associativity index > primary_domain_index+1. But this
isn't reflected in your commit msg. The commit msg only says this
affects PowerNV.
setup_arch
mem_topology_setup
parse_numa_properties
detect_and_enable_coregroup() {...
// coregroup_enabled = 0/1
index = of_read_number(associativity, 1);
if (index > primary_domain_index + 1) {
coregroup_enabled = 1;
return index;
}
}
<...>
find_possible_nodes() {...
prop_length /= sizeof(int);
if (prop_length > primary_domain_index + 2)
coregroup_enabled = 1;
}
> +
> static int __init parse_numa_properties(void)
> {
> struct device_node *memory, *pci;
> - int default_nid = 0;
> - unsigned long i;
> + int default_nid = 0, index = 0;
> const __be32 *associativity;
> + unsigned long i;
>
> if (numa_enabled == 0) {
> pr_warn("disabled by user\n");
> @@ -927,7 +947,6 @@ static int __init parse_numa_properties(void)
> */
> for_each_present_cpu(i) {
> __be32 vphn_assoc[VPHN_ASSOC_BUFSIZE];
> - struct device_node *cpu;
> int nid = NUMA_NO_NODE;
>
> memset(vphn_assoc, 0, VPHN_ASSOC_BUFSIZE * sizeof(__be32));
> @@ -935,7 +954,9 @@ static int __init parse_numa_properties(void)
> if (__vphn_get_associativity(i, vphn_assoc) == 0) {
> nid = associativity_to_nid(vphn_assoc);
> initialize_form1_numa_distance(vphn_assoc);
> + index = detect_and_enable_coregroup(vphn_assoc, index);
> } else {
> + struct device_node *cpu;
>
> /*
> * Don't fall back to default_nid yet -- we will plug
> @@ -948,6 +969,7 @@ static int __init parse_numa_properties(void)
> associativity = of_get_associativity(cpu);
> if (associativity) {
> nid = associativity_to_nid(associativity);
> + index = detect_and_enable_coregroup(associativity, index);
> initialize_form1_numa_distance(associativity);
> }
> of_node_put(cpu);
> @@ -1445,7 +1467,9 @@ static long vphn_get_associativity(unsigned long cpu,
>
> int cpu_to_coregroup_id(int cpu)
> {
> - __be32 associativity[VPHN_ASSOC_BUFSIZE] = {0};
> + int coregroup_id = cpu_to_core_id(cpu);
> + struct device_node *cpunode = NULL;
> + const __be32 *associativity;
> int index;
>
> if (cpu < 0 || cpu > nr_cpu_ids)
> @@ -1454,19 +1478,31 @@ int cpu_to_coregroup_id(int cpu)
> if (!coregroup_enabled)
> goto out;
>
> - if (!firmware_has_feature(FW_FEATURE_VPHN))
> - goto out;
> + if (firmware_has_feature(FW_FEATURE_VPHN)) {
> + __be32 tmp[VPHN_ASSOC_BUFSIZE] = {0};
>
> - if (vphn_get_associativity(cpu, associativity))
> + if (vphn_get_associativity(cpu, tmp))
> + goto out;
> +
> + associativity = tmp;
> +
> + } else {
> + cpunode = of_get_cpu_node(cpu, NULL);
> + if (!cpunode)
> + goto out;
> +
> + associativity = of_get_associativity(cpunode);
> + }
> + if (!associativity)
> goto out;
>
> index = of_read_number(associativity, 1);
> if (index > primary_domain_index + 1)
> - return of_read_number(&associativity[index - 1], 1);
> + coregroup_id = of_read_number(&associativity[index - 1], 1);
>
> out:
> - return cpu_to_core_id(cpu);
> -}
Looks like leftover removed from previous patch. This change should be
fixed in patch-2 itself.
> + if (cpunode)
> + of_node_put(cpunode);
>
> return coregroup_id;
> }
> --
> 2.43.0
-ritesh
^ permalink raw reply
* Re: [PATCH v2 03/10] dt-bindings: soc: fsl: qe: Convert QE GPIO to DT schema
From: Krzysztof Kozlowski @ 2026-07-10 10:28 UTC (permalink / raw)
To: Paul Louvel
Cc: Qiang Zhao, Christophe Leroy (CS GROUP), Thomas Gleixner,
Rob Herring, Krzysztof Kozlowski, Conor Dooley, Linus Walleij,
Bartosz Golaszewski, Madhavan Srinivasan, Michael Ellerman,
Nicholas Piggin, linuxppc-dev, linux-arm-kernel, linux-kernel,
devicetree, linux-gpio, Herve Codina
In-Reply-To: <20260708-qe-pic-gpios-v2-3-1972044cfbd1@bootlin.com>
On Wed, Jul 08, 2026 at 12:15:16PM +0200, Paul Louvel wrote:
> From: Christophe Leroy <christophe.leroy@csgroup.eu>
>
> Convert QE GPIO devicetree binding to DT schema. The old binding uses
> fsl,<chip>-qe-pario-bank because multiple MCP83XX SoC has support for
> these GPIO banks. The best practice is to list out every <chip> instead.
>
> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
> Signed-off-by: Paul Louvel <paul.louvel@bootlin.com>
> ---
> .../bindings/gpio/fsl,mpc8323-qe-pario-bank.yaml | 45 ++++++++++++++++++++++
> .../bindings/soc/fsl/cpm_qe/qe/par_io.txt | 26 +------------
> 2 files changed, 46 insertions(+), 25 deletions(-)
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Best regards,
Krzysztof
^ permalink raw reply
* Re: [PATCH v2 04/10] dt-bindings: soc: fsl: qe: Add support of IRQ in QE GPIO
From: Krzysztof Kozlowski @ 2026-07-10 10:28 UTC (permalink / raw)
To: Paul Louvel
Cc: Qiang Zhao, Christophe Leroy (CS GROUP), Thomas Gleixner,
Rob Herring, Krzysztof Kozlowski, Conor Dooley, Linus Walleij,
Bartosz Golaszewski, Madhavan Srinivasan, Michael Ellerman,
Nicholas Piggin, linuxppc-dev, linux-arm-kernel, linux-kernel,
devicetree, linux-gpio, Herve Codina
In-Reply-To: <20260708-qe-pic-gpios-v2-4-1972044cfbd1@bootlin.com>
On Wed, Jul 08, 2026 at 12:15:17PM +0200, Paul Louvel wrote:
> Some QE GPIO pins have an associated interrupt line in the QE PIC to
> signal state changes on the pin. Add the corresponding
> interrupt-controller / nexus properties to the QE GPIO binding.
>
> Because the GPIO controller does not perform any interrupt handling
> itself, a nexus node (interrupt-map) is used to map each GPIO line
> supporting IRQ to the parent QE PIC interrupt domain.
>
> As the QE PIC can be configured to generate an interrupt on either a
> high-to-low transition or any change in signal state, three
> interrupt-map entries are needed per GPIO pin that can yield an
> interrupt (falling, both, and the "none" case which defaults to both in
> QE PIC). This overhead is necessary because the interrupt-map-pass-thru
> property is not part of the DT specification.
>
> The interrupt-map property is optional: it is not required for GPIO
> banks that have no interrupt capable GPIO line (e.g. port D on MPC8323),
> or when interrupt functionality is not used.
>
> Update the example to show a scenario where each bank supports a
> different numbers of IRQs, or no IRQs at all.
>
> Signed-off-by: Paul Louvel <paul.louvel@bootlin.com>
> ---
> .../bindings/gpio/fsl,mpc8323-qe-pario-bank.yaml | 39 ++++++++++++++++++++++
> 1 file changed, 39 insertions(+)
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Best regards,
Krzysztof
^ permalink raw reply
* Re: [patch 12/18] ptrace, treewide: Rename ptrace_report_syscall_entry() to ptrace_report_syscall_permit_entry()
From: Michal Suchánek @ 2026-07-10 10:42 UTC (permalink / raw)
To: Thomas Gleixner
Cc: LKML, Peter Zijlstra, Arnd Bergmann, Oleg Nesterov,
Richard Henderson, Vineet Gupta, Russell King, Catalin Marinas,
Will Deacon, Guo Ren, Brian Cain, Geert Uytterhoeven,
Michal Simek, Thomas Bogendoerfer, Dinh Nguyen, Helge Deller,
Yoshinori Sato, David S. Miller, Andreas Larsson, Chris Zankel,
linux-alpha, linux-snps-arc, linux-arm-kernel, linux-csky,
linux-hexagon, linux-m68k, linux-mips, linux-openrisc,
linux-parisc, linux-sh, sparclinux, linux-um, linux-arch,
Michael Ellerman, Shrikanth Hegde, linuxppc-dev, Kees Cook,
Huacai Chen, loongarch, Paul Walmsley, Palmer Dabbelt,
linux-riscv, Sven Schnelle, linux-s390, x86, Mark Rutland,
Jinjie Ruan, Andy Lutomirski, Richard Weinberger, Jonathan Corbet,
linux-doc
In-Reply-To: <20260707190254.280015701@kernel.org>
Hello,
why is the syscall -1 special-cased here?
Wouldn't any invalid syscall number such as -2 work equally well, making
this whole 'permit' pinned on the -1 value bogus?
On Tue, Jul 07, 2026 at 09:06:44PM +0200, Thomas Gleixner wrote:
> The return value of that function is boolean and tells the caller whether
> to permit the syscall processing or not.
>
> Rename the function so the purpose is clear and make the return type bool.
>
> Signed-off-by: Thomas Gleixner <tglx@kernel.org>
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: Oleg Nesterov <oleg@redhat.com>
> Cc: Richard Henderson <richard.henderson@linaro.org>
> Cc: Vineet Gupta <vgupta@kernel.org>
> Cc: Russell King <linux@armlinux.org.uk>
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Will Deacon <will@kernel.org>
> Cc: Guo Ren <guoren@kernel.org>
> Cc: Brian Cain <bcain@kernel.org>
> Cc: Geert Uytterhoeven <geert@linux-m68k.org>
> Cc: Michal Simek <monstr@monstr.eu>
> Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
> Cc: Dinh Nguyen <dinguyen@kernel.org>
> Cc: Helge Deller <deller@gmx.de>
> Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: Andreas Larsson <andreas@gaisler.com>
> Cc: Chris Zankel <chris@zankel.net>
> Cc: linux-alpha@vger.kernel.org
> Cc: linux-snps-arc@lists.infradead.org
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: linux-csky@vger.kernel.org
> Cc: linux-hexagon@vger.kernel.org
> Cc: linux-m68k@lists.linux-m68k.org
> Cc: linux-mips@vger.kernel.org
> Cc: linux-openrisc@vger.kernel.org
> Cc: linux-parisc@vger.kernel.org
> Cc: linux-sh@vger.kernel.org
> Cc: sparclinux@vger.kernel.org
> Cc: linux-um@lists.infradead.org
> Cc: linux-arch@vger.kernel.org
> ---
> arch/alpha/kernel/ptrace.c | 2 +-
> arch/arc/kernel/ptrace.c | 2 +-
> arch/arm/kernel/ptrace.c | 2 +-
> arch/arm64/kernel/ptrace.c | 2 +-
> arch/csky/kernel/ptrace.c | 2 +-
> arch/hexagon/kernel/traps.c | 2 +-
> arch/m68k/kernel/ptrace.c | 2 +-
> arch/microblaze/kernel/ptrace.c | 2 +-
> arch/mips/kernel/ptrace.c | 2 +-
> arch/nios2/kernel/ptrace.c | 2 +-
> arch/openrisc/kernel/ptrace.c | 2 +-
> arch/parisc/kernel/ptrace.c | 10 ++++------
> arch/sh/kernel/ptrace_32.c | 2 +-
> arch/sparc/kernel/ptrace_32.c | 2 +-
> arch/sparc/kernel/ptrace_64.c | 2 +-
> arch/um/kernel/ptrace.c | 2 +-
> arch/xtensa/kernel/ptrace.c | 2 +-
> include/asm-generic/syscall.h | 4 ++--
> include/linux/entry-common.h | 25 ++++++++++++-------------
> include/linux/ptrace.h | 13 ++++++-------
> 20 files changed, 40 insertions(+), 44 deletions(-)
>
> --- a/arch/alpha/kernel/ptrace.c
> +++ b/arch/alpha/kernel/ptrace.c
> @@ -375,7 +375,7 @@ asmlinkage unsigned long syscall_trace_e
> struct pt_regs *regs = current_pt_regs();
>
> if (test_thread_flag(TIF_SYSCALL_TRACE) &&
> - ptrace_report_syscall_entry(regs)) {
> + !ptrace_report_syscall_permit_entry(regs)) {
> syscall_set_nr(current, regs, -1);
Why is this done here?
Presumably the ptrace_report_syscall_entry returns false here becasue
the tracer put -1 into whatever register specifies the syscall number
(or it was there to start with) which was then read back, compared to
-1, leading to returning false. Now it's set to -1 again?
Thanks
Michal
> if (regs->r19 == 0 && regs->r0 == (unsigned long)-1)
> syscall_set_return_value(current, regs, -ENOSYS, 0);
> --- a/arch/arc/kernel/ptrace.c
> +++ b/arch/arc/kernel/ptrace.c
> @@ -342,7 +342,7 @@ long arch_ptrace(struct task_struct *chi
> asmlinkage int syscall_trace_enter(struct pt_regs *regs)
> {
> if (test_thread_flag(TIF_SYSCALL_TRACE))
> - if (ptrace_report_syscall_entry(regs))
> + if (!ptrace_report_syscall_permit_entry(regs))
> return ULONG_MAX;
>
> #ifdef CONFIG_HAVE_SYSCALL_TRACEPOINTS
> --- a/arch/arm/kernel/ptrace.c
> +++ b/arch/arm/kernel/ptrace.c
> @@ -840,7 +840,7 @@ static void report_syscall(struct pt_reg
>
> if (dir == PTRACE_SYSCALL_EXIT)
> ptrace_report_syscall_exit(regs, 0);
> - else if (ptrace_report_syscall_entry(regs))
> + else if (!ptrace_report_syscall_permit_entry(regs))
> current_thread_info()->abi_syscall = -1;
>
> regs->ARM_ip = ip;
> --- a/arch/arm64/kernel/ptrace.c
> +++ b/arch/arm64/kernel/ptrace.c
> @@ -2379,7 +2379,7 @@ static int report_syscall_entry(struct p
> int regno, ret;
>
> saved_reg = ptrace_save_reg(regs, PTRACE_SYSCALL_ENTER, ®no);
> - ret = ptrace_report_syscall_entry(regs);
> + ret = !ptrace_report_syscall_permit_entry(regs);
> if (ret)
> forget_syscall(regs);
> regs->regs[regno] = saved_reg;
> --- a/arch/csky/kernel/ptrace.c
> +++ b/arch/csky/kernel/ptrace.c
> @@ -320,7 +320,7 @@ long arch_ptrace(struct task_struct *chi
> asmlinkage int syscall_trace_enter(struct pt_regs *regs)
> {
> if (test_thread_flag(TIF_SYSCALL_TRACE))
> - if (ptrace_report_syscall_entry(regs))
> + if (!ptrace_report_syscall_permit_entry(regs))
> return -1;
>
> if (!seccomp_permit_syscall())
> --- a/arch/hexagon/kernel/traps.c
> +++ b/arch/hexagon/kernel/traps.c
> @@ -345,7 +345,7 @@ void do_trap0(struct pt_regs *regs)
>
> /* allow strace to catch syscall args */
> if (unlikely(test_thread_flag(TIF_SYSCALL_TRACE) &&
> - ptrace_report_syscall_entry(regs)))
> + !ptrace_report_syscall_permit_entry(regs)))
> return; /* return -ENOSYS somewhere? */
>
> /* Interrupts should be re-enabled for syscall processing */
> --- a/arch/m68k/kernel/ptrace.c
> +++ b/arch/m68k/kernel/ptrace.c
> @@ -279,7 +279,7 @@ asmlinkage int syscall_trace_enter(void)
> int ret = 0;
>
> if (test_thread_flag(TIF_SYSCALL_TRACE))
> - ret = ptrace_report_syscall_entry(task_pt_regs(current));
> + ret = !ptrace_report_syscall_permit_entry(task_pt_regs(current));
>
> if (!seccomp_permit_syscall())
> return -1;
> --- a/arch/microblaze/kernel/ptrace.c
> +++ b/arch/microblaze/kernel/ptrace.c
> @@ -139,7 +139,7 @@ asmlinkage unsigned long do_syscall_trac
> secure_computing_strict(regs->r12);
>
> if (test_thread_flag(TIF_SYSCALL_TRACE) &&
> - ptrace_report_syscall_entry(regs))
> + !ptrace_report_syscall_permit_entry(regs))
> /*
> * Tracing decided this syscall should not happen.
> * We'll return a bogus call number to get an ENOSYS
> --- a/arch/mips/kernel/ptrace.c
> +++ b/arch/mips/kernel/ptrace.c
> @@ -1324,7 +1324,7 @@ asmlinkage long syscall_trace_enter(stru
> user_exit();
>
> if (test_thread_flag(TIF_SYSCALL_TRACE)) {
> - if (ptrace_report_syscall_entry(regs))
> + if (!ptrace_report_syscall_permit_entry(regs))
> return -1;
> }
>
> --- a/arch/nios2/kernel/ptrace.c
> +++ b/arch/nios2/kernel/ptrace.c
> @@ -133,7 +133,7 @@ asmlinkage int do_syscall_trace_enter(vo
> int ret = 0;
>
> if (test_thread_flag(TIF_SYSCALL_TRACE))
> - ret = ptrace_report_syscall_entry(task_pt_regs(current));
> + ret = !ptrace_report_syscall_permit_entry(task_pt_regs(current));
>
> return ret;
> }
> --- a/arch/openrisc/kernel/ptrace.c
> +++ b/arch/openrisc/kernel/ptrace.c
> @@ -293,7 +293,7 @@ asmlinkage long do_syscall_trace_enter(s
> long ret = 0;
>
> if (test_thread_flag(TIF_SYSCALL_TRACE) &&
> - ptrace_report_syscall_entry(regs))
> + !ptrace_report_syscall_permit_entry(regs))
> /*
> * Tracing decided this syscall should not happen.
> * We'll return a bogus call number to get an ENOSYS
> --- a/arch/parisc/kernel/ptrace.c
> +++ b/arch/parisc/kernel/ptrace.c
> @@ -326,7 +326,7 @@ long compat_arch_ptrace(struct task_stru
> long do_syscall_trace_enter(struct pt_regs *regs)
> {
> if (test_thread_flag(TIF_SYSCALL_TRACE)) {
> - int rc = ptrace_report_syscall_entry(regs);
> + bool permit = ptrace_report_syscall_permit_entry(regs);
>
> /*
> * As tracesys_next does not set %r28 to -ENOSYS
> @@ -334,12 +334,10 @@ long do_syscall_trace_enter(struct pt_re
> */
> regs->gr[28] = -ENOSYS;
>
> - if (rc) {
> + if (!permit) {
> /*
> - * A nonzero return code from
> - * ptrace_report_syscall_entry() tells us
> - * to prevent the syscall execution. Skip
> - * the syscall call and the syscall restart handling.
> + * Skip the syscall call and the syscall restart
> + * handling.
> *
> * Note that the tracer may also just change
> * regs->gr[20] to an invalid syscall number,
> --- a/arch/sh/kernel/ptrace_32.c
> +++ b/arch/sh/kernel/ptrace_32.c
> @@ -455,7 +455,7 @@ long arch_ptrace(struct task_struct *chi
> asmlinkage long do_syscall_trace_enter(struct pt_regs *regs)
> {
> if (test_thread_flag(TIF_SYSCALL_TRACE) &&
> - ptrace_report_syscall_entry(regs)) {
> + !ptrace_report_syscall_permit_entry(regs)) {
> regs->regs[0] = -ENOSYS;
> return -1;
> }
> --- a/arch/sparc/kernel/ptrace_32.c
> +++ b/arch/sparc/kernel/ptrace_32.c
> @@ -441,7 +441,7 @@ asmlinkage int syscall_trace(struct pt_r
> if (syscall_exit_p)
> ptrace_report_syscall_exit(regs, 0);
> else
> - ret = ptrace_report_syscall_entry(regs);
> + ret = !ptrace_report_syscall_permit_entry(regs);
> }
>
> return ret;
> --- a/arch/sparc/kernel/ptrace_64.c
> +++ b/arch/sparc/kernel/ptrace_64.c
> @@ -1093,7 +1093,7 @@ asmlinkage int syscall_trace_enter(struc
> user_exit();
>
> if (test_thread_flag(TIF_SYSCALL_TRACE))
> - ret = ptrace_report_syscall_entry(regs);
> + ret = !ptrace_report_syscall_permit_entry(regs);
>
> if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT)))
> trace_sys_enter(regs, regs->u_regs[UREG_G1]);
> --- a/arch/um/kernel/ptrace.c
> +++ b/arch/um/kernel/ptrace.c
> @@ -135,7 +135,7 @@ int syscall_trace_enter(struct pt_regs *
> if (!test_thread_flag(TIF_SYSCALL_TRACE))
> return 0;
>
> - return ptrace_report_syscall_entry(regs);
> + return !ptrace_report_syscall_permit_entry(regs);
> }
>
> void syscall_trace_leave(struct pt_regs *regs)
> --- a/arch/xtensa/kernel/ptrace.c
> +++ b/arch/xtensa/kernel/ptrace.c
> @@ -547,7 +547,7 @@ int do_syscall_trace_enter(struct pt_reg
> regs->areg[2] = -ENOSYS;
>
> if (test_thread_flag(TIF_SYSCALL_TRACE) &&
> - ptrace_report_syscall_entry(regs)) {
> + !ptrace_report_syscall_permit_entry(regs)) {
> regs->areg[2] = -ENOSYS;
> regs->syscall = NO_SYSCALL;
> return 0;
> --- a/include/asm-generic/syscall.h
> +++ b/include/asm-generic/syscall.h
> @@ -58,8 +58,8 @@ void syscall_set_nr(struct task_struct *
> *
> * It's only valid to call this when @task is stopped for system
> * call exit tracing (due to %SYSCALL_WORK_SYSCALL_TRACE or
> - * %SYSCALL_WORK_SYSCALL_AUDIT), after ptrace_report_syscall_entry()
> - * returned nonzero to prevent the system call from taking place.
> + * %SYSCALL_WORK_SYSCALL_AUDIT), after ptrace_report_syscall_permit_entry()
> + * returned False to prevent the system call from taking place.
> *
> * This rolls back the register state in @regs so it's as if the
> * system call instruction was a no-op. The registers containing
> --- a/include/linux/entry-common.h
> +++ b/include/linux/entry-common.h
> @@ -38,21 +38,22 @@
> SYSCALL_WORK_SYSCALL_EXIT_TRAP)
>
> /**
> - * arch_ptrace_report_syscall_entry - Architecture specific ptrace_report_syscall_entry() wrapper
> + * arch_ptrace_report_syscall_permit_entry - Architecture specific wrapper for
> + * ptrace_report_syscall_permit_entry()
> * @regs: Pointer to the register state at syscall entry
> *
> - * Invoked from syscall_trace_enter() to wrap ptrace_report_syscall_entry().
> + * Invoked from syscall_trace_enter() to wrap ptrace_report_syscall_permit_entry().
> *
> - * This allows architecture specific ptrace_report_syscall_entry()
> + * This allows architecture specific ptrace_report_syscall_permit_entry()
> * implementations. If not defined by the architecture this falls back to
> - * to ptrace_report_syscall_entry().
> + * to ptrace_report_syscall_permit_entry().
> */
> -static __always_inline int arch_ptrace_report_syscall_entry(struct pt_regs *regs);
> +static __always_inline bool arch_ptrace_report_syscall_permit_entry(struct pt_regs *regs);
>
> -#ifndef arch_ptrace_report_syscall_entry
> -static __always_inline int arch_ptrace_report_syscall_entry(struct pt_regs *regs)
> +#ifndef arch_ptrace_report_syscall_permit_entry
> +static __always_inline bool arch_ptrace_report_syscall_permit_entry(struct pt_regs *regs)
> {
> - return ptrace_report_syscall_entry(regs);
> + return ptrace_report_syscall_permit_entry(regs);
> }
> #endif
>
> @@ -73,8 +74,6 @@ static inline void syscall_enter_audit(s
> static __always_inline long syscall_trace_enter(struct pt_regs *regs, unsigned long work,
> long syscall)
> {
> - long ret = 0;
> -
> /*
> * Handle Syscall User Dispatch. This must comes first, since
> * the ABI here can be something that doesn't make sense for
> @@ -95,8 +94,8 @@ static __always_inline long syscall_trac
>
> /* Handle ptrace */
> if (work & (SYSCALL_WORK_SYSCALL_TRACE | SYSCALL_WORK_SYSCALL_EMU)) {
> - ret = arch_ptrace_report_syscall_entry(regs);
> - if (ret || (work & SYSCALL_WORK_SYSCALL_EMU))
> + if (!arch_ptrace_report_syscall_permit_entry(regs) ||
> + (work & SYSCALL_WORK_SYSCALL_EMU))
> return -1L;
> }
>
> @@ -137,7 +136,7 @@ static __always_inline long syscall_trac
> * It handles the following work items:
> *
> * 1) syscall_work flag dependent invocations of
> - * ptrace_report_syscall_entry(), __seccomp_permit_syscall(), trace_sys_enter()
> + * ptrace_report_syscall_permit_entry(), __seccomp_permit_syscall(), trace_sys_enter()
> * 2) Invocation of audit_syscall_entry()
> */
> static __always_inline long syscall_enter_from_user_mode_work(struct pt_regs *regs, long syscall)
> --- a/include/linux/ptrace.h
> +++ b/include/linux/ptrace.h
> @@ -405,13 +405,13 @@ extern void sigaction_compat_abi(struct
> /*
> * ptrace report for syscall entry and exit looks identical.
> */
> -static inline int ptrace_report_syscall(unsigned long message)
> +static inline bool ptrace_report_syscall(unsigned long message)
> {
> int ptrace = current->ptrace;
> int signr;
>
> if (!(ptrace & PT_PTRACED))
> - return 0;
> + return true;
>
> signr = ptrace_notify(SIGTRAP | ((ptrace & PT_TRACESYSGOOD) ? 0x80 : 0),
> message);
> @@ -424,11 +424,11 @@ static inline int ptrace_report_syscall(
> if (signr)
> send_sig(signr, current, 1);
>
> - return fatal_signal_pending(current);
> + return !fatal_signal_pending(current);
> }
>
> /**
> - * ptrace_report_syscall_entry - task is about to attempt a system call
> + * ptrace_report_syscall_permit_entry - task is about to attempt a system call
> * @regs: user register state of current task
> *
> * This will be called if %SYSCALL_WORK_SYSCALL_TRACE or
> @@ -438,7 +438,7 @@ static inline int ptrace_report_syscall(
> * call number and arguments to be tried. It is safe to block here,
> * preventing the system call from beginning.
> *
> - * Returns zero normally, or nonzero if the calling arch code should abort
> + * Returns True normally, or False if the calling architecture code should abort
> * the system call. That must prevent normal entry so no system call is
> * made. If @task ever returns to user mode after this, its register state
> * is unspecified, but should be something harmless like an %ENOSYS error
> @@ -447,8 +447,7 @@ static inline int ptrace_report_syscall(
> *
> * Called without locks, just after entering kernel mode.
> */
> -static inline __must_check int ptrace_report_syscall_entry(
> - struct pt_regs *regs)
> +static inline __must_check bool ptrace_report_syscall_permit_entry(struct pt_regs *regs)
> {
> return ptrace_report_syscall(PTRACE_EVENTMSG_SYSCALL_ENTRY);
> }
>
^ permalink raw reply
* Re: [PATCH v7 00/22] dma-mapping: Track shared DMA state through direct, pool and swiotlb paths
From: Will Deacon @ 2026-07-10 10:50 UTC (permalink / raw)
To: Marek Szyprowski
Cc: Aneesh Kumar K.V, iommu, linux-arm-kernel, linux-kernel,
linux-coco, Robin Murphy, Marc Zyngier, Steven Price,
Suzuki K Poulose, Catalin Marinas, Jiri Pirko, Jason Gunthorpe,
Mostafa Saleh, Petr Tesarik, Alexey Kardashevskiy, Dan Williams,
Xu Yilun, linuxppc-dev, linux-s390, Madhavan Srinivasan,
Michael Ellerman, Nicholas Piggin, Christophe Leroy (CS GROUP),
Alexander Gordeev, Gerald Schaefer, Heiko Carstens, Vasily Gorbik,
Christian Borntraeger, Sven Schnelle, x86
In-Reply-To: <fc804746-4fb8-4ea9-997f-a4cae9ba8c14@samsung.com>
On Tue, Jul 07, 2026 at 03:03:48PM +0200, Marek Szyprowski wrote:
> On 07.07.2026 10:06, Aneesh Kumar K.V wrote:
> > "Aneesh Kumar K.V (Arm)" <aneesh.kumar@kernel.org> writes:
> >
> >> This series tracks confidential-computing shared DMA state through the
> >> dma-direct, dma-pool, and swiotlb paths so that encrypted and decrypted
> >> DMA buffers are handled consistently.
> >>
> >> Today, the direct DMA path mostly relies on force_dma_unencrypted() for
> >> shared/decrypted buffer handling. This series consolidates the
> >> force_dma_unencrypted() checks in the top-level functions and ensures
> >> that the remaining DMA interfaces use DMA attributes to make the correct
> >> decisions.
> >>
> >> The series separates mapping and allocation state:
> >> - DMA_ATTR_CC_SHARED describes the DMA address attribute requested for a
> >> mapping. It tells the DMA mapping path that the DMA address must target
> >> shared/decrypted memory.
> >> - __DMA_ATTR_ALLOC_CC_SHARED is an internal DMA-mapping attribute used only
> >> by allocation paths after the DMA core decides that the backing pages
> >> must be allocated as shared/decrypted memory.
> >>
> >> The series:
> >> - moves swiotlb-backed allocations out of __dma_direct_alloc_pages(),
> >> - uses __DMA_ATTR_ALLOC_CC_SHARED through the dma-direct alloc/free paths
> >> - teaches the atomic DMA pools to track encrypted versus decrypted
> >> state
> >> - tracks swiotlb pool encryption state and enforces strict pool
> >> selection
> >> - centralizes encrypted/decrypted pgprot handling in dma_pgprot() using
> >> DMA attributes
> >> - passes DMA attributes down to dma_capable() so capability checks can
> >> validate whether the selected DMA address encoding matches
> >> DMA_ATTR_CC_SHARED
> >> - makes dma_direct_map_phys() choose the DMA address encoding from
> >> DMA_ATTR_CC_SHARED and fall back to swiotlb when a shared DMA request
> >> cannot use the direct mapping, which lets arm64 and x86 CCA guests stop
> >> relying on SWIOTLB_FORCE for DMA mappings
> >> - use the selected swiotlb pool state to derive the returned DMA
> >> address
> >> - reports CC_ATTR_GUEST_MEM_ENCRYPT for arm64 Realms, powerpc secure
> >> guests, and s390 protected virtualization guests.
> >>
> >> Dependency:
> >> This series depends on the pKVM changes posted at:
> >> https://lore.kernel.org/all/20260603110522.3331819-1-smostafa@google.com
FYI, I'll probably take the second patch there as a fix, then I can put
the other two on a topic branch in the arm64 tree.
Will
^ permalink raw reply
* Re: [patch 13/18] entry: Make trace_syscall_enter() return type bool
From: Michal Suchánek @ 2026-07-10 11:01 UTC (permalink / raw)
To: Thomas Gleixner
Cc: LKML, Peter Zijlstra, Michael Ellerman, Shrikanth Hegde,
linuxppc-dev, Kees Cook, Huacai Chen, loongarch, Paul Walmsley,
Palmer Dabbelt, linux-riscv, Sven Schnelle, linux-s390, x86,
Mark Rutland, Jinjie Ruan, Andy Lutomirski, Oleg Nesterov,
Richard Henderson, Russell King, Catalin Marinas, Guo Ren,
Geert Uytterhoeven, Thomas Bogendoerfer, Helge Deller,
Yoshinori Sato, Richard Weinberger, Chris Zankel,
linux-arm-kernel, linux-alpha, linux-csky, linux-m68k, linux-mips,
linux-parisc, linux-sh, linux-um, Arnd Bergmann, Vineet Gupta,
Will Deacon, Brian Cain, Michal Simek, Dinh Nguyen,
David S. Miller, Andreas Larsson, linux-snps-arc, linux-hexagon,
linux-openrisc, sparclinux, linux-arch, Jonathan Corbet,
linux-doc
In-Reply-To: <87se5tqkyp.ffs@fw13>
On Wed, Jul 08, 2026 at 10:34:38PM +0200, Thomas Gleixner wrote:
> On Wed, Jul 08 2026 at 17:52, Michal Suchánek wrote:
> > On Tue, Jul 07, 2026 at 09:06:48PM +0200, Thomas Gleixner wrote:
> >> In preparation of converting the return value of
> >> syscall_enter_from_user_mode[_work]() bool, rework trace_syscall_enter() to
> >>
> >> - update the syscall number via a pointer argument
> >>
> >> - Return True if the syscall number is != -1, False otherwise
> >
> > This does not achieve the goal of the initial RFC: To detangle the
> > return value of syscall_enter_from_user_mode from the syscall number.
>
> As I explained to you before: Your RFC broke the implicit assumption of
> tracing, which is way worse than having this oddity.
It would be so nice to make the assumptions about the entry API explicit
so that platforms can agree on the semantics.
>
> > This still conflates them, making it impossible to tell if the syscall
> > was rejected or syscall number was -1 to start with. Now also obfuscated
> > by performing the check deeper inside the common code.
>
> That's where it belongs. It's a problem to solve within the given
> semantics of trace_syscall_enter() and not a problem to be worked around
> at the call sites if you want to have consolidated semantics.
>
> >> The only difference is that this also returns False, when the syscall
> >> number was already -1 to begin with, but there is not much which can be
> >> done about that. As the architecture has to preset the return value to
> >> -ENOSYS anyway, that results in the correct return value for such an
> >> invalid syscall.
> >
> > That's not possible to do for architectures where the syscall number and
> > the syscall return value are in the same register.
> >
> > You suggested that it is possible to not write the return value into an
> > actual register but use an additional field for that, and have the exit
> > code write the register.
> >
> > However, that's not what is documented, nor what is currently done.
>
> Just because S390 screwed up their ABI and then on top of that failed to
> do what _every_ other architecture in the kernel does, i.e. having a
> result storage which is preset to -ENOSYS does not mean that S390 did
> the right thing just because it was not documented. Kernel documentation
> is known to be incomplete and I fixed it up in the last patch as you
> might have noticed.
>
> Just for the record. Presetting the return value to -ENOSYS has been
> practice for three decades. I couldn't be bothered to do a full search
No, it isn't practice anymore for decades.
The moment ppc and s390 support was merged they do not preset the
syscall return value to -ENOSYS, for obvious reason.
That is how the undocumented, implicit, 'as implemented' API goes. It
silently changes as the implementation evolves.
> in the history trees to figure out the exact point, but as of 2.1.9,
> which was released in Nov. 1996, this is definitely the case.
>
> So don't tell me that because S390 missed the train when it was
> added to mainline in 2007 (, i.e. 11 years _after_ this "undocumented" rule was
> established that now 20 years later the world has to revolve around S390
> and your personal idea of "clear and intelligible":
Don't tell me you missed the train on what the actual API of syscall
entry is.
>
> > While this is an improvement in some respects the goal to have clear and
> > intelligible API around the generic entry is not acheived.
>
> I'm honestly not sure whether I should laugh or cry.
>
> You are completely missing the point:
>
> 1) The set in stone rule is that if the entry code returns -1L as the
> syscall number then the architecture code has to skip the syscall
> invocation _and_ is not supposed to change the return value.
Which stone?
Pics or it did not happen.
>
> 2) There is no guarantee and never has been that any of the involved
> mechanisms (ptrace, seccomp, tracing) will change the return value
> when it sets the syscall number to -1L.
For ptrace to correctly emulate a syscall it needs to set the syscall nr
to an invalid value on entry, and the desired result if the syscall on
exit AFAICT.
Relying on platfrom quirk to assume that the return valu is set to
ENOSYS is insufficient.
I doubt many platfroms have an ABI that dictates that the register that
has the syscal nr is set to -1 on exit from syscal. Then even if the
-ENOSYS is preset by the kernel the syscall nr needs to be poked back on
exit for the emulation to be correct.
>
> Quite the contrary there has been a long time (30 years at least)
> expectation that the return value has been preset to -ENOSYS.
That is your opinion, not the fact. Multiple platforms do not work like
that.
>
> 3) It's trivial as demonstrated to make ptrace and seccomp more
> comprehensible but that does not invalidate #2
>
> 4) Due to the historical integration of tracing (+probes/BPF) there is
> an implicit assumption that the return code is preset to -ENOSYS.
> See #2
False again
>
> 5) There is an obvious ambiguity between the initial syscall number
> being -1 and the change of syscall number to -1 in the case of
> tracing, but that's not unique to tracing:
>
> If e.g. seccomp() observes the handed in syscall number to be -1
> and tells in the return code to skip the syscall, then it can
> rightfully assume that the return code will be -ENOSYS and has no
> obligation to set it explicitly. See #2
False again
>
> Q: Is it perfect?
> A: No
>
> Q: Can it be made perfect?
> A: No, because you can't change history and established practice.
>
> Just for illustration. Changing the logic in trace_syscall_enter() to:
>
> --- a/kernel/entry/syscall-common.c
> +++ b/kernel/entry/syscall-common.c
> @@ -9,13 +9,15 @@
>
> bool trace_syscall_enter(struct pt_regs *regs, long *syscall)
> {
> + long orig_syscall = *syscall;
> +
> trace_sys_enter(regs, *syscall);
> /*
> * Probes or BPF hooks in the tracepoint may have changed the
> * system call number. Reread it.
> */
> *syscall = syscall_get_nr(current, regs);
> - return *syscall != -1L;
> + return *syscall == orig_syscall || *syscall != -1L;
> }
>
> void trace_syscall_exit(struct pt_regs *regs, long ret)
>
> does not make #2 magically go away. It's still the same problem whether
> you like it or not.
However, reading the syscall number from pt_regs only after
syscall_enter_from_user_mode exits does.
Thanks
Michal
^ permalink raw reply
* Re: [patch 12/18] ptrace, treewide: Rename ptrace_report_syscall_entry() to ptrace_report_syscall_permit_entry()
From: Oleg Nesterov @ 2026-07-10 11:16 UTC (permalink / raw)
To: Michal Suchánek
Cc: Thomas Gleixner, LKML, Peter Zijlstra, Arnd Bergmann,
Richard Henderson, Vineet Gupta, Russell King, Catalin Marinas,
Will Deacon, Guo Ren, Brian Cain, Geert Uytterhoeven,
Michal Simek, Thomas Bogendoerfer, Dinh Nguyen, Helge Deller,
Yoshinori Sato, David S. Miller, Andreas Larsson, Chris Zankel,
linux-alpha, linux-snps-arc, linux-arm-kernel, linux-csky,
linux-hexagon, linux-m68k, linux-mips, linux-openrisc,
linux-parisc, linux-sh, sparclinux, linux-um, linux-arch,
Michael Ellerman, Shrikanth Hegde, linuxppc-dev, Kees Cook,
Huacai Chen, loongarch, Paul Walmsley, Palmer Dabbelt,
linux-riscv, Sven Schnelle, linux-s390, x86, Mark Rutland,
Jinjie Ruan, Andy Lutomirski, Richard Weinberger, Jonathan Corbet,
linux-doc
In-Reply-To: <alDMlSYN1eKkjNCL@kunlun.suse.cz>
On 07/10, Michal Suchánek wrote:
>
> > --- a/arch/alpha/kernel/ptrace.c
> > +++ b/arch/alpha/kernel/ptrace.c
> > @@ -375,7 +375,7 @@ asmlinkage unsigned long syscall_trace_e
> > struct pt_regs *regs = current_pt_regs();
> >
> > if (test_thread_flag(TIF_SYSCALL_TRACE) &&
> > - ptrace_report_syscall_entry(regs)) {
> > + !ptrace_report_syscall_permit_entry(regs)) {
> > syscall_set_nr(current, regs, -1);
>
> Why is this done here?
>
> Presumably the ptrace_report_syscall_entry returns false here becasue
> the tracer put -1 into whatever register specifies the syscall number
> (or it was there to start with) which was then read back, compared to
> -1, leading to returning false. Now it's set to -1 again?
I don't know why arch/alpha/ does syscall_set_nr(-1).
But note that ptrace_report_syscall_entry() doesn't even check whether
the syscall number was changed. It only checks fatal_signal_pending().
Oleg.
^ permalink raw reply
* Re: [patch 13/18] entry: Make trace_syscall_enter() return type bool
From: Oleg Nesterov @ 2026-07-10 11:40 UTC (permalink / raw)
To: Michal Suchánek
Cc: Thomas Gleixner, LKML, Peter Zijlstra, Michael Ellerman,
Shrikanth Hegde, linuxppc-dev, Kees Cook, Huacai Chen, loongarch,
Paul Walmsley, Palmer Dabbelt, linux-riscv, Sven Schnelle,
linux-s390, x86, Mark Rutland, Jinjie Ruan, Andy Lutomirski,
Richard Henderson, Russell King, Catalin Marinas, Guo Ren,
Geert Uytterhoeven, Thomas Bogendoerfer, Helge Deller,
Yoshinori Sato, Richard Weinberger, Chris Zankel,
linux-arm-kernel, linux-alpha, linux-csky, linux-m68k, linux-mips,
linux-parisc, linux-sh, linux-um, Arnd Bergmann, Vineet Gupta,
Will Deacon, Brian Cain, Michal Simek, Dinh Nguyen,
David S. Miller, Andreas Larsson, linux-snps-arc, linux-hexagon,
linux-openrisc, sparclinux, linux-arch, Jonathan Corbet,
linux-doc
In-Reply-To: <alDQ7isUKJFl8Va4@kunlun.suse.cz>
On 07/10, Michal Suchánek wrote:
>
> On Wed, Jul 08, 2026 at 10:34:38PM +0200, Thomas Gleixner wrote:
> >
> > 1) The set in stone rule is that if the entry code returns -1L as the
> > syscall number then the architecture code has to skip the syscall
> > invocation _and_ is not supposed to change the return value.
>
> Which stone?
>
> Pics or it did not happen.
>
> >
> > 2) There is no guarantee and never has been that any of the involved
> > mechanisms (ptrace, seccomp, tracing) will change the return value
> > when it sets the syscall number to -1L.
>
> For ptrace to correctly emulate a syscall it needs to set the syscall nr
> to an invalid value on entry, and the desired result if the syscall on
> exit AFAICT.
I can only say that ptrace users do want to skip the syscall and set the
return value on entry.
See
[PATCH v5 1/2] ptrace: add PTRACE_SET_SYSCALL_INFO syscall skipping support
https://lore.kernel.org/all/20260709100949.94345-2-renzo@cs.unibo.it/
The changelog explains that currently this doesn't work because
among the arches which define HAVE_ARCH_TRACEHOOK (at least) arch/mips is
broken in this regard.
Oleg.
^ permalink raw reply
* Re: [patch 13/18] entry: Make trace_syscall_enter() return type bool
From: Michal Suchánek @ 2026-07-10 12:32 UTC (permalink / raw)
To: Oleg Nesterov
Cc: Thomas Gleixner, LKML, Peter Zijlstra, Michael Ellerman,
Shrikanth Hegde, linuxppc-dev, Kees Cook, Huacai Chen, loongarch,
Paul Walmsley, Palmer Dabbelt, linux-riscv, Sven Schnelle,
linux-s390, x86, Mark Rutland, Jinjie Ruan, Andy Lutomirski,
Richard Henderson, Russell King, Catalin Marinas, Guo Ren,
Geert Uytterhoeven, Thomas Bogendoerfer, Helge Deller,
Yoshinori Sato, Richard Weinberger, Chris Zankel,
linux-arm-kernel, linux-alpha, linux-csky, linux-m68k, linux-mips,
linux-parisc, linux-sh, linux-um, Arnd Bergmann, Vineet Gupta,
Will Deacon, Brian Cain, Michal Simek, Dinh Nguyen,
David S. Miller, Andreas Larsson, linux-snps-arc, linux-hexagon,
linux-openrisc, sparclinux, linux-arch, Jonathan Corbet,
linux-doc
In-Reply-To: <alDaOw8t-e3rxIPm@redhat.com>
On Fri, Jul 10, 2026 at 01:40:43PM +0200, Oleg Nesterov wrote:
> On 07/10, Michal Suchánek wrote:
> >
> > On Wed, Jul 08, 2026 at 10:34:38PM +0200, Thomas Gleixner wrote:
> > >
> > > 1) The set in stone rule is that if the entry code returns -1L as the
> > > syscall number then the architecture code has to skip the syscall
> > > invocation _and_ is not supposed to change the return value.
> >
> > Which stone?
> >
> > Pics or it did not happen.
> >
> > >
> > > 2) There is no guarantee and never has been that any of the involved
> > > mechanisms (ptrace, seccomp, tracing) will change the return value
> > > when it sets the syscall number to -1L.
> >
> > For ptrace to correctly emulate a syscall it needs to set the syscall nr
> > to an invalid value on entry, and the desired result if the syscall on
> > exit AFAICT.
>
> I can only say that ptrace users do want to skip the syscall and set the
> return value on entry.
>
> See
> [PATCH v5 1/2] ptrace: add PTRACE_SET_SYSCALL_INFO syscall skipping support
> https://lore.kernel.org/all/20260709100949.94345-2-renzo@cs.unibo.it/
>
> The changelog explains that currently this doesn't work because
> among the arches which define HAVE_ARCH_TRACEHOOK (at least) arch/mips is
> broken in this regard.
Or it could be documented that setting the return value has to be done
in the exit trace, and that would than work on any architecture AFAICT.
With ppc and s390 using the same register for the syscall number and
syscall return value it's very much impossible to poke the return value
on entry into a register using the generic register access function. As
of now there is no place to store the value ot of the return value
outside of the registers, either.
And the current PTRACE_SET_SYSCALL_INFO indeed sets the syscall nr and
arguments on entry and the syscall return value on exit, that
disctincion is implemented.
Not sure how the patchset you point out is relevant, it only adds
changes in the exit case.
Thanks
Michal
^ permalink raw reply
* Re: [patch 13/18] entry: Make trace_syscall_enter() return type bool
From: Oleg Nesterov @ 2026-07-10 12:52 UTC (permalink / raw)
To: Michal Suchánek
Cc: Thomas Gleixner, LKML, Peter Zijlstra, Michael Ellerman,
Shrikanth Hegde, linuxppc-dev, Kees Cook, Huacai Chen, loongarch,
Paul Walmsley, Palmer Dabbelt, linux-riscv, Sven Schnelle,
linux-s390, x86, Mark Rutland, Jinjie Ruan, Andy Lutomirski,
Richard Henderson, Russell King, Catalin Marinas, Guo Ren,
Geert Uytterhoeven, Thomas Bogendoerfer, Helge Deller,
Yoshinori Sato, Richard Weinberger, Chris Zankel,
linux-arm-kernel, linux-alpha, linux-csky, linux-m68k, linux-mips,
linux-parisc, linux-sh, linux-um, Arnd Bergmann, Vineet Gupta,
Will Deacon, Brian Cain, Michal Simek, Dinh Nguyen,
David S. Miller, Andreas Larsson, linux-snps-arc, linux-hexagon,
linux-openrisc, sparclinux, linux-arch, Jonathan Corbet,
linux-doc
In-Reply-To: <alDmTcgzMlKiio9H@kunlun.suse.cz>
On 07/10, Michal Suchánek wrote:
>
> On Fri, Jul 10, 2026 at 01:40:43PM +0200, Oleg Nesterov wrote:
> >
> > I can only say that ptrace users do want to skip the syscall and set the
> > return value on entry.
> >
> > See
> > [PATCH v5 1/2] ptrace: add PTRACE_SET_SYSCALL_INFO syscall skipping support
> > https://lore.kernel.org/all/20260709100949.94345-2-renzo@cs.unibo.it/
> >
> > The changelog explains that currently this doesn't work because
> > among the arches which define HAVE_ARCH_TRACEHOOK (at least) arch/mips is
> > broken in this regard.
>
> Or it could be documented that setting the return value has to be done
> in the exit trace, and that would than work on any architecture AFAICT.
Well, ptrace users know the problem. And this what they have to do
currently.
> With ppc and s390 using the same register for the syscall number and
> syscall return value it's very much impossible to poke the return value
> on entry into a register using the generic register access function. As
> of now there is no place to store the value ot of the return value
> outside of the registers, either.
I know nothing about ppc and s390. Can't comment right now.
> And the current PTRACE_SET_SYSCALL_INFO indeed sets the syscall nr and
> arguments on entry and the syscall return value on exit, that
> disctincion is implemented.
>
> Not sure how the patchset you point out is relevant, it only adds
> changes in the exit case.
No. It allows to skip-and-set-retval on PTRACE_EVENT_SECCOMP.
But ENTRY -> EXIT transition is not yet allowed due to the problems
above.
Oleg.
^ permalink raw reply
* Re: [PATCH 23/42] mmc: sdhci-of-bst: Use devm_of_reserved_mem_device_init_by_idx()
From: Ulf Hansson @ 2026-07-10 13:08 UTC (permalink / raw)
To: Mukesh Ojha
Cc: Bjorn Andersson, Konrad Dybcio, Liviu Dudau, Maarten Lankhorst,
Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter,
Joel Stanley, Andrew Jeffery, Paul Cercueil, Anitha Chrisanthus,
Paul Kocialkowski, Linus Walleij, Chen-Yu Tsai, Jernej Skrabec,
Samuel Holland, Alexey Brodkin, Laurent Pinchart, Tomi Valkeinen,
Michal Simek, Daniel Scally, Jacopo Mondi, Mauro Carvalho Chehab,
Eddie James, Tiffany Lin, Andrew-CT Chen, Yunfei Dong,
Minghsiu Tsai, Houlong Wei, Matthias Brugger,
AngeloGioacchino Del Regno, Joseph Liu, Marvin Lin,
Dmitry Osipenko, Krzysztof Kozlowski, Thierry Reding,
Jonathan Hunter, Srinivas Kandagatla, Arnd Bergmann,
Greg Kroah-Hartman, Ge Gordon, Adrian Hunter, Ulf Hansson,
Rob Herring, Saravana Kannan, Mathieu Poirier, Jaroslav Kysela,
Takashi Iwai, Shengjiu Wang, Xiubo Li, Liam Girdwood, Mark Brown,
Frank Li, Sascha Hauer, Peter Ujfalusi, Bard Liao, Daniel Baluta,
Orson Zhai, Baolin Wang, Peter Chen, Fugang Duan, Ekansh Gupta,
BST Linux Kernel Upstream Group, Fabio Estevam, Nicolin Chen,
Pengutronix Kernel Team, Kai Vehmanen, Pierre-Louis Bossart,
Vijendar Mukunda, Chunyan Zhang, CIX Linux Kernel Upstream Group,
linux-arm-msm, linux-kernel, dri-devel, linux-aspeed,
linux-arm-kernel, linux-mips, linux-sunxi, linux-media, openbmc,
linux-mediatek, kernel, linux-tegra, linux-mmc, devicetree,
linux-remoteproc, linux-staging, linux-sound, linuxppc-dev, imx,
sound-open-firmware
In-Reply-To: <20260703193855.110619-24-mukesh.ojha@oss.qualcomm.com>
On Fri, Jul 3, 2026 at 9:48 PM Mukesh Ojha <mukesh.ojha@oss.qualcomm.com> wrote:
>
> Use the devres-managed devm_of_reserved_mem_device_init_by_idx() instead
> of the manual of_reserved_mem_device_init_by_idx()/
> of_reserved_mem_device_release() pair, letting the device resource
> manager handle cleanup automatically.
>
> Signed-off-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>
Acked-by: Ulf Hansson <ulfh@kernel.org>
Kind regards
Uffe
> ---
> drivers/mmc/host/sdhci-of-bst.c | 7 ++-----
> 1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci-of-bst.c b/drivers/mmc/host/sdhci-of-bst.c
> index f8d3df715e1a..304554ced690 100644
> --- a/drivers/mmc/host/sdhci-of-bst.c
> +++ b/drivers/mmc/host/sdhci-of-bst.c
> @@ -405,7 +405,6 @@ static void sdhci_bst_free_bounce_buffer(struct sdhci_host *host)
> host->bounce_buffer, host->bounce_addr);
> host->bounce_buffer = NULL;
> }
> - of_reserved_mem_device_release(mmc_dev(host->mmc));
> }
>
> static int sdhci_bst_alloc_bounce_buffer(struct sdhci_host *host)
> @@ -417,7 +416,7 @@ static int sdhci_bst_alloc_bounce_buffer(struct sdhci_host *host)
> /* Fixed SRAM bounce size to 32KB: verified config under 32-bit DMA addressing limit */
> bounce_size = SZ_32K;
>
> - ret = of_reserved_mem_device_init_by_idx(mmc_dev(mmc), mmc_dev(mmc)->of_node, 0);
> + ret = devm_of_reserved_mem_device_init_by_idx(mmc_dev(mmc), mmc_dev(mmc)->of_node, 0);
> if (ret) {
> dev_err(mmc_dev(mmc), "Failed to initialize reserved memory\n");
> return ret;
> @@ -425,10 +424,8 @@ static int sdhci_bst_alloc_bounce_buffer(struct sdhci_host *host)
>
> host->bounce_buffer = dma_alloc_coherent(mmc_dev(mmc), bounce_size,
> &host->bounce_addr, GFP_KERNEL);
> - if (!host->bounce_buffer) {
> - of_reserved_mem_device_release(mmc_dev(mmc));
> + if (!host->bounce_buffer)
> return -ENOMEM;
> - }
>
> host->bounce_buffer_size = bounce_size;
>
> --
> 2.53.0
>
^ permalink raw reply
* Re: [PATCH] usb: phy: fsl-usb: clear fsl_otg_dev after freeing it
From: Greg Kroah-Hartman @ 2026-07-10 13:17 UTC (permalink / raw)
To: Guangshuo Li
Cc: Kees Cook, Duoming Zhou, Li Yang, Anatolij Gustschin, linux-usb,
linuxppc-dev, linux-kernel
In-Reply-To: <20260708064549.719147-1-lgs201920130244@gmail.com>
On Wed, Jul 08, 2026 at 02:45:49PM +0800, Guangshuo Li wrote:
> fsl_otg_dev is a file-scoped singleton pointer and is used by
> fsl_otg_conf() to decide whether the OTG device has already been
> initialized.
>
> fsl_otg_remove() frees fsl_otg_dev but leaves the global pointer
> unchanged. A later bind can therefore see a non-NULL dangling pointer,
> skip initialization, and continue using freed memory through the global
> fsl_otg_dev pointer.
>
> Clear fsl_otg_dev after freeing it so that a later probe does not treat a
> dangling pointer as an initialized device.
>
> Fixes: 0807c500a1a6 ("USB: add Freescale USB OTG Transceiver driver")
> Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
> ---
> drivers/usb/phy/phy-fsl-usb.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/usb/phy/phy-fsl-usb.c b/drivers/usb/phy/phy-fsl-usb.c
> index 35d79f11b03d..0b5e937633f4 100644
> --- a/drivers/usb/phy/phy-fsl-usb.c
> +++ b/drivers/usb/phy/phy-fsl-usb.c
> @@ -997,6 +997,7 @@ static void fsl_otg_remove(struct platform_device *pdev)
> fsl_otg_uninit_timers();
> kfree(fsl_otg_dev->phy.otg);
> kfree(fsl_otg_dev);
> + fsl_otg_dev = NULL;
>
> if (pdata->exit)
> pdata->exit(pdev);
> --
> 2.43.0
>
>
For all of these patches, you have to document that you use an LLM.
Please resend them all with that information.
thanks,
greg k-h
^ permalink raw reply
* Re: [PATCH 2/2] module: Bring includes in linux/kmod.h up to date
From: Aaron Tomlin @ 2026-07-10 13:57 UTC (permalink / raw)
To: Petr Pavlu
Cc: Tony Luck, Borislav Petkov, Thomas Gleixner, Ingo Molnar,
Dave Hansen, x86, H. Peter Anvin, Philipp Reisner, Lars Ellenberg,
Christoph Böhmwalder, Jens Axboe, Johan Hovold, Alex Elder,
Greg Kroah-Hartman, Rafael J. Wysocki, Michal Januszewski,
Helge Deller, Alexander Viro, Christian Brauner, Jan Kara,
Trond Myklebust, Anna Schumaker, Chuck Lever, Jeff Layton,
NeilBrown, Olga Kornievskaia, Dai Ngo, Tom Talpey, Mark Fasheh,
Joel Becker, Joseph Qi, Tejun Heo, Johannes Weiner,
Michal Koutný, Luis Chamberlain, Daniel Gomez, Sami Tolvanen,
Pavel Machek, Len Brown, Andrew Morton, Danilo Krummrich,
Nikolay Aleksandrov, Ido Schimmel, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Simon Horman, David Howells,
Jarkko Sakkinen, Paul Moore, James Morris, Serge E. Hallyn,
Kentaro Takeda, Tetsuo Handa, linux-edac, linux-kernel, drbd-dev,
linux-block, greybus-dev, linuxppc-dev, linux-acpi, linux-fbdev,
dri-devel, linux-fsdevel, linux-nfs, ocfs2-devel, cgroups,
linux-modules, linux-pm, driver-core, bridge, netdev, keyrings,
linux-security-module
In-Reply-To: <20260708154510.6794-3-petr.pavlu@suse.com>
On Wed, Jul 08, 2026 at 05:44:30PM +0200, Petr Pavlu wrote:
> Including linux/kmod.h alone results in 1.5 MB of preprocessed output, even
> though it provides only a few functions and macros.
>
> The header currently depends on:
>
> * __printf() -> linux/compiler_attributes.h,
> * ENOSYS -> linux/errno.h,
> * bool -> linux/types.h.
>
> Include only these files, reducing the preprocessed output to 10 kB.
>
> Signed-off-by: Petr Pavlu <petr.pavlu@suse.com>
> ---
> include/linux/kmod.h | 12 ++----------
> 1 file changed, 2 insertions(+), 10 deletions(-)
>
> diff --git a/include/linux/kmod.h b/include/linux/kmod.h
> index 9a07c3215389..b9474a62a568 100644
> --- a/include/linux/kmod.h
> +++ b/include/linux/kmod.h
> @@ -2,17 +2,9 @@
> #ifndef __LINUX_KMOD_H__
> #define __LINUX_KMOD_H__
>
> -/*
> - * include/linux/kmod.h
> - */
> -
> -#include <linux/umh.h>
> -#include <linux/gfp.h>
> -#include <linux/stddef.h>
> +#include <linux/compiler_attributes.h>
> #include <linux/errno.h>
> -#include <linux/compiler.h>
> -#include <linux/workqueue.h>
> -#include <linux/sysctl.h>
> +#include <linux/types.h>
>
> #ifdef CONFIG_MODULES
> /* modprobe exit status on success, -ve on error. Return value
> --
> 2.54.0
>
LGTM. Thank you.
Reviewed-by: Aaron Tomlin <atomlin@atomlin.com>
--
Aaron Tomlin
^ permalink raw reply
* Re: [PATCH v3 00/20] driver core: count references of the platform device's fwnode, not OF node
From: Greg Kroah-Hartman @ 2026-07-10 14:09 UTC (permalink / raw)
To: Bartosz Golaszewski
Cc: Lee Jones, Mark Brown, Thierry Reding, Sebastian Hesselbarth,
Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Srinivas Kandagatla, Vinod Koul, Rafael J. Wysocki,
Danilo Krummrich, Rob Herring, Saravana Kannan,
Madhavan Srinivasan, Michael Ellerman, Nicholas Piggin,
Christophe Leroy (CS GROUP), Andi Shyti, Andy Shevchenko,
Joerg Roedel, Will Deacon, Robin Murphy, Doug Berger,
Florian Fainelli, Broadcom internal kernel review list,
Ulf Hansson, Frank Li, Sascha Hauer, Pengutronix Kernel Team,
Fabio Estevam, Matthew Brost, Thomas Hellström, Rodrigo Vivi,
David Airlie, Simona Vetter, Peter Chen, Paul Cercueil, Bin Liu,
Philipp Zabel, Maximilian Luz, Hans de Goede, Ilpo Järvinen,
Krzysztof Kozlowski, Benjamin Herrenschmidt, brgl, linux-kernel,
netdev, linux-arm-msm, linux-sound, driver-core, devicetree,
linuxppc-dev, linux-i2c, iommu, linux-pm, imx, linux-arm-kernel,
intel-xe, dri-devel, linux-usb, linux-mips, platform-driver-x86,
mfd, stable, Manuel Ebner, Wolfram Sang, Konrad Dybcio
In-Reply-To: <20260706-pdev-fwnode-ref-v3-0-1ff028e33779@oss.qualcomm.com>
On Mon, Jul 06, 2026 at 02:44:12PM +0200, Bartosz Golaszewski wrote:
> Platform device core provides helper interfaces for dealing with
> dynamically created platform devices. Most users should use
> platform_device_register_full() which encapsulates most of the
> operations but some modules will want to use the split approach of
> calling platform_device_alloc() + platform_device_add() separately for
> various reasons.
>
> With many platform devices now using dynamic software nodes as their
> primary firmware nodes and with the platform device interface being
> extended to also better cover the use-cases of secondary software nodes,
> I believe it makes sense to switch to counting the references of all
> kinds of firmware nodes.
>
> To that end, I identified all users of platform_device_alloc() that also
> assign dev.of_node or dev.fwnode manually. I noticed five cases where
> the references are not increased as they should (patches 1-5 fix these
> users) and provided three new functions in platform_device.h that now
> become the preferred interfaces for assigning firmware nodes to dynamic
> platform devices (in line with platform_device_add_data(),
> platform_device_add_resources(), etc.). The bulk of the patches in this
> series are small driver conversions to port all users to going through
> the new functions that now encapsulate the refcount logic. With that
> done, the final patch seamlessly switches to counting the references of
> all firmware node types.
>
> This effort is prerequisite of removing platform_device_release_full()
> and unifying the release path for dynamic platform devices using
> unmanaged software nodes.
>
> Merging strategy: The entire series should go through the driver core
> tree, possibly with an immutable branch provided to solve any potential
> conflicts though these are rather unlikely.
I've added this to the driver-core-testing branch now, thanks!
greg k-h
^ permalink raw reply
* Re: [patch 13/18] entry: Make trace_syscall_enter() return type bool
From: Michal Suchánek @ 2026-07-10 15:20 UTC (permalink / raw)
To: Oleg Nesterov
Cc: Thomas Gleixner, LKML, Peter Zijlstra, Michael Ellerman,
Shrikanth Hegde, linuxppc-dev, Kees Cook, Huacai Chen, loongarch,
Paul Walmsley, Palmer Dabbelt, linux-riscv, Sven Schnelle,
linux-s390, x86, Mark Rutland, Jinjie Ruan, Andy Lutomirski,
Richard Henderson, Russell King, Catalin Marinas, Guo Ren,
Geert Uytterhoeven, Thomas Bogendoerfer, Helge Deller,
Yoshinori Sato, Richard Weinberger, Chris Zankel,
linux-arm-kernel, linux-alpha, linux-csky, linux-m68k, linux-mips,
linux-parisc, linux-sh, linux-um, Arnd Bergmann, Vineet Gupta,
Will Deacon, Brian Cain, Michal Simek, Dinh Nguyen,
David S. Miller, Andreas Larsson, linux-snps-arc, linux-hexagon,
linux-openrisc, sparclinux, linux-arch, Jonathan Corbet,
linux-doc
In-Reply-To: <alDrGBMdTuoLcVyy@redhat.com>
On Fri, Jul 10, 2026 at 02:52:40PM +0200, Oleg Nesterov wrote:
> On 07/10, Michal Suchánek wrote:
> >
> > On Fri, Jul 10, 2026 at 01:40:43PM +0200, Oleg Nesterov wrote:
> > >
> > > I can only say that ptrace users do want to skip the syscall and set the
> > > return value on entry.
> > >
> > > See
> > > [PATCH v5 1/2] ptrace: add PTRACE_SET_SYSCALL_INFO syscall skipping support
> > > https://lore.kernel.org/all/20260709100949.94345-2-renzo@cs.unibo.it/
> > >
> > > The changelog explains that currently this doesn't work because
> > > among the arches which define HAVE_ARCH_TRACEHOOK (at least) arch/mips is
> > > broken in this regard.
> >
> > Or it could be documented that setting the return value has to be done
> > in the exit trace, and that would than work on any architecture AFAICT.
>
> Well, ptrace users know the problem. And this what they have to do
> currently.
>
> > With ppc and s390 using the same register for the syscall number and
> > syscall return value it's very much impossible to poke the return value
> > on entry into a register using the generic register access function. As
> > of now there is no place to store the value ot of the return value
> > outside of the registers, either.
>
> I know nothing about ppc and s390. Can't comment right now.
>
> > And the current PTRACE_SET_SYSCALL_INFO indeed sets the syscall nr and
> > arguments on entry and the syscall return value on exit, that
> > disctincion is implemented.
> >
> > Not sure how the patchset you point out is relevant, it only adds
> > changes in the exit case.
>
> No. It allows to skip-and-set-retval on PTRACE_EVENT_SECCOMP.
And if it was hooked correctly to seccomp indicating to seccomp that the
syscall needs to be skipped it could work but it is not, and will fail
on ppc.
Thanks
Michal
>
> But ENTRY -> EXIT transition is not yet allowed due to the problems
> above.
>
> Oleg.
>
^ permalink raw reply
* Re: [PATCH v7 16/22] dma-direct: make dma_direct_map_phys() honor DMA_ATTR_CC_SHARED
From: Jason Gunthorpe @ 2026-07-10 16:19 UTC (permalink / raw)
To: Aneesh Kumar K.V
Cc: Catalin Marinas, iommu, linux-arm-kernel, linux-kernel,
linux-coco, Robin Murphy, Marek Szyprowski, Will Deacon,
Marc Zyngier, Steven Price, Suzuki K Poulose, Jiri Pirko,
Mostafa Saleh, Petr Tesarik, Alexey Kardashevskiy, Dan Williams,
Xu Yilun, linuxppc-dev, linux-s390, Madhavan Srinivasan,
Michael Ellerman, Nicholas Piggin, Christophe Leroy (CS GROUP),
Alexander Gordeev, Gerald Schaefer, Heiko Carstens, Vasily Gorbik,
Christian Borntraeger, Sven Schnelle, x86, Jiri Pirko,
Michael Kelley
In-Reply-To: <yq5ajyr3h106.fsf@kernel.org>
On Fri, Jul 10, 2026 at 10:52:49AM +0530, Aneesh Kumar K.V wrote:
> >> > /*
> >> > * For host memory encryption and device requiring unencrypted DMA,
> >> > * MMIO memory is treated as shared by default.
> >> > */
> >> > if (attrs & DMA_ATTR_MMIO) {
> >> > if (cc_platform_has(CC_ATTR_HOST_MEM_ENCRYPT) || force_dma_unencrypted(dev))
> >> > attrs |= DMA_ATTR_CC_SHARED;
> >> > }
> >>
> >> Yes, I think it does the trick, preserves the current semantics for AMD.
> >> I guess you could use a single 'if' for all checks (up to you).
> >
> > Please don't change it, MMIO P2P is broken on CC systems today and it
> > should stay broken. Passing DMA_ATTR_MMIO with DMA_ATTR_CC_SHARED is
> > an error that we need to correct in the drivers not make work in the
> > core code.
> >
>
> But the above changes are intended to handle HOST_MEM_ENCRYPT. In v7, we
> had the following diff:
To follow how the rest of the decrypted/encrypted stuff works the MMIO
has to be flaged with CC_SHARED for HOST_MEM_ENCRYPT too, just like
the PTEs.
> @@ -88,37 +88,40 @@ static inline dma_addr_t dma_direct_map_phys(struct device *dev,
> {
> dma_addr_t dma_addr;
>
> + /*
> + * For a device requiring unencrypted DMA, MMIO memory is treated
> + * as shared by default.
> + */
> + if (force_dma_unencrypted(dev) && (attrs & DMA_ATTR_MMIO))
> + attrs |= DMA_ATTR_CC_SHARED;
force_dma_unencrypted() says nothing about the properties of the
address passed in, this was nonsense :\
> As we discussed [1], that can come in a later patch. In the meantime, adding
> the HOST_MEM_ENCRYPT check preserves the previous behavior for SME.
It never worked. When we added ATTR_MMIO it started to have a chance
to work but prior to that it was always broken anyhow. I don't see
there is much merit in preserving the narrow window when we
inadvertantly had a half working ATTR_MMIO.
But if you really want to it should be
cc_platform_has(CC_ATTR_HOST_MEM_ENCRYPT) *only* and get rid of the wrong
force_dma_unencrypted().
But IMHO, I'd rather this series treat ATTR_MMIO as private MMIO and
ATTR_MMIO|CC_SHARED as shared MMIO and that's the right and correct
thing for the DMA API.
Jason
^ permalink raw reply
* Re: [PATCH 10/42] drm: pl111: Use devm_of_reserved_mem_device_init()
From: Linus Walleij @ 2026-07-10 17:45 UTC (permalink / raw)
To: Mukesh Ojha
Cc: Bjorn Andersson, Konrad Dybcio, Liviu Dudau, Maarten Lankhorst,
Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter,
Joel Stanley, Andrew Jeffery, Paul Cercueil, Anitha Chrisanthus,
Paul Kocialkowski, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
Alexey Brodkin, Laurent Pinchart, Tomi Valkeinen, Michal Simek,
Daniel Scally, Jacopo Mondi, Mauro Carvalho Chehab, Eddie James,
Tiffany Lin, Andrew-CT Chen, Yunfei Dong, Minghsiu Tsai,
Houlong Wei, Matthias Brugger, AngeloGioacchino Del Regno,
Joseph Liu, Marvin Lin, Dmitry Osipenko, Krzysztof Kozlowski,
Thierry Reding, Jonathan Hunter, Srinivas Kandagatla,
Arnd Bergmann, Greg Kroah-Hartman, Ge Gordon, Adrian Hunter,
Ulf Hansson, Rob Herring, Saravana Kannan, Mathieu Poirier,
Jaroslav Kysela, Takashi Iwai, Shengjiu Wang, Xiubo Li,
Liam Girdwood, Mark Brown, Frank Li, Sascha Hauer, Peter Ujfalusi,
Bard Liao, Daniel Baluta, Orson Zhai, Baolin Wang, Peter Chen,
Fugang Duan, Ekansh Gupta, BST Linux Kernel Upstream Group,
Fabio Estevam, Nicolin Chen, Pengutronix Kernel Team,
Kai Vehmanen, Pierre-Louis Bossart, Vijendar Mukunda,
Chunyan Zhang, CIX Linux Kernel Upstream Group, linux-arm-msm,
linux-kernel, dri-devel, linux-aspeed, linux-arm-kernel,
linux-mips, linux-sunxi, linux-media, openbmc, linux-mediatek,
kernel, linux-tegra, linux-mmc, devicetree, linux-remoteproc,
linux-staging, linux-sound, linuxppc-dev, imx,
sound-open-firmware
In-Reply-To: <20260703193855.110619-11-mukesh.ojha@oss.qualcomm.com>
On Fri, Jul 3, 2026 at 9:43 PM Mukesh Ojha <mukesh.ojha@oss.qualcomm.com> wrote:
> Switch to devm_of_reserved_mem_device_init() so the reserved memory
> region is released automatically on probe failure or device removal.
> Remove the explicit of_reserved_mem_device_release() calls in the
> dev_put error path and pl111_amba_remove().
>
> Signed-off-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>
Looks good to me:
Reviewed-by: Linus Walleij <linusw@kernel.org>
Yours,
Linus Walleij
^ permalink raw reply
* [powerpc:fixes-test 12/12] arch/powerpc/include/asm/ptrace.h:241:33: error: implicit declaration of function 'BIT'
From: kernel test robot @ 2026-07-10 17:46 UTC (permalink / raw)
To: Mukesh Kumar Chaurasiya (IBM)
Cc: oe-kbuild-all, linuxppc-dev, Madhavan Srinivasan,
Michal Suchánek
tree: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git fixes-test
head: afc2830892a128a13a65f677271a0a48aeb61b5e
commit: afc2830892a128a13a65f677271a0a48aeb61b5e [12/12] powerpc/syscall: Fix syscall skip handling for seccomp and ptrace
config: powerpc-allnoconfig (https://download.01.org/0day-ci/archive/20260711/202607110141.nUx3NKwu-lkp@intel.com/config)
compiler: powerpc-linux-gcc (GCC) 16.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260711/202607110141.nUx3NKwu-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202607110141.nUx3NKwu-lkp@intel.com/
All errors (new ones prefixed by >>):
In file included from arch/powerpc/include/asm/user.h:5,
from include/linux/user.h:1,
from include/linux/elfcore.h:5,
from include/linux/vmcore_info.h:6,
from include/linux/kexec.h:18,
from include/linux/crash_dump.h:5,
from drivers/of/fdt.c:11:
arch/powerpc/include/asm/ptrace.h: In function 'set_syscall_entry_ret':
>> arch/powerpc/include/asm/ptrace.h:241:33: error: implicit declaration of function 'BIT' [-Wimplicit-function-declaration]
241 | #define SYSCALL_ENTRY_RET_SET BIT(0)
| ^~~
arch/powerpc/include/asm/ptrace.h:245:30: note: in expansion of macro 'SYSCALL_ENTRY_RET_SET'
245 | regs->entry_flags |= SYSCALL_ENTRY_RET_SET;
| ^~~~~~~~~~~~~~~~~~~~~
vim +/BIT +241 arch/powerpc/include/asm/ptrace.h
228
229 #define force_successful_syscall_return() \
230 do { \
231 set_thread_flag(TIF_NOERROR); \
232 } while(0)
233
234 #define current_pt_regs() \
235 ((struct pt_regs *)((unsigned long)task_stack_page(current) + THREAD_SIZE) - 1)
236
237 /*
238 * SYSCALL_ENTRY_RET_SET: seccomp or ptrace called syscall_set_return_value()
239 * and wants the syscall skipped; regs->gpr[3] already holds the return value.
240 */
> 241 #define SYSCALL_ENTRY_RET_SET BIT(0)
242
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply
* Re: [PATCH v7 16/22] dma-direct: make dma_direct_map_phys() honor DMA_ATTR_CC_SHARED
From: Aneesh Kumar K.V @ 2026-07-10 19:09 UTC (permalink / raw)
To: Jason Gunthorpe
Cc: Catalin Marinas, iommu, linux-arm-kernel, linux-kernel,
linux-coco, Robin Murphy, Marek Szyprowski, Will Deacon,
Marc Zyngier, Steven Price, Suzuki K Poulose, Jiri Pirko,
Mostafa Saleh, Petr Tesarik, Alexey Kardashevskiy, Dan Williams,
Xu Yilun, linuxppc-dev, linux-s390, Madhavan Srinivasan,
Michael Ellerman, Nicholas Piggin, Christophe Leroy (CS GROUP),
Alexander Gordeev, Gerald Schaefer, Heiko Carstens, Vasily Gorbik,
Christian Borntraeger, Sven Schnelle, x86, Jiri Pirko,
Michael Kelley
In-Reply-To: <20260710161945.GO118978@ziepe.ca>
Jason Gunthorpe <jgg@ziepe.ca> writes:
> On Fri, Jul 10, 2026 at 10:52:49AM +0530, Aneesh Kumar K.V wrote:
>> >> > /*
>> >> > * For host memory encryption and device requiring unencrypted DMA,
>> >> > * MMIO memory is treated as shared by default.
>> >> > */
>> >> > if (attrs & DMA_ATTR_MMIO) {
>> >> > if (cc_platform_has(CC_ATTR_HOST_MEM_ENCRYPT) || force_dma_unencrypted(dev))
>> >> > attrs |= DMA_ATTR_CC_SHARED;
>> >> > }
>> >>
>> >> Yes, I think it does the trick, preserves the current semantics for AMD.
>> >> I guess you could use a single 'if' for all checks (up to you).
>> >
>> > Please don't change it, MMIO P2P is broken on CC systems today and it
>> > should stay broken. Passing DMA_ATTR_MMIO with DMA_ATTR_CC_SHARED is
>> > an error that we need to correct in the drivers not make work in the
>> > core code.
>> >
>>
>> But the above changes are intended to handle HOST_MEM_ENCRYPT. In v7, we
>> had the following diff:
>
> To follow how the rest of the decrypted/encrypted stuff works the MMIO
> has to be flaged with CC_SHARED for HOST_MEM_ENCRYPT too, just like
> the PTEs.
>
>> @@ -88,37 +88,40 @@ static inline dma_addr_t dma_direct_map_phys(struct device *dev,
>> {
>> dma_addr_t dma_addr;
>>
>> + /*
>> + * For a device requiring unencrypted DMA, MMIO memory is treated
>> + * as shared by default.
>> + */
>> + if (force_dma_unencrypted(dev) && (attrs & DMA_ATTR_MMIO))
>> + attrs |= DMA_ATTR_CC_SHARED;
>
> force_dma_unencrypted() says nothing about the properties of the
> address passed in, this was nonsense :\
>
>> As we discussed [1], that can come in a later patch. In the meantime, adding
>> the HOST_MEM_ENCRYPT check preserves the previous behavior for SME.
>
> It never worked. When we added ATTR_MMIO it started to have a chance
> to work but prior to that it was always broken anyhow. I don't see
> there is much merit in preserving the narrow window when we
> inadvertantly had a half working ATTR_MMIO.
>
> But if you really want to it should be
> cc_platform_has(CC_ATTR_HOST_MEM_ENCRYPT) *only* and get rid of the wrong
> force_dma_unencrypted().
>
Ok, I will update the changes to so we preserve the previous behaviour
for SME?
if (attrs & DMA_ATTR_MMIO) {
/*
* For host memory encryption treat MMIO memory as shared
*/
if (cc_platform_has(CC_ATTR_HOST_MEM_ENCRYPT))
attrs |= DMA_ATTR_CC_SHARED;
}
Do let me know if you feel strongly that the above change should not be
included and that the SME P2P case should instead be handled in a future
patch.
>
> But IMHO, I'd rather this series treat ATTR_MMIO as private MMIO and
> ATTR_MMIO|CC_SHARED as shared MMIO and that's the right and correct
> thing for the DMA API.
>
If you think the rest of the series is ready for upstream, could you
please ack it so it can be picked up for the next merge window? I'll
repost v8, rebased on top of the pKVM topic branch.
-aneesh
^ permalink raw reply
* [PATCH v4 4/8] ibmvfc: define asynchronous sub-queue
From: Dave Marquardt via B4 Relay @ 2026-07-10 19:16 UTC (permalink / raw)
To: James E.J. Bottomley, Martin K. Petersen, Madhavan Srinivasan,
Michael Ellerman, Nicholas Piggin, Christophe Leroy (CS GROUP),
Tyrel Datwyler
Cc: linux-kernel, linux-scsi, linuxppc-dev, Brian King, Greg Joyce,
Kyle Mahlkuch, Dave Marquardt
In-Reply-To: <20260710-ibmvfc-fpin-support-v4-0-ef031ac19520@linux.ibm.com>
From: Dave Marquardt <davemarq@linux.ibm.com>
Define data structures for asynchronous sub-queue support required for
full and extended FPIN functionality.
Add ibmvfc_async_subq structure to represent async events received via
the sub-queue, including FPIN status, link state, event type, and WWPN
information.
Update ibmvfc_channel_setup structure to include async_subq_handle field
and reduce IBMVFC_MAX_CHANNELS from 502 to 501 to accommodate the async
sub-queue. Add async_scrq pointer to ibmvfc_channels structure.
Add capability flags IBMVFC_USE_ASYNC_SUBQ and IBMVFC_SUPPORT_ASYNC_SUBQ
for negotiating async sub-queue support with VIOS during login.
Signed-off-by: Dave Marquardt <davemarq@linux.ibm.com>
---
drivers/scsi/ibmvscsi/ibmvfc.h | 25 ++++++++++++++++++++++++-
1 file changed, 24 insertions(+), 1 deletion(-)
diff --git a/drivers/scsi/ibmvscsi/ibmvfc.h b/drivers/scsi/ibmvscsi/ibmvfc.h
index adfd67e85af8..f38dfae9924c 100644
--- a/drivers/scsi/ibmvscsi/ibmvfc.h
+++ b/drivers/scsi/ibmvscsi/ibmvfc.h
@@ -182,6 +182,7 @@ struct ibmvfc_npiv_login {
#define IBMVFC_CAN_USE_MAD_VERSION 0x008
#define IBMVFC_CAN_SEND_VF_WWPN 0x010
#define IBMVFC_YES_SCSI 0x040
+#define IBMVFC_USE_ASYNC_SUBQ 0x100
#define IBMVFC_CAN_USE_NOOP_CMD 0x200
__be64 node_name;
struct srp_direct_buf async;
@@ -230,6 +231,7 @@ struct ibmvfc_npiv_login_resp {
#define IBMVFC_HANDLE_VF_WWPN 0x0040
#define IBMVFC_CAN_SUPPORT_CHANNELS 0x0080
#define IBMVFC_SUPPORT_SCSI 0x0200
+#define IBMVFC_SUPPORT_ASYNC_SUBQ 0x0800
#define IBMVFC_SUPPORT_NOOP_CMD 0x1000
__be32 max_cmds;
__be32 scsi_id_sz;
@@ -564,7 +566,7 @@ struct ibmvfc_channel_setup_mad {
struct srp_direct_buf buffer;
} __packed __aligned(8);
-#define IBMVFC_MAX_CHANNELS 502
+#define IBMVFC_MAX_CHANNELS 501
struct ibmvfc_channel_setup {
__be32 flags;
@@ -579,6 +581,7 @@ struct ibmvfc_channel_setup {
struct srp_direct_buf buffer;
__be64 reserved2[5];
__be64 channel_handles[IBMVFC_MAX_CHANNELS];
+ __be64 async_subq_handle;
} __packed __aligned(8);
struct ibmvfc_connection_info {
@@ -715,6 +718,25 @@ struct ibmvfc_async_work {
struct work_struct async_work_s;
};
+struct ibmvfc_async_subq {
+ volatile u8 valid;
+#define IBMVFC_ASYNC_ID_IS_ASSOC_ID 0x01
+#define IBMVFC_FC_EEH 0x04
+#define IBMVFC_FC_FW_UPDATE 0x08
+#define IBMVFC_FC_FW_DUMP 0x10
+ u8 flags;
+ u8 link_state;
+ u8 fpin_status;
+ __be16 event;
+ __be16 pad;
+ volatile __be64 wwpn;
+ volatile __be64 nport_id;
+ union {
+ __be64 node_name;
+ __be64 assoc_id;
+ } id;
+} __packed __aligned(8);
+
union ibmvfc_iu {
struct ibmvfc_mad_common mad_common;
struct ibmvfc_npiv_login_mad npiv_login;
@@ -854,6 +876,7 @@ struct ibmvfc_queue {
struct ibmvfc_channels {
struct ibmvfc_queue *scrqs;
+ struct ibmvfc_queue *async_scrq;
enum ibmvfc_protocol protocol;
unsigned int active_queues;
unsigned int desired_queues;
--
2.55.0
^ permalink raw reply related
* [PATCH v4 2/8] ibmvfc: Add NOOP command support
From: Dave Marquardt via B4 Relay @ 2026-07-10 19:16 UTC (permalink / raw)
To: James E.J. Bottomley, Martin K. Petersen, Madhavan Srinivasan,
Michael Ellerman, Nicholas Piggin, Christophe Leroy (CS GROUP),
Tyrel Datwyler
Cc: linux-kernel, linux-scsi, linuxppc-dev, Brian King, Greg Joyce,
Kyle Mahlkuch, Dave Marquardt
In-Reply-To: <20260710-ibmvfc-fpin-support-v4-0-ef031ac19520@linux.ibm.com>
From: Dave Marquardt <davemarq@linux.ibm.com>
Add support for VFC_NOOP messages from VIOS to enable keep-alive
functionality between the client and server.
Define the VFC_NOOP CRQ format and add handling in both the main CRQ
handler (ibmvfc_handle_crq) and sub-CRQ handler (ibmvfc_handle_scrq).
Log unexpected NOOP messages if received before VIOS advertises support
during NPIV login.
Set the IBMVFC_CAN_USE_NOOP_CMD capability bit during NPIV login to
inform VIOS that the client can handle NOOP commands.
Signed-off-by: Dave Marquardt <davemarq@linux.ibm.com>
---
drivers/scsi/ibmvscsi/ibmvfc.c | 22 ++++++++++++++++++++--
drivers/scsi/ibmvscsi/ibmvfc.h | 23 +++++++++++++----------
2 files changed, 33 insertions(+), 12 deletions(-)
diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c
index d3fd1d3437c6..a7e3b7ee0683 100644
--- a/drivers/scsi/ibmvscsi/ibmvfc.c
+++ b/drivers/scsi/ibmvscsi/ibmvfc.c
@@ -1512,7 +1512,9 @@ static void ibmvfc_set_login_info(struct ibmvfc_host *vhost)
login_info->flags |= cpu_to_be16(IBMVFC_CLIENT_MIGRATED);
login_info->max_cmds = cpu_to_be32(max_cmds);
- login_info->capabilities = cpu_to_be64(IBMVFC_CAN_MIGRATE | IBMVFC_CAN_SEND_VF_WWPN);
+ login_info->capabilities =
+ cpu_to_be64(IBMVFC_CAN_MIGRATE | IBMVFC_CAN_SEND_VF_WWPN |
+ IBMVFC_CAN_USE_NOOP_CMD);
if (vhost->mq_enabled || vhost->using_channels)
login_info->capabilities |= cpu_to_be64(IBMVFC_CAN_USE_CHANNELS);
@@ -3569,6 +3571,14 @@ static void ibmvfc_handle_crq(struct ibmvfc_crq *crq, struct ibmvfc_host *vhost,
if (crq->format == IBMVFC_ASYNC_EVENT)
return;
+ if (crq->format == IBMVFC_VFC_NOOP) {
+ if (vhost->state == IBMVFC_ACTIVE &&
+ !ibmvfc_check_caps(vhost, IBMVFC_SUPPORT_NOOP_CMD))
+ dev_err_ratelimited(vhost->dev,
+ "Received unexpected NOOP command from partner\n");
+ return;
+ }
+
/* The only kind of payload CRQs we should get are responses to
* things we send. Make sure this response is to something we
* actually sent
@@ -4095,7 +4105,15 @@ static void ibmvfc_handle_scrq(struct ibmvfc_crq *crq, struct ibmvfc_host *vhost
case IBMVFC_CRQ_XPORT_EVENT:
return;
default:
- dev_err(vhost->dev, "Got and invalid message type 0x%02x\n", crq->valid);
+ dev_err(vhost->dev, "Got an invalid message type 0x%02x\n", crq->valid);
+ return;
+ }
+
+ if (crq->format == IBMVFC_VFC_NOOP)
+ return;
+
+ if (unlikely(!evt)) {
+ dev_err(vhost->dev, "Received null event\n");
return;
}
diff --git a/drivers/scsi/ibmvscsi/ibmvfc.h b/drivers/scsi/ibmvscsi/ibmvfc.h
index f69e0605a78d..526632cb7237 100644
--- a/drivers/scsi/ibmvscsi/ibmvfc.h
+++ b/drivers/scsi/ibmvscsi/ibmvfc.h
@@ -175,11 +175,12 @@ struct ibmvfc_npiv_login {
#define IBMVFC_FLUSH_ON_HALT 0x02
__be32 max_cmds;
__be64 capabilities;
-#define IBMVFC_CAN_MIGRATE 0x01
-#define IBMVFC_CAN_USE_CHANNELS 0x02
-#define IBMVFC_CAN_HANDLE_FPIN 0x04
-#define IBMVFC_CAN_USE_MAD_VERSION 0x08
-#define IBMVFC_CAN_SEND_VF_WWPN 0x10
+#define IBMVFC_CAN_MIGRATE 0x001
+#define IBMVFC_CAN_USE_CHANNELS 0x002
+#define IBMVFC_CAN_HANDLE_FPIN 0x004
+#define IBMVFC_CAN_USE_MAD_VERSION 0x008
+#define IBMVFC_CAN_SEND_VF_WWPN 0x010
+#define IBMVFC_CAN_USE_NOOP_CMD 0x200
__be64 node_name;
struct srp_direct_buf async;
u8 partition_name[IBMVFC_MAX_NAME];
@@ -221,11 +222,12 @@ struct ibmvfc_npiv_login_resp {
#define IBMVFC_NATIVE_FC 0x01
__be32 reserved;
__be64 capabilities;
-#define IBMVFC_CAN_FLUSH_ON_HALT 0x08
-#define IBMVFC_CAN_SUPPRESS_ABTS 0x10
-#define IBMVFC_MAD_VERSION_CAP 0x20
-#define IBMVFC_HANDLE_VF_WWPN 0x40
-#define IBMVFC_CAN_SUPPORT_CHANNELS 0x80
+#define IBMVFC_CAN_FLUSH_ON_HALT 0x0008
+#define IBMVFC_CAN_SUPPRESS_ABTS 0x0010
+#define IBMVFC_MAD_VERSION_CAP 0x0020
+#define IBMVFC_HANDLE_VF_WWPN 0x0040
+#define IBMVFC_CAN_SUPPORT_CHANNELS 0x0080
+#define IBMVFC_SUPPORT_NOOP_CMD 0x1000
__be32 max_cmds;
__be32 scsi_id_sz;
__be64 max_dma_len;
@@ -621,6 +623,7 @@ struct ibmvfc_trace_entry {
enum ibmvfc_crq_formats {
IBMVFC_CMD_FORMAT = 0x01,
IBMVFC_ASYNC_EVENT = 0x02,
+ IBMVFC_VFC_NOOP = 0x03,
IBMVFC_MAD_FORMAT = 0x04,
};
--
2.55.0
^ permalink raw reply related
* [PATCH v4 0/8] ibmvfc: make ibmvfc support FPIN messages
From: Dave Marquardt via B4 Relay @ 2026-07-10 19:16 UTC (permalink / raw)
To: James E.J. Bottomley, Martin K. Petersen, Madhavan Srinivasan,
Michael Ellerman, Nicholas Piggin, Christophe Leroy (CS GROUP),
Tyrel Datwyler
Cc: linux-kernel, linux-scsi, linuxppc-dev, Brian King, Greg Joyce,
Kyle Mahlkuch, Dave Marquardt
This patch series adds FPIN (fabric performance impact notification)
support to the ibmvfc (IBM Virtual Fibre Channel) driver. This comes
in three flavors:
- basic, to recognize existing FPIN messages from the virtual I/O
server (VIOS) (patch 1)
- full, supporting additional FPIN information and using its own
asynchronous sub-queue and interrupt (patches 4-7)
- extended, supporting FC-LS-5 (patch 8)
Full and extended FPIN support requires a new asynchronous sub-queue
with its own interrupt. The asynchronous sub-queue support requires
ibmvfc to also support
- a new VFC_NOOP command, which the driver recognizes and
ignores (patch 2)
- fabric login, to login separately to the fabric through messages
exchanged with VIOS rather than doing fabric login through the
existing NPIV login (patch 3)
All three modes convert an incoming FPIN message from VIOS to an FC
extended link service message, in some cases using default values for
information not provided by the VIOS FPIN message but expected in the
FC ELS message. This FC ELS message is passed to fc_host_rcv_fpin for
updating statistics and sending the information upstream by netlink
multicast, where it may be read by listeners including the DM
multipath daemon "multipathd."
Signed-off-by: Dave Marquardt <davemarq@linux.ibm.com>
---
Changes in v4:
- Refactored channel registration
- Check whether async work queue is allocated before using or freeing
- Fixed work queue allocation/destruction
- Skip basic KUnit test when there are no ibmvfc devices available
- Fix target not found condition in ibmvfc_process_async_work
- Link to v3: https://patch.msgid.link/20260702-ibmvfc-fpin-support-v3-0-d95b9547cf88@linux.ibm.com
Changes in v3:
- Fixed latent bug, exposed by VFC_NOOP, related to dataless CRQs and events
- Fixed FPIN TLV descriptor length calculations
- Use safe list walker to walk targets in ibmvfc_process_async_work
- Added write memory barriers after clearing CRQ valid field
- Use per-vhost work queue for FPIN work
- Link to v2: https://patch.msgid.link/20260608-ibmvfc-fpin-support-v2-0-d41f540fba5c@linux.ibm.com
Highlights of changes in v2:
- Refactored mostly common FPIN conversion routines and async event
processing into single routines with wrappers for differences.
- Moved FPIN processing to a work queue to avoid conflicts with
fc_host_fpin_rcv and memory allocation
- Set descriptor sizes correctly
- Use target WWPN for basic FPIN descriptor
- Split patch 4 into 3 patches, for definition, allocation, and use of
the asynchronous sub-queue for events
- Link to v1: https://patch.msgid.link/20260408-ibmvfc-fpin-support-v1-0-52b06c464e03@linux.ibm.com
---
Dave Marquardt (8):
ibmvfc: add basic FPIN support
ibmvfc: Add NOOP command support
ibmvfc: make ibmvfc login to fabric
ibmvfc: define asynchronous sub-queue
ibmvfc: allocate asynchronous sub-queue
ibmvfc: extend async event handlers to handle async sub queue events
ibmvfc: register and use asynchronous sub-queue for events
ibmvfc: handle extended FPIN events
drivers/scsi/Kconfig | 10 +
drivers/scsi/ibmvscsi/Makefile | 1 +
drivers/scsi/ibmvscsi/ibmvfc.c | 736 ++++++++++++++++++++++++++++++++---
drivers/scsi/ibmvscsi/ibmvfc.h | 115 +++++-
drivers/scsi/ibmvscsi/ibmvfc_kunit.c | 240 ++++++++++++
5 files changed, 1031 insertions(+), 71 deletions(-)
---
base-commit: 57a6ed0b41677ccc5e28cc0976e495c1dfa33747
change-id: 20260407-ibmvfc-fpin-support-b9b575cd2da1
Best regards,
--
Dave Marquardt <davemarq@linux.ibm.com>
^ permalink raw reply
* [PATCH v4 5/8] ibmvfc: allocate asynchronous sub-queue
From: Dave Marquardt via B4 Relay @ 2026-07-10 19:16 UTC (permalink / raw)
To: James E.J. Bottomley, Martin K. Petersen, Madhavan Srinivasan,
Michael Ellerman, Nicholas Piggin, Christophe Leroy (CS GROUP),
Tyrel Datwyler
Cc: linux-kernel, linux-scsi, linuxppc-dev, Brian King, Greg Joyce,
Kyle Mahlkuch, Dave Marquardt
In-Reply-To: <20260710-ibmvfc-fpin-support-v4-0-ef031ac19520@linux.ibm.com>
From: Dave Marquardt <davemarq@linux.ibm.com>
Allocate and initialize the asynchronous sub-queue required for receiving
full and extended FPIN events from VIOS.
Modify ibmvfc_alloc_channels() to allocate async_scrq using
ibmvfc_alloc_queue() with IBMVFC_SUB_CRQ_FMT format. Update error
handling to properly clean up async_scrq on allocation failures.
Update ibmvfc_channel_setup() to pass async_subq_handle to VIOS during
channel setup, and ibmvfc_channel_setup_done() to store the VIOS cookie
for the async sub-queue.
Modify ibmvfc_release_channels() to free async_scrq resources during
cleanup.
Signed-off-by: Dave Marquardt <davemarq@linux.ibm.com>
---
drivers/scsi/ibmvscsi/ibmvfc.c | 36 +++++++++++++++++++++++++++++++++---
1 file changed, 33 insertions(+), 3 deletions(-)
diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c
index c95e78d729ed..586847ff3336 100644
--- a/drivers/scsi/ibmvscsi/ibmvfc.c
+++ b/drivers/scsi/ibmvscsi/ibmvfc.c
@@ -5375,6 +5375,9 @@ static void ibmvfc_channel_setup_done(struct ibmvfc_event *evt)
for (i = 0; i < active_queues; i++)
scrqs->scrqs[i].vios_cookie =
be64_to_cpu(setup->channel_handles[i]);
+ if (scrqs->async_scrq)
+ scrqs->async_scrq->vios_cookie =
+ be64_to_cpu(setup->async_subq_handle);
ibmvfc_dbg(vhost, "Using %u channels\n",
vhost->scsi_scrqs.active_queues);
@@ -5425,6 +5428,7 @@ static void ibmvfc_channel_setup(struct ibmvfc_host *vhost)
setup_buf->num_scsi_subq_channels = cpu_to_be32(num_channels);
for (i = 0; i < num_channels; i++)
setup_buf->channel_handles[i] = cpu_to_be64(scrqs->scrqs[i].cookie);
+ setup_buf->async_subq_handle = cpu_to_be64(scrqs->async_scrq->cookie);
}
ibmvfc_init_event(evt, ibmvfc_channel_setup_done, IBMVFC_MAD_FORMAT);
@@ -6392,6 +6396,17 @@ static int ibmvfc_alloc_channels(struct ibmvfc_host *vhost,
if (!channels->scrqs)
return -ENOMEM;
+ channels->async_scrq = kzalloc_obj(*channels->async_scrq, GFP_KERNEL);
+ if (!channels->async_scrq) {
+ rc = -ENOMEM;
+ goto free_scrqs;
+ }
+
+ rc = ibmvfc_alloc_queue(vhost, channels->async_scrq,
+ IBMVFC_SUB_CRQ_FMT);
+ if (rc)
+ goto free_async;
+
for (i = 0; i < channels->max_queues; i++) {
scrq = &channels->scrqs[i];
rc = ibmvfc_alloc_queue(vhost, scrq, IBMVFC_SUB_CRQ_FMT);
@@ -6400,13 +6415,21 @@ static int ibmvfc_alloc_channels(struct ibmvfc_host *vhost,
scrq = &channels->scrqs[j - 1];
ibmvfc_free_queue(vhost, scrq);
}
- kfree(channels->scrqs);
- channels->scrqs = NULL;
+ ibmvfc_free_queue(vhost, channels->async_scrq);
channels->active_queues = 0;
- return rc;
+ goto free_async;
}
}
+ return rc;
+
+free_async:
+ kfree(channels->async_scrq);
+ channels->async_scrq = NULL;
+free_scrqs:
+ kfree(channels->scrqs);
+ channels->scrqs = NULL;
+
return rc;
}
@@ -6441,8 +6464,15 @@ static void ibmvfc_release_channels(struct ibmvfc_host *vhost,
kfree(channels->scrqs);
channels->scrqs = NULL;
+
channels->active_queues = 0;
}
+
+ if (channels->async_scrq) {
+ ibmvfc_free_queue(vhost, channels->async_scrq);
+ kfree(channels->async_scrq);
+ channels->async_scrq = NULL;
+ }
}
static void ibmvfc_release_sub_crqs(struct ibmvfc_host *vhost)
--
2.55.0
^ permalink raw reply related
* [PATCH v4 3/8] ibmvfc: make ibmvfc login to fabric
From: Dave Marquardt via B4 Relay @ 2026-07-10 19:16 UTC (permalink / raw)
To: James E.J. Bottomley, Martin K. Petersen, Madhavan Srinivasan,
Michael Ellerman, Nicholas Piggin, Christophe Leroy (CS GROUP),
Tyrel Datwyler
Cc: linux-kernel, linux-scsi, linuxppc-dev, Brian King, Greg Joyce,
Kyle Mahlkuch, Dave Marquardt
In-Reply-To: <20260710-ibmvfc-fpin-support-v4-0-ef031ac19520@linux.ibm.com>
From: Dave Marquardt <davemarq@linux.ibm.com>
Add fabric login capability to support asynchronous event queue with
dedicated interrupt as required by NPIV specification for async sub-queue
and full/extended FPIN message support.
Implement ibmvfc_fabric_login() to perform fabric login using MAD
(Management Adapter Data) format. Add ibmvfc_fabric_login_done() callback
to handle login completion, including error handling and retry logic.
On successful fabric login, store the assigned N_Port ID in the FC host
structure and transition to IBMVFC_HOST_ACTION_QUERY state to continue
initialization.
Signed-off-by: Dave Marquardt <davemarq@linux.ibm.com>
---
drivers/scsi/ibmvscsi/ibmvfc.c | 96 ++++++++++++++++++++++++++++++++++++++++--
drivers/scsi/ibmvscsi/ibmvfc.h | 17 ++++++++
2 files changed, 109 insertions(+), 4 deletions(-)
diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c
index a7e3b7ee0683..c95e78d729ed 100644
--- a/drivers/scsi/ibmvscsi/ibmvfc.c
+++ b/drivers/scsi/ibmvscsi/ibmvfc.c
@@ -5265,6 +5265,88 @@ static void ibmvfc_discover_targets(struct ibmvfc_host *vhost)
ibmvfc_link_down(vhost, IBMVFC_LINK_DEAD);
}
+static void ibmvfc_fabric_login_done(struct ibmvfc_event *evt)
+{
+ struct ibmvfc_fabric_login *rsp = &evt->xfer_iu->fabric_login;
+ u32 mad_status = be16_to_cpu(rsp->common.status);
+ struct ibmvfc_host *vhost = evt->vhost;
+ int level = IBMVFC_DEFAULT_LOG_LEVEL;
+
+ ENTER;
+
+ switch (mad_status) {
+ case IBMVFC_MAD_SUCCESS:
+ fc_host_port_id(vhost->host) = be64_to_cpu(rsp->nport_id);
+ ibmvfc_free_event(evt);
+ break;
+
+ case IBMVFC_MAD_FAILED:
+ if (ibmvfc_retry_cmd(be16_to_cpu(rsp->status), be16_to_cpu(rsp->error)))
+ level += ibmvfc_retry_host_init(vhost);
+ else
+ ibmvfc_link_down(vhost, IBMVFC_LINK_DEAD);
+ ibmvfc_log(vhost, level, "Fabric Login failed: %s (%x:%x)\n",
+ ibmvfc_get_cmd_error(be16_to_cpu(rsp->status), be16_to_cpu(rsp->error)),
+ be16_to_cpu(rsp->status), be16_to_cpu(rsp->error));
+ ibmvfc_free_event(evt);
+ LEAVE;
+ return;
+
+ case IBMVFC_MAD_CRQ_ERROR:
+ ibmvfc_retry_host_init(vhost);
+ fallthrough;
+
+ case IBMVFC_MAD_DRIVER_FAILED:
+ ibmvfc_free_event(evt);
+ LEAVE;
+ return;
+
+ default:
+ dev_err(vhost->dev, "Invalid fabric Login response: 0x%x\n", mad_status);
+ ibmvfc_link_down(vhost, IBMVFC_LINK_DEAD);
+ ibmvfc_free_event(evt);
+ LEAVE;
+ return;
+ }
+
+ ibmvfc_set_host_action(vhost, IBMVFC_HOST_ACTION_QUERY);
+ wake_up(&vhost->work_wait_q);
+
+ LEAVE;
+}
+
+static void ibmvfc_fabric_login(struct ibmvfc_host *vhost)
+{
+ struct ibmvfc_fabric_login *mad;
+ struct ibmvfc_event *evt;
+ int level = IBMVFC_DEFAULT_LOG_LEVEL;
+
+ if (vhost->scsi_scrqs.protocol != IBMVFC_PROTO_SCSI) {
+ ibmvfc_log(vhost, level, "Fabric Login failed: unknown protocol\n");
+ ibmvfc_hard_reset_host(vhost);
+ return;
+ }
+
+ evt = ibmvfc_get_reserved_event(&vhost->crq);
+ if (!evt) {
+ ibmvfc_log(vhost, level, "Fabric Login failed: no available events\n");
+ ibmvfc_hard_reset_host(vhost);
+ return;
+ }
+
+ ibmvfc_init_event(evt, ibmvfc_fabric_login_done, IBMVFC_MAD_FORMAT);
+ mad = &evt->iu.fabric_login;
+ memset(mad, 0, sizeof(*mad));
+ mad->common.opcode = cpu_to_be32(IBMVFC_FABRIC_LOGIN);
+ mad->common.version = cpu_to_be32(1);
+ mad->common.length = cpu_to_be16(sizeof(*mad));
+
+ ibmvfc_set_host_action(vhost, IBMVFC_HOST_ACTION_INIT_WAIT);
+
+ if (ibmvfc_send_event(evt, vhost, default_timeout))
+ ibmvfc_link_down(vhost, IBMVFC_LINK_DOWN);
+}
+
static void ibmvfc_channel_setup_done(struct ibmvfc_event *evt)
{
struct ibmvfc_host *vhost = evt->vhost;
@@ -5311,8 +5393,12 @@ static void ibmvfc_channel_setup_done(struct ibmvfc_event *evt)
return;
}
- ibmvfc_set_host_action(vhost, IBMVFC_HOST_ACTION_QUERY);
- wake_up(&vhost->work_wait_q);
+ if (ibmvfc_check_caps(vhost, IBMVFC_SUPPORT_SCSI)) {
+ ibmvfc_fabric_login(vhost);
+ } else {
+ ibmvfc_set_host_action(vhost, IBMVFC_HOST_ACTION_QUERY);
+ wake_up(&vhost->work_wait_q);
+ }
}
static void ibmvfc_channel_setup(struct ibmvfc_host *vhost)
@@ -5503,9 +5589,11 @@ static void ibmvfc_npiv_login_done(struct ibmvfc_event *evt)
vhost->host->can_queue = be32_to_cpu(rsp->max_cmds) - IBMVFC_NUM_INTERNAL_REQ;
vhost->host->max_sectors = npiv_max_sectors;
- if (ibmvfc_check_caps(vhost, IBMVFC_CAN_SUPPORT_CHANNELS) && vhost->do_enquiry) {
+ if (ibmvfc_check_caps(vhost, IBMVFC_CAN_SUPPORT_CHANNELS) && vhost->do_enquiry)
ibmvfc_channel_enquiry(vhost);
- } else {
+ else if (ibmvfc_check_caps(vhost, IBMVFC_SUPPORT_SCSI))
+ ibmvfc_fabric_login(vhost);
+ else {
vhost->do_enquiry = 0;
ibmvfc_set_host_action(vhost, IBMVFC_HOST_ACTION_QUERY);
wake_up(&vhost->work_wait_q);
diff --git a/drivers/scsi/ibmvscsi/ibmvfc.h b/drivers/scsi/ibmvscsi/ibmvfc.h
index 526632cb7237..adfd67e85af8 100644
--- a/drivers/scsi/ibmvscsi/ibmvfc.h
+++ b/drivers/scsi/ibmvscsi/ibmvfc.h
@@ -138,6 +138,7 @@ enum ibmvfc_mad_types {
IBMVFC_CHANNEL_ENQUIRY = 0x1000,
IBMVFC_CHANNEL_SETUP = 0x2000,
IBMVFC_CONNECTION_INFO = 0x4000,
+ IBMVFC_FABRIC_LOGIN = 0x8000,
};
struct ibmvfc_mad_common {
@@ -180,6 +181,7 @@ struct ibmvfc_npiv_login {
#define IBMVFC_CAN_HANDLE_FPIN 0x004
#define IBMVFC_CAN_USE_MAD_VERSION 0x008
#define IBMVFC_CAN_SEND_VF_WWPN 0x010
+#define IBMVFC_YES_SCSI 0x040
#define IBMVFC_CAN_USE_NOOP_CMD 0x200
__be64 node_name;
struct srp_direct_buf async;
@@ -227,6 +229,7 @@ struct ibmvfc_npiv_login_resp {
#define IBMVFC_MAD_VERSION_CAP 0x0020
#define IBMVFC_HANDLE_VF_WWPN 0x0040
#define IBMVFC_CAN_SUPPORT_CHANNELS 0x0080
+#define IBMVFC_SUPPORT_SCSI 0x0200
#define IBMVFC_SUPPORT_NOOP_CMD 0x1000
__be32 max_cmds;
__be32 scsi_id_sz;
@@ -590,6 +593,19 @@ struct ibmvfc_connection_info {
__be64 reserved[16];
} __packed __aligned(8);
+struct ibmvfc_fabric_login {
+ struct ibmvfc_mad_common common;
+ __be64 flags;
+#define IBMVFC_STRIP_MERGE 0x1
+#define IBMVFC_LINK_COMMANDS 0x2
+ __be64 capabilities;
+ __be64 nport_id;
+ __be16 status;
+ __be16 error;
+ __be32 pad;
+ __be64 reserved[16];
+} __packed __aligned(8);
+
struct ibmvfc_trace_start_entry {
u32 xfer_len;
} __packed;
@@ -715,6 +731,7 @@ union ibmvfc_iu {
struct ibmvfc_channel_enquiry channel_enquiry;
struct ibmvfc_channel_setup_mad channel_setup;
struct ibmvfc_connection_info connection_info;
+ struct ibmvfc_fabric_login fabric_login;
} __packed __aligned(8);
enum ibmvfc_target_action {
--
2.55.0
^ permalink raw reply related
* [PATCH v4 7/8] ibmvfc: register and use asynchronous sub-queue for events
From: Dave Marquardt via B4 Relay @ 2026-07-10 19:16 UTC (permalink / raw)
To: James E.J. Bottomley, Martin K. Petersen, Madhavan Srinivasan,
Michael Ellerman, Nicholas Piggin, Christophe Leroy (CS GROUP),
Tyrel Datwyler
Cc: linux-kernel, linux-scsi, linuxppc-dev, Brian King, Greg Joyce,
Kyle Mahlkuch, Dave Marquardt
In-Reply-To: <20260710-ibmvfc-fpin-support-v4-0-ef031ac19520@linux.ibm.com>
From: Dave Marquardt <davemarq@linux.ibm.com>
Complete async sub-queue integration by setting up interrupt handling,
registering the queue as a channel, and enabling its use during NPIV
login.
Add ibmvfc_interrupt_async_subq() interrupt handler and
ibmvfc_drain_async_subq() to process events from the async sub-queue.
Refactor ibmvfc_register_channel() into ibmvfc_register_channel_common()
to support both regular sub-CRQs and the async sub-queue with different
interrupt handlers.
Update ibmvfc_set_login_info() to set IBMVFC_CAN_USE_CHANNELS,
IBMVFC_YES_SCSI, IBMVFC_USE_ASYNC_SUBQ, and IBMVFC_CAN_HANDLE_FPIN
capability bits when channels are enabled, informing VIOS that the client
supports async sub-queue and FPIN handling.
Register async_scrq during channel initialization and unregister during
cleanup.
---
drivers/scsi/ibmvscsi/ibmvfc.c | 146 ++++++++++++++++++++++++++++++++++-------
1 file changed, 124 insertions(+), 22 deletions(-)
diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c
index ee56f13f1a97..eb786ac24274 100644
--- a/drivers/scsi/ibmvscsi/ibmvfc.c
+++ b/drivers/scsi/ibmvscsi/ibmvfc.c
@@ -1517,7 +1517,9 @@ static void ibmvfc_set_login_info(struct ibmvfc_host *vhost)
IBMVFC_CAN_USE_NOOP_CMD);
if (vhost->mq_enabled || vhost->using_channels)
- login_info->capabilities |= cpu_to_be64(IBMVFC_CAN_USE_CHANNELS);
+ login_info->capabilities |=
+ cpu_to_be64(IBMVFC_CAN_USE_CHANNELS | IBMVFC_YES_SCSI |
+ IBMVFC_USE_ASYNC_SUBQ | IBMVFC_CAN_HANDLE_FPIN);
login_info->async.va = cpu_to_be64(vhost->async_crq.msg_token);
login_info->async.len = cpu_to_be32(async_crq->size *
@@ -4243,6 +4245,52 @@ static struct ibmvfc_crq *ibmvfc_next_scrq(struct ibmvfc_queue *scrq)
return crq;
}
+static void ibmvfc_drain_async_subq(struct ibmvfc_queue *scrq)
+{
+ struct ibmvfc_host *vhost = scrq->vhost;
+ struct ibmvfc_crq *crq;
+ unsigned long flags;
+ int done = 0;
+
+ spin_lock_irqsave(vhost->host->host_lock, flags);
+ spin_lock(scrq->q_lock);
+ while (!done) {
+ while ((crq = ibmvfc_next_scrq(scrq)) != NULL) {
+ ibmvfc_handle_async(crq, scrq->vhost, true);
+ crq->valid = 0;
+ wmb(); /* complete write */
+ }
+
+ ibmvfc_toggle_scrq_irq(scrq, 1);
+ crq = ibmvfc_next_scrq(scrq);
+ if (crq != NULL) {
+ ibmvfc_toggle_scrq_irq(scrq, 0);
+ ibmvfc_handle_async(crq, scrq->vhost, true);
+ crq->valid = 0;
+ wmb(); /* complete write */
+ } else
+ done = 1;
+ }
+ spin_unlock(scrq->q_lock);
+ spin_unlock_irqrestore(vhost->host->host_lock, flags);
+}
+
+/**
+ * ibmvfc_interrupt_asyncq - Handle an async event from the adapter
+ * @irq: interrupt request
+ * @scrq_instance: async subq
+ *
+ **/
+static irqreturn_t ibmvfc_interrupt_async_subq(int irq, void *scrq_instance)
+{
+ struct ibmvfc_queue *scrq = (struct ibmvfc_queue *)scrq_instance;
+
+ ibmvfc_toggle_scrq_irq(scrq, 0);
+ ibmvfc_drain_async_subq(scrq);
+
+ return IRQ_HANDLED;
+}
+
static void ibmvfc_drain_sub_crq(struct ibmvfc_queue *scrq)
{
struct ibmvfc_crq *crq;
@@ -6340,14 +6388,29 @@ static int ibmvfc_init_crq(struct ibmvfc_host *vhost)
return retrc;
}
-static int ibmvfc_register_channel(struct ibmvfc_host *vhost,
- struct ibmvfc_channels *channels,
- int index)
+/**
+ * ibmvfc_register_channel_common - Register a sub-CRQ with the hypervisor
+ * @vhost: ibmvfc host struct
+ * @channels: ibmvfc channels struct
+ * @scrq: sub-CRQ to register
+ * @index: channel index (negative for async)
+ * @irq: interrupt handler for the sub-CRQ
+ *
+ * Return value:
+ * 0 on success / non-zero on failure
+ **/
+static int ibmvfc_register_channel_common(struct ibmvfc_host *vhost,
+ struct ibmvfc_channels *channels,
+ struct ibmvfc_queue *scrq,
+ int index,
+ irq_handler_t irq)
{
struct device *dev = vhost->dev;
struct vio_dev *vdev = to_vio_dev(dev);
- struct ibmvfc_queue *scrq = &channels->scrqs[index];
+ long hcall_rc;
int rc = -ENOMEM;
+ const char *name_suffix;
+ bool is_async = (index < 0);
ENTER;
@@ -6366,20 +6429,19 @@ static int ibmvfc_register_channel(struct ibmvfc_host *vhost,
if (!scrq->irq) {
rc = -EINVAL;
- dev_err(dev, "Error mapping sub-crq[%d] irq\n", index);
+ if (is_async)
+ dev_err(dev, "Error mapping sub-crq[%s] irq\n", "async");
+ else
+ dev_err(dev, "Error mapping sub-crq[%d] irq\n", index);
goto irq_failed;
}
switch (channels->protocol) {
case IBMVFC_PROTO_SCSI:
- snprintf(scrq->name, sizeof(scrq->name), "ibmvfc-%x-scsi%d",
- vdev->unit_address, index);
- scrq->handler = ibmvfc_interrupt_mq;
+ name_suffix = "scsi";
break;
case IBMVFC_PROTO_NVME:
- snprintf(scrq->name, sizeof(scrq->name), "ibmvfc-%x-nvmf%d",
- vdev->unit_address, index);
- scrq->handler = ibmvfc_interrupt_mq;
+ name_suffix = "nvmf";
break;
default:
dev_err(dev, "Unknown channel protocol (%d)\n",
@@ -6387,35 +6449,63 @@ static int ibmvfc_register_channel(struct ibmvfc_host *vhost,
goto irq_failed;
}
+ if (is_async) {
+ snprintf(scrq->name, sizeof(scrq->name), "ibmvfc-%x-%s%s",
+ vdev->unit_address, name_suffix, "async");
+ scrq->handler = irq;
+ } else {
+ snprintf(scrq->name, sizeof(scrq->name), "ibmvfc-%x-%s%d",
+ vdev->unit_address, name_suffix, index);
+ scrq->handler = irq ? irq : ibmvfc_interrupt_mq;
+ scrq->hwq_id = index;
+ }
+
rc = request_irq(scrq->irq, scrq->handler, 0, scrq->name, scrq);
if (rc) {
- dev_err(dev, "Couldn't register sub-crq[%d] irq\n", index);
+ if (is_async)
+ dev_err(dev, "Couldn't register sub-crq[%s] irq\n", "async");
+ else
+ dev_err(dev, "Couldn't register sub-crq[%d] irq\n", index);
irq_dispose_mapping(scrq->irq);
goto irq_failed;
}
- scrq->hwq_id = index;
-
LEAVE;
return 0;
irq_failed:
do {
- rc = plpar_hcall_norets(H_FREE_SUB_CRQ, vdev->unit_address, scrq->cookie);
- } while (rc == H_BUSY || H_IS_LONG_BUSY(rc));
+ hcall_rc = plpar_hcall_norets(H_FREE_SUB_CRQ, vdev->unit_address, scrq->cookie);
+ } while (hcall_rc == H_BUSY || H_IS_LONG_BUSY(hcall_rc));
reg_failed:
LEAVE;
return rc;
}
+static int ibmvfc_register_channel_async(struct ibmvfc_host *vhost,
+ struct ibmvfc_channels *channels,
+ struct ibmvfc_queue *scrq,
+ irq_handler_t irq)
+{
+ return ibmvfc_register_channel_common(vhost, channels, scrq, -1, irq);
+}
+
+static int ibmvfc_register_channel(struct ibmvfc_host *vhost,
+ struct ibmvfc_channels *channels,
+ int index)
+{
+ struct ibmvfc_queue *scrq = &channels->scrqs[index];
+
+ return ibmvfc_register_channel_common(vhost, channels, scrq, index, NULL);
+}
+
static void ibmvfc_deregister_channel(struct ibmvfc_host *vhost,
struct ibmvfc_channels *channels,
- int index)
+ struct ibmvfc_queue *scrq)
{
struct device *dev = vhost->dev;
struct vio_dev *vdev = to_vio_dev(dev);
- struct ibmvfc_queue *scrq = &channels->scrqs[index];
long rc;
ENTER;
@@ -6430,7 +6520,7 @@ static void ibmvfc_deregister_channel(struct ibmvfc_host *vhost,
} while (rc == H_BUSY || H_IS_LONG_BUSY(rc));
if (rc)
- dev_err(dev, "Failed to free sub-crq[%d]: rc=%ld\n", index, rc);
+ dev_err(dev, "Failed to free sub-crq[%s]: rc=%ld\n", scrq->name, rc);
/* Clean out the queue */
memset(scrq->msgs.crq, 0, PAGE_SIZE);
@@ -6448,10 +6538,21 @@ static void ibmvfc_reg_sub_crqs(struct ibmvfc_host *vhost,
if (!vhost->mq_enabled || !channels->scrqs)
return;
+ if (ibmvfc_register_channel_async(vhost, channels,
+ channels->async_scrq,
+ ibmvfc_interrupt_async_subq)) {
+ vhost->do_enquiry = 0;
+ return;
+ }
+
for (i = 0; i < channels->max_queues; i++) {
if (ibmvfc_register_channel(vhost, channels, i)) {
for (j = i; j > 0; j--)
- ibmvfc_deregister_channel(vhost, channels, j - 1);
+ ibmvfc_deregister_channel(
+ vhost, channels, &channels->scrqs[j - 1]);
+ ibmvfc_deregister_channel(vhost, channels,
+ channels->async_scrq);
+
vhost->do_enquiry = 0;
return;
}
@@ -6470,7 +6571,8 @@ static void ibmvfc_dereg_sub_crqs(struct ibmvfc_host *vhost,
return;
for (i = 0; i < channels->max_queues; i++)
- ibmvfc_deregister_channel(vhost, channels, i);
+ ibmvfc_deregister_channel(vhost, channels, &channels->scrqs[i]);
+ ibmvfc_deregister_channel(vhost, channels, channels->async_scrq);
LEAVE;
}
--
2.55.0
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox