qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@redhat.com>
To: Richard Henderson <rth@twiddle.net>,
	Michal Marek <mmarek@suse.com>, Alexander Graf <agraf@suse.de>
Cc: Eric Bischoff <ebischoff@suse.com>,
	Miroslav Benes <mbenes@suse.cz>,
	qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v4] target-s390x: Implement stfl and stfle
Date: Wed, 1 Mar 2017 21:20:50 +0100	[thread overview]
Message-ID: <0ac325ae-6b68-2a03-74a8-c5ab0ebb58e0@redhat.com> (raw)
In-Reply-To: <ea3392d8-cd07-64e0-134a-4f111fe853db@twiddle.net>

On 01.03.2017 20:30, Richard Henderson wrote:
> On 03/01/2017 07:00 PM, Thomas Huth wrote:
>>> Primarily, it does not raise an exception for error.
>>
>> Protection and page faults should be generated properly via
>> trigger_access_exception() there ... or did I miss something?
> 
> So why does s390_cpu_virt_mem_rw document that it returns non-zero if
> there was an error?

The non-zero return code is needed for the callers to decide whether to
continue or not (this is used in non-TCG code, too, so we need something
that is independent from TCG magic here). See the usage of
s390_cpu_virt_mem_read() / ..._write() in target/s390x/ioinst.c for example.

> I see you do raise an exception on the TCG path (via translate_pages),
> but not the KVM path.  That is very confusing.

The KVM_S390_MEM_OP ioctl can raise an exception, too. I konw, it's
confusing, but that ioctl was necessary since you need to hold a special
lock in KVM while walking the page tables.

>> AR = Access Register ... they are needed when the CPU runs in access
>> register mode (i.e. the AS PSW bits are 01). AFAIK we don't emulate this
>> in QEMU yet, but the KVM_S390_MEM_OP ioctl already supports it.
> 
> Hmm.  I guess I don't know how to read that then.

The access-register mode is described in the "Access-Register
Translation" sub-chapter in Chapter 5 ("Program Execution") of the POP.
Make sure to have some good painkillers ready first, though ... that's
IMHO really one of the ugliest parts of the architecture ;-)

>>> Your writes need to look a lot more like fast_memmove in mem_helper.c,
>>> except that of course only the destination needs translation.
>>
>> I still think that s390_cpu_virt_mem_write() should be fine here, too.
> 
> Ideally you'd interact with the TCG TLB in some way so that you didn't
> have to manage your own translation and your own exceptions.  That's
> what fast_memmove does.

Well, all the code from s390_cpu_virt_mem_rw() can also run with KVM -
in case the KVM_S390_MEM_OP is not available (which also has just been
introduced two years ago). So all the code that can be called by
s390_cpu_virt_mem_rw() has to work also without TCG.

But I agree, since the original problem here (TCG emulation of stfle) is
not related to KVM, it's maybe better to use a function a la
fast_memmove there instead.

>>> Of course, in practice we could reduce this to just one cpu_stl_data for
>>> STFL and one or two cpu_stq_data for STFLE.
>>
>> I think STFLE can store more than two 64-bit words, can't it?
> 
> Technically, yes.  But there are less than 128 bits defined.  Certainly
> much less than the 4k bits that Michal prepares for.

True. But maybe we should then also have an assert() or something
similar here in case the bits exceed the 128 limit one day...?

 Thomas

  reply	other threads:[~2017-03-01 20:20 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-24 13:44 [Qemu-devel] [PATCH] target-s390x: Implement stfl and stfle Michal Marek
2017-02-24 14:51 ` no-reply
2017-02-24 15:22   ` Michal Marek
2017-02-24 16:28     ` David Hildenbrand
2017-02-25  0:05 ` Richard Henderson
2017-02-25 20:39   ` Michal Marek
2017-02-25 23:30     ` Michal Marek
2017-02-25 23:16   ` [Qemu-devel] [PATCH v2] " Michal Marek
2017-02-25 23:38     ` [Qemu-devel] [PATCH v3] " Michal Marek
2017-02-26 11:22       ` Thomas Huth
2017-02-26 18:57         ` Michal Marek
2017-02-27  7:30           ` Thomas Huth
2017-02-27 10:18         ` [Qemu-devel] [PATCH v4] " Michal Marek
2017-02-28 22:11           ` Richard Henderson
2017-03-01  8:00             ` Thomas Huth
2017-03-01 19:30               ` Richard Henderson
2017-03-01 20:20                 ` Thomas Huth [this message]
2017-03-02 13:09                 ` David Hildenbrand
2017-03-02 10:53             ` Michal Marek
2017-03-02 13:12               ` David Hildenbrand

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=0ac325ae-6b68-2a03-74a8-c5ab0ebb58e0@redhat.com \
    --to=thuth@redhat.com \
    --cc=agraf@suse.de \
    --cc=ebischoff@suse.com \
    --cc=mbenes@suse.cz \
    --cc=mmarek@suse.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).