From mboxrd@z Thu Jan 1 00:00:00 1970 From: Cornelia Huck Subject: Re: [PATCH 4/8] s390: Add channel I/O instructions. Date: Tue, 11 Dec 2012 13:53:51 +0100 Message-ID: <20121211135351.2e79daa6@BR9GNB5Z> 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 Cc: qemu-devel , KVM , linux-s390 , Marcelo Tosatti , Gleb Natapov , Anthony Liguori , Christian Borntraeger , Carsten Otte , Heiko Carstens , Martin Schwidefsky , Sebastian Ott To: Alexander Graf Return-path: Received: from e06smtp14.uk.ibm.com ([195.75.94.110]:43708 "EHLO e06smtp14.uk.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753001Ab2LKMx7 (ORCPT ); Tue, 11 Dec 2012 07:53:59 -0500 Received: from /spool/local by e06smtp14.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 11 Dec 2012 12:53:33 -0000 In-Reply-To: Sender: kvm-owner@vger.kernel.org List-ID: 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.