Received: by 2002:ab2:69cc:0:b0:1f4:be93:e15a with SMTP id n12csp1572891lqp; Mon, 15 Apr 2024 10:08:20 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW32f6Iu6dr9Dd4OSYZINiE1Hi6EQ8bKKV0hSJofVytgBLfazsmKtWHH/bz1kjP7hLUENcAO+YIZNGtmXoagGcMvvkvAlh/WXirWqf3qw== X-Google-Smtp-Source: AGHT+IHgn/xiGtMK7XeTnEoTuLXdLlvY/qBQCVcsEjEIIp88cr6zHPprA00CJ7plOB0JdG1fRDjz X-Received: by 2002:a17:902:e5c6:b0:1e4:145a:ee19 with SMTP id u6-20020a170902e5c600b001e4145aee19mr10971337plf.50.1713200900353; Mon, 15 Apr 2024 10:08:20 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713200900; cv=pass; d=google.com; s=arc-20160816; b=mEQItRWGEydThkuVWmowrEKVMdkwRzWjvSvaR/72M0kBXAxzyw2fbhK6qSljnePxER HPJNI+qYCb/ePhTjZ/FuW5raGIPjrbQH/qjwJSAnGVzlX+Vf0Ark7HyC0c5UaDY639Ne bG7ca85LBkK6aRGWI9+cHjFdv7oFS8zXNXDMJav/lJZH1nRybWy17nEeOquGP6JRZfDy pkn8HJrqIpav4NoaY/jXyGF90flzjly3qPzTfhnF3WscUGFtxiM+Qe1zJcdayekZiQR+ iiwwhuFyCdJnWpAf7UqTTJrEDymz8po8xd4SHqRl55ktLPzPFAsvfS5ZbVYHDNgYFsIH HOhw== ARC-Message-Signature: i=2; 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=Z52/1ZZYR1CvGL0V5chwJsk+UfCztWDiXCAoT+2GZNk=; fh=P6DrWbmwkjZG5KmvX6sBvfOSJFyERRqYD6sFVJzKArk=; b=X43tua3hevo1KstLAdgdP93fxodgH4mOwHngZS96vmD23qEWUWRa9hfYxCjzTiqkc2 qZJUACVcfRjm9xSkQ3V13bPoE3IkuhqBEYziG4RoA49s8W6RU+uBMKBXgFE3QhpLCZgU bF6l8rEOZ9+ls1w7tWrXjjQSXRGB8YUdgcSEFApDhsRFIFmC58YlAqJ/V0N+GExGt6Xn OWZ7YiVnn7kpmmZ2hPek9YAmETMeOjfdouzzvBgJQcEN1Um3uQ8T1TosunfIuXM7+eYq 5NJRmn5bm14N5WMbuG/epvUf/mFua8ocRDQiKEweSlrXyJ1J+ksKd0U4B1jwV+vtcdyi 95fQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=L5iRR3Qi; arc=pass (i=1 spf=pass spfdomain=ventanamicro.com dkim=pass dkdomain=ventanamicro.com); spf=pass (google.com: domain of linux-kernel+bounces-145605-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-145605-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id ma7-20020a170903094700b001e5a5ea5288si6467438plb.572.2024.04.15.10.08.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Apr 2024 10:08:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-145605-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=L5iRR3Qi; arc=pass (i=1 spf=pass spfdomain=ventanamicro.com dkim=pass dkdomain=ventanamicro.com); spf=pass (google.com: domain of linux-kernel+bounces-145605-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-145605-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id E134CB23DEB for ; Mon, 15 Apr 2024 17:03:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id ABEB08287D; Mon, 15 Apr 2024 17:01:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ventanamicro.com header.i=@ventanamicro.com header.b="L5iRR3Qi" Received: from mail-pf1-f181.google.com (mail-pf1-f181.google.com [209.85.210.181]) (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 921E9839FF for ; Mon, 15 Apr 2024 17:01:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.181 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713200518; cv=none; b=nEnxeoiqhlgXXmtnV2FFLB7CFr0fNiX4AnYXqLQMV7NM8SRVvlrQsYH3bd1WFW51/hQV5JwTyp1HyzNn7IuAUHEUQr8XqR5zCTBbBfvqF6iJJ4GGP8F42kVN4AlR5LFNCo11eGtgTifFRed/zd7JmeM3u84YjxbA8LWllcG+Q38= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713200518; c=relaxed/simple; bh=nvDPc3L6oEQANMqW6TwMQT+97dhGLiqDQqjjsq7m6Sg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=TEAdhy6T/lt8wWhmwwcXB2GFyYM2gzWheT9Ih2i6tBLyQ117lttozW24kFblCc7mAt9aSLLtRAh4H9Szah7v3TskpKQHLFOLtL91Wkc+7erTqYx2P5ELJFys7iggyEHx21jinX0epzTQYRewZpy1KPPTkDc52aIpLdswEkRhRjg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ventanamicro.com; spf=pass smtp.mailfrom=ventanamicro.com; dkim=pass (2048-bit key) header.d=ventanamicro.com header.i=@ventanamicro.com header.b=L5iRR3Qi; arc=none smtp.client-ip=209.85.210.181 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-pf1-f181.google.com with SMTP id d2e1a72fcca58-6ed054f282aso2406259b3a.0 for ; Mon, 15 Apr 2024 10:01:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1713200517; x=1713805317; 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=Z52/1ZZYR1CvGL0V5chwJsk+UfCztWDiXCAoT+2GZNk=; b=L5iRR3QiiU+6sb+LRsiGnwZl3gaT4EJfpuTqOak2N+oz304KL8S796qofU/wokpmAY 20+aZkZMzgnLnDns3R4xxR43dIc8sxadQCUUkwDEcJiy/YfMwYpwpSjy473phrvL+pAC Keq59DdmdBeCl2kQijYNUDWrf7zQeBxtBpj914Ct0B1A6j9zjZi0owd3pzKT+XrF6Jcq tcqlzKqaY35Fxn7vfWhqW/QjsbCkTt4prWfJaqng0N6Jrzg6qEy+dZlJ0EhYeneCNm1D 0b6LU9ctLvjplDsu2Xk9bk/R0EOHUSE2q1u4LPyTR9YMfN3PHo6Z/cLeY9qK84k/hG2u Rj/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713200517; x=1713805317; 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=Z52/1ZZYR1CvGL0V5chwJsk+UfCztWDiXCAoT+2GZNk=; b=PV8+uL1KAOzTHL9QIb2GoFecsyqjqllqW0d+U83HE1FFGLn6NGcH0K5ts1Ri+9gd10 Ba1Za3q2q6ZTJHZkvmscySej3mGQTdSdKzQpOeO1VrxDtPntELF9Bhgy7n5sS1AxOjAR 52N+3DPdltG93+sq2QfLlL/xVfI6xLoMtjQMYd7oum+QF3JFJDQy5+YlFlTiaEcTOYkW b318uKb7dz+KZ1KWYCRsWGMykKM3hMdYBgTsM4vbOF3+rGjA7NVZBQdOeMATOG7uOpyn T8OxSNqVY4jbm77fKRW7nxvRakoP/h8gkIEHzKArdPFIiNBfKuU/YnQo30FHTAAXZcpQ mpOg== X-Forwarded-Encrypted: i=1; AJvYcCUZMFgxx9mAoOBrgFWH68z47H4rZgke/KsQf6pzq+Dj5s7Pcd5HjFg7vG4SYVaBui09pX2qykbnmdEhMEYkD92Vjdl1aQx8cQt2JOi3 X-Gm-Message-State: AOJu0YyyGGWZD/roq1VGKAtg0fuW6X3IQ+e7qQmu8+O1WCZMUmLVC+Yf Foj2f+mZrIULHuFBnKw7+QbhZrKSkCSeS4AKV8XKmtSx3LvthdHitRynAA+wWLw= X-Received: by 2002:a05:6a00:986:b0:6ed:1c7:8c6b with SMTP id u6-20020a056a00098600b006ed01c78c6bmr10123074pfg.1.1713200516899; Mon, 15 Apr 2024 10:01:56 -0700 (PDT) Received: from sunil-pc.Dlink ([106.51.187.230]) by smtp.gmail.com with ESMTPSA id 1-20020a056a00072100b006ed045e3a70sm7433158pfm.25.2024.04.15.10.01.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Apr 2024 10:01:56 -0700 (PDT) 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, acpica-devel@lists.linux.dev Cc: Catalin Marinas , Will Deacon , Paul Walmsley , Palmer Dabbelt , Albert Ou , "Rafael J . Wysocki" , Len Brown , Bjorn Helgaas , Anup Patel , Thomas Gleixner , Samuel Holland , Robert Moore , Haibo1 Xu , Conor Dooley , Andrew Jones , Atish Kumar Patra , Andrei Warkentin , Marc Zyngier , =?UTF-8?q?Bj=C3=B6rn=20T=C3=B6pel?= , Sunil V L Subject: [RFC PATCH v4 05/20] ACPI: RISC-V: Implement arch function to reorder irqchip probe entries Date: Mon, 15 Apr 2024 22:30:58 +0530 Message-Id: <20240415170113.662318-6-sunilvl@ventanamicro.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240415170113.662318-1-sunilvl@ventanamicro.com> References: <20240415170113.662318-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. 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 86b0925f612d..dceec808cfab 100644 --- a/drivers/acpi/riscv/Makefile +++ b/drivers/acpi/riscv/Makefile @@ -1,4 +1,4 @@ # SPDX-License-Identifier: GPL-2.0-only -obj-y += rhct.o +obj-y += rhct.o irq.o obj-$(CONFIG_ACPI_PROCESSOR_IDLE) += cpuidle.o obj-$(CONFIG_ACPI_CPPC_LIB) += cppc.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.40.1