Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3667850pxf; Mon, 22 Mar 2021 11:57:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxyeRPrh4V92emBaVQc7Q0jnH2OYUa1MbGB7lrXeaEB7Tu5oWJo+PkdTwrfKZzslEIPLvSU X-Received: by 2002:a17:906:4d8f:: with SMTP id s15mr1244053eju.350.1616439445059; Mon, 22 Mar 2021 11:57:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616439445; cv=none; d=google.com; s=arc-20160816; b=MnhqrEEgNI0zsh4fdOrLyBCKszgSXSwexZREgvBimdDLDn8SGVE75at9Jw1dWwhNGy tbacwGCCvaThvqTZlnoxEMRwwHZIOzrDgssnwUCFND/ULjsw6s9Tb8I5ySFIEfOmXil/ cs4FFXvLi/Ab50W/l02q4iMmK8h/lw6A3DqL7Mx4QmHISC7HrH75mITp5Fm7VeUDZHyr l40n6OLNXoQ2UCZxsHVGx9daRf7FOEtCRib3zi7pUSgjlYYHm4waxbo9QuepUD0VtqxH +dNMpPdW2m8yNl/jduiEEbon+T07sCwP1oGSeTh+uY5GHaYzMWxrY3vf+r+bt46nULm3 qMPQ== 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; bh=QdgiUYt/XCfEgHanMY36px79V1PHdzTm1C1ccO/u9Ng=; b=hOgHFzc8fkKLkxHYNRCvYspDCa8eCuZgWaye3eWLP3IfH8QlgqxuYAJir9acIhvY6O NBFbrfiW6DD2Kmue8af3VM7G8KSietwbWy3EdF41HIszw2sl49kYGK2ZxsoXa9NikOdX +vptlt7MaGV4fWC/i6aV2cAC4Pq1OBe2kMfjQKgUOeBlTnr7MhRl2XxDflXutZoj3gun Iz964wCQuSL1rS9hiLrh4dTZ22UIbejnp7Dj8DGR7XoHGYHWRBxS/FmJCgDB679G1zrE P7wYlxnhHtytXwLg/1RHyYQbjA0lgm+QPJoF1KUytzLd7G8AXpcDHtDUt7YXNRyOIqi9 ZesA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bu1si11734870edb.213.2021.03.22.11.57.02; Mon, 22 Mar 2021 11:57:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232283AbhCVSyS (ORCPT + 99 others); Mon, 22 Mar 2021 14:54:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:37504 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231724AbhCVSxo (ORCPT ); Mon, 22 Mar 2021 14:53:44 -0400 Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3B71661990; Mon, 22 Mar 2021 18:53:44 +0000 (UTC) Received: from 78.163-31-62.static.virginmediabusiness.co.uk ([62.31.163.78] helo=why.lan) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94) (envelope-from ) id 1lOPZV-0038p5-VO; Mon, 22 Mar 2021 18:46:38 +0000 From: Marc Zyngier To: Lorenzo Pieralisi , Bjorn Helgaas Cc: Frank Wunderlich , Thierry Reding , Thomas Gleixner , Rob Herring , Will Deacon , "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , Michael Kelley , Wei Liu , Thierry Reding , Jonathan Hunter , Ryder Lee , Marek Vasut , Yoshihiro Shimoda , Michal Simek , Paul Walmsley , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-hyperv@vger.kernel.org, linux-tegra@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-renesas-soc@vger.kernel.org, kernel-team@android.com Subject: [PATCH v2 15/15] PCI: Refactor HT advertising of NO_MSI flag Date: Mon, 22 Mar 2021 18:46:14 +0000 Message-Id: <20210322184614.802565-16-maz@kernel.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210322184614.802565-1-maz@kernel.org> References: <20210322184614.802565-1-maz@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SA-Exim-Connect-IP: 62.31.163.78 X-SA-Exim-Rcpt-To: lorenzo.pieralisi@arm.com, bhelgaas@google.com, frank-w@public-files.de, treding@nvidia.com, tglx@linutronix.de, robh@kernel.org, will@kernel.org, kys@microsoft.com, haiyangz@microsoft.com, sthemmin@microsoft.com, mikelley@microsoft.com, wei.liu@kernel.org, thierry.reding@gmail.com, jonathanh@nvidia.com, ryder.lee@mediatek.com, marek.vasut+renesas@gmail.com, yoshihiro.shimoda.uh@renesas.com, michal.simek@xilinx.com, paul.walmsley@sifive.com, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-hyperv@vger.kernel.org, linux-tegra@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-renesas-soc@vger.kernel.org, kernel-team@android.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The few quirks that deal with NO_MSI tend to be copy-paste heavy. Refactor them so that the hierarchy of conditions is slightly cleaner. Acked-by: Bjorn Helgaas Signed-off-by: Marc Zyngier --- drivers/pci/quirks.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index 653660e3ba9e..972bb0f9f994 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c @@ -2585,10 +2585,8 @@ static int msi_ht_cap_enabled(struct pci_dev *dev) /* Check the HyperTransport MSI mapping to know whether MSI is enabled or not */ static void quirk_msi_ht_cap(struct pci_dev *dev) { - if (dev->subordinate && !msi_ht_cap_enabled(dev)) { - pci_warn(dev, "MSI quirk detected; subordinate MSI disabled\n"); - dev->subordinate->bus_flags |= PCI_BUS_FLAGS_NO_MSI; - } + if (!msi_ht_cap_enabled(dev)) + quirk_disable_msi(dev); } DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_HT2000_PCIE, quirk_msi_ht_cap); @@ -2601,9 +2599,6 @@ static void quirk_nvidia_ck804_msi_ht_cap(struct pci_dev *dev) { struct pci_dev *pdev; - if (!dev->subordinate) - return; - /* * Check HT MSI cap on this chipset and the root one. A single one * having MSI is enough to be sure that MSI is supported. @@ -2611,10 +2606,8 @@ static void quirk_nvidia_ck804_msi_ht_cap(struct pci_dev *dev) pdev = pci_get_slot(dev->bus, 0); if (!pdev) return; - if (!msi_ht_cap_enabled(dev) && !msi_ht_cap_enabled(pdev)) { - pci_warn(dev, "MSI quirk detected; subordinate MSI disabled\n"); - dev->subordinate->bus_flags |= PCI_BUS_FLAGS_NO_MSI; - } + if (!msi_ht_cap_enabled(pdev)) + quirk_msi_ht_cap(dev); pci_dev_put(pdev); } DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_CK804_PCIE, -- 2.29.2