Skip to content

[feat] Add hypervisor support for aarch64#10

Merged
equation314 merged 6 commits intoarceos-org:mainfrom
numpy1314:hypervisor-test
Jul 1, 2025
Merged

[feat] Add hypervisor support for aarch64#10
equation314 merged 6 commits intoarceos-org:mainfrom
numpy1314:hypervisor-test

Conversation

@numpy1314
Copy link
Copy Markdown
Contributor

update aarch64 hv part

@equation314
Copy link
Copy Markdown
Member

It is a duplicate of #7 which was nearly approved the review, but for some reason it got closed.

@numpy1314
Copy link
Copy Markdown
Contributor Author

It is a duplicate of #7 which was nearly approved the review, but for some reason it got closed.

Yes, that person is busy now, so I take over this part of the work.

Copy link
Copy Markdown
Member

@equation314 equation314 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please refer to the review comments of #7.

…shifting right 12 bits, and the unnecessary Inner Shareable suffix is ​​deleted.
@numpy1314
Copy link
Copy Markdown
Contributor Author

Please refer to the review comments of #7.

Modification has been completed,and I wonder if it is necessary to remove the inner shared suffix in the assembly code section on line 146

asm!("tlbi vaae1is, {}; dsb sy; isb", in(reg) vaddr.as_usize())
#[cfg(not(feature = "arm-el2"))]
{
asm!("tlbi vaae1is, {}; dsb sy; isb", in(reg) vaddr.vaddr >> 12)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The operand should be bits 12..55 of virtual address, see the official doccument and arceos-org/page_table_multiarch#21.

@equation314
Copy link
Copy Markdown
Member

Modification has been completed,and I wonder if it is necessary to remove the inner shared suffix in the assembly code section on line 146

The inner share suffix means broadcast to all cores in the same shared domain.

When we flush the TlB by address, it is often the case that one core modifies the page table mapping, which needs to take effect on other cores as well, so there is an is suffix.

When we flush all tlb entries, it is often during the initialization phase, when all cores will execute this operation to flush their own local TLBs, so there is no need for the is suffix.

Linux also use use is suffix to flush the TLB by virtual address ranges: https://github.com/torvalds/linux/blob/dfba48a70cb68888efb494c9642502efe73614ed/arch/arm64/include/asm/tlbflush.h#L470

@numpy1314 numpy1314 force-pushed the hypervisor-test branch 2 times, most recently from 270e1e1 to 1b0f2d7 Compare June 30, 2025 09:42
@numpy1314
Copy link
Copy Markdown
Contributor Author

Modification has been completed,and I wonder if it is necessary to remove the inner shared suffix in the assembly code section on line 146

The inner share suffix means broadcast to all cores in the same shared domain.

When we flush the TlB by address, it is often the case that one core modifies the page table mapping, which needs to take effect on other cores as well, so there is an is suffix.

When we flush all tlb entries, it is often during the initialization phase, when all cores will execute this operation to flush their own local TLBs, so there is no need for the is suffix.

Linux also use use is suffix to flush the TLB by virtual address ranges: https://github.com/torvalds/linux/blob/dfba48a70cb68888efb494c9642502efe73614ed/arch/arm64/include/asm/tlbflush.h#L470

Thank you very much. I ignored the processing of high bits before. I also learned the specific mechanism of refreshing specific addresses and refreshing the entire page table in multi-core situations. Here I want to confirm whether my understanding is correct: when we modify the mapping of a specific address, this operation will affect the TLB of all cores in the shared domain, but when the full TLB is refreshed, each core executes it independently, so there is no need to broadcast this instruction to other cores in the inner shared domain, right?

@equation314
Copy link
Copy Markdown
Member

when we modify the mapping of a specific address, this operation will affect the TLB of all cores in the shared domain, but when the full TLB is refreshed, each core executes it independently, so there is no need to broadcast this instruction to other cores in the inner shared domain, right?

Yep

/// If `vaddr` is [`None`], flushes the entire TLB. Otherwise, flushes the TLB
/// entry that maps the given virtual address.
///
/// Moreover, The reason for shifting vaddr right by 12 bits here is to clear
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove meaningless comments

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, useless comments have been removed

@equation314 equation314 changed the title [feat] functions essential to hypervisor implementation [feat] Add hypervisor support for aarch64 Jul 1, 2025
@equation314 equation314 merged commit 15de230 into arceos-org:main Jul 1, 2025
6 checks passed
@numpy1314 numpy1314 deleted the hypervisor-test branch July 2, 2025 02:59
AsakuraMizu added a commit that referenced this pull request Nov 13, 2025
Co-authored-by: 朝倉水希 <asakuramizu111@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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.

2 participants