]> Projects (at) Tadryanom (dot) Me - AdrOS.git/commit
virtio-blk: fix V2P usage for kva_alloc addresses (H6 regression)
authorTulio A M Mendes <[email protected]>
Thu, 11 Jun 2026 01:43:33 +0000 (22:43 -0300)
committerTulio A M Mendes <[email protected]>
Thu, 11 Jun 2026 01:43:33 +0000 (22:43 -0300)
commit6f21a0ae17048c66f1fdcf50333672afa92f7ef4
tree6623011879a685f4ad0e03314191bbf0ad88e59d
parent1dbea378e97b5d2a3f2df900aa0e9c0e82403d74
virtio-blk: fix V2P usage for kva_alloc addresses (H6 regression)

Bug: virtio_blk_init used V2P() macro to convert vring virtual address
to physical address. After H6, vring_va comes from kva_alloc_pages()
which may not be in the linear mapping region. V2P assumes linear
mapping (VA = PA + 0xC0000000), which is fragile.

Fix: Replace V2P(vring_va) with vmm_virt_to_phys(vring_va) to use
the proper VMM translation function that works for any mapped virtual
address.

This fixes the regression introduced by H6 where virtio-blk relied on
coincidental overlap between kva_alloc range (0xC0500000..0xC0800000)
and the initial 16MB linear mapping (0xC0000000..0xC0100000).

Test: make test-battery PASS (157/157), make analyzer PASS
src/drivers/virtio_blk.c