]> git.baikalelectronics.ru Git - kernel.git/commit
spi: amd: Limit max transfer and message size
authorCristian Ciocaltea <cristian.ciocaltea@collabora.com>
Wed, 6 Jul 2022 10:06:22 +0000 (13:06 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 21 Jul 2022 19:24:16 +0000 (21:24 +0200)
commit36dff32c6d3a79d4c1520f72605162100ed43110
tree0f3c4aa99a40469ed517398f185207388d90f85f
parent9c9770b0898d8a391cae7d1ec8f3c95ab88a8df9
spi: amd: Limit max transfer and message size

[ Upstream commit b268b13fc002af5a180a237d443b335118a85f48 ]

Enabling the SPI CS35L41 audio codec driver for Steam Deck [1]
revealed a problem with the current AMD SPI controller driver
implementation, consisting of an unrecoverable system hang.

The issue can be prevented if we ensure the max transfer size
and the max message size do not exceed the FIFO buffer size.

According to the implementation of the downstream driver, the
AMD SPI controller is not able to handle more than 70 bytes per
transfer, which corresponds to the size of the FIFO buffer.

Hence, let's fix this by setting the SPI limits mentioned above.

[1] https://lore.kernel.org/r/20220621213819.262537-1-cristian.ciocaltea@collabora.com

Reported-by: Anastasios Vacharakis <vacharakis@o2mail.de>
Fixes: 3ddb9c4b0be3 ("spi: spi-amd: Add AMD SPI controller driver support")
Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
Link: https://lore.kernel.org/r/20220706100626.1234731-2-cristian.ciocaltea@collabora.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/spi/spi-amd.c