Re: qemu/hw/device-assignment: questions about msix_table_page

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, May 05, 2009 at 02:45:38PM +0300, Michael S. Tsirkin wrote:
> On Tue, May 05, 2009 at 07:49:10AM -0300, Marcelo Tosatti wrote:
> > On Tue, May 05, 2009 at 01:34:50PM +0300, Michael S. Tsirkin wrote:
> > > On Tue, May 05, 2009 at 07:19:45AM -0300, Marcelo Tosatti wrote:
> > > > On Tue, May 05, 2009 at 12:51:36PM +0300, Michael S. Tsirkin wrote:
> > > > > On Mon, Apr 27, 2009 at 10:30:17PM +0800, Sheng Yang wrote:
> > > > > > > > > > If guest can write to the real device MSI-X table directly, it would
> > > > > > > > > > cause chaos on interrupt delivery, for what guest see is totally
> > > > > > > > > > different with what's host see...
> > > > > > > > >
> > > > > > > > > Obviously.
> > > > > > > > >
> > > > > > > > > Thanks,
> > > > > > 
> > > > > 
> > > > > What's the reason that this page is unmapped from the qemu memory space?
> > > > > Specifically what do these lines do:
> > > > >             int offset = r_dev->msix_table_addr - real_region->base_addr;
> > > > >             ret = munmap(region->u.r_virtbase + offset, TARGET_PAGE_SIZE);
> > > > 
> > > > I believe this allows accesses to this page (the MSI-X table), which
> > > > is part of the guest address space (through kvm memory slots), to be
> > > > trapped by qemu.
> > > > 
> > > > Since there is no actual page in this guest address, KVM treats accesses
> > > > as MMIO and forwards them to QEMU.
> > > > 
> > > > 
> > > 
> > > I thought about this too.
> > > But why is this necessary for assigned MSI-X but not for emulated devices such as
> > > e.g. e1000? All e1000 does seems to be cpu_register_physical_memory ...
> > 
> > Because there is no registered (kvm) memory slot for the range which
> > e1000 registers its MMIO?
> 
>         ret = kvm_register_phys_mem(kvm_context, e_phys,
>                                     region->u.r_virtbase,
>                                     TARGET_PAGE_ALIGN(e_size), 0);
> is what creates this slot, correct?

Yes, think so. Now I remember: you map the assigned PCI device memory 
to the guest, but need to intercept only the MSI-X table.

> 
> > Not sure about the address of the MSI-X table
> > page, but you could achieve the same effect by splitting the slot which
> > it lives in two, with a 1 page hole between them.
> > 
> > BTW this is why you can't map the MSI-X table page directly, you want
> > accesses to be trapped.
> 
> -- 
> MST
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux