Hi, any one help? I have puzzled by the question of device''s MMIO areas. I know a MMIO operation of guest os handled by VMM as follow steps: 1: Qemu-dm does its initialization and presents virtual devices for guest os. 2: virtual bios executes PCI_setup, it will scan the pci bus and get configure space of all devices,then virtual bios allocation system resources(like port I/O range,MMIO range, interrupt) for device. 3: I think in this step vmm will get all mmio range that in step 2, then vmm will set ept entry which can cause ept violation when guest os attemp to access corresponding MMIO ares. 4: In ept violation exit, vmm will pass mmio operation to qemu-dm. 5: Qemu-dm do mmio operation with its callback functions, if qemu-dm could not find (or register) callback function for some MMIO ares(for example, in DMA write process ,the targe physical address is not stationary but determined by guest os''s driver,then when qemu-dm find no callback for DMA target address, it will pass the content of write operation to vmm by default, vmm then pass the result into the space of guest os). what I want to know is step2 and step5: In step2, how does vmm get all mmio areas of devices? and how vmm set ept entry with these mmio areas ? In setp5, is it ture for DMA operatin I described? and when qemu-dm find no callback function for some MMIO area, what it will do? Thanks for your help. -- View this message in context: http://xen.1045712.n5.nabble.com/How-does-vmm-get-all-mmio-areas-of-pci-devices-tp5037367p5037367.html Sent from the Xen - Dev mailing list archive at Nabble.com.
On Thu, Dec 1, 2011 at 2:08 AM, confucius <henanwxr@hotmail.com> wrote:> what I want to know is step2 and step5: > In step2, how does vmm get all mmio areas of devices? and how vmm set ept > entry with these mmio areas ?At the moment, Xen will send all accesses to guest physical addresses it doesn''t recognize to qemu. There is a general plan to have qemu register these areas with Xen before starting the guest, but that''s not being actively worked on at the moment, AFAIK.> In setp5, is it ture for DMA operatin I described? and when qemu-dm find no > callback function for some MMIO area, what it will do?I don''t understand your thing about DMA. DMA is emulated by QEMU; but it''s not done to MMIO regions, but to memory regions. A guest driver shouldn''t request a DMA to a region of the physical address space that isn''t backed by RAM; if it tries to, the request will fail in QEMU. (Not sure exactly what will happen.) In any case, if qemu gets an MMIO request from the guest on an area of physical memory where it doesn''t have any devices, it will just pass the request back to Xen without doing anything. I believe this typically this will results in writes doing nothing and reads getting 0. -George
Thanks for your reply,George. Now I am trying to understand what you have explained. 1: vmm doesn''t consider where the mmio area of device placed, so it needn''t to set ept entry for capturing mmio operation of guest os. Instead, vmm only considers(or register) the memory areas where it can access directly,and set corresponding ept entry. when vmm found some memory areas it can''t access(maybe the mmio area), it will send these areas to qemu-dm.qemu-dm will process these. Am I right? 2: I am not very clear how virtual DMA operate between vmm and qemu-dm. Because the target physical address of DMA operation is not fixed like other MMIO areas(for example ,vga buffer placed 0xA0000~0xC0000),it was specified by the driver, so qemu-dm can''t register callback function for these target physical like other MMIO areas. when virtual DMA write memory in qemu address space, what will happend? just do nothing, if so, how does virtual DMA transfer result of writing to vmm (or guest os)? 3: I want to konw whether exist MMIO areas that can''t recognised by qemu-dm, and how qemu-dm process it? -- View this message in context: http://xen.1045712.n5.nabble.com/How-does-vmm-get-all-mmio-areas-of-pci-devices-tp5037367p5042107.html Sent from the Xen - Dev mailing list archive at Nabble.com.