-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Drive protection user bits on TL #2383
Conversation
The changes are pretty minor, just looking for an approval from someone |
tl_out_a.bits.user.lift(AMBAProt).foreach { x => | ||
val user_bit_cacheable = edge.manager.supportsAcquireTFast(access_address, a_size) | ||
|
||
x.privileged := s2_req.dprv === PRV.M || user_bit_cacheable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so all cacheable accesses are also by definition privileged?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The relevant point from the AMBA spec is that if a master cannot generate accurate protection information, it is recommended that we mark the transaction as privileged. Because caches like the L2 can merge requests from multiple different privilege modes, we can't accurately provide the protection information.
tl_out.a.bits.user.lift(AMBAProt).foreach { x => | ||
val user_bit_cacheable = edge_out.manager.supportsAcquireTFast(refill_paddr, lgCacheBlockBytes.U) | ||
|
||
x.privileged := io.privileged || user_bit_cacheable // privileged if machine mode or memory port |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh i see the comment here. so we are assuming everythign cacheable is going to memory port? If not this comment is a bit misleading
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, currently we are assuming any cacheable thing is going to the memory port. During a short discussion that I had with @hcook he mentioned that it's possible this may change in the future if we add other types of ports.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems it should be the opposite for safety, i.e. if you cannot figure out the exact privilege level, you should assume the lowest level of privilege.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand ARM's reasoning behind their decision, but we are making this change to be more compatible with ARM behavior. So I think for that reason we should follow the same thing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am confused. Since we cache everything on fetch, why is privileged not just tied to true?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@terpstra, @aswaterman posed a similar question but was unsure.
If @daveparry can review i can rubber stamp (assuming his review is not strong enough) |
x.fetch := false.B | ||
x.secure := true.B | ||
x.bufferable := false.B | ||
x.modifiable := false.B |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder whether bufferable/modifiable should be !user_bit_cacheable ?
tl_out.a.bits.user.lift(AMBAProt).foreach { x => | ||
val user_bit_cacheable = edge_out.manager.supportsAcquireTFast(refill_paddr, lgCacheBlockBytes.U) | ||
|
||
x.privileged := io.privileged || user_bit_cacheable // privileged if machine mode or memory port |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am confused. Since we cache everything on fetch, why is privileged not just tied to true?
@jsmithsf Hi, Thanks for your work. I am rookie to rocketchip, and want to understand why AMBAProtField is needed when virtual memory is disabled.
I am working on a chipyard configuration(rv32imac without os support), and when I port the deign to vcu118 fpga prototyping, the firrtl will complain some amba signal is not initialized. |
Related issue:
Type of change: other enhancement
Drive some relevant AMBA protection field information from Rocket.
Impact: API modification
When Rocket is configured to not use virtual memory, it will drive extra information on the TL user bits that can be converted into the AMBA protection fields.
Development Phase: implementation
Release Notes
The instruction vs data, cacheable vs. non-cacheable, and privileged vs. non-privileged information should be driven now.
Now we will mark an access as privileged if the core is in machine mode, or if the access is to a cacheable region.