From patchwork Tue Dec 19 17:45:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sunil V L X-Patchwork-Id: 13498917 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 4486FC46CCD for ; Tue, 19 Dec 2023 19:02:17 +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=i4DISYeJpMvV5YQKRVi61KwxcXaFNwSzHMEEKJNAJSc=; b=wBxCvzxoWedCA+ cIESpBn0Hq3+gqoztzcP8mJqoosrNwWMpeiB+m3I1mvadwqdGIWAydHQmt+N1upSFCRZIgGsJD9nl Ww9/CBJnBijd4OD1tcHD3YhMq0G9RW97DwewDb/FxwpKzC0zN+3rY3+yPdM0RQKxQmUpyWLj3+ms0 1Kmtwxawz80n2ixMN463s2BNzYK1tvhi+VhhTiXhcMHwcqSZgFugCnNGettaVSj+y9471XgxPlECn a1lmsnQitxEtycXSJn7JRLugtRcX0Wkr6IdGiK2bLoWGrOeoz93B1UhO0SsFmFuxCBegNr2k4sYmq P9ZHCZUj6OsUcfBa9HiA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rFfLh-00FGub-2a; Tue, 19 Dec 2023 19:01:49 +0000 Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rFeBO-00F1aR-1y for linux-arm-kernel@lists.infradead.org; Tue, 19 Dec 2023 17:47:08 +0000 Received: by mail-pl1-x62f.google.com with SMTP id d9443c01a7336-1d3aa0321b5so25339065ad.2 for ; Tue, 19 Dec 2023 09:47:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1703008025; x=1703612825; 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=XaVzwwT2ecLOtMDBM5TdFJiJ9XdFZ6MUpboDwIj/4ug=; b=jaHIrw3CtURZfDLL5CdOrgdl4XiCxao8ndPVGp1RhjL9upeIAOzFU99HIdiqJPK0pX z3JJ+5hsg4z3/iLjjsml+JBx8GvZLXiByALaEdwPXVzIqFmd9PeQ5uKdqdACQEaGuTK/ CtPAmZWVhfm7FeHYcUjkb8qpgHYmnqt1/WFZDELFwnkU3aplVbTAQ83ozCdTP0cCwmUY e9Zb7MSyG5jhQfo5+5kuuoZRefqurKFeM8UCQR67821Ey2il/jWg4UK8MT+/dTLA+1Uk KuNnOBKWIfSnPbl3mGgb6o0kA1ZqixpZIIxJgp5odoshHhbg10EkSR6IrIh3WdoURGhr +rRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703008025; x=1703612825; 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=XaVzwwT2ecLOtMDBM5TdFJiJ9XdFZ6MUpboDwIj/4ug=; b=LPeMlzxR2llOVhthSsZjCrODx37kbBkfYjN71F//+7t4lsUXsm5P2viyCx9sMJ2GLW zmkedGTGcUO1R4SfFHZUzZAEywMlz9HqBzexeKyfE3unB41jZ+Fm/dwrGXCrrHBUrdwg I9geg5R23E4glNRTIqbrsH4evL6kAQCnIsOLwvW8UzLOaJVeg3hb7PL6BKThncLnc80L d7z6jgxzt7yVQjKZZaiI9sIpHhrvj5/4gbMYCI22OtJmOOm/U4DG3+w4bEc1mGxNzUWK 7hN6/9w/N4WCgU8cJafJpmSGxmX8rtXKxj0ehvkQ8RlMAfJ+IQH5v0gF9YUdonsMn+pB EA8w== X-Gm-Message-State: AOJu0YxRONqV8fesLj/cbB0ti5pS8IaW4DO+QRs81WHxc6IFlDF2Yc0m Txpev05F/YoAlrKVrf4atIzHK5rlZdIJa/uxDj4= X-Google-Smtp-Source: AGHT+IG5x81QIwdA146e8SSr+Pdh859h/oT2VMGTgxkFKS+ftvwwQnsNNroKYOvMgeiD+AUyeRhwsQ== X-Received: by 2002:a17:903:2347:b0:1d3:c730:f0a2 with SMTP id c7-20020a170903234700b001d3c730f0a2mr3728002plh.118.1703008025154; Tue, 19 Dec 2023 09:47:05 -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.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Dec 2023 09:47:04 -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?b?QmrDtnJuIFTDtnBlbA==?= , Marc Zyngier , Sunil V L Subject: [RFC PATCH v3 16/17] ACPI: RISC-V: Create PLIC platform device Date: Tue, 19 Dec 2023 23:15:25 +0530 Message-Id: <20231219174526.2235150-17-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> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231219_094706_667746_8AC69409 X-CRM114-Status: GOOD ( 10.86 ) 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 Since PLIC needs to be a platform device, probe the MADT and create platform devices for each PLIC in the system. Signed-off-by: Sunil V L --- drivers/acpi/riscv/init.c | 1 + drivers/acpi/riscv/init.h | 1 + drivers/acpi/riscv/irq.c | 19 +++++++++++++++++++ 3 files changed, 21 insertions(+) diff --git a/drivers/acpi/riscv/init.c b/drivers/acpi/riscv/init.c index e7eff7ab1474..c6fd4097e8ae 100644 --- a/drivers/acpi/riscv/init.c +++ b/drivers/acpi/riscv/init.c @@ -11,4 +11,5 @@ void __init acpi_riscv_init(void) { riscv_acpi_aplic_platform_init(); + riscv_acpi_plic_platform_init(); } diff --git a/drivers/acpi/riscv/init.h b/drivers/acpi/riscv/init.h index 17bcf0baaadb..b4b305d83b3a 100644 --- a/drivers/acpi/riscv/init.h +++ b/drivers/acpi/riscv/init.h @@ -3,3 +3,4 @@ void __init riscv_acpi_imsic_platform_init(void); void __init riscv_acpi_aplic_platform_init(void); +void __init riscv_acpi_plic_platform_init(void); diff --git a/drivers/acpi/riscv/irq.c b/drivers/acpi/riscv/irq.c index d08a851ab6dc..f14ea43b0178 100644 --- a/drivers/acpi/riscv/irq.c +++ b/drivers/acpi/riscv/irq.c @@ -148,3 +148,22 @@ void __init riscv_acpi_aplic_platform_init(void) { acpi_table_parse_madt(ACPI_MADT_TYPE_APLIC, aplic_parse_madt, 0); } + +static int __init plic_parse_madt(union acpi_subtable_headers *header, + const unsigned long end) +{ + struct acpi_madt_plic *plic = (struct acpi_madt_plic *)header; + + return irqchip_add_platform_device("riscv-plic", + plic->id, + plic->base_addr, + plic->size, + plic->gsi_base, + plic->num_irqs, + header); +} + +void __init riscv_acpi_plic_platform_init(void) +{ + acpi_table_parse_madt(ACPI_MADT_TYPE_PLIC, plic_parse_madt, 0); +}