[PATCH 0/7] hw/i386/amd_iommu: Cleanups and fixes

Sairaj Kodilkar posted 7 patches 4 months ago
Failed in applying to current master (apply log)
There is a newer version of this series
hw/i386/amd_iommu.c | 217 ++++++++++++++++++++++++++++----------------
hw/i386/amd_iommu.h |   9 +-
2 files changed, 146 insertions(+), 80 deletions(-)
[PATCH 0/7] hw/i386/amd_iommu: Cleanups and fixes
Posted by Sairaj Kodilkar 4 months ago
This series provides few cleanups and fixes for the amd iommu

The patches are based on top of 56c6e249b698 (v10.0.0-rc3) and Alejandro's
DMA remapping series [1].

[1] https://lore.kernel.org/all/20250502021605.1795985-1-alejandro.j.jimenez@oracle.com/

The series is uploaded on github:
https://github.com/AMDESE/qemu-iommu/tree/sarunkod/alej%2Bcleanup-v1

Sairaj Kodilkar (7):
  hw/i386/amd_iommu: Fix MMIO register write tracing
  hw/i386/amd_iommu: Remove unused and wrongly set ats_enabled field
  hw/i386/amd_iommu: Move IOAPIC memory region initialization to the end
  hw/i386/amd_iommu: Support MMIO writes to the status register
  hw/i386/amd_iommu: Fix event log generation
  hw/i386/amd_iommu: Fix handling device on buses != 0
  hw/i386/amd_iommu: Support 64 bit address for IOTLB lookup

 hw/i386/amd_iommu.c | 217 ++++++++++++++++++++++++++++----------------
 hw/i386/amd_iommu.h |   9 +-
 2 files changed, 146 insertions(+), 80 deletions(-)

-- 
2.34.1
Re: [PATCH 0/7] hw/i386/amd_iommu: Cleanups and fixes
Posted by Philippe Mathieu-Daudé 4 months ago
On 16/7/25 09:31, Sairaj Kodilkar wrote:
> This series provides few cleanups and fixes for the amd iommu
> 
> The patches are based on top of 56c6e249b698 (v10.0.0-rc3) and Alejandro's
> DMA remapping series [1].

56c6e249b698 is 4 months old, we are about to release v10.1.0-rc0.

What is the point of posting obsolete code?

I'm not going to review further.

Regards,

Phil.

> [1] https://lore.kernel.org/all/20250502021605.1795985-1-alejandro.j.jimenez@oracle.com/
> 
> The series is uploaded on github:
> https://github.com/AMDESE/qemu-iommu/tree/sarunkod/alej%2Bcleanup-v1
> 
> Sairaj Kodilkar (7):
>    hw/i386/amd_iommu: Fix MMIO register write tracing
>    hw/i386/amd_iommu: Remove unused and wrongly set ats_enabled field
>    hw/i386/amd_iommu: Move IOAPIC memory region initialization to the end
>    hw/i386/amd_iommu: Support MMIO writes to the status register
>    hw/i386/amd_iommu: Fix event log generation
>    hw/i386/amd_iommu: Fix handling device on buses != 0
>    hw/i386/amd_iommu: Support 64 bit address for IOTLB lookup
> 
>   hw/i386/amd_iommu.c | 217 ++++++++++++++++++++++++++++----------------
>   hw/i386/amd_iommu.h |   9 +-
>   2 files changed, 146 insertions(+), 80 deletions(-)
>
Re: [PATCH 0/7] hw/i386/amd_iommu: Cleanups and fixes
Posted by Sairaj Kodilkar 4 months ago

On 7/16/2025 6:07 PM, Philippe Mathieu-Daudé wrote:
> On 16/7/25 09:31, Sairaj Kodilkar wrote:
>> This series provides few cleanups and fixes for the amd iommu
>>
>> The patches are based on top of 56c6e249b698 (v10.0.0-rc3) and 
>> Alejandro's
>> DMA remapping series [1].
> 
> 56c6e249b698 is 4 months old, we are about to release v10.1.0-rc0.
> 
> What is the point of posting obsolete code?
> 
> I'm not going to review further.

Hey Philippe,

sorry. I missed to add it in cover letter. Intention is to get feedback
on this series. Since this is on top of Alejandro's series, I will
rebase it once his series gets merged.

Regards
Sairaj

> 
> Regards,
> 
> Phil.
> 
>> [1] https://lore.kernel.org/all/20250502021605.1795985-1- 
>> alejandro.j.jimenez@oracle.com/
>>
>> The series is uploaded on github:
>> https://github.com/AMDESE/qemu-iommu/tree/sarunkod/alej%2Bcleanup-v1
>>
>> Sairaj Kodilkar (7):
>>    hw/i386/amd_iommu: Fix MMIO register write tracing
>>    hw/i386/amd_iommu: Remove unused and wrongly set ats_enabled field
>>    hw/i386/amd_iommu: Move IOAPIC memory region initialization to the end
>>    hw/i386/amd_iommu: Support MMIO writes to the status register
>>    hw/i386/amd_iommu: Fix event log generation
>>    hw/i386/amd_iommu: Fix handling device on buses != 0
>>    hw/i386/amd_iommu: Support 64 bit address for IOTLB lookup
>>
>>   hw/i386/amd_iommu.c | 217 ++++++++++++++++++++++++++++----------------
>>   hw/i386/amd_iommu.h |   9 +-
>>   2 files changed, 146 insertions(+), 80 deletions(-)
>>
> 


Re: [PATCH 0/7] hw/i386/amd_iommu: Cleanups and fixes
Posted by Michael S. Tsirkin 4 months ago
On Wed, Jul 16, 2025 at 06:26:37PM +0530, Sairaj Kodilkar wrote:
> 
> 
> On 7/16/2025 6:07 PM, Philippe Mathieu-Daudé wrote:
> > On 16/7/25 09:31, Sairaj Kodilkar wrote:
> > > This series provides few cleanups and fixes for the amd iommu
> > > 
> > > The patches are based on top of 56c6e249b698 (v10.0.0-rc3) and
> > > Alejandro's
> > > DMA remapping series [1].
> > 
> > 56c6e249b698 is 4 months old, we are about to release v10.1.0-rc0.
> > 
> > What is the point of posting obsolete code?
> > 
> > I'm not going to review further.
> 
> Hey Philippe,
> 
> sorry. I missed to add it in cover letter. Intention is to get feedback
> on this series. Since this is on top of Alejandro's series, I will
> rebase it once his series gets merged.
> 
> Regards
> Sairaj

Merged now, go ahead and rebase.

> > 
> > Regards,
> > 
> > Phil.
> > 
> > > [1] https://lore.kernel.org/all/20250502021605.1795985-1-
> > > alejandro.j.jimenez@oracle.com/
> > > 
> > > The series is uploaded on github:
> > > https://github.com/AMDESE/qemu-iommu/tree/sarunkod/alej%2Bcleanup-v1
> > > 
> > > Sairaj Kodilkar (7):
> > >    hw/i386/amd_iommu: Fix MMIO register write tracing
> > >    hw/i386/amd_iommu: Remove unused and wrongly set ats_enabled field
> > >    hw/i386/amd_iommu: Move IOAPIC memory region initialization to the end
> > >    hw/i386/amd_iommu: Support MMIO writes to the status register
> > >    hw/i386/amd_iommu: Fix event log generation
> > >    hw/i386/amd_iommu: Fix handling device on buses != 0
> > >    hw/i386/amd_iommu: Support 64 bit address for IOTLB lookup
> > > 
> > >   hw/i386/amd_iommu.c | 217 ++++++++++++++++++++++++++++----------------
> > >   hw/i386/amd_iommu.h |   9 +-
> > >   2 files changed, 146 insertions(+), 80 deletions(-)
> > > 
> > 
Re: [PATCH 0/7] hw/i386/amd_iommu: Cleanups and fixes
Posted by Sairaj Kodilkar 4 months ago

On 7/16/2025 6:59 PM, Michael S. Tsirkin wrote:
> On Wed, Jul 16, 2025 at 06:26:37PM +0530, Sairaj Kodilkar wrote:
>>
>>
>> On 7/16/2025 6:07 PM, Philippe Mathieu-Daudé wrote:
>>> On 16/7/25 09:31, Sairaj Kodilkar wrote:
>>>> This series provides few cleanups and fixes for the amd iommu
>>>>
>>>> The patches are based on top of 56c6e249b698 (v10.0.0-rc3) and
>>>> Alejandro's
>>>> DMA remapping series [1].
>>>
>>> 56c6e249b698 is 4 months old, we are about to release v10.1.0-rc0.
>>>
>>> What is the point of posting obsolete code?
>>>
>>> I'm not going to review further.
>>
>> Hey Philippe,
>>
>> sorry. I missed to add it in cover letter. Intention is to get feedback
>> on this series. Since this is on top of Alejandro's series, I will
>> rebase it once his series gets merged.
>>
>> Regards
>> Sairaj
> 
> Merged now, go ahead and rebase.
> 

Hey Michael,

Sorry, I should have mentioned which series I am talking about,
https://lore.kernel.org/qemu-devel/20250502021605.1795985-1-\
alejandro.j.jimenez@oracle.com/

I know Alejandro's cleanup series has merged. I was waiting for
DMA remapping series. But what I'll do now, is remove the patches that
depend on his series and rebase remaining patches on top of master.

Thanks and sorry for inconvenience. Will take care of this in future

Thanks
Sairaj

>>>
>>> Regards,
>>>
>>> Phil.
>>>
>>>> [1] https://lore.kernel.org/all/20250502021605.1795985-1-
>>>> alejandro.j.jimenez@oracle.com/
>>>>
>>>> The series is uploaded on github:
>>>> https://github.com/AMDESE/qemu-iommu/tree/sarunkod/alej%2Bcleanup-v1
>>>>
>>>> Sairaj Kodilkar (7):
>>>>     hw/i386/amd_iommu: Fix MMIO register write tracing
>>>>     hw/i386/amd_iommu: Remove unused and wrongly set ats_enabled field
>>>>     hw/i386/amd_iommu: Move IOAPIC memory region initialization to the end
>>>>     hw/i386/amd_iommu: Support MMIO writes to the status register
>>>>     hw/i386/amd_iommu: Fix event log generation
>>>>     hw/i386/amd_iommu: Fix handling device on buses != 0
>>>>     hw/i386/amd_iommu: Support 64 bit address for IOTLB lookup
>>>>
>>>>    hw/i386/amd_iommu.c | 217 ++++++++++++++++++++++++++++----------------
>>>>    hw/i386/amd_iommu.h |   9 +-
>>>>    2 files changed, 146 insertions(+), 80 deletions(-)
>>>>
>>>
> 


Re: [PATCH 0/7] hw/i386/amd_iommu: Cleanups and fixes
Posted by Michael S. Tsirkin 4 months ago
On Thu, Jul 17, 2025 at 11:17:05AM +0530, Sairaj Kodilkar wrote:
> 
> 
> On 7/16/2025 6:59 PM, Michael S. Tsirkin wrote:
> > On Wed, Jul 16, 2025 at 06:26:37PM +0530, Sairaj Kodilkar wrote:
> > > 
> > > 
> > > On 7/16/2025 6:07 PM, Philippe Mathieu-Daudé wrote:
> > > > On 16/7/25 09:31, Sairaj Kodilkar wrote:
> > > > > This series provides few cleanups and fixes for the amd iommu
> > > > > 
> > > > > The patches are based on top of 56c6e249b698 (v10.0.0-rc3) and
> > > > > Alejandro's
> > > > > DMA remapping series [1].
> > > > 
> > > > 56c6e249b698 is 4 months old, we are about to release v10.1.0-rc0.
> > > > 
> > > > What is the point of posting obsolete code?
> > > > 
> > > > I'm not going to review further.
> > > 
> > > Hey Philippe,
> > > 
> > > sorry. I missed to add it in cover letter. Intention is to get feedback
> > > on this series. Since this is on top of Alejandro's series, I will
> > > rebase it once his series gets merged.
> > > 
> > > Regards
> > > Sairaj
> > 
> > Merged now, go ahead and rebase.
> > 
> 
> Hey Michael,
> 
> Sorry, I should have mentioned which series I am talking about,
> https://lore.kernel.org/qemu-devel/20250502021605.1795985-1-\
> alejandro.j.jimenez@oracle.com/


Alejandro said he will send v3 of this.

> I know Alejandro's cleanup series has merged. I was waiting for
> DMA remapping series. But what I'll do now, is remove the patches that
> depend on his series and rebase remaining patches on top of master.
> 
> Thanks and sorry for inconvenience. Will take care of this in future
> 
> Thanks
> Sairaj
> 
> > > > 
> > > > Regards,
> > > > 
> > > > Phil.
> > > > 
> > > > > [1] https://lore.kernel.org/all/20250502021605.1795985-1-
> > > > > alejandro.j.jimenez@oracle.com/
> > > > > 
> > > > > The series is uploaded on github:
> > > > > https://github.com/AMDESE/qemu-iommu/tree/sarunkod/alej%2Bcleanup-v1
> > > > > 
> > > > > Sairaj Kodilkar (7):
> > > > >     hw/i386/amd_iommu: Fix MMIO register write tracing
> > > > >     hw/i386/amd_iommu: Remove unused and wrongly set ats_enabled field
> > > > >     hw/i386/amd_iommu: Move IOAPIC memory region initialization to the end
> > > > >     hw/i386/amd_iommu: Support MMIO writes to the status register
> > > > >     hw/i386/amd_iommu: Fix event log generation
> > > > >     hw/i386/amd_iommu: Fix handling device on buses != 0
> > > > >     hw/i386/amd_iommu: Support 64 bit address for IOTLB lookup
> > > > > 
> > > > >    hw/i386/amd_iommu.c | 217 ++++++++++++++++++++++++++++----------------
> > > > >    hw/i386/amd_iommu.h |   9 +-
> > > > >    2 files changed, 146 insertions(+), 80 deletions(-)
> > > > > 
> > > > 
> > 
Re: [PATCH 0/7] hw/i386/amd_iommu: Cleanups and fixes
Posted by Alejandro Jimenez 4 months ago

On 7/17/25 2:07 AM, Michael S. Tsirkin wrote:
> On Thu, Jul 17, 2025 at 11:17:05AM +0530, Sairaj Kodilkar wrote:
>>
>>
>> On 7/16/2025 6:59 PM, Michael S. Tsirkin wrote:
>>> On Wed, Jul 16, 2025 at 06:26:37PM +0530, Sairaj Kodilkar wrote:
>>>>
>>>>
>>>> On 7/16/2025 6:07 PM, Philippe Mathieu-Daudé wrote:
>>>>> On 16/7/25 09:31, Sairaj Kodilkar wrote:
>>>>>> This series provides few cleanups and fixes for the amd iommu
>>>>>>
>>>>>> The patches are based on top of 56c6e249b698 (v10.0.0-rc3) and
>>>>>> Alejandro's
>>>>>> DMA remapping series [1].
>>>>>
>>>>> 56c6e249b698 is 4 months old, we are about to release v10.1.0-rc0.
>>>>>
>>>>> What is the point of posting obsolete code?
>>>>>
>>>>> I'm not going to review further.
>>>>
>>>> Hey Philippe,
>>>>
>>>> sorry. I missed to add it in cover letter. Intention is to get feedback
>>>> on this series. Since this is on top of Alejandro's series, I will
>>>> rebase it once his series gets merged.
>>>>
>>>> Regards
>>>> Sairaj
>>>
>>> Merged now, go ahead and rebase.
>>>
>>
>> Hey Michael,
>>
>> Sorry, I should have mentioned which series I am talking about,
>> https://lore.kernel.org/qemu-devel/20250502021605.1795985-1-\
>> alejandro.j.jimenez@oracle.com/
> 
> 
> Alejandro said he will send v3 of this.
> 

Yes, I am working on this task, and expect to send the new revision 
soon. The pending issue I am working to address (failures on reboot when 
guest boots with forcedac=1) also requires a change in the VFIO host 
kernel driver, but I will send the QEMU patches as soon as that portion 
is ready.

Thank you,
Alejandro

>> I know Alejandro's cleanup series has merged. I was waiting for
>> DMA remapping series. But what I'll do now, is remove the patches that
>> depend on his series and rebase remaining patches on top of master.
>>
>> Thanks and sorry for inconvenience. Will take care of this in future
>>
>> Thanks
>> Sairaj
>>
>>>>>
>>>>> Regards,
>>>>>
>>>>> Phil.
>>>>>
>>>>>> [1] https://lore.kernel.org/all/20250502021605.1795985-1-
>>>>>> alejandro.j.jimenez@oracle.com/
>>>>>>
>>>>>> The series is uploaded on github:
>>>>>> https://github.com/AMDESE/qemu-iommu/tree/sarunkod/alej%2Bcleanup-v1
>>>>>>
>>>>>> Sairaj Kodilkar (7):
>>>>>>      hw/i386/amd_iommu: Fix MMIO register write tracing
>>>>>>      hw/i386/amd_iommu: Remove unused and wrongly set ats_enabled field
>>>>>>      hw/i386/amd_iommu: Move IOAPIC memory region initialization to the end
>>>>>>      hw/i386/amd_iommu: Support MMIO writes to the status register
>>>>>>      hw/i386/amd_iommu: Fix event log generation
>>>>>>      hw/i386/amd_iommu: Fix handling device on buses != 0
>>>>>>      hw/i386/amd_iommu: Support 64 bit address for IOTLB lookup
>>>>>>
>>>>>>     hw/i386/amd_iommu.c | 217 ++++++++++++++++++++++++++++----------------
>>>>>>     hw/i386/amd_iommu.h |   9 +-
>>>>>>     2 files changed, 146 insertions(+), 80 deletions(-)
>>>>>>
>>>>>
>>>
> 


Re: [PATCH 0/7] hw/i386/amd_iommu: Cleanups and fixes
Posted by Vasant Hegde 3 months, 4 weeks ago
Alejandro, Sairaj,


On 7/17/2025 7:18 PM, Alejandro Jimenez wrote:
> 
> 
> On 7/17/25 2:07 AM, Michael S. Tsirkin wrote:
>> On Thu, Jul 17, 2025 at 11:17:05AM +0530, Sairaj Kodilkar wrote:
>>>
>>>
>>> On 7/16/2025 6:59 PM, Michael S. Tsirkin wrote:
>>>> On Wed, Jul 16, 2025 at 06:26:37PM +0530, Sairaj Kodilkar wrote:
>>>>>


.../...

>>>
>>> Hey Michael,
>>>
>>> Sorry, I should have mentioned which series I am talking about,
>>> https://lore.kernel.org/qemu-devel/20250502021605.1795985-1-\
>>> alejandro.j.jimenez@oracle.com/
>>
>>
>> Alejandro said he will send v3 of this.
>>
> 
> Yes, I am working on this task, and expect to send the new revision soon. The
> pending issue I am working to address (failures on reboot when guest boots with
> forcedac=1) also requires a change in the VFIO host kernel driver, but I will
> send the QEMU patches as soon as that portion is ready.

Sure. May be for now keep that as known issue and move on ? we can fix it later.

Other thought (Again it can be separate patch/series)

Ankit's kernel side fix to support different host page table level is queued for
next merge window. How about reducing MAX host page table level support from
current 6 level to 4 level? I think this should help to improve performance
little bit as well.


[1]
https://lore.kernel.org/linux-iommu/8109b208f87b80e400c2abd24a2e44fcbc0763a5.1749016436.git.Ankit.Soni@amd.com/


-Vasant
Re: [PATCH 0/7] hw/i386/amd_iommu: Cleanups and fixes
Posted by Alejandro Jimenez 3 months, 4 weeks ago

On 7/18/25 9:28 AM, Vasant Hegde wrote:
> Alejandro, Sairaj,
> 
> 
> On 7/17/2025 7:18 PM, Alejandro Jimenez wrote:
>>
>>
>> On 7/17/25 2:07 AM, Michael S. Tsirkin wrote:
>>> On Thu, Jul 17, 2025 at 11:17:05AM +0530, Sairaj Kodilkar wrote:
>>>>
>>>>
>>>> On 7/16/2025 6:59 PM, Michael S. Tsirkin wrote:
>>>>> On Wed, Jul 16, 2025 at 06:26:37PM +0530, Sairaj Kodilkar wrote:
>>>>>>
> 
> 
> .../...
> 
>>>>
>>>> Hey Michael,
>>>>
>>>> Sorry, I should have mentioned which series I am talking about,
>>>> https://lore.kernel.org/qemu-devel/20250502021605.1795985-1-\
>>>> alejandro.j.jimenez@oracle.com/
>>>
>>>
>>> Alejandro said he will send v3 of this.
>>>
>>
>> Yes, I am working on this task, and expect to send the new revision soon. The
>> pending issue I am working to address (failures on reboot when guest boots with
>> forcedac=1) also requires a change in the VFIO host kernel driver, but I will
>> send the QEMU patches as soon as that portion is ready.
> 
> Sure. May be for now keep that as known issue and move on ? we can fix it later.
>

That would help. I am spending time on the forcedac issue, trying to 
rule out all the reasons I can think of. But I am reaching a point in 
the investigation where I'd need to ask for advice from the community, 
and having the code merged would simplify things.

So I'll try a few more ideas and if I still can't figure out the issue 
I'll send v3 with an acknowledgment of the limitation, if that is a 
viable approach for others too.


> Other thought (Again it can be separate patch/series)
> 
> Ankit's kernel side fix to support different host page table level is queued for
> next merge window. How about reducing MAX host page table level support from
> current 6 level to 4 level? I think this should help to improve performance
> little bit as well.
> 
> 

Yes, I have considered that option as the "fallback" path, since it is 
an architecturally valid restriction that should solve this problem too. 
My v3 wip branch already includes support for the HATDis portion 
(patches from Joao Martins), and I was planning to add the HATS support 
in future series.

Thank you,
Alejandro

> [1]
> https://lore.kernel.org/linux-iommu/8109b208f87b80e400c2abd24a2e44fcbc0763a5.1749016436.git.Ankit.Soni@amd.com/
> 
> 
> -Vasant