From nobody Thu Mar 28 22:49:16 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1578335249; cv=none; d=zohomail.com; s=zohoarc; b=eTcM/wsVK8GI3Yr1lcENXDMWa38gtJwnCKtKO1zZ3TbOHriaVhFzyuU27RuYLw/IRRnaoeg+Lrf4iCCcwHfNs/m7xiYxQiOV5mJUemcv2nm/wVlNU61EOX+Dit9uxn1zIKd4+3/rLMEna+kK3wO2a05H+yFo0K3zmLYjTbcTHtI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578335249; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=8f/+nUG4rr/GFJ5v31c6QNVhP6tG/Wll9wbFn0cFbzI=; b=NBmDWMHaj3TpDmYLHWwaLf3d5cc4quyADksySqzIeaGoI54qF0ChBsufV5rJm+XzDmosMpv621ERC/5rpIm6KNy80lFkzYKEJBdgU1DKBFNE7R+O8Qw56BjYAt67WobGMWv9KnkQ1os8/1r53OwZ0Ww2E1dhJN94GIMCQzsk/jk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1578335249497828.4016769432898; Mon, 6 Jan 2020 10:27:29 -0800 (PST) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ioX5L-0003Ub-Bh; Mon, 06 Jan 2020 18:26:39 +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 1ioX5K-0003UW-7H for xen-devel@lists.xenproject.org; Mon, 06 Jan 2020 18:26:38 +0000 Received: from mail.kernel.org (unknown [198.145.29.99]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 1301f952-30b2-11ea-ab4f-12813bfff9fa; Mon, 06 Jan 2020 18:26:37 +0000 (UTC) Received: from sstabellini-ThinkPad-T480s.xilinx.com (c-67-164-102-47.hsd1.ca.comcast.net [67.164.102.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C48BE24676; Mon, 6 Jan 2020 18:26:36 +0000 (UTC) X-Inumbo-ID: 1301f952-30b2-11ea-ab4f-12813bfff9fa DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578335197; bh=NWWARxEV0s1XHYVPLrIrR8mW8V3zRq/cCBu1IzVnN1c=; h=From:To:Cc:Subject:Date:From; b=UWiQQqbYNm6Mft5Mdp4ELqXpUhmHEMmOOVMABl7hwZlbZ+5yIgytvjkKRq5V3kvBD k2B19NwMbteQmwS1qsWQOR33GsZs3FKHBdCEbVHfKNTPk6kVFQ8sSX0XfXJx4UQQ7t VrqphWor6JaRUWhla4ipHzaUQiuvx/KvYQEqk8J4= From: Stefano Stabellini To: xen-devel@lists.xenproject.org Date: Mon, 6 Jan 2020 10:26:20 -0800 Message-Id: <20200106182620.19505-1-sstabellini@kernel.org> X-Mailer: git-send-email 2.17.1 Subject: [Xen-devel] [PATCH] xen/arm: during efi boot, improve the check for usable memory 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: sstabellini@kernel.org, Julien Grall , Stefano Stabellini MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) When booting via EFI, the EFI memory map has information about memory regions and their type. Improve the check for the type and attribute of each memory region to figure out whether it is usable memory or not. This patch brings the check on par with Linux and makes more memory reusable as normal memory by Xen. Reported-by: Roman Shaposhnik Signed-off-by: Stefano Stabellini CC: Julien Grall --- xen/arch/arm/efi/efi-boot.h | 11 +++++++---- xen/include/efi/efidef.h | 1 + 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/xen/arch/arm/efi/efi-boot.h b/xen/arch/arm/efi/efi-boot.h index d7bf934077..5d1d526d17 100644 --- a/xen/arch/arm/efi/efi-boot.h +++ b/xen/arch/arm/efi/efi-boot.h @@ -149,10 +149,13 @@ static EFI_STATUS __init efi_process_memory_map_booti= nfo(EFI_MEMORY_DESCRIPTOR * =20 for ( Index =3D 0; Index < (mmap_size / desc_size); Index++ ) { - if ( desc_ptr->Type =3D=3D EfiConventionalMemory || - (!map_bs && - (desc_ptr->Type =3D=3D EfiBootServicesCode || - desc_ptr->Type =3D=3D EfiBootServicesData)) ) + if ( desc_ptr->Attribute & EFI_MEMORY_WB && + (desc_ptr->Type =3D=3D EfiConventionalMemory || + desc_ptr->Type =3D=3D EfiLoaderCode || + desc_ptr->Type =3D=3D EfiLoaderData || + desc_ptr->Type =3D=3D EfiPersistentMemory || + desc_ptr->Type =3D=3D EfiBootServicesCode || + desc_ptr->Type =3D=3D EfiBootServicesData) ) { if ( !meminfo_add_bank(&bootinfo.mem, desc_ptr) ) { diff --git a/xen/include/efi/efidef.h b/xen/include/efi/efidef.h index 86a7e111bf..f46207840f 100644 --- a/xen/include/efi/efidef.h +++ b/xen/include/efi/efidef.h @@ -147,6 +147,7 @@ typedef enum { EfiMemoryMappedIO, EfiMemoryMappedIOPortSpace, EfiPalCode, + EfiPersistentMemory, EfiMaxMemoryType } EFI_MEMORY_TYPE; =20 --=20 2.17.1 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel