Skip to contentSkip to conversation

kvm: Relax aligment check of kvm_set_phys_mem

PATCH New Jan Kiszka 1 participant 1 message Apr 30, 2009

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

PATCH 1/1 kvm: Relax aligment check of kvm_set_phys_mem

There is no need to reject an unaligned memory region registration if the region will be I/O memory and it will not split an existing KVM slot. This fixes KVM support on PPC.

---

 kvm-all.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
kvm-all.c +9 -1
index 32cd636..0da5c7a 100644
@@ -583,7 +583,15 @@ void kvm_set_phys_mem(target_phys_addr_t start_addr,
     int err;
 
     if (start_addr & ~TARGET_PAGE_MASK) {
-        fprintf(stderr, "Only page-aligned memory slots supported\n");
+        if (flags >= IO_MEM_UNASSIGNED) {
+            if (!kvm_lookup_overlapping_slot(s, start_addr,
+                                             start_addr + size)) {
+                return;
+            }
+            fprintf(stderr, "Unaligned split of a KVM memory slot\n");
+        } else {
+            fprintf(stderr, "Only page-aligned memory slots supported\n");
+        }
         abort();
     }