Melissa Jost has uploaded this change for review. (
https://gem5-review.googlesource.com/c/public/gem5/+/53040 )
Change subject: dev: Modify LupIO-PIC for SMP support
......................................................................
dev: Modify LupIO-PIC for SMP support
Added mask and enable arrays to the LupIO-PIC in order to
handle SMP support.
Change-Id: Id120206f33374ce337e389ef5a10fd64e62bcab3
---
M src/dev/lupio/lupio_pic.cc
M src/dev/lupio/lupio_pic.hh
2 files changed, 54 insertions(+), 20 deletions(-)
diff --git a/src/dev/lupio/lupio_pic.cc b/src/dev/lupio/lupio_pic.cc
index 3fe8a49..4f30f31 100644
--- a/src/dev/lupio/lupio_pic.cc
+++ b/src/dev/lupio/lupio_pic.cc
@@ -34,8 +34,6 @@
#include "params/LupioPIC.hh"
#include "sim/system.hh"
-#define LUPIO_PIC_NSRC 32
-
namespace gem5
{
@@ -46,23 +44,26 @@
system(params.system),
nSrc(params.n_src),
nThread(params.num_threads),
- intType(params.int_type)
+ intType(params.int_type),
+ mask{0},
+ enable{0}
{
+ // CPU0 receives all IRQ sources by default
+ enable[0] = 0xFFFFFFFF;
DPRINTF(LupioPIC, "LupioPIC initalized\n");
}
void
LupioPIC::lupioPicUpdateIRQ()
{
- if (nThread > 1 ) {
- panic("This device currently does not have SMP support\n");
- }
+ for (int cpu = 0; cpu < nThread; cpu++) {
+ auto tc = system->threads[cpu];
- auto tc = system->threads[0];
- if (pending & mask) {
- tc->getCpuPtr()->postInterrupt(tc->threadId(), intType, 0);
- } else {
- tc->getCpuPtr()->clearInterrupt(tc->threadId(), intType, 0);
+ if (enable[cpu] & mask[cpu] & pending) {
+ tc->getCpuPtr()->postInterrupt(tc->threadId(), intType, 0);
+ } else {
+ tc->getCpuPtr()->clearInterrupt(tc->threadId(), intType, 0);
+ }
}
}
@@ -90,21 +91,27 @@
LupioPIC::lupioPicRead(uint8_t addr)
{
uint32_t r = 0;
-
- switch (addr >> 2) {
+
+ int cpu = addr >> LUPIO_PIC_MAX;
+ int reg = (addr >> 2) & (LUPIO_PIC_MAX - 1);
+
+ switch (reg) {
case LUPIO_PIC_PRIO:
// Value will be 32 if there is no unmasked pending IRQ
- r = ctz32(pending & mask);
+ r = ctz32(pending & mask[cpu] & enable[cpu]);
DPRINTF(LupioPIC, "Read PIC_PRIO: %d\n", r);
break;
case LUPIO_PIC_MASK:
- r = mask;
+ r = mask[cpu];
DPRINTF(LupioPIC, "Read PIC_MASK: %d\n", r);
break;
case LUPIO_PIC_PEND:
- r = pending;
+ r = (enable[cpu] & pending);
DPRINTF(LupioPIC, "Read PIC_PEND: %d\n", r);
break;
+ case LUPIO_PIC_ENAB:
+ r = enable[cpu];
+ break;
default:
panic("Unexpected read to the LupioPIC device at
address %#llx!",
@@ -119,10 +126,18 @@
{
uint32_t val = val64;
- switch (addr >> 2) {
+ int cpu = addr >> LUPIO_PIC_MAX;
+ int reg = (addr >> 2) & (LUPIO_PIC_MAX - 1);
+
+ switch (reg) {
case LUPIO_PIC_MASK:
- mask = val;
- DPRINTF(LupioPIC, "Write PIC_MASK: %d\n", mask);
+ mask[cpu] = val;
+ DPRINTF(LupioPIC, "Write PIC_MASK: %d\n", mask[cpu]);
+ lupioPicUpdateIRQ();
+ break;
+ case LUPIO_PIC_ENAB:
+ enable[cpu] = val;
+ DPRINTF(LupioPIC, "Write PIC_ENAB: %d\n", enable[cpu]);
lupioPicUpdateIRQ();
break;
diff --git a/src/dev/lupio/lupio_pic.hh b/src/dev/lupio/lupio_pic.hh
index 623f032..a5d6582 100644
--- a/src/dev/lupio/lupio_pic.hh
+++ b/src/dev/lupio/lupio_pic.hh
@@ -35,6 +35,8 @@
#include "params/LupioPIC.hh"
#include "sim/system.hh"
+#define LUPIO_PIC_NSRC 32
+
namespace gem5
{
@@ -62,13 +64,18 @@
LUPIO_PIC_PRIO,
LUPIO_PIC_MASK,
LUPIO_PIC_PEND,
+ LUPIO_PIC_ENAB,
// Max offset
LUPIO_PIC_MAX,
};
uint32_t pending = 0;
- uint32_t mask = 0;
+ // Register for masking or unmasking up to 32 sources
+ uint32_t mask[LUPIO_PIC_NSRC];
+ // Regitser to determine which input IRQ is routed to the
+ // corresponding processor
+ uint32_t enable[LUPIO_PIC_NSRC];
protected:
/**
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/53040
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: Id120206f33374ce337e389ef5a10fd64e62bcab3
Gerrit-Change-Number: 53040
Gerrit-PatchSet: 1
Gerrit-Owner: Melissa Jost <melissakj...@gmail.com>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s