From: Joao Martins <joao.m.martins@oracle.com>
To: "Suthikulpanit, Suravee" <suravee.suthikulpanit@amd.com>,
qemu-devel@nongnu.org
Cc: pbonzini@redhat.com, mtosatti@redhat.com, mst@redhat.com,
marcel.apfelbaum@gmail.com, jon.grimm@amd.com,
santosh.shukla@amd.com, vasant.hegde@amd.com, Wei.Huang2@amd.com,
Ruihui.Dian@amd.com, bsd@redhat.com, berrange@redhat.com
Subject: Re: [PATCH] hw/i386/amd_iommu: Allow migration
Date: Wed, 5 Feb 2025 10:20:31 +0000 [thread overview]
Message-ID: <48ca4719-e6fc-497b-a74f-89416d951ac6@oracle.com> (raw)
In-Reply-To: <e3cd0f2b-639e-4383-81a7-06a227d0db28@amd.com>
On 05/02/2025 02:45, Suthikulpanit, Suravee wrote:
>
>
> On 11/29/2024 12:14 AM, Joao Martins wrote:
>> On 21/11/2024 11:42, Joao Martins wrote:> On 20/11/2024 07:31, Suravee
>> Suthikulpanit wrote:
>>>> Add migration support for AMD IOMMU model by saving necessary AMDVIState
>>>> parameters for MMIO registers, device table, command buffer, and event
>>>> buffers.
>>>>
>>>> Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
>>>> ---
>>>> hw/i386/amd_iommu.c | 36 +++++++++++++++++++++++++++++++++++-
>>>> 1 file changed, 35 insertions(+), 1 deletion(-)
>>>>
>>>> diff --git a/hw/i386/amd_iommu.c b/hw/i386/amd_iommu.c
>>>> index 13af7211e1..3d2bb9d81e 100644
>>>> --- a/hw/i386/amd_iommu.c
>>>> +++ b/hw/i386/amd_iommu.c
>>>> @@ -1673,7 +1673,41 @@ static Property amdvi_properties[] = {
>>>>
>>>> static const VMStateDescription vmstate_amdvi_sysbus = {
>>>> .name = "amd-iommu",
>>>> - .unmigratable = 1
>>>> + .version_id = 1,
>>>> + .minimum_version_id = 1,
>>>> + .priority = MIG_PRI_IOMMU,
>>>> + .fields = (VMStateField[]) {
>>>> + /* Updated in amdvi_handle_control_write() */
>>>> + VMSTATE_BOOL(enabled, AMDVIState),
>>>
>>> no xtsup ? I guess you are relying on the dest command line having xtsup=on
>>> like intel-iommu
>>>
>>
>> Having said, I think I found a flaw here that sort of "ignores" the default
>> command line param of 'device-iotlb' (broad x86-iommu param). By default it
>> seems we enable device-iotlb in amd-iommu regardless, even though it's disabled
>> by default in qemu command line params.
>>
>> Should we enable migration I think stuff like that starts to be important to
>> honor given the compability issues we would have to deal apriori. See below on
>> how to fix, happy to formally send if what I explained makes sense to all
>
> As you mentioned, AMD vIOMMU currently ignore this parameter and QEMU default
> dt_supported to false, and set the IOTLBSup in the IVRS table to 1. If we start
> interpret this option, we need to also emulate the following cases when
> dt_supported=0:
>
> * When DTE[I]=1. From AMD IOMMU Spec:
>
> I: IOTLB enable. Controls IOMMU response to address translation requests from
> peripherals. 0=IOMMU returns target abort status when it receives an ATS
> requests from the peripheral. 1=IOMMU responds to ATS requests from the
> peripheral. This bit does not affect interrupts from the peripheral. If I=1 when
> Capability Offset 00h[IotlbSup]=0, the results are undefined.
>
> * Handle the INVALIDATE_IOTLB_PAGES command, which also needs dt_supported=1.
>
> Apart from trying to be compatible w/ the x86-iommu dt_supported param (which is
> mostly for Intel vIOMMU), I am not sure if handling the dt_supported is
> necessary for AMD vIOMMU.
I agree; I certainly not suggesting going out of our way to support
device-iotlb=1 with my command. We could throw an error and fail the amd-iommu
device realize if we wanna explicit that amd vIOMMU doesn't support device_iotlb=1.
> Do we have a scenario where we need to disable ATS
> support for vIOMMU?
> It's closer to reality that ATS isn't quite fully exerciable in Qemu (until this
series lands IIUC:
https://lore.kernel.org/qemu-devel/20250120174033.308518-20-clement.mathieu--drif@eviden.com/).
My whole point was to honor the default, which is disabled and not mis-advertise
it as being supported. Specially considering the cases abov you point out look
to be be obvious gaps that aren't implemented, all the more reason to not be
misadvertising it.
next prev parent reply other threads:[~2025-02-05 10:21 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-20 7:31 [PATCH] hw/i386/amd_iommu: Allow migration Suravee Suthikulpanit
2024-11-21 11:42 ` Joao Martins
2024-11-28 17:14 ` Joao Martins
2024-12-18 9:48 ` Vasant Hegde
2025-02-05 2:45 ` Suthikulpanit, Suravee
2025-02-05 10:20 ` Joao Martins [this message]
2025-02-05 2:17 ` Suthikulpanit, Suravee
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=48ca4719-e6fc-497b-a74f-89416d951ac6@oracle.com \
--to=joao.m.martins@oracle.com \
--cc=Ruihui.Dian@amd.com \
--cc=Wei.Huang2@amd.com \
--cc=berrange@redhat.com \
--cc=bsd@redhat.com \
--cc=jon.grimm@amd.com \
--cc=marcel.apfelbaum@gmail.com \
--cc=mst@redhat.com \
--cc=mtosatti@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=santosh.shukla@amd.com \
--cc=suravee.suthikulpanit@amd.com \
--cc=vasant.hegde@amd.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;
as well as URLs for NNTP newsgroup(s).