Received: by 2002:a05:7412:d008:b0:f9:6acb:47ec with SMTP id bd8csp77782rdb; Tue, 19 Dec 2023 09:48:45 -0800 (PST) X-Google-Smtp-Source: AGHT+IFFB0PNDtmdx6VoCV3yG1grhz7C7r2SYYRiKWdrjQOyNbdsTF30WvKRUqgx3IidRJHvbsdW X-Received: by 2002:a50:85cc:0:b0:551:9675:53c2 with SMTP id q12-20020a5085cc000000b00551967553c2mr6137670edh.49.1703008125494; Tue, 19 Dec 2023 09:48:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703008125; cv=none; d=google.com; s=arc-20160816; b=eNRXiA5GXPM3dZ9DTKDDNRC9uqUkoEl2pBo3Jd6qyVg8/L00P5bgvUAzmJQn81qeQH 2fLIJslIlR7Z6pY5onDgNSD+8kzDYXvH1NTug2nNptLgUooWfgWgqPoCEM4T/HLIvHcT XfrcE0uyDyqZe8ybYOhY4h0PAe9pVrhrWGAaKkXCnl91Lk91irZUPjooLaxl2yMoxAGZ dvz0OTARLSfdk5k19B2zaYiu6KYwp8Y7eZYKOQXX7oTMfGTVsxzUiId82y8+62fdaAk0 wHUN0InCou05kuNX4RBb5WwvGQTCdKzdwfJOnUZBMMVKJ03IcwKUrOiMGvyiJ+ktn+yB tRPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=DxzCTJ+m1lwBq+RMy/cftySc6UneYPqTwJF8JhbniDw=; fh=G3MkS2cP7FkeH+7kxy0LRzNpJgfwnUWZciURRBohxGI=; b=bqFdaO6TgjlGFFaf2FFl+HoW4bgOIRNOMzT5tbat6v2AMYyS3NY83V1Vp0l7V9FxOu zUmq5LPJTVQcGsEEWFw20JLPt34SJHUnKdhnLB5lQ0nF8MKh36TW7UNwi4uLMxH2rEl5 0REJZkiv1T3sY7hwxrZz1rPR2QXLEOhprVWoyxLPS7XxBDxa3/VzsZBuBkCeGWiLr51N sxjGzso3wgxM3yP01Wyc9X3XIJduhhzCTO9K192/KEHNriQTlqnBMOL0igf2Qx8QXDVT 4QMHaBA/aiE/jmdjpgf2XCViW20rO0uyaaOa6+EyEb1ewgK9vSAvDF2fZo5Rlx78M7PP RKmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b="hXeec/N+"; spf=pass (google.com: domain of linux-kernel+bounces-5720-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-5720-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id u15-20020a50c04f000000b00552eb91d465si3696296edd.550.2023.12.19.09.48.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Dec 2023 09:48:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-5720-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b="hXeec/N+"; spf=pass (google.com: domain of linux-kernel+bounces-5720-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-5720-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 4413C1F2183D for ; Tue, 19 Dec 2023 17:48:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AAA2637D18; Tue, 19 Dec 2023 17:46:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ventanamicro.com header.i=@ventanamicro.com header.b="hXeec/N+" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BAEB13A1B9 for ; Tue, 19 Dec 2023 17:46:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ventanamicro.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ventanamicro.com Received: by mail-pl1-f170.google.com with SMTP id d9443c01a7336-1d3e84fded7so3141565ad.1 for ; Tue, 19 Dec 2023 09:46:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1703007980; x=1703612780; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=DxzCTJ+m1lwBq+RMy/cftySc6UneYPqTwJF8JhbniDw=; b=hXeec/N+8w/TaInjdCZDrwA5oxBuB2FqPrscUupZ/mHRD7vS0bP/9ortxDQJfhhWlq Btu267dcv/FSnCuA0hbLdqLG3jcn/iRqoyYaJDEbtKGTRW9jDnTscM/iX2bifzw6OOnw +7eVmklAy/HVpmz8sj4gl6aBgYUa3w9phzafjcZLNOZeZAZZqRqXvXtMTNjlJZZYxDdN WYYGD4q3WdhPn2XT00MaI7piSCUqWG+DrZzDEgiM/aKPEWyx3DbXaNutdhdwOs042tPt 0jGDHitJhY1cuDoBVrGrtIuCvDnfM6yy6tb7en4gtEWcDm8Hso86Dyu2NZ17pz4NnvTr A1DA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703007980; x=1703612780; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DxzCTJ+m1lwBq+RMy/cftySc6UneYPqTwJF8JhbniDw=; b=sp8MVY97uz+FhLA6BQd3lB4loLoRQQ1A8jtUntBGn313kZ+v5gAEXeTs5mccurCke2 mKABN0tAnOK3bwJqooVoZUjXHIEKAJp4n87TpFgQ2KWWlT56udicN5XloRCbYylC0t2p HE7LmDPqMC/Y1yFhVsT6WTErcO6zCC890pX4dpgtgY4nvF+BLSAyGxEoablz1zQyayj2 i06mH7Y+ZAko/Ce3RCLbq9m0r6OKaPYr+FsJPm0GhzzfFRx3TgU/QLn8X4PdNWrOMByk 7fX4laVmj3ckx3uxSDfjozQDTLzEGxDGyglAk7Cf769/Cgq8E9fHh7A2NVlgYPyv9eKf +G8w== X-Gm-Message-State: AOJu0YzYXM9xS1WL3+f3M9TKzA8B8iLunTlBt9BsbdY0OwTCNHLMo9tW FLo2QRdSmrc+kMsl/Ri1bWGWGg== X-Received: by 2002:a17:903:41c8:b0:1d3:c5e4:b2f3 with SMTP id u8-20020a17090341c800b001d3c5e4b2f3mr2609020ple.100.1703007980064; Tue, 19 Dec 2023 09:46:20 -0800 (PST) Received: from sunil-pc.Dlink ([106.51.188.200]) by smtp.gmail.com with ESMTPSA id n16-20020a170903111000b001d3320f6143sm14453015plh.269.2023.12.19.09.46.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Dec 2023 09:46:19 -0800 (PST) From: Sunil V L To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, linux-acpi@vger.kernel.org, linux-pci@vger.kernel.org Cc: Catalin Marinas , Will Deacon , Paul Walmsley , Palmer Dabbelt , Albert Ou , "Rafael J . Wysocki" , Len Brown , Anup Patel , Thomas Gleixner , Bjorn Helgaas , Haibo Xu , Conor Dooley , Andrew Jones , =?UTF-8?q?Bj=C3=B6rn=20T=C3=B6pel?= , Marc Zyngier , Sunil V L Subject: [RFC PATCH v3 08/17] ACPI: RISC-V: Implement arch function to reorder irqchip probe entries Date: Tue, 19 Dec 2023 23:15:17 +0530 Message-Id: <20231219174526.2235150-9-sunilvl@ventanamicro.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231219174526.2235150-1-sunilvl@ventanamicro.com> References: <20231219174526.2235150-1-sunilvl@ventanamicro.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit ACPI MADT entries for interrupt controllers don't have a way to describe the hierarchy. However, the hierarchy is known to the architecture and on RISC-V platforms, the MADT sub table types are ordered in the incremental order from the root controller which is RINTC. So, add architecture function for RISC-V to reorder the interrupt controller probing as per the hierarchy as below. RINTC->IMSIC->APLIC->PLIC Signed-off-by: Sunil V L --- drivers/acpi/riscv/Makefile | 2 +- drivers/acpi/riscv/irq.c | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 drivers/acpi/riscv/irq.c diff --git a/drivers/acpi/riscv/Makefile b/drivers/acpi/riscv/Makefile index 8b3b126e0b94..f80b3da230e9 100644 --- a/drivers/acpi/riscv/Makefile +++ b/drivers/acpi/riscv/Makefile @@ -1,2 +1,2 @@ # SPDX-License-Identifier: GPL-2.0-only -obj-y += rhct.o +obj-y += rhct.o irq.o diff --git a/drivers/acpi/riscv/irq.c b/drivers/acpi/riscv/irq.c new file mode 100644 index 000000000000..36e0525b3235 --- /dev/null +++ b/drivers/acpi/riscv/irq.c @@ -0,0 +1,32 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Copyright (C) 2023, Ventana Micro Systems Inc + * Author: Sunil V L + * + */ + +#include +#include + +static int irqchip_cmp_func(const void *in0, const void *in1) +{ + struct acpi_probe_entry *elem0 = (struct acpi_probe_entry *)in0; + struct acpi_probe_entry *elem1 = (struct acpi_probe_entry *)in1; + + return (elem0->type > elem1->type) - (elem0->type < elem1->type); +} + +/* + * RISC-V irqchips in MADT of ACPI spec are defined in the same order how + * they should be probed. Since IRQCHIP_ACPI_DECLARE doesn't define any + * order, this arch function will reorder the probe functions as per the + * required order for the architecture. + */ +void arch_sort_irqchip_probe(struct acpi_probe_entry *ap_head, int nr) +{ + struct acpi_probe_entry *ape = ap_head; + + if (nr == 1 || !ACPI_COMPARE_NAMESEG(ACPI_SIG_MADT, ape->id)) + return; + sort(ape, nr, sizeof(*ape), irqchip_cmp_func, NULL); +} -- 2.39.2