[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <MW5PR11MB5881C833CBC14D106DD9A8B5895BA@MW5PR11MB5881.namprd11.prod.outlook.com>
Date: Thu, 15 Jun 2023 23:43:59 +0000
From: "Zhang, Tina" <tina.zhang@...el.com>
To: "Xu, Yanfei" <yanfei.xu@...el.com>,
"dwmw2@...radead.org" <dwmw2@...radead.org>,
"baolu.lu@...ux.intel.com" <baolu.lu@...ux.intel.com>,
"joro@...tes.org" <joro@...tes.org>,
"will@...nel.org" <will@...nel.org>,
"robin.murphy@....com" <robin.murphy@....com>
CC: "iommu@...ts.linux.dev" <iommu@...ts.linux.dev>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"Xu, Yanfei" <yanfei.xu@...el.com>
Subject: RE: [PATCH] iommu/vt-d: Fix to flush cache of PASID directory table
Hi,
> -----Original Message-----
> From: Yanfei Xu <yanfei.xu@...el.com>
> Sent: Thursday, June 15, 2023 3:16 PM
> To: dwmw2@...radead.org; baolu.lu@...ux.intel.com; joro@...tes.org;
> will@...nel.org; robin.murphy@....com
> Cc: iommu@...ts.linux.dev; linux-kernel@...r.kernel.org; Xu, Yanfei
> <yanfei.xu@...el.com>
> Subject: [PATCH] iommu/vt-d: Fix to flush cache of PASID directory table
>
> 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 <yanfei.xu@...el.com>
> ---
> 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;
How about merging the logic of the above few lines into this one:
size = info->pasid_supported ? max_pasid >> (PASID_PDE_SHIFT - 3) : PAGE_SIZE;
Though the logic is about the same, the suggested one seems more intuitive.
Regards,
-Tina
> + order = get_order(size);
> pages = alloc_pages_node(info->iommu->node,
> GFP_KERNEL | __GFP_ZERO, order);
> if (!pages) {
> --
> 2.34.1
>
Powered by blists - more mailing lists