Congratulations to SDU Team and China UEFI on RISC-V working group, thanks for sharing and really impressive work😊
Thanks,
Yong Li
发件人: caiyuq...@outlook.com
发送时间: 2023年8月19日 16:57
收件人: sun...@ventanamicro.com <sun...@ventanamicro.com>
抄送: 李 冰 <libin...@outlook.com>; Li, Yong <yon...@intel.com>; Chai, Evan <evan...@intel.com>
主题: Re: EDK2 on RISC-V Sophgo SG2042 platform (PR #92) Q&AHi, sunilvlWe sincerely appreciate your comments and we have refined the code based on some of them. There were also some issues that were difficult to explain clearly in PR, so I will explain them here.Also, thanks to yon...@intel.com for the guidance on the upstream steps of the code. We've sent latest patches against the edk2-platform repo to de...@edk2.groups.io. Maybe using email to review patches and make comments is the usual and convenient way.There are some tricky issues that need better solutions:Q1. About Why Copy RISC-V MMU Libraries?A1. There are some instructions for commit information: "SG2042 (Xuantie C920) MMU can be enabled in SV39 mode, but there are bugs with exception handling and MMC that need to be fixed, so MMU is not currently enabled. Add this library is to ensure compilation pass." One of the difficult bugs can be seen at https://groups.google.com/a/riscv.org/g/fw-exchange/c/wKYnYBNmPr4/m/nY69VnxXAQAJ. It could be due to AMO PMA, but the manual for the C920 doesn't have any information about PMA, and this issue still needs to be addressed.So we modified the RiscVConfigureMmu function so that the satp mode is set to SATP_MODE_OFF. This version is handled this way for now, do you have any suggestions?Q2. Error in SG2042 about initializing system memory independently of each memory node.A2. The SG2042 EVB has four DDR slots. When three 32GB sized DDRs are plugged in, the results run as shown:The first figure shows the result of one InitializeRamRegions for the four memory nodes as a whole. The MemoryLength in the red box is the sum of the sizes of the three memory nodes.The second graph shows the results of InitializeRamRegions performed independently for each of the four memory nodes. The MemoryLength in the red box is just the first memory node size.The print information added in the yellow box of the second image is in MdeModulePkg/Core/Dxe/Gcd.c:2333.Only the PhysicalStart of the HOB created by the first node is less than EfiFreeMemoryBottom, and CoreInitializeMemoryServices will only use the first eligible ResourceHob to calculate MemoryLength.So we calculate the sum of the four memory node sizes for one InitializeRamRegions in the SEC module. Or is there a better way?Q3. Why use opensbi v1.2 instead of the latest v1.3?A3. The opensbi for SG2042 is maintained by Sophgo and there are issues with using opensbi v1.3. Currently, Sophgo has a plan to submit patches to upstream and is working on the issues, so it may not be long before opensbi v1.3 is ready to use. Upstream plan and status can be found at the link below:Thanks again for your advice and help!😀Thanks,China.P.R. SDU-AII Team
>My suggestion is to introduce a PCD variable to disable MMU
>configuration. This probably helps in debugging also and avoids
>duplicating the entire library.
>Tuan, do you see any issue with that?
Agree that PCD can be used to disable MMU.