Re: pci passhthrough device's pci mem cannot mapped

2023-11-04 Thread Jiatong Shen
thank you very much for the reply.

in the end, I believe it is `object_property_set_bool(OBJECT(cpu),
"host-phys-bits", true, _abort);` in target/i386/host-cpu.c does the
trick.. I can make
the passthrough device work if I specify `-cpu max,host-phys-bits=true` in
qemu 4.2.0.

Thank you very much for the help.

Best Regards,
Jiatong Shen

On Tue, Oct 31, 2023 at 6:58 PM Peter Maydell 
wrote:

> On Tue, 31 Oct 2023 at 06:51, Jiatong Shen  wrote:
> >
> > Hello community experts,
> >
> >   I am using a 4.2.0 versioned qemu and passthrough an A40 (48G GPU
> memory). When I start the virtual machine with following option "-m
> size=4096M,slots=2,maxmem=1T ", the virtual machine could boot but the in
> the VM I saw lspci failed to find bar1 and kernel message attached in the
> end of the mail.
>
> > I tried 6.2.0 with the same options and it works without problem. So my
> question what might cause the problem and why. Thank you very much for help.
>
> (I assume when you say "a 4.2.0 versioned qemu" you mean that
> you're using version 4.2 of QEMU, not that you're using a
> 4.2-versioned machine type with a newer version of the QEMU
> binary, given the command line that you say you're using.)
>
> For problems of the form "this didn't work in QEMU version X,
> but it does work in newer QEMU Y", the obvious guess is
> "this was a bug, and we fixed it in the later version".
> So if the newer version works for you I would recommend using
> it -- 4.2 is now very old, and it's unlikely anybody will
> be particularly interested in doing the work to try to figure
> out what was going on in such an old version of QEMU, unless
> you have a support contract with them...
>
> thanks
> -- PMM
>


-- 

Best Regards,

Jiatong Shen


Re: pci passhthrough device's pci mem cannot mapped

2023-10-31 Thread Peter Maydell
On Tue, 31 Oct 2023 at 06:51, Jiatong Shen  wrote:
>
> Hello community experts,
>
>   I am using a 4.2.0 versioned qemu and passthrough an A40 (48G GPU memory). 
> When I start the virtual machine with following option "-m 
> size=4096M,slots=2,maxmem=1T ", the virtual machine could boot but the in the 
> VM I saw lspci failed to find bar1 and kernel message attached in the end of 
> the mail.

> I tried 6.2.0 with the same options and it works without problem. So my 
> question what might cause the problem and why. Thank you very much for help.

(I assume when you say "a 4.2.0 versioned qemu" you mean that
you're using version 4.2 of QEMU, not that you're using a
4.2-versioned machine type with a newer version of the QEMU
binary, given the command line that you say you're using.)

For problems of the form "this didn't work in QEMU version X,
but it does work in newer QEMU Y", the obvious guess is
"this was a bug, and we fixed it in the later version".
So if the newer version works for you I would recommend using
it -- 4.2 is now very old, and it's unlikely anybody will
be particularly interested in doing the work to try to figure
out what was going on in such an old version of QEMU, unless
you have a support contract with them...

thanks
-- PMM



pci passhthrough device's pci mem cannot mapped

2023-10-31 Thread Jiatong Shen
Hello community experts,

  I am using a 4.2.0 versioned qemu and passthrough an A40 (48G GPU
memory). When I start the virtual machine with following option "-m
size=4096M,slots=2,maxmem=1T ", the virtual machine could boot but the in
the VM I saw lspci failed to find bar1 and kernel message attached in the
end of the mail.

root@a40-test:~# lspci -s 00:08.0 -vvv

00:08.0 3D controller: NVIDIA Corporation Device 2235 (rev a1)

Subsystem: NVIDIA Corporation Device 145a

Physical Slot: 8

Control: I/O+ Mem+ BusMaster- SpecCycle- MemWINV- VGASnoop- ParErr+
Stepping- SERR+ FastB2B- DisINTx-

Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- SERR-  (64-bit, prefetchable)

Region 3: Memory at c000 (64-bit, prefetchable) [size=32M]


I tried 6.2.0 with the same options and it works without problem. So my
question what might cause the problem and why. Thank you very much for help.





-- 

Best Regards,

Jiatong Shen

kernel message:

[mem 0xc000-0xfeffbfff] available for PCI devices

[Thu Oct 26 15:16:42 2023] pci :00:03.0: [10de:2235] type 00 class
0x030200

[Thu Oct 26 15:16:42 2023] pci :00:03.0: reg 0x10: [mem
0xfb00-0xfbff]

[Thu Oct 26 15:16:42 2023] pci :00:03.0: reg 0x14: [mem
0x110-0x11f 64bit pref]

[Thu Oct 26 15:16:42 2023] pci :00:03.0: reg 0x1c: [mem
0x120-0x12001ff 64bit pref]

[Thu Oct 26 15:16:42 2023] pci :00:03.0: Enabling HDA controller

[Thu Oct 26 15:16:42 2023] pci :00:03.0: PME# supported from D0 D3hot

[Thu Oct 26 15:16:42 2023] pci :00:03.0: 32.000 Gb/s available PCIe
bandwidth, limited by 2.5 GT/s x16 link at :00:03.0 (capable of 252.048
Gb/s with 16 GT/s x16 link)

[Thu Oct 26 15:16:42 2023] pci :00:03.0: can't claim BAR 1 [mem
0x110-0x11f 64bit pref]: no compatible bridge window

[Thu Oct 26 15:16:42 2023] pci :00:03.0: can't claim BAR 3 [mem
0x120-0x12001ff 64bit pref]: no compatible bridge window

[Thu Oct 26 15:16:42 2023] pci :00:03.0: BAR 1: no space for [mem size
0x10 64bit pref]

[Thu Oct 26 15:16:42 2023] pci :00:03.0: BAR 1: trying firmware
assignment [mem 0x110-0x11f 64bit pref]

[Thu Oct 26 15:16:42 2023] pci :00:03.0: BAR 1: [mem
0x110-0x11f 64bit pref] conflicts with PCI mem [mem
0x-0xff]

[Thu Oct 26 15:16:42 2023] pci :00:03.0: BAR 1: failed to assign [mem
size 0x10 64bit pref]

[Thu Oct 26 15:16:42 2023] pci :00:03.0: BAR 3: assigned [mem
0xc000-0xc1ff 64bit pref]

NVRM: BAR1 is 0M @ 0x0 (PCI::00:03.0)

[Thu Oct 26 15:16:46 2023] nvidia: probe of :00:03.0 failed with error
-1

NVRM: BAR1 is 0M @ 0x0 (PCI::00:03.0)

[Thu Oct 26 15:16:47 2023] nvidia: probe of :00:03.0 failed with error
-1


My command looks like ,


qemu-system-x86_64 -cpu host -smp 2 -m 4096 \

-enable-kvm -device vfio-pci,host=:4b:00.0 \

-drive file=test,if=virtio,format=raw \

-netdev user,id=net0,hostfwd=tcp::12-:22 \

-device virtio-net-pci,netdev=net0 \

-vnc 0.0.0.0:70