* [PATCH 0/7] Userspace memory registration
@ 2008-09-23 17:44 Glauber Costa
2008-09-23 17:44 ` [PATCH 1/7] Don't separate registrations with IO_MEM_ROM set Glauber Costa
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: Glauber Costa @ 2008-09-23 17:44 UTC (permalink / raw)
To: kvm; +Cc: avi, aliguori
Hey folks,
Userspace memory registration is back, now simpler due to some comments
being addressed. we don't keep track of mmio regions at all now, which
makes the code base even simpler. OTOH, mmio coalescing is left to a later
work, since it now seems completely orthogonal to what I aim at this series.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/7] Don't separate registrations with IO_MEM_ROM set
2008-09-23 17:44 [PATCH 0/7] Userspace memory registration Glauber Costa
@ 2008-09-23 17:44 ` Glauber Costa
2008-09-23 17:44 ` [PATCH 2/7] do not use mem_hole anymore Glauber Costa
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Glauber Costa @ 2008-09-23 17:44 UTC (permalink / raw)
To: kvm; +Cc: avi, aliguori
Actually, all registrations are the same. If IO_MEM_ROM is set, we only
need to take care of not passing its value as the phys_offset.
Signed-off-by: Glauber Costa <glommer@redhat.com>
---
qemu/qemu-kvm.c | 31 +++++++++++--------------------
1 files changed, 11 insertions(+), 20 deletions(-)
diff --git a/qemu/qemu-kvm.c b/qemu/qemu-kvm.c
index 5fcf2af..00840df 100644
--- a/qemu/qemu-kvm.c
+++ b/qemu/qemu-kvm.c
@@ -768,26 +768,17 @@ void kvm_cpu_register_physical_memory(target_phys_addr_t start_addr,
unsigned long phys_offset)
{
int r = 0;
- if (!(phys_offset & ~TARGET_PAGE_MASK)) {
- r = kvm_is_allocated_mem(kvm_context, start_addr, size);
- if (r)
- return;
- r = kvm_is_intersecting_mem(kvm_context, start_addr);
- if (r)
- kvm_create_mem_hole(kvm_context, start_addr, size);
- r = kvm_register_phys_mem(kvm_context, start_addr,
- phys_ram_base + phys_offset,
- size, 0);
- }
- if (phys_offset & IO_MEM_ROM) {
- phys_offset &= ~IO_MEM_ROM;
- r = kvm_is_intersecting_mem(kvm_context, start_addr);
- if (r)
- kvm_create_mem_hole(kvm_context, start_addr, size);
- r = kvm_register_phys_mem(kvm_context, start_addr,
- phys_ram_base + phys_offset,
- size, 0);
- }
+
+ phys_offset &= ~IO_MEM_ROM;
+ r = kvm_is_allocated_mem(kvm_context, start_addr, size);
+ if (r)
+ return;
+ r = kvm_is_intersecting_mem(kvm_context, start_addr);
+ if (r)
+ kvm_create_mem_hole(kvm_context, start_addr, size);
+ r = kvm_register_phys_mem(kvm_context, start_addr,
+ phys_ram_base + phys_offset,
+ size, 0);
if (r < 0) {
printf("kvm_cpu_register_physical_memory: failed\n");
exit(1);
--
1.5.5.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/7] do not use mem_hole anymore.
2008-09-23 17:44 [PATCH 0/7] Userspace memory registration Glauber Costa
2008-09-23 17:44 ` [PATCH 1/7] Don't separate registrations with IO_MEM_ROM set Glauber Costa
@ 2008-09-23 17:44 ` Glauber Costa
2008-09-23 17:44 ` [PATCH 3/7] substitute is_allocated_mem with more general is_containing_region Glauber Costa
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Glauber Costa @ 2008-09-23 17:44 UTC (permalink / raw)
To: kvm; +Cc: avi, aliguori
memory holes are totally evil. Right now they work for some basic tests,
but had never been stressed enough. Using memory holes leaves open questions like:
* what happens if a area being registered span two slots?
* what happens if there is already data in the slots?
also, the code behaves badly if the piece to be removed lies in the boundaries of the
current slot. Luckily, we don't really need it. Remove it, and make sure we never hit it.
Signed-off-by: Glauber Costa <glommer@redhat.com>
---
libkvm/libkvm.c | 69 +-----------------------------------------------------
libkvm/libkvm.h | 2 -
qemu/qemu-kvm.c | 13 +++++----
3 files changed, 9 insertions(+), 75 deletions(-)
diff --git a/libkvm/libkvm.c b/libkvm/libkvm.c
index a850caa..c261053 100644
--- a/libkvm/libkvm.c
+++ b/libkvm/libkvm.c
@@ -439,74 +439,9 @@ int kvm_is_allocated_mem(kvm_context_t kvm, unsigned long phys_start,
return 0;
}
-int kvm_create_mem_hole(kvm_context_t kvm, unsigned long phys_start,
- unsigned long len)
-{
- int slot;
- int r;
- struct kvm_userspace_memory_region rmslot;
- struct kvm_userspace_memory_region newslot1;
- struct kvm_userspace_memory_region newslot2;
-
- len = (len + PAGE_SIZE - 1) & PAGE_MASK;
-
- slot = get_intersecting_slot(phys_start);
- /* no need to create hole, as there is already hole */
- if (slot == -1)
- return 0;
-
- memset(&rmslot, 0, sizeof(struct kvm_userspace_memory_region));
- memset(&newslot1, 0, sizeof(struct kvm_userspace_memory_region));
- memset(&newslot2, 0, sizeof(struct kvm_userspace_memory_region));
-
- rmslot.guest_phys_addr = slots[slot].phys_addr;
- rmslot.slot = slot;
-
- newslot1.guest_phys_addr = slots[slot].phys_addr;
- newslot1.memory_size = phys_start - slots[slot].phys_addr;
- newslot1.slot = slot;
- newslot1.userspace_addr = slots[slot].userspace_addr;
- newslot1.flags = slots[slot].flags;
-
- newslot2.guest_phys_addr = newslot1.guest_phys_addr +
- newslot1.memory_size + len;
- newslot2.memory_size = slots[slot].phys_addr +
- slots[slot].len - newslot2.guest_phys_addr;
- newslot2.userspace_addr = newslot1.userspace_addr +
- newslot1.memory_size;
- newslot2.slot = get_free_slot(kvm);
- newslot2.flags = newslot1.flags;
-
- r = ioctl(kvm->vm_fd, KVM_SET_USER_MEMORY_REGION, &rmslot);
- if (r == -1) {
- fprintf(stderr, "kvm_create_mem_hole: %s\n", strerror(errno));
- return -1;
- }
- free_slot(slot);
-
- r = ioctl(kvm->vm_fd, KVM_SET_USER_MEMORY_REGION, &newslot1);
- if (r == -1) {
- fprintf(stderr, "kvm_create_mem_hole: %s\n", strerror(errno));
- return -1;
- }
- register_slot(newslot1.slot, newslot1.guest_phys_addr,
- newslot1.memory_size, newslot1.userspace_addr,
- newslot1.flags);
-
- r = ioctl(kvm->vm_fd, KVM_SET_USER_MEMORY_REGION, &newslot2);
- if (r == -1) {
- fprintf(stderr, "kvm_create_mem_hole: %s\n", strerror(errno));
- return -1;
- }
- register_slot(newslot2.slot, newslot2.guest_phys_addr,
- newslot2.memory_size, newslot2.userspace_addr,
- newslot2.flags);
- return 0;
-}
-
int kvm_register_phys_mem(kvm_context_t kvm,
- unsigned long phys_start, void *userspace_addr,
- unsigned long len, int log)
+ unsigned long phys_start, void *userspace_addr,
+ unsigned long len, int log)
{
struct kvm_userspace_memory_region memory = {
diff --git a/libkvm/libkvm.h b/libkvm/libkvm.h
index 79dd769..77fd903 100644
--- a/libkvm/libkvm.h
+++ b/libkvm/libkvm.h
@@ -457,8 +457,6 @@ void kvm_destroy_phys_mem(kvm_context_t, unsigned long phys_start,
int kvm_is_intersecting_mem(kvm_context_t kvm, unsigned long phys_start);
int kvm_is_allocated_mem(kvm_context_t kvm, unsigned long phys_start,
unsigned long len);
-int kvm_create_mem_hole(kvm_context_t kvm, unsigned long phys_start,
- unsigned long len);
int kvm_register_phys_mem(kvm_context_t kvm,
unsigned long phys_start, void *userspace_addr,
unsigned long len, int log);
diff --git a/qemu/qemu-kvm.c b/qemu/qemu-kvm.c
index 00840df..3663d38 100644
--- a/qemu/qemu-kvm.c
+++ b/qemu/qemu-kvm.c
@@ -773,12 +773,13 @@ void kvm_cpu_register_physical_memory(target_phys_addr_t start_addr,
r = kvm_is_allocated_mem(kvm_context, start_addr, size);
if (r)
return;
- r = kvm_is_intersecting_mem(kvm_context, start_addr);
- if (r)
- kvm_create_mem_hole(kvm_context, start_addr, size);
- r = kvm_register_phys_mem(kvm_context, start_addr,
- phys_ram_base + phys_offset,
- size, 0);
+ r = kvm_is_intersecting_mem(kvm_context, start_addr);
+ if (r) {
+ printf("Ignoring intersecting memory %llx (%lx)\n", start_addr, size);
+ } else
+ r = kvm_register_phys_mem(kvm_context, start_addr,
+ phys_ram_base + phys_offset,
+ size, 0);
if (r < 0) {
printf("kvm_cpu_register_physical_memory: failed\n");
exit(1);
--
1.5.5.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 3/7] substitute is_allocated_mem with more general is_containing_region
2008-09-23 17:44 [PATCH 0/7] Userspace memory registration Glauber Costa
2008-09-23 17:44 ` [PATCH 1/7] Don't separate registrations with IO_MEM_ROM set Glauber Costa
2008-09-23 17:44 ` [PATCH 2/7] do not use mem_hole anymore Glauber Costa
@ 2008-09-23 17:44 ` Glauber Costa
2008-09-23 17:44 ` [PATCH 4/7] add debuging facilities to memory registration at libkvm Glauber Costa
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Glauber Costa @ 2008-09-23 17:44 UTC (permalink / raw)
To: kvm; +Cc: avi, aliguori
is_allocated_mem is a function that checks if every relevant aspect of the memory slot
match (start and size). Replace it with a more generic function that checks if a memory
region is totally contained into another. The former case is also covered.
Signed-off-by: Glauber Costa <glommer@redhat.com>
---
libkvm/libkvm.c | 34 +++++++++++++---------------------
libkvm/libkvm.h | 4 +---
qemu/qemu-kvm.c | 12 ++++--------
3 files changed, 18 insertions(+), 32 deletions(-)
diff --git a/libkvm/libkvm.c b/libkvm/libkvm.c
index c261053..11a9529 100644
--- a/libkvm/libkvm.c
+++ b/libkvm/libkvm.c
@@ -125,17 +125,27 @@ int get_slot(unsigned long phys_addr)
return -1;
}
-int get_intersecting_slot(unsigned long phys_addr)
+/* Returns -1 if this slot is not totally contained on any other,
+ * and the number of the slot otherwise */
+int get_container_slot(uint64_t phys_addr, unsigned long size)
{
int i;
for (i = 0; i < KVM_MAX_NUM_MEM_REGIONS ; ++i)
- if (slots[i].len && slots[i].phys_addr < phys_addr &&
- (slots[i].phys_addr + slots[i].len) > phys_addr)
+ if (slots[i].len && slots[i].phys_addr <= phys_addr &&
+ (slots[i].phys_addr + slots[i].len) >= phys_addr + size)
return i;
return -1;
}
+int kvm_is_containing_region(kvm_context_t kvm, unsigned long phys_addr, unsigned long size)
+{
+ int slot = get_container_slot(phys_addr, size);
+ if (slot == -1)
+ return 0;
+ return 1;
+}
+
/*
* dirty pages logging control
*/
@@ -421,24 +431,6 @@ void *kvm_create_phys_mem(kvm_context_t kvm, unsigned long phys_start,
return ptr;
}
-int kvm_is_intersecting_mem(kvm_context_t kvm, unsigned long phys_start)
-{
- return get_intersecting_slot(phys_start) != -1;
-}
-
-int kvm_is_allocated_mem(kvm_context_t kvm, unsigned long phys_start,
- unsigned long len)
-{
- int slot;
-
- slot = get_slot(phys_start);
- if (slot == -1)
- return 0;
- if (slots[slot].len == len)
- return 1;
- return 0;
-}
-
int kvm_register_phys_mem(kvm_context_t kvm,
unsigned long phys_start, void *userspace_addr,
unsigned long len, int log)
diff --git a/libkvm/libkvm.h b/libkvm/libkvm.h
index 77fd903..cb77c6c 100644
--- a/libkvm/libkvm.h
+++ b/libkvm/libkvm.h
@@ -454,9 +454,7 @@ void *kvm_create_phys_mem(kvm_context_t, unsigned long phys_start,
unsigned long len, int log, int writable);
void kvm_destroy_phys_mem(kvm_context_t, unsigned long phys_start,
unsigned long len);
-int kvm_is_intersecting_mem(kvm_context_t kvm, unsigned long phys_start);
-int kvm_is_allocated_mem(kvm_context_t kvm, unsigned long phys_start,
- unsigned long len);
+int kvm_is_containing_region(kvm_context_t kvm, unsigned long phys_start, unsigned long size);
int kvm_register_phys_mem(kvm_context_t kvm,
unsigned long phys_start, void *userspace_addr,
unsigned long len, int log);
diff --git a/qemu/qemu-kvm.c b/qemu/qemu-kvm.c
index 3663d38..07cffef 100644
--- a/qemu/qemu-kvm.c
+++ b/qemu/qemu-kvm.c
@@ -770,16 +770,12 @@ void kvm_cpu_register_physical_memory(target_phys_addr_t start_addr,
int r = 0;
phys_offset &= ~IO_MEM_ROM;
- r = kvm_is_allocated_mem(kvm_context, start_addr, size);
+ r = kvm_is_containing_region(kvm_context, start_addr, size);
if (r)
return;
- r = kvm_is_intersecting_mem(kvm_context, start_addr);
- if (r) {
- printf("Ignoring intersecting memory %llx (%lx)\n", start_addr, size);
- } else
- r = kvm_register_phys_mem(kvm_context, start_addr,
- phys_ram_base + phys_offset,
- size, 0);
+ r = kvm_register_phys_mem(kvm_context, start_addr,
+ phys_ram_base + phys_offset,
+ size, 0);
if (r < 0) {
printf("kvm_cpu_register_physical_memory: failed\n");
exit(1);
--
1.5.5.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 4/7] add debuging facilities to memory registration at libkvm
2008-09-23 17:44 [PATCH 0/7] Userspace memory registration Glauber Costa
` (2 preceding siblings ...)
2008-09-23 17:44 ` [PATCH 3/7] substitute is_allocated_mem with more general is_containing_region Glauber Costa
@ 2008-09-23 17:44 ` Glauber Costa
2008-09-23 17:44 ` [PATCH 5/7] unregister memory area depending on their flags Glauber Costa
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Glauber Costa @ 2008-09-23 17:44 UTC (permalink / raw)
To: kvm; +Cc: avi, aliguori
Signed-off-by: Glauber Costa <glommer@redhat.com>
---
libkvm/libkvm.c | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/libkvm/libkvm.c b/libkvm/libkvm.c
index 11a9529..f7a7fdd 100644
--- a/libkvm/libkvm.c
+++ b/libkvm/libkvm.c
@@ -52,6 +52,15 @@
#include "kvm-s390.h"
#endif
+//#define DEBUG_MEMREG
+#ifdef DEBUG_MEMREG
+#define DPRINTF(fmt, args...) \
+ do { fprintf(stderr, "%s:%d " fmt , __func__, __LINE__, ##args); } while (0)
+#else
+#define DPRINTF(fmt, args...) do {} while (0)
+#endif
+
+
int kvm_abi = EXPECTED_KVM_API_VERSION;
int kvm_page_size;
@@ -445,6 +454,9 @@ int kvm_register_phys_mem(kvm_context_t kvm,
int r;
memory.slot = get_free_slot(kvm);
+ DPRINTF("memory: gpa: %llx, size: %llx, uaddr: %llx, slot: %x, flags: %lx\n",
+ memory.guest_phys_addr, memory.memory_size,
+ memory.userspace_addr, memory.slot, memory.flags);
r = ioctl(kvm->vm_fd, KVM_SET_USER_MEMORY_REGION, &memory);
if (r == -1) {
fprintf(stderr, "create_userspace_phys_mem: %s\n", strerror(errno));
@@ -983,6 +995,7 @@ int kvm_unregister_coalesced_mmio(kvm_context_t kvm, uint64_t addr, uint32_t siz
perror("kvm_unregister_coalesced_mmio_zone");
return -errno;
}
+ DPRINTF("Unregistered coalesced mmio region for %llx (%lx)\n", addr, size);
return 0;
}
#endif
--
1.5.5.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 5/7] unregister memory area depending on their flags
2008-09-23 17:44 [PATCH 0/7] Userspace memory registration Glauber Costa
` (3 preceding siblings ...)
2008-09-23 17:44 ` [PATCH 4/7] add debuging facilities to memory registration at libkvm Glauber Costa
@ 2008-09-23 17:44 ` Glauber Costa
2008-09-23 17:44 ` [PATCH 6/7] register mmio slots Glauber Costa
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Glauber Costa @ 2008-09-23 17:44 UTC (permalink / raw)
To: kvm; +Cc: avi, aliguori
Signed-off-by: Glauber Costa <glommer@redhat.com>
---
libkvm/libkvm.c | 12 ++++++++++++
libkvm/libkvm.h | 3 +++
qemu/qemu-kvm.c | 7 +++++++
3 files changed, 22 insertions(+), 0 deletions(-)
diff --git a/libkvm/libkvm.c b/libkvm/libkvm.c
index f7a7fdd..88d3f5d 100644
--- a/libkvm/libkvm.c
+++ b/libkvm/libkvm.c
@@ -508,6 +508,18 @@ void kvm_destroy_phys_mem(kvm_context_t kvm, unsigned long phys_start,
free_slot(memory.slot);
}
+void kvm_unregister_memory_area(kvm_context_t kvm, uint64_t phys_addr, unsigned long size)
+{
+
+ int slot = get_container_slot(phys_addr, size);
+
+ if (slot != -1) {
+ DPRINTF("Unregistering memory region %llx (%lx)\n", phys_addr, size);
+ kvm_destroy_phys_mem(kvm, phys_addr, size);
+ return;
+ }
+}
+
static int kvm_get_map(kvm_context_t kvm, int ioctl_num, int slot, void *buf)
{
int r;
diff --git a/libkvm/libkvm.h b/libkvm/libkvm.h
index cb77c6c..14ea93b 100644
--- a/libkvm/libkvm.h
+++ b/libkvm/libkvm.h
@@ -454,6 +454,9 @@ void *kvm_create_phys_mem(kvm_context_t, unsigned long phys_start,
unsigned long len, int log, int writable);
void kvm_destroy_phys_mem(kvm_context_t, unsigned long phys_start,
unsigned long len);
+void kvm_unregister_memory_area(kvm_context_t, uint64_t phys_start,
+ unsigned long len);
+
int kvm_is_containing_region(kvm_context_t kvm, unsigned long phys_start, unsigned long size);
int kvm_register_phys_mem(kvm_context_t kvm,
unsigned long phys_start, void *userspace_addr,
diff --git a/qemu/qemu-kvm.c b/qemu/qemu-kvm.c
index 07cffef..1da253a 100644
--- a/qemu/qemu-kvm.c
+++ b/qemu/qemu-kvm.c
@@ -768,8 +768,15 @@ void kvm_cpu_register_physical_memory(target_phys_addr_t start_addr,
unsigned long phys_offset)
{
int r = 0;
+ unsigned long area_flags = phys_offset & ~TARGET_PAGE_MASK;
phys_offset &= ~IO_MEM_ROM;
+
+ if (area_flags == IO_MEM_UNASSIGNED) {
+ kvm_unregister_memory_area(kvm_context, start_addr, size);
+ return;
+ }
+
r = kvm_is_containing_region(kvm_context, start_addr, size);
if (r)
return;
--
1.5.5.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 6/7] register mmio slots
2008-09-23 17:44 [PATCH 0/7] Userspace memory registration Glauber Costa
` (4 preceding siblings ...)
2008-09-23 17:44 ` [PATCH 5/7] unregister memory area depending on their flags Glauber Costa
@ 2008-09-23 17:44 ` Glauber Costa
2008-09-23 17:44 ` [PATCH 7/7] move kvm memory registration inside qemu's Glauber Costa
2008-09-24 11:51 ` [PATCH 0/7] Userspace memory registration Avi Kivity
7 siblings, 0 replies; 9+ messages in thread
From: Glauber Costa @ 2008-09-23 17:44 UTC (permalink / raw)
To: kvm; +Cc: avi, aliguori
By analysing phys_offset, we know whether a region is an mmio region
or not. If it is, we don't want to have kvm caring about it, so just
return.
Signed-off-by: Glauber Costa <glommer@redhat.com>
---
qemu/qemu-kvm.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/qemu/qemu-kvm.c b/qemu/qemu-kvm.c
index 1da253a..cfdf90f 100644
--- a/qemu/qemu-kvm.c
+++ b/qemu/qemu-kvm.c
@@ -780,6 +780,10 @@ void kvm_cpu_register_physical_memory(target_phys_addr_t start_addr,
r = kvm_is_containing_region(kvm_context, start_addr, size);
if (r)
return;
+
+ if (area_flags >= TLB_MMIO)
+ return;
+
r = kvm_register_phys_mem(kvm_context, start_addr,
phys_ram_base + phys_offset,
size, 0);
--
1.5.5.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 7/7] move kvm memory registration inside qemu's
2008-09-23 17:44 [PATCH 0/7] Userspace memory registration Glauber Costa
` (5 preceding siblings ...)
2008-09-23 17:44 ` [PATCH 6/7] register mmio slots Glauber Costa
@ 2008-09-23 17:44 ` Glauber Costa
2008-09-24 11:51 ` [PATCH 0/7] Userspace memory registration Avi Kivity
7 siblings, 0 replies; 9+ messages in thread
From: Glauber Costa @ 2008-09-23 17:44 UTC (permalink / raw)
To: kvm; +Cc: avi, aliguori
Remove explicit calls to kvm_cpu_register_physical_memory,
and bundle it together with qemu's memory registration function.
Signed-off-by: Glauber Costa <glommer@redhat.com>
---
qemu/exec.c | 5 +++++
qemu/hw/ipf.c | 8 --------
qemu/hw/pc.c | 22 +---------------------
qemu/hw/ppc440_bamboo.c | 2 --
4 files changed, 6 insertions(+), 31 deletions(-)
diff --git a/qemu/exec.c b/qemu/exec.c
index 8595d6b..856b1fe 100644
--- a/qemu/exec.c
+++ b/qemu/exec.c
@@ -2215,6 +2215,11 @@ void cpu_register_physical_memory(target_phys_addr_t start_addr,
kqemu_set_phys_mem(start_addr, size, phys_offset);
}
#endif
+#ifdef USE_KVM
+ if (kvm_enabled())
+ kvm_cpu_register_physical_memory(start_addr, size, phys_offset);
+#endif
+
size = (size + TARGET_PAGE_SIZE - 1) & TARGET_PAGE_MASK;
end_addr = start_addr + (target_phys_addr_t)size;
for(addr = start_addr; addr != end_addr; addr += TARGET_PAGE_SIZE) {
diff --git a/qemu/hw/ipf.c b/qemu/hw/ipf.c
index d70af90..5227385 100644
--- a/qemu/hw/ipf.c
+++ b/qemu/hw/ipf.c
@@ -420,18 +420,14 @@ static void ipf_init1(ram_addr_t ram_size, int vga_ram_size,
if (kvm_enabled()) {
ram_addr = qemu_ram_alloc(0xa0000);
cpu_register_physical_memory(0, 0xa0000, ram_addr);
- kvm_cpu_register_physical_memory(0, 0xa0000, ram_addr);
ram_addr = qemu_ram_alloc(0x20000); // Workaround 0xa0000-0xc0000
ram_addr = qemu_ram_alloc(0x40000);
cpu_register_physical_memory(0xc0000, 0x40000, ram_addr);
- kvm_cpu_register_physical_memory(0xc0000, 0x40000, ram_addr);
ram_addr = qemu_ram_alloc(ram_size - 0x100000);
cpu_register_physical_memory(0x100000, ram_size - 0x100000, ram_addr);
- kvm_cpu_register_physical_memory(0x100000, ram_size - 0x100000,
- ram_addr);
} else
{
ram_addr = qemu_ram_alloc(ram_size);
@@ -444,9 +440,6 @@ static void ipf_init1(ram_addr_t ram_size, int vga_ram_size,
if (above_4g_mem_size > 0) {
ram_addr = qemu_ram_alloc(above_4g_mem_size);
cpu_register_physical_memory(0x100000000, above_4g_mem_size, ram_addr);
- if (kvm_enabled())
- kvm_cpu_register_physical_memory(0x100000000, above_4g_mem_size,
- ram_addr);
}
/*Load firware to its proper position.*/
@@ -468,7 +461,6 @@ static void ipf_init1(ram_addr_t ram_size, int vga_ram_size,
fw_image_start = fw_start + GFW_SIZE - image_size;
cpu_register_physical_memory(GFW_START, GFW_SIZE, fw_offset);
- kvm_cpu_register_physical_memory(GFW_START,GFW_SIZE, fw_offset);
memcpy(fw_image_start, image, image_size);
free(image);
diff --git a/qemu/hw/pc.c b/qemu/hw/pc.c
index cc3bd50..fda4320 100644
--- a/qemu/hw/pc.c
+++ b/qemu/hw/pc.c
@@ -777,9 +777,7 @@ static int load_option_rom(const char *filename, int offset, int type)
cpu_register_physical_memory(0xd0000 + offset,
size, option_rom_offset | type);
option_rom_setup_reset(0xd0000 + offset, size);
- if (kvm_enabled())
- kvm_cpu_register_physical_memory(0xd0000 + offset,
- size, option_rom_offset | type);
+
return size;
}
@@ -852,7 +850,6 @@ static void pc_init1(ram_addr_t ram_size, int vga_ram_size,
/* allocate RAM */
ram_addr = qemu_ram_alloc(0xa0000);
cpu_register_physical_memory(0, 0xa0000, ram_addr);
- kvm_cpu_register_physical_memory(0, 0xa0000, ram_addr);
/* Allocate, even though we won't register, so we don't break the
* phys_ram_base + PA assumption. This range includes vga (0xa0000 - 0xc0000),
@@ -863,9 +860,6 @@ static void pc_init1(ram_addr_t ram_size, int vga_ram_size,
cpu_register_physical_memory(0x100000,
below_4g_mem_size - 0x100000,
ram_addr);
- kvm_cpu_register_physical_memory(0x100000,
- below_4g_mem_size - 0x100000,
- ram_addr);
/* above 4giga memory allocation */
if (above_4g_mem_size > 0) {
@@ -881,9 +875,6 @@ static void pc_init1(ram_addr_t ram_size, int vga_ram_size,
cpu_register_physical_memory(0x100000000ULL,
above_4g_mem_size,
ram_addr);
- kvm_cpu_register_physical_memory(0x100000000ULL,
- above_4g_mem_size,
- ram_addr);
}
/* allocate VGA RAM */
@@ -927,9 +918,6 @@ static void pc_init1(ram_addr_t ram_size, int vga_ram_size,
/* setup basic memory access */
cpu_register_physical_memory(0xc0000, 0x10000,
vga_bios_offset | IO_MEM_ROM);
- if (kvm_enabled())
- kvm_cpu_register_physical_memory(0xc0000, 0x10000,
- vga_bios_offset | IO_MEM_ROM);
/* map the last 128KB of the BIOS in ISA space */
isa_bios_size = bios_size;
@@ -941,10 +929,6 @@ static void pc_init1(ram_addr_t ram_size, int vga_ram_size,
cpu_register_physical_memory(0x100000 - isa_bios_size,
isa_bios_size,
(bios_offset + bios_size - isa_bios_size) /* | IO_MEM_ROM */);
- if (kvm_enabled())
- kvm_cpu_register_physical_memory(0x100000 - isa_bios_size,
- isa_bios_size,
- (bios_offset + bios_size - isa_bios_size) | IO_MEM_ROM);
/* XXX: for DDIM support, "ROM space" should be writable during
initialization, and (optionally) marked readonly by the BIOS
@@ -963,10 +947,6 @@ static void pc_init1(ram_addr_t ram_size, int vga_ram_size,
/* map all the bios at the top of memory */
cpu_register_physical_memory((uint32_t)(-bios_size),
bios_size, bios_offset | IO_MEM_ROM);
- if (kvm_enabled()) {
- kvm_cpu_register_physical_memory((uint32_t)(-bios_size),
- bios_size, bios_offset | IO_MEM_ROM);
- }
bochs_bios_init();
diff --git a/qemu/hw/ppc440_bamboo.c b/qemu/hw/ppc440_bamboo.c
index 9ff6f7d..deafc5f 100644
--- a/qemu/hw/ppc440_bamboo.c
+++ b/qemu/hw/ppc440_bamboo.c
@@ -93,8 +93,6 @@ void bamboo_init(ram_addr_t ram_size, int vga_ram_size,
/* Register mem */
cpu_register_physical_memory(0, ram_size, 0);
- if (kvm_enabled())
- kvm_cpu_register_physical_memory(0, ram_size, 0);
/* load kernel with uboot loader */
printf("%s: load kernel\n", __func__);
--
1.5.5.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 0/7] Userspace memory registration
2008-09-23 17:44 [PATCH 0/7] Userspace memory registration Glauber Costa
` (6 preceding siblings ...)
2008-09-23 17:44 ` [PATCH 7/7] move kvm memory registration inside qemu's Glauber Costa
@ 2008-09-24 11:51 ` Avi Kivity
7 siblings, 0 replies; 9+ messages in thread
From: Avi Kivity @ 2008-09-24 11:51 UTC (permalink / raw)
To: Glauber Costa; +Cc: kvm, aliguori
Glauber Costa wrote:
> Hey folks,
>
> Userspace memory registration is back, now simpler due to some comments
> being addressed. we don't keep track of mmio regions at all now, which
> makes the code base even simpler. OTOH, mmio coalescing is left to a later
> work, since it now seems completely orthogonal to what I aim at this series.
>
Applied, thanks.
--
error compiling committee.c: too many arguments to function
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2008-09-24 11:51 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-23 17:44 [PATCH 0/7] Userspace memory registration Glauber Costa
2008-09-23 17:44 ` [PATCH 1/7] Don't separate registrations with IO_MEM_ROM set Glauber Costa
2008-09-23 17:44 ` [PATCH 2/7] do not use mem_hole anymore Glauber Costa
2008-09-23 17:44 ` [PATCH 3/7] substitute is_allocated_mem with more general is_containing_region Glauber Costa
2008-09-23 17:44 ` [PATCH 4/7] add debuging facilities to memory registration at libkvm Glauber Costa
2008-09-23 17:44 ` [PATCH 5/7] unregister memory area depending on their flags Glauber Costa
2008-09-23 17:44 ` [PATCH 6/7] register mmio slots Glauber Costa
2008-09-23 17:44 ` [PATCH 7/7] move kvm memory registration inside qemu's Glauber Costa
2008-09-24 11:51 ` [PATCH 0/7] Userspace memory registration Avi Kivity
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.