Re: [PATCH v6 05/16] KVM: TDX: Pass size to reclaim_page()

From: Binbin Wu
Date: Sun Nov 19 2023 - 01:58:45 EST




On 11/19/2023 2:42 PM, Binbin Wu wrote:


On 11/7/2023 11:00 PM, isaku.yamahata@xxxxxxxxx wrote:
@@ -1597,7 +1600,7 @@ static int tdx_sept_drop_private_spte(struct kvm *kvm, gfn_t gfn,
           * The HKID assigned to this TD was already freed and cache
           * was already flushed. We don't have to flush again.
           */
-        err = tdx_reclaim_page(hpa);
+        err = tdx_reclaim_page(hpa, level);
          if (KVM_BUG_ON(err, kvm))
              return -EIO;
          tdx_unpin(kvm, pfn);
@@ -1630,7 +1633,7 @@ static int tdx_sept_drop_private_spte(struct kvm *kvm, gfn_t gfn,
          pr_tdx_error(TDH_PHYMEM_PAGE_WBINVD, err, NULL);
          return -EIO;
      }
-    tdx_clear_page(hpa);
+    tdx_clear_page(hpa, PAGE_SIZE);
Should here be KVM_HPAGE_SIZE(level) instead of  PAGE_SIZE?

OK, please ignore this comment, I see this is handled by the following patch.


      tdx_unpin(kvm, pfn);
      return 0;
  }
@@ -1742,7 +1745,7 @@ static int tdx_sept_free_private_spt(struct kvm *kvm, gfn_t gfn,
       * already flushed. We don't have to flush again.
       */
      if (!is_hkid_assigned(kvm_tdx))
-        return tdx_reclaim_page(__pa(private_spt));
+        return tdx_reclaim_page(__pa(private_spt), PG_LEVEL_4K);
        /*
       * free_private_spt() is (obviously) called when a shadow page is being