From patchwork Mon Jul 29 14:22:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sunil V L X-Patchwork-Id: 13745123 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E0AD2C3DA4A for ; Mon, 29 Jul 2024 14:44:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=1v7P8DgVWEOiQraKJZCp7Th7levU77nqOCGgGfYFy3k=; b=M4jhwG7i0iTfMGkxVs+YPQc/Sq CnvzIRNTIGGOldCpeu6d8N1NrLsWtSLoVSjYtRuBJwBtq4IdZ28WZSFc8cP1dbZNt4dXR4LSl1nci j7GaUtoqUsX6s1/piS+oXE9SvR2BKOKMbza4sVrTsxyTkAy551ZUnW/XRXB8VYlczmhek8tFD2JI/ 9jL0VaYf2ccDAhyqOu6LwKWWSe3g/+xGNJokLQUzcYUNjjAYXfYkzMv8+uu/Xc08Litsl3fWF/HGL bZiJYeqkzJN1gKP+08L7ny+W68m/s6q6I80O+hltFmlcNFyUzxXIrqaCubnDXlJpLNxCYFrgmzm/B eT/XzZwQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sYRby-0000000Bi1e-0XZT; Mon, 29 Jul 2024 14:44:30 +0000 Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sYRHH-0000000BYWB-2V4y for linux-arm-kernel@lists.infradead.org; Mon, 29 Jul 2024 14:23:09 +0000 Received: by mail-pl1-x635.google.com with SMTP id d9443c01a7336-1fc56fd4de1so19346535ad.0 for ; Mon, 29 Jul 2024 07:23:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1722262986; x=1722867786; darn=lists.infradead.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=1v7P8DgVWEOiQraKJZCp7Th7levU77nqOCGgGfYFy3k=; b=PkoDwsu0vP8cpQRm4FgQpLnjY5tj1+0BEIEn0RfnY6T/Lv+o5MeygjY0/0+Nzzu+h4 bsZmsoca49OgM3MoRiJrmfA7KpG67FwzcBfsm36IfwSNWh1c3NcSMfjWE3ffCgt3xrAY LqrbMGQ7zwq3yscoefTf9+uOcnmPq1DxYvwkOTn9EMUkMpgpaKLntppb94d+5bc7c3wc gTeycSYBOUJAuZIqcCccesObqHgt9tF2GajYeoQg4R97UD4A48sc2tBIYpgs6dLCll9B BxKHAhKCOX6EXn+ZAFui7B6hQgo6FDi3ihtNpFpOCbwvIFCd5KowYqNmW8qWlb3IJirM 2tIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722262986; x=1722867786; 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=1v7P8DgVWEOiQraKJZCp7Th7levU77nqOCGgGfYFy3k=; b=qNJdSU3Awkux1wzh7DPafOQ6vq7/mstFfRxizl/T6KjFkDOikl1ufCDW2A9Xo5DpND A3BlC6ZbgwPpFy0qwqIus5iKN5mMZhEpcP92wGomsCYFqsOXctwumgSZy0xco6qrFmDj vno/VWAnhV//2kWeAy5SiGze42f4mNvljpdgvSqBSQWObiYFUXYif05QGdqwDELgQBSi 9944mxWyYzfK3jfhoX/wgBYH4q6I1skJXFqJV4+skzb//xtf2YhQa5+rm4uAbYLR1tw9 SCQBp9h159uNKHNkri0AGRihJNyzmNwC2kp4VY/58pePcS9oyzUw1/WPRh5J17O07SQY nEsw== X-Forwarded-Encrypted: i=1; AJvYcCV54AOHTAnA9xPMvJgPufONOOuVRzqMijcqqBoJ+ZTrkGZiyhHIBik6GVYCJr/uE2ooKYhIONuZbCaAl+VeWEDGsVEe/byh1dcQCp3mPeRCvDJFCEQ= X-Gm-Message-State: AOJu0YzY8H2ZEZfhg0iuws7FJgdWmfOeRbaJ8/06YGxacNnTMlqrRnwM Buyv8gxYgVQ7YR2Wmd1ZCLx4N/5umtD148PKOh834YDODrPYJUlWUjQgrDHo38Q= X-Google-Smtp-Source: AGHT+IH0i4SJoksic7K7uCsgqP3M+9IpULgJ5o8eJTMb+FKn2Lo8UBe751+qjL2E7UCdZzZIpyOlyw== X-Received: by 2002:a17:902:d4c8:b0:1fd:6f24:efad with SMTP id d9443c01a7336-1ff04b01aebmr124703345ad.26.1722262986279; Mon, 29 Jul 2024 07:23:06 -0700 (PDT) Received: from sunil-pc.tail07344b.ts.net ([106.51.198.16]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1fed7fa988dsm83512965ad.263.2024.07.29.07.23.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jul 2024 07:23:05 -0700 (PDT) From: Sunil V L To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-riscv@lists.infradead.org, linux-pci@vger.kernel.org Cc: Catalin Marinas , Will Deacon , Palmer Dabbelt , Albert Ou , "Rafael J . Wysocki" , Len Brown , Bjorn Helgaas , Anup Patel , Thomas Gleixner , Samuel Holland , Robert Moore , Conor Dooley , Andrew Jones , Haibo Xu , Atish Kumar Patra , Drew Fustini , Sunil V L Subject: [PATCH v7 02/17] ACPI: scan: Add a weak function to reorder the IRQCHIP probe Date: Mon, 29 Jul 2024 19:52:24 +0530 Message-ID: <20240729142241.733357-3-sunilvl@ventanamicro.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240729142241.733357-1-sunilvl@ventanamicro.com> References: <20240729142241.733357-1-sunilvl@ventanamicro.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240729_072307_660528_AFACED7C X-CRM114-Status: GOOD ( 14.87 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Unlike OF framework, the irqchip probe using IRQCHIP_ACPI_DECLARE has no order defined. Depending on the Makefile is not a good idea. So, usually it is worked around by mandating only root interrupt controller probed using IRQCHIP_ACPI_DECLARE and other interrupt controllers are probed via cascade mechanism. However, this is also not a clean solution because if there are multiple root controllers (ex: RINTC in RISC-V which is per CPU) which need to be probed first, then the cascade will happen for every root controller. So, introduce a architecture specific weak function to order the probing of the interrupt controllers which can be implemented by different architectures as per their interrupt controller hierarchy. Signed-off-by: Sunil V L --- drivers/acpi/scan.c | 3 +++ include/linux/acpi.h | 2 ++ 2 files changed, 5 insertions(+) diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 59771412686b..52a9dfc8e18c 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c @@ -2755,6 +2755,8 @@ static int __init acpi_match_madt(union acpi_subtable_headers *header, return 0; } +void __weak arch_sort_irqchip_probe(struct acpi_probe_entry *ap_head, int nr) { } + int __init __acpi_probe_device_table(struct acpi_probe_entry *ap_head, int nr) { int count = 0; @@ -2763,6 +2765,7 @@ int __init __acpi_probe_device_table(struct acpi_probe_entry *ap_head, int nr) return 0; mutex_lock(&acpi_probe_mutex); + arch_sort_irqchip_probe(ap_head, nr); for (ape = ap_head; nr; ape++, nr--) { if (ACPI_COMPARE_NAMESEG(ACPI_SIG_MADT, ape->id)) { acpi_probe_count = 0; diff --git a/include/linux/acpi.h b/include/linux/acpi.h index 0687a442fec7..3fff86f95c2f 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -1343,6 +1343,8 @@ struct acpi_probe_entry { kernel_ulong_t driver_data; }; +void arch_sort_irqchip_probe(struct acpi_probe_entry *ap_head, int nr); + #define ACPI_DECLARE_PROBE_ENTRY(table, name, table_id, subtable, \ valid, data, fn) \ static const struct acpi_probe_entry __acpi_probe_##name \