Skip to contentSkip to conversation

css: SCHIB measurement block origin must be aligned

PATCH In review Pierre Morel 2 participants 3 messages Feb 18, 2021 – Feb 19, 2021

lore
Share & tools
lore
#0 lore raw

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 MB must be aligned on 128bits otherwise an operand exception is recognized.

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 1/1 css: SCHIB measurement block origin must be aligned

The Measurement Block Origin inside the SCHIB is used when Mesurement Block format 1 is in used and must be aligned on 128bits.

---
 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
#2 lore raw
Quoted 3 lines · Pierre Morel

The Measurement Block Origin inside the SCHIB is used when Mesurement Block format 1 is in used and must be aligned on 128bits.

128 bits = 16 bytes ...

Quoted 10 lines
---
  target/s390x/ioinst.c | 6 ++++++
  1 file changed, 6 insertions(+)
target/s390x/ioinst.c +0 -0
index a412926d27..1ee11522e1 100644

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

Quoted 7 lines
target/s390x/ioinst.c +4 -0
@@ -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)) {

... but that checks for a 64 byte alignment...

And looking at the PoP, I also see some talk about 64 byte alignment there, so I guess you meant 64 byte insteas of 128 bit in the patch description?

Thomas

Quoted 6 lines
target/s390x/ioinst.c +2 -0
+        return 0;
+    }
      return 1;
  }