From patchwork Wed Nov 1 00:07:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dave Hansen X-Patchwork-Id: 160383 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:abcd:0:b0:403:3b70:6f57 with SMTP id f13csp98955vqx; Tue, 31 Oct 2023 17:08:42 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEl8U18Vdh3dyYnCmyhgIWlRJGenz4kRvj/EBd8RGtIVtsQVbnU+lgSerhqYaXSGUJf95bX X-Received: by 2002:a17:903:230c:b0:1cc:32df:8eb5 with SMTP id d12-20020a170903230c00b001cc32df8eb5mr8180618plh.6.1698797321981; Tue, 31 Oct 2023 17:08:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698797321; cv=none; d=google.com; s=arc-20160816; b=bpqJSArHn+fTDtswdxkTna4PKZrUwPuKr0X9tKZ4mWHDDvlfV+g2hkE2eOSKCYUn45 UJEQuFgMx/2nGAXi/mdW9KVEUirK0T1GjuhF0mIzSP9oo6EboGEILQIuebYvOkh2kqHF g3grwOYPMYuBZ6UXcnNo16a2as/1OapRGVgZqHPRQVJaEEhTb4qFNPyqC3P9tBGJunY/ R6Ad2jCkHz6uYI7g5/7DtK8dajUxm6z6B40JsEznUI/UuXV5sqb1osdbfJmSitG35ROO yYZA/GcOwfD0qW8ZAari5hkWfkn5MtteRNcl14zOyDRv2fr/Yuy3xUbpE46eQDEUdWzN xfsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=DER9XlP40YQ0FsYod3Po1oWh8SS7tTZc2Zrt7CkTsL8=; fh=WnlVi/Q/6zv0fZ6Ey9Krvq5QWByVvi9tb1A26EVXDkE=; b=SHHAJtlQl8FQoP4oe+8kHVNZ1j1zXSmFwpW89tzlWOBRBeEuZoGZNRTl9pcOlqgt7b HmPkKbuXkr/tLWdHVJP9yhniLXuq3nGhWjGag4sxjJZDV9D6vsgZtlAmz28uYkuPZ9sM B7BLoqz54/nnBMXkNFs/cqFRsiT7gH7gAKU/01nuovdRF4A1r1rJxV0TsZsmmBRpxL+q RiFifXxx/9NEhlp5RbAoA5bU8eeWcXZ/hc8DqjOURGma4vK8bdlMICokmedhB91A0kPz 8zULG91xy12ggMDgh2JT1W+1wzbt9AGcgWv6Y8ADT5W4LY5CKLQr0y83OTrsYi5HkSr0 853g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Edpiwt6S; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id ju2-20020a170903428200b001c604fdbb14si1747154plb.81.2023.10.31.17.08.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 17:08:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Edpiwt6S; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 15A5780CCD38; Tue, 31 Oct 2023 17:08:37 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345001AbjKAAI1 (ORCPT + 34 others); Tue, 31 Oct 2023 20:08:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44756 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231129AbjKAAIZ (ORCPT ); Tue, 31 Oct 2023 20:08:25 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 70E0AF3 for ; Tue, 31 Oct 2023 17:08:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1698797303; x=1730333303; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=0fAlQDu6TcG0IgowxLHEv4hAohadL2zveXEyNa++vZs=; b=Edpiwt6SJ3sJip7PAByyfJ+z3e1S97kW0v5eIT1IP9yvRz8i8ZxMZeXc XrzIqyidiAt5Dt2Wwx/GaBU4p0jL2GFBMc0/SCJFmueskmXQuN9r8Wpp1 q98C5TaXgKo57GRstfdcbWVxuH3cDaSsUWqNUBORFUtHZ2NpK6m/jGpSx fGfI1Gs9kcUHy1gNKhMbMrgSkykSY1IwUicbsojJZv5mFjWMUYl6zBydl NxrihoyPnhLbpHMjnhkj3NzXzOMvWhEr3MNTET+V6Qz1dgnBbCAu8sSA0 v62WaDGiiuqz8V0qsqVMU7kARnEJT5BWe8EEiS+Gocr+dePf5RiCU0Vtz w==; X-IronPort-AV: E=McAfee;i="6600,9927,10880"; a="9933860" X-IronPort-AV: E=Sophos;i="6.03,266,1694761200"; d="scan'208";a="9933860" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Oct 2023 17:08:23 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10880"; a="754298707" X-IronPort-AV: E=Sophos;i="6.03,266,1694761200"; d="scan'208";a="754298707" Received: from viggo.jf.intel.com (HELO ray2.sr71.net) ([10.54.77.144]) by orsmga007.jf.intel.com with ESMTP; 31 Oct 2023 17:08:22 -0700 From: Dave Hansen To: torvalds@linux-foundation.org Cc: x86@kernel.org, linux-kernel@vger.kernel.org, Dave Hansen Subject: [GIT PULL] x86/tdx for 6.7 Date: Tue, 31 Oct 2023 17:07:55 -0700 Message-Id: <20231101000755.4183137-1-dave.hansen@linux.intel.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Tue, 31 Oct 2023 17:08:37 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781318100607870674 X-GMAIL-MSGID: 1781318100607870674 Hi Linus, Please pull some x86/tdx changes for 6.7. The majority of this is a rework of the assembly and C wrappers that are used to talk to the TDX module and VMM. This is a nice cleanup in general but is also clearing the way for using this code when Linux is the TDX VMM. There are also some tidbits to make TDX guests play nicer with Hyper-V and to take advantage the hardware TSC. --- The following changes since commit 0bb80ecc33a8fb5a682236443c1e740d5c917d1d: Linux 6.6-rc1 (2023-09-10 16:28:41 -0700) are available in the Git repository at: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git tags/x86_tdx_for_6.7 for you to fetch changes up to 9ee4318c157b9802589b746cc340bae3142d984c: x86/tdx: Mark TSC reliable (2023-10-06 10:00:04 -0700) ---------------------------------------------------------------- * Refactor and clean up TDX hypercall/module call infrastructure * Handle retrying/resuming page conversion hypercalls * Make sure to use the (shockingly) reliable TSC in TDX guests ---------------------------------------------------------------- Dexuan Cui (1): x86/tdx: Retry partially-completed page conversion hypercalls Kai Huang (12): x86/tdx: Zero out the missing RSI in TDX_HYPERCALL macro x86/tdx: Skip saving output regs when SEAMCALL fails with VMFailInvalid x86/tdx: Make macros of TDCALLs consistent with the spec x86/tdx: Rename __tdx_module_call() to __tdcall() x86/tdx: Pass TDCALL/SEAMCALL input/output registers via a structure x86/tdx: Extend TDX_MODULE_CALL to support more TDCALL/SEAMCALL leafs x86/tdx: Make TDX_HYPERCALL asm similar to TDX_MODULE_CALL x86/tdx: Reimplement __tdx_hypercall() using TDX_MODULE_CALL asm x86/tdx: Remove 'struct tdx_hypercall_args' x86/virt/tdx: Wire up basic SEAMCALL functions x86/virt/tdx: Make TDX_MODULE_CALL handle SEAMCALL #UD and #GP x86/tdx: Fix __noreturn build warning around __tdx_hypercall_failed() Kirill A. Shutemov (1): x86/tdx: Mark TSC reliable arch/x86/Kconfig | 12 ++ arch/x86/Makefile | 2 + arch/x86/boot/compressed/tdx.c | 6 +- arch/x86/coco/tdx/tdcall.S | 234 +++++--------------------------------- arch/x86/coco/tdx/tdx-shared.c | 28 ++++- arch/x86/coco/tdx/tdx.c | 138 +++++++++++++++------- arch/x86/hyperv/ivm.c | 10 +- arch/x86/include/asm/shared/tdx.h | 89 +++++++++------ arch/x86/include/asm/tdx.h | 11 ++ arch/x86/kernel/asm-offsets.c | 33 +++--- arch/x86/virt/Makefile | 2 + arch/x86/virt/vmx/Makefile | 2 + arch/x86/virt/vmx/tdx/Makefile | 2 + arch/x86/virt/vmx/tdx/seamcall.S | 61 ++++++++++ arch/x86/virt/vmx/tdx/tdxcall.S | 226 +++++++++++++++++++++++++++--------- tools/objtool/noreturns.h | 1 + 16 files changed, 491 insertions(+), 366 deletions(-) create mode 100644 arch/x86/virt/Makefile create mode 100644 arch/x86/virt/vmx/Makefile create mode 100644 arch/x86/virt/vmx/tdx/Makefile create mode 100644 arch/x86/virt/vmx/tdx/seamcall.S