From: Alexey Kardashevskiy <aik@ozlabs.ru>
To: David Gibson <david@gibson.dropbear.id.au>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH qemu] memory: Fix IOMMU replay base address
Date: Mon, 22 Feb 2016 22:36:19 +1100 [thread overview]
Message-ID: <56CAF2B3.2030502@ozlabs.ru> (raw)
In-Reply-To: <20160222062631.GH2808@voom.fritz.box>
On 02/22/2016 05:26 PM, David Gibson wrote:
> On Mon, Feb 22, 2016 at 05:09:39PM +1100, Alexey Kardashevskiy wrote:
>> Since a788f227 "memory: Allow replay of IOMMU mapping notifications"
>> when new VFIO listener is added, all existing IOMMU mappings are replayed.
>> However there is a problem that the base address of an IOMMU memory region
>> (IOMMU MR) is ignored which is not a problem for the existing user (which is
>> pseries) with its default 32bit DMA window starting at 0 but it is if there is
>> another DMA window.
>>
>> This adjusts the replaying address by mr->addr.
>
> Uh.. this doesn't look right to me. AFAICT from the existing
> implementations the 'addr' parameter to the translate function is an
> offset within the memory region, which would make the original version
> correct.
Ok, then spapr_tce_translate_iommu() needs to be fixed. Or I am missing
something here? The @addr field is definitely ignored now.
>
>> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
>> ---
>> memory.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/memory.c b/memory.c
>> index 09041ed..377269b 100644
>> --- a/memory.c
>> +++ b/memory.c
>> @@ -1436,7 +1436,7 @@ void memory_region_iommu_replay(MemoryRegion *mr, Notifier *n,
>> IOMMUTLBEntry iotlb;
>>
>> for (addr = 0; addr < memory_region_size(mr); addr += granularity) {
>> - iotlb = mr->iommu_ops->translate(mr, addr, is_write);
>> + iotlb = mr->iommu_ops->translate(mr, mr->addr + addr, is_write);
>> if (iotlb.perm != IOMMU_NONE) {
>> n->notify(n, &iotlb);
>> }
>
--
Alexey
next prev parent reply other threads:[~2016-02-22 11:36 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-22 6:09 [Qemu-devel] [PATCH qemu] memory: Fix IOMMU replay base address Alexey Kardashevskiy
2016-02-22 6:26 ` David Gibson
2016-02-22 11:36 ` Alexey Kardashevskiy [this message]
2016-02-22 12:12 ` David Gibson
2016-02-23 2:11 ` Alexey Kardashevskiy
2016-02-23 6:20 ` David Gibson
2016-02-23 9:00 ` Alexey Kardashevskiy
2016-02-23 9:56 ` Paolo Bonzini
2016-02-23 11:25 ` David Gibson
2016-02-24 0:19 ` Alexey Kardashevskiy
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=56CAF2B3.2030502@ozlabs.ru \
--to=aik@ozlabs.ru \
--cc=david@gibson.dropbear.id.au \
--cc=qemu-devel@nongnu.org \
/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).