Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ycai
simbricks
Commits
b4dcbc81
Commit
b4dcbc81
authored
Jun 18, 2022
by
Antoine Kaufmann
Browse files
sims/nic/corundum: minimal host termination handling
parent
2c0b5f80
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
0 deletions
+18
-0
sims/nic/corundum/corundum_verilator.cc
sims/nic/corundum/corundum_verilator.cc
+18
-0
No files found.
sims/nic/corundum/corundum_verilator.cc
View file @
b4dcbc81
...
...
@@ -51,6 +51,7 @@ static uint64_t clock_period = 4 * 1000ULL; // 4ns -> 250MHz
static
volatile
int
exiting
=
0
;
uint64_t
main_time
=
0
;
static
struct
SimbricksNicIf
nicif
;
static
bool
pci_terminated
=
false
;
#ifdef TRACE_ENABLED
static
VerilatedVcdC
*
trace
;
...
...
@@ -355,6 +356,11 @@ class MMIOInterface {
};
void
pci_rwcomp_issue
(
MMIOOp
*
op
)
{
if
(
pci_terminated
)
{
delete
op
;
return
;
}
volatile
union
SimbricksProtoPcieD2H
*
msg
=
d2h_alloc
();
volatile
struct
SimbricksProtoPcieD2HReadcomp
*
rc
;
volatile
struct
SimbricksProtoPcieD2HWritecomp
*
wc
;
...
...
@@ -383,6 +389,10 @@ void pci_rwcomp_issue(MMIOOp *op) {
std
::
set
<
DMAOp
*>
pci_dma_pending
;
void
pci_dma_issue
(
DMAOp
*
op
)
{
if
(
pci_terminated
)
{
std
::
cerr
<<
"trying to issue dma after host terminated
\n
"
;
abort
();
}
volatile
union
SimbricksProtoPcieD2H
*
msg
=
d2h_alloc
();
uint8_t
ty
;
...
...
@@ -559,6 +569,11 @@ static void poll_h2d(MMIOInterface &mmio) {
case
SIMBRICKS_PROTO_MSG_TYPE_SYNC
:
break
;
case
SIMBRICKS_PROTO_MSG_TYPE_TERMINATE
:
std
::
cerr
<<
"poll_h2d: peer terminated"
<<
std
::
endl
;
pci_terminated
=
true
;
break
;
default:
std
::
cerr
<<
"poll_h2d: unsupported type="
<<
t
<<
std
::
endl
;
}
...
...
@@ -746,6 +761,9 @@ static void poll_n2d(EthernetRx &rx) {
}
void
pci_msi_issue
(
uint8_t
vec
)
{
if
(
pci_terminated
)
return
;
volatile
union
SimbricksProtoPcieD2H
*
msg
=
d2h_alloc
();
volatile
struct
SimbricksProtoPcieD2HInterrupt
*
intr
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment