From mboxrd@z Thu Jan 1 00:00:00 1970 From: Scott Wood Subject: Re: RFC: vfio interface for platform devices Date: Wed, 3 Jul 2013 13:51:50 -0500 Message-ID: <1372877510.8183.141@snotra> References: <9001E680-3DF3-4B9A-97B9-D4B3DEFAB97C@suse.de> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; delsp=Yes; format=Flowed Content-Transfer-Encoding: 8BIT Cc: Yoder Stuart-B08248 , Alex Williamson , Wood Scott-B07421 , Bhushan Bharat-R65777 , Sethi Varun-B16395 , "virtualization@lists.linux-foundation.org" , Antonios Motakis , "kvm@vger.kernel.org list" , "kvm-ppc@vger.kernel.org" , "kvmarm@lists.cs.columbia.edu" To: Alexander Graf Return-path: Received: from tx2ehsobe005.messaging.microsoft.com ([65.55.88.15]:19250 "EHLO tx2outboundpool.messaging.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756239Ab3GCSwK convert rfc822-to-8bit (ORCPT ); Wed, 3 Jul 2013 14:52:10 -0400 In-Reply-To: <9001E680-3DF3-4B9A-97B9-D4B3DEFAB97C@suse.de> (from agraf@suse.de on Tue Jul 2 20:07:53 2013) Content-Disposition: inline Sender: kvm-owner@vger.kernel.org List-ID: On 07/02/2013 08:07:53 PM, Alexander Graf wrote: > > On 03.07.2013, at 01:25, Yoder Stuart-B08248 wrote: > > > 8. Open Issues > > > > -how to handle cases where VFIO is requested to handle > > a device where the valid, mappable range for a region > > is less than a page size. See example above where an > > advertised region in the DMA node is 4 bytes. If exposed > > to a guest VM, the guest has to be able to map a full page > > of I/O space which opens a potential security issue. > > The way we solved this for legacy PCI device assignment was by going > through QEMU for emulation and falling back to legacy read/write > IIRC. We could probably do the same here. IIRC there was a way for a > normal Linux mmap'ed device region to trap individual accesses too, > so we could just use that one too. > > The slow path emulation would then happen magically in QEMU, since > MMIO writes will get reinjected into the normal QEMU MMIO handling > path which will just issue a read/write on the mmap'ed region if it's > not declared as emulated. I agree that's what should happen by default, but there should be a way for root to tell vfio that a device is allowed to overmap, in order to get the performance benefit of direct access in cases where root knows (or explicitly doesn't care) that it is safe. -Scott