KVM: s390: pci: fix GAIT physical vs virtual pointers usage
PATCH 1/1 KVM: s390: pci: fix GAIT physical vs virtual pointers usage
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.
--- arch/s390/kvm/interrupt.c | 2 +- arch/s390/kvm/pci.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/s390/kvm/interrupt.c +1 -1
@@ -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)
arch/s390/kvm/pci.c +1 -1
@@ -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);
Signature · 1 line
2.37.3
Quoted 7 lines · On Wed, 7 Sep 2022 11:59:52 -0400 Matthew Rosato <[email protected]>…
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.
Quoted 6 lines
Note: this currently doesn't fix a real bug, since virtual addresses are indentical to physical ones.
Reviewed-by Pierre Morel <[email protected]>Acked-by Nico Boehr <[email protected]>Signed-off-by Matthew Rosato <[email protected]>
Quoted 31 lines
--- arch/s390/kvm/interrupt.c | 2 +- arch/s390/kvm/pci.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)arch/s390/kvm/interrupt.c +1
-1@@ -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)arch/s390/kvm/pci.c +1
-1@@ -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);
Quoted 7 lines · Matthew Rosato
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.
Quoted 6 lines
Note: this currently doesn't fix a real bug, since virtual addresses are indentical to physical ones.
Reviewed-by Pierre Morel <[email protected]>Acked-by Nico Boehr <[email protected]>Signed-off-by Matthew Rosato <[email protected]>
Thanks, applied