From patchwork Thu Aug 3 17:59:10 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: 130851 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f41:0:b0:3e4:2afc:c1 with SMTP id v1csp1397909vqx; Thu, 3 Aug 2023 13:49:36 -0700 (PDT) X-Google-Smtp-Source: APBJJlHWKfX4KIiQJp3VJRpqcplGK7uSmcnqURkFLK5SCERt2/qhNX+6bce7IAQGTBnYH3KJ4f6Z X-Received: by 2002:a05:6a20:72a5:b0:136:42c8:693c with SMTP id o37-20020a056a2072a500b0013642c8693cmr19930832pzk.6.1691095776028; Thu, 03 Aug 2023 13:49:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691095776; cv=none; d=google.com; s=arc-20160816; b=Hyv0MtxmTNWH2TwHvni88MYGq7q90elWDc9EfRCVFoMtWwhxZZ/5N228cvbln9L8g8 4DMMmryzOLJ8k5oNa/ruT9ccjle1xAoMiehiw1L65J9fxdMPmpiGUYqXqdHzsk1sQegv D9+ZQJDnI/gkadsTbNmVItKvzp95ntxXleG03Lrnz5cFFCDgL+TkSxaXd7tI/EMfsTl8 lv+feGcWQ6821IW9MuivhLlU6P04rFMhrkOo0+b5mLx7UqiwtE10Ae9BZQC4uEvYXdrB U3Ts1DHUudUR79bm9EArWqjfF1Su2v58vjHQ1iZgwphWh80w+xzH8eYfDY8mjnvIFoE8 Qvqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=9aQz/o5NvlReZUl/stpeRs4o5FY0c8qnUYDCfHqNmJI=; fh=dzn7FZXuyjRD/SsADoLVmv8ajN6bypv0shpvYBNDmUc=; b=MRBUyIEKpsDBQ/iEwSLOWLnRQQ14e64LqAfIGif2fkxO5exToRE7cpo3xoDZQeQwp6 ZUWQOUN/hVKZ/OI81AdF0CY/G6G1cJ0Ue1YvIGwkTYVRgXvIe/6oKJzD1cX5Y1OQq11e YO0P0EhbVjLwd8pSg4w1gsXGkSWzL2Naf0cYcIjMVrZPA6ZP1dbxiGhXnZDSM2gMaJUK Zdu2Q7wosWM04fsQtKK119UkeYoGS/Y0/daQHgmgetU75Z2EPdO5VQnJ26sSWpn92pn9 Ye57xLdYk1nMC+prg4E/ITYOb2DrWK1eDiMr7j08omyZLx9KppLqxx80JWzZXw8cksvb Pwjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=Yv3oRH7T; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l65-20020a639144000000b0055c9d23b482si570482pge.314.2023.08.03.13.49.21; Thu, 03 Aug 2023 13:49:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=Yv3oRH7T; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232697AbjHCSDR (ORCPT + 99 others); Thu, 3 Aug 2023 14:03:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235256AbjHCSCV (ORCPT ); Thu, 3 Aug 2023 14:02:21 -0400 Received: from mail-pf1-x434.google.com (mail-pf1-x434.google.com [IPv6:2607:f8b0:4864:20::434]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E1ECA420C for ; Thu, 3 Aug 2023 11:01:29 -0700 (PDT) Received: by mail-pf1-x434.google.com with SMTP id d2e1a72fcca58-686e0213c0bso897541b3a.1 for ; Thu, 03 Aug 2023 11:01:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1691085686; x=1691690486; 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=9aQz/o5NvlReZUl/stpeRs4o5FY0c8qnUYDCfHqNmJI=; b=Yv3oRH7T1TZNQw/AeEOc/wdAwvfBHh5qCQDTqqhRRIWLN2RT7duj6j3Mlz5B+tyUjx DwzXxTjoAWH+iw6CkKfwMxF9xCniQjo3B09L5BaQ+m3yDEsvvlfRGxAUpVXc7dZmfqkz PN5+8DYtk9mthHfXcWzvd40WNmLxpaQLT+X3GYJHhIU0xy+P4PfNU1GlwdTTN0c2vXWS N5M/tFDrDNAY9aGtxjAy1r+U43wKUASBkf3zWtuZ0PK/OlWurnWRvhkcieTUH/K57kZ9 QHExlMok+1N1kt3iHzoySeHMoWERDl2+R1ayM9E29ohmdQ7YVT4UT939xn3e7d7QWGc0 3iwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691085686; x=1691690486; 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=9aQz/o5NvlReZUl/stpeRs4o5FY0c8qnUYDCfHqNmJI=; b=TT2135MH/mxu6k6XwnC3noIZW4kL1nKjWSGBwvY/xZFgQHvQCTx94tXl50/6l0Cvr+ vgox/nxdcHz7BYuO1Qb96yK6Mm4espQvU02k7kqofnzEGOKdvSlEWTnoEIosbF0f8I9k M6460pB4aO7omhUHHDx0Fx3tsLEqRj/lI5Bno+NEKuLv0HbhjFF6/5Z4OB1ac+7ovhWH oLLnWYgKlyKm8NHMKUrI7sdjVzddPZdUkIcQpS33YqehJ6jRywNukI+UD8Lwe7J26WEB znAe7CuxXECRM8NxLmL/AITRyyl3cVT+IftaIOg2CIZYfUd7RfM1Q6Z/0r6uBSwxCzLH HXaQ== X-Gm-Message-State: ABy/qLbq3jVC5LqFM9hHWYho7ZnAbI3Y53XNzENKWHzSlIBKrTDhAIHX 2iFQX4LajUSxVq+DtlQ94lWveA== X-Received: by 2002:a05:6a20:3d91:b0:132:c07c:f042 with SMTP id s17-20020a056a203d9100b00132c07cf042mr22166693pzi.15.1691085686344; Thu, 03 Aug 2023 11:01:26 -0700 (PDT) Received: from sunil-pc.Dlink ([106.51.190.143]) by smtp.gmail.com with ESMTPSA id s8-20020aa78d48000000b0065a1b05193asm134952pfe.185.2023.08.03.11.01.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Aug 2023 11:01:26 -0700 (PDT) From: Sunil V L To: linux-doc@vger.kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-acpi@vger.kernel.org, linux-pci@vger.kernel.org Cc: Jonathan Corbet , Paul Walmsley , Palmer Dabbelt , Albert Ou , Catalin Marinas , Will Deacon , "Rafael J . Wysocki" , Len Brown , Andy Shevchenko , Daniel Scally , Heikki Krogerus , Sakari Ailus , Greg Kroah-Hartman , Daniel Lezcano , Thomas Gleixner , Anup Patel , Marc Zyngier , Bjorn Helgaas , Robert Moore , Haibo Xu , Andrew Jones , Conor Dooley , Atish Kumar Patra , Sunil V L Subject: [RFC PATCH v1 15/21] ACPI: RISC-V: Create IMSIC platform device Date: Thu, 3 Aug 2023 23:29:10 +0530 Message-Id: <20230803175916.3174453-16-sunilvl@ventanamicro.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230803175916.3174453-1-sunilvl@ventanamicro.com> References: <20230803175916.3174453-1-sunilvl@ventanamicro.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773242444532865162 X-GMAIL-MSGID: 1773242444532865162 The MSI controller functionality of the RISC-V IMSIC is probed as a platform device by the driver. So, create the IMSIC platform device if the IMSIC was discovered in MADT during early IMSIC driver probe. Signed-off-by: Sunil V L --- drivers/acpi/riscv/init.c | 2 ++ drivers/acpi/riscv/init.h | 4 ++++ drivers/acpi/riscv/irqchip.c | 23 +++++++++++++++++++++++ 3 files changed, 29 insertions(+) create mode 100644 drivers/acpi/riscv/init.h diff --git a/drivers/acpi/riscv/init.c b/drivers/acpi/riscv/init.c index b5807bbdb171..be61c08ea385 100644 --- a/drivers/acpi/riscv/init.c +++ b/drivers/acpi/riscv/init.c @@ -6,7 +6,9 @@ */ #include +#include "init.h" void __init acpi_riscv_init(void) { + riscv_acpi_imsic_platform_init(); } diff --git a/drivers/acpi/riscv/init.h b/drivers/acpi/riscv/init.h new file mode 100644 index 000000000000..a2f72bb294d3 --- /dev/null +++ b/drivers/acpi/riscv/init.h @@ -0,0 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +#include + +void __init riscv_acpi_imsic_platform_init(void); diff --git a/drivers/acpi/riscv/irqchip.c b/drivers/acpi/riscv/irqchip.c index 6e15d45cb229..ca96bf109cf7 100644 --- a/drivers/acpi/riscv/irqchip.c +++ b/drivers/acpi/riscv/irqchip.c @@ -9,7 +9,10 @@ #include #include #include +#include +#include #include +#include "../../../drivers/pci/pci.h" struct riscv_irqchip_list { struct fwnode_handle *fwnode; @@ -101,3 +104,23 @@ struct fwnode_handle *acpi_riscv_get_msi_fwnode(struct device *dev) { return imsic_acpi_fwnode; } + +void __init riscv_acpi_imsic_platform_init(void) +{ + struct platform_device *pdev; + int ret; + + if (!acpi_riscv_get_msi_fwnode(NULL)) { + pci_no_msi(); + return; + } + + pdev = platform_device_alloc("riscv-imsic", 0); + if (!pdev) + return; + + pdev->dev.fwnode = acpi_riscv_get_msi_fwnode(NULL); + ret = platform_device_add(pdev); + if (ret) + platform_device_put(pdev); +}