Hi, In my understanding, domU''s PCI configure space access (ncluding virtual device''s and direct io''s) is always trapped and emulated by xen hypervisor. How did xen do it? Through exposing PCI configure space area to domU as non-accessible memory? Where''s the code to deal of this? Thanks! -cody
On 26 December 2011 07:02, Kai Huang <mail.kai.huang@gmail.com> wrote:> Hi, > > In my understanding, domU''s PCI configure space access (ncluding > virtual device''s and direct io''s) is always trapped and emulated by > xen hypervisor. How did xen do it? Through exposing PCI configure > space area to domU as non-accessible memory? Where''s the code to deal > of this? Thanks! >Config space access happen through the IO port cf8 and cfc. When a guest write to an io port that will cause a VMEXIT then xen will forward the io port request to qemu. cf8 and cfc are owned by the PCI BUS device model in qemu then this code will interpret the config space request and send it to the right pci device model (code qemu/i386-dm/helper2.c qemu/hw/pci.c) Jean
On Mon, Dec 26, 2011 at 4:22 PM, Jean Guyader <jean.guyader@gmail.com> wrote:> On 26 December 2011 07:02, Kai Huang <mail.kai.huang@gmail.com> wrote: >> Hi, >> >> In my understanding, domU''s PCI configure space access (ncluding >> virtual device''s and direct io''s) is always trapped and emulated by >> xen hypervisor. How did xen do it? Through exposing PCI configure >> space area to domU as non-accessible memory? Where''s the code to deal >> of this? Thanks! >> > > Config space access happen through the IO port cf8 and cfc. > When a guest write to an io port that will cause a VMEXIT then xen will > forward the io port request to qemu. cf8 and cfc are owned by the PCI > BUS device model in qemu then this code will interpret the config > space request and send it to the right pci device model (code > qemu/i386-dm/helper2.c qemu/hw/pci.c) > > JeanIO port only works for PCI device, and in real system should only be used during early boot phase. All PCIE devices must use MMIO mechanism to access configure space. Are you saying currently xen/qemu only exports PIO mechanism to domU, and does not support PCIE devices emulation/passthrough? Thanks. -cody
On 26 December 2011 09:50, Kai Huang <mail.kai.huang@gmail.com> wrote:> On Mon, Dec 26, 2011 at 4:22 PM, Jean Guyader <jean.guyader@gmail.com> wrote: >> On 26 December 2011 07:02, Kai Huang <mail.kai.huang@gmail.com> wrote: >>> Hi, >>> >>> In my understanding, domU''s PCI configure space access (ncluding >>> virtual device''s and direct io''s) is always trapped and emulated by >>> xen hypervisor. How did xen do it? Through exposing PCI configure >>> space area to domU as non-accessible memory? Where''s the code to deal >>> of this? Thanks! >>> >> >> Config space access happen through the IO port cf8 and cfc. >> When a guest write to an io port that will cause a VMEXIT then xen will >> forward the io port request to qemu. cf8 and cfc are owned by the PCI >> BUS device model in qemu then this code will interpret the config >> space request and send it to the right pci device model (code >> qemu/i386-dm/helper2.c qemu/hw/pci.c) >> >> Jean > > IO port only works for PCI device, and in real system should only be > used during early boot phase. All PCIE devices must use MMIO mechanism > to access configure space. > > Are you saying currently xen/qemu only exports PIO mechanism to domU, > and does not support PCIE devices emulation/passthrough? >xen/qemu doesn''t emulate a PCIE bus, it only has PCI support. Jean
On Mon, Dec 26, 2011 at 4:54 PM, Jean Guyader <jean.guyader@gmail.com> wrote:> On 26 December 2011 09:50, Kai Huang <mail.kai.huang@gmail.com> wrote: >> On Mon, Dec 26, 2011 at 4:22 PM, Jean Guyader <jean.guyader@gmail.com> wrote: >>> On 26 December 2011 07:02, Kai Huang <mail.kai.huang@gmail.com> wrote: >>>> Hi, >>>> >>>> In my understanding, domU''s PCI configure space access (ncluding >>>> virtual device''s and direct io''s) is always trapped and emulated by >>>> xen hypervisor. How did xen do it? Through exposing PCI configure >>>> space area to domU as non-accessible memory? Where''s the code to deal >>>> of this? Thanks! >>>> >>> >>> Config space access happen through the IO port cf8 and cfc. >>> When a guest write to an io port that will cause a VMEXIT then xen will >>> forward the io port request to qemu. cf8 and cfc are owned by the PCI >>> BUS device model in qemu then this code will interpret the config >>> space request and send it to the right pci device model (code >>> qemu/i386-dm/helper2.c qemu/hw/pci.c) >>> >>> Jean >> >> IO port only works for PCI device, and in real system should only be >> used during early boot phase. All PCIE devices must use MMIO mechanism >> to access configure space. >> >> Are you saying currently xen/qemu only exports PIO mechanism to domU, >> and does not support PCIE devices emulation/passthrough? >> > > xen/qemu doesn''t emulate a PCIE bus, it only has PCI support. > > JeanOh. Is there any plan, or code branch we are working on to support PCIE bus in xen/qemu now? -cody
On 26 December 2011 10:06, Kai Huang <mail.kai.huang@gmail.com> wrote:> On Mon, Dec 26, 2011 at 4:54 PM, Jean Guyader <jean.guyader@gmail.com> wrote: >> On 26 December 2011 09:50, Kai Huang <mail.kai.huang@gmail.com> wrote: >>> On Mon, Dec 26, 2011 at 4:22 PM, Jean Guyader <jean.guyader@gmail.com> wrote: >>>> On 26 December 2011 07:02, Kai Huang <mail.kai.huang@gmail.com> wrote: >>>>> Hi, >>>>> >>>>> In my understanding, domU''s PCI configure space access (ncluding >>>>> virtual device''s and direct io''s) is always trapped and emulated by >>>>> xen hypervisor. How did xen do it? Through exposing PCI configure >>>>> space area to domU as non-accessible memory? Where''s the code to deal >>>>> of this? Thanks! >>>>> >>>> >>>> Config space access happen through the IO port cf8 and cfc. >>>> When a guest write to an io port that will cause a VMEXIT then xen will >>>> forward the io port request to qemu. cf8 and cfc are owned by the PCI >>>> BUS device model in qemu then this code will interpret the config >>>> space request and send it to the right pci device model (code >>>> qemu/i386-dm/helper2.c qemu/hw/pci.c) >>>> >>>> Jean >>> >>> IO port only works for PCI device, and in real system should only be >>> used during early boot phase. All PCIE devices must use MMIO mechanism >>> to access configure space. >>> >>> Are you saying currently xen/qemu only exports PIO mechanism to domU, >>> and does not support PCIE devices emulation/passthrough? >>> >> >> xen/qemu doesn''t emulate a PCIE bus, it only has PCI support. >> >> Jean > > Oh. Is there any plan, or code branch we are working on to support > PCIE bus in xen/qemu now? >Someone can correct me if I''m wrong but I don''t think qemu upstream has pcie support yet. When qemu upstream will have pcie support we will get it for free. Jean
On 26 December 2011 06:02, Kai Huang <mail.kai.huang@gmail.com> wrote:> Hi, > > In my understanding, domU''s PCI configure space access (ncluding > virtual device''s and direct io''s) is always trapped and emulated by > xen hypervisor. How did xen do it? Through exposing PCI configure > space area to domU as non-accessible memory? Where''s the code to deal > of this? Thanks!For PV domU an alternative access method for accessing the PCI config space is used in the kernel. The code for this is in drivers/pci/xen-pcifront.c in recent linux kernels. The dom0 backend code is in drivers/xen/xen-pciback/* Rolf> > -cody > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xensource.com > http://lists.xensource.com/xen-devel