[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <39228f3c-6137-4a00-941d-8c445ffb1a19@linux.intel.com>
Date: Wed, 23 Oct 2024 15:37:48 +0800
From: Baolu Lu <baolu.lu@...ux.intel.com>
To: "Duan, Zhenzhong" <zhenzhong.duan@...el.com>,
"iommu@...ts.linux.dev" <iommu@...ts.linux.dev>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Cc: baolu.lu@...ux.intel.com, "dwmw2@...radead.org" <dwmw2@...radead.org>,
"joro@...tes.org" <joro@...tes.org>, "will@...nel.org" <will@...nel.org>,
"robin.murphy@....com" <robin.murphy@....com>,
"Peng, Chao P" <chao.p.peng@...el.com>
Subject: Re: [PATCH 1/2] iommu/vt-d: Fix checks in dmar_fault_dump_ptes()
On 2024/10/23 13:09, Duan, Zhenzhong wrote:
>>> ---
>>> drivers/iommu/intel/iommu.c | 31 ++++++++++++++++++++-----------
>>> 1 file changed, 20 insertions(+), 11 deletions(-)
>>>
>>> diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c
>>> index a564eeaf2375..8288b0ee7a61 100644
>>> --- a/drivers/iommu/intel/iommu.c
>>> +++ b/drivers/iommu/intel/iommu.c
>>> @@ -733,12 +733,17 @@ void dmar_fault_dump_ptes(struct intel_iommu
>> *iommu, u16 source_id,
>>> u8 devfn = source_id & 0xff;
>>> u8 bus = source_id >> 8;
>>> struct dma_pte *pgtable;
>>> + u64 entry;
>>>
>>> pr_info("Dump %s table entries for IOVA 0x%llx\n", iommu->name, addr);
>>>
>>> /* root entry dump */
>>> rt_entry = &iommu->root_entry[bus];
>>> - if (!rt_entry) {
>>> + entry = rt_entry->lo;
>>> + if (sm_supported(iommu) && devfn >= 0x80)
>>> + entry = rt_entry->hi;
>>> +
>>> + if (!(entry & 1)) {
>>> pr_info("root table entry is not present\n");
>>> return;
>>> }
>>> @@ -766,28 +771,32 @@ void dmar_fault_dump_ptes(struct intel_iommu
>> *iommu, u16 source_id,
>>> goto pgtable_walk;
>>> }
>>>
>>> + /* For request-without-pasid, get the pasid from context entry */
>>> + if (pasid == IOMMU_PASID_INVALID)
>>> + pasid = IOMMU_NO_PASID;
>>> +
>>> /* get the pointer to pasid directory entry */
>>> dir = phys_to_virt(ctx_entry->lo & VTD_PAGE_MASK);
>> Is above code correct in the scalable mode?
> I didn't find issue, could you show some light?
It's fine. I just mixed it with the root entry.
Thanks,
baolu
Powered by blists - more mailing lists