Commit 3f0a9db
committed
vxdna: Add contiguous heap VA and error handling for QEMU vxdna
Add expandable device heap support in vxdna (QEMU virtio-accel backend)
with contiguous virtual address management and robust error handling.
Heap VA management:
- Reserve a contiguous HEAP_MAX_SIZE (512MB) VA range with PROT_NONE
on first DEV_HEAP BO creation. Use MAP_FIXED to place each expansion
chunk at m_heap_base + m_heap_cur_offset, ensuring the guest kernel
sees a contiguous UVA space matching its expectations.
- Track heap state with m_heap_destroyed flag: once any DEV_HEAP BO is
destroyed, the contiguous VA invariant is broken so all further
DEV/DEV_HEAP allocations are rejected with -EINVAL.
- Add bounds check: reject expansion if m_heap_cur_offset + size
exceeds HEAP_MAX_SIZE with -ENOSPC.
- Move m_heap_cur_offset update after add_bo() and response write to
avoid permanently wasting VA budget on failed operations.
Error handling:
- vxdna_ccmd_error_wrap: Remove exception re-throwing after catch.
Re-throwing caused QEMU to send 0x1200 error responses and skip
fence signaling, hanging the guest indefinitely on sync_wait.
Now errors are logged and written to the response buffer only.
- write_err_rsp: Log and return instead of throwing when resp resource
is missing, preventing exceptions from escaping the error wrapper.
- vxdna_bo constructor: Add mmap_target parameter to support MAP_FIXED
placement. Add get_type() accessor for BO type queries.
Cleanup:
- Clean up reserved VA range in vxdna_context destructor.
- Update Doxygen for vxdna_ccmd_error_wrap to reflect non-re-throwing
behavior.
Signed-off-by: Wendy Liang <wendy.liang@amd.com>1 parent 5be2b21 commit 3f0a9db
2 files changed
+86
-33
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
74 | | - | |
| 74 | + | |
| 75 | + | |
75 | 76 | | |
76 | 77 | | |
77 | 78 | | |
| |||
90 | 91 | | |
91 | 92 | | |
92 | 93 | | |
93 | | - | |
| 94 | + | |
| 95 | + | |
94 | 96 | | |
95 | 97 | | |
96 | 98 | | |
| |||
171 | 173 | | |
172 | 174 | | |
173 | 175 | | |
174 | | - | |
175 | 176 | | |
176 | 177 | | |
177 | 178 | | |
178 | | - | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
179 | 183 | | |
180 | 184 | | |
181 | 185 | | |
182 | | - | |
183 | | - | |
| 186 | + | |
184 | 187 | | |
185 | | - | |
186 | 188 | | |
187 | 189 | | |
188 | 190 | | |
| |||
198 | 200 | | |
199 | 201 | | |
200 | 202 | | |
201 | | - | |
202 | | - | |
| 203 | + | |
203 | 204 | | |
204 | | - | |
205 | 205 | | |
206 | 206 | | |
207 | 207 | | |
208 | 208 | | |
209 | 209 | | |
210 | 210 | | |
211 | | - | |
| 211 | + | |
212 | 212 | | |
213 | | - | |
| 213 | + | |
214 | 214 | | |
215 | 215 | | |
216 | | - | |
| 216 | + | |
| 217 | + | |
217 | 218 | | |
218 | 219 | | |
219 | 220 | | |
| |||
420 | 421 | | |
421 | 422 | | |
422 | 423 | | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
423 | 428 | | |
424 | 429 | | |
425 | 430 | | |
426 | 431 | | |
427 | 432 | | |
428 | | - | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
429 | 457 | | |
430 | 458 | | |
431 | 459 | | |
| |||
440 | 468 | | |
441 | 469 | | |
442 | 470 | | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
443 | 474 | | |
444 | 475 | | |
445 | 476 | | |
| |||
454 | 485 | | |
455 | 486 | | |
456 | 487 | | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
457 | 491 | | |
458 | 492 | | |
459 | 493 | | |
| |||
674 | 708 | | |
675 | 709 | | |
676 | 710 | | |
677 | | - | |
678 | | - | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
679 | 716 | | |
680 | 717 | | |
681 | 718 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
| 27 | + | |
26 | 28 | | |
27 | 29 | | |
28 | 30 | | |
| |||
50 | 52 | | |
51 | 53 | | |
52 | 54 | | |
53 | | - | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
54 | 58 | | |
55 | 59 | | |
56 | 60 | | |
| |||
100 | 104 | | |
101 | 105 | | |
102 | 106 | | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
103 | 116 | | |
104 | 117 | | |
105 | 118 | | |
| |||
156 | 169 | | |
157 | 170 | | |
158 | 171 | | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
159 | 175 | | |
160 | 176 | | |
161 | 177 | | |
| |||
493 | 509 | | |
494 | 510 | | |
495 | 511 | | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
496 | 517 | | |
497 | 518 | | |
498 | 519 | | |
| |||
711 | 732 | | |
712 | 733 | | |
713 | 734 | | |
714 | | - | |
715 | | - | |
716 | | - | |
717 | | - | |
718 | | - | |
719 | | - | |
720 | | - | |
721 | | - | |
722 | | - | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
723 | 740 | | |
724 | 741 | | |
725 | | - | |
726 | | - | |
727 | | - | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
728 | 745 | | |
729 | 746 | | |
730 | 747 | | |
731 | 748 | | |
732 | 749 | | |
733 | | - | |
734 | 750 | | |
735 | 751 | | |
736 | 752 | | |
737 | 753 | | |
738 | 754 | | |
739 | 755 | | |
740 | 756 | | |
| 757 | + | |
741 | 758 | | |
742 | | - | |
743 | 759 | | |
| 760 | + | |
744 | 761 | | |
745 | | - | |
746 | 762 | | |
| 763 | + | |
747 | 764 | | |
748 | | - | |
749 | 765 | | |
750 | 766 | | |
751 | 767 | | |
| |||
0 commit comments