Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Arm64 fdt support #1

Merged
merged 5 commits into from
Jan 31, 2024

Conversation

guoweikang
Copy link

axhal/platfrom: Integrate platform code for axhal on the aarch64 architecture


  1. remove dw_apb_uart and pl011 uart code,abstract as aarch64 console
    trait;
  2. remove bst,virt,raspi mem.rs, abstract as aarch64_common mem.rs
  3. axhal add platform_name method
  4. support arm device tree

@guoweikang guoweikang force-pushed the guoweikang/fdt_support branch 2 times, most recently from 8a74311 to 0036083 Compare January 26, 2024 10:11
@elliott10
Copy link

  1. dw_apb_uart and pl011 uart driver are low-level hardware related crates, and can be called by OS, but should not be directly dependent on specific components of arceos.

  2. The addition of the device tree feature, I suggests submitting a separate PR.

@guoweikang
Copy link
Author

  1. dw_apb_uart and pl011 uart driver are low-level hardware related crates, and can be called by OS, but should not be directly dependent on specific components of arceos.
    In fact, I anticipate that future UART drivers will be abstracted as a serial driver, with "dw_apb" or "pl011" serving as driver features. In this commit, I have taken a straightforward approach to abstract them as a UartDriver ops(it is uglly now).
  2. The addition of the device tree feature, I suggests submitting a separate PR.
    Regarding the addition of the device tree feature, I agree with your suggestion of submitting a separate pull request (PR). I will indeed submit a distinct PR for that.

@scPointer
Copy link

主要是一些小的规范问题

scripts/make/qemu.mk

配置文件不建议改动

README.md

需要给更详细一点的说明:比方说现在新增命令是只能在板子上运行?还是可以在 qemu 上模拟运行?

crates/of/Cargo.toml

crate 名太短了,如果它是某种缩写,建议写全

crates/page_table_entry/src/arch/aarch64.rs

使用 GenericPTE 的 is_unused,而不是单独为 A64PTE 实现一个重复的 is_empty。尽管这可能要在 modules/axhal/src/platform/aarch64_common/mem.rs 引入额外的 GenericPTE,但完全相同的函数太冗余了。

modules/axhal/src/platform/aarch64_common/boot.rs

所有变量加 MY_ 是否是有特殊理由,还是只是命名习惯?如果没有,建议去掉它,然后把后面的缩写写全。

crates/of/tests/of.rs

同理,不需要 MY_ 前缀,可以把 DTB 写全或者改叫 DTB_FILE 、DTB_DATA 、DTB_TEXT 之类的名字

modules/axruntime/src/lib.rs

打印输出直接写 info!("Platform Name: {} ", axhal::platform_name()); 和代码保持一致。我没有找到 Machine Model 的这个概念。

@guoweikang
Copy link
Author

主要是一些小的规范问题

scripts/make/qemu.mk

配置文件不建议改动

README.md

关于这个问题的详细原因,在issue 有说明

需要给更详细一点的说明:比方说现在新增命令是只能在板子上运行?还是可以在 qemu 上模拟运行?

crates/of/Cargo.toml

crate 名太短了,如果它是某种缩写,建议写全

crates/page_table_entry/src/arch/aarch64.rs

此命名方式 借鉴 linux中的 Open Firmware 开放的硬件描述和配置标准的缩写

使用 GenericPTE 的 is_unused,而不是单独为 A64PTE 实现一个重复的 is_empty。尽管这可能要在 modules/axhal/src/platform/aarch64_common/mem.rs 引入额外的 GenericPTE,但完全相同的函数太冗余了。

modules/axhal/src/platform/aarch64_common/boot.rs

OK

所有变量加 MY_ 是否是有特殊理由,还是只是命名习惯?如果没有,建议去掉它,然后把后面的缩写写全。

crates/of/tests/of.rs

同理,不需要 MY_ 前缀,可以把 DTB 写全或者改叫 DTB_FILE 、DTB_DATA 、DTB_TEXT 之类的名字

modules/axruntime/src/lib.rs

打印输出直接写 info!("Platform Name: {} ", axhal::platform_name()); 和代码保持一致。我没有找到 Machine Model 的这个概念。
Machine Model 同上,借鉴设备树关于设备描述的标准术语,这里确实没有一致,应该是 Machine Model,这里显示为Platform Name 的一部分原因是 porting ArceOS的 platform 的术语

@scPointer
Copy link

👍

  • 关于 issue 的问题:至少还是要在 README 指出“在 aarch64 上默认启动 qemu 时内存大小不同” 以及原因。
  • MY_ 目前还没看到回复或者修改

@guoweikang
Copy link
Author

👍

  • 关于 issue 的问题:至少还是要在 README 指出“在 aarch64 上默认启动 qemu 时内存大小不同” 以及原因。
  • MY_ 目前还没看到回复或者修改

@guoweikang guoweikang closed this Jan 29, 2024
@guoweikang
Copy link
Author

guoweikang commented Jan 29, 2024

This PR is split into two PRs:
PR6: aarch64重构
PR: fdt支持

@guoweikang guoweikang reopened this Jan 29, 2024
--------
1 Move aarch64 mem func(init_mmu) to aarch64_common mem module
2 Aarch64 support read mem info from fdt
3 As memory layout information can now be obtained through FDT,
  the static mapping method for mapping aarch64 memory is no longer necessary.

Signed-off-by: guoweikang <[email protected]>
--------
Bitmap_allocator is hard coding, support max 4GB mem,Previously,
the platform memory size was hard-coded in the platform/aarch64.
No matter what the memory size specified by qemu was, it was not
actually used. Now the memory layout size is dynamically obtained
from the device tree, and qemu's memory parameters can no longer
be specified arbitrarily.
Because byte allocator have more mem region used,The phenomenon
of memory expansion no longer occurs

Signed-off-by: guoweikang <[email protected]>
--------
CPU ID can be read from fdt, bst and qemu use the same mp mod

Signed-off-by: guoweikang <[email protected]>
@elliott10 elliott10 merged commit c64b61a into Arceos-monolithic:main Jan 31, 2024
pengzechen pushed a commit to pengzechen/hypervisor that referenced this pull request Mar 10, 2024
@guoweikang guoweikang deleted the guoweikang/fdt_support branch March 28, 2024 06:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants