From: Avi Kivity <avi@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: Paul Brook <paul@codesourcery.com>,
qemu-devel@nongnu.org, patches@linaro.org
Subject: Re: [Qemu-devel] [PATCH] exec.c: Allow memory region start_addr and region_offset to vary in low bits
Date: Mon, 05 Dec 2011 15:40:35 +0200 [thread overview]
Message-ID: <4EDCC9D3.7040800@redhat.com> (raw)
In-Reply-To: <1323082897-15249-1-git-send-email-peter.maydell@linaro.org>
On 12/05/2011 01:01 PM, Peter Maydell wrote:
> Fix a long-standing deficiency of cpu_register_physical_memory_log()
> where the start address and region offset had to have the same low
> bits (otherwise the IO functions would be passed an incorrect address
> offset). This was most likely to bite when registering memory regions
> which started at a non-page-boundary.
>
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
> This is such a small change to correct this issue that I'm kind of
> suspicious of it :-)
Your instincts are correct, unfortunately.
> @@ -2677,7 +2674,11 @@ void cpu_register_physical_memory_log(target_phys_addr_t start_addr,
> if (phys_offset == IO_MEM_UNASSIGNED) {
> region_offset = start_addr;
> }
> - region_offset &= TARGET_PAGE_MASK;
> + /* Adjust the region offset to account for the start_addr possibly
> + * not being page aligned, so we end up passing the IO functions
> + * the true offset from the start of the region.
> + */
> + region_offset -= (start_addr & ~TARGET_PAGE_MASK);
> size = (size + TARGET_PAGE_SIZE - 1) & TARGET_PAGE_MASK;
> end_addr = start_addr + (target_phys_addr_t)size;
>
region_offset is added to iotlb in tlb_set_page(), smashing the low bits
with your change. It's safe in subpage, since that doesn't happen there.
--
error compiling committee.c: too many arguments to function
next prev parent reply other threads:[~2011-12-05 13:40 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-05 11:01 [Qemu-devel] [PATCH] exec.c: Allow memory region start_addr and region_offset to vary in low bits Peter Maydell
2011-12-05 13:40 ` Avi Kivity [this message]
2011-12-05 14:01 ` Peter Maydell
2011-12-05 14:14 ` Avi Kivity
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=4EDCC9D3.7040800@redhat.com \
--to=avi@redhat.com \
--cc=patches@linaro.org \
--cc=paul@codesourcery.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.