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
Subject: Re: [PATCH v2 1/1] s390/mm: fix virtual-physical address confusion for swiotlb
Date: Mon, 7 Nov 2022 13:13:33 +0100 [thread overview]
Message-ID: <2fa2bab1-bcf8-9a9b-d402-c22dc1dbc8a2@linux.ibm.com> (raw)
In-Reply-To: <20221107121221.156274-2-nrb@linux.ibm.com>
Am 07.11.22 um 13:12 schrieb Nico Boehr:
> swiotlb passes virtual addresses to set_memory_encrypted() and
> set_memory_decrypted(), but uv_remove_shared() and uv_set_shared()
> expect physical addresses. This currently works, because virtual
> and physical addresses are the same.
>
> Add virt_to_phys() to resolve the virtual-physical confusion.
>
> Reported-by: Marc Hartmayer <mhartmay@linux.ibm.com>
> Signed-off-by: Nico Boehr <nrb@linux.ibm.com>
You can keep my RB:
Reviewed-by: Christian Borntraeger <borntraeger@linux.ibm.com>
> ---
> arch/s390/include/asm/mem_encrypt.h | 4 ++--
> arch/s390/mm/init.c | 12 ++++++------
> 2 files changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/arch/s390/include/asm/mem_encrypt.h b/arch/s390/include/asm/mem_encrypt.h
> index 08a8b96606d7..b85e13505a0f 100644
> --- a/arch/s390/include/asm/mem_encrypt.h
> +++ b/arch/s390/include/asm/mem_encrypt.h
> @@ -4,8 +4,8 @@
>
> #ifndef __ASSEMBLY__
>
> -int set_memory_encrypted(unsigned long addr, int numpages);
> -int set_memory_decrypted(unsigned long addr, int numpages);
> +int set_memory_encrypted(unsigned long vaddr, int numpages);
> +int set_memory_decrypted(unsigned long vaddr, int numpages);
>
> #endif /* __ASSEMBLY__ */
>
> diff --git a/arch/s390/mm/init.c b/arch/s390/mm/init.c
> index 97d66a3e60fb..d509656c67d7 100644
> --- a/arch/s390/mm/init.c
> +++ b/arch/s390/mm/init.c
> @@ -140,25 +140,25 @@ void mark_rodata_ro(void)
> debug_checkwx();
> }
>
> -int set_memory_encrypted(unsigned long addr, int numpages)
> +int set_memory_encrypted(unsigned long vaddr, int numpages)
> {
> int i;
>
> /* make specified pages unshared, (swiotlb, dma_free) */
> for (i = 0; i < numpages; ++i) {
> - uv_remove_shared(addr);
> - addr += PAGE_SIZE;
> + uv_remove_shared(virt_to_phys((void *)vaddr));
> + vaddr += PAGE_SIZE;
> }
> return 0;
> }
>
> -int set_memory_decrypted(unsigned long addr, int numpages)
> +int set_memory_decrypted(unsigned long vaddr, int numpages)
> {
> int i;
> /* make specified pages shared (swiotlb, dma_alloca) */
> for (i = 0; i < numpages; ++i) {
> - uv_set_shared(addr);
> - addr += PAGE_SIZE;
> + uv_set_shared(virt_to_phys((void *)vaddr));
> + vaddr += PAGE_SIZE;
> }
> return 0;
> }
next prev parent reply other threads:[~2022-11-07 12:13 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-07 12:12 [PATCH v2 0/1] s390/mm: fix virtual-physical address confusion for swiotlb Nico Boehr
2022-11-07 12:12 ` [PATCH v2 1/1] " Nico Boehr
2022-11-07 12:13 ` Christian Borntraeger [this message]
2022-11-07 12:29 ` Claudio Imbrenda
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=2fa2bab1-bcf8-9a9b-d402-c22dc1dbc8a2@linux.ibm.com \
--to=borntraeger@linux.ibm.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