From: Marcelo Tosatti <mtosatti@redhat.com>
To: kvm@vger.kernel.org
Cc: qemu-devel@nongnu.org, Cam Macdonell <cam@cs.ualberta.ca>,
Marcelo Tosatti <mtosatti@redhat.com>
Subject: [uq/master patch 5/5] introduce qemu_ram_map
Date: Fri, 23 Apr 2010 14:04:15 -0300 [thread overview]
Message-ID: <20100423170646.344848232@amt.cnet> (raw)
In-Reply-To: 20100423170410.914857113@amt.cnet
[-- Attachment #1: qemu-ram-mmap --]
[-- Type: text/plain, Size: 1691 bytes --]
Which allows drivers to register an mmaped region into ram block mappings.
To be used by device assignment driver.
CC: Cam Macdonell <cam@cs.ualberta.ca>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Index: qemu-kvm/cpu-common.h
===================================================================
--- qemu-kvm.orig/cpu-common.h
+++ qemu-kvm/cpu-common.h
@@ -32,6 +32,7 @@ static inline void cpu_register_physical
}
ram_addr_t cpu_get_physical_page_desc(target_phys_addr_t addr);
+ram_addr_t qemu_ram_map(ram_addr_t size, void *host);
ram_addr_t qemu_ram_alloc(ram_addr_t);
void qemu_ram_free(ram_addr_t addr);
/* This should only be used for ram local to a device. */
Index: qemu-kvm/exec.c
===================================================================
--- qemu-kvm.orig/exec.c
+++ qemu-kvm/exec.c
@@ -2710,6 +2710,34 @@ static void *file_ram_alloc(ram_addr_t m
}
#endif
+ram_addr_t qemu_ram_map(ram_addr_t size, void *host)
+{
+ RAMBlock *new_block;
+
+ size = TARGET_PAGE_ALIGN(size);
+ new_block = qemu_malloc(sizeof(*new_block));
+
+ new_block->host = host;
+
+ new_block->offset = last_ram_offset;
+ new_block->length = size;
+
+ new_block->next = ram_blocks;
+ ram_blocks = new_block;
+
+ phys_ram_dirty = qemu_realloc(phys_ram_dirty,
+ (last_ram_offset + size) >> TARGET_PAGE_BITS);
+ memset(phys_ram_dirty + (last_ram_offset >> TARGET_PAGE_BITS),
+ 0xff, size >> TARGET_PAGE_BITS);
+
+ last_ram_offset += size;
+
+ if (kvm_enabled())
+ kvm_setup_guest_memory(new_block->host, size);
+
+ return new_block->offset;
+}
+
ram_addr_t qemu_ram_alloc(ram_addr_t size)
{
RAMBlock *new_block;
next prev parent reply other threads:[~2010-04-23 17:08 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-23 17:04 [uq/master patch 0/5] prepare for qemu-kvm's usage of upstream memslot code Marcelo Tosatti
2010-04-23 17:04 ` [uq/master patch 1/5] vga: fix typo in length passed to kvm_log_stop Marcelo Tosatti
2010-04-23 17:04 ` [uq/master patch 2/5] kvm: add logging count to slots Marcelo Tosatti
2010-04-24 7:34 ` Jan Kiszka
2010-04-25 12:33 ` Avi Kivity
2010-04-25 13:57 ` Jan Kiszka
2010-04-25 14:17 ` Avi Kivity
2010-04-25 14:29 ` Jan Kiszka
2010-04-25 14:41 ` Avi Kivity
2010-04-25 14:51 ` Jan Kiszka
2010-04-25 14:58 ` Avi Kivity
2010-04-25 15:07 ` Jan Kiszka
2010-04-25 15:22 ` Avi Kivity
2010-04-25 16:42 ` Jan Kiszka
2010-04-26 5:37 ` Avi Kivity
2010-04-26 13:47 ` Marcelo Tosatti
2010-04-23 17:04 ` [uq/master patch 3/5] introduce leul_to_cpu Marcelo Tosatti
2010-04-23 17:04 ` [uq/master patch 4/5] kvm: port qemu-kvm's bitmap scanning Marcelo Tosatti
2010-04-23 17:04 ` Marcelo Tosatti [this message]
2010-04-25 12:33 ` [uq/master patch 0/5] prepare for qemu-kvm's usage of upstream memslot code 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=20100423170646.344848232@amt.cnet \
--to=mtosatti@redhat.com \
--cc=cam@cs.ualberta.ca \
--cc=kvm@vger.kernel.org \
--cc=qemu-devel@nongnu.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox