public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1] s390/mm: fix virtual-physical address confusion for swiotlb
@ 2022-11-07 10:58 Nico Boehr
  2022-11-07 11:21 ` Christian Borntraeger
  0 siblings, 1 reply; 3+ messages in thread
From: Nico Boehr @ 2022-11-07 10:58 UTC (permalink / raw)
  To: borntraeger, frankja, imbrenda; +Cc: kvm, linux-s390

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>
---
 arch/s390/mm/init.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/s390/mm/init.c b/arch/s390/mm/init.c
index 97d66a3e60fb..8b652654064e 100644
--- a/arch/s390/mm/init.c
+++ b/arch/s390/mm/init.c
@@ -146,7 +146,7 @@ int set_memory_encrypted(unsigned long addr, int numpages)
 
 	/* make specified pages unshared, (swiotlb, dma_free) */
 	for (i = 0; i < numpages; ++i) {
-		uv_remove_shared(addr);
+		uv_remove_shared(virt_to_phys((void *)addr));
 		addr += PAGE_SIZE;
 	}
 	return 0;
@@ -157,7 +157,7 @@ int set_memory_decrypted(unsigned long addr, int numpages)
 	int i;
 	/* make specified pages shared (swiotlb, dma_alloca) */
 	for (i = 0; i < numpages; ++i) {
-		uv_set_shared(addr);
+		uv_set_shared(virt_to_phys((void *)addr));
 		addr += PAGE_SIZE;
 	}
 	return 0;
-- 
2.37.3


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

end of thread, other threads:[~2022-11-07 12:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-07 10:58 [PATCH v1] s390/mm: fix virtual-physical address confusion for swiotlb Nico Boehr
2022-11-07 11:21 ` Christian Borntraeger
2022-11-07 12:06   ` Nico Boehr

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox