Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1990146rwd; Thu, 15 Jun 2023 19:51:22 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4kDHkbIFy33AGoswiCBgk656Q4voDpjUCqCq1oF9HWEgzboynJxopxPfMKzQ/tE6QX3ueh X-Received: by 2002:a05:6a20:914e:b0:101:1951:d491 with SMTP id x14-20020a056a20914e00b001011951d491mr1181493pzc.6.1686883882142; Thu, 15 Jun 2023 19:51:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686883882; cv=none; d=google.com; s=arc-20160816; b=RRiBdWTrHJXeKzl+rCH0RV2oBk28y82An15MTBo2axbiTW1eEF9SwmhJHzuVXngrvL w2d65v03qW+Z+SgtyTZvW2MXKNsPBK3U5pS9+3V35dNNPr7s3GP9OdJpRiXgA+LWj1yk CbF1R32Ulr5Os/vRySiASwiJkykQKunHW9PCKQd+A8e748R06KaXR5LZ8lDP8XzUopir RZBuA8MEK7Xj8IoNsx44/eyEt8Fet3imYLwV4OmhjMpoQVGaWvtEfMG77jEtDmlK3v9z eGItTYw7vEtjuviBxoDvdXqMSFklA0eCuM/CUS544RdSfx5AVezxvEjY59FWUQsN0/r0 3sew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:to:content-language:subject:cc:user-agent:mime-version :date:message-id:dkim-signature; bh=MZNBSyajkuKZK/msKjfOYWxSJQTJ3DU5HN5ZA45kuCU=; b=XIYSbJI6OONc67k8U0ktJq1kW6sGurxVnNysjriFolnH/WHC6NoSqC9k91XtX4qIUa TzDbikLTs15INPi8lWmYSMXX4wy/e1Tqvrv1BRFxpDhOLJ9ISVzUjLilpemQmQfUkMZ/ V4e6Kyt6V48bceh/dMys5iggvMskw3ZbYvAoVmhW2S+294QH3EVn+PbLanUDkF6Mtfim 5VHijQ5LxPa50wxvS7wHa9nxdHFN4D63M0EfCAbRWbWJxmimwM3LEGxuNwDiHzqqaGlP MBLhePWOY9TqHr078cJHTnWoEx19ZkX+hmyNTG0Ldo2IrS/78ViNI18vYFJkqoor9xl+ xqVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=dgVvhkTC; 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 bc1-20020a170902930100b001b3c7e6a8c0si8611600plb.531.2023.06.15.19.51.10; Thu, 15 Jun 2023 19:51:22 -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=dgVvhkTC; 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 S239977AbjFPCDE (ORCPT + 99 others); Thu, 15 Jun 2023 22:03:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38198 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239937AbjFPCDC (ORCPT ); Thu, 15 Jun 2023 22:03:02 -0400 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6727F295E for ; Thu, 15 Jun 2023 19:02:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686880978; x=1718416978; h=message-id:date:mime-version:cc:subject:to:references: from:in-reply-to:content-transfer-encoding; bh=BMPz4Do2SaGpAD8qHhUtOKMRTvwbRAuUSKYYeb83iGg=; b=dgVvhkTCGuIpaV+nhGxqnkXra/QoCoamWtxrjzhATyj10Xet7vNGlitz udcsPtC906CkpHEV9PcmqHXlNkZ5cL9CaAadv7xxOixkXerU0hWXKg1pc edyjCn49rbX/97mugLajsCQyd8zJ3njuIxLTkz20CP9OymPs/ziel3fpK NiW0yU7Ymw3a1vA81+iBhLOZpVyAAXr7vro4MrrbipLlG6LWCbyPfoUIC pvtc/DeN5RB6bpJOoyyN3Wf/DbEet/e+7Hw293vrHD35J7MCl4h65TcOG 9AVUwf62a3ql9YH2AQN/diFE2Lxu9EtW1+1HA1BEpSJELwPmMTQtWN31/ Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10742"; a="357967063" X-IronPort-AV: E=Sophos;i="6.00,246,1681196400"; d="scan'208";a="357967063" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Jun 2023 19:02:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10742"; a="1042905935" X-IronPort-AV: E=Sophos;i="6.00,246,1681196400"; d="scan'208";a="1042905935" Received: from allen-box.sh.intel.com (HELO [10.239.159.127]) ([10.239.159.127]) by fmsmga005.fm.intel.com with ESMTP; 15 Jun 2023 19:02:56 -0700 Message-ID: <3f60b35a-683c-5e18-c9d5-964df9331f0f@linux.intel.com> Date: Fri, 16 Jun 2023 10:01:45 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Cc: baolu.lu@linux.intel.com, iommu@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH] iommu/vt-d: Fix to flush cache of PASID directory table Content-Language: en-US To: Yanfei Xu , dwmw2@infradead.org, joro@8bytes.org, will@kernel.org, robin.murphy@arm.com References: <20230615071613.690639-1-yanfei.xu@intel.com> From: Baolu Lu In-Reply-To: <20230615071613.690639-1-yanfei.xu@intel.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_MED, 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 On 6/15/23 3:16 PM, Yanfei Xu wrote: > 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. Documentation/process/submitting-patches.rst Please add more information about - Describe your problem. - Any background of the problem? - How your change fixes the problem. ... > > Fixes: 194b3348bdbb ("iommu/vt-d: Fix PASID directory pointer coherency") Do you need a Cc stable? > 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) { Is it similar to 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; } ? Best regards, baolu