From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 68289C4829E for ; Thu, 15 Feb 2024 22:53:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=yvGmF8ckNMPWxFEdlE1Kic3MgrpnVSGLHNI3uscg8Ho=; b=g3pp70YZtz451L 734ugABlq2LgTd7DmA2Wh0n9KkAFa5p9ks2eNxIEX3Zz0rR7VOBW7d+kNzrJ6Ntq5wS1UuYG2lx0f 7eNDoIB3+qi7yvml//MnRQB6YO1KCzcAAwk/v/1+4Xhf//lsVPX3nb7UeaMreBwx41Gm0naF2OKlr siLA0a+mwfseRjK738fc3M2kU08axPlUJQTNgL3wRZAXDlfJs3/x36BFFLFO7Fn1fe358ZjHP+p8f BCDwLYeVYVzaDM5hufk27+D1WeGE+Xz88asnQajK3NUFHBD+tTwU/KJJQYqD9K6hFSook/b/uzcBd nzfL48kswlJBhhsqj3oQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rakbr-00000000OJe-1Jfr; Thu, 15 Feb 2024 22:53:39 +0000 Received: from mail-qk1-x72a.google.com ([2607:f8b0:4864:20::72a]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rakbp-00000000OIQ-0Aun for linux-arm-kernel@lists.infradead.org; Thu, 15 Feb 2024 22:53:38 +0000 Received: by mail-qk1-x72a.google.com with SMTP id af79cd13be357-783f27300b1so3260485a.1 for ; Thu, 15 Feb 2024 14:53:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708037615; x=1708642415; darn=lists.infradead.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:feedback-id:from:to:cc:subject:date :message-id:reply-to; bh=3LGmj+4Ox8DNbnQHN45Al/A5FlWzwlLmvFimBSFQ88o=; b=D7eeSP38LfgoARcQJZfjsQj5zcu4UCkeBUo4zrp0p3b3ySBw53E/L1Tog4eASsEpCC 5Mgqz3P28WnKybnAuPdSvsMhKv1tp29KIFNnTFjawoEsVSZ+0TF9vT6bd9TbVsUTf+v+ 0K//o3Qw+sViCOARXTgo9kKHEhgrlPhrRNKv5Tg/d/5rE0cRPpqRPd2I5CkjTSqyJp/n h4hMmEiDzVoiKfH1YKQ744JuLRO456KJgfrQ/E2DNa7ZEeZJ3JJySIUZNGu4rstoKPmK qUbrPNVarq+FCQZUOAVqUlG6UMINqYlUovlMVKfpS98ZuA6eFkxPk2qhi3m8zTl1p0yM pXHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708037615; x=1708642415; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:feedback-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3LGmj+4Ox8DNbnQHN45Al/A5FlWzwlLmvFimBSFQ88o=; b=MEbbsuyDH1kuq2Sgh9/WKI7YwjEymSa5vHTZugpyl7iX7Hc2A4xnoi5KvptkYHTwAK StsiecGsd5gDGszgqwRe9otYI3bl+Gm/zARF9sQzdrrS4X9eSURQXxhO4sEgVrrKN7y7 uqCM8pCdcb5ZRHh2wpOLh/tB+Xdsc/BhSf8sJk1xhPwzL1vtsc5yGTAKxJd/+yTtq2xu lEV31i406P/XXxk64adbuTxfMfFbBDI1zHgVp2ElOyO5REkFaxusHsOUWx6eJfO5RfGp 1IFEes0aDm2fap5Nwx5kYLSQaeFvd3L2/Z1sitbX0I8NfFYkk1Trg1pCpZpS9CXsyzBu GRgA== X-Gm-Message-State: AOJu0Yw6KctZ4Ie+Z2yuRU8jnWw/d2iGbCSgNDXyI6X+Q4Xin2Zmt1Vl sOCPjLxv1ZaG+ZXliLi6N7zU1k6XWuEjXtEUTmMv8bhyCWA+3XGX X-Google-Smtp-Source: AGHT+IHynkdzBL+6w805/MNC3X+1JCGgVdnQ1SYu5l7m8zh13dbhAhq1No1F0QgY2V54D9ytwVyRJQ== X-Received: by 2002:a05:620a:491a:b0:787:2f14:553 with SMTP id vy26-20020a05620a491a00b007872f140553mr3219040qkn.18.1708037615202; Thu, 15 Feb 2024 14:53:35 -0800 (PST) Received: from fauth1-smtp.messagingengine.com (fauth1-smtp.messagingengine.com. [103.168.172.200]) by smtp.gmail.com with ESMTPSA id oq27-20020a05620a611b00b007873ee07d53sm249933qkn.3.2024.02.15.14.53.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 14:53:34 -0800 (PST) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailfauth.nyi.internal (Postfix) with ESMTP id 0D90A1200064; Thu, 15 Feb 2024 17:53:34 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Thu, 15 Feb 2024 17:53:34 -0500 X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrvddugddtgecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpeffhffvvefukfhfgggtuggjsehttdertddttddvnecuhfhrohhmpeeuohhquhhn ucfhvghnghcuoegsohhquhhnrdhfvghnghesghhmrghilhdrtghomheqnecuggftrfgrth htvghrnhephedugfduffffteeutddvheeuveelvdfhleelieevtdeguefhgeeuveeiudff iedvnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepsg hoqhhunhdomhgvshhmthhprghuthhhphgvrhhsohhnrghlihhthidqieelvdeghedtieeg qddujeejkeehheehvddqsghoqhhunhdrfhgvnhhgpeepghhmrghilhdrtghomhesfhhigi hmvgdrnhgrmhgv X-ME-Proxy: Feedback-ID: iad51458e:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 15 Feb 2024 17:53:32 -0500 (EST) Date: Thu, 15 Feb 2024 14:53:28 -0800 From: Boqun Feng To: linux-arm-kernel@lists.infradead.org Cc: stable@vger.kernel.org, Ard Biesheuvel , linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [RFC] efi: Add ACPI_MEMORY_NVS into the linear map Message-ID: References: <20240215225116.3435953-1-boqun.feng@gmail.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20240215225116.3435953-1-boqun.feng@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240215_145337_102958_F9229183 X-CRM114-Status: GOOD ( 27.76 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org (Cc the correct arm mailing list) On Thu, Feb 15, 2024 at 02:51:06PM -0800, Boqun Feng wrote: > Currently ACPI_MEMORY_NVS is omitted from the linear map, which causes > a trouble with the following firmware memory region setup: > > [..] efi: 0x0000dfd62000-0x0000dfd83fff [ACPI Reclaim|...] > [..] efi: 0x0000dfd84000-0x0000dfd87fff [ACPI Mem NVS|...] > > , on ARM64 with 64k page size, the whole 0x0000dfd80000-0x0000dfd8ffff > range will be omitted from the the linear map due to 64k round-up. And > a page fault happens when trying to access the ACPI_RECLAIM_MEMORY: > > [...] Unable to handle kernel paging request at virtual address ffff0000dfd80000 > > To fix this, add ACPI_MEMORY_NVS into the linear map. > > Signed-off-by: Boqun Feng > Cc: stable@vger.kernel.org # 5.15+ > --- > We hit this in an ARM64 Hyper-V VM when using 64k page size, although > this issue may also be fixed if the efi memory regions are all 64k > aligned, but I don't find this memory region setup is invalid per UEFI > spec, also I don't find that spec disallows ACPI_MEMORY_NVS to be mapped > in the OS linear map, but if there is any better way or I'm reading the > spec incorrectly, please let me know. > > It's Cced stable since 5.15 because that's when Hyper-V ARM64 support is > added, and Hyper-V is the only one that hits the problem so far. > > drivers/firmware/efi/efi-init.c | 9 +++++++-- > 1 file changed, 7 insertions(+), 2 deletions(-) > > diff --git a/drivers/firmware/efi/efi-init.c b/drivers/firmware/efi/efi-init.c > index a00e07b853f2..9a1b9bc66d50 100644 > --- a/drivers/firmware/efi/efi-init.c > +++ b/drivers/firmware/efi/efi-init.c > @@ -139,6 +139,7 @@ static __init int is_usable_memory(efi_memory_desc_t *md) > case EFI_LOADER_CODE: > case EFI_LOADER_DATA: > case EFI_ACPI_RECLAIM_MEMORY: > + case EFI_ACPI_MEMORY_NVS: > case EFI_BOOT_SERVICES_CODE: > case EFI_BOOT_SERVICES_DATA: > case EFI_CONVENTIONAL_MEMORY: > @@ -202,8 +203,12 @@ static __init void reserve_regions(void) > if (!is_usable_memory(md)) > memblock_mark_nomap(paddr, size); > > - /* keep ACPI reclaim memory intact for kexec etc. */ > - if (md->type == EFI_ACPI_RECLAIM_MEMORY) > + /* > + * keep ACPI reclaim and NVS memory and intact for kexec > + * etc. > + */ > + if (md->type == EFI_ACPI_RECLAIM_MEMORY || > + md->type == EFI_ACPI_MEMORY_NVS) > memblock_reserve(paddr, size); > } > } > -- > 2.43.0 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel