All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/1] css: SCHIB measurement block origin must be aligned
@ 2021-02-18 17:33 Pierre Morel
  2021-02-18 17:33 ` [PATCH 1/1] " Pierre Morel
  0 siblings, 1 reply; 4+ messages in thread
From: Pierre Morel @ 2021-02-18 17:33 UTC (permalink / raw)
  To: kvm; +Cc: frankja, david, thuth, cohuck, imbrenda, pasic

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(+)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/1] css: SCHIB measurement block origin must be aligned
  2021-02-18 17:33 [PATCH 0/1] css: SCHIB measurement block origin must be aligned Pierre Morel
@ 2021-02-18 17:33 ` Pierre Morel
  0 siblings, 0 replies; 4+ messages in thread
From: Pierre Morel @ 2021-02-18 17:33 UTC (permalink / raw)
  To: kvm; +Cc: frankja, david, thuth, cohuck, imbrenda, pasic

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

Signed-off-by: Pierre Morel <pmorel@linux.ibm.com>
---
 target/s390x/ioinst.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/target/s390x/ioinst.c b/target/s390x/ioinst.c
index a412926d27..1ee11522e1 100644
--- a/target/s390x/ioinst.c
+++ b/target/s390x/ioinst.c
@@ -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;
 }
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/1] css: SCHIB measurement block origin must be aligned
  2021-02-18 17:40 ` [PATCH 1/1] " Pierre Morel
@ 2021-02-19  6:23   ` Thomas Huth
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas Huth @ 2021-02-19  6:23 UTC (permalink / raw)
  To: Pierre Morel, cohuck
  Cc: david, qemu-devel, pasic, borntraeger, qemu-s390x, imbrenda, rth

On 18/02/2021 18.40, Pierre Morel wrote:
> 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 ...

> Signed-off-by: Pierre Morel <pmorel@linux.ibm.com>
> ---
>   target/s390x/ioinst.c | 6 ++++++
>   1 file changed, 6 insertions(+)
> 
> diff --git a/target/s390x/ioinst.c b/target/s390x/ioinst.c
> index a412926d27..1ee11522e1 100644
> --- a/target/s390x/ioinst.c
> +++ b/target/s390x/ioinst.c
> @@ -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


> +        return 0;
> +    }
>       return 1;
>   }
>   
> 



^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/1] css: SCHIB measurement block origin must be aligned
  2021-02-18 17:40 [PATCH 0/1] " Pierre Morel
@ 2021-02-18 17:40 ` Pierre Morel
  2021-02-19  6:23   ` Thomas Huth
  0 siblings, 1 reply; 4+ messages in thread
From: Pierre Morel @ 2021-02-18 17:40 UTC (permalink / raw)
  To: cohuck
  Cc: thuth, pmorel, david, qemu-devel, pasic, borntraeger, qemu-s390x,
	imbrenda, rth

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

Signed-off-by: Pierre Morel <pmorel@linux.ibm.com>
---
 target/s390x/ioinst.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/target/s390x/ioinst.c b/target/s390x/ioinst.c
index a412926d27..1ee11522e1 100644
--- a/target/s390x/ioinst.c
+++ b/target/s390x/ioinst.c
@@ -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;
 }
 
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-02-19  6:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-18 17:33 [PATCH 0/1] css: SCHIB measurement block origin must be aligned Pierre Morel
2021-02-18 17:33 ` [PATCH 1/1] " Pierre Morel
2021-02-18 17:40 [PATCH 0/1] " Pierre Morel
2021-02-18 17:40 ` [PATCH 1/1] " Pierre Morel
2021-02-19  6:23   ` Thomas Huth

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.