]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
s390: Make UV folio operations work on whole folio
authorClaudio Imbrenda <imbrenda@linux.ibm.com>
Wed, 4 Feb 2026 15:02:32 +0000 (16:02 +0100)
committerClaudio Imbrenda <imbrenda@linux.ibm.com>
Wed, 4 Feb 2026 16:00:08 +0000 (17:00 +0100)
uv_destroy_folio() and uv_convert_from_secure_folio() should work on
all pages in the folio, not just the first one.

This was fine until now, but it will become a problem with upcoming
patches.

Acked-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
arch/s390/kernel/uv.c

index ed46950be86f2f249bf10f4567c37355d7832d84..ca0849008c0da4b28315cd22386f5015ee1598d4 100644 (file)
@@ -134,14 +134,15 @@ static int uv_destroy(unsigned long paddr)
  */
 int uv_destroy_folio(struct folio *folio)
 {
+       unsigned long i;
        int rc;
 
-       /* Large folios cannot be secure */
-       if (unlikely(folio_test_large(folio)))
-               return 0;
-
        folio_get(folio);
-       rc = uv_destroy(folio_to_phys(folio));
+       for (i = 0; i < (1 << folio_order(folio)); i++) {
+               rc = uv_destroy(folio_to_phys(folio) + i * PAGE_SIZE);
+               if (rc)
+                       break;
+       }
        if (!rc)
                clear_bit(PG_arch_1, &folio->flags.f);
        folio_put(folio);
@@ -183,14 +184,15 @@ EXPORT_SYMBOL_GPL(uv_convert_from_secure);
  */
 int uv_convert_from_secure_folio(struct folio *folio)
 {
+       unsigned long i;
        int rc;
 
-       /* Large folios cannot be secure */
-       if (unlikely(folio_test_large(folio)))
-               return 0;
-
        folio_get(folio);
-       rc = uv_convert_from_secure(folio_to_phys(folio));
+       for (i = 0; i < (1 << folio_order(folio)); i++) {
+               rc = uv_convert_from_secure(folio_to_phys(folio) + i * PAGE_SIZE);
+               if (rc)
+                       break;
+       }
        if (!rc)
                clear_bit(PG_arch_1, &folio->flags.f);
        folio_put(folio);