Skip to content

Commit 9f9597d

Browse files
Merge pull request #159 from tenstorrent-riscv-software/asrinivasan/4gtlb_warning
console: Print error about missing 4G TLBs in virtiodevice.cpp instead
2 parents 3bbc891 + fa0cb5f commit 9f9597d

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

‎console/l2cpu.cpp‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,7 @@ L2CPU::L2CPU(int idx, int card_idx)
6969
first = std::make_unique<TlbWindow4G>(fd, coordinates.x, coordinates.y, 0x4000'0000'0000ULL, memory, true);
7070
second = std::make_unique<TlbWindow4G>(fd, coordinates.x, coordinates.y, 0x4001'0000'0000ULL, memory+(1ULL<<32), true);
7171
} catch (const std::exception &e) {
72-
std::cerr << "Warning: could not allocate first/second TLB windows for L2CPU " << idx
73-
<< ": " << e.what() << "\nContinuing without them. Virtio functionality won't work." << std::endl;
74-
72+
// Virtio code errors out later via get_memory_ptr() == nullptr
7573
// Unwind anything that did succeed
7674
second.reset();
7775
first.reset();

‎console/virtiodevice.hpp‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,11 @@ class VirtioDevice {
109109
mmio_base = reinterpret_cast<uint8_t*>(window->get_window());
110110

111111
memory = l2cpu.get_memory_ptr();
112+
if (memory == nullptr) {
113+
fprintf(stderr, "Error: L2CPU 4G TLB windows unavailable (get_memory_ptr returned null).\n"
114+
"Virtio cannot run without DRAM access; check TLB allocation (dmesg) and TLB availability after reset.\n");
115+
exit(1);
116+
}
112117

113118
// TODO: Check if (interrupt_number-5) is in valid
114119
// range, and adjust which register to use accordingly

0 commit comments

Comments
 (0)