From patchwork Thu Sep 5 04:22:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shawn Anastasio X-Patchwork-Id: 1158200 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46P72j1cGjz9s4Y for ; Thu, 5 Sep 2019 14:27:41 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=fail (p=quarantine dis=none) header.from=anastas.io Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=anastas.io header.i=@anastas.io header.b="jWXbsz+q"; dkim-atps=neutral Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 46P72j0lp5zDqxb for ; Thu, 5 Sep 2019 14:27:41 +1000 (AEST) X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=anastas.io (client-ip=104.248.188.109; helo=alpha.anastas.io; envelope-from=shawn@anastas.io; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=quarantine dis=none) header.from=anastas.io Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=anastas.io header.i=@anastas.io header.b="jWXbsz+q"; dkim-atps=neutral Received: from alpha.anastas.io (alpha.anastas.io [104.248.188.109]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 46P6xX2ZrvzDr1g for ; Thu, 5 Sep 2019 14:23:12 +1000 (AEST) Received: from authenticated-user (alpha.anastas.io [104.248.188.109]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by alpha.anastas.io (Postfix) with ESMTPSA id 7047184B9D; Wed, 4 Sep 2019 23:22:38 -0500 (CDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=anastas.io; s=mail; t=1567657359; bh=EmICgee2nNUFVTp9r6uhX6GMoMfnTqEaFNlse3ssPuc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jWXbsz+qQlJDwPgeEAudXQxT2TUqfzpY3dno5FjhVl+ySQe2k4YPNyAJiizFaGOW8 30eusimYMGDWVV7N5VurXjBJTEyl9yrF8DKNx07OkJqUG2CdXRF3XRiveqkvL/Agu/ R6S4+HhElHqIKVI/so6TWwk0f1gVazk4YZXazlJ55PF1irrgDOBWGOUXfsQIvvVwHJ 7j3xsXfcQuaVRbQMPLQRFFCKtF3+qi+oI/7z5Fdxia2KRbzsq1y0cm4CcmwenSb1pV 4P4WG4fVojFNGuUYaAN1N+DR6BxczBQEEjiY2rmffJyPKAxGrybqVtkVYodtVYRY/i SAbsgciFBr2aA== From: Shawn Anastasio To: linux-pci@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Subject: [PATCH 2/2] powerpc/pci: Fix IOMMU setup for hotplugged devices on pseries Date: Wed, 4 Sep 2019 23:22:15 -0500 Message-Id: <20190905042215.3974-3-shawn@anastas.io> In-Reply-To: <20190905042215.3974-1-shawn@anastas.io> References: <20190905042215.3974-1-shawn@anastas.io> MIME-Version: 1.0 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: sbobroff@linux.ibm.com, aik@ozlabs.ru, oohall@gmail.com, bhelgaas@google.com Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" Move PCI device setup from pcibios_add_device() to pcibios_fixup_dev(). This ensures that platform-specific DMA and IOMMU setup occurs after the device has been registered in sysfs, which is a requirement for IOMMU group assignment to work. This fixes IOMMU group assignment for hotplugged devices on pseries, where the existing behavior results in IOMMU assignment before registration. Signed-off-by: Shawn Anastasio --- arch/powerpc/kernel/pci-common.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c index f627e15bb43c..21b4761bb0ed 100644 --- a/arch/powerpc/kernel/pci-common.c +++ b/arch/powerpc/kernel/pci-common.c @@ -987,15 +987,14 @@ static void pcibios_setup_device(struct pci_dev *dev) ppc_md.pci_irq_fixup(dev); } -int pcibios_add_device(struct pci_dev *dev) +void pcibios_fixup_dev(struct pci_dev *dev) { - /* - * We can only call pcibios_setup_device() after bus setup is complete, - * since some of the platform specific DMA setup code depends on it. - */ - if (dev->bus->is_added) - pcibios_setup_device(dev); + /* Device is registered in sysfs and ready to be set up */ + pcibios_setup_device(dev); +} +int pcibios_add_device(struct pci_dev *dev) +{ #ifdef CONFIG_PCI_IOV if (ppc_md.pcibios_fixup_sriov) ppc_md.pcibios_fixup_sriov(dev);