Message ID | 20231025202344.581132-12-sunilvl@ventanamicro.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:d641:0:b0:403:3b70:6f57 with SMTP id cy1csp218298vqb; Wed, 25 Oct 2023 13:26:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF+9w2xgFs7xQ0S3D9DBUCk4ky1HJrNJXvb1U+KHzaNdBiAeOwBwMJBAq/j98Jea9rzwGS2 X-Received: by 2002:a25:8747:0:b0:d86:4342:290 with SMTP id e7-20020a258747000000b00d8643420290mr1186999ybn.21.1698265582866; Wed, 25 Oct 2023 13:26:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698265582; cv=none; d=google.com; s=arc-20160816; b=m6/65prQlxkmQnRDUnki44GM0cGEsATHxQorWQnk0axU1eDc6GiJi03UlyKGKTKZGh 1BGFbEr5tf9FZ7Ss+I/e4tyi0WBdOXW+J/frSCBCsXHpEn9KXy2+G2975eEoU0weJNtF vVdOzKhd5fuzdfiCi8Vr4TlfReGyNTpBW5kI70cfcnv5lP9SqEFv/H53alrLqiwud+80 qRbialdbOent9IcBjcyaEc69x1Fgfnr3tK+KlIRDR5qm+pRsd8uZaSNV170tXIOPVKMM 7LGiwvM3AWcSkMGXNF8+gTI+fUm2XdRjOY7QC3c3vdRAEIgV7wiUj2SP0WX3p6hWCIld q8WA== 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=ksJT9a6E7b+AgWOW+0QqZAQKxEPs+GfkSTk4Wygp/9k=; fh=/fEAwM0ftwV2z3MN/iSYq1lv8IFPZ2fY8Kg8RoFcxjU=; b=VMUohHNjrUPXqm9SoedoEyfZXXmIVLuX+GruC+vPrxIu17f2Q21rht2JB5vqTZQklX Q9SzcpxgobypwmjiuOEx/DuUsDiJkEEoDOCDDkFbC5OVrHG7GJOF0F34S9hwxnkf/8PH fd494NlGA3Nz+RE4zdXUWwNpbnH8fl7v2x+EFKnkaORluCjswsBmFKAOzPWCoRZvLXsa Vl5xdes51X52/VRYc6QsPAlrDvMVIhYOna6oEeuvp/mOKxXU8rdytDxRrl5J79Glc0lI H+8aOwmr/SYRrzMyps8iZ5+jp+uqskVw5j7T/a89juNW+nRg8v2Tev4Bex26u+dJo9It IPlg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=JPtX39iv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id w83-20020a25df56000000b00d801af7c4a8si13257187ybg.385.2023.10.25.13.26.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 13:26:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=JPtX39iv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id AA12B80E9E8C; Wed, 25 Oct 2023 13:26:19 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234983AbjJYU0B (ORCPT <rfc822;a1648639935@gmail.com> + 25 others); Wed, 25 Oct 2023 16:26:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38348 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343904AbjJYUZ2 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 25 Oct 2023 16:25:28 -0400 Received: from mail-pf1-x429.google.com (mail-pf1-x429.google.com [IPv6:2607:f8b0:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A1ACB10F1 for <linux-kernel@vger.kernel.org>; Wed, 25 Oct 2023 13:25:13 -0700 (PDT) Received: by mail-pf1-x429.google.com with SMTP id d2e1a72fcca58-6b77ab73c6fso101444b3a.1 for <linux-kernel@vger.kernel.org>; Wed, 25 Oct 2023 13:25:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1698265513; x=1698870313; 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=ksJT9a6E7b+AgWOW+0QqZAQKxEPs+GfkSTk4Wygp/9k=; b=JPtX39ivNbt4Wu54KHQbjp1dzqEbHENSrbcvDK7ihL8aouRjgAM1qBg0f08HtA9Epz uqxhuOgJssIxhOx5Hdtxi2qNqGoiGAOTpJHtqhzM8/RCoJrrOyAWwNbj7WgPxnxdhNJ/ QUCcaLA6nIsojuBhfGSIcOAOGAS30PqwI+9t1tNo9RNydJmC8xkKN3pJEfZCXMfEY6XK XXfnvzgLivw+nwMJOq+PVT3Azu/kavUkoHQdT5Fpb7im21YBKGATma9lx07I7CqEHUUh g8ix8mJPToO7AYfDx1nMKi5QnmRiTuIVnEkjuyp+JOi8/WevGG0hM3Q0gsPDw916+c6y jUGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698265513; x=1698870313; 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=ksJT9a6E7b+AgWOW+0QqZAQKxEPs+GfkSTk4Wygp/9k=; b=NdXvqpD0In62gq/E5SpCyYors+XhjO0WxIFRTpDQlEu1nH7wllYuPeOXZ1ca27FJsR UX1QKHwHdKOCm4f0PR/NlDSakV6x0aRnkoyymN55ic6bMYwECSD6GlSONAppFGcx+A6x inl2xATiIUeLXArxNY/kEE9xbJvyYUbaezVvRsvGO+cXmj/yLrD0UEIxd604k/OX7c0B jn/RNVk7RjCdUT/jnj/hIwqdQBexEGAjrqSmkHfRjE+y7kDLQp9wYmocZgZz22GwAMFO o8dxhW7QcSmP7nzx5+xC0AW8V+D5bMtQl8jkVhPXLi0GtTkd0TmejS8VmQkAU4TpkA2t eG6w== X-Gm-Message-State: AOJu0Ywl6mZRFSeaOB9sxSwotwCMcqkcTGn/byHgdiUwsNlCd5u2ctgA ufosK/i7cb5RcFihf25Ya47M+P8xar0lVLgWfLtYig== X-Received: by 2002:a05:6a00:478c:b0:6b4:64ac:eab2 with SMTP id dh12-20020a056a00478c00b006b464aceab2mr801836pfb.1.1698265512788; Wed, 25 Oct 2023 13:25:12 -0700 (PDT) Received: from sunil-pc.Dlink ([106.51.188.78]) by smtp.gmail.com with ESMTPSA id y3-20020aa79423000000b006b84ed9371esm10079590pfo.177.2023.10.25.13.25.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 13:25:12 -0700 (PDT) From: Sunil V L <sunilvl@ventanamicro.com> 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, linux-serial@vger.kernel.org Cc: Catalin Marinas <catalin.marinas@arm.com>, Will Deacon <will@kernel.org>, Paul Walmsley <paul.walmsley@sifive.com>, Palmer Dabbelt <palmer@dabbelt.com>, Albert Ou <aou@eecs.berkeley.edu>, "Rafael J . Wysocki" <rafael@kernel.org>, Len Brown <lenb@kernel.org>, Bjorn Helgaas <bhelgaas@google.com>, Anup Patel <anup@brainfault.org>, Thomas Gleixner <tglx@linutronix.de>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Jiri Slaby <jirislaby@kernel.org>, Conor Dooley <conor.dooley@microchip.com>, Andrew Jones <ajones@ventanamicro.com>, Atish Kumar Patra <atishp@rivosinc.com>, Haibo Xu <haibo1.xu@intel.com>, Sunil V L <sunilvl@ventanamicro.com> Subject: [RFC PATCH v2 11/21] PCI: MSI: Add helper function to set system wide MSI support Date: Thu, 26 Oct 2023 01:53:34 +0530 Message-Id: <20231025202344.581132-12-sunilvl@ventanamicro.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231025202344.581132-1-sunilvl@ventanamicro.com> References: <20231025202344.581132-1-sunilvl@ventanamicro.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=2.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: ** X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Wed, 25 Oct 2023 13:26:19 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780760531802794592 X-GMAIL-MSGID: 1780760531802794592 |
Series |
RISC-V: ACPI: Add external interrupt controller support
|
|
Commit Message
Sunil V L
Oct. 25, 2023, 8:23 p.m. UTC
Like pci_no_msi() used to disable MSI support, add a function to enable
system wide MSI support.
Signed-off-by: Sunil V L <sunilvl@ventanamicro.com>
---
drivers/pci/msi/msi.c | 5 +++++
drivers/pci/pci.h | 2 ++
2 files changed, 7 insertions(+)
Comments
On Thu, Oct 26 2023 at 01:53, Sunil V. L. wrote: > Like pci_no_msi() used to disable MSI support, add a function to enable > system wide MSI support. Why? int pci_msi_enable = 1; So this function makes it more one or what am I missing here? Thanks, tglx
On Mon, Oct 30, 2023 at 03:28:53PM +0100, Thomas Gleixner wrote: > On Thu, Oct 26 2023 at 01:53, Sunil V. L. wrote: > > Like pci_no_msi() used to disable MSI support, add a function to enable > > system wide MSI support. > > Why? > > int pci_msi_enable = 1; > > So this function makes it more one or what am I missing here? > Hi Thomas, Just noting related discussion : https://www.spinics.net/lists/linux-serial/msg57616.html The MSI controller on RISC-V (IMSIC) is optional for the platform. So, when by default pci_msi_enable = 1 and the MSI controller is not discovered, we get stack trace like below. [ 0.608941] [<ffffffff804d0400>] pci_msi_setup_msi_irqs+0x18/0x34 [ 0.608991] [<ffffffff804cfe04>] msix_capability_init+0x228/0x406 [ 0.609001] [<ffffffff804cfbc6>] __pci_enable_msix_range+0x1b4/0x1ca [ 0.609011] [<ffffffff804ce8c2>] pci_alloc_irq_vectors_affinity+0x6e/0xee [ 0.609020] [<ffffffff8055015c>] vp_find_vqs_msix+0xfa/0x350 [ 0.609031] [<ffffffff8054ff54>] vp_find_vqs+0x36/0x144 [ 0.609040] [<ffffffff8054f7b8>] vp_modern_find_vqs+0x14/0x48 [ 0.609049] [<ffffffff8064d3fc>] init_vqs+0x362/0x4ee [ 0.609058] [<ffffffff8064c8be>] virtnet_probe+0x672/0xa70 [ 0.609067] [<ffffffff80549d38>] virtio_dev_probe+0x194/0x200 [ 0.609075] [<ffffffff805afb52>] really_probe+0x106/0x28a [ 0.609083] [<ffffffff805aefda>] __driver_probe_device+0x62/0xdc [ 0.609091] [<ffffffff805af920>] driver_probe_device+0x38/0x164 [ 0.609098] [<ffffffff805af146>] __driver_attach+0xd0/0x17c [ 0.609106] [<ffffffff805ac6e2>] bus_for_each_dev+0xd0/0x11c [ 0.609116] [<ffffffff805af06e>] driver_attach+0x1a/0x22 [ 0.609123] [<ffffffff805ace06>] bus_add_driver+0x136/0x208 [ 0.609132] [<ffffffff805b044e>] driver_register+0x48/0xda [ 0.609140] [<ffffffff80549594>] register_virtio_driver+0x20/0x2a [ 0.609157] [<ffffffff80a3060e>] virtio_net_driver_init+0x76/0xa6 [ 0.609168] [<ffffffff800020ec>] do_one_initcall+0xc0/0x21e [ 0.609176] [<ffffffff80a00f68>] do_initcall_level+0x7c/0x8e [ 0.609186] [<ffffffff80a00eb6>] do_initcalls+0x52/0x88 [ 0.609195] [<ffffffff80a00e5c>] do_basic_setup+0x1c/0x24 [ 0.609204] [<ffffffff80a00e00>] kernel_init_freeable+0xe2/0x122 [ 0.609213] [<ffffffff8090beb4>] kernel_init+0x1a/0x18e [ 0.609223] [<ffffffff8000383e>] ret_from_fork+0xa/0x1c So, what I did was, by default call pci_no_msi() to disable MSI and then call pci_set_msi() to enable when MSI controller is probed. But I think Bjorn's suggestion to depend on PCI_BUS_FLAGS_NO_MSI may be better idea. In that case, we need to set bridge->msi_domain to true in pci_create_root_bus(). Let me know what do you prefer or if I am completely missing something here. Thanks, Sunil
On Mon, Oct 30 2023 at 23:24, Sunil V. L. wrote: > On Mon, Oct 30, 2023 at 03:28:53PM +0100, Thomas Gleixner wrote: > Just noting related discussion : > https://www.spinics.net/lists/linux-serial/msg57616.html > > The MSI controller on RISC-V (IMSIC) is optional for the platform. So, > when by default pci_msi_enable = 1 and the MSI controller is not > discovered, we get stack trace like below. <SNIP> > So, what I did was, by default call pci_no_msi() to disable MSI and then > call pci_set_msi() to enable when MSI controller is probed. Your taste sensors should have gone out of range ... > But I think Bjorn's suggestion to depend on PCI_BUS_FLAGS_NO_MSI may be > better idea. In that case, we need to set bridge->msi_domain to true in > pci_create_root_bus(). Let me know what do you prefer or if I am > completely missing something here. That's definitely more sensible, but as I said in the other thread, Marc is the one who did the PCI core/bridge setup magic and he is definitely in a better position to answer that bridge->msi_domain question. Thanks, tglx
On Mon, Oct 30, 2023 at 08:29:13PM +0100, Thomas Gleixner wrote: > On Mon, Oct 30 2023 at 23:24, Sunil V. L. wrote: > > On Mon, Oct 30, 2023 at 03:28:53PM +0100, Thomas Gleixner wrote: > > Just noting related discussion : > > https://www.spinics.net/lists/linux-serial/msg57616.html > > > > The MSI controller on RISC-V (IMSIC) is optional for the platform. So, > > when by default pci_msi_enable = 1 and the MSI controller is not > > discovered, we get stack trace like below. > > <SNIP> > > > So, what I did was, by default call pci_no_msi() to disable MSI and then > > call pci_set_msi() to enable when MSI controller is probed. > > Your taste sensors should have gone out of range ... > > > But I think Bjorn's suggestion to depend on PCI_BUS_FLAGS_NO_MSI may be > > better idea. In that case, we need to set bridge->msi_domain to true in > > pci_create_root_bus(). Let me know what do you prefer or if I am > > completely missing something here. > > That's definitely more sensible, but as I said in the other thread, Marc > is the one who did the PCI core/bridge setup magic and he is definitely > in a better position to answer that bridge->msi_domain question. > Thanks!. It looks like Marc introduced bridge->msi_domain in [1] for exactly the same problem we have with RISC-V + ACPI. Let me remove this hack and do similar to pci_host_common_probe() in next revision unless I get objections to that approach. Sorry, somehow my script didn't copy Marc in the series. Will make sure I copy him explicitly in next revision. [1] - https://lore.kernel.org/all/20210330151145.997953-12-maz@kernel.org/ Thanks! Sunil
diff --git a/drivers/pci/msi/msi.c b/drivers/pci/msi/msi.c index ef1d8857a51b..e76ccb8b5f0b 100644 --- a/drivers/pci/msi/msi.c +++ b/drivers/pci/msi/msi.c @@ -913,3 +913,8 @@ void pci_no_msi(void) { pci_msi_enable = 0; } + +void pci_set_msi(void) +{ + pci_msi_enable = 1; +} diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h index 39a8932dc340..2f876c29f75c 100644 --- a/drivers/pci/pci.h +++ b/drivers/pci/pci.h @@ -167,8 +167,10 @@ extern unsigned int pci_pm_d3hot_delay; #ifdef CONFIG_PCI_MSI void pci_no_msi(void); +void pci_set_msi(void); #else static inline void pci_no_msi(void) { } +static inline void pci_set_msi(void) { } #endif void pci_realloc_get_opt(char *);