Skip to content

Remove deprecated direct TLB programming mechanism #122

@joelsmithTT

Description

@joelsmithTT

Since commit 694e6c4, Luwen uses KMD's TLB allocation. The old hardcoded TLB mechanism was deprecated some code remains.

Background

With driver allocation, Luwen requests TLBs via allocate_tlb() ioctl and configures them via configure_tlb() ioctl. Direct TLB register programming and hardcoded TLB indices are no longer supported.

BAR0 maps to AXI address space. TLB windows reside within this space. Without the full BAR0 mapping, TLB windows are inaccessible via AXI methods. The pci_axi_* methods attempt to access addresses in TLB window range, which no longer works.

Cleanup Required

Remove PossibleTlbAllocation::Hardcoded:

  • Remove variant from enum in ttkmd-if/src/lib.rs
  • Remove Hardcoded match arms in: setup_tlb(), get_tlb(), noc_write(), noc_read(), write_tlb(), read_tlb()
  • Remove direct TLB register programming:
    • tlb::grayskull::setup_tlb()
    • tlb::wormhole::setup_tlb()
    • tlb::blackhole::setup_tlb()
    • tlb::setup_tlb() wrapper

Remove Python APIs exposing direct TLB programming:

  • PciGrayskull::setup_tlb(), ::set_default_tlb(), ::pci_axi_read32(), ::pci_axi_write32()
  • PciWormhole::setup_tlb(), ::set_default_tlb()
  • PciBlackhole::setup_tlb(), ::set_default_tlb()
  • Remove from pyluwen.pyi

Fix fallback logic:

  • Remove Hardcoded fallback in luwen-ref/src/lib.rs (lines 92-95)

Update examples:

  • Fix luwen-demo to use driver allocation

Address NoAllocation variant:

  • Currently only has todo!() placeholders—remove or implement

Notes

  • Most affected code is GS-specific. Consider removing GS support entirely.
  • Python code using setup_tlb(index, ...) will need to migrate to driver allocation APIs.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions