From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:58944) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ROthv-0003Rx-GD for qemu-devel@nongnu.org; Fri, 11 Nov 2011 11:12:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ROtht-0002qw-B3 for qemu-devel@nongnu.org; Fri, 11 Nov 2011 11:11:59 -0500 Received: from mail-qw0-f45.google.com ([209.85.216.45]:39456) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ROtht-0002qY-8P for qemu-devel@nongnu.org; Fri, 11 Nov 2011 11:11:57 -0500 Received: by qadz3 with SMTP id z3so5016058qad.4 for ; Fri, 11 Nov 2011 08:11:56 -0800 (PST) MIME-Version: 1.0 In-Reply-To: <4EBD467F.7040107@suse.de> References: <1320887981-2099-1-git-send-email-agraf@suse.de> <4A2D3614-438C-40F4-B3D1-A8ABF30FB82F@suse.de> <4EBD467F.7040107@suse.de> Date: Fri, 11 Nov 2011 16:11:56 +0000 Message-ID: From: Peter Maydell Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH] s390x: initialize virtio dev region List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexander Graf Cc: qemu-devel@nongnu.org On 11 November 2011 15:59, Alexander Graf wrote: > This is the machine init function. The s390 virtio machine's ram layout i= s > defined to be exactly as I posted in the previous post. So there won't be > any ram starts at !=3D 0 or multiple mappings :). That's the layout of the RAM in target_phys_addr_t space. The layout of the ram in ram_addr_t space is not guaranteed to be the same, it just happens to be in this case. >>> On 10.11.2011, at 02:36, Peter Maydell wrote: >> In summary, either: >> (1) you need to ask the memory region for its ram_addr_t >> [there doesn't seem to be an API for this at the moment], >> do arithmetic on ram_addr_t's and use qemu_get_ram_ptr() to >> get a host pointer corresponding to that ram_addr_t >> or (2) you need to do your arithmetic in target_phys_addr_t's >> (and then you can say your RAM starts at physaddr 0, which >> is guaranteed, rather than at ram_addr_t 0, which isn't) >> and use cpu_physical_memory_map/unmap(). > > I still don't get it. What I want is: > > =C2=A0for (i =3D ram_size; i < my_ram_size; i++) > =C2=A0 =C2=A0stb_phys(env, i, 0); > > cpu_physical_memory_map gives me a pointer to the memory region between > ram_size and my_ram_size. I memset(0) it. I don't see how I could possibl= y > have different offsets anywhere. If cpu_physical_memory_map would take > anything different than physical address, a lot of assumptions in QEMU co= de > would break. Yes, so that's option (2) and you need to be using a target_phys_addr_t. -- PMM