[Qemu-devel] [PATCH v1 3/3] s390x/cpumodel: allow to enable MVCOS for qemu cpu model

David Hildenbrand posted 3 patches 8 years, 4 months ago
There is a newer version of this series
[Qemu-devel] [PATCH v1 3/3] s390x/cpumodel: allow to enable MVCOS for qemu cpu model
Posted by David Hildenbrand 8 years, 4 months ago
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(+)

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);
     }
-- 
2.9.3


Re: [Qemu-devel] [PATCH v1 3/3] s390x/cpumodel: allow to enable MVCOS for qemu cpu model
Posted by Richard Henderson 8 years, 4 months ago
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~

Re: [Qemu-devel] [PATCH v1 3/3] s390x/cpumodel: allow to enable MVCOS for qemu cpu model
Posted by David Hildenbrand 8 years, 4 months ago
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~
> 


-- 

Thanks,

David

Re: [Qemu-devel] [PATCH v1 3/3] s390x/cpumodel: allow to enable MVCOS for qemu cpu model
Posted by Thomas Huth 8 years, 4 months ago
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