Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp663334pxj; Tue, 18 May 2021 11:17:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwqVSLj3JsAml5jEVEw5J+DnmcWsEf1ZrijXHDMo733hETYUBT1yxZW4BN6Arj7w0lPGr2i X-Received: by 2002:a17:907:10c7:: with SMTP id rv7mr7306451ejb.125.1621361869519; Tue, 18 May 2021 11:17:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621361869; cv=none; d=google.com; s=arc-20160816; b=rbumq9RQBRrvJH/RxzGcka+n5+yua1wSmdAKqIlKZzKo3Od+c80Ipmj0x6ow4gFg3B yJqBXGKtCxtZLF8ubdpEx2yfkMJOYfF/Sru1NSfva3q2w10dJIn3nvqXpaWk16AGeZgv 9WqblEFDo8Y2PKykz3p9ff8P+j9bstCrjHDpQ1V0To8QP0MgjI4TsQmzi5XSELafzBMn nmPILJZuB7rExaq1zg/qqXDdeDK+Bt0WfuWs/aHlyBgUnarALBG3HFh3wXjsqhypoA78 Cnf7bLgbU/OUCgVG6Id0dDXHzypUHvE9wBACkIBZ0ZOl2LaeXPpzR8xeUgxBdqG2xyAO 4mHA== 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=CBmeihjLe2eJNYXUvtNTWC9ZGbK9s0YlBJRp8jxHxNY=; b=0o2KURIC9l++Xq0JzEb9IDtgvCaz7/XDAeVsWQVRzhIsWuNggc2Tx334dZnr6fI8LD N9TukHoa3iTwUhjkDz2Sr3AzqbEemPysdBCQr8UFXo/0Zcd8MgguCQJTZkDS8smI9u0y KUGWZGPX1wIlQlghRaSyi5J/125kkM6lRtzCKLWzVmVuP38dBn+J7JNuTFXHvU/dP7Af U1Jh1CjNHoG2o0EDocAFbuh9efAyGii4eBz3ZdUmHKjWVmLaU6coV5JDadwOMOfsUuPk YsFGop8gVYq/49t4gdLbVYwMTn4t0PhEqykdvFTlvFc5zX3L1pmFs5vew1eQ1RnBdVRm G+NA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="b/0ZNka8"; 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 m9si11657662eds.410.2021.05.18.11.17.25; Tue, 18 May 2021 11:17:49 -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="b/0ZNka8"; 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 S1345639AbhEQQNp (ORCPT + 99 others); Mon, 17 May 2021 12:13:45 -0400 Received: from mail.kernel.org ([198.145.29.99]:44904 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344018AbhEQPtq (ORCPT ); Mon, 17 May 2021 11:49:46 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id DACFB6143C; Mon, 17 May 2021 14:45:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621262728; bh=JaP8JF+iAXaoiUiigp6hkLEMLv2p2rM5QI0GfBWiHJM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=b/0ZNka8zfFg1HRtaH3Fm7N4rKWRFBsd8JAXFcB7nVMX686lorQPpSF4jp4wMcTqb meYiCZUtWnnFk8DKMgi6UucTi3Xb9qbTH724u4V3c9NzjHX349n7hgLbwa2olR/m1m 0Gr8ag8IYfTc7hZCM4VQ4sEyg7A9W84AOzL1mKGI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ashok Raj , Lu Baolu , Joerg Roedel Subject: [PATCH 5.10 264/289] iommu/vt-d: Remove WO permissions on second-level paging entries Date: Mon, 17 May 2021 16:03:09 +0200 Message-Id: <20210517140314.031244314@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517140305.140529752@linuxfoundation.org> References: <20210517140305.140529752@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 commit eea53c5816889ee8b64544fa2e9311a81184ff9c upstream. 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: Greg Kroah-Hartman --- drivers/iommu/intel/iommu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/iommu/intel/iommu.c +++ b/drivers/iommu/intel/iommu.c @@ -2362,8 +2362,9 @@ static int __domain_mapping(struct dmar_ 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;