From patchwork Fri Sep 20 09:31:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 174122 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp2244107ill; Fri, 20 Sep 2019 02:33:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqwjF8QCLqJEDdYN0bm4EV8nos4JhOZA6vkc4yoT3j6WSDI5+hgiyuOP7vkKvjTECad6/rNA X-Received: by 2002:a5e:aa09:: with SMTP id s9mr7592847ioe.22.1568971996475; Fri, 20 Sep 2019 02:33:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568971996; cv=none; d=google.com; s=arc-20160816; b=Arfod/qbX8VTJuEyLpuzPJ2NCTzSQHz/UF+fiR8LiUzMJUwt0H0BkF1/pn9ibD8zhe M/Stz8/11CJUfRcBqmVlzSoFKS4topr+flfeea9kIF8frq34+bwt5liZKMNWF69wpgqo ReXOx+BAW9dVec2twqaeSzkkdDPrRkZ3gNath/jXcEd+GojoqFfTaAopiEviPIU3lv4+ YlNK0di8euviYATgfts46ankIzEhCZhW0AS63TT+Zinx74CuFs91zZxV4DieJIJL4m4a MSgjJZWcc1pR3YgEoS2vqdrT1sK7n9KfZHP6zK3XnCbw/0JhffICc0WqaU5imvYLl+NP DeOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:message-id:date:to:from; bh=pAEqRNJW2EzUwiAsxesbNw82IiAYjvlrZTB2qmQ9FCk=; b=zmv3H4wqKhhfUcBqrWZ5vh5K+TUEZPc+QXwh4ySKvFTtQnO8e/zJbhKtGbPtc8Tg9C dmgXocxQEY155doqqoJfV1ce7p3CdLKuTKLZkyA3dHOmpfnvdFphrqduLOFDF3859dwi GiZ5FJeuAcRXfTeavULwU7DMKAw64rIwGyOg9f61SfpreFL/iUUprHikxqYIgD3TZaH3 7tm5a/AyU/3r+AuJ5QRsjU2jqGehEifKs4K3aq0m+RU2FmsjAWNMadFRucZQY/qr2rUQ e3yWC73q3sa7AvyQZ2uxkwqJZhRHqyo4eeLV2tIZp3tSteqfuew3sXDdoZkwQqBp4kwv wRnw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id o5si2879103ioo.37.2019.09.20.02.33.16 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Sep 2019 02:33:16 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iBFGT-0002Cq-FD; Fri, 20 Sep 2019 09:31:45 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iBFGR-0002Cg-O1 for xen-devel@lists.xenproject.org; Fri, 20 Sep 2019 09:31:43 +0000 X-Inumbo-ID: 730ac83d-db89-11e9-9686-12813bfff9fa Received: from foss.arm.com (unknown [217.140.110.172]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTP id 730ac83d-db89-11e9-9686-12813bfff9fa; Fri, 20 Sep 2019 09:31:40 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id BC43E337; Fri, 20 Sep 2019 02:31:39 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.196.50]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id EDF553F575; Fri, 20 Sep 2019 02:31:38 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Fri, 20 Sep 2019 10:31:30 +0100 Message-Id: <20190920093130.11842-1-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 Subject: [Xen-devel] [PATCH for-4.13 v2] xen/arm32: setup: Give a xenheap page to the boot allocator X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Julien Grall , Stefano Stabellini , Volodymyr Babchuk , Jan Beulich MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" After commit 6e3e771203 "xen/arm: setup: Relocate the Device-Tree later on in the boot", the boot allocator will not receive any xenheap page (i.e. mapped page) on Arm32. However, the boot allocator implicitely rely on having the first page already mapped and therefore result to break boot on Arm32. The easiest way for now is to give a xenheap page to the boot allocator. We may want to rethink the interface in the future. Fixes: 6e3e771203 ('xen/arm: setup: Relocate the Device-Tree later on in the boot') Signed-off-by: Julien Grall Reviewed-by: Jan Beulich Reviewed-by: Stefano Stabellini --- Changes in v2: - Add Jan's reviewed-by - Use boot_mfn_start rather than boot_mfn_end when giving xenheap pages. --- xen/arch/arm/setup.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c index 581b262655..fca7e68cba 100644 --- a/xen/arch/arm/setup.c +++ b/xen/arch/arm/setup.c @@ -593,6 +593,7 @@ static void __init setup_mm(void) unsigned long heap_pages, xenheap_pages, domheap_pages; int i; const uint32_t ctr = READ_CP32(CTR); + mfn_t boot_mfn_start, boot_mfn_end; if ( !bootinfo.mem.nr_banks ) panic("No memory bank\n"); @@ -665,6 +666,11 @@ static void __init setup_mm(void) setup_xenheap_mappings((e >> PAGE_SHIFT) - xenheap_pages, xenheap_pages); + /* We need a single mapped page for populating bootmem_region_list. */ + boot_mfn_start = mfn_add(xenheap_mfn_end, -1); + boot_mfn_end = xenheap_mfn_end; + init_boot_pages(mfn_to_maddr(boot_mfn_start), mfn_to_maddr(boot_mfn_end)); + /* Add non-xenheap memory */ for ( i = 0; i < bootinfo.mem.nr_banks; i++ ) { @@ -710,7 +716,7 @@ static void __init setup_mm(void) /* Add xenheap memory that was not already added to the boot allocator. */ init_xenheap_pages(mfn_to_maddr(xenheap_mfn_start), - mfn_to_maddr(xenheap_mfn_end)); + mfn_to_maddr(boot_mfn_start)); } #else /* CONFIG_ARM_64 */ static void __init setup_mm(void)