mbox series

[v4,0/7] Convert the intel iommu driver to the dma-iommu api

Message ID 20200927063437.13988-1-baolu.lu@linux.intel.com (mailing list archive)
Headers show
Series Convert the intel iommu driver to the dma-iommu api | expand

Message

Baolu Lu Sept. 27, 2020, 6:34 a.m. UTC
Hi,

The previous post of this series could be found here.

https://lore.kernel.org/linux-iommu/20200912032200.11489-1-baolu.lu@linux.intel.com/

This version introduce a new patch [4/7] to fix an issue reported here.

https://lore.kernel.org/linux-iommu/51a1baec-48d1-c0ac-181b-1fba92aa428d@linux.intel.com/

There aren't any other changes.

Please help to test and review.

Best regards,
baolu

Lu Baolu (3):
  iommu: Add quirk for Intel graphic devices in map_sg
  iommu/vt-d: Update domain geometry in iommu_ops.at(de)tach_dev
  iommu/vt-d: Cleanup after converting to dma-iommu ops

Tom Murphy (4):
  iommu: Handle freelists when using deferred flushing in iommu drivers
  iommu: Add iommu_dma_free_cpu_cached_iovas()
  iommu: Allow the dma-iommu api to use bounce buffers
  iommu/vt-d: Convert intel iommu driver to the iommu ops

 .../admin-guide/kernel-parameters.txt         |   5 -
 drivers/iommu/dma-iommu.c                     | 228 ++++-
 drivers/iommu/intel/Kconfig                   |   1 +
 drivers/iommu/intel/iommu.c                   | 901 +++---------------
 include/linux/dma-iommu.h                     |   8 +
 include/linux/iommu.h                         |   1 +
 6 files changed, 336 insertions(+), 808 deletions(-)

Comments

Tvrtko Ursulin Sept. 28, 2020, 9:44 a.m. UTC | #1
On 27/09/2020 07:34, Lu Baolu wrote:
> Hi,
> 
> The previous post of this series could be found here.
> 
> https://lore.kernel.org/linux-iommu/20200912032200.11489-1-baolu.lu@linux.intel.com/
> 
> This version introduce a new patch [4/7] to fix an issue reported here.
> 
> https://lore.kernel.org/linux-iommu/51a1baec-48d1-c0ac-181b-1fba92aa428d@linux.intel.com/
> 
> There aren't any other changes.
> 
> Please help to test and review.
> 
> Best regards,
> baolu
> 
> Lu Baolu (3):
>    iommu: Add quirk for Intel graphic devices in map_sg

Since I do have patches to fix i915 to handle this, do we want to 
co-ordinate the two and avoid having to add this quirk and then later 
remove it? Or you want to go the staged approach?

Regards,

Tvrtko

>    iommu/vt-d: Update domain geometry in iommu_ops.at(de)tach_dev
>    iommu/vt-d: Cleanup after converting to dma-iommu ops
> 
> Tom Murphy (4):
>    iommu: Handle freelists when using deferred flushing in iommu drivers
>    iommu: Add iommu_dma_free_cpu_cached_iovas()
>    iommu: Allow the dma-iommu api to use bounce buffers
>    iommu/vt-d: Convert intel iommu driver to the iommu ops
> 
>   .../admin-guide/kernel-parameters.txt         |   5 -
>   drivers/iommu/dma-iommu.c                     | 228 ++++-
>   drivers/iommu/intel/Kconfig                   |   1 +
>   drivers/iommu/intel/iommu.c                   | 901 +++---------------
>   include/linux/dma-iommu.h                     |   8 +
>   include/linux/iommu.h                         |   1 +
>   6 files changed, 336 insertions(+), 808 deletions(-)
>
Baolu Lu Sept. 29, 2020, 12:11 a.m. UTC | #2
Hi Tvrtko,

On 9/28/20 5:44 PM, Tvrtko Ursulin wrote:
> 
> On 27/09/2020 07:34, Lu Baolu wrote:
>> Hi,
>>
>> The previous post of this series could be found here.
>>
>> https://lore.kernel.org/linux-iommu/20200912032200.11489-1-baolu.lu@linux.intel.com/ 
>>
>>
>> This version introduce a new patch [4/7] to fix an issue reported here.
>>
>> https://lore.kernel.org/linux-iommu/51a1baec-48d1-c0ac-181b-1fba92aa428d@linux.intel.com/ 
>>
>>
>> There aren't any other changes.
>>
>> Please help to test and review.
>>
>> Best regards,
>> baolu
>>
>> Lu Baolu (3):
>>    iommu: Add quirk for Intel graphic devices in map_sg
> 
> Since I do have patches to fix i915 to handle this, do we want to 
> co-ordinate the two and avoid having to add this quirk and then later 
> remove it? Or you want to go the staged approach?

I have no preference. It depends on which patch goes first. Let the
maintainers help here.

Best regards,
baolu

> 
> Regards,
> 
> Tvrtko
> 
>>    iommu/vt-d: Update domain geometry in iommu_ops.at(de)tach_dev
>>    iommu/vt-d: Cleanup after converting to dma-iommu ops
>>
>> Tom Murphy (4):
>>    iommu: Handle freelists when using deferred flushing in iommu drivers
>>    iommu: Add iommu_dma_free_cpu_cached_iovas()
>>    iommu: Allow the dma-iommu api to use bounce buffers
>>    iommu/vt-d: Convert intel iommu driver to the iommu ops
>>
>>   .../admin-guide/kernel-parameters.txt         |   5 -
>>   drivers/iommu/dma-iommu.c                     | 228 ++++-
>>   drivers/iommu/intel/Kconfig                   |   1 +
>>   drivers/iommu/intel/iommu.c                   | 901 +++---------------
>>   include/linux/dma-iommu.h                     |   8 +
>>   include/linux/iommu.h                         |   1 +
>>   6 files changed, 336 insertions(+), 808 deletions(-)
>>
Joerg Roedel Oct. 1, 2020, 12:17 p.m. UTC | #3
Hi Baolu,

On Tue, Sep 29, 2020 at 08:11:35AM +0800, Lu Baolu wrote:
> I have no preference. It depends on which patch goes first. Let the
> maintainers help here.

No preference on my side, except that it is too late for this now to
make it into v5.10. Besides that I let the decission up to you when this
is ready. Just send me a pull-request when it should get into the
iommu-tree.

Regards,

	Joerg
Logan Gunthorpe Oct. 1, 2020, 9:17 p.m. UTC | #4
Hi Lu,

On 2020-09-27 12:34 a.m., Lu Baolu wrote:
> Hi,
> 
> The previous post of this series could be found here.
> 
> https://lore.kernel.org/linux-iommu/20200912032200.11489-1-baolu.lu@linux.intel.com/
> 
> This version introduce a new patch [4/7] to fix an issue reported here.
> 
> https://lore.kernel.org/linux-iommu/51a1baec-48d1-c0ac-181b-1fba92aa428d@linux.intel.com/
> 
> There aren't any other changes.
> 
> Please help to test and review.

I've tested this patchset on my Sandy Bridge machine and found no issues (while including a 
patch to ioat I've sent to that maintainer).

Tested-By: Logan Gunthorpe <logang@deltatee.com>

Thanks,

Logan
Baolu Lu Oct. 2, 2020, 11:59 a.m. UTC | #5
Hi Joerg,

On 2020/10/1 20:17, Joerg Roedel wrote:
> Hi Baolu,
> 
> On Tue, Sep 29, 2020 at 08:11:35AM +0800, Lu Baolu wrote:
>> I have no preference. It depends on which patch goes first. Let the
>> maintainers help here.
> 
> No preference on my side, except that it is too late for this now to
> make it into v5.10. Besides that I let the decission up to you when this
> is ready. Just send me a pull-request when it should get into the
> iommu-tree.

Sure.

Best regards,
baolu

> 
> Regards,
> 
> 	Joerg
>
Tvrtko Ursulin Oct. 12, 2020, 8:44 a.m. UTC | #6
On 29/09/2020 01:11, Lu Baolu wrote:
> Hi Tvrtko,
> 
> On 9/28/20 5:44 PM, Tvrtko Ursulin wrote:
>>
>> On 27/09/2020 07:34, Lu Baolu wrote:
>>> Hi,
>>>
>>> The previous post of this series could be found here.
>>>
>>> https://lore.kernel.org/linux-iommu/20200912032200.11489-1-baolu.lu@linux.intel.com/ 
>>>
>>>
>>> This version introduce a new patch [4/7] to fix an issue reported here.
>>>
>>> https://lore.kernel.org/linux-iommu/51a1baec-48d1-c0ac-181b-1fba92aa428d@linux.intel.com/ 
>>>
>>>
>>> There aren't any other changes.
>>>
>>> Please help to test and review.
>>>
>>> Best regards,
>>> baolu
>>>
>>> Lu Baolu (3):
>>>    iommu: Add quirk for Intel graphic devices in map_sg
>>
>> Since I do have patches to fix i915 to handle this, do we want to 
>> co-ordinate the two and avoid having to add this quirk and then later 
>> remove it? Or you want to go the staged approach?
> 
> I have no preference. It depends on which patch goes first. Let the
> maintainers help here.

FYI we have merged the required i915 patches to out tree last week or 
so. I *think* this means they will go into 5.11. So the i915 specific 
workaround patch will not be needed in Intel IOMMU.

Regards,

Tvrtko
Baolu Lu Oct. 13, 2020, 12:32 a.m. UTC | #7
Hi Tvrtko,

On 10/12/20 4:44 PM, Tvrtko Ursulin wrote:
> 
> On 29/09/2020 01:11, Lu Baolu wrote:
>> Hi Tvrtko,
>>
>> On 9/28/20 5:44 PM, Tvrtko Ursulin wrote:
>>>
>>> On 27/09/2020 07:34, Lu Baolu wrote:
>>>> Hi,
>>>>
>>>> The previous post of this series could be found here.
>>>>
>>>> https://lore.kernel.org/linux-iommu/20200912032200.11489-1-baolu.lu@linux.intel.com/ 
>>>>
>>>>
>>>> This version introduce a new patch [4/7] to fix an issue reported here.
>>>>
>>>> https://lore.kernel.org/linux-iommu/51a1baec-48d1-c0ac-181b-1fba92aa428d@linux.intel.com/ 
>>>>
>>>>
>>>> There aren't any other changes.
>>>>
>>>> Please help to test and review.
>>>>
>>>> Best regards,
>>>> baolu
>>>>
>>>> Lu Baolu (3):
>>>>    iommu: Add quirk for Intel graphic devices in map_sg
>>>
>>> Since I do have patches to fix i915 to handle this, do we want to 
>>> co-ordinate the two and avoid having to add this quirk and then later 
>>> remove it? Or you want to go the staged approach?
>>
>> I have no preference. It depends on which patch goes first. Let the
>> maintainers help here.
> 
> FYI we have merged the required i915 patches to out tree last week or 
> so. I *think* this means they will go into 5.11. So the i915 specific 
> workaround patch will not be needed in Intel IOMMU.

Thanks for letting us know this. I will drop the workaround patch and
test the whole series after the next rc1.

Best regards,
baolu
Baolu Lu Nov. 2, 2020, 2 a.m. UTC | #8
Hi Tvrtko,

On 10/12/20 4:44 PM, Tvrtko Ursulin wrote:
> 
> On 29/09/2020 01:11, Lu Baolu wrote:
>> Hi Tvrtko,
>>
>> On 9/28/20 5:44 PM, Tvrtko Ursulin wrote:
>>>
>>> On 27/09/2020 07:34, Lu Baolu wrote:
>>>> Hi,
>>>>
>>>> The previous post of this series could be found here.
>>>>
>>>> https://lore.kernel.org/linux-iommu/20200912032200.11489-1-baolu.lu@linux.intel.com/ 
>>>>
>>>>
>>>> This version introduce a new patch [4/7] to fix an issue reported here.
>>>>
>>>> https://lore.kernel.org/linux-iommu/51a1baec-48d1-c0ac-181b-1fba92aa428d@linux.intel.com/ 
>>>>
>>>>
>>>> There aren't any other changes.
>>>>
>>>> Please help to test and review.
>>>>
>>>> Best regards,
>>>> baolu
>>>>
>>>> Lu Baolu (3):
>>>>    iommu: Add quirk for Intel graphic devices in map_sg
>>>
>>> Since I do have patches to fix i915 to handle this, do we want to 
>>> co-ordinate the two and avoid having to add this quirk and then later 
>>> remove it? Or you want to go the staged approach?
>>
>> I have no preference. It depends on which patch goes first. Let the
>> maintainers help here.
> 
> FYI we have merged the required i915 patches to out tree last week or 
> so. I *think* this means they will go into 5.11. So the i915 specific 
> workaround patch will not be needed in Intel IOMMU.

Do you mind telling me what's the status of this fix patch? I tried this
series on v5.10-rc1 with the graphic quirk patch dropped. I am still
seeing dma faults from graphic device.

Best regards,
baolu

> 
> Regards,
> 
> Tvrtko
Tvrtko Ursulin Nov. 2, 2020, 11:52 a.m. UTC | #9
On 02/11/2020 02:00, Lu Baolu wrote:
> Hi Tvrtko,
> On 10/12/20 4:44 PM, Tvrtko Ursulin wrote:
>>
>> On 29/09/2020 01:11, Lu Baolu wrote:
>>> Hi Tvrtko,
>>>
>>> On 9/28/20 5:44 PM, Tvrtko Ursulin wrote:
>>>>
>>>> On 27/09/2020 07:34, Lu Baolu wrote:
>>>>> Hi,
>>>>>
>>>>> The previous post of this series could be found here.
>>>>>
>>>>> https://lore.kernel.org/linux-iommu/20200912032200.11489-1-baolu.lu@linux.intel.com/ 
>>>>>
>>>>>
>>>>> This version introduce a new patch [4/7] to fix an issue reported 
>>>>> here.
>>>>>
>>>>> https://lore.kernel.org/linux-iommu/51a1baec-48d1-c0ac-181b-1fba92aa428d@linux.intel.com/ 
>>>>>
>>>>>
>>>>> There aren't any other changes.
>>>>>
>>>>> Please help to test and review.
>>>>>
>>>>> Best regards,
>>>>> baolu
>>>>>
>>>>> Lu Baolu (3):
>>>>>    iommu: Add quirk for Intel graphic devices in map_sg
>>>>
>>>> Since I do have patches to fix i915 to handle this, do we want to 
>>>> co-ordinate the two and avoid having to add this quirk and then 
>>>> later remove it? Or you want to go the staged approach?
>>>
>>> I have no preference. It depends on which patch goes first. Let the
>>> maintainers help here.
>>
>> FYI we have merged the required i915 patches to out tree last week or 
>> so. I *think* this means they will go into 5.11. So the i915 specific 
>> workaround patch will not be needed in Intel IOMMU.
> 
> Do you mind telling me what's the status of this fix patch? I tried this
> series on v5.10-rc1 with the graphic quirk patch dropped. I am still
> seeing dma faults from graphic device.

Hmm back then I thought i915 fixes for this would land in 5.11 so I will 
stick with that. :) (See my quoted text a paragraph above yours.)

Regards,

Tvrtko
Baolu Lu Nov. 3, 2020, 2:53 a.m. UTC | #10
On 11/2/20 7:52 PM, Tvrtko Ursulin wrote:
> 
> On 02/11/2020 02:00, Lu Baolu wrote:
>> Hi Tvrtko,
>> On 10/12/20 4:44 PM, Tvrtko Ursulin wrote:
>>>
>>> On 29/09/2020 01:11, Lu Baolu wrote:
>>>> Hi Tvrtko,
>>>>
>>>> On 9/28/20 5:44 PM, Tvrtko Ursulin wrote:
>>>>>
>>>>> On 27/09/2020 07:34, Lu Baolu wrote:
>>>>>> Hi,
>>>>>>
>>>>>> The previous post of this series could be found here.
>>>>>>
>>>>>> https://lore.kernel.org/linux-iommu/20200912032200.11489-1-baolu.lu@linux.intel.com/ 
>>>>>>
>>>>>>
>>>>>> This version introduce a new patch [4/7] to fix an issue reported 
>>>>>> here.
>>>>>>
>>>>>> https://lore.kernel.org/linux-iommu/51a1baec-48d1-c0ac-181b-1fba92aa428d@linux.intel.com/ 
>>>>>>
>>>>>>
>>>>>> There aren't any other changes.
>>>>>>
>>>>>> Please help to test and review.
>>>>>>
>>>>>> Best regards,
>>>>>> baolu
>>>>>>
>>>>>> Lu Baolu (3):
>>>>>>    iommu: Add quirk for Intel graphic devices in map_sg
>>>>>
>>>>> Since I do have patches to fix i915 to handle this, do we want to 
>>>>> co-ordinate the two and avoid having to add this quirk and then 
>>>>> later remove it? Or you want to go the staged approach?
>>>>
>>>> I have no preference. It depends on which patch goes first. Let the
>>>> maintainers help here.
>>>
>>> FYI we have merged the required i915 patches to out tree last week or 
>>> so. I *think* this means they will go into 5.11. So the i915 specific 
>>> workaround patch will not be needed in Intel IOMMU.
>>
>> Do you mind telling me what's the status of this fix patch? I tried this
>> series on v5.10-rc1 with the graphic quirk patch dropped. I am still
>> seeing dma faults from graphic device.
> 
> Hmm back then I thought i915 fixes for this would land in 5.11 so I will 
> stick with that. :) (See my quoted text a paragraph above yours.)

What size are those fixes? I am considering pushing this series for
v5.11. Is it possible to get some acks for those patches and let them
go to Linus through iommu tree?

Best regards,
baolu
Tvrtko Ursulin Nov. 3, 2020, 9:14 a.m. UTC | #11
On 03/11/2020 02:53, Lu Baolu wrote:
> On 11/2/20 7:52 PM, Tvrtko Ursulin wrote:
>>
>> On 02/11/2020 02:00, Lu Baolu wrote:
>>> Hi Tvrtko,
>>> On 10/12/20 4:44 PM, Tvrtko Ursulin wrote:
>>>>
>>>> On 29/09/2020 01:11, Lu Baolu wrote:
>>>>> Hi Tvrtko,
>>>>>
>>>>> On 9/28/20 5:44 PM, Tvrtko Ursulin wrote:
>>>>>>
>>>>>> On 27/09/2020 07:34, Lu Baolu wrote:
>>>>>>> Hi,
>>>>>>>
>>>>>>> The previous post of this series could be found here.
>>>>>>>
>>>>>>> https://lore.kernel.org/linux-iommu/20200912032200.11489-1-baolu.lu@linux.intel.com/ 
>>>>>>>
>>>>>>>
>>>>>>> This version introduce a new patch [4/7] to fix an issue reported 
>>>>>>> here.
>>>>>>>
>>>>>>> https://lore.kernel.org/linux-iommu/51a1baec-48d1-c0ac-181b-1fba92aa428d@linux.intel.com/ 
>>>>>>>
>>>>>>>
>>>>>>> There aren't any other changes.
>>>>>>>
>>>>>>> Please help to test and review.
>>>>>>>
>>>>>>> Best regards,
>>>>>>> baolu
>>>>>>>
>>>>>>> Lu Baolu (3):
>>>>>>>    iommu: Add quirk for Intel graphic devices in map_sg
>>>>>>
>>>>>> Since I do have patches to fix i915 to handle this, do we want to 
>>>>>> co-ordinate the two and avoid having to add this quirk and then 
>>>>>> later remove it? Or you want to go the staged approach?
>>>>>
>>>>> I have no preference. It depends on which patch goes first. Let the
>>>>> maintainers help here.
>>>>
>>>> FYI we have merged the required i915 patches to out tree last week 
>>>> or so. I *think* this means they will go into 5.11. So the i915 
>>>> specific workaround patch will not be needed in Intel IOMMU.
>>>
>>> Do you mind telling me what's the status of this fix patch? I tried this
>>> series on v5.10-rc1 with the graphic quirk patch dropped. I am still
>>> seeing dma faults from graphic device.
>>
>> Hmm back then I thought i915 fixes for this would land in 5.11 so I 
>> will stick with that. :) (See my quoted text a paragraph above yours.)
> 
> What size are those fixes? I am considering pushing this series for
> v5.11. Is it possible to get some acks for those patches and let them
> go to Linus through iommu tree?

For 5.10 you mean? They feel a bit too large for comfort to go via a 
non-i915/drm tree. These are the two patches required:

https://cgit.freedesktop.org/drm-intel/commit/?h=drm-intel-gt-next&id=8a473dbadccfc6206150de3db3223c40785da348
https://cgit.freedesktop.org/drm-intel/commit/?h=drm-intel-gt-next&id=934941ed5a3070a7833c688c9b1d71484fc01a68

I'll copy Joonas as our maintainer - how does the idea of taking the 
above two patches through the iommu tree sound to you?

Regards,

Tvrtko
Joonas Lahtinen Nov. 3, 2020, 9:58 a.m. UTC | #12
Quoting Tvrtko Ursulin (2020-11-03 11:14:32)
> 
> 
> On 03/11/2020 02:53, Lu Baolu wrote:
> > On 11/2/20 7:52 PM, Tvrtko Ursulin wrote:
> >>
> >> On 02/11/2020 02:00, Lu Baolu wrote:
> >>> Hi Tvrtko,
> >>> On 10/12/20 4:44 PM, Tvrtko Ursulin wrote:
> >>>>
> >>>> On 29/09/2020 01:11, Lu Baolu wrote:

<SNIP>

> >>>> FYI we have merged the required i915 patches to out tree last week 
> >>>> or so. I *think* this means they will go into 5.11. So the i915 
> >>>> specific workaround patch will not be needed in Intel IOMMU.
> >>>
> >>> Do you mind telling me what's the status of this fix patch? I tried this
> >>> series on v5.10-rc1 with the graphic quirk patch dropped. I am still
> >>> seeing dma faults from graphic device.
> >>
> >> Hmm back then I thought i915 fixes for this would land in 5.11 so I 
> >> will stick with that. :) (See my quoted text a paragraph above yours.)
> > 
> > What size are those fixes? I am considering pushing this series for
> > v5.11. Is it possible to get some acks for those patches and let them
> > go to Linus through iommu tree?
> 
> For 5.10 you mean? They feel a bit too large for comfort to go via a 
> non-i915/drm tree. These are the two patches required:
> 
> https://cgit.freedesktop.org/drm-intel/commit/?h=drm-intel-gt-next&id=8a473dbadccfc6206150de3db3223c40785da348
> https://cgit.freedesktop.org/drm-intel/commit/?h=drm-intel-gt-next&id=934941ed5a3070a7833c688c9b1d71484fc01a68
> 
> I'll copy Joonas as our maintainer - how does the idea of taking the 
> above two patches through the iommu tree sound to you?

Hi Lu,

The patches have already been merged into our tree and are heading
towards 5.11, so I don't think we should merge them elsewhere. DRM
subsystem had the feature freeze for 5.10 at the time of 5.9-rc5
and only drm-intel-fixes pull requests are sent after that.

The patches seem to target to eliminate need for a previously used
workaround. To me it seems more appropriate for the patches to follow
the regular process as new feature for 5.11 to make sure the changes
get validated as part of linux-next.

Would that work for you? We intend to send the feature pull requests
to DRM for 5.11 in the upcoming weeks.

Regards, Joonas
Joerg Roedel Nov. 3, 2020, 10:54 a.m. UTC | #13
Hi,

On Tue, Nov 03, 2020 at 11:58:26AM +0200, Joonas Lahtinen wrote:
> Would that work for you? We intend to send the feature pull requests
> to DRM for 5.11 in the upcoming weeks.

For the IOMMU side it is best to include the workaround for now. When
the DRM fixes are merged into v5.11-rc1 together with this conversion,
it can be reverted and will not be in 5.11-final.

Regards,

	Joerg
Baolu Lu Nov. 20, 2020, 10:20 a.m. UTC | #14
On 2020/11/3 18:54, Joerg Roedel wrote:
> Hi,
> 
> On Tue, Nov 03, 2020 at 11:58:26AM +0200, Joonas Lahtinen wrote:
>> Would that work for you? We intend to send the feature pull requests
>> to DRM for 5.11 in the upcoming weeks.
> 
> For the IOMMU side it is best to include the workaround for now. When
> the DRM fixes are merged into v5.11-rc1 together with this conversion,
> it can be reverted and will not be in 5.11-final.

Okay! So I will keep the workaround and send a new version (mostly
rebase) to Will.

Best regards,
baolu