Linux s390 Architecture development
 help / color / mirror / Atom feed
* [PATCH] s390/cmf: Fix virtual vs physical address confusion
@ 2026-09-18 16:12 Peter Oberparleiter
  2026-09-18 16:20 ` sashiko-bot
  2026-09-20 16:15 ` Heiko Carstens
  0 siblings, 2 replies; 4+ messages in thread
From: Peter Oberparleiter @ 2026-09-18 16:12 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; therefore add a
missing virt_to_phys() 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.

Signed-off-by: Peter Oberparleiter <oberpar@linux.ibm.com>
---
 drivers/s390/cio/cmf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/s390/cio/cmf.c b/drivers/s390/cio/cmf.c
index 92ab3d546fe4..5f57a12762d2 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_phys((void *)address) : 0;
 	else
 		sch->config.mbi = address;
 
-- 
2.53.0


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

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

> The measurement block address is an absolute address; therefore add a
> missing virt_to_phys() 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.
> 
> 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/20260918161207.1756809-1-oberpar@linux.ibm.com?part=1


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

* Re: [PATCH] s390/cmf: Fix virtual vs physical address confusion
  2026-09-18 16:12 [PATCH] s390/cmf: Fix virtual vs physical address confusion Peter Oberparleiter
  2026-09-18 16:20 ` sashiko-bot
@ 2026-09-20 16:15 ` Heiko Carstens
  2026-09-21 10:58   ` Peter Oberparleiter
  1 sibling, 1 reply; 4+ messages in thread
From: Heiko Carstens @ 2026-09-20 16:15 UTC (permalink / raw)
  To: Peter Oberparleiter
  Cc: Vineeth Vijayan, Vasily Gorbik, Alexander Gordeev, linux-s390

On Fri, Sep 18, 2026 at 06:12:07PM +0200, Peter Oberparleiter wrote:
> The measurement block address is an absolute address; therefore add a
> missing virt_to_phys() 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.
> 
> Signed-off-by: Peter Oberparleiter <oberpar@linux.ibm.com>
> ---
>  drivers/s390/cio/cmf.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/s390/cio/cmf.c b/drivers/s390/cio/cmf.c
> index 92ab3d546fe4..5f57a12762d2 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_phys((void *)address) : 0;

Would it make sense to change the type of the mba member in struct
schib_config and struct schib to dma64_t, and use virt_to_dma64()
instead of virt_to_phys() here?

That would add sparse type checking and would catch similar future bugs.

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

* Re: [PATCH] s390/cmf: Fix virtual vs physical address confusion
  2026-09-20 16:15 ` Heiko Carstens
@ 2026-09-21 10:58   ` Peter Oberparleiter
  0 siblings, 0 replies; 4+ messages in thread
From: Peter Oberparleiter @ 2026-09-21 10:58 UTC (permalink / raw)
  To: Heiko Carstens
  Cc: Vineeth Vijayan, Vasily Gorbik, Alexander Gordeev, linux-s390

On 20.09.2026 18:15, Heiko Carstens wrote:
> On Fri, Sep 18, 2026 at 06:12:07PM +0200, Peter Oberparleiter wrote:
>> The measurement block address is an absolute address; therefore add a
>> missing virt_to_phys() 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.
>>
>> Signed-off-by: Peter Oberparleiter <oberpar@linux.ibm.com>
>> ---
>>  drivers/s390/cio/cmf.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/s390/cio/cmf.c b/drivers/s390/cio/cmf.c
>> index 92ab3d546fe4..5f57a12762d2 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_phys((void *)address) : 0;
> 
> Would it make sense to change the type of the mba member in struct
> schib_config and struct schib to dma64_t, and use virt_to_dma64()
> instead of virt_to_phys() here?
> 
> That would add sparse type checking and would catch similar future bugs.

Sounds good - I'll prepare a v2.


-- 
Peter Oberparleiter
Linux on IBM Z Development - IBM Germany R&D

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

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

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

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