From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mx.groups.io with SMTP id smtpd.web11.5722.1651887402613426917 for ; Fri, 06 May 2022 18:36:55 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=OFRy8ZqJ; spf=pass (domain: intel.com, ip: 192.55.52.120, 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=1651887415; x=1683423415; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=9AxqkV7gYGl4Mm9dTzeZ8sJA64bODETBpFUn7T6WRow=; b=OFRy8ZqJ3o6p/rqqPuKsVzerR+p7n9VL/1f9vAavpXaa+Chxo+jASMAM KJNRw4lZ8ykXGedbvibac/TeFgxDUoSzgwCRbcpw6LH+Jzx289aGdpt53 tVKXRSZEf0tFGw/LSsFV8nU9N/S/6TpIura7lVLymeq6NWtYzmDAvud2Q xc7aRa32Qxug3mCxBSQlnOvj+jEcm6wuX4xp/o6E1VKc8kAfQCyIML//A CJclRFI28fW4d6RsyRCLJ5Kryts6TTYC3f0bl0+gbEADtdHvIUbl5gKlu WLYGmgCixNXABzgOd88z+3WIN4ocxMgYWGMqTBlGxzn0YB1Uv6LMQvOwx A==; X-IronPort-AV: E=McAfee;i="6400,9594,10339"; a="267463971" X-IronPort-AV: E=Sophos;i="5.91,205,1647327600"; d="scan'208";a="267463971" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 May 2022 18:36:55 -0700 X-IronPort-AV: E=Sophos;i="5.91,205,1647327600"; d="scan'208";a="538143081" Received: from mxu9-mobl1.ccr.corp.intel.com ([10.249.172.52]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 May 2022 18:36:52 -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 V2 5/6] OvmfPkg/TdxDxe: Install MpInitLibDepLib protocols Date: Sat, 7 May 2022 09:36:22 +0800 Message-Id: <8312a21767d191e33ae521074a627cca4cb91766.1651885849.git.min.m.xu@intel.com> 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