diff mbox series

[v1,for-2.12,4/9] s390x/tcg: wire up SET CHANNEL MONITOR

Message ID 20171204140150.20483-5-david@redhat.com
State New
Headers show
Series s390x/tcg: facilitites and instructions | expand

Commit Message

David Hildenbrand Dec. 4, 2017, 2:01 p.m. UTC
Let's just wire it up like KVM.

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

Comments

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

> Let's just wire it up like KVM.
> 
> Signed-off-by: David Hildenbrand <david@redhat.com>
> ---
>  target/s390x/helper.h      | 1 +
>  target/s390x/insn-data.def | 1 +
>  target/s390x/misc_helper.c | 9 +++++++++
>  target/s390x/translate.c   | 7 +++++++
>  4 files changed, 18 insertions(+)

So we would have generated an exception before if someone tried to
enable channel measurements under tcg?
David Hildenbrand Dec. 4, 2017, 5:27 p.m. UTC | #2
On 04.12.2017 18:24, Cornelia Huck wrote:
> On Mon,  4 Dec 2017 15:01:45 +0100
> David Hildenbrand <david@redhat.com> wrote:
> 
>> Let's just wire it up like KVM.
>>
>> Signed-off-by: David Hildenbrand <david@redhat.com>
>> ---
>>  target/s390x/helper.h      | 1 +
>>  target/s390x/insn-data.def | 1 +
>>  target/s390x/misc_helper.c | 9 +++++++++
>>  target/s390x/translate.c   | 7 +++++++
>>  4 files changed, 18 insertions(+)
> 
> So we would have generated an exception before if someone tried to
> enable channel measurements under tcg?
> 

Yes, PGM_OPERATION should have been triggered.
Cornelia Huck Dec. 4, 2017, 5:32 p.m. UTC | #3
On Mon, 4 Dec 2017 18:27:55 +0100
David Hildenbrand <david@redhat.com> wrote:

> On 04.12.2017 18:24, Cornelia Huck wrote:
> > On Mon,  4 Dec 2017 15:01:45 +0100
> > David Hildenbrand <david@redhat.com> wrote:
> >   
> >> Let's just wire it up like KVM.
> >>
> >> Signed-off-by: David Hildenbrand <david@redhat.com>
> >> ---
> >>  target/s390x/helper.h      | 1 +
> >>  target/s390x/insn-data.def | 1 +
> >>  target/s390x/misc_helper.c | 9 +++++++++
> >>  target/s390x/translate.c   | 7 +++++++
> >>  4 files changed, 18 insertions(+)  
> > 
> > So we would have generated an exception before if someone tried to
> > enable channel measurements under tcg?
> >   
> 
> Yes, PGM_OPERATION should have been triggered.
> 

Next question: What happens now if we try to enable channel
measurements? :)
David Hildenbrand Dec. 4, 2017, 5:39 p.m. UTC | #4
On 04.12.2017 18:32, Cornelia Huck wrote:
> On Mon, 4 Dec 2017 18:27:55 +0100
> David Hildenbrand <david@redhat.com> wrote:
> 
>> On 04.12.2017 18:24, Cornelia Huck wrote:
>>> On Mon,  4 Dec 2017 15:01:45 +0100
>>> David Hildenbrand <david@redhat.com> wrote:
>>>   
>>>> Let's just wire it up like KVM.
>>>>
>>>> Signed-off-by: David Hildenbrand <david@redhat.com>
>>>> ---
>>>>  target/s390x/helper.h      | 1 +
>>>>  target/s390x/insn-data.def | 1 +
>>>>  target/s390x/misc_helper.c | 9 +++++++++
>>>>  target/s390x/translate.c   | 7 +++++++
>>>>  4 files changed, 18 insertions(+)  
>>>
>>> So we would have generated an exception before if someone tried to
>>> enable channel measurements under tcg?
>>>   
>>
>> Yes, PGM_OPERATION should have been triggered.
>>
> 
> Next question: What happens now if we try to enable channel
> measurements? :)
> 

With my limited knowledge of the magical world of css, it seems to work.

[root@localhost ~]# chccwdev --attribute cmb_enable=1 0.0.0001
Setting cmb_enable attribute of 0.0.0001 to 1
Done
diff mbox series

Patch

diff --git a/target/s390x/helper.h b/target/s390x/helper.h
index 95ad44bc39..e5282b939c 100644
--- a/target/s390x/helper.h
+++ b/target/s390x/helper.h
@@ -166,6 +166,7 @@  DEF_HELPER_3(msch, void, env, i64, i64)
 DEF_HELPER_2(rchp, void, env, i64)
 DEF_HELPER_2(rsch, void, env, i64)
 DEF_HELPER_2(sal, void, env, i64)
+DEF_HELPER_4(schm, void, env, i64, i64, i64)
 DEF_HELPER_3(ssch, void, env, i64, i64)
 DEF_HELPER_2(stcrw, void, env, i64)
 DEF_HELPER_3(stsch, void, env, i64, i64)
diff --git a/target/s390x/insn-data.def b/target/s390x/insn-data.def
index 8793350963..e21d226092 100644
--- a/target/s390x/insn-data.def
+++ b/target/s390x/insn-data.def
@@ -1055,6 +1055,7 @@ 
     C(0xb23b, RCHP,    S,     Z,   0, 0, 0, 0, rchp, 0)
     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(0xb233, SSCH,    S,     Z,   0, insn, 0, 0, ssch, 0)
     C(0xb239, STCRW,   S,     Z,   0, insn, 0, 0, stcrw, 0)
     C(0xb234, STSCH,   S,     Z,   0, insn, 0, 0, stsch, 0)
diff --git a/target/s390x/misc_helper.c b/target/s390x/misc_helper.c
index d0d4441572..98ecedb499 100644
--- a/target/s390x/misc_helper.c
+++ b/target/s390x/misc_helper.c
@@ -386,6 +386,15 @@  void HELPER(sal)(CPUS390XState *env, uint64_t r1)
     qemu_mutex_unlock_iothread();
 }
 
+void HELPER(schm)(CPUS390XState *env, uint64_t r1, uint64_t r2, uint64_t inst)
+{
+    S390CPU *cpu = s390_env_get_cpu(env);
+
+    qemu_mutex_lock_iothread();
+    ioinst_handle_schm(cpu, r1, r2, inst >> 16, GETPC());
+    qemu_mutex_unlock_iothread();
+}
+
 void HELPER(ssch)(CPUS390XState *env, uint64_t r1, uint64_t inst)
 {
     S390CPU *cpu = s390_env_get_cpu(env);
diff --git a/target/s390x/translate.c b/target/s390x/translate.c
index a6346ac139..bd3fc6448e 100644
--- a/target/s390x/translate.c
+++ b/target/s390x/translate.c
@@ -4095,6 +4095,13 @@  static ExitStatus op_sal(DisasContext *s, DisasOps *o)
     return NO_EXIT;
 }
 
+static ExitStatus op_schm(DisasContext *s, DisasOps *o)
+{
+    check_privileged(s);
+    gen_helper_schm(cpu_env, regs[1], regs[2], o->in2);
+    return NO_EXIT;
+}
+
 static ExitStatus op_ssch(DisasContext *s, DisasOps *o)
 {
     check_privileged(s);