Received: by 2002:ab2:3350:0:b0:1f4:6588:b3a7 with SMTP id o16csp1176378lqe; Mon, 8 Apr 2024 00:24:11 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXm7wV1YlBvUKEJpO4a+KCU8iMUYnfyLGaqdFnHY7wDq3DVR9SmfP/HgrdP9j2Ys987sMsIqVHVq6VjPKY0L7kFaGKM0OT+zHrQ8EsGHg== X-Google-Smtp-Source: AGHT+IEFqcZcuKS7M3UI/8wWgftakeVaNfCafcf72Awtx1XTFukFCPXfPA/h2MkNTDd8EuB7Rrw0 X-Received: by 2002:a19:ca4d:0:b0:513:c61c:7331 with SMTP id h13-20020a19ca4d000000b00513c61c7331mr6276083lfj.3.1712561051468; Mon, 08 Apr 2024 00:24:11 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712561051; cv=pass; d=google.com; s=arc-20160816; b=fKnh7nT37a5fGkogYvAb2kC1vFGUKQYc/iWoWLVRXLESHU0am+mxbzqoTfXtZ4Qeaw B3GteQ2gnHTLWmKxvYAD1mcpDQmz06xAVMYhwnKEeWW9X4Snwo8tl9m+BFLMRKweQwDx BmXOL+PimhnbqVMuOHEWVc+ZvL+hyc26qORDPHb4y4l6Qpu1RZ534qHWwFUqE27LJLB6 AvwQQWy4etMur9qRyivCjQvWbS+ZIN3xKdzgeSepbSOB6zbKs3MjBxZAOosvbhZMcDBD 7z4eV4y+rav6BDPv0IwgajwCxyNPaLVir3EwtZx3uq4mMn7yyd3a0LLJubyKvbwO2hLe yaXg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:cc:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=bfMZ/LxN6/N3FTgiZVSCk+AdPr5bAFVmCQ7mZkAmcDA=; fh=MJt9DfxjtwnW8ZZSQzfUxkUWtQNU0UUHkPzoBnNI3uI=; b=VekufXftxsLJ1CLJLX/3NOBPefbLLrTMwZex5Fu5byhwPsVk4yU9uguXoMIMu4Fz7Z vVzwUXRqOHizQjJtwHlh0XSZAX/ltol/GGohKM9M3EO3UO3/CQ5/T1mTZ+4+tfEIg1Wf 5Y2A/wwJNZ0cGjetDKRrsfVJAXsEuDzU4OGqoI2KDtvBMknxKUAlC9U/HRAnN6YNDMVP qS9jCNSrcZiGw/vWGCr8kElGEheTgqIjfSNGyvaDpaHekwSMJL8TzGY4JSYjLFbQzOwb 9x4F/GKEbXcuvm5lXo/WLtLsbk35RU/SE1+gfKnpMg/vYy1qtZ1ztWdfd/vHBCLH8xMi Dpnw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=fWZgFEKa; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-134896-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-134896-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id um16-20020a170906cf9000b00a5191363319si3313325ejb.509.2024.04.08.00.24.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Apr 2024 00:24:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-134896-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=fWZgFEKa; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-134896-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-134896-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 3395D1F22871 for ; Mon, 8 Apr 2024 07:24:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 648DF25570; Mon, 8 Apr 2024 07:24:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="fWZgFEKa" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.13]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 48D8129CEB for ; Mon, 8 Apr 2024 07:23:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.13 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712561040; cv=none; b=RuTZAV9tkKihEleOBB9KpxC2xQMVcRJ6/7gMoYDAJjD0Q7RPxE4Ts7Wlz0V910DitB5BR0SrRlrfWtJc5EQRy4sbSYCAYFdPLjMIgRZo5ujwXycgonE0OP2dJz0wVQ4smXUzcbYJTorRzbgVuG2ONMHcOdsJQcxchRTiddWHYFM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712561040; c=relaxed/simple; bh=IicImq3z2qvLmGQsgKhqWxik+ce2KS2cRSEMO+XvwdM=; h=Message-ID:Date:MIME-Version:Cc:Subject:To:References:From: In-Reply-To:Content-Type; b=PBNV8/NYUeKb/RRe413D25iVYnD8UH5QjMPrRzaQSMwRxpXxGWuZZ29Ew4WE5n9G8OnEqxuTQzYWdum8jcBaN5K2pdlxp2B6oUtmiSCWuhGr8qAPCLmkuO6IYRaM/6HxC+oqp+Ax1e8+h+qPmYvoOZ3bVcuNqt97G8osfKAsCDs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=fWZgFEKa; arc=none smtp.client-ip=198.175.65.13 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1712561039; x=1744097039; h=message-id:date:mime-version:cc:subject:to:references: from:in-reply-to:content-transfer-encoding; bh=IicImq3z2qvLmGQsgKhqWxik+ce2KS2cRSEMO+XvwdM=; b=fWZgFEKak040GgIP7TDiSrlh4D8oeN5LApxf0zqUXlPUAleL9Sy+Io+J 5G32lajKpNnzhy5zEi7cReJyXM9jYjskh6su/wyBbNExqQl+1lnxIzM+p dyzcWBV8S5cZgFNqJsea+m2LRUU6fj36ruJ9WbjZ6vjMATioEvORj1kyQ BTU1YIWy8fcWQVVZPb/2jdnYE8S3TGwdZc0yF9JcXR3bcGunsM+x+pNf1 0hDhFtiJPwwZ+lrc4UubM7b+5U5NO9QWy7c2zwlYeGSkaD4ezGeUQS8HB S/dd88Yn5Tg2G72r0ZTpzPz98JM+aXqMcyN6jIWcVVoZ/hqAEyO41zo0B A==; X-CSE-ConnectionGUID: rJJlcCNiRXGxb27e289+ew== X-CSE-MsgGUID: MwfbXIfwQauDqMmJ6K9iYg== X-IronPort-AV: E=McAfee;i="6600,9927,11037"; a="18966794" X-IronPort-AV: E=Sophos;i="6.07,186,1708416000"; d="scan'208";a="18966794" Received: from fmviesa009.fm.intel.com ([10.60.135.149]) by orvoesa105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Apr 2024 00:23:59 -0700 X-CSE-ConnectionGUID: pMFad0P1SXW8jnvMBD8EMQ== X-CSE-MsgGUID: 6s7CIl2MSg+Q5TTXBs4laA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,186,1708416000"; d="scan'208";a="19851737" Received: from penghuan-mobl.ccr.corp.intel.com (HELO [10.254.211.109]) ([10.254.211.109]) by fmviesa009-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Apr 2024 00:23:56 -0700 Message-ID: Date: Mon, 8 Apr 2024 15:23:53 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Cc: baolu.lu@linux.intel.com, Kevin Tian , Yi Liu , Joerg Roedel , Will Deacon , Robin Murphy , linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/2] iommu/vt-d: Remove caching mode check before devtlb flush To: Ethan Zhao , iommu@lists.linux.dev References: <20240407144232.190355-1-baolu.lu@linux.intel.com> <20240407144232.190355-2-baolu.lu@linux.intel.com> Content-Language: en-US From: Baolu Lu In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 2024/4/8 15:21, Ethan Zhao wrote: > On 4/7/2024 10:42 PM, Lu Baolu wrote: >> The Caching Mode (CM) of the Intel IOMMU indicates if the hardware >> implementation caches not-present or erroneous translation-structure >> entries except the first-stage translation. The caching mode is >> unrelated to the device TLB , therefore there is no need to check >> it before a device TLB invalidation operation. >> >> Before the scalable mode is introduced, caching mode is treated as >> an indication that the driver is running in a VM guest. This is just >> a software contract as shadow page table is the only way to implement >> a virtual IOMMU. But the VT-d spec doesn't state this anywhere. After >> the scalable mode is introduced, this doesn't stand for anymore, as >> caching mode is not relevant for the first-stage translation. A virtual >> IOMMU implementation is free to support first-stage translation only >> with caching mode cleared. >> >> Remove the caching mode check before device TLB invalidation to ensure >> compatibility with the scalable mode use cases. >> >> Fixes: 792fb43ce2c9 ("iommu/vt-d: Enable Intel IOMMU scalable mode by >> default") >> Signed-off-by: Lu Baolu >> --- >>   drivers/iommu/intel/iommu.c | 5 ++--- >>   1 file changed, 2 insertions(+), 3 deletions(-) >> >> diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c >> index 493b6a600394..681789b1258d 100644 >> --- a/drivers/iommu/intel/iommu.c >> +++ b/drivers/iommu/intel/iommu.c >> @@ -1501,7 +1501,7 @@ static void iommu_flush_iotlb_psi(struct >> intel_iommu *iommu, >>       else >>           __iommu_flush_iotlb_psi(iommu, did, pfn, pages, ih); >> -    if (!cap_caching_mode(iommu->cap) && !map) >> +    if (!map) > > My understanding, we don't need patch[1/2] at all, and customer is just > asking > about the CM & tlb flushing, it is great to have this commit [2/2]. Actually they fix different problems. Best regards, baolu