All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Hervé Poussineau" <hpoussin@reactos.org>
To: Paolo Bonzini <pbonzini@redhat.com>,
	Aurelien Jarno <aurelien@aurel32.net>
Cc: Peter Maydell <peter.maydell@linaro.org>,
	Leon Alrae <leon.alrae@imgtec.com>,
	qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] dma/rc4030: do multiple calls to address_space_rw when doing DMA transfers
Date: Wed, 17 Jun 2015 20:31:22 +0200	[thread overview]
Message-ID: <5581BCFA.40503@reactos.org> (raw)
In-Reply-To: <5581A9B7.3040700@redhat.com>

Le 17/06/2015 19:09, Paolo Bonzini a écrit :
>
>
> On 17/06/2015 10:33, Paolo Bonzini wrote:
>> On 16/06/2015 19:48, Aurelien Jarno wrote:
>>> The code assumes that if you don't have an IOMMU, the address range in
>>> the underlying memory region is linear.
>>
>> I think this is exactly what Peter Crosthwaite's infamous :) "exec:
>> Respect as_translate_internal length clamp" patch was trying to fix.
>> However, address_space_translate_internal uses section->mr->size instead
>> of section->size.  I'll post a patch once I'm through the email deluge
>> from 1 week of absence.
>
> Can you test this?

Sure. It works well for my test case. Thanks Paolo!

However, it breaks PC machines.
mtree gives:
     0000000000000cf8-0000000000000cfb (prio 0, RW): pci-conf-idx
     0000000000000cf9-0000000000000cf9 (prio 1, RW): piix3-reset-control
"make check" wants to write 4 bytes to 0xcf8. Your patch makes it write only 1 byte, and bad things happen.


>
> diff --git a/exec.c b/exec.c
> index 76bfc4a..fabb8bb 100644
> --- a/exec.c
> +++ b/exec.c
> @@ -350,7 +350,7 @@
> address_space_translate_internal(AddressSpaceDispatch *d, hwaddr addr,
> hwaddr *x
>       /* Compute offset within MemoryRegion */
>       *xlat = addr + section->offset_within_region;
>
> -    diff = int128_sub(section->mr->size, int128_make64(addr));
> +    diff = int128_sub(section->size, int128_make64(addr));
>       *plen = int128_get64(int128_min(diff, int128_make64(*plen)));
>       return section;
>   }
>
> Paolo
>

  reply	other threads:[~2015-06-17 18:35 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-11 20:30 [Qemu-devel] [PATCH] dma/rc4030: do multiple calls to address_space_rw when doing DMA transfers Hervé Poussineau
2015-06-11 23:30 ` Aurelien Jarno
2015-06-15 20:44   ` Hervé Poussineau
2015-06-16 17:48     ` Aurelien Jarno
2015-06-17  8:33       ` Paolo Bonzini
2015-06-17 17:09         ` Paolo Bonzini
2015-06-17 18:31           ` Hervé Poussineau [this message]
2015-06-17 19:15             ` Paolo Bonzini

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=5581BCFA.40503@reactos.org \
    --to=hpoussin@reactos.org \
    --cc=aurelien@aurel32.net \
    --cc=leon.alrae@imgtec.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --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 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.