* [v2 0/1] KVM: s390: VSIE: sort out virtual/physical address in pin_guest_page
@ 2022-10-25 8:20 Nico Boehr
2022-10-25 8:20 ` [v2 1/1] " Nico Boehr
2022-10-25 11:36 ` [v2 0/1] " Janosch Frank
0 siblings, 2 replies; 6+ messages in thread
From: Nico Boehr @ 2022-10-25 8:20 UTC (permalink / raw)
To: borntraeger, frankja, imbrenda; +Cc: kvm, linux-s390
v1->v2:
---
* remove useless cast (thanks Christian)
Nico Boehr (1):
KVM: s390: VSIE: sort out virtual/physical address in pin_guest_page
arch/s390/kvm/vsie.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--
2.37.3
^ permalink raw reply [flat|nested] 6+ messages in thread
* [v2 1/1] KVM: s390: VSIE: sort out virtual/physical address in pin_guest_page
2022-10-25 8:20 [v2 0/1] KVM: s390: VSIE: sort out virtual/physical address in pin_guest_page Nico Boehr
@ 2022-10-25 8:20 ` Nico Boehr
2022-10-25 8:34 ` Christian Borntraeger
2022-10-25 11:09 ` Claudio Imbrenda
2022-10-25 11:36 ` [v2 0/1] " Janosch Frank
1 sibling, 2 replies; 6+ messages in thread
From: Nico Boehr @ 2022-10-25 8:20 UTC (permalink / raw)
To: borntraeger, frankja, imbrenda; +Cc: kvm, linux-s390
pin_guest_page() used page_to_virt() to calculate the hpa of the pinned
page. This currently works, because virtual and physical addresses are
the same. Use page_to_phys() instead to resolve the virtual-real address
confusion.
One caller of pin_guest_page() actually expected the hpa to be a hva, so
add the missing phys_to_virt() conversion here.
Signed-off-by: Nico Boehr <nrb@linux.ibm.com>
---
arch/s390/kvm/vsie.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/s390/kvm/vsie.c b/arch/s390/kvm/vsie.c
index 94138f8f0c1c..0e9d020d7093 100644
--- a/arch/s390/kvm/vsie.c
+++ b/arch/s390/kvm/vsie.c
@@ -654,7 +654,7 @@ static int pin_guest_page(struct kvm *kvm, gpa_t gpa, hpa_t *hpa)
page = gfn_to_page(kvm, gpa_to_gfn(gpa));
if (is_error_page(page))
return -EINVAL;
- *hpa = (hpa_t) page_to_virt(page) + (gpa & ~PAGE_MASK);
+ *hpa = (hpa_t)page_to_phys(page) + (gpa & ~PAGE_MASK);
return 0;
}
@@ -869,7 +869,7 @@ static int pin_scb(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page,
WARN_ON_ONCE(rc);
return 1;
}
- vsie_page->scb_o = (struct kvm_s390_sie_block *) hpa;
+ vsie_page->scb_o = phys_to_virt(hpa);
return 0;
}
--
2.37.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [v2 1/1] KVM: s390: VSIE: sort out virtual/physical address in pin_guest_page
2022-10-25 8:20 ` [v2 1/1] " Nico Boehr
@ 2022-10-25 8:34 ` Christian Borntraeger
2022-10-25 9:08 ` David Hildenbrand
2022-10-25 11:09 ` Claudio Imbrenda
1 sibling, 1 reply; 6+ messages in thread
From: Christian Borntraeger @ 2022-10-25 8:34 UTC (permalink / raw)
To: Nico Boehr, frankja, imbrenda; +Cc: kvm, linux-s390, David Hildenbrand
Am 25.10.22 um 10:20 schrieb Nico Boehr:
> pin_guest_page() used page_to_virt() to calculate the hpa of the pinned
> page. This currently works, because virtual and physical addresses are
> the same. Use page_to_phys() instead to resolve the virtual-real address
> confusion.
>
> One caller of pin_guest_page() actually expected the hpa to be a hva, so
> add the missing phys_to_virt() conversion here.
>
> Signed-off-by: Nico Boehr <nrb@linux.ibm.com>
Looks good.
Reviewed-by: Christian Borntraeger <borntraeger@linux.ibm.com>
Adding David CC.
> ---
> arch/s390/kvm/vsie.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/s390/kvm/vsie.c b/arch/s390/kvm/vsie.c
> index 94138f8f0c1c..0e9d020d7093 100644
> --- a/arch/s390/kvm/vsie.c
> +++ b/arch/s390/kvm/vsie.c
> @@ -654,7 +654,7 @@ static int pin_guest_page(struct kvm *kvm, gpa_t gpa, hpa_t *hpa)
> page = gfn_to_page(kvm, gpa_to_gfn(gpa));
> if (is_error_page(page))
> return -EINVAL;
> - *hpa = (hpa_t) page_to_virt(page) + (gpa & ~PAGE_MASK);
> + *hpa = (hpa_t)page_to_phys(page) + (gpa & ~PAGE_MASK);
> return 0;
> }
>
> @@ -869,7 +869,7 @@ static int pin_scb(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page,
> WARN_ON_ONCE(rc);
> return 1;
> }
> - vsie_page->scb_o = (struct kvm_s390_sie_block *) hpa;
> + vsie_page->scb_o = phys_to_virt(hpa);
> return 0;
> }
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [v2 1/1] KVM: s390: VSIE: sort out virtual/physical address in pin_guest_page
2022-10-25 8:34 ` Christian Borntraeger
@ 2022-10-25 9:08 ` David Hildenbrand
0 siblings, 0 replies; 6+ messages in thread
From: David Hildenbrand @ 2022-10-25 9:08 UTC (permalink / raw)
To: Christian Borntraeger, Nico Boehr, frankja, imbrenda; +Cc: kvm, linux-s390
On 25.10.22 10:34, Christian Borntraeger wrote:
>
>
> Am 25.10.22 um 10:20 schrieb Nico Boehr:
>> pin_guest_page() used page_to_virt() to calculate the hpa of the pinned
>> page. This currently works, because virtual and physical addresses are
>> the same. Use page_to_phys() instead to resolve the virtual-real address
>> confusion.
>>
>> One caller of pin_guest_page() actually expected the hpa to be a hva, so
>> add the missing phys_to_virt() conversion here.
>>
>> Signed-off-by: Nico Boehr <nrb@linux.ibm.com>
>
> Looks good.
> Reviewed-by: Christian Borntraeger <borntraeger@linux.ibm.com>
>
>
> Adding David CC.
>
>> ---
>> arch/s390/kvm/vsie.c | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/arch/s390/kvm/vsie.c b/arch/s390/kvm/vsie.c
>> index 94138f8f0c1c..0e9d020d7093 100644
>> --- a/arch/s390/kvm/vsie.c
>> +++ b/arch/s390/kvm/vsie.c
>> @@ -654,7 +654,7 @@ static int pin_guest_page(struct kvm *kvm, gpa_t gpa, hpa_t *hpa)
>> page = gfn_to_page(kvm, gpa_to_gfn(gpa));
>> if (is_error_page(page))
>> return -EINVAL;
>> - *hpa = (hpa_t) page_to_virt(page) + (gpa & ~PAGE_MASK);
>> + *hpa = (hpa_t)page_to_phys(page) + (gpa & ~PAGE_MASK);
>> return 0;
>> }
>>
>> @@ -869,7 +869,7 @@ static int pin_scb(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page,
>> WARN_ON_ONCE(rc);
>> return 1;
>> }
>> - vsie_page->scb_o = (struct kvm_s390_sie_block *) hpa;
>> + vsie_page->scb_o = phys_to_virt(hpa);
>> return 0;
Right, we don't provide the scb to the SIE, but only read/write manually
from it.
Acked-by: David Hildenbrand <david@redhat.com>
--
Thanks,
David / dhildenb
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [v2 1/1] KVM: s390: VSIE: sort out virtual/physical address in pin_guest_page
2022-10-25 8:20 ` [v2 1/1] " Nico Boehr
2022-10-25 8:34 ` Christian Borntraeger
@ 2022-10-25 11:09 ` Claudio Imbrenda
1 sibling, 0 replies; 6+ messages in thread
From: Claudio Imbrenda @ 2022-10-25 11:09 UTC (permalink / raw)
To: Nico Boehr; +Cc: borntraeger, frankja, kvm, linux-s390
On Tue, 25 Oct 2022 10:20:39 +0200
Nico Boehr <nrb@linux.ibm.com> wrote:
> pin_guest_page() used page_to_virt() to calculate the hpa of the pinned
> page. This currently works, because virtual and physical addresses are
> the same. Use page_to_phys() instead to resolve the virtual-real address
> confusion.
>
> One caller of pin_guest_page() actually expected the hpa to be a hva, so
> add the missing phys_to_virt() conversion here.
>
> Signed-off-by: Nico Boehr <nrb@linux.ibm.com>
Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
> ---
> arch/s390/kvm/vsie.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/s390/kvm/vsie.c b/arch/s390/kvm/vsie.c
> index 94138f8f0c1c..0e9d020d7093 100644
> --- a/arch/s390/kvm/vsie.c
> +++ b/arch/s390/kvm/vsie.c
> @@ -654,7 +654,7 @@ static int pin_guest_page(struct kvm *kvm, gpa_t gpa, hpa_t *hpa)
> page = gfn_to_page(kvm, gpa_to_gfn(gpa));
> if (is_error_page(page))
> return -EINVAL;
> - *hpa = (hpa_t) page_to_virt(page) + (gpa & ~PAGE_MASK);
> + *hpa = (hpa_t)page_to_phys(page) + (gpa & ~PAGE_MASK);
> return 0;
> }
>
> @@ -869,7 +869,7 @@ static int pin_scb(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page,
> WARN_ON_ONCE(rc);
> return 1;
> }
> - vsie_page->scb_o = (struct kvm_s390_sie_block *) hpa;
> + vsie_page->scb_o = phys_to_virt(hpa);
> return 0;
> }
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [v2 0/1] KVM: s390: VSIE: sort out virtual/physical address in pin_guest_page
2022-10-25 8:20 [v2 0/1] KVM: s390: VSIE: sort out virtual/physical address in pin_guest_page Nico Boehr
2022-10-25 8:20 ` [v2 1/1] " Nico Boehr
@ 2022-10-25 11:36 ` Janosch Frank
1 sibling, 0 replies; 6+ messages in thread
From: Janosch Frank @ 2022-10-25 11:36 UTC (permalink / raw)
To: Nico Boehr, borntraeger, imbrenda; +Cc: kvm, linux-s390
On 10/25/22 10:20, Nico Boehr wrote:
> v1->v2:
> ---
> * remove useless cast (thanks Christian)
>
> Nico Boehr (1):
> KVM: s390: VSIE: sort out virtual/physical address in pin_guest_page
>
> arch/s390/kvm/vsie.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
I'll put this on devel since the initial patch set is already there to
get as much CI coverage as possible.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-10-25 11:36 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-25 8:20 [v2 0/1] KVM: s390: VSIE: sort out virtual/physical address in pin_guest_page Nico Boehr
2022-10-25 8:20 ` [v2 1/1] " Nico Boehr
2022-10-25 8:34 ` Christian Borntraeger
2022-10-25 9:08 ` David Hildenbrand
2022-10-25 11:09 ` Claudio Imbrenda
2022-10-25 11:36 ` [v2 0/1] " Janosch Frank
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox