Re: [PATCH v3 2/2] x86/PCI: sta2x11: use default DMA address translation

From: Borislav Petkov
Date: Wed Nov 13 2019 - 13:54:30 EST


On Thu, Nov 07, 2019 at 04:06:45PM +0100, Nicolas Saenz Julienne wrote:
> The devices found behind this PCIe chip have unusual DMA mapping
> constraints as there is an AMBA interconnect placed in between them and
> the different PCI endpoints. The offset between physical memory
> addresses and AMBA's view is provided by reading a PCI config register,
> which is saved and used whenever DMA mapping is needed.
>
> It turns out that this DMA setup can be represented by properly setting
> 'dma_pfn_offset', 'dma_bus_mask' and 'dma_mask' during the PCI device
> enable fixup. And ultimately allows us to get rid of this device's
> custom DMA functions.
>
> Aside from the code deletion and DMA setup, sta2x11_pdev_to_mapping() is
> moved to avoid warnings whenever CONFIG_PM is not enabled.
>
> Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@xxxxxxx>
> Reviewed-by: Christoph Hellwig <hch@xxxxxx>
>
> ---
>
> Changed since v1:
> - use variable to avoid recalculating AMBA's max address
> - remove x86's dma-direct.h as it's not longer needed
>
> arch/x86/Kconfig | 1 -
> arch/x86/include/asm/device.h | 3 -
> arch/x86/include/asm/dma-direct.h | 9 --
> arch/x86/pci/sta2x11-fixup.c | 135 ++++++------------------------
> 4 files changed, 26 insertions(+), 122 deletions(-)
> delete mode 100644 arch/x86/include/asm/dma-direct.h

Ok, I have only 2/2 in my mbox so in the future, when sending a whole
set, make sure you Cc everybody on all the patches so that people can
see the whole thing.

Then, I went and read back all the discussion about this cleanup and
how it is hard to test it because it is not in PCs but in automotive
installations...

Long story, short, I like patches with negative diffstats :) so I could
take it through tip unless Christoph has different plans for this.

Thx.

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette