From patchwork Fri Feb 26 15:55:58 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joerg Roedel X-Patchwork-Id: 8439131 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id C2B359F2F0 for ; Fri, 26 Feb 2016 15:56:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D655A203B6 for ; Fri, 26 Feb 2016 15:56:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 02ADB203B1 for ; Fri, 26 Feb 2016 15:56:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754633AbcBZP4E (ORCPT ); Fri, 26 Feb 2016 10:56:04 -0500 Received: from 8bytes.org ([81.169.241.247]:40503 "EHLO theia.8bytes.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754585AbcBZP4C (ORCPT ); Fri, 26 Feb 2016 10:56:02 -0500 Received: by theia.8bytes.org (Postfix, from userid 1000) id 9EA1312D3; Fri, 26 Feb 2016 16:55:59 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=8bytes.org; s=mail-1; t=1456502159; bh=6ZXe4RmSwFpN80eSBPmqE21Jf5g4PmclUxS9J/YIGNQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=JRm6Y/nSwIdgLbGcYWBXJGNAdFPpl6xu62BGMbNjM7roh9VQJO6J2CzwgJwl/WJFO 302aHHwW+GYCFOTWJjyrjyQKxaq/n9yrsxVFoDZhsLTbFohaZ/V20jmy33Yw+R2t+I BkJkGNt/wDTeWnkoVY0QBgZv3WN5mtDFUaS1nHHP6jFJhwL3C3ampE/4wkrL/u9RUK KBKo0IXt6j79qRfy4ivBLUI3fmK8zrY0bjuNi9RLvdhHa5ivPfvq0tUGpMKtAuS/bZ lYIINv3UUTXzykBF5SBNZzmZwqn0y8CzNjwbhAY1TowMBVyIp6JOtMrpSuvX+qjxvx as/ae4qYaxsKA== Date: Fri, 26 Feb 2016 16:55:58 +0100 From: Joerg Roedel To: "Zytaruk, Kelly" Cc: Bjorn Helgaas , "linux-pci@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "bhelgaas@google.com" , "Marsan, Luugi" , Alex Williamson Subject: Re: BUGZILLA [112941] - Cannot reenable SRIOV after disabling SRIOV on AMD GPU Message-ID: <20160226155558.GA32730@8bytes.org> References: <20160223170215.GA25203@localhost> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hi Kelly, On Wed, Feb 24, 2016 at 06:29:56PM +0000, Zytaruk, Kelly wrote: > I don't know if the asynchronous nature of the iommu attach/detach is > by design or if it is broken somewhere up the tree and just not > working in my case. Maybe one of the iommu owners could answer this. Thanks a lot for your bug report and the detailed analysis of the issue. I attached a possible fix for you to try out. Can you please test it and report whether it changes anything? Thanks, Joerg From 027b6489833aef8ce5ec46cef3e0f9e6a61dbdcd Mon Sep 17 00:00:00 2001 From: Joerg Roedel Date: Fri, 26 Feb 2016 16:48:59 +0100 Subject: [PATCH] iommu/amd: Detach device from domain before removal Detach the device that is about to be removed from its domain (if it has one) to clear any related state like DTE entry and device's ATS state. Signed-off-by: Joerg Roedel --- drivers/iommu/amd_iommu.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c index 539b0de..60cc89f 100644 --- a/drivers/iommu/amd_iommu.c +++ b/drivers/iommu/amd_iommu.c @@ -114,6 +114,7 @@ struct kmem_cache *amd_iommu_irq_cache; static void update_domain(struct protection_domain *domain); static int protection_domain_init(struct protection_domain *domain); +static void detach_device(struct device *dev); /* * For dynamic growth the aperture size is split into ranges of 128MB of @@ -384,6 +385,9 @@ static void iommu_uninit_device(struct device *dev) if (!dev_data) return; + if (dev_data->domain) + detach_device(dev); + iommu_device_unlink(amd_iommu_rlookup_table[dev_data->devid]->iommu_dev, dev);