From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from loongson.cn (loongson.cn [114.242.206.163]) by mx.groups.io with SMTP id smtpd.web11.15173.1683859343274126517 for ; Thu, 11 May 2023 19:42:24 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: loongson.cn, ip: 114.242.206.163, mailfrom: lixianglai@loongson.cn) Received: from loongson.cn (unknown [10.2.5.185]) by gateway (Coremail) with SMTP id _____8Cx+emLp11kTPwHAA--.13593S3; Fri, 12 May 2023 10:42:19 +0800 (CST) Received: from localhost.localdomain (unknown [10.2.5.185]) by localhost.localdomain (Coremail) with SMTP id AQAAf8BxkrCLp11kw9RWAA--.23317S2; Fri, 12 May 2023 10:42:19 +0800 (CST) From: "xianglai" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Bibo Mao , Chao Li , Leif Lindholm , Liming Gao , Michael D Kinney Subject: [edk2-platforms][PATCH V2 1/1] Platform/Loongson: Set Dxe common page size to 16k Date: Fri, 12 May 2023 10:42:16 +0800 Message-Id: <6b42f72aea391400820b83dbd5bf2fa70bab5937.1683859255.git.lixianglai@loongson.cn> X-Mailer: git-send-email 2.31.1 In-Reply-To: References: MIME-Version: 1.0 X-CM-TRANSID: AQAAf8BxkrCLp11kw9RWAA--.23317S2 X-CM-SenderInfo: 5ol0xt5qjotxo6or00hjvr0hdfq/ X-Coremail-Antispam: 1Uk129KBjvJXoW7KrWrZr4ruF48WF1rtF1rtFb_yoW8tFy8pF 15ua47Kr18JF17Zw18Aa4UurWavry5GrZ8JFsxKw4xC3WDJ3Wkua4YvF4Fva4UG34FyFyD ZryI9w4Uua1UZ3DanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUj1kv1TuYvTs0mT0YCTnIWj qI5I8CrVACY4xI64kE6c02F40Ex7xfYxn0WfASr-VFAUDa7-sFnT9fnUUIcSsGvfJTRUUU bn8Fc2x0x2IEx4CE42xK8VAvwI8IcIk0rVWrJVCq3wA2ocxC64kIII0Yj41l84x0c7CEw4 AK67xGY2AK021l84ACjcxK6xIIjxv20xvE14v26r4j6ryUM28EF7xvwVC0I7IYx2IY6xkF 7I0E14v26r4j6F4UM28EF7xvwVC2z280aVAFwI0_Gr1j6F4UJwA2z4x0Y4vEx4A2jsIEc7 CjxVAFwI0_Gr1j6F4UJwAS0I0E0xvYzxvE52x082IY62kv0487Mc804VCY07AIYIkI8VC2 zVCFFI0UMc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VCjz48v1sIEY20_WwAm72CE4IkC6x 0Yz7v_Jr0_Gr1lF7xvr2IYc2Ij64vIr41l42xK82IYc2Ij64vIr41l42xK82IY6x8ErcxF aVAv8VWrMxC20s026xCaFVCjc4AY6r1j6r4UMI8I3I0E5I8CrVAFwI0_Jr0_Jr4lx2IqxV Cjr7xvwVAFwI0_JrI_JrWlx4CE17CEb7AF67AKxVWUAVWUtwCIc40Y0x0EwIxGrwCI42IY 6xIIjxv20xvE14v26r1j6r1xMIIF0xvE2Ix0cI8IcVCY1x0267AKxVWUJVW8JwCI42IY6x AIw20EY4v20xvaj40_Jr0_JF4lIxAIcVC2z280aVAFwI0_Jr0_Gr1lIxAIcVC2z280aVCY 1x0267AKxVWUJVW8JbIYCTnIWIevJa73UjIFyTuYvj4RC_MaUUUUU Content-Transfer-Encoding: 8bit The loongarch qemu tcg code section is 16K aligned by default. When UEFI keep 4K alignment, the code section and data section of UEFI are loaded into the same page by qemu, and when the data is written to the page containing the code section, it will cause qemu to refresh TB, resulting in qemu running slowly.Therefore, setting Dxe to 16K alignment can ensure that the code section is loaded into a page separately, avoid qemu repeatedly refreshing TB, and speed up the execution speed of qemu. The following shows the impact of Dxe 4K alignment and 16K alignment on image size: DXE 4k alignment: DXEFV.FV 7.2M After compression: FVMAIN_COMPACT.Fv 3.4M QEMU_EFI.fd 3.7M DXE 16k alignment: DXEFV.FV 9.5M After compression: FVMAIN_COMPACT.Fv 3.4M QEMU_EFI.fd 3.7M Cc: Ard Biesheuvel Cc: Bibo Mao Cc: Chao Li Cc: Leif Lindholm Cc: Liming Gao Cc: Michael D Kinney Signed-off-by: xianglai li --- Platform/Loongson/LoongArchQemuPkg/Loongson.dsc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Platform/Loongson/LoongArchQemuPkg/Loongson.dsc b/Platform/Loongson/LoongArchQemuPkg/Loongson.dsc index 6875e39cc6..13b27d84b8 100644 --- a/Platform/Loongson/LoongArchQemuPkg/Loongson.dsc +++ b/Platform/Loongson/LoongArchQemuPkg/Loongson.dsc @@ -61,8 +61,13 @@ [BuildOptions.LOONGARCH64.EDKII.SEC] *_*_*_CC_FLAGS = +# +# default page size is 16K for loongarch qemu tcg +# code section separated with data section with 16K page alignment, else data +# write operation in the same page with code section will cause qemu TB flush +# [BuildOptions.common.EDKII.DXE_CORE,BuildOptions.common.EDKII.DXE_DRIVER,BuildOptions.common.EDKII.UEFI_DRIVER,BuildOptions.common.EDKII.UEFI_APPLICATION] - GCC:*_*_*_DLINK_FLAGS = -z common-page-size=0x1000 + GCC:*_*_*_DLINK_FLAGS = -z common-page-size=0x4000 [BuildOptions.common.EDKII.DXE_RUNTIME_DRIVER] GCC:*_*_LOONGARCH64_DLINK_FLAGS = -z common-page-size=0x10000 -- 2.31.1