Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp861370ybl; Wed, 11 Dec 2019 08:36:44 -0800 (PST) X-Google-Smtp-Source: APXvYqyNhh51f/WxU4uiWqTRgrz3q6UbcbxXgEMNvyg8vONotSxbRg+UDI2w+2/v3XB9YjMcGI+o X-Received: by 2002:a9d:eea:: with SMTP id 97mr2722586otj.177.1576082204500; Wed, 11 Dec 2019 08:36:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576082204; cv=none; d=google.com; s=arc-20160816; b=Eim7xNbSYCuFm0Dy7SWoqAdg9Gblpqnp9qlCS6vdqK+Rb0B3WC8lIw/6hrD7c0hB2/ R6KSXERfsAKReAIV2PhoMVJhT1w6xKPWxT5RcHRT2lONVBamZRr76q/mZYZ4eH1RO9ke BpuPvAr8OgCy//8iW00v7nsAlripA7a6nfG1HZHE+97FiXxFzy7f75uTvytxQYtWU93Y Lya96y76WjnZfW2o13m2lVIWYx2WhOhb3yJT+57aRpGRQ03hA5yNTcFBVLNRr6dOz55R aSCIFGX2PbRlmtLqds6Dwd4tAB3O4LRdaY13fEY0u8gMH1XCoScs+MckOctzeELf1pzY NTwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:mail-followup-to:reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=G2ZB3omzRfSfFMjDrR0LBqamRCs0vWgnzAtR96DPAFU=; b=dL3CAgsm3sB5L873ziDcq1EOdwoH0jvh6TRwk600vaN7MUAAQ1VAcUQN/I8upfXcAN pfedtVleV6ZLKzO7p2gsL8nD5j8wpsf1s83/IG374k7gH+tTefkXejMhKd0E58hrMU+M Czp5chCx4t0fFtaqGpSB4RPNj6p/8eV9+0dmLd7kv87K1nvw8EeRzJEudc9jJW/OGxBZ 3V3a2lHSoRJBPNB12xnU0GQUzviB9vVbCIj/5lpx/WtTyDAB0PCZbuW19BKkAyHYj8Pa KWAuy848K5G8MvB5zv3TC6zClcqyjI/nwonUZtxQBQoLcs1eB7pJgzELdgywi/PEBv1T Gx/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=TBZmtIH8; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n11si1351046otq.112.2019.12.11.08.36.31; Wed, 11 Dec 2019 08:36:44 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=TBZmtIH8; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730158AbfLKQfj (ORCPT + 99 others); Wed, 11 Dec 2019 11:35:39 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:39376 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729260AbfLKQfi (ORCPT ); Wed, 11 Dec 2019 11:35:38 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576082137; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references; bh=G2ZB3omzRfSfFMjDrR0LBqamRCs0vWgnzAtR96DPAFU=; b=TBZmtIH8PN8dWdMGlZxjiDmI9JZx/31WBjsVncYt2fLHWhEEOCaPzzEfsnDqKubXVrCWBn wOWmrhwOmN1FDQZLsXpAa55dm9KHfRHQReVOQwoq/UtAQLIjycdCiHHW5gOBr6I7CYCbO5 djJIYcQzl86cmCB/h/ZFHMj2lft6Fjw= Received: from mail-yw1-f70.google.com (mail-yw1-f70.google.com [209.85.161.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-216--ERRxf7MPzWx5EH9xbsn6w-1; Wed, 11 Dec 2019 11:35:35 -0500 X-MC-Unique: -ERRxf7MPzWx5EH9xbsn6w-1 Received: by mail-yw1-f70.google.com with SMTP id 199so17738719ywe.20 for ; Wed, 11 Dec 2019 08:35:35 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:reply-to :mail-followup-to:references:mime-version:content-disposition :in-reply-to; bh=G2ZB3omzRfSfFMjDrR0LBqamRCs0vWgnzAtR96DPAFU=; b=oz4spAwVmkpaTDpdVtlz9Q9tWejB/S3IVC7gGGyymPyqUE3GnEaRCMJ2P75ghPEa/T dbZ6Yb1cDli7gPjxfDQ0WTAdnKaa4FUny0o4WRGbzsOoSDvxPhAyTX4c0G3/LhWHRzqX L7dHwwHYQCgNZF6w+gSVI7RzpQfhhfjOhT4fknX7/aIaMQODhBirten07LG9UAG9B3eR 47RK7Pi77/QT0qI7tbbHQbVCav7hua3D6SRxjxu+5/FyL1EyizxN0cclSsPj+6CyG4IA YXvUqICBXVhkiQhrEdaKLN/JmDcE6l4/cCc9SV4v+cXQp1HGhzlC6WxavbYtpzFKzM6s JmUw== X-Gm-Message-State: APjAAAWRbdQXtC3Kd2t/27/afKy9bzONaD+cSnyD/X7rbVsr4ULftR2z d+fP0EigWnZHV1a0iVtBJjww06bRxkKVKqMWG36zrLtggQV6nR+Hm5JOVnQ4TnlQT9y5+iZmiOs 7xdxvYCGjDQ2cMWY8q/qSSRHT X-Received: by 2002:a81:de03:: with SMTP id k3mr496981ywj.504.1576082135406; Wed, 11 Dec 2019 08:35:35 -0800 (PST) X-Received: by 2002:a81:de03:: with SMTP id k3mr496966ywj.504.1576082135136; Wed, 11 Dec 2019 08:35:35 -0800 (PST) Received: from localhost (ip70-163-223-149.ph.ph.cox.net. [70.163.223.149]) by smtp.gmail.com with ESMTPSA id l74sm1168529ywc.45.2019.12.11.08.35.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Dec 2019 08:35:34 -0800 (PST) Date: Wed, 11 Dec 2019 09:35:11 -0700 From: Jerry Snitselaar To: Lu Baolu Cc: Joerg Roedel , David Woodhouse , ashok.raj@intel.com, jacob.jun.pan@intel.com, kevin.tian@intel.com, iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH 1/1] iommu/vt-d: Fix dmar pte read access not set error Message-ID: <20191211163511.gjju2s3yy4sus44w@cantor> Reply-To: Jerry Snitselaar Mail-Followup-To: Lu Baolu , Joerg Roedel , David Woodhouse , ashok.raj@intel.com, jacob.jun.pan@intel.com, kevin.tian@intel.com, iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org References: <20191211014015.7898-1-baolu.lu@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Disposition: inline In-Reply-To: <20191211014015.7898-1-baolu.lu@linux.intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed Dec 11 19, Lu Baolu wrote: >If the default DMA domain of a group doesn't fit a device, it >will still sit in the group but use a private identity domain. >When map/unmap/iova_to_phys come through iommu API, the driver >should still serve them, otherwise, other devices in the same >group will be impacted. Since identity domain has been mapped >with the whole available memory space and RMRRs, we don't need >to worry about the impact on it. > Does this pose any potential issues with the reverse case where the group has a default identity domain, and the first device fits that, but a later device in the group needs dma and gets a private dma domain? >Link: https://www.spinics.net/lists/iommu/msg40416.html >Cc: Jerry Snitselaar >Reported-by: Jerry Snitselaar >Fixes: 942067f1b6b97 ("iommu/vt-d: Identify default domains replaced with private") >Cc: stable@vger.kernel.org # v5.3+ >Signed-off-by: Lu Baolu >--- > drivers/iommu/intel-iommu.c | 8 -------- > 1 file changed, 8 deletions(-) > >diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c >index 0c8d81f56a30..b73bebea9148 100644 >--- a/drivers/iommu/intel-iommu.c >+++ b/drivers/iommu/intel-iommu.c >@@ -5478,9 +5478,6 @@ static int intel_iommu_map(struct iommu_domain *domain, > int prot = 0; > int ret; > >- if (dmar_domain->flags & DOMAIN_FLAG_LOSE_CHILDREN) >- return -EINVAL; >- > if (iommu_prot & IOMMU_READ) > prot |= DMA_PTE_READ; > if (iommu_prot & IOMMU_WRITE) >@@ -5523,8 +5520,6 @@ static size_t intel_iommu_unmap(struct iommu_domain *domain, > /* Cope with horrid API which requires us to unmap more than the > size argument if it happens to be a large-page mapping. */ > BUG_ON(!pfn_to_dma_pte(dmar_domain, iova >> VTD_PAGE_SHIFT, &level)); >- if (dmar_domain->flags & DOMAIN_FLAG_LOSE_CHILDREN) >- return 0; > > if (size < VTD_PAGE_SIZE << level_to_offset_bits(level)) > size = VTD_PAGE_SIZE << level_to_offset_bits(level); >@@ -5556,9 +5551,6 @@ static phys_addr_t intel_iommu_iova_to_phys(struct iommu_domain *domain, > int level = 0; > u64 phys = 0; > >- if (dmar_domain->flags & DOMAIN_FLAG_LOSE_CHILDREN) >- return 0; >- > pte = pfn_to_dma_pte(dmar_domain, iova >> VTD_PAGE_SHIFT, &level); > if (pte) > phys = dma_pte_addr(pte); >-- >2.17.1 >