From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.groups.io with SMTP id smtpd.web08.26641.1660726435614323342 for ; Wed, 17 Aug 2022 01:53:56 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Hg0xViFn; spf=pass (domain: redhat.com, ip: 170.10.133.124, mailfrom: lersek@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1660726434; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OHLwbzhbCkvPTngzvoLBWaxUqkCxHrGhdcS98Ua8X3g=; b=Hg0xViFnm/4lYtybPa2TKAeIIzy0wHiosjo8JC8huoNhshJDH/COrGDfy4WxZzu7Y7oFiD uRCuYcjR01wHnTHH6eI8ykzskSQU3gfIMe6lH3URlylLoSqWc4AJpTvqe33JqqRx+jqY3e px03+wQaChtMh/Hl0Q4pq6KsN+3hk/0= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-124-uJoGLMeGNLeMMf7m7ThYCA-1; Wed, 17 Aug 2022 04:53:53 -0400 X-MC-Unique: uJoGLMeGNLeMMf7m7ThYCA-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5FD093C32207; Wed, 17 Aug 2022 08:53:33 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (unknown [10.39.193.174]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 78C84492CA6; Wed, 17 Aug 2022 08:53:31 +0000 (UTC) Subject: Re: [edk2-devel] [PATCH 1/2] OvmfPkg: Introduce NULL class library to inhibit driver load To: "Brian J. Johnson" , devel@edk2.groups.io, Ard Biesheuvel Cc: Yuan Yu , Gerd Hoffmann , Pawel Polawski , Oliver Steffen , Jiewen Yao References: <20220815094030.465587-1-ardb@kernel.org> <20220815094030.465587-2-ardb@kernel.org> <3cc22b45-149b-15c5-257d-347d1a13cd96@redhat.com> <8a033ba8-967e-002d-2d39-6d19273403d2@hpe.com> From: "Laszlo Ersek" Message-ID: <8c46d455-cd23-d24b-c91e-1ea6e877a80b@redhat.com> Date: Wed, 17 Aug 2022 10:53:29 +0200 MIME-Version: 1.0 In-Reply-To: <8a033ba8-967e-002d-2d39-6d19273403d2@hpe.com> X-Scanned-By: MIMEDefang 2.85 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit On 08/16/22 23:08, Brian J. Johnson wrote: > On 8/16/22 07:30, Laszlo Ersek wrote: >> On physical machines, I've seen firmware options for disabling the IP >> stack entirely; I wonder how those firmwares do it... > > I don't know how any physical machine handles that particular option. > But one approach would be to add a GUID to the depex of the module you > want to control, and install it only when you want the module to be > dispatched.  That's pretty straightforward, although it does result in > "Driver %g was discovered but not loaded!!" messages from > CoreDisplayDiscoveredNotDispatched() if sufficient debugging is enabled. Indeed, thanks for the reminder! ArmVirtPkg and OvmfPkg uses this pattern with several core drivers: PlatformHasIoMmuLib: - depex: gEdkiiIoMmuProtocolGuid OR gIoMmuAbsentProtocolGuid - hooked into: PciHostBridgeDxe PlatformHasAcpiLib: - depex: gEdkiiPlatformHasAcpiGuid - hooked into: AcpiTableDxe NvVarStoreFormattedLib: - depex: gEdkiiNvVarStoreFormattedGuid - hooked into: VariableRuntimeDxe >>From these, the first and third examples are not full matches, as the depexes injected via PlatformHasIoMmuLib and NvVarStoreFormattedLib are always supposed to be satisfied *eventually* -- the drivers that the dependencies are injected into are always required; the dependencies ensure some platform specific ordering requirements. But PlatformHasAcpiLib seems like a 100% match; it *is* meant to block AcpiTableDxe indefinitely, if the platform chooses so (dynamically). Thanks! Laszlo