From patchwork Mon Aug 7 19:57:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jon Derrick X-Patchwork-Id: 9886097 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 043E3602CC for ; Mon, 7 Aug 2017 19:59:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E8C6528437 for ; Mon, 7 Aug 2017 19:59:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D9E9D286BA; Mon, 7 Aug 2017 19:59:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 48C5428437 for ; Mon, 7 Aug 2017 19:59:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751860AbdHGT73 (ORCPT ); Mon, 7 Aug 2017 15:59:29 -0400 Received: from mga03.intel.com ([134.134.136.65]:57688 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751589AbdHGT72 (ORCPT ); Mon, 7 Aug 2017 15:59:28 -0400 Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Aug 2017 12:59:27 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.41,339,1498546800"; d="scan'208";a="120977746" Received: from eremita.lm.intel.com ([10.232.112.28]) by orsmga002.jf.intel.com with ESMTP; 07 Aug 2017 12:59:26 -0700 From: Jon Derrick To: , Cc: Bjorn Helgaas , David Woodhouse , Keith Busch , Scott Bauer , David Fugate , , Jon Derrick Subject: [PATCH 2/3] pci: Generalize is_vmd behavior Date: Mon, 7 Aug 2017 13:57:12 -0600 Message-Id: <20170807195713.10963-2-jonathan.derrick@intel.com> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170807195713.10963-1-jonathan.derrick@intel.com> References: <20170807195713.10963-1-jonathan.derrick@intel.com> Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Generalize is_vmd behavior to remove dependency on domain number checking in pci quirks. Signed-off-by: Jon Derrick --- arch/x86/include/asm/pci.h | 8 +++----- arch/x86/pci/common.c | 2 +- drivers/pci/quirks.c | 2 +- include/linux/pci.h | 4 ++++ 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/arch/x86/include/asm/pci.h b/arch/x86/include/asm/pci.h index 473a729..5c5d54a 100644 --- a/arch/x86/include/asm/pci.h +++ b/arch/x86/include/asm/pci.h @@ -60,16 +60,14 @@ static inline void *_pci_root_bus_fwnode(struct pci_bus *bus) #define pci_root_bus_fwnode _pci_root_bus_fwnode #endif -static inline bool is_vmd(struct pci_bus *bus) -{ #if IS_ENABLED(CONFIG_VMD) +static inline bool pci_bus_is_vmd(struct pci_bus *bus) +{ struct pci_sysdata *sd = bus->sysdata; return sd->vmd_domain; -#else - return false; -#endif } +#endif /* Can be used to override the logic in pci_scan_bus for skipping already-configured bus numbers - to be used for buggy BIOSes diff --git a/arch/x86/pci/common.c b/arch/x86/pci/common.c index dbe2132..18b2277 100644 --- a/arch/x86/pci/common.c +++ b/arch/x86/pci/common.c @@ -662,7 +662,7 @@ static void set_dma_domain_ops(struct pci_dev *pdev) {} static void set_dev_domain_options(struct pci_dev *pdev) { - if (is_vmd(pdev->bus)) + if (pci_bus_is_vmd(pdev->bus)) pdev->hotplug_user_indicators = 1; } diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index 6967c6b..ba47995 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c @@ -4666,7 +4666,7 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x443, quirk_intel_qat_vf_cap); static void quirk_no_aersid(struct pci_dev *pdev) { /* VMD Domain */ - if (pdev->bus->sysdata && pci_domain_nr(pdev->bus) >= 0x10000) + if (pci_bus_is_vmd(pdev->bus)) pdev->bus->bus_flags |= PCI_BUS_FLAGS_NO_AERSID; } DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x2030, quirk_no_aersid); diff --git a/include/linux/pci.h b/include/linux/pci.h index 4869e66..0299d8b 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -1471,6 +1471,10 @@ static inline int pci_proc_domain(struct pci_bus *bus) { return 0; } static inline int pci_get_new_domain_nr(void) { return -ENOSYS; } #endif /* CONFIG_PCI_DOMAINS */ +#if !IS_ENABLED(CONFIG_VMD) +static inline bool pci_bus_is_vmd(struct pci_bus *bus) { return false; } +#endif + /* * Generic implementation for PCI domain support. If your * architecture does not need custom management of PCI