]> git.itanic.dy.fi Git - linux-stable/commit
net: ipa: DMA addresses are nicely aligned
authorAlex Elder <elder@linaro.org>
Sun, 28 Mar 2021 17:31:10 +0000 (12:31 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 28 Sep 2022 09:10:34 +0000 (11:10 +0200)
commit53b1715e283e91e0230ea217a612ee6790607b43
treef027837e5bf24dcf5944a9bf5957663f1867d0dd
parent48afea293a892e685b22d575393d5a4a662413b4
net: ipa: DMA addresses are nicely aligned

[ Upstream commit 19aaf72c0c7a26ab7ffc655a6d84da6a379f899b ]

A recent patch avoided doing 64-bit modulo operations by checking
the alignment of some DMA allocations using only the lower 32 bits
of the address.

David Laight pointed out (after the fix was committed) that DMA
allocations might already satisfy the alignment requirements.  And
he was right.

Remove the alignment checks that occur after DMA allocation requests,
and update comments to explain why the constraint is satisfied.  The
only place IPA_TABLE_ALIGN was used was to check the alignment; it is
therefore no longer needed, so get rid of it.

Add comments where GSI_RING_ELEMENT_SIZE and the tre_count and
event_count channel data fields are defined to make explicit they
are required to be powers of 2.

Revise a comment in gsi_trans_pool_init_dma(), taking into account
that dma_alloc_coherent() guarantees its result is aligned to a page
size (or order thereof).

Don't bother printing an error if a DMA allocation fails.

Suggested-by: David Laight <David.Laight@ACULAB.COM>
Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Stable-dep-of: cf412ec33325 ("net: ipa: properly limit modem routing table use")
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ipa/gsi.c
drivers/net/ipa/gsi_private.h
drivers/net/ipa/gsi_trans.c
drivers/net/ipa/ipa_data.h
drivers/net/ipa/ipa_table.c