From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f180.google.com (mail-pf1-f180.google.com [209.85.210.180]) (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 91C168062B for ; Mon, 15 Apr 2024 17:01:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.180 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713200519; cv=none; b=dBqQfYpgeO1PPXnIkesAO374zc5gJrPArtjgz9Fv3k5v2BWtU72O1a0I0W9PLFOmOGI1s+2rhRkPgkuJFL/xEbCTW7pR1qvVqKb7jejL4z5YK3QRWVfTykxfr164qtraDC9vmC9kJVY/EEwFTNwhXH9t7XUOiR5Eu9IWPxtvZHU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713200519; c=relaxed/simple; bh=nvDPc3L6oEQANMqW6TwMQT+97dhGLiqDQqjjsq7m6Sg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=NRuIL/ovDfz+h8Oeack4m1fypS2nMrt+qosUn5NfRKkZAa8Aod0XX88UZYr5pai2Xb+96tJEz6J0n5DkARmBcMvzuDbMvs3qEnznslosoSjDDITmfrvWH+nzm07HzjfW+PrDZvIsVUHFQ8mXT/KV+K4uEl69fSAseOIFoN0tK1g= 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=llAJbpvO; arc=none smtp.client-ip=209.85.210.180 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ventanamicro.com header.i=@ventanamicro.com header.b="llAJbpvO" Received: by mail-pf1-f180.google.com with SMTP id d2e1a72fcca58-6ed054f282aso2406258b3a.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=lists.linux.dev; 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=llAJbpvO1FzL+9JDD7sxlZb7Cdg5WS6gk8OKQWW4jaDOKXW3PtDuYoe1k7Umh2GFUq aZlqx9kjfzcOZNog7e5Lzi2dDBSvUafuePab5oTn5ONaYZ315wHvEFNLuO/MWuYyB5oV 3scRCUOvaoUMkqjxheP9Xx1THkVCmo+kDc1hqp7jVVm2G9ttaI56t/yOul9bkZ4x9G/V hA9X6Zo0B8MHwKc2YX3d3BpYQlpnsNJRCg1M36aG0XTqUKXBFxjkAxLkQTNspKyhqCBJ RW8dPb3cBKCczGExMex3oRX9IR5EAOTdFPd9CEzU3U6Rxf16B86pavNwzSpjPf40DqfA G//Q== 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=G/8gPUWeZ3/k74fYn/cYZlwj6FwH+srK4QekQS4bDvlC4gyzgMDUqtkM40Vk0Q/u6+ 4fKRS8TwP6z88467FHgHiksnAOGRUohcElcgQ3+3FSLZqjBF81JW/7NtIKsx+femv6Oq rV3aKdKFevEOmvaCw3LgLgoAcW7HouUNLBc1OkfA7SAm1jZojpKnq9XSNPoRzvFYaXRA 9mTj9UDF3CZvsacaOUPWk+luD2pyIDYVIIajGsLTep2cXNVT3fVn5ialJAkjaWMnh4SH b8RnZfvgg1UGZN6e+wqFGkhBhQ1qCpJKuO/MO7BksQA72ohhao0F/N8ev7O+R7WDgwWJ WccQ== X-Forwarded-Encrypted: i=1; AJvYcCX5stz6QKeHNWuknUJGTzwa0+vg/NScAYO25Vaipf0rGkx73ZwvHRFaaeQf9ovjDVHDuPBbJIhW5UoUJGDHQVIcIQPfeYis8z4OkYK6 X-Gm-Message-State: AOJu0YyFu+MwL8gmkZ1RzQBQvHc3532ca5Mj4FSTRlPuYVyPsMqQqcCL s10iiEuMbTFYW4PEzTnjdyVqEGfpgg79P2WV0HSgZk58sa/sqmzjs6ZyB0J9wdI= X-Google-Smtp-Source: AGHT+IF3pZ5kgHd0L+s0ETBbrzTu2eQzZocJwTnnUWv3+XrCVjsqR27b/As/nt3u7TcsRgOfwdwSGQ== 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: acpica-devel@lists.linux.dev 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 From mboxrd@z Thu Jan 1 00:00:00 1970 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 7A8C5C4345F for ; Mon, 15 Apr 2024 17:03:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=x83hadpOiMabDPax6E+FMFiO1ftfgvZmpzOPpSuubH4=; b=isA0KAzWO6S6Hc CeB35+VH85IyZGYL/nwgz/wALwvU+lDOfFQlgbAHs9oZIKulKGm+2UmlODQbAfY5TE4K23IxtolWL AFUSH9b78HTcarJsjm1X3Y9xrCUJu8n7nhYegsI6aPtBtei4+Se24Ajtjv5COJHH8VnIoT06B8f9o gNXQ0YqNwC3SDtl7xwwsVHx8iXeGxRiE1LTn4ZGzEJPQ5yCEYr1elpfa/B7CTvdPPAZWKkw53WzIg 89SrDP9gvLK3pBVFRueosayFHpA8GQp2zppiv3Nw7UosY4eCMhbTEr1Kb9799zYzfyIUJmI1I4eSO bX68kWkWbIbf/egnf7hw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rwPjT-00000009CFy-2XyQ; Mon, 15 Apr 2024 17:03:03 +0000 Received: from mail-pf1-x42e.google.com ([2607:f8b0:4864:20::42e]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rwPiQ-00000009Bb1-0OIg for linux-riscv@lists.infradead.org; Mon, 15 Apr 2024 17:02:05 +0000 Received: by mail-pf1-x42e.google.com with SMTP id d2e1a72fcca58-6ee13f19e7eso2452339b3a.1 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=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=Z52/1ZZYR1CvGL0V5chwJsk+UfCztWDiXCAoT+2GZNk=; b=JKJS5AgnWFe703jJXTr2O+uxXy2QdAGmV+WQ86Upv08fjr/M3ZaAJT7M3WYiaUhBwV zCZcyzl327z5er5d+FADKulnZVAXr+9pOFedaq8jJJ+pEYdS1oC4tRlYTBukGx366mhQ pWzTFsi/+3GiscbDxekUTfQDFnm69J4urLkw+yIzC/m/ehL6J6GaTGVKmt23RseEmQ9j luxsZDrmMPdqFuXvyUt3O74a4g5Ca36qrvrd5LT+MwoPO5SbZVk98+P0HF16yIBvFiGt oVpIoW/0yeXCZH5AXMyercEbcTmL+e7qMJ+dpyo3NDEFpyEP65FBswGF5DTUqEuvX8yg gQSA== 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=u03N1EWiLM6ISZAPXePg3Z9A9CvkLw4qHOH4tAw99cmOtNdxqqVIu76SUpAFzJrJ4i gyyThGHMDn2DpJumfB7s7NauwbAshZV7i38CGlfrpvA3+gyQ+XAvGUf5PKB+BpgGPpoM 1W8NJbWdQ8DvindUCGYz81/E9kunlvv/p0uY9utR4seTLl2A4r773a8i32y9QtsqwAz8 dWdw2ySH0r8TZyCtvMY+8hUF9Y7KHRhd01ZbbGrH8VljdsdlmXrwxAwoopQxZIQrVMDQ z1/9U8AJv71HSTNiaYu73gpZbLJ/tJ8q/uVag0X3EDqJAFaYl/SldaEGvUW7LqKnKJsx HBaw== X-Forwarded-Encrypted: i=1; AJvYcCWTkfGfxiXKebdftnJnwo6RItW9wLL86n/tsDYpUBKjwGJgZh12GXk8nmOayyvZPPM1Rz7N7yGuzn5k22Ey7i+nbcJFW6I2kUQyhhKivECX X-Gm-Message-State: AOJu0YwqTNJ+AJMiiUOWeGj7cCoqGoRBuPcFm0A6ibS6cs4Ka7gya7zb 03fmKX55Jse19FIMF1o2iKRkF+xQFwHumwWxZ1vVNsECxZeomnpD7dg0AMrmAx8= X-Google-Smtp-Source: AGHT+IF3pZ5kgHd0L+s0ETBbrzTu2eQzZocJwTnnUWv3+XrCVjsqR27b/As/nt3u7TcsRgOfwdwSGQ== 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 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> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240415_100158_249871_2FC5BA46 X-CRM114-Status: GOOD ( 15.94 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Marc Zyngier , Albert Ou , Haibo1 Xu , "Rafael J . Wysocki" , Catalin Marinas , Anup Patel , Atish Kumar Patra , Robert Moore , Samuel Holland , Conor Dooley , Palmer Dabbelt , Andrei Warkentin , Paul Walmsley , Bjorn Helgaas , =?UTF-8?q?Bj=C3=B6rn=20T=C3=B6pel?= , Thomas Gleixner , Andrew Jones , Will Deacon , Len Brown Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org 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 _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv From mboxrd@z Thu Jan 1 00:00:00 1970 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 B427FC4345F for ; Mon, 15 Apr 2024 17:04:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=JBjQpUXZw+dHg2WfaSgK4tCIztIzBRAYqupobF8rqks=; b=KPdgg4l7bkSwSv lv0BW8mLhSKvPVnDYqsuCDXu4DSchI75Dc/YV2GToRkBdDMMwQdL8YcMcVFBJjHRKOngmoPQ+33Bg A7S7UI24YGqDQAO0KRuF/rcSldVr5/ZjhnWSeD+hSzZ7QNlHltu5Q41ZeDLD3n/Ss5XMhl7UQS2T1 gsHPFs2aKHo78F5CZ0uIEDS8caOGpdwP15HKEGvztPJn/zjWOJFNxBpq2j8RZz8qEpDmILaHWuRfi 3pPhAs6QUBdPry/aPCVIg1MdpQG4E9IoN/HgUX7uiw6D8B9YI2QkDq5xAuGR7EmFbHh0vrvHFZkHw rvJ+03N4m4AXaoa1FmCQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rwPka-00000009D6p-0pIU; Mon, 15 Apr 2024 17:04:12 +0000 Received: from mail-pf1-x42d.google.com ([2607:f8b0:4864:20::42d]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rwPiR-00000009BbO-3pwS for linux-arm-kernel@lists.infradead.org; Mon, 15 Apr 2024 17:02:12 +0000 Received: by mail-pf1-x42d.google.com with SMTP id d2e1a72fcca58-6f00f24f761so659129b3a.3 for ; Mon, 15 Apr 2024 10:01:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1713200517; x=1713805317; 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=Z52/1ZZYR1CvGL0V5chwJsk+UfCztWDiXCAoT+2GZNk=; b=JKJS5AgnWFe703jJXTr2O+uxXy2QdAGmV+WQ86Upv08fjr/M3ZaAJT7M3WYiaUhBwV zCZcyzl327z5er5d+FADKulnZVAXr+9pOFedaq8jJJ+pEYdS1oC4tRlYTBukGx366mhQ pWzTFsi/+3GiscbDxekUTfQDFnm69J4urLkw+yIzC/m/ehL6J6GaTGVKmt23RseEmQ9j luxsZDrmMPdqFuXvyUt3O74a4g5Ca36qrvrd5LT+MwoPO5SbZVk98+P0HF16yIBvFiGt oVpIoW/0yeXCZH5AXMyercEbcTmL+e7qMJ+dpyo3NDEFpyEP65FBswGF5DTUqEuvX8yg gQSA== 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=OTtGROb5c0hxsZUmgoSr91E6ddYF3oesyfQoESbXU4jUjUSv8WSSRmlh8Z24solMy2 3LlGz8RbyM5DbkKrGuFXR+7T/lyrPsMgrjQurkx5Z2e7xzOkLP5wj2WHnVmLOGV7N4us sAiJsZA/ThbeEXAyN/vUkve4YMo0ySsm67+gGTTUhEa+Ww22d5OHMCwb+RH2n4yVIs0H 5B9gVznfwvUDifTHBsw15nDubHPd4qpCNMNXFmI7Xdjbcej2/3FpUlf1yX/Yd2OPhOh6 COIbjPrsDpiihAZDtutRkrpsOIVlbmNqSEAvdM3rt8ieb21OJCDaVCVDZdPtaHy28Ew2 /nNQ== X-Gm-Message-State: AOJu0Yx7T4S5E30mAd+6r4Pm3+rwHMsa7CiwgRA5q34YpkmpxFXN8krb ioDIGrfPs6QFOQEnKMJ5/TiKer+4JfTuBTvBGfLNhqR6Hv0BZg9QPZBxvUIKVsZOfsfmTw1tDVc 6nes= X-Google-Smtp-Source: AGHT+IF3pZ5kgHd0L+s0ETBbrzTu2eQzZocJwTnnUWv3+XrCVjsqR27b/As/nt3u7TcsRgOfwdwSGQ== 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> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240415_100200_042574_1F78358C X-CRM114-Status: GOOD ( 17.48 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel