Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4623991pxj; Wed, 12 May 2021 09:28:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxhhxGL5WhIzMAYOXwIv05d3Q2Nj7BTGgJW5cNfAVaaJBUAfX/0PP2vLUz1vrAU0hDepc/Y X-Received: by 2002:a05:6402:4383:: with SMTP id o3mr44371977edc.333.1620836909284; Wed, 12 May 2021 09:28:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620836909; cv=none; d=google.com; s=arc-20160816; b=vKA9RRweVkybCdnmH7qcdAQsynxnP+3UXmFQEAyb+z3NhBNz7h8Ji3ceZCbZB5Og6d lfgQ+y4VvpnpHvXEntmNuAUZwo5Nqyu4evstNLdh4C5i66VlmZG0jKn1jPv8oq9xJGAr O/1Hl31YDPDjcZP83iOtPw8QcFzDGHqIPahKJSziwCVr5kNTcM1Xmq7IJ14J6bQ9qd7y qaM3Ex38uQeyfDkPc8qBzQMDKbUhstVOYjvzTlIFzzWMgHrslU/NCZMY6cqZuJq8m1nS fO7C1TcHape4FC54bBmRndUlGeHBJrcjz44NAPsw9qrAD1GDSIXdd5dPajU7s4tdPsRQ XcEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=aONHhUR3IMzyLO3F5TSPROzM+bXarM5JP5gTr/7X4w8=; b=tLd/WJ2BfQnE60Ci8ET7u+tUCf+LVIlEOKbnMv+dfJFSlqApoUynrespssSvW9n+YK fP7euVrknPMXhOOs9Wzj3BjSpO5Ci5O3e5/3YLjZcvp2lE13ytHv+qOFAfjpwkn4FcJi /2M/lFVjE6cGnjJr8Bc6S81sx4VakT/mAQIKYHoh8aJEpr0aD9eGYmCTZ2B8oxodjroP baDX8JFAbygUZrqQtb5ALSHWkHYBK+Xy9x2ZU2fkRHBrHpU14fHCaHWcOFMVNZ97jjV0 8tGmwLSQPyeEQWI0oG4/d+CHVLK2o90jQCerWvu3bjtPa9giK9NEZGdV6aXSqHF3/Xff BGvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="H/z9d6si"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a6si397237ejg.52.2021.05.12.09.28.04; Wed, 12 May 2021 09:28:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="H/z9d6si"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240916AbhELQZy (ORCPT + 99 others); Wed, 12 May 2021 12:25:54 -0400 Received: from mail.kernel.org ([198.145.29.99]:56820 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236163AbhELPhL (ORCPT ); Wed, 12 May 2021 11:37:11 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id AF3CA6195F; Wed, 12 May 2021 15:18:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620832715; bh=sVeNyo0mnWj+SHhKZzcxA11k+TOWY+vV1e+2HZ+AcqI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=H/z9d6si4zooR5lKxoya8hCjRmiMrV+h+3qjohEwjDFaPP0Hog9LI2P4aXNrVU0zL u01dEHfs8ek+ax7SxHU0WWjjRdbM6BAGKSGdUVcrcEovWMhPLjSyVCFd2iPiG2a/Xd sLgiAnrxxch9rK1AH4noKluumFhU00nQ6waiAjS4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ashok Raj , Lu Baolu , Joerg Roedel , Sasha Levin Subject: [PATCH 5.10 393/530] iommu/vt-d: Remove WO permissions on second-level paging entries Date: Wed, 12 May 2021 16:48:23 +0200 Message-Id: <20210512144832.691698283@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210512144819.664462530@linuxfoundation.org> References: <20210512144819.664462530@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Lu Baolu [ Upstream commit eea53c5816889ee8b64544fa2e9311a81184ff9c ] When the first level page table is used for IOVA translation, it only supports Read-Only and Read-Write permissions. The Write-Only permission is not supported as the PRESENT bit (implying Read permission) should always set. When using second level, we still give separate permissions that allows WriteOnly which seems inconsistent and awkward. We want to have consistent behavior. After moving to 1st level, we don't want things to work sometimes, and break if we use 2nd level for the same mappings. Hence remove this configuration. Suggested-by: Ashok Raj Fixes: b802d070a52a1 ("iommu/vt-d: Use iova over first level") Signed-off-by: Lu Baolu Link: https://lore.kernel.org/r/20210320025415.641201-3-baolu.lu@linux.intel.com Signed-off-by: Joerg Roedel Signed-off-by: Sasha Levin --- drivers/iommu/intel/iommu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c index 8010c3895f8c..30c2b52f7ea2 100644 --- a/drivers/iommu/intel/iommu.c +++ b/drivers/iommu/intel/iommu.c @@ -2357,8 +2357,9 @@ static int __domain_mapping(struct dmar_domain *domain, unsigned long iov_pfn, return -EINVAL; attr = prot & (DMA_PTE_READ | DMA_PTE_WRITE | DMA_PTE_SNP); + attr |= DMA_FL_PTE_PRESENT; if (domain_use_first_level(domain)) { - attr |= DMA_FL_PTE_PRESENT | DMA_FL_PTE_XD | DMA_FL_PTE_US; + attr |= DMA_FL_PTE_XD | DMA_FL_PTE_US; if (domain->domain.type == IOMMU_DOMAIN_DMA) { attr |= DMA_FL_PTE_ACCESS; -- 2.30.2