All of lore.kernel.org
 help / color / mirror / Atom feed
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 16:14:20 +0200	[thread overview]
Message-ID: <4EDCD1BC.7060109@redhat.com> (raw)
In-Reply-To: <CAFEAcA-bB6Ptn4QaaJ2Y9GhvyuTBJHhL5gA2jMfXyRFaKGS8jQ@mail.gmail.com>

On 12/05/2011 04:01 PM, Peter Maydell wrote:
> On 5 December 2011 13:40, Avi Kivity <avi@redhat.com> wrote:
> > On 12/05/2011 01:01 PM, Peter Maydell wrote:
> >> @@ -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.
>
> OK, but we only need to avoid trashing the bottom 5 bits, right?

All TARGET_PAGE_BITS of them.

> So we could do
>     region_offset -= (start_addr & ~TARGET_PAGE_MASK);
>     if (size >= TARGET_PAGE_SIZE) {
>         region_offset &= ~0x1F; /* can make this a #define IO_MEM_MASK */
>     }
>
> which would allow regions to start on 0x20 granularity, or byte granularity
> if they're less than a page in size (and so guaranteed to be subpages only).
>

An alternative is to stash region_offset somewhere else.  There's
CPUTLBEntry::addend, see comment above its definition.

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

      reply	other threads:[~2011-12-05 14:14 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
2011-12-05 14:01   ` Peter Maydell
2011-12-05 14:14     ` Avi Kivity [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=4EDCD1BC.7060109@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.