s390/cmf: Fix virtual vs physical address confusion
Subsystems (2)
Peter Oberparleiter
maintainerPATCH v2 1/1 s390/cmf: Fix virtual vs physical address confusion
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.
---
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(-)
drivers/s390/cio/cio.h +3 -2
@@ -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 )));
drivers/s390/cio/cmf.c +1 -1
@@ -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;
Signature · 1 line
2.53.0
[email protected]
AI reviewSashiko has reviewed this patch and found no issues. It looks great!
Quoted 5 lines
The measurement block address is an absolute address. Define the associated
schib_configand schib fields asdma64_tto enable automatic detection of incorrect assignments. Also add the missingvirt_to_dma64()translation.
Quoted 7 lines
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 <[email protected]>Signed-off-by Peter Oberparleiter <[email protected]>
Sashiko has reviewed this patch and found no issues. It looks great!
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Quoted 12 lines · Peter Oberparleiter
The measurement block address is an absolute address. Define the associated
schib_configand schib fields asdma64_tto enable automatic detection of incorrect assignments. Also add the missingvirt_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 <[email protected]>Signed-off-by Peter Oberparleiter <[email protected]>
Quoted 8 lines
---
v2:
- Change type of mba field from u64 todma64_t
- Add fixes and cc-stable tagsdrivers/s390/cio/cio.h | 5 +++-- drivers/s390/cio/cmf.c | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-)
Applied, thanks!