From: David Hildenbrand Subject: Re: [PATCH kvm-unit-tests] x86: setup: fixes to alloc_phys setup Date: Wed, 15 Nov 2017 11:26:23 +0100 Message-ID: References: <20171115082058.16576-1-pbonzini@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit To: Paolo Bonzini , kvm@vger.kernel.org Return-path: Received: from mx1.redhat.com ([209.132.183.28]:41398 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752323AbdKOK0Y (ORCPT ); Wed, 15 Nov 2017 05:26:24 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D648A76524 for ; Wed, 15 Nov 2017 10:26:24 +0000 (UTC) In-Reply-To: <20171115082058.16576-1-pbonzini@redhat.com> Content-Language: en-US Sender: kvm-owner@vger.kernel.org List-ID: On 15.11.2017 09:20, Paolo Bonzini wrote: > There were two thinkos in commit 937e239 ("x86: use alloc_phys", > 2017-11-02). > > First, alloc_phys is not initialized if there are no multiboot modules, > as is the case when invoking QEMU directly with a test kernel. > > Second, one "&" was missing, so the topmost memory address was passed > as the size to phys_alloc_init. > > Signed-off-by: Paolo Bonzini > --- > lib/x86/setup.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/lib/x86/setup.c b/lib/x86/setup.c > index f6a8ea8..ff7c8d3 100644 > --- a/lib/x86/setup.c > +++ b/lib/x86/setup.c > @@ -46,6 +46,10 @@ void setup_multiboot(struct mbi_bootinfo *bootinfo) > { > struct mbi_module *mods; > > + /* TODO: use e820 */ > + u64 end_of_memory = bootinfo->mem_upper * 1024ull; > + phys_alloc_init((uintptr_t) &edata, end_of_memory - (uintptr_t) &edata); > + > if (bootinfo->mods_count != 1) > return; > > @@ -53,10 +57,6 @@ void setup_multiboot(struct mbi_bootinfo *bootinfo) > > initrd = (char *)(uintptr_t) mods->start; > initrd_size = mods->end - mods->start; > - > - /* TODO: use e820 */ > - u64 end_of_memory = bootinfo->mem_upper * 1024ull; > - phys_alloc_init((uintptr_t) &edata, end_of_memory - (uintptr_t)edata); > } > > void setup_libcflat(void) > Looks good to me. (unfortunately had no time yet to review the original series) -- Thanks, David / dhildenb