From mboxrd@z Thu Jan 1 00:00:00 1970 From: Anthony Liguori Subject: Re: [PATCH 1/1] direct mmio for passthrough - kernel part Date: Tue, 01 Apr 2008 09:42:11 -0500 Message-ID: <47F249C3.6000300@codemonkey.ws> References: <1207050734-13166-1-git-send-email-benami@il.ibm.com> <1207050734-13166-2-git-send-email-benami@il.ibm.com> <47F238D8.7040608@qumranet.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: kvm-devel@lists.sourceforge.net, allen.m.kay@intel.com, andrea@qumranet.com, benami@il.ibm.com To: Avi Kivity Return-path: In-Reply-To: <47F238D8.7040608@qumranet.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: kvm-devel-bounces@lists.sourceforge.net Errors-To: kvm-devel-bounces@lists.sourceforge.net List-Id: kvm.vger.kernel.org Avi Kivity wrote: > benami@il.ibm.com wrote: > >> From: Ben-Ami Yassour >> >> Enable a guest to access a device's memory mapped I/O regions directly. >> Userspace sends the mmio regions that the guest can access. On the first >> page fault for an access to an mmio address the host translates the gva to hpa, >> and updates the sptes. >> >> >> > > Can you explain why you're not using the regular memory slot mechanism? > i.e. have userspace mmap(/dev/mem) and create a memslot containing that > at the appropriate guest physical address? > /dev/mem is often restricted in what memory can be mapped. However, we can't add something like this to KVM that allows arbitrary HPA's to be mapped into a guest from userspace. This is just as bad as /dev/mem and is going to upset a lot of people. Regardless of whether we can use /dev/mem, I think we should introduce a new char device anyway. We only need to mmap() MMIO regions which are mapped by the PCI bus, presumably, the kernel should know about these mappings. The driver should only allow mappings that are valid for a particular PCI device such that it cannot be abused to map arbitrary regions of memory into a guest. Bonus points if it can validate that there isn't a valid Linux driver loaded for the given PCI device. Regards, Anthony Liguori > There are some issues with refcounting, but Andrea has some tricks to > deal with that. > > ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace