Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp63986ybl; Tue, 10 Dec 2019 17:41:58 -0800 (PST) X-Google-Smtp-Source: APXvYqzEcMX+ZoQcvN+t0ldmqn4Ptk+sLFKp2x72clVYH+NGZSY4EB063M1AfW6bOdWShHTn3DEP X-Received: by 2002:aca:55cc:: with SMTP id j195mr946778oib.22.1576028518746; Tue, 10 Dec 2019 17:41:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576028518; cv=none; d=google.com; s=arc-20160816; b=Y10OuU47haGGgUDF6v2mr7IH9oFB4+z468Law/IuRAdM3xP1bOzG8hfbCLLjyQfGHe u/6G0nMqVPJ9aht6QSpGqDVYE+G2aMOg5SQvMHrTcx2hqoujCalr5zeI0D019OPcdoR4 cX19IbwDDPVqZLFXRHcL/XuImEcRY3JuCp/ioJhKZGsd/rYUwiyrQbLGa1/Np+uII70f hxl+UC0dE8biKRg9+72yZfaa9gdbM5r8SXmCFUhMehpmxxhR5DjTvez5o4F8GC9xDsAh w1rjQGQaOcO23u1kI608hF+VB7Da4FH6uaWYam/I825op03ka2CfDOpoJ9z9O3UpENfr Ej5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=8Jvllcc4UOu1/xlYPGV4rj1FvRvZWNaQ6Ljzv+vq2yw=; b=aJgw5jUXbTCPj1w9GSRHOvlsfK3SR579nZ/27zifjyMENjnRkrDiYKbUCzL1YadJOB MsTTIs14GOOhBPk4uDYLOvNfA4/Or+xv7wX1b0sYff8+LHiEoD4wPTw3jY6M8pCe06di GHByiS/zyXL8Ge0adv2ljPqQvyY+N2gZjwlwE97h/4G9m25YzfSZoDsG7JMz4ygoV4vg lOK3NEyD3vHi1nDNIzGp52mS0CoHIlgrSWRlpR06nAO3eizei6i42gVM81XdWinEZgRE GLRd1mKPaIHat+vxVaaF2aH9hnRcgzDLsxR9CbCYnRy5pDBQ1FI0wxbbd7HbLr3sL5KY L74g== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x9si129240otk.170.2019.12.10.17.41.47; Tue, 10 Dec 2019 17:41:58 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727352AbfLKBlQ (ORCPT + 99 others); Tue, 10 Dec 2019 20:41:16 -0500 Received: from mga05.intel.com ([192.55.52.43]:31308 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726417AbfLKBlQ (ORCPT ); Tue, 10 Dec 2019 20:41:16 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Dec 2019 17:41:15 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,301,1571727600"; d="scan'208";a="238371606" Received: from allen-box.sh.intel.com ([10.239.159.136]) by fmsmga004.fm.intel.com with ESMTP; 10 Dec 2019 17:41:14 -0800 From: Lu Baolu To: Joerg Roedel , David Woodhouse Cc: ashok.raj@intel.com, jacob.jun.pan@intel.com, kevin.tian@intel.com, iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, Lu Baolu , Jerry Snitselaar , stable@vger.kernel.org Subject: [PATCH 1/1] iommu/vt-d: Fix dmar pte read access not set error Date: Wed, 11 Dec 2019 09:40:15 +0800 Message-Id: <20191211014015.7898-1-baolu.lu@linux.intel.com> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. 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