Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp278479ybl; Wed, 11 Dec 2019 18:14:26 -0800 (PST) X-Google-Smtp-Source: APXvYqydZt5KUNdJK1n8N5F2aDMU+Mx9YocNCNImExj3FitLXoW081tvtmLcSAyHz+ZyFSRNJm+T X-Received: by 2002:a9d:684e:: with SMTP id c14mr5386596oto.340.1576116866176; Wed, 11 Dec 2019 18:14:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576116866; cv=none; d=google.com; s=arc-20160816; b=gMrx96ncDwB+atpBGo7k4aeawVgRty2Mt24G7sWSOA5ONPpsORIw2A588TX1snpOpC kDKevo8vJXfmMU+5RmdnNYh37LC0YVSMlhGY+6LBZ5aIfJSd5tDsTu53pJiiEqG79ULR cMX52588hh+aU03TTY+2UdPVm1sg3RElXGlKVx3Goch6/Ftr+GxxDLHhY10vB3vI/xoc f/Sny7U8TSubZkMnw0lHmML6cCwVJYUoX9sTAQL/xdLAeQwzOV+eRI07FmhGQCQ5Yetv 4s920MVJt6FFoXASVSy/vmwHKOg8hvCKpK746cFJMd6kIOytjbtJEpxZkAuF7F610tJl iO2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:to:subject:cc; bh=K69eHUD4fwoqXdNwypPM6FbPZTLWu0Djjqqr1v67ijw=; b=g+v1Y+rz7gYRIKW2eUVBaL+cTj3s9kYkbfcCrXv6inFOP1Z7bZwIaB2Gs2q9QlcwbO toKvZiyT5UNM4vVYJtBcIqYlAYrFxnYMycAhqIROeJ91Rao59xQpRJoflCErabeTnbwi LjfpVcybfBeibekJHUuhO0ODdDONCrqtR8qSY4pMFvkQv4xD6RosaTCoSdW/QhI2shEn MnrbN1RshqX4LBxTchuwjWoUhZ3pRaD8TzMcF+hJUt3p1xkV68qPE4OFZVyMOyibP45Y RWQlV8Q9Vz9PvYA5OXpv3L1nTahaAV8Zp9JtcrhNmGS1fmvUE2S+WdICyWcy8nwoZHV1 KnTg== 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 f4si2227781oib.104.2019.12.11.18.14.14; Wed, 11 Dec 2019 18:14:26 -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 S1727704AbfLLCNl (ORCPT + 99 others); Wed, 11 Dec 2019 21:13:41 -0500 Received: from mga04.intel.com ([192.55.52.120]:35819 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726793AbfLLCNl (ORCPT ); Wed, 11 Dec 2019 21:13:41 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Dec 2019 18:13:40 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,303,1571727600"; d="scan'208";a="225748499" Received: from allen-box.sh.intel.com (HELO [10.239.159.136]) ([10.239.159.136]) by orsmga002.jf.intel.com with ESMTP; 11 Dec 2019 18:13:38 -0800 Cc: baolu.lu@linux.intel.com Subject: Re: [PATCH 1/1] iommu/vt-d: Fix dmar pte read access not set error To: 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> <20191212014952.vlrmxrk2cebwxjnp@cantor> From: Lu Baolu Message-ID: <6f3bcad9-b9b3-b349-fdad-ce53a79a665b@linux.intel.com> Date: Thu, 12 Dec 2019 10:12:53 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.1 MIME-Version: 1.0 In-Reply-To: <20191212014952.vlrmxrk2cebwxjnp@cantor> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On 12/12/19 9:49 AM, Jerry Snitselaar wrote: > 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. >> >> 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 > > Reviewed-by: Jerry Snitselaar Can you please try this fix and check whether it can fix your problem? If it helps, do you mind adding a Tested-by? Best regards, 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 >> >