* [PATCH v3 0/1] s390: ipl: fix physical-virtual confusion for diag308 @ 2023-03-10 13:34 Nico Boehr 2023-03-10 13:34 ` [PATCH v3 1/1] " Nico Boehr 0 siblings, 1 reply; 7+ messages in thread From: Nico Boehr @ 2023-03-10 13:34 UTC (permalink / raw) To: hca, gor, agordeev, borntraeger, svens; +Cc: linux-s390, mhartmay v3: --- * u64 -> unsigned long (thanks Alexander) * improve commit description a bit (thanks Alexander) v2: --- * add special handling for addr NULL (thanks Alexander) Nico Boehr (1): s390: ipl: fix physical-virtual confusion for diag308 arch/s390/kernel/ipl.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) -- 2.39.1 ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v3 1/1] s390: ipl: fix physical-virtual confusion for diag308 2023-03-10 13:34 [PATCH v3 0/1] s390: ipl: fix physical-virtual confusion for diag308 Nico Boehr @ 2023-03-10 13:34 ` Nico Boehr 2023-03-10 13:36 ` Alexander Gordeev 2023-03-31 6:48 ` Alexander Gordeev 0 siblings, 2 replies; 7+ messages in thread From: Nico Boehr @ 2023-03-10 13:34 UTC (permalink / raw) To: hca, gor, agordeev, borntraeger, svens; +Cc: linux-s390, mhartmay Diag 308 subcodes expect a physical address as their parameter. This currently is not a bug, but in the future physical and virtual addresses might differ. Fix the confusion by doing a virtual-to-physical conversion in the exported diag308() and leave the assembly wrapper __diag308() alone. Note that several callers pass NULL as addr, so check for the case when NULL is passed and pass 0 to hardware since virt_to_phys(0) might be nonzero. Suggested-by: Marc Hartmayer <mhartmay@linux.ibm.com> Signed-off-by: Nico Boehr <nrb@linux.ibm.com> --- arch/s390/kernel/ipl.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/s390/kernel/ipl.c b/arch/s390/kernel/ipl.c index 5f0f5c86963a..afac9970ce42 100644 --- a/arch/s390/kernel/ipl.c +++ b/arch/s390/kernel/ipl.c @@ -176,11 +176,11 @@ static bool reipl_fcp_clear; static bool reipl_ccw_clear; static bool reipl_eckd_clear; -static inline int __diag308(unsigned long subcode, void *addr) +static inline int __diag308(unsigned long subcode, unsigned long addr) { union register_pair r1; - r1.even = (unsigned long) addr; + r1.even = addr; r1.odd = 0; asm volatile( " diag %[r1],%[subcode],0x308\n" @@ -195,7 +195,7 @@ static inline int __diag308(unsigned long subcode, void *addr) int diag308(unsigned long subcode, void *addr) { diag_stat_inc(DIAG_STAT_X308); - return __diag308(subcode, addr); + return __diag308(subcode, addr ? virt_to_phys(addr) : 0); } EXPORT_SYMBOL_GPL(diag308); -- 2.39.1 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v3 1/1] s390: ipl: fix physical-virtual confusion for diag308 2023-03-10 13:34 ` [PATCH v3 1/1] " Nico Boehr @ 2023-03-10 13:36 ` Alexander Gordeev 2023-03-31 6:48 ` Alexander Gordeev 1 sibling, 0 replies; 7+ messages in thread From: Alexander Gordeev @ 2023-03-10 13:36 UTC (permalink / raw) To: Nico Boehr; +Cc: hca, gor, borntraeger, svens, linux-s390, mhartmay On Fri, Mar 10, 2023 at 02:34:11PM +0100, Nico Boehr wrote: > Diag 308 subcodes expect a physical address as their parameter. > > This currently is not a bug, but in the future physical and virtual > addresses might differ. > > Fix the confusion by doing a virtual-to-physical conversion in the > exported diag308() and leave the assembly wrapper __diag308() alone. > > Note that several callers pass NULL as addr, so check for the case when > NULL is passed and pass 0 to hardware since virt_to_phys(0) might be > nonzero. > > Suggested-by: Marc Hartmayer <mhartmay@linux.ibm.com> > Signed-off-by: Nico Boehr <nrb@linux.ibm.com> > --- > arch/s390/kernel/ipl.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/arch/s390/kernel/ipl.c b/arch/s390/kernel/ipl.c > index 5f0f5c86963a..afac9970ce42 100644 > --- a/arch/s390/kernel/ipl.c > +++ b/arch/s390/kernel/ipl.c > @@ -176,11 +176,11 @@ static bool reipl_fcp_clear; > static bool reipl_ccw_clear; > static bool reipl_eckd_clear; > > -static inline int __diag308(unsigned long subcode, void *addr) > +static inline int __diag308(unsigned long subcode, unsigned long addr) > { > union register_pair r1; > > - r1.even = (unsigned long) addr; > + r1.even = addr; > r1.odd = 0; > asm volatile( > " diag %[r1],%[subcode],0x308\n" > @@ -195,7 +195,7 @@ static inline int __diag308(unsigned long subcode, void *addr) > int diag308(unsigned long subcode, void *addr) > { > diag_stat_inc(DIAG_STAT_X308); > - return __diag308(subcode, addr); > + return __diag308(subcode, addr ? virt_to_phys(addr) : 0); > } > EXPORT_SYMBOL_GPL(diag308); Reviewed-by: Alexander Gordeev <agordeev@linux.ibm.com> ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v3 1/1] s390: ipl: fix physical-virtual confusion for diag308 2023-03-10 13:34 ` [PATCH v3 1/1] " Nico Boehr 2023-03-10 13:36 ` Alexander Gordeev @ 2023-03-31 6:48 ` Alexander Gordeev 2023-03-31 7:16 ` Nico Boehr 1 sibling, 1 reply; 7+ messages in thread From: Alexander Gordeev @ 2023-03-31 6:48 UTC (permalink / raw) To: Nico Boehr; +Cc: hca, gor, borntraeger, svens, linux-s390, mhartmay Hi Nico, Anything prevents this one from pushing? Thanks! ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v3 1/1] s390: ipl: fix physical-virtual confusion for diag308 2023-03-31 6:48 ` Alexander Gordeev @ 2023-03-31 7:16 ` Nico Boehr 2023-04-04 6:39 ` Alexander Gordeev 0 siblings, 1 reply; 7+ messages in thread From: Nico Boehr @ 2023-03-31 7:16 UTC (permalink / raw) To: Alexander Gordeev; +Cc: hca, gor, borntraeger, svens, linux-s390, mhartmay Quoting Alexander Gordeev (2023-03-31 08:48:37) > Hi Nico, > > Anything prevents this one from pushing? No, can be pushed. ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v3 1/1] s390: ipl: fix physical-virtual confusion for diag308 2023-03-31 7:16 ` Nico Boehr @ 2023-04-04 6:39 ` Alexander Gordeev 2023-04-04 7:06 ` Nico Boehr 0 siblings, 1 reply; 7+ messages in thread From: Alexander Gordeev @ 2023-04-04 6:39 UTC (permalink / raw) To: Nico Boehr; +Cc: hca, gor, borntraeger, svens, linux-s390, mhartmay On Fri, Mar 31, 2023 at 09:16:14AM +0200, Nico Boehr wrote: > > Anything prevents this one from pushing? > No, can be pushed. Could you push it then, please? ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v3 1/1] s390: ipl: fix physical-virtual confusion for diag308 2023-04-04 6:39 ` Alexander Gordeev @ 2023-04-04 7:06 ` Nico Boehr 0 siblings, 0 replies; 7+ messages in thread From: Nico Boehr @ 2023-04-04 7:06 UTC (permalink / raw) To: Alexander Gordeev; +Cc: hca, gor, borntraeger, svens, linux-s390, mhartmay Quoting Alexander Gordeev (2023-04-04 08:39:12) > On Fri, Mar 31, 2023 at 09:16:14AM +0200, Nico Boehr wrote: > > > Anything prevents this one from pushing? > > No, can be pushed. > > Could you push it then, please? Done. ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2023-04-04 7:06 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2023-03-10 13:34 [PATCH v3 0/1] s390: ipl: fix physical-virtual confusion for diag308 Nico Boehr 2023-03-10 13:34 ` [PATCH v3 1/1] " Nico Boehr 2023-03-10 13:36 ` Alexander Gordeev 2023-03-31 6:48 ` Alexander Gordeev 2023-03-31 7:16 ` Nico Boehr 2023-04-04 6:39 ` Alexander Gordeev 2023-04-04 7:06 ` Nico Boehr
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox