Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QEMU 7.2.1 unable to find dtb #100

Open
ghost opened this issue Apr 18, 2023 · 9 comments
Open

QEMU 7.2.1 unable to find dtb #100

ghost opened this issue Apr 18, 2023 · 9 comments

Comments

@ghost
Copy link

ghost commented Apr 18, 2023

latest memflow
QEMU 7.2.1
Windows 10 22H2 (OS Build 19045.2787)
[archlinux memflow-qemu]# qemu-system-x86_64 --version
QEMU emulator version 7.2.1
Copyright (c) 2003-2022 Fabrice Bellard and the QEMU Project developers
[archlinux memflow-qemu]# cargo run --all-features --example ps_win32 --release
    Finished release [optimized] target(s) in 0.07s
     Running `/opt/memflow-qemu/./runner.sh target/release/examples/ps_win32`
11:54:05 [INFO] qemu process with name qemu-system-x86_64 found with pid 56930
11:54:05 [INFO] qemu memory map found CTup2(7f8358000000, 34359738368)
11:54:05 [INFO] connecting to qmp tcp socket at: 127.0.0.1:6448
11:54:05 [INFO] qemu machine mem_map: MemoryMapping: base=0 size=30000 real_base=7f8358000000
MemoryMapping: base=50000 size=70000 real_base=7f8358050000
MemoryMapping: base=100000 size=7ef00000 real_base=7f8358100000
MemoryMapping: base=100000000 size=780000000 real_base=7f83d8000000
11:54:05 [WARN] oslayer: not found (unable to find x64 dtb in lowstub < 1M)
11:54:05 [WARN] x64::find_lowstub() error: oslayer: not found
11:54:05 [WARN] oslayer: not found (unable to find x64 dtb in lowstub < 16M)
11:54:05 [WARN] oslayer: not found (unable to find x86_pae dtb in lowstub < 16M)
11:54:05 [WARN] oslayer: not found (unable to find x86 dtb in lowstub < 16M)
11:54:05 [WARN] oslayer: not found (unable to find aarch64 dtb in lowstub < 16M)
11:54:05 [ERROR] oslayer: not found (unable to find dtb)
thread 'main' panicked at 'unable to create win32 instance with qemu connector: Error(OsLayer, NotFound)', examples/ps_win32.rs:44:10
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
<domain type='kvm' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
  <name>default</name>
  <uuid>6e6f5377-0f40-4131-b5c6-c58d5c91e64c</uuid>
  <memory unit='KiB'>33554432</memory>
  <currentMemory unit='KiB'>33554432</currentMemory>
  <memoryBacking>
    <hugepages/>
  </memoryBacking>
  <vcpu placement='static'>20</vcpu>
  <iothreads>1</iothreads>
  <os firmware='efi'>
    <type arch='x86_64' machine='pc-q35-7.2'>hvm</type>
    <firmware>
      <feature enabled='no' name='enrolled-keys'/>
      <feature enabled='yes' name='secure-boot'/>
    </firmware>
    <loader readonly='yes' secure='yes' type='pflash'>/usr/share/edk2/x64/OVMF_CODE.secboot.4m.fd</loader>
    <nvram template='/usr/share/edk2/x64/OVMF_VARS.4m.fd'>/var/lib/libvirt/qemu/nvram/default.fd</nvram>
    <boot dev='hd'/>
  </os>
  ...
  <devices>
    <emulator>/usr/bin/qemu-system-x86_64</emulator>
    ...
  </devices>
  ...
  <qemu:commandline>
    <qemu:arg value='-qmp'/>
    <qemu:arg value='tcp:127.0.0.1:6448,server,nowait'/>
    <qemu:arg value='-fw_cfg'/>
    <qemu:arg value='opt/ovmf/X-PciMmio64Mb,string=65536'/>
  </qemu:commandline>
</domain>
@ghost
Copy link
Author

ghost commented Apr 18, 2023

[archlinux memflow-qemu]# cargo run --all-features --example read_phys --release 
    Finished release [optimized] target(s) in 0.07s
     Running `/opt/memflow-qemu/./runner.sh target/release/examples/read_phys`
12:08:49 [INFO] qemu process with name qemu-system-x86_64 found with pid 56930
12:08:49 [INFO] qemu memory map found CTup2(7f8358000000, 34359738368)
12:08:49 [INFO] connecting to qmp tcp socket at: 127.0.0.1:6448
12:08:49 [INFO] qemu machine mem_map: MemoryMapping: base=0 size=30000 real_base=7f8358000000
MemoryMapping: base=50000 size=70000 real_base=7f8358050000
MemoryMapping: base=100000 size=7ef00000 real_base=7f8358100000
MemoryMapping: base=100000000 size=780000000 real_base=7f83d8000000
12:08:49 [INFO] Received metadata: PhysicalMemoryMetadata { max_address: 87fffffff, real_size: 34342567936, readonly: false, ideal_batch_size: 4096 }
thread 'main' panicked at 'unable to read physical memory: partial virtual read', examples/read_phys.rs:31:10
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

@ko1N
Copy link
Member

ko1N commented Apr 18, 2023

Hey! Thanks for the issue. It's hard to tell but it could be that you're using resizable bar, which is currently an issue for memflow-qemu. Sadly i dont have any newer GPU to further debug/fix this with at the moment. Can you try either disabling resizable bar or try memflow-kvm as an alternative?

@ghost
Copy link
Author

ghost commented Apr 19, 2023

I don't think it's a problem with Resizable BAR. QEMU 6.x - QEMU 7.1 all worked fine until QEMU 7.2.1 I had this problem

But yeah, I will try to turn off Resizable BAR and test

@ghost
Copy link
Author

ghost commented Apr 19, 2023

I tried memflow-kvm before, but it would randomly crash my VM, so I gave up using it

@ghost
Copy link
Author

ghost commented Apr 19, 2023

Everything worked fine after I turned off Resizable BAR

@RageCarry
Copy link

I have the same issue, but my Resizable BAR was never enabled, I've checked in nvidia profile inspector to confirm that it is disabled.
Only work If I completely remove GPU pci passthrough from VM, any advise ?

@h33p
Copy link
Member

h33p commented Feb 7, 2024

I have the same issue, but my Resizable BAR was never enabled, I've checked in nvidia profile inspector to confirm that it is disabled. Only work If I completely remove GPU pci passthrough from VM, any advise ?

If your VM is libvirt based, would be nice if you could copy and paste the output of the following command:

sudo virsh qemu-monitor-command win10 --hmp 'info mtree -f' | grep pc.ram

Replace win10 with your VM name. Here's an example what the output should roughly look like:

  0000000000000000-000000000009ffff (prio 0, ram): pc.ram KVM
  0000000000100000-000000007fffffff (prio 0, ram): pc.ram @0000000000100000 KVM
  0000000100000000-000000067fffffff (prio 0, ram): pc.ram @0000000080000000 KVM
  0000000000000000-000000000009ffff (prio 0, ram): pc.ram KVM
  0000000000100000-000000007fffffff (prio 0, ram): pc.ram @0000000000100000 KVM
  0000000100000000-000000067fffffff (prio 0, ram): pc.ram @0000000080000000 KVM

@h33p
Copy link
Member

h33p commented Feb 7, 2024

A workaround would be to use memflow-kvm, which does not guess memory mappings.

@RageCarry
Copy link

I'm very sorry for the delayed reply
I didn't have access to a PC. I've re-checked, C.A.M (Clever Access Memory) was enabled, which stands for Resizable BAR, in the host BIOS. Changed to disabled, solved it, If you still need the output of the command, please let me know, and I will provide it

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

No branches or pull requests

3 participants