From: Marcelo Tosatti <mtosatti@redhat.com>
To: kvm@vger.kernel.org
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Subject: [patch 5/8] testdev: add port to create/delete memslots
Date: Wed, 24 Mar 2010 18:24:13 -0300 [thread overview]
Message-ID: <20100324212726.290507585@amt.cnet> (raw)
In-Reply-To: 20100324212408.790319364@amt.cnet
[-- Attachment #1: qemu-testdev-memslot --]
[-- Type: text/plain, Size: 2333 bytes --]
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Index: qemu-kvm/hw/testdev.c
===================================================================
--- qemu-kvm.orig/hw/testdev.c
+++ qemu-kvm/hw/testdev.c
@@ -5,6 +5,10 @@
struct testdev {
ISADevice dev;
CharDriverState *chr;
+ struct memslot {
+ target_phys_addr_t start;
+ target_phys_addr_t end;
+ } memslot;
};
static void test_device_serial_write(void *opaque, uint32_t addr, uint32_t data)
@@ -90,6 +94,45 @@ static CPUWriteMemoryFunc * const test_i
test_iomem_writel,
};
+#define CMD_CREATE_SLOT 0x0
+#define CMD_DELETE_SLOT 0x1
+
+static void test_device_memslot_write(void *opaque, uint32_t addr, uint32_t data)
+{
+ uint32_t port = addr - 0x2018;
+ struct testdev *dev = opaque;
+
+ switch(port) {
+ case 0:
+ dev->memslot.start = 0;
+ case 4:
+ dev->memslot.start |= (unsigned long)data << (port * 8);
+ break;
+ case 8:
+ dev->memslot.end = 0;
+ case 12:
+ dev->memslot.end |= (unsigned long)data << ((port-8) * 8);
+ break;
+ case 16:
+ if (data == CMD_CREATE_SLOT) {
+ ram_addr_t ram_addr, size;
+
+ size = dev->memslot.end - dev->memslot.start;
+
+ ram_addr = qemu_ram_alloc(size);
+ cpu_register_physical_memory(dev->memslot.start, size, ram_addr);
+ }
+ else if (data == CMD_DELETE_SLOT) {
+ ram_addr_t size = dev->memslot.end - dev->memslot.start;
+
+ cpu_register_physical_memory(dev->memslot.start, size,
+ IO_MEM_UNASSIGNED);
+ }
+ default:
+ break;
+ }
+}
+
static int init_test_device(ISADevice *isa)
{
struct testdev *dev = DO_UPCAST(struct testdev, dev, isa);
@@ -105,6 +148,8 @@ static int init_test_device(ISADevice *i
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(0x2000, 24, 1, test_device_irq_line, NULL);
+ register_ioport_write(0x2018, 20, 4, test_device_memslot_write, dev);
+
iomem_buf = qemu_mallocz(0x10000);
iomem = cpu_register_io_memory(test_iomem_read, test_iomem_write, NULL);
cpu_register_physical_memory(0xff000000, 0x10000, iomem);
next prev parent reply other threads:[~2010-03-24 21:29 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-24 21:24 [patch 0/8] add slot deletion, rmap chain tests Marcelo Tosatti
2010-03-24 21:24 ` [patch 1/8] test: allow functions to execute on non-irq context remotely Marcelo Tosatti
2010-03-25 16:25 ` Avi Kivity
2010-03-25 18:07 ` Marcelo Tosatti
2010-03-28 6:32 ` Avi Kivity
2010-03-24 21:24 ` [patch 2/8] test: add pagefault exception handler Marcelo Tosatti
2010-03-24 21:24 ` [patch 3/8] test: protect fwcfg accesses with lock Marcelo Tosatti
2010-03-24 21:24 ` [patch 4/8] test: export vm helpers Marcelo Tosatti
2010-03-24 21:24 ` Marcelo Tosatti [this message]
2010-03-25 16:27 ` [patch 5/8] testdev: add port to create/delete memslots Avi Kivity
2010-03-24 21:24 ` [patch 6/8] test: parallel faults vs slot deletion Marcelo Tosatti
2010-03-24 21:24 ` [patch 7/8] test: bump max vcpus to 64 Marcelo Tosatti
2010-03-24 21:24 ` [patch 8/8] test: long rmap chains Marcelo Tosatti
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=20100324212726.290507585@amt.cnet \
--to=mtosatti@redhat.com \
--cc=kvm@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.