Skip to content

Conversation

assembler-0
Copy link
Owner

@assembler-0 assembler-0 commented Oct 11, 2025

Summary by CodeRabbit

  • Chores

    • Extra disk image now formatted as EXT2 instead of FAT16 in build outputs.
  • Bug Fixes

    • Reduced console noise by removing verbose read logs in the storage subsystem.
    • Shell: running cd with no argument no longer prints an extra status message; directory still resets to "/".

Copy link

coderabbitai bot commented Oct 11, 2025

Walkthrough

Replaced VIRT_TO_PHYS with VMemGetPhysAddr across multiple drivers (AHCI, xHCI, RTL8139, VirtioBlk) for DMA-related physical address resolution. Updated CMake to format SataDisk.img with EXT2 instead of FAT16. Removed select debug prints in AHCI and Shell. Added includes and pending request initialization in VirtioBlk.

Changes

Cohort / File(s) Summary of Changes
Address translation: VIRT_TO_PHYS → VMemGetPhysAddr
drivers/storage/AHCI.c, drivers/xHCI/xHCI.c, drivers/ethernet/realtek/RTL8139.c, drivers/virtio/VirtioBlk.c
Systematic replacement of virtual-to-physical translation to VMemGetPhysAddr(...) for DMA structures, rings, descriptors, and buffers across AHCI, xHCI, RTL8139, and VirtioBlk paths.
VirtioBlk initialization and includes
drivers/virtio/VirtioBlk.c
Added #include for BlockDevice.h and Format.h; initialized pending_reqs tracking array; continued use of new address translation for queue descriptors and request buffers.
Build image filesystem change
CMakeLists.txt
Changed second extra disk image creation from MKFS_FAT -F 16 SataDisk.img to MKFS_EXT2 SataDisk.img.
Log/print reductions
drivers/storage/AHCI.c, kernel/etc/Shell.c
Removed verbose read debug logs in AHCI; suppressed default message when cd is called without an argument in Shell while retaining directory reset behavior.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • Development #127: Introduces VMem/VMemGetPhysAddr and VM mapping changes that this PR depends on for new address translation.
  • Development #110: Touches VirtioBlk pending-request tracking; aligns with this PR’s pending_reqs initialization.
  • Development #52: Modifies VMemGetPhysAddr and identity-mapping behavior, directly impacting these translation call-site changes.

Poem

A rabbit taps the DMA lane,
Maps bytes from virtual to physical plain.
EXT2 seeds a fresher ground,
Quiet shells make softer sound.
Rings and queues aligned just right—
Carrots queued, we ship tonight! 🥕✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 46.15% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Title Check ❓ Inconclusive The title “Development” is too vague and does not convey the substantive changes introduced, which include replacing VIRT_TO_PHYS with VMemGetPhysAddr across multiple drivers, changing the filesystem type for extra-img to EXT2, and removing select debug prints. As such, it fails to inform reviewers or future readers about the primary content of the pull request. Please choose a concise, descriptive title that highlights the main change, for example “Replace VIRT_TO_PHYS with VMemGetPhysAddr in drivers and update mkfs for extra-img target.”
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch Development

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 14b8dcc and 5887d58.

📒 Files selected for processing (6)
  • CMakeLists.txt (1 hunks)
  • drivers/ethernet/realtek/RTL8139.c (1 hunks)
  • drivers/storage/AHCI.c (2 hunks)
  • drivers/virtio/VirtioBlk.c (4 hunks)
  • drivers/xHCI/xHCI.c (8 hunks)
  • kernel/etc/Shell.c (0 hunks)
💤 Files with no reviewable changes (1)
  • kernel/etc/Shell.c
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: assembler-0
PR: assembler-0/VoidFrame#93
File: kernel/memory/VMem.c:72-79
Timestamp: 2025-08-17T08:16:43.539Z
Learning: In VoidFrame kernel, VMemGetPhysAddr and related page table walking functions were causing panics because they assumed identity mapping existed for physical addresses < IDENTITY_MAP_SIZE (4GB), but the bootloader doesn't provide this 1:1 mapping. The fix is to remove all identity mapping assumptions and always use PHYS_TO_VIRT() for page table access in functions like VMemGetPageTablePhys, VMemMap, VMemMapHuge, VMemGetPhysAddr, VMemUnmap, VMemMapMMIO, and VMemUnmapMMIO.
🧬 Code graph analysis (1)
drivers/xHCI/xHCI.c (1)
mm/VMem.c (1)
  • VMemGetPhysAddr (492-520)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build
🔇 Additional comments (16)
drivers/ethernet/realtek/RTL8139.c (1)

76-76: LGTM!

Correctly replaced VIRT_TO_PHYS with VMemGetPhysAddr for DMA buffer physical address resolution, consistent with the broader PR changes.

Based on learnings

drivers/storage/AHCI.c (2)

127-129: LGTM!

Correctly replaced VIRT_TO_PHYS with VMemGetPhysAddr for command list, FIS base, and command table physical addresses. This ensures proper page table walking instead of relying on non-existent identity mapping.

Based on learnings


190-190: LGTM!

Correctly replaced VIRT_TO_PHYS with VMemGetPhysAddr for PRD (Physical Region Descriptor) base address calculation. This ensures DMA operations receive the correct physical address.

Based on learnings

drivers/virtio/VirtioBlk.c (5)

3-5: LGTM!

Added necessary includes for block device integration and formatting utilities, supporting the broader storage subsystem changes in this PR.


204-206: LGTM!

Correctly replaced VIRT_TO_PHYS with VMemGetPhysAddr for virtqueue structure physical addresses (descriptor table, driver ring, and device ring). This ensures the VirtIO device receives valid physical addresses for DMA operations.

Based on learnings


212-215: LGTM!

Properly initializes the pending_reqs array to NULL, preventing use of uninitialized memory when tracking pending VirtIO block requests.


244-254: LGTM!

Correctly replaced VIRT_TO_PHYS with VMemGetPhysAddr for all three VirtIO descriptor physical addresses in read operations (request header, data buffer, status). This ensures consistent physical address translation across the descriptor chain.

Based on learnings


312-322: LGTM!

Correctly replaced VIRT_TO_PHYS with VMemGetPhysAddr for all three VirtIO descriptor physical addresses in write operations (request header, data buffer, status). This mirrors the read path changes and maintains consistency.

Based on learnings

drivers/xHCI/xHCI.c (7)

107-110: LGTM!

Correctly replaced VIRT_TO_PHYS with VMemGetPhysAddr for command ring physical address in the link TRB setup. This ensures the xHCI controller receives a valid physical address for the circular ring structure.

Based on learnings


150-168: LGTM!

Correctly replaced VIRT_TO_PHYS with VMemGetPhysAddr for event ring and ERST (Event Ring Segment Table) physical addresses. This ensures proper xHCI event handling with valid DMA addresses for both the event ring and its segment table.

Based on learnings


191-192: LGTM!

Correctly replaced VIRT_TO_PHYS with VMemGetPhysAddr for DCBAA (Device Context Base Address Array) physical address. This ensures the xHCI controller can properly access device context structures via DMA.

Based on learnings


597-598: LGTM!

Correctly replaced VIRT_TO_PHYS with VMemGetPhysAddr for ERDP (Event Ring Dequeue Pointer) physical address during event processing. This maintains consistency with other xHCI ring management operations.

Based on learnings


647-648: LGTM!

Correctly replaced VIRT_TO_PHYS with VMemGetPhysAddr for device context physical address storage in DCBAA during device addressing. This ensures the controller can DMA to/from the device context.

Based on learnings


687-690: LGTM!

Correctly replaced VIRT_TO_PHYS with VMemGetPhysAddr for transfer ring physical address in control transfer link TRB. This ensures proper circular ring operation for endpoint transfers.

Based on learnings


704-708: LGTM!

Correctly replaced VIRT_TO_PHYS with VMemGetPhysAddr for data buffer physical address in control transfer data stage TRB. This ensures the xHCI controller can DMA to/from the correct data buffer location.

Based on learnings

CMakeLists.txt (1)

244-244: EXT2 filesystem driver confirmed

A working EXT2 driver is implemented in fs/EXT/Ext2.c and registered in fs/VFS.c; no further action needed.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@assembler-0 assembler-0 merged commit c70870f into main Oct 11, 2025
2 checks passed
This was referenced Oct 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant