* [PATCH v2 0/1] s390: ipl: fix physical-virtual confusion for diag308
@ 2023-03-10 13:02 Nico Boehr
2023-03-10 13:02 ` [PATCH v2 1/1] " Nico Boehr
0 siblings, 1 reply; 3+ messages in thread
From: Nico Boehr @ 2023-03-10 13:02 UTC (permalink / raw)
To: hca, gor, agordeev, borntraeger, svens; +Cc: linux-s390, mhartmay
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 | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--
2.39.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH v2 1/1] s390: ipl: fix physical-virtual confusion for diag308
2023-03-10 13:02 [PATCH v2 0/1] s390: ipl: fix physical-virtual confusion for diag308 Nico Boehr
@ 2023-03-10 13:02 ` Nico Boehr
2023-03-10 13:23 ` Alexander Gordeev
0 siblings, 1 reply; 3+ messages in thread
From: Nico Boehr @ 2023-03-10 13:02 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, this is _currently_ fine since
virt_to_phys(0) == 0. But in the future, lowcore addresses might no
longer be special, so make sure we pass 0 to hardware in case addr is
NULL.
Suggested-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Signed-off-by: Nico Boehr <nrb@linux.ibm.com>
---
arch/s390/kernel/ipl.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/s390/kernel/ipl.c b/arch/s390/kernel/ipl.c
index 5f0f5c86963a..d8b8a87626f7 100644
--- a/arch/s390/kernel/ipl.c
+++ b/arch/s390/kernel/ipl.c
@@ -176,7 +176,7 @@ 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, u64 addr)
{
union register_pair r1;
@@ -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] 3+ messages in thread* Re: [PATCH v2 1/1] s390: ipl: fix physical-virtual confusion for diag308
2023-03-10 13:02 ` [PATCH v2 1/1] " Nico Boehr
@ 2023-03-10 13:23 ` Alexander Gordeev
0 siblings, 0 replies; 3+ messages in thread
From: Alexander Gordeev @ 2023-03-10 13:23 UTC (permalink / raw)
To: Nico Boehr; +Cc: hca, gor, borntraeger, svens, linux-s390, mhartmay
On Fri, Mar 10, 2023 at 02:02:36PM +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.
You change the prototype though ;)
> Note that several callers pass NULL as addr, this is _currently_ fine since
> virt_to_phys(0) == 0. But in the future, lowcore addresses might no
> longer be special, so make sure we pass 0 to hardware in case addr is
> NULL.
This paragraph seems to me is extra or not precise at least.
The reason for explicit NULL check is not virt_to_phys(NULL)
might return non-0 in the future, but rather virt_to_phys(NULL)
is not expected returning 0 on any architecture.
> Suggested-by: Marc Hartmayer <mhartmay@linux.ibm.com>
> Signed-off-by: Nico Boehr <nrb@linux.ibm.com>
> ---
> arch/s390/kernel/ipl.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/s390/kernel/ipl.c b/arch/s390/kernel/ipl.c
> index 5f0f5c86963a..d8b8a87626f7 100644
> --- a/arch/s390/kernel/ipl.c
> +++ b/arch/s390/kernel/ipl.c
> @@ -176,7 +176,7 @@ 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, u64 addr)
Physical addresses are unsigned longs. Why u64 then?
Also the cast to unsigned long (not seen here) becomes redundant.
> {
> union register_pair r1;
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-03-10 14:10 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-10 13:02 [PATCH v2 0/1] s390: ipl: fix physical-virtual confusion for diag308 Nico Boehr
2023-03-10 13:02 ` [PATCH v2 1/1] " Nico Boehr
2023-03-10 13:23 ` Alexander Gordeev
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox