From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:52241) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TiPLX-0005aM-6A for qemu-devel@nongnu.org; Tue, 11 Dec 2012 07:54:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TiPLR-00069C-31 for qemu-devel@nongnu.org; Tue, 11 Dec 2012 07:54:03 -0500 Received: from e06smtp18.uk.ibm.com ([195.75.94.114]:48932) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TiPLQ-000697-QO for qemu-devel@nongnu.org; Tue, 11 Dec 2012 07:53:57 -0500 Received: from /spool/local by e06smtp18.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 11 Dec 2012 12:53:39 -0000 Received: from d06av06.portsmouth.uk.ibm.com (d06av06.portsmouth.uk.ibm.com [9.149.37.217]) by b06cxnps4076.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id qBBCrkcO56164518 for ; Tue, 11 Dec 2012 12:53:46 GMT Received: from d06av06.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av06.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id qBBCrrxn005576 for ; Tue, 11 Dec 2012 05:53:53 -0700 Date: Tue, 11 Dec 2012 13:53:51 +0100 From: Cornelia Huck Message-ID: <20121211135351.2e79daa6@BR9GNB5Z> In-Reply-To: References: <1354884626-15060-1-git-send-email-cornelia.huck@de.ibm.com> <1354884626-15060-5-git-send-email-cornelia.huck@de.ibm.com> <7024DD5C-C290-48C8-A1F2-8C8831011D1C@suse.de> <20121210101805.6f4645cd@BR9GNB5Z> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 4/8] s390: Add channel I/O instructions. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexander Graf Cc: linux-s390 , Anthony Liguori , KVM , Gleb Natapov , Carsten Otte , Sebastian Ott , Marcelo Tosatti , Heiko Carstens , qemu-devel , Christian Borntraeger , Martin Schwidefsky On Tue, 11 Dec 2012 11:18:44 +0100 Alexander Graf wrote: > > On 10.12.2012, at 10:18, Cornelia Huck wrote: > > > On Mon, 10 Dec 2012 10:00:16 +0100 > > Alexander Graf wrote: > > > >> > >> > >> On 07.12.2012, at 13:50, Cornelia Huck wrote: > >>> +/* Special handling for the prefix page. */ > >>> +static void *s390_get_address(CPUS390XState *env, ram_addr_t guest_addr) > >>> +{ > >>> + if (guest_addr < 8192) { > >>> + guest_addr += env->psa; > >>> + } else if ((env->psa <= guest_addr) && (guest_addr < env->psa + 8192)) { > >>> + guest_addr -= env->psa; > >>> + } > >>> + > >>> + return qemu_get_ram_ptr(guest_addr); > >> > >> Do we actually need this? > > > > Yes. I've seen failures for I/O instructions using the lowcore (which > > the Linux kernel likes to do). > > Then we want an s390 generic function that does this, not an io specific one though, right? Also qemu_get_ram_ptr is a no-go, as it doesn't do boundary checks. Oh, wasn't aware of that. > > So what we really want is something like s390_cpu_physical_memory_map(env, ...) with a special case on the lowcore. Let's see how this works out. > >>> + addr = ipb >> 28; > >>> + if (addr > 0) { > >>> + addr = env->regs[addr]; > >>> + } > >>> + addr += (ipb & 0xfff0000) >> 16; > >> > >> This adds the upper bits twice. Are you sire that's correct? > > > > If addr was 0, it doesn't. If addr was > 0 before, we grabbed the > > address from the corresponding register and want to add to it. > > This is a very confusing way of writing what you're trying to express then :). How about > > hwaddr addr = 0; > > reg = ipb >> 28; > if (reg) { > addr = env->regs[reg]; > } > addr += (ipb >> 16) & 0xfff0; I've moved this to a helper function anyway - but this looks a bit more readable, yes.