From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mx.groups.io with SMTP id smtpd.web11.11878.1651761831263961075 for ; Thu, 05 May 2022 07:44:00 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=PaZ+AIh4; spf=pass (domain: intel.com, ip: 134.134.136.20, mailfrom: min.m.xu@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1651761838; x=1683297838; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=9AxqkV7gYGl4Mm9dTzeZ8sJA64bODETBpFUn7T6WRow=; b=PaZ+AIh4UJxxVuN6zOzMHQpeyl0dgFI9/Vh3HJeV+BZ7xgDx+NFtjzc9 lO7eTVixRtV/qaqTBH+n+qrMoWiZ+MvE9v2/zu7FbrSyayXy/tnUtivk1 b3fI9kyZlD1v4XumgsjA4iOcP9tEbD6E6f1WlqMoDabxH/X6Vtw3ngZP6 /9rAWkCxfZ37AQK33lhRzrAkChLXppMozRNP0EX0jyF6TWrcuO/eiYcCB 8EKgNC/8V6wtiSjgSyqOsMrJpStPPmS2bfmJXbEziNtPprtB4veG2mvD4 UECgDv+tk2S2tvp5x4ZWuPwKDAvng4zNNs02xaYYwsmAuAl5zgbTKM16l A==; X-IronPort-AV: E=McAfee;i="6400,9594,10338"; a="255604435" X-IronPort-AV: E=Sophos;i="5.91,201,1647327600"; d="scan'208";a="255604435" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 May 2022 07:43:50 -0700 X-IronPort-AV: E=Sophos;i="5.91,201,1647327600"; d="scan'208";a="563268928" Received: from mxu9-mobl1.ccr.corp.intel.com ([10.249.175.139]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 May 2022 07:43:47 -0700 From: "Min Xu" To: devel@edk2.groups.io Cc: Min M Xu , Eric Dong , Ray Ni , Brijesh Singh , Erdem Aktas , James Bottomley , Jiewen Yao , Tom Lendacky , Gerd Hoffmann Subject: [PATCH 5/6] OvmfPkg/TdxDxe: Install MpInitLibDepLib protocols Date: Thu, 5 May 2022 22:43:18 +0800 Message-Id: X-Mailer: git-send-email 2.29.2.windows.2 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Min M Xu BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3918 In Td guest CpuDxe driver uses the MpInitLibUp, the other guest type use the MpInitLib. So we install different Protocols according to the current working guest type. Cc: Eric Dong Cc: Ray Ni Cc: Brijesh Singh Cc: Erdem Aktas Cc: James Bottomley Cc: Jiewen Yao Cc: Tom Lendacky Cc: Gerd Hoffmann Signed-off-by: Min Xu --- OvmfPkg/TdxDxe/TdxDxe.c | 22 +++++++++++++++++++++- OvmfPkg/TdxDxe/TdxDxe.inf | 2 ++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/OvmfPkg/TdxDxe/TdxDxe.c b/OvmfPkg/TdxDxe/TdxDxe.c index f0929998233c..2318db989792 100644 --- a/OvmfPkg/TdxDxe/TdxDxe.c +++ b/OvmfPkg/TdxDxe/TdxDxe.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -250,13 +251,32 @@ TdxDxeEntryPoint ( if (!TdIsEnabled ()) { // - // If it is Non-Td guest, we're done. + // If it is Non-Td guest, we install gEfiMpInitLibMpDepProtocolGuid so that + // MpInitLib will be used in CpuDxe driver. // + gBS->InstallProtocolInterface ( + &ImageHandle, + &gEfiMpInitLibMpDepProtocolGuid, + EFI_NATIVE_INTERFACE, + NULL + ); + return EFI_SUCCESS; } SetMmioSharedBit (); + // + // It is Td guest, we install gEfiMpInitLibUpDepProtocolGuid so that + // MpInitLibUp will be used in CpuDxe driver. + // + gBS->InstallProtocolInterface ( + &ImageHandle, + &gEfiMpInitLibUpDepProtocolGuid, + EFI_NATIVE_INTERFACE, + NULL + ); + // // Call TDINFO to get actual number of cpus in domain // diff --git a/OvmfPkg/TdxDxe/TdxDxe.inf b/OvmfPkg/TdxDxe/TdxDxe.inf index 2ec2ef2ed5f2..a7e0abda1522 100644 --- a/OvmfPkg/TdxDxe/TdxDxe.inf +++ b/OvmfPkg/TdxDxe/TdxDxe.inf @@ -50,6 +50,8 @@ gQemuAcpiTableNotifyProtocolGuid ## CONSUMES gEfiAcpiSdtProtocolGuid ## CONSUMES gEfiAcpiTableProtocolGuid ## CONSUMES + gEfiMpInitLibMpDepProtocolGuid + gEfiMpInitLibUpDepProtocolGuid [Pcd] gUefiOvmfPkgTokenSpaceGuid.PcdPciIoBase -- 2.29.2.windows.2