diff mbox

[v1,3/3] s390x/cpumodel: allow to enable MVCOS for qemu cpu model

Message ID 20170613214736.19963-4-david@redhat.com
State New
Headers show

Commit Message

David Hildenbrand June 13, 2017, 9:47 p.m. UTC
This allows botting a recent linux kernel (e.g. compiled for z900) and
using mvcos for uaccess:

qemu-system-s390x ... -cpu qemu,mvcos=on ...

While at it, correctly fake its abscence.

Signed-off-by: David Hildenbrand <david@redhat.com>
---
 target/s390x/cpu_models.c | 1 +
 target/s390x/mem_helper.c | 3 +++
 2 files changed, 4 insertions(+)

Comments

Richard Henderson June 14, 2017, 4:44 a.m. UTC | #1
On 06/13/2017 02:47 PM, David Hildenbrand wrote:
> +    if (!s390_has_feat(S390_FEAT_MOVE_WITH_OPTIONAL_SPEC)) {
> +        program_interrupt(env, PGM_OPERATION, 6);
> +    }

This is (supposed to be) done via the feature field of insn-data.def.

Except that we do not yet enforce that; we haven't updated that bit of the 
translator since we actually added support for the feature bits.


r~
David Hildenbrand June 14, 2017, 7:03 a.m. UTC | #2
On 14.06.2017 06:44, Richard Henderson wrote:
> On 06/13/2017 02:47 PM, David Hildenbrand wrote:
>> +    if (!s390_has_feat(S390_FEAT_MOVE_WITH_OPTIONAL_SPEC)) {
>> +        program_interrupt(env, PGM_OPERATION, 6);
>> +    }
> 
> This is (supposed to be) done via the feature field of insn-data.def.
> 
> Except that we do not yet enforce that; we haven't updated that bit of the 
> translator since we actually added support for the feature bits.

That makes sense, I'll drop this hunk then. So wiring up these bits with
the CPU model directly sounds like what we want to do.

Thanks!

> 
> 
> r~
>
Thomas Huth June 14, 2017, 7:40 a.m. UTC | #3
On 14.06.2017 09:03, David Hildenbrand wrote:
> On 14.06.2017 06:44, Richard Henderson wrote:
>> On 06/13/2017 02:47 PM, David Hildenbrand wrote:
>>> +    if (!s390_has_feat(S390_FEAT_MOVE_WITH_OPTIONAL_SPEC)) {
>>> +        program_interrupt(env, PGM_OPERATION, 6);
>>> +    }
>>
>> This is (supposed to be) done via the feature field of insn-data.def.
>>
>> Except that we do not yet enforce that; we haven't updated that bit of the 
>> translator since we actually added support for the feature bits.
> 
> That makes sense, I'll drop this hunk then.
I think you could then also simply put the one-line-change to
target/s390x/cpu_models.c into the previous patch instead.

 Thomas
diff mbox

Patch

diff --git a/target/s390x/cpu_models.c b/target/s390x/cpu_models.c
index c508ae1..348e760 100644
--- a/target/s390x/cpu_models.c
+++ b/target/s390x/cpu_models.c
@@ -682,6 +682,7 @@  static void add_qemu_cpu_model_features(S390FeatBitmap fbm)
         S390_FEAT_LONG_DISPLACEMENT_FAST,
         S390_FEAT_ETF2_ENH,
         S390_FEAT_STORE_CLOCK_FAST,
+        S390_FEAT_MOVE_WITH_OPTIONAL_SPEC,
         S390_FEAT_GENERAL_INSTRUCTIONS_EXT,
         S390_FEAT_EXECUTE_EXT,
         S390_FEAT_STFLE_45,
diff --git a/target/s390x/mem_helper.c b/target/s390x/mem_helper.c
index cb27465..e0a5de0 100644
--- a/target/s390x/mem_helper.c
+++ b/target/s390x/mem_helper.c
@@ -1508,6 +1508,9 @@  uint32_t HELPER(mvcos)(CPUS390XState *env, uint64_t dest, uint64_t src,
     HELPER_LOG("%s dest %" PRIx64 ", src %" PRIx64 ", len %" PRIx64 "\n",
                __func__, dest, src, len);
 
+    if (!s390_has_feat(S390_FEAT_MOVE_WITH_OPTIONAL_SPEC)) {
+        program_interrupt(env, PGM_OPERATION, 6);
+    }
     if (!(env->psw.mask & PSW_MASK_DAT)) {
         program_interrupt(env, PGM_SPECIAL_OP, 6);
     }