From nobody Fri Apr 19 16:52:18 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+61614+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+61614+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1592935030; cv=none; d=zohomail.com; s=zohoarc; b=dJH0j8oIrkVn6Nnq4AMTyD5A5k3JPFrcsi11Y9NgliDtNJt061e93YYF1gMpeBh5pFKRZjBg5H6JcX1XVAKpN8Naf+0COlYCl0xFXHdMilewEw70r6p/eOCREFFDULbCbL32G/DkhXmwj81hRF3kKRmEy7ApWm7dXpLPmWXN5hA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592935030; h=Content-Transfer-Encoding:Cc:Date:From:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Sender:Subject:To; bh=kqVwmnUKpfBZaMq4J4RvivYySPF1NOZQ8JppTjGB6Ic=; b=EJNJHj3WeXPQBnJfRK8VMM9cWQTklLfPgdkpcM+pBlXod2e0ma3dX+A3bDfAqxZGt466yPGbfNJx1+Gzttlr/cVslIFi7eEv2vP7OpJYZlWFlQYSwIa9JYRUkbB8lwbI/+4kPPMuQpi1y60y+8lbWELPl88pZDjCIDfSOGac7jI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+61614+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1592935030140494.14508605793924; Tue, 23 Jun 2020 10:57:10 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id b6vVYY1788612xABE0iuLpnw; Tue, 23 Jun 2020 10:57:09 -0700 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web12.12830.1592935027754739135 for ; Tue, 23 Jun 2020 10:57:08 -0700 X-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 0A83631B; Tue, 23 Jun 2020 10:57:06 -0700 (PDT) X-Received: from localhost.localdomain (unknown [10.37.8.29]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E568B3F71E; Tue, 23 Jun 2020 10:57:04 -0700 (PDT) From: "Ard Biesheuvel" To: devel@edk2.groups.io Cc: lersek@redhat.com, philmd@redhat.com, Ard Biesheuvel Subject: [edk2-devel] [PATCH] ArmVirtPkg/NorFlashQemuLib: disable NOR flash DT nodes upon discovery Date: Tue, 23 Jun 2020 19:57:00 +0200 Message-Id: <20200623175700.1564281-1-ard.biesheuvel@arm.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,ard.biesheuvel@arm.com X-Gm-Message-State: RbHUAaYbHNiTynX36tPQ2N8Rx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1592935029; bh=CqXTHs5XuICF9IHpTCEqiCQexBB8069V2ERWA9dTgTk=; h=Cc:Date:From:Reply-To:Subject:To; b=IKKzR99LXOCd1tjgZxBYSvY/L/yTEjt+BB81dnSio6F8IXTKOJXeR6+WLTYHpZhMu+D qJYERhJtLZWIbSWr9Gwv1dSLZGWQvIk9cpd2a1JAhwLAFmIvYhFZ3yLMyc7wdDYk34r0f c9gB3zRliMdYOjBQdEHkFA0rZ+C56a4cy5Y= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" Our UEFI guest firmware takes ownership of the emulated NOR flash in order to support the variable runtime services, and it does not expect the OS to interfere with the underlying storage directly. So disable the NOR flash DT nodes as we discover them, in a way similar to how we disable the PL031 RTC in the device tree when we attach our RTC runtime driver to it. Signed-off-by: Ard Biesheuvel Reviewed-by: Laszlo Ersek Reviewed-by: Philippe Mathieu-Daude --- ArmVirtPkg/Library/NorFlashQemuLib/NorFlashQemuLib.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/ArmVirtPkg/Library/NorFlashQemuLib/NorFlashQemuLib.c b/ArmVirt= Pkg/Library/NorFlashQemuLib/NorFlashQemuLib.c index 9b1d1184bdd3..c676039785be 100644 --- a/ArmVirtPkg/Library/NorFlashQemuLib/NorFlashQemuLib.c +++ b/ArmVirtPkg/Library/NorFlashQemuLib/NorFlashQemuLib.c @@ -86,6 +86,18 @@ NorFlashPlatformGetDevices ( mNorFlashDevices[Num].BlockSize =3D QEMU_NOR_BLOCK_SIZE; Num++; } + + // + // UEFI takes ownership of the NOR flash, and exposes its functionality + // through the UEFI Runtime Services GetVariable, SetVariable, etc. Th= is + // means we need to disable it in the device tree to prevent the OS fr= om + // attaching its device driver as well. + // + Status =3D FdtClient->SetNodeProperty (FdtClient, Node, "status", + "disabled", sizeof ("disabled")); + if (EFI_ERROR (Status)) { + DEBUG ((EFI_D_WARN, "Failed to set NOR flash status to 'disabled'\= n")); + } } =20 *NorFlashDescriptions =3D mNorFlashDevices; --=20 2.27.0 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#61614): https://edk2.groups.io/g/devel/message/61614 Mute This Topic: https://groups.io/mt/75065345/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-