Skip to contentSkip to conversation

css: SCHIB measurement block origin must be aligned

PATCH Applied Pierre Morel 3 participants 5 messages Feb 19, 2021 – Feb 22, 2021

lore
Share & tools
lore
#0 lore raw

v2 cover css: SCHIB measurement block origin must be aligned

Hi,

By testing Measurement with KVM unit tests I fall on this:
we forgot to test the alignment of the MBO for measurement format 1.

The last 6 bits of the MBO must be null, i.e. an aligned on 64 bytes of the MBO, otherwise an operand exception is recognized when issuing a msch instruction.

Regards,
Pierre

Pierre Morel (1):
css: SCHIB measurement block origin must be aligned

 target/s390x/ioinst.c | 6 ++++++
 1 file changed, 6 insertions(+)
Signature · 1 line
2.25.1
#1 lore raw

PATCH v2 1/1 css: SCHIB measurement block origin must be aligned

The Measurement Block Origin inside the SCHIB is used when Measurement Block format 1 is in used and must be aligned on 64 bytes otherwise an operand exception is recognized when issuing the Modify Sub CHannel (MSCH) instruction.

---
 target/s390x/ioinst.c | 6 ++++++
 1 file changed, 6 insertions(+)
target/s390x/ioinst.c +6 -0
index a412926d27..1ee11522e1 100644
@@ -121,6 +121,12 @@ static int ioinst_schib_valid(SCHIB *schib)
     if (be32_to_cpu(schib->pmcw.chars) & PMCW_CHARS_MASK_XMWME) {
         return 0;
     }
+    /* for MB format 1 bits 26-31 of word 11 must be 0 */
+    /* MBA uses words 10 and 11, it means align on 2**6 */
+    if ((be16_to_cpu(schib->pmcw.chars) & PMCW_CHARS_MASK_MBFC) &&
+        (be64_to_cpu(schib->mba) & 0x03fUL)) {
+        return 0;
+    }
     return 1;
 }
 
Signature · 1 line
2.25.1
Reviewed-by on v2 1/1
#2 lore raw
Quoted 16 lines · Pierre Morel

The Measurement Block Origin inside the SCHIB is used when Measurement Block format 1 is in used and must be aligned on 64 bytes otherwise an operand exception is recognized when issuing the Modify Sub CHannel (MSCH) instruction.

---
  target/s390x/ioinst.c | 6 ++++++
  1 file changed, 6 insertions(+)
target/s390x/ioinst.c +0 -0
index a412926d27..1ee11522e1 100644
@@ -121,6 +121,12 @@ static int ioinst_schib_valid(SCHIB *schib)
      if (be32_to_cpu(schib->pmcw.chars) & PMCW_CHARS_MASK_XMWME) {

target/s390x/ioinst.c static int ioinst_schib_valid(SCHIB *schib) · line 131

Quoted 10 lines
target/s390x/ioinst.c +6 -0
          return 0;
      }
+    /* for MB format 1 bits 26-31 of word 11 must be 0 */
+    /* MBA uses words 10 and 11, it means align on 2**6 */
+    if ((be16_to_cpu(schib->pmcw.chars) & PMCW_CHARS_MASK_MBFC) &&
+        (be64_to_cpu(schib->mba) & 0x03fUL)) {
+        return 0;
+    }
      return 1;
  }
#3 lore raw
Quoted 21 lines · Thomas Huth
Quoted 20 lines · Pierre Morel

The Measurement Block Origin inside the SCHIB is used when Measurement Block format 1 is in used and must be aligned on 64 bytes otherwise an operand exception is recognized when issuing the Modify Sub CHannel (MSCH) instruction.

---
  target/s390x/ioinst.c | 6 ++++++

  1 file changed, 6 insertions(+)
target/s390x/ioinst.c +2 -0
index a412926d27..1ee11522e1 100644
@@ -121,6 +121,12 @@ static int ioinst_schib_valid(SCHIB *schib)
       if (be32_to_cpu(schib->pmcw.chars) & PMCW_CHARS_MASK_XMWME) {
           return 0;
       }
+    /* for MB format 1 bits 26-31 of word 11 must be 0 */
+    /* MBA uses words 10 and 11, it means align on 2**6 */
Quoted 9 lines

target/s390x/ioinst.c static int ioinst_schib_valid(SCHIB *schib) · line 131

Quoted 6 lines
target/s390x/ioinst.c +4 -0
+    if ((be16_to_cpu(schib->pmcw.chars) & PMCW_CHARS_MASK_MBFC) &&
+        (be64_to_cpu(schib->mba) & 0x03fUL)) {
+        return 0;
+    }
       return 1;
   }

Thanks,
Pierre

Signature · 2 lines
Pierre Morel
IBM Lab Boeblingen
#4 lore raw
In reply to Pierre Morel
Quoted 13 lines · On Fri, 19 Feb 2021 14:39:32 +0100 Pierre Morel <[email protected]> wrote:

Hi,

By testing Measurement with KVM unit tests I fall on this:
we forgot to test the alignment of the MBO for measurement format 1.

The last 6 bits of the MBO must be null, i.e. an aligned on 64 bytes of the MBO, otherwise an operand exception is recognized when issuing a msch instruction.

Regards,
Pierre

Quoted 6 lines

Pierre Morel (1):
css: SCHIB measurement block origin must be aligned

 target/s390x/ioinst.c | 6 ++++++
 1 file changed, 6 insertions(+)

Thanks, applied.