public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Baolu Lu <baolu.lu@linux.intel.com>
To: "Duan, Zhenzhong" <zhenzhong.duan@intel.com>,
	"iommu@lists.linux.dev" <iommu@lists.linux.dev>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: baolu.lu@linux.intel.com,
	"dwmw2@infradead.org" <dwmw2@infradead.org>,
	"joro@8bytes.org" <joro@8bytes.org>,
	"will@kernel.org" <will@kernel.org>,
	"robin.murphy@arm.com" <robin.murphy@arm.com>,
	"Peng, Chao P" <chao.p.peng@intel.com>
Subject: Re: [PATCH 1/2] iommu/vt-d: Fix checks in dmar_fault_dump_ptes()
Date: Wed, 23 Oct 2024 15:37:48 +0800	[thread overview]
Message-ID: <39228f3c-6137-4a00-941d-8c445ffb1a19@linux.intel.com> (raw)
In-Reply-To: <SJ0PR11MB6744E47FF944D4C576B6B973924D2@SJ0PR11MB6744.namprd11.prod.outlook.com>

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

  reply	other threads:[~2024-10-23  7:37 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-22  9:50 [PATCH 0/2] vtd: Minor cleanup Zhenzhong Duan
2024-10-22  9:50 ` [PATCH 1/2] iommu/vt-d: Fix checks in dmar_fault_dump_ptes() Zhenzhong Duan
2024-10-23  3:12   ` Baolu Lu
2024-10-23  5:09     ` Duan, Zhenzhong
2024-10-23  7:37       ` Baolu Lu [this message]
2024-10-22  9:50 ` [PATCH 2/2] iommu/vt-d: Fix checks in pgtable_walk() Zhenzhong Duan
2024-10-23  4:49   ` Baolu Lu
2024-10-23  5:16     ` Duan, Zhenzhong
2024-10-23  7:41       ` Baolu Lu
2024-10-23  7:48         ` Duan, Zhenzhong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=39228f3c-6137-4a00-941d-8c445ffb1a19@linux.intel.com \
    --to=baolu.lu@linux.intel.com \
    --cc=chao.p.peng@intel.com \
    --cc=dwmw2@infradead.org \
    --cc=iommu@lists.linux.dev \
    --cc=joro@8bytes.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robin.murphy@arm.com \
    --cc=will@kernel.org \
    --cc=zhenzhong.duan@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox