From: David Hildenbrand Subject: Re: [PATCH kvm-unit-tests v3 07/11] s390x: initialize the physical allocator Date: Wed, 14 Feb 2018 13:22:07 +0100 Message-ID: <9ffeff5d-e49a-3682-41dc-f9ce1c13eded@redhat.com> References: <20180213162321.20522-1-david@redhat.com> <20180213162321.20522-8-david@redhat.com> <06f28f10-4889-c87b-5d8e-7f222feda99f@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: Paolo Bonzini , =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= , Cornelia Huck , Christian Borntraeger To: Thomas Huth , kvm@vger.kernel.org Return-path: Received: from mx3-rdu2.redhat.com ([66.187.233.73]:45732 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754615AbeBNMWJ (ORCPT ); Wed, 14 Feb 2018 07:22:09 -0500 In-Reply-To: <06f28f10-4889-c87b-5d8e-7f222feda99f@redhat.com> Content-Language: en-US Sender: kvm-owner@vger.kernel.org List-ID: On 14.02.2018 13:05, Thomas Huth wrote: > On 13.02.2018 17:23, David Hildenbrand wrote: >> We now have the range of free memory, let's initialize the physical >> allocator. It is now possible to use use malloc and memalign, based on the >> early-ops. alloc_pages() cannot be used yet (as it has to be initialized >> via free_pages() - e.g. via setup_vm() - first) >> >> Signed-off-by: David Hildenbrand >> --- >> lib/s390x/sclp.c | 12 ++++++++++++ >> s390x/Makefile | 3 +++ >> 2 files changed, 15 insertions(+) >> >> diff --git a/lib/s390x/sclp.c b/lib/s390x/sclp.c >> index 199405c..c7471b1 100644 >> --- a/lib/s390x/sclp.c >> +++ b/lib/s390x/sclp.c >> @@ -15,11 +15,21 @@ >> #include >> #include >> #include "sclp.h" >> +#include >> + >> +extern unsigned long stacktop; >> >> static uint64_t storage_increment_size; >> static uint64_t max_ram_size; >> static uint64_t ram_size; >> >> +static void mem_init(phys_addr_t mem_end) >> +{ >> + phys_addr_t freemem_start = (phys_addr_t)&stacktop & PAGE_MASK; > > Should be ok since stacktop should be aligned. Otherwise this should > maybe better be (stacktop + PAGE_SIZE - 1) & PAGE_MASK ? > Either that or drop the "& PAGE_MASK". But guess this doesn't really make a difference right now. Thanks! > Thomas > -- Thanks, David / dhildenb