From patchwork Tue Dec 31 20:24:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jon Derrick X-Patchwork-Id: 11314965 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5039E1398 for ; Wed, 1 Jan 2020 02:27:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2EE712072C for ; Wed, 1 Jan 2020 02:27:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727158AbgAAC1D (ORCPT ); Tue, 31 Dec 2019 21:27:03 -0500 Received: from mga14.intel.com ([192.55.52.115]:65216 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726960AbgAAC1D (ORCPT ); Tue, 31 Dec 2019 21:27:03 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 31 Dec 2019 18:27:02 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,381,1571727600"; d="scan'208";a="221068072" Received: from unknown (HELO nsgsw-rhel7p6.lm.intel.com) ([10.232.116.83]) by orsmga006.jf.intel.com with ESMTP; 31 Dec 2019 18:27:02 -0800 From: Jon Derrick To: , Cc: Bjorn Helgaas , Lorenzo Pieralisi , Keith Busch , Joerg Roedel , Christoph Hellwig , David Woodhouse , Lu Baolu , Jon Derrick Subject: [RFC 3/5] x86/PCI: Expose VMD's device in pci_sysdata Date: Tue, 31 Dec 2019 13:24:21 -0700 Message-Id: <1577823863-3303-4-git-send-email-jonathan.derrick@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1577823863-3303-1-git-send-email-jonathan.derrick@intel.com> References: <1577823863-3303-1-git-send-email-jonathan.derrick@intel.com> Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org To be used by intel-iommu code to find the correct domain. Signed-off-by: Jon Derrick --- arch/x86/include/asm/pci.h | 4 ++-- drivers/pci/controller/vmd.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/x86/include/asm/pci.h b/arch/x86/include/asm/pci.h index 90d0731..7656807 100644 --- a/arch/x86/include/asm/pci.h +++ b/arch/x86/include/asm/pci.h @@ -25,7 +25,7 @@ struct pci_sysdata { void *fwnode; /* IRQ domain for MSI assignment */ #endif #if IS_ENABLED(CONFIG_VMD) - bool vmd_domain; /* True if in Intel VMD domain */ + struct device *vmd_dev; /* Non-null if in Intel VMD domain */ #endif }; @@ -65,7 +65,7 @@ static inline bool is_vmd(struct pci_bus *bus) #if IS_ENABLED(CONFIG_VMD) struct pci_sysdata *sd = bus->sysdata; - return sd->vmd_domain; + return !!sd->vmd_dev; #else return false; #endif diff --git a/drivers/pci/controller/vmd.c b/drivers/pci/controller/vmd.c index 2128422..907b5bd 100644 --- a/drivers/pci/controller/vmd.c +++ b/drivers/pci/controller/vmd.c @@ -679,7 +679,7 @@ static int vmd_enable_domain(struct vmd_dev *vmd, unsigned long features) .parent = res, }; - sd->vmd_domain = true; + sd->vmd_dev = &vmd->dev->dev; sd->domain = vmd_find_free_domain(); if (sd->domain < 0) return sd->domain;