From patchwork Mon Jan 21 10:45:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 10773549 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 112901575 for ; Mon, 21 Jan 2019 10:46:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 01BD429E32 for ; Mon, 21 Jan 2019 10:46:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E961629E35; Mon, 21 Jan 2019 10:46:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9C28329E32 for ; Mon, 21 Jan 2019 10:46:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727745AbfAUKqo (ORCPT ); Mon, 21 Jan 2019 05:46:44 -0500 Received: from mx1.redhat.com ([209.132.183.28]:60536 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727729AbfAUKqo (ORCPT ); Mon, 21 Jan 2019 05:46:44 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 644BB42BDD; Mon, 21 Jan 2019 10:46:44 +0000 (UTC) Received: from thuth.com (ovpn-116-152.ams2.redhat.com [10.36.116.152]) by smtp.corp.redhat.com (Postfix) with ESMTP id E625F6872B; Mon, 21 Jan 2019 10:46:39 +0000 (UTC) From: Thomas Huth To: kvm@vger.kernel.org, Paolo Bonzini , =?utf-8?b?UmFk?= =?utf-8?b?aW0gS3LEjW3DocWZ?= Cc: David Hildenbrand , Janosch Frank Subject: [kvm-unit-tests PULL 10/10] s390x: Initialize the physical allocator on mem init Date: Mon, 21 Jan 2019 11:45:55 +0100 Message-Id: <1548067555-15766-11-git-send-email-thuth@redhat.com> In-Reply-To: <1548067555-15766-1-git-send-email-thuth@redhat.com> References: <1548067555-15766-1-git-send-email-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Mon, 21 Jan 2019 10:46:44 +0000 (UTC) Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Janosch Frank The physical and virtual allocators can coexist, so we can initialize the former and allocate pages without breaking VM alloc. Signed-off-by: Janosch Frank Acked-by: David Hildenbrand Signed-off-by: Thomas Huth --- lib/s390x/sclp.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/s390x/sclp.c b/lib/s390x/sclp.c index 7f556e5..b60f7a4 100644 --- a/lib/s390x/sclp.c +++ b/lib/s390x/sclp.c @@ -16,6 +16,7 @@ #include #include "sclp.h" #include +#include extern unsigned long stacktop; @@ -28,8 +29,16 @@ char _sccb[PAGE_SIZE] __attribute__((__aligned__(4096))); static void mem_init(phys_addr_t mem_end) { phys_addr_t freemem_start = (phys_addr_t)&stacktop; + phys_addr_t base, top; phys_alloc_init(freemem_start, mem_end - freemem_start); + phys_alloc_get_unused(&base, &top); + base = (base + PAGE_SIZE - 1) & -PAGE_SIZE; + top = top & -PAGE_SIZE; + + /* Make the pages available to the physical allocator */ + free_pages((void *)(unsigned long)base, top - base); + page_alloc_ops_enable(); } static void sclp_read_scp_info(ReadInfo *ri, int length)