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

HSM和IPI、RFENCE扩展共存的问题 #12

Open
Gallium70 opened this issue Dec 30, 2021 · 5 comments
Open

HSM和IPI、RFENCE扩展共存的问题 #12

Gallium70 opened this issue Dec 30, 2021 · 5 comments
Labels
enhancement New feature or request

Comments

@Gallium70
Copy link

目前rustsbi-qemu在收到M态软件中断时,只会判断上一个HSM命令,如果不存在就直接 panic ,导致S态软件无论是通过SBI s-IPI扩展还是直接访问Clint都无法使用IPI功能(除非是ACLINT)。

一个最直接的hack就是发现没有HSM命令时,把软件中断直接转发给S态;不过这样可能处理不了rfence扩展,应该得再加一套或者两套命令接口。

@luojia65
Copy link
Member

这部分如果改成”转发MachineSoft到SupervisorSoft“能处理这种情况吗?

@Gallium70
Copy link
Author

我自己现在的方法是把panic换成

let clint = crate::clint::Clint::new(0x2000000 as *mut u8);
clint.clear_soft(hart_id); // Clear IPI
unsafe {
    mip::clear_msoft();
    mip::set_ssoft();
};

这样S态可以用IPI,不过remote fence就只能靠S态软件自己实现了;如果要在sbi里面支持rfence,那可能得加一套和hsm类似的命令机制,也放在这判断一下(不过rfence应该不需要维护状态,可能实现起来会简单一些)

@luojia65
Copy link
Member

确实存在这个问题,我写了个测试用例,然后看看M态怎么转发这个中断会比较好。解决这个问题需要对risc-v的中断架构有深刻的了解。

@YdrMaster YdrMaster mentioned this issue Jun 9, 2022
18 tasks
@YdrMaster
Copy link
Member

现在 hsm 需要的中断会在单独的 handler 里处理,肯定不会和 ipi 冲突,rfnc 没实现,但是应该也能和 ipi 共存,实现的时候注意这个问题。应该禁止 s 态直接访问 clint。

@YdrMaster YdrMaster added the enhancement New feature or request label Jul 21, 2022
@YdrMaster
Copy link
Member

更新:已经禁止 s 态访问 clint

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants