From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:47252) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QxuhX-0000nT-4J for qemu-devel@nongnu.org; Mon, 29 Aug 2011 01:48:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QxuhW-0004dV-4M for qemu-devel@nongnu.org; Mon, 29 Aug 2011 01:48:03 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56314) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QxuhV-0004dQ-Q8 for qemu-devel@nongnu.org; Mon, 29 Aug 2011 01:48:02 -0400 Message-ID: <4E5B280B.4090204@redhat.com> Date: Mon, 29 Aug 2011 08:47:55 +0300 From: Avi Kivity MIME-Version: 1.0 References: <1314389053-30841-1-git-send-email-lmr@redhat.com> <4E580E8E.2060200@codemonkey.ws> In-Reply-To: <4E580E8E.2060200@codemonkey.ws> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] hw: Add test device for unittests execution List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: Lucas Meneghel Rodrigues , Marcelo Tosatti , qemu-devel@nongnu.org, Gerd Hoffmann On 08/27/2011 12:22 AM, Anthony Liguori wrote: > > I think I posted patches at some point for kvm unittests to use a > standard UART. Was there any reason not to do use a UART? > No. >> +static void test_device_exit(void *opaque, uint32_t addr, uint32_t >> data) >> +{ >> + exit(data); >> +} > > Port 501 can do this. Right. > >> + >> +static uint32_t test_device_memsize_read(void *opaque, uint32_t addr) >> +{ >> + return ram_size; >> +} > > This can be read through fw_cfg, any reason to do PIO for this? Legacy. We even have a fw_cfg driver in k-u-t.git. >> +static void test_device_flush_page(void *opaque, uint32_t addr, >> uint32_t data) >> +{ >> + target_phys_addr_t len = 4096; >> + void *a = cpu_physical_memory_map(data& ~0xffful,&len, 0); >> + >> + mprotect(a, 4096, PROT_NONE); >> + mprotect(a, 4096, PROT_READ|PROT_WRITE); >> + cpu_physical_memory_unmap(a, len, 0, 0); > > This hard codes page size (get it via sysconf). (or getpagesize()) > I think mprotect probably isn't available on windows either. Google thinks it is. > Should this use MemoryRegion? > Yes. Lucas, do you want to tackle these yourself? I'll help with any questions. Otherwise I'll do it. -- I have a truly marvellous patch that fixes the bug which this signature is too narrow to contain.