5.18.18-rc1 review
Subsystems (12)
Greg Kroah-Hartman
maintainerPATCH 606/1095 iio: adc: ltc2497: Fix alignment for DMA safety
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit 6ebf401d555ee1e75e779b865d38e171db0aa1f2 ]
____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition.
Update the comment to include 'may'.
--- drivers/iio/adc/ltc2497.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/adc/ltc2497.c +2 -2
@@ -20,10 +20,10 @@ struct ltc2497_driverdata {struct ltc2497core_driverdata common_ddata;struct i2c_client *client;/* -* DMA (thus cache coherency maintenance) requires the +* DMA (thus cache coherency maintenance) may require the * transfer buffers to live in their own cache lines. */ -__be32 buf____cacheline_aligned ; +__be32 buf__aligned(IIO_DMA_MINALIGN) ; }; static int ltc2497_result_and_measure(struct ltc2497core_driverdata *ddata,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 607/1095 iio: adc: max1027: Fix alignment for DMA safety
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit e754fb7e7a05e3838c9aa044b4114869dd0d1e17 ]
____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition.
--- drivers/iio/adc/max1027.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/adc/max1027.c +1 -1
@@ -272,7 +272,7 @@ struct max1027_state {struct mutex lock;struct completion complete; -u8 reg____cacheline_aligned ; +u8 reg__aligned(IIO_DMA_MINALIGN) ; };static int max1027_wait_eoc (struct iio_dev *indio_dev)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 608/1095 iio: adc: max11100: Fix alignment for DMA safety
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit 51f30d63145cc84cb8a8e0ec96f9a8b73e6b5448 ]
____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition.
Update the comment to include 'may'.
--- drivers/iio/adc/max11100.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/adc/max11100.c +2 -2
@@ -33,10 +33,10 @@ struct max11100_state {struct spi_device *spi;/* -* DMA (thus cache coherency maintenance) requires the +* DMA (thus cache coherency maintenance) may require the * transfer buffers to live in their own cache lines. */ -u8 buffer[3 ]____cacheline_aligned ; +u8 buffer[3 ]__aligned(IIO_DMA_MINALIGN) ; };static const struct iio_chan_spec max11100_channels[] = {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 609/1095 iio: adc: max1118: Fix alignment for DMA safety
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit f746ab0bac5b335b09143dcd01db6f9f26d0c9ec ]
____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition.
--- drivers/iio/adc/max1118.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/adc/max1118.c +1 -1
@@ -42,7 +42,7 @@ struct max1118 {s64 ts__aligned(8) ; } scan; -u8 data____cacheline_aligned ; +u8 data__aligned(IIO_DMA_MINALIGN) ; };#define MAX1118_CHANNEL (ch) \
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 610/1095 iio: adc: max1241: Fix alignment for DMA safety
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit 9d7019e43ee67a48cef63f8f23f002233064d390 ]
____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition.
--- drivers/iio/adc/max1241.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/adc/max1241.c +1 -1
@@ -26,7 +26,7 @@ struct max1241 {struct regulator *vref;struct gpio_desc *shutdown; -__be16 data____cacheline_aligned ; +__be16 data__aligned(IIO_DMA_MINALIGN) ; };static const struct iio_chan_spec max1241_channels[] = {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 611/1095 iio: adc: mcp320x: Fix alignment for DMA safety
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit e770f78036ce4327caf285873f4b20564a8b4f0f ]
____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition.
Worth noting the fixes tag refers to the same issue being observed on a platform that probably had only 64 byte cachelines.
--- drivers/iio/adc/mcp320x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/adc/mcp320x.c +1 -1
@@ -92,7 +92,7 @@ struct mcp320x {struct mutex lock;const struct mcp320x_chip_info *chip_info; -u8 tx_buf____cacheline_aligned ; +u8 tx_buf__aligned(IIO_DMA_MINALIGN) ;u8 rx_buf[4 ]; };
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 612/1095 iio: adc: ti-adc0832: Fix alignment for DMA safety
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit 1e6bb81c23a84a078736a0f2a52bd765863e94ed ]
____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition.
--- drivers/iio/adc/ti-adc0832.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/adc/ti-adc0832.c +1 -1
@@ -36,7 +36,7 @@ struct adc0832 {*/ u8 data[24 ]__aligned(8) ; -u8 tx_buf[2 ]____cacheline_aligned ; +u8 tx_buf[2 ]__aligned(IIO_DMA_MINALIGN) ;u8 rx_buf[2 ]; };
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 613/1095 iio: adc: ti-adc084s021: Fix alignment for DMA safety
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit bb102fd600d1d6c0020a4514197c0604c4a218d9 ]
____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition.
Update the comment to include 'may'.
--- drivers/iio/adc/ti-adc084s021.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/adc/ti-adc084s021.c +2 -2
@@ -32,10 +32,10 @@ struct adc084s021 {s64 ts__aligned(8) ; } scan;/* -* DMA (thus cache coherency maintenance) requires the +* DMA (thus cache coherency maintenance) may require the * transfer buffers to live in their own cache line. */ -u16 tx_buf[4 ]____cacheline_aligned ; +u16 tx_buf[4 ]__aligned(IIO_DMA_MINALIGN) ;__be16 rx_buf[5 ];/* First 16-bits are trash */ };
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 614/1095 iio: adc: ti-adc108s102: Fix alignment for DMA safety
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit 6909fe17888b66ea53ebb15640f82b97daa587a0 ]
____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition.
Dual fixes tags as two cases that were introduced in different patches. One of those patches is a fix however and likely to have been backported to stable kernels.
Note the second alignment marking is likely to be unnecessary, but is left for now to keep this fix simple.
--- drivers/iio/adc/ti-adc108s102.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/adc/ti-adc108s102.c +2 -2
@@ -77,8 +77,8 @@ struct adc108s102_state {* tx_buf: 8 channel read commands, plus 1 dummy command * rx_buf: 1 dummy response, 8 channel responses */ -__be16 rx_buf[9 ]____cacheline_aligned ; -__be16 tx_buf[9 ]____cacheline_aligned ; +__be16 rx_buf[9 ]__aligned(IIO_DMA_MINALIGN) ; +__be16 tx_buf[9 ]__aligned(IIO_DMA_MINALIGN) ; };#define ADC108S102_V_CHAN (index) \
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 615/1095 iio: adc: ti-adc12138: Fix alignment for DMA safety
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit 76890c3bce6003caf53b283c49a210280cb8ea33 ]
____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition.
--- drivers/iio/adc/ti-adc12138.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/adc/ti-adc12138.c +1 -1
@@ -55,7 +55,7 @@ struct adc12138 {*/ __be16 data[20 ]__aligned(8) ; -u8 tx_buf[2 ]____cacheline_aligned ; +u8 tx_buf[2 ]__aligned(IIO_DMA_MINALIGN) ;u8 rx_buf[2 ]; };
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 616/1095 iio: adc: ti-adc128s052: Fix alignment for DMA safety
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit 23c81e7a7e5204a08b553d07362d3082926663b8 ]
____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition.
--- drivers/iio/adc/ti-adc128s052.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/adc/ti-adc128s052.c +1 -1
@@ -29,7 +29,7 @@ struct adc128 {struct regulator *reg;struct mutex lock; -u8 buffer[2 ]____cacheline_aligned ; +u8 buffer[2 ]__aligned(IIO_DMA_MINALIGN) ; };static int adc128_adc_conversion (struct adc128 *adc,u8 channel)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 617/1095 iio: adc: ti-adc161s626: Fix alignment for DMA safety
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit 3a828f204a110dc9f253c4cf3c1103d00a0681da ]
____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition.
--- drivers/iio/adc/ti-adc161s626.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/adc/ti-adc161s626.c +1 -1
@@ -71,7 +71,7 @@ struct ti_adc_data {u8 read_size;u8 shift; -u8 buffer[16 ]____cacheline_aligned ; +u8 buffer[16 ]__aligned(IIO_DMA_MINALIGN) ; }; static int ti_adc_read_measurement(struct ti_adc_data *data,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 618/1095 iio: adc: ti-ads124s08: Fix alignment for DMA safety
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit 7df19bd26cc0b85ff997cc9e2aaea712836b5460 ]
____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition.
--- drivers/iio/adc/ti-ads124s08.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/adc/ti-ads124s08.c +1 -1
@@ -106,7 +106,7 @@ struct ads124s_private {* timestamp is maintained. */ u32 buffer[ADS124S08_MAX_CHANNELS +sizeof (s64)/sizeof (u32)]__aligned(8) ; -u8 data[5 ]____cacheline_aligned ; +u8 data[5 ]__aligned(IIO_DMA_MINALIGN) ; };#define ADS124S08_CHAN (index) \
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 619/1095 iio: adc: ti-ads131e08: Fix alignment for DMA safety
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit 55afdd050c063ae4b8dbd566107a030c00d005fd ]
____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition.
--- drivers/iio/adc/ti-ads131e08.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/adc/ti-ads131e08.c +1 -1
@@ -105,7 +105,7 @@ struct ads131e08_state {s64 ts__aligned(8) ; } tmp_buf; -u8 tx_buf[3 ]____cacheline_aligned ; +u8 tx_buf[3 ]__aligned(IIO_DMA_MINALIGN) ;/* * Add extra one padding byte to be able to access the last channel * value using u32 pointer
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 620/1095 iio: adc: ti-ads7950: Fix alignment for DMA safety
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit dd54ba8b2469f6ae665c529623a9454ce5293ca8 ]
____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition.
Update the comment to include 'may'.
--- drivers/iio/adc/ti-ads7950.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/adc/ti-ads7950.c +2 -2
@@ -102,11 +102,11 @@ struct ti_ads7950_state {unsigned int gpio_cmd_settings_bitmask;/* -* DMA (thus cache coherency maintenance) requires the +* DMA (thus cache coherency maintenance) may require the * transfer buffers to live in their own cache lines. */ u16 rx_buf[TI_ADS7950_MAX_CHAN +2 +TI_ADS7950_TIMESTAMP_SIZE ] -____cacheline_aligned ; +__aligned(IIO_DMA_MINALIGN) ;u16 tx_buf[TI_ADS7950_MAX_CHAN +2 ];u16 single_tx;u16 single_rx;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 621/1095 iio: adc: ti-ads8344: Fix alignment for DMA safety
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit 8966b11e5a14aaabc747ee97a7942fd50a681402 ]
____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition.
--- drivers/iio/adc/ti-ads8344.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/adc/ti-ads8344.c +1 -1
@@ -28,7 +28,7 @@ struct ads8344 {*/ struct mutex lock; -u8 tx_buf____cacheline_aligned ; +u8 tx_buf__aligned(IIO_DMA_MINALIGN) ;u8 rx_buf[3 ]; };
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 622/1095 iio: adc: ti-ads8688: Fix alignment for DMA safety
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit a2105d87eb8eb03591515df10102e04a1c9e0e46 ]
____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition.
--- drivers/iio/adc/ti-ads8688.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/adc/ti-ads8688.c +1 -1
@@ -71,7 +71,7 @@ struct ads8688_state {union {__be32 d32;u8 d8[4 ]; - } data[2 ]____cacheline_aligned ; + } data[2 ]__aligned(IIO_DMA_MINALIGN) ; };enum ads8688_id {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 623/1095 iio: adc: ti-tlc4541: Fix alignment for DMA safety
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit 62fa19bf484bfeb52c56b7c6d6a6b1222c597f9c ]
____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition.
Update the comment to include 'may'.
--- drivers/iio/adc/ti-tlc4541.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/adc/ti-tlc4541.c +2 -2
@@ -37,12 +37,12 @@ struct tlc4541_state {struct spi_message scan_single_msg;/* -* DMA (thus cache coherency maintenance) requires the +* DMA (thus cache coherency maintenance) may require the * transfer buffers to live in their own cache lines. * 2 bytes data + 6 bytes padding + 8 bytes timestamp when * call iio_push_to_buffers_with_timestamp. */ -__be16 rx_buf[8 ]____cacheline_aligned ; +__be16 rx_buf[8 ]__aligned(IIO_DMA_MINALIGN) ; };struct tlc4541_chip_info {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 624/1095 iio: addac: ad74413r: Fix alignment for DMA safety
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit 00eb2b8a077062557772234019ecd6045b8b6298 ]
____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition.
Update the comment to include 'may'.
--- drivers/iio/addac/ad74413r.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/addac/ad74413r.c +2 -2
@@ -77,13 +77,13 @@ struct ad74413r_state {struct spi_transfer adc_samples_xfer[AD74413R_CHANNEL_MAX +1 ];/* -* DMA (thus cache coherency maintenance) requires the +* DMA (thus cache coherency maintenance) may require the * transfer buffers to live in their own cache lines. */ struct {u8 rx_buf[AD74413R_FRAME_SIZE *AD74413R_CHANNEL_MAX ];s64 timestamp; - } adc_samples_buf____cacheline_aligned ; + } adc_samples_buf__aligned(IIO_DMA_MINALIGN) ;u8 adc_samples_tx_buf[AD74413R_FRAME_SIZE *AD74413R_CHANNEL_MAX ];u8 reg_tx_buf[AD74413R_FRAME_SIZE ];
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 625/1095 iio: amplifiers: ad8366: Fix alignment for DMA safety
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit 026bffa458d029a5f15ac3f82a9bb0f64aca403d ]
____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition.
Update the comment to include 'may'.
--- drivers/iio/amplifiers/ad8366.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/amplifiers/ad8366.c +2 -2
@@ -45,10 +45,10 @@ struct ad8366_state {enum ad8366_type type;struct ad8366_info *info;/* -* DMA (thus cache coherency maintenance) requires the +* DMA (thus cache coherency maintenance) may require the * transfer buffers to live in their own cache lines. */ -unsigned char data[2 ]____cacheline_aligned ; +unsigned char data[2 ]__aligned(IIO_DMA_MINALIGN) ; };static struct ad8366_info ad8366_infos[] = {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 626/1095 iio: common: ssp: Fix alignment for DMA safety
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit 314d2b1978bb3d20b1ec239f4e28c394da493f36 ]
____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition.
--- drivers/iio/common/ssp_sensors/ssp.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/iio/common/ssp_sensors/ssp.h +1 -2
@@ -221,8 +221,7 @@ struct ssp_data {struct iio_dev *sensor_devs[SSP_SENSOR_MAX ];atomic_t enable_refcount; -__le16 header_buffer[SSP_HEADER_BUFFER_SIZE /sizeof (__le16)] -____cacheline_aligned ; +__le16 header_buffer[SSP_HEADER_BUFFER_SIZE /sizeof (__le16)]__aligned(IIO_DMA_MINALIGN) ; };void ssp_clean_pending_list (struct ssp_data *data);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 627/1095 iio: dac: ad5064: Fix alignment for DMA safety
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit 8779b88c214fa0f8fdfb9c54a124f468884d356a ]
____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition.
Update the comment to include 'may'.
--- drivers/iio/dac/ad5064.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/dac/ad5064.c +2 -2
@@ -115,13 +115,13 @@ struct ad5064_state {struct mutex lock;/* -* DMA (thus cache coherency maintenance) requires the +* DMA (thus cache coherency maintenance) may require the * transfer buffers to live in their own cache lines. */ union {u8 i2c[3 ];__be32 spi; - } data____cacheline_aligned ; + } data__aligned(IIO_DMA_MINALIGN) ; };enum ad5064_type {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 628/1095 iio: dac: ad5360: Fix alignment for DMA safety
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit 94ec314e1bd686b669c24385ce2dbc967eb74147 ]
____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition.
Update the comment to include 'may'.
--- drivers/iio/dac/ad5360.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/dac/ad5360.c +2 -2
@@ -79,13 +79,13 @@ struct ad5360_state {struct mutex lock;/* -* DMA (thus cache coherency maintenance) requires the +* DMA (thus cache coherency maintenance) may require the * transfer buffers to live in their own cache lines. */ union {__be32 d32;u8 d8[4 ]; - } data[2 ]____cacheline_aligned ; + } data[2 ]__aligned(IIO_DMA_MINALIGN) ; };enum ad5360_type {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 629/1095 iio: dac: ad5421: Fix alignment for DMA safety
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit d2b240d3d31c66df4d2da54c75ff8e27a0e006c3 ]
____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition.
Update the comment to include 'may'.
--- drivers/iio/dac/ad5421.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/dac/ad5421.c +2 -2
@@ -72,13 +72,13 @@ struct ad5421_state {struct mutex lock;/* -* DMA (thus cache coherency maintenance) requires the +* DMA (thus cache coherency maintenance) may require the * transfer buffers to live in their own cache lines. */ union {__be32 d32;u8 d8[4 ]; - } data[2 ]____cacheline_aligned ; + } data[2 ]__aligned(IIO_DMA_MINALIGN) ; };static const struct iio_event_spec ad5421_current_event[] = {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 630/1095 iio: dac: ad5449: Fix alignment for DMA safety
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit 678d536bb454e3bbedcaa68208550ac9dc1cc066 ]
____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition.
Update the comment to include 'may'.
--- drivers/iio/dac/ad5449.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/dac/ad5449.c +2 -2
@@ -68,10 +68,10 @@ struct ad5449 {uint16_t dac_cache[AD5449_MAX_CHANNELS ];/* -* DMA (thus cache coherency maintenance) requires the +* DMA (thus cache coherency maintenance) may require the * transfer buffers to live in their own cache lines. */ -__be16 data[2 ]____cacheline_aligned ; +__be16 data[2 ]__aligned(IIO_DMA_MINALIGN) ; };enum ad5449_type {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 631/1095 iio: dac: ad5504: Fix alignment for DMA safety
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit 00b9737caa5aaed5cf45a7c7498edf5957efa3b2 ]
____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition.
--- drivers/iio/dac/ad5504.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/dac/ad5504.c +1 -1
@@ -54,7 +54,7 @@ struct ad5504_state {unsigned pwr_down_mask;unsigned pwr_down_mode; -__be16 data[2 ]____cacheline_aligned ; +__be16 data[2 ]__aligned(IIO_DMA_MINALIGN) ; };/*
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 632/1095 iio: dac: ad5592r: Fix alignment for DMA safety
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit 4a4a79c06caeec47003bcbee1cf3094479f26e24 ]
____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition.
--- drivers/iio/dac/ad5592r-base.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/iio/dac/ad5592r-base.h +3 -1
@@ -14,6 +14,8 @@#include <linux/mutex.h> #include <linux/gpio/driver.h> +#include <linux/iio/iio.h> +struct device ;struct ad5592r_state ;
@@ -65,7 +67,7 @@ struct ad5592r_state {u8 gpio_in;u8 gpio_val; -__be16 spi_msg____cacheline_aligned ; +__be16 spi_msg__aligned(IIO_DMA_MINALIGN) ;__be16 spi_msg_nop; };
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 633/1095 iio: dac: ad5686: Fix alignment for DMA safety
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit 444e38927d9af093de7cdc6afbb7afdc3485da2d ]
____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition.
Update the comment to include 'may'.
--- drivers/iio/dac/ad5686.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/iio/dac/ad5686.h +4 -2
@@ -13,6 +13,8 @@#include <linux/mutex.h> #include <linux/kernel.h> +#include <linux/iio/iio.h> +#define AD5310_CMD (x) ((x) << 12)#define AD5683_DATA (x) ((x) << 4)
@@ -137,7 +139,7 @@ struct ad5686_state {struct mutex lock;/* -* DMA (thus cache coherency maintenance) requires the +* DMA (thus cache coherency maintenance) may require the * transfer buffers to live in their own cache lines. */
@@ -145,7 +147,7 @@ struct ad5686_state {__be32 d32;__be16 d16;u8 d8[4 ]; - } data[3 ]____cacheline_aligned ; + } data[3 ]__aligned(IIO_DMA_MINALIGN) ; };
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 634/1095 iio: dac: ad5755: Fix alignment for DMA safety
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit d0c167ceff2d833ee493dd58164dc87bd36e48aa ]
____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition.
Update the comment to include 'may'.
--- drivers/iio/dac/ad5755.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/dac/ad5755.c +2 -2
@@ -189,14 +189,14 @@ struct ad5755_state {struct mutex lock;/* -* DMA (thus cache coherency maintenance) requires the +* DMA (thus cache coherency maintenance) may require the * transfer buffers to live in their own cache lines. */ union {__be32 d32;u8 d8[4 ]; - } data[2 ]____cacheline_aligned ; + } data[2 ]__aligned(IIO_DMA_MINALIGN) ; };enum ad5755_type {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 635/1095 iio: dac: ad5761: Fix alignment for DMA safety
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit 7d12a61187aed57863c41032acbc1fae516d6e49 ]
____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition.
Update the comment to include 'may'.
--- drivers/iio/dac/ad5761.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/dac/ad5761.c +2 -2
@@ -70,13 +70,13 @@ struct ad5761_state {enum ad5761_voltage_range range;/* -* DMA (thus cache coherency maintenance) requires the +* DMA (thus cache coherency maintenance) may require the * transfer buffers to live in their own cache lines. */ union {__be32 d32;u8 d8[4 ]; - } data[3 ]____cacheline_aligned ; + } data[3 ]__aligned(IIO_DMA_MINALIGN) ; };static const struct ad5761_range_params ad5761_range_params[] = {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 636/1095 iio: dac: ad5764: Fix alignment for DMA safety
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit b378722a3e9bb51318c0de7eeb4d71f2fcd6987f ]
____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition.
Update the comment to include 'may'.
--- drivers/iio/dac/ad5764.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/dac/ad5764.c +2 -2
@@ -56,13 +56,13 @@ struct ad5764_state {struct mutex lock;/* -* DMA (thus cache coherency maintenance) requires the +* DMA (thus cache coherency maintenance) may require the * transfer buffers to live in their own cache lines. */ union {__be32 d32;u8 d8[4 ]; - } data[2 ]____cacheline_aligned ; + } data[2 ]__aligned(IIO_DMA_MINALIGN) ; };enum ad5764_type {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 637/1095 iio: dac: ad5766: Fix alignment for DMA safety
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit c32be7f035ae430ba9c142b03ceb9f935b09ed6b ]
____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition.
--- drivers/iio/dac/ad5766.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/dac/ad5766.c +1 -1
@@ -123,7 +123,7 @@ struct ad5766_state {u32 d32;u16 w16[2 ];u8 b8[4 ]; - } data[3 ]____cacheline_aligned ; + } data[3 ]__aligned(IIO_DMA_MINALIGN) ; };struct ad5766_span_tbl {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 638/1095 iio: dac: ad5770r: Fix alignment for DMA safety
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit 27f2261d16d01858b8e5baca5a1a515b040429c4 ]
____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition.
--- drivers/iio/dac/ad5770r.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/dac/ad5770r.c +1 -1
@@ -140,7 +140,7 @@ struct ad5770r_state {bool ch_pwr_down[AD5770R_MAX_CHANNELS ];bool internal_ref;bool external_res; -u8 transf_buf[2 ]____cacheline_aligned ; +u8 transf_buf[2 ]__aligned(IIO_DMA_MINALIGN) ; };static const struct regmap_config ad5770r_spi_regmap_config = {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 639/1095 iio: dac: ad5791: Fix alignment for DMA saftey
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit b2d5e9de77c8774a5a6cff59d928f2fa38cbc642 ]
____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition.
--- drivers/iio/dac/ad5791.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/dac/ad5791.c +1 -1
@@ -95,7 +95,7 @@ struct ad5791_state {union {__be32 d32;u8 d8[4 ]; - } data[3 ]____cacheline_aligned ; + } data[3 ]__aligned(IIO_DMA_MINALIGN) ; };enum ad5791_supported_device_ids {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 640/1095 iio: dac: ad7293: Fix alignment for DMA safety
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit 8482468b30bdb16d4a764f995d7a63d94fa0cf40 ]
____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition.
--- drivers/iio/dac/ad7293.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/dac/ad7293.c +1 -1
@@ -144,7 +144,7 @@ struct ad7293_state {struct regulator *reg_avdd;struct regulator *reg_vdrive;u8 page_select; -u8 data[3 ]____cacheline_aligned ; +u8 data[3 ]__aligned(IIO_DMA_MINALIGN) ; };static int ad7293_page_select (struct ad7293_state *st,unsigned int reg)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 641/1095 iio: dac: ad7303: Fix alignment for DMA safety
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit 69e51448ddfb9062efdf83e2d3179498e0aeb293 ]
____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition.
Update the comment to include 'may'.
--- drivers/iio/dac/ad7303.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/dac/ad7303.c +2 -2
@@ -44,10 +44,10 @@ struct ad7303_state {struct mutex lock;/* -* DMA (thus cache coherency maintenance) requires the +* DMA (thus cache coherency maintenance) may require the * transfer buffers to live in their own cache lines. */ -__be16 data____cacheline_aligned ; +__be16 data__aligned(IIO_DMA_MINALIGN) ; }; static int ad7303_write(struct ad7303_state *st, unsigned int chan,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 642/1095 iio: dac: ad8801: Fix alignment for DMA safety
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit 1c20292c6b60cfc60a5e652174b8063e5cc03fec ]
____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition.
--- drivers/iio/dac/ad8801.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/dac/ad8801.c +1 -1
@@ -26,7 +26,7 @@ struct ad8801_state {struct regulator *vrefh_reg;struct regulator *vrefl_reg; -__be16 data____cacheline_aligned ; +__be16 data__aligned(IIO_DMA_MINALIGN) ; }; static int ad8801_spi_write(struct ad8801_state *state,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 643/1095 iio: dac: ltc2688: Fix alignment for DMA safety
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit 2030708377a219b548a9a36da57d3852382baf1d ]
____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition.
Update the comment to include 'may'.
--- drivers/iio/dac/ltc2688.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/dac/ltc2688.c +2 -2
@@ -91,10 +91,10 @@ struct ltc2688_state {struct mutex lock;int vref;/* -* DMA (thus cache coherency maintenance) requires the +* DMA (thus cache coherency maintenance) may require the * transfer buffers to live in their own cache lines. */ -u8 tx_data[6 ]____cacheline_aligned ; +u8 tx_data[6 ]__aligned(IIO_DMA_MINALIGN) ;u8 rx_data[3 ]; };
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 644/1095 iio: dac: mcp4922: Fix alignment for DMA safety
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit e66bf04797f1f95a2402414c00e64d00f63d31ec ]
____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition.
--- drivers/iio/dac/mcp4922.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/dac/mcp4922.c +1 -1
@@ -29,7 +29,7 @@ struct mcp4922_state {unsigned int value[MCP4922_NUM_CHANNELS ];unsigned int vref_mv;struct regulator *vref_reg; -u8 mosi[2 ]____cacheline_aligned ; +u8 mosi[2 ]__aligned(IIO_DMA_MINALIGN) ; };#define MCP4922_CHAN (chan, bits) { \
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 645/1095 iio: dac: ti-dac082s085: Fix alignment for DMA safety
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit 03a0cc77f164e4e59b970d50c6e9a6caf06dae80 ]
____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition.
--- drivers/iio/dac/ti-dac082s085.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/dac/ti-dac082s085.c +1 -1
@@ -55,7 +55,7 @@ struct ti_dac_chip {bool powerdown;u8 powerdown_mode;u8 resolution; -u8 buf[2 ]____cacheline_aligned ; +u8 buf[2 ]__aligned(IIO_DMA_MINALIGN) ; };#define WRITE_NOT_UPDATE (chan) (0x00 | (chan) << 6)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 646/1095 iio: dac: ti-dac5571: Fix alignment for DMA safety
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit 58e22371539e01c742be5c30295f591a6a17e348 ]
____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition.
--- drivers/iio/dac/ti-dac5571.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/dac/ti-dac5571.c +1 -1
@@ -52,7 +52,7 @@ struct dac5571_data {struct dac5571_spec const *spec;int (*dac5571_cmd)(struct dac5571_data *data,int channel,u16 val);int (*dac5571_pwrdwn)(struct dac5571_data *data,int channel,u8 pwrdwn); -u8 buf[3 ]____cacheline_aligned ; +u8 buf[3 ]__aligned(IIO_DMA_MINALIGN) ; };#define DAC5571_POWERDOWN (mode) ((mode) + 1)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 647/1095 iio: dac: ti-dac7311: Fix alignment for DMA safety
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit 3637c49ed54632d7c221af718d2d7b1d381d4b6e ]
____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition.
--- drivers/iio/dac/ti-dac7311.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/dac/ti-dac7311.c +1 -1
@@ -52,7 +52,7 @@ struct ti_dac_chip {bool powerdown;u8 powerdown_mode;u8 resolution; -u8 buf[2 ]____cacheline_aligned ; +u8 buf[2 ]__aligned(IIO_DMA_MINALIGN) ; };static u8 ti_dac_get_power (struct ti_dac_chip *ti_dac,bool powerdown)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 648/1095 iio: dac: ti-dac7612: Fix alignment for DMA safety
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit b9ac08b3282a95fcefb057c2886028a6807725d8 ]
____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition.
Updated help text to 'may' require buffers to be in their own cacheline.
--- drivers/iio/dac/ti-dac7612.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/dac/ti-dac7612.c +2 -2
@@ -31,10 +31,10 @@ struct dac7612 {struct mutex lock;/* -* DMA (thus cache coherency maintenance) requires the +* DMA (thus cache coherency maintenance) may require the * transfer buffers to live in their own cache lines. */ -uint8_t data[2 ]____cacheline_aligned ; +uint8_t data[2 ]__aligned(IIO_DMA_MINALIGN) ; };static int dac7612_cmd_single (struct dac7612 *priv,int channel,u16 val)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 649/1095 iio: frequency: ad9523: Fix alignment for DMA safety
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit 8ff2eb625c353b1491d9f89f1dfd52e7aef5734c ]
____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition.
Updated help text to 'may' require buffers to be in their own cacheline.
--- drivers/iio/frequency/ad9523.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/iio/frequency/ad9523.c +3 -3
@@ -287,13 +287,13 @@ struct ad9523_state {struct mutex lock;/* -* DMA (thus cache coherency maintenance) requires the -* transfer buffers to live in their own cache lines. +* DMA (thus cache coherency maintenance) may require that +* transfer buffers live in their own cache lines. */ union {__be32 d32;u8 d8[4 ]; - } data[2 ]____cacheline_aligned ; + } data[2 ]__aligned(IIO_DMA_MINALIGN) ; };static int ad9523_read (struct iio_dev *indio_dev,unsigned int addr)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 650/1095 iio: frequency: adf4350: Fix alignment for DMA safety
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit 389b8972eb2a614cb3189e5fa55b1b7f66142c71 ]
____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition.
Updated help text to 'may' require buffers to be in their own cacheline.
--- drivers/iio/frequency/adf4350.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/iio/frequency/adf4350.c +3 -3
@@ -56,10 +56,10 @@ struct adf4350_state {*/ struct mutex lock;/* -* DMA (thus cache coherency maintenance) requires the -* transfer buffers to live in their own cache lines. +* DMA (thus cache coherency maintenance) may require that +* transfer buffers live in their own cache lines. */ -__be32 val____cacheline_aligned ; +__be32 val__aligned(IIO_DMA_MINALIGN) ; };static struct adf4350_platform_data default_pdata = {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 651/1095 iio: frequency: adf4371: Fix alignment for DMA safety
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit 0bb5675befe666eeed71ad808426cf2ec1c9a714 ]
____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition.
--- drivers/iio/frequency/adf4371.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/frequency/adf4371.c +1 -1
@@ -175,7 +175,7 @@ struct adf4371_state {unsigned int mod2;unsigned int rf_div_sel;unsigned int ref_div_factor; -u8 buf[10 ]____cacheline_aligned ; +u8 buf[10 ]__aligned(IIO_DMA_MINALIGN) ; }; static unsigned long long adf4371_pll_fract_n_get_rate(struct adf4371_state *st,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 652/1095 iio: frequency: admv1013: Fix alignment for DMA safety
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit b3f3f8d264b9be0cb3e50e89e3f8789a948a43bb ]
____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition.
--- drivers/iio/frequency/admv1013.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/frequency/admv1013.c +1 -1
@@ -100,7 +100,7 @@ struct admv1013_state {unsigned int input_mode;unsigned int quad_se_mode;bool det_en; -u8 data[3 ]____cacheline_aligned ; +u8 data[3 ]__aligned(IIO_DMA_MINALIGN) ; }; static int __admv1013_spi_read(struct admv1013_state *st, unsigned int reg,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 653/1095 iio: frequency: admv1014: Fix alignment for DMA safety
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit a3e38a557a54df0edea791d7eb623515bb86e39a ]
____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition.
--- drivers/iio/frequency/admv1014.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/frequency/admv1014.c +1 -1
@@ -127,7 +127,7 @@ struct admv1014_state {unsigned int quad_se_mode;unsigned int p1db_comp;bool det_en; -u8 data[3 ]____cacheline_aligned ; +u8 data[3 ]__aligned(IIO_DMA_MINALIGN) ; };static const int mixer_vgate_table[] = {106 ,107 ,108 ,110 ,111 ,112 ,113 ,114 ,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 654/1095 iio: frequency: admv4420: Fix alignment for DMA safety
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit f890aaac771bd015c348eddb967b4027e88344c0 ]
____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition.
--- drivers/iio/frequency/admv4420.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/frequency/admv4420.c +1 -1
@@ -113,7 +113,7 @@ struct admv4420_state {struct admv4420_n_counter n_counter;enum admv4420_mux_sel mux_sel;struct mutex lock; -u8 transf_buf[4 ]____cacheline_aligned ; +u8 transf_buf[4 ]__aligned(IIO_DMA_MINALIGN) ; };static const struct regmap_config admv4420_regmap_config = {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 655/1095 iio: frequency: adrf6780: Fix alignment for DMA safety
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit 9a5b11884cb72780cb824cac8aab47094654a84f ]
____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition.
--- drivers/iio/frequency/adrf6780.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/frequency/adrf6780.c +1 -1
@@ -86,7 +86,7 @@ struct adrf6780_state {bool uc_bias_en;bool lo_sideband;bool vdet_out_en; -u8 data[3 ]____cacheline_aligned ; +u8 data[3 ]__aligned(IIO_DMA_MINALIGN) ; }; static int __adrf6780_spi_read(struct adrf6780_state *st, unsigned int reg,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 656/1095 iio: gyro: adis16080: Fix alignment for DMA safety
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit ae6eeb534924ecc2afd5a394964fd6de0ca54d39 ]
____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition.
Fixes tag is inaccurate but unlikely anyone will backport this beyond that point so I haven't chased the history futher than 2013.
--- drivers/iio/gyro/adis16080.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/gyro/adis16080.c +1 -1
@@ -45,7 +45,7 @@ struct adis16080_state {const struct adis16080_chip_info *info;struct mutex lock; -__be16 buf____cacheline_aligned ; +__be16 buf__aligned(IIO_DMA_MINALIGN) ; }; static int adis16080_read_sample(struct iio_dev *indio_dev,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 657/1095 iio: gyro: adis16130: Fix alignment for DMA safety
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit ff3211b2ba9afac80ceb795d148831dd879b30b7 ]
____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition.
--- drivers/iio/gyro/adis16130.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/gyro/adis16130.c +1 -1
@@ -41,7 +41,7 @@struct adis16130_state {struct spi_device *us;struct mutex buf_lock; -u8 buf[4 ]____cacheline_aligned ; +u8 buf[4 ]__aligned(IIO_DMA_MINALIGN) ; };static int adis16130_spi_read (struct iio_dev *indio_dev,u8 reg_addr,u32 *val)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 658/1095 iio: gyro: adxrs450: Fix alignment for DMA safety
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit 966d2f4ee7f6e189df47abf67223266ad31e201f ]
____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition.
Fixes tag is inaccurate but unlikely anyone will be interested in backporting beyond that point.
--- drivers/iio/gyro/adxrs450.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/gyro/adxrs450.c +1 -1
@@ -73,7 +73,7 @@ enum {struct adxrs450_state {struct spi_device *us;struct mutex buf_lock; -__be32 tx____cacheline_aligned ; +__be32 tx__aligned(IIO_DMA_MINALIGN) ;__be32 rx; };
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 659/1095 iio: gyro: fxas210002c: Fix alignment for DMA safety
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit 3aafe923987cb4a15e16f03c6185ed4b6a78ca00 ]
____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition.
Updated the comment to 'may' require.
--- drivers/iio/gyro/fxas21002c_core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/iio/gyro/fxas21002c_core.c +3 -3
@@ -150,10 +150,10 @@ struct fxas21002c_data {struct regulator *vddio;/* -* DMA (thus cache coherency maintenance) requires the -* transfer buffers to live in their own cache lines. +* DMA (thus cache coherency maintenance) may require the +* transfer buffers live in their own cache lines. */ -s16 buffer[8 ]____cacheline_aligned ; +s16 buffer[8 ]__aligned(IIO_DMA_MINALIGN) ; };enum fxas21002c_channel_index {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 660/1095 iio: imu: fxos8700: Fix alignment for DMA safety
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit c9a8417a13ed9c81383662fca8a4b89f84d31e78 ]
____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition.
--- drivers/iio/imu/fxos8700_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/imu/fxos8700_core.c +1 -1
@@ -167,7 +167,7 @@struct fxos8700_data {struct regmap *regmap;struct iio_trigger *trig; -__be16 buf[FXOS8700_DATA_BUF_SIZE ]____cacheline_aligned ; +__be16 buf[FXOS8700_DATA_BUF_SIZE ]__aligned(IIO_DMA_MINALIGN) ; };/* Regmap info */
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 661/1095 iio: imu: inv_icm42600: Fix alignment for DMA safety
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit 848847702bd10bf0bf547e38adc44c14e9742784 ]
Partial fix for this driver as a second instance was introduced in a later patch.
____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition.
--- drivers/iio/imu/inv_icm42600/inv_icm42600.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/imu/inv_icm42600/inv_icm42600.h +1 -1
@@ -141,7 +141,7 @@ struct inv_icm42600_state {struct inv_icm42600_suspended suspended;struct iio_dev *indio_gyro;struct iio_dev *indio_accel; -uint8_t buffer[2 ]____cacheline_aligned ; +uint8_t buffer[2 ]__aligned(IIO_DMA_MINALIGN) ;struct inv_icm42600_fifo fifo;struct {int64_t gyro;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 662/1095 iio: imu: inv_icm42600: Fix alignment for DMA safety in buffer code.
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit b0aa05065a0c1d1bffa10923dbc36f7193babbb7 ]
Second fix for this driver due to different introducing patches.
____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition.
--- drivers/iio/imu/inv_icm42600/inv_icm42600_buffer.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/imu/inv_icm42600/inv_icm42600_buffer.h +1 -1
@@ -39,7 +39,7 @@ struct inv_icm42600_fifo {size_t accel;size_t total; } nb; -uint8_t data[2080 ]____cacheline_aligned ; +uint8_t data[2080 ]__aligned(IIO_DMA_MINALIGN) ; };/* FIFO data packet */
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 663/1095 iio: imu: mpu6050: Fix alignment for DMA safety
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit 54e03562bb960e78af050d2e550c28d77642ee44 ]
____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition.
--- drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h +1 -1
@@ -203,7 +203,7 @@ struct inv_mpu6050_state {s32 magn_raw_to_gauss[3 ];struct iio_mount_matrix magn_orient;unsigned int suspended_sensors; -u8 data[INV_MPU6050_OUTPUT_DATA_SIZE ]____cacheline_aligned ; +u8 data[INV_MPU6050_OUTPUT_DATA_SIZE ]__aligned(IIO_DMA_MINALIGN) ; };/*register and associated bit definition*/
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 664/1095 iio: potentiometer: ad5110: Fix alignment for DMA safety
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit b5841c38cb2f7e54b0787b3e0326a6b21b89ea3e ]
____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition.
--- drivers/iio/potentiometer/ad5110.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/potentiometer/ad5110.c +2 -2
@@ -63,10 +63,10 @@ struct ad5110_data {struct mutex lock;const struct ad5110_cfg *cfg;/* -* DMA (thus cache coherency maintenance) requires the +* DMA (thus cache coherency maintenance) may require the * transfer buffers to live in their own cache lines. */ -u8 buf[2 ]____cacheline_aligned ; +u8 buf[2 ]__aligned(IIO_DMA_MINALIGN) ; };static const struct iio_chan_spec ad5110_channels[] = {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 665/1095 iio: potentiometer: ad5272: Fix alignment for DMA safety
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit da803652534271dbb4af0802bd678c759e27e6de ]
____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition.
--- drivers/iio/potentiometer/ad5272.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/potentiometer/ad5272.c +1 -1
@@ -50,7 +50,7 @@ struct ad5272_data {struct i2c_client *client;struct mutex lock;const struct ad5272_cfg *cfg; -u8 buf[2 ]____cacheline_aligned ; +u8 buf[2 ]__aligned(IIO_DMA_MINALIGN) ; };static const struct iio_chan_spec ad5272_channel = {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 666/1095 iio: potentiometer: max5481: Fix alignment for DMA safety
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit ec1ac1c0e7a14657d729159ccfbea72f434bdaf1 ]
____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition.
--- drivers/iio/potentiometer/max5481.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/potentiometer/max5481.c +1 -1
@@ -44,7 +44,7 @@ static const struct max5481_cfg max5481_cfg[] = {struct max5481_data {struct spi_device *spi;const struct max5481_cfg *cfg; -u8 msg[3 ]____cacheline_aligned ; +u8 msg[3 ]__aligned(IIO_DMA_MINALIGN) ; };#define MAX5481_CHANNEL { \
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 667/1095 iio: potentiometer: mcp41010: Fix alignment for DMA safety
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit c5f78f4d2168ba21324095b0d46d4353c2eace4d ]
____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition.
--- drivers/iio/potentiometer/mcp41010.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/potentiometer/mcp41010.c +1 -1
@@ -60,7 +60,7 @@ struct mcp41010_data {const struct mcp41010_cfg *cfg;struct mutex lock;/* Protect write sequences */ unsigned int value[MCP41010_MAX_WIPERS ];/* Cache wiper values */ -u8 buf[2 ]____cacheline_aligned ; +u8 buf[2 ]__aligned(IIO_DMA_MINALIGN) ; };#define MCP41010_CHANNEL (ch) { \
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 668/1095 iio: potentiometer: mcp4131: Fix alignment for DMA safety
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit 4842e5de6f39ebf2c0f6da9e6a0cb751c7108507 ]
____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition.
--- drivers/iio/potentiometer/mcp4131.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/potentiometer/mcp4131.c +1 -1
@@ -129,7 +129,7 @@ struct mcp4131_data {struct spi_device *spi;const struct mcp4131_cfg *cfg;struct mutex lock; -u8 buf[2 ]____cacheline_aligned ; +u8 buf[2 ]__aligned(IIO_DMA_MINALIGN) ; };#define MCP4131_CHANNEL (ch) { \
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 669/1095 iio: proximity: as3935: Fix alignment for DMA safety
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit 2386c0f8c5b740873a4b9126c3706601b127fe22 ]
____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition.
--- drivers/iio/proximity/as3935.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/proximity/as3935.c +1 -1
@@ -65,7 +65,7 @@ struct as3935_state {u8 chan;s64 timestamp__aligned(8) ; } scan; -u8 buf[2 ]____cacheline_aligned ; +u8 buf[2 ]__aligned(IIO_DMA_MINALIGN) ; };static const struct iio_chan_spec as3935_channels[] = {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 670/1095 iio: resolver: ad2s1200: Fix alignment for DMA safety
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit 37882314d3bdc2ae775ebb9fa8ed7a94cd1aad61 ]
____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition.
Fixes tag is probably not where the issue was first introduced, but is likely to be as far as anyone considers backporting this fix.
--- drivers/iio/resolver/ad2s1200.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/resolver/ad2s1200.c +1 -1
@@ -41,7 +41,7 @@ struct ad2s1200_state {struct spi_device *sdev;struct gpio_desc *sample;struct gpio_desc *rdvel; -__be16 rx____cacheline_aligned ; +__be16 rx__aligned(IIO_DMA_MINALIGN) ; }; static int ad2s1200_read_raw(struct iio_dev *indio_dev,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 671/1095 iio: resolver: ad2s90: Fix alignment for DMA safety
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit faa05ecb1349070d874810e161b653c2220e0006 ]
____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition.
Fixes tag is probably not where the issue was first introduced, but is likely to be far beyond the point where anyone considers backporting this fix.
--- drivers/iio/resolver/ad2s90.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/resolver/ad2s90.c +1 -1
@@ -24,7 +24,7 @@struct ad2s90_state {struct mutex lock;/* lock to protect rx buffer */ struct spi_device *sdev; -u8 rx[2 ]____cacheline_aligned ; +u8 rx[2 ]__aligned(IIO_DMA_MINALIGN) ; }; static int ad2s90_read_raw(struct iio_dev *indio_dev,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 672/1095 iio: temp: ltc2983: Fix alignment for DMA safety
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit 732f2cb2fbb51bd5bc03a114bd102ab3b2f537fe ]
____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition.
--- drivers/iio/temperature/ltc2983.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/temperature/ltc2983.c +2 -2
@@ -200,11 +200,11 @@ struct ltc2983_data {u8 num_channels;u8 iio_channels;/* -* DMA (thus cache coherency maintenance) requires the +* DMA (thus cache coherency maintenance) may require the * transfer buffers to live in their own cache lines. * Holds the converted temperature */ -__be32 temp____cacheline_aligned ; +__be32 temp__aligned(IIO_DMA_MINALIGN) ; };struct ltc2983_sensor {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 673/1095 iio: temp: max31865: Fix alignment for DMA safety
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit ecdef5b8317cdf18acb46223e087f04a226fa619 ]
____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition
--- drivers/iio/temperature/max31865.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/temperature/max31865.c +1 -1
@@ -53,7 +53,7 @@ struct max31865_data {struct mutex lock;bool filter_50hz;bool three_wire; -u8 buf[2 ]____cacheline_aligned ; +u8 buf[2 ]__aligned(IIO_DMA_MINALIGN) ; }; static int max31865_read(struct max31865_data *data, u8 reg,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 674/1095 iio: temp: maxim_thermocouple: Fix alignment for DMA safety
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit 10897f34309b3c7bc14698407436c82d11c07f47 ]
____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition
--- drivers/iio/temperature/maxim_thermocouple.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/temperature/maxim_thermocouple.c +1 -1
@@ -122,7 +122,7 @@ struct maxim_thermocouple_data {struct spi_device *spi;const struct maxim_thermocouple_chip *chip; -u8 buffer[16 ]____cacheline_aligned ; +u8 buffer[16 ]__aligned(IIO_DMA_MINALIGN) ;char tc_type; };
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 675/1095 clk: mediatek: reset: Fix written reset bit offset
In reply to Greg Kroah-HartmanFrom: Rex-BC Chen <[email protected]>
[ Upstream commit edabcf71d100fd433a0fc2d0c97057c446c33b2a ]
Original assert/deassert bit is BIT(0), but it's more resonable to modify them to BIT(id % 32) which is based on id.
This patch will not influence any previous driver because the reset is only used for thermal. The id (MT8183_INFRACFG_AO_THERM_SW_RST) is 0.
--- drivers/clk/mediatek/reset.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/clk/mediatek/reset.c +2 -2
@@ -25,7 +25,7 @@ static int mtk_reset_assert_set_clr(struct reset_controller_dev *rcdev, struct mtk_reset *data = container_of(rcdev, struct mtk_reset, rcdev);unsigned int reg = data->regofs + ((id /32 ) <<4 ); -return regmap_write (data->regmap, reg,1 ); +return regmap_write (data->regmap, reg,BIT (id %32 )); } static int mtk_reset_deassert_set_clr(struct reset_controller_dev *rcdev,
@@ -34,7 +34,7 @@ static int mtk_reset_deassert_set_clr(struct reset_controller_dev *rcdev, struct mtk_reset *data = container_of(rcdev, struct mtk_reset, rcdev);unsigned int reg = data->regofs + ((id /32 ) <<4 ) +0x4 ; -return regmap_write (data->regmap, reg,1 ); +return regmap_write (data->regmap, reg,BIT (id %32 )); } static int mtk_reset_assert(struct reset_controller_dev *rcdev,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 676/1095 clk: imx93: use adc_root as the parent clock of adc1
In reply to Greg Kroah-HartmanFrom: Haibo Chen <[email protected]>
[ Upstream commit 18d6d8fe4f24938985844d52c481b86fcce9d102 ]
When debug, find after system boot up, all adc register operation will trigger system hang, this is because the internal adc ipg clock is gate off. In dts, only reference the IMX93_CLK_ADC1_GATE, which is adc1, no one touch the adc_root, so adc_root will be gate off automatically after system boot up.
--- drivers/clk/imx/clk-imx93.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/imx/clk-imx93.c +1 -1
@@ -150,7 +150,7 @@ static const struct imx93_clk_ccgr { { IMX93_CLK_A55_GATE, "a55", "a55_root", 0x8000, }, /* M33 critical clk for system run */ { IMX93_CLK_CM33_GATE, "cm33", "m33_root", 0x8040, CLK_IS_CRITICAL }, - { IMX93_CLK_ADC1_GATE, "adc1", "osc_24m", 0x82c0, }, + { IMX93_CLK_ADC1_GATE, "adc1", "adc_root", 0x82c0, }, { IMX93_CLK_WDOG1_GATE, "wdog1", "osc_24m", 0x8300, }, { IMX93_CLK_WDOG2_GATE, "wdog2", "osc_24m", 0x8340, }, { IMX93_CLK_WDOG3_GATE, "wdog3", "osc_24m", 0x8380, },
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 677/1095 clk: imx93: correct nic_media parent
In reply to Greg Kroah-HartmanFrom: Peng Fan <[email protected]>
[ Upstream commit 1e3c837a663e9a12c4afabb3279d18cb5110a8f4 ]
NIC_MEDIA sources from media_axi_root, not media_apb_root.
--- drivers/clk/imx/clk-imx93.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/imx/clk-imx93.c +1 -1
@@ -219,7 +219,7 @@ static const struct imx93_clk_ccgr { { IMX93_CLK_LCDIF_GATE, "lcdif", "media_apb_root", 0x9640, }, { IMX93_CLK_PXP_GATE, "pxp", "media_apb_root", 0x9680, }, { IMX93_CLK_ISI_GATE, "isi", "media_apb_root", 0x96c0, }, - { IMX93_CLK_NIC_MEDIA_GATE, "nic_media", "media_apb_root", 0x9700, }, + { IMX93_CLK_NIC_MEDIA_GATE, "nic_media", "media_axi_root", 0x9700, }, { IMX93_CLK_USB_CONTROLLER_GATE, "usb_controller", "hsio_root", 0x9a00, }, { IMX93_CLK_USB_TEST_60M_GATE, "usb_test_60m", "hsio_usb_test_60m_root", 0x9a40, }, { IMX93_CLK_HSIO_TROUT_24M_GATE, "hsio_trout_24m", "osc_24m", 0x9a80, },
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 678/1095 clk: imx: clk-fracn-gppll: fix mfd value
In reply to Greg Kroah-HartmanFrom: Peng Fan <[email protected]>
[ Upstream commit 044034efbeea05f65c09d2ba15ceeab53b60e947 ]
According to spec:
A value of 0 is disallowed and should not be programmed in this register
Fix to 1.
--- drivers/clk/imx/clk-fracn-gppll.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/clk/imx/clk-fracn-gppll.c +4 -4
@@ -64,10 +64,10 @@ struct clk_fracn_gppll {* Fout = Fvco / (rdiv * odiv) */ static const struct imx_fracn_gppll_rate_table fracn_tbl[] = { -PLL_FRACN_GP (650000000U ,81 ,0 ,0 ,0 ,3 ), -PLL_FRACN_GP (594000000U ,198 ,0 ,0 ,0 ,8 ), -PLL_FRACN_GP (560000000U ,70 ,0 ,0 ,0 ,3 ), -PLL_FRACN_GP (400000000U ,50 ,0 ,0 ,0 ,3 ), +PLL_FRACN_GP (650000000U ,81 ,0 ,1 ,0 ,3 ), +PLL_FRACN_GP (594000000U ,198 ,0 ,1 ,0 ,8 ), +PLL_FRACN_GP (560000000U ,70 ,0 ,1 ,0 ,3 ), +PLL_FRACN_GP (400000000U ,50 ,0 ,1 ,0 ,3 ),PLL_FRACN_GP (393216000U ,81 ,92 ,100 ,0 ,5 ) };
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 679/1095 clk: imx: clk-fracn-gppll: Return rate in rate table properly in ->recalc_rate()
In reply to Greg Kroah-HartmanFrom: Liu Ying <[email protected]>
[ Upstream commit 5ebaf9f7da5bb2dc56d394eabfcbe46dc6b1ea8d ]
The PLL parameters in rate table should be directly compared with those read from PLL registers instead of the cooked ones.
--- drivers/clk/imx/clk-fracn-gppll.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-)
drivers/clk/imx/clk-fracn-gppll.c +13 -11
@@ -131,18 +131,7 @@ static unsigned long clk_fracn_gppll_recalc_rate(struct clk_hw *hw, unsigned lon mfi =FIELD_GET (PLL_MFI_MASK , pll_div); rdiv =FIELD_GET (PLL_RDIV_MASK , pll_div); - rdiv = rdiv +1 ; odiv =FIELD_GET (PLL_ODIV_MASK , pll_div); -switch (odiv) { -case 0 : - odiv =2 ; -break ; -case 1 : - odiv =3 ; -break ; -default : -break ; - }/* * Sometimes, the recalculated rate has deviation due to
@@ -160,6 +149,19 @@ static unsigned long clk_fracn_gppll_recalc_rate(struct clk_hw *hw, unsigned lonif (rate)return (unsigned long )rate; + rdiv = rdiv +1 ; + +switch (odiv) { +case 0 : + odiv =2 ; +break ; +case 1 : + odiv =3 ; +break ; +default : +break ; + } +/* Fvco = Fref * (MFI + MFN / MFD) */ fvco = fvco * mfi * mfd + fvco * mfn;do_div (fvco, mfd * rdiv * odiv);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 680/1095 clk: imx: clk-fracn-gppll: correct rdiv
In reply to Greg Kroah-HartmanFrom: Peng Fan <[email protected]>
[ Upstream commit f300cb7fccf69ba1835b983c76d70deb818ad194 ]
According to Reference Manual:
000b - Divide by 1
001b - Divide by 1
010b - Divide by 2
011b - Divide by 3
100b - Divide by 4
101b - Divide by 5
110b - Divide by 6
111b - Divide by 7
So only need increase rdiv by 1 when the register value is 0.
--- drivers/clk/imx/clk-fracn-gppll.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/clk/imx/clk-fracn-gppll.c +2 -1
@@ -149,7 +149,8 @@ static unsigned long clk_fracn_gppll_recalc_rate(struct clk_hw *hw, unsigned lonif (rate)return (unsigned long )rate; - rdiv = rdiv +1 ; +if (!rdiv) + rdiv = rdiv +1 ;switch (odiv) {case 0 :
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 681/1095 RDMA/rxe: fix xa_alloc_cycle() error return value check again
In reply to Greg Kroah-HartmanFrom: Dongliang Mu <[email protected]>
[ Upstream commit 1a685940e6200e9def6e34bbaa19dd31dc5aeaf8 ]
Currently rxe_alloc checks ret to indicate error, but 1 is also a valid return and just indicates that the allocation succeeded with a wrap.
Fix this by modifying the check to be < 0.
--- drivers/infiniband/sw/rxe/rxe_pool.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/infiniband/sw/rxe/rxe_pool.c +2 -2
@@ -140,7 +140,7 @@ void *rxe_alloc(struct rxe_pool *pool) err =xa_alloc_cyclic (&pool->xa, &elem->index, elem, pool->limit, &pool->next,GFP_KERNEL ); -if (err) +if (err <0 ) goto err_free;return obj;
@@ -168,7 +168,7 @@ int __rxe_add_to_pool(struct rxe_pool *pool, struct rxe_pool_elem *elem) err =xa_alloc_cyclic (&pool->xa, &elem->index, elem, pool->limit, &pool->next,GFP_KERNEL ); -if (err) +if (err <0 ) goto err_cnt;return 0 ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 682/1095 lib/test_hmm: avoid accessing uninitialized pages
In reply to Greg Kroah-HartmanFrom: Miaohe Lin <[email protected]>
[ Upstream commit ed913b055a74b723976f8e885a3395162a0371e6 ]
If make_device_exclusive_range() fails or returns pages marked for exclusive access less than required, remaining fields of pages will left uninitialized. So dmirror_atomic_map() will access those yet uninitialized fields of pages. To fix it, do dmirror_atomic_map() iff all pages are marked for exclusive access (we will break if mapped is less than required anyway) so we won't access those uninitialized fields of pages.
--- lib/test_hmm.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
lib/test_hmm.c +8 -2
@@ -732,7 +732,7 @@ static int dmirror_exclusive(struct dmirror *dmirror,mmap_read_lock (mm);for (addr = start; addr < end; addr = next) { -unsigned long mapped; +unsigned long mapped =0 ;int i;if (end < addr + (ARRAY_SIZE (pages) <<PAGE_SHIFT ))
@@ -741,7 +741,13 @@ static int dmirror_exclusive(struct dmirror *dmirror, next = addr + (ARRAY_SIZE (pages) <<PAGE_SHIFT ); ret =make_device_exclusive_range (mm, addr, next, pages,NULL ); - mapped =dmirror_atomic_map (addr, next, pages, dmirror); +/* +* Do dmirror_atomic_map() iff all pages are marked for +* exclusive access to avoid accessing uninitialized +* fields of pages. +*/ +if (ret == (next - addr) >>PAGE_SHIFT ) + mapped =dmirror_atomic_map (addr, next, pages, dmirror);for (i =0 ; i < ret; i++) {if (pages[i]) {unlock_page (pages[i]);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 683/1095 mm/memremap: fix memunmap_pages() race with get_dev_pagemap()
In reply to Greg Kroah-HartmanFrom: Miaohe Lin <[email protected]>
[ Upstream commit 1e57ffb6e3fd9583268c6462c4e3853575b21701 ]
Think about the below scene:
CPU1 CPU2
memunmap_pages
percpu_ref_exit
__percpu_ref_exit
free_percpu(percpu_count);
/* percpu_count is freed here! */
get_dev_pagemap
xa_load(&pgmap_array, PHYS_PFN(phys))
/* pgmap still in the pgmap_array */
percpu_ref_tryget_live(&pgmap->ref)
if __ref_is_percpu
/* __PERCPU_REF_ATOMIC_DEAD not set yet */
this_cpu_inc(*percpu_count)
/* access freed percpu_count here! */
ref->percpu_count_ptr = __PERCPU_REF_ATOMIC_DEAD;
/* too late... */ pageunmap_range
To fix the issue, do percpu_ref_exit() after pgmap_array is emptied. So we won't do percpu_ref_tryget_live() against a being freed percpu_ref.
--- mm/memremap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/memremap.c +1 -1
@@ -141,10 +141,10 @@ void memunmap_pages(struct dev_pagemap *pgmap)for (i =0 ; i < pgmap->nr_range; i++)percpu_ref_put_many (&pgmap->ref,pfn_len (pgmap, i));wait_for_completion (&pgmap->done); -percpu_ref_exit (&pgmap->ref);for (i =0 ; i < pgmap->nr_range; i++)pageunmap_range (pgmap, i); +percpu_ref_exit (&pgmap->ref);WARN_ONCE (pgmap->altmap.alloc,"failed to free all reserved pages\n" );devmap_managed_enable_put (pgmap);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 684/1095 KVM: Dont set Accessed/Dirty bits for ZERO_PAGE
In reply to Greg Kroah-HartmanFrom: Sean Christopherson <[email protected]>
[ Upstream commit a1040b0d42acf69bb4f6dbdc54c2dcd78eea1de5 ]
Don't set Accessed/Dirty bits for a struct page with PG_reserved set, i.e. don't set A/D bits for the ZERO_PAGE. The ZERO_PAGE (or pages depending on the architecture) should obviously never be written, and similarly there's no point in marking it accessed as the page will never be swapped out or reclaimed. The comment in page-flags.h is quite clear that PG_reserved pages should be managed only by their owner, and strictly following that mandate also simplifies KVM's logic.
Message-Id: <[email protected]>
--- virt/kvm/kvm_main.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-)
virt/kvm/kvm_main.c +14 -2
@@ -2852,16 +2852,28 @@ void kvm_release_pfn_dirty(kvm_pfn_t pfn) }EXPORT_SYMBOL_GPL (kvm_release_pfn_dirty); +static bool kvm_is_ad_tracked_pfn (kvm_pfn_t pfn) +{ +if (!pfn_valid (pfn)) +return false; + +/* +* Per page-flags.h, pages tagged PG_reserved "should in general not be +* touched (e.g. set dirty) except by its owner". +*/ +return !PageReserved (pfn_to_page (pfn)); +} +void kvm_set_pfn_dirty (kvm_pfn_t pfn) { -if (!kvm_is_reserved_pfn (pfn) && !kvm_is_zone_device_pfn (pfn)) +if (kvm_is_ad_tracked_pfn (pfn))SetPageDirty (pfn_to_page (pfn)); }EXPORT_SYMBOL_GPL (kvm_set_pfn_dirty);void kvm_set_pfn_accessed (kvm_pfn_t pfn) { -if (!kvm_is_reserved_pfn (pfn) && !kvm_is_zone_device_pfn (pfn)) +if (kvm_is_ad_tracked_pfn (pfn))mark_page_accessed (pfn_to_page (pfn)); }EXPORT_SYMBOL_GPL (kvm_set_pfn_accessed);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 685/1095 mwifiex: fix sleep in atomic context bugs caused by dev_coredumpv
In reply to Greg Kroah-HartmanFrom: Duoming Zhou <[email protected]>
[ Upstream commit a52ed4866d2b90dd5e4ae9dabd453f3ed8fa3cbc ]
There are sleep in atomic context bugs when uploading device dump data in mwifiex. The root cause is that dev_coredumpv could not be used in atomic contexts, because it calls dev_set_name which include operations that may sleep. The call tree shows execution paths that could lead to bugs:
(Interrupt context)fw_dump_timer_fn
mwifiex_upload_device_dump
dev_coredumpv(..., GFP_KERNEL)
dev_coredumpm()
kzalloc(sizeof(*devcd), gfp); //may sleep dev_set_name
kobject_set_name_vargs
kvasprintf_const(GFP_KERNEL, ...); //may sleep kstrdup(s, GFP_KERNEL); //may sleep
The corresponding fail log is shown below:
[ 135.275938] usb 1-1: == mwifiex dump information to /sys/class/devcoredump start [ 135.281029] BUG: sleeping function called from invalid context at include/linux/sched/mm.h:265 ... [ 135.293613] Call Trace: [ 135.293613] <IRQ> [ 135.293613] dump_stack_lvl+0x57/0x7d [ 135.293613] __might_resched.cold+0x138/0x173 [ 135.293613] ? dev_coredumpm+0xca/0x2e0 [ 135.293613] kmem_cache_alloc_trace+0x189/0x1f0 [ 135.293613] ? devcd_match_failing+0x30/0x30 [ 135.293613] dev_coredumpm+0xca/0x2e0 [ 135.293613] ? devcd_freev+0x10/0x10 [ 135.293613] dev_coredumpv+0x1c/0x20 [ 135.293613] ? devcd_match_failing+0x30/0x30 [ 135.293613] mwifiex_upload_device_dump+0x65/0xb0 [ 135.293613] ? mwifiex_dnld_fw+0x1b0/0x1b0 [ 135.293613] call_timer_fn+0x122/0x3d0 [ 135.293613] ? msleep_interruptible+0xb0/0xb0 [ 135.293613] ? lock_downgrade+0x3c0/0x3c0 [ 135.293613] ? __next_timer_interrupt+0x13c/0x160 [ 135.293613] ? lockdep_hardirqs_on_prepare+0xe/0x220 [ 135.293613] ? mwifiex_dnld_fw+0x1b0/0x1b0 [ 135.293613] __run_timers.part.0+0x3f8/0x540 [ 135.293613] ? call_timer_fn+0x3d0/0x3d0 [ 135.293613] ? arch_restore_msi_irqs+0x10/0x10 [ 135.293613] ? lapic_next_event+0x31/0x40 [ 135.293613] run_timer_softirq+0x4f/0xb0 [ 135.293613] __do_softirq+0x1c2/0x651 ... [ 135.293613] RIP: 0010:default_idle+0xb/0x10 [ 135.293613] RSP: 0018:ffff888006317e68 EFLAGS: 00000246 [ 135.293613] RAX: ffffffff82ad8d10 RBX: ffff888006301cc0 RCX: ffffffff82ac90e1 [ 135.293613] RDX: ffffed100d9ff1b4 RSI: ffffffff831ad140 RDI: ffffffff82ad8f20 [ 135.293613] RBP: 0000000000000003 R08: 0000000000000000 R09: ffff88806cff8d9b [ 135.293613] R10: ffffed100d9ff1b3 R11: 0000000000000001 R12: ffffffff84593410 [ 135.293613] R13: 0000000000000000 R14: 0000000000000000 R15: 1ffff11000c62fd2 ... [ 135.389205] usb 1-1: == mwifiex dump information to /sys/class/devcoredump end
This patch uses delayed work to replace timer and moves the operations that may sleep into a delayed work in order to mitigate bugs, it was tested on Marvell 88W8801 chip whose port is usb and the firmware is usb8801_uapsta.bin. The following is the result after using delayed work to replace timer.
[ 134.936453] usb 1-1: == mwifiex dump information to /sys/class/devcoredump start [ 135.043344] usb 1-1: == mwifiex dump information to /sys/class/devcoredump end
As we can see, there is no bug now.
--- drivers/net/wireless/marvell/mwifiex/init.c | 9 +++++---- drivers/net/wireless/marvell/mwifiex/main.h | 3 ++- drivers/net/wireless/marvell/mwifiex/sta_event.c | 6 +++--- 3 files changed, 10 insertions(+), 8 deletions(-)
drivers/net/wireless/marvell/mwifiex/init.c +5 -4
@@ -63,9 +63,10 @@ static void wakeup_timer_fn(struct timer_list *t) adapter->if_ops.card_reset (adapter); } -static void fw_dump_timer_fn (struct timer_list *t) +static void fw_dump_work (struct work_struct *work) { -struct mwifiex_adapter *adapter =from_timer (adapter, t, devdump_timer); +struct mwifiex_adapter *adapter = + container_of(work, struct mwifiex_adapter, devdump_work.work);mwifiex_upload_device_dump (adapter); }
@@ -321,7 +322,7 @@ static void mwifiex_init_adapter(struct mwifiex_adapter *adapter) adapter->active_scan_triggered = false;timer_setup (&adapter->wakeup_timer, wakeup_timer_fn,0 ); adapter->devdump_len =0 ; -timer_setup (&adapter->devdump_timer, fw_dump_timer_fn,0 ); +INIT_DELAYED_WORK (&adapter->devdump_work, fw_dump_work); }/*
@@ -400,7 +401,7 @@ static void mwifiex_adapter_cleanup(struct mwifiex_adapter *adapter) {del_timer (&adapter->wakeup_timer); -del_timer_sync (&adapter->devdump_timer); +cancel_delayed_work_sync (&adapter->devdump_work);mwifiex_cancel_all_pending_cmd (adapter);wake_up_interruptible (&adapter->cmd_wait_q.wait);wake_up_interruptible (&adapter->hs_activate_wait_q);
drivers/net/wireless/marvell/mwifiex/main.h +2 -1
@@ -49,6 +49,7 @@#include <linux/pm_runtime.h> #include <linux/slab.h> #include <linux/of_irq.h> +#include <linux/workqueue.h> #include "decl.h" #include "ioctl.h"
@@ -1055,7 +1056,7 @@ struct mwifiex_adapter {/* Device dump data/length */ void *devdump_data;int devdump_len; -struct timer_list devdump_timer; +struct delayed_work devdump_work;bool ignore_btcoex_events; };
drivers/net/wireless/marvell/mwifiex/sta_event.c +3 -3
@@ -623,8 +623,8 @@ mwifiex_fw_dump_info_event(struct mwifiex_private *priv,* transmission event get lost, in this cornel case, * user would still get partial of the dump. */ -mod_timer (&adapter->devdump_timer, - jiffies +msecs_to_jiffies (MWIFIEX_TIMER_10S )); +schedule_delayed_work (&adapter->devdump_work, +msecs_to_jiffies (MWIFIEX_TIMER_10S )); }/* Overflow check */
@@ -643,7 +643,7 @@ mwifiex_fw_dump_info_event(struct mwifiex_private *priv,return ; upload_dump: -del_timer_sync (&adapter->devdump_timer); +cancel_delayed_work_sync (&adapter->devdump_work);mwifiex_upload_device_dump (adapter); }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 686/1095 scsi: iscsi: Allow iscsi_if_stop_conn() to be called from kernel
In reply to Greg Kroah-HartmanFrom: Mike Christie <[email protected]>
[ Upstream commit 3328333b47f4163504267440ec0a36087a407a5f ]
iscsi_if_stop_conn() is only called from the userspace interface but in a subsequent commit we will want to call it from the kernel interface to allow drivers like qedi to remove sessions from inside the kernel during shutdown. This removes the iscsi_uevent code from iscsi_if_stop_conn() so we can call it in a new helper.
--- drivers/scsi/scsi_transport_iscsi.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-)
drivers/scsi/scsi_transport_iscsi.c +7 -10
@@ -2264,16 +2264,8 @@ static void iscsi_if_disconnect_bound_ep(struct iscsi_cls_conn *conn, } } -static int iscsi_if_stop_conn (struct iscsi_transport *transport, -struct iscsi_uevent *ev) +static int iscsi_if_stop_conn (struct iscsi_cls_conn *conn,int flag) { -int flag = ev->u.stop_conn.flag; -struct iscsi_cls_conn *conn; - - conn =iscsi_conn_lookup (ev->u.stop_conn.sid, ev->u.stop_conn.cid); -if (!conn) -return -EINVAL ; -ISCSI_DBG_TRANS_CONN (conn,"iscsi if conn stop.\n" );/* * If this is a termination we have to call stop_conn with that flag
@@ -3720,7 +3712,12 @@ static int iscsi_if_transport_conn(struct iscsi_transport *transport,case ISCSI_UEVENT_DESTROY_CONN :return iscsi_if_destroy_conn (transport, ev);case ISCSI_UEVENT_STOP_CONN : -return iscsi_if_stop_conn (transport, ev); + conn =iscsi_conn_lookup (ev->u.stop_conn.sid, + ev->u.stop_conn.cid); +if (!conn) +return -EINVAL ; + +return iscsi_if_stop_conn (conn, ev->u.stop_conn.flag); }/*
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 687/1095 scsi: iscsi: Add helper to remove a session from the kernel
In reply to Greg Kroah-HartmanFrom: Mike Christie <[email protected]>
[ Upstream commit bb42856bfd54fda1cbc7c470fcf5db1596938f4f ]
During qedi shutdown we need to stop the iSCSI layer from sending new nops as pings and from responding to target ones and make sure there is no running connection cleanups. Commit d1f2ce77638d ("scsi: qedi: Fix host removal with running sessions") converted the driver to use the libicsi helper to drive session removal, so the above issues could be handled. The problem is that during system shutdown iscsid will not be running so when we try to remove the root session we will hang waiting for userspace to reply.
Add a helper that will drive the destruction of sessions like these during system shutdown.
--- drivers/scsi/scsi_transport_iscsi.c | 49 +++++++++++++++++++++++++++++ include/scsi/scsi_transport_iscsi.h | 1 + 2 files changed, 50 insertions(+)
drivers/scsi/scsi_transport_iscsi.c +49 -0
@@ -2341,6 +2341,55 @@ static void iscsi_cleanup_conn_work_fn(struct work_struct *work)ISCSI_DBG_TRANS_CONN (conn,"cleanup done.\n" ); } +static int iscsi_iter_force_destroy_conn_fn (struct device *dev,void *data) +{ +struct iscsi_transport *transport; +struct iscsi_cls_conn *conn; + +if (!iscsi_is_conn_dev (dev)) +return 0 ; + + conn =iscsi_dev_to_conn (dev); + transport = conn->transport; + +if (READ_ONCE (conn->state) !=ISCSI_CONN_DOWN ) +iscsi_if_stop_conn (conn,STOP_CONN_TERM ); + + transport->destroy_conn (conn); +return 0 ; +} + +/** +* iscsi_force_destroy_session - destroy a session from the kernel +* @session: session to destroy +* +* Force the destruction of a session from the kernel. This should only be +* used when userspace is no longer running during system shutdown. +*/ +void iscsi_force_destroy_session (struct iscsi_cls_session *session) +{ +struct iscsi_transport *transport = session->transport; +unsigned long flags; + +WARN_ON_ONCE (system_state ==SYSTEM_RUNNING ); + +spin_lock_irqsave (&sesslock, flags); +if (list_empty (&session->sess_list)) { +spin_unlock_irqrestore (&sesslock, flags); +/* +* Conn/ep is already freed. Session is being torn down via +* async path. For shutdown we don't care about it so return. +*/ +return ; + } +spin_unlock_irqrestore (&sesslock, flags); + +device_for_each_child (&session->dev,NULL , + iscsi_iter_force_destroy_conn_fn); + transport->destroy_session (session); +} +EXPORT_SYMBOL_GPL (iscsi_force_destroy_session); +void iscsi_free_session (struct iscsi_cls_session *session) {ISCSI_DBG_TRANS_SESSION (session,"Freeing session\n" );
include/scsi/scsi_transport_iscsi.h +1 -0
@@ -442,6 +442,7 @@ extern struct iscsi_cls_session *iscsi_create_session(struct Scsi_Host *shost,struct iscsi_transport *t, int dd_size, unsigned int target_id); +extern void iscsi_force_destroy_session (struct iscsi_cls_session *session);extern void iscsi_remove_session (struct iscsi_cls_session *session);extern void iscsi_free_session (struct iscsi_cls_session *session); extern struct iscsi_cls_conn *iscsi_alloc_conn(struct iscsi_cls_session *sess,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 688/1095 scsi: iscsi: Fix session removal on shutdown
In reply to Greg Kroah-HartmanFrom: Mike Christie <[email protected]>
[ Upstream commit 31500e902759322ba3c64b60dabae2704e738df8 ]
When the system is shutting down, iscsid is not running so we will not get a response to the ISCSI_ERR_INVALID_HOST error event. The system shutdown will then hang waiting on userspace to remove the session.
This has libiscsi force the destruction of the session from the kernel when iscsi_host_remove() is called from a driver's shutdown callout.
This fixes a regression added in qedi boot with commit d1f2ce77638d ("scsi:
qedi: Fix host removal with running sessions") which made qedi use the common session removal function that waits on userspace instead of rolling its own kernel based removal.
--- drivers/infiniband/ulp/iser/iscsi_iser.c | 4 ++-- drivers/scsi/be2iscsi/be_main.c | 2 +- drivers/scsi/bnx2i/bnx2i_iscsi.c | 2 +- drivers/scsi/cxgbi/libcxgbi.c | 2 +- drivers/scsi/iscsi_tcp.c | 4 ++-- drivers/scsi/libiscsi.c | 9 +++++++-- drivers/scsi/qedi/qedi_main.c | 9 ++++++--- include/scsi/libiscsi.h | 2 +- 8 files changed, 21 insertions(+), 13 deletions(-)
drivers/infiniband/ulp/iser/iscsi_iser.c +2 -2
@@ -568,7 +568,7 @@ static void iscsi_iser_session_destroy(struct iscsi_cls_session *cls_session)struct Scsi_Host *shost =iscsi_session_to_shost (cls_session);iscsi_session_teardown (cls_session); -iscsi_host_remove (shost); +iscsi_host_remove (shost, false);iscsi_host_free (shost); }
@@ -685,7 +685,7 @@ iscsi_iser_session_create(struct iscsi_endpoint *ep,return cls_session; remove_host: -iscsi_host_remove (shost); +iscsi_host_remove (shost, false); free_host:iscsi_host_free (shost);return NULL ;
drivers/scsi/be2iscsi/be_main.c +1 -1
@@ -5745,7 +5745,7 @@ static void beiscsi_remove(struct pci_dev *pcidev)cancel_work_sync (&phba->sess_work);beiscsi_iface_destroy_default (phba); -iscsi_host_remove (phba->shost); +iscsi_host_remove (phba->shost, false);beiscsi_disable_port (phba,1 );/* after cancelling boot_work */
drivers/scsi/bnx2i/bnx2i_iscsi.c +1 -1
@@ -909,7 +909,7 @@ void bnx2i_free_hba(struct bnx2i_hba *hba) {struct Scsi_Host *shost = hba->shost; -iscsi_host_remove (shost); +iscsi_host_remove (shost, false);INIT_LIST_HEAD (&hba->ep_ofld_list);INIT_LIST_HEAD (&hba->ep_active_list);INIT_LIST_HEAD (&hba->ep_destroy_list);
drivers/scsi/cxgbi/libcxgbi.c +1 -1
@@ -328,7 +328,7 @@ void cxgbi_hbas_remove(struct cxgbi_device *cdev) chba = cdev->hbas[i];if (chba) { cdev->hbas[i] =NULL ; -iscsi_host_remove (chba->shost); +iscsi_host_remove (chba->shost, false);pci_dev_put (cdev->pdev);iscsi_host_free (chba->shost); }
drivers/scsi/iscsi_tcp.c +2 -2
@@ -898,7 +898,7 @@ iscsi_sw_tcp_session_create(struct iscsi_endpoint *ep, uint16_t cmds_max, remove_session:iscsi_session_teardown (cls_session); remove_host: -iscsi_host_remove (shost); +iscsi_host_remove (shost, false); free_host:iscsi_host_free (shost);return NULL ;
@@ -915,7 +915,7 @@ static void iscsi_sw_tcp_session_destroy(struct iscsi_cls_session *cls_session)iscsi_tcp_r2tpool_free (cls_session->dd_data);iscsi_session_teardown (cls_session); -iscsi_host_remove (shost); +iscsi_host_remove (shost, false);iscsi_host_free (shost); }
drivers/scsi/libiscsi.c +7 -2
@@ -2828,11 +2828,12 @@ static void iscsi_notify_host_removed(struct iscsi_cls_session *cls_session)/** * iscsi_host_remove - remove host and sessions * @shost: scsi host +* @is_shutdown: true if called from a driver shutdown callout * * If there are any sessions left, this will initiate the removal and wait * for the completion. */ -void iscsi_host_remove (struct Scsi_Host *shost) +void iscsi_host_remove (struct Scsi_Host *shost,bool is_shutdown) {struct iscsi_host *ihost =shost_priv (shost);unsigned long flags;
@@ -2841,7 +2842,11 @@ void iscsi_host_remove(struct Scsi_Host *shost) ihost->state =ISCSI_HOST_REMOVED ;spin_unlock_irqrestore (&ihost->lock, flags); -iscsi_host_for_each_session (shost, iscsi_notify_host_removed); +if (!is_shutdown) +iscsi_host_for_each_session (shost, iscsi_notify_host_removed); +else +iscsi_host_for_each_session (shost, iscsi_force_destroy_session); +wait_event_interruptible (ihost->session_removal_wq, ihost->num_sessions ==0 );if (signal_pending (current))
drivers/scsi/qedi/qedi_main.c +6 -3
@@ -2414,9 +2414,12 @@ static void __qedi_remove(struct pci_dev *pdev, int mode)int rval;u16 retry =10 ; -if (mode ==QEDI_MODE_NORMAL || mode ==QEDI_MODE_SHUTDOWN ) { -iscsi_host_remove (qedi->shost); +if (mode ==QEDI_MODE_NORMAL ) +iscsi_host_remove (qedi->shost, false); +else if (mode ==QEDI_MODE_SHUTDOWN ) +iscsi_host_remove (qedi->shost, true); +if (mode ==QEDI_MODE_NORMAL || mode ==QEDI_MODE_SHUTDOWN ) {if (qedi->tmf_thread) {destroy_workqueue (qedi->tmf_thread); qedi->tmf_thread =NULL ;
@@ -2791,7 +2794,7 @@ static int __qedi_probe(struct pci_dev *pdev, int mode)#ifdef CONFIG_DEBUG_FS qedi_dbg_host_exit (&qedi->dbg_ctx);#endif -iscsi_host_remove (qedi->shost); +iscsi_host_remove (qedi->shost, false); stop_iscsi_func: qedi_ops->stop (qedi->cdev); stop_slowpath:
include/scsi/libiscsi.h +1 -1
@@ -411,7 +411,7 @@ extern int iscsi_host_add(struct Scsi_Host *shost, struct device *pdev);extern struct Scsi_Host *iscsi_host_alloc (struct scsi_host_template *sht,int dd_data_size,bool xmit_can_sleep); -extern void iscsi_host_remove (struct Scsi_Host *shost); +extern void iscsi_host_remove (struct Scsi_Host *shost,bool is_shutdown);extern void iscsi_host_free (struct Scsi_Host *shost);extern int iscsi_target_alloc (struct scsi_target *starget); extern int iscsi_host_get_max_scsi_cmds(struct Scsi_Host *shost,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 689/1095 dmaengine: dw-edma: Fix eDMA Rd/Wr-channels and DMA-direction semantics
In reply to Greg Kroah-HartmanFrom: Serge Semin <[email protected]>
[ Upstream commit c1e33979171da63cf47e56243ccb8ba82363c7d3 ]
In accordance with [1, 2] the DW eDMA controller has been created to be part of the DW PCIe Root Port and DW PCIe End-point controllers and to offload the transferring of large blocks of data between application and remote PCIe domains leaving the system CPU free for other tasks. In the first case (eDMA being part of DW PCIe Root Port) the eDMA controller is always accessible via the CPU DBI interface and never over the PCIe wire.
The latter case is more complex. Depending on the DW PCIe End-Point IP-core synthesize parameters it's possible to have the eDMA registers accessible not only from the application CPU side, but also via mapping the eDMA CSRs over a dedicated endpoint BAR. So based on the specifics denoted above the eDMA driver is supposed to support two types of the DMA controller setups:
1) eDMA embedded into the DW PCIe Root Port/End-point and accessible over the local CPU from the application side.
2) eDMA embedded into the DW PCIe End-point and accessible via the PCIe wire with MWr/MRd TLPs generated by the CPU PCIe host controller.
Since the CPU memory resides different sides in these cases the semantics of the MEM_TO_DEV and DEV_TO_MEM operations is flipped with respect to the Tx and Rx DMA channels. So MEM_TO_DEV/DEV_TO_MEM corresponds to the Tx/Rx channels in setup 1) and to the Rx/Tx channels in case of setup 2).
The DW eDMA driver has supported the case 2) since e63d79d1ffcd ("dmaengine: Add Synopsys eDMA IP core driver") in the framework of the drivers/dma/dw-edma/dw-edma-pcie.c driver.
The case 1) support was added later by bd96f1b2f43a ("dmaengine: dw-edma:
support local dma device transfer semantics"). Afterwards the driver was supposed to cover the both possible eDMA setups, but the latter commit turned out to be not fully correct.
The problem was that the commit together with the new functionality support also changed the channel direction semantics so the eDMA Read-channel (corresponding to the DMA_DEV_TO_MEM direction for case 1) now uses the sgl/cyclic base addresses as the Source addresses of the DMA transfers and dma_slave_config.dst_addr as the Destination address of the DMA transfers.
Similarly the eDMA Write-channel (corresponding to the DMA_MEM_TO_DEV direction for case 1) now uses dma_slave_config.src_addr as a source address of the DMA transfers and sgl/cyclic base address as the Destination address of the DMA transfers. This contradicts the logic of the DMA-interface, which implies that DEV side is supposed to belong to the PCIe device memory and MEM - to the CPU/Application memory. Indeed it seems irrational to have the SG-list defined in the PCIe bus space, while expecting a contiguous buffer allocated in the CPU memory. Moreover the passed SG-list and cyclic DMA buffers are supposed to be mapped in a way so to be seen by the DW eDMA Application (CPU) interface.
So in order to have the correct DW eDMA interface we need to invert the eDMA Rd/Wr-channels and DMA-slave directions semantics by selecting the src/dst addresses based on the DMA transfer direction instead of using the channel direction capability.
[1] DesignWare Cores PCI Express Controller Databook - DWC PCIe Root Port,
v.5.40a, March 2019, p.1092
[2] DesignWare Cores PCI Express Controller Databook - DWC PCIe Endpoint,
v.5.40a, March 2019, p.1189--- drivers/dma/dw-edma/dw-edma-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/dma/dw-edma/dw-edma-core.c +1 -1
@@ -423,7 +423,7 @@ dw_edma_device_transfer(struct dw_edma_transfer *xfer) chunk->ll_region.sz += burst->sz; desc->alloc_sz += burst->sz; -if (chan->dir ==EDMA_DIR_WRITE ) { +if (dir ==DMA_DEV_TO_MEM ) { burst->sar = src_addr;if (xfer->type ==EDMA_XFER_CYCLIC ) { burst->dar = xfer->xfer.cyclic.paddr;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 690/1095 KVM: x86: Fix errant brace in KVM capability handling
In reply to Greg Kroah-HartmanFrom: Ben Gardon <[email protected]>
[ Upstream commit 1c4dc57328bf218e999951824dce75c6125c4f3c ]
The braces around the KVM_CAP_XSAVE2 block also surround the KVM_CAP_PMU_CAPABILITY block, likely the result of a merge issue. Simply move the curly brace back to where it belongs.
Message-Id: <[email protected]>
--- arch/x86/kvm/x86.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kvm/x86.c +1 -1
@@ -4377,10 +4377,10 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)if (r <sizeof (struct kvm_xsave )) r =sizeof (struct kvm_xsave );break ; + }case KVM_CAP_PMU_CAPABILITY : r = enable_pmu ?KVM_CAP_PMU_VALID_MASK :0 ;break ; - }case KVM_CAP_DISABLE_QUIRKS2 : r =KVM_X86_VALID_QUIRKS ;break ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 691/1095 mtd: hyperbus: rpc-if: Fix RPM imbalance in probe error path
In reply to Greg Kroah-HartmanFrom: Geert Uytterhoeven <[email protected]>
[ Upstream commit c223a38d62e57aa60a890ea7247e3c58a54478e6 ]
If rpcif_hw_init() fails, Runtime PM is left enabled.
--- drivers/mtd/hyperbus/rpc-if.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/mtd/hyperbus/rpc-if.c +6 -2
@@ -134,7 +134,7 @@ static int rpcif_hb_probe(struct platform_device *pdev) error =rpcif_hw_init (&hyperbus->rpc, true);if (error) -return error; + goto out_disable_rpm; hyperbus->hbdev.map.size = hyperbus->rpc.size; hyperbus->hbdev.map.virt = hyperbus->rpc.dirmap;
@@ -145,8 +145,12 @@ static int rpcif_hb_probe(struct platform_device *pdev) hyperbus->hbdev.np =of_get_next_child (pdev->dev.parent->of_node,NULL ); error =hyperbus_register_device (&hyperbus->hbdev);if (error) -rpcif_disable_rpm (&hyperbus->rpc); + goto out_disable_rpm; + +return 0 ; +out_disable_rpm: +rpcif_disable_rpm (&hyperbus->rpc);return error; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 692/1095 mtd: dataflash: Add SPI ID table
In reply to Greg Kroah-HartmanFrom: Mark Brown <[email protected]>
[ Upstream commit ac4f83482afbfd927d0fe118151b747cf175e724 ]
Currently autoloading for SPI devices does not use the DT ID table, it uses SPI modalises. Supporting OF modalises is going to be difficult if not impractical, an attempt was made but has been reverted, so ensure that module autoloading works for this driver by adding an id_table listing the SPI IDs for everything.
--- drivers/mtd/devices/mtd_dataflash.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/mtd/devices/mtd_dataflash.c +8 -0
@@ -112,6 +112,13 @@ static const struct of_device_id dataflash_dt_ids[] = {MODULE_DEVICE_TABLE (of, dataflash_dt_ids);#endif +static const struct spi_device_id dataflash_spi_ids[] = { + { .name ="at45" , }, + { .name ="dataflash" , }, + {/* sentinel */ } +}; +MODULE_DEVICE_TABLE (spi, dataflash_spi_ids); +/* ......................................................................... */ /*
@@ -936,6 +943,7 @@ static struct spi_driver dataflash_driver = { .probe = dataflash_probe, .remove = dataflash_remove, + .id_table = dataflash_spi_ids,/* FIXME: investigate suspend and resume... */ };
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 693/1095 clk: qcom: camcc-sm8250: Fix halt on boot by reducing drivers init level
In reply to Greg Kroah-HartmanFrom: Vladimir Zapolskiy <[email protected]>
[ Upstream commit c4f40351901a10cd662ac2c081396d8fb04f584d ]
Access to I/O of SM8250 camera clock controller IP depends on enabled GCC_CAMERA_AHB_CLK clock supplied by global clock controller, the latter one is inited on subsys level, so, to satisfy the dependency, it would make sense to deprive the init level of camcc-sm8250 driver.
If both drivers are compiled as built-in, there is a change that a board won't boot up due to a race, which happens on the same init level.
--- drivers/clk/qcom/camcc-sm8250.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-)
drivers/clk/qcom/camcc-sm8250.c +1 -11
@@ -2440,17 +2440,7 @@ static struct platform_driver cam_cc_sm8250_driver = { }, }; -static int __init cam_cc_sm8250_init (void ) -{ -return platform_driver_register (&cam_cc_sm8250_driver); -} -subsys_initcall (cam_cc_sm8250_init); - -static void __exit cam_cc_sm8250_exit(void) -{ -platform_driver_unregister (&cam_cc_sm8250_driver); -} -module_exit (cam_cc_sm8250_exit); +module_platform_driver (cam_cc_sm8250_driver);MODULE_DESCRIPTION ("QTI CAMCC SM8250 Driver" );MODULE_LICENSE ("GPL v2" );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 694/1095 misc: rtsx: Fix an error handling path in rtsx_pci_probe()
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 44fd1917314e9d4f53dd95dd65df1c152f503d3a ]
If an error occurs after a successful idr_alloc() call, the corresponding resource must be released with idr_remove() as already done in the .remove function.
Update the error handling path to add the missing idr_remove() call.
--- drivers/misc/cardreader/rtsx_pcr.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/misc/cardreader/rtsx_pcr.c +5 -1
@@ -1507,7 +1507,7 @@ static int rtsx_pci_probe(struct pci_dev *pcidev, pcr->remap_addr =ioremap (base, len);if (!pcr->remap_addr) { ret = -ENOMEM ; - goto free_handle; + goto free_idr; } pcr->rtsx_resv_buf = dma_alloc_coherent(&(pcidev->dev),
@@ -1570,6 +1570,10 @@ static int rtsx_pci_probe(struct pci_dev *pcidev, pcr->rtsx_resv_buf, pcr->rtsx_resv_buf_addr); unmap:iounmap (pcr->remap_addr); +free_idr: +spin_lock (&rtsx_pci_lock); +idr_remove (&rtsx_pci_idr, pcr->id); +spin_unlock (&rtsx_pci_lock); free_handle:kfree (handle); free_pcr:
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 695/1095 driver core: fix potential deadlock in __driver_attach
In reply to Greg Kroah-HartmanFrom: Zhang Wensheng <[email protected]>
[ Upstream commit 70fe758352cafdee72a7b13bf9db065f9613ced8 ]
In __driver_attach function, There are also AA deadlock problem, like the commit b232b02bf3c2 ("driver core: fix deadlock in __device_attach").
stack like commit b232b02bf3c2 ("driver core: fix deadlock in __device_attach").
list below:
In __driver_attach function, The lock holding logic is as follows:
...
__driver_attach
if (driver_allows_async_probing(drv))
device_lock(dev) // get lock dev
async_schedule_dev(__driver_attach_async_helper, dev); // func
async_schedule_node
async_schedule_node_domain(func)
entry = kzalloc(sizeof(struct async_entry), GFP_ATOMIC); /* when fail or work limit, sync to execute func, but
__driver_attach_async_helper will get lock dev as will, which will lead to A-A deadlock. */
if (!entry || atomic_read(&entry_count) > MAX_WORK) {
func;
else
queue_work_node(node, system_unbound_wq, &entry->work)
device_unlock(dev)
As above show, when it is allowed to do async probes, because of out of memory or work limit, async work is not be allowed, to do sync execute instead. it will lead to A-A deadlock because of __driver_attach_async_helper getting lock dev.
Reproduce:
and it can be reproduce by make the condition
(if (!entry || atomic_read(&entry_count) > MAX_WORK)) untenable, like below:
[ 370.785650] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. [ 370.787154] task:swapper/0 state:D stack: 0 pid: 1 ppid: 0 flags:0x00004000 [ 370.788865] Call Trace: [ 370.789374] <TASK> [ 370.789841] __schedule+0x482/0x1050 [ 370.790613] schedule+0x92/0x1a0 [ 370.791290] schedule_preempt_disabled+0x2c/0x50 [ 370.792256] __mutex_lock.isra.0+0x757/0xec0 [ 370.793158] __mutex_lock_slowpath+0x1f/0x30 [ 370.794079] mutex_lock+0x50/0x60 [ 370.794795] __device_driver_lock+0x2f/0x70 [ 370.795677] ? driver_probe_device+0xd0/0xd0 [ 370.796576] __driver_attach_async_helper+0x1d/0xd0 [ 370.797318] ? driver_probe_device+0xd0/0xd0 [ 370.797957] async_schedule_node_domain+0xa5/0xc0 [ 370.798652] async_schedule_node+0x19/0x30 [ 370.799243] __driver_attach+0x246/0x290 [ 370.799828] ? driver_allows_async_probing+0xa0/0xa0 [ 370.800548] bus_for_each_dev+0x9d/0x130 [ 370.801132] driver_attach+0x22/0x30 [ 370.801666] bus_add_driver+0x290/0x340 [ 370.802246] driver_register+0x88/0x140 [ 370.802817] ? virtio_scsi_init+0x116/0x116 [ 370.803425] scsi_register_driver+0x1a/0x30 [ 370.804057] init_sd+0x184/0x226 [ 370.804533] do_one_initcall+0x71/0x3a0 [ 370.805107] kernel_init_freeable+0x39a/0x43a [ 370.805759] ? rest_init+0x150/0x150 [ 370.806283] kernel_init+0x26/0x230 [ 370.806799] ret_from_fork+0x1f/0x30
To fix the deadlock, move the async_schedule_dev outside device_lock, as we can see, in async_schedule_node_domain, the parameter of queue_work_node is system_unbound_wq, so it can accept concurrent operations. which will also not change the code logic, and will not lead to deadlock.
--- drivers/base/dd.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/base/dd.c +4 -1
@@ -1091,6 +1091,7 @@ static void __driver_attach_async_helper(void *_dev, async_cookie_t cookie)static int __driver_attach (struct device *dev,void *data) {struct device_driver *drv = data; +bool async = false;int ret;/*
@@ -1129,9 +1130,11 @@ static int __driver_attach(struct device *dev, void *data)if (!dev->driver) {get_device (dev); dev->p->async_driver = drv; -async_schedule_dev (__driver_attach_async_helper, dev); + async = true; }device_unlock (dev); +if (async) +async_schedule_dev (__driver_attach_async_helper, dev);return 0 ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 696/1095 clk: qcom: clk-krait: unlock spin after mux completion
In reply to Greg Kroah-HartmanFrom: Ansuel Smith <[email protected]>
[ Upstream commit df83d2c9e72910416f650ade1e07cc314ff02731 ]
Unlock spinlock after the mux switch is completed to prevent any corner case of mux request while the switch still needs to be done.
--- drivers/clk/qcom/clk-krait.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/clk/qcom/clk-krait.c +6 -1
@@ -32,11 +32,16 @@ static void __krait_mux_set_sel(struct krait_mux_clk *mux, int sel) regval |= (sel & mux->mask) << (mux->shift +LPL_SHIFT ); }krait_set_l2_indirect_reg (mux->offset, regval); -spin_unlock_irqrestore (&krait_clock_reg_lock, flags);/* Wait for switch to complete. */ mb ();udelay (1 ); + +/* +* Unlock now to make sure the mux register is not +* modified while switching to the new parent. +*/ +spin_unlock_irqrestore (&krait_clock_reg_lock, flags); }static int krait_mux_set_parent (struct clk_hw *hw,u8 index)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 697/1095 coresight: configfs: Fix unload of configurations on module exit
In reply to Greg Kroah-HartmanFrom: Mike Leach <[email protected]>
[ Upstream commit 199380decc5f9188a9e65676031950f1734aaffe ]
Any loaded configurations must be correctly unloaded on coresight module exit, or issues can arise with nested locking in the configfs directory code if built with CONFIG_LOCKDEP.
Prior to this patch, the preloaded configuration configfs directory entries were being unloaded by the recursive code in configfs_unregister_subsystem().
However, when built with CONFIG_LOCKDEP, this caused a nested lock warning, which was not mitigated by the LOCKDEP dependent code in fs/configfs/dir.c designed to prevent this, due to the different directory levels for the root of the directory being removed.
As the preloaded (and all other) configurations are registered after configfs_register_subsystem(), we now explicitly unload them before the call to configfs_unregister_subsystem().
The new routine cscfg_unload_cfgs_on_exit() iterates through the load owner list to unload any remaining configurations that were not unloaded by the user before the module exits. This covers both the CSCFG_OWNER_PRELOAD and CSCFG_OWNER_MODULE owner types, and will be extended to cover future load owner types for CoreSight configurations.
--- .../hwtracing/coresight/coresight-syscfg.c | 104 ++++++++++++++++-- 1 file changed, 93 insertions(+), 11 deletions(-)
drivers/hwtracing/coresight/coresight-syscfg.c +93 -11
@@ -414,6 +414,27 @@ static void cscfg_remove_owned_csdev_features(struct coresight_device *csdev, vo } } +/* +* Unregister all configuration and features from configfs owned by load_owner. +* Although this is called without the list mutex being held, it is in the +* context of an unload operation which are strictly serialised, +* so the lists cannot change during this call. +*/ +static void cscfg_fs_unregister_cfgs_feats (void *load_owner) +{ +struct cscfg_config_desc *config_desc; +struct cscfg_feature_desc *feat_desc; + +list_for_each_entry (config_desc, &cscfg_mgr->config_desc_list, item) { +if (config_desc->load_owner == load_owner) +cscfg_configfs_del_config (config_desc); + } +list_for_each_entry (feat_desc, &cscfg_mgr->feat_desc_list, item) { +if (feat_desc->load_owner == load_owner) +cscfg_configfs_del_feature (feat_desc); + } +} +/* * removal is relatively easy - just remove from all lists, anything that * matches the owner. Memory for the descriptors will be managed by the owner,
@@ -1022,8 +1043,10 @@ struct device *cscfg_device(void)/* Must have a release function or the kernel will complain on module unload */ static void cscfg_dev_release (struct device *dev) { +mutex_lock (&cscfg_mutex);kfree (cscfg_mgr); cscfg_mgr =NULL ; +mutex_unlock (&cscfg_mutex); }/* a device is needed to "own" some kernel elements such as sysfs entries. */
@@ -1042,6 +1065,13 @@ static int cscfg_create_device(void)if (!cscfg_mgr) goto create_dev_exit_unlock; +/* initialise the cscfg_mgr structure */ +INIT_LIST_HEAD (&cscfg_mgr->csdev_desc_list); +INIT_LIST_HEAD (&cscfg_mgr->feat_desc_list); +INIT_LIST_HEAD (&cscfg_mgr->config_desc_list); +INIT_LIST_HEAD (&cscfg_mgr->load_order_list); +atomic_set (&cscfg_mgr->sys_active_cnt,0 ); +/* setup the device */ dev =cscfg_device (); dev->release = cscfg_dev_release;
@@ -1056,17 +1086,73 @@ static int cscfg_create_device(void)return err; } -static void cscfg_clear_device (void ) +/* +* Loading and unloading is generally on user discretion. +* If exiting due to coresight module unload, we need to unload any configurations that remain, +* before we unregister the configfs intrastructure. +* +* Do this by walking the load_owner list and taking appropriate action, depending on the load +* owner type. +*/ +static void cscfg_unload_cfgs_on_exit (void ) { -struct cscfg_config_desc *cfg_desc; +struct cscfg_load_owner_info *owner_info =NULL ; +/* +* grab the mutex - even though we are exiting, some configfs files +* may still be live till we dump them, so ensure list data is +* protected from a race condition. +*/ mutex_lock (&cscfg_mutex); -list_for_each_entry (cfg_desc, &cscfg_mgr->config_desc_list, item) { -etm_perf_del_symlink_cscfg (cfg_desc); +while (!list_empty (&cscfg_mgr->load_order_list)) { + +/* remove in reverse order of loading */ + owner_info =list_last_entry (&cscfg_mgr->load_order_list, + struct cscfg_load_owner_info, item); + +/* action according to type */ +switch (owner_info->type) { +case CSCFG_OWNER_PRELOAD : +/* +* preloaded descriptors are statically allocated in +* this module - just need to unload dynamic items from +* csdev lists, and remove from configfs directories. +*/ +pr_info ("cscfg: unloading preloaded configurations\n" ); +break ; + +case CSCFG_OWNER_MODULE : +/* +* this is an error - the loadable module must have been unloaded prior +* to the coresight module unload. Therefore that module has not +* correctly unloaded configs in its own exit code. +* Nothing to do other than emit an error string as the static descriptor +* references we need to unload will have disappeared with the module. +*/ +pr_err ("cscfg: ERROR: prior module failed to unload configuration\n" ); + goto list_remove; + } + +/* remove from configfs - outside the scope of the list mutex */ +mutex_unlock (&cscfg_mutex); +cscfg_fs_unregister_cfgs_feats (owner_info); +mutex_lock (&cscfg_mutex); + +/* Next unload from csdev lists. */ +cscfg_unload_owned_cfgs_feats (owner_info); + +list_remove: +/* remove from load order list */ +list_del (&owner_info->item); } +mutex_unlock (&cscfg_mutex); +} + +static void cscfg_clear_device (void ) +{ +cscfg_unload_cfgs_on_exit ();cscfg_configfs_release (cscfg_mgr);device_unregister (cscfg_device ()); -mutex_unlock (&cscfg_mutex); }/* Initialise system config management API device */
@@ -1074,20 +1160,16 @@ int __init cscfg_init(void) {int err =0 ; +/* create the device and init cscfg_mgr */ err =cscfg_create_device ();if (err)return err; +/* initialise configfs subsystem */ err =cscfg_configfs_init (cscfg_mgr);if (err) goto exit_err; -INIT_LIST_HEAD (&cscfg_mgr->csdev_desc_list); -INIT_LIST_HEAD (&cscfg_mgr->feat_desc_list); -INIT_LIST_HEAD (&cscfg_mgr->config_desc_list); -INIT_LIST_HEAD (&cscfg_mgr->load_order_list); -atomic_set (&cscfg_mgr->sys_active_cnt,0 ); -/* preload built-in configurations */ err =cscfg_preload (THIS_MODULE );if (err)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 698/1095 coresight: syscfg: Update load and unload operations
In reply to Greg Kroah-HartmanFrom: Mike Leach <[email protected]>
[ Upstream commit 8add26f7ef33bba7984cb6ff7911c6aa970fe55a ]
The configfs system is a source of access to the config information in the configuration and feature lists.
This can result in additional LOCKDEP issues as a result of the mutex ordering between the config list mutex (cscfg_mutex) and the configfs system mutexes.
As such we need to adjust how load/unload operations work to ensure correct operation.
1) Previously the cscfg_mutex was held throughout the load/unload operation. This is now only held during configuration list manipulations, resulting in a multi-stage load/unload process.
2) All operations that manipulate the configfs representation of the configurations and features are now separated out and run without the cscfg_mutex being held. This avoids circular lock_dep issue with the built-in configfs mutexes and semaphores
3) As the load and unload is now multi-stage, some parts under the cscfg_mutex and others not:
i) A flag indicating a load / unload operation in progress is used to serialise load / unload operations.
ii) activating any configuration not possible when unload is in progress. iii) Configurations have an "available" flag set only after the last load stage for the configuration is complete. Activation of the configuration not possible till flag is set.
4) Following load/unload rules remain:
i) Unload prevented while any configuration is active remains. ii) Unload in strict reverse order of load.
iii) Existing configurations can be activated while a new load operation is underway. (by definition there can be no dependencies between an existing configuration and a new loading one due to ii) above.)
--- .../hwtracing/coresight/coresight-config.h | 2 + .../hwtracing/coresight/coresight-syscfg.c | 191 ++++++++++++++---- .../hwtracing/coresight/coresight-syscfg.h | 13 ++ 3 files changed, 165 insertions(+), 41 deletions(-)
drivers/hwtracing/coresight/coresight-config.h +2 -0
@@ -134,6 +134,7 @@ struct cscfg_feature_desc {* @active_cnt: ref count for activate on this configuration. * @load_owner: handle to load owner for dynamic load and unload of configs. * @fs_group: reference to configfs group for dynamic unload. +* @available: config can be activated - multi-stage load sets true on completion. */ struct cscfg_config_desc {const char *name;
@@ -148,6 +149,7 @@ struct cscfg_config_desc {atomic_t active_cnt;void *load_owner;struct config_group *fs_group; +bool available; };/**
drivers/hwtracing/coresight/coresight-syscfg.c +150 -41
271 lines not on this page · raw message
drivers/hwtracing/coresight/coresight-syscfg.h +13 -0
@@ -12,6 +12,17 @@#include "coresight-config.h" +/* +* Load operation types. +* When loading or unloading, another load operation cannot be run. +* When unloading configurations cannot be activated. +*/ +enum cscfg_load_ops { +CSCFG_NONE , +CSCFG_LOAD , +CSCFG_UNLOAD +}; +/** * System configuration manager device. *
@@ -30,6 +41,7 @@* @cfgfs_subsys: configfs subsystem used to manage configurations. * @sysfs_active_config:Active config hash used if CoreSight controlled from sysfs. * @sysfs_active_preset:Active preset index used if CoreSight controlled from sysfs. +* @load_state: A multi-stage load/unload operation is in progress. */ struct cscfg_manager {struct device dev;
@@ -41,6 +53,7 @@ struct cscfg_manager {struct configfs_subsystem cfgfs_subsys;u32 sysfs_active_config;int sysfs_active_preset; +enum cscfg_load_ops load_state; };/* get reference to dev in cscfg_manager */
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 699/1095 usb: gadget: f_mass_storage: Make CD-ROM emulation works with Windows OS
In reply to Greg Kroah-HartmanFrom: Neal Liu <[email protected]>
[ Upstream commit 3b91edd624ab1ab694deef513a45eb9e9d49d75f ]
Add read TOC with format 1 to support CD-ROM emulation with Windows OS.
This patch is tested on Windows OS Server 2019.
--- drivers/usb/gadget/function/f_mass_storage.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/usb/gadget/function/f_mass_storage.c +6 -5
@@ -1192,13 +1192,14 @@ static int do_read_toc(struct fsg_common *common, struct fsg_buffhd *bh)u8 format;int i, len; + format = common->cmnd[2 ] &0xf ; +if ((common->cmnd[1 ] & ~0x02 ) !=0 ||/* Mask away MSF */ - start_track >1 ) { + (start_track >1 && format !=0x1 )) { curlun->sense_data =SS_INVALID_FIELD_IN_CDB ;return -EINVAL ; } - format = common->cmnd[2 ] &0xf ;/* * Check if CDB is old style SFF-8020i * i.e. format is in 2 MSBs of byte 9
@@ -1208,8 +1209,8 @@ static int do_read_toc(struct fsg_common *common, struct fsg_buffhd *bh) format = (common->cmnd[9 ] >>6 ) &0x3 ;switch (format) { -case 0 : -/* Formatted TOC */ +case 0 :/* Formatted TOC */ +case 1 :/* Multi-session info */ len =4 +2 *8 ;/* 4 byte header + 2 descriptors */ memset (buf,0 , len); buf[1 ] = len -2 ;/* TOC Length excludes length field */
@@ -1250,7 +1251,7 @@ static int do_read_toc(struct fsg_common *common, struct fsg_buffhd *bh)return len;default : -/* Multi-session, PMA, ATIP, CD-TEXT not supported/required */ +/* PMA, ATIP, CD-TEXT not supported/required */ curlun->sense_data =SS_INVALID_FIELD_IN_CDB ;return -EINVAL ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 700/1095 clk: qcom: gcc-msm8939: Add missing SYSTEM_MM_NOC_BFDCD_CLK_SRC
In reply to Greg Kroah-HartmanFrom: Bryan O'Donoghue <[email protected]>
[ Upstream commit 07e7fcf1714c5f9930ad27613fea940aedba68da ]
When adding in the indexes for this clock-controller we missed SYSTEM_MM_NOC_BFDCD_CLK_SRC.
Add it in now.
--- include/dt-bindings/clock/qcom,gcc-msm8939.h | 1 + 1 file changed, 1 insertion(+)
include/dt-bindings/clock/qcom,gcc-msm8939.h +1 -0
@@ -192,6 +192,7 @@#define GCC_VENUS0_CORE0_VCODEC0_CLK 183#define GCC_VENUS0_CORE1_VCODEC0_CLK 184#define GCC_OXILI_TIMER_CLK 185 +#define SYSTEM_MM_NOC_BFDCD_CLK_SRC 186/* Indexes for GDSCs */ #define BIMC_GDSC 0
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 701/1095 clk: qcom: gcc-msm8939: Fix bimc_ddr_clk_src rcgr base address
In reply to Greg Kroah-HartmanFrom: Bryan O'Donoghue <[email protected]>
[ Upstream commit 63d42708320d6d2ca9ed505123d50ff4a542c36f ]
Reviewing qcom docs for the 8939 we can see the command rcgr is pointing to the wrong address. bimc_ddr_clk_src_rcgr is @ 0x01832024 not 0x01832004.
--- drivers/clk/qcom/gcc-msm8939.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/qcom/gcc-msm8939.c +1 -1
@@ -632,7 +632,7 @@ static struct clk_rcg2 system_noc_bfdcd_clk_src = { };static struct clk_rcg2 bimc_ddr_clk_src = { - .cmd_rcgr =0x32004 , + .cmd_rcgr =0x32024 , .hid_width =5 , .parent_map = gcc_xo_gpll0_bimc_map, .clkr.hw.init = &(struct clk_init_data ){
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 702/1095 clk: qcom: gcc-msm8939: Add missing system_mm_noc_bfdcd_clk_src
In reply to Greg Kroah-HartmanFrom: Bryan O'Donoghue <[email protected]>
[ Upstream commit dd363e2f7196278e7a30f509a0e8a841cb763b14 ]
The msm8939 has an additional higher operating point for the multi-media peripherals. The higher throughput MM componets operate off of the system-mm noc not the system noc.
system_mm_noc_bfdcd_clk_src is the source clock for the higher frequency capable system noc mm.
Maximum frequency for the MM SNOC is 400 MHz.
--- drivers/clk/qcom/gcc-msm8939.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
drivers/clk/qcom/gcc-msm8939.c +13 -0
@@ -644,6 +644,18 @@ static struct clk_rcg2 bimc_ddr_clk_src = { }, }; +static struct clk_rcg2 system_mm_noc_bfdcd_clk_src = { + .cmd_rcgr =0x2600c , + .hid_width =5 , + .parent_map = gcc_xo_gpll0_gpll6a_map, + .clkr.hw.init = &(struct clk_init_data ){ + .name ="system_mm_noc_bfdcd_clk_src" , + .parent_data = gcc_xo_gpll0_gpll6a_parent_data, + .num_parents =3 , + .ops = &clk_rcg2_ops, + }, +}; +static const struct freq_tbl ftbl_gcc_camss_ahb_clk[] = {F (40000000 ,P_GPLL0 ,10 ,1 ,2 ),F (80000000 ,P_GPLL0 ,10 ,0 ,0 ),
@@ -3623,6 +3635,7 @@ static struct clk_regmap *gcc_msm8939_clocks[] = { [GPLL2_VOTE] = &gpll2_vote, [PCNOC_BFDCD_CLK_SRC] = &pcnoc_bfdcd_clk_src.clkr, [SYSTEM_NOC_BFDCD_CLK_SRC] = &system_noc_bfdcd_clk_src.clkr, + [SYSTEM_MM_NOC_BFDCD_CLK_SRC] = &system_mm_noc_bfdcd_clk_src.clkr, [CAMSS_AHB_CLK_SRC] = &camss_ahb_clk_src.clkr, [APSS_AHB_CLK_SRC] = &apss_ahb_clk_src.clkr, [CSI0_CLK_SRC] = &csi0_clk_src.clkr,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 703/1095 clk: qcom: gcc-msm8939: Point MM peripherals to system_mm_noc clock
In reply to Greg Kroah-HartmanFrom: Bryan O'Donoghue <[email protected]>
[ Upstream commit 05eed0990927aa9634682fec58660e30f7b7ae30 ]
Qcom docs indciate the following peripherals operating from System NOC MM not from System NOC clocks.
- MDP
- VFE
- JPEGe
- Venus
Switch over the relevant parent pointers.
--- drivers/clk/qcom/gcc-msm8939.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/clk/qcom/gcc-msm8939.c +8 -8
@@ -2453,7 +2453,7 @@ static struct clk_branch gcc_camss_jpeg_axi_clk = { .hw.init = &(struct clk_init_data){ .name ="gcc_camss_jpeg_axi_clk" , .parent_data = &(const struct clk_parent_data ){ - .hw = &system_noc_bfdcd_clk_src.clkr.hw, + .hw = &system_mm_noc_bfdcd_clk_src.clkr.hw, }, .num_parents =1 , .flags =CLK_SET_RATE_PARENT ,
@@ -2657,7 +2657,7 @@ static struct clk_branch gcc_camss_vfe_axi_clk = { .hw.init = &(struct clk_init_data){ .name ="gcc_camss_vfe_axi_clk" , .parent_data = &(const struct clk_parent_data ){ - .hw = &system_noc_bfdcd_clk_src.clkr.hw, + .hw = &system_mm_noc_bfdcd_clk_src.clkr.hw, }, .num_parents =1 , .flags =CLK_SET_RATE_PARENT ,
@@ -2813,7 +2813,7 @@ static struct clk_branch gcc_mdss_axi_clk = { .hw.init = &(struct clk_init_data){ .name ="gcc_mdss_axi_clk" , .parent_data = &(const struct clk_parent_data ){ - .hw = &system_noc_bfdcd_clk_src.clkr.hw, + .hw = &system_mm_noc_bfdcd_clk_src.clkr.hw, }, .num_parents =1 , .flags =CLK_SET_RATE_PARENT ,
@@ -3205,7 +3205,7 @@ static struct clk_branch gcc_mdp_tbu_clk = { .hw.init = &(struct clk_init_data){ .name ="gcc_mdp_tbu_clk" , .parent_data = &(const struct clk_parent_data ){ - .hw = &system_noc_bfdcd_clk_src.clkr.hw, + .hw = &system_mm_noc_bfdcd_clk_src.clkr.hw, }, .num_parents =1 , .flags =CLK_SET_RATE_PARENT ,
@@ -3223,7 +3223,7 @@ static struct clk_branch gcc_venus_tbu_clk = { .hw.init = &(struct clk_init_data){ .name ="gcc_venus_tbu_clk" , .parent_data = &(const struct clk_parent_data ){ - .hw = &system_noc_bfdcd_clk_src.clkr.hw, + .hw = &system_mm_noc_bfdcd_clk_src.clkr.hw, }, .num_parents =1 , .flags =CLK_SET_RATE_PARENT ,
@@ -3241,7 +3241,7 @@ static struct clk_branch gcc_vfe_tbu_clk = { .hw.init = &(struct clk_init_data){ .name ="gcc_vfe_tbu_clk" , .parent_data = &(const struct clk_parent_data ){ - .hw = &system_noc_bfdcd_clk_src.clkr.hw, + .hw = &system_mm_noc_bfdcd_clk_src.clkr.hw, }, .num_parents =1 , .flags =CLK_SET_RATE_PARENT ,
@@ -3259,7 +3259,7 @@ static struct clk_branch gcc_jpeg_tbu_clk = { .hw.init = &(struct clk_init_data){ .name ="gcc_jpeg_tbu_clk" , .parent_data = &(const struct clk_parent_data ){ - .hw = &system_noc_bfdcd_clk_src.clkr.hw, + .hw = &system_mm_noc_bfdcd_clk_src.clkr.hw, }, .num_parents =1 , .flags =CLK_SET_RATE_PARENT ,
@@ -3496,7 +3496,7 @@ static struct clk_branch gcc_venus0_axi_clk = { .hw.init = &(struct clk_init_data){ .name ="gcc_venus0_axi_clk" , .parent_data = &(const struct clk_parent_data ){ - .hw = &system_noc_bfdcd_clk_src.clkr.hw, + .hw = &system_mm_noc_bfdcd_clk_src.clkr.hw, }, .num_parents =1 , .flags =CLK_SET_RATE_PARENT ,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 704/1095 usb: host: xhci: use snprintf() in xhci_decode_trb()
In reply to Greg Kroah-HartmanFrom: Sergey Shtylyov <[email protected]>
[ Upstream commit 1ce69c35b86038dd11d3a6115a04501c5b89a940 ]
Commit cbf286e8ef83 ("xhci: fix unsafe memory usage in xhci tracing") apparently missed one sprintf() call in xhci_decode_trb() -- replace it with the snprintf() call as well...
Found by Linux Verification Center (linuxtesting.org) with the SVACE static analysis tool.
--- drivers/usb/host/xhci.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/host/xhci.h +1 -1
@@ -2393,7 +2393,7 @@ static inline const char *xhci_decode_trb(char *str, size_t size, field3 & TRB_CYCLE ? 'C' : 'c');break ;case TRB_STOP_RING : - sprintf(str, + snprintf(str, size, "%s: slot %d sp %d ep %d flags %c", xhci_trb_type_string(type), TRB_TO_SLOT_ID(field3),
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 705/1095 RDMA/rxe: Fix deadlock in rxe_do_local_ops()
In reply to Greg Kroah-HartmanFrom: Bob Pearson <[email protected]>
[ Upstream commit 7cb33d1bc1ac8e51fd88928f96674d392f8e07c4 ]
When a local operation (invalidate mr, reg mr, bind mw) is finished there will be no ack packet coming from a responder to cause the wqe to be completed. This may happen anyway if a subsequent wqe performs IO. Currently if the wqe is signalled the completer tasklet is scheduled immediately but not otherwise.
This leads to a deadlock if the next wqe has the fence bit set in send flags and the operation is not signalled. This patch removes the condition that the wqe must be signalled in order to schedule the completer tasklet which is the simplest fix for this deadlock and is fairly low cost. This is the analog for local operations of always setting the ackreq bit in all last or only request packets even if the operation is not signalled.
--- drivers/infiniband/sw/rxe/rxe_req.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/infiniband/sw/rxe/rxe_req.c +5 -3
@@ -586,9 +586,11 @@ static int rxe_do_local_ops(struct rxe_qp *qp, struct rxe_send_wqe *wqe) wqe->status =IB_WC_SUCCESS ; qp->req.wqe_index =queue_next_index (qp->sq.queue, qp->req.wqe_index); -if ((wqe->wr.send_flags &IB_SEND_SIGNALED ) || - qp->sq_sig_type ==IB_SIGNAL_ALL_WR ) -rxe_run_task (&qp->comp.task,1 ); +/* There is no ack coming for local work requests +* which can lead to a deadlock. So go ahead and complete +* it now. +*/ +rxe_run_task (&qp->comp.task,1 );return 0 ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 706/1095 clk: qcom: ipq8074: fix NSS core PLL-s
In reply to Greg Kroah-HartmanFrom: Robert Marko <[email protected]>
[ Upstream commit ca41ec1b30434636c56c5600b24a8d964d359d9c ]
Like in IPQ6018 the NSS related Alpha PLL-s require initial configuration to work.
So, obtain the regmap that is required for the Alpha PLL configuration and thus utilize the qcom_cc_really_probe() as we already have the regmap. Then utilize the Alpha PLL configs from the downstream QCA 5.4 based kernel to configure them.
This fixes the UBI32 and NSS crypto PLL-s failing to get enabled by the kernel.
--- drivers/clk/qcom/gcc-ipq8074.c | 39 +++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-)
drivers/clk/qcom/gcc-ipq8074.c +38 -1
@@ -4371,6 +4371,33 @@ static struct clk_branch gcc_pcie0_axi_s_bridge_clk = { }, }; +static const struct alpha_pll_config ubi32_pll_config = { + .l =0x4e , + .config_ctl_val =0x200d4aa8 , + .config_ctl_hi_val =0x3c2 , + .main_output_mask =BIT (0 ), + .aux_output_mask =BIT (1 ), + .pre_div_val =0x0 , + .pre_div_mask =BIT (12 ), + .post_div_val =0x0 , + .post_div_mask =GENMASK (9 ,8 ), +}; + +static const struct alpha_pll_config nss_crypto_pll_config = { + .l =0x3e , + .alpha =0x0 , + .alpha_hi =0x80 , + .config_ctl_val =0x4001055b , + .main_output_mask =BIT (0 ), + .pre_div_val =0x0 , + .pre_div_mask =GENMASK (14 ,12 ), + .post_div_val =0x1 <<8 , + .post_div_mask =GENMASK (11 ,8 ), + .vco_mask =GENMASK (21 ,20 ), + .vco_val =0x0 , + .alpha_en_mask =BIT (24 ), +}; +static struct clk_hw *gcc_ipq8074_hws[] = { &gpll0_out_main_div2.hw, &gpll6_out_main_div2.hw,
@@ -4772,7 +4799,17 @@ static const struct qcom_cc_desc gcc_ipq8074_desc = {static int gcc_ipq8074_probe (struct platform_device *pdev) { -return qcom_cc_probe (pdev, &gcc_ipq8074_desc); +struct regmap *regmap; + + regmap =qcom_cc_map (pdev, &gcc_ipq8074_desc); +if (IS_ERR (regmap)) +return PTR_ERR (regmap); + +clk_alpha_pll_configure (&ubi32_pll_main, regmap, &ubi32_pll_config); +clk_alpha_pll_configure (&nss_crypto_pll_main, regmap, + &nss_crypto_pll_config); + +return qcom_cc_really_probe (pdev, &gcc_ipq8074_desc, regmap); }static struct platform_driver gcc_ipq8074_driver = {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 707/1095 clk: qcom: ipq8074: SW workaround for UBI32 PLL lock
In reply to Greg Kroah-HartmanFrom: Robert Marko <[email protected]>
[ Upstream commit 3401ea2856ef84f39b75f0dc5ebcaeda81cb90ec ]
UBI32 Huayra PLL fails to lock in 5 us in some SoC silicon and thus it will cause the wait_for_pll() to timeout and thus return the error indicating that the PLL failed to lock.
This is bug in Huayra PLL HW for which SW workaround is to set bit 26 of TEST_CTL register.
This is ported from the QCA 5.4 based downstream kernel.
--- drivers/clk/qcom/gcc-ipq8074.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/clk/qcom/gcc-ipq8074.c +3 -0
@@ -4805,6 +4805,9 @@ static int gcc_ipq8074_probe(struct platform_device *pdev)if (IS_ERR (regmap))return PTR_ERR (regmap); +/* SW Workaround for UBI32 Huayra PLL */ +regmap_update_bits (regmap,0x2501c ,BIT (26 ),BIT (26 )); +clk_alpha_pll_configure (&ubi32_pll_main, regmap, &ubi32_pll_config);clk_alpha_pll_configure (&nss_crypto_pll_main, regmap, &nss_crypto_pll_config);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 708/1095 clk: qcom: ipq8074: fix NSS port frequency tables
In reply to Greg Kroah-HartmanFrom: Robert Marko <[email protected]>
[ Upstream commit 0e9e61a2815b5cd34f1b495b2d72e8127ce9b794 ]
NSS port 5 and 6 frequency tables are currently broken and are causing a wide ranges of issue like 1G not working at all on port 6 or port 5 being clocked with 312 instead of 125 MHz as UNIPHY1 gets selected.
So, update the frequency tables with the ones from the downstream QCA 5.4 based kernel which has already fixed this.
--- drivers/clk/qcom/gcc-ipq8074.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/clk/qcom/gcc-ipq8074.c +8 -0
@@ -1788,8 +1788,10 @@ static struct clk_regmap_div nss_port4_tx_div_clk_src = {static const struct freq_tbl ftbl_nss_port5_rx_clk_src[] = {F (19200000 ,P_XO ,1 ,0 ,0 ),F (25000000 ,P_UNIPHY1_RX ,12.5 ,0 ,0 ), +F (25000000 ,P_UNIPHY0_RX ,5 ,0 ,0 ),F (78125000 ,P_UNIPHY1_RX ,4 ,0 ,0 ),F (125000000 ,P_UNIPHY1_RX ,2.5 ,0 ,0 ), +F (125000000 ,P_UNIPHY0_RX ,1 ,0 ,0 ),F (156250000 ,P_UNIPHY1_RX ,2 ,0 ,0 ),F (312500000 ,P_UNIPHY1_RX ,1 ,0 ,0 ), { }
@@ -1828,8 +1830,10 @@ static struct clk_regmap_div nss_port5_rx_div_clk_src = {static const struct freq_tbl ftbl_nss_port5_tx_clk_src[] = {F (19200000 ,P_XO ,1 ,0 ,0 ),F (25000000 ,P_UNIPHY1_TX ,12.5 ,0 ,0 ), +F (25000000 ,P_UNIPHY0_TX ,5 ,0 ,0 ),F (78125000 ,P_UNIPHY1_TX ,4 ,0 ,0 ),F (125000000 ,P_UNIPHY1_TX ,2.5 ,0 ,0 ), +F (125000000 ,P_UNIPHY0_TX ,1 ,0 ,0 ),F (156250000 ,P_UNIPHY1_TX ,2 ,0 ,0 ),F (312500000 ,P_UNIPHY1_TX ,1 ,0 ,0 ), { }
@@ -1867,8 +1871,10 @@ static struct clk_regmap_div nss_port5_tx_div_clk_src = {static const struct freq_tbl ftbl_nss_port6_rx_clk_src[] = {F (19200000 ,P_XO ,1 ,0 ,0 ), +F (25000000 ,P_UNIPHY2_RX ,5 ,0 ,0 ),F (25000000 ,P_UNIPHY2_RX ,12.5 ,0 ,0 ),F (78125000 ,P_UNIPHY2_RX ,4 ,0 ,0 ), +F (125000000 ,P_UNIPHY2_RX ,1 ,0 ,0 ),F (125000000 ,P_UNIPHY2_RX ,2.5 ,0 ,0 ),F (156250000 ,P_UNIPHY2_RX ,2 ,0 ,0 ),F (312500000 ,P_UNIPHY2_RX ,1 ,0 ,0 ),
@@ -1907,8 +1913,10 @@ static struct clk_regmap_div nss_port6_rx_div_clk_src = {static const struct freq_tbl ftbl_nss_port6_tx_clk_src[] = {F (19200000 ,P_XO ,1 ,0 ,0 ), +F (25000000 ,P_UNIPHY2_TX ,5 ,0 ,0 ),F (25000000 ,P_UNIPHY2_TX ,12.5 ,0 ,0 ),F (78125000 ,P_UNIPHY2_TX ,4 ,0 ,0 ), +F (125000000 ,P_UNIPHY2_TX ,1 ,0 ,0 ),F (125000000 ,P_UNIPHY2_TX ,2.5 ,0 ,0 ),F (156250000 ,P_UNIPHY2_TX ,2 ,0 ,0 ),F (312500000 ,P_UNIPHY2_TX ,1 ,0 ,0 ),
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 709/1095 clk: qcom: ipq8074: set BRANCH_HALT_DELAY flag for UBI clocks
In reply to Greg Kroah-HartmanFrom: Robert Marko <[email protected]>
[ Upstream commit 2bd357e698207e2e65db03007e4be65bf9d6a7b3 ]
Currently, attempting to enable the UBI clocks will cause the stuck at off warning to be printed and clk_enable will fail.
[ 14.936694] gcc_ubi1_ahb_clk status stuck at 'off'
Downstream 5.4 QCA kernel has fixed this by seting the BRANCH_HALT_DELAY flag on UBI clocks, so lets do the same.
--- drivers/clk/qcom/gcc-ipq8074.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/clk/qcom/gcc-ipq8074.c +10 -0
@@ -3354,6 +3354,7 @@ static struct clk_branch gcc_nssnoc_ubi1_ahb_clk = {static struct clk_branch gcc_ubi0_ahb_clk = { .halt_reg =0x6820c , + .halt_check =BRANCH_HALT_DELAY , .clkr = { .enable_reg =0x6820c , .enable_mask =BIT (0 ),
@@ -3371,6 +3372,7 @@ static struct clk_branch gcc_ubi0_ahb_clk = {static struct clk_branch gcc_ubi0_axi_clk = { .halt_reg =0x68200 , + .halt_check =BRANCH_HALT_DELAY , .clkr = { .enable_reg =0x68200 , .enable_mask =BIT (0 ),
@@ -3388,6 +3390,7 @@ static struct clk_branch gcc_ubi0_axi_clk = {static struct clk_branch gcc_ubi0_nc_axi_clk = { .halt_reg =0x68204 , + .halt_check =BRANCH_HALT_DELAY , .clkr = { .enable_reg =0x68204 , .enable_mask =BIT (0 ),
@@ -3405,6 +3408,7 @@ static struct clk_branch gcc_ubi0_nc_axi_clk = {static struct clk_branch gcc_ubi0_core_clk = { .halt_reg =0x68210 , + .halt_check =BRANCH_HALT_DELAY , .clkr = { .enable_reg =0x68210 , .enable_mask =BIT (0 ),
@@ -3422,6 +3426,7 @@ static struct clk_branch gcc_ubi0_core_clk = {static struct clk_branch gcc_ubi0_mpt_clk = { .halt_reg =0x68208 , + .halt_check =BRANCH_HALT_DELAY , .clkr = { .enable_reg =0x68208 , .enable_mask =BIT (0 ),
@@ -3439,6 +3444,7 @@ static struct clk_branch gcc_ubi0_mpt_clk = {static struct clk_branch gcc_ubi1_ahb_clk = { .halt_reg =0x6822c , + .halt_check =BRANCH_HALT_DELAY , .clkr = { .enable_reg =0x6822c , .enable_mask =BIT (0 ),
@@ -3456,6 +3462,7 @@ static struct clk_branch gcc_ubi1_ahb_clk = {static struct clk_branch gcc_ubi1_axi_clk = { .halt_reg =0x68220 , + .halt_check =BRANCH_HALT_DELAY , .clkr = { .enable_reg =0x68220 , .enable_mask =BIT (0 ),
@@ -3473,6 +3480,7 @@ static struct clk_branch gcc_ubi1_axi_clk = {static struct clk_branch gcc_ubi1_nc_axi_clk = { .halt_reg =0x68224 , + .halt_check =BRANCH_HALT_DELAY , .clkr = { .enable_reg =0x68224 , .enable_mask =BIT (0 ),
@@ -3490,6 +3498,7 @@ static struct clk_branch gcc_ubi1_nc_axi_clk = {static struct clk_branch gcc_ubi1_core_clk = { .halt_reg =0x68230 , + .halt_check =BRANCH_HALT_DELAY , .clkr = { .enable_reg =0x68230 , .enable_mask =BIT (0 ),
@@ -3507,6 +3516,7 @@ static struct clk_branch gcc_ubi1_core_clk = {static struct clk_branch gcc_ubi1_mpt_clk = { .halt_reg =0x68228 , + .halt_check =BRANCH_HALT_DELAY , .clkr = { .enable_reg =0x68228 , .enable_mask =BIT (0 ),
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 710/1095 clk: qcom: camcc-sdm845: Fix topology around titan_top power domain
In reply to Greg Kroah-HartmanFrom: Vladimir Zapolskiy <[email protected]>
[ Upstream commit 103dd2338bbff567bce7acd00fc5a09c806b38ec ]
On SDM845 two found VFE GDSC power domains shall not be operated, if titan top is turned off, thus the former power domains will be set as subdomains by a GDSC registration routine.
--- drivers/clk/qcom/camcc-sdm845.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/clk/qcom/camcc-sdm845.c +4 -0
@@ -1534,6 +1534,8 @@ static struct clk_branch cam_cc_sys_tmr_clk = { }, }; +static struct gdsc titan_top_gdsc; +static struct gdsc bps_gdsc = { .gdscr =0x6004 , .pd = {
@@ -1567,6 +1569,7 @@ static struct gdsc ife_0_gdsc = { .name = "ife_0_gdsc", }, .flags = POLL_CFG_GDSCR, + .parent = &titan_top_gdsc.pd, .pwrsts = PWRSTS_OFF_ON, };
@@ -1576,6 +1579,7 @@ static struct gdsc ife_1_gdsc = { .name = "ife_1_gdsc", }, .flags = POLL_CFG_GDSCR, + .parent = &titan_top_gdsc.pd, .pwrsts = PWRSTS_OFF_ON, };
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 711/1095 clk: qcom: camcc-sm8250: Fix topology around titan_top power domain
In reply to Greg Kroah-HartmanFrom: Vladimir Zapolskiy <[email protected]>
[ Upstream commit f8acf01a6a4f84baf05181e24bd48def4ba23f5b ]
On SM8250 two found VFE GDSC power domains shall not be operated, if titan top is turned off, thus the former power domains will be set as subdomains by a GDSC registration routine.
--- drivers/clk/qcom/camcc-sm8250.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/clk/qcom/camcc-sm8250.c +4 -0
@@ -2205,6 +2205,8 @@ static struct clk_branch cam_cc_sleep_clk = { }, }; +static struct gdsc titan_top_gdsc; +static struct gdsc bps_gdsc = { .gdscr =0x7004 , .pd = {
@@ -2238,6 +2240,7 @@ static struct gdsc ife_0_gdsc = { .name = "ife_0_gdsc", }, .flags = POLL_CFG_GDSCR, + .parent = &titan_top_gdsc.pd, .pwrsts = PWRSTS_OFF_ON, };
@@ -2247,6 +2250,7 @@ static struct gdsc ife_1_gdsc = { .name = "ife_1_gdsc", }, .flags = POLL_CFG_GDSCR, + .parent = &titan_top_gdsc.pd, .pwrsts = PWRSTS_OFF_ON, };
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 712/1095 clk: qcom: clk-rcg2: Fail Duty-Cycle configuration if MND divider is not enabled.
In reply to Greg Kroah-HartmanFrom: Nikita Travkin <[email protected]>
[ Upstream commit bdafb609c3bb848d710ad9cd4debd2ee9d6a4049 ]
In cases when MND is not enabled (e.g. when only Half Integer Divider is used), setting D registers makes no effect.
Fail instead of making ineffective write.
--- drivers/clk/qcom/clk-rcg2.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/clk/qcom/clk-rcg2.c +6 -1
@@ -405,7 +405,7 @@ static int clk_rcg2_get_duty_cycle(struct clk_hw *hw, struct clk_duty *duty)static int clk_rcg2_set_duty_cycle (struct clk_hw *hw,struct clk_duty *duty) {struct clk_rcg2 *rcg =to_clk_rcg2 (hw); -u32 notn_m, n, m, d, not2d, mask, duty_per; +u32 notn_m, n, m, d, not2d, mask, duty_per, cfg;int ret;/* Duty-cycle cannot be modified for non-MND RCGs */
@@ -416,6 +416,11 @@ static int clk_rcg2_set_duty_cycle(struct clk_hw *hw, struct clk_duty *duty)regmap_read (rcg->clkr.regmap,RCG_N_OFFSET (rcg), ¬n_m);regmap_read (rcg->clkr.regmap,RCG_M_OFFSET (rcg), &m); +regmap_read (rcg->clkr.regmap,RCG_CFG_OFFSET (rcg), &cfg); + +/* Duty-cycle cannot be modified if MND divider is in bypass mode. */ +if (!(cfg &CFG_MODE_MASK )) +return -EINVAL ; n = (~(notn_m) + m) & mask;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 713/1095 clk: qcom: clk-rcg2: Make sure to not write d=0 to the NMD register
In reply to Greg Kroah-HartmanFrom: Nikita Travkin <[email protected]>
[ Upstream commit d0696770cef35a1fd16ea2167e2198c18aa6fbfe ]
Sometimes calculation of d value may result in 0 because of the rounding after integer division. This causes the following error:
[ 113.969689] camss_gp1_clk_src: rcg didn't update its configuration. [ 113.969754] WARNING: CPU: 3 PID: 35 at drivers/clk/qcom/clk-rcg2.c:122 update_config+0xc8/0xdc
Make sure that D value is never zero.
--- drivers/clk/qcom/clk-rcg2.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/clk/qcom/clk-rcg2.c +6 -3
@@ -13,6 +13,7 @@#include <linux/rational.h> #include <linux/regmap.h> #include <linux/math64.h> +#include <linux/minmax.h> #include <linux/slab.h> #include <asm/div64.h>
@@ -429,9 +430,11 @@ static int clk_rcg2_set_duty_cycle(struct clk_hw *hw, struct clk_duty *duty)/* Calculate 2d value */ d =DIV_ROUND_CLOSEST (n * duty_per *2 ,100 ); -/* Check bit widths of 2d. If D is too big reduce duty cycle. */ -if (d > mask) - d = mask; +/* +* Check bit widths of 2d. If D is too big reduce duty cycle. +* Also make sure it is never zero. +*/ + d =clamp_val (d,1 , mask);if ((d /2 ) > (n - m)) d = (n - m) *2 ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 714/1095 kernfs: fix potential NULL dereference in __kernfs_remove
In reply to Greg Kroah-HartmanFrom: Yushan Zhou <[email protected]>
[ Upstream commit 72b5d5aef246a0387cefa23121dd90901c7a691a ]
When lockdep is enabled, lockdep_assert_held_write would cause potential NULL pointer dereference.
Fix the following smatch warnings:
fs/kernfs/dir.c:1353 __kernfs_remove() warn: variable dereferenced before check 'kn' (see line 1346)
--- fs/kernfs/dir.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
fs/kernfs/dir.c +5 -2
@@ -1343,14 +1343,17 @@ static void __kernfs_remove(struct kernfs_node *kn) {struct kernfs_node *pos; +/* Short-circuit if non-root @kn has already finished removal. */ +if (!kn) +return ; +lockdep_assert_held_write (&kernfs_root (kn)->kernfs_rwsem);/* -* Short-circuit if non-root @kn has already finished removal. * This is for kernfs_remove_self() which plays with active ref * after removal. */ -if (!kn || (kn->parent &&RB_EMPTY_NODE (&kn->rb))) +if (kn->parent &&RB_EMPTY_NODE (&kn->rb))return ;pr_debug ("kernfs %s: removing\n" , kn->name);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 715/1095 mm: rmap: use the correct parameter name for DEFINE_PAGE_VMA_WALK
In reply to Greg Kroah-HartmanFrom: Yang Shi <[email protected]>
[ Upstream commit 507db7927cd181d409dd495c8384b8e14c21c600 ]
The parameter used by DEFINE_PAGE_VMA_WALK is _page not page, fix the parameter name. It didn't cause any build error, it is probably because the only caller is write_protect_page() from ksm.c, which pass in page.
--- include/linux/rmap.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
include/linux/rmap.h +2 -2
@@ -220,8 +220,8 @@ struct page_vma_mapped_walk {#define DEFINE_PAGE_VMA_WALK (name, _page, _vma, _address, _flags) \ struct page_vma_mapped_walk name = { \ .pfn = page_to_pfn(_page), \ - .nr_pages = compound_nr(page), \ - .pgoff = page_to_pgoff(page), \ + .nr_pages = compound_nr(_page), \ + .pgoff = page_to_pgoff(_page), \ .vma = _vma, \ .address = _address, \ .flags = _flags, \
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 716/1095 mm/migration: return errno when isolate_huge_page failed
In reply to Greg Kroah-HartmanFrom: Miaohe Lin <[email protected]>
[ Upstream commit 7ce82f4c3f3ead13a9d9498768e3b1a79975c4d8 ]
We might fail to isolate huge page due to e.g. the page is under migration which cleared HPageMigratable. We should return errno in this case rather than always return 1 which could confuse the user, i.e. the caller might think all of the memory is migrated while the hugetlb page is left behind. We make the prototype of isolate_huge_page consistent with isolate_lru_page as suggested by Huang Ying and rename isolate_huge_page to isolate_hugetlb as suggested by Muchun to improve the readability.
--- include/linux/hugetlb.h | 6 +++--- mm/gup.c | 2 +- mm/hugetlb.c | 11 +++++------ mm/memory-failure.c | 2 +- mm/memory_hotplug.c | 2 +- mm/mempolicy.c | 2 +- mm/migrate.c | 7 ++++--- 7 files changed, 16 insertions(+), 16 deletions(-)
include/linux/hugetlb.h +3 -3
@@ -167,7 +167,7 @@ bool hugetlb_reserve_pages(struct inode *inode, long from, long to, vm_flags_t vm_flags);long hugetlb_unreserve_pages (struct inode *inode,long start,long end,long freed); -bool isolate_huge_page (struct page *page,struct list_head *list); +int isolate_hugetlb (struct page *page,struct list_head *list);int get_hwpoison_huge_page (struct page *page,bool *hugetlb);int get_huge_page_for_hwpoison (unsigned long pfn,int flags);void putback_active_hugepage (struct page *page);
@@ -369,9 +369,9 @@ static inline pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr,return NULL ; } -static inline bool isolate_huge_page (struct page *page,struct list_head *list) +static inline int isolate_hugetlb (struct page *page,struct list_head *list) { -return false; +return -EBUSY ; }static inline int get_hwpoison_huge_page (struct page *page,bool *hugetlb)
mm/gup.c +1 -1
@@ -1795,7 +1795,7 @@ static long check_and_migrate_movable_pages(unsigned long nr_pages,* Try to move out any movable page before pinning the range. */ if (folio_test_hugetlb (folio)) { -if (!isolate_huge_page (&folio->page, +if (isolate_hugetlb (&folio->page, &movable_page_list)) isolation_error_count++;continue ;
mm/hugetlb.c +5 -6
@@ -2758,8 +2758,7 @@ static int alloc_and_dissolve_huge_page(struct hstate *h, struct page *old_page,* Fail with -EBUSY if not possible. */ spin_unlock_irq (&hugetlb_lock); -if (!isolate_huge_page (old_page, list)) - ret = -EBUSY ; + ret =isolate_hugetlb (old_page, list);spin_lock_irq (&hugetlb_lock); goto free_new; }else if (!HPageFreed (old_page)) {
@@ -2835,7 +2834,7 @@ int isolate_or_dissolve_huge_page(struct page *page, struct list_head *list)if (hstate_is_gigantic (h))return -ENOMEM ; -if (page_count (head) &&isolate_huge_page (head, list)) +if (page_count (head) && !isolate_hugetlb (head, list)) ret =0 ;else if (!page_count (head)) ret =alloc_and_dissolve_huge_page (h, head, list);
@@ -6758,15 +6757,15 @@ follow_huge_pgd(struct mm_struct *mm, unsigned long address, pgd_t *pgd, int flareturn pte_page (*(pte_t *)pgd) + ((address & ~PGDIR_MASK ) >>PAGE_SHIFT ); } -bool isolate_huge_page (struct page *page,struct list_head *list) +int isolate_hugetlb (struct page *page,struct list_head *list) { -bool ret = true; +int ret =0 ;spin_lock_irq (&hugetlb_lock);if (!PageHeadHuge (page) || !HPageMigratable (page) || !get_page_unless_zero (page)) { - ret = false; + ret = -EBUSY ; goto unlock; }ClearHPageMigratable (page);
mm/memory-failure.c +1 -1
@@ -2211,7 +2211,7 @@ static bool isolate_page(struct page *page, struct list_head *pagelist)bool lru =PageLRU (page);if (PageHuge (page)) { - isolated =isolate_huge_page (page, pagelist); + isolated = !isolate_hugetlb (page, pagelist); }else {if (lru) isolated = !isolate_lru_page (page);
mm/memory_hotplug.c +1 -1
@@ -1627,7 +1627,7 @@ do_migrate_range(unsigned long start_pfn, unsigned long end_pfn)if (PageHuge (page)) { pfn =page_to_pfn (head) +compound_nr (head) -1 ; -isolate_huge_page (head, &source); +isolate_hugetlb (head, &source);continue ; }else if (PageTransHuge (page)) pfn =page_to_pfn (head) +thp_nr_pages (page) -1 ;
mm/mempolicy.c +1 -1
@@ -607,7 +607,7 @@ static int queue_pages_hugetlb(pte_t *pte, unsigned long hmask,/* With MPOL_MF_MOVE, we migrate only unshared hugepage. */ if (flags & (MPOL_MF_MOVE_ALL ) || (flags &MPOL_MF_MOVE &&page_mapcount (page) ==1 )) { -if (!isolate_huge_page (page, qp->pagelist) && +if (isolate_hugetlb (page, qp->pagelist) && (flags &MPOL_MF_STRICT ))/* * Failed to isolate page but allow migrating pages
mm/migrate.c +4 -3
@@ -133,7 +133,7 @@ static void putback_movable_page(struct page *page)* * This function shall be used whenever the isolated pageset has been * built from lru, balloon, hugetlbfs page. See isolate_migratepages_range() -* and isolate_huge_page(). +* and isolate_hugetlb(). */ void putback_movable_pages (struct list_head *l) {
@@ -1631,8 +1631,9 @@ static int add_page_for_migration(struct mm_struct *mm, unsigned long addr,if (PageHuge (page)) {if (PageHead (page)) { -isolate_huge_page (page, pagelist); - err =1 ; + err =isolate_hugetlb (page, pagelist); +if (!err) + err =1 ; } }else {struct page *head;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 717/1095 mm/migration: fix potential pte_unmap on an not mapped pte
In reply to Greg Kroah-HartmanFrom: Miaohe Lin <[email protected]>
[ Upstream commit ad1ac596e8a8c4b06715dfbd89853eb73c9886b2 ]
__migration_entry_wait and migration_entry_wait_on_locked assume pte is always mapped from caller. But this is not the case when it's called from migration_entry_wait_huge and follow_huge_pmd. Add a hugetlbfs variant that calls hugetlb_migration_entry_wait(ptep == NULL) to fix this issue.
--- include/linux/swapops.h | 12 ++++++++---- mm/hugetlb.c | 4 ++-- mm/migrate.c | 23 +++++++++++++++++++---- 3 files changed, 29 insertions(+), 10 deletions(-)
include/linux/swapops.h +8 -4
@@ -216,8 +216,10 @@ extern void __migration_entry_wait(struct mm_struct *mm, pte_t *ptep, spinlock_t *ptl);extern void migration_entry_wait (struct mm_struct *mm,pmd_t *pmd,unsigned long address); -extern void migration_entry_wait_huge (struct vm_area_struct *vma, -struct mm_struct *mm,pte_t *pte); +#ifdef CONFIG_HUGETLB_PAGE +extern void __migration_entry_wait_huge (pte_t *ptep,spinlock_t *ptl); +extern void migration_entry_wait_huge (struct vm_area_struct *vma,pte_t *pte); +#endif #else static inline swp_entry_t make_readable_migration_entry (pgoff_t offset) {
@@ -238,8 +240,10 @@ static inline void __migration_entry_wait(struct mm_struct *mm, pte_t *ptep, spinlock_t *ptl) { }static inline void migration_entry_wait (struct mm_struct *mm,pmd_t *pmd,unsigned long address) { } -static inline void migration_entry_wait_huge (struct vm_area_struct *vma, -struct mm_struct *mm,pte_t *pte) { } +#ifdef CONFIG_HUGETLB_PAGE +static inline void __migration_entry_wait_huge (pte_t *ptep,spinlock_t *ptl) { } +static inline void migration_entry_wait_huge (struct vm_area_struct *vma,pte_t *pte) { } +#endif static inline int is_writable_migration_entry (swp_entry_t entry) {return 0 ;
mm/hugetlb.c +2 -2
@@ -5602,7 +5602,7 @@ vm_fault_t hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma,*/ entry =huge_ptep_get (ptep);if (unlikely (is_hugetlb_entry_migration (entry))) { -migration_entry_wait_huge (vma, mm, ptep); +migration_entry_wait_huge (vma, ptep);return 0 ; }else if (unlikely (is_hugetlb_entry_hwpoisoned (entry))) return VM_FAULT_HWPOISON_LARGE |
@@ -6725,7 +6725,7 @@ follow_huge_pmd(struct mm_struct *mm, unsigned long address, }else {if (is_hugetlb_entry_migration (pte)) {spin_unlock (ptl); -__migration_entry_wait (mm, (pte_t *)pmd, ptl); +__migration_entry_wait_huge ((pte_t *)pmd, ptl); goto retry; }/*
mm/migrate.c +19 -4
@@ -309,13 +309,28 @@ void migration_entry_wait(struct mm_struct *mm, pmd_t *pmd,__migration_entry_wait (mm, ptep, ptl); } -void migration_entry_wait_huge (struct vm_area_struct *vma, -struct mm_struct *mm,pte_t *pte) +#ifdef CONFIG_HUGETLB_PAGE +void __migration_entry_wait_huge (pte_t *ptep,spinlock_t *ptl) { -spinlock_t *ptl =huge_pte_lockptr (hstate_vma (vma), mm, pte); -__migration_entry_wait (mm, pte, ptl); +pte_t pte; + +spin_lock (ptl); + pte =huge_ptep_get (ptep); + +if (unlikely (!is_hugetlb_entry_migration (pte))) +spin_unlock (ptl); +else +migration_entry_wait_on_locked (pte_to_swp_entry (pte),NULL , ptl); } +void migration_entry_wait_huge (struct vm_area_struct *vma,pte_t *pte) +{ +spinlock_t *ptl =huge_pte_lockptr (hstate_vma (vma), vma->vm_mm, pte); + +__migration_entry_wait_huge (pte, ptl); +} +#endif +#ifdef CONFIG_ARCH_ENABLE_THP_MIGRATION void pmd_migration_entry_wait (struct mm_struct *mm,pmd_t *pmd) {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 718/1095 kasan: fix zeroing vmalloc memory with HW_TAGS
In reply to Greg Kroah-HartmanFrom: Andrey Konovalov <[email protected]>
[ Upstream commit 6c2f761dad7851d8088b91063ccaea3c970efe78 ]
HW_TAGS KASAN skips zeroing page_alloc allocations backing vmalloc mappings via __GFP_SKIP_ZERO. Instead, these pages are zeroed via kasan_unpoison_vmalloc() by passing the KASAN_VMALLOC_INIT flag.
The problem is that __kasan_unpoison_vmalloc() does not zero pages when either kasan_vmalloc_enabled() or is_vmalloc_or_module_addr() fail.
Thus:
1. Change __vmalloc_node_range() to only set KASAN_VMALLOC_INIT when __GFP_SKIP_ZERO is set.
2. Change __kasan_unpoison_vmalloc() to always zero pages when the KASAN_VMALLOC_INIT flag is set.
3. Add WARN_ON() asserts to check that KASAN_VMALLOC_INIT cannot be set in other early return paths of __kasan_unpoison_vmalloc().
Also clean up the comment in __kasan_unpoison_vmalloc.
--- mm/kasan/hw_tags.c | 32 +++++++++++++++++++++++--------- mm/vmalloc.c | 10 +++++----- 2 files changed, 28 insertions(+), 14 deletions(-)
mm/kasan/hw_tags.c +23 -9
@@ -257,27 +257,37 @@ static void unpoison_vmalloc_pages(const void *addr, u8 tag) } } +static void init_vmalloc_pages (const void *start,unsigned long size) +{ +const void *addr; + +for (addr = start; addr < start + size; addr +=PAGE_SIZE ) { +struct page *page =virt_to_page (addr); + +clear_highpage_kasan_tagged (page); + } +} +void *__kasan_unpoison_vmalloc (const void *start,unsigned long size,kasan_vmalloc_flags_t flags) {u8 tag;unsigned long redzone_start, redzone_size; -if (!kasan_vmalloc_enabled ()) -return (void *)start; - -if (!is_vmalloc_or_module_addr (start)) +if (!kasan_vmalloc_enabled () || !is_vmalloc_or_module_addr (start)) { +if (flags &KASAN_VMALLOC_INIT ) +init_vmalloc_pages (start, size);return (void *)start; + }/* -* Skip unpoisoning and assigning a pointer tag for non-VM_ALLOC -* mappings as: +* Don't tag non-VM_ALLOC mappings, as: * * 1. Unlike the software KASAN modes, hardware tag-based KASAN only * supports tagging physical memory. Therefore, it can only tag a * single mapping of normal physical pages. * 2. Hardware tag-based KASAN can only tag memory mapped with special -* mapping protection bits, see arch_vmalloc_pgprot_modify(). +* mapping protection bits, see arch_vmap_pgprot_tagged(). * As non-VM_ALLOC mappings can be mapped outside of vmalloc code, * providing these bits would require tracking all non-VM_ALLOC * mappers.
@@ -289,15 +299,19 @@ void *__kasan_unpoison_vmalloc(const void *start, unsigned long size,* * For non-VM_ALLOC allocations, page_alloc memory is tagged as usual. */ -if (!(flags &KASAN_VMALLOC_VM_ALLOC )) +if (!(flags &KASAN_VMALLOC_VM_ALLOC )) { +WARN_ON (flags &KASAN_VMALLOC_INIT );return (void *)start; + }/* * Don't tag executable memory. * The kernel doesn't tolerate having the PC register tagged. */ -if (!(flags &KASAN_VMALLOC_PROT_NORMAL )) +if (!(flags &KASAN_VMALLOC_PROT_NORMAL )) { +WARN_ON (flags &KASAN_VMALLOC_INIT );return (void *)start; + } tag =kasan_random_tag (); start =set_tag (start, tag);
mm/vmalloc.c +5 -5
@@ -3170,15 +3170,15 @@ void *__vmalloc_node_range(unsigned long size, unsigned long align,/* * Mark the pages as accessible, now that they are mapped. -* The init condition should match the one in post_alloc_hook() -* (except for the should_skip_init() check) to make sure that memory -* is initialized under the same conditions regardless of the enabled -* KASAN mode. +* The condition for setting KASAN_VMALLOC_INIT should complement the +* one in post_alloc_hook() with regards to the __GFP_SKIP_ZERO check +* to make sure that memory is initialized under the same conditions. * Tag-based KASAN modes only assign tags to normal non-executable * allocations, see __kasan_unpoison_vmalloc(). */ kasan_flags |=KASAN_VMALLOC_VM_ALLOC ; -if (!want_init_on_free () &&want_init_on_alloc (gfp_mask)) +if (!want_init_on_free () &&want_init_on_alloc (gfp_mask) && + (gfp_mask & __GFP_SKIP_ZERO)) kasan_flags |=KASAN_VMALLOC_INIT ;/* KASAN_VMALLOC_PROT_NORMAL already set if required. */ area->addr =kasan_unpoison_vmalloc (area->addr, real_size, kasan_flags);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 719/1095 mm/mempolicy: fix get_nodes out of bound access
In reply to Greg Kroah-HartmanFrom: Tianyu Li <[email protected]>
[ Upstream commit 000eca5d044d1ee23b4ca311793cf3fc528da6c6 ]
When user specified more nodes than supported, get_nodes will access nmask array out of bounds.
--- mm/mempolicy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/mempolicy.c +1 -1
@@ -1387,7 +1387,7 @@ static int get_nodes(nodemask_t *nodes, const unsigned long __user *nmask, unsigned long bits = min_t(unsigned long, maxnode, BITS_PER_LONG);unsigned long t; -if (get_bitmap (&t, &nmask[maxnode /BITS_PER_LONG ], bits)) +if (get_bitmap (&t, &nmask[(maxnode -1 ) /BITS_PER_LONG ], bits))return -EFAULT ;if (maxnode - bits >=MAX_NUMNODES ) {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 720/1095 phy: ti: tusb1210: Dont check for write errors when powering on
In reply to Greg Kroah-HartmanFrom: Andy Shevchenko <[email protected]>
[ Upstream commit d4a0a189b72a7c98e4256292b18b67c69fbc9343 ]
On some platforms, like Intel Merrifield, the writing values during power on may timeout:
tusb1210 dwc3.0.auto.ulpi: error -110 writing val 0x41 to reg 0x80 phy phy-dwc3.0.auto.ulpi.0: phy poweron failed --> -110 dwc3 dwc3.0.auto: error -ETIMEDOUT: failed to initialize core
dwc3: probe of dwc3.0.auto failed with error -110
which effectively fails the probe of the USB controller. Drop the check as it was before the culprit commit (see Fixes tag).
--- drivers/phy/ti/phy-tusb1210.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/phy/ti/phy-tusb1210.c +3 -2
@@ -105,8 +105,9 @@ static int tusb1210_power_on(struct phy *phy)msleep (TUSB1210_RESET_TIME_MS );/* Restore the optional eye diagram optimization value */ -return tusb1210_ulpi_write (tusb,TUSB1210_VENDOR_SPECIFIC2 , - tusb->vendor_specific2); +tusb1210_ulpi_write (tusb,TUSB1210_VENDOR_SPECIFIC2 , tusb->vendor_specific2); + +return 0 ; }static int tusb1210_power_off (struct phy *phy)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 721/1095 PCI: dwc: Stop link on host_init errors and de-initialization
In reply to Greg Kroah-HartmanFrom: Serge Semin <[email protected]>
[ Upstream commit 113fa857b74c947137d845e7e635afcf6a59c43a ]
It's logically correct to undo everything that was done when an error is discovered or in the corresponding cleanup counterpart. Otherwise the host controller will be left in an undetermined state. Since the link is set up in the host_init method, deactivate it there in the cleanup-on-error block and stop the link in the antagonistic routine - dw_pcie_host_deinit(). Link deactivation is platform-specific and should be implemented in dw_pcie_ops.stop_link().
--- .../pci/controller/dwc/pcie-designware-host.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-)
drivers/pci/controller/dwc/pcie-designware-host.c +14 -2
@@ -421,8 +421,14 @@ int dw_pcie_host_init(struct pcie_port *pp) bridge->sysdata = pp; ret =pci_host_probe (bridge); -if (!ret) -return 0 ; +if (ret) + goto err_stop_link; + +return 0 ; + +err_stop_link: +if (pci->ops && pci->ops->stop_link) + pci->ops->stop_link (pci); err_free_msi:if (pp->has_msi_ctrl)
@@ -433,8 +439,14 @@ EXPORT_SYMBOL_GPL(dw_pcie_host_init);void dw_pcie_host_deinit (struct pcie_port *pp) { +struct dw_pcie *pci =to_dw_pcie_from_pp (pp); +pci_stop_root_bus (pp->bridge->bus);pci_remove_root_bus (pp->bridge->bus); + +if (pci->ops && pci->ops->stop_link) + pci->ops->stop_link (pci); +if (pp->has_msi_ctrl)dw_pcie_free_msi (pp); }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 722/1095 PCI: dwc: Add unroll iATU space support to dw_pcie_disable_atu()
In reply to Greg Kroah-HartmanFrom: Serge Semin <[email protected]>
[ Upstream commit d1cf738f2b65a5640234e1da90a68d3523fbed83 ]
dw_pcie_disable_atu() was introduced by f8aed6ec624f ("PCI: dwc:
designware: Add EP mode support") and supported only the viewport version of the iATU CSRs.
DW PCIe IP cores v4.80a and newer also support unrolled iATU/eDMA space. Callers of dw_pcie_disable_atu(), including pci_epc_ops.clear_bar(), pci_epc_ops.unmap_addr(), and dw_pcie_setup_rc(), don't work correctly when it is enabled.
Add dw_pcie_disable_atu() support for controllers with unrolled iATU CSRs enabled.
--- drivers/pci/controller/dwc/pcie-designware.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)
drivers/pci/controller/dwc/pcie-designware.c +13 -3
@@ -491,7 +491,7 @@ int dw_pcie_prog_inbound_atu(struct dw_pcie *pci, u8 func_no, int index,void dw_pcie_disable_atu (struct dw_pcie *pci,int index,enum dw_pcie_region_type type) { -int region; +u32 region;switch (type) {case DW_PCIE_REGION_INBOUND :
@@ -504,8 +504,18 @@ void dw_pcie_disable_atu(struct dw_pcie *pci, int index,return ; } -dw_pcie_writel_dbi (pci,PCIE_ATU_VIEWPORT , region | index); -dw_pcie_writel_dbi (pci,PCIE_ATU_CR2 , ~(u32 )PCIE_ATU_ENABLE ); +if (pci->iatu_unroll_enabled) { +if (region ==PCIE_ATU_REGION_INBOUND ) { +dw_pcie_writel_ib_unroll (pci, index,PCIE_ATU_UNR_REGION_CTRL2 , + ~(u32 )PCIE_ATU_ENABLE ); + }else { +dw_pcie_writel_ob_unroll (pci, index,PCIE_ATU_UNR_REGION_CTRL2 , + ~(u32 )PCIE_ATU_ENABLE ); + } + }else { +dw_pcie_writel_dbi (pci,PCIE_ATU_VIEWPORT , region | index); +dw_pcie_writel_dbi (pci,PCIE_ATU_CR2 , ~(u32 )PCIE_ATU_ENABLE ); + } }int dw_pcie_wait_for_link (struct dw_pcie *pci)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 723/1095 PCI: dwc: Disable outbound windows only for controllers using iATU
In reply to Greg Kroah-HartmanFrom: Serge Semin <[email protected]>
[ Upstream commit d60a2e281e9de2b2f67343b2e39417ca0f4fd54e ]
Some DWC-based controllers (e.g., pcie-al.c and pci-keystone.c, identified by the fact that they override the default dw_child_pcie_ops) use their own address translation approach instead of the DWC internal ATU (iATU). For those controllers, skip disabling the iATU outbound windows.
--- drivers/pci/controller/dwc/pcie-designware-host.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
drivers/pci/controller/dwc/pcie-designware-host.c +8 -6
@@ -543,7 +543,6 @@ static struct pci_ops dw_pcie_ops = {void dw_pcie_setup_rc (struct pcie_port *pp) { -int i;u32 val, ctrl, num_ctrls;struct dw_pcie *pci =to_dw_pcie_from_pp (pp);
@@ -594,19 +593,22 @@ void dw_pcie_setup_rc(struct pcie_port *pp)PCI_COMMAND_MASTER |PCI_COMMAND_SERR ;dw_pcie_writel_dbi (pci,PCI_COMMAND , val); -/* Ensure all outbound windows are disabled so there are multiple matches */ -for (i =0 ; i < pci->num_ob_windows; i++) -dw_pcie_disable_atu (pci, i,DW_PCIE_REGION_OUTBOUND ); -/* * If the platform provides its own child bus config accesses, it means * the platform uses its own address translation component rather than * ATU, so we should not program the ATU here. */ if (pp->bridge->child_ops == &dw_child_pcie_ops) { -int atu_idx =0 ; +int i, atu_idx =0 ;struct resource_entry *entry; +/* +* Disable all outbound windows to make sure a transaction +* can't match multiple windows. +*/ +for (i =0 ; i < pci->num_ob_windows; i++) +dw_pcie_disable_atu (pci, i,DW_PCIE_REGION_OUTBOUND ); +/* Get last memory resource entry */ resource_list_for_each_entry (entry, &pp->bridge->windows) {if (resource_type (entry->res) !=IORESOURCE_MEM )
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 724/1095 PCI: dwc: Set INCREASE_REGION_SIZE flag based on limit address
In reply to Greg Kroah-HartmanFrom: Serge Semin <[email protected]>
[ Upstream commit 777e7c3ab73036105e6fc4a67ed950179dbffbab ]
We program the 64-bit ATU limit address (in PCIE_ATU_LIMIT/ PCIE_ATU_UPPER_LIMIT or PCIE_ATU_UNR_LOWER_LIMIT/PCIE_ATU_UNR_UPPER_LIMIT), but in addition, the PCIE_ATU_INCREASE_REGION_SIZE bit must be set if the upper 32 bits of the limit address differ from the upper 32 bits of the base address (see [1,2]).
5b4cf0f65324 ("PCI: dwc: Add upper limit address for outbound iATU") set PCIE_ATU_INCREASE_REGION_SIZE, but only when the *size* was greater than 4GB. It did not set it when a smaller region crossed a 4GB boundary, e.g., [mem 0x0_f0000000-0x1_0fffffff].
Set PCIE_ATU_INCREASE_REGION_SIZE whenever PCIE_ATU_UPPER_LIMIT is greater than PCIE_ATU_UPPER_BASE.
[1] DesignWare Cores PCI Express Controller Databook - DWC PCIe Root Port,
v5.40a, March 2019, fig.3-36, p.175
[2] DesignWare Cores PCI Express Controller Databook - DWC PCIe Root Port,
v5.40a, March 2019, fig.3-37, p.176--- drivers/pci/controller/dwc/pcie-designware.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
drivers/pci/controller/dwc/pcie-designware.c +10 -6
@@ -287,8 +287,8 @@ static void dw_pcie_prog_outbound_atu_unroll(struct dw_pcie *pci, u8 func_no,dw_pcie_writel_ob_unroll (pci, index,PCIE_ATU_UNR_UPPER_TARGET ,upper_32_bits (pci_addr)); val = type |PCIE_ATU_FUNC_NUM (func_no); - val =upper_32_bits (size -1 ) ? - val |PCIE_ATU_INCREASE_REGION_SIZE : val; +if (upper_32_bits (limit_addr) >upper_32_bits (cpu_addr)) + val |=PCIE_ATU_INCREASE_REGION_SIZE ;if (pci->version ==0x490A ) val =dw_pcie_enable_ecrc (val);dw_pcie_writel_ob_unroll (pci, index,PCIE_ATU_UNR_REGION_CTRL1 , val);
@@ -315,6 +315,7 @@ static void __dw_pcie_prog_outbound_atu(struct dw_pcie *pci, u8 func_no, u64 pci_addr, u64 size) {u32 retries, val; +u64 limit_addr;if (pci->ops && pci->ops->cpu_addr_fixup) cpu_addr = pci->ops->cpu_addr_fixup (pci, cpu_addr);
@@ -325,6 +326,8 @@ static void __dw_pcie_prog_outbound_atu(struct dw_pcie *pci, u8 func_no,return ; } + limit_addr = cpu_addr + size -1 ; +dw_pcie_writel_dbi (pci,PCIE_ATU_VIEWPORT ,PCIE_ATU_REGION_OUTBOUND | index); dw_pcie_writel_dbi(pci, PCIE_ATU_LOWER_BASE,
@@ -332,17 +335,18 @@ static void __dw_pcie_prog_outbound_atu(struct dw_pcie *pci, u8 func_no,dw_pcie_writel_dbi (pci,PCIE_ATU_UPPER_BASE ,upper_32_bits (cpu_addr));dw_pcie_writel_dbi (pci,PCIE_ATU_LIMIT , -lower_32_bits (cpu_addr + size -1 )); +lower_32_bits (limit_addr));if (pci->version >=0x460A )dw_pcie_writel_dbi (pci,PCIE_ATU_UPPER_LIMIT , -upper_32_bits (cpu_addr + size -1 )); +upper_32_bits (limit_addr));dw_pcie_writel_dbi (pci,PCIE_ATU_LOWER_TARGET ,lower_32_bits (pci_addr));dw_pcie_writel_dbi (pci,PCIE_ATU_UPPER_TARGET ,upper_32_bits (pci_addr)); val = type |PCIE_ATU_FUNC_NUM (func_no); - val = ((upper_32_bits (size -1 )) && (pci->version >=0x460A )) ? - val |PCIE_ATU_INCREASE_REGION_SIZE : val; +if (upper_32_bits (limit_addr) >upper_32_bits (cpu_addr) && + pci->version >=0x460A ) + val |=PCIE_ATU_INCREASE_REGION_SIZE ;if (pci->version ==0x490A ) val =dw_pcie_enable_ecrc (val);dw_pcie_writel_dbi (pci,PCIE_ATU_CR1 , val);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 725/1095 PCI: dwc: Deallocate EPC memory on dw_pcie_ep_init() errors
In reply to Greg Kroah-HartmanFrom: Serge Semin <[email protected]>
[ Upstream commit 8161e9626b50892eaedbd8070ecb1586ecedb109 ]
If dw_pcie_ep_init() fails to perform any action after the EPC memory is initialized and the MSI memory region is allocated, the latter parts won't be undone thus causing a memory leak. Add a cleanup-on-error path to fix these leaks.
--- .../pci/controller/dwc/pcie-designware-ep.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-)
drivers/pci/controller/dwc/pcie-designware-ep.c +16 -2
@@ -780,8 +780,9 @@ int dw_pcie_ep_init(struct dw_pcie_ep *ep) ep->msi_mem =pci_epc_mem_alloc_addr (epc, &ep->msi_mem_phys, epc->mem->window.page_size);if (!ep->msi_mem) { + ret = -ENOMEM ;dev_err (dev,"Failed to reserve memory for MSI/MSI-X\n" ); -return -ENOMEM ; + goto err_exit_epc_mem; }if (ep->ops->get_features) {
@@ -790,6 +791,19 @@ int dw_pcie_ep_init(struct dw_pcie_ep *ep)return 0 ; } -return dw_pcie_ep_init_complete (ep); + ret =dw_pcie_ep_init_complete (ep); +if (ret) + goto err_free_epc_mem; + +return 0 ; + +err_free_epc_mem: +pci_epc_mem_free_addr (epc, ep->msi_mem_phys, ep->msi_mem, + epc->mem->window.page_size); + +err_exit_epc_mem: +pci_epc_mem_exit (epc); + +return ret; }EXPORT_SYMBOL_GPL (dw_pcie_ep_init);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 726/1095 PCI: dwc: Always enable CDM check if "snps,enable-cdm-check" exists
In reply to Greg Kroah-HartmanFrom: Serge Semin <[email protected]>
[ Upstream commit ec7b952f453ce7eabe7e1bea584626934d44f668 ]
If the "snps,enable-cdm-check" property exists, we should enable the CDM check. But previously dw_pcie_setup() could exit before doing so if the "num-lanes" property was absent or invalid.
Move the CDM enable earlier so we do it regardless of whether "num-lanes" is present.
--- drivers/pci/controller/dwc/pcie-designware.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/pci/controller/dwc/pcie-designware.c +7 -7
@@ -740,6 +740,13 @@ void dw_pcie_setup(struct dw_pcie *pci) val |=PORT_LINK_DLL_LINK_EN ;dw_pcie_writel_dbi (pci,PCIE_PORT_LINK_CONTROL , val); +if (of_property_read_bool (np,"snps,enable-cdm-check" )) { + val =dw_pcie_readl_dbi (pci,PCIE_PL_CHK_REG_CONTROL_STATUS ); + val |=PCIE_PL_CHK_REG_CHK_REG_CONTINUOUS | +PCIE_PL_CHK_REG_CHK_REG_START ; +dw_pcie_writel_dbi (pci,PCIE_PL_CHK_REG_CONTROL_STATUS , val); + } +of_property_read_u32 (np,"num-lanes" , &pci->num_lanes);if (!pci->num_lanes) {dev_dbg (pci->dev,"Using h/w default number of lanes\n" );
@@ -786,11 +793,4 @@ void dw_pcie_setup(struct dw_pcie *pci)break ; }dw_pcie_writel_dbi (pci,PCIE_LINK_WIDTH_SPEED_CONTROL , val); - -if (of_property_read_bool (np,"snps,enable-cdm-check" )) { - val =dw_pcie_readl_dbi (pci,PCIE_PL_CHK_REG_CONTROL_STATUS ); - val |=PCIE_PL_CHK_REG_CHK_REG_CONTINUOUS | -PCIE_PL_CHK_REG_CHK_REG_START ; -dw_pcie_writel_dbi (pci,PCIE_PL_CHK_REG_CONTROL_STATUS , val); - } }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 727/1095 soundwire: bus_type: fix remove and shutdown support
In reply to Greg Kroah-HartmanFrom: Pierre-Louis Bossart <[email protected]>
[ Upstream commit df6407782964dc7e35ad84230abb38f46314b245 ]
The bus sdw_drv_remove() and sdw_drv_shutdown() helpers are used conditionally, if the driver provides these routines.
These helpers already test if the driver provides a .remove or .shutdown callback, so there's no harm in invoking the sdw_drv_remove() and sdw_drv_shutdown() unconditionally.
In addition, the current code is imbalanced with dev_pm_domain_attach() called from sdw_drv_probe(), but dev_pm_domain_detach() called from sdw_drv_remove() only if the driver provides a .remove callback.
--- drivers/soundwire/bus_type.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/soundwire/bus_type.c +2 -6
@@ -193,12 +193,8 @@ int __sdw_register_driver(struct sdw_driver *drv, struct module *owner) drv->driver.owner = owner; drv->driver.probe = sdw_drv_probe; - -if (drv->remove) - drv->driver.remove = sdw_drv_remove; - -if (drv->shutdown) - drv->driver.shutdown = sdw_drv_shutdown; + drv->driver.remove = sdw_drv_remove; + drv->driver.shutdown = sdw_drv_shutdown;return driver_register (&drv->driver); }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 728/1095 soundwire: revisit driver bind/unbind and callbacks
In reply to Greg Kroah-HartmanFrom: Pierre-Louis Bossart <[email protected]>
[ Upstream commit bd29c00edd0a5dac8b6e7332bb470cd50f92e893 ]
In the SoundWire probe, we store a pointer from the driver ops into the 'slave' structure. This can lead to kernel oopses when unbinding codec drivers, e.g. with the following sequence to remove machine driver and codec driver.
/sbin/modprobe -r snd_soc_sof_sdw/sbin/modprobe -r snd_soc_rt711
The full details can be found in the BugLink below, for reference the two following examples show different cases of driver ops/callbacks being invoked after the driver .remove().
kernel: BUG: kernel NULL pointer dereference, address: 0000000000000150 kernel: Workqueue: events cdns_update_slave_status_work [soundwire_cadence] kernel: RIP: 0010:mutex_lock+0x19/0x30 kernel: Call Trace: kernel: ? sdw_handle_slave_status+0x426/0xe00 [soundwire_bus 94ff184bf398570c3f8ff7efe9e32529f532e4ae] kernel: ? newidle_balance+0x26a/0x400 kernel: ? cdns_update_slave_status_work+0x1e9/0x200 [soundwire_cadence 1bcf98eebe5ba9833cd433323769ac923c9c6f82]
kernel: BUG: unable to handle page fault for address: ffffffffc07654c8 kernel: Workqueue: pm pm_runtime_work kernel: RIP: 0010:sdw_bus_prep_clk_stop+0x6f/0x160 [soundwire_bus] kernel: Call Trace: kernel: <TASK> kernel: sdw_cdns_clock_stop+0xb5/0x1b0 [soundwire_cadence 1bcf98eebe5ba9833cd433323769ac923c9c6f82] kernel: intel_suspend_runtime+0x5f/0x120 [soundwire_intel aca858f7c87048d3152a4a41bb68abb9b663a1dd] kernel: ? dpm_sysfs_remove+0x60/0x60
This was not detected earlier in Intel tests since the tests first remove the parent PCI device and shut down the bus. The sequence above is a corner case which keeps the bus operational but without a driver bound.
While trying to solve this kernel oopses, it became clear that the existing SoundWire bus does not deal well with the unbind case.
Commit 528be501b7d4a ("soundwire: sdw_slave: add probe_complete structure and new fields") added a 'probed' status variable and a 'probe_complete'
struct completion. This status is however not reset on remove and
likewise the 'probe complete' is not re-initialized, so the bind/unbind/bind test cases would fail. The timeout used before the 'update_status' callback was also a bad idea in hindsight, there
should really be no timing assumption as to if and when a driver is
bound to a device.
An initial draft was based on device_lock() and device_unlock() was tested. This proved too complicated, with deadlocks created during the suspend-resume sequences, which also use the same device_lock/unlock() as the bind/unbind sequences. On a CometLake device, a bad DSDT/BIOS caused spurious resumes and the use of device_lock() caused hangs during suspend. After multiple weeks or testing and painful reverse-engineering of deadlocks on different devices, we looked for alternatives that did not interfere with the device core.
A bus notifier was used successfully to keep track of DRIVER_BOUND and DRIVER_UNBIND events. This solved the bind-unbind-bind case in tests, but it can still be defeated with a theoretical corner case where the memory is freed by a .remove while the callback is in use. The notifier only helps make sure the driver callbacks are valid, but not that the memory allocated in probe remains valid while the callbacks are invoked.
This patch suggests the introduction of a new 'sdw_dev_lock' mutex protecting probe/remove and all driver callbacks. Since this mutex is 'local' to SoundWire only, it does not interfere with existing locks and does not create deadlocks. In addition, this patch removes the 'probe_complete' completion, instead we directly invoke the 'update_status' from the probe routine. That removes any sort of timing dependency and a much better support for the device/driver model, the driver could be bound before the bus started, or eons after the bus started and the hardware would be properly initialized in all cases.
--- drivers/soundwire/bus.c | 75 ++++++++++++++++++++--------------- drivers/soundwire/bus_type.c | 30 +++++++++++--- drivers/soundwire/slave.c | 3 +- drivers/soundwire/stream.c | 53 ++++++++++++++++--------- include/linux/soundwire/sdw.h | 6 +-- 5 files changed, 106 insertions(+), 61 deletions(-)
drivers/soundwire/bus.c +42 -33
@@ -7,6 +7,7 @@#include <linux/pm_runtime.h> #include <linux/soundwire/sdw_registers.h> #include <linux/soundwire/sdw.h> +#include <linux/soundwire/sdw_type.h> #include "bus.h" #include "sysfs_local.h"
@@ -846,15 +847,21 @@ static int sdw_slave_clk_stop_callback(struct sdw_slave *slave,enum sdw_clk_stop_mode mode, enum sdw_clk_stop_type type) { - int ret; + int ret = 0; -if (slave->ops && slave->ops->clk_stop) { - ret = slave->ops->clk_stop (slave, mode, type); -if (ret <0 ) -return ret; +mutex_lock (&slave->sdw_dev_lock); + +if (slave->probed) { +struct device *dev = &slave->dev; +struct sdw_driver *drv =drv_to_sdw_driver (dev->driver); + +if (drv->ops && drv->ops->clk_stop) + ret = drv->ops->clk_stop (slave, mode, type); } -return 0 ; +mutex_unlock (&slave->sdw_dev_lock); + +return ret; } static int sdw_slave_clk_stop_prepare(struct sdw_slave *slave,
@@ -1616,14 +1623,24 @@ static int sdw_handle_slave_alerts(struct sdw_slave *slave) }/* Update the Slave driver */ -if (slave_notify && slave->ops && - slave->ops->interrupt_callback) { - slave_intr.sdca_cascade = sdca_cascade; - slave_intr.control_port = clear; -memcpy (slave_intr.port, &port_status, -sizeof (slave_intr.port)); - - slave->ops->interrupt_callback (slave, &slave_intr); +if (slave_notify) { +mutex_lock (&slave->sdw_dev_lock); + +if (slave->probed) { +struct device *dev = &slave->dev; +struct sdw_driver *drv =drv_to_sdw_driver (dev->driver); + +if (drv->ops && drv->ops->interrupt_callback) { + slave_intr.sdca_cascade = sdca_cascade; + slave_intr.control_port = clear; +memcpy (slave_intr.port, &port_status, +sizeof (slave_intr.port)); + + drv->ops->interrupt_callback (slave, &slave_intr); + } + } + +mutex_unlock (&slave->sdw_dev_lock); }/* Ack interrupt */
@@ -1697,29 +1714,21 @@ static int sdw_handle_slave_alerts(struct sdw_slave *slave)static int sdw_update_slave_status (struct sdw_slave *slave,enum sdw_slave_status status) { -unsigned long time; +int ret =0 ; -if (!slave->probed) { -/* -* the slave status update is typically handled in an -* interrupt thread, which can race with the driver -* probe, e.g. when a module needs to be loaded. -* -* make sure the probe is complete before updating -* status. -*/ - time =wait_for_completion_timeout (&slave->probe_complete, -msecs_to_jiffies (DEFAULT_PROBE_TIMEOUT )); -if (!time) { -dev_err (&slave->dev,"Probe not complete, timed out\n" ); -return -ETIMEDOUT ; - } +mutex_lock (&slave->sdw_dev_lock); + +if (slave->probed) { +struct device *dev = &slave->dev; +struct sdw_driver *drv =drv_to_sdw_driver (dev->driver); + +if (drv->ops && drv->ops->update_status) + ret = drv->ops->update_status (slave, status); } -if (!slave->ops || !slave->ops->update_status) -return 0 ; +mutex_unlock (&slave->sdw_dev_lock); -return slave->ops->update_status (slave, status); +return ret; }/**
drivers/soundwire/bus_type.c +25 -5
@@ -98,8 +98,6 @@ static int sdw_drv_probe(struct device *dev)if (!id)return -ENODEV ; - slave->ops = drv->ops; -/* * attach to power domain but don't turn on (last arg) */
@@ -107,19 +105,23 @@ static int sdw_drv_probe(struct device *dev)if (ret)return ret; +mutex_lock (&slave->sdw_dev_lock); + ret = drv->probe (slave, id);if (ret) { name = drv->name;if (!name) name = drv->driver.name; +mutex_unlock (&slave->sdw_dev_lock); +dev_err (dev,"Probe of %s failed: %d\n" , name, ret);dev_pm_domain_detach (dev, false);return ret; }/* device is probed so let's read the properties now */ -if (slave->ops && slave->ops->read_prop) - slave->ops->read_prop (slave); +if (drv->ops && drv->ops->read_prop) + drv->ops->read_prop (slave);/* init the sysfs as we have properties now */ ret =sdw_slave_sysfs_init (slave);
@@ -139,7 +141,19 @@ static int sdw_drv_probe(struct device *dev) slave->prop.clk_stop_timeout); slave->probed = true; -complete (&slave->probe_complete); + +/* +* if the probe happened after the bus was started, notify the codec driver +* of the current hardware status to e.g. start the initialization. +* Errors are only logged as warnings to avoid failing the probe. +*/ +if (drv->ops && drv->ops->update_status) { + ret = drv->ops->update_status (slave, slave->status); +if (ret <0 ) +dev_warn (dev,"%s: update_status failed with status %d\n" , __func__, ret); + } + +mutex_unlock (&slave->sdw_dev_lock);dev_dbg (dev,"probe complete\n" );
@@ -152,9 +166,15 @@ static int sdw_drv_remove(struct device *dev)struct sdw_driver *drv =drv_to_sdw_driver (dev->driver);int ret =0 ; +mutex_lock (&slave->sdw_dev_lock); + + slave->probed = false; +if (drv->remove) ret = drv->remove (slave); +mutex_unlock (&slave->sdw_dev_lock); +dev_pm_domain_detach (dev, false);return ret;
drivers/soundwire/slave.c +2 -1
@@ -12,6 +12,7 @@ static void sdw_slave_release(struct device *dev) {struct sdw_slave *slave =dev_to_sdw_dev (dev); +mutex_destroy (&slave->sdw_dev_lock);kfree (slave); }
@@ -58,9 +59,9 @@ int sdw_slave_add(struct sdw_bus *bus,init_completion (&slave->enumeration_complete);init_completion (&slave->initialization_complete); slave->dev_num =0 ; -init_completion (&slave->probe_complete); slave->probed = false; slave->first_interrupt_done = false; +mutex_init (&slave->sdw_dev_lock);for (i =0 ; i <SDW_MAX_PORTS ; i++)init_completion (&slave->port_ready[i]);
drivers/soundwire/stream.c +35 -18
85 lines not on this page · raw message
include/linux/soundwire/sdw.h +2 -4
@@ -646,9 +646,6 @@ struct sdw_slave_ops {* @dev_num: Current Device Number, values can be 0 or dev_num_sticky * @dev_num_sticky: one-time static Device Number assigned by Bus * @probed: boolean tracking driver state -* @probe_complete: completion utility to control potential races -* on startup between driver probe/initialization and SoundWire -* Slave state changes/implementation-defined interrupts * @enumeration_complete: completion utility to control potential races * on startup between device enumeration and read/write access to the * Slave device
@@ -663,6 +660,7 @@ struct sdw_slave_ops {* for a Slave happens for the first time after enumeration * @is_mockup_device: status flag used to squelch errors in the command/control * protocol for SoundWire mockup devices +* @sdw_dev_lock: mutex used to protect callbacks/remove races */ struct sdw_slave {struct sdw_slave_id id;
@@ -680,12 +678,12 @@ struct sdw_slave {u16 dev_num;u16 dev_num_sticky;bool probed; -struct completion probe_complete;struct completion enumeration_complete;struct completion initialization_complete;u32 unattach_request;bool first_interrupt_done;bool is_mockup_device; +struct mutex sdw_dev_lock;/* protect callbacks/remove races */ };#define dev_to_sdw_dev (_dev) container_of(_dev, struct sdw_slave, dev)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 729/1095 KVM: arm64: Dont return from void function
In reply to Greg Kroah-HartmanFrom: Quentin Perret <[email protected]>
[ Upstream commit 1c3ace2b8b3995d3213c5e2d2aca01a0577a3b0f ]
Although harmless, the return statement in kvm_unexpected_el2_exception is rather confusing as the function itself has a void return type. The C standard is also pretty clear that "A return statement with an expression shall not appear in a function whose return type is void". Given that this return statement does not seem to add any actual value, let's not pointlessly violate the standard.
Build-tested with GCC 10 and CLANG 13 for good measure, the disassembled code is identical with or without the return statement.
--- arch/arm64/kvm/hyp/nvhe/switch.c | 2 +- arch/arm64/kvm/hyp/vhe/switch.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/arm64/kvm/hyp/nvhe/switch.c +1 -1
@@ -371,5 +371,5 @@ void __noreturn hyp_panic(void) asmlinkage void kvm_unexpected_el2_exception(void) { -return __kvm_unexpected_el2_exception (); +__kvm_unexpected_el2_exception (); }
arch/arm64/kvm/hyp/vhe/switch.c +1 -1
@@ -240,5 +240,5 @@ void __noreturn hyp_panic(void) asmlinkage void kvm_unexpected_el2_exception(void) { -return __kvm_unexpected_el2_exception (); +__kvm_unexpected_el2_exception (); }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 730/1095 dmaengine: sf-pdma: Add multithread support for a DMA channel
In reply to Greg Kroah-HartmanFrom: Viacheslav Mitrofanov <[email protected]>
[ Upstream commit b2cc5c465c2cb8ab697c3fd6583c614e3f6cfbcc ]
When we get a DMA channel and try to use it in multiple threads it will cause oops and hanging the system.
% echo 64 > /sys/module/dmatest/parameters/threads_per_chan % echo 10000 > /sys/module/dmatest/parameters/iterations % echo 1 > /sys/module/dmatest/parameters/run
[ 89.480664] Unable to handle kernel NULL pointer dereference at virtual
address 00000000000000a0
[ 89.488725] Oops [#1]
[ 89.494708] CPU: 2 PID: 1008 Comm: dma0chan0-copy0 Not tainted
5.17.0-rc5
[ 89.509385] epc : vchan_find_desc+0x32/0x46
[ 89.513553] ra : sf_pdma_tx_status+0xca/0xd6This happens because of data race. Each thread rewrite channels's descriptor as soon as device_prep_dma_memcpy() is called. It leads to the situation when the driver thinks that it uses right descriptor that actually is freed or substituted for other one.
With current fixes a descriptor changes its value only when it has been used. A new descriptor is acquired from vc->desc_issued queue that is already filled with descriptors that are ready to be sent. Threads have no direct access to DMA channel descriptor. Now it is just possible to queue a descriptor for further processing.
--- drivers/dma/sf-pdma/sf-pdma.c | 44 ++++++++++++++++++++++++----------- 1 file changed, 30 insertions(+), 14 deletions(-)
drivers/dma/sf-pdma/sf-pdma.c +30 -14
@@ -52,16 +52,6 @@ static inline struct sf_pdma_desc *to_sf_pdma_desc(struct virt_dma_desc *vd)static struct sf_pdma_desc *sf_pdma_alloc_desc (struct sf_pdma_chan *chan) {struct sf_pdma_desc *desc; -unsigned long flags; - -spin_lock_irqsave (&chan->lock, flags); - -if (chan->desc && !chan->desc->in_use) { -spin_unlock_irqrestore (&chan->lock, flags); -return chan->desc; - } - -spin_unlock_irqrestore (&chan->lock, flags); desc =kzalloc (sizeof (*desc),GFP_NOWAIT );if (!desc)
@@ -111,7 +101,6 @@ sf_pdma_prep_dma_memcpy(struct dma_chan *dchan, dma_addr_t dest, dma_addr_t src, desc->async_tx =vchan_tx_prep (&chan->vchan, &desc->vdesc, flags);spin_lock_irqsave (&chan->vchan.lock, iflags); - chan->desc = desc;sf_pdma_fill_desc (desc, dest, src, len);spin_unlock_irqrestore (&chan->vchan.lock, iflags);
@@ -170,11 +159,17 @@ static size_t sf_pdma_desc_residue(struct sf_pdma_chan *chan,unsigned long flags;u64 residue =0 ;struct sf_pdma_desc *desc; -struct dma_async_tx_descriptor *tx; +struct dma_async_tx_descriptor *tx =NULL ;spin_lock_irqsave (&chan->vchan.lock, flags); - tx = &chan->desc->vdesc.tx; +list_for_each_entry (vd, &chan->vchan.desc_submitted, node) +if (vd->tx.cookie == cookie) + tx = &vd->tx; + +if (!tx) + goto out; +if (cookie == tx->chan->completed_cookie) goto out;
@@ -241,6 +236,19 @@ static void sf_pdma_enable_request(struct sf_pdma_chan *chan)writel (v, regs->ctrl); } +static struct sf_pdma_desc *sf_pdma_get_first_pending_desc (struct sf_pdma_chan *chan) +{ +struct virt_dma_chan *vchan = &chan->vchan; +struct virt_dma_desc *vdesc; + +if (list_empty (&vchan->desc_issued)) +return NULL ; + + vdesc = list_first_entry(&vchan->desc_issued, struct virt_dma_desc, node); + + return container_of(vdesc, struct sf_pdma_desc, vdesc); +} +static void sf_pdma_xfer_desc (struct sf_pdma_chan *chan) {struct sf_pdma_desc *desc = chan->desc;
@@ -268,8 +276,11 @@ static void sf_pdma_issue_pending(struct dma_chan *dchan)spin_lock_irqsave (&chan->vchan.lock, flags); -if (vchan_issue_pending (&chan->vchan) && chan->desc) +if (!chan->desc &&vchan_issue_pending (&chan->vchan)) { +/* vchan_issue_pending has made a check that desc in not NULL */ + chan->desc =sf_pdma_get_first_pending_desc (chan);sf_pdma_xfer_desc (chan); + }spin_unlock_irqrestore (&chan->vchan.lock, flags); }
@@ -298,6 +309,11 @@ static void sf_pdma_donebh_tasklet(struct tasklet_struct *t)spin_lock_irqsave (&chan->vchan.lock, flags);list_del (&chan->desc->vdesc.node);vchan_cookie_complete (&chan->desc->vdesc); + + chan->desc =sf_pdma_get_first_pending_desc (chan); +if (chan->desc) +sf_pdma_xfer_desc (chan); +spin_unlock_irqrestore (&chan->vchan.lock, flags); }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 731/1095 PCI: endpoint: Dont stop controller when unbinding endpoint function
In reply to Greg Kroah-HartmanFrom: Shunsuke Mie <[email protected]>
[ Upstream commit 1bc2b7bfba6e2f64edf5e246f3af2967261f6c3d ]
Unbinding an endpoint function from the endpoint controller shouldn't stop the controller. This is especially a problem for multi-function endpoints where other endpoints may still be active.
Don't stop the controller when unbinding one of its endpoints. Normally the controller is stopped via configfs.
--- drivers/pci/endpoint/functions/pci-epf-test.c | 1 - 1 file changed, 1 deletion(-)
drivers/pci/endpoint/functions/pci-epf-test.c +0 -1
@@ -627,7 +627,6 @@ static void pci_epf_test_unbind(struct pci_epf *epf)cancel_delayed_work (&epf_test->cmd_handler);pci_epf_test_clean_dma_chan (epf_test); -pci_epc_stop (epc);for (bar =0 ; bar <PCI_STD_NUM_BARS ; bar++) { epf_bar = &epf->bar[bar];
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 732/1095 phy: qcom-qmp: fix the QSERDES_V5_COM_CMN_MODE register
In reply to Greg Kroah-HartmanFrom: Dmitry Baryshkov <[email protected]>
[ Upstream commit 488987b2d5cade4e7680f7e81590435a848d1fa9 ]
Change QSERDES_V5_COM_CMN_MODE to be defined to 0x1a0 rather than 0x1a4. The only user of this register name (sm8450_qmp_gen4x2_pcie_serdes_tbl) should use the 0x1a0 register, as stated in the downstream dtsi tree.
--- drivers/phy/qualcomm/phy-qcom-qmp.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/phy/qualcomm/phy-qcom-qmp.h +2 -1
@@ -1116,7 +1116,8 @@#define QSERDES_V5_COM_CORE_CLK_EN 0x174#define QSERDES_V5_COM_CMN_CONFIG 0x17c#define QSERDES_V5_COM_CMN_MISC1 0x19c -#define QSERDES_V5_COM_CMN_MODE 0x1a4 +#define QSERDES_V5_COM_CMN_MODE 0x1a0 +#define QSERDES_V5_COM_CMN_MODE_CONTD 0x1a4#define QSERDES_V5_COM_VCO_DC_LEVEL_CTRL 0x1a8#define QSERDES_V5_COM_BIN_VCOCAL_CMP_CODE1_MODE0 0x1ac#define QSERDES_V5_COM_BIN_VCOCAL_CMP_CODE2_MODE0 0x1b0
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 733/1095 scsi: qla2xxx: Check correct variable in qla24xx_async_gffid()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 7c33e477bd883f79cccec418980cb8f7f2d50347 ]
There is a copy and paste bug here. It should check ".rsp" instead of ".req". The error message is copy and pasted as well so update that too.
--- drivers/scsi/qla2xxx/qla_gs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/qla2xxx/qla_gs.c +2 -2
@@ -3386,9 +3386,9 @@ int qla24xx_async_gffid(scsi_qla_host_t *vha, fc_port_t *fcport, bool wait) sp->u.iocb_cmd.u.ctarg.rsp_allocated_size, &sp->u.iocb_cmd.u.ctarg.rsp_dma, GFP_KERNEL); -if (!sp->u.iocb_cmd.u.ctarg.req) { +if (!sp->u.iocb_cmd.u.ctarg.rsp) {ql_log (ql_log_warn, vha,0xd041 , -"%s: Failed to allocate ct_sns request.\n" , +"%s: Failed to allocate ct_sns response.\n" , __func__); goto done_free_sp; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 734/1095 intel_th: Fix a resource leak in an error handling path
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 086c28ab7c5699256aced0049aae9c42f1410313 ]
If an error occurs after calling 'pci_alloc_irq_vectors()', 'pci_free_irq_vectors()' must be called as already done in the remove function.
--- drivers/hwtracing/intel_th/pci.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/hwtracing/intel_th/pci.c +8 -2
@@ -100,8 +100,10 @@ static int intel_th_pci_probe(struct pci_dev *pdev, } th =intel_th_alloc (&pdev->dev, drvdata, resource, r); -if (IS_ERR (th)) -return PTR_ERR (th); +if (IS_ERR (th)) { + err =PTR_ERR (th); + goto err_free_irq; + } th->activate = intel_th_pci_activate; th->deactivate = intel_th_pci_deactivate;
@@ -109,6 +111,10 @@ static int intel_th_pci_probe(struct pci_dev *pdev,pci_set_master (pdev);return 0 ; + +err_free_irq: +pci_free_irq_vectors (pdev); +return err; }static void intel_th_pci_remove (struct pci_dev *pdev)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 735/1095 intel_th: msu-sink: Potential dereference of null pointer
In reply to Greg Kroah-HartmanFrom: Jiasheng Jiang <[email protected]>
[ Upstream commit 82f76a4a720791d889de775b5f7541d601efc8bd ]
The return value of dma_alloc_coherent() needs to be checked. To avoid use of null pointer in sg_set_buf() in case of the failure of alloc.
--- drivers/hwtracing/intel_th/msu-sink.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/hwtracing/intel_th/msu-sink.c +3 -0
@@ -71,6 +71,9 @@ static int msu_sink_alloc_window(void *data, struct sg_table **sgt, size_t size) block =dma_alloc_coherent (priv->dev->parent->parent,PAGE_SIZE , &sg_dma_address (sg_ptr),GFP_KERNEL ); +if (!block) +return -ENOMEM ; +sg_set_buf (sg_ptr, block,PAGE_SIZE ); }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 736/1095 intel_th: msu: Fix vmalloced buffers
In reply to Greg Kroah-HartmanFrom: Alexander Shishkin <[email protected]>
[ Upstream commit ac12ad3ccf6d386e64a9d6a890595a2509d24edd ]
After commit f5ff79fddf0e ("dma-mapping: remove CONFIG_DMA_REMAP") there's a chance of DMA buffer getting allocated via vmalloc(), which messes up the mmapping code:
Quoted 5 lines
RIP: msc_mmap_fault [intel_th_msu] Call Trace: <TASK> __do_fault do_fault
...
Fix this by accounting for vmalloc possibility.
--- drivers/hwtracing/intel_th/msu.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
drivers/hwtracing/intel_th/msu.c +12 -2
@@ -1067,6 +1067,16 @@ msc_buffer_set_uc(struct msc *msc) {}static inline void msc_buffer_set_wb (struct msc *msc) {}#endif /* CONFIG_X86 */ +static struct page *msc_sg_page (struct scatterlist *sg) +{ +void *addr =sg_virt (sg); + +if (is_vmalloc_addr (addr)) +return vmalloc_to_page (addr); + +return sg_page (sg); +} +/** * msc_buffer_win_alloc() - alloc a window for a multiblock mode * @msc: MSC device
@@ -1137,7 +1147,7 @@ static void __msc_buffer_win_free(struct msc *msc, struct msc_window *win)int i;for_each_sg (win->sgt->sgl, sg, win->nr_segs, i) { -struct page *page =sg_page (sg); +struct page *page =msc_sg_page (sg); page->mapping =NULL ; dma_free_coherent(msc_dev(win->msc)->parent->parent, PAGE_SIZE,
@@ -1401,7 +1411,7 @@ static struct page *msc_buffer_get_page(struct msc *msc, unsigned long pgoff) pgoff -= win->pgoff;for_each_sg (win->sgt->sgl, sg, win->nr_segs, blk) { -struct page *page =sg_page (sg); +struct page *page =msc_sg_page (sg);size_t pgsz =PFN_DOWN (sg->length);if (pgoff < pgsz)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 737/1095 binder: fix redefinition of seq_file attributes
In reply to Greg Kroah-HartmanFrom: Carlos Llamas <[email protected]>
[ Upstream commit b7e241bbff24f9e106bf616408fd58bcedc44bae ]
The patchset in [1] exported some definitions to binder_internal.h in order to make the debugfs entries such as 'stats' and 'transaction_log' available in a binderfs instance. However, the DEFINE_SHOW_ATTRIBUTE macro expands into a static function/variable pair, which in turn get redefined each time a source file includes this internal header.
This problem was made evident after a report from the kernel test robot <[email protected]> where several W=1 build warnings are seen in downstream kernels. See the following example:
include/../drivers/android/binder_internal.h:111:23: warning: 'binder_stats_fops' defined but not used [-Wunused-const-variable=]
111 | DEFINE_SHOW_ATTRIBUTE(binder_stats);
| ^~~~~~~~~~~~
include/linux/seq_file.h:174:37: note: in definition of macro 'DEFINE_SHOW_ATTRIBUTE'
174 | static const struct file_operations __name ## _fops = { \
| ^~~~~~This patch fixes the above issues by moving back the definitions into binder.c and instead creates an array of the debugfs entries which is more convenient to share with binderfs and iterate through.
[1] https://lore.kernel.org/all/[email protected]/
--- drivers/android/binder.c | 114 +++++++++++++++++++++--------- drivers/android/binder_internal.h | 46 +++--------- drivers/android/binderfs.c | 47 +++--------- 3 files changed, 100 insertions(+), 107 deletions(-)
drivers/android/binder.c +79 -35
@@ -170,8 +170,32 @@ static inline void binder_stats_created(enum binder_stat_types type)atomic_inc (&binder_stats.obj_created[type]); } -struct binder_transaction_log binder_transaction_log; -struct binder_transaction_log binder_transaction_log_failed; +struct binder_transaction_log_entry { +int debug_id; +int debug_id_done; +int call_type; +int from_proc; +int from_thread; +int target_handle; +int to_proc; +int to_thread; +int to_node; +int data_size; +int offsets_size; +int return_error_line; +uint32_t return_error; +uint32_t return_error_param; +char context_name[BINDERFS_MAX_NAME +1 ]; +}; + +struct binder_transaction_log { +atomic_t cur; +bool full; +struct binder_transaction_log_entry entry[32 ]; +}; + +static struct binder_transaction_log binder_transaction_log; +static struct binder_transaction_log binder_transaction_log_failed;static struct binder_transaction_log_entry *binder_transaction_log_add (struct binder_transaction_log *log)
@@ -6084,8 +6108,7 @@ static void print_binder_proc_stats(struct seq_file *m,print_binder_stats (m," " , &proc->stats); } - -int binder_state_show (struct seq_file *m,void *unused) +static int state_show (struct seq_file *m,void *unused) {struct binder_proc *proc;struct binder_node *node;
@@ -6124,7 +6147,7 @@ int binder_state_show(struct seq_file *m, void *unused)return 0 ; } -int binder_stats_show (struct seq_file *m,void *unused) +static int stats_show (struct seq_file *m,void *unused) {struct binder_proc *proc;
@@ -6140,7 +6163,7 @@ int binder_stats_show(struct seq_file *m, void *unused)return 0 ; } -int binder_transactions_show (struct seq_file *m,void *unused) +static int transactions_show (struct seq_file *m,void *unused) {struct binder_proc *proc;
@@ -6196,7 +6219,7 @@ static void print_binder_transaction_log_entry(struct seq_file *m, "\n" : " (incomplete)\n"); } -int binder_transaction_log_show (struct seq_file *m,void *unused) +static int transaction_log_show (struct seq_file *m,void *unused) {struct binder_transaction_log *log = m->private;unsigned int log_cur =atomic_read (&log->cur);
@@ -6228,6 +6251,45 @@ const struct file_operations binder_fops = { .release = binder_release, }; +DEFINE_SHOW_ATTRIBUTE (state); +DEFINE_SHOW_ATTRIBUTE (stats); +DEFINE_SHOW_ATTRIBUTE (transactions); +DEFINE_SHOW_ATTRIBUTE (transaction_log); + +const struct binder_debugfs_entry binder_debugfs_entries[] = { + { + .name ="state" , + .mode =0444 , + .fops = &state_fops, + .data =NULL , + }, + { + .name ="stats" , + .mode =0444 , + .fops = &stats_fops, + .data =NULL , + }, + { + .name ="transactions" , + .mode =0444 , + .fops = &transactions_fops, + .data =NULL , + }, + { + .name ="transaction_log" , + .mode =0444 , + .fops = &transaction_log_fops, + .data = &binder_transaction_log, + }, + { + .name ="failed_transaction_log" , + .mode =0444 , + .fops = &transaction_log_fops, + .data = &binder_transaction_log_failed, + }, + {}/* terminator */ +}; +static int __init init_binder_device (const char *name) {int ret;
@@ -6273,36 +6335,18 @@ static int __init binder_init(void)atomic_set (&binder_transaction_log_failed.cur, ~0U ); binder_debugfs_dir_entry_root =debugfs_create_dir ("binder" ,NULL ); -if (binder_debugfs_dir_entry_root) +if (binder_debugfs_dir_entry_root) { +const struct binder_debugfs_entry *db_entry; + +binder_for_each_debugfs_entry (db_entry) +debugfs_create_file (db_entry->name, + db_entry->mode, + binder_debugfs_dir_entry_root, + db_entry->data, + db_entry->fops); + binder_debugfs_dir_entry_proc =debugfs_create_dir ("proc" , binder_debugfs_dir_entry_root); - -if (binder_debugfs_dir_entry_root) { -debugfs_create_file ("state" , -0444 , - binder_debugfs_dir_entry_root, -NULL , - &binder_state_fops); -debugfs_create_file ("stats" , -0444 , - binder_debugfs_dir_entry_root, -NULL , - &binder_stats_fops); -debugfs_create_file ("transactions" , -0444 , - binder_debugfs_dir_entry_root, -NULL , - &binder_transactions_fops); -debugfs_create_file ("transaction_log" , -0444 , - binder_debugfs_dir_entry_root, - &binder_transaction_log, - &binder_transaction_log_fops); -debugfs_create_file ("failed_transaction_log" , -0444 , - binder_debugfs_dir_entry_root, - &binder_transaction_log_failed, - &binder_transaction_log_fops); } if (!IS_ENABLED(CONFIG_ANDROID_BINDERFS) &&
drivers/android/binder_internal.h +11 -35
58 lines not on this page · raw message
drivers/android/binderfs.c +10 -37
59 lines not on this page · raw message
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 738/1095 staging: rtl8192u: Fix sleep in atomic context bug in dm_fsync_timer_callback
In reply to Greg Kroah-HartmanFrom: Duoming Zhou <[email protected]>
[ Upstream commit 6a0c054930d554ad8f8044ef1fc856d9da391c81 ]
There are sleep in atomic context bugs when dm_fsync_timer_callback is executing. The root cause is that the memory allocation functions with GFP_KERNEL or GFP_NOIO parameters are called in dm_fsync_timer_callback which is a timer handler. The call paths that could trigger bugs are shown below:
(interrupt context)dm_fsync_timer_callback
write_nic_byte
kzalloc(sizeof(data), GFP_KERNEL); //may sleep usb_control_msg
kmalloc(.., GFP_NOIO); //may sleep
write_nic_dword
kzalloc(sizeof(data), GFP_KERNEL); //may sleep usb_control_msg
kmalloc(.., GFP_NOIO); //may sleep
This patch uses delayed work to replace timer and moves the operations that may sleep into the delayed work in order to mitigate bugs.
--- drivers/staging/rtl8192u/r8192U.h | 2 +- drivers/staging/rtl8192u/r8192U_dm.c | 38 +++++++++++++--------------- drivers/staging/rtl8192u/r8192U_dm.h | 2 +- 3 files changed, 20 insertions(+), 22 deletions(-)
drivers/staging/rtl8192u/r8192U.h +1 -1
@@ -1013,7 +1013,7 @@ typedef struct r8192_priv {bool bis_any_nonbepkts;bool bcurrent_turbo_EDCA;bool bis_cur_rdlstate; -struct timer_list fsync_timer; +struct delayed_work fsync_work;bool bfsync_processing;/* 500ms Fsync timer is active or not */ u32 rate_record;u32 rateCountDiffRecord;
drivers/staging/rtl8192u/r8192U_dm.c +18 -20
@@ -2578,19 +2578,20 @@ static void dm_init_fsync(struct net_device *dev) priv->ieee80211->fsync_seconddiff_ratethreshold =200 ; priv->ieee80211->fsync_state = Default_Fsync; priv->framesyncMonitor =1 ;/* current default 0xc38 monitor on */ -timer_setup (&priv->fsync_timer, dm_fsync_timer_callback,0 ); +INIT_DELAYED_WORK (&priv->fsync_work, dm_fsync_work_callback); }static void dm_deInit_fsync (struct net_device *dev) {struct r8192_priv *priv =ieee80211_priv (dev); -del_timer_sync (&priv->fsync_timer); +cancel_delayed_work_sync (&priv->fsync_work); } -void dm_fsync_timer_callback (struct timer_list *t) +void dm_fsync_work_callback (struct work_struct *work) { -struct r8192_priv *priv =from_timer (priv, t, fsync_timer); +struct r8192_priv *priv = + container_of(work, struct r8192_priv, fsync_work.work);struct net_device *dev = priv->ieee80211->dev;u32 rate_index, rate_count =0 , rate_count_diff =0 ;bool bSwitchFromCountDiff = false;
@@ -2657,17 +2658,16 @@ void dm_fsync_timer_callback(struct timer_list *t) } }if (bDoubleTimeInterval) { -if (timer_pending (&priv->fsync_timer)) -del_timer_sync (&priv->fsync_timer); - priv->fsync_timer.expires = jiffies + -msecs_to_jiffies (priv->ieee80211->fsync_time_interval*priv->ieee80211->fsync_multiple_timeinterval); -add_timer (&priv->fsync_timer); +cancel_delayed_work_sync (&priv->fsync_work); +schedule_delayed_work (&priv->fsync_work, +msecs_to_jiffies (priv + ->ieee80211->fsync_time_interval * + priv->ieee80211->fsync_multiple_timeinterval)); }else { -if (timer_pending (&priv->fsync_timer)) -del_timer_sync (&priv->fsync_timer); - priv->fsync_timer.expires = jiffies + -msecs_to_jiffies (priv->ieee80211->fsync_time_interval); -add_timer (&priv->fsync_timer); +cancel_delayed_work_sync (&priv->fsync_work); +schedule_delayed_work (&priv->fsync_work, +msecs_to_jiffies (priv + ->ieee80211->fsync_time_interval)); } }else {/* Let Register return to default value; */
@@ -2695,7 +2695,7 @@ static void dm_EndSWFsync(struct net_device *dev)struct r8192_priv *priv =ieee80211_priv (dev);RT_TRACE (COMP_HALDM ,"%s\n" , __func__); -del_timer_sync (&(priv->fsync_timer)); +cancel_delayed_work_sync (&priv->fsync_work);/* Let Register return to default value; */ if (priv->bswitch_fsync) {
@@ -2736,11 +2736,9 @@ static void dm_StartSWFsync(struct net_device *dev)if (priv->ieee80211->fsync_rate_bitmap & rateBitmap) priv->rate_record += priv->stats.received_rate_histogram[1 ][rateIndex]; } -if (timer_pending (&priv->fsync_timer)) -del_timer_sync (&priv->fsync_timer); - priv->fsync_timer.expires = jiffies + -msecs_to_jiffies (priv->ieee80211->fsync_time_interval); -add_timer (&priv->fsync_timer); +cancel_delayed_work_sync (&priv->fsync_work); +schedule_delayed_work (&priv->fsync_work, +msecs_to_jiffies (priv->ieee80211->fsync_time_interval));write_nic_dword (dev, rOFDM0_RxDetector2,0x465c12cd ); }
drivers/staging/rtl8192u/r8192U_dm.h +1 -1
@@ -166,7 +166,7 @@ void dm_force_tx_fw_info(struct net_device *dev,void dm_init_edca_turbo (struct net_device *dev);void dm_rf_operation_test_callback (unsigned long data);void dm_rf_pathcheck_workitemcallback (struct work_struct *work); -void dm_fsync_timer_callback (struct timer_list *t); +void dm_fsync_work_callback (struct work_struct *work);void dm_cck_txpower_adjust (struct net_device *dev,bool binch14);void dm_shadow_init (struct net_device *dev);void dm_initialize_txpower_tracking (struct net_device *dev);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 739/1095 rtla/utils: Use calloc and check the potential memory allocation failure
In reply to Greg Kroah-HartmanFrom: jianchunfu <[email protected]>
[ Upstream commit b5f37a0b6f667f5c72340ca9dcd7703f261cb981 ]
Replace malloc with calloc and add memory allocating check of mon_cpus before used.
--- tools/tracing/rtla/src/utils.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
tools/tracing/rtla/src/utils.c +3 -2
@@ -106,8 +106,9 @@ int parse_cpu_list(char *cpu_list, char **monitored_cpus) nr_cpus =sysconf (_SC_NPROCESSORS_CONF); - mon_cpus =malloc (nr_cpus *sizeof (char )); -memset (mon_cpus,0 , (nr_cpus *sizeof (char ))); + mon_cpus =calloc (nr_cpus,sizeof (char )); +if (!mon_cpus) + goto err;for (p = cpu_list; *p; ) { cpu =atoi (p);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 740/1095 mmc: sdhci-of-esdhc: Fix refcount leak in esdhc_signal_voltage_switch
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit b5899a3e2f783a27b268e38d37f9b24c71bddf45 ]
of_find_matching_node() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Add missing of_node_put() to avoid refcount leak. of_node_put() checks null pointer.
--- drivers/mmc/host/sdhci-of-esdhc.c | 1 + 1 file changed, 1 insertion(+)
drivers/mmc/host/sdhci-of-esdhc.c +1 -0
@@ -904,6 +904,7 @@ static int esdhc_signal_voltage_switch(struct mmc_host *mmc, scfg_node =of_find_matching_node (NULL , scfg_device_ids);if (scfg_node) scfg_base =of_iomap (scfg_node,0 ); +of_node_put (scfg_node);if (scfg_base) { sdhciovselcr =SDHCIOVSELCR_TGLEN |SDHCIOVSELCR_VSELVAL ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 741/1095 mmc: mxcmmc: Silence a clang warning
In reply to Greg Kroah-HartmanFrom: Fabio Estevam <[email protected]>
[ Upstream commit 7dc65e3c0ef4b746a583b7c58f99873fddf5ccfa ]
Change the of_device_get_match_data() cast to (uintptr_t) to silence the following clang warning:
drivers/mmc/host/mxcmmc.c:1028:18: warning: cast to smaller integer type 'enum mxcmci_type' from 'const void *' [-Wvoid-pointer-to-enum-cast]
--- drivers/mmc/host/mxcmmc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/host/mxcmmc.c +1 -1
@@ -1025,7 +1025,7 @@ static int mxcmci_probe(struct platform_device *pdev) mmc->max_req_size = mmc->max_blk_size * mmc->max_blk_count; mmc->max_seg_size = mmc->max_req_size; - host->devtype = (enum mxcmci_type )of_device_get_match_data (&pdev->dev); + host->devtype = (uintptr_t )of_device_get_match_data (&pdev->dev);/* adjust max_segs after devtype detection */ if (!is_mpc512x_mmc (host))
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 742/1095 mmc: renesas_sdhi: Get the reset handle early in the probe
In reply to Greg Kroah-HartmanFrom: Lad Prabhakar <[email protected]>
[ Upstream commit 0dac1e498f8130fdacfdd5289e3a7ac87ec1b9ad ]
In case of devm_reset_control_get_optional_exclusive() failure we returned directly instead of jumping to the error path to roll back initialization.
This patch moves devm_reset_control_get_optional_exclusive() early in the probe so that we have the reset handle prior to initialization of the hardware.
--- drivers/mmc/host/renesas_sdhi_core.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/mmc/host/renesas_sdhi_core.c +4 -4
@@ -940,6 +940,10 @@ int renesas_sdhi_probe(struct platform_device *pdev,if (IS_ERR (priv->clk_cd))return dev_err_probe (&pdev->dev,PTR_ERR (priv->clk_cd),"cannot get cd clock" ); + priv->rstc =devm_reset_control_get_optional_exclusive (&pdev->dev,NULL ); +if (IS_ERR (priv->rstc)) +return PTR_ERR (priv->rstc); + priv->pinctrl =devm_pinctrl_get (&pdev->dev);if (!IS_ERR (priv->pinctrl)) { priv->pins_default = pinctrl_lookup_state(priv->pinctrl,
@@ -1032,10 +1036,6 @@ int renesas_sdhi_probe(struct platform_device *pdev,if (ret) goto efree; - priv->rstc =devm_reset_control_get_optional_exclusive (&pdev->dev,NULL ); -if (IS_ERR (priv->rstc)) -return PTR_ERR (priv->rstc); - ver =sd_ctrl_read16 (host,CTL_VERSION );/* GEN2_SDR104 is first known SDHI to use 32bit block count */ if (ver <SDHI_VER_GEN2_SDR104 && mmc_data->max_blk_count >U16_MAX )
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 743/1095 memstick/ms_block: Fix some incorrect memory allocation
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 2e531bc3e0d86362fcd8a577b3278d9ef3cc2ba0 ]
Some functions of the bitmap API take advantage of the fact that a bitmap is an array of long.
So, to make sure this assertion is correct, allocate bitmaps with bitmap_zalloc() instead of kzalloc()+hand-computed number of bytes.
While at it, also use bitmap_free() instead of kfree() to keep the semantic.
--- drivers/memstick/core/ms_block.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/memstick/core/ms_block.c +5 -5
@@ -1341,17 +1341,17 @@ static int msb_ftl_initialize(struct msb_data *msb) msb->zone_count = msb->block_count /MS_BLOCKS_IN_ZONE ; msb->logical_block_count = msb->zone_count *496 -2 ; - msb->used_blocks_bitmap =kzalloc (msb->block_count /8 ,GFP_KERNEL ); - msb->erased_blocks_bitmap =kzalloc (msb->block_count /8 ,GFP_KERNEL ); + msb->used_blocks_bitmap =bitmap_zalloc (msb->block_count,GFP_KERNEL ); + msb->erased_blocks_bitmap =bitmap_zalloc (msb->block_count,GFP_KERNEL ); msb->lba_to_pba_table =kmalloc_array (msb->logical_block_count,sizeof (u16),GFP_KERNEL );if (!msb->used_blocks_bitmap || !msb->lba_to_pba_table || !msb->erased_blocks_bitmap) { -kfree (msb->used_blocks_bitmap); +bitmap_free (msb->used_blocks_bitmap); +bitmap_free (msb->erased_blocks_bitmap);kfree (msb->lba_to_pba_table); -kfree (msb->erased_blocks_bitmap);return -ENOMEM ; }
@@ -1946,7 +1946,7 @@ static DEFINE_MUTEX(msb_disk_lock); /* protects against races in open/release */static void msb_data_clear (struct msb_data *msb) {kfree (msb->boot_page); -kfree (msb->used_blocks_bitmap); +bitmap_free (msb->used_blocks_bitmap);kfree (msb->lba_to_pba_table);kfree (msb->cache); msb->card =NULL ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 744/1095 memstick/ms_block: Fix a memory leak
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 54eb7a55be6779c4d0c25eaf5056498a28595049 ]
'erased_blocks_bitmap' is never freed. As it is allocated at the same time as 'used_blocks_bitmap', it is likely that it should be freed also at the same time.
Add the corresponding bitmap_free() in msb_data_clear().
--- drivers/memstick/core/ms_block.c | 1 + 1 file changed, 1 insertion(+)
drivers/memstick/core/ms_block.c +1 -0
@@ -1947,6 +1947,7 @@ static void msb_data_clear(struct msb_data *msb) {kfree (msb->boot_page);bitmap_free (msb->used_blocks_bitmap); +bitmap_free (msb->erased_blocks_bitmap);kfree (msb->lba_to_pba_table);kfree (msb->cache); msb->card =NULL ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 745/1095 mmc: sdhci-of-at91: fix set_uhs_signaling rewriting of MC1R
In reply to Greg Kroah-HartmanFrom: Eugen Hristev <[email protected]>
[ Upstream commit 5987e6ded29d52e42fc7b06aa575c60a25eee38e ]
In set_uhs_signaling, the DDR bit is being set by fully writing the MC1R register.
This can lead to accidental erase of certain bits in this register. Avoid this by doing a read-modify-write operation.
--- drivers/mmc/host/sdhci-of-at91.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/mmc/host/sdhci-of-at91.c +7 -2
@@ -100,8 +100,13 @@ static void sdhci_at91_set_clock(struct sdhci_host *host, unsigned int clock)static void sdhci_at91_set_uhs_signaling (struct sdhci_host *host,unsigned int timing) { -if (timing ==MMC_TIMING_MMC_DDR52 ) -sdhci_writeb (host,SDMMC_MC1R_DDR ,SDMMC_MC1R ); +u8 mc1r; + +if (timing ==MMC_TIMING_MMC_DDR52 ) { + mc1r =sdhci_readb (host,SDMMC_MC1R ); + mc1r |=SDMMC_MC1R_DDR ; +sdhci_writeb (host, mc1r,SDMMC_MC1R ); + }sdhci_set_uhs_signaling (host, timing); }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 746/1095 of: device: Fix missing of_node_put() in of_dma_set_restricted_buffer
In reply to Greg Kroah-HartmanFrom: Liang He <[email protected]>
[ Upstream commit d17e37c41b7ed38459957a5d2968ba61516fd5c2 ]
We should use of_node_put() for the reference 'node' returned by of_parse_phandle() which will increase the refcount.
--- drivers/of/device.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/of/device.c +4 -1
@@ -81,8 +81,11 @@ of_dma_set_restricted_buffer(struct device *dev, struct device_node *np)* restricted-dma-pool region is allowed. */ if (of_device_is_compatible (node,"restricted-dma-pool" ) && -of_device_is_available (node)) +of_device_is_available (node)) { +of_node_put (node);break ; + } +of_node_put (node); }/*
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 747/1095 mmc: block: Add single read for 4k sector cards
In reply to Greg Kroah-HartmanFrom: Christian Loehle <[email protected]>
[ Upstream commit b3fa3e6dccc465969721b8bd2824213bd235efeb ]
Cards with 4k native sector size may only be read 4k-aligned, accommodate for this in the single read recovery and use it.
--- drivers/mmc/core/block.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-)
drivers/mmc/core/block.c +14 -14
@@ -175,7 +175,7 @@ static inline int mmc_blk_part_switch(struct mmc_card *card, unsigned int part_type);static void mmc_blk_rw_rq_prep (struct mmc_queue_req *mqrq,struct mmc_card *card, -int disable_multi, +int recovery_mode,struct mmc_queue *mq);static void mmc_blk_hsq_req_done (struct mmc_request *mrq);
@@ -1285,7 +1285,7 @@ static void mmc_blk_eval_resp_error(struct mmc_blk_request *brq) }static void mmc_blk_data_prep (struct mmc_queue *mq,struct mmc_queue_req *mqrq, -int disable_multi,bool *do_rel_wr_p, +int recovery_mode,bool *do_rel_wr_p,bool *do_data_tag_p) {struct mmc_blk_data *md = mq->blkdata;
@@ -1351,12 +1351,12 @@ static void mmc_blk_data_prep(struct mmc_queue *mq, struct mmc_queue_req *mqrq, brq->data.blocks--;/* -* After a read error, we redo the request one sector +* After a read error, we redo the request one (native) sector * at a time in order to accurately determine which * sectors can be read successfully. */ -if (disable_multi) - brq->data.blocks =1 ; +if (recovery_mode) + brq->data.blocks =queue_physical_block_size (mq->queue) >>9 ;/* * Some controllers have HW issues while operating
@@ -1573,7 +1573,7 @@ static int mmc_blk_cqe_issue_rw_rq(struct mmc_queue *mq, struct request *req)static void mmc_blk_rw_rq_prep (struct mmc_queue_req *mqrq,struct mmc_card *card, -int disable_multi, +int recovery_mode,struct mmc_queue *mq) {u32 readcmd, writecmd;
@@ -1582,7 +1582,7 @@ static void mmc_blk_rw_rq_prep(struct mmc_queue_req *mqrq,struct mmc_blk_data *md = mq->blkdata;bool do_rel_wr, do_data_tag; -mmc_blk_data_prep (mq, mqrq, disable_multi, &do_rel_wr, &do_data_tag); +mmc_blk_data_prep (mq, mqrq, recovery_mode, &do_rel_wr, &do_data_tag); brq->mrq.cmd = &brq->cmd;
@@ -1673,7 +1673,7 @@ static int mmc_blk_fix_state(struct mmc_card *card, struct request *req)#define MMC_READ_SINGLE_RETRIES 2 -/* Single sector read during recovery */ +/* Single (native) sector read during recovery */ static void mmc_blk_read_single (struct mmc_queue *mq,struct request *req) {struct mmc_queue_req *mqrq =req_to_mmc_queue_req (req);
@@ -1681,6 +1681,7 @@ static void mmc_blk_read_single(struct mmc_queue *mq, struct request *req)struct mmc_card *card = mq->card;struct mmc_host *host = card->host;blk_status_t error =BLK_STS_OK ; +size_t bytes_per_read =queue_physical_block_size (mq->queue); do { u32 status;
@@ -1715,13 +1716,13 @@ static void mmc_blk_read_single(struct mmc_queue *mq, struct request *req)else error =BLK_STS_OK ; - }while (blk_update_request (req, error,512 )); + }while (blk_update_request (req, error, bytes_per_read));return ; error_exit: mrq->data->bytes_xfered =0 ; -blk_update_request (req,BLK_STS_IOERR ,512 ); +blk_update_request (req,BLK_STS_IOERR , bytes_per_read);/* Let it try the remaining request again */ if (mqrq->retries >MMC_MAX_RETRIES -1 ) mqrq->retries =MMC_MAX_RETRIES -1 ;
@@ -1862,10 +1863,9 @@ static void mmc_blk_mq_rw_recovery(struct mmc_queue *mq, struct request *req)return ; } -/* FIXME: Missing single sector read for large sector size */ -if (!mmc_large_sector (card) &&rq_data_dir (req) ==READ && - brq->data.blocks >1 ) { -/* Read one sector at a time */ +if (rq_data_dir (req) ==READ && brq->data.blocks > +queue_physical_block_size (mq->queue) >>9 ) { +/* Read one (native) sector at a time */ mmc_blk_read_single (mq, req);return ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 748/1095 KVM: s390: pv: leak the topmost page table when destroy fails
In reply to Greg Kroah-HartmanFrom: Claudio Imbrenda <[email protected]>
[ Upstream commit faa2f72cb3569256480c5540d242c84e99965160 ]
Each secure guest must have a unique ASCE (address space control element); we must avoid that new guests use the same page for their ASCE, to avoid errors.
Since the ASCE mostly consists of the address of the topmost page table (plus some flags), we must not return that memory to the pool unless the ASCE is no longer in use.
Only a successful Destroy Secure Configuration UVC will make the ASCE reusable again.
If the Destroy Configuration UVC fails, the ASCE cannot be reused for a secure guest (either for the ASCE or for other memory areas). To avoid a collision, it must not be used again. This is a permanent error and the page becomes in practice unusable, so we set it aside and leak it. On failure we already leak other memory that belongs to the ultravisor (i.e. the variable and base storage for a guest) and not leaking the topmost page table was an oversight.
This error (and thus the leakage) should not happen unless the hardware is broken or KVM has some unknown serious bug.
Message-Id: <[email protected]>
--- arch/s390/include/asm/gmap.h | 2 + arch/s390/kvm/pv.c | 9 ++-- arch/s390/mm/gmap.c | 86 ++++++++++++++++++++++++++++++++++++ 3 files changed, 94 insertions(+), 3 deletions(-)
arch/s390/include/asm/gmap.h +2 -0
@@ -148,4 +148,6 @@ void gmap_sync_dirty_log_pmd(struct gmap *gmap, unsigned long dirty_bitmap[4], unsigned long gaddr, unsigned long vmaddr);int gmap_mark_unmergeable (void );void s390_reset_acc (struct mm_struct *mm); +void s390_unlist_old_asce (struct gmap *gmap); +int s390_replace_asce (struct gmap *gmap);#endif /* _ASM_S390_GMAP_H */
arch/s390/kvm/pv.c +6 -3
@@ -161,10 +161,13 @@ int kvm_s390_pv_deinit_vm(struct kvm *kvm, u16 *rc, u16 *rrc)atomic_set (&kvm->mm->context.is_protected,0 );KVM_UV_EVENT (kvm,3 ,"PROTVIRT DESTROY VM: rc %x rrc %x" , *rc, *rrc);WARN_ONCE (cc,"protvirt destroy vm failed rc %x rrc %x" , *rc, *rrc); -/* Inteded memory leak on "impossible" error */ -if (!cc) +/* Intended memory leak on "impossible" error */ +if (!cc) {kvm_s390_pv_dealloc_vm (kvm); -return cc ? -EIO :0 ; +return 0 ; + } +s390_replace_asce (kvm->arch.gmap); +return -EIO ; }int kvm_s390_pv_init_vm (struct kvm *kvm,u16 *rc,u16 *rrc)
arch/s390/mm/gmap.c +86 -0
89 lines not on this page · raw message
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 749/1095 PCI/portdrv: Dont disable AER reporting in get_port_device_capability()
In reply to Greg Kroah-HartmanFrom: Stefan Roese <[email protected]>
[ Upstream commit 8795e182b02dc87e343c79e73af6b8b7f9c5e635 ]
AER reporting is currently disabled in the DevCtl registers of all non Root Port PCIe devices on systems using pcie_ports_native || host->native_aer, disabling AER completely in such systems. This is because 2bd50dd800b5 ("PCI: PCIe: Disable PCIe port services during port initialization"), added a call to pci_disable_pcie_error_reporting() *after* the AER setup was completed for the PCIe device tree.
Here a longer analysis about the current status of AER enabling / disabling upon bootup provided by Bjorn:
pcie_portdrv_probe
pcie_port_device_register
get_port_device_capability
pci_disable_pcie_error_reporting
clear CERE NFERE FERE URRE # <-- disable for RP USP DSP
pcie_device_init
device_register # new AER service device
aer_probe
aer_enable_rootport # RP only
set_downstream_devices_error_reporting
set_device_error_reporting # self (RP)
if (RP || USP || DSP)
pci_enable_pcie_error_reporting
set CERE NFERE FERE URRE # <-- enable for RP
pci_walk_bus
set_device_error_reporting
if (RP || USP || DSP)
pci_enable_pcie_error_reporting
set CERE NFERE FERE URRE # <-- enable for USP DSP
In a typical Root Port -> Endpoint hierarchy, the above:
- Disables Error Reporting for the Root Port,
- Enables Error Reporting for the Root Port,
- Does NOT enable Error Reporting for the Endpoint because it is not a Root Port or Switch Port.
In a deeper Root Port -> Upstream Switch Port -> Downstream Switch Port -> Endpoint hierarchy:
- Disables Error Reporting for the Root Port,
- Enables Error Reporting for the Root Port,
- Enables Error Reporting for both Switch Ports,
- Does NOT enable Error Reporting for the Endpoint because it is not a Root Port or Switch Port,
- Disables Error Reporting for the Switch Ports when pcie_portdrv_probe() claims them. AER does not re-enable it because these are not Root Ports.
Remove this call to pci_disable_pcie_error_reporting() from get_port_device_capability(), leaving the already enabled AER configuration intact. With this change, AER is enabled in the Root Port and the PCIe switch upstream and downstream ports. Only the PCIe Endpoints don't have AER enabled yet. A follow-up patch will take care of this Endpoint enabling.
--- drivers/pci/pcie/portdrv_core.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-)
drivers/pci/pcie/portdrv_core.c +1 -8
@@ -222,15 +222,8 @@ static int get_port_device_capability(struct pci_dev *dev)#ifdef CONFIG_PCIEAER if (dev->aer_cap &&pci_aer_available () && - (pcie_ports_native || host->native_aer)) { + (pcie_ports_native || host->native_aer)) services |=PCIE_PORT_SERVICE_AER ; - -/* -* Disable AER on this port in case it's been enabled by the -* BIOS (the AER service driver will enable it when necessary). -*/ -pci_disable_pcie_error_reporting (dev); - }#endif /* Root Ports and Root Complex Event Collectors may generate PMEs */
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 750/1095 PCI: qcom: Set up rev 2.1.0 PARF_PHY before enabling clocks
In reply to Greg Kroah-HartmanFrom: Christian Marangi <[email protected]>
[ Upstream commit 38f897ae3d44900f627cad708a15db498ce2ca31 ]
We currently enable clocks BEFORE we write to PARF_PHY_CTRL reg to enable clocks and resets. This causes the driver to never set to a ready state with the error 'Phy link never came up'.
This is caused by the PHY clock getting enabled before setting the required bits in the PARF regs.
A workaround for this was set but with this new discovery we can drop the workaround and use a proper solution to the problem by just enabling the clock only AFTER the PARF_PHY_CTRL bit is set.
This correctly sets up the PCIe link and makes it usable even when a bootloader leaves the PCIe link in an undefined state.
--- drivers/pci/controller/dwc/pcie-qcom.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/pci/controller/dwc/pcie-qcom.c +4 -6
@@ -337,8 +337,6 @@ static int qcom_pcie_init_2_1_0(struct qcom_pcie *pcie)reset_control_assert (res->ext_reset);reset_control_assert (res->phy_reset); -writel (1 , pcie->parf +PCIE20_PARF_PHY_CTRL ); - ret =regulator_bulk_enable (ARRAY_SIZE (res->supplies), res->supplies);if (ret <0 ) {dev_err (dev,"cannot enable regulators\n" );
@@ -381,15 +379,15 @@ static int qcom_pcie_init_2_1_0(struct qcom_pcie *pcie) goto err_deassert_axi; } - ret =clk_bulk_prepare_enable (ARRAY_SIZE (res->clks), res->clks); -if (ret) - goto err_clks; -/* enable PCIe clocks and resets */ val =readl (pcie->parf +PCIE20_PARF_PHY_CTRL ); val &= ~BIT (0 );writel (val, pcie->parf +PCIE20_PARF_PHY_CTRL ); + ret =clk_bulk_prepare_enable (ARRAY_SIZE (res->clks), res->clks); +if (ret) + goto err_clks; +if (of_device_is_compatible (node,"qcom,pcie-ipq8064" ) ||of_device_is_compatible (node,"qcom,pcie-ipq8064-v2" )) { writel(PCS_DEEMPH_TX_DEEMPH_GEN1(24) |
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 751/1095 scsi: smartpqi: Fix DMA direction for RAID requests
In reply to Greg Kroah-HartmanFrom: Mahesh Rajashekhara <[email protected]>
[ Upstream commit 69695aeaa6621bc49cdd7a8e5a8d1042461e496e ]
Correct a SOP READ and WRITE DMA flags for some requests.
This update corrects DMA direction issues with SCSI commands removed from the controller's internal lookup table.
Currently, SCSI READ BLOCK LIMITS (0x5) was removed from the controller lookup table and exposed a DMA direction flag issue.
SCSI READ BLOCK LIMITS was recently removed from our controller lookup table so the controller uses the respective IU flag field to set the DMA data direction. Since the DMA direction is incorrect the FW never completes the request causing a hang.
Some SCSI commands which use SCSI READ BLOCK LIMITS
* sg_map
* mt -f /dev/stX status
After updating controller firmware, users may notice their tape units failing. This patch resolves the issue.
Also, the AIO path DMA direction is correct.
The DMA direction flag is a day-one bug with no reported BZ.
--- drivers/scsi/smartpqi/smartpqi_init.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/smartpqi/smartpqi_init.c +2 -2
@@ -5484,10 +5484,10 @@ static int pqi_raid_submit_scsi_cmd_with_io_request( }switch (scmd->sc_data_direction) { -case DMA_TO_DEVICE : +case DMA_FROM_DEVICE : request->data_direction =SOP_READ_FLAG ;break ; -case DMA_FROM_DEVICE : +case DMA_TO_DEVICE : request->data_direction =SOP_WRITE_FLAG ;break ;case DMA_NONE :
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 752/1095 xtensa: iss/network: provide release() callback
In reply to Greg Kroah-HartmanFrom: Max Filippov <[email protected]>
[ Upstream commit 8864fb8359682912ee99235db7db916733a1fd7b ]
Provide release() callback for the platform device embedded into struct iss_net_private and registered in the iss_net_configure so that platform_device_unregister could be called for it.
--- arch/xtensa/platforms/iss/network.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
arch/xtensa/platforms/iss/network.c +10 -0
@@ -503,6 +503,15 @@ static const struct net_device_ops iss_netdev_ops = { .ndo_set_rx_mode = iss_net_set_multicast_list, }; +static void iss_net_pdev_release (struct device *dev) +{ +struct platform_device *pdev =to_platform_device (dev); +struct iss_net_private *lp = + container_of(pdev, struct iss_net_private, pdev); + +free_netdev (lp->dev); +} +static int iss_net_configure (int index,char *init) {struct net_device *dev;
@@ -559,6 +568,7 @@ static int iss_net_configure(int index, char *init) lp->pdev.id = index; lp->pdev.name =DRIVER_NAME ; + lp->pdev.dev.release = iss_net_pdev_release;platform_device_register (&lp->pdev);SET_NETDEV_DEV (dev, &lp->pdev.dev);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 753/1095 xtensa: iss: fix handling error cases in iss_net_configure()
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit 628ccfc8f5f79dd548319408fcc53949fe97b258 ]
The 'pdev' and 'netdev' need to be released in error cases of iss_net_configure().
Change the return type of iss_net_configure() to void, because it's not used.
--- arch/xtensa/platforms/iss/network.c | 32 ++++++++++++++--------------- 1 file changed, 15 insertions(+), 17 deletions(-)
arch/xtensa/platforms/iss/network.c +15 -17
@@ -512,16 +512,15 @@ static void iss_net_pdev_release(struct device *dev)free_netdev (lp->dev); } -static int iss_net_configure (int index,char *init) +static void iss_net_configure (int index,char *init) {struct net_device *dev;struct iss_net_private *lp; -int err; dev =alloc_etherdev (sizeof (*lp));if (dev ==NULL ) {pr_err ("eth_configure: failed to allocate device\n" ); -return 1 ; +return ; }/* Initialize private element. */
@@ -550,7 +549,7 @@ static int iss_net_configure(int index, char *init)if (!tuntap_probe (lp, index, init)) {pr_err ("%s: invalid arguments. Skipping device!\n" , dev->name); - goto errout; + goto err_free_netdev; }pr_info ("Netdevice %d (%pM)\n" , index, dev->dev_addr);
@@ -558,7 +557,8 @@ static int iss_net_configure(int index, char *init)/* sysfs register */ if (!driver_registered) { -platform_driver_register (&iss_net_driver); +if (platform_driver_register (&iss_net_driver)) + goto err_free_netdev; driver_registered =1 ; }
@@ -569,7 +569,8 @@ static int iss_net_configure(int index, char *init) lp->pdev.id = index; lp->pdev.name =DRIVER_NAME ; lp->pdev.dev.release = iss_net_pdev_release; -platform_device_register (&lp->pdev); +if (platform_device_register (&lp->pdev)) + goto err_free_netdev;SET_NETDEV_DEV (dev, &lp->pdev.dev); dev->netdev_ops = &iss_netdev_ops;
@@ -578,23 +579,20 @@ static int iss_net_configure(int index, char *init) dev->irq =-1 ;rtnl_lock (); - err =register_netdevice (dev); -rtnl_unlock (); - -if (err) { +if (register_netdevice (dev)) { +rtnl_unlock ();pr_err ("%s: error registering net device!\n" , dev->name); -/* XXX: should we call ->remove() here? */ -free_netdev (dev); -return 1 ; +platform_device_unregister (&lp->pdev); +return ; } +rtnl_unlock ();timer_setup (&lp->tl, iss_net_user_timer_expire,0 ); -return 0 ; +return ; -errout: -/* FIXME: unregister; free, etc.. */ -return -EIO ; +err_free_netdev: +free_netdev (dev); }/* ------------------------------------------------------------------------- */
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 754/1095 usb: gadget: udc: amd5536 depends on HAS_DMA
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
[ Upstream commit 8097cf2fb3b2205257f1c76f4808e3398d66b6d9 ]
USB_AMD5536UDC should depend on HAS_DMA since it selects USB_SNP_CORE, which depends on HAS_DMA and since 'select' does not follow any dependency chains.
Fixes this kconfig warning:
WARNING: unmet direct dependencies detected for USB_SNP_CORE
Depends on [n]: USB_SUPPORT [=y] && USB_GADGET [=y] && (USB_AMD5536UDC [=y] || USB_SNP_UDC_PLAT [=n]) && HAS_DMA [=n] Selected by [y]:
- USB_AMD5536UDC [=y] && USB_SUPPORT [=y] && USB_GADGET [=y] && USB_PCI [=y]
--- drivers/usb/gadget/udc/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/gadget/udc/Kconfig +1 -1
@@ -311,7 +311,7 @@ source "drivers/usb/gadget/udc/bdc/Kconfig" config USB_AMD5536UDC tristate "AMD5536 UDC" - depends on USB_PCI + depends on USB_PCI && HAS_DMA select USB_SNP_CORE help The AMD5536 UDC is part of the AMD Geode CS5536, an x86 southbridge.
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 755/1095 usb: aspeed-vhub: Fix refcount leak bug in ast_vhub_init_desc()
In reply to Greg Kroah-HartmanFrom: Liang He <[email protected]>
[ Upstream commit 220fafb4ed04187e9c17be4152da5a7f2ffbdd8c ]
We should call of_node_put() for the reference returned by of_get_child_by_name() which has increased the refcount.
--- drivers/usb/gadget/udc/aspeed-vhub/hub.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/usb/gadget/udc/aspeed-vhub/hub.c +3 -1
@@ -1059,8 +1059,10 @@ static int ast_vhub_init_desc(struct ast_vhub *vhub)/* Initialize vhub String Descriptors. */ INIT_LIST_HEAD (&vhub->vhub_str_desc); desc_np =of_get_child_by_name (vhub_np,"vhub-strings" ); -if (desc_np) +if (desc_np) { ret =ast_vhub_of_parse_str_desc (vhub, desc_np); +of_node_put (desc_np); + }else ret =ast_vhub_str_alloc_add (vhub, &ast_vhub_strings);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 756/1095 usb: dwc3: core: Deprecate GCTL.CORESOFTRESET
In reply to Greg Kroah-HartmanFrom: Thinh Nguyen <[email protected]>
[ Upstream commit afbd04e66e5d16ca3c7ea2e3c56eca25558eacf3 ]
Synopsys IP DWC_usb32 and DWC_usb31 version 1.90a and above deprecated GCTL.CORESOFTRESET. The DRD mode switching flow is updated to remove the GCTL soft reset. Add version checks to prevent using deprecated setting in mode switching flow.
--- drivers/usb/dwc3/core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/usb/dwc3/core.c +2 -1
@@ -158,7 +158,8 @@ static void __dwc3_set_mode(struct work_struct *work) }/* For DRD host or device mode only */ -if (dwc->desired_dr_role !=DWC3_GCTL_PRTCAP_OTG ) { + if ((DWC3_IP_IS(DWC3) || DWC3_VER_IS_PRIOR(DWC31, 190A)) && + dwc->desired_dr_role !=DWC3_GCTL_PRTCAP_OTG ) { reg =dwc3_readl (dwc->regs,DWC3_GCTL ); reg |=DWC3_GCTL_CORESOFTRESET ;dwc3_writel (dwc->regs,DWC3_GCTL , reg);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 757/1095 usb: dwc3: core: Do not perform GCTL_CORE_SOFTRESET during bootup
In reply to Greg Kroah-HartmanFrom: Rohith Kollalsi <[email protected]>
[ Upstream commit 07903626d98853e605fe63e5ce149f1b7314bbea ]
According to the programming guide, it is recommended to perform a GCTL_CORE_SOFTRESET only when switching the mode from device to host or host to device. However, it is found that during bootup when __dwc3_set_mode() is called for the first time, GCTL_CORESOFTRESET is done with suspendable bit(BIT 17) of DWC3_GUSB3PIPECTL set. This some times leads to issues like controller going into bad state and controller registers reading value zero. Until GCTL_CORESOFTRESET is done and run/stop bit is set core initialization is not complete. Setting suspendable bit of DWC3_GUSB3PIPECTL and then performing GCTL_CORESOFTRESET is therefore not recommended. Avoid this by only performing the reset if current_dr_role is set, that is, when doing subsequent role switching.
--- drivers/usb/dwc3/core.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/usb/dwc3/core.c +7 -3
@@ -157,9 +157,13 @@ static void __dwc3_set_mode(struct work_struct *work)break ; } -/* For DRD host or device mode only */ - if ((DWC3_IP_IS(DWC3) || DWC3_VER_IS_PRIOR(DWC31, 190A)) && - dwc->desired_dr_role !=DWC3_GCTL_PRTCAP_OTG ) { +/* +* When current_dr_role is not set, there's no role switching. +* Only perform GCTL.CoreSoftReset when there's DRD role switching. +*/ +if (dwc->current_dr_role && ((DWC3_IP_IS (DWC3 ) || + DWC3_VER_IS_PRIOR(DWC31, 190A)) && + dwc->desired_dr_role !=DWC3_GCTL_PRTCAP_OTG )) { reg =dwc3_readl (dwc->regs,DWC3_GCTL ); reg |=DWC3_GCTL_CORESOFTRESET ;dwc3_writel (dwc->regs,DWC3_GCTL , reg);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 758/1095 usb: dwc3: qcom: fix missing optional irq warnings
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
[ Upstream commit 69bb3520db7cecbccc9e497fc568fa5465c9d43f ]
Not all platforms have all of the four currently supported wakeup interrupts so use the optional irq helpers when looking up interrupts to avoid printing error messages when an optional interrupt is not found:
dwc3-qcom a6f8800.usb: error -ENXIO: IRQ hs_phy_irq not found
--- drivers/usb/dwc3/dwc3-qcom.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/dwc3/dwc3-qcom.c +2 -2
@@ -443,9 +443,9 @@ static int dwc3_qcom_get_irq(struct platform_device *pdev,int ret;if (np) - ret =platform_get_irq_byname (pdev_irq, name); + ret =platform_get_irq_byname_optional (pdev_irq, name);else - ret =platform_get_irq (pdev_irq, num); + ret =platform_get_irq_optional (pdev_irq, num);return ret; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 759/1095 eeprom: idt_89hpesx: uninitialized data in idt_dbgfs_csr_write()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 71d46f1ff2212ced4852c7e77c5176382a1bdcec ]
The simple_write_to_buffer() function will return positive/success if it is able to write a single byte anywhere within the buffer. However that potentially leaves a lot of the buffer uninitialized.
In this code it's better to return 0 if the offset is non-zero. This code is not written to support partial writes. And then return -EFAULT if the buffer is not completely initialized.
--- drivers/misc/eeprom/idt_89hpesx.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/misc/eeprom/idt_89hpesx.c +6 -2
@@ -909,14 +909,18 @@ static ssize_t idt_dbgfs_csr_write(struct file *filep, const char __user *ubuf,u32 csraddr, csrval;char *buf; +if (*offp) +return 0 ; +/* Copy data from User-space */ buf =kmalloc (count +1 ,GFP_KERNEL );if (!buf)return -ENOMEM ; - ret =simple_write_to_buffer (buf, count, offp, ubuf, count); -if (ret <0 ) +if (copy_from_user (buf, ubuf, count)) { + ret = -EFAULT ; goto free_buf; + } buf[count] =0 ;/* Find position of colon in the buffer */
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 760/1095 phy: stm32: fix error return in stm32_usbphyc_phy_init
In reply to Greg Kroah-HartmanFrom: Fabrice Gasnier <[email protected]>
[ Upstream commit 32b378a9179ae4db61cfc5d502717214e6cd1e1c ]
Error code is overridden, in case the PLL doesn't lock. So, the USB initialization can continue. This leads to a platform freeze. This can be avoided by returning proper error code to avoid USB probe freezing the platform. It also displays proper errors in log.
--- drivers/phy/st/phy-stm32-usbphyc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/phy/st/phy-stm32-usbphyc.c +3 -1
@@ -358,7 +358,9 @@ static int stm32_usbphyc_phy_init(struct phy *phy)return 0 ; pll_disable: -return stm32_usbphyc_pll_disable (usbphyc); +stm32_usbphyc_pll_disable (usbphyc); + +return ret; }static int stm32_usbphyc_phy_exit (struct phy *phy)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 761/1095 phy: rockchip-inno-usb2: Ignore OTG IRQs in host mode
In reply to Greg Kroah-HartmanFrom: Samuel Holland <[email protected]>
[ Upstream commit fd7d47484125c7d04578de9294faa7fec6e5df0a ]
When the OTG port is fixed to host mode, the driver does not request its IRQs, nor does it enable those IRQs in hardware. Similarly, the driver should ignore the OTG port IRQs when handling the shared interrupt.
Otherwise, it would update the extcon based on an ID pin which may be in an undefined state, or try to queue a uninitialized work item.
--- drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/phy/rockchip/phy-rockchip-inno-usb2.c +3 -1
@@ -942,7 +942,9 @@ static irqreturn_t rockchip_usb2phy_irq(int irq, void *data)switch (rport->port_id) {case USB2PHY_PORT_OTG : - ret |=rockchip_usb2phy_otg_mux_irq (irq, rport); +if (rport->mode !=USB_DR_MODE_HOST && + rport->mode !=USB_DR_MODE_UNKNOWN ) + ret |=rockchip_usb2phy_otg_mux_irq (irq, rport);break ;case USB2PHY_PORT_HOST : ret |=rockchip_usb2phy_linestate_irq (irq, rport);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 762/1095 interconnect: imx: fix max_node_id
In reply to Greg Kroah-HartmanFrom: Peng Fan <[email protected]>
[ Upstream commit bd734481e172b4827af09c9ab06c51d2ab7201e6 ]
max_node_id not equal to the ARRAY_SIZE of node array, need increase 1, otherwise xlate will fail for the last entry. And rename max_node_id to num_nodes to reflect the reality.
--- drivers/interconnect/imx/imx.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/interconnect/imx/imx.c +4 -4
@@ -234,16 +234,16 @@ int imx_icc_register(struct platform_device *pdev,struct device *dev = &pdev->dev;struct icc_onecell_data *data;struct icc_provider *provider; -int max_node_id; +int num_nodes;int ret;/* icc_onecell_data is indexed by node_id, unlike nodes param */ - max_node_id =get_max_node_id (nodes, nodes_count); - data =devm_kzalloc (dev,struct_size (data, nodes, max_node_id), + num_nodes =get_max_node_id (nodes, nodes_count) +1 ; + data =devm_kzalloc (dev,struct_size (data, nodes, num_nodes),GFP_KERNEL );if (!data)return -ENOMEM ; - data->num_nodes = max_node_id; + data->num_nodes = num_nodes; provider =devm_kzalloc (dev,sizeof (*provider),GFP_KERNEL );if (!provider)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 763/1095 um: random: Dont initialise hwrng struct with zero
In reply to Greg Kroah-HartmanFrom: Christopher Obbard <[email protected]>
[ Upstream commit 9e70cbd11b03889c92462cf52edb2bd023c798fa ]
Initialising the hwrng struct with zeros causes a
compile-time sparse warning:
$ ARCH=um make -j10 W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ... CHECK arch/um/drivers/random.c arch/um/drivers/random.c:31:31: sparse: warning: Using plain integer as NULL pointer
Fix the warning by not initialising the hwrng struct with zeros as it is initialised anyway during module init.
--- arch/um/drivers/random.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/um/drivers/random.c +1 -1
@@ -28,7 +28,7 @@* protects against a module being loaded twice at the same time. */ static int random_fd =-1 ; -static struct hwrng hwrng = {0 , }; +static struct hwrng hwrng;static DECLARE_COMPLETION (have_data);static int rng_dev_read (struct hwrng *rng,void *buf,size_t max,bool block)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 764/1095 RDMA/irdma: Fix a window for use-after-free
In reply to Greg Kroah-HartmanFrom: Mustafa Ismail <[email protected]>
[ Upstream commit 8ecef7890b3aea78c8bbb501a4b5b8134367b821 ]
During a destroy CQ an interrupt may cause processing of a CQE after CQ resources are freed by irdma_cq_free_rsrc(). Fix this by moving the call to irdma_cq_free_rsrc() after the irdma_sc_cleanup_ceqes(), which is called under the cq_lock.
--- drivers/infiniband/hw/irdma/verbs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/hw/irdma/verbs.c +1 -1
@@ -1760,11 +1760,11 @@ static int irdma_destroy_cq(struct ib_cq *ib_cq, struct ib_udata *udata)spin_unlock_irqrestore (&iwcq->lock, flags);irdma_cq_wq_destroy (iwdev->rf, cq); -irdma_cq_free_rsrc (iwdev->rf, iwcq);spin_lock_irqsave (&iwceq->ce_lock, flags);irdma_sc_cleanup_ceqes (cq, ceq);spin_unlock_irqrestore (&iwceq->ce_lock, flags); +irdma_cq_free_rsrc (iwdev->rf, iwcq);return 0 ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 765/1095 RDMA/irdma: Fix VLAN connection with wildcard address
In reply to Greg Kroah-HartmanFrom: Mustafa Ismail <[email protected]>
[ Upstream commit 82ab2b52654c43ba24a3f6603fec40874cc5a7e5 ]
When an application listens on a wildcard address, and there are VLAN and non-VLAN IP addresses, iWARP connection establishemnt can fail if the listen node VLAN ID does not match.
Fix this by checking the vlan_id only if not a wildcard listen node.
--- drivers/infiniband/hw/irdma/cm.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/infiniband/hw/irdma/cm.c +6 -5
@@ -1477,12 +1477,13 @@ irdma_find_listener(struct irdma_cm_core *cm_core, u32 *dst_addr, u16 dst_port, list_for_each_entry (listen_node, &cm_core->listen_list, list) {memcpy (listen_addr, listen_node->loc_addr,sizeof (listen_addr)); listen_port = listen_node->loc_port; +if (listen_port != dst_port || + !(listener_state & listen_node->listener_state)) +continue ;/* compare node pair, return node handle if a match */ -if ((!memcmp (listen_addr, dst_addr,sizeof (listen_addr)) || - !memcmp (listen_addr, ip_zero,sizeof (listen_addr))) && - listen_port == dst_port && - vlan_id == listen_node->vlan_id && - (listener_state & listen_node->listener_state)) { +if (!memcmp (listen_addr, ip_zero,sizeof (listen_addr)) || + (!memcmp (listen_addr, dst_addr,sizeof (listen_addr)) && + vlan_id == listen_node->vlan_id)) {refcount_inc (&listen_node->refcnt);spin_unlock_irqrestore (&cm_core->listen_list_lock, flags);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 766/1095 RDMA/irdma: Fix setting of QP context err_rq_idx_valid field
In reply to Greg Kroah-HartmanFrom: Mustafa Ismail <[email protected]>
[ Upstream commit 3a844596ed71b7c12ac602f6f6b7b0f17e4d6a90 ]
Setting err_rq_idx_valid field in QP context when the AE source of the AEQE is not associated with an RQ causes the firmware flush to fail.
Set err_rq_idx_valid field in QP context only if it is associated with an RQ. Additionally, cleanup the redundant setting of this field in irdma_process_aeq.
--- drivers/infiniband/hw/irdma/hw.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-)
drivers/infiniband/hw/irdma/hw.c +4 -11
@@ -257,10 +257,6 @@ static void irdma_process_aeq(struct irdma_pci_f *rf) iwqp->last_aeq = info->ae_id;spin_unlock_irqrestore (&iwqp->lock, flags); ctx_info = &iwqp->ctx_info; -if (rdma_protocol_roce (&iwqp->iwdev->ibdev,1 )) - ctx_info->roce_info->err_rq_idx_valid = true; -else - ctx_info->iwarp_info->err_rq_idx_valid = true; }else {if (info->ae_id !=IRDMA_AE_CQ_OPERATION_ERROR )continue ;
@@ -370,16 +366,12 @@ static void irdma_process_aeq(struct irdma_pci_f *rf)case IRDMA_AE_LCE_FUNCTION_CATASTROPHIC :case IRDMA_AE_LCE_CQ_CATASTROPHIC :case IRDMA_AE_UDA_XMIT_DGRAM_TOO_LONG : -if (rdma_protocol_roce (&iwdev->ibdev,1 )) - ctx_info->roce_info->err_rq_idx_valid = false; -else - ctx_info->iwarp_info->err_rq_idx_valid = false; - fallthrough;default :ibdev_err (&iwdev->ibdev,"abnormal ae_id = 0x%x bool qp=%d qp_id = %d\n" , info->ae_id, info->qp, info->qp_cq_id);if (rdma_protocol_roce (&iwdev->ibdev,1 )) { -if (!info->sq && ctx_info->roce_info->err_rq_idx_valid) { + ctx_info->roce_info->err_rq_idx_valid = info->rq; +if (info->rq) { ctx_info->roce_info->err_rq_idx = info->wqe_idx;irdma_sc_qp_setctx_roce (&iwqp->sc_qp, iwqp->host_ctx.va, ctx_info);
@@ -388,7 +380,8 @@ static void irdma_process_aeq(struct irdma_pci_f *rf)irdma_cm_disconn (iwqp);break ; } -if (!info->sq && ctx_info->iwarp_info->err_rq_idx_valid) { + ctx_info->iwarp_info->err_rq_idx_valid = info->rq; +if (info->rq) { ctx_info->iwarp_info->err_rq_idx = info->wqe_idx; ctx_info->tcp_info_valid = false; ctx_info->iwarp_info_valid = true;
Signature · 1 line
2.35.1