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: 181168 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:24d3:b0:fb:cd0c:d3e with SMTP id r19csp2112573dyi; Tue, 19 Dec 2023 09:52:53 -0800 (PST) X-Google-Smtp-Source: AGHT+IGzzG+CHvrjskDFzGJBIc7l4vdfEPMpyi+lo3HJfjsIt0d/uEMHxTiWGbDEMXgOwoQZMwLb X-Received: by 2002:a17:907:9408:b0:a1b:64a6:5f00 with SMTP id dk8-20020a170907940800b00a1b64a65f00mr11904990ejc.5.1703008373613; Tue, 19 Dec 2023 09:52:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703008373; cv=none; d=google.com; s=arc-20160816; b=0Qz9HoR2IIIb1M3AUJQvcF82HUO2zC3ridXQdJPhgu2m4DZQ+HHUAvcO6qzxcANDxH WWUtIcCF7bAFJV6QOPDU3OgXTOPRJ5bPy6U7yN2cd8pc6MJ9rZjNDxzCHDTtSsiC6S1c q49pXzOaNHO5eV+NRH0BzrJxQTjRwb3kk0mS+XaAUIlk+T/NZipXpSLc5ZVdWSwvgpbi BYmPq13I6bGm/FTsy9LPP7vIdxjeL8Uh4I/II5Km1ITe6p5UWqNNCMAdsG7lzTqMe90D B5twtEsmwzZ7Ft3AmumFo7FeK9LYc3kQlKCmmqAv/VPlQCM0NWBDduz+7ReiEDC5qtn2 wgrA== 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=XaVzwwT2ecLOtMDBM5TdFJiJ9XdFZ6MUpboDwIj/4ug=; fh=G3MkS2cP7FkeH+7kxy0LRzNpJgfwnUWZciURRBohxGI=; b=Jus72TlpnbEJh9JzhJgMlQDBIYGbT3fLW1Ybirq3lObBlX0lhAfOrA46RYZQL1xSya 5qT0RkJj7P+FocUG5kFxObeDxJE95h0agg/r7apADryU9LS307Xvr5c/qsdkcHg4Wciw t7a5TKeNaGmVBx7p0xLMpiVNbvDW54aAn3g3JizkFtNt+6pFd7jCfYrqG2xioENOwq1g ShZh+5oGjJuXh/2+A+SHDLgChOOtHMANYdfcLjsR4bUGQpRuYUUuurP67tFIDIp0AMIM q1CBHGAnnbvFGqQGohTLtoIRxhDZDv3dRPu8jWJ5F9aSip9byZFnN9k5aFkS5xu39THj ZahA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=OwdMO+Dy; spf=pass (google.com: domain of linux-kernel+bounces-5728-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-5728-ouuuleilei=gmail.com@vger.kernel.org" Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id e18-20020a170906045200b00a24901b6057si631769eja.392.2023.12.19.09.52.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Dec 2023 09:52:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-5728-ouuuleilei=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=OwdMO+Dy; spf=pass (google.com: domain of linux-kernel+bounces-5728-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-5728-ouuuleilei=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 9A6A31F25284 for ; Tue, 19 Dec 2023 17:52:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CA4A641849; Tue, 19 Dec 2023 17:47:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ventanamicro.com header.i=@ventanamicro.com header.b="OwdMO+Dy" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) (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 D067541212 for ; Tue, 19 Dec 2023 17:47:05 +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-f169.google.com with SMTP id d9443c01a7336-1d3aa0321b5so25338965ad.2 for ; Tue, 19 Dec 2023 09:47:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1703008025; x=1703612825; 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=XaVzwwT2ecLOtMDBM5TdFJiJ9XdFZ6MUpboDwIj/4ug=; b=OwdMO+DyVotX9tmk1xRIsraAElYFlr5ThzaBzSh7oPVDYa8hsVFFb6066ici19XRHg Y6WBeMXC2BPYDoydWlpIfBi4CgE/GG5YE9CDZHsxTlXlACfJQ8IEDxBwvrcc6hDl+gpP +eNPO7GMP+ddTzRoRXZqfLmhnFBJN6IOVi+mCM4crUVLjXyCkuEi38cW/8eHyEfZaVe5 wCsfexqpWND6NugDDnaHgMaw5FZnfswZAnCRygZ64HnkwiNNvktxEmB5D59MlXtx4g4M XI1VbKpv1GGbtTG1FwOusSamDObMBU90lQ4FW/j218mKBgCFCfWDlO0yYAiUworYFrBj xmXg== 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=GkQ+KrfMgD8BiycVO8PvZyF/7TZq3QiHjqsQGryOPJyCcuZudn4PnN7fyCiKWkB0mZ tc82XSg/nqkTuMLEDvwFXnhcfw1QifIZrGgxXi07pYuFokNHzRyHRYe5mF9DdXA9HUcN tSsZM9N2GtJeUUkSQfexPvOI7Au4mjRR+9NPmANQcDaTLouU7wQYM8IYyfHfIZc2LcP0 lM7itPgW+cOu1JzYJa8lQ0r4DMfjZBTXgFeGnIA01I/0eMmHeso2CFqgOsg+y1Xqfco3 JRAL+OkT+bULNwCs0upAN474OzcWhLk2qgbkVV3UhenLkO/xYwggQRyj0dVADgsCb+xc VCpw== X-Gm-Message-State: AOJu0YzpnSUSZD1YXWQOEJI17NZHHkxClP5yqz9QXVxjgmV8l2y2Qtz6 PIcF9VOFSZ6rltt6JbIL5kTQPMafTSFsJEh6REM= 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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785733708366184516 X-GMAIL-MSGID: 1785733708366184516 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); +}