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
2c0b5f80
Commit
2c0b5f80
authored
Jun 18, 2022
by
Antoine Kaufmann
Browse files
lib/nicbm: basic terminaiton support for host simulators
Stops enqueuing messages but keeps synchronizing with the network
parent
55028a24
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
0 deletions
+21
-0
lib/simbricks/nicbm/nicbm.cc
lib/simbricks/nicbm/nicbm.cc
+21
-0
No files found.
lib/simbricks/nicbm/nicbm.cc
View file @
2c0b5f80
...
@@ -86,6 +86,11 @@ static void sigusr2_handler(int dummy) {
...
@@ -86,6 +86,11 @@ static void sigusr2_handler(int dummy) {
#endif
#endif
volatile
union
SimbricksProtoPcieD2H
*
Runner
::
D2HAlloc
()
{
volatile
union
SimbricksProtoPcieD2H
*
Runner
::
D2HAlloc
()
{
if
(
SimbricksBaseIfInTerminated
(
&
nicif_
.
pcie
.
base
))
{
fprintf
(
stderr
,
"Runner::D2HAlloc: peer already terminated
\n
"
);
abort
();
}
volatile
union
SimbricksProtoPcieD2H
*
msg
;
volatile
union
SimbricksProtoPcieD2H
*
msg
;
bool
first
=
true
;
bool
first
=
true
;
while
((
msg
=
SimbricksPcieIfD2HOutAlloc
(
&
nicif_
.
pcie
,
main_time_
))
==
NULL
)
{
while
((
msg
=
SimbricksPcieIfD2HOutAlloc
(
&
nicif_
.
pcie
,
main_time_
))
==
NULL
)
{
...
@@ -149,6 +154,9 @@ void Runner::DmaTrigger() {
...
@@ -149,6 +154,9 @@ void Runner::DmaTrigger() {
}
}
void
Runner
::
DmaDo
(
DMAOp
&
op
)
{
void
Runner
::
DmaDo
(
DMAOp
&
op
)
{
if
(
SimbricksBaseIfInTerminated
(
&
nicif_
.
pcie
.
base
))
return
;
volatile
union
SimbricksProtoPcieD2H
*
msg
=
D2HAlloc
();
volatile
union
SimbricksProtoPcieD2H
*
msg
=
D2HAlloc
();
dma_pending_
++
;
dma_pending_
++
;
#ifdef DEBUG_NICBM
#ifdef DEBUG_NICBM
...
@@ -204,6 +212,9 @@ void Runner::DmaDo(DMAOp &op) {
...
@@ -204,6 +212,9 @@ void Runner::DmaDo(DMAOp &op) {
}
}
void
Runner
::
MsiIssue
(
uint8_t
vec
)
{
void
Runner
::
MsiIssue
(
uint8_t
vec
)
{
if
(
SimbricksBaseIfInTerminated
(
&
nicif_
.
pcie
.
base
))
return
;
volatile
union
SimbricksProtoPcieD2H
*
msg
=
D2HAlloc
();
volatile
union
SimbricksProtoPcieD2H
*
msg
=
D2HAlloc
();
#ifdef DEBUG_NICBM
#ifdef DEBUG_NICBM
printf
(
"main_time = %lu: nicbm: issue MSI interrupt vec %u
\n
"
,
main_time_
,
vec
);
printf
(
"main_time = %lu: nicbm: issue MSI interrupt vec %u
\n
"
,
main_time_
,
vec
);
...
@@ -217,6 +228,9 @@ void Runner::MsiIssue(uint8_t vec) {
...
@@ -217,6 +228,9 @@ void Runner::MsiIssue(uint8_t vec) {
}
}
void
Runner
::
MsiXIssue
(
uint8_t
vec
)
{
void
Runner
::
MsiXIssue
(
uint8_t
vec
)
{
if
(
SimbricksBaseIfInTerminated
(
&
nicif_
.
pcie
.
base
))
return
;
volatile
union
SimbricksProtoPcieD2H
*
msg
=
D2HAlloc
();
volatile
union
SimbricksProtoPcieD2H
*
msg
=
D2HAlloc
();
#ifdef DEBUG_NICBM
#ifdef DEBUG_NICBM
printf
(
"main_time = %lu: nicbm: issue MSI-X interrupt vec %u
\n
"
,
main_time_
,
vec
);
printf
(
"main_time = %lu: nicbm: issue MSI-X interrupt vec %u
\n
"
,
main_time_
,
vec
);
...
@@ -230,6 +244,9 @@ void Runner::MsiXIssue(uint8_t vec) {
...
@@ -230,6 +244,9 @@ void Runner::MsiXIssue(uint8_t vec) {
}
}
void
Runner
::
IntXIssue
(
bool
level
)
{
void
Runner
::
IntXIssue
(
bool
level
)
{
if
(
SimbricksBaseIfInTerminated
(
&
nicif_
.
pcie
.
base
))
return
;
volatile
union
SimbricksProtoPcieD2H
*
msg
=
D2HAlloc
();
volatile
union
SimbricksProtoPcieD2H
*
msg
=
D2HAlloc
();
#ifdef DEBUG_NICBM
#ifdef DEBUG_NICBM
printf
(
"main_time = %lu: nicbm: set intx interrupt %u
\n
"
,
main_time_
,
level
);
printf
(
"main_time = %lu: nicbm: set intx interrupt %u
\n
"
,
main_time_
,
level
);
...
@@ -400,6 +417,10 @@ void Runner::PollH2D() {
...
@@ -400,6 +417,10 @@ void Runner::PollH2D() {
#endif
#endif
break
;
break
;
case
SIMBRICKS_PROTO_MSG_TYPE_TERMINATE
:
fprintf
(
stderr
,
"poll_h2d: peer terminated
\n
"
);
break
;
default:
default:
fprintf
(
stderr
,
"poll_h2d: unsupported type=%u
\n
"
,
type
);
fprintf
(
stderr
,
"poll_h2d: unsupported type=%u
\n
"
,
type
);
}
}
...
...
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