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

Question about iohpmctr in iommu_ref_model #240

Closed
baimengwei opened this issue Jul 21, 2023 · 2 comments
Closed

Question about iohpmctr in iommu_ref_model #240

baimengwei opened this issue Jul 21, 2023 · 2 comments

Comments

@baimengwei
Copy link

baimengwei commented Jul 21, 2023

In the spec, iohpmctr is a counter, which seems to be 32-64 bit adjustable by hardware, but if it's 64 bit width for iohpmctr, the C model is out of this range and doesn't seem to report overflow. Is a bug or correct behavior ?

https://github.com/riscv-non-isa/riscv-iommu/blob/main/iommu_ref_model/libiommu/src/iommu_hpm.c#L84

if g_reg_file.iohpmctr[i].counter is 0xFFFFFFFFFF,and its width is 40, then a interrupt might be report.

if g_reg_file.iohpmctr[i].counter is 0xFFFFFFFFFFFFFFFF,and its width is 64, then count will be zero, a interrupt can not be report. because of the value width is 64.

https://github.com/riscv-non-isa/riscv-iommu/blob/main/iommu_ref_model/libiommu/src/iommu_hpm.c#L86C14-L86C20

@ved-rivos
Copy link
Collaborator

Yes. Was a bug. Its fixed in PR #241. Thanks for reporting.

@baimengwei
Copy link
Author

Thanks for resolving.

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

No branches or pull requests

2 participants