[v1,for-2.12,6/9] s390x/tcg: Implement SIGA instruction

Message ID 20171204140150.20483-7-david@redhat.com
State New
Headers show
Series
  • s390x/tcg: facilitites and instructions
Related show

Commit Message

David Hildenbrand Dec. 4, 2017, 2:01 p.m.
I have no idea what that instruction does, but KVM seems to suppress it,
setting cc=3 (and as it seems to be an io instruction, it should be
protected). Let's do the same for TCG, so we're at least equal.

(it is used in the kernel for qdio, I wasn't even able to find the real
 name of that instruction)

Signed-off-by: David Hildenbrand <david@redhat.com>
---
 target/s390x/insn-data.def | 1 +
 target/s390x/translate.c   | 8 ++++++++
 2 files changed, 9 insertions(+)

Comments

Cornelia Huck Dec. 4, 2017, 5:29 p.m. | #1
On Mon,  4 Dec 2017 15:01:47 +0100
David Hildenbrand <david@redhat.com> wrote:

> I have no idea what that instruction does, but KVM seems to suppress it,
> setting cc=3 (and as it seems to be an io instruction, it should be
> protected). Let's do the same for TCG, so we're at least equal.
> 
> (it is used in the kernel for qdio, I wasn't even able to find the real
>  name of that instruction)

<arcane knowledge from previous life>
It's called SIGNAL ADAPTER, and we don't indicate qdio in the chsc
stuff.
</arcane knowledge from previous life>

Following the KVM lead for undocumented stuff is the way to go,
unsatisfying though it is.

[Don't binutils etc. know the name?]

> 
> Signed-off-by: David Hildenbrand <david@redhat.com>
> ---
>  target/s390x/insn-data.def | 1 +
>  target/s390x/translate.c   | 8 ++++++++
>  2 files changed, 9 insertions(+)

Patch

diff --git a/target/s390x/insn-data.def b/target/s390x/insn-data.def
index c7353e7f11..f7b66b0091 100644
--- a/target/s390x/insn-data.def
+++ b/target/s390x/insn-data.def
@@ -1056,6 +1056,7 @@ 
     C(0xb238, RSCH,    S,     Z,   0, 0, 0, 0, rsch, 0)
     C(0xb237, SAL,     S,     Z,   0, 0, 0, 0, sal, 0)
     C(0xb23c, SCHM,    S,     Z,   0, insn, 0, 0, schm, 0)
+    C(0xb274, SIGA,    S,     Z,   0, 0, 0, 0, siga, 0)
     C(0xb23a, STCPS,   S,     Z,   0, 0, 0, 0, stcps, 0)
     C(0xb233, SSCH,    S,     Z,   0, insn, 0, 0, ssch, 0)
     C(0xb239, STCRW,   S,     Z,   0, insn, 0, 0, stcrw, 0)
diff --git a/target/s390x/translate.c b/target/s390x/translate.c
index 5c2432678c..1e4079464a 100644
--- a/target/s390x/translate.c
+++ b/target/s390x/translate.c
@@ -4102,6 +4102,14 @@  static ExitStatus op_schm(DisasContext *s, DisasOps *o)
     return NO_EXIT;
 }
 
+static ExitStatus op_siga(DisasContext *s, DisasOps *o)
+{
+    check_privileged(s);
+    /* From KVM code: Not provided, set CC = 3 for subchannel not operational */
+    gen_op_movi_cc(s, 3);
+    return NO_EXIT;
+}
+
 static ExitStatus op_stcps(DisasContext *s, DisasOps *o)
 {
     check_privileged(s);