[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 2/5] target/s390x: Enforce instruction features
From: |
Aurelien Jarno |
Subject: |
Re: [Qemu-devel] [PATCH 2/5] target/s390x: Enforce instruction features |
Date: |
Thu, 15 Jun 2017 22:55:37 +0200 |
User-agent: |
NeoMutt/20170113 (1.7.2) |
On 2017-06-15 15:10, David Hildenbrand wrote:
>
> >> A "sane" guest (e.g. Linux) will only use an instruction if the
> >> corresponding stfl(e) bit is set. So in my opinion, this should be just
> >> fine. If the bit is not set currently, the guest will not use it == dead
> >> code.
> >
> > Not necessarily. Depending on the distribution, gcc and hence binaries
> > default to a different ISA. Over the time people have added the
> > corresponding instructions to QEMU so that these binaries work. Now
> > given that GCC does not necessarily use all the instructions from a
> > given facility, we end up with missing instructions.
>
> That's true, glibc sometimes assumes a certain architecture level
> without checking. So you're right, maybe we should defer this "big
> hammer" change until we have all facilities as part of the qemu CPU
Well the GNU libc itself correctly probe the facilities with stfl/stfle.
What happens is that newer instructions might be generated directly by
GCC if told to do so (with -march=xxx or the default architecture).
> model. Then, e.g. runnning -cpu qemu will not break such stuff, however
> e.g. -cpu z900 could correctly simulate that architecture level.
>
> One option would be:
>
> /* for now, we don't fake absence of features for the qemu model */
> if (!object_dynamic_cast(cpu, "qemu-s390x-cpu") {
> dc.features = cpu->model->features;
> }
>
>
> ...
>
> if (s->features && !test_bit(insn->fac, s->features)) {
> gen_program_exception(s, PGM_OPERATION);
> return EXIT_NORETURN;
> }
I don't know that part of the code enough to tell if it is the good way
to do that, but certainly having a "qemu" CPU that supports all
instructions look like the way to go, especially for the linux-user
emulation.
Aurelien
--
Aurelien Jarno GPG: 4096R/1DDD8C9B
address@hidden http://www.aurel32.net
[Qemu-devel] [PATCH 1/5] target/s390x: Map existing FAC_* names to S390_FEAT_* names, Richard Henderson, 2017/06/15
[Qemu-devel] [PATCH 3/5] target/s390x: change PSW_SHIFT_KEY, Richard Henderson, 2017/06/15
[Qemu-devel] [PATCH 5/5] target/s390x: mark CSST, CSST2, FPSEH facilities as available, Richard Henderson, 2017/06/15
[Qemu-devel] [PATCH 4/5] target/s390x: implement mvcos instruction, Richard Henderson, 2017/06/15
Re: [Qemu-devel] [PATCH 0/5] More s390x improvements, no-reply, 2017/06/15