public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: "Edgecombe, Rick P" <rick.p.edgecombe@intel.com>
To: "pbonzini@redhat.com" <pbonzini@redhat.com>,
	"Zhao, Yan Y" <yan.y.zhao@intel.com>
Cc: "kvm@vger.kernel.org" <kvm@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"Huang, Kai" <kai.huang@intel.com>,
	"dave.hansen@linux.intel.com" <dave.hansen@linux.intel.com>,
	"Yamahata, Isaku" <isaku.yamahata@intel.com>
Subject: Re: [PATCH 08/13] x86/virt/tdx: Add SEAMCALL wrappers to add TD private pages
Date: Wed, 15 Jan 2025 02:02:11 +0000	[thread overview]
Message-ID: <3f8fa8fc98b532add1ff14034c0c868cdbeca7f8.camel@intel.com> (raw)
In-Reply-To: <6345272506c5bc707f11b6f54c4bd5015cedcd95.camel@intel.com>

On Tue, 2025-01-14 at 16:49 -0800, Rick Edgecombe wrote:
> Lastly, TD's are not booting for me, with a QEMU error. Still debugging this.

I was able to boot kvm-coco-queue with the below two fixes. I'll glue the TDX
tests back on tomorrow and test further. Regarding the mk_keyed_paddr()
cast/shift issue, Dave had expressed a preference for int over u16 for keyids:
https://lore.kernel.org/kvm/3a32ce4a-b108-4f06-a22d-14e9c2e135f7@intel.com/


diff --git a/arch/x86/include/asm/tdx.h b/arch/x86/include/asm/tdx.h
index 201f2e910411..e83f4bac6e9a 100644
--- a/arch/x86/include/asm/tdx.h
+++ b/arch/x86/include/asm/tdx.h
@@ -149,7 +149,7 @@ static inline u64 mk_keyed_paddr(u16 hkid, struct page
*page)
 
        ret = page_to_phys(page);
        /* KeyID bits are just above the physical address bits: */
-       ret |= hkid << boot_cpu_data.x86_phys_bits;
+       ret |= (u64)hkid << boot_cpu_data.x86_phys_bits;
        
        return ret;
 }
diff --git a/arch/x86/kvm/vmx/tdx.c b/arch/x86/kvm/vmx/tdx.c
index df6928a62e2d..307b6ee083d0 100644
--- a/arch/x86/kvm/vmx/tdx.c
+++ b/arch/x86/kvm/vmx/tdx.c
@@ -2307,7 +2307,7 @@ static int __tdx_td_init(struct kvm *kvm, struct td_params
*td_params,
        struct kvm_tdx *kvm_tdx = to_kvm_tdx(kvm);
        cpumask_var_t packages;
        struct page **tdcs_pages = NULL;
-       struct page *page, *tdr_page;
+       struct page *tdr_page;
        int ret, i;
        u64 err, rcx;
 
@@ -2333,7 +2333,7 @@ static int __tdx_td_init(struct kvm *kvm, struct td_params
*td_params,
 
        for (i = 0; i < kvm_tdx->td.tdcs_nr_pages; i++) {
                tdcs_pages[i] = alloc_page(GFP_KERNEL);
-               if (!page)
+               if (!tdcs_pages[i])
                        goto free_tdcs;
        }
 



  reply	other threads:[~2025-01-15  2:02 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-01  7:49 [PATCH v2 00/13] x86/virt/tdx: Add SEAMCALL wrappers for KVM Paolo Bonzini
2025-01-01  7:49 ` [PATCH 01/13] x86/virt/tdx: Add SEAMCALL wrappers for TDX KeyID management Paolo Bonzini
2025-01-02 19:44   ` Edgecombe, Rick P
2025-01-01  7:49 ` [PATCH 02/13] x86/virt/tdx: Add SEAMCALL wrappers for TDX TD creation Paolo Bonzini
2025-01-03 17:51   ` Edgecombe, Rick P
2025-01-01  7:49 ` [PATCH 03/13] x86/virt/tdx: Add SEAMCALL wrappers for TDX vCPU creation Paolo Bonzini
2025-01-01  7:49 ` [PATCH 04/13] x86/virt/tdx: Add SEAMCALL wrappers for TDX page cache management Paolo Bonzini
2025-01-01  7:49 ` [PATCH 05/13] x86/virt/tdx: Add SEAMCALL wrappers for TDX VM/vCPU field access Paolo Bonzini
2025-01-01  7:49 ` [PATCH 06/13] x86/virt/tdx: Add SEAMCALL wrappers for TDX flush operations Paolo Bonzini
2025-01-01  7:49 ` [PATCH 07/13] x86/virt/tdx: Add SEAMCALL wrapper tdh_mem_sept_add() to add SEPT pages Paolo Bonzini
2025-01-02 21:59   ` Edgecombe, Rick P
2025-01-07  5:27     ` Yan Zhao
2025-01-07 19:48     ` Dave Hansen
2025-01-08  1:12       ` Yan Zhao
2025-01-08  1:20         ` Dave Hansen
2025-01-08  1:43           ` Edgecombe, Rick P
2025-01-08  2:14             ` Yan Zhao
2025-01-01  7:49 ` [PATCH 08/13] x86/virt/tdx: Add SEAMCALL wrappers to add TD private pages Paolo Bonzini
2025-01-02 23:32   ` Edgecombe, Rick P
2025-01-06  5:50     ` Yan Zhao
2025-01-06 19:21       ` Edgecombe, Rick P
2025-01-07  6:37         ` Yan Zhao
2025-01-14 23:32       ` Paolo Bonzini
2025-01-15  0:49         ` Edgecombe, Rick P
2025-01-15  2:02           ` Edgecombe, Rick P [this message]
2025-01-15  5:49         ` Yan Zhao
2025-01-01  7:49 ` [PATCH 09/13] x86/virt/tdx: Add SEAMCALL wrappers to manage TDX TLB tracking Paolo Bonzini
2025-01-03  1:28   ` Edgecombe, Rick P
2025-01-07  6:40     ` Yan Zhao
2025-01-01  7:49 ` [PATCH 10/13] x86/virt/tdx: Add SEAMCALL wrappers to remove a TD private page Paolo Bonzini
2025-01-03  1:36   ` Edgecombe, Rick P
2025-01-07  6:43     ` Yan Zhao
2025-01-07  6:52       ` Yan Zhao
2025-01-07 22:13       ` Dave Hansen
2025-01-08  0:41         ` Yan Zhao
2025-01-08 16:31           ` Dave Hansen
2025-01-09  2:19             ` Yan Zhao
2025-01-01  7:49 ` [PATCH 11/13] x86/virt/tdx: Add SEAMCALL wrappers for TD measurement of initial contents Paolo Bonzini
2025-01-03 18:02   ` Edgecombe, Rick P
2025-01-14 22:03     ` Paolo Bonzini
2025-01-14 22:10       ` Dave Hansen
2025-01-15  1:24       ` Yan Zhao
2025-01-07  7:01   ` Yan Zhao
2025-01-07 22:05     ` Dave Hansen
2025-01-01  7:49 ` [PATCH 12/13] x86/virt/tdx: Read essential global metadata for KVM Paolo Bonzini
2025-01-03 18:26   ` Edgecombe, Rick P
2025-01-01  7:49 ` [PATCH 13/13] x86/virt/tdx: Add tdx_guest_keyid_alloc/free() to alloc and free TDX guest KeyID Paolo Bonzini
2025-01-02 19:43 ` [PATCH v2 00/13] x86/virt/tdx: Add SEAMCALL wrappers for KVM Edgecombe, Rick P

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=3f8fa8fc98b532add1ff14034c0c868cdbeca7f8.camel@intel.com \
    --to=rick.p.edgecombe@intel.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=isaku.yamahata@intel.com \
    --cc=kai.huang@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=yan.y.zhao@intel.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