Skip to content

Commit

Permalink
Merge #3194 #3195
Browse files Browse the repository at this point in the history
3194: chips/qemu_rv32_virt_chip: check mip.mtimer in pending IRQs r=bradjc a=lschuermann

### Pull Request Overview

This is a fix identical to that of #2571. It was not included in the qemu_rv32_virt board PR (#2516)  as that has been branched off before this fix was included in mainline.

### Testing Strategy

This pull request was tested by release tests (where before this change timer interrupts required pressing keys to trigger console interrupts, which are then registered as pending interrupts).


### TODO or Help Wanted

N/A

### Documentation Updated

- [x] Updated the relevant files in `/docs`, or no updates are required.

### Formatting

- [x] Ran `make prepush`.


3195: boards/qemu_rv32_virt: add IPC support r=bradjc a=lschuermann

### Pull Request Overview

This pull request adds IPC support to the QEMU RISC-V 32-bit "virt" platform board, which has been used during release testing.

### Testing Strategy

This pull request was tested by release testing.

### TODO or Help Wanted

N/A

### Documentation Updated

- [x] Updated the relevant files in `/docs`, or no updates are required.

### Formatting

- [x] Ran `make prepush`.


Co-authored-by: Leon Schuermann <leon@is.currently.online>
  • Loading branch information
bors[bot] and lschuermann committed Sep 6, 2022
3 parents b94b086 + 6d8bbfe + b8bac80 commit ffa5ce0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
14 changes: 8 additions & 6 deletions boards/qemu_rv32_virt/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ struct QemuRv32VirtPlatform {
'static,
VirtualMuxAlarm<'static, sifive::clint::Clint<'static>>,
>,
ipc: kernel::ipc::IPC<{ NUM_PROCS as u8 }>,
scheduler: &'static CooperativeSched<'static>,
scheduler_timer:
&'static VirtualSchedulerTimer<VirtualMuxAlarm<'static, sifive::clint::Clint<'static>>>,
Expand All @@ -69,6 +70,7 @@ impl SyscallDriverLookup for QemuRv32VirtPlatform {
capsules::console::DRIVER_NUM => f(Some(self.console)),
capsules::alarm::DRIVER_NUM => f(Some(self.alarm)),
capsules::low_level_debug::DRIVER_NUM => f(Some(self.lldb)),
kernel::ipc::DRIVER_NUM => f(Some(&self.ipc)),
_ => f(None),
}
}
Expand Down Expand Up @@ -268,6 +270,11 @@ pub unsafe fn main() {
lldb,
scheduler,
scheduler_timer,
ipc: kernel::ipc::IPC::new(
board_kernel,
kernel::ipc::DRIVER_NUM,
&memory_allocation_cap,
),
};

// ---------- PROCESS LOADING, SCHEDULER LOOP ----------
Expand All @@ -292,10 +299,5 @@ pub unsafe fn main() {
debug!("{:?}", err);
});

board_kernel.kernel_loop(
&platform,
chip,
None::<&kernel::ipc::IPC<{ NUM_PROCS as u8 }>>,
&main_loop_cap,
);
board_kernel.kernel_loop(&platform, chip, Some(&platform.ipc), &main_loop_cap);
}
8 changes: 8 additions & 0 deletions chips/qemu_rv32_virt_chip/src/chip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,14 @@ impl<'a, I: InterruptService<()> + 'a> Chip for QemuRv32VirtChip<'a, I> {
}

fn has_pending_interrupts(&self) -> bool {
// First check if the global machine timer interrupt is set.
// We would also need to check for additional global interrupt bits
// if there were to be used for anything in the future.
if CSR.mip.is_set(mip::mtimer) {
return true;
}

// Then we can check the PLIC.
self.plic.get_saved_interrupts().is_some()
}

Expand Down

0 comments on commit ffa5ce0

Please sign in to comment.