qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 08/20] memory: store MemoryRegionSection pointers in phys_map
Date: Thu, 08 Mar 2012 11:50:49 +0200	[thread overview]
Message-ID: <4F5880F9.2080905@redhat.com> (raw)
In-Reply-To: <CAFEAcA_hCs2eOA9t_YfJcUWs9zKvDKN-zCDndgXcx6J_4u9WaQ@mail.gmail.com>

On 03/07/2012 09:32 PM, Peter Maydell wrote:
> On 7 March 2012 17:49, Peter Maydell <peter.maydell@linaro.org> wrote:
> > git bisect blames this commit (5312bd8b3) for causing a Linux kernel
> > on spitz to produce a bunch of pxa2xx_i2c warnings that weren't
> > being emitted before:
>
> What seems to happen here is that we register a memory region
> (this is for the second i2c device in hw/pxa2xx.c):
>
>     memory_region_init_io(&s->iomem, &pxa2xx_i2c_ops, s,
>                           "pxa2xx-i2x", s->region_size);
>
> where region_size is 0x100. We then map it at 0x40f00100
> (via sysbus_mmio_map). This used to result in our read and write
> functions being called with offsets from the start of the page,
> so in this case for the register at 0x90 into the device the
> passed in addr would be 0x190. There is some hackery in pxa2xx_i2c_init
> to work out what the offset is from the start of the region
> when we map the device, we pass it in as a qdev 'offset'
> property, and then read/write can fix things up to get the
> actual register offset.
>
> With this commit read and write functions are now passed the actual
> offset from the start of the device region, ie 0x90. So the hackery
> ends up doing fixing up it doesn't need to do, and generates negative
> offsets which cause the diagnostic messages.
>
> So it seems like the new behaviour is more like the right thing,
> but was it an intentional change? 

I don't recall whether it was intentional or not (i.e., whether I was
aware I was changing behaviour or not), but it's certainly the desired
behaviour.

> Should we just drop the offset
> hackery as a workaround for a now-fixed bug?

Yes.  I'll live the patch to you.

>
> Are we running into the "mapping devices at non-page-offsets isn't
> supported" issue here?

It wasn't supported?

>  <optimism>Is that now supported after this
> patch series?</>

I'm sure that there are some rough edges but I made quite an effort to
cover corner cases.  For example, a region that starts and ends and
non-aligned offsets, but spans more than a page, ought to work.

> (I think the other devices I know of which include workarounds
> for being passed relative-to-page-base addresses handle it by
> masking out the high bits of the address, eg arm11mpcore.c,
> so they weren't broken by this commit.)

I assumed this was due to the days where absolute addresses were passed,
but yes.

-- 
error compiling committee.c: too many arguments to function

  reply	other threads:[~2012-03-08  9:51 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-14  9:27 [Qemu-devel] [PATCH 00/20] Reduce storage overhead of memory core Avi Kivity
2012-02-14  9:27 ` [Qemu-devel] [PATCH 01/20] memory: allow MemoryListeners to observe a specific address space Avi Kivity
2012-02-14  9:27 ` [Qemu-devel] [PATCH 02/20] xen: ignore I/O memory regions Avi Kivity
2012-02-14  9:27 ` [Qemu-devel] [PATCH 03/20] memory: split memory listener for the two address spaces Avi Kivity
2012-02-14  9:27 ` [Qemu-devel] [PATCH 04/20] memory: support stateless memory listeners Avi Kivity
2012-02-14  9:27 ` [Qemu-devel] [PATCH 05/20] memory: change memory registration to rebuild the memory map on each change Avi Kivity
2012-02-14  9:27 ` [Qemu-devel] [PATCH 06/20] memory: remove first level of l1_phys_map Avi Kivity
2012-02-14  9:27 ` [Qemu-devel] [PATCH 07/20] memory: unify phys_map last level with intermediate levels Avi Kivity
2012-02-14  9:27 ` [Qemu-devel] [PATCH 08/20] memory: store MemoryRegionSection pointers in phys_map Avi Kivity
2012-03-07 17:49   ` Peter Maydell
2012-03-07 19:32     ` Peter Maydell
2012-03-08  9:50       ` Avi Kivity [this message]
2012-03-08 10:09         ` Peter Maydell
2012-03-08 11:11           ` Avi Kivity
2012-03-08 11:25             ` Peter Maydell
2012-02-14  9:27 ` [Qemu-devel] [PATCH 09/20] memory: compress phys_map node pointers to 16 bits Avi Kivity
2012-02-14  9:27 ` [Qemu-devel] [PATCH 10/20] memory: fix RAM subpages in newly initialized pages Avi Kivity
2012-02-14  9:27 ` [Qemu-devel] [PATCH 11/20] memory: unify the two branches of cpu_register_physical_memory_log() Avi Kivity
2012-02-14  9:27 ` [Qemu-devel] [PATCH 12/20] memory: move tlb flush to MemoryListener commit callback Avi Kivity
2012-02-14  9:27 ` [Qemu-devel] [PATCH 13/20] memory: make phys_page_find() return a MemoryRegionSection Avi Kivity
2012-02-14  9:27 ` [Qemu-devel] [PATCH 14/20] memory: give phys_page_find() its own tree search loop Avi Kivity
2012-02-14  9:27 ` [Qemu-devel] [PATCH 15/20] memory: simplify multipage/subpage registration Avi Kivity
2012-02-14  9:27 ` [Qemu-devel] [PATCH 16/20] memory: replace phys_page_find_alloc() with phys_page_set() Avi Kivity
2012-02-14  9:27 ` [Qemu-devel] [PATCH 17/20] memory: switch phys_page_set() to a recursive implementation Avi Kivity
2012-02-14  9:27 ` [Qemu-devel] [PATCH 18/20] memory: change phys_page_set() to set multiple pages Avi Kivity
2012-02-14  9:27 ` [Qemu-devel] [PATCH 19/20] memory: unify PhysPageEntry::node and ::leaf Avi Kivity
2012-02-14  9:27 ` [Qemu-devel] [PATCH 20/20] memory: allow phys_map tree paths to terminate early 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=4F5880F9.2080905@redhat.com \
    --to=avi@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 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).