Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752896AbdHDNNl (ORCPT ); Fri, 4 Aug 2017 09:13:41 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56144 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752151AbdHDNNY (ORCPT ); Fri, 4 Aug 2017 09:13:24 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 484666146B Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=bhe@redhat.com Date: Fri, 4 Aug 2017 21:13:20 +0800 From: Baoquan He To: Joerg Roedel Cc: iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v9 12/13] iommu/amd: Clear out the GV flag when handle deferred domain attach Message-ID: <20170804131320.GO1874@x1> References: <1501587449-9817-1-git-send-email-bhe@redhat.com> <1501587449-9817-13-git-send-email-bhe@redhat.com> <20170804123041.GX3431@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170804123041.GX3431@suse.de> User-Agent: Mutt/1.7.0 (2016-08-17) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Fri, 04 Aug 2017 13:13:24 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1276 Lines: 32 On 08/04/17 at 02:30pm, Joerg Roedel wrote: > On Tue, Aug 01, 2017 at 07:37:28PM +0800, Baoquan He wrote: > > @@ -2466,11 +2472,21 @@ static struct protection_domain *get_domain(struct device *dev) > > return ERR_PTR(-EINVAL); > > > > domain = get_dev_data(dev)->domain; > > - if (domain == NULL && get_dev_data(dev)->defer_attach) { > > + if (domain == NULL && dev_data->defer_attach) { > > + u16 alias = amd_iommu_alias_table[dev_data->devid]; > > get_dev_data(dev)->defer_attach = false; > > io_domain = iommu_get_domain_for_dev(dev); > > domain = to_pdomain(io_domain); > > attach_device(dev, domain); > > + /* > > + * If the deferred attached domain is not v2, should clear out > > + * the old GV flag. > > + */ > > + if (!(domain->flags & PD_IOMMUV2_MASK)) { > > + clear_dte_flag_gv(dev_data->devid); > > + if (alias != dev_data->devid) > > + clear_dte_flag_gv(dev_data->devid); > > Hmm, thinking more about it, I am not sure what the IOMMU responds to > PRI/PASID prefixes if the GV flag is 0. > > But until we know it causes problems we should just disable the bit > while doing the copy in the previous patch and avoid any special > handling like done here. So just drop this patch, right? Will do if I got it right. Thanks. >