From: Christian Borntraeger <borntraeger@linux.ibm.com>
To: Nico Boehr <nrb@linux.ibm.com>,
frankja@linux.ibm.com, imbrenda@linux.ibm.com
Cc: kvm@vger.kernel.org, linux-s390@vger.kernel.org,
David Hildenbrand <david@redhat.com>
Subject: Re: [v1] KVM: s390: VSIE: sort out virtual/physical address in pin_guest_page
Date: Tue, 25 Oct 2022 08:37:21 +0200 [thread overview]
Message-ID: <6dec3e0e-4b77-ffe9-533f-207606e327c4@linux.ibm.com> (raw)
In-Reply-To: <20221024160237.33912-1-nrb@linux.ibm.com>
Am 24.10.22 um 18:02 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>
> ---
> 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..c6a10ff46d58 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 = (struct kvm_s390_sie_block *)phys_to_virt(hpa);
Do we still need the cast here? phys_to_virt should return a void * and the assignment should succeed.
> return 0;
> }
>
next prev parent reply other threads:[~2022-10-25 6:37 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-24 16:02 [v1] KVM: s390: VSIE: sort out virtual/physical address in pin_guest_page Nico Boehr
2022-10-25 6:37 ` Christian Borntraeger [this message]
2022-10-25 8:21 ` Nico Boehr
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6dec3e0e-4b77-ffe9-533f-207606e327c4@linux.ibm.com \
--to=borntraeger@linux.ibm.com \
--cc=david@redhat.com \
--cc=frankja@linux.ibm.com \
--cc=imbrenda@linux.ibm.com \
--cc=kvm@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=nrb@linux.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox