From patchwork Thu Jan 10 10:34:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janosch Frank X-Patchwork-Id: 10755557 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 BED9491E for ; Thu, 10 Jan 2019 10:34:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AE6B1293AD for ; Thu, 10 Jan 2019 10:34:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A1FF529478; Thu, 10 Jan 2019 10:34:51 +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 554FD293AD for ; Thu, 10 Jan 2019 10:34:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728289AbfAJKeu (ORCPT ); Thu, 10 Jan 2019 05:34:50 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:51292 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727745AbfAJKeu (ORCPT ); Thu, 10 Jan 2019 05:34:50 -0500 Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id x0AAYEMg073681 for ; Thu, 10 Jan 2019 05:34:49 -0500 Received: from e06smtp01.uk.ibm.com (e06smtp01.uk.ibm.com [195.75.94.97]) by mx0a-001b2d01.pphosted.com with ESMTP id 2px2cpndf9-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 10 Jan 2019 05:34:48 -0500 Received: from localhost by e06smtp01.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 10 Jan 2019 10:34:46 -0000 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp01.uk.ibm.com (192.168.101.131) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Thu, 10 Jan 2019 10:34:44 -0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x0AAYiVS49610774 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 10 Jan 2019 10:34:44 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E3AA65204E; Thu, 10 Jan 2019 10:34:43 +0000 (GMT) Received: from s38lp20.lnxne.boe (unknown [9.145.49.69]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id 4956352052; Thu, 10 Jan 2019 10:34:43 +0000 (GMT) From: Janosch Frank To: kvm@vger.kernel.org Cc: linux-s390@vger.kernel.org, david@redhat.com, thuth@redhat.com Subject: [kvm-unit-tests PATCH] s390x: Initialize the physical allocator on mem init Date: Thu, 10 Jan 2019 11:34:24 +0100 X-Mailer: git-send-email 2.14.3 X-TM-AS-GCONF: 00 x-cbid: 19011010-4275-0000-0000-000002FD00A8 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19011010-4276-0000-0000-0000380B11CD Message-Id: <20190110103424.166061-1-frankja@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-01-10_04:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=3 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=714 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1901100087 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- lib/s390x/sclp.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/s390x/sclp.c b/lib/s390x/sclp.c index e14f25d..52be655 100644 --- a/lib/s390x/sclp.c +++ b/lib/s390x/sclp.c @@ -18,6 +18,7 @@ #include #include "sclp.h" #include +#include extern unsigned long stacktop; @@ -31,9 +32,17 @@ static struct spinlock sclp_lock; static void mem_init(phys_addr_t mem_end) { + phys_addr_t base, top; phys_addr_t freemem_start = (phys_addr_t)&stacktop; 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_setup_int(void)