fix interrupting during a quisce on sparc

src/arch/sparc/ua2005.cc:
    fix interrupting when quisced. Since sticks correspond to instructions when not quisced we need to
    check if were suspended and interrupt at the guess time
src/base/traceflags.py:
    add trace flag for Iob
src/cpu/simple/base.cc:
    Use Quisce instead of IPI trace flag
src/dev/sparc/iob.cc:
    add some Dprintfs

--HG--
extra : convert_revision : 72e18fcc750ad1e4b2bb67b19b354eaffc6af6d5
This commit is contained in:
Ali Saidi 2007-03-13 00:05:52 -04:00
parent 247ee8ef74
commit a068d6db0f
4 changed files with 27 additions and 3 deletions

View file

@ -195,6 +195,7 @@ MiscRegFile::setFSReg(int miscReg, const MiscReg &val, ThreadContext *tc)
panic("No support for setting spec_en bit\n"); panic("No support for setting spec_en bit\n");
setRegNoEffect(miscReg, bits(val,0,0)); setRegNoEffect(miscReg, bits(val,0,0));
if (!bits(val,0,0)) { if (!bits(val,0,0)) {
DPRINTF(Quiesce, "Cpu executed quiescing instruction\n");
// Time to go to sleep // Time to go to sleep
tc->suspend(); tc->suspend();
if (tc->getKernelStats()) if (tc->getKernelStats())
@ -307,7 +308,7 @@ MiscRegFile::processSTickCompare(ThreadContext *tc)
tc->getCpuPtr()->instCount(); tc->getCpuPtr()->instCount();
assert(ticks >= 0 && "stick compare missed interrupt cycle"); assert(ticks >= 0 && "stick compare missed interrupt cycle");
if (ticks == 0) { if (ticks == 0 || tc->status() == ThreadContext::Suspended) {
DPRINTF(Timer, "STick compare cycle reached at %#x\n", DPRINTF(Timer, "STick compare cycle reached at %#x\n",
(stick_cmpr & mask(63))); (stick_cmpr & mask(63)));
if (!(tc->readMiscRegNoEffect(MISCREG_STICK_CMPR) & (ULL(1) << 63))) { if (!(tc->readMiscRegNoEffect(MISCREG_STICK_CMPR) & (ULL(1) << 63))) {
@ -324,11 +325,15 @@ MiscRegFile::processHSTickCompare(ThreadContext *tc)
// we're actually at the correct cycle or we need to wait a little while // we're actually at the correct cycle or we need to wait a little while
// more // more
int ticks; int ticks;
if ( tc->status() == ThreadContext::Halted ||
tc->status() == ThreadContext::Unallocated)
return;
ticks = ((int64_t)(hstick_cmpr & mask(63)) - (int64_t)stick) - ticks = ((int64_t)(hstick_cmpr & mask(63)) - (int64_t)stick) -
tc->getCpuPtr()->instCount(); tc->getCpuPtr()->instCount();
assert(ticks >= 0 && "hstick compare missed interrupt cycle"); assert(ticks >= 0 && "hstick compare missed interrupt cycle");
if (ticks == 0) { if (ticks == 0 || tc->status() == ThreadContext::Suspended) {
DPRINTF(Timer, "HSTick compare cycle reached at %#x\n", DPRINTF(Timer, "HSTick compare cycle reached at %#x\n",
(stick_cmpr & mask(63))); (stick_cmpr & mask(63)));
if (!(tc->readMiscRegNoEffect(MISCREG_HSTICK_CMPR) & (ULL(1) << 63))) { if (!(tc->readMiscRegNoEffect(MISCREG_HSTICK_CMPR) & (ULL(1) << 63))) {

View file

@ -116,6 +116,7 @@ baseFlags = [
'ISP', 'ISP',
'IdeCtrl', 'IdeCtrl',
'IdeDisk', 'IdeDisk',
'Iob',
'Interrupt', 'Interrupt',
'LLSC', 'LLSC',
'LSQ', 'LSQ',

View file

@ -301,7 +301,7 @@ BaseSimpleCPU::post_interrupt(int int_num, int index)
BaseCPU::post_interrupt(int_num, index); BaseCPU::post_interrupt(int_num, index);
if (thread->status() == ThreadContext::Suspended) { if (thread->status() == ThreadContext::Suspended) {
DPRINTF(IPI,"Suspended Processor awoke\n"); DPRINTF(Quiesce,"Suspended Processor awoke\n");
thread->activate(); thread->activate();
} }
} }

View file

@ -192,6 +192,8 @@ Iob::writeIob(PacketPtr pkt)
data = pkt->get<uint64_t>(); data = pkt->get<uint64_t>();
intMan[index].cpu = bits(data,12,8); intMan[index].cpu = bits(data,12,8);
intMan[index].vector = bits(data,5,0); intMan[index].vector = bits(data,5,0);
DPRINTF(Iob, "Wrote IntMan %d cpu %d, vec %d\n", index,
intMan[index].cpu, intMan[index].vector);
return; return;
} }
@ -201,11 +203,14 @@ Iob::writeIob(PacketPtr pkt)
intCtl[index].mask = bits(data,2,2); intCtl[index].mask = bits(data,2,2);
if (bits(data,1,1)) if (bits(data,1,1))
intCtl[index].pend = false; intCtl[index].pend = false;
DPRINTF(Iob, "Wrote IntCtl %d pend %d cleared %d\n", index,
intCtl[index].pend, bits(data,2,2));
return; return;
} }
if (accessAddr == JIntVecAddr) { if (accessAddr == JIntVecAddr) {
jIntVec = bits(pkt->get<uint64_t>(), 5,0); jIntVec = bits(pkt->get<uint64_t>(), 5,0);
DPRINTF(Iob, "Wrote jIntVec %d\n", jIntVec);
return; return;
} }
@ -237,11 +242,15 @@ Iob::writeJBus(PacketPtr pkt)
index = (accessAddr - JIntBusyAddr) >> 3; index = (accessAddr - JIntBusyAddr) >> 3;
data = pkt->get<uint64_t>(); data = pkt->get<uint64_t>();
jIntBusy[index].busy = bits(data,5,5); jIntBusy[index].busy = bits(data,5,5);
DPRINTF(Iob, "Wrote jIntBusy index %d busy: %d\n", index,
jIntBusy[index].busy);
return; return;
} }
if (accessAddr == JIntABusyAddr) { if (accessAddr == JIntABusyAddr) {
data = pkt->get<uint64_t>(); data = pkt->get<uint64_t>();
jIntBusy[cpuid].busy = bits(data,5,5); jIntBusy[cpuid].busy = bits(data,5,5);
DPRINTF(Iob, "Wrote jIntBusy index %d busy: %d\n", cpuid,
jIntBusy[cpuid].busy);
return; return;
}; };
@ -256,6 +265,8 @@ Iob::receiveDeviceInterrupt(DeviceId devid)
return; return;
intCtl[devid].mask = true; intCtl[devid].mask = true;
intCtl[devid].pend = true; intCtl[devid].pend = true;
DPRINTF(Iob, "Receiving Device interrupt: %d for cpu %d vec %d\n",
devid, intMan[devid].cpu, intMan[devid].vector);
ic->post(intMan[devid].cpu, SparcISA::IT_INT_VEC, intMan[devid].vector); ic->post(intMan[devid].cpu, SparcISA::IT_INT_VEC, intMan[devid].vector);
} }
@ -269,6 +280,8 @@ Iob::generateIpi(Type type, int cpu_id, int vector)
switch (type) { switch (type) {
case 0: // interrupt case 0: // interrupt
DPRINTF(Iob, "Generating interrupt because of I/O write to cpu: %d vec %d\n",
cpu_id, vector);
ic->post(cpu_id, SparcISA::IT_INT_VEC, vector); ic->post(cpu_id, SparcISA::IT_INT_VEC, vector);
break; break;
case 1: // reset case 1: // reset
@ -279,9 +292,11 @@ Iob::generateIpi(Type type, int cpu_id, int vector)
sys->threadContexts[cpu_id]->activate(); sys->threadContexts[cpu_id]->activate();
break; break;
case 2: // idle -- this means stop executing and don't wake on interrupts case 2: // idle -- this means stop executing and don't wake on interrupts
DPRINTF(Iob, "Idling CPU because of I/O write cpu: %d\n", cpu_id);
sys->threadContexts[cpu_id]->halt(); sys->threadContexts[cpu_id]->halt();
break; break;
case 3: // resume case 3: // resume
DPRINTF(Iob, "Resuming CPU because of I/O write cpu: %d\n", cpu_id);
sys->threadContexts[cpu_id]->activate(); sys->threadContexts[cpu_id]->activate();
break; break;
default: default:
@ -297,6 +312,9 @@ Iob::receiveJBusInterrupt(int cpu_id, int source, uint64_t d0, uint64_t d1)
if (jIntBusy[cpu_id].busy) if (jIntBusy[cpu_id].busy)
return false; return false;
DPRINTF(Iob, "Receiving jBus interrupt: %d for cpu %d vec %d\n",
source, cpu_id, jIntVec);
jIntBusy[cpu_id].busy = true; jIntBusy[cpu_id].busy = true;
jIntBusy[cpu_id].source = source; jIntBusy[cpu_id].source = source;
jBusData0[cpu_id] = d0; jBusData0[cpu_id] = d0;