From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52541) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bTBo1-0000yE-LK for qemu-devel@nongnu.org; Fri, 29 Jul 2016 13:42:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bTBnz-0002fJ-Lt for qemu-devel@nongnu.org; Fri, 29 Jul 2016 13:42:40 -0400 Received: from mail-vk0-x230.google.com ([2607:f8b0:400c:c05::230]:34856) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bTBnz-0002fE-Hj for qemu-devel@nongnu.org; Fri, 29 Jul 2016 13:42:39 -0400 Received: by mail-vk0-x230.google.com with SMTP id w127so59403019vkh.2 for ; Fri, 29 Jul 2016 10:42:39 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <808c92d5d8b54da500fbe5426d7dce5b3034ffd1.1468454556.git.alistair.francis@xilinx.com> References: <808c92d5d8b54da500fbe5426d7dce5b3034ffd1.1468454556.git.alistair.francis@xilinx.com> From: Peter Maydell Date: Fri, 29 Jul 2016 18:42:19 +0100 Message-ID: Content-Type: text/plain; charset=UTF-8 Subject: Re: [Qemu-devel] [PATCH v9 6/8] loader: Add AddressSpace loading support to targphys List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alistair Francis Cc: QEMU Developers , Peter Crosthwaite , Markus Armbruster , Christopher Covington , Paolo Bonzini On 14 July 2016 at 01:03, Alistair Francis wrote: > Add a new function load_image_targphys_as() that allows the caller > to specify an AddressSpace to use when loading a targphys. The > original load_image_targphys() function doesn't have any change in > functionality. > > Signed-off-by: Alistair Francis > --- > > hw/core/loader.c | 10 ++++++++-- > include/hw/loader.h | 5 +++++ > 2 files changed, 13 insertions(+), 2 deletions(-) > > diff --git a/hw/core/loader.c b/hw/core/loader.c > index 861dbc2..31a2d4a 100644 > --- a/hw/core/loader.c > +++ b/hw/core/loader.c > @@ -133,10 +133,16 @@ ssize_t read_targphys(const char *name, > return did; > } > > -/* return the size or -1 if error */ > int load_image_targphys(const char *filename, > hwaddr addr, uint64_t max_sz) > { > + return load_image_targphys_as(filename, addr, max_sz, NULL); > +} > + > +/* return the size or -1 if error */ > +int load_image_targphys_as(const char *filename, > + hwaddr addr, uint64_t max_sz, AddressSpace *as) > +{ > int size; > > size = get_image_size(filename); > @@ -144,7 +150,7 @@ int load_image_targphys(const char *filename, > return -1; > } > if (size > 0) { > - rom_add_file_fixed(filename, addr, -1); > + rom_add_file_fixed_as(filename, addr, -1, as); > } > return size; > } > diff --git a/include/hw/loader.h b/include/hw/loader.h > index ede98f6..1a9053f 100644 > --- a/include/hw/loader.h > +++ b/include/hw/loader.h > @@ -16,6 +16,9 @@ int load_image(const char *filename, uint8_t *addr); /* deprecated */ > ssize_t load_image_size(const char *filename, void *addr, size_t size); > int load_image_targphys(const char *filename, hwaddr, > uint64_t max_sz); > +int load_image_targphys_as(const char *filename, > + hwaddr addr, uint64_t max_sz, AddressSpace *as); > + Again, code changes are fine but could we have a doc comment? thanks -- PMM