linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sinan Kaya <okaya@codeaurora.org>
To: linux-pci@vger.kernel.org, timur@codeaurora.org
Cc: linux-arm-msm@vger.kernel.org, Joerg Roedel <joro@8bytes.org>,
	open list <linux-kernel@vger.kernel.org>,
	Sinan Kaya <okaya@codeaurora.org>,
	"open list:AMD IOMMU AMD-VI" <iommu@lists.linux-foundation.org>,
	linux-arm-kernel@lists.infradead.org
Subject: [PATCH V4 11/26] iommu/amd: deprecate pci_get_bus_and_slot()
Date: Tue, 19 Dec 2017 00:37:47 -0500	[thread overview]
Message-ID: <1513661883-28662-12-git-send-email-okaya@codeaurora.org> (raw)
In-Reply-To: <1513661883-28662-1-git-send-email-okaya@codeaurora.org>

pci_get_bus_and_slot() is restrictive such that it assumes domain=0 as
where a PCI device is present. This restricts the device drivers to be
reused for other domain numbers.

Getting ready to remove pci_get_bus_and_slot() function in favor of
pci_get_domain_bus_and_slot().

Hard-code the domain number as 0 for the AMD IOMMU driver.

Signed-off-by: Sinan Kaya <okaya@codeaurora.org>
---
 drivers/iommu/amd_iommu.c      | 3 ++-
 drivers/iommu/amd_iommu_init.c | 9 +++++----
 drivers/iommu/amd_iommu_v2.c   | 3 ++-
 3 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c
index 7d5eb00..821547b 100644
--- a/drivers/iommu/amd_iommu.c
+++ b/drivers/iommu/amd_iommu.c
@@ -527,7 +527,8 @@ static void amd_iommu_report_page_fault(u16 devid, u16 domain_id,
 	struct iommu_dev_data *dev_data = NULL;
 	struct pci_dev *pdev;
 
-	pdev = pci_get_bus_and_slot(PCI_BUS_NUM(devid), devid & 0xff);
+	pdev = pci_get_domain_bus_and_slot(0, PCI_BUS_NUM(devid),
+					   devid & 0xff);
 	if (pdev)
 		dev_data = get_dev_data(&pdev->dev);
 
diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c
index 6fe2d03..4e4a615 100644
--- a/drivers/iommu/amd_iommu_init.c
+++ b/drivers/iommu/amd_iommu_init.c
@@ -1697,8 +1697,8 @@ static int iommu_init_pci(struct amd_iommu *iommu)
 	u32 range, misc, low, high;
 	int ret;
 
-	iommu->dev = pci_get_bus_and_slot(PCI_BUS_NUM(iommu->devid),
-					  iommu->devid & 0xff);
+	iommu->dev = pci_get_domain_bus_and_slot(0, PCI_BUS_NUM(iommu->devid),
+						 iommu->devid & 0xff);
 	if (!iommu->dev)
 		return -ENODEV;
 
@@ -1764,8 +1764,9 @@ static int iommu_init_pci(struct amd_iommu *iommu)
 	if (is_rd890_iommu(iommu->dev)) {
 		int i, j;
 
-		iommu->root_pdev = pci_get_bus_and_slot(iommu->dev->bus->number,
-				PCI_DEVFN(0, 0));
+		iommu->root_pdev =
+			pci_get_domain_bus_and_slot(0, iommu->dev->bus->number,
+						    PCI_DEVFN(0, 0));
 
 		/*
 		 * Some rd890 systems may not be fully reconfigured by the
diff --git a/drivers/iommu/amd_iommu_v2.c b/drivers/iommu/amd_iommu_v2.c
index 7d94e1d..8696382 100644
--- a/drivers/iommu/amd_iommu_v2.c
+++ b/drivers/iommu/amd_iommu_v2.c
@@ -564,7 +564,8 @@ static int ppr_notifier(struct notifier_block *nb, unsigned long e, void *data)
 	finish      = (iommu_fault->tag >> 9) & 1;
 
 	devid = iommu_fault->device_id;
-	pdev = pci_get_bus_and_slot(PCI_BUS_NUM(devid), devid & 0xff);
+	pdev = pci_get_domain_bus_and_slot(0, PCI_BUS_NUM(devid),
+					   devid & 0xff);
 	if (!pdev)
 		return -ENODEV;
 	dev_data = get_dev_data(&pdev->dev);
-- 
1.9.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2017-12-19  5:37 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-19  5:37 [PATCH V4 00/26] PCI: deprecate pci_get_bus_and_slot() Sinan Kaya
2017-12-19  5:37 ` [PATCH V4 01/26] alpha/PCI: " Sinan Kaya
2018-01-03 12:43   ` Sinan Kaya
2017-12-19  5:37 ` [PATCH V4 02/26] powerpc/PCI: " Sinan Kaya
2017-12-19 10:29   ` Michael Ellerman
2017-12-19 12:24     ` Sinan Kaya
2017-12-19  5:37 ` [PATCH V4 03/26] x86/PCI: " Sinan Kaya
2017-12-19  5:37 ` [PATCH V4 04/26] ata: " Sinan Kaya
2017-12-19  5:37 ` [PATCH V4 05/26] agp: nvidia: " Sinan Kaya
2018-01-03 12:44   ` Sinan Kaya
2018-01-29 21:43     ` Dave Airlie
2018-01-29 22:01       ` Sinan Kaya
2018-01-29 22:38       ` Bjorn Helgaas
2018-01-29 22:43         ` Dave Airlie
2017-12-19  5:37 ` [PATCH V4 06/26] edd: " Sinan Kaya
2018-01-03 12:48   ` Sinan Kaya
2017-12-19  5:37 ` [PATCH V4 07/26] ibft: " Sinan Kaya
2017-12-19  5:37 ` [PATCH V4 08/26] drm/gma500: " Sinan Kaya
2018-01-04 12:27   ` Sinan Kaya
2017-12-19  5:37 ` [PATCH V4 09/26] drm/nouveau: " Sinan Kaya
2018-01-04 12:26   ` Sinan Kaya
2017-12-19  5:37 ` [PATCH V4 10/26] Drivers: ide: " Sinan Kaya
2017-12-19 14:13   ` David Miller
2017-12-19  5:37 ` Sinan Kaya [this message]
2018-01-04 12:25   ` [PATCH V4 11/26] iommu/amd: " Sinan Kaya
2018-01-04 16:28     ` Gary R Hook
2018-01-04 16:32       ` Sinan Kaya
2018-01-04 17:25         ` Gary R Hook
2018-01-17 13:02   ` Joerg Roedel
2017-12-19  5:37 ` [PATCH V4 12/26] powerpc/powermac: " Sinan Kaya
2017-12-19  5:37 ` [PATCH V4 13/26] bnx2x: " Sinan Kaya
2017-12-19 14:14   ` David Miller
2017-12-19  5:37 ` [PATCH V4 14/26] pch_gbe: " Sinan Kaya
2017-12-19 10:45   ` Andy Shevchenko
2017-12-19 12:17     ` Sinan Kaya
2017-12-19 13:24       ` Andy Shevchenko
2017-12-19 14:53       ` David Miller
2017-12-19 14:13   ` David Miller
2017-12-19  5:37 ` [PATCH V4 15/26] PCI: cpqhp: " Sinan Kaya
2017-12-19  5:37 ` [PATCH V4 16/26] PCI: ibmphp: " Sinan Kaya
2017-12-19  5:37 ` [PATCH V4 17/26] PCI/quirks: " Sinan Kaya
2017-12-19  5:37 ` [PATCH V4 18/26] PCI/syscall: " Sinan Kaya
2017-12-19  5:37 ` [PATCH V4 19/26] xen: " Sinan Kaya
2017-12-19  5:37 ` [PATCH V4 20/26] openprom: " Sinan Kaya
2017-12-19 14:13   ` David Miller
2017-12-19  5:37 ` [PATCH V4 21/26] backlight: " Sinan Kaya
2017-12-19  8:51   ` Lee Jones
2017-12-19  5:37 ` [PATCH V4 22/26] video: fbdev: intelfb: " Sinan Kaya
2018-01-02 13:38   ` Sinan Kaya
2018-01-03 11:18     ` Bartlomiej Zolnierkiewicz
2017-12-19  5:37 ` [PATCH V4 23/26] video: fbdev: nvidia: " Sinan Kaya
2018-01-02 13:38   ` Sinan Kaya
2018-01-03 11:18     ` Bartlomiej Zolnierkiewicz
2017-12-19  5:38 ` [PATCH V4 24/26] video: fbdev: riva: " Sinan Kaya
2018-01-02 13:37   ` Sinan Kaya
2018-01-03 11:18     ` Bartlomiej Zolnierkiewicz
2017-12-19  5:38 ` [PATCH V4 25/26] i7300_idle: remove unused file Sinan Kaya
2018-01-02 13:36   ` Sinan Kaya
2018-01-02 13:44     ` Greg Kroah-Hartman
2017-12-19  5:38 ` [PATCH V4 26/26] PCI: Remove pci_get_bus_and_slot() function Sinan Kaya
2018-02-16 14:55   ` Bjorn Helgaas
2018-01-11 23:57 ` [PATCH V4 00/26] PCI: deprecate pci_get_bus_and_slot() Bjorn Helgaas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1513661883-28662-12-git-send-email-okaya@codeaurora.org \
    --to=okaya@codeaurora.org \
    --cc=iommu@lists.linux-foundation.org \
    --cc=joro@8bytes.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=timur@codeaurora.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).