All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kunkun Jiang <jiangkunkun@huawei.com>
To: Auger Eric <eric.auger@redhat.com>,
	Peter Maydell <peter.maydell@linaro.org>,
	Alex Williamson <alex.williamson@redhat.com>,
	"open list:ARM SMMU" <qemu-arm@nongnu.org>,
	"open list:All patches CC here" <qemu-devel@nongnu.org>
Cc: Zenghui Yu <yuzenghui@huawei.com>,
	wanghaibin.wang@huawei.com, Keqian Zhu <zhukeqian1@huawei.com>,
	shameerali.kolothum.thodi@huawei.com
Subject: Re: [RFC PATCH 2/3] vfio: Add vfio_prereg_listener_log_sync in nested stage
Date: Mon, 12 Apr 2021 21:45:51 +0800	[thread overview]
Message-ID: <89bef82f-7ec4-63ea-f0c0-95b45d425c83@huawei.com> (raw)
In-Reply-To: <c6ee5401-ccb6-1259-f7db-c3f97ff39256@redhat.com>

Hi Eric,

On 2021/4/8 21:56, Auger Eric wrote:
> Hi Kunkun,
>
> On 2/19/21 10:42 AM, Kunkun Jiang wrote:
>> On Intel, the DMA mapped through the host single stage. Instead
>> we set up the stage 2 and stage 1 separately in nested mode as there
>> is no "Caching Mode".
> You need to rewrite the above sentences, Missing ARM and also the 1st
> sentences misses a verb.
Thanks for your review! I will fix it in the next version.
>> Legacy vfio_listener_log_sync cannot be used in nested stage as we
>> don't need to pay close attention to stage 1 mapping. This patch adds
>> vfio_prereg_listener_log_sync to mark dirty pages in nested mode.
>>
>> Signed-off-by: Kunkun Jiang <jiangkunkun@huawei.com>
>> ---
>>   hw/vfio/common.c | 25 +++++++++++++++++++++++++
>>   1 file changed, 25 insertions(+)
>>
>> diff --git a/hw/vfio/common.c b/hw/vfio/common.c
>> index 7c50905856..af333e0dee 100644
>> --- a/hw/vfio/common.c
>> +++ b/hw/vfio/common.c
>> @@ -1216,6 +1216,22 @@ static int vfio_dma_sync_ram_section_dirty_bitmap(VFIOContainer *container,
>>                          int128_get64(section->size), ram_addr);
>>   }
>>   
>> +static void vfio_prereg_listener_log_sync(MemoryListener *listener,
>> +                                          MemoryRegionSection *section)
>> +{
>> +    VFIOContainer *container =
>> +        container_of(listener, VFIOContainer, prereg_listener);
>> +
>> +    if (!memory_region_is_ram(section->mr) ||
>> +        !container->dirty_pages_supported) {
>> +        return;
>> +    }
>> +
>> +    if (vfio_devices_all_saving(container)) {
> I fail to see where is this defined?
Keqian modified vfio_devices_all_saving to vfio_devices_all_dirty_tracking
in 758b96b61d5.

When I posted this series patches, it was vfio_devices_all_saving. In 
v2[1], I
have updated it based on the lasted qemu.

[1] 
https://lore.kernel.org/qemu-devel/20210331101259.2153-3-jiangkunkun@huawei.com/

Thanks,
Kunkun Jiang
>> +        vfio_dma_sync_ram_section_dirty_bitmap(container, section);
>> +    }
>> +}
>> +
>>   typedef struct {
>>       IOMMUNotifier n;
>>       VFIOGuestIOMMU *giommu;
>> @@ -1260,6 +1276,14 @@ static int vfio_sync_dirty_bitmap(VFIOContainer *container,
>>       if (memory_region_is_iommu(section->mr)) {
>>           VFIOGuestIOMMU *giommu;
>>   
>> +        /*
>> +         * In nested mode, stage 2 and stage 1 are set up separately. We
>> +         * only need to focus on stage 2 mapping when marking dirty pages.
>> +         */
>> +        if (container->iommu_type == VFIO_TYPE1_NESTING_IOMMU) {
>> +            return 0;
>> +        }
>> +
>>           QLIST_FOREACH(giommu, &container->giommu_list, giommu_next) {
>>               if (MEMORY_REGION(giommu->iommu) == section->mr &&
>>                   giommu->n.start == section->offset_within_region) {
>> @@ -1312,6 +1336,7 @@ static const MemoryListener vfio_memory_listener = {
>>   static MemoryListener vfio_memory_prereg_listener = {
>>       .region_add = vfio_prereg_listener_region_add,
>>       .region_del = vfio_prereg_listener_region_del,
>> +    .log_sync = vfio_prereg_listener_log_sync,
>>   };
>>   
>>   static void vfio_listener_release(VFIOContainer *container)
>>
> Thanks
>
> Eric
>
> .




  reply	other threads:[~2021-04-12 13:51 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-19  9:42 [RFC PATCH 0/3] Add migration support for VFIO PCI devices in SMMUv3 nested stage mode Kunkun Jiang
2021-02-19  9:42 ` [RFC PATCH 1/3] vfio: Introduce helpers to mark dirty pages of a RAM section Kunkun Jiang
2021-04-08 13:46   ` Auger Eric
2021-04-12 13:45     ` Kunkun Jiang
2021-02-19  9:42 ` [RFC PATCH 2/3] vfio: Add vfio_prereg_listener_log_sync in nested stage Kunkun Jiang
2021-04-08 13:56   ` Auger Eric
2021-04-12 13:45     ` Kunkun Jiang [this message]
2021-02-19  9:42 ` [RFC PATCH 3/3] hw/arm/smmuv3: Post-load stage 1 configurations to the host Kunkun Jiang
2021-04-12  8:34   ` Auger Eric
2021-04-12 13:46     ` Kunkun Jiang
2021-03-01  8:27 ` [RFC PATCH 0/3] Add migration support for VFIO PCI devices in SMMUv3 nested stage mode Kunkun Jiang
2021-04-12  8:40 ` Auger Eric
2021-04-12 13:46   ` Kunkun Jiang

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=89bef82f-7ec4-63ea-f0c0-95b45d425c83@huawei.com \
    --to=jiangkunkun@huawei.com \
    --cc=alex.williamson@redhat.com \
    --cc=eric.auger@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=shameerali.kolothum.thodi@huawei.com \
    --cc=wanghaibin.wang@huawei.com \
    --cc=yuzenghui@huawei.com \
    --cc=zhukeqian1@huawei.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.