From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id E23B48213E for ; Fri, 17 Feb 2017 14:48:54 -0800 (PST) Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6F1168553F; Fri, 17 Feb 2017 22:48:55 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-116-41.phx2.redhat.com [10.3.116.41]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1HMmsqM023565; Fri, 17 Feb 2017 17:48:54 -0500 To: Jordan Justen References: <20170216204137.30221-1-lersek@redhat.com> <20170216204137.30221-6-lersek@redhat.com> <148736674932.16600.18157429547029640715@jljusten-ivb> <183f0597-4a1f-c5aa-a687-a728415582e7@redhat.com> Cc: edk2-devel-01 From: Laszlo Ersek Message-ID: <82a88081-165f-bf58-c77e-942600e932d1@redhat.com> Date: Fri, 17 Feb 2017 23:48:52 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.1 MIME-Version: 1.0 In-Reply-To: <183f0597-4a1f-c5aa-a687-a728415582e7@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Fri, 17 Feb 2017 22:48:55 +0000 (UTC) Subject: Re: [PATCH 5/5] OvmfPkg/AcpiPlatformDxe: replay QEMU_LOADER_WRITE_POINTER commands at S3 X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Feb 2017 22:48:55 -0000 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit On 02/17/17 23:41, Laszlo Ersek wrote: [snip] > I briefly considered a QemuFwCfgLib API that lets the caller inquire > about DMA enablement, but it just doesn't feel right, and (considering > the above) it's not even useful. Later I would like to abstract away > this S3 boot script munging, from both this driver and SmmControl2Dxe, > but the interface is a hard nut: > > - SEC lib instance (exists only for x86): must return EFI_UNSUPPORTED > - PEI/DXE instance (exists only for x86): must be split into > - PEI only: returns EFI_UNSUPPORTED > - DXE only: > - returns EFI_UNSUPPORTED if S3 is disabled > - works if the protocol is available > - what does it do if the protocol is not available *yet*? > - can't use a DEPEX (whole client module won't load with S3 > disabled!) > - register protocol notify in constructor? then what? > - collect operations and write them to boot script at EndOfDxe? > - that always turns out to be a bad idea, due to unspecified > callback invocation order One thing I can imagine here is: simply push the dependency handling to the client module. If the protocol is not found, just return EFI_NOT_STARTED, and let the client module deal with that. The client can set its own DEPEX, or register a protocol notify as necessary. So I guess this could be solved after all, hopefully. Laszlo > - DXE only instance (exists for arm/aarch64 only): very different from > the x86 impl already (uses chunked MMIO at the bottom, not REP IO), > so unification with the above is hard > > While writing this patch, I was racking my brain for hours about this. I > think I must have restarted this patch three or four times just because > of that. > > Ultimately, it's the second driver where we use a meaningful boot script > fragment, and usually the third occurrence of a pattern is where the > generics start to emerge, and (hopefully) become a candidate for > factoring out. I dislike the repetitive and hard-to-read nature of the > opcode additions (hence the profuse comments above), but from the two > instances we can look at (SmmControl2Dxe and this patch), I couldn't > really abstract away a natural interface. > > I think it is a relatively big task anyway, deserving its own BZ (not to > be confused with the also separate BZ that I proposed for residual / > cleanup patches on top of this series, should you recommend such.) If > you felt inclined to research / prototype that, that would be huge... > > Thanks! > Laszlo > >> >> -Jordan