From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH] Add ability to drop pages through testdev Date: Wed, 29 Dec 2010 11:50:48 +0200 Message-ID: <4D1B0478.5010304@redhat.com> References: <20101222151849.GF2231@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: mtosatti@redhat.com, kvm@vger.kernel.org To: Gleb Natapov Return-path: Received: from mx1.redhat.com ([209.132.183.28]:58536 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750796Ab0L2Juw (ORCPT ); Wed, 29 Dec 2010 04:50:52 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id oBT9op61001318 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 29 Dec 2010 04:50:52 -0500 In-Reply-To: <20101222151849.GF2231@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On 12/22/2010 05:18 PM, Gleb Natapov wrote: > Signed-off-by: Gleb Natapov > diff --git a/hw/testdev.c b/hw/testdev.c > index d1abf59..29df385 100644 > --- a/hw/testdev.c > +++ b/hw/testdev.c > @@ -1,3 +1,4 @@ > +#include > #include "hw.h" > #include "qdev.h" > #include "isa.h" > @@ -46,6 +47,16 @@ static uint32_t test_device_ioport_read(void *opaque, uint32_t addr) > return test_device_ioport_data; > } > > +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); > +} > + Icky. This is much better done through the api tests. Applied it so as not to spoil all the effort. -- error compiling committee.c: too many arguments to function