Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp705672rwd; Thu, 15 Jun 2023 00:28:54 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4H7gFjGzFYXvDoVTHX8Y9c58hjax5V++KAYbW+vxHSEbicoLXNAVG8ATG6QcCgfCvFakg0 X-Received: by 2002:a05:6808:1144:b0:398:a09:3cb with SMTP id u4-20020a056808114400b003980a0903cbmr16782027oiu.36.1686814134072; Thu, 15 Jun 2023 00:28:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686814134; cv=none; d=google.com; s=arc-20160816; b=k85d89nAHALQ142icyAnRg4wVkCp3zg066ihDtDQI0T30IC1qxgJi0eCazjLhcUo96 U2ADTVWKvv0yBu3vEGUstrZXong9VGwZ976G/+ugU8awriLkLGGUWnFoqSN2HNbzPttl R+FP3FtTv7pPW+OdpaRwvlLbq9zYRkABDE3OXfaMcI3brNJliC4CZino1EzA3RyBrBrM oF92HjHoQbARrhEdblNn4xEorccNTaPOpH3Epu4H6TKaMWsz0gL5d0nIuQwswbSAIJJW JEEuMAFk9kHTrriAyB83BacjNO7yRUB2wyPwcQ0EgPSU+PEwr5iSAaj4MCqsP13lmciV FlWQ== 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=pI9Kebwri7Wjwt5dIv+EfvKXtO/M52yhl/ynLaKFTh4=; b=pcCbCp4RpGDbpAoY79rDVqGbuP8DGf5mc10DFd+qK5S4oyt0FY+11gP/LZxj12yl1A KUAYBTj4ePcHtUuQQSdsDJUNVR1LdsBikn1ym+bIXKoE/MLpwkNv8hCb9+C1XU3nwgpj mTt2EC4Q8E/hMiwW2UdL1Wolr4CTRkFIytnpvA5jR2+IqlvGFonbBbaR6rX7AAp7fsab F9s3i3fmRFfMGmKPV9Vu/P4I0XAhHaQjN8oDOy1Ic7lZH5k3woIhNNFjjv6dTynffD68 Qvtfroj1E46jSgjHxO//+u+O+Q4Q2LyXbKN1k/Rkutc7EC1784B4AA5vAd91TUR7GX13 ikZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ZjE8i8W5; 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 x190-20020a6386c7000000b00550d4afd7casi401520pgd.739.2023.06.15.00.28.36; Thu, 15 Jun 2023 00:28:54 -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=ZjE8i8W5; 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 S244885AbjFOHVH (ORCPT + 99 others); Thu, 15 Jun 2023 03:21:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41204 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238246AbjFOHU3 (ORCPT ); Thu, 15 Jun 2023 03:20:29 -0400 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 606D8270A for ; Thu, 15 Jun 2023 00:18:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686813532; x=1718349532; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=tv0xInhDNZvIGN29/qg5JZUQvfOAzDkVJk+y8zR9+Z0=; b=ZjE8i8W5fRSYFplo7odk277vLPw/NRW+H+Cg0bltmmU6YvIoa+B2nV6z HodB+9+nZRCpCSFkwTo7SyybDL1vvpbxXeD7ZDSRw88S5vJPJPGP5luyN Rbp8jjA/5EjQPHW0vCxkPd7E7PruPItMMao9OitTst5rjrSYbkNDK/7yp Xu6MQaczsHrg8YmR9MTmffUKsgLsWb4v1imMtyt5+r+Bb2YmkTOucMtGs guDVeococ+8h7VMb2jNsN5NmJ+XYZfbHpO1HwWJItf5XlO0grmoPALOGq Wl1EeJGAL0LFlHim7BxDEtybz+Ml4zTIQ4VonP4x7Yf2DkX6S7QG3mdmY w==; X-IronPort-AV: E=McAfee;i="6600,9927,10741"; a="339183070" X-IronPort-AV: E=Sophos;i="6.00,244,1681196400"; d="scan'208";a="339183070" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Jun 2023 00:18:52 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10741"; a="706544678" X-IronPort-AV: E=Sophos;i="6.00,244,1681196400"; d="scan'208";a="706544678" Received: from tower.bj.intel.com ([10.238.157.62]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Jun 2023 00:18:49 -0700 From: Yanfei Xu To: dwmw2@infradead.org, baolu.lu@linux.intel.com, joro@8bytes.org, will@kernel.org, robin.murphy@arm.com Cc: iommu@lists.linux.dev, linux-kernel@vger.kernel.org, yanfei.xu@intel.com Subject: [PATCH] iommu/vt-d: Fix to flush cache of PASID directory table Date: Thu, 15 Jun 2023 15:16:13 +0800 Message-Id: <20230615071613.690639-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=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE 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 to assign it with a page size. Fixes: 194b3348bdbb ("iommu/vt-d: Fix PASID directory pointer coherency") Signed-off-by: Yanfei Xu --- drivers/iommu/intel/pasid.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/iommu/intel/pasid.c b/drivers/iommu/intel/pasid.c index c5d479770e12..bde7df055865 100644 --- a/drivers/iommu/intel/pasid.c +++ b/drivers/iommu/intel/pasid.c @@ -115,7 +115,9 @@ int intel_pasid_alloc_table(struct device *dev) intel_pasid_max_id); size = max_pasid >> (PASID_PDE_SHIFT - 3); - order = size ? get_order(size) : 0; + if (!size) + size = PAGE_SIZE; + order = get_order(size); pages = alloc_pages_node(info->iommu->node, GFP_KERNEL | __GFP_ZERO, order); if (!pages) { -- 2.34.1