Skip to contentSkip to conversation

s390x: virtio-less ccw target enablement

PATCH In review Alexander Graf 2 participants 6 messages Nov 4, 2014

lore
Share & tools
lore
#0 lore raw

cover s390x: virtio-less ccw target enablement

Hi,

With these two patches I'm able to boot a kernel with -M s390-ccw and TCG. So far the actual CCW instruction interpretation is missing, so it won't get any further than an initrd, but at least it's a start ;).

Alex

Alexander Graf (2):
s390x: Fix sclp console input
s390x: Ignore sam31

 target-s390x/insn-data.def | 4 +++-
 target-s390x/interrupt.c   | 2 --
 2 files changed, 3 insertions(+), 3 deletions(-)
Signature · 1 line
1.7.12.4
#1 lore raw

PATCH 1/2 s390x: Fix sclp console input

When injecting an sclp console interrupt into the guest, we increase the PC by 4 for some reason. I have no idea why I put that code there, but it's clearly wrong. Remove the increment.

This patch fixes sclp serial input for the ccw machine.

---
 target-s390x/interrupt.c | 2 --
 1 file changed, 2 deletions(-)
target-s390x/interrupt.c +0 -2
index 23a9114..1404d0a 100644
@@ -22,9 +22,7 @@ void s390_sclp_extint(uint32_t parm)
         kvm_s390_service_interrupt(parm);
     } else {
         S390CPU *dummy_cpu = s390_cpu_addr2state(0);
-        CPUS390XState *env = &dummy_cpu->env;
 
-        env->psw.addr += 4;
         cpu_inject_ext(dummy_cpu, EXT_SERVICE, parm, 0);
     }
 }
Signature · 1 line
1.7.12.4
Reviewed-by on v1 1/2
#2 lore raw

Re: [Qemu-devel] [PATCH 1/2] s390x: Fix sclp console input

Quoted 16 lines · Alexander Graf

When injecting an sclp console interrupt into the guest, we increase the PC by 4 for some reason. I have no idea why I put that code there, but it's clearly wrong. Remove the increment.

This patch fixes sclp serial input for the ccw machine.

---
  target-s390x/interrupt.c | 2 --
  1 file changed, 2 deletions(-)
target-s390x/interrupt.c +0 -0
index 23a9114..1404d0a 100644

target-s390x/interrupt.c void s390_sclp_extint(uint32_t parm) · line 28

Quoted 9 lines
target-s390x/interrupt.c +0 -2
@@ -22,9 +22,7 @@ void s390_sclp_extint(uint32_t parm)
          kvm_s390_service_interrupt(parm);
      } else {
          S390CPU *dummy_cpu = s390_cpu_addr2state(0);
-        CPUS390XState *env = &dummy_cpu->env;
 
-        env->psw.addr += 4;
          cpu_inject_ext(dummy_cpu, EXT_SERVICE, parm, 0);
      }
  }
#3 lore raw

PATCH 2/2 s390x: Ignore sam31

In reply to Alexander Graf

The SAM31 instruction switches the memory model to 31bit. Linux uses it on bootup, so we have to implement it. We only really model the 64bit memory model though, so we can nop it, cross our fingers and hope for the guest to not rely on 32bit wrap semantics.

---
 target-s390x/insn-data.def | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
target-s390x/insn-data.def +3 -1
index b42ebb6..4cc2da4 100644
@@ -744,8 +744,10 @@
 /* SERVICE CALL LOGICAL PROCESSOR (PV hypercall) */
     C(0xb220, SERVC,   RRE,   Z,   r1_o, r2_o, 0, 0, servc, 0)
 /* SET ADDRESSING MODE */
+    /* We have to nop SAM31, it is used by early Linux bootup */
+    C(0x010d, SAM31,   E,     Z,   0, 0, 0, 0, 0, 0)
     /* We only do 64-bit, so accept this as a no-op.
-       Let SAM24 and SAM31 signal illegal instruction.  */
+       Let SAM24 signal illegal instruction.  */
     C(0x010e, SAM64,   E,     Z,   0, 0, 0, 0, 0, 0)
 /* SET ADDRESS SPACE CONTROL FAST */
     C(0xb279, SACF,    S,     Z,   0, a2, 0, 0, sacf, 0)
Signature · 1 line
1.7.12.4
#4 lore raw

Re: [Qemu-devel] [PATCH 2/2] s390x: Ignore sam31

Hi Alex,

I'm not really happy with that. A brief look into the instruction manual shows, that modal instructions have different outputs depending on the addressing mode. On the long run it would be better to implement this. That said I'm not an expert on s390x and there is a reason we're only doing 64-bit.

Thanks,
Bastian

Quoted 26 lines · Alexander Graf

The SAM31 instruction switches the memory model to 31bit. Linux uses it on bootup, so we have to implement it. We only really model the 64bit memory model though, so we can nop it, cross our fingers and hope for the guest to not rely on 32bit wrap semantics.

---
  target-s390x/insn-data.def | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
target-s390x/insn-data.def +3 -1
index b42ebb6..4cc2da4 100644
@@ -744,8 +744,10 @@
  /* SERVICE CALL LOGICAL PROCESSOR (PV hypercall) */
      C(0xb220, SERVC,   RRE,   Z,   r1_o, r2_o, 0, 0, servc, 0)
  /* SET ADDRESSING MODE */
+    /* We have to nop SAM31, it is used by early Linux bootup */
+    C(0x010d, SAM31,   E,     Z,   0, 0, 0, 0, 0, 0)
      /* We only do 64-bit, so accept this as a no-op.
-       Let SAM24 and SAM31 signal illegal instruction.  */
+       Let SAM24 signal illegal instruction.  */
      C(0x010e, SAM64,   E,     Z,   0, 0, 0, 0, 0, 0)
  /* SET ADDRESS SPACE CONTROL FAST */
      C(0xb279, SACF,    S,     Z,   0, a2, 0, 0, sacf, 0)
#5 lore raw

Re: [Qemu-devel] [PATCH 2/2] s390x: Ignore sam31

Quoted 7 lines · Bastian Koppelmann

Hi Alex,

I'm not really happy with that. A brief look into the instruction manual shows, that modal instructions have different outputs depending on the addressing mode. On the long run it would be better to implement this. That said I'm not an expert on s390x and there is a reason we're only doing 64-bit.

IIRC we even do support 31bit mode - we merely would need to set the respective PSW bit :).

I'll give that a try.

Alex