All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Jan Kiszka <jan.kiszka@siemens.com>
Cc: "Liu Ping Fan" <pingfank@linux.vnet.ibm.com>,
	qemu-devel <qemu-devel@nongnu.org>,
	"Andreas Färber" <afaerber@suse.de>
Subject: Re: [Qemu-devel] [RFC][PATCH 09/15] memory: Introduce address_space_lookup_region
Date: Mon, 06 May 2013 16:54:46 +0200	[thread overview]
Message-ID: <5187C436.7020403@redhat.com> (raw)
In-Reply-To: <5187C388.8070202@siemens.com>

Il 06/05/2013 16:51, Jan Kiszka ha scritto:
> On 2013-05-06 16:39, Paolo Bonzini wrote:
>> Il 06/05/2013 16:26, Jan Kiszka ha scritto:
>>> This new service so far only replaces phys_page_find as public API. In a
>>> follow-up step, it will return the effective memory region for the
>>> specified address, i.e. after resolving what are currently sub-pages.
>>> Moreover, it will also once encapsulate locking and reference counting
>>> when we introduce BQL-free dispatching.
>>
>> In my IOMMU rebase I have a similar function:
>>
>> /* address_space_translate: translate an address range into an address space
>>  * into a MemoryRegionSection and an address range into that section.
>>  *
>>  * @as: #AddressSpace to be accessed
>>  * @addr: address within that address space
>>  * @xlat: pointer to address within the returned memory region section's
>>  * #MemoryRegion.
>>  * @len: pointer to length
>>  * @is_write: indicates the transfer direction
>>  */
>> MemoryRegionSection *address_space_translate(AddressSpace *as, hwaddr addr,
>>                                              hwaddr *xlat, hwaddr *len,
>>                                              bool is_write);
>>
>> It wraps (actually, replaces) both phys_page_find and
>> memory_region_section_addr.
> 
> Good, looks like we are heading in similar directions. What is the
> purpose of len? When does is_write matter?

Both matter when adding the IOMMU.  is_write is needed to check for
permissions, and len because the translation will be valid for one page
only (not for the full size of the MemoryRegion.

I can implement address_space_translate on top of
address_space_lookup_region and include your next patch too, so we're
fine here.

Paolo

> In a later step, this should become something like
> address_space_get_region_ref (to be paired with memory_region_unref,
> once done). So this one also takes care of incrementing the reference
> counter or acquiring the BQL, as necessary. Currently, it asks the
> caller to specify if the BQL is already held, but that will change.
> 
> Jan
> 

  reply	other threads:[~2013-05-06 14:55 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-06 14:26 [Qemu-devel] [RFC][PATCH 00/15] Refactor portio dispatching Jan Kiszka
2013-05-06 14:26 ` [Qemu-devel] [RFC][PATCH 01/15] adlib: replace register_ioport* Jan Kiszka
2013-05-06 14:26 ` [Qemu-devel] [RFC][PATCH 02/15] applesmc: " Jan Kiszka
2013-05-06 14:26 ` [Qemu-devel] [RFC][PATCH 03/15] wdt_ib700: " Jan Kiszka
2013-05-06 14:26 ` [Qemu-devel] [RFC][PATCH 04/15] i82374: " Jan Kiszka
2013-05-06 14:26 ` [Qemu-devel] [RFC][PATCH 05/15] prep: " Jan Kiszka
2013-05-06 14:43   ` Andreas Färber
2013-05-06 14:26 ` [Qemu-devel] [RFC][PATCH 06/15] vt82c686: " Jan Kiszka
2013-05-06 14:26 ` [Qemu-devel] [RFC][PATCH 07/15] Privatize register_ioport_read/write Jan Kiszka
2013-05-06 14:26 ` [Qemu-devel] [RFC][PATCH 08/15] isa: implement isa_is_ioport_assigned via memory_region_find Jan Kiszka
2013-05-06 14:55   ` Andreas Färber
2013-05-06 14:59     ` Paolo Bonzini
2013-05-06 15:02       ` Jan Kiszka
2013-05-06 15:10         ` Paolo Bonzini
2013-05-06 14:59     ` Jan Kiszka
2013-05-06 14:26 ` [Qemu-devel] [RFC][PATCH 09/15] memory: Introduce address_space_lookup_region Jan Kiszka
2013-05-06 14:39   ` Paolo Bonzini
2013-05-06 14:51     ` Jan Kiszka
2013-05-06 14:54       ` Paolo Bonzini [this message]
2013-05-06 14:26 ` [Qemu-devel] [RFC][PATCH 10/15] memory: Rework sub-page handling Jan Kiszka
2013-05-06 20:09   ` Paolo Bonzini
2013-05-06 20:46   ` Peter Maydell
2013-05-07  9:48     ` Paolo Bonzini
2013-05-07 12:35     ` Paolo Bonzini
2013-05-07 17:26       ` Jan Kiszka
2013-05-07 18:23         ` Jan Kiszka
2013-05-08  8:41           ` Paolo Bonzini
2013-05-06 14:26 ` [Qemu-devel] [RFC][PATCH 11/15] memory: Allow unaligned address_space_rw Jan Kiszka
2013-05-06 14:55   ` Paolo Bonzini
2013-05-06 14:58     ` Jan Kiszka
2013-05-06 15:01       ` Paolo Bonzini
2013-05-06 14:26 ` [Qemu-devel] [RFC][PATCH 12/15] vmware-vga: Accept unaligned I/O accesses Jan Kiszka
2013-05-06 14:40   ` Paolo Bonzini
2013-05-06 14:45     ` Jan Kiszka
2013-05-06 14:26 ` [Qemu-devel] [RFC][PATCH 13/15] ioport: Switch dispatching to memory core layer Jan Kiszka
2013-05-06 14:26 ` [Qemu-devel] [RFC][PATCH 14/15] ioport: Remove unused old dispatching services Jan Kiszka
2013-05-06 14:26 ` [Qemu-devel] [RFC][PATCH 15/15] ioport: Move IOPortRead/WriteFunc typedefs to memory.h Jan Kiszka
2013-05-06 14:50 ` [Qemu-devel] [RFC][PATCH 00/15] Refactor portio dispatching Andreas Färber
2013-05-06 14:54   ` Jan Kiszka

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=5187C436.7020403@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=afaerber@suse.de \
    --cc=jan.kiszka@siemens.com \
    --cc=pingfank@linux.vnet.ibm.com \
    --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.