[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <BN9PR11MB527662008A42304A70AFA2378CB2A@BN9PR11MB5276.namprd11.prod.outlook.com>
Date: Tue, 14 Nov 2023 05:31:20 +0000
From: "Tian, Kevin" <kevin.tian@...el.com>
To: Baolu Lu <baolu.lu@...ux.intel.com>,
Joerg Roedel <joro@...tes.org>,
"Will Deacon" <will@...nel.org>,
Robin Murphy <robin.murphy@....com>,
"Jason Gunthorpe" <jgg@...pe.ca>
CC: "iommu@...ts.linux.dev" <iommu@...ts.linux.dev>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH 1/1] iommu/vt-d: Omit devTLB invalidation requests when
TES=0
> From: Baolu Lu <baolu.lu@...ux.intel.com>
> Sent: Tuesday, November 14, 2023 12:55 PM
>
> On 11/14/23 12:45 PM, Tian, Kevin wrote:
> >> From: Baolu Lu <baolu.lu@...ux.intel.com>
> >> Sent: Tuesday, November 14, 2023 11:14 AM
> >>
> >> On 11/14/23 11:14 AM, Tian, Kevin wrote:
> >>>> From: Lu Baolu<baolu.lu@...ux.intel.com>
> >>>> Sent: Tuesday, November 14, 2023 9:11 AM
> >>>>
> >>>> The latest VT-d spec indicates that when remapping hardware is
> disabled
> >>>> (TES=0 in Global Status Register), upstream ATS Invalidation Completion
> >>>> requests are treated as UR (Unsupported Request).
> >>>>
> >>>> Consequently, the spec recommends in section 4.3 Handling of Device-
> TLB
> >>>> Invalidations that software refrain from submitting any Device-TLB
> >>>> invalidation requests when address remapping hardware is disabled.
> >>>>
> >>>> Verify address remapping hardware is enabled prior to submitting
> Device-
> >>>> TLB invalidation requests.
> >>>>
> >>>> Fixes: 792fb43ce2c9 ("iommu/vt-d: Enable Intel IOMMU scalable mode
> by
> >>>> default")
> >>>> Signed-off-by: Lu Baolu<baolu.lu@...ux.intel.com>
> >>>> ---
> >>>> drivers/iommu/intel/dmar.c | 18 ++++++++++++++++++
> >>>> 1 file changed, 18 insertions(+)
> >>>>
> >>>> diff --git a/drivers/iommu/intel/dmar.c b/drivers/iommu/intel/dmar.c
> >>>> index a3414afe11b0..23cb80d62a9a 100644
> >>>> --- a/drivers/iommu/intel/dmar.c
> >>>> +++ b/drivers/iommu/intel/dmar.c
> >>>> @@ -1522,6 +1522,15 @@ void qi_flush_dev_iotlb(struct intel_iommu
> >>>> *iommu, u16 sid, u16 pfsid,
> >>>> {
> >>>> struct qi_desc desc;
> >>>>
> >>>> + /*
> >>>> + * VT-d spec, section 4.3:
> >>>> + *
> >>>> + * Software is recommended to not submit any Device-TLB
> >>>> invalidation
> >>>> + * requests while address remapping hardware is disabled.
> >>>> + */
> >>>> + if (!(iommu->gcmd & DMA_GCMD_TE))
> >>>> + return;
> >>>> +
> >>> Is it a valid case to see such request when the iommu is disabled?
> >>> If not then let's add a WARN.
> >>
> >> There might be valid cases. The VT-d translation is turned on after all
> >> devices get probed.
> >>
> >
> > but I didn't get why there will be actual mapping changes before
> > vtd translation is enabled...
>
> For an example, in iommu_create_device_direct_mappings(),
> iommu_flush_iotlb_all() is called after direct mappings are created.
>
Okay.
Reviewed-by: Kevin Tian <kevin.tian@...el.com>
Powered by blists - more mailing lists