All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 0/1] s390: nmi: fix virtual-physical address confusion
@ 2023-02-15 16:02 Nico Boehr
  2023-02-15 16:02 ` [PATCH v1 1/1] " Nico Boehr
  0 siblings, 1 reply; 6+ messages in thread
From: Nico Boehr @ 2023-02-15 16:02 UTC (permalink / raw)
  To: borntraeger, frankja, imbrenda; +Cc: kvm, linux-s390

When a machine check is received while in SIE, it is reinjected into the
guest in some cases. The respective code needs to access the sie_block,
which is taken from the backed up R14.

Since reinjection only occurs while we are in SIE (i.e. between the
labels sie_entry and sie_leave in entry.S and thus if CIF_MCCK_GUEST is
set), the backed up R14 will always contain a physical address in
s390_backup_mcck_info.

This currently works, because virtual and physical addresses are
the same.

Add phys_to_virt() to resolve the virtual-physical confusion.

Nico Boehr (1):
  s390: nmi: fix virtual-physical address confusion

 arch/s390/kernel/nmi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.39.1


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

* [PATCH v1 1/1] s390: nmi: fix virtual-physical address confusion
  2023-02-15 16:02 [PATCH v1 0/1] s390: nmi: fix virtual-physical address confusion Nico Boehr
@ 2023-02-15 16:02 ` Nico Boehr
  2023-02-15 16:20   ` Claudio Imbrenda
  2023-02-16  6:17   ` Alexander Gordeev
  0 siblings, 2 replies; 6+ messages in thread
From: Nico Boehr @ 2023-02-15 16:02 UTC (permalink / raw)
  To: borntraeger, frankja, imbrenda; +Cc: kvm, linux-s390

When a machine check is received while in SIE, it is reinjected into the
guest in some cases. The respective code needs to access the sie_block,
which is taken from the backed up R14.

Since reinjection only occurs while we are in SIE (i.e. between the
labels sie_entry and sie_leave in entry.S and thus if CIF_MCCK_GUEST is
set), the backed up R14 will always contain a physical address in
s390_backup_mcck_info.

This currently works, because virtual and physical addresses are
the same.

Add phys_to_virt() to resolve the virtual-physical confusion.

Signed-off-by: Nico Boehr <nrb@linux.ibm.com>
---
 arch/s390/kernel/nmi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/s390/kernel/nmi.c b/arch/s390/kernel/nmi.c
index 5dbf274719a9..322160328866 100644
--- a/arch/s390/kernel/nmi.c
+++ b/arch/s390/kernel/nmi.c
@@ -347,7 +347,7 @@ static void notrace s390_backup_mcck_info(struct pt_regs *regs)
 
 	/* r14 contains the sie block, which was set in sie64a */
 	struct kvm_s390_sie_block *sie_block =
-			(struct kvm_s390_sie_block *) regs->gprs[14];
+			(struct kvm_s390_sie_block *)phys_to_virt(regs->gprs[14]);
 
 	if (sie_block == NULL)
 		/* Something's seriously wrong, stop system. */
-- 
2.39.1


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

* Re: [PATCH v1 1/1] s390: nmi: fix virtual-physical address confusion
  2023-02-15 16:02 ` [PATCH v1 1/1] " Nico Boehr
@ 2023-02-15 16:20   ` Claudio Imbrenda
  2023-02-16  6:17   ` Alexander Gordeev
  1 sibling, 0 replies; 6+ messages in thread
From: Claudio Imbrenda @ 2023-02-15 16:20 UTC (permalink / raw)
  To: Nico Boehr; +Cc: borntraeger, frankja, kvm, linux-s390

On Wed, 15 Feb 2023 17:02:52 +0100
Nico Boehr <nrb@linux.ibm.com> wrote:

> When a machine check is received while in SIE, it is reinjected into the
> guest in some cases. The respective code needs to access the sie_block,
> which is taken from the backed up R14.
> 
> Since reinjection only occurs while we are in SIE (i.e. between the
> labels sie_entry and sie_leave in entry.S and thus if CIF_MCCK_GUEST is
> set), the backed up R14 will always contain a physical address in
> s390_backup_mcck_info.
> 
> This currently works, because virtual and physical addresses are
> the same.
> 
> Add phys_to_virt() to resolve the virtual-physical confusion.
> 
> Signed-off-by: Nico Boehr <nrb@linux.ibm.com>

Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>

> ---
>  arch/s390/kernel/nmi.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/s390/kernel/nmi.c b/arch/s390/kernel/nmi.c
> index 5dbf274719a9..322160328866 100644
> --- a/arch/s390/kernel/nmi.c
> +++ b/arch/s390/kernel/nmi.c
> @@ -347,7 +347,7 @@ static void notrace s390_backup_mcck_info(struct pt_regs *regs)
>  
>  	/* r14 contains the sie block, which was set in sie64a */
>  	struct kvm_s390_sie_block *sie_block =
> -			(struct kvm_s390_sie_block *) regs->gprs[14];
> +			(struct kvm_s390_sie_block *)phys_to_virt(regs->gprs[14]);
>  
>  	if (sie_block == NULL)
>  		/* Something's seriously wrong, stop system. */


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

* Re: [PATCH v1 1/1] s390: nmi: fix virtual-physical address confusion
  2023-02-15 16:02 ` [PATCH v1 1/1] " Nico Boehr
  2023-02-15 16:20   ` Claudio Imbrenda
@ 2023-02-16  6:17   ` Alexander Gordeev
  2023-02-16  9:38     ` Alexander Gordeev
  1 sibling, 1 reply; 6+ messages in thread
From: Alexander Gordeev @ 2023-02-16  6:17 UTC (permalink / raw)
  To: Nico Boehr; +Cc: borntraeger, frankja, imbrenda, kvm, linux-s390

On Wed, Feb 15, 2023 at 05:02:52PM +0100, Nico Boehr wrote:
> When a machine check is received while in SIE, it is reinjected into the
> guest in some cases. The respective code needs to access the sie_block,
> which is taken from the backed up R14.
> 
> Since reinjection only occurs while we are in SIE (i.e. between the
> labels sie_entry and sie_leave in entry.S and thus if CIF_MCCK_GUEST is
> set), the backed up R14 will always contain a physical address in
> s390_backup_mcck_info.
> 
> This currently works, because virtual and physical addresses are
> the same.
> 
> Add phys_to_virt() to resolve the virtual-physical confusion.
> 
> Signed-off-by: Nico Boehr <nrb@linux.ibm.com>
> ---
>  arch/s390/kernel/nmi.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/s390/kernel/nmi.c b/arch/s390/kernel/nmi.c
> index 5dbf274719a9..322160328866 100644
> --- a/arch/s390/kernel/nmi.c
> +++ b/arch/s390/kernel/nmi.c
> @@ -347,7 +347,7 @@ static void notrace s390_backup_mcck_info(struct pt_regs *regs)
>  
>  	/* r14 contains the sie block, which was set in sie64a */
>  	struct kvm_s390_sie_block *sie_block =
> -			(struct kvm_s390_sie_block *) regs->gprs[14];
> +			(struct kvm_s390_sie_block *)phys_to_virt(regs->gprs[14]);

Casting to (struct kvm_s390_sie_block *) is not superfluous,
since phys_to_virt() returns (void *).

>  
>  	if (sie_block == NULL)
>  		/* Something's seriously wrong, stop system. */

Reviewed-by: Alexander Gordeev <agordeev@linux.ibm.com>

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

* Re: [PATCH v1 1/1] s390: nmi: fix virtual-physical address confusion
  2023-02-16  6:17   ` Alexander Gordeev
@ 2023-02-16  9:38     ` Alexander Gordeev
  2023-02-16 10:17       ` Janosch Frank
  0 siblings, 1 reply; 6+ messages in thread
From: Alexander Gordeev @ 2023-02-16  9:38 UTC (permalink / raw)
  To: Nico Boehr; +Cc: borntraeger, frankja, imbrenda, kvm, linux-s390

On Thu, Feb 16, 2023 at 07:17:07AM +0100, Alexander Gordeev wrote:
> Casting to (struct kvm_s390_sie_block *) is not superfluous,

s/not//

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

* Re: [PATCH v1 1/1] s390: nmi: fix virtual-physical address confusion
  2023-02-16  9:38     ` Alexander Gordeev
@ 2023-02-16 10:17       ` Janosch Frank
  0 siblings, 0 replies; 6+ messages in thread
From: Janosch Frank @ 2023-02-16 10:17 UTC (permalink / raw)
  To: Alexander Gordeev, Nico Boehr; +Cc: borntraeger, imbrenda, kvm, linux-s390

On 2/16/23 10:38, Alexander Gordeev wrote:
> On Thu, Feb 16, 2023 at 07:17:07AM +0100, Alexander Gordeev wrote:
>> Casting to (struct kvm_s390_sie_block *) is not superfluous,
> 
> s/not//

Do you want to pick this up or should it go through the kvm tree?

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

end of thread, other threads:[~2023-02-16 10:17 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-15 16:02 [PATCH v1 0/1] s390: nmi: fix virtual-physical address confusion Nico Boehr
2023-02-15 16:02 ` [PATCH v1 1/1] " Nico Boehr
2023-02-15 16:20   ` Claudio Imbrenda
2023-02-16  6:17   ` Alexander Gordeev
2023-02-16  9:38     ` Alexander Gordeev
2023-02-16 10:17       ` Janosch Frank

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.