Received: by 2002:a05:7412:1e0b:b0:fc:a2b0:25d7 with SMTP id kr11csp760384rdb; Thu, 15 Feb 2024 14:58:21 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVkvimJJ/1AgY4VrfMVDqi/Bm816sMQpvbU1iPP2EOJroSgr1rHP5JYJi4pyV3UbfmO4Z6sPJYMRezlMjWaPNCQqbTvvU4GwCB9wttdDQ== X-Google-Smtp-Source: AGHT+IGTpi6nK524Y/ms6n90kxJOmS0USsOg/BAB7nozQBHMIrQqd1XtEGgb8CT3EHZOaBAuPq0V X-Received: by 2002:a17:90b:2308:b0:298:d43b:812e with SMTP id mt8-20020a17090b230800b00298d43b812emr3176165pjb.7.1708037901513; Thu, 15 Feb 2024 14:58:21 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708037901; cv=pass; d=google.com; s=arc-20160816; b=M5hG9PMBDr8+B6EQLYz+LQwMTHlNm4YC/MUwOkz+vIZfDP+x+jqt90eTWmANa2Wlx4 gTqLbljmeZmUlm5BbD8DuE3HKBvAZdqjp0iYXbKk5Lzh6ZV7M1kS5xhgDK+UPRdDbfnt 7kzUCgUF9pyzvQL1JFlwM+1pzbx6X+MaDER7IdI20Eg5I0XVrdQE0pyNsNMFXQqik/Zv lrCA8e/fpzdoMwnsbDTWm+g36n/ot/RGkeVYE0GC6U3nH00xz59XtIMPZ4Tbu4/E8iYu 55rgjJKEaGhbTE00vsmP7S4rQYkoMjEkf2veF/BKBd/Sa54QIt+shJv2UUkNUT3iKGOb hOcA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:feedback-id:dkim-signature; bh=MnyzlgyQvhJraZkrPcyEIJ8UMchFvRt/RNLWEzws5Fw=; fh=bGqi63n0YgNwmisFyCRtKduPf3AZd2vfaPLJGrhnZb8=; b=XDB18nwtOPltHat0KzclX3PtchYALjsnxw2FoLatgUbDpIf2yfWasYH1hDC3GKcdT2 kKfo3bCAuWWXejIAK2iKDAnsNlR+Qm4JPpzW21HLjKMAFHAZCoHsAQwRWFLPrQwwXysi 0YrjYPh8klw0ekdNdfUhTiPH3TVMySnvxkAL5wX+pK/NGJycSCmWEuMWNZUFg9frdAIA gHVXOK5gKuX7vTYsbud1M6Rypm8yOe6oiJEs51NKKCV35jdiQfN2/Ppd678H9XVU5oSw ot7C7G/P9XkrF0Mr/yenWH3x4wPVPuX9znepxr1hqeL42E+l9gn75FbrzqdRSf20TnTj KIGg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=kq5fy2yO; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-67786-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67786-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id ds22-20020a17090b08d600b00296e1a667d0si3710420pjb.78.2024.02.15.14.58.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 14:58:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-67786-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=kq5fy2yO; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-67786-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67786-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 13AC9B219A4 for ; Thu, 15 Feb 2024 22:51:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 805CC145325; Thu, 15 Feb 2024 22:51:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="kq5fy2yO" Received: from mail-ot1-f44.google.com (mail-ot1-f44.google.com [209.85.210.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2154913A86F; Thu, 15 Feb 2024 22:51:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.44 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708037494; cv=none; b=u028JKfnU2t4xTR8rA10ryIOGBb4pwnUnKL+RV919B+qhR88CD1CxxxbrqZ5zk13IDjpPloSAHXStpOgrEvYiEMMeIq0PHcGuGJ8QVhSHWH/EaRAxUfD2HnEu4Er8mu69tI551F5M9sDX0+u91xC6JXzl1g8eTpnzfOf33XIFyA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708037494; c=relaxed/simple; bh=6XhwMTtsLs0JIWiOr9upPSdCY8YQXot2QALVLFFVtTA=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=oh5mNOi42vKMfsR1dQRxsPwE8JLlvJsEPVs1cUuZWnI/1/LjloxGYLVFiqN10YP70i2fEPoBi7vuAFntM/btYSa85XcqUx8ufhCeXKBRCGO4vQ1DgJguVoqdcw5wKI7uliEmeEJo1ux2ak0V4Az0thp03P3KOvTh1CwfTt1rj2g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=kq5fy2yO; arc=none smtp.client-ip=209.85.210.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ot1-f44.google.com with SMTP id 46e09a7af769-6e42845298eso786875a34.2; Thu, 15 Feb 2024 14:51:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708037492; x=1708642292; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:feedback-id:from:to:cc:subject:date:message-id:reply-to; bh=MnyzlgyQvhJraZkrPcyEIJ8UMchFvRt/RNLWEzws5Fw=; b=kq5fy2yOa3ia9NZAOnabiWem340bFMUD9byZyRscSJq1edzIxOelnGLD44EUYnDZTS znrGgvGYL0DUBcWCeSbZmTzuRw//NpjM74xqAFTEJZTJktkiM5fPN0hTK3RvVQsYJc5+ jfLiHwhzVDd+XIl3wNp1C82hJbYd3DlCZE77ngqyEhjwnd3GI8SmMD7O9QMMakqA7xh6 WgFmaghh50pZU1s1mTbl9LFLmUntLlEePWFQnbzokfLwnvq9JZmPtdMtjUtku1FQ7qCJ g22VsLt/KA75ccZD6khQMeafWQ9i07+eOBYO83ODnEstAIQQVvhk45DKU1ewdXk6I/+h +XqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708037492; x=1708642292; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:feedback-id:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=MnyzlgyQvhJraZkrPcyEIJ8UMchFvRt/RNLWEzws5Fw=; b=xLAViVhoEYCZz6weBCmSdh50T8dR1V7OOSCPhw9RH1DpV19kai/NWmI7aG4AzKGEsX nYbzfKbIq+RF4WOteGePn75XEiYKn2YW6nNsQB20yz8VEdkXM77BwE/0cdN+lG48zpwY V2+iGAA1YXkFs9t5a2StgukmJLWSEKk6wht2yHTabDDaCwMIdLlm13uqCpSmMqVLFykc LlF86VEeZahbqG2pKHR690y8VQWpHWt4MGCKmKj9JO/t1cOrWLbCZC7CcOCm1Jwi7bJO lO4V+CXYv3Lo2H7PkNiwhEDNdi55herSFNrT1suWHozfxEx8JSUsoTxsaNBqnWSuQ7M8 V1ig== X-Forwarded-Encrypted: i=1; AJvYcCUn4AyIh0ZOopMS3i1MVp20OqfRdd2Z3RR4wcQFNI1cdar5Vx+H1wEK5IkxGYrpLcAebbRki/zDQ+km5mp7HTvBV9vzoruSNeWR39KOMe0vjFyJxdseHs4Y11k+/3WxpoekaB5i5jqNjVYio80vh+4ylaYq8fRwy++KSfEw2yvt X-Gm-Message-State: AOJu0Yxuaar00NG0bzvQXMtDsX2roolz7b6PImZvJmHIehfKDYyVPWmq 4caeBNUjVsNWQrav7b9zpWzZTTsECSIst958z4jAQf6hmddKiDyT X-Received: by 2002:a05:6830:12cf:b0:6e4:2202:ff9f with SMTP id a15-20020a05683012cf00b006e42202ff9fmr3142170otq.17.1708037491957; Thu, 15 Feb 2024 14:51:31 -0800 (PST) Received: from fauth1-smtp.messagingengine.com (fauth1-smtp.messagingengine.com. [103.168.172.200]) by smtp.gmail.com with ESMTPSA id 11-20020ac8590b000000b0042c80eb0d79sm992012qty.52.2024.02.15.14.51.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 14:51:31 -0800 (PST) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailfauth.nyi.internal (Postfix) with ESMTP id E339B1200043; Thu, 15 Feb 2024 17:51:30 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Thu, 15 Feb 2024 17:51:30 -0500 X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrvddugddtgecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvfevufffkffoggfgsedtkeertdertddtnecuhfhrohhmpeeuohhquhhnucfh vghnghcuoegsohhquhhnrdhfvghnghesghhmrghilhdrtghomheqnecuggftrfgrthhtvg hrnhepgfetfffhheejgedtudeiffduteefhefggedujeduhfeifefgiefgveeuudeludff necuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepsghoqh hunhdomhgvshhmthhprghuthhhphgvrhhsohhnrghlihhthidqieelvdeghedtieegqddu jeejkeehheehvddqsghoqhhunhdrfhgvnhhgpeepghhmrghilhdrtghomhesfhhigihmvg drnhgrmhgv X-ME-Proxy: Feedback-ID: iad51458e:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 15 Feb 2024 17:51:30 -0500 (EST) From: Boqun Feng To: linux-arm-kernel@vger.kernel.org Cc: Boqun Feng , stable@vger.kernel.org, Ard Biesheuvel , linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC] efi: Add ACPI_MEMORY_NVS into the linear map Date: Thu, 15 Feb 2024 14:51:06 -0800 Message-ID: <20240215225116.3435953-1-boqun.feng@gmail.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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