uint32_t int_num = 1 << intNumToBit(cpuHighestInt[ctx]);
getActiveInt(ctx, intNumToWord(cpuHighestInt[ctx])) |= int_num;
updateRunPri();
- getPendingInt(ctx, intNumToWord(cpuHighestInt[ctx]))
- &= ~int_num;
+ if (!isLevelSensitive(ctx, active_int)) {
+ getPendingInt(ctx, intNumToWord(cpuHighestInt[ctx]))
+ &= ~int_num;
+ }
}
DPRINTF(Interrupt,
}
}
+ uint32_t prev_highest = cpuHighestInt[cpu];
cpuHighestInt[cpu] = highest_int;
- if (highest_int == SPURIOUS_INT)
+ if (highest_int == SPURIOUS_INT) {
+ if (isLevelSensitive(cpu, prev_highest)) {
+
+ DPRINTF(Interrupt, "Clear IRQ for cpu%d\n", cpu);
+ platform->intrctrl->clear(cpu, ArmISA::INT_IRQ, 0);
+ }
continue;
+ }
/* @todo make this work for more than one cpu, need to handle 1:N, N:N
* models */
}
void
-GicV2::clearInt(uint32_t number)
+GicV2::clearInt(uint32_t num)
{
- /* @todo assume edge triggered only at the moment. Nothing to do. */
+ if (isLevelSensitive(0, num)) {
+ uint8_t target = getCpuTarget(0, num);
+
+ DPRINTF(Interrupt,
+ "Received Clear interrupt number %d, cpuTarget %#x:\n",
+ num, target);
+
+ getPendingInt(target, intNumToWord(num)) &= ~(1 << intNumToBit(num));
+ updateIntState(intNumToWord(num));
+ } else {
+ /* Nothing to do :
+ * Edge-triggered interrupt remain pending until software
+ * writes GICD_ICPENDR or reads GICC_IAR */
+ }
}
void
}
}
+ /** GICD_ICFGRn
+ * get 2 bit config associated to an interrupt.
+ */
+ uint8_t getIntConfig(ContextID ctx, uint32_t ix) {
+ assert(ix < INT_LINES_MAX);
+ const uint8_t cfg_low = intNumToBit(ix * 2);
+ const uint8_t cfg_hi = cfg_low + 1;
+ return bits(intConfig[intNumToWord(ix * 2)], cfg_hi, cfg_low);
+ }
+
/** GICD_ITARGETSR{8..255}
* an 8 bit cpu target id for each global interrupt.
*/
* and if it is 1:N or N:N */
uint32_t intConfig[INT_BITS_MAX*2];
+ bool isLevelSensitive(ContextID ctx, uint32_t ix) {
+ if (ix == SPURIOUS_INT) {
+ return false;
+ } else {
+ return bits(getIntConfig(ctx, ix), 1) == 0;
+ }
+ }
+
/** CPU enabled */
bool cpuEnabled[CPU_MAX];