Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
138 commits
Select commit Hold shift + click to select a range
f10bf9c
Init ACPI driver and example
terryzbai Mar 25, 2026
ef77f30
WIP: ACPI AML parser
terryzbai Mar 29, 2026
c4bf01f
WIP: AML parser
terryzbai Mar 30, 2026
73d9496
WIP: AML parser
terryzbai Mar 30, 2026
0f4ccc4
checkpoint: UB in recurssive function
terryzbai Mar 31, 2026
c4f38d8
WIP: direct path_len arg to avoid UB error
terryzbai Apr 1, 2026
b5e7687
WIP: found _CRS
terryzbai Apr 2, 2026
a66de5b
WIP
terryzbai Apr 2, 2026
14cc614
WIP: calculate length of name data length
terryzbai Apr 2, 2026
ff334a5
WIP: _CRS parsed
terryzbai Apr 8, 2026
5d25ec6
WIP: parse Package Object containing routing tables
terryzbai Apr 8, 2026
033677f
WIP: save PCI seg groups
terryzbai Apr 10, 2026
9a95485
WIP: something
terryzbai Apr 10, 2026
8174bdf
WIP: refactor interpreter
terryzbai Apr 16, 2026
80c0310
WIP: object scanning
terryzbai Apr 16, 2026
7a60697
WIP: fix opcode
terryzbai Apr 16, 2026
9256dcb
WIP: _CRS extracted again
terryzbai Apr 17, 2026
9a01ed5
WIP: fix
terryzbai Apr 17, 2026
ab2d399
WIP: temp solution to extract _PRT package name
terryzbai Apr 17, 2026
6ad0199
WIP: PRT package found
terryzbai Apr 17, 2026
e716475
WIP: parsed PRT package again
terryzbai Apr 17, 2026
7d024a2
WIP: parse Extended IRQ Descriptor
terryzbai Apr 17, 2026
58259c2
WIP: convert IRQ name object to integer
terryzbai Apr 17, 2026
0b02321
WIP: receive all CRS in acpi.c
terryzbai Apr 17, 2026
b51d96c
WIP: code cleanup
terryzbai Apr 17, 2026
5789a8c
WIP: add pci_resource var_addr
terryzbai Apr 22, 2026
b1f3a5c
WIP: init PCI driver
terryzbai Apr 22, 2026
8ac46fa
WIP: add pci resource mr and cleanup
terryzbai Apr 22, 2026
f818c50
fix: crs bookkeeping
terryzbai May 4, 2026
52c8e13
refactor: using shared caps and bootinfo tags
terryzbai May 5, 2026
5f25ff6
ECAM mapping for PCI driver
terryzbai May 6, 2026
3e243ed
WIP: copy caps to shared cnode
terryzbai May 8, 2026
c19fcaf
wip: refactor
terryzbai May 8, 2026
61e30c6
wip: revoke untypeds
terryzbai May 8, 2026
5d958d5
wip: refactor
terryzbai May 8, 2026
7264e67
fix: get correct object size
terryzbai May 8, 2026
da85cd5
wip: pass pci_resources structure
terryzbai May 11, 2026
cf4fbda
wip: PCI driver gets CRS
terryzbai May 11, 2026
c361e33
wip: pass desc of cnode caps
terryzbai May 11, 2026
cab30b6
wip
terryzbai May 11, 2026
27fdefd
wip: fix pci bus scan
terryzbai May 11, 2026
45bbe6e
wip: tiny changes
terryzbai May 11, 2026
3a85f62
WIP: tine changes
terryzbai May 11, 2026
869f58f
Receive IRQControl cap and pass it to PCI driver
terryzbai May 13, 2026
0986a3a
WIP: cleanup
terryzbai May 13, 2026
3853407
wip: integrate ACPI/PCI to echoserver example
terryzbai May 16, 2026
114a0bf
wip: map eth_driver's vspace cap to PCI driver
terryzbai May 16, 2026
1b05139
wip: comment untyped_revoke to map dev regs for PCI devices
terryzbai May 16, 2026
69377b2
wip: timer driver works
terryzbai May 17, 2026
3692dc5
echoserver example works without re-configuration
terryzbai May 17, 2026
cd8f48b
wip: dynamic irq but the first irq is not delivered correctly
terryzbai May 18, 2026
a777c25
fix: messed handler and notif cap :(
terryzbai May 18, 2026
ad360e9
wip: fix incorrect cap for ack
terryzbai May 19, 2026
b0ca044
wip: use APIC IRQ number instead
terryzbai May 20, 2026
7f64b64
pass prt to PCI driver
terryzbai May 21, 2026
e1c02bb
extract GSI number for PCI device
terryzbai May 21, 2026
ef67666
echoserver example works on QEMU
terryzbai May 28, 2026
24b0b90
drivers/network: add ixgbe driver
abrandnewusername Mar 24, 2026
11157ae
WIP: style and license fixup
terryzbai Mar 24, 2026
d33c9f0
WIP: some cleanup and fixes
terryzbai Mar 25, 2026
a23cb70
WIP: code refactor
terryzbai May 5, 2026
9535cc3
echoserver works after refactor
terryzbai May 22, 2026
4a0e96f
fix barrier operations
terryzbai May 22, 2026
2996d91
wip
terryzbai May 25, 2026
790bca9
wip: echoserver on qemu works after rebase
terryzbai May 28, 2026
ab419bc
wip: AML interpreter working on vb-105
terryzbai Jun 1, 2026
e50343f
wip: execute methods
terryzbai Jun 3, 2026
7afb272
wip: execute _PIC method
terryzbai Jun 3, 2026
3d65982
wip: extract _PRT packages
terryzbai Jun 3, 2026
65cc0c4
wip: extarct IRQ number via get_integer_data()
terryzbai Jun 4, 2026
9214dd5
wip: prt extraction cleanup
terryzbai Jun 4, 2026
82437b9
wip: more fixes on method execution
terryzbai Jun 5, 2026
249e5f4
wip: minor fix
terryzbai Jun 5, 2026
5d6910d
wip: making nodes for OpRegion and FieldNames
terryzbai Jun 9, 2026
b1e7f79
wip: parse CreateWordField
terryzbai Jun 10, 2026
283fb8b
wip: parse vb-105 tables on QEMU
terryzbai Jun 11, 2026
912c303
wip: refactor
terryzbai Jun 11, 2026
1984dfe
wip: more progress
terryzbai Jun 12, 2026
194f20a
wip: progress
terryzbai Jun 12, 2026
b9efbe2
wip: draft parse finished
terryzbai Jun 12, 2026
9e2d8cf
wip: found _PIC method
terryzbai Jun 12, 2026
7ebe372
wip
terryzbai Jun 12, 2026
cc6046a
wip: finish _PIC method eval
terryzbai Jun 13, 2026
5430cde
wip: found PCIe bus
terryzbai Jun 13, 2026
d49544c
wip: scan SSDT2
terryzbai Jun 14, 2026
d51f08a
wip: need to handle eval method inside method
terryzbai Jun 14, 2026
beecf23
wip: progress
terryzbai Jun 14, 2026
8999d36
wip: fix issues
terryzbai Jun 14, 2026
5a17d37
wip: progress
terryzbai Jun 15, 2026
cd8873c
wip: parse OpRegionOp
terryzbai Jun 15, 2026
ee447b5
wip: read real-time values from ECAM
terryzbai Jun 15, 2026
78c3406
wip: progress
terryzbai Jun 16, 2026
487895a
wip: change eval API
terryzbai Jun 16, 2026
b024461
wip: fix nested evaluation
terryzbai Jun 16, 2026
de7d688
wip: fix local variables
terryzbai Jun 16, 2026
af6e18d
wip: fix add and subtract
terryzbai Jun 17, 2026
dbc5ab7
wip: fix a bit of read_field_op
terryzbai Jun 17, 2026
a97c24f
wip: fix some ub issues
terryzbai Jun 17, 2026
4586c7d
wip: basically finish _CRS parsing
terryzbai Jun 17, 2026
3492102
wip: minor fixes
terryzbai Jun 17, 2026
39d26cf
wip: fix IF_OP
terryzbai Jun 17, 2026
25908a2
wip: evaluation returns eval_ret_t instead
terryzbai Jun 18, 2026
5a216d9
wip: use aml_data_t for data
terryzbai Jun 18, 2026
e2273cb
wip: finish buffer parsing
terryzbai Jun 19, 2026
a0588c5
wip: parse _CRS
terryzbai Jun 19, 2026
cad8ea7
wip: parse end_tag in _CRS
terryzbai Jun 19, 2026
62d467a
wip: update buffer
terryzbai Jun 19, 2026
ae6db24
wip: fix ub and prt parsing
terryzbai Jun 22, 2026
6f09a98
wip: generalise node evaluation
terryzbai Jun 23, 2026
c9f3dae
wip: return package
terryzbai Jun 23, 2026
d14f14e
wip: parse PRT packages
terryzbai Jun 23, 2026
63e7009
wip: improvement
terryzbai Jun 24, 2026
0c7c43c
wip: add files for vb105 tables
terryzbai Jun 24, 2026
1c43e85
wip: this is incomplete refactor
terryzbai Jul 7, 2026
5ade4d3
wip: refactor
terryzbai Jul 9, 2026
d40547f
wip: refactor
terryzbai Jul 9, 2026
8dc28c9
wip: fix assert
terryzbai Jul 9, 2026
f37dc40
wip: fix package parsing
terryzbai Jul 9, 2026
3d1682a
wip: finish prt package parsing
terryzbai Jul 10, 2026
8e359d7
wip: echoserver works on QEMU
terryzbai Jul 10, 2026
126f6da
wip: fix ONE_OP
terryzbai Jul 10, 2026
e4efcce
wip: fix CREATE_FIELD parsing
terryzbai Jul 10, 2026
ad0e0f4
wip: scan-mode interpreter works on hardware
terryzbai Jul 10, 2026
12922dd
wip: fix GSI parsing on hardware
terryzbai Jul 10, 2026
ece8139
wip: fix cnode_specs bookkeeping bug
terryzbai Jul 11, 2026
66fd998
wip: finished real-time field reading
terryzbai Jul 12, 2026
9a99159
wip: fix untyped passing issue
terryzbai Jul 13, 2026
0eb0104
wip: testing ixgbe driver
terryzbai Jul 13, 2026
f9d0d30
wip: fix IRQs handling for ixgbe driver
terryzbai Jul 13, 2026
1f87137
checkpoint: I/O APIC interrupts fixed
terryzbai Jul 15, 2026
07ab173
checkpoint: echoserver works on viscous
terryzbai Jul 16, 2026
b8467ab
wip: some optimisation on ixgbe driver
terryzbai Jul 16, 2026
22e2c8e
wip: test
terryzbai Jul 20, 2026
d41388c
wip: test
terryzbai Jul 20, 2026
da34378
wip: still works
terryzbai Jul 20, 2026
f7ad5ab
parsing: PRT package for PCI bridges
terryzbai Jul 20, 2026
ea76201
checkpoint: parsing PRT for PCI bridges
terryzbai Jul 21, 2026
22eca9e
docs: add docs for acpi and pcie
terryzbai Jul 22, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions benchmark/benchmark.c
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,68 @@ seL4_Bool fault(microkit_child id, microkit_msginfo msginfo, microkit_msginfo *r
break;
}
case seL4_Fault_UserException: {
sddf_printf("Registers: \n");
sddf_printf("rip : ");
sddf_printf("0x%lx", regs.rip);
sddf_printf("\n");
sddf_printf("rsp: ");
sddf_printf("0x%lx", regs.rsp);
sddf_printf("\n");
sddf_printf("rflags : ");
sddf_printf("0x%lx", regs.rflags);
sddf_printf("\n");
sddf_printf("rax : ");
sddf_printf("0x%lx", regs.rax);
sddf_printf("\n");
sddf_printf("rbx : ");
sddf_printf("0x%lx", regs.rbx);
sddf_printf("\n");
sddf_printf("rcx : ");
sddf_printf("0x%lx", regs.rcx);
sddf_printf("\n");
sddf_printf("rdx : ");
sddf_printf("0x%lx", regs.rdx);
sddf_printf("\n");
sddf_printf("rsi : ");
sddf_printf("0x%lx", regs.rsi);
sddf_printf("\n");
sddf_printf("rdi : ");
sddf_printf("0x%lx", regs.rdi);
sddf_printf("\n");
sddf_printf("rbp : ");
sddf_printf("0x%lx", regs.rbp);
sddf_printf("\n");
sddf_printf("r8 : ");
sddf_printf("0x%lx", regs.r8);
sddf_printf("\n");
sddf_printf("r9 : ");
sddf_printf("0x%lx", regs.r9);
sddf_printf("\n");
sddf_printf("r10 : ");
sddf_printf("0x%lx", regs.r10);
sddf_printf("\n");
sddf_printf("r11 : ");
sddf_printf("0x%lx", regs.r11);
sddf_printf("\n");
sddf_printf("r12 : ");
sddf_printf("0x%lx", regs.r12);
sddf_printf("\n");
sddf_printf("r13 : ");
sddf_printf("0x%lx", regs.r13);
sddf_printf("\n");
sddf_printf("r14 : ");
sddf_printf("0x%lx", regs.r14);
sddf_printf("\n");
sddf_printf("r15 : ");
sddf_printf("0x%lx", regs.r15);
sddf_printf("\n");
sddf_printf("fs_base : ");
sddf_printf("0x%lx", regs.fs_base);
sddf_printf("\n");
sddf_printf("gs_base : ");
sddf_printf("0x%lx", regs.gs_base);
sddf_printf("\n");

sddf_printf("UserException\n");
break;
}
Expand Down
80 changes: 80 additions & 0 deletions docs/acpi/acpi.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<!--
Copyright 2026, UNSW

SPDX-License-Identifier: BSD-2-Clause
-->
# sDDF ACPI Subsystem

On x86, Intel introduced the Advanced Configuration and Power Interface (ACPI)
to standardise the communication mechanism between the firmware and the host OS.
The firmware updates the platform configurations and power interface data in the
ACPI tables during the initialisation. This means the resources cannot be known
and allocated for the subsystems at build time like what is done on ARM and
RISCV.

The Root System Description Pointer (RSDP) of these tables can either be
obtained from the boot loader (in UEFI-based systems) or at fixed address (in
legacy BIOS systems). In UEFI-based systems, the RSDP and other ACPI tables can
be anywhere in the memory, and can only be known at run time.

## Dynamic ACPI tables mapping

So far, the seL4 kernel does not parse all the ACPI tables but passes RSDP as a
bootinfo block to the root task. The bootinfo pre-filling to user's memory was
partially supported by the rust capDL initialiser but not Microkit. This
[Microkit PR](https://github.com/seL4/microkit/pull/536) adds the support by
extending the pre-filling type of `MemoryRegion`.

To self-map the ACPI tables, the ACPI driver needs to receive all the remaining
untypeds from the root task. The [draft
implementation](https://github.com/seL4/rust-sel4/pull/322) is done by @syzmon,
but it is a need to make an RFC to the capDL repository.

In this typical system, the untyped capabilities flow from the capDL initialiser
to the ACPI driver, and then some of them are handed off to the PCIe driver.
The existing `cap_sharing` feature in Microkit allows a PD to access to another
PD's CSpace, but it is obviously not safe to give the unrestricted access for a
specific use case. The solution here is to add a tag `cnode` that defines a
user-managed CNode and can be mapped to one or more PDs. There are already
[some discussions](https://github.com/seL4/microkit/pull/539) on this aggressive
change, and it still needs more input from the verification team.


## AML interpreter

The ACPI tables are compiled in ACPI Machine Language (AML) and stored as byte
code in memory, so another primary functionality of ACPI driver is parsing and
extracting required configuration information from the byte code. For the
verifiability and minimality of the ACPI driver, the solution that might be
silly but necessary is to implement a simplified interpreter rather than to
integrate a third-party one.

The custom interpreter is implemented with a few simplified data structures:
- A finite state machine that manages the parsing state of current `operation`,
each `operation` having a known list of definition blocks.
- A state stack that saves the hierarchy of current parsing states.
- An object tree that connects all the parsed AML `operations`.

The ACPI driver firstly runs the interpreter on all the DSDT and SSDT tables
in `scan` mode and form a tree of AML objects. After finding the target object,
it runs the interpreter in `evaluation` mode to extract the data. The primary
reasons of doing this way are that there are some across-defined objects among
the tables, and the evaluation results depend on the `MethodOperation` execution
order and arguments.

## Dynamic resource mapping for subsystems

After the extraction, the ACPI driver places the subsystem-related resource
information in the shared memory and copies the corresponding capabilities to
the shared CNode, so the downstream subsystems can start its lifecylce with
everthing prepared. For now, we have only PCIe subsystem connected to the ACPI
driver. Other subsystems, such as timer, serial, power management, etc. should
be properly integrated on x86 as well.

## TODO List

- [ ] ACPI driver works as a [Post-initialiser](https://github.com/seL4/rfcs)
- [ ] Properly receive leftover untypeds from the capDL initialiser (RFC TBD)
- [ ] Passing IRQ routing tables to or set up IRQs for all the subsystems
- [ ] Self-map ACPI tables without untypeds for paging structures (by taking
advantages of driver image mapping)
31 changes: 31 additions & 0 deletions docs/pci/pci.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<!--
Copyright 2026, UNSW

SPDX-License-Identifier: BSD-2-Clause
-->
# sDDF PCIe Subsystem

The Enhanced Configuration Access Method (ECAM) space is the interface for
software to negotiate the PCIe-related settings, such as memory BARs and IRQs.
Giving the device drivers the access to ECAM apparently breaks the isolation
principle, as they would be able to mess things up.

The solution is to have PCIe driver as a centralised server that address all
the requests from the device drivers and set things up for them. The simplified
implementation of this mechanism is to patch the requests to the PCIe driver at
build time, so the PCIe driver can allocates and configures resources for them
once it receives the available resource window from the ACPI driver.

## Progress

The PCIe driver is currently in an experimental phase, which has proved the
feasibility of dynamically allocating and mapping IRQs and memroy for PCIe
device drivers, so the PCIe device drivers will have required resources ready
when they are scheduled.

## TODO

- [ ] Resource requests patched by metaprogram for PCIe device drivers
- [ ] Centralised MSI/MSI-X interrupt management
- [ ] Separate IRQ node for restricted access to PCIe device driver's CSpace
- [ ] Work as a post-initialiser
Loading
Loading