Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2297084rwd; Fri, 16 Jun 2023 01:54:09 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6/4KdvLDY+ovMTHRw+8XXbfB4yECq0LzApgbchexDQ2pzpTAGXo4liXldGdY+uaFiqpMDl X-Received: by 2002:a05:6359:59a:b0:123:ab5:5654 with SMTP id ee26-20020a056359059a00b001230ab55654mr1011938rwb.20.1686905649655; Fri, 16 Jun 2023 01:54:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686905649; cv=none; d=google.com; s=arc-20160816; b=YX/BvrQkYaOW6N4m6JHAtkQolCFsg4XTEHONJEmGodjykaJPkiPmmVNa0lN16IESxq NbMVQdHWwOtiucCyOxooye89uU7akq1yfoN9l34fFPfqoWBDI+6EHd69t+85WW5sm/i8 0rETID50NinLkKPqOAPDIn9LSvo0loHFEFIeMp4FneP6xTd4ZDd3POdStERUeJ8a4mwh G1ZUCTO/L6lICsPLXfZUc1ABlxBWUGgumJ+r9rsqRpWWoZkdCBZyP7Ea6WsZ8SHC9qZH KfCjwy0PEUY7XuIfN/r1ZUPHFnAJBTkesHVvwmrzuqHJiclPTmnIu4o6UTgOzgfdqQWR EqTg== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=4OtzIMDtEB8RzmxhYMDke5FT++Hz2qsZRJ7GNYlt4/M=; b=hGhuppJvsIFIpVlon5mrJJ6PvPrNYVeoeKDFVfcoUeTShoaU9pDZVMZBuiAc7/HCVx QvHMqwYhEoknGJvmaLH0WJ7h+qPp6TxI4cOw/Ut5xMyEcLzjPwsmTO+n4Ot7h+obpuXY 4loB62sHG8fOBBghvLOMVYO3sUaW7rgJ+l1c1/6hagIgFKmpA21aGIIqaLKi+rWobJ7W Wg5720l7UKBSRmJ3gXm5zPMb1tii5XxOs2PZbCy1h/+XTjeMDun9ib+t7AbEQF/pgj0w 2oBffds14vyAW3FbxZ9hRkViDIMvSV9/DceUeMlzciIbDuwNALQKzJkpkIoa9LW01VhO 817Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Q9fhaTqg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j69-20020a638048000000b0054fd0012d2fsi5588960pgd.42.2023.06.16.01.53.56; Fri, 16 Jun 2023 01:54:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Q9fhaTqg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244891AbjFPIN2 (ORCPT + 99 others); Fri, 16 Jun 2023 04:13:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54836 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242564AbjFPIN0 (ORCPT ); Fri, 16 Jun 2023 04:13:26 -0400 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3CCD22962 for ; Fri, 16 Jun 2023 01:13:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686903206; x=1718439206; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=6ItNP+JKSJICj4eyo+r6suaHTPScQyJ1JFtXO/FOP/0=; b=Q9fhaTqgipqVwUG3xsWDKuT9eKdmAR2EyYTO5s0opmgC/gFnkrIhzQax s045mqUZtE1eEuYB2PDywTsRFVgNRUd3pPC4p+0W7ygcRzAX/AdBbzDOV KF9ofTRhcBRk7OIhluzYaDa8VSc1DrjxpVc99nnK/A1Clct0aiA/gTurE f3mq58Knrafs2jz4ZOQZLYAx0PVjZB+oRSdPodow+awEnJCJHYJl0fWR7 DkEgln4UqH1+cI+I+8Jys1ckaKYlztguZmI2J+OwW+VgN9PPtlkg6Khw8 BnCOj+4ZDTTV40ovy6vFb3krSmBWpgd5p/N+ka7X8tm+ceglcQlNlLJp3 g==; X-IronPort-AV: E=McAfee;i="6600,9927,10742"; a="343898449" X-IronPort-AV: E=Sophos;i="6.00,247,1681196400"; d="scan'208";a="343898449" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jun 2023 01:13:24 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10742"; a="959538546" X-IronPort-AV: E=Sophos;i="6.00,247,1681196400"; d="scan'208";a="959538546" Received: from tower.bj.intel.com ([10.238.157.62]) by fmsmga006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jun 2023 01:13:21 -0700 From: Yanfei Xu To: dwmw2@infradead.org, baolu.lu@linux.intel.com, joro@8bytes.org, will@kernel.org, robin.murphy@arm.com, tina.zhang@intel.com Cc: iommu@lists.linux.dev, linux-kernel@vger.kernel.org, yanfei.xu@intel.com Subject: [PATCH v2] iommu/vt-d: Fix to flush cache of PASID directory table Date: Fri, 16 Jun 2023 16:10:45 +0800 Message-Id: <20230616081045.721873-1-yanfei.xu@intel.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Even the PCI devices don't support pasid capability, PASID table is mandatory for a PCI device in scalable mode. However flushing cache of pasid directory table for these devices are not taken after pasid table is allocated as the "size" of table is zero. Fix it by calculating the size by page order. Found this when reading the code, no actual problem encountered for now Fixes: 194b3348bdbb ("iommu/vt-d: Fix PASID directory pointer coherency") Suggested-by: Lu Baolu Signed-off-by: Yanfei Xu --- v1->v2: use variable "order" to calculate the table size (Suggested by baolu) drivers/iommu/intel/pasid.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iommu/intel/pasid.c b/drivers/iommu/intel/pasid.c index c5d479770e12..49fc5a038a14 100644 --- a/drivers/iommu/intel/pasid.c +++ b/drivers/iommu/intel/pasid.c @@ -129,7 +129,7 @@ int intel_pasid_alloc_table(struct device *dev) info->pasid_table = pasid_table; if (!ecap_coherent(info->iommu->ecap)) - clflush_cache_range(pasid_table->table, size); + clflush_cache_range(pasid_table->table, (1 << order) * PAGE_SIZE); return 0; } -- 2.34.1