From nobody Fri Apr 19 19:31:13 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=1579044764; cv=none; d=zohomail.com; s=zohoarc; b=kvxIBKB0i0vDKJQwGwjKypEYeINm14ZNLa2uK2vwuuJHH3lSMrRrc9P+c2/WMbS/X2gvBLJYqfULk97A+A72kWws3FJtRTj64VIERAryGPpX7B4j9ypD8STTke5mx8k1/V/rEG4Ypf6iQRrW3QagCrrH12MQvOVBn1sxZbweylY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1579044764; 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=zkY6ZWrevgVjQCo1wQrbTbj+RkRmmLtseXP4adIC9P8=; b=CSmP65eS3FT8qUW7jB9FNwSsNb19VOxJuXE7Q0EWQJpZyT1dZs99WkCc1O4jt1h8nhz20YtCo9191rN12i7sEfkzR9ZJmv8R84zubhfHAcilYfuvVaRM+ulpGhLUUMhvEouWAgAvdsNsFV8X1wguhl/3iLmG6VoTKFfMpbL9VCI= 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 1579044764922997.1459663290029; Tue, 14 Jan 2020 15:32:44 -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 1irVfE-0006xh-23; Tue, 14 Jan 2020 23:32:00 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1irVfC-0006xb-7A for xen-devel@lists.xenproject.org; Tue, 14 Jan 2020 23:31:58 +0000 Received: from mail.kernel.org (unknown [198.145.29.99]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 0e3e1d5c-3726-11ea-b89f-bc764e2007e4; Tue, 14 Jan 2020 23:31:57 +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 146B924679; Tue, 14 Jan 2020 23:31:57 +0000 (UTC) X-Inumbo-ID: 0e3e1d5c-3726-11ea-b89f-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579044717; bh=4rf87aTkKhOyWrEcDfzAHBn6Y486BEPHFJPLZ/NZjd0=; h=From:To:Cc:Subject:Date:From; b=Gsv2SsH5XOfSqvietm/QWMg0nG/hKfk6coQTqsMav5bSvrukKJzPg/Grh+A8ZEZs9 Dgt2VTkHyN3YqlglciLrzUSRZIp/mlWNv9Qnsv9cvobCsmVnZZm4ef8GHcHx9sS+/e 3mplmyZ2bcjU+JBhspWpl/FkiFqPuZWepx8MDl04= From: Stefano Stabellini To: xen-devel@lists.xenproject.org Date: Tue, 14 Jan 2020 15:31:55 -0800 Message-Id: <20200114233155.26411-1-sstabellini@kernel.org> X-Mailer: git-send-email 2.17.1 Subject: [Xen-devel] [PATCH v2] 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 v5.5-rc6 and makes more memory reusable as normal memory by Xen (except that Linux also reuses EFI_PERSISTENT_MEMORY, which we do not). Specifically, this patch also reuses memory marked as EfiLoaderCode/Data, and it uses both Attribute and Type for the check (Attribute needs to be EFI_MEMORY_WB). Reported-by: Roman Shaposhnik Signed-off-by: Stefano Stabellini CC: Julien Grall Acked-by: Julien Grall --- Changes in v2: - improve commit message - do not allocate memory marked as EFI_PERSISTENT_MEMORY - do not change map_bs' behavior --- xen/arch/arm/efi/efi-boot.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/xen/arch/arm/efi/efi-boot.h b/xen/arch/arm/efi/efi-boot.h index d7bf934077..6527cb0bdf 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 || + (!map_bs && + (desc_ptr->Type =3D=3D EfiBootServicesCode || + desc_ptr->Type =3D=3D EfiBootServicesData))) ) { if ( !meminfo_add_bank(&bootinfo.mem, desc_ptr) ) { --=20 2.17.1 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel