From: Vincent Palatin <vpalatin@chromium.org>
To: qemu-devel@nongnu.org
Cc: Salvatore Lionetti <salvatorelionetti@yahoo.it>,
Vincent Palatin <vpalatin@chromium.org>
Subject: [Qemu-devel] [PATCH] fix offset for MMIO subpage access
Date: Wed, 2 Mar 2011 16:23:57 -0500 [thread overview]
Message-ID: <1299101037-14925-1-git-send-email-vpalatin@chromium.org> (raw)
In-Reply-To: <AANLkTin2bMafivJC9ZjBc29mQgeeQsF1w0Aq0Rcym2zC@mail.gmail.com>
When using a MMIO subpage not starting on a page boundary, the offset
value given to the access handler is based on the start of the MMU page
not on the subpage base.
As a consequence, if you are mapping the same subpage sized MMIO device
at different addresses, this is somewhat impractical and confusing since
the same register will be called with different "offset" depending on the
base address.
My proposal is to workaround this by recording the offset in region_offset
field.
Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
---
exec.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/exec.c b/exec.c
index d611100..b59e7c9 100644
--- a/exec.c
+++ b/exec.c
@@ -2626,6 +2626,7 @@ void cpu_register_physical_memory_offset(target_phys_addr_t start_addr,
CHECK_SUBPAGE(addr, start_addr, start_addr2, end_addr, end_addr2,
need_subpage);
if (need_subpage) {
+ region_offset -= (start_addr & ~TARGET_PAGE_MASK);
if (!(orig_memory & IO_MEM_SUBPAGE)) {
subpage = subpage_init((addr & TARGET_PAGE_MASK),
&p->phys_offset, orig_memory,
@@ -2658,6 +2659,7 @@ void cpu_register_physical_memory_offset(target_phys_addr_t start_addr,
end_addr2, need_subpage);
if (need_subpage) {
+ region_offset -= (start_addr & ~TARGET_PAGE_MASK);
subpage = subpage_init((addr & TARGET_PAGE_MASK),
&p->phys_offset, IO_MEM_UNASSIGNED,
addr & TARGET_PAGE_MASK);
--
1.7.3.1
next prev parent reply other threads:[~2011-03-02 21:24 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-24 9:08 [Qemu-devel] Memory Map Salvatore Lionetti
2011-02-25 16:10 ` Blue Swirl
2011-03-02 17:11 ` Salvatore Lionetti
2011-03-02 21:13 ` Vincent Palatin
2011-03-02 21:23 ` Vincent Palatin [this message]
2011-03-03 9:20 ` Salvatore Lionetti
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=1299101037-14925-1-git-send-email-vpalatin@chromium.org \
--to=vpalatin@chromium.org \
--cc=qemu-devel@nongnu.org \
--cc=salvatorelionetti@yahoo.it \
/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).