From: Gleb Natapov <gleb@redhat.com>
To: avi@redhat.com, mtosatti@redhat.com
Cc: kvm@vger.kernel.org
Subject: [PATCH] Add ability to drop pages through testdev
Date: Wed, 22 Dec 2010 17:18:49 +0200 [thread overview]
Message-ID: <20101222151849.GF2231@redhat.com> (raw)
Signed-off-by: Gleb Natapov <gleb@redhat.com>
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 <sys/mman.h>
#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);
+}
+
static char *iomem_buf;
static uint32_t test_iomem_readb(void *opaque, target_phys_addr_t addr)
@@ -104,6 +115,7 @@ static int init_test_device(ISADevice *isa)
register_ioport_write(0xe0, 1, 2, test_device_ioport_write, dev);
register_ioport_read(0xe0, 1, 4, test_device_ioport_read, dev);
register_ioport_write(0xe0, 1, 4, test_device_ioport_write, dev);
+ register_ioport_write(0xe4, 1, 4, test_device_flush_page, dev);
register_ioport_write(0x2000, 24, 1, test_device_irq_line, NULL);
iomem_buf = qemu_mallocz(0x10000);
iomem = cpu_register_io_memory(test_iomem_read, test_iomem_write, NULL);
--
Gleb.
next reply other threads:[~2010-12-22 15:18 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-22 15:18 Gleb Natapov [this message]
2010-12-29 9:50 ` [PATCH] Add ability to drop pages through testdev Avi Kivity
2010-12-29 9:55 ` Gleb Natapov
2010-12-29 9:58 ` Avi Kivity
2010-12-29 10:03 ` Gleb Natapov
2010-12-29 10:05 ` Avi Kivity
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20101222151849.GF2231@redhat.com \
--to=gleb@redhat.com \
--cc=avi@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=mtosatti@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox