linux-s390.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] KVM: s390: pci: fix GAIT physical vs virtual pointers usage
@ 2022-09-07 15:59 Matthew Rosato
  2022-09-09  9:52 ` Claudio Imbrenda
  2022-09-20  8:25 ` Janosch Frank
  0 siblings, 2 replies; 3+ messages in thread
From: Matthew Rosato @ 2022-09-07 15:59 UTC (permalink / raw)
  To: linux-s390
  Cc: nrb, pmorel, schnelle, farman, borntraeger, hca, gor, agordeev,
	svens, frankja, david, imbrenda, kvm, linux-kernel

The GAIT and all of its entries must be represented by physical
addresses as this structure is shared with underlying firmware.
We can keep a virtual address of the GAIT origin in order to
handle processing in the kernel, but when traversing the entries
we must again convert the physical AISB stored in that GAIT entry
into a virtual address in order to process it.

Note: this currently doesn't fix a real bug, since virtual addresses
are indentical to physical ones.

Reviewed-by: Pierre Morel <pmorel@linux.ibm.com>
Acked-by: Nico Boehr <nrb@linux.ibm.com>
Signed-off-by: Matthew Rosato <mjrosato@linux.ibm.com>
---
 arch/s390/kvm/interrupt.c | 2 +-
 arch/s390/kvm/pci.c       | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/s390/kvm/interrupt.c b/arch/s390/kvm/interrupt.c
index b9c944b262c7..ab569faf0df2 100644
--- a/arch/s390/kvm/interrupt.c
+++ b/arch/s390/kvm/interrupt.c
@@ -3324,7 +3324,7 @@ static void aen_host_forward(unsigned long si)
 	if (gaite->count == 0)
 		return;
 	if (gaite->aisb != 0)
-		set_bit_inv(gaite->aisbo, (unsigned long *)gaite->aisb);
+		set_bit_inv(gaite->aisbo, phys_to_virt(gaite->aisb));
 
 	kvm = kvm_s390_pci_si_to_kvm(aift, si);
 	if (!kvm)
diff --git a/arch/s390/kvm/pci.c b/arch/s390/kvm/pci.c
index bb8c335d17b9..8cfa0b03ebbb 100644
--- a/arch/s390/kvm/pci.c
+++ b/arch/s390/kvm/pci.c
@@ -71,7 +71,7 @@ static int zpci_setup_aipb(u8 nisc)
 		rc = -ENOMEM;
 		goto free_sbv;
 	}
-	aift->gait = (struct zpci_gaite *)page_to_phys(page);
+	aift->gait = (struct zpci_gaite *)page_to_virt(page);
 
 	zpci_aipb->aipb.faisb = virt_to_phys(aift->sbv->vector);
 	zpci_aipb->aipb.gait = virt_to_phys(aift->gait);
-- 
2.37.3


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

* Re: [PATCH] KVM: s390: pci: fix GAIT physical vs virtual pointers usage
  2022-09-07 15:59 [PATCH] KVM: s390: pci: fix GAIT physical vs virtual pointers usage Matthew Rosato
@ 2022-09-09  9:52 ` Claudio Imbrenda
  2022-09-20  8:25 ` Janosch Frank
  1 sibling, 0 replies; 3+ messages in thread
From: Claudio Imbrenda @ 2022-09-09  9:52 UTC (permalink / raw)
  To: Matthew Rosato
  Cc: linux-s390, nrb, pmorel, schnelle, farman, borntraeger, hca, gor,
	agordeev, svens, frankja, david, kvm, linux-kernel

On Wed,  7 Sep 2022 11:59:52 -0400
Matthew Rosato <mjrosato@linux.ibm.com> wrote:

> The GAIT and all of its entries must be represented by physical
> addresses as this structure is shared with underlying firmware.
> We can keep a virtual address of the GAIT origin in order to
> handle processing in the kernel, but when traversing the entries
> we must again convert the physical AISB stored in that GAIT entry
> into a virtual address in order to process it.
> 
> Note: this currently doesn't fix a real bug, since virtual addresses
> are indentical to physical ones.
> 
> Reviewed-by: Pierre Morel <pmorel@linux.ibm.com>
> Acked-by: Nico Boehr <nrb@linux.ibm.com>
> Signed-off-by: Matthew Rosato <mjrosato@linux.ibm.com>

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

> ---
>  arch/s390/kvm/interrupt.c | 2 +-
>  arch/s390/kvm/pci.c       | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/s390/kvm/interrupt.c b/arch/s390/kvm/interrupt.c
> index b9c944b262c7..ab569faf0df2 100644
> --- a/arch/s390/kvm/interrupt.c
> +++ b/arch/s390/kvm/interrupt.c
> @@ -3324,7 +3324,7 @@ static void aen_host_forward(unsigned long si)
>  	if (gaite->count == 0)
>  		return;
>  	if (gaite->aisb != 0)
> -		set_bit_inv(gaite->aisbo, (unsigned long *)gaite->aisb);
> +		set_bit_inv(gaite->aisbo, phys_to_virt(gaite->aisb));
>  
>  	kvm = kvm_s390_pci_si_to_kvm(aift, si);
>  	if (!kvm)
> diff --git a/arch/s390/kvm/pci.c b/arch/s390/kvm/pci.c
> index bb8c335d17b9..8cfa0b03ebbb 100644
> --- a/arch/s390/kvm/pci.c
> +++ b/arch/s390/kvm/pci.c
> @@ -71,7 +71,7 @@ static int zpci_setup_aipb(u8 nisc)
>  		rc = -ENOMEM;
>  		goto free_sbv;
>  	}
> -	aift->gait = (struct zpci_gaite *)page_to_phys(page);
> +	aift->gait = (struct zpci_gaite *)page_to_virt(page);
>  
>  	zpci_aipb->aipb.faisb = virt_to_phys(aift->sbv->vector);
>  	zpci_aipb->aipb.gait = virt_to_phys(aift->gait);


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

* Re: [PATCH] KVM: s390: pci: fix GAIT physical vs virtual pointers usage
  2022-09-07 15:59 [PATCH] KVM: s390: pci: fix GAIT physical vs virtual pointers usage Matthew Rosato
  2022-09-09  9:52 ` Claudio Imbrenda
@ 2022-09-20  8:25 ` Janosch Frank
  1 sibling, 0 replies; 3+ messages in thread
From: Janosch Frank @ 2022-09-20  8:25 UTC (permalink / raw)
  To: Matthew Rosato, linux-s390
  Cc: nrb, pmorel, schnelle, farman, borntraeger, hca, gor, agordeev,
	svens, david, imbrenda, kvm, linux-kernel

On 9/7/22 17:59, Matthew Rosato wrote:
> The GAIT and all of its entries must be represented by physical
> addresses as this structure is shared with underlying firmware.
> We can keep a virtual address of the GAIT origin in order to
> handle processing in the kernel, but when traversing the entries
> we must again convert the physical AISB stored in that GAIT entry
> into a virtual address in order to process it.
> 
> Note: this currently doesn't fix a real bug, since virtual addresses
> are indentical to physical ones.
> 
> Reviewed-by: Pierre Morel <pmorel@linux.ibm.com>
> Acked-by: Nico Boehr <nrb@linux.ibm.com>
> Signed-off-by: Matthew Rosato <mjrosato@linux.ibm.com>

Thanks, applied


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

end of thread, other threads:[~2022-09-20  8:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-07 15:59 [PATCH] KVM: s390: pci: fix GAIT physical vs virtual pointers usage Matthew Rosato
2022-09-09  9:52 ` Claudio Imbrenda
2022-09-20  8:25 ` Janosch Frank

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).