From mboxrd@z Thu Jan 1 00:00:00 1970 From: Olaf Hering Subject: Re: [PATCH] tools/hvmloader: move shared_info to reserved memory area Date: Fri, 26 Oct 2012 17:51:28 +0200 Message-ID: <20121026155128.GA18615@aepfle.de> References: <20121025114645.GA7218@aepfle.de> <20121026115817.GA27383@localhost.localdomain> <20121026140820.GA11453@aepfle.de> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <20121026140820.GA11453@aepfle.de> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Konrad Rzeszutek Wilk Cc: Keir Fraser , xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org On Fri, Oct 26, Olaf Hering wrote: > Oh, my take would be to return false in xen_hvm_platform if the > hypervisor is 3.3 or older, so that the guest does not use the PVonHVM > extensions. Like this untested patch: diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c index 0cc41f8..8566fa8 100644 --- a/arch/x86/xen/enlighten.c +++ b/arch/x86/xen/enlighten.c @@ -1543,17 +1543,10 @@ static void __init xen_hvm_init_shared_info(void) static void __init init_hvm_pv_info(void) { - int major, minor; uint32_t eax, ebx, ecx, edx, pages, msr, base; u64 pfn; base = xen_cpuid_base(); - cpuid(base + 1, &eax, &ebx, &ecx, &edx); - - major = eax >> 16; - minor = eax & 0xffff; - printk(KERN_INFO "Xen version %d.%d.\n", major, minor); - cpuid(base + 2, &pages, &msr, &ecx, &edx); pfn = __pa(hypercall_page); @@ -1604,13 +1597,29 @@ static void __init xen_hvm_guest_init(void) static bool __init xen_hvm_platform(void) { + int major, minor, old = 0; + uint32_t eax, ebx, ecx, edx, base; + bool usable = true; + if (xen_pv_domain()) return false; - if (!xen_cpuid_base()) + base = xen_cpuid_base(); + if (!base) return false; - return true; + cpuid(base + 1, &eax, &ebx, &ecx, &edx); + + major = eax >> 16; + minor = eax & 0xffff; + + /* Require at least Xen 3.4 */ + if (major < 3 || (major == 3 && minor < 4)) + usable = false; + printk(KERN_INFO "Xen version %d.%d.%s\n", + major, minor, usable ? "" : " (too old)"); + + return usable; } bool xen_hvm_need_lapic(void)