[edk2] [PATCH 0/5] ArmPkg et al: remove UncachedMemoryallocationLib

Ard Biesheuvel posted 5 patches 7 years, 4 months ago
Failed in applying to current master (apply log)
ArmPkg/ArmPkg.dec                                                          |   4 -
ArmPkg/ArmPkg.dsc                                                          |   2 -
ArmPkg/Include/Library/UncachedMemoryAllocationLib.h                       | 665 ------------------
ArmPkg/Library/ArmDmaLib/ArmDmaLib.c                                       |  42 +-
ArmPkg/Library/UncachedMemoryAllocationLib/UncachedMemoryAllocationLib.c   | 719 --------------------
ArmPkg/Library/UncachedMemoryAllocationLib/UncachedMemoryAllocationLib.inf |  50 --
BeagleBoardPkg/BeagleBoardPkg.dsc                                          |   2 -
EmbeddedPkg/Include/Library/DmaLib.h                                       |  30 +-
EmbeddedPkg/Library/NullDmaLib/NullDmaLib.c                                |  48 +-
Omap35xxPkg/Library/DebugAgentTimerLib/DebugAgentTimerLib.inf              |   1 +
Omap35xxPkg/Library/OmapDmaLib/OmapDmaLib.inf                              |   1 -
Omap35xxPkg/Omap35xxPkg.dsc                                                |   2 -
12 files changed, 112 insertions(+), 1454 deletions(-)
delete mode 100644 ArmPkg/Include/Library/UncachedMemoryAllocationLib.h
delete mode 100644 ArmPkg/Library/UncachedMemoryAllocationLib/UncachedMemoryAllocationLib.c
delete mode 100644 ArmPkg/Library/UncachedMemoryAllocationLib/UncachedMemoryAllocationLib.inf
[edk2] [PATCH 0/5] ArmPkg et al: remove UncachedMemoryallocationLib
Posted by Ard Biesheuvel 7 years, 4 months ago
This series is a followup to 'ArmPkg/ArmDmaLib: remove dependency on
UncachedMemoryAllocationLib' sent out yesterday, and removes library
entirely.

There are two reasons for this:
- UncachedMemoryAllocationLib is often abused by drivers that should
  be using DMA abstractions instead. It is up to the platform to decide
  whether DMA is cache coherent or not, and the fact that non-cache
  coherent DMA may be implemented using uncached allocations should remain
  an implementation detail of the DmaLib instance.

- The code is poorly maintained, only frees its allocations in the destructor,
  and misleads by exposing pool allocate/free entry points that are actually
  backed by page based allocations.

Patches #1 and #2 add a DmaAllocateAlignedBuffer() to DmaLib and both
its implementations. This is required for current users of
UncachedMemoryAllocationLib that rely on minimum alignment to be able
to switch the DmaLib.

Patches #3 and #4 remove a couple of stale references.

Patch #5 actually removes the library and its single remaining implementation.

Ard Biesheuvel (5):
  EmbeddedPkg/DmaLib: add routine to allocate aligned buffers
  ArmPkg/ArmDmaLib: implement DmaAllocateAlignedBuffer()
  BeagleBoardPkg: remove UncachedMemoryAllocationLib resolutions
  Omap35xxPkg: remove bogus UncachedMemoryAllocationLib dependency
  ArmPkg: remove UncachedMemoryAllocationLib

 ArmPkg/ArmPkg.dec                                                          |   4 -
 ArmPkg/ArmPkg.dsc                                                          |   2 -
 ArmPkg/Include/Library/UncachedMemoryAllocationLib.h                       | 665 ------------------
 ArmPkg/Library/ArmDmaLib/ArmDmaLib.c                                       |  42 +-
 ArmPkg/Library/UncachedMemoryAllocationLib/UncachedMemoryAllocationLib.c   | 719 --------------------
 ArmPkg/Library/UncachedMemoryAllocationLib/UncachedMemoryAllocationLib.inf |  50 --
 BeagleBoardPkg/BeagleBoardPkg.dsc                                          |   2 -
 EmbeddedPkg/Include/Library/DmaLib.h                                       |  30 +-
 EmbeddedPkg/Library/NullDmaLib/NullDmaLib.c                                |  48 +-
 Omap35xxPkg/Library/DebugAgentTimerLib/DebugAgentTimerLib.inf              |   1 +
 Omap35xxPkg/Library/OmapDmaLib/OmapDmaLib.inf                              |   1 -
 Omap35xxPkg/Omap35xxPkg.dsc                                                |   2 -
 12 files changed, 112 insertions(+), 1454 deletions(-)
 delete mode 100644 ArmPkg/Include/Library/UncachedMemoryAllocationLib.h
 delete mode 100644 ArmPkg/Library/UncachedMemoryAllocationLib/UncachedMemoryAllocationLib.c
 delete mode 100644 ArmPkg/Library/UncachedMemoryAllocationLib/UncachedMemoryAllocationLib.inf

-- 
2.11.0

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH 0/5] ArmPkg et al: remove UncachedMemoryallocationLib
Posted by Leif Lindholm 7 years, 3 months ago
On Fri, Aug 25, 2017 at 01:10:09PM +0100, Ard Biesheuvel wrote:
> This series is a followup to 'ArmPkg/ArmDmaLib: remove dependency on
> UncachedMemoryAllocationLib' sent out yesterday, and removes library
> entirely.
> 
> There are two reasons for this:
> - UncachedMemoryAllocationLib is often abused by drivers that should
>   be using DMA abstractions instead. It is up to the platform to decide
>   whether DMA is cache coherent or not, and the fact that non-cache
>   coherent DMA may be implemented using uncached allocations should remain
>   an implementation detail of the DmaLib instance.
> 
> - The code is poorly maintained, only frees its allocations in the destructor,
>   and misleads by exposing pool allocate/free entry points that are actually
>   backed by page based allocations.
> 
> Patches #1 and #2 add a DmaAllocateAlignedBuffer() to DmaLib and both
> its implementations. This is required for current users of
> UncachedMemoryAllocationLib that rely on minimum alignment to be able
> to switch the DmaLib.
> 
> Patches #3 and #4 remove a couple of stale references.
> 
> Patch #5 actually removes the library and its single remaining implementation.

For the series:
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>

However, this breaks a bunch of (edk2-)platforms: juno, fvp, tc2,
hikey and armada70x0. Is there a follow-on patch coming for those,
and could you hold off on pushing this series until that is ready?

Armada has the only non-bogus UncachedMemoryAllocationLib dependency,
the others are just trivial deletions.

/
    Leif

> Ard Biesheuvel (5):
>   EmbeddedPkg/DmaLib: add routine to allocate aligned buffers
>   ArmPkg/ArmDmaLib: implement DmaAllocateAlignedBuffer()
>   BeagleBoardPkg: remove UncachedMemoryAllocationLib resolutions
>   Omap35xxPkg: remove bogus UncachedMemoryAllocationLib dependency
>   ArmPkg: remove UncachedMemoryAllocationLib
> 
>  ArmPkg/ArmPkg.dec                                                          |   4 -
>  ArmPkg/ArmPkg.dsc                                                          |   2 -
>  ArmPkg/Include/Library/UncachedMemoryAllocationLib.h                       | 665 ------------------
>  ArmPkg/Library/ArmDmaLib/ArmDmaLib.c                                       |  42 +-
>  ArmPkg/Library/UncachedMemoryAllocationLib/UncachedMemoryAllocationLib.c   | 719 --------------------
>  ArmPkg/Library/UncachedMemoryAllocationLib/UncachedMemoryAllocationLib.inf |  50 --
>  BeagleBoardPkg/BeagleBoardPkg.dsc                                          |   2 -
>  EmbeddedPkg/Include/Library/DmaLib.h                                       |  30 +-
>  EmbeddedPkg/Library/NullDmaLib/NullDmaLib.c                                |  48 +-
>  Omap35xxPkg/Library/DebugAgentTimerLib/DebugAgentTimerLib.inf              |   1 +
>  Omap35xxPkg/Library/OmapDmaLib/OmapDmaLib.inf                              |   1 -
>  Omap35xxPkg/Omap35xxPkg.dsc                                                |   2 -
>  12 files changed, 112 insertions(+), 1454 deletions(-)
>  delete mode 100644 ArmPkg/Include/Library/UncachedMemoryAllocationLib.h
>  delete mode 100644 ArmPkg/Library/UncachedMemoryAllocationLib/UncachedMemoryAllocationLib.c
>  delete mode 100644 ArmPkg/Library/UncachedMemoryAllocationLib/UncachedMemoryAllocationLib.inf
> 
> -- 
> 2.11.0
> 
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH 0/5] ArmPkg et al: remove UncachedMemoryallocationLib
Posted by Ard Biesheuvel 7 years, 3 months ago
On 29 August 2017 at 16:44, Leif Lindholm <leif.lindholm@linaro.org> wrote:
> On Fri, Aug 25, 2017 at 01:10:09PM +0100, Ard Biesheuvel wrote:
>> This series is a followup to 'ArmPkg/ArmDmaLib: remove dependency on
>> UncachedMemoryAllocationLib' sent out yesterday, and removes library
>> entirely.
>>
>> There are two reasons for this:
>> - UncachedMemoryAllocationLib is often abused by drivers that should
>>   be using DMA abstractions instead. It is up to the platform to decide
>>   whether DMA is cache coherent or not, and the fact that non-cache
>>   coherent DMA may be implemented using uncached allocations should remain
>>   an implementation detail of the DmaLib instance.
>>
>> - The code is poorly maintained, only frees its allocations in the destructor,
>>   and misleads by exposing pool allocate/free entry points that are actually
>>   backed by page based allocations.
>>
>> Patches #1 and #2 add a DmaAllocateAlignedBuffer() to DmaLib and both
>> its implementations. This is required for current users of
>> UncachedMemoryAllocationLib that rely on minimum alignment to be able
>> to switch the DmaLib.
>>
>> Patches #3 and #4 remove a couple of stale references.
>>
>> Patch #5 actually removes the library and its single remaining implementation.
>
> For the series:
> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
>
> However, this breaks a bunch of (edk2-)platforms: juno, fvp, tc2,
> hikey and armada70x0. Is there a follow-on patch coming for those,
> and could you hold off on pushing this series until that is ready?
>
> Armada has the only non-bogus UncachedMemoryAllocationLib dependency,
> the others are just trivial deletions.
>

Yes. There are interdependencies between repos, so I will just merge
#1 and #2 and hold off with the rest until after all dependencies have
been removed.
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH 0/5] ArmPkg et al: remove UncachedMemoryallocationLib
Posted by Ard Biesheuvel 7 years, 3 months ago
On 29 August 2017 at 16:47, Ard Biesheuvel <ard.biesheuvel@linaro.org> wrote:
> On 29 August 2017 at 16:44, Leif Lindholm <leif.lindholm@linaro.org> wrote:
>> On Fri, Aug 25, 2017 at 01:10:09PM +0100, Ard Biesheuvel wrote:
>>> This series is a followup to 'ArmPkg/ArmDmaLib: remove dependency on
>>> UncachedMemoryAllocationLib' sent out yesterday, and removes library
>>> entirely.
>>>
>>> There are two reasons for this:
>>> - UncachedMemoryAllocationLib is often abused by drivers that should
>>>   be using DMA abstractions instead. It is up to the platform to decide
>>>   whether DMA is cache coherent or not, and the fact that non-cache
>>>   coherent DMA may be implemented using uncached allocations should remain
>>>   an implementation detail of the DmaLib instance.
>>>
>>> - The code is poorly maintained, only frees its allocations in the destructor,
>>>   and misleads by exposing pool allocate/free entry points that are actually
>>>   backed by page based allocations.
>>>
>>> Patches #1 and #2 add a DmaAllocateAlignedBuffer() to DmaLib and both
>>> its implementations. This is required for current users of
>>> UncachedMemoryAllocationLib that rely on minimum alignment to be able
>>> to switch the DmaLib.
>>>
>>> Patches #3 and #4 remove a couple of stale references.
>>>
>>> Patch #5 actually removes the library and its single remaining implementation.
>>
>> For the series:
>> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
>>
>> However, this breaks a bunch of (edk2-)platforms: juno, fvp, tc2,
>> hikey and armada70x0. Is there a follow-on patch coming for those,
>> and could you hold off on pushing this series until that is ready?
>>
>> Armada has the only non-bogus UncachedMemoryAllocationLib dependency,
>> the others are just trivial deletions.
>>
>
> Yes. There are interdependencies between repos, so I will just merge
> #1 and #2 and hold off with the rest until after all dependencies have
> been removed.


Patches #1 .. #4 pushed as

deef290f95e0 EmbeddedPkg/DmaLib: add routine to allocate aligned buffers
4b4104d87e28 ArmPkg/ArmDmaLib: implement DmaAllocateAlignedBuffer()
b56397ba9f67 BeagleBoardPkg: remove UncachedMemoryAllocationLib resolutions
c1d799b91509 Omap35xxPkg: remove bogus UncachedMemoryAllocationLib dependency

I will push the remaining patch that actually removes
UncachedMemoryAllocationLib once the dependencies are gone from
edk2-platforms.
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel