From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f180.google.com (mail-pf1-f180.google.com [209.85.210.180]) by mx.groups.io with SMTP id smtpd.web10.6316.1678882760274514769 for ; Wed, 15 Mar 2023 05:19:20 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@rivosinc-com.20210112.gappssmtp.com header.s=20210112 header.b=C5OtZN4p; spf=pass (domain: rivosinc.com, ip: 209.85.210.180, mailfrom: dhaval@rivosinc.com) Received: by mail-pf1-f180.google.com with SMTP id z11so11579737pfh.4 for ; Wed, 15 Mar 2023 05:19:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; t=1678882759; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=WDb0W4Hhua7tfULiDZzCR1ewK7Vu/2on4bGyUDk1kaA=; b=C5OtZN4p6lXXlYGv6qtKj2kdE3qkxZPvFBqyIp7xMez5VmVx4emRAXOyGjwSgOZU0+ jU9ozeWwgHkBliIvW/wbWx16+vpZIfaB/LZMcctxYFCYgpA13NyOo7mhfa9S1GpG8myq Xcx/XCMm5nhIx4XLSLWg4AoSo1IbQpR18SCqDIXnAJG3NPPgR7UGlo/zxoZaZsgYxiqC mFwSDYKjWSrIXLDV8j2iNE6x3LaVDAWCJfM+SZnzB6VWAgGTwrmF5ZgOJPiW3/8QAReR Xwr5Tt5DgkshEO4sB+2FIGtGUYsf8lnXTGFHFLLr1bq0aHC+prpRu/bn5nJWcGpgLFOB hSnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678882759; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WDb0W4Hhua7tfULiDZzCR1ewK7Vu/2on4bGyUDk1kaA=; b=VDYL2sTo4mD0Q2YwUCpa15BsQBXesAlpIA9zHC/s7c9uUWfVkayNCmaHOeqH+N2HZy /bPi1CTXSP0rWSItepmsOQoy/1zFrppZtmvjR2QZdbQJuKUQxCSrpUhtGVBJ3Oli7lpP fzXPnwnTdV87iuRysXsMYtJthv+tsBCHiRFamNgUhkBli5iuhhjkUVYN6YQFqSiHrKvm /ZgngeUSq9VWHBEDj1msxYDD97zRG94VnEb5Epx5pvCSPPMAaqGR8scY5ZyL2B+9uN4K vM4Qc4A99LOkoeBhCDIhhB6eWVGMjGCGfRSelaHV9vatq6Cm/H0JEShhAhkn6M+wAXyl Glbw== X-Gm-Message-State: AO0yUKUhJqpePoxpSx/FNyh21dhlzAYOV0zFKAL43euqG/hlrwrflJOe gVs04n7llVIqpB79FY2UG4Fgvdw+c9T6jhezF2sp6zdw X-Google-Smtp-Source: AK7set+9ibG/4QL1+BxeIFiMEtxp7d1k3Lo2Q0APHUTZ198lbtKNUIt+bDLuJ8OBNlAW+GwAC7TldA== X-Received: by 2002:aa7:9a02:0:b0:625:d515:58f3 with SMTP id w2-20020aa79a02000000b00625d51558f3mr134426pfj.17.1678882759553; Wed, 15 Mar 2023 05:19:19 -0700 (PDT) Return-Path: Received: from dhaval.ba.rivosinc.com ([171.76.81.12]) by smtp.gmail.com with ESMTPSA id d13-20020aa7814d000000b005dd98927cc5sm3382239pfn.76.2023.03.15.05.19.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Mar 2023 05:19:19 -0700 (PDT) From: "Dhaval Sharma" To: devel@edk2.groups.io Cc: Guo Dong , Ray Ni , Sean Rhodes , James Lu , Gua Guo Subject: [PATCH v4 1/2] UefiPayloadPkg: Remove FP Init from UPL entry Date: Wed, 15 Mar 2023 17:49:12 +0530 Message-Id: <20230315121913.119025-2-dhaval@rivosinc.com> X-Mailer: git-send-email 2.40.0.rc0.57.g454dfcbddf In-Reply-To: <20230315121913.119025-1-dhaval@rivosinc.com> References: <20230315121913.119025-1-dhaval@rivosinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit According to UPL spec BL should initialize FP init meaning UPL does not need to initialize it. Besides this is arch specific init and needs to be moved out of UPL common flow. In order to not break current BL implementations, for now just moving the init to later point of time but for both x32 and x64 eventually this should be removed once BL impelement this logic. Test: Verified booting UEFI shell on coreboot on qemu. Cc: Guo Dong Cc: Ray Ni Cc: Sean Rhodes Cc: James Lu Cc: Gua Guo Signed-off-by: Dhaval Sharma Reviewed-by: Gua Guo --- Notes: v3: - Added FP initialization to X64 path as well v4: - Updated reviewed-by tag UefiPayloadPkg/UefiPayloadEntry/Ia32/DxeLoadFunc.c | 3 +++ UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.c | 3 --- UefiPayloadPkg/UefiPayloadEntry/X64/DxeLoadFunc.c | 3 +++ 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/UefiPayloadPkg/UefiPayloadEntry/Ia32/DxeLoadFunc.c b/UefiPayloadPkg/UefiPayloadEntry/Ia32/DxeLoadFunc.c index c66e56aee15a..9d2bfb2fa654 100644 --- a/UefiPayloadPkg/UefiPayloadEntry/Ia32/DxeLoadFunc.c +++ b/UefiPayloadPkg/UefiPayloadEntry/Ia32/DxeLoadFunc.c @@ -268,6 +268,9 @@ HandOffToDxeCore ( UINT32 Index; X64_IDT_TABLE *IdtTableForX64; + // Initialize floating point operating environment to be compliant with UEFI spec. + InitializeFloatingPointUnits (); + // // Clear page 0 and mark it as allocated if NULL pointer detection is enabled. // diff --git a/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.c b/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.c index 46ee27c905e9..07f4c1d29686 100644 --- a/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.c +++ b/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.c @@ -470,9 +470,6 @@ _ModuleEntryPoint ( PrintHob (mHobList); ); - // Initialize floating point operating environment to be compliant with UEFI spec. - InitializeFloatingPointUnits (); - // Build HOB based on information from Bootloader Status = BuildHobs (BootloaderParameter, &DxeFv); ASSERT_EFI_ERROR (Status); diff --git a/UefiPayloadPkg/UefiPayloadEntry/X64/DxeLoadFunc.c b/UefiPayloadPkg/UefiPayloadEntry/X64/DxeLoadFunc.c index 346e3feb0459..84a6112ce64a 100644 --- a/UefiPayloadPkg/UefiPayloadEntry/X64/DxeLoadFunc.c +++ b/UefiPayloadPkg/UefiPayloadEntry/X64/DxeLoadFunc.c @@ -40,6 +40,9 @@ HandOffToDxeCore ( VOID *GhcbBase; UINTN GhcbSize; + // Initialize floating point operating environment to be compliant with UEFI spec. + InitializeFloatingPointUnits (); + // // Clear page 0 and mark it as allocated if NULL pointer detection is enabled. // -- 2.40.0.rc0.57.g454dfcbddf