From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:53355) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RumtC-0003uj-CJ for qemu-devel@nongnu.org; Tue, 07 Feb 2012 10:23:30 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rumt7-0000UV-UB for qemu-devel@nongnu.org; Tue, 07 Feb 2012 10:23:26 -0500 Received: from mail-pw0-f45.google.com ([209.85.160.45]:43246) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rumt7-0000UI-Jc for qemu-devel@nongnu.org; Tue, 07 Feb 2012 10:23:21 -0500 Received: by pbaa11 with SMTP id a11so8000731pba.4 for ; Tue, 07 Feb 2012 07:23:20 -0800 (PST) Message-ID: <4F3141E4.8080902@codemonkey.ws> Date: Tue, 07 Feb 2012 09:23:16 -0600 From: Anthony Liguori MIME-Version: 1.0 References: <4F2AB552.2070909@redhat.com> <4F2B41D6.8020603@codemonkey.ws> <51470503-DEE0-478D-8D01-020834AF6E8C@suse.de> <4F3117E5.6000105@redhat.com> <4F31241C.70404@redhat.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [RFC] Next gen kvm api List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexander Graf Cc: KVM list , linux-kernel , Avi Kivity , kvm-ppc , qemu-devel On 02/07/2012 07:40 AM, Alexander Graf wrote: > > Why? For the HPET timer register for example, we could have a simple MMIO hook that says > > on_read: > return read_current_time() - shared_page.offset; > on_write: > handle_in_user_space(); > > For IDE, it would be as simple as > > register_pio_hook_ptr_r(PIO_IDE, SIZE_BYTE,&s->cmd[0]); > for (i = 1; i< 7; i++) { > register_pio_hook_ptr_r(PIO_IDE + i, SIZE_BYTE,&s->cmd[i]); > register_pio_hook_ptr_w(PIO_IDE + i, SIZE_BYTE,&s->cmd[i]); > } You can't easily serialize updates to that address with the kernel since two threads are likely going to be accessing it at the same time. That either means an expensive sync operation or a reliance on atomic instructions. But not all architectures offer non-word sized atomic instructions so it gets fairly nasty in practice. Regards, Anthony Liguori