From nobody Fri Oct 10 21:14:38 2025 Received: from esa3.hc555-34.eu.iphmx.com (esa3.hc555-34.eu.iphmx.com [207.54.77.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D698A2566D1; Thu, 12 Jun 2025 14:39:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=207.54.77.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749739167; cv=none; b=lVmZgj7nY8wVQwhWLDOebnz5sKj4yH5Ehgj486R4iYXW8nkwVskR/ND4/BsiNY+HE6JfwHjPxFDAey/5xBfHjltwm/hQL3Tlmx6J9stl+STRCo0hknibWhZEzPx9qOIRBvvtxas0nj+pTgjaZsmmmcw68qjOmUK3tnwo6xGTc7w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749739167; c=relaxed/simple; bh=TOqVmhZr+3+F6SSr0o3CVr7UW9s5G0m391KmKzLln1w=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=U1o2TL7DzSSeY48mRRXf0IKFszYZvXsN2AwkGCbMgI3y2ixYcBTqDmT8oztYbjKWhZgaQSZxrLZEUst1faqmUtwsn0VgJQxdmW+8y8V7obRLI6/RdWoAoAogX/WHzbB0pPYZfRutO6YSs2isHw8fCCwX2fRyc57mTmGjv+QmpDw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=mobileye.com; spf=pass smtp.mailfrom=mobileye.com; dkim=fail (0-bit key) header.d=mobileye.com header.i=@mobileye.com header.b=W9zklm+C reason="key not found in DNS"; arc=none smtp.client-ip=207.54.77.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=mobileye.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=mobileye.com Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="key not found in DNS" (0-bit key) header.d=mobileye.com header.i=@mobileye.com header.b="W9zklm+C" DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mobileye.com; i=@mobileye.com; q=dns/txt; s=MoEyIP; t=1749739165; x=1781275165; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=TOqVmhZr+3+F6SSr0o3CVr7UW9s5G0m391KmKzLln1w=; b=W9zklm+C7O4aOKFWumbziRLGUaTKdfsyZCzDElz4yzpTI3/F+/IVVKLR 4UcPX48Gm7jiIzIrS81tT2oke2b2AmaTQpHda0Xk06IIcoEOax0CD3F78 HIqeoTHGeEk1cMjHH4zRZOo1F2FmVdUBFePioyuaqwP2OKNhuTR+j1R42 Xk8kst2tQNrgc2mQkMWxewGioYC2yyxq0JgL+/zAAsmtWyHnpFPY6lQCK bKygW4h8ZnAQzAC9P8BYEDXpyVI1XYA6qcc5KvbxoT+XohikSfMqeMyhN IojmjoAsIvVr5HprZMSmLPWIbI12//sHIE0nW/bOzyW3J7tDXq1noO1IL A==; X-CSE-ConnectionGUID: FyMY0vSXSSyly/jgsizkFA== X-CSE-MsgGUID: kNzQqysHRFemZW6EE+rBig== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from unknown (HELO ces03_data.me-corp.lan) ([146.255.191.134]) by esa3.hc555-34.eu.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jun 2025 17:39:16 +0300 X-CSE-ConnectionGUID: Sir/HMzRSLSNIi8/c/f4xw== X-CSE-MsgGUID: ewezxy20TNmtEFUeqzmlhQ== Received: from unknown (HELO epgd071.me-corp.lan) ([10.154.54.1]) by ces03_data.me-corp.lan with SMTP; 12 Jun 2025 17:39:14 +0300 Received: by epgd071.me-corp.lan (sSMTP sendmail emulation); Thu, 12 Jun 2025 17:39:15 +0300 From: Vladimir Kondratiev To: Thomas Gleixner , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , Anup Patel , Chen Wang , Inochi Amaoto , Sunil V L , "Rafael J . Wysocki" , Ryo Takakura Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-riscv@lists.infradead.org, sophgo@lists.linux.dev, Vladimir Kondratiev Subject: [PATCH v3 1/7] riscv: helper to parse hart index Date: Thu, 12 Jun 2025 17:39:05 +0300 Message-ID: <20250612143911.3224046-2-vladimir.kondratiev@mobileye.com> In-Reply-To: <20250612143911.3224046-1-vladimir.kondratiev@mobileye.com> References: <20250609134749.1453835-1-vladimir.kondratiev@mobileye.com> <20250612143911.3224046-1-vladimir.kondratiev@mobileye.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable RISC-V APLIC specification defines "hart index" in [1] And similar definitions found for ACLINT in [2] Quote from [1]: Within a given interrupt domain, each of the domain=E2=80=99s harts has a u= nique index number in the range 0 to 2^14 =E2=88=92 1 (=3D 16,383). The index num= ber a domain associates with a hart may or may not have any relationship to the unique hart identifier (=E2=80=9Chart ID=E2=80=9D) that the RISC-V Privileg= ed Architecture assigns to the hart. Two different interrupt domains may employ entirely different index numbers for the same set of harts. Further, [1] says in "4.5 Memory-mapped control region for an interrupt domain": The array of IDC structures may include some for potential hart index numbers that are not actual hart index numbers in the domain. For example, the first IDC structure is always for hart index 0, but 0 is not necessarily a valid index number for any hart in the domain. Support arbitrary hart indices specified in an optional property "riscv,hart-indexes" which is specified as an array of u32 elements, one per interrupt target, listing hart indexes in the same order as in "interrupts-extended". If this property is not specified, fallback to use logical hart indices within the domain. If property not exist, fall back to logical hart indexes Link: https://github.com/riscv/riscv-aia [1] Link: https://github.com/riscvarchive/riscv-aclint [2] Signed-off-by: Vladimir Kondratiev --- arch/riscv/include/asm/irq.h | 2 ++ arch/riscv/kernel/irq.c | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/arch/riscv/include/asm/irq.h b/arch/riscv/include/asm/irq.h index 7b038f3b7cb0..59c975f750c9 100644 --- a/arch/riscv/include/asm/irq.h +++ b/arch/riscv/include/asm/irq.h @@ -22,6 +22,8 @@ void arch_trigger_cpumask_backtrace(const cpumask_t *mask= , int exclude_cpu); void riscv_set_intc_hwnode_fn(struct fwnode_handle *(*fn)(void)); =20 struct fwnode_handle *riscv_get_intc_hwnode(void); +int riscv_get_hart_index(struct fwnode_handle *fwnode, u32 logical_index, + u32 *hart_index); =20 #ifdef CONFIG_ACPI =20 diff --git a/arch/riscv/kernel/irq.c b/arch/riscv/kernel/irq.c index 9ceda02507ca..b6af20bc300f 100644 --- a/arch/riscv/kernel/irq.c +++ b/arch/riscv/kernel/irq.c @@ -32,6 +32,40 @@ struct fwnode_handle *riscv_get_intc_hwnode(void) } EXPORT_SYMBOL_GPL(riscv_get_intc_hwnode); =20 +/** + * riscv_get_hart_index() - get hart index for interrupt delivery + * @fwnode: interrupt controller node + * @logical_index: index within the "interrupts-extended" property + * @hart_index: filled with the hart index to use + * + * RISC-V uses term "hart index" for its interrupt controllers, for the + * purpose of the interrupt routing to destination harts. + * It may be arbitrary numbers assigned to each destination hart in context + * of the particular interrupt domain. + * + * These numbers encoded in the optional property "riscv,hart-indexes" + * that should contain hart index for each interrupt destination in the sa= me + * order as in the "interrupts-extended" property. If this property + * not exist, it assumed equal to the logical index, i.e. index within the + * "interrupts-extended" property. + * + * Return: error code + */ +int riscv_get_hart_index(struct fwnode_handle *fwnode, u32 logical_index, + u32 *hart_index) +{ + static const char *prop_hart_index =3D "riscv,hart-indexes"; + struct device_node *np =3D to_of_node(fwnode); + + if (!np || !of_property_present(np, prop_hart_index)) { + *hart_index =3D logical_index; + return 0; + } + + return of_property_read_u32_index(np, prop_hart_index, + logical_index, hart_index); +} + #ifdef CONFIG_IRQ_STACKS #include =20 --=20 2.43.0 From nobody Fri Oct 10 21:14:38 2025 Received: from esa1.hc555-34.eu.iphmx.com (esa1.hc555-34.eu.iphmx.com [23.90.104.144]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ABD12256C80; Thu, 12 Jun 2025 14:39:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=23.90.104.144 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749739170; cv=none; b=srQ6qOANhjDTsi+rhCg1VkUNR/R7ZIbB5iS3IgE99prOsFZfBYhiZSyFogXgqW8aildIZaLPweJseX+ov8g6lwTtXROf5A3rCAhGiT51Yvw2q1kluyTcx5zGxXILw1tfY8vk3Z2hn3bw6vtflRN9tUfBaDSGZbP62vA8HRfJ6EQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749739170; c=relaxed/simple; bh=S4SlciKZEDkvxxA53sOZjgI7BGGyzxMFgS4kqW029qc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=uFIo9IVRqJnBkxMiamvri2vcI7QFmbsqFdY70u+oR8rBsQQKO5RAZsGdOl99tlNLOpMFIZQ2nFVhVjSdE3bVbvBWkl75lr3Z2dF0ROHHdPr7WrFLWVneeQMM+Ee2ZzClETH48v+T0dMLMyGGIcXGp8ngh9/HeplhHWtw3Dj9oDw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=mobileye.com; spf=pass smtp.mailfrom=mobileye.com; dkim=fail (0-bit key) header.d=mobileye.com header.i=@mobileye.com header.b=Omu73LlD reason="key not found in DNS"; arc=none smtp.client-ip=23.90.104.144 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=mobileye.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=mobileye.com Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="key not found in DNS" (0-bit key) header.d=mobileye.com header.i=@mobileye.com header.b="Omu73LlD" DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mobileye.com; i=@mobileye.com; q=dns/txt; s=MoEyIP; t=1749739168; x=1781275168; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=S4SlciKZEDkvxxA53sOZjgI7BGGyzxMFgS4kqW029qc=; b=Omu73LlDLfotXtgfJT/UvlxaqDNQBPrh+synv5fl0DeL2K6yZqTJtCCu p9Zr/HW6iNFdPEkZTjBwsMXo9SqCFhWAXnA5rLHBcFKkV0oyNcAmu+dJx I15XMy6Wnq6Xf1yAUTlGts6O1CCFDqVVQar3LFlaQUm0s6NnDmrW8z2LA Ihiof6qPXDJs6e51qML3Hz+v48m4Bq8zEkLU5rCvdF8NmJD9eL11CtCcy oWzVseeyifz82GbPFXAjax6xZjmI20GUBhVLUxar8/rO2A2gSPE0g4wsr JsnIIk4v8Jf3OOo4VMUoDenf+x6suGX7qLN0eZShHVxjAwS3w4Ytzv4ns w==; X-CSE-ConnectionGUID: un4Mo7nPRqidx0IW4sWGuw== X-CSE-MsgGUID: SoOIPtFGRlWQZzle/8EKEw== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from unknown (HELO ces04_data.me-crop.lan) ([146.255.191.134]) by esa1.hc555-34.eu.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jun 2025 17:39:17 +0300 X-CSE-ConnectionGUID: ZVDzdeJHScyNoWOTNPStaQ== X-CSE-MsgGUID: LpmPiIX0Rj2MIafJbAzrDQ== Received: from unknown (HELO epgd071.me-corp.lan) ([10.154.54.6]) by ces04_data.me-crop.lan with SMTP; 12 Jun 2025 17:39:15 +0300 Received: by epgd071.me-corp.lan (sSMTP sendmail emulation); Thu, 12 Jun 2025 17:39:16 +0300 From: Vladimir Kondratiev To: Thomas Gleixner , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , Anup Patel , Chen Wang , Inochi Amaoto , Sunil V L , "Rafael J . Wysocki" , Ryo Takakura Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-riscv@lists.infradead.org, sophgo@lists.linux.dev, Vladimir Kondratiev Subject: [PATCH v3 2/7] irqchip/riscv-aplic: use riscv_get_hart_index() Date: Thu, 12 Jun 2025 17:39:06 +0300 Message-ID: <20250612143911.3224046-3-vladimir.kondratiev@mobileye.com> In-Reply-To: <20250612143911.3224046-1-vladimir.kondratiev@mobileye.com> References: <20250609134749.1453835-1-vladimir.kondratiev@mobileye.com> <20250612143911.3224046-1-vladimir.kondratiev@mobileye.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Use global helper function instead of the local implementation Signed-off-by: Vladimir Kondratiev --- drivers/irqchip/irq-riscv-aplic-direct.c | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/drivers/irqchip/irq-riscv-aplic-direct.c b/drivers/irqchip/irq= -riscv-aplic-direct.c index 205ad61d15e4..c2a75bf3d20c 100644 --- a/drivers/irqchip/irq-riscv-aplic-direct.c +++ b/drivers/irqchip/irq-riscv-aplic-direct.c @@ -219,20 +219,6 @@ static int aplic_direct_parse_parent_hwirq(struct devi= ce *dev, u32 index, return 0; } =20 -static int aplic_direct_get_hart_index(struct device *dev, u32 logical_ind= ex, - u32 *hart_index) -{ - const char *prop_hart_index =3D "riscv,hart-indexes"; - struct device_node *np =3D to_of_node(dev->fwnode); - - if (!np || !of_property_present(np, prop_hart_index)) { - *hart_index =3D logical_index; - return 0; - } - - return of_property_read_u32_index(np, prop_hart_index, logical_index, har= t_index); -} - int aplic_direct_setup(struct device *dev, void __iomem *regs) { int i, j, rc, cpu, current_cpu, setup_count =3D 0; @@ -279,7 +265,7 @@ int aplic_direct_setup(struct device *dev, void __iomem= *regs) cpumask_set_cpu(cpu, &direct->lmask); =20 idc =3D per_cpu_ptr(&aplic_idcs, cpu); - rc =3D aplic_direct_get_hart_index(dev, i, &idc->hart_index); + rc =3D riscv_get_hart_index(dev->fwnode, i, &idc->hart_index); if (rc) { dev_warn(dev, "hart index not found for IDC%d\n", i); continue; --=20 2.43.0 From nobody Fri Oct 10 21:14:38 2025 Received: from esa1.hc555-34.eu.iphmx.com (esa1.hc555-34.eu.iphmx.com [23.90.104.144]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3F83625B2F9; Thu, 12 Jun 2025 14:39:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=23.90.104.144 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749739172; cv=none; b=l4lIGq8BgKL7nP6fFImBKY+i8e7XiRV/E5jAv5tV1Wbp7b9eYhqjVa5WnPY5cTjYX239vytv3in3ElrXrWlP3BD9Xsuml8wJWU0GU3ehiqFYGi6W6fJzavKyzBEVn3o8X0XUNZiSxT/Ss9nmdWZ+YaoylzGFvXwe7gwKmSxn6V0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749739172; c=relaxed/simple; bh=R0DjUyymyH51702nfIhvD4gSoTHc5AdW1g9ClY+/bUU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=eWj/93Hsca/bCeK45fDWBNgvDzpC+83oFD+5ZnwubzWNVLiHCjhdmMfsn5NKUBXw1vwhwLdypS3K8uxozKdTEgli+bBFsv9JmhzlDRSKR5aKxwmh0uDwV3caZgAvjdF24VztseRnGlCcym/zUALocuGn8TVdqep7/215iQvuCyk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=mobileye.com; spf=pass smtp.mailfrom=mobileye.com; dkim=fail (0-bit key) header.d=mobileye.com header.i=@mobileye.com header.b=bV8ZGutc reason="key not found in DNS"; arc=none smtp.client-ip=23.90.104.144 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=mobileye.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=mobileye.com Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="key not found in DNS" (0-bit key) header.d=mobileye.com header.i=@mobileye.com header.b="bV8ZGutc" DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mobileye.com; i=@mobileye.com; q=dns/txt; s=MoEyIP; t=1749739169; x=1781275169; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=R0DjUyymyH51702nfIhvD4gSoTHc5AdW1g9ClY+/bUU=; b=bV8ZGutcaeGnSKrV+zhuKyfgipO9QQVlwosntyCZMUWzfmFXjOngBe5z 5INRRgWVoy82bYHgD/l6tTCS48RAWLMgpyOf1OTgu3gO3CnNGMgDsfl3H ByV0OBFIvA9yZQtOzQ9SKAtGBU9xxib31FGbjZw/Gs+kXkHCktc2tqamb 6JMIyR4KcqEB1NWMBlAU+8FG18jyxrj4gi/uM0/9rrm+BrXI9uQcF6a6j BHTGnOXf5WSF+63ydLTZMLqdY+NN4rlOzHDgvLhY9g7pXcSXt+pfMOV1p UkRWT/Rfe/mw1wQY+N8Ua2HS5QJdrOPZeKZSt5MhxjGQ7JXgvCJ81LLzD A==; X-CSE-ConnectionGUID: un4Mo7nPRqidx0IW4sWGuw== X-CSE-MsgGUID: byih88LRQ6yq5E8J+vCgQg== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from unknown (HELO ces04_data.me-crop.lan) ([146.255.191.134]) by esa1.hc555-34.eu.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jun 2025 17:39:18 +0300 X-CSE-ConnectionGUID: +8ZAKTERTIydl0ak4WMZ5w== X-CSE-MsgGUID: i1rORHJeROiet+NjGoACVw== Received: from unknown (HELO epgd071.me-corp.lan) ([10.154.54.1]) by ces04_data.me-crop.lan with SMTP; 12 Jun 2025 17:39:16 +0300 Received: by epgd071.me-corp.lan (sSMTP sendmail emulation); Thu, 12 Jun 2025 17:39:17 +0300 From: Vladimir Kondratiev To: Thomas Gleixner , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , Anup Patel , Chen Wang , Inochi Amaoto , Sunil V L , "Rafael J . Wysocki" , Ryo Takakura Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-riscv@lists.infradead.org, sophgo@lists.linux.dev, Vladimir Kondratiev Subject: [PATCH v3 3/7] dt-bindings: interrupt-controller: add MIPS P8700 aclint-sswi Date: Thu, 12 Jun 2025 17:39:07 +0300 Message-ID: <20250612143911.3224046-4-vladimir.kondratiev@mobileye.com> In-Reply-To: <20250612143911.3224046-1-vladimir.kondratiev@mobileye.com> References: <20250609134749.1453835-1-vladimir.kondratiev@mobileye.com> <20250612143911.3224046-1-vladimir.kondratiev@mobileye.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add ACLINT-SSWI variant for the MIPS P8700. This CPU has SSWI device compliant with the RISC-V draft spec (see [1]) CPU indexes on this platform are not contiguous, instead it uses bit-fields to encode hart,core,cluster numbers, thus property "riscv,hart-indexes" is mandatory Link: https://github.com/riscvarchive/riscv-aclint [1] Signed-off-by: Vladimir Kondratiev Acked-by: Conor Dooley --- .../thead,c900-aclint-sswi.yaml | 64 ++++++++++++++++--- 1 file changed, 55 insertions(+), 9 deletions(-) diff --git a/Documentation/devicetree/bindings/interrupt-controller/thead,c= 900-aclint-sswi.yaml b/Documentation/devicetree/bindings/interrupt-controll= er/thead,c900-aclint-sswi.yaml index 8d330906bbbd..c1ab865fcd64 100644 --- a/Documentation/devicetree/bindings/interrupt-controller/thead,c900-acl= int-sswi.yaml +++ b/Documentation/devicetree/bindings/interrupt-controller/thead,c900-acl= int-sswi.yaml @@ -4,23 +4,32 @@ $id: http://devicetree.org/schemas/interrupt-controller/thead,c900-aclint-= sswi.yaml# $schema: http://devicetree.org/meta-schemas/core.yaml# =20 -title: T-HEAD C900 ACLINT Supervisor-level Software Interrupt Device +title: ACLINT Supervisor-level Software Interrupt Device =20 maintainers: - Inochi Amaoto =20 description: - The SSWI device is a part of the THEAD ACLINT device. It provides - supervisor-level IPI functionality for a set of HARTs on a THEAD - platform. It provides a register to set an IPI (SETSSIP) for each - HART connected to the SSWI device. + The SSWI device is a part of the ACLINT device. It provides + supervisor-level IPI functionality for a set of HARTs on a supported + platforms. It provides a register to set an IPI (SETSSIP) for each + HART connected to the SSWI device. See draft specification + https://github.com/riscvarchive/riscv-aclint + + Following variants of the SSWI ACLINT supported, using dedicated + compatible string + - THEAD C900 + - MIPS P8700 =20 properties: compatible: - items: - - enum: - - sophgo,sg2044-aclint-sswi - - const: thead,c900-aclint-sswi + oneOf: + - items: + - enum: + - sophgo,sg2044-aclint-sswi + - const: thead,c900-aclint-sswi + - items: + - const: mips,p8700-aclint-sswi =20 reg: maxItems: 1 @@ -34,6 +43,14 @@ properties: minItems: 1 maxItems: 4095 =20 + riscv,hart-indexes: + $ref: /schemas/types.yaml#/definitions/uint32-array + minItems: 1 + maxItems: 4095 + description: + A list of hart indexes that APLIC should use to address each hart + that is mentioned in the "interrupts-extended" + additionalProperties: false =20 required: @@ -43,8 +60,22 @@ required: - interrupt-controller - interrupts-extended =20 +allOf: + - if: + properties: + compatible: + contains: + const: mips,p8700-aclint-sswi + then: + required: + - riscv,hart-indexes + else: + properties: + riscv,hart-indexes: false + examples: - | + //Example 1 interrupt-controller@94000000 { compatible =3D "sophgo,sg2044-aclint-sswi", "thead,c900-aclint-sswi"; reg =3D <0x94000000 0x00004000>; @@ -55,4 +86,19 @@ examples: <&cpu3intc 1>, <&cpu4intc 1>; }; + + - | + //Example 2 + interrupt-controller@94000000 { + compatible =3D "mips,p8700-aclint-sswi"; + reg =3D <0x94000000 0x00004000>; + #interrupt-cells =3D <0>; + interrupt-controller; + interrupts-extended =3D <&cpu1intc 1>, + <&cpu2intc 1>, + <&cpu3intc 1>, + <&cpu4intc 1>; + riscv,hart-indexes =3D <0x0 0x1 0x10 0x11>; + }; + ... --=20 2.43.0 From nobody Fri Oct 10 21:14:38 2025 Received: from esa1.hc555-34.eu.iphmx.com (esa1.hc555-34.eu.iphmx.com [23.90.104.144]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 60B9C25B692; Thu, 12 Jun 2025 14:39:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=23.90.104.144 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749739173; cv=none; b=k/eVk7lT0f9N9Xg93fnEywRBb5+I3/jK36e+pYTS8zwZComrLxAKMfGci1fK6xgkNCJNxesx9jKm17UvuixqifiL+0f/gbPAhOBiaTpyqqdteKzXS/zkuhkIYQn9pQW1AkHvJOAxuP+zlWXta31JT7wFf9u5FkicylOT3jrhKWg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749739173; c=relaxed/simple; bh=IUsgoytCa960UqK9Tup9+lUYJiEi9bGrelfn5xp32LM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=o4+xzL7QWFLtoTY9DyhETvDNn4ldLpij5KE1Vfx8JKn/v5iREd2VvcNG8WWAH7IIwJBFHR7pkCZ5csnyA+dsWMCwd0JZ+Qkh8oBit5ceNP3ZDmbMb8Z0b9aH5J92uZYfAY1audaHb6Bq5L/WErMeI4TDSFDkHYoTLQJxTVe717k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=mobileye.com; spf=pass smtp.mailfrom=mobileye.com; dkim=fail (0-bit key) header.d=mobileye.com header.i=@mobileye.com header.b=XDpTFQMW reason="key not found in DNS"; arc=none smtp.client-ip=23.90.104.144 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=mobileye.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=mobileye.com Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="key not found in DNS" (0-bit key) header.d=mobileye.com header.i=@mobileye.com header.b="XDpTFQMW" DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mobileye.com; i=@mobileye.com; q=dns/txt; s=MoEyIP; t=1749739170; x=1781275170; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=IUsgoytCa960UqK9Tup9+lUYJiEi9bGrelfn5xp32LM=; b=XDpTFQMWkz/thFgWFQoqQoyl1kcAbdJtTVDa9UUe0q7NLQLVh+CE3x2t qojefw5EsxSh6WYcKy5JxOz1FVHipmGdZFiI/4YBDL3dKdShrtdZqWjmA SJVVonpZRVdGp5bJNOF+xL2PdolAABCoQl9lQcPMZFsf0siMAA/yj2uWL W4hkbW0ln5pTW1qTa4d8xN04R1QpgP01OcC+xHsOuJs5goil5vboasoWt fHObrWix3cEiyqs3Up+6MWKNnVsOWVETG5w+Hn8x13TKV1/GvIN3Ci90v 1fkRXrw+fjPSzTqthR6C3KspWrG57MEhbRMv2jWKe+fbkAOuVLDJqkfa3 Q==; X-CSE-ConnectionGUID: ir1SvB+CSzy4Z5qjXS/M9A== X-CSE-MsgGUID: oxf5+owXRV2wYVvdlc5vpQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from unknown (HELO ces01_data.me-corp.lan) ([146.255.191.134]) by esa1.hc555-34.eu.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jun 2025 17:39:19 +0300 X-CSE-ConnectionGUID: x3X4diFySeybW0papmj+KA== X-CSE-MsgGUID: xFE6pKGLTw+8Dm3smtkXvg== Received: from unknown (HELO epgd071.me-corp.lan) ([10.154.54.6]) by ces01_data.me-corp.lan with SMTP; 12 Jun 2025 17:39:18 +0300 Received: by epgd071.me-corp.lan (sSMTP sendmail emulation); Thu, 12 Jun 2025 17:39:18 +0300 From: Vladimir Kondratiev To: Thomas Gleixner , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , Anup Patel , Chen Wang , Inochi Amaoto , Sunil V L , "Rafael J . Wysocki" , Ryo Takakura Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-riscv@lists.infradead.org, sophgo@lists.linux.dev, Vladimir Kondratiev Subject: [PATCH v3 4/7] irqchip: MIPS P800 variant of aclint-sswi Date: Thu, 12 Jun 2025 17:39:08 +0300 Message-ID: <20250612143911.3224046-5-vladimir.kondratiev@mobileye.com> In-Reply-To: <20250612143911.3224046-1-vladimir.kondratiev@mobileye.com> References: <20250609134749.1453835-1-vladimir.kondratiev@mobileye.com> <20250612143911.3224046-1-vladimir.kondratiev@mobileye.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Refactor Thead specific implementation of the ACLINT-SSWI irqchip. Factor out generic code that serves both Thead and MIPS variants. This generic part is according to the RISC-V draft spec [1]. Link: https://github.com/riscvarchive/riscv-aclint [1] Signed-off-by: Vladimir Kondratiev --- drivers/irqchip/Kconfig | 15 ++- drivers/irqchip/Makefile | 2 +- ...d-c900-aclint-sswi.c =3D> irq-aclint-sswi.c} | 91 +++++++++++++------ include/linux/cpuhotplug.h | 2 +- 4 files changed, 75 insertions(+), 35 deletions(-) rename drivers/irqchip/{irq-thead-c900-aclint-sswi.c =3D> irq-aclint-sswi.= c} (68%) diff --git a/drivers/irqchip/Kconfig b/drivers/irqchip/Kconfig index 0d196e447142..39f6f421fc75 100644 --- a/drivers/irqchip/Kconfig +++ b/drivers/irqchip/Kconfig @@ -634,18 +634,25 @@ config STARFIVE_JH8100_INTC =20 If you don't know what to do here, say Y. =20 -config THEAD_C900_ACLINT_SSWI - bool "THEAD C9XX ACLINT S-mode IPI Interrupt Controller" +config ACLINT_SSWI + bool "RISC-V ACLINT S-mode IPI Interrupt Controller" depends on RISCV depends on SMP select IRQ_DOMAIN_HIERARCHY select GENERIC_IRQ_IPI_MUX help - This enables support for T-HEAD specific ACLINT SSWI device - support. + This enables support for variants of the RISC-V ACLINT-SSWI device. + Supported variants are: + - T-HEAD, with compatible "thead,c900-aclint-sswi" + - MIPS P8700, with compatible "mips,p8700-aclint-sswi" =20 If you don't know what to do here, say Y. =20 +# Backwards compatibility so oldconfig does not drop it. +config THEAD_C900_ACLINT_SSWI + bool + select ACLINT_SSWI + config EXYNOS_IRQ_COMBINER bool "Samsung Exynos IRQ combiner support" if COMPILE_TEST depends on (ARCH_EXYNOS && ARM) || COMPILE_TEST diff --git a/drivers/irqchip/Makefile b/drivers/irqchip/Makefile index 23ca4959e6ce..0458d6c5d161 100644 --- a/drivers/irqchip/Makefile +++ b/drivers/irqchip/Makefile @@ -105,7 +105,7 @@ obj-$(CONFIG_RISCV_APLIC_MSI) +=3D irq-riscv-aplic-msi= .o obj-$(CONFIG_RISCV_IMSIC) +=3D irq-riscv-imsic-state.o irq-riscv-imsic-ea= rly.o irq-riscv-imsic-platform.o obj-$(CONFIG_SIFIVE_PLIC) +=3D irq-sifive-plic.o obj-$(CONFIG_STARFIVE_JH8100_INTC) +=3D irq-starfive-jh8100-intc.o -obj-$(CONFIG_THEAD_C900_ACLINT_SSWI) +=3D irq-thead-c900-aclint-sswi.o +obj-$(CONFIG_ACLINT_SSWI) +=3D irq-aclint-sswi.o obj-$(CONFIG_IMX_IRQSTEER) +=3D irq-imx-irqsteer.o obj-$(CONFIG_IMX_INTMUX) +=3D irq-imx-intmux.o obj-$(CONFIG_IMX_MU_MSI) +=3D irq-imx-mu-msi.o diff --git a/drivers/irqchip/irq-thead-c900-aclint-sswi.c b/drivers/irqchip= /irq-aclint-sswi.c similarity index 68% rename from drivers/irqchip/irq-thead-c900-aclint-sswi.c rename to drivers/irqchip/irq-aclint-sswi.c index 8ff6e7a1363b..5e133cf29737 100644 --- a/drivers/irqchip/irq-thead-c900-aclint-sswi.c +++ b/drivers/irqchip/irq-aclint-sswi.c @@ -3,7 +3,8 @@ * Copyright (C) 2024 Inochi Amaoto */ =20 -#define pr_fmt(fmt) "thead-c900-aclint-sswi: " fmt +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + #include #include #include @@ -21,56 +22,51 @@ #include #include =20 -#define THEAD_ACLINT_xSWI_REGISTER_SIZE 4 - -#define THEAD_C9XX_CSR_SXSTATUS 0x5c0 -#define THEAD_C9XX_SXSTATUS_CLINTEE BIT(17) - static int sswi_ipi_virq __ro_after_init; static DEFINE_PER_CPU(void __iomem *, sswi_cpu_regs); =20 -static void thead_aclint_sswi_ipi_send(unsigned int cpu) +static void aclint_sswi_ipi_send(unsigned int cpu) { writel(0x1, per_cpu(sswi_cpu_regs, cpu)); } =20 -static void thead_aclint_sswi_ipi_clear(void) +static void aclint_sswi_ipi_clear(void) { writel_relaxed(0x0, this_cpu_read(sswi_cpu_regs)); } =20 -static void thead_aclint_sswi_ipi_handle(struct irq_desc *desc) +static void aclint_sswi_ipi_handle(struct irq_desc *desc) { struct irq_chip *chip =3D irq_desc_get_chip(desc); =20 chained_irq_enter(chip, desc); =20 csr_clear(CSR_IP, IE_SIE); - thead_aclint_sswi_ipi_clear(); + aclint_sswi_ipi_clear(); =20 ipi_mux_process(); =20 chained_irq_exit(chip, desc); } =20 -static int thead_aclint_sswi_starting_cpu(unsigned int cpu) +static int aclint_sswi_starting_cpu(unsigned int cpu) { enable_percpu_irq(sswi_ipi_virq, irq_get_trigger_type(sswi_ipi_virq)); =20 return 0; } =20 -static int thead_aclint_sswi_dying_cpu(unsigned int cpu) +static int aclint_sswi_dying_cpu(unsigned int cpu) { - thead_aclint_sswi_ipi_clear(); + aclint_sswi_ipi_clear(); =20 disable_percpu_irq(sswi_ipi_virq); =20 return 0; } =20 -static int __init thead_aclint_sswi_parse_irq(struct fwnode_handle *fwnode, - void __iomem *reg) +static int __init aclint_sswi_parse_irq(struct fwnode_handle *fwnode, + void __iomem *reg) { struct of_phandle_args parent; unsigned long hartid; @@ -97,7 +93,7 @@ static int __init thead_aclint_sswi_parse_irq(struct fwno= de_handle *fwnode, =20 cpu =3D riscv_hartid_to_cpuid(hartid); =20 - per_cpu(sswi_cpu_regs, cpu) =3D reg + i * THEAD_ACLINT_xSWI_REGISTER_SIZ= E; + per_cpu(sswi_cpu_regs, cpu) =3D reg + hart_index * 4; } =20 pr_info("%pfwP: register %u CPU%s\n", fwnode, contexts, str_plural(contex= ts)); @@ -105,17 +101,12 @@ static int __init thead_aclint_sswi_parse_irq(struct = fwnode_handle *fwnode, return 0; } =20 -static int __init thead_aclint_sswi_probe(struct fwnode_handle *fwnode) +static int __init aclint_sswi_probe(struct fwnode_handle *fwnode) { struct irq_domain *domain; void __iomem *reg; int virq, rc; =20 - /* If it is T-HEAD CPU, check whether SSWI is enabled */ - if (riscv_cached_mvendorid(0) =3D=3D THEAD_VENDOR_ID && - !(csr_read(THEAD_C9XX_CSR_SXSTATUS) & THEAD_C9XX_SXSTATUS_CLINTEE)) - return -ENOTSUPP; - if (!is_of_node(fwnode)) return -EINVAL; =20 @@ -124,7 +115,7 @@ static int __init thead_aclint_sswi_probe(struct fwnode= _handle *fwnode) return -ENOMEM; =20 /* Parse SSWI setting */ - rc =3D thead_aclint_sswi_parse_irq(fwnode, reg); + rc =3D aclint_sswi_parse_irq(fwnode, reg); if (rc < 0) return rc; =20 @@ -146,22 +137,64 @@ static int __init thead_aclint_sswi_probe(struct fwno= de_handle *fwnode) } =20 /* Register SSWI irq and handler */ - virq =3D ipi_mux_create(BITS_PER_BYTE, thead_aclint_sswi_ipi_send); + virq =3D ipi_mux_create(BITS_PER_BYTE, aclint_sswi_ipi_send); if (virq <=3D 0) { pr_err("unable to create muxed IPIs\n"); irq_dispose_mapping(sswi_ipi_virq); return virq < 0 ? virq : -ENOMEM; } =20 - irq_set_chained_handler(sswi_ipi_virq, thead_aclint_sswi_ipi_handle); + irq_set_chained_handler(sswi_ipi_virq, aclint_sswi_ipi_handle); =20 - cpuhp_setup_state(CPUHP_AP_IRQ_THEAD_ACLINT_SSWI_STARTING, - "irqchip/thead-aclint-sswi:starting", - thead_aclint_sswi_starting_cpu, - thead_aclint_sswi_dying_cpu); + cpuhp_setup_state(CPUHP_AP_IRQ_ACLINT_SSWI_STARTING, + "irqchip/aclint-sswi:starting", + aclint_sswi_starting_cpu, + aclint_sswi_dying_cpu); =20 riscv_ipi_set_virq_range(virq, BITS_PER_BYTE); =20 + return 0; +} + +/* generic/MIPS variant */ +static int __init generic_aclint_sswi_probe(struct fwnode_handle *fwnode) +{ + int rc; + + rc =3D aclint_sswi_probe(fwnode); + if (rc) + return rc; + + /* Announce that SSWI is providing IPIs */ + pr_info("providing IPIs using ACLINT SSWI\n"); + + return 0; +} + +static int __init generic_aclint_sswi_early_probe(struct device_node *node, + struct device_node *parent) +{ + return generic_aclint_sswi_probe(&node->fwnode); +} +IRQCHIP_DECLARE(generic_aclint_sswi, "mips,p8700-aclint-sswi", generic_acl= int_sswi_early_probe); + +/* THEAD variant */ +#define THEAD_C9XX_CSR_SXSTATUS 0x5c0 +#define THEAD_C9XX_SXSTATUS_CLINTEE BIT(17) + +static int __init thead_aclint_sswi_probe(struct fwnode_handle *fwnode) +{ + int rc; + + /* If it is T-HEAD CPU, check whether SSWI is enabled */ + if (riscv_cached_mvendorid(0) =3D=3D THEAD_VENDOR_ID && + !(csr_read(THEAD_C9XX_CSR_SXSTATUS) & THEAD_C9XX_SXSTATUS_CLINTEE)) + return -ENOTSUPP; + + rc =3D aclint_sswi_probe(fwnode); + if (rc) + return rc; + /* Announce that SSWI is providing IPIs */ pr_info("providing IPIs using THEAD ACLINT SSWI\n"); =20 diff --git a/include/linux/cpuhotplug.h b/include/linux/cpuhotplug.h index df366ee15456..d381420bbd5f 100644 --- a/include/linux/cpuhotplug.h +++ b/include/linux/cpuhotplug.h @@ -145,7 +145,7 @@ enum cpuhp_state { CPUHP_AP_IRQ_EIOINTC_STARTING, CPUHP_AP_IRQ_AVECINTC_STARTING, CPUHP_AP_IRQ_SIFIVE_PLIC_STARTING, - CPUHP_AP_IRQ_THEAD_ACLINT_SSWI_STARTING, + CPUHP_AP_IRQ_ACLINT_SSWI_STARTING, CPUHP_AP_IRQ_RISCV_IMSIC_STARTING, CPUHP_AP_IRQ_RISCV_SBI_IPI_STARTING, CPUHP_AP_ARM_MVEBU_COHERENCY, --=20 2.43.0 From nobody Fri Oct 10 21:14:38 2025 Received: from esa1.hc555-34.eu.iphmx.com (esa1.hc555-34.eu.iphmx.com [23.90.104.144]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D671925CC5A; Thu, 12 Jun 2025 14:39:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=23.90.104.144 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749739175; cv=none; b=H77DrVBPZ3gXCWbrw6NGlQJ8uYAJqxlrIDeuG2yIP09kJbLJj8WPfBF10hnX3NiHwLdOBgQzd7MLAckZ6seuLBoQjuf3WjzxREO5CFgaT8k9jV/gYOvj+OpdI0o9owqxI3eL7IwTyOQ02C1JDW5OpIxUV+Ulkxela2JqGihMwMA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749739175; c=relaxed/simple; bh=LMCbJCAp6bbeSvRYKpbQ/PpB/GPQVCZzGN5f5K2rlYA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=DVF1MgLdvo4qfqSFvsj0bgI8rEWtmhIqic5eCdPv3WKiMumZgy55d7BzYNM7ERrM12pshLu+FZxS1VscwZCgHCbD9tfyT+vz7M+Z/2Ye51eoCkBlfh/Q/3ljJ8bWrHw+4dqAdJGoYVKQGmm3TXMexz/dzQDDm9BBOzMH5CXyjvQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=mobileye.com; spf=pass smtp.mailfrom=mobileye.com; dkim=fail (0-bit key) header.d=mobileye.com header.i=@mobileye.com header.b=RstUxlks reason="key not found in DNS"; arc=none smtp.client-ip=23.90.104.144 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=mobileye.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=mobileye.com Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="key not found in DNS" (0-bit key) header.d=mobileye.com header.i=@mobileye.com header.b="RstUxlks" DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mobileye.com; i=@mobileye.com; q=dns/txt; s=MoEyIP; t=1749739173; x=1781275173; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=LMCbJCAp6bbeSvRYKpbQ/PpB/GPQVCZzGN5f5K2rlYA=; b=RstUxlksL/J+5/j7ASbB6DZGfclt0vqf4ASvu7pGLro6/FBLgmFjdX2S 5UcFha3++p0H0CLCZdUKeCjAH6zYl6SJBKVCgfzBCmUp7B6jjjIwqX1mz ym0SopEQyhSPhdMuKG4eRv15YD/ULQn0z3PAh77z2xxW3ymRGsuXHEdpu XmHEFacmjl/S0AvFlExF8s02JLoAt4+hu6wisJ/PEyDcXAcpFEqxKkLSp pa8stFBYEqMU457y+mI8Lfgyb83kik0vTZZPpIRPuDce/WYXlnty2d6RS iVlbCuZOY53ef0mOU43SXHiNs9ImY9BYTRouty9Eb9CyzzGz30MQatV0z A==; X-CSE-ConnectionGUID: un4Mo7nPRqidx0IW4sWGuw== X-CSE-MsgGUID: OwSxmjY0T9iPc+tymvhxcA== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from unknown (HELO ces04_data.me-crop.lan) ([146.255.191.134]) by esa1.hc555-34.eu.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jun 2025 17:39:20 +0300 X-CSE-ConnectionGUID: UjMjNaakRTm0/KPcek5JTg== X-CSE-MsgGUID: TU5gZLFjQmq3pd5BLTSRhw== Received: from unknown (HELO epgd071.me-corp.lan) ([10.154.54.1]) by ces04_data.me-crop.lan with SMTP; 12 Jun 2025 17:39:19 +0300 Received: by epgd071.me-corp.lan (sSMTP sendmail emulation); Thu, 12 Jun 2025 17:39:19 +0300 From: Vladimir Kondratiev To: Thomas Gleixner , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , Anup Patel , Chen Wang , Inochi Amaoto , Sunil V L , "Rafael J . Wysocki" , Ryo Takakura Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-riscv@lists.infradead.org, sophgo@lists.linux.dev, Vladimir Kondratiev Subject: [PATCH v3 5/7] irqchip/aslint-sswi: resolve hart index Date: Thu, 12 Jun 2025 17:39:09 +0300 Message-ID: <20250612143911.3224046-6-vladimir.kondratiev@mobileye.com> In-Reply-To: <20250612143911.3224046-1-vladimir.kondratiev@mobileye.com> References: <20250609134749.1453835-1-vladimir.kondratiev@mobileye.com> <20250612143911.3224046-1-vladimir.kondratiev@mobileye.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Resolve hart index according to assignment in the "riscv,hart-indexes" property as defined in [1] Link: https://github.com/riscvarchive/riscv-aclint [1] Signed-off-by: Vladimir Kondratiev --- drivers/irqchip/irq-aclint-sswi.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/irqchip/irq-aclint-sswi.c b/drivers/irqchip/irq-aclint= -sswi.c index 5e133cf29737..81d28a53635e 100644 --- a/drivers/irqchip/irq-aclint-sswi.c +++ b/drivers/irqchip/irq-aclint-sswi.c @@ -72,6 +72,7 @@ static int __init aclint_sswi_parse_irq(struct fwnode_han= dle *fwnode, unsigned long hartid; u32 contexts, i; int rc, cpu; + u32 hart_index; =20 contexts =3D of_irq_count(to_of_node(fwnode)); if (!(contexts)) { @@ -93,6 +94,11 @@ static int __init aclint_sswi_parse_irq(struct fwnode_ha= ndle *fwnode, =20 cpu =3D riscv_hartid_to_cpuid(hartid); =20 + rc =3D riscv_get_hart_index(fwnode, i, &hart_index); + if (rc) { + pr_warn("%pfwP: hart index [%d] not found\n", fwnode, i); + return -EINVAL; + } per_cpu(sswi_cpu_regs, cpu) =3D reg + hart_index * 4; } =20 --=20 2.43.0 From nobody Fri Oct 10 21:14:38 2025 Received: from esa2.hc555-34.eu.iphmx.com (esa2.hc555-34.eu.iphmx.com [23.90.104.147]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4C24C25B301; Thu, 12 Jun 2025 14:39:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=23.90.104.147 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749739171; cv=none; b=fxBtWEgnMTA/Fl4fllm5k36QvQFysELiYngLe7IAwXG8q1Lk/Ihs89P+0SCIItsX5/WCuJLpsnGmS3oEUy/Kdkyc83/dInYwScuh2oj2NpaLOIKOJMEgvVTtbC7mCTGsBAehhM06gJNTGPY8414IDR5rAJVdAr9vpEyDdndW0MM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749739171; c=relaxed/simple; bh=6/mZP00EM9rJ5UOmw5xRb/tAHJW+hgPGA9vOCXCI5fo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=a1z2NeJ4bcH9qWDW8vhC9lcDMUbrLBtmNQFlYr80WfEroTYZS/2/j6jVLXgj52Z26kqpoSS6HmYzGvfogOc3kR+i+a/mcFtKCwvRoomhCoymF/nyY5lQ9iKmOM/GkQVdB0KnaBdqg4PaQIEzgei+A9qe6hrsBblq/fb/fnXoBDg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=mobileye.com; spf=pass smtp.mailfrom=mobileye.com; dkim=fail (0-bit key) header.d=mobileye.com header.i=@mobileye.com header.b=VH4DPmyT reason="key not found in DNS"; arc=none smtp.client-ip=23.90.104.147 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=mobileye.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=mobileye.com Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="key not found in DNS" (0-bit key) header.d=mobileye.com header.i=@mobileye.com header.b="VH4DPmyT" DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mobileye.com; i=@mobileye.com; q=dns/txt; s=MoEyIP; t=1749739169; x=1781275169; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=6/mZP00EM9rJ5UOmw5xRb/tAHJW+hgPGA9vOCXCI5fo=; b=VH4DPmyTHFos//MKp2YWs9r4hvoBIw3NtX6P40Gt3227ue6OMOFCLFKY BI+CGwjpp0S2yo7d+fxMMX1vDTcLA3zP+MPp3h8df54KfDIhK+8Qcu1nN HVSHj8dq7/KIW7J4D7dBXPqGk+MeDMW5qfvzec+kKkI7F8InoWxfeG+Rf 8C57CsPQGjwle9DTUL4+UbCZk1b34INCcKbdVIjuQvCeN5HxlOlUC3+4L Oy2aqLNNyUdBbiTPGrArt95gMKSCKUyN4dmbC7MeMjKfcwWfkaf/DW4OV QBp6GbI/B2Wqk6VY1vND4F08zXYd6y/ZY0/q43STDTgOoxYI9qOkRP8oD A==; X-CSE-ConnectionGUID: TDDXB1duQWqC8XJ4q7vXag== X-CSE-MsgGUID: 3tM+JvTuSrKjBRyJf9JdkQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from unknown (HELO ces02_data.me-corp.lan) ([146.255.191.134]) by esa2.hc555-34.eu.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jun 2025 17:39:22 +0300 X-CSE-ConnectionGUID: coDxqz9uTa2+dzqVxqKfCA== X-CSE-MsgGUID: JoxQzBbCSY2r56AZOvU54A== Received: from unknown (HELO epgd071.me-corp.lan) ([10.154.54.6]) by ces02_data.me-corp.lan with SMTP; 12 Jun 2025 17:39:19 +0300 Received: by epgd071.me-corp.lan (sSMTP sendmail emulation); Thu, 12 Jun 2025 17:39:20 +0300 From: Vladimir Kondratiev To: Thomas Gleixner , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , Anup Patel , Chen Wang , Inochi Amaoto , Sunil V L , "Rafael J . Wysocki" , Ryo Takakura Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-riscv@lists.infradead.org, sophgo@lists.linux.dev, Vladimir Kondratiev Subject: [PATCH v3 6/7] irqchip/aclint-sswi: reduce data scope Date: Thu, 12 Jun 2025 17:39:10 +0300 Message-ID: <20250612143911.3224046-7-vladimir.kondratiev@mobileye.com> In-Reply-To: <20250612143911.3224046-1-vladimir.kondratiev@mobileye.com> References: <20250609134749.1453835-1-vladimir.kondratiev@mobileye.com> <20250612143911.3224046-1-vladimir.kondratiev@mobileye.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Move variables to the innermost scope where it is used Signed-off-by: Vladimir Kondratiev --- drivers/irqchip/irq-aclint-sswi.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/irqchip/irq-aclint-sswi.c b/drivers/irqchip/irq-aclint= -sswi.c index 81d28a53635e..a604c7e1e416 100644 --- a/drivers/irqchip/irq-aclint-sswi.c +++ b/drivers/irqchip/irq-aclint-sswi.c @@ -68,11 +68,7 @@ static int aclint_sswi_dying_cpu(unsigned int cpu) static int __init aclint_sswi_parse_irq(struct fwnode_handle *fwnode, void __iomem *reg) { - struct of_phandle_args parent; - unsigned long hartid; - u32 contexts, i; - int rc, cpu; - u32 hart_index; + u32 contexts; =20 contexts =3D of_irq_count(to_of_node(fwnode)); if (!(contexts)) { @@ -80,7 +76,12 @@ static int __init aclint_sswi_parse_irq(struct fwnode_ha= ndle *fwnode, return -EINVAL; } =20 - for (i =3D 0; i < contexts; i++) { + for (u32 i =3D 0; i < contexts; i++) { + struct of_phandle_args parent; + unsigned long hartid; + int rc, cpu; + u32 hart_index; + rc =3D of_irq_parse_one(to_of_node(fwnode), i, &parent); if (rc) return rc; --=20 2.43.0 From nobody Fri Oct 10 21:14:38 2025 Received: from esa2.hc555-34.eu.iphmx.com (esa2.hc555-34.eu.iphmx.com [23.90.104.147]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0683725C6F3; Thu, 12 Jun 2025 14:39:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=23.90.104.147 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749739174; cv=none; b=RwrX4hsDzCKJXfrna9cFC7uusm9gOgRBdPJhwP1FjNZNh0NVe0N8EHwUFXX6Ne618/jD7/a2vU5zQF7XTHUal7w1k+pOjidNTBPdMT8m7vmoIY9dx3r4Mp991GpdwRBUI43gIz/+VA2MVt9vIpAPHXupyqyGyIlGH35T/xBNb/M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749739174; c=relaxed/simple; bh=qHQZtgOUSppdb/h/ZBO+JNEWe7/fBqOyl/vdXLNJOYQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TSVpKymn1VPkIU60q5eMqJmicmFs11Vb6+9SvpPoO0tQzU6Lo65yYmeUUhYBKsa54QXJjheKmR/eY21i/WsgNCrhMMS+UGSfEmGWYOdqsfa0EAow931WaH3CJEm/s+shIBTbQJZX2cibw7mGGpAovULk9gfnuN3FFuwLP4KDeOw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=mobileye.com; spf=pass smtp.mailfrom=mobileye.com; dkim=fail (0-bit key) header.d=mobileye.com header.i=@mobileye.com header.b=kgzSfWck reason="key not found in DNS"; arc=none smtp.client-ip=23.90.104.147 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=mobileye.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=mobileye.com Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="key not found in DNS" (0-bit key) header.d=mobileye.com header.i=@mobileye.com header.b="kgzSfWck" DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mobileye.com; i=@mobileye.com; q=dns/txt; s=MoEyIP; t=1749739172; x=1781275172; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=qHQZtgOUSppdb/h/ZBO+JNEWe7/fBqOyl/vdXLNJOYQ=; b=kgzSfWckRi4vY3UEu1Nl1Hs0j5UGGjyJYqzhmn8MsnwG5ds24v3yrv7X n/v/gFB3mr44se1FYlO+G0RUA2xdNlZLVnbe64RAjVs86JwNd5LVKmjJ/ goDiuUMo+LxLMbqL9SbhIRv7N/FU9IFg0D9KLNfqHXbITA+BlBCLxB6XQ nLQPezNce/hdQATjfRVHQZ6CXVNoQkK90+XG0drCg2loFNCEvfGWQq7St tk1s62BtAdaEWzgORmrbj4Lm0hEzzc90V2n12CxAEVdWphYzmikEIDvNn Gyt30dZiF7Iy/Q0CrJ1yhrofNIhIoy9fuuKEY4bWAwO4f+2tjwWLrNZpq Q==; X-CSE-ConnectionGUID: TDDXB1duQWqC8XJ4q7vXag== X-CSE-MsgGUID: cRubhSHCS3KghFXFcfDXag== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from unknown (HELO ces02_data.me-corp.lan) ([146.255.191.134]) by esa2.hc555-34.eu.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jun 2025 17:39:22 +0300 X-CSE-ConnectionGUID: 7KsuaaKlTxqTEHgxHTSWtg== X-CSE-MsgGUID: pZwLk6cwTG2vxbWmD9CagA== Received: from unknown (HELO epgd071.me-corp.lan) ([10.154.54.1]) by ces02_data.me-corp.lan with SMTP; 12 Jun 2025 17:39:21 +0300 Received: by epgd071.me-corp.lan (sSMTP sendmail emulation); Thu, 12 Jun 2025 17:39:21 +0300 From: Vladimir Kondratiev To: Thomas Gleixner , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , Anup Patel , Chen Wang , Inochi Amaoto , Sunil V L , "Rafael J . Wysocki" , Ryo Takakura Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-riscv@lists.infradead.org, sophgo@lists.linux.dev, Vladimir Kondratiev Subject: [PATCH v3 7/7] irqchip/aclint-sswi: remove extra includes Date: Thu, 12 Jun 2025 17:39:11 +0300 Message-ID: <20250612143911.3224046-8-vladimir.kondratiev@mobileye.com> In-Reply-To: <20250612143911.3224046-1-vladimir.kondratiev@mobileye.com> References: <20250609134749.1453835-1-vladimir.kondratiev@mobileye.com> <20250612143911.3224046-1-vladimir.kondratiev@mobileye.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Signed-off-by: Vladimir Kondratiev --- drivers/irqchip/irq-aclint-sswi.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/drivers/irqchip/irq-aclint-sswi.c b/drivers/irqchip/irq-aclint= -sswi.c index a604c7e1e416..51ecb509a984 100644 --- a/drivers/irqchip/irq-aclint-sswi.c +++ b/drivers/irqchip/irq-aclint-sswi.c @@ -7,15 +7,9 @@ =20 #include #include -#include -#include #include #include -#include -#include #include -#include -#include #include #include #include --=20 2.43.0