On 06/27/17 11:59, Zeng, Star wrote:
> Laszlo,
> 
> I got the point and I like the idea of wrapper function personally.
> Although we can clean up the UEFI drivers in EDK2 tree, but it is really hard 
> to evaluate the UEFI drivers in OPROM on add-on card.
> The patch did not just break OVMF, but also broke all real platforms we have 
> in hand (it's my fault that I did not catch the failure when reviewing 
> patch), the patch is so risky.

Can we perhaps add a FeaturePCD (default value: FALSE) and rework Amit's
patch to consider the PCD? I really like the idea of being true to the
UEFI spec.

In the edk2 tree we could rebase the affected drivers to the wrapper
function. And in OVMF (and in other in-tree emulation platforms), we
could set the FeaturePCD to TRUE.

It is possible to use OVMF with assigned physical PCI devices, but
people can easily rebuild OVMF themselves, with the FeaturePCD re-set to
FALSE. Users can also quickly report the exact cards / oproms that break
with the FeaturePCD set to TRUE.


If you think it's simply not worth the effort, I'm OK with that, but
then we should specify this behavior in the UEFI spec -- we'll need a
Mantis bug for that. IMO it's not great that so many UEFI_DRIVERs in the
wild depend on behavior that is expressly forbidden by the UEFI spec at
the moment. If we can't modify all those drivers, then we should adapt
the spec, so that it reflects reality.

I'm not going to suggest specific language for the UEFI spec right now.
But the wording could be based on the documentation of the wrapper
function that I'm working on now. I think I might post the patches just
for illustration.

Thanks,
Laszlo

> 
> 
> Thanks,
> Star
> -----Original Message-----
> From: Laszlo Ersek [mailto:ler...@redhat.com] 
> Sent: Tuesday, June 27, 2017 5:45 PM
> To: Zeng, Star <star.z...@intel.com>; Amit Kumar <amit...@samsung.com>; 
> edk2-devel@lists.01.org
> Cc: Tian, Feng <feng.t...@intel.com>; Gao, Liming <liming....@intel.com>; 
> Kinney, Michael D <michael.d.kin...@intel.com>; Gabriel L. Somlo (GMail) 
> <gso...@gmail.com>; Fan, Jeff <jeff....@intel.com>
> Subject: Re: [edk2] [PATCH V4] MdeModulePkg/DxeCore: Fixed Interface returned 
> by CoreOpenProtocol
> 
> Hi Star,
> 
> On 06/27/17 03:37, Zeng, Star wrote:
>> I have reverted this patch at fd220166c435479a81dfe8519c92abec9acf7d82 first.
> 
> Thanks for that. More comments below:
> 
>>
>>
>> Thanks,
>> Star
>> -----Original Message-----
>> From: Zeng, Star
>> Sent: Tuesday, June 27, 2017 8:53 AM
>> To: Laszlo Ersek <ler...@redhat.com>; Amit Kumar 
>> <amit...@samsung.com>; edk2-devel@lists.01.org
>> Cc: Tian, Feng <feng.t...@intel.com>; Gao, Liming 
>> <liming....@intel.com>; Kinney, Michael D 
>> <michael.d.kin...@intel.com>; Gabriel L. Somlo (GMail) 
>> <gso...@gmail.com>; Fan, Jeff <jeff....@intel.com>; Zeng, Star 
>> <star.z...@intel.com>
>> Subject: RE: [edk2] [PATCH V4] MdeModulePkg/DxeCore: Fixed Interface 
>> returned by CoreOpenProtocol
>>
>> Laszlo,
>>
>> I agree to revert this patch first since it breaks something.
>> Could you help do that with detailed revert log?
>>
>> Anyway, have you found any bug in this patch itself?
> 
> No, as I said, I think the patch has the right goal (it improves compliance 
> with the UEFI specification).
> 
> And, while I didn't personally review the patch, I trust your and Liming's 
> review on it.
> 
> The problem is not with the patch per se. The problem is that the patch 
> triggers an existing bug in many other drivers.
> 
> So the actual bugs are in those drivers that incorrectly expect
> OpenProtocol() to set Interface even when OpenProtocol() returns 
> EFI_ALREADY_STARTED.
> 
> The end result is that all these drivers should be fixed first (with separate 
> patches), before fixing OpenProtocol() itself.
> 
> I'll try to work a bit more on those drivers and discover how many there are 
> of them. Obviously I can't audit *all* drivers in the edk2 tree, just those 
> that break the OVMF boot process.
> 
> In fact, the newest idea I have is the following: I think I'll introduce an 
> OpenProtocol() wrapper function to UefiLib. This function should work 
> identically to OpenProtocol(), except when OpenProtocol() returns 
> EFI_ALREADY_STARTED. In that case, the wrapper function will repeat the exact 
> same OpenProtocol() call just with GET_PROTOCOL attribute, and set Interface 
> on output. This will restore and legitimize the OpenProtocol() behavior 
> expected by all those problematic drivers, without having to do intrusive 
> error handling in them.
> 
> Thanks,
> Laszlo
> 

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to