Linux s390 Architecture development
 help / color / mirror / Atom feed
* [PATCH v2] s390/cmf: Fix virtual vs physical address confusion
@ 2026-09-21 13:16 Peter Oberparleiter
  2026-09-21 13:25 ` sashiko-bot
  2026-09-21 15:23 ` Heiko Carstens
  0 siblings, 2 replies; 3+ messages in thread
From: Peter Oberparleiter @ 2026-09-21 13:16 UTC (permalink / raw)
  To: Vineeth Vijayan
  Cc: Heiko Carstens, Vasily Gorbik, Alexander Gordeev, linux-s390,
	Peter Oberparleiter

The measurement block address is an absolute address. Define the
associated schib_config and schib fields as dma64_t to enable automatic
detection of incorrect assignments. Also add the missing virt_to_dma64()
translation.

Without this fix, a wrong address will be used by firmware when storing
extended format channel measurement data on kernels built with
CONFIG_RANDOMIZE_IDENTITY_BASE=y.

Fixes: 14edd0d73bfe ("s390/cmf: fix virtual vs physical address confusion")
Cc: <stable@vger.kernel.org>
Signed-off-by: Peter Oberparleiter <oberpar@linux.ibm.com>
---
v2:
  - Change type of mba field from u64 to dma64_t
  - Add fixes and cc-stable tags

 drivers/s390/cio/cio.h | 5 +++--
 drivers/s390/cio/cmf.c | 2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/s390/cio/cio.h b/drivers/s390/cio/cio.h
index bad142c536e1..e0a6b4663ff1 100644
--- a/drivers/s390/cio/cio.h
+++ b/drivers/s390/cio/cio.h
@@ -7,6 +7,7 @@
 #include <linux/mod_devicetable.h>
 #include <asm/chpid.h>
 #include <asm/cio.h>
+#include <asm/dma-types.h>
 #include <asm/fcx.h>
 #include <asm/schid.h>
 #include <asm/tpi.h>
@@ -49,7 +50,7 @@ struct pmcw {
 
 /* Target SCHIB configuration. */
 struct schib_config {
-	u64 mba;
+	dma64_t mba;
 	u32 intparm;
 	u16 mbi;
 	u32 isc:3;
@@ -66,7 +67,7 @@ struct schib_config {
 struct schib {
 	struct pmcw pmcw;	 /* path management control word */
 	union scsw scsw;	 /* subchannel status word */
-	__u64 mba;               /* measurement block address */
+	dma64_t mba;             /* measurement block address */
 	__u8 mda[4];		 /* model dependent area */
 } __attribute__ ((packed,aligned(4)));
 
diff --git a/drivers/s390/cio/cmf.c b/drivers/s390/cio/cmf.c
index 8fd41a7dfc20..02b0feb9d1fd 100644
--- a/drivers/s390/cio/cmf.c
+++ b/drivers/s390/cio/cmf.c
@@ -183,7 +183,7 @@ static int set_schib(struct ccw_device *cdev, u32 mme, int mbfc,
 	sch->config.mbfc = mbfc;
 	/* address can be either a block address or a block index */
 	if (mbfc)
-		sch->config.mba = address;
+		sch->config.mba = address ? virt_to_dma64((void *)address) : 0;
 	else
 		sch->config.mbi = address;
 
-- 
2.53.0


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

* Re: [PATCH v2] s390/cmf: Fix virtual vs physical address confusion
  2026-09-21 13:16 [PATCH v2] s390/cmf: Fix virtual vs physical address confusion Peter Oberparleiter
@ 2026-09-21 13:25 ` sashiko-bot
  2026-09-21 15:23 ` Heiko Carstens
  1 sibling, 0 replies; 3+ messages in thread
From: sashiko-bot @ 2026-09-21 13:25 UTC (permalink / raw)
  To: Peter Oberparleiter
  Cc: Heiko Carstens, Alexander Gordeev, linux-s390,
	Christian Borntraeger, Vasily Gorbik

> The measurement block address is an absolute address. Define the
> associated schib_config and schib fields as dma64_t to enable automatic
> detection of incorrect assignments. Also add the missing virt_to_dma64()
> translation.
> 
> Without this fix, a wrong address will be used by firmware when storing
> extended format channel measurement data on kernels built with
> CONFIG_RANDOMIZE_IDENTITY_BASE=y.
> 
> Fixes: 14edd0d73bfe ("s390/cmf: fix virtual vs physical address confusion")
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Peter Oberparleiter <oberpar@linux.ibm.com>

Sashiko has reviewed this patch and found no issues. It looks great!

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260921131648.3636771-1-oberpar@linux.ibm.com?part=1


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

* Re: [PATCH v2] s390/cmf: Fix virtual vs physical address confusion
  2026-09-21 13:16 [PATCH v2] s390/cmf: Fix virtual vs physical address confusion Peter Oberparleiter
  2026-09-21 13:25 ` sashiko-bot
@ 2026-09-21 15:23 ` Heiko Carstens
  1 sibling, 0 replies; 3+ messages in thread
From: Heiko Carstens @ 2026-09-21 15:23 UTC (permalink / raw)
  To: Peter Oberparleiter
  Cc: Vineeth Vijayan, Vasily Gorbik, Alexander Gordeev, linux-s390

On Mon, Sep 21, 2026 at 03:16:48PM +0200, Peter Oberparleiter wrote:
> The measurement block address is an absolute address. Define the
> associated schib_config and schib fields as dma64_t to enable automatic
> detection of incorrect assignments. Also add the missing virt_to_dma64()
> translation.
> 
> Without this fix, a wrong address will be used by firmware when storing
> extended format channel measurement data on kernels built with
> CONFIG_RANDOMIZE_IDENTITY_BASE=y.
> 
> Fixes: 14edd0d73bfe ("s390/cmf: fix virtual vs physical address confusion")
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Peter Oberparleiter <oberpar@linux.ibm.com>
> ---
> v2:
>   - Change type of mba field from u64 to dma64_t
>   - Add fixes and cc-stable tags
> 
>  drivers/s390/cio/cio.h | 5 +++--
>  drivers/s390/cio/cmf.c | 2 +-
>  2 files changed, 4 insertions(+), 3 deletions(-)

Applied, thanks!

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

end of thread, other threads:[~2026-09-21 15:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-21 13:16 [PATCH v2] s390/cmf: Fix virtual vs physical address confusion Peter Oberparleiter
2026-09-21 13:25 ` sashiko-bot
2026-09-21 15:23 ` Heiko Carstens

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox