[KVM/qemu] check page size of qemu and host at intialization time

Zhang, Xiantao
2007-12-11T11:04:59Z

[-- Attachment #1: Type: text/plain, Size: 1285 bytes --]

From: Zhang Xiantao <xiantao.zhang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Date: Tue, 11 Dec 2007 18:54:27 +0800
Subject: [PATCH] kvm: qemu: Check page size at initialization time.

Currently, we assume Qemu target page size = HOST page
size, this patch check them. if not equal, print error
info and exit.
Signed-off-by: Zhang Xiantao <xiantao.zhang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
qemu/hw/ipf.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/qemu/hw/ipf.c b/qemu/hw/ipf.c
index 012073d..9466707 100644
--- a/qemu/hw/ipf.c
+++ b/qemu/hw/ipf.c
@@ -27,6 +27,8 @@
#include "vl.h"
#include "firmware.h"
#include "ia64intrin.h"
+#include <unistd.h>
+
#ifdef USE_KVM
#include "qemu-kvm.h"
extern int kvm_allowed;
@@ -143,6 +145,14 @@ static void ipf_init1(ram_addr_t ram_size, int
vga_ram_size, int boot_device,
NICInfo *nd;
qemu_irq *cpu_irq;
qemu_irq *i8259;
+ int page_size;
+
+ page_size = getpagesize();
+ if(page_size != TARGET_PAGE_SIZE) {
+ fprintf(stderr,"Error! Host page size != qemu target
page size,\
+ you may need to change TARGET_PAGE_BITS in
qemu!!\n");
+ exit(-1);
+ }

if (ram_size >= 0xc0000000 ) {
above_4g_mem_size = ram_size - 0xc0000000;
--
1.5.2

[-- Attachment #2: 0001-kvm-qemu-Check-page-size-at-initialization-time.patch --]
[-- Type: application/octet-stream, Size: 1252 bytes --]

From 54340b17eb042b484652b9f5292ad193bdb02e65 Mon Sep 17 00:00:00 2001
From: Zhang Xiantao <xiantao.zhang@intel.com>
Date: Tue, 11 Dec 2007 18:54:27 +0800
Subject: [PATCH] kvm: qemu: Check page size at initialization time.

Currently, we assume Qemu target page size = HOST page
size, this patch check them. if not equal, print error
info and exit.
Signed-off-by: Zhang Xiantao <xiantao.zhang@intel.com>
---
qemu/hw/ipf.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/qemu/hw/ipf.c b/qemu/hw/ipf.c
index 012073d..9466707 100644
--- a/qemu/hw/ipf.c
+++ b/qemu/hw/ipf.c
@@ -27,6 +27,8 @@
#include "vl.h"
#include "firmware.h"
#include "ia64intrin.h"
+#include <unistd.h>
+
#ifdef USE_KVM
#include "qemu-kvm.h"
extern int kvm_allowed;
@@ -143,6 +145,14 @@ static void ipf_init1(ram_addr_t ram_size, int vga_ram_size, int boot_device,
NICInfo *nd;
qemu_irq *cpu_irq;
qemu_irq *i8259;
+ int page_size;
+
+ page_size = getpagesize();
+ if(page_size != TARGET_PAGE_SIZE) {
+ fprintf(stderr,"Error! Host page size != qemu target page size,\
+ you may need to change TARGET_PAGE_BITS in qemu!!\n");
+ exit(-1);
+ }

if (ram_size >= 0xc0000000 ) {
above_4g_mem_size = ram_size - 0xc0000000;
--
1.5.2

[-- Attachment #3: Type: text/plain, Size: 277 bytes --]

-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php

[-- Attachment #4: Type: text/plain, Size: 186 bytes --]

_______________________________________________
kvm-devel mailing list
kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org