public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [edk2-devel] [PATCH 1/1] EmbeddedPkg/NonCoherentIoMmuDxe: Make SetAttributes always succeed
@ 2024-03-12 15:17 Ard Biesheuvel via groups.io
  2024-03-12 16:38 ` Leif Lindholm
  0 siblings, 1 reply; 6+ messages in thread
From: Ard Biesheuvel via groups.io @ 2024-03-12 15:17 UTC (permalink / raw)
  To: devel; +Cc: jeremy.linton, quic_llindhol, abner.chang, Ard Biesheuvel

From: Ard Biesheuvel <ardb@kernel.org>

NonCoherentIoMmuSetAttribute() does nothing except return
EFI_UNSUPPORTED. This was fine when it was introduced, but now, the PCI
bus driver will fail a PCI I/O Map() operation if the SetAttributes
fails.

So return EFI_SUCCESS instead.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
---
This fixes a regression on Raspberry Pi4, which no longer boots.

 EmbeddedPkg/Drivers/NonCoherentIoMmuDxe/NonCoherentIoMmuDxe.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/EmbeddedPkg/Drivers/NonCoherentIoMmuDxe/NonCoherentIoMmuDxe.c b/EmbeddedPkg/Drivers/NonCoherentIoMmuDxe/NonCoherentIoMmuDxe.c
index 4e7a5698c162..f02a76a62ea8 100644
--- a/EmbeddedPkg/Drivers/NonCoherentIoMmuDxe/NonCoherentIoMmuDxe.c
+++ b/EmbeddedPkg/Drivers/NonCoherentIoMmuDxe/NonCoherentIoMmuDxe.c
@@ -70,7 +70,7 @@ NonCoherentIoMmuSetAttribute (
   IN UINT64                IoMmuAccess
   )
 {
-  return EFI_UNSUPPORTED;
+  return EFI_SUCCESS;
 }
 
 /**
-- 
2.44.0.278.ge034bb2e1d-goog



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#116688): https://edk2.groups.io/g/devel/message/116688
Mute This Topic: https://groups.io/mt/104886877/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [edk2-devel] [PATCH 1/1] EmbeddedPkg/NonCoherentIoMmuDxe: Make SetAttributes always succeed
  2024-03-12 15:17 [edk2-devel] [PATCH 1/1] EmbeddedPkg/NonCoherentIoMmuDxe: Make SetAttributes always succeed Ard Biesheuvel via groups.io
@ 2024-03-12 16:38 ` Leif Lindholm
  2024-03-12 16:50   ` Ard Biesheuvel
  0 siblings, 1 reply; 6+ messages in thread
From: Leif Lindholm @ 2024-03-12 16:38 UTC (permalink / raw)
  To: Ard Biesheuvel, devel; +Cc: jeremy.linton, abner.chang, Ard Biesheuvel

On 2024-03-12 08:17, Ard Biesheuvel wrote:
> From: Ard Biesheuvel <ardb@kernel.org>
> 
> NonCoherentIoMmuSetAttribute() does nothing except return
> EFI_UNSUPPORTED. This was fine when it was introduced, but now, the PCI
> bus driver will fail a PCI I/O Map() operation if the SetAttributes
> fails.
> 
> So return EFI_SUCCESS instead.

It's unclear to me why this change is safe (looking forward).
Does NonCoherentIoMmuDxe also imply no IoMmu actually exists?

/
     Leif

> Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
> ---
> This fixes a regression on Raspberry Pi4, which no longer boots.
> 
>   EmbeddedPkg/Drivers/NonCoherentIoMmuDxe/NonCoherentIoMmuDxe.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/EmbeddedPkg/Drivers/NonCoherentIoMmuDxe/NonCoherentIoMmuDxe.c b/EmbeddedPkg/Drivers/NonCoherentIoMmuDxe/NonCoherentIoMmuDxe.c
> index 4e7a5698c162..f02a76a62ea8 100644
> --- a/EmbeddedPkg/Drivers/NonCoherentIoMmuDxe/NonCoherentIoMmuDxe.c
> +++ b/EmbeddedPkg/Drivers/NonCoherentIoMmuDxe/NonCoherentIoMmuDxe.c
> @@ -70,7 +70,7 @@ NonCoherentIoMmuSetAttribute (
>     IN UINT64                IoMmuAccess
>     )
>   {
> -  return EFI_UNSUPPORTED;
> +  return EFI_SUCCESS;
>   }
>   
>   /**



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#116691): https://edk2.groups.io/g/devel/message/116691
Mute This Topic: https://groups.io/mt/104886877/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [edk2-devel] [PATCH 1/1] EmbeddedPkg/NonCoherentIoMmuDxe: Make SetAttributes always succeed
  2024-03-12 16:38 ` Leif Lindholm
@ 2024-03-12 16:50   ` Ard Biesheuvel
  2024-03-12 16:56     ` Leif Lindholm
  0 siblings, 1 reply; 6+ messages in thread
From: Ard Biesheuvel @ 2024-03-12 16:50 UTC (permalink / raw)
  To: Leif Lindholm; +Cc: devel, jeremy.linton, abner.chang

On Tue, 12 Mar 2024 at 17:38, Leif Lindholm <quic_llindhol@quicinc.com> wrote:
>
> On 2024-03-12 08:17, Ard Biesheuvel wrote:
> > From: Ard Biesheuvel <ardb@kernel.org>
> >
> > NonCoherentIoMmuSetAttribute() does nothing except return
> > EFI_UNSUPPORTED. This was fine when it was introduced, but now, the PCI
> > bus driver will fail a PCI I/O Map() operation if the SetAttributes
> > fails.
> >
> > So return EFI_SUCCESS instead.
>
> It's unclear to me why this change is safe (looking forward).
> Does NonCoherentIoMmuDxe also imply no IoMmu actually exists?
>

Basically. NonCoherentIoMmuDxe is just a vehicle to allow
NonCoherentDmaLib to be plugged into the PCI host bridge driver. It is
not intended to ever do anything more than that.


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#116693): https://edk2.groups.io/g/devel/message/116693
Mute This Topic: https://groups.io/mt/104886877/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [edk2-devel] [PATCH 1/1] EmbeddedPkg/NonCoherentIoMmuDxe: Make SetAttributes always succeed
  2024-03-12 16:50   ` Ard Biesheuvel
@ 2024-03-12 16:56     ` Leif Lindholm
  2024-03-12 16:58       ` Ard Biesheuvel
  0 siblings, 1 reply; 6+ messages in thread
From: Leif Lindholm @ 2024-03-12 16:56 UTC (permalink / raw)
  To: Ard Biesheuvel; +Cc: devel, jeremy.linton, abner.chang

On 2024-03-12 09:50, Ard Biesheuvel wrote:
> On Tue, 12 Mar 2024 at 17:38, Leif Lindholm <quic_llindhol@quicinc.com> wrote:
>>
>> On 2024-03-12 08:17, Ard Biesheuvel wrote:
>>> From: Ard Biesheuvel <ardb@kernel.org>
>>>
>>> NonCoherentIoMmuSetAttribute() does nothing except return
>>> EFI_UNSUPPORTED. This was fine when it was introduced, but now, the PCI
>>> bus driver will fail a PCI I/O Map() operation if the SetAttributes
>>> fails.
>>>
>>> So return EFI_SUCCESS instead.
>>
>> It's unclear to me why this change is safe (looking forward).
>> Does NonCoherentIoMmuDxe also imply no IoMmu actually exists?
>>
> 
> Basically. NonCoherentIoMmuDxe is just a vehicle to allow
> NonCoherentDmaLib to be plugged into the PCI host bridge driver. It is
> not intended to ever do anything more than that.

Not that it needs to happen for this
(Reviewed-by: Leif Lindholm <quic_llindhol@quicinc.com>)
but maybe we ought to consider renaming it then?
DummyIoMmuDxe?

/
     Leif



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#116695): https://edk2.groups.io/g/devel/message/116695
Mute This Topic: https://groups.io/mt/104886877/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [edk2-devel] [PATCH 1/1] EmbeddedPkg/NonCoherentIoMmuDxe: Make SetAttributes always succeed
  2024-03-12 16:56     ` Leif Lindholm
@ 2024-03-12 16:58       ` Ard Biesheuvel
  2024-03-12 17:14         ` Leif Lindholm
  0 siblings, 1 reply; 6+ messages in thread
From: Ard Biesheuvel @ 2024-03-12 16:58 UTC (permalink / raw)
  To: Leif Lindholm; +Cc: devel, jeremy.linton, abner.chang

On Tue, 12 Mar 2024 at 17:56, Leif Lindholm <quic_llindhol@quicinc.com> wrote:
>
> On 2024-03-12 09:50, Ard Biesheuvel wrote:
> > On Tue, 12 Mar 2024 at 17:38, Leif Lindholm <quic_llindhol@quicinc.com> wrote:
> >>
> >> On 2024-03-12 08:17, Ard Biesheuvel wrote:
> >>> From: Ard Biesheuvel <ardb@kernel.org>
> >>>
> >>> NonCoherentIoMmuSetAttribute() does nothing except return
> >>> EFI_UNSUPPORTED. This was fine when it was introduced, but now, the PCI
> >>> bus driver will fail a PCI I/O Map() operation if the SetAttributes
> >>> fails.
> >>>
> >>> So return EFI_SUCCESS instead.
> >>
> >> It's unclear to me why this change is safe (looking forward).
> >> Does NonCoherentIoMmuDxe also imply no IoMmu actually exists?
> >>
> >
> > Basically. NonCoherentIoMmuDxe is just a vehicle to allow
> > NonCoherentDmaLib to be plugged into the PCI host bridge driver. It is
> > not intended to ever do anything more than that.
>
> Not that it needs to happen for this
> (Reviewed-by: Leif Lindholm <quic_llindhol@quicinc.com>)
> but maybe we ought to consider renaming it then?
> DummyIoMmuDxe?
>

Fair point. Or PassThroughIoMmuDxe perhaps?


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#116696): https://edk2.groups.io/g/devel/message/116696
Mute This Topic: https://groups.io/mt/104886877/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [edk2-devel] [PATCH 1/1] EmbeddedPkg/NonCoherentIoMmuDxe: Make SetAttributes always succeed
  2024-03-12 16:58       ` Ard Biesheuvel
@ 2024-03-12 17:14         ` Leif Lindholm
  0 siblings, 0 replies; 6+ messages in thread
From: Leif Lindholm @ 2024-03-12 17:14 UTC (permalink / raw)
  To: Ard Biesheuvel; +Cc: devel, jeremy.linton, abner.chang

On 2024-03-12 09:58, Ard Biesheuvel wrote:
> On Tue, 12 Mar 2024 at 17:56, Leif Lindholm <quic_llindhol@quicinc.com> wrote:
>>
>> On 2024-03-12 09:50, Ard Biesheuvel wrote:
>>> On Tue, 12 Mar 2024 at 17:38, Leif Lindholm <quic_llindhol@quicinc.com> wrote:
>>>>
>>>> On 2024-03-12 08:17, Ard Biesheuvel wrote:
>>>>> From: Ard Biesheuvel <ardb@kernel.org>
>>>>>
>>>>> NonCoherentIoMmuSetAttribute() does nothing except return
>>>>> EFI_UNSUPPORTED. This was fine when it was introduced, but now, the PCI
>>>>> bus driver will fail a PCI I/O Map() operation if the SetAttributes
>>>>> fails.
>>>>>
>>>>> So return EFI_SUCCESS instead.
>>>>
>>>> It's unclear to me why this change is safe (looking forward).
>>>> Does NonCoherentIoMmuDxe also imply no IoMmu actually exists?
>>>>
>>>
>>> Basically. NonCoherentIoMmuDxe is just a vehicle to allow
>>> NonCoherentDmaLib to be plugged into the PCI host bridge driver. It is
>>> not intended to ever do anything more than that.
>>
>> Not that it needs to happen for this
>> (Reviewed-by: Leif Lindholm <quic_llindhol@quicinc.com>)
>> but maybe we ought to consider renaming it then?
>> DummyIoMmuDxe?
> 
> Fair point. Or PassThroughIoMmuDxe perhaps?

Works for me.
Or, hmm...
Is there a risk that sounds a bit like a driver that actively configures 
IoMmus into passthrough mode?

/
     Leif



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#116697): https://edk2.groups.io/g/devel/message/116697
Mute This Topic: https://groups.io/mt/104886877/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-03-12 17:14 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-12 15:17 [edk2-devel] [PATCH 1/1] EmbeddedPkg/NonCoherentIoMmuDxe: Make SetAttributes always succeed Ard Biesheuvel via groups.io
2024-03-12 16:38 ` Leif Lindholm
2024-03-12 16:50   ` Ard Biesheuvel
2024-03-12 16:56     ` Leif Lindholm
2024-03-12 16:58       ` Ard Biesheuvel
2024-03-12 17:14         ` Leif Lindholm

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox