qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RFC v2 0/1] memory: Delete assertion in memory_region_unregister_io


From: Paolo Bonzini
Subject: Re: [RFC v2 0/1] memory: Delete assertion in memory_region_unregister_iommu_notifier
Date: Fri, 3 Jul 2020 12:10:53 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0

On 03/07/20 09:39, Eugenio Perez Martin wrote:
> #4  0x0000555555888171 in memory_region_notify_one
> (notifier=0x7ffde0487fa8, entry=0x7ffde5dfe200) at
> /home/qemu/memory.c:1918
> 1918        assert(entry->iova >= notifier->start && entry_end <=
> notifier->end);
> (gdb) p *entry
> $1 = {target_as = 0x555556f6c050, iova = 0, translated_addr = 0,
> addr_mask = 18446744073709551615, perm = IOMMU_NONE}

Oh, I see now.  I am worried that an IOMMU notifier could interpret the
IOMMUTLBEntry incorrectly if there is only partial overlap.  There are
various possibilities:

1) create another IOMMUTLBEntry like

        hwaddr offset = notifier->start > entry->iova ? notifier->start -
entry->iova : 0;
        IOMMUTLBEntry partial = {
            .target_as = entry->target_as,
            .iova = entry->iova + offset,
            .translated_addr = entry->translated_addr + offset,
            .addr_mask = MIN(entry->addr_mask, notifier->end - notifier->start),
            .perm = entry->perm
        };

The addr_mask however would not be a mask if the notifier is not
naturally aligned

2) pass the offset/size pair (computed as above) as extra arguments to
the IOMMUNotify function

3) add a function to compute the offset/size and call it in the notifier

You choose. :)

Paolo




reply via email to

[Prev in Thread] Current Thread [Next in Thread]