questions about pci
Hi all:
I read pci code in qemu about i440fx, pci.c and so on. I think if guest os whose mainboard is based on x86, it will use IO instructions to access PCI configuration space.If not use passthrough, qemu should emulate these operations.I find a function called kvm_handle_io who will emulate ioport write/read, I have traced this function, but I haven't found it has any relationship with pci read/write configuration space functions like i440fx_write_config and piix3_write_config.So how does it emulate pci configuration space access when not use passthrough?
thanks
Wanpeng Li
LTC China, IBM
Quoted 4 lines
I read pci code in qemu about i440fx,
pci.cand so on. I think if guest os whose mainboard is based on x86, it will use IO instructions to access PCI configuration space.If not use passthrough, qemu should emulate these operations.I find a function calledkvm_handle_iowho will
^^^^^^^^^^^^^
Looks suspicious. Prefix kvm mean passthrough, I guess.
Quoted 4 lines
emulate ioport write/read, I have traced this function, but I haven't found it has any relationship with pci read/write configuration space functions like
i440fx_write_configand piix3_write_config.So how does it emulate pci configuration space access when not use passthrough?
grep -r i440fx_write_config * show you that you should take a look onhw/piix_pci.c. Besides, setting breakpoint at i440fx_write_config also show you how it get called.
HTH,
chenwj
Signature · 5 lines
Wei-Ren Chen (陳韋任) Computer Systems Lab, Institute of Information Science, Academia Sinica, Taiwan (R.O.C.) Tel:886-2-2788-3799 #1667 Homepage: http://people.cs.nctu.edu.tw/~chenwj
CC'ed to the list.
Quoted 11 lines · WanPeng Li
Quoted 7 lines · 陳韋任
Quoted 4 lines
I read pci code in qemu about i440fx,
pci.cand so on. I think if guest os whose mainboard is based on x86, it will use IO instructions to access PCI configuration space.If not use passthrough, qemu should emulate these operations.I find a function calledkvm_handle_iowho will^^^^^^^^^^^^^Looks suspicious. Prefix kvm mean passthrough, I guess.
If want to use passthrough, you should add additional options, but I'am not. so not use passthrough here.
Are you sure you are running into kvm_handle_io while booting a guest OS
by using QEMU? I set a breakpoint at kvm_handle_io but never stopping at it. Or you're using KVM?
Quoted 8 lines
I think you know something about PCI, so I need your help to confirm some details.In phyical machine based on x86 platform, for example, during the process of kernel traverse pci devices, it needs to write pci configuration space, this influnce will reach the configuration space by two registers(0xcf8,0xcfc).In Qemu
0xcf8and0xcfcbind to some methods(read/write) of PHB.So every IO instructions(in/out) in guest os who intend to write pci configuration space should capture by kvm then pass to qemu to emulate(if not use passthrough).In guest os IO
O.K., from here I am pretty sure you are talking about KVM which uses
QEMU to emulate devices. I am not familiar in this part, so ...
Quoted 5 lines
instructions just read/write
0xcf8,0xcfc, then pci will parse the address and forward to right device.In qemu it should first through PHB who binds methods and 0xcf8/0xcfc,then parse the address by the code itself.right? So every pci read/write configuration space should through PHB read/write methods first.
Regards,
chenwj
Signature · 5 lines
Wei-Ren Chen (陳韋任) Computer Systems Lab, Institute of Information Science, Academia Sinica, Taiwan (R.O.C.) Tel:886-2-2788-3799 #1667 Homepage: http://people.cs.nctu.edu.tw/~chenwj