From: Cornelia Huck <cornelia.huck@de.ibm.com>
To: Alexander Graf <agraf@suse.de>
Cc: qemu-devel <qemu-devel@nongnu.org>, KVM <kvm@vger.kernel.org>,
linux-s390 <linux-s390@vger.kernel.org>,
Marcelo Tosatti <mtosatti@redhat.com>,
Gleb Natapov <gleb@redhat.com>,
Anthony Liguori <aliguori@us.ibm.com>,
Christian Borntraeger <borntraeger@de.ibm.com>,
Carsten Otte <cotte@de.ibm.com>,
Heiko Carstens <heiko.carstens@de.ibm.com>,
Martin Schwidefsky <schwidefsky@de.ibm.com>,
Sebastian Ott <sebott@linux.vnet.ibm.com>
Subject: Re: [PATCH 4/8] s390: Add channel I/O instructions.
Date: Tue, 11 Dec 2012 13:53:51 +0100 [thread overview]
Message-ID: <20121211135351.2e79daa6@BR9GNB5Z> (raw)
In-Reply-To: <F6B1809B-676A-44CB-A054-B86BF0D537DA@suse.de>
On Tue, 11 Dec 2012 11:18:44 +0100
Alexander Graf <agraf@suse.de> wrote:
>
> On 10.12.2012, at 10:18, Cornelia Huck wrote:
>
> > On Mon, 10 Dec 2012 10:00:16 +0100
> > Alexander Graf <agraf@suse.de> wrote:
> >
> >>
> >>
> >> On 07.12.2012, at 13:50, Cornelia Huck <cornelia.huck@de.ibm.com> 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.
WARNING: multiple messages have this Message-ID (diff)
From: Cornelia Huck <cornelia.huck@de.ibm.com>
To: Alexander Graf <agraf@suse.de>
Cc: linux-s390 <linux-s390@vger.kernel.org>,
Anthony Liguori <aliguori@us.ibm.com>, KVM <kvm@vger.kernel.org>,
Gleb Natapov <gleb@redhat.com>, Carsten Otte <cotte@de.ibm.com>,
Sebastian Ott <sebott@linux.vnet.ibm.com>,
Marcelo Tosatti <mtosatti@redhat.com>,
Heiko Carstens <heiko.carstens@de.ibm.com>,
qemu-devel <qemu-devel@nongnu.org>,
Christian Borntraeger <borntraeger@de.ibm.com>,
Martin Schwidefsky <schwidefsky@de.ibm.com>
Subject: Re: [Qemu-devel] [PATCH 4/8] s390: Add channel I/O instructions.
Date: Tue, 11 Dec 2012 13:53:51 +0100 [thread overview]
Message-ID: <20121211135351.2e79daa6@BR9GNB5Z> (raw)
In-Reply-To: <F6B1809B-676A-44CB-A054-B86BF0D537DA@suse.de>
On Tue, 11 Dec 2012 11:18:44 +0100
Alexander Graf <agraf@suse.de> wrote:
>
> On 10.12.2012, at 10:18, Cornelia Huck wrote:
>
> > On Mon, 10 Dec 2012 10:00:16 +0100
> > Alexander Graf <agraf@suse.de> wrote:
> >
> >>
> >>
> >> On 07.12.2012, at 13:50, Cornelia Huck <cornelia.huck@de.ibm.com> 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.
next prev parent reply other threads:[~2012-12-11 12:53 UTC|newest]
Thread overview: 78+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-07 12:50 [RFC PATCH v4 0/8] s390: channel I/O support in qemu Cornelia Huck
2012-12-07 12:50 ` [Qemu-devel] " Cornelia Huck
2012-12-07 12:50 ` [PATCH 1/8] Update linux headers Cornelia Huck
2012-12-07 12:50 ` [Qemu-devel] " Cornelia Huck
2012-12-07 13:01 ` Peter Maydell
2012-12-07 13:01 ` Peter Maydell
2012-12-07 14:08 ` Cornelia Huck
2012-12-07 14:08 ` Cornelia Huck
2012-12-07 12:50 ` [PATCH 2/8] s390: Channel I/O basic defintions Cornelia Huck
2012-12-07 12:50 ` [Qemu-devel] " Cornelia Huck
2012-12-10 8:07 ` Alexander Graf
2012-12-10 8:07 ` [Qemu-devel] " Alexander Graf
2012-12-10 10:18 ` Cornelia Huck
2012-12-10 10:18 ` [Qemu-devel] " Cornelia Huck
2012-12-11 10:27 ` Alexander Graf
2012-12-11 10:27 ` [Qemu-devel] " Alexander Graf
2012-12-11 12:48 ` Cornelia Huck
2012-12-11 12:48 ` [Qemu-devel] " Cornelia Huck
2012-12-07 12:50 ` [PATCH 3/8] s390: I/O interrupt and machine check injection Cornelia Huck
2012-12-07 12:50 ` [Qemu-devel] " Cornelia Huck
2012-12-10 8:20 ` Alexander Graf
2012-12-10 8:20 ` [Qemu-devel] " Alexander Graf
2012-12-10 10:27 ` Cornelia Huck
2012-12-10 10:27 ` [Qemu-devel] " Cornelia Huck
2012-12-11 0:26 ` Rob Landley
2012-12-11 0:26 ` [Qemu-devel] " Rob Landley
2012-12-11 12:17 ` Cornelia Huck
2012-12-11 12:17 ` Cornelia Huck
2012-12-11 10:29 ` Alexander Graf
2012-12-11 10:29 ` [Qemu-devel] " Alexander Graf
2012-12-11 12:50 ` Cornelia Huck
2012-12-11 12:50 ` [Qemu-devel] " Cornelia Huck
2012-12-07 12:50 ` [PATCH 4/8] s390: Add channel I/O instructions Cornelia Huck
2012-12-07 12:50 ` [Qemu-devel] " Cornelia Huck
2012-12-10 9:00 ` Alexander Graf
2012-12-10 9:00 ` [Qemu-devel] " Alexander Graf
2012-12-10 9:18 ` Cornelia Huck
2012-12-10 9:18 ` [Qemu-devel] " Cornelia Huck
2012-12-11 10:18 ` Alexander Graf
2012-12-11 10:18 ` [Qemu-devel] " Alexander Graf
2012-12-11 12:53 ` Cornelia Huck [this message]
2012-12-11 12:53 ` Cornelia Huck
2012-12-07 12:50 ` [PATCH 5/8] s390: Virtual channel subsystem support Cornelia Huck
2012-12-07 12:50 ` [Qemu-devel] " Cornelia Huck
2012-12-07 12:50 ` [PATCH 6/8] s390: Wire up channel I/O in kvm Cornelia Huck
2012-12-07 12:50 ` [Qemu-devel] " Cornelia Huck
2012-12-10 9:40 ` Alexander Graf
2012-12-10 9:40 ` [Qemu-devel] " Alexander Graf
2012-12-10 10:29 ` Cornelia Huck
2012-12-10 10:29 ` [Qemu-devel] " Cornelia Huck
2012-12-07 12:50 ` [PATCH 7/8] s390-virtio: Factor out some initialization code Cornelia Huck
2012-12-07 12:50 ` [Qemu-devel] " Cornelia Huck
2012-12-07 12:50 ` [PATCH 8/8] s390: Add new channel I/O based virtio transport Cornelia Huck
2012-12-07 12:50 ` [Qemu-devel] " Cornelia Huck
2012-12-11 10:53 ` Alexander Graf
2012-12-11 10:53 ` [Qemu-devel] " Alexander Graf
2012-12-11 12:06 ` Christian Borntraeger
2012-12-11 12:06 ` [Qemu-devel] " Christian Borntraeger
2012-12-12 0:38 ` Alexander Graf
2012-12-12 0:38 ` [Qemu-devel] " Alexander Graf
2012-12-11 13:03 ` Cornelia Huck
2012-12-11 13:03 ` [Qemu-devel] " Cornelia Huck
2012-12-12 0:39 ` Alexander Graf
2012-12-12 0:39 ` [Qemu-devel] " Alexander Graf
2013-01-16 13:24 ` Alexander Graf
2013-01-16 13:24 ` [Qemu-devel] " Alexander Graf
2013-01-16 13:53 ` Alexander Graf
2013-01-16 13:53 ` Alexander Graf
2013-01-16 13:58 ` Cornelia Huck
2013-01-16 13:58 ` Cornelia Huck
2013-01-16 16:46 ` Richard Henderson
2013-01-16 16:46 ` Richard Henderson
2013-01-16 17:05 ` Alexander Graf
2013-01-16 17:05 ` Alexander Graf
2012-12-10 8:02 ` [RFC PATCH v4 0/8] s390: channel I/O support in qemu Alexander Graf
2012-12-10 8:02 ` [Qemu-devel] " Alexander Graf
2012-12-10 10:34 ` Cornelia Huck
2012-12-10 10:34 ` [Qemu-devel] " Cornelia Huck
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20121211135351.2e79daa6@BR9GNB5Z \
--to=cornelia.huck@de.ibm.com \
--cc=agraf@suse.de \
--cc=aliguori@us.ibm.com \
--cc=borntraeger@de.ibm.com \
--cc=cotte@de.ibm.com \
--cc=gleb@redhat.com \
--cc=heiko.carstens@de.ibm.com \
--cc=kvm@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=mtosatti@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=schwidefsky@de.ibm.com \
--cc=sebott@linux.vnet.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.