Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp673998pxj; Tue, 18 May 2021 11:32:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzrb7u8CBpM2O2U+nWTeth/jVt/nzvq2ukg+EA621hYuSBaqkz/vesJL9ZxyNj+ybHM/rV4 X-Received: by 2002:a50:ff13:: with SMTP id a19mr8588621edu.300.1621362732105; Tue, 18 May 2021 11:32:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621362732; cv=none; d=google.com; s=arc-20160816; b=oiHzGyPZl4gSo3QfXpYAlkLALnPk4/wawfcfQx1xOUogXKlX7vWvz1nlP0rjmrb/PE 82lS0qLaIv0dG7QyfANQLWg346BvGsOew+D66+GuTUxGv/St1lTdvS/cDBo5ojcbj8HM ChFNqtOctedWmvJhQN+GK1NWXyjuWd11QNn+n7MlhB9EU/a4mXtvqW7FTcGIJwHbVt+Q 9CPpWjpCCP3I+6nrH2f7bh1FdCvC1V+anX3piBxhCpwi3v7XG8k85excZrukAg6D4bSJ hpLQPQtKG21uxudWzQj5LlX+VaQWZvh7BaLqlvbVacbWM/v4uPiASNXTRRT7jSkMdPrW Q0Xg== 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=IVt5WId/kfCdWmPwYt/nx+no4ezppCZhyB8MZuhGWbg=; b=lG4RdlMlmDNF/P74gu6PBX0sBA2M09CAZUswNQjwIIvX6CHmRuy1p1vVE3283vS6Dr g3xSrQFHrUQSKoajkZJMsAN97EmxgnOc9EqtASSOf71c8VtwCaunydWs7QMzvZaztiXL b2xau7308eAfuRdC3R0xjzNLq0y3jvrCHX7fRCVILd0s46wR6cqWavojwbrT3KLKRADg 0JhS2huEUHBb3P9dItEt75hdG+J/HrP+MJwt/pABvcl2M7SBrgiz4D2GUncEcofl2dWO ZjWuNUU4MamNyW992+UsLW31M7DiOl+YO0yKZn9ce48EJK3JnQZtN9NPN23bGPnJfvsO V5rQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=B2PLnBpA; 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 v1si332163ejd.643.2021.05.18.11.31.48; Tue, 18 May 2021 11:32:12 -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=B2PLnBpA; 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 S1347224AbhEQQPY (ORCPT + 99 others); Mon, 17 May 2021 12:15:24 -0400 Received: from mail.kernel.org ([198.145.29.99]:46470 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241559AbhEQPuy (ORCPT ); Mon, 17 May 2021 11:50:54 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id AA73361442; Mon, 17 May 2021 14:46:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621262763; bh=VM1rfCZqGRioSwtoMBQhxfkw1LM++KGXzZ0aJsaCq9E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=B2PLnBpA3MeMIzYuB08PTti1eWpSMh3kjPJ2Am+8G/59I5PGmc0AG0H/HNzFmAddE dSFYT50NgoWi7Rh2wsY03YVHCG0MVveaEfV9w3L5uhIzF/6h6jsbneprr+kEhC+5Ht eVhdj5eidBcuPrApzTuETXRaR7+J+B4EX1Ff3B58= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Wolfgang=20M=C3=BCller?= , Charles Wright , Christoph Biedl , Ashok Raj , Lu Baolu , Joerg Roedel , Sasha Levin Subject: [PATCH 5.10 262/289] Revert "iommu/vt-d: Preset Access/Dirty bits for IOVA over FL" Date: Mon, 17 May 2021 16:03:07 +0200 Message-Id: <20210517140313.969017886@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 This reverts commit 416fa531c8160151090206a51b829b9218b804d9 which is commit a8ce9ebbecdfda3322bbcece6b3b25888217f8e3 upstream as it was backported incorrectly and is causing problems for some systems. Reported-by: Wolfgang Müller Reported-by: Charles Wright Reported-by: Christoph Biedl Cc: Ashok Raj Cc: Lu Baolu Cc: Joerg Roedel Cc: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/iommu/intel/iommu.c | 17 +++++------------ include/linux/intel-iommu.h | 2 -- 2 files changed, 5 insertions(+), 14 deletions(-) --- a/drivers/iommu/intel/iommu.c +++ b/drivers/iommu/intel/iommu.c @@ -1028,11 +1028,8 @@ static struct dma_pte *pfn_to_dma_pte(st domain_flush_cache(domain, tmp_page, VTD_PAGE_SIZE); pteval = ((uint64_t)virt_to_dma_pfn(tmp_page) << VTD_PAGE_SHIFT) | DMA_PTE_READ | DMA_PTE_WRITE; - if (domain_use_first_level(domain)) { + if (domain_use_first_level(domain)) pteval |= DMA_FL_PTE_XD | DMA_FL_PTE_US; - if (domain->domain.type == IOMMU_DOMAIN_DMA) - pteval |= DMA_FL_PTE_ACCESS; - } if (cmpxchg64(&pte->val, 0ULL, pteval)) /* Someone else set it while we were thinking; use theirs. */ free_pgtable_page(tmp_page); @@ -2362,18 +2359,14 @@ static int __domain_mapping(struct dmar_ return -EINVAL; attr = prot & (DMA_PTE_READ | DMA_PTE_WRITE | DMA_PTE_SNP); - if (domain_use_first_level(domain)) { + if (domain_use_first_level(domain)) attr |= DMA_FL_PTE_PRESENT | DMA_FL_PTE_XD | DMA_FL_PTE_US; - if (domain->domain.type == IOMMU_DOMAIN_DMA) { - attr |= DMA_FL_PTE_ACCESS; - if (prot & DMA_PTE_WRITE) - attr |= DMA_FL_PTE_DIRTY; - } + if (!sg) { + sg_res = nr_pages; + pteval = ((phys_addr_t)phys_pfn << VTD_PAGE_SHIFT) | attr; } - pteval = ((phys_addr_t)phys_pfn << VTD_PAGE_SHIFT) | attr; - while (nr_pages > 0) { uint64_t tmp; --- a/include/linux/intel-iommu.h +++ b/include/linux/intel-iommu.h @@ -42,8 +42,6 @@ #define DMA_FL_PTE_PRESENT BIT_ULL(0) #define DMA_FL_PTE_US BIT_ULL(2) -#define DMA_FL_PTE_ACCESS BIT_ULL(5) -#define DMA_FL_PTE_DIRTY BIT_ULL(6) #define DMA_FL_PTE_XD BIT_ULL(63) #define ADDR_WIDTH_5LEVEL (57)