From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:46681) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UgfbC-0002Uz-9q for qemu-devel@nongnu.org; Sun, 26 May 2013 14:23:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ugfb9-0005wd-6U for qemu-devel@nongnu.org; Sun, 26 May 2013 14:23:18 -0400 Received: from mail-ee0-f48.google.com ([74.125.83.48]:54770) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ugfb8-0005wN-UD for qemu-devel@nongnu.org; Sun, 26 May 2013 14:23:15 -0400 Received: by mail-ee0-f48.google.com with SMTP id b47so3417904eek.7 for ; Sun, 26 May 2013 11:23:13 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <51A25306.9000907@redhat.com> Date: Sun, 26 May 2013 20:23:02 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1369133851-1894-1-git-send-email-pbonzini@redhat.com> <1369133851-1894-18-git-send-email-pbonzini@redhat.com> <51A05CDF.1090106@web.de> <51A06C9B.5060302@redhat.com> <51A09018.7000901@web.de> <51A09E6F.7030109@redhat.com> <51A0A0D5.5000706@web.de> <51A1CF4C.2070903@redhat.com> <51A1D1FA.5070206@web.de> In-Reply-To: <51A1D1FA.5070206@web.de> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 17/30] memory: add address_space_translate List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jan Kiszka Cc: peter.maydell@linaro.org, qemu-devel@nongnu.org, David Gibson -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Il 26/05/2013 11:12, Jan Kiszka ha scritto: > On 2013-05-26 11:01, Paolo Bonzini wrote: >> Il 25/05/2013 13:30, Jan Kiszka ha scritto: >>> On 2013-05-25 13:20, Paolo Bonzini wrote: >>>> Il 25/05/2013 12:19, Jan Kiszka ha scritto: >>>>> addr -= section->offset_within_address_space; - len >>>>> = MIN(section->size - addr, len); >>>> ^^^^^^^^^^^^^ ^^^^ >>>> >>>> This is the size of a section minus an offset in the >>>> section. >>>> >>>>> + diff = int128_sub(section->mr->size, >>>>> int128_make64(addr)); >>>> ^^^^^^^^^^^^^^^^^ ^^^^ >>>> >>>> This is the size of a region minus the same offset in the >>>> section. >>>> >>>>> + len = MIN(int128_get64(diff), len); >>>>> >>>>> /* Compute offset within MemoryRegion */ addr += >>>>> section->offset_within_region; >>>> >>>> So this has to be moved above. >> >>> Right, fixed. >> >>>> Do you have a branch pushed somewhere that I can test >>>> against? >> >>> git://git.kiszka.org/qemu.git queues/ioport >> >> And another thing... in "ioport: Switch dispatching to memory >> core layer", could you put memory_region_iorange_read/write in >> mr->ops->read/write instead of adding an "if" in the dispatch >> routines? > > Not trivially because mr->opaque is passed to the read/write > handler, but memory_region_iorange_read/write needs the region. Can > add more data structures to handles this, but what does it buy us? It's simpler, and I think it lets us remove ops->old_portio too. We can have something like typedef MemoryRegionPortioList { MemoryRegion mr; void *piolist_opaque; MemoryRegionPortio pio[]; } then you can set mr->opaque == mr. It's more similar to how other regions are implemented, e.g. subpages. Paolo -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQIcBAEBAgAGBQJRolMGAAoJEBvWZb6bTYbym5wP/izYQtpCSLhiAe6LiyN5cSVj wMe+gSqhqyvi8Ho/GewilHlp1L0UKXQs18KhKqZbEtVETFdvKYoU+sJCPqWbRThW Gj62dfo1Zn814gnv/CxiebslcI5fiU2UrHtpW1oXBKCZWmLJrfZSJqT5K7o1Z8Y3 qRDcR2sIISIQgAxM/n2EbuJWq/v50BUCDOXgpT3eUrq3rvdQHbh/Ym+y8Zd74sXl VhK3UmP17ro0YPLtImForhrFutgavtgKuKCVvMTkD04ZLrWrW+QdXJmGl+LuCp+M L/ib7jaR/4uPJ1RiDPbZexKc956yRsA5gzvJo9kHE0B6IipM+uqVCbrfk96kWrAC Cg3qGn26cT/bc4zNF7NudJxAErVaHf220iJecoqFXNi6OwZTM6IgHlVH58l+yrRE swQlxqQHQoYEzm4ZzsuK9C9Y50Y4C6G0LzkEWeyvYi5UdbOxt/hl1yh0pdSnhSSx 47Hw28nZgceDpcySv/Deb3zBzw/Pxx1Z3wkTxMhVpZ6t3Bot/T9hmkGQyuFqvXWF cdrJEdYmJ2CEkmY2uwKUWCZeMzNtR+qfij+QlcI9RjFoVlmlOySJmBwR55Y7yu5m H4wRZjeQ8PtfpZH/NmmwkNPOxaghDTaUn9k9/rEQzCDM9b17ddovvDI8JYqo9oaa K1di55883LPNfkvycya3 =dJkN -----END PGP SIGNATURE-----