-
Notifications
You must be signed in to change notification settings - Fork 34
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
Add vCLIC
interface and logic
#44
Conversation
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
e604564
to
eff9be5
Compare
FPGA implementation fails because Lines 268 to 275 in eff9be5
|
Thanks, will fix :) |
LGTM for me @niwis, maybe we can do some squashing or squash-and-merge, but functionally it's ready for merge |
@niwis rfc when you have time, so that we can proceed also in cheshire |
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.
Thanks a lot @ezelioli and @alex96295 for the extensions and rebase! I have a few general comments and suggestions, the rest in-line.
-
It seems like of the changes would generally be useful for H extension (also without CLIC). In particular, I'm thinking of a) tracing virtualisation mode, and b) Fixing H interrupt delegation. Do you think you could open dedicated PRs for these changes to this repo and Bruno's "upstream" H-ext branch?
-
We're still experimenting with the new "integrate" action, so this is not very obvious. But the current integration causes a port mismatch. Can you point the
base-ref
in integration.yml to a cheshire ref which integrates vCLIC? See CONTRIBUTING-PULP.md -
A more open question: Should we have an explicit
VCLIC
parameter or similar to enable/disable non-specified features? My concern is that H and CLIC have official RISC-V specs whereas vCLIC does not, so implicitly activating vCLIC when H and CLIC are enabled might lead to unexpected behavior.
@@ -35,6 +35,7 @@ class ex_trace_item; | |||
riscv::ST_ACCESS_FAULT: this.cause_s = "Store Access Fault"; | |||
riscv::ENV_CALL_UMODE: this.cause_s = "Environment Call User Mode"; | |||
riscv::ENV_CALL_SMODE: this.cause_s = "Environment Call Supervisor Mode"; | |||
riscv::ENV_CALL_VSMODE: this.cause_s = "Environment Call Virtual Supervisor Mode"; |
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 believe this is generally useful for H ext... can we commit this separately so that we can also merge it into upstream H ext?
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.
Same here, seems more related to H ext than to vCLIC
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.
Same for the changes in this file (vCLIC->H)
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.
Also here (vCLIC->H)
riscv::priv_lvl_t priv_lvl; // In CLIC mode, keeps information about | ||
// incoming interrupt target privilege level | ||
logic trap_to_v; |
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.
These fields might be a bit misleading since they are only used in CLIC mode. Would it be possible to pack them together with the other CLIC-specific data into the cause
field? There should be enough space. This would also reduce the overall diff. We can also define a new struct type for better readability if you prefer.
cva6/core/cva6_clic_controller.sv
Lines 69 to 79 in 876c325
// ------------------ | |
// Interrupt Packager | |
// ------------------ | |
// Pack interrupt cause to be inserted into the pipeline | |
assign clic_irq_cause_o = { | |
1'b1, // This is an irq | |
{riscv::XLEN - 25{1'b0}}, // XLEN-2...24 | |
clic_irq_level_i, // to mintstatus.mil | |
{16 - $clog2(CVA6Cfg.CLICNumInterruptSrc) {1'b0}}, // 15...IDWidth | |
clic_irq_id_i | |
}; // to mcause |
| riscv::HSTATUS_VGEIN | ||
| riscv::HSTATUS_VTVM | ||
| riscv::HSTATUS_VTW | ||
| riscv::HSTATUS_VTSR; | ||
|
||
// hypervisor delegable interrupts | ||
localparam logic [riscv::XLEN-1:0] HS_DELEG_INTERRUPTS = riscv::MIP_VSSIP | ||
localparam logic [riscv::XLEN-1:0] HS_DELEG_INTERRUPTS = riscv::MIP_VSSIP; | ||
|
||
localparam logic [63:0] HIE_MASK = riscv::MIP_VSSIP | ||
| riscv::MIP_VSTIP | ||
| riscv::MIP_VSEIP; | ||
| riscv::MIP_VSEIP | ||
| riscv::MIP_SGEIP; | ||
|
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.
Do these apply to H ext in general?
@@ -55,12 +64,67 @@ module cva6_clic_controller #( | |||
clic_irq_req_o = clic_irq_valid_i; | |||
// Take S-mode interrupts with higher level | |||
end else if (clic_irq_priv_i == riscv::PRIV_LVL_S) begin | |||
clic_irq_req_o = (clic_irq_level_i > max_sthresh) && (clic_irq_valid_i) && irq_ctrl_i.sie; | |||
// clic_irq_req_o = (clic_irq_level_i > max_sthresh) && (clic_irq_valid_i) && irq_ctrl_i.sie; |
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 assume this line can be removed
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.
There are several ToDos in this file. Should we discuss them before merging?
@@ -531,7 +536,7 @@ module csr_regfile | |||
if (CVA6Cfg.RVH) csr_rdata = htinst_q; | |||
else read_access_exception = 1'b1; | |||
riscv::CSR_HGEIE: | |||
if (CVA6Cfg.RVH) csr_rdata = '0; | |||
if (CVA6Cfg.RVH) csr_rdata = {hgeie_q[riscv::XLEN-1:1], 1'b0}; |
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.
These also look generally useful for H ext
@@ -1478,6 +1494,7 @@ module cva6 | |||
assign tracer_if.exception = commit_stage_i.exception_o; | |||
// assign current privilege level | |||
assign tracer_if.priv_lvl = priv_lvl; | |||
assign tracer_if.v = v; |
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.
Can be combined with tracer H-support changes above
Superseded by #55 |
This PR adds support for virtualized interrupts handled by the RISC-V CLIC interface.
@ezelioli this is the reference PR for this feature, to be updated in Cheshire and other systems using CVA6 + CLIC with virtual extensions enabled for the latter
It would be good if you could use this branch to run your tests, so we see if I missed something during cherry-picking (there were a lot of conflicts because the current codebase has different indentation, causing false negatives)
@ezelioli @niwis we should try to converge on this ASAP