From: Anthony PERARD <anthony.perard@citrix.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: Peter Maydell <peter.maydell@linaro.org>,
Nitin Srivastava <nitins@juniper.net>,
Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>,
Stefano Stabellini <stefano.stabellini@eu.citrix.com>,
Michael Tokarev <mjt@tls.msk.ru>, Alexander Graf <agraf@suse.de>,
qemu-devel <qemu-devel@nongnu.org>,
"qemu-ppc@nongnu.org" <qemu-ppc@nongnu.org>
Subject: Re: [Qemu-devel] [Qemu-ppc] standard test image not booting with qemu-system-ppc
Date: Tue, 4 Feb 2014 18:18:23 +0000 [thread overview]
Message-ID: <20140204181822.GH1775@perard.uk.xensource.com> (raw)
In-Reply-To: <52F0E883.1020704@redhat.com>
On Tue, Feb 04, 2014 at 02:17:55PM +0100, Paolo Bonzini wrote:
> Il 04/02/2014 08:55, Alexander Graf ha scritto:
> >> With this change, the
> >> memory system is now refusing to allow an access of size
> >> 2 through, because it's greater than the region length. So
> >
> > Ouch. Yes, for ioport reads/writes we definitely have to only cap the port range, not the length.
>
> We can do it in general for MMIO. Something like this?
>
> diff --git a/exec.c b/exec.c
> index 9ad0a4b..9a1eef3 100644
> --- a/exec.c
> +++ b/exec.c
> @@ -325,7 +325,7 @@ address_space_translate_internal(AddressSpaceDispatch *d, hwaddr addr, hwaddr *x
> hwaddr *plen, bool resolve_subpage)
> {
> MemoryRegionSection *section;
> - Int128 diff, diff_page;
> + Int128 diff;
>
> section = address_space_lookup_region(d, addr, resolve_subpage);
> /* Compute offset within MemoryRegionSection */
> @@ -334,9 +334,7 @@ address_space_translate_internal(AddressSpaceDispatch *d, hwaddr addr, hwaddr *x
> /* Compute offset within MemoryRegion */
> *xlat = addr + section->offset_within_region;
>
> - diff_page = int128_make64(((addr & TARGET_PAGE_MASK) + TARGET_PAGE_SIZE) - addr);
> diff = int128_sub(section->mr->size, int128_make64(addr));
> - diff = int128_min(diff, diff_page);
> *plen = int128_get64(int128_min(diff, int128_make64(*plen)));
> return section;
> }
> @@ -370,6 +368,11 @@ MemoryRegion *address_space_translate(AddressSpace *as, hwaddr addr,
> as = iotlb.target_as;
> }
>
> + if (memory_access_is_direct(mr, is_write)) {
> + hwaddr page = (addr & TARGET_PAGE_MASK) + TARGET_PAGE_SIZE - addr;
> + len = MIN(page, len);
> + }
> +
> *plen = len;
> *xlat = addr;
> return mr;
>
>
> Stefano, Anthony, can you test it on Xen?
This patches works fine (after adding a prototype for
memory_access_is_direct before the function).
--
Anthony PERARD
prev parent reply other threads:[~2014-02-04 18:18 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <246b6975027245a0bc428eb33808390d@CO1PR05MB490.namprd05.prod.outlook.com>
[not found] ` <52EFFFC1.7040303@ilande.co.uk>
2014-02-03 21:13 ` [Qemu-devel] [Qemu-ppc] standard test image not booting with qemu-system-ppc Alexander Graf
2014-02-03 22:58 ` Alexander Graf
2014-02-03 23:28 ` Alexander Graf
2014-02-04 0:44 ` Peter Maydell
2014-02-04 7:55 ` Alexander Graf
2014-02-04 13:17 ` Paolo Bonzini
2014-02-04 14:37 ` Stefano Stabellini
2014-02-04 18:18 ` Anthony PERARD [this message]
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=20140204181822.GH1775@perard.uk.xensource.com \
--to=anthony.perard@citrix.com \
--cc=agraf@suse.de \
--cc=mark.cave-ayland@ilande.co.uk \
--cc=mjt@tls.msk.ru \
--cc=nitins@juniper.net \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=stefano.stabellini@eu.citrix.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).