From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 305AECD3424 for ; Sun, 17 Sep 2023 19:33:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239697AbjIQTdX (ORCPT ); Sun, 17 Sep 2023 15:33:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41146 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239777AbjIQTc6 (ORCPT ); Sun, 17 Sep 2023 15:32:58 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B2B212B for ; Sun, 17 Sep 2023 12:32:50 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EBA38C433C7; Sun, 17 Sep 2023 19:32:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1694979170; bh=/PbjieVacA6H+0TEX6WkGY6El2gaGJcf1K8rja0ulvA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SUWAlJIrY/hPZxj465kxeM4S07UAXa38YXkBdVlBi1xogZahXtKYn+UAn2jzWdDFo hQSa7KXrZJ+THctFr52epGQmC1PueraT0xZSkNPJhDOS1PTKAz0T1gVvbkTE8xc3rs lSA4X6j8/dGhE5sud757GcEcxiOMP8syza6XMywA= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Lu Baolu , Yanfei Xu , Joerg Roedel , Sasha Levin Subject: [PATCH 5.10 235/406] iommu/vt-d: Fix to flush cache of PASID directory table Date: Sun, 17 Sep 2023 21:11:29 +0200 Message-ID: <20230917191107.372401382@linuxfoundation.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20230917191101.035638219@linuxfoundation.org> References: <20230917191101.035638219@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Yanfei Xu [ Upstream commit 8a3b8e63f8371c1247b7aa24ff9c5312f1a6948b ] 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 real problem encountered for now. Fixes: 194b3348bdbb ("iommu/vt-d: Fix PASID directory pointer coherency") Suggested-by: Lu Baolu Signed-off-by: Yanfei Xu Link: https://lore.kernel.org/r/20230616081045.721873-1-yanfei.xu@intel.com Signed-off-by: Lu Baolu Signed-off-by: Joerg Roedel Signed-off-by: Sasha Levin --- 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 80d6412e2c546..9b24e8224379e 100644 --- a/drivers/iommu/intel/pasid.c +++ b/drivers/iommu/intel/pasid.c @@ -187,7 +187,7 @@ int intel_pasid_alloc_table(struct device *dev) device_attach_pasid_table(info, 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.40.1