media: davinci-isif: avoid uninitialized variable use
Subsystems (59)
Sasha Levin
maintainerPATCH 264/671 media: davinci-isif: avoid uninitialized variable use
From: Arnd Bergmann <[email protected]>
[ Upstream commit 0e633f97162c1c74c68e2eb20bbd9259dce87cd9 ]
clang warns about a possible variable use that gcc never complained about:
drivers/media/platform/davinci/isif.c:982:32: error: variable 'frame_size' is uninitialized when used here
[-Werror,-Wuninitialized]
dm365_vpss_set_pg_frame_size(frame_size);
^~~~~~~~~~
drivers/media/platform/davinci/isif.c:887:2: note: variable 'frame_size' is declared here
struct vpss_pg_frame_size frame_size;
^1 error generated.
There is no initialization for this variable at all, and there has never been one in the mainline kernel, so we really should not put that stack data into an mmio register.
On the other hand, I suspect that gcc checks the condition more closely and notices that the global isif_cfg.bayer.config_params.test_pat_gen flag is initialized to zero and never written to from any code path, so anything depending on it can be eliminated.
To shut up the clang warning, just remove the dead code manually, it has probably never been used because any attempt to do so would have resulted in undefined behavior.
--- drivers/media/platform/davinci/isif.c | 9 --------- 1 file changed, 9 deletions(-)
drivers/media/platform/davinci/isif.c +0 -9
@@ -884,9 +884,7 @@ static int isif_set_hw_if_params(struct vpfe_hw_if_param *params)static int isif_config_ycbcr (void ) {struct isif_ycbcr_config *params = &isif_cfg.ycbcr; -struct vpss_pg_frame_size frame_size;u32 modeset =0 , ccdcfg =0 ; -struct vpss_sync_pol sync;dev_dbg (isif_cfg.dev,"\nStarting isif_config_ycbcr..." );
@@ -974,13 +972,6 @@ static int isif_config_ycbcr(void)/* two fields are interleaved in memory */ regw (0x00000249 ,SDOFST ); -/* Setup test pattern if enabled */ -if (isif_cfg.bayer.config_params.test_pat_gen) { - sync.ccdpg_hdpol = params->hd_pol; - sync.ccdpg_vdpol = params->vd_pol; -dm365_vpss_set_sync_pol (sync); -dm365_vpss_set_pg_frame_size (frame_size); - }return 0 ; }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 265/671 media: tw5864: Fix possible NULL pointer dereference in tw5864_handle_frame
From: YueHaibing <[email protected]>
[ Upstream commit 2e7682ebfc750177a4944eeb56e97a3f05734528 ]
'vb' null check should be done before dereferencing it in tw5864_handle_frame, otherwise a NULL pointer dereference may occur.
--- drivers/media/pci/tw5864/tw5864-video.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/media/pci/tw5864/tw5864-video.c +2 -2
@@ -1395,13 +1395,13 @@ static void tw5864_handle_frame(struct tw5864_h264_frame *frame) input->vb =NULL ;spin_unlock_irqrestore (&input->slock, flags); - v4l2_buf =to_vb2_v4l2_buffer (&vb->vb.vb2_buf); -if (!vb) {/* Gone because of disabling */ dev_dbg (&dev->pci->dev,"vb is empty, dropping frame\n" );return ; } + v4l2_buf =to_vb2_v4l2_buffer (&vb->vb.vb2_buf); +/* * Check for space. * Mind the overhead of startcode emulation prevention.
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 266/671 spi: tegra114: clear packed bit for unpacked mode
In reply to Sasha LevinFrom: Sowjanya Komatineni <[email protected]>
[ Upstream commit 7b3d10cdf54b8bc1dc0da21faed9789ac4da3684 ]
Packed bit is not cleared when not using packed mode. This results in transfer timeouts for the unpacked mode transfers followed by the packed mode transfers.
--- drivers/spi/spi-tegra114.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/spi/spi-tegra114.c +2 -0
@@ -730,6 +730,8 @@ static int tegra_spi_start_transfer_one(struct spi_device *spi,if (tspi->is_packed) command1 |=SPI_PACKED ; +else + command1 &= ~SPI_PACKED ; command1 &= ~(SPI_CS_SEL_MASK |SPI_TX_EN |SPI_RX_EN ); tspi->cur_direction =0 ;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 267/671 spi: tegra114: fix for unpacked mode transfers
In reply to Sasha LevinFrom: Sowjanya Komatineni <[email protected]>
[ Upstream commit 1a89ac5b91895127f7c586ec5075c3753ca25501 ]
Fixes: computation of actual bytes to fill/receive in/from FIFO in unpacked mode when transfer length is not a multiple of requested bits per word.
unpacked mode transfers fails when the transfer includes partial bytes in the last word.
Total words to be written/read to/from FIFO is computed based on transfer length and bits per word. Unpacked mode includes 0 padding bytes for partial words to align with bits per word and these extra bytes are also accounted for calculating bytes left to transfer in the current driver.
This causes extra bytes access of tx/rx buffers along with buffer index position crossing actual length where remain_len becomes negative and due to unsigned type, negative value is a 32 bit representation of signed value and transferred bytes never meets the actual transfer length resulting in transfer timeout and a hang.
This patch fixes this with proper computation of the actual bytes to fill in FIFO during transmit and the actual bytes to read from FIFO during receive ignoring 0 padded bytes.
--- drivers/spi/spi-tegra114.c | 43 +++++++++++++++++++++++++++++++------- 1 file changed, 36 insertions(+), 7 deletions(-)
drivers/spi/spi-tegra114.c +36 -7
@@ -307,10 +307,16 @@ static unsigned tegra_spi_fill_tx_fifo_from_client_txbuf( x |= (u32)(*tx_buf++) << (i *8 );tegra_spi_writel (tspi, x,SPI_TX_FIFO ); } + + tspi->cur_tx_pos += written_words * tspi->bytes_per_word; }else { +unsigned int write_bytes; max_n_32bit =min (tspi->curr_dma_words, tx_empty_count); written_words = max_n_32bit; nbytes = written_words * tspi->bytes_per_word; +if (nbytes > t->len - tspi->cur_pos) + nbytes = t->len - tspi->cur_pos; + write_bytes = nbytes;for (count =0 ; count < max_n_32bit; count++) {u32 x =0 ;
@@ -319,8 +325,10 @@ static unsigned tegra_spi_fill_tx_fifo_from_client_txbuf( x |= (u32)(*tx_buf++) << (i *8 );tegra_spi_writel (tspi, x,SPI_TX_FIFO ); } + + tspi->cur_tx_pos += write_bytes; } - tspi->cur_tx_pos += written_words * tspi->bytes_per_word; +return written_words; }
@@ -344,20 +352,27 @@ static unsigned int tegra_spi_read_rx_fifo_to_client_rxbuf(for (i =0 ; len && (i <4 ); i++, len--) *rx_buf++ = (x >> i*8 ) &0xFF ; } - tspi->cur_rx_pos += tspi->curr_dma_words * tspi->bytes_per_word; read_words += tspi->curr_dma_words; + tspi->cur_rx_pos += tspi->curr_dma_words * tspi->bytes_per_word; }else {u32 rx_mask = ((u32 )1 << t->bits_per_word) -1 ; +u8 bytes_per_word = tspi->bytes_per_word; +unsigned int read_bytes; + len = rx_full_count * bytes_per_word; +if (len > t->len - tspi->cur_pos) + len = t->len - tspi->cur_pos; + read_bytes = len;for (count =0 ; count < rx_full_count; count++) {u32 x =tegra_spi_readl (tspi,SPI_RX_FIFO ) & rx_mask; -for (i =0 ; (i < tspi->bytes_per_word); i++) +for (i =0 ; len && (i < bytes_per_word); i++, len--) *rx_buf++ = (x >> (i*8 )) &0xFF ; } - tspi->cur_rx_pos += rx_full_count * tspi->bytes_per_word; read_words += rx_full_count; + tspi->cur_rx_pos += read_bytes; } +return read_words; }
@@ -372,12 +387,17 @@ static void tegra_spi_copy_client_txbuf_to_spi_txbuf(unsigned len = tspi->curr_dma_words * tspi->bytes_per_word;memcpy (tspi->tx_dma_buf, t->tx_buf + tspi->cur_pos, len); + tspi->cur_tx_pos += tspi->curr_dma_words * tspi->bytes_per_word; }else {unsigned int i;unsigned int count;u8 *tx_buf = (u8 *)t->tx_buf + tspi->cur_tx_pos;unsigned consume = tspi->curr_dma_words * tspi->bytes_per_word; +unsigned int write_bytes; +if (consume > t->len - tspi->cur_pos) + consume = t->len - tspi->cur_pos; + write_bytes = consume;for (count =0 ; count < tspi->curr_dma_words; count++) {u32 x =0 ;
@@ -386,8 +406,9 @@ static void tegra_spi_copy_client_txbuf_to_spi_txbuf( x |= (u32)(*tx_buf++) << (i *8 ); tspi->tx_dma_buf[count] = x; } + + tspi->cur_tx_pos += write_bytes; } - tspi->cur_tx_pos += tspi->curr_dma_words * tspi->bytes_per_word;/* Make the dma buffer to read by dma */ dma_sync_single_for_device(tspi->dev, tspi->tx_dma_phys,
@@ -405,20 +426,28 @@ static void tegra_spi_copy_spi_rxbuf_to_client_rxbuf(unsigned len = tspi->curr_dma_words * tspi->bytes_per_word;memcpy (t->rx_buf + tspi->cur_rx_pos, tspi->rx_dma_buf, len); + tspi->cur_rx_pos += tspi->curr_dma_words * tspi->bytes_per_word; }else {unsigned int i;unsigned int count;unsigned char *rx_buf = t->rx_buf + tspi->cur_rx_pos;u32 rx_mask = ((u32 )1 << t->bits_per_word) -1 ; +unsigned consume = tspi->curr_dma_words * tspi->bytes_per_word; +unsigned int read_bytes; +if (consume > t->len - tspi->cur_pos) + consume = t->len - tspi->cur_pos; + read_bytes = consume;for (count =0 ; count < tspi->curr_dma_words; count++) {u32 x = tspi->rx_dma_buf[count] & rx_mask; -for (i =0 ; (i < tspi->bytes_per_word); i++) +for (i =0 ; consume && (i < tspi->bytes_per_word); + i++, consume--) *rx_buf++ = (x >> (i*8 )) &0xFF ; } + + tspi->cur_rx_pos += read_bytes; } - tspi->cur_rx_pos += tspi->curr_dma_words * tspi->bytes_per_word;/* Make the dma buffer to read by dma */ dma_sync_single_for_device(tspi->dev, tspi->rx_dma_phys,
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 268/671 spi: tegra114: terminate dma and reset on transfer timeout
In reply to Sasha LevinFrom: Sowjanya Komatineni <[email protected]>
[ Upstream commit 32bd1a9551cae34e6889afa235c7afdfede9aeac ]
Fixes: terminate DMA and perform controller reset on transfer timeout to clear the FIFO's and errors.
--- drivers/spi/spi-tegra114.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/spi/spi-tegra114.c +9 -0
@@ -869,7 +869,16 @@ static int tegra_spi_transfer_one_message(struct spi_master *master,if (WARN_ON (ret ==0 )) {dev_err (tspi->dev,"spi transfer timeout, err %d\n" , ret); +if (tspi->is_curr_dma_xfer && + (tspi->cur_direction &DATA_DIR_TX )) +dmaengine_terminate_all (tspi->tx_dma_chan); +if (tspi->is_curr_dma_xfer && + (tspi->cur_direction &DATA_DIR_RX )) +dmaengine_terminate_all (tspi->rx_dma_chan); ret = -EIO ; +reset_control_assert (tspi->rst); +udelay (2 ); +reset_control_deassert (tspi->rst); goto complete_xfer; }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 269/671 spi: tegra114: flush fifos
In reply to Sasha LevinFrom: Sowjanya Komatineni <[email protected]>
[ Upstream commit c4fc9e5b28ff787e35137c2cc13316bb11d7657b ]
Fixes: Flush TX and RX FIFOs before start of new transfer and on FIFO overflow or underrun errors.
--- drivers/spi/spi-tegra114.c | 39 +++++++++++++++++++++++++++++--------- 1 file changed, 30 insertions(+), 9 deletions(-)
drivers/spi/spi-tegra114.c +30 -9
@@ -499,22 +499,37 @@ static int tegra_spi_start_rx_dma(struct tegra_spi_data *tspi, int len)return 0 ; } -static int tegra_spi_start_dma_based_transfer ( -struct tegra_spi_data *tspi,struct spi_transfer *t) +static int tegra_spi_flush_fifos (struct tegra_spi_data *tspi) { -u32 val; -unsigned int len; -int ret =0 ; +unsigned long timeout = jiffies +HZ ;u32 status; -/* Make sure that Rx and Tx fifo are empty */ status =tegra_spi_readl (tspi,SPI_FIFO_STATUS );if ((status &SPI_FIFO_EMPTY ) !=SPI_FIFO_EMPTY ) { -dev_err (tspi->dev,"Rx/Tx fifo are not empty status 0x%08x\n" , - (unsigned )status); -return -EIO ; + status |=SPI_RX_FIFO_FLUSH |SPI_TX_FIFO_FLUSH ; +tegra_spi_writel (tspi, status,SPI_FIFO_STATUS ); +while ((status &SPI_FIFO_EMPTY ) !=SPI_FIFO_EMPTY ) { + status =tegra_spi_readl (tspi,SPI_FIFO_STATUS ); +if (time_after (jiffies, timeout)) { +dev_err (tspi->dev, +"timeout waiting for fifo flush\n" ); +return -EIO ; + } + +udelay (1 ); + } } +return 0 ; +} + +static int tegra_spi_start_dma_based_transfer ( +struct tegra_spi_data *tspi,struct spi_transfer *t) +{ +u32 val; +unsigned int len; +int ret =0 ; + val =SPI_DMA_BLK_SET (tspi->curr_dma_words -1 );tegra_spi_writel (tspi, val,SPI_DMA_BLK );
@@ -779,6 +794,9 @@ static int tegra_spi_start_transfer_one(struct spi_device *spi,dev_dbg (tspi->dev,"The def 0x%x and written 0x%x\n" , tspi->def_command1_reg, (unsigned )command1); + ret =tegra_spi_flush_fifos (tspi); +if (ret <0 ) +return ret;if (total_fifo_words >SPI_FIFO_DEPTH ) ret =tegra_spi_start_dma_based_transfer (tspi, t);else
@@ -876,6 +894,7 @@ static int tegra_spi_transfer_one_message(struct spi_master *master, (tspi->cur_direction & DATA_DIR_RX))dmaengine_terminate_all (tspi->rx_dma_chan); ret = -EIO ; +tegra_spi_flush_fifos (tspi);reset_control_assert (tspi->rst);udelay (2 );reset_control_deassert (tspi->rst);
@@ -929,6 +948,7 @@ static irqreturn_t handle_cpu_based_xfer(struct tegra_spi_data *tspi) tspi->status_reg);dev_err (tspi->dev,"CpuXfer 0x%08x:0x%08x\n" , tspi->command1_reg, tspi->dma_control_reg); +tegra_spi_flush_fifos (tspi);reset_control_assert (tspi->rst);udelay (2 );reset_control_deassert (tspi->rst);
@@ -1001,6 +1021,7 @@ static irqreturn_t handle_dma_based_xfer(struct tegra_spi_data *tspi) tspi->status_reg);dev_err (tspi->dev,"DmaXfer 0x%08x:0x%08x\n" , tspi->command1_reg, tspi->dma_control_reg); +tegra_spi_flush_fifos (tspi);reset_control_assert (tspi->rst);udelay (2 );reset_control_deassert (tspi->rst);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 270/671 spi: tegra114: configure dma burst size to fifo trig level
In reply to Sasha LevinFrom: Sowjanya Komatineni <[email protected]>
[ Upstream commit f4ce428c41fb22e3ed55496dded94df44cb920fa ]
Fixes: Configure DMA burst size to be same as SPI TX/RX trigger levels to avoid mismatch.
SPI FIFO trigger levels are calculated based on the transfer length. So this patch moves DMA slave configuration to happen before start of DMAs.
--- drivers/spi/spi-tegra114.c | 52 ++++++++++++++++++++++---------------- 1 file changed, 30 insertions(+), 22 deletions(-)
drivers/spi/spi-tegra114.c +30 -22
@@ -529,6 +529,8 @@ static int tegra_spi_start_dma_based_transfer(u32 val;unsigned int len;int ret =0 ; +u8 dma_burst; +struct dma_slave_config dma_sconfig = {0 }; val =SPI_DMA_BLK_SET (tspi->curr_dma_words -1 );tegra_spi_writel (tspi, val,SPI_DMA_BLK );
@@ -540,12 +542,16 @@ static int tegra_spi_start_dma_based_transfer( len = tspi->curr_dma_words *4 ;/* Set attention level based on length of transfer */ -if (len &0xF ) +if (len &0xF ) { val |=SPI_TX_TRIG_1 |SPI_RX_TRIG_1 ; -else if (((len) >>4 ) &0x1 ) + dma_burst =1 ; + }else if (((len) >>4 ) &0x1 ) { val |=SPI_TX_TRIG_4 |SPI_RX_TRIG_4 ; -else + dma_burst =4 ; + }else { val |=SPI_TX_TRIG_8 |SPI_RX_TRIG_8 ; + dma_burst =8 ; + }if (tspi->cur_direction &DATA_DIR_TX ) val |=SPI_IE_TX ;
@@ -556,7 +562,18 @@ static int tegra_spi_start_dma_based_transfer(tegra_spi_writel (tspi, val,SPI_DMA_CTL ); tspi->dma_control_reg = val; + dma_sconfig.device_fc = true;if (tspi->cur_direction &DATA_DIR_TX ) { + dma_sconfig.dst_addr = tspi->phys +SPI_TX_FIFO ; + dma_sconfig.dst_addr_width =DMA_SLAVE_BUSWIDTH_4_BYTES ; + dma_sconfig.dst_maxburst = dma_burst; + ret =dmaengine_slave_config (tspi->tx_dma_chan, &dma_sconfig); +if (ret <0 ) { +dev_err (tspi->dev, +"DMA slave config failed: %d\n" , ret); +return ret; + } +tegra_spi_copy_client_txbuf_to_spi_txbuf (tspi, t); ret =tegra_spi_start_tx_dma (tspi, len);if (ret <0 ) {
@@ -567,6 +584,16 @@ static int tegra_spi_start_dma_based_transfer( }if (tspi->cur_direction &DATA_DIR_RX ) { + dma_sconfig.src_addr = tspi->phys +SPI_RX_FIFO ; + dma_sconfig.src_addr_width =DMA_SLAVE_BUSWIDTH_4_BYTES ; + dma_sconfig.src_maxburst = dma_burst; + ret =dmaengine_slave_config (tspi->rx_dma_chan, &dma_sconfig); +if (ret <0 ) { +dev_err (tspi->dev, +"DMA slave config failed: %d\n" , ret); +return ret; + } +/* Make the dma buffer to read by dma */ dma_sync_single_for_device (tspi->dev, tspi->rx_dma_phys, tspi->dma_buf_size,DMA_FROM_DEVICE );
@@ -626,7 +653,6 @@ static int tegra_spi_init_dma_param(struct tegra_spi_data *tspi,u32 *dma_buf;dma_addr_t dma_phys;int ret; -struct dma_slave_config dma_sconfig; dma_chan =dma_request_slave_channel_reason (tspi->dev, dma_to_memory ?"rx" :"tx" );
@@ -646,19 +672,6 @@ static int tegra_spi_init_dma_param(struct tegra_spi_data *tspi,return -ENOMEM ; } -if (dma_to_memory) { - dma_sconfig.src_addr = tspi->phys +SPI_RX_FIFO ; - dma_sconfig.src_addr_width =DMA_SLAVE_BUSWIDTH_4_BYTES ; - dma_sconfig.src_maxburst =0 ; - }else { - dma_sconfig.dst_addr = tspi->phys +SPI_TX_FIFO ; - dma_sconfig.dst_addr_width =DMA_SLAVE_BUSWIDTH_4_BYTES ; - dma_sconfig.dst_maxburst =0 ; - } - - ret =dmaengine_slave_config (dma_chan, &dma_sconfig); -if (ret) - goto scrub;if (dma_to_memory) { tspi->rx_dma_chan = dma_chan; tspi->rx_dma_buf = dma_buf;
@@ -669,11 +682,6 @@ static int tegra_spi_init_dma_param(struct tegra_spi_data *tspi, tspi->tx_dma_phys = dma_phys; }return 0 ; - -scrub: -dma_free_coherent (tspi->dev, tspi->dma_buf_size, dma_buf, dma_phys); -dma_release_channel (dma_chan); -return ret; } static void tegra_spi_deinit_dma_param(struct tegra_spi_data *tspi,
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 271/671 bus: ti-sysc: Fix sysc_unprepare() when no clocks have been allocated
In reply to Sasha LevinFrom: Tony Lindgren <[email protected]>
[ Upstream commit aaa29bb01cc4bf5a87dbdb219efba3b09f259d8e ]
If we return early before ddata->clocks have been allocated we will get a NULL pointer dereference in sysc_unprepare(). Let's fix this by returning early when no clocks are allocated.
--- drivers/bus/ti-sysc.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/bus/ti-sysc.c +3 -0
@@ -1400,6 +1400,9 @@ static void sysc_unprepare(struct sysc *ddata) {int i; +if (!ddata->clocks) +return ; +for (i =0 ; i <SYSC_MAX_CLOCKS ; i++) {if (!IS_ERR_OR_NULL (ddata->clocks[i]))clk_unprepare (ddata->clocks[i]);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 272/671 dccp: Fix memleak in __feat_register_sp
In reply to Sasha LevinFrom: YueHaibing <[email protected]>
[ Upstream commit 1d3ff0950e2b40dc861b1739029649d03f591820 ]
If dccp_feat_push_change fails, we forget free the mem which is alloced by kmemdup in dccp_feat_clone_sp_val.
--- net/dccp/feat.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
net/dccp/feat.c +6 -1
@@ -738,7 +738,12 @@ static int __feat_register_sp(struct list_head *fn, u8 feat, u8 is_local,if (dccp_feat_clone_sp_val (&fval, sp_val, sp_len))return -ENOMEM ; -return dccp_feat_push_change (fn, feat, is_local, mandatory, &fval); +if (dccp_feat_push_change (fn, feat, is_local, mandatory, &fval)) { +kfree (fval.sp.vec); +return -ENOMEM ; + } + +return 0 ; }/**
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 273/671 soc/fsl/qe: Fix an error code in qe_pin_request()
In reply to Sasha LevinFrom: Dan Carpenter <[email protected]>
[ Upstream commit 5674a92ca4b7e5a6a19231edd10298d30324cd27 ]
We forgot to set "err" on this error path.
--- drivers/soc/fsl/qe/gpio.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/soc/fsl/qe/gpio.c +3 -1
@@ -179,8 +179,10 @@ struct qe_pin *qe_pin_request(struct device_node *np, int index)if (err <0 ) goto err0; gc =gpio_to_chip (err); -if (WARN_ON (!gc)) +if (WARN_ON (!gc)) { + err = -ENODEV ; goto err0; + }if (!of_device_is_compatible (gc->of_node,"fsl,mpc8323-qe-pario-bank" )) {pr_debug ("%s: tried to get a non-qe pin\n" , __func__);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 274/671 spi: bcm2835aux: fix driver to not allow 65535 (=-1) cs-gpios
In reply to Sasha LevinFrom: Martin Sperl <[email protected]>
[ Upstream commit 509c583620e9053e43d611bf1614fc3d3abafa96 ]
The original driver by default defines num_chipselects as -1. This actually allicates an array of 65535 entries in of_spi_register_master.
There is a side-effect for buggy device trees that (contrary to dt-binding documentation) have no cs-gpio defined.
This mode was never supported by the driver due to limitations of native cs and additional code complexity and is explicitly not stated to be implemented.
To keep backwards compatibility with such buggy DTs we limit the number of chip_selects to 1, as for all practical purposes it is only ever realistic to use a single chip select in native cs mode without negative side-effects.
--- drivers/spi/spi-bcm2835aux.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
drivers/spi/spi-bcm2835aux.c +12 -1
@@ -416,7 +416,18 @@ static int bcm2835aux_spi_probe(struct platform_device *pdev)platform_set_drvdata (pdev, master); master->mode_bits = (SPI_CPOL |SPI_CS_HIGH |SPI_NO_CS ); master->bits_per_word_mask =SPI_BPW_MASK (8 ); - master->num_chipselect =-1 ; +/* even though the driver never officially supported native CS +* allow a single native CS for legacy DT support purposes when +* no cs-gpio is configured. +* Known limitations for native cs are: +* * multiple chip-selects: cs0-cs2 are all simultaniously asserted +* whenever there is a transfer - this even includes SPI_NO_CS +* * SPI_CS_HIGH: is ignores - cs are always asserted low +* * cs_change: cs is deasserted after each spi_transfer +* * cs_delay_usec: cs is always deasserted one SCK cycle after +* a spi_transfer +*/ + master->num_chipselect =1 ; master->transfer_one = bcm2835aux_spi_transfer_one; master->handle_err = bcm2835aux_spi_handle_err; master->prepare_message = bcm2835aux_spi_prepare_message;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 275/671 drm/fb-helper: generic: Call drm_client_add() after setup is done
In reply to Sasha LevinFrom: Noralf Trønnes <[email protected]>
[ Upstream commit 6e3f17ee73f7e3c2ef0e2c8fd8624b2ece8ef2c9 ]
Hotplug can happen while drm_fbdev_generic_setup() is running so move drm_client_add() call after setup is done to avoid drm_fbdev_client_hotplug() running in two threads at the same time.
--- drivers/gpu/drm/drm_fb_helper.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_fb_helper.c +2 -2
@@ -3257,8 +3257,6 @@ int drm_fbdev_generic_setup(struct drm_device *dev, unsigned int preferred_bpp)return ret; } -drm_client_add (&fb_helper->client); -if (!preferred_bpp) preferred_bpp = dev->mode_config.preferred_depth;if (!preferred_bpp)
@@ -3267,6 +3265,8 @@ int drm_fbdev_generic_setup(struct drm_device *dev, unsigned int preferred_bpp)drm_fbdev_client_hotplug (&fb_helper->client); +drm_client_add (&fb_helper->client); +return 0 ; }EXPORT_SYMBOL (drm_fbdev_generic_setup);
Signature · 6 lines
2.20.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Sasha Levin
maintainerPATCH 276/671 arm64/vdso: don't leak kernel addresses
In reply to Sasha LevinFrom: Matteo Croce <[email protected]>
[ Upstream commit 0f1bf7e39822476b2f921435cf990f67a61f5f92 ]
Since commit ad67b74d2469d9b8 ("printk: hash addresses printed with %p"), two obfuscated kernel pointer are printed at every boot:
vdso: 2 pages (1 code @ (____ptrval____), 1 data @ (____ptrval____))
Remove the the print completely, as it's useless without the addresses.
--- arch/arm64/kernel/vdso.c | 2 -- 1 file changed, 2 deletions(-)
arch/arm64/kernel/vdso.c +0 -2
@@ -146,8 +146,6 @@ static int __init vdso_init(void) } vdso_pages = (vdso_end - vdso_start) >>PAGE_SHIFT ; -pr_info ("vdso: %ld pages (%ld code @ %p, %ld data @ %p)\n" , - vdso_pages +1 , vdso_pages, vdso_start,1L , vdso_data);/* Allocate the vDSO pagelist, plus a page for the data. */ vdso_pagelist = kcalloc(vdso_pages + 1, sizeof(struct page *),
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 277/671 rtc: Fix timestamp value for RTC_TIMESTAMP_BEGIN_1900
In reply to Sasha LevinFrom: Geert Uytterhoeven <[email protected]>
[ Upstream commit d3062d1d7415cb5a37777220357aca51a491c3d7 ]
Printing "mktime64(1900, 1, 1, 0, 0, 0)" gives -2208988800.
--- include/linux/rtc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/rtc.h +1 -1
@@ -163,7 +163,7 @@ struct rtc_device {#define to_rtc_device (d) container_of(d, struct rtc_device, dev)/* useful timestamps */ -#define RTC_TIMESTAMP_BEGIN_1900 -2208989361LL/* 1900-01-01 00:00:00 */ +#define RTC_TIMESTAMP_BEGIN_1900 -2208988800LL/* 1900-01-01 00:00:00 */ #define RTC_TIMESTAMP_BEGIN_2000 946684800LL/* 2000-01-01 00:00:00 */ #define RTC_TIMESTAMP_END_2099 4102444799LL/* 2099-12-31 23:59:59 */
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 278/671 rtc: mt6397: Don't call irq_dispose_mapping.
In reply to Sasha LevinFrom: Pi-Hsun Shih <[email protected]>
[ Upstream commit 24db953e942bd7a983e97892bdaddf69d00b1199 ]
The IRQ mapping was changed to not being created in the rtc-mt6397 driver, so the irq_dispose_mapping is no longer needed. Also the dev_id passed to free_irq should be the same as the last argument passed to request_threaded_irq.
This prevents a "Trying to free already-free IRQ 274" warning when unbinding the driver.
--- drivers/rtc/rtc-mt6397.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/rtc/rtc-mt6397.c +3 -6
@@ -343,7 +343,7 @@ static int mtk_rtc_probe(struct platform_device *pdev)if (ret) {dev_err (&pdev->dev,"Failed to request alarm IRQ: %d: %d\n" , rtc->irq, ret); - goto out_dispose_irq; +return ret; }device_init_wakeup (&pdev->dev,1 );
@@ -359,9 +359,7 @@ static int mtk_rtc_probe(struct platform_device *pdev)return 0 ; out_free_irq: -free_irq (rtc->irq, rtc->rtc_dev); -out_dispose_irq: -irq_dispose_mapping (rtc->irq); +free_irq (rtc->irq, rtc);return ret; }
@@ -369,8 +367,7 @@ static int mtk_rtc_remove(struct platform_device *pdev) {struct mt6397_rtc *rtc =platform_get_drvdata (pdev); -free_irq (rtc->irq, rtc->rtc_dev); -irq_dispose_mapping (rtc->irq); +free_irq (rtc->irq, rtc);return 0 ; }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 279/671 ehea: Fix a copy-paste err in ehea_init_port_res
In reply to Sasha LevinFrom: YueHaibing <[email protected]>
[ Upstream commit c8f191282f819ab4e9b47b22a65c6c29734cefce ]
pr->tx_bytes should be assigned to tx_bytes other than rx_bytes.
--- drivers/net/ethernet/ibm/ehea/ehea_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/ibm/ehea/ehea_main.c +1 -1
@@ -1464,7 +1464,7 @@ static int ehea_init_port_res(struct ehea_port *port, struct ehea_port_res *pr,memset (pr,0 ,sizeof (struct ehea_port_res )); - pr->tx_bytes = rx_bytes; + pr->tx_bytes = tx_bytes; pr->tx_packets = tx_packets; pr->rx_bytes = rx_bytes; pr->rx_packets = rx_packets;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 280/671 bpf: Add missed newline in verifier verbose log
In reply to Sasha LevinFrom: Andrey Ignatov <[email protected]>
[ Upstream commit 1fbd20f8b77b366ea4aeb92ade72daa7f36a7e3b ]
check_stack_access() that prints verbose log is used in adjust_ptr_min_max_vals() that prints its own verbose log and now they stick together, e.g.:
variable stack access var_off=(0xfffffffffffffff0; 0x4) off=-16 size=1R2 stack pointer arithmetic goes out of range, prohibited for !root
Add missing newline so that log is more readable:
variable stack access var_off=(0xfffffffffffffff0; 0x4) off=-16 size=1 R2 stack pointer arithmetic goes out of range, prohibited for !root
--- kernel/bpf/verifier.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/bpf/verifier.c +1 -1
@@ -1253,7 +1253,7 @@ static int check_stack_access(struct bpf_verifier_env *env,char tn_buf[48 ];tnum_strn (tn_buf,sizeof (tn_buf), reg->var_off); -verbose (env,"variable stack access var_off=%s off=%d size=%d" , +verbose (env,"variable stack access var_off=%s off=%d size=%d\n" , tn_buf, off, size);return -EACCES ; }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 281/671 drm/vmwgfx: Remove set but not used variable 'restart'
In reply to Sasha LevinFrom: YueHaibing <[email protected]>
[ Upstream commit b2130cca9c8db5073b71d832da2a6c8311a8f3bb ]
Fixes gcc '-Wunused-but-set-variable' warning:
drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c: In function 'vmw_cmdbuf_work_func':drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c:514:7: warning:
variable 'restart' set but not used [-Wunused-but-set-variable]
It not used any more after commit dc366364c4ef ("drm/vmwgfx: Fix multiple command buffer context use")
--- drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c +1 -5
@@ -511,17 +511,14 @@ static void vmw_cmdbuf_work_func(struct work_struct *work) container_of(work, struct vmw_cmdbuf_man, work);struct vmw_cmdbuf_header *entry, *next;uint32_t dummy; -bool restart[SVGA_CB_CONTEXT_MAX ];bool send_fence = false;struct list_head restart_head[SVGA_CB_CONTEXT_MAX ];int i;struct vmw_cmdbuf_context *ctx;bool global_block = false; -for_each_cmdbuf_ctx (man, i, ctx) { +for_each_cmdbuf_ctx (man, i, ctx)INIT_LIST_HEAD (&restart_head[i]); - restart[i] = false; - }mutex_lock (&man->error_mutex);spin_lock (&man->lock);
@@ -533,7 +530,6 @@ static void vmw_cmdbuf_work_func(struct work_struct *work)const char *cmd_name;list_del_init (&entry->list); - restart[entry->cb_context] = true; global_block = true;if (!vmw_cmd_describe (header, &error_cmd_size, &cmd_name)) {
Signature · 6 lines
2.20.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Sasha Levin
maintainerPATCH 282/671 scsi: qla2xxx: Unregister chrdev if module initialization fails
In reply to Sasha LevinFrom: Bart Van Assche <[email protected]>
[ Upstream commit c794d24ec9eb6658909955772e70f34bef5b5b91 ]
If module initialization fails after the character device has been registered, unregister the character device. Additionally, avoid duplicating error path code.
--- drivers/scsi/qla2xxx/qla_os.c | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-)
drivers/scsi/qla2xxx/qla_os.c +21 -13
@@ -6967,8 +6967,7 @@ qla2x00_module_init(void)/* Initialize target kmem_cache and mem_pools */ ret =qlt_init ();if (ret <0 ) { -kmem_cache_destroy (srb_cachep); -return ret; + goto destroy_cache; }else if (ret >0 ) {/* * If initiator mode is explictly disabled by qlt_init(),
@@ -6989,11 +6988,10 @@ qla2x00_module_init(void) qla2xxx_transport_template =fc_attach_transport (&qla2xxx_transport_functions);if (!qla2xxx_transport_template) { -kmem_cache_destroy (srb_cachep);ql_log (ql_log_fatal,NULL ,0x0002 ,"fc_attach_transport failed...Failing load!.\n" ); -qlt_exit (); -return -ENODEV ; + ret = -ENODEV ; + goto qlt_exit; } apidev_major =register_chrdev (0 ,QLA2XXX_APIDEV , &apidev_fops);
@@ -7005,27 +7003,37 @@ qla2x00_module_init(void) qla2xxx_transport_vport_template =fc_attach_transport (&qla2xxx_transport_vport_functions);if (!qla2xxx_transport_vport_template) { -kmem_cache_destroy (srb_cachep); -qlt_exit (); -fc_release_transport (qla2xxx_transport_template);ql_log (ql_log_fatal,NULL ,0x0004 ,"fc_attach_transport vport failed...Failing load!.\n" ); -return -ENODEV ; + ret = -ENODEV ; + goto unreg_chrdev; }ql_log (ql_log_info,NULL ,0x0005 ,"QLogic Fibre Channel HBA Driver: %s.\n" , qla2x00_version_str); ret =pci_register_driver (&qla2xxx_pci_driver);if (ret) { -kmem_cache_destroy (srb_cachep); -qlt_exit (); -fc_release_transport (qla2xxx_transport_template); -fc_release_transport (qla2xxx_transport_vport_template);ql_log (ql_log_fatal,NULL ,0x0006 ,"pci_register_driver failed...ret=%d Failing load!.\n" , ret); + goto release_vport_transport; }return ret; + +release_vport_transport: +fc_release_transport (qla2xxx_transport_vport_template); + +unreg_chrdev: +if (apidev_major >=0 ) +unregister_chrdev (apidev_major,QLA2XXX_APIDEV ); +fc_release_transport (qla2xxx_transport_template); + +qlt_exit: +qlt_exit (); + +destroy_cache: +kmem_cache_destroy (srb_cachep); +return ret; }/**
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 283/671 of: use correct function prototype for of_overlay_fdt_apply()
In reply to Sasha LevinFrom: Chris Packham <[email protected]>
[ Upstream commit ecb0abc1d8528015957fbd034be8bfe760363b3b ]
When CONFIG_OF_OVERLAY is not enabled the fallback stub for of_overlay_fdt_apply() does not match the prototype for the case when CONFIG_OF_OVERLAY is enabled. Update the stub to use the correct function prototype.
--- include/linux/of.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
include/linux/of.h +2 -1
@@ -1425,7 +1425,8 @@ int of_overlay_notifier_unregister(struct notifier_block *nb);#else -static inline int of_overlay_fdt_apply (void *overlay_fdt,int *ovcs_id) +static inline int of_overlay_fdt_apply (void *overlay_fdt,u32 overlay_fdt_size, +int *ovcs_id) {return -ENOTSUPP ; }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 284/671 net/sched: cbs: fix port_rate miscalculation
In reply to Sasha LevinFrom: Leandro Dorileo <[email protected]>
[ Upstream commit e0a7683d30e91e30ee6cf96314ae58a0314a095e ]
The Credit Based Shaper heavily depends on link speed to calculate the scheduling credits, we can't properly calculate the credits if the device has failed to report the link speed.
In that case we can't dequeue packets assuming a wrong port rate that will result into an inconsistent credit distribution.
This patch makes sure we fail to dequeue case:
1) __ethtool_get_link_ksettings() reports error or 2) the ethernet driver failed to set the ksettings' speed value (setting link speed to SPEED_UNKNOWN).
Additionally we properly re calculate the port rate whenever the link speed is changed.
--- net/sched/sch_cbs.c | 98 ++++++++++++++++++++++++++++++++++++++------- 1 file changed, 84 insertions(+), 14 deletions(-)
net/sched/sch_cbs.c +84 -14
@@ -61,16 +61,20 @@#include <linux/string.h> #include <linux/errno.h> #include <linux/skbuff.h> +#include <net/netevent.h> #include <net/netlink.h> #include <net/sch_generic.h> #include <net/pkt_sched.h> +static LIST_HEAD (cbs_list); +static DEFINE_SPINLOCK (cbs_list_lock); +#define BYTES_PER_KBIT (1000LL / 8)struct cbs_sched_data {bool offload;int queue; -s64 port_rate;/* in bytes/s */ +atomic64_t port_rate;/* in bytes/s */ s64 last;/* timestamp in ns */ s64 credits;/* in bytes */ s32 locredit;/* in bytes */
@@ -82,6 +86,7 @@ struct cbs_sched_data { struct sk_buff **to_free);struct sk_buff *(*dequeue)(struct Qdisc *sch);struct Qdisc *qdisc; +struct list_head cbs_list; }; static int cbs_child_enqueue(struct sk_buff *skb, struct Qdisc *sch,
@@ -180,6 +185,11 @@ static struct sk_buff *cbs_dequeue_soft(struct Qdisc *sch)s64 credits;int len; +if (atomic64_read (&q->port_rate) ==-1 ) { +WARN_ONCE (1 ,"cbs: dequeue() called with unknown port rate." ); +return NULL ; + } +if (q->credits <0 ) { credits =timediff_to_credits (now - q->last, q->idleslope);
@@ -206,7 +216,8 @@ static struct sk_buff *cbs_dequeue_soft(struct Qdisc *sch)/* As sendslope is a negative number, this will decrease the * amount of q->credits. */ - credits =credits_from_len (len, q->sendslope, q->port_rate); + credits =credits_from_len (len, q->sendslope, +atomic64_read (&q->port_rate)); credits += q->credits; q->credits =max_t (s64, credits, q->locredit);
@@ -293,6 +304,50 @@ static int cbs_enable_offload(struct net_device *dev, struct cbs_sched_data *q,return 0 ; } +static void cbs_set_port_rate (struct net_device *dev,struct cbs_sched_data *q) +{ +struct ethtool_link_ksettings ecmd; +int port_rate =-1 ; + +if (!__ethtool_get_link_ksettings (dev, &ecmd) && + ecmd.base.speed !=SPEED_UNKNOWN ) + port_rate = ecmd.base.speed *1000 *BYTES_PER_KBIT ; + +atomic64_set (&q->port_rate, port_rate); +netdev_dbg (dev,"cbs: set %s's port_rate to: %lld, linkspeed: %d\n" , + dev->name, (long long )atomic64_read (&q->port_rate), + ecmd.base.speed); +} + +static int cbs_dev_notifier (struct notifier_block *nb,unsigned long event, +void *ptr) +{ +struct net_device *dev =netdev_notifier_info_to_dev (ptr); +struct cbs_sched_data *q; +struct net_device *qdev; +bool found = false; + +ASSERT_RTNL (); + +if (event !=NETDEV_UP && event !=NETDEV_CHANGE ) +return NOTIFY_DONE ; + +spin_lock (&cbs_list_lock); +list_for_each_entry (q, &cbs_list, cbs_list) { + qdev =qdisc_dev (q->qdisc); +if (qdev == dev) { + found = true; +break ; + } + } +spin_unlock (&cbs_list_lock); + +if (found) +cbs_set_port_rate (dev, q); + +return NOTIFY_DONE ; +} +static int cbs_change (struct Qdisc *sch,struct nlattr *opt,struct netlink_ext_ack *extack) {
@@ -314,16 +369,7 @@ static int cbs_change(struct Qdisc *sch, struct nlattr *opt, qopt =nla_data (tb[TCA_CBS_PARMS ]);if (!qopt->offload) { -struct ethtool_link_ksettings ecmd; -s64 link_speed; - -if (!__ethtool_get_link_ksettings (dev, &ecmd)) - link_speed = ecmd.base.speed; -else - link_speed =SPEED_1000 ; - - q->port_rate = link_speed *1000 *BYTES_PER_KBIT ; - +cbs_set_port_rate (dev, q);cbs_disable_offload (dev, q); }else { err =cbs_enable_offload (dev, q, qopt, extack);
@@ -346,6 +392,7 @@ static int cbs_init(struct Qdisc *sch, struct nlattr *opt, {struct cbs_sched_data *q =qdisc_priv (sch);struct net_device *dev =qdisc_dev (sch); +int err;if (!opt) {NL_SET_ERR_MSG (extack,"Missing CBS qdisc options which are mandatory" );
@@ -366,7 +413,17 @@ static int cbs_init(struct Qdisc *sch, struct nlattr *opt,qdisc_watchdog_init (&q->watchdog, sch); -return cbs_change (sch, opt, extack); + err =cbs_change (sch, opt, extack); +if (err) +return err; + +if (!q->offload) { +spin_lock (&cbs_list_lock); +list_add (&q->cbs_list, &cbs_list); +spin_unlock (&cbs_list_lock); + } + +return 0 ; }static void cbs_destroy (struct Qdisc *sch)
@@ -374,8 +431,11 @@ static void cbs_destroy(struct Qdisc *sch)struct cbs_sched_data *q =qdisc_priv (sch);struct net_device *dev =qdisc_dev (sch); -qdisc_watchdog_cancel (&q->watchdog); +spin_lock (&cbs_list_lock); +list_del (&q->cbs_list); +spin_unlock (&cbs_list_lock); +qdisc_watchdog_cancel (&q->watchdog);cbs_disable_offload (dev, q);if (q->qdisc)
@@ -486,14 +546,24 @@ static struct Qdisc_ops cbs_qdisc_ops __read_mostly = { .owner = THIS_MODULE, }; +static struct notifier_block cbs_device_notifier = { + .notifier_call = cbs_dev_notifier, +}; +static int __init cbs_module_init (void ) { +int err =register_netdevice_notifier (&cbs_device_notifier); + +if (err) +return err; +return register_qdisc (&cbs_qdisc_ops); } static void __exit cbs_module_exit(void) {unregister_qdisc (&cbs_qdisc_ops); +unregister_netdevice_notifier (&cbs_device_notifier); }module_init (cbs_module_init)module_exit (cbs_module_exit)
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 285/671 clk: qcom: Skip halt checks on gcc_pcie_0_pipe_clk for 8998
In reply to Sasha LevinFrom: Marc Gonzalez <[email protected]>
[ Upstream commit c0ee0e43c049a13d11e913edf875e4ee376dc84b ]
See similar issue solved by commit 5f2420ed2189
("clk: qcom: Skip halt checks on gcc_usb3_phy_pipe_clk for 8998")
Without this patch, PCIe PHY init fails:
qcom-qmp-phy 1c06000.phy: pipe_clk enable failed err=-16 phy phy-1c06000.phy.0: phy init failed --> -16
--- drivers/clk/qcom/gcc-msm8998.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/qcom/gcc-msm8998.c +1 -1
@@ -2144,7 +2144,7 @@ static struct clk_branch gcc_pcie_0_mstr_axi_clk = {static struct clk_branch gcc_pcie_0_pipe_clk = { .halt_reg =0x6b018 , - .halt_check =BRANCH_HALT , + .halt_check =BRANCH_HALT_SKIP , .clkr = { .enable_reg =0x6b018 , .enable_mask =BIT (0 ),
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 286/671 ACPI: button: reinitialize button state upon resume
In reply to Sasha LevinFrom: Zhang Rui <[email protected]>
[ Upstream commit 13e962140be671f31a011543f11477af67a6c33e ]
With commit dfa46c50f65b ("ACPI / button: Fix an issue in button.lid_init_state=ignore mode"), the lid device is considered to be not compliant to SW_LID if the Lid state is unchanged when updating it.
This is not wrong, but we overlooked the resume case, where Lid state is updated unconditionally in the button driver .resume() callback. And this results in warning message "ACPI: button: The lid device is not compliant to SW_LID." after resume, if the machine is suspended with Lid opened and then resumed with Lid opened.
Fix this by flushing the cached lid state before updating the Lid device in .resume() callback.
--- drivers/acpi/button.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/acpi/button.c +4 -1
@@ -467,8 +467,11 @@ static int acpi_button_resume(struct device *dev)struct acpi_button *button =acpi_driver_data (device); button->suspended = false; -if (button->type ==ACPI_BUTTON_TYPE_LID && button->input->users) +if (button->type ==ACPI_BUTTON_TYPE_LID && button->input->users) { + button->last_state = !!acpi_lid_evaluate_state (device); + button->last_time =ktime_get ();acpi_lid_initialize_state (device); + } return 0; }#endif
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 287/671 firmware: arm_scmi: fix of_node leak in scmi_mailbox_check
In reply to Sasha LevinFrom: Steven Price <[email protected]>
[ Upstream commit fa7fe29a645b4da08efe8ff2392898b88f9ded9f ]
of_parse_phandle_with_args() requires the caller to call of_node_put() on the returned args->np pointer. Otherwise the reference count will remain incremented.
However, in this case, since we don't actually use the returned pointer, we can simply pass in NULL.
--- drivers/firmware/arm_scmi/driver.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/firmware/arm_scmi/driver.c +1 -3
@@ -662,9 +662,7 @@ static int scmi_xfer_info_init(struct scmi_info *sinfo)static int scmi_mailbox_check (struct device_node *np) { -struct of_phandle_args arg; - -return of_parse_phandle_with_args (np,"mboxes" ,"#mbox-cells" ,0 , &arg); +return of_parse_phandle_with_args (np,"mboxes" ,"#mbox-cells" ,0 ,NULL ); }static int scmi_mbox_free_channel (int id,void *p,void *data)
Signature · 7 lines
2.20.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Sasha Levin
maintainerPATCH 288/671 rxrpc: Fix detection of out of order acks
In reply to Sasha LevinFrom: Jeffrey Altman <[email protected]>
[ Upstream commit 1a2391c30c0b9d041bc340f68df81d49c53546cc ]
The rxrpc packet serial number cannot be safely used to compute out of order ack packets for several reasons:
1. The allocation of serial numbers cannot be assumed to imply the order by which acks are populated and transmitted. In some rxrpc implementations, delayed acks and ping acks are transmitted asynchronously to the receipt of data packets and so may be transmitted out of order. As a result, they can race with idle acks.
2. Serial numbers are allocated by the rxrpc connection and not the call and as such may wrap independently if multiple channels are in use.
In any case, what matters is whether the ack packet provides new information relating to the bounds of the window (the firstPacket and previousPacket in the ACK data).
Fix this by discarding packets that appear to wind back the window bounds rather than on serial number procession.
--- net/rxrpc/ar-internal.h | 1 + net/rxrpc/input.c | 18 ++++++++++++------ 2 files changed, 13 insertions(+), 6 deletions(-)
net/rxrpc/ar-internal.h +1 -0
@@ -644,6 +644,7 @@ struct rxrpc_call {u8 ackr_reason;/* reason to ACK */ u16 ackr_skew;/* skew on packet being ACK'd */ rxrpc_serial_t ackr_serial;/* serial of packet being ACK'd */ +rxrpc_serial_t ackr_first_seq;/* first sequence number received */ rxrpc_seq_t ackr_prev_seq;/* previous sequence number received */ rxrpc_seq_t ackr_consumed;/* Highest packet shown consumed */ rxrpc_seq_t ackr_seen;/* Highest packet shown seen */
net/rxrpc/input.c +12 -6
@@ -837,7 +837,7 @@ static void rxrpc_input_ack(struct rxrpc_call *call, struct sk_buff *skb,u8 acks[RXRPC_MAXACKS ]; } buf;rxrpc_serial_t acked_serial; -rxrpc_seq_t first_soft_ack, hard_ack; +rxrpc_seq_t first_soft_ack, hard_ack, prev_pkt;int nr_acks, offset, ioffset;_enter ("" );
@@ -851,13 +851,14 @@ static void rxrpc_input_ack(struct rxrpc_call *call, struct sk_buff *skb, acked_serial =ntohl (buf.ack.serial); first_soft_ack =ntohl (buf.ack.firstPacket); + prev_pkt =ntohl (buf.ack.previousPacket); hard_ack = first_soft_ack -1 ; nr_acks = buf.ack.nAcks; summary.ack_reason = (buf.ack.reason <RXRPC_ACK__INVALID ? buf.ack.reason :RXRPC_ACK__INVALID );trace_rxrpc_rx_ack (call, sp->hdr.serial, acked_serial, - first_soft_ack,ntohl (buf.ack.previousPacket), + first_soft_ack, prev_pkt, summary.ack_reason, nr_acks);if (buf.ack.reason ==RXRPC_ACK_PING_RESPONSE )
@@ -878,8 +879,9 @@ static void rxrpc_input_ack(struct rxrpc_call *call, struct sk_buff *skb, rxrpc_propose_ack_respond_to_ack); } -/* Discard any out-of-order or duplicate ACKs. */ -if (before_eq (sp->hdr.serial, call->acks_latest)) +/* Discard any out-of-order or duplicate ACKs (outside lock). */ +if (before (first_soft_ack, call->ackr_first_seq) || +before (prev_pkt, call->ackr_prev_seq))return ; buf.info.rxMTU =0 ;
@@ -890,12 +892,16 @@ static void rxrpc_input_ack(struct rxrpc_call *call, struct sk_buff *skb,spin_lock (&call->input_lock); -/* Discard any out-of-order or duplicate ACKs. */ -if (before_eq (sp->hdr.serial, call->acks_latest)) +/* Discard any out-of-order or duplicate ACKs (inside lock). */ +if (before (first_soft_ack, call->ackr_first_seq) || +before (prev_pkt, call->ackr_prev_seq)) goto out; call->acks_latest_ts = skb->tstamp; call->acks_latest = sp->hdr.serial; + call->ackr_first_seq = first_soft_ack; + call->ackr_prev_seq = prev_pkt; +/* Parse rwind and mtu sizes if provided. */ if (buf.info.rxMTU)rxrpc_input_ackinfo (call, skb, &buf.info);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 289/671 scsi: target/core: Fix a race condition in the LUN lookup code
In reply to Sasha LevinFrom: Bart Van Assche <[email protected]>
[ Upstream commit 63f7479439c95bcd49b7dd4af809862c316c71a3 ]
The rcu_dereference(deve->se_lun) expression occurs twice in the LUN lookup functions. Since these expressions are not serialized against deve->se_lun assignments each of these expressions may yield a different result. Avoid that the wrong LUN pointer is stored in se_cmd by reading deve->se_lun only once.
--- drivers/target/target_core_device.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/target/target_core_device.c +2 -2
@@ -85,7 +85,7 @@ transport_lookup_cmd_lun(struct se_cmd *se_cmd, u64 unpacked_lun) goto out_unlock; } - se_cmd->se_lun =rcu_dereference (deve->se_lun); + se_cmd->se_lun = se_lun; se_cmd->pr_res_key = deve->pr_res_key; se_cmd->orig_fe_lun = unpacked_lun; se_cmd->se_cmd_flags |=SCF_SE_LUN_CMD ;
@@ -176,7 +176,7 @@ int transport_lookup_tmr_lun(struct se_cmd *se_cmd, u64 unpacked_lun) goto out_unlock; } - se_cmd->se_lun =rcu_dereference (deve->se_lun); + se_cmd->se_lun = se_lun; se_cmd->pr_res_key = deve->pr_res_key; se_cmd->orig_fe_lun = unpacked_lun; se_cmd->se_cmd_flags |=SCF_SE_LUN_CMD ;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 290/671 brcmfmac: fix leak of mypkt on error return path
In reply to Sasha LevinFrom: Colin Ian King <[email protected]>
[ Upstream commit a927e8d8ab57e696800e20cf09a72b7dfe3bbebb ]
Currently if the call to brcmf_sdiod_set_backplane_window fails then error return path leaks mypkt. Fix this by returning by a new error path labelled 'out' that calls brcmu_pkt_buf_free_skb to free mypkt. Also remove redundant check on err before calling brcmf_sdiod_skbuff_write.
Addresses-Coverity: ("Resource Leak")
--- drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c +3 -5
@@ -617,15 +617,13 @@ int brcmf_sdiod_send_buf(struct brcmf_sdio_dev *sdiodev, u8 *buf, uint nbytes) err =brcmf_sdiod_set_backplane_window (sdiodev, addr);if (err) -return err; + goto out; addr &=SBSDIO_SB_OFT_ADDR_MASK ; addr |=SBSDIO_SB_ACCESS_2_4B_FLAG ; -if (!err) - err =brcmf_sdiod_skbuff_write (sdiodev, sdiodev->func2, addr, - mypkt); - + err =brcmf_sdiod_skbuff_write (sdiodev, sdiodev->func2, addr, mypkt); +out:brcmu_pkt_buf_free_skb (mypkt);return err;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 291/671 ARM: pxa: ssp: Fix "WARNING: invalid free of devm_ allocated data"
In reply to Sasha LevinFrom: YueHaibing <[email protected]>
[ Upstream commit 9ee8578d953023cc57e7e736ae48502c707c0210 ]
Since commit 1c459de1e645 ("ARM: pxa: ssp: use devm_ functions") kfree, iounmap, clk_put etc are not needed anymore in remove path.
--- arch/arm/plat-pxa/ssp.c | 6 ------ 1 file changed, 6 deletions(-)
arch/arm/plat-pxa/ssp.c +0 -6
@@ -183,18 +183,12 @@ static int pxa_ssp_probe(struct platform_device *pdev)static int pxa_ssp_remove (struct platform_device *pdev) { -struct resource *res;struct ssp_device *ssp; ssp =platform_get_drvdata (pdev);if (ssp ==NULL )return -ENODEV ; - res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); -release_mem_region (res->start,resource_size (res)); - -clk_put (ssp->clk); -mutex_lock (&ssp_lock);list_del (&ssp->node);mutex_unlock (&ssp_lock);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 292/671 PCI: rockchip: Fix rockchip_pcie_ep_assert_intx() bitwise operations
In reply to Sasha LevinFrom: Colin Ian King <[email protected]>
[ Upstream commit c577f4a5a08bb9677e12ddafb62e2f3a901de87f ]
Currently the bitwise operations on the u16 variable 'status' with the setting ROCKCHIP_PCIE_EP_CMD_STATUS_IS are incorrect because ROCKCHIP_PCIE_EP_CMD_STATUS_IS is 1UL<<19 which is wider than the u16 variable.
Fix this by making status a u32.
--- drivers/pci/controller/pcie-rockchip-ep.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/controller/pcie-rockchip-ep.c +1 -1
@@ -350,7 +350,7 @@ static void rockchip_pcie_ep_assert_intx(struct rockchip_pcie_ep *ep, u8 fn,struct rockchip_pcie *rockchip = &ep->rockchip;u32 r = ep->max_regions -1 ;u32 offset; -u16 status; +u32 status;u8 msg_code; if (unlikely(ep->irq_pci_addr != ROCKCHIP_PCIE_EP_PCI_LEGACY_IRQ_ADDR ||
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 293/671 net: hns3: fix for vport->bw_limit overflow problem
In reply to Sasha LevinFrom: Yunsheng Lin <[email protected]>
[ Upstream commit 2566f10676ba996b745e138f54f3e2f974311692 ]
When setting vport->bw_limit to hdev->tm_info.pg_info[0].bw_limit in hclge_tm_vport_tc_info_update, vport->bw_limit can be as big as HCLGE_ETHER_MAX_RATE (100000), which can not fit into u16 (65535).
So this patch fixes it by using u32 for vport->bw_limit.
--- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h +1 -1
@@ -600,7 +600,7 @@ struct hclge_vport {u16 alloc_rss_size;u16 qs_offset; -u16 bw_limit;/* VSI BW Limit (0 = disabled) */ +u32 bw_limit;/* VSI BW Limit (0 = disabled) */ u8 dwrr;struct hclge_tx_vtag_cfg txvlan_cfg;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 294/671 hwmon: (w83627hf) Use request_muxed_region for Super-IO accesses
In reply to Sasha LevinFrom: Guenter Roeck <[email protected]>
[ Upstream commit e95fd518d05bfc087da6fcdea4900a57cfb083bd ]
Super-IO accesses may fail on a system with no or unmapped LPC bus.
Also, other drivers may attempt to access the LPC bus at the same time, resulting in undefined behavior.
Use request_muxed_region() to ensure that IO access on the requested address space is supported, and to ensure that access by multiple drivers is synchronized.
--- drivers/hwmon/w83627hf.c | 42 +++++++++++++++++++++++++++++++++++----- 1 file changed, 37 insertions(+), 5 deletions(-)
drivers/hwmon/w83627hf.c +37 -5
@@ -130,17 +130,23 @@ superio_select(struct w83627hf_sio_data *sio, int ld)outb (ld, sio->sioaddr +1 ); } -static inline void +static inline int superio_enter (struct w83627hf_sio_data *sio) { +if (!request_muxed_region (sio->sioaddr,2 ,DRVNAME )) +return -EBUSY ; +outb (0x87 , sio->sioaddr);outb (0x87 , sio->sioaddr); + +return 0 ; }static inline void superio_exit (struct w83627hf_sio_data *sio) {outb (0xAA , sio->sioaddr); +release_region (sio->sioaddr,2 ); }#define W627_DEVID 0x52
@@ -1278,7 +1284,7 @@ static DEVICE_ATTR_RO(name);static int __init w83627hf_find (int sioaddr,unsigned short *addr,struct w83627hf_sio_data *sio_data) { -int err = -ENODEV ; +int err;u16 val;static __initconst char *const names[] = {
@@ -1290,7 +1296,11 @@ static int __init w83627hf_find(int sioaddr, unsigned short *addr, }; sio_data->sioaddr = sioaddr; -superio_enter (sio_data); + err =superio_enter (sio_data); +if (err) +return err; + + err = -ENODEV ; val = force_id ? force_id :superio_inb (sio_data,DEVID );switch (val) {case W627_DEVID :
@@ -1644,9 +1654,21 @@ static int w83627thf_read_gpio5(struct platform_device *pdev)struct w83627hf_sio_data *sio_data =dev_get_platdata (&pdev->dev);int res =0xff , sel; -superio_enter (sio_data); +if (superio_enter (sio_data)) { +/* +* Some other driver reserved the address space for itself. +* We don't want to fail driver instantiation because of that, +* so display a warning and keep going. +*/ +dev_warn (&pdev->dev, +"Can not read VID data: Failed to enable SuperIO access\n" ); +return res; + } +superio_select (sio_data,W83627HF_LD_GPIO5 ); + res =0xff ; +/* Make sure these GPIO pins are enabled */ if (!(superio_inb (sio_data,W83627THF_GPIO5_EN ) & (1 <<3 ))) {dev_dbg (&pdev->dev,"GPIO5 disabled, no VID function\n" );
@@ -1677,7 +1699,17 @@ static int w83687thf_read_vid(struct platform_device *pdev)struct w83627hf_sio_data *sio_data =dev_get_platdata (&pdev->dev);int res =0xff ; -superio_enter (sio_data); +if (superio_enter (sio_data)) { +/* +* Some other driver reserved the address space for itself. +* We don't want to fail driver instantiation because of that, +* so display a warning and keep going. +*/ +dev_warn (&pdev->dev, +"Can not read VID data: Failed to enable SuperIO access\n" ); +return res; + } +superio_select (sio_data,W83627HF_LD_HWM );/* Make sure these GPIO pins are enabled */
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 295/671 perf/core: Fix the address filtering fix
In reply to Sasha LevinFrom: Alexander Shishkin <[email protected]>
[ Upstream commit 52a44f83fc2d64a5e74d5d685fad2fecc7b7a321 ]
The following recent commit:
c60f83b813e5 ("perf, pt, coresight: Fix address filters for vmas with non-zero offset")
changes the address filtering logic to communicate filter ranges to the PMU driver via a single address range object, instead of having the driver do the final bit of math.
That change forgets to take into account kernel filters, which are not calculated the same way as DSO based filters.
Fix that by passing the kernel filters the same way as file-based filters. This doesn't require any additional changes in the drivers.
--- kernel/events/core.c | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-)
kernel/events/core.c +21 -16
@@ -8861,26 +8861,29 @@ static void perf_event_addr_filters_apply(struct perf_event *event)if (task ==TASK_TOMBSTONE )return ; -if (!ifh->nr_file_filters) -return ; - - mm =get_task_mm (event->ctx->task); -if (!mm) - goto restart; +if (ifh->nr_file_filters) { + mm =get_task_mm (event->ctx->task); +if (!mm) + goto restart; -down_read (&mm->mmap_sem); +down_read (&mm->mmap_sem); + }raw_spin_lock_irqsave (&ifh->lock, flags);list_for_each_entry (filter, &ifh->list, entry) { - event->addr_filter_ranges[count].start =0 ; - event->addr_filter_ranges[count].size =0 ; +if (filter->path.dentry) { +/* +* Adjust base offset if the filter is associated to a +* binary that needs to be mapped: +*/ + event->addr_filter_ranges[count].start =0 ; + event->addr_filter_ranges[count].size =0 ; -/* -* Adjust base offset if the filter is associated to a binary -* that needs to be mapped: -*/ -if (filter->path.dentry)perf_addr_filter_apply (filter, mm, &event->addr_filter_ranges[count]); + }else { + event->addr_filter_ranges[count].start = filter->offset; + event->addr_filter_ranges[count].size = filter->size; + } count++; }
@@ -8888,9 +8891,11 @@ static void perf_event_addr_filters_apply(struct perf_event *event) event->addr_filters_gen++;raw_spin_unlock_irqrestore (&ifh->lock, flags); -up_read (&mm->mmap_sem); +if (ifh->nr_file_filters) { +up_read (&mm->mmap_sem); -mmput (mm); +mmput (mm); + } restart:perf_event_stop (event,1 );
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 296/671 staging: android: vsoc: fix copy_from_user overrun
In reply to Sasha LevinFrom: Vincent Stehlé <[email protected]>
[ Upstream commit 060ea4271a82270be6d44e8e9aefe8f155fb5626 ]
The np->permission' structure is smaller than the np' structure but sizeof(*np) worth of data is copied in there. Fix the size passed to copy_from_user() to avoid overrun.
--- drivers/staging/android/vsoc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/staging/android/vsoc.c +2 -1
@@ -260,7 +260,8 @@ do_create_fd_scoped_permission(struct vsoc_device_region *region_p,atomic_t *owner_ptr =NULL ;struct vsoc_device_region *managed_region_p; -if (copy_from_user (&np->permission, &arg->perm,sizeof (*np)) || +if (copy_from_user (&np->permission, + &arg->perm,sizeof (np->permission)) ||copy_from_user (&managed_fd, &arg->managed_region_fd,sizeof (managed_fd))) {return -EFAULT ;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 297/671 PCI: dwc: Fix dw_pcie_ep_find_capability() to return correct capability offset
In reply to Sasha LevinFrom: Kishon Vijay Abraham I <[email protected]>
[ Upstream commit 421db1ab287eebe80fd203eb009ae92836c586ad ]
commit beb4641a787d ("PCI: dwc: Add MSI-X callbacks handler") while adding MSI-X callback handler, introduced dw_pcie_ep_find_capability() and __dw_pcie_ep_find_next_cap() for finding the MSI and MSIX capability.
However if MSI or MSIX capability is the last capability (i.e there are no additional items in the capabilities list and the Next Capability Pointer is set to '0'), __dw_pcie_ep_find_next_cap will return '0' even though MSI or MSIX capability may be present because of incorrect ordering of the "next_cap_ptr" check. Fix it.
--- drivers/pci/controller/dwc/pcie-designware-ep.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/pci/controller/dwc/pcie-designware-ep.c +5 -5
@@ -46,16 +46,19 @@ static u8 __dw_pcie_ep_find_next_cap(struct dw_pcie *pci, u8 cap_ptr,u8 cap_id, next_cap_ptr;u16 reg; +if (!cap_ptr) +return 0 ; + reg =dw_pcie_readw_dbi (pci, cap_ptr); - next_cap_ptr = (reg &0xff00 ) >>8 ; cap_id = (reg &0x00ff ); -if (!next_cap_ptr || cap_id >PCI_CAP_ID_MAX ) +if (cap_id >PCI_CAP_ID_MAX )return 0 ;if (cap_id == cap)return cap_ptr; + next_cap_ptr = (reg &0xff00 ) >>8 ;return __dw_pcie_ep_find_next_cap (pci, next_cap_ptr, cap); }
@@ -67,9 +70,6 @@ static u8 dw_pcie_ep_find_capability(struct dw_pcie *pci, u8 cap) reg =dw_pcie_readw_dbi (pci,PCI_CAPABILITY_LIST ); next_cap_ptr = (reg &0x00ff ); -if (!next_cap_ptr) -return 0 ; -return __dw_pcie_ep_find_next_cap (pci, next_cap_ptr, cap); }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 298/671 soc: amlogic: meson-gx-pwrc-vpu: Fix power on/off register bitmask
In reply to Sasha LevinFrom: Neil Armstrong <[email protected]>
[ Upstream commit 2fe3b4bbc93ec30a173ebae7d2b8c530416df3af ]
The register bitmask to power on/off the VPU memories was incorectly set to 0x2 instead of 0x3. While still working, let's use the recommended vendor value instead.
--- drivers/soc/amlogic/meson-gx-pwrc-vpu.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/soc/amlogic/meson-gx-pwrc-vpu.c +4 -4
@@ -54,12 +54,12 @@ static int meson_gx_pwrc_vpu_power_off(struct generic_pm_domain *genpd)/* Power Down Memories */ for (i =0 ; i <32 ; i +=2 ) {regmap_update_bits (pd->regmap_hhi,HHI_VPU_MEM_PD_REG0 , -0x2 << i,0x3 << i); +0x3 << i,0x3 << i);udelay (5 ); }for (i =0 ; i <32 ; i +=2 ) {regmap_update_bits (pd->regmap_hhi,HHI_VPU_MEM_PD_REG1 , -0x2 << i,0x3 << i); +0x3 << i,0x3 << i);udelay (5 ); }for (i =8 ; i <16 ; i++) {
@@ -108,13 +108,13 @@ static int meson_gx_pwrc_vpu_power_on(struct generic_pm_domain *genpd)/* Power Up Memories */ for (i =0 ; i <32 ; i +=2 ) {regmap_update_bits (pd->regmap_hhi,HHI_VPU_MEM_PD_REG0 , -0x2 << i,0 ); +0x3 << i,0 );udelay (5 ); }for (i =0 ; i <32 ; i +=2 ) {regmap_update_bits (pd->regmap_hhi,HHI_VPU_MEM_PD_REG1 , -0x2 << i,0 ); +0x3 << i,0 );udelay (5 ); }
Signature · 7 lines
2.20.1 _______________________________________________ linux-amlogic mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-amlogic
Sasha Levin
maintainerPATCH 299/671 platform/x86: alienware-wmi: fix kfree on potentially uninitialized pointer
In reply to Sasha LevinFrom: Colin Ian King <[email protected]>
[ Upstream commit 98e2630284ab741804bd0713e932e725466f2f84 ]
Currently the kfree of output.pointer can be potentially freeing an uninitalized pointer in the case where out_data is NULL. Fix this by reworking the case where out_data is not-null to perform the ACPI status check and also the kfree of outpoint.pointer in one block and hence ensuring the pointer is only freed when it has been used.
Also replace the if (ptr != NULL) idiom with just if (ptr).
--- drivers/platform/x86/alienware-wmi.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-)
drivers/platform/x86/alienware-wmi.c +8 -9
@@ -522,23 +522,22 @@ static acpi_status alienware_wmax_command(struct wmax_basic_args *in_args, input.length = (acpi_size )sizeof (*in_args); input.pointer = in_args; -if (out_data !=NULL ) { +if (out_data) { output.length =ACPI_ALLOCATE_BUFFER ; output.pointer =NULL ; status =wmi_evaluate_method (WMAX_CONTROL_GUID ,0 , command, &input, &output); - }else +if (ACPI_SUCCESS (status)) { + obj = (union acpi_object *)output.pointer; +if (obj && obj->type ==ACPI_TYPE_INTEGER ) + *out_data = (u32 )obj->integer.value; + } +kfree (output.pointer); + }else { status =wmi_evaluate_method (WMAX_CONTROL_GUID ,0 , command, &input,NULL ); - -if (ACPI_SUCCESS (status) && out_data !=NULL ) { - obj = (union acpi_object *)output.pointer; -if (obj && obj->type ==ACPI_TYPE_INTEGER ) - *out_data = (u32 ) obj->integer.value; } -kfree (output.pointer);return status; - }/*
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 300/671 tipc: set sysctl_tipc_rmem and named_timeout right range
In reply to Sasha LevinFrom: Jie Liu <[email protected]>
[ Upstream commit 4bcd4ec1017205644a2697bccbc3b5143f522f5f ]
We find that sysctl_tipc_rmem and named_timeout do not have the right minimum setting. sysctl_tipc_rmem should be larger than zero, like sysctl_tcp_rmem. And named_timeout as a timeout setting should be not less than zero.
--- net/tipc/sysctl.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
net/tipc/sysctl.c +6 -2
@@ -37,6 +37,8 @@#include <linux/sysctl.h> +static int zero; +static int one =1 ;static struct ctl_table_header *tipc_ctl_hdr;static struct ctl_table tipc_table[] = {
@@ -45,14 +47,16 @@ static struct ctl_table tipc_table[] = { .data = &sysctl_tipc_rmem, .maxlen = sizeof(sysctl_tipc_rmem), .mode = 0644, - .proc_handler = proc_dointvec, + .proc_handler = proc_dointvec_minmax, + .extra1 = &one, }, { .procname = "named_timeout", .data = &sysctl_tipc_named_timeout, .maxlen = sizeof(sysctl_tipc_named_timeout), .mode = 0644, - .proc_handler = proc_dointvec, + .proc_handler = proc_dointvec_minmax, + .extra1 = &zero, }, {} };
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 301/671 usb: typec: tcpm: Notify the tcpc to start connection-detection for SRPs
In reply to Sasha LevinFrom: Hans de Goede <[email protected]>
[ Upstream commit 7893f9e1c26d1f9ea02622902ee671de45ad377b ]
Some tcpc device-drivers need to explicitly be told to watch for connection events, otherwise the tcpc will not generate any TCPM_CC_EVENTs and devices being plugged into the Type-C port will not be noticed.
For dual-role ports tcpm_start_drp_toggling() is used to tell the tcpc to watch for connection events. Sofar we lack a similar callback to the tcpc for single-role ports. With some tcpc-s such as the fusb302 this means no TCPM_CC_EVENTs will be generated when the port is configured as a single-role port.
This commit renames start_drp_toggling to start_toggling and since the device-properties are parsed by the tcpm-core, adds a port_type parameter to the start_toggling callback so that the tcpc_dev driver knows the port-type and can act accordingly when it starts toggling.
The new start_toggling callback now always gets called if defined, instead of only being called for DRP ports.
To avoid this causing undesirable functional changes all existing start_drp_toggling implementations are not only renamed to start_toggling, but also get a port_type check added and return -EOPNOTSUPP when port_type is not DRP.
--- drivers/usb/typec/fusb302/fusb302.c | 10 ++++++--- drivers/usb/typec/tcpci.c | 10 ++++++--- drivers/usb/typec/tcpm.c | 32 +++++++++++++---------------- drivers/usb/typec/typec_wcove.c | 10 ++++++--- include/linux/usb/tcpm.h | 13 ++++++------ 5 files changed, 42 insertions(+), 33 deletions(-)
drivers/usb/typec/fusb302/fusb302.c +7 -3
@@ -990,13 +990,17 @@ static int tcpm_set_roles(struct tcpc_dev *dev, bool attached,return ret; } -static int tcpm_start_drp_toggling (struct tcpc_dev *dev, -enum typec_cc_status cc) +static int tcpm_start_toggling (struct tcpc_dev *dev, +enum typec_port_type port_type, +enum typec_cc_status cc) { struct fusb302_chip *chip = container_of(dev, struct fusb302_chip, tcpc_dev);int ret =0 ; +if (port_type !=TYPEC_PORT_DRP ) +return -EOPNOTSUPP ; +mutex_lock (&chip->lock); ret =fusb302_set_src_current (chip, cc_src_current[cc]);if (ret <0 ) {
@@ -1206,7 +1210,7 @@ static void init_tcpc_dev(struct tcpc_dev *fusb302_tcpc_dev) fusb302_tcpc_dev->set_vbus = tcpm_set_vbus; fusb302_tcpc_dev->set_pd_rx = tcpm_set_pd_rx; fusb302_tcpc_dev->set_roles = tcpm_set_roles; - fusb302_tcpc_dev->start_drp_toggling = tcpm_start_drp_toggling; + fusb302_tcpc_dev->start_toggling = tcpm_start_toggling; fusb302_tcpc_dev->pd_transmit = tcpm_pd_transmit; }
drivers/usb/typec/tcpci.c +7 -3
@@ -100,13 +100,17 @@ static int tcpci_set_cc(struct tcpc_dev *tcpc, enum typec_cc_status cc)return 0 ; } -static int tcpci_start_drp_toggling (struct tcpc_dev *tcpc, -enum typec_cc_status cc) +static int tcpci_start_toggling (struct tcpc_dev *tcpc, +enum typec_port_type port_type, +enum typec_cc_status cc) {int ret;struct tcpci *tcpci =tcpc_to_tcpci (tcpc);unsigned int reg =TCPC_ROLE_CTRL_DRP ; +if (port_type !=TYPEC_PORT_DRP ) +return -EOPNOTSUPP ; +/* Handle vendor drp toggling */ if (tcpci->data->start_drp_toggling) { ret = tcpci->data->start_drp_toggling (tcpci, tcpci->data, cc);
@@ -511,7 +515,7 @@ struct tcpci *tcpci_register_port(struct device *dev, struct tcpci_data *data) tcpci->tcpc.get_cc = tcpci_get_cc; tcpci->tcpc.set_polarity = tcpci_set_polarity; tcpci->tcpc.set_vconn = tcpci_set_vconn; - tcpci->tcpc.start_drp_toggling = tcpci_start_drp_toggling; + tcpci->tcpc.start_toggling = tcpci_start_toggling; tcpci->tcpc.set_pd_rx = tcpci_set_pd_rx; tcpci->tcpc.set_roles = tcpci_set_roles;
drivers/usb/typec/tcpm.c +14 -18
@@ -31,7 +31,7 @@#define FOREACH_STATE (S ) \ S(INVALID_STATE), \ - S(DRP_TOGGLING), \ + S(TOGGLING), \ S(SRC_UNATTACHED), \ S(SRC_ATTACH_WAIT), \ S(SRC_ATTACHED), \
@@ -473,7 +473,7 @@ static void tcpm_log(struct tcpm_port *port, const char *fmt, ...)/* Do not log while disconnected and unattached */ if (tcpm_port_is_disconnected (port) && (port->state ==SRC_UNATTACHED || port->state ==SNK_UNATTACHED || - port->state ==DRP_TOGGLING )) + port->state ==TOGGLING ))return ;va_start (args, fmt);
@@ -2561,20 +2561,16 @@ static int tcpm_set_charge(struct tcpm_port *port, bool charge)return 0 ; } -static bool tcpm_start_drp_toggling (struct tcpm_port *port, -enum typec_cc_status cc) +static bool tcpm_start_toggling (struct tcpm_port *port,enum typec_cc_status cc) {int ret; -if (port->tcpc->start_drp_toggling && - port->port_type ==TYPEC_PORT_DRP ) { -tcpm_log_force (port,"Start DRP toggling" ); - ret = port->tcpc->start_drp_toggling (port->tcpc, cc); -if (!ret) -return true; - } +if (!port->tcpc->start_toggling) +return false; -return false; +tcpm_log_force (port,"Start toggling" ); + ret = port->tcpc->start_toggling (port->tcpc, port->port_type, cc); +return ret ==0 ; }static void tcpm_set_cc (struct tcpm_port *port,enum typec_cc_status cc)
@@ -2868,15 +2864,15 @@ static void run_state_machine(struct tcpm_port *port) port->enter_state = port->state;switch (port->state) { -case DRP_TOGGLING : +case TOGGLING :break ;/* SRC states */ case SRC_UNATTACHED :if (!port->non_pd_role_swap)tcpm_swap_complete (port, -ENOTCONN );tcpm_src_detach (port); -if (tcpm_start_drp_toggling (port,tcpm_rp_cc (port))) { -tcpm_set_state (port,DRP_TOGGLING ,0 ); +if (tcpm_start_toggling (port,tcpm_rp_cc (port))) { +tcpm_set_state (port,TOGGLING ,0 );break ; }tcpm_set_cc (port,tcpm_rp_cc (port));
@@ -3074,8 +3070,8 @@ static void run_state_machine(struct tcpm_port *port)tcpm_swap_complete (port, -ENOTCONN );tcpm_pps_complete (port, -ENOTCONN );tcpm_snk_detach (port); -if (tcpm_start_drp_toggling (port,TYPEC_CC_RD )) { -tcpm_set_state (port,DRP_TOGGLING ,0 ); +if (tcpm_start_toggling (port,TYPEC_CC_RD )) { +tcpm_set_state (port,TOGGLING ,0 );break ; }tcpm_set_cc (port,TYPEC_CC_RD );
@@ -3642,7 +3638,7 @@ static void _tcpm_cc_change(struct tcpm_port *port, enum typec_cc_status cc1, : "connected");switch (port->state) { -case DRP_TOGGLING : +case TOGGLING :if (tcpm_port_is_debug (port) ||tcpm_port_is_audio (port) ||tcpm_port_is_source (port))tcpm_set_state (port,SRC_ATTACH_WAIT ,0 );
drivers/usb/typec/typec_wcove.c +7 -3
@@ -416,12 +416,16 @@ static int wcove_pd_transmit(struct tcpc_dev *tcpc,return regmap_write (wcove->regmap,USBC_TXCMD , cmd |USBC_TXCMD_START ); } -static int wcove_start_drp_toggling (struct tcpc_dev *tcpc, -enum typec_cc_status cc) +static int wcove_start_toggling (struct tcpc_dev *tcpc, +enum typec_port_type port_type, +enum typec_cc_status cc) {struct wcove_typec *wcove =tcpc_to_wcove (tcpc);unsigned int usbc_ctrl; +if (port_type !=TYPEC_PORT_DRP ) +return -EOPNOTSUPP ; + usbc_ctrl =USBC_CONTROL1_MODE_DRP |USBC_CONTROL1_DRPTOGGLE_RANDOM ;switch (cc) {
@@ -642,7 +646,7 @@ static int wcove_typec_probe(struct platform_device *pdev) wcove->tcpc.set_polarity = wcove_set_polarity; wcove->tcpc.set_vconn = wcove_set_vconn; wcove->tcpc.set_current_limit = wcove_set_current_limit; - wcove->tcpc.start_drp_toggling = wcove_start_drp_toggling; + wcove->tcpc.start_toggling = wcove_start_toggling; wcove->tcpc.set_pd_rx = wcove_set_pd_rx; wcove->tcpc.set_roles = wcove_set_roles;
include/linux/usb/tcpm.h +7 -6
@@ -121,10 +121,10 @@ struct tcpc_config {* with partner. * @set_pd_rx: Called to enable or disable reception of PD messages * @set_roles: Called to set power and data roles -* @start_drp_toggling: -* Optional; if supported by hardware, called to start DRP -* toggling. DRP toggling is stopped automatically if -* a connection is established. +* @start_toggling: +* Optional; if supported by hardware, called to start dual-role +* toggling or single-role connection detection. Toggling stops +* automatically if a connection is established. * @try_role: Optional; called to set a preferred role * @pd_transmit:Called to transmit PD message * @mux: Pointer to multiplexer data
@@ -147,8 +147,9 @@ struct tcpc_dev {int (*set_pd_rx)(struct tcpc_dev *dev,bool on);int (*set_roles)(struct tcpc_dev *dev,bool attached,enum typec_role role,enum typec_data_role data); -int (*start_drp_toggling)(struct tcpc_dev *dev, -enum typec_cc_status cc); +int (*start_toggling)(struct tcpc_dev *dev, +enum typec_port_type port_type, +enum typec_cc_status cc);int (*try_role)(struct tcpc_dev *dev,int role);int (*pd_transmit)(struct tcpc_dev *dev,enum tcpm_transmit_type type,const struct pd_message *msg);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 302/671 selftests/ipc: Fix msgque compiler warnings
In reply to Sasha LevinFrom: Kees Cook <[email protected]>
[ Upstream commit a147faa96f832f76e772b1e448e94ea84c774081 ]
This fixes the various compiler warnings when building the msgque selftest. The primary change is using sys/msg.h instead of linux/msg.h directly to gain the API declarations.
--- tools/testing/selftests/ipc/msgque.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
tools/testing/selftests/ipc/msgque.c +6 -5
@@ -1,9 +1,10 @@// SPDX-License-Identifier: GPL-2.0 +#define _GNU_SOURCE#include <stdlib.h> #include <stdio.h> #include <string.h> #include <errno.h> -#include <linux/msg.h> +#include <sys/msg.h> #include <fcntl.h> #include "../kselftest.h"
@@ -73,7 +74,7 @@ int restore_queue(struct msgque_data *msgque)return 0 ; destroy: -if (msgctl (id,IPC_RMID ,0 )) +if (msgctl (id,IPC_RMID ,NULL ))printf ("Failed to destroy queue: %d\n" , -errno);return ret; }
@@ -120,7 +121,7 @@ int check_and_destroy_queue(struct msgque_data *msgque) ret =0 ; err: -if (msgctl (msgque->msq_id,IPC_RMID ,0 )) { +if (msgctl (msgque->msq_id,IPC_RMID ,NULL )) {printf ("Failed to destroy queue: %d\n" , -errno);return -errno; }
@@ -129,7 +130,7 @@ int check_and_destroy_queue(struct msgque_data *msgque)int dump_queue (struct msgque_data *msgque) { -struct msqid64_ds ds; +struct msqid_ds ds;int kern_id;int i, ret;
@@ -245,7 +246,7 @@ int main(int argc, char **argv)return ksft_exit_pass (); err_destroy: -if (msgctl (msgque.msq_id,IPC_RMID ,0 )) { +if (msgctl (msgque.msq_id,IPC_RMID ,NULL )) {printf ("Failed to destroy queue: %d\n" , -errno);return ksft_exit_fail (); }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 303/671 net: hns3: fix loop condition of hns3_get_tx_timeo_queue_info()
In reply to Sasha LevinFrom: Jian Shen <[email protected]>
[ Upstream commit fa6c4084b98b82c98cada0f0d5c9f8577579f962 ]
In function hns3_get_tx_timeo_queue_info(), it should use netdev->num_tx_queues, instead of netdve->real_num_tx_queues as the loop limitation.
--- drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +1 -1
@@ -1464,7 +1464,7 @@ static bool hns3_get_tx_timeo_queue_info(struct net_device *ndev)int i;/* Find the stopped queue the same way the stack does */ -for (i =0 ; i < ndev->real_num_tx_queues; i++) { +for (i =0 ; i < ndev->num_tx_queues; i++) {struct netdev_queue *q;unsigned long trans_start;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 304/671 powerpc: vdso: Make vdso32 installation conditional in vdso_install
In reply to Sasha LevinFrom: Ben Hutchings <[email protected]>
[ Upstream commit ff6d27823f619892ab96f7461764840e0d786b15 ]
The 32-bit vDSO is not needed and not normally built for 64-bit little-endian configurations. However, the vdso_install target still builds and installs it. Add the same config condition as is normally used for the build.
--- arch/powerpc/Makefile | 2 ++ 1 file changed, 2 insertions(+)
arch/powerpc/Makefile +2 -0
@@ -412,7 +412,9 @@ vdso_install: ifdef CONFIG_PPC64 $(Q)$(MAKE) $(build)=arch/$(ARCH)/kernel/vdso64 $@ endif +ifdef CONFIG_VDSO32 $(Q)$(MAKE) $(build)=arch/$(ARCH)/kernel/vdso32 $@ +endif archclean: $(Q)$(MAKE) $(clean)=$(boot)
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 305/671 ARM: dts: ls1021: Fix SGMII PCS link remaining down after PHY disconnect
In reply to Sasha LevinFrom: Vladimir Oltean <[email protected]>
[ Upstream commit c7861adbe37f576931650ad8ef805e0c47564b9a ]
Each eTSEC MAC has its own TBI (SGMII) PCS and private MDIO bus. But due to a DTS oversight, both SGMII-compatible MACs of the LS1021 SoC are pointing towards the same internal PCS. Therefore nobody is controlling the internal PCS of eTSEC0.
Upon initial ndo_open, the SGMII link is ok by virtue of U-boot initialization. But upon an ifdown/ifup sequence, the code path from ndo_open -> init_phy -> gfar_configure_serdes does not get executed for the PCS of eTSEC0 (and is executed twice for MAC eTSEC1). So the SGMII link remains down for eTSEC0. On the LS1021A-TWR board, to signal this failure condition, the PHY driver keeps printing '803x_aneg_done: SGMII link is not ok'.
Also, it changes compatible of mdio0 to "fsl,etsec2-mdio" to match mdio1 device.
--- arch/arm/boot/dts/ls1021a-twr.dts | 9 ++++++++- arch/arm/boot/dts/ls1021a.dtsi | 11 ++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-)
arch/arm/boot/dts/ls1021a-twr.dts +8 -1
@@ -143,7 +143,7 @@ }; &enet0 { - tbi-handle = <&tbi1>; + tbi-handle = <&tbi0>; phy-handle = <&sgmii_phy2>; phy-connection-type = "sgmii"; status = "okay";
@@ -222,6 +222,13 @@ sgmii_phy2: ethernet-phy@2 { reg = <0x2>; }; + tbi0: tbi-phy@1f { + reg = <0x1f>; + device_type = "tbi-phy"; + }; +}; + +&mdio1 { tbi1: tbi-phy@1f { reg = <0x1f>; device_type = "tbi-phy";
arch/arm/boot/dts/ls1021a.dtsi +10 -1
@@ -584,7 +584,7 @@ }; mdio0: mdio@2d24000 { - compatible = "gianfar"; + compatible = "fsl,etsec2-mdio"; device_type = "mdio"; #address-cells = <1>; #size-cells = <0>;
@@ -592,6 +592,15 @@ <0x0 0x2d10030 0x0 0x4>; }; + mdio1: mdio@2d64000 { + compatible = "fsl,etsec2-mdio"; + device_type = "mdio"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x0 0x2d64000 0x0 0x4000>, + <0x0 0x2d50030 0x0 0x4>; + }; + ptp_clock@2d10e00 { compatible = "fsl,etsec-ptp"; reg = <0x0 0x2d10e00 0x0 0xb0>;
Signature · 7 lines
2.20.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Sasha Levin
maintainerPATCH 306/671 media: ov2659: fix unbalanced mutex_lock/unlock
In reply to Sasha LevinFrom: Akinobu Mita <[email protected]>
[ Upstream commit 384538bda10913e5c94ec5b5d34bd3075931bcf4 ]
Avoid returning with mutex locked.
--- drivers/media/i2c/ov2659.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/i2c/ov2659.c +1 -1
@@ -1136,7 +1136,7 @@ static int ov2659_set_fmt(struct v4l2_subdev *sd, mf =v4l2_subdev_get_try_format (sd, cfg, fmt->pad); *mf = fmt->format;#else -return -ENOTTY ; + ret = -ENOTTY ;#endif }else {s64 val;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 307/671 6lowpan: Off by one handling ->nexthdr
In reply to Sasha LevinFrom: Dan Carpenter <[email protected]>
[ Upstream commit f57c4bbf34439531adccd7d3a4ecc14f409c1399 ]
NEXTHDR_MAX is 255. What happens here is that we take a u8 value "hdr->nexthdr" from the network and then look it up in lowpan_nexthdr_nhcs[]. The problem is that if hdr->nexthdr is 0xff then we read one element beyond the end of the array so the array needs to be one element larger.
--- net/6lowpan/nhc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/6lowpan/nhc.c +1 -1
@@ -18,7 +18,7 @@#include "nhc.h" static struct rb_root rb_root =RB_ROOT ; -static struct lowpan_nhc *lowpan_nexthdr_nhcs[NEXTHDR_MAX ]; +static struct lowpan_nhc *lowpan_nexthdr_nhcs[NEXTHDR_MAX +1 ];static DEFINE_SPINLOCK (lowpan_nhc_lock);static int lowpan_nhc_insert (struct lowpan_nhc *nhc)
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 308/671 dmaengine: axi-dmac: Don't check the number of frames for alignment
In reply to Sasha LevinFrom: Alexandru Ardelean <[email protected]>
[ Upstream commit 648865a79d8ee3d1aa64aab5eb2a9d12eeed14f9 ]
In 2D transfers (for the AXI DMAC), the number of frames (numf) represents Y_LENGTH, and the length of a frame is X_LENGTH. 2D transfers are useful for video transfers where screen resolutions ( X * Y ) are typically aligned for X, but not for Y.
There is no requirement for Y_LENGTH to be aligned to the bus-width (or anything), and this is also true for AXI DMAC.
Checking the Y_LENGTH for alignment causes false errors when initiating DMA transfers. This change fixes this by checking only that the Y_LENGTH is non-zero.
--- drivers/dma/dma-axi-dmac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/dma/dma-axi-dmac.c +1 -1
@@ -486,7 +486,7 @@ static struct dma_async_tx_descriptor *axi_dmac_prep_interleaved(if (chan->hw_2d) {if (!axi_dmac_check_len (chan, xt->sgl[0 ].size) || - !axi_dmac_check_len (chan, xt->numf)) + xt->numf ==0 )return NULL ;if (xt->sgl[0 ].size + dst_icg > chan->max_length || xt->sgl[0 ].size + src_icg > chan->max_length)
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 309/671 ALSA: usb-audio: Handle the error from snd_usb_mixer_apply_create_quirk()
In reply to Sasha LevinFrom: Takashi Iwai <[email protected]>
[ Upstream commit 328e9f6973be2ee67862cb17bf6c0c5c5918cd72 ]
The error from snd_usb_mixer_apply_create_quirk() is ignored in the current usb-audio driver code, which will continue the probing even after the error. Let's take it more serious.
--- sound/usb/mixer.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
sound/usb/mixer.c +3 -1
@@ -3480,7 +3480,9 @@ int snd_usb_create_mixer(struct snd_usb_audio *chip, int ctrlif,if (err <0 ) goto _error; -snd_usb_mixer_apply_create_quirk (mixer); + err =snd_usb_mixer_apply_create_quirk (mixer); +if (err <0 ) + goto _error; err =snd_device_new (chip->card,SNDRV_DEV_CODEC , mixer, &dev_ops);if (err <0 )
Signature · 6 lines
2.20.1 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Sasha Levin
maintainerPATCH 310/671 afs: Fix AFS file locking to allow fine grained locks
In reply to Sasha LevinFrom: David Howells <[email protected]>
[ Upstream commit 68ce801ffd82e72d5005ab5458e8b9e59f24d9cc ]
Fix AFS file locking to allow fine grained locks as some applications, such as firefox, won't work if they can't take such locks on certain state files
- thereby preventing the use of kAFS to distribute a home directory.
Note that this cannot be made completely functional as the protocol only has provision for whole-file locks, so there exists the possibility of a process deadlocking itself by getting a partial read-lock on a file first and then trying to get a non-overlapping write-lock - but we got the server's read lock with the first lock, so we're now stuck.
OpenAFS solves this by just granting any partial-range lock directly without consulting the server - and hoping there's no remote collision. I want to implement that in a separate patch and it requires a bit more thought.
--- fs/afs/flock.c | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-)
fs/afs/flock.c +9 -14
@@ -432,10 +432,6 @@ static int afs_do_setlk(struct file *file, struct file_lock *fl)_enter ("{%x:%u},%u" , vnode->fid.vid, vnode->fid.vnode, fl->fl_type); -/* only whole-file locks are supported */ -if (fl->fl_start !=0 || fl->fl_end !=OFFSET_MAX ) -return -EINVAL ; - fl->fl_ops = &afs_lock_ops;INIT_LIST_HEAD (&fl->fl_u.afs.link); fl->fl_u.afs.state =AFS_LOCK_PENDING ;
@@ -587,10 +583,6 @@ static int afs_do_unlk(struct file *file, struct file_lock *fl)/* Flush all pending writes before doing anything with locks. */ vfs_fsync (file,0 ); -/* only whole-file unlocks are supported */ -if (fl->fl_start !=0 || fl->fl_end !=OFFSET_MAX ) -return -EINVAL ; - ret =posix_lock_file (file, fl,NULL );_leave (" = %d [%u]" , ret, vnode->lock_state);return ret;
@@ -618,12 +610,15 @@ static int afs_do_getlk(struct file *file, struct file_lock *fl) goto error; lock_count =READ_ONCE (vnode->status.lock_count); -if (lock_count >0 ) - fl->fl_type =F_RDLCK ; -else - fl->fl_type =F_WRLCK ; - fl->fl_start =0 ; - fl->fl_end =OFFSET_MAX ; +if (lock_count !=0 ) { +if (lock_count >0 ) + fl->fl_type =F_RDLCK ; +else + fl->fl_type =F_WRLCK ; + fl->fl_start =0 ; + fl->fl_end =OFFSET_MAX ; + fl->fl_pid =0 ; + } } ret =0 ;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 311/671 afs: Further fix file locking
In reply to Sasha LevinFrom: David Howells <[email protected]>
[ Upstream commit 4be5975aea154e164696128d049dec9ed341585c ]
Further fix the file locking in the afs filesystem client in a number of ways, including:
(1) Don't submit the operation to obtain a lock from the server in a work queue context, but rather do it in the process context of whoever issued the requesting system call.
(2) The owner of the file_lock struct at the front of the pending_locks queue now owns right to talk to the server.
(3) Write locks can be instantly granted if they don't overlap with any other locks *and* we have a write lock on the server.
(4) In the event of an authentication/permission error, all other matching pending locks requests are also immediately aborted.
(5) Properly use VFS core locks_lock_file_wait() to distribute the server lock amongst local client locks, including waiting for the lock to become available.
Test with:
sqlite3 /afs/.../scratch/billings.sqlite <<EOF CREATE TABLE hosts ( hostname varchar(80), shorthost varchar(80), room varchar(30), building varchar(30), PRIMARY KEY(shorthost) ); EOF
With the version of sqlite3 that I have, this should fail consistently with EAGAIN, whether or not the program is straced (which introduces some delays between lock syscalls).
--- fs/afs/flock.c | 390 ++++++++++++++++++++++++------------------------- 1 file changed, 195 insertions(+), 195 deletions(-)
fs/afs/flock.c +195 -195
@@ -13,9 +13,11 @@#define AFS_LOCK_GRANTED 0#define AFS_LOCK_PENDING 1 +#define AFS_LOCK_YOUR_TRY 2struct workqueue_struct *afs_lock_manager; +static void afs_next_locker (struct afs_vnode *vnode,int error);static void afs_fl_copy_lock (struct file_lock *new,struct file_lock *fl);static void afs_fl_release_private (struct file_lock *fl);
@@ -24,6 +26,12 @@ static const struct file_lock_operations afs_lock_ops = { .fl_release_private = afs_fl_release_private, }; +static inline void afs_set_lock_state (struct afs_vnode *vnode,enum afs_lock_state state) +{ +_debug ("STATE %u -> %u" , vnode->lock_state, state); + vnode->lock_state = state; +} +/* * if the callback is broken on this vnode, then the lock may now be available */
@@ -31,7 +39,13 @@ void afs_lock_may_be_available(struct afs_vnode *vnode) {_enter ("{%x:%u}" , vnode->fid.vid, vnode->fid.vnode); -queue_delayed_work (afs_lock_manager, &vnode->lock_work,0 ); +if (vnode->lock_state !=AFS_VNODE_LOCK_WAITING_FOR_CB ) +return ; + +spin_lock (&vnode->lock); +if (vnode->lock_state ==AFS_VNODE_LOCK_WAITING_FOR_CB ) +afs_next_locker (vnode,0 ); +spin_unlock (&vnode->lock); }/*
@@ -49,22 +63,65 @@ static void afs_schedule_lock_extension(struct afs_vnode *vnode)* first lock in the queue is itself a readlock) * - the caller must hold the vnode lock */ -static void afs_grant_locks (struct afs_vnode *vnode,struct file_lock *fl) +static void afs_grant_locks (struct afs_vnode *vnode) {struct file_lock *p, *_p; +bool exclusive = (vnode->lock_type ==AFS_LOCK_WRITE ); -list_move_tail (&fl->fl_u.afs.link, &vnode->granted_locks); -if (fl->fl_type ==F_RDLCK ) { -list_for_each_entry_safe (p, _p, &vnode->pending_locks, - fl_u.afs.link) { -if (p->fl_type ==F_RDLCK ) { - p->fl_u.afs.state =AFS_LOCK_GRANTED ; -list_move_tail (&p->fl_u.afs.link, - &vnode->granted_locks); -wake_up (&p->fl_wait); - } +list_for_each_entry_safe (p, _p, &vnode->pending_locks, fl_u.afs.link) { +if (!exclusive && p->fl_type ==F_WRLCK ) +continue ; + +list_move_tail (&p->fl_u.afs.link, &vnode->granted_locks); + p->fl_u.afs.state =AFS_LOCK_GRANTED ; +wake_up (&p->fl_wait); + } +} + +/* +* If an error is specified, reject every pending lock that matches the +* authentication and type of the lock we failed to get. If there are any +* remaining lockers, try to wake up one of them to have a go. +*/ +static void afs_next_locker (struct afs_vnode *vnode,int error) +{ +struct file_lock *p, *_p, *next =NULL ; +struct key *key = vnode->lock_key; +unsigned int fl_type =F_RDLCK ; + +_enter ("" ); + +if (vnode->lock_type ==AFS_LOCK_WRITE ) + fl_type =F_WRLCK ; + +list_for_each_entry_safe (p, _p, &vnode->pending_locks, fl_u.afs.link) { +if (error && + p->fl_type == fl_type && +afs_file_key (p->fl_file) == key) { +list_del_init (&p->fl_u.afs.link); + p->fl_u.afs.state = error; +wake_up (&p->fl_wait); } + +/* Select the next locker to hand off to. */ +if (next && + (next->fl_type ==F_WRLCK || p->fl_type ==F_RDLCK )) +continue ; + next = p; } + + vnode->lock_key =NULL ; +key_put (key); + +if (next) { +afs_set_lock_state (vnode,AFS_VNODE_LOCK_SETTING ); + next->fl_u.afs.state =AFS_LOCK_YOUR_TRY ; +wake_up (&next->fl_wait); + }else { +afs_set_lock_state (vnode,AFS_VNODE_LOCK_NONE ); + } + +_leave ("" ); }/*
@@ -170,8 +227,6 @@ void afs_lock_work(struct work_struct *work) {struct afs_vnode *vnode = container_of(work, struct afs_vnode, lock_work.work); -struct file_lock *fl, *next; -afs_lock_type_t type;struct key *key;int ret;
@@ -184,7 +239,7 @@ void afs_lock_work(struct work_struct *work)switch (vnode->lock_state) {case AFS_VNODE_LOCK_NEED_UNLOCK :_debug ("unlock" ); - vnode->lock_state =AFS_VNODE_LOCK_UNLOCKING ; +afs_set_lock_state (vnode,AFS_VNODE_LOCK_UNLOCKING );spin_unlock (&vnode->lock);/* attempt to release the server lock; if it fails, we just
@@ -196,22 +251,9 @@ void afs_lock_work(struct work_struct *work) vnode->fid.vid, vnode->fid.vnode, ret);spin_lock (&vnode->lock); -key_put (vnode->lock_key); - vnode->lock_key =NULL ; - vnode->lock_state =AFS_VNODE_LOCK_NONE ; - -if (list_empty (&vnode->pending_locks)) { -spin_unlock (&vnode->lock); -return ; - } - -/* The new front of the queue now owns the state variables. */ - next =list_entry (vnode->pending_locks.next, - struct file_lock, fl_u.afs.link); - vnode->lock_key =key_get (afs_file_key (next->fl_file)); - vnode->lock_type = (next->fl_type ==F_RDLCK ) ?AFS_LOCK_READ :AFS_LOCK_WRITE ; - vnode->lock_state =AFS_VNODE_LOCK_WAITING_FOR_CB ; - goto again; +afs_next_locker (vnode,0 ); +spin_unlock (&vnode->lock); +return ;/* If we've already got a lock, then it must be time to extend that * lock as AFS locks time out after 5 minutes.
@@ -222,7 +264,7 @@ void afs_lock_work(struct work_struct *work)ASSERT (!list_empty (&vnode->granted_locks)); key =key_get (vnode->lock_key); - vnode->lock_state =AFS_VNODE_LOCK_EXTENDING ; +afs_set_lock_state (vnode,AFS_VNODE_LOCK_EXTENDING );spin_unlock (&vnode->lock); ret =afs_extend_lock (vnode, key);/* RPC */
@@ -236,72 +278,26 @@ void afs_lock_work(struct work_struct *work)if (vnode->lock_state !=AFS_VNODE_LOCK_EXTENDING ) goto again; - vnode->lock_state =AFS_VNODE_LOCK_GRANTED ; +afs_set_lock_state (vnode,AFS_VNODE_LOCK_GRANTED ); -if (ret ==0 ) -afs_schedule_lock_extension (vnode); -else +if (ret !=0 )queue_delayed_work (afs_lock_manager, &vnode->lock_work,HZ *10 );spin_unlock (&vnode->lock);_leave (" [ext]" );return ; -/* If we don't have a granted lock, then we must've been called -* back by the server, and so if might be possible to get a -* lock we're currently waiting for. -*/ +/* If we're waiting for a callback to indicate lock release, we can't +* actually rely on this, so need to recheck at regular intervals. The +* problem is that the server might not notify us if the lock just +* expires (say because a client died) rather than being explicitly +* released. +*/ case AFS_VNODE_LOCK_WAITING_FOR_CB : -_debug ("get" ); - - key =key_get (vnode->lock_key); - type = vnode->lock_type; - vnode->lock_state =AFS_VNODE_LOCK_SETTING ; +_debug ("retry" ); +afs_next_locker (vnode,0 );spin_unlock (&vnode->lock); - - ret =afs_set_lock (vnode, key, type);/* RPC */ -key_put (key); - -spin_lock (&vnode->lock); -switch (ret) { -case -EWOULDBLOCK : -_debug ("blocked" ); -break ; -case 0 : -_debug ("acquired" ); - vnode->lock_state =AFS_VNODE_LOCK_GRANTED ; -/* Fall through */ -default : -/* Pass the lock or the error onto the first locker in -* the list - if they're looking for this type of lock. -* If they're not, we assume that whoever asked for it -* took a signal. -*/ -if (list_empty (&vnode->pending_locks)) { -_debug ("withdrawn" ); - vnode->lock_state =AFS_VNODE_LOCK_NEED_UNLOCK ; - goto again; - } - - fl =list_entry (vnode->pending_locks.next, - struct file_lock, fl_u.afs.link); - type = (fl->fl_type ==F_RDLCK ) ?AFS_LOCK_READ :AFS_LOCK_WRITE ; -if (vnode->lock_type != type) { -_debug ("changed" ); - vnode->lock_state =AFS_VNODE_LOCK_NEED_UNLOCK ; - goto again; - } - - fl->fl_u.afs.state = ret; -if (ret ==0 ) -afs_grant_locks (vnode, fl); -else -list_del_init (&fl->fl_u.afs.link); -wake_up (&fl->fl_wait); -spin_unlock (&vnode->lock); -_leave (" [granted]" ); -return ; - } +return ;default :/* Looks like a lock request was withdrawn. */
@@ -319,14 +315,15 @@ void afs_lock_work(struct work_struct *work)*/ static void afs_defer_unlock (struct afs_vnode *vnode) { -_enter ("" ); +_enter ("%u" , vnode->lock_state); -if (vnode->lock_state ==AFS_VNODE_LOCK_GRANTED || - vnode->lock_state ==AFS_VNODE_LOCK_EXTENDING ) { +if (list_empty (&vnode->granted_locks) && + (vnode->lock_state ==AFS_VNODE_LOCK_GRANTED || + vnode->lock_state ==AFS_VNODE_LOCK_EXTENDING )) {cancel_delayed_work (&vnode->lock_work); - vnode->lock_state =AFS_VNODE_LOCK_NEED_UNLOCK ; -afs_lock_may_be_available (vnode); +afs_set_lock_state (vnode,AFS_VNODE_LOCK_NEED_UNLOCK ); +queue_delayed_work (afs_lock_manager, &vnode->lock_work,0 ); } }
@@ -375,50 +372,6 @@ static int afs_do_setlk_check(struct afs_vnode *vnode, struct key *key,return 0 ; } -/* -* Remove the front runner from the pending queue. -* - The caller must hold vnode->lock. -*/ -static void afs_dequeue_lock (struct afs_vnode *vnode,struct file_lock *fl) -{ -struct file_lock *next; - -_enter ("" ); - -/* ->lock_type, ->lock_key and ->lock_state only belong to this -* file_lock if we're at the front of the pending queue or if we have -* the lock granted or if the lock_state is NEED_UNLOCK or UNLOCKING. -*/ -if (vnode->granted_locks.next == &fl->fl_u.afs.link && - vnode->granted_locks.prev == &fl->fl_u.afs.link) { -list_del_init (&fl->fl_u.afs.link); -afs_defer_unlock (vnode); -return ; - } - -if (!list_empty (&vnode->granted_locks) || - vnode->pending_locks.next != &fl->fl_u.afs.link) { -list_del_init (&fl->fl_u.afs.link); -return ; - } - -list_del_init (&fl->fl_u.afs.link); -key_put (vnode->lock_key); - vnode->lock_key =NULL ; - vnode->lock_state =AFS_VNODE_LOCK_NONE ; - -if (list_empty (&vnode->pending_locks)) -return ; - -/* The new front of the queue now owns the state variables. */ - next =list_entry (vnode->pending_locks.next, - struct file_lock, fl_u.afs.link); - vnode->lock_key =key_get (afs_file_key (next->fl_file)); - vnode->lock_type = (next->fl_type ==F_RDLCK ) ?AFS_LOCK_READ :AFS_LOCK_WRITE ; - vnode->lock_state =AFS_VNODE_LOCK_WAITING_FOR_CB ; -afs_lock_may_be_available (vnode); -} -/* * request a lock on a file on the server */
@@ -443,44 +396,66 @@ static int afs_do_setlk(struct file *file, struct file_lock *fl)return ret;spin_lock (&vnode->lock); +list_add_tail (&fl->fl_u.afs.link, &vnode->pending_locks); -/* If we've already got a readlock on the server then we instantly -* grant another readlock, irrespective of whether there are any -* pending writelocks. +/* If we've already got a lock on the server then try to move to having +* the VFS grant the requested lock. Note that this means that other +* clients may get starved out. */ -if (type ==AFS_LOCK_READ && - vnode->lock_state ==AFS_VNODE_LOCK_GRANTED && - vnode->lock_type ==AFS_LOCK_READ ) { -_debug ("instant readlock" ); -ASSERT (!list_empty (&vnode->granted_locks)); - goto share_existing_lock; - } +_debug ("try %u" , vnode->lock_state); +if (vnode->lock_state ==AFS_VNODE_LOCK_GRANTED ) { +if (type ==AFS_LOCK_READ ) { +_debug ("instant readlock" ); +list_move_tail (&fl->fl_u.afs.link, &vnode->granted_locks); + fl->fl_u.afs.state =AFS_LOCK_GRANTED ; + goto vnode_is_locked_u; + } -list_add_tail (&fl->fl_u.afs.link, &vnode->pending_locks); +if (vnode->lock_type ==AFS_LOCK_WRITE ) { +_debug ("instant writelock" ); +list_move_tail (&fl->fl_u.afs.link, &vnode->granted_locks); + fl->fl_u.afs.state =AFS_LOCK_GRANTED ; + goto vnode_is_locked_u; + } + }if (vnode->lock_state !=AFS_VNODE_LOCK_NONE ) goto need_to_wait; +try_to_lock:/* We don't have a lock on this vnode and we aren't currently waiting * for one either, so ask the server for a lock. * * Note that we need to be careful if we get interrupted by a signal * after dispatching the request as we may still get the lock, even * though we don't wait for the reply (it's not too bad a problem - the -* lock will expire in 10 mins anyway). +* lock will expire in 5 mins anyway). */ _debug ("not locked" ); vnode->lock_key =key_get (key); vnode->lock_type = type; - vnode->lock_state =AFS_VNODE_LOCK_SETTING ; +afs_set_lock_state (vnode,AFS_VNODE_LOCK_SETTING );spin_unlock (&vnode->lock); ret =afs_set_lock (vnode, key, type);/* RPC */ spin_lock (&vnode->lock);switch (ret) { +case -EKEYREJECTED : +case -EKEYEXPIRED : +case -EKEYREVOKED : +case -EPERM : +case -EACCES : + fl->fl_u.afs.state = ret; +list_del_init (&fl->fl_u.afs.link); +afs_next_locker (vnode, ret); + goto error_unlock; +default : - goto abort_attempt; + fl->fl_u.afs.state = ret; +list_del_init (&fl->fl_u.afs.link); +afs_next_locker (vnode,0 ); + goto error_unlock;case -EWOULDBLOCK :/* The server doesn't have a lock-waiting queue, so the client
@@ -490,29 +465,23 @@ static int afs_do_setlk(struct file *file, struct file_lock *fl)_debug ("would block" );ASSERT (list_empty (&vnode->granted_locks)); ASSERTCMP(vnode->pending_locks.next, ==, &fl->fl_u.afs.link); - vnode->lock_state =AFS_VNODE_LOCK_WAITING_FOR_CB ; - goto need_to_wait; + goto lock_is_contended;case 0 :_debug ("acquired" ); -break ; +afs_set_lock_state (vnode,AFS_VNODE_LOCK_GRANTED ); +afs_grant_locks (vnode); + goto vnode_is_locked_u; } -/* we've acquired a server lock, but it needs to be renewed after 5 -* mins */ - vnode->lock_state =AFS_VNODE_LOCK_GRANTED ; -afs_schedule_lock_extension (vnode); - -share_existing_lock: -/* the lock has been granted as far as we're concerned... */ - fl->fl_u.afs.state =AFS_LOCK_GRANTED ; -list_move_tail (&fl->fl_u.afs.link, &vnode->granted_locks); - -given_lock: -/* ... but we do still need to get the VFS's blessing */ +vnode_is_locked_u:spin_unlock (&vnode->lock); +vnode_is_locked: +/* the lock has been granted by the server... */ + ASSERTCMP(fl->fl_u.afs.state, ==, AFS_LOCK_GRANTED); - ret =posix_lock_file (file, fl,NULL ); +/* ... but the VFS still needs to distribute access on this client. */ + ret =locks_lock_file_wait (file, fl);if (ret <0 ) goto vfs_rejected_lock;
@@ -524,38 +493,61 @@ static int afs_do_setlk(struct file *file, struct file_lock *fl)_leave (" = 0" );return 0 ; +lock_is_contended: +if (!(fl->fl_flags &FL_SLEEP )) { +list_del_init (&fl->fl_u.afs.link); +afs_next_locker (vnode,0 ); + ret = -EAGAIN ; + goto error_unlock; + } + +afs_set_lock_state (vnode,AFS_VNODE_LOCK_WAITING_FOR_CB ); +queue_delayed_work (afs_lock_manager, &vnode->lock_work,HZ *5 ); + need_to_wait:/* We're going to have to wait. Either this client doesn't have a lock * on the server yet and we need to wait for a callback to occur, or -* the client does have a lock on the server, but it belongs to some -* other process(es) and is incompatible with the lock we want. +* the client does have a lock on the server, but it's shared and we +* need an exclusive lock. */ - ret = -EAGAIN ; -if (fl->fl_flags &FL_SLEEP ) { -spin_unlock (&vnode->lock); +spin_unlock (&vnode->lock); -_debug ("sleep" ); - ret =wait_event_interruptible (fl->fl_wait, - fl->fl_u.afs.state !=AFS_LOCK_PENDING ); +_debug ("sleep" ); + ret =wait_event_interruptible (fl->fl_wait, + fl->fl_u.afs.state !=AFS_LOCK_PENDING ); +_debug ("wait = %d" , ret); +if (fl->fl_u.afs.state >=0 && fl->fl_u.afs.state !=AFS_LOCK_GRANTED ) {spin_lock (&vnode->lock); - } -if (fl->fl_u.afs.state ==AFS_LOCK_GRANTED ) - goto given_lock; -if (fl->fl_u.afs.state <0 ) - ret = fl->fl_u.afs.state; +switch (fl->fl_u.afs.state) { +case AFS_LOCK_YOUR_TRY : + fl->fl_u.afs.state =AFS_LOCK_PENDING ; + goto try_to_lock; +case AFS_LOCK_PENDING : +if (ret >0 ) { +/* We need to retry the lock. We may not be +* notified by the server if it just expired +* rather than being released. +*/ + ASSERTCMP(vnode->lock_state, ==, AFS_VNODE_LOCK_WAITING_FOR_CB); +afs_set_lock_state (vnode,AFS_VNODE_LOCK_SETTING ); + fl->fl_u.afs.state =AFS_LOCK_PENDING ; + goto try_to_lock; + } + goto error_unlock; +case AFS_LOCK_GRANTED : +default : +break ; + } -abort_attempt: -/* we aren't going to get the lock, either because we're unwilling to -* wait, or because some signal happened */ -_debug ("abort" ); -afs_dequeue_lock (vnode, fl); +spin_unlock (&vnode->lock); + } -error_unlock: -spin_unlock (&vnode->lock); -_leave (" = %d" , ret); -return ret; +if (fl->fl_u.afs.state ==AFS_LOCK_GRANTED ) + goto vnode_is_locked; + ret = fl->fl_u.afs.state; + goto error; vfs_rejected_lock:/* The VFS rejected the lock we just obtained, so we have to discard
@@ -565,9 +557,13 @@ static int afs_do_setlk(struct file *file, struct file_lock *fl)_debug ("vfs refused %d" , ret);spin_lock (&vnode->lock);list_del_init (&fl->fl_u.afs.link); -if (list_empty (&vnode->granted_locks)) -afs_defer_unlock (vnode); - goto error_unlock; +afs_defer_unlock (vnode); + +error_unlock: +spin_unlock (&vnode->lock); +error: +_leave (" = %d" , ret); +return ret; }/*
@@ -583,7 +579,7 @@ static int afs_do_unlk(struct file *file, struct file_lock *fl)/* Flush all pending writes before doing anything with locks. */ vfs_fsync (file,0 ); - ret =posix_lock_file (file, fl,NULL ); + ret =locks_lock_file_wait (file, fl);_leave (" = %d [%u]" , ret, vnode->lock_state);return ret; }
@@ -705,7 +701,11 @@ static void afs_fl_release_private(struct file_lock *fl)_enter ("" );spin_lock (&vnode->lock); -afs_dequeue_lock (vnode, fl); + +list_del_init (&fl->fl_u.afs.link); +if (list_empty (&vnode->granted_locks)) +afs_defer_unlock (vnode); +_debug ("state %u for %p" , vnode->lock_state, vnode);spin_unlock (&vnode->lock); }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 312/671 NFS: Don't interrupt file writeout due to fatal errors
In reply to Sasha LevinFrom: Trond Myklebust <[email protected]>
[ Upstream commit 14bebe3c90b326d2a0df78aed5e9de090c71d878 ]
When flushing out dirty pages, the fact that we may hit fatal errors is not a reason to stop writeback. Those errors are reported through fsync(), not through the flush mechanism.
--- fs/nfs/write.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/nfs/write.c +1 -1
@@ -646,7 +646,7 @@ static int nfs_page_async_flush(struct nfs_pageio_descriptor *pgio,return ret; out_launder:nfs_write_error_remove_page (req); -return ret; +return 0 ; } static int nfs_do_writepage(struct page *page, struct writeback_control *wbc,
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 313/671 coresight: catu: fix clang build warning
In reply to Sasha LevinFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 59d63de076607a9334b11628b5c3ddda1d8f56cd ]
Clang points out a syntax error, as the etr_catu_buf_ops structure is declared 'static' before the type is known:
In file included from drivers/hwtracing/coresight/coresight-tmc-etr.c:12:drivers/hwtracing/coresight/coresight-catu.h:116:40: warning: tentative definition of variable with internal linkage has incomplete non-array type 'const struct etr_buf_operations' [-Wtentative-definition-incomplete-type]
static const struct etr_buf_operations etr_catu_buf_ops;
^drivers/hwtracing/coresight/coresight-catu.h:116:21: note: forward declaration of 'struct etr_buf_operations' static const struct etr_buf_operations etr_catu_buf_ops;
This seems worth fixing in the code, so replace pointer to the empty constant structure with a NULL pointer. We need an extra NULL pointer check here, but the result should be better object code otherwise, avoiding the silly empty structure.
--- drivers/hwtracing/coresight/coresight-catu.h | 5 ----- drivers/hwtracing/coresight/coresight-tmc-etr.c | 5 +++-- 2 files changed, 3 insertions(+), 7 deletions(-)
drivers/hwtracing/coresight/coresight-catu.h +0 -5
@@ -109,11 +109,6 @@ static inline bool coresight_is_catu_device(struct coresight_device *csdev) return true; } -#ifdef CONFIG_CORESIGHT_CATU extern const struct etr_buf_operations etr_catu_buf_ops; -#else -/* Dummy declaration for the CATU ops */ -static const struct etr_buf_operations etr_catu_buf_ops; -#endif #endif
drivers/hwtracing/coresight/coresight-tmc-etr.c +3 -2
@@ -747,7 +747,8 @@ static inline void tmc_etr_disable_catu(struct tmc_drvdata *drvdata)static const struct etr_buf_operations *etr_buf_ops[] = { [ETR_MODE_FLAT ] = &etr_flat_buf_ops, [ETR_MODE_ETR_SG ] = &etr_sg_buf_ops, - [ETR_MODE_CATU ] = &etr_catu_buf_ops, + [ETR_MODE_CATU ] =IS_ENABLED (CONFIG_CORESIGHT_CATU ) + ? &etr_catu_buf_ops :NULL , }; static inline int tmc_etr_mode_alloc_buf(int mode,
@@ -761,7 +762,7 @@ static inline int tmc_etr_mode_alloc_buf(int mode,case ETR_MODE_FLAT :case ETR_MODE_ETR_SG :case ETR_MODE_CATU : -if (etr_buf_ops[mode]->alloc) +if (etr_buf_ops[mode] && etr_buf_ops[mode]->alloc) rc = etr_buf_ops[mode]->alloc (drvdata, etr_buf, node, pages);if (!rc)
Signature · 7 lines
2.20.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Sasha Levin
maintainerPATCH 314/671 s390/kexec_file: Fix potential segment overlap in ELF loader
In reply to Sasha LevinFrom: Philipp Rudo <[email protected]>
[ Upstream commit 6339a3889ad4d0dd930ed7a1e873fb81d3e690f7 ]
When loading an ELF image via kexec_file the segment alignment is ignored in the calculation for the load address of the next segment. When there are multiple segments this can lead to segment overlap and thus load failure.
--- arch/s390/kernel/kexec_elf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/s390/kernel/kexec_elf.c +1 -1
@@ -58,7 +58,7 @@ static int kexec_file_add_elf_kernel(struct kimage *image,if (ret)return ret; - data->memsz += buf.memsz; + data->memsz =ALIGN (data->memsz, phdr->p_align) + buf.memsz; }return 0 ;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 315/671 irqchip/gic-v3-its: fix some definitions of inner cacheability attributes
In reply to Sasha LevinFrom: Hongbo Yao <[email protected]>
[ Upstream commit 0f29456d08042134aff6e562d07a6365c841c4ad ]
Some definitions of Inner Cacheability attibutes need to be corrected.
--- include/linux/irqchip/arm-gic-v3.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
include/linux/irqchip/arm-gic-v3.h +6 -6
@@ -165,7 +165,7 @@#define GICR_PROPBASER_nCnB GIC_BASER_CACHEABILITY(GICR_PROPBASER, INNER, nCnB)#define GICR_PROPBASER_nC GIC_BASER_CACHEABILITY(GICR_PROPBASER, INNER, nC)#define GICR_PROPBASER_RaWt GIC_BASER_CACHEABILITY(GICR_PROPBASER, INNER, RaWt) -#define GICR_PROPBASER_RaWb GIC_BASER_CACHEABILITY(GICR_PROPBASER, INNER, RaWt) +#define GICR_PROPBASER_RaWb GIC_BASER_CACHEABILITY(GICR_PROPBASER, INNER, RaWb)#define GICR_PROPBASER_WaWt GIC_BASER_CACHEABILITY(GICR_PROPBASER, INNER, WaWt)#define GICR_PROPBASER_WaWb GIC_BASER_CACHEABILITY(GICR_PROPBASER, INNER, WaWb)#define GICR_PROPBASER_RaWaWt GIC_BASER_CACHEABILITY(GICR_PROPBASER, INNER, RaWaWt)
@@ -192,7 +192,7 @@#define GICR_PENDBASER_nCnB GIC_BASER_CACHEABILITY(GICR_PENDBASER, INNER, nCnB)#define GICR_PENDBASER_nC GIC_BASER_CACHEABILITY(GICR_PENDBASER, INNER, nC)#define GICR_PENDBASER_RaWt GIC_BASER_CACHEABILITY(GICR_PENDBASER, INNER, RaWt) -#define GICR_PENDBASER_RaWb GIC_BASER_CACHEABILITY(GICR_PENDBASER, INNER, RaWt) +#define GICR_PENDBASER_RaWb GIC_BASER_CACHEABILITY(GICR_PENDBASER, INNER, RaWb)#define GICR_PENDBASER_WaWt GIC_BASER_CACHEABILITY(GICR_PENDBASER, INNER, WaWt)#define GICR_PENDBASER_WaWb GIC_BASER_CACHEABILITY(GICR_PENDBASER, INNER, WaWb)#define GICR_PENDBASER_RaWaWt GIC_BASER_CACHEABILITY(GICR_PENDBASER, INNER, RaWaWt)
@@ -251,7 +251,7 @@#define GICR_VPROPBASER_nCnB GIC_BASER_CACHEABILITY(GICR_VPROPBASER, INNER, nCnB)#define GICR_VPROPBASER_nC GIC_BASER_CACHEABILITY(GICR_VPROPBASER, INNER, nC)#define GICR_VPROPBASER_RaWt GIC_BASER_CACHEABILITY(GICR_VPROPBASER, INNER, RaWt) -#define GICR_VPROPBASER_RaWb GIC_BASER_CACHEABILITY(GICR_VPROPBASER, INNER, RaWt) +#define GICR_VPROPBASER_RaWb GIC_BASER_CACHEABILITY(GICR_VPROPBASER, INNER, RaWb)#define GICR_VPROPBASER_WaWt GIC_BASER_CACHEABILITY(GICR_VPROPBASER, INNER, WaWt)#define GICR_VPROPBASER_WaWb GIC_BASER_CACHEABILITY(GICR_VPROPBASER, INNER, WaWb)#define GICR_VPROPBASER_RaWaWt GIC_BASER_CACHEABILITY(GICR_VPROPBASER, INNER, RaWaWt)
@@ -277,7 +277,7 @@#define GICR_VPENDBASER_nCnB GIC_BASER_CACHEABILITY(GICR_VPENDBASER, INNER, nCnB)#define GICR_VPENDBASER_nC GIC_BASER_CACHEABILITY(GICR_VPENDBASER, INNER, nC)#define GICR_VPENDBASER_RaWt GIC_BASER_CACHEABILITY(GICR_VPENDBASER, INNER, RaWt) -#define GICR_VPENDBASER_RaWb GIC_BASER_CACHEABILITY(GICR_VPENDBASER, INNER, RaWt) +#define GICR_VPENDBASER_RaWb GIC_BASER_CACHEABILITY(GICR_VPENDBASER, INNER, RaWb)#define GICR_VPENDBASER_WaWt GIC_BASER_CACHEABILITY(GICR_VPENDBASER, INNER, WaWt)#define GICR_VPENDBASER_WaWb GIC_BASER_CACHEABILITY(GICR_VPENDBASER, INNER, WaWb)#define GICR_VPENDBASER_RaWaWt GIC_BASER_CACHEABILITY(GICR_VPENDBASER, INNER, RaWaWt)
@@ -351,7 +351,7 @@#define GITS_CBASER_nCnB GIC_BASER_CACHEABILITY(GITS_CBASER, INNER, nCnB)#define GITS_CBASER_nC GIC_BASER_CACHEABILITY(GITS_CBASER, INNER, nC)#define GITS_CBASER_RaWt GIC_BASER_CACHEABILITY(GITS_CBASER, INNER, RaWt) -#define GITS_CBASER_RaWb GIC_BASER_CACHEABILITY(GITS_CBASER, INNER, RaWt) +#define GITS_CBASER_RaWb GIC_BASER_CACHEABILITY(GITS_CBASER, INNER, RaWb)#define GITS_CBASER_WaWt GIC_BASER_CACHEABILITY(GITS_CBASER, INNER, WaWt)#define GITS_CBASER_WaWb GIC_BASER_CACHEABILITY(GITS_CBASER, INNER, WaWb)#define GITS_CBASER_RaWaWt GIC_BASER_CACHEABILITY(GITS_CBASER, INNER, RaWaWt)
@@ -375,7 +375,7 @@#define GITS_BASER_nCnB GIC_BASER_CACHEABILITY(GITS_BASER, INNER, nCnB)#define GITS_BASER_nC GIC_BASER_CACHEABILITY(GITS_BASER, INNER, nC)#define GITS_BASER_RaWt GIC_BASER_CACHEABILITY(GITS_BASER, INNER, RaWt) -#define GITS_BASER_RaWb GIC_BASER_CACHEABILITY(GITS_BASER, INNER, RaWt) +#define GITS_BASER_RaWb GIC_BASER_CACHEABILITY(GITS_BASER, INNER, RaWb)#define GITS_BASER_WaWt GIC_BASER_CACHEABILITY(GITS_BASER, INNER, WaWt)#define GITS_BASER_WaWb GIC_BASER_CACHEABILITY(GITS_BASER, INNER, WaWb)#define GITS_BASER_RaWaWt GIC_BASER_CACHEABILITY(GITS_BASER, INNER, RaWaWt)
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 316/671 scsi: qla2xxx: Fix a format specifier
In reply to Sasha LevinFrom: Bart Van Assche <[email protected]>
[ Upstream commit 19ce192cd718e02f880197c0983404ca48236807 ]
Since mcmd->sess->port_name is eight bytes long, use %8phC to format that port name instead of %phC.
--- drivers/scsi/qla2xxx/qla_target.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/qla2xxx/qla_target.c +1 -1
@@ -2290,7 +2290,7 @@ void qlt_xmit_tm_rsp(struct qla_tgt_mgmt_cmd *mcmd) mcmd->orig_iocb.imm_ntfy.u.isp24.status_subcode == ELS_TPRLO) {ql_dbg (ql_dbg_disc, vha,0x2106 , -"TM response logo %phC status %#x state %#x" , +"TM response logo %8phC status %#x state %#x" , mcmd->sess->port_name, mcmd->fc_tm_rsp, mcmd->flags);qlt_schedule_sess_for_deletion (mcmd->sess);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 317/671 scsi: qla2xxx: Fix error handling in qlt_alloc_qfull_cmd()
In reply to Sasha LevinFrom: Bart Van Assche <[email protected]>
[ Upstream commit c04466c17142d5eb566984372b9a5003d1900fe3 ]
The test "if (!cmd)" is not useful because it is guaranteed that cmd != NULL. Instead of testing the cmd pointer, rely on the tag to decide whether or not command allocation failed.
--- drivers/scsi/qla2xxx/qla_target.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/scsi/qla2xxx/qla_target.c +2 -5
@@ -5334,11 +5334,7 @@ qlt_alloc_qfull_cmd(struct scsi_qla_host *vha, se_sess = sess->se_sess; tag =sbitmap_queue_get (&se_sess->sess_tag_pool, &cpu); -if (tag <0 ) -return ; - - cmd = &((struct qla_tgt_cmd *)se_sess->sess_cmd_map)[tag]; -if (!cmd) { +if (tag <0 ) {ql_dbg (ql_dbg_io, vha,0x3009 ,"qla_target(%d): %s: Allocation of cmd failed\n" , vha->vp_idx, __func__);
@@ -5353,6 +5349,7 @@ qlt_alloc_qfull_cmd(struct scsi_qla_host *vha,return ; } + cmd = &((struct qla_tgt_cmd *)se_sess->sess_cmd_map)[tag];memset (cmd,0 ,sizeof (struct qla_tgt_cmd ));qlt_incr_num_pend_cmds (vha);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 318/671 scsi: qla2xxx: Avoid that qlt_send_resp_ctio() corrupts memory
In reply to Sasha LevinFrom: Bart Van Assche <[email protected]>
[ Upstream commit a861b49273578e255426a499842cf7f465456351 ]
The "(&ctio->u.status1.sense_data)[i]" where i >= 0 expressions in qlt_send_resp_ctio() are probably typos and should have been "(&ctio->u.status1.sense_data[4 * i])" instead. Instead of only fixing these typos, modify the code for storing sense data such that it becomes easy to read. This patch fixes a Coverity complaint about accessing an array outside its bounds.
--- drivers/scsi/qla2xxx/qla_target.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/scsi/qla2xxx/qla_target.c +6 -6
@@ -2233,14 +2233,14 @@ void qlt_send_resp_ctio(struct qla_qpair *qpair, struct qla_tgt_cmd *cmd, ctio->u.status1.scsi_status |=cpu_to_le16 (SS_RESIDUAL_UNDER ); -/* Response code and sense key */ -put_unaligned_le32 (((0x70 <<24 ) | (sense_key <<8 )), - (&ctio->u.status1.sense_data)[0 ]); +/* Fixed format sense data. */ + ctio->u.status1.sense_data[0 ] =0x70 ; + ctio->u.status1.sense_data[2 ] = sense_key;/* Additional sense length */ -put_unaligned_le32 (0x0a , (&ctio->u.status1.sense_data)[1 ]); + ctio->u.status1.sense_data[7 ] =0xa ;/* ASC and ASCQ */ -put_unaligned_le32 (((asc <<24 ) | (ascq <<16 )), - (&ctio->u.status1.sense_data)[3 ]); + ctio->u.status1.sense_data[12 ] = asc; + ctio->u.status1.sense_data[13 ] = ascq;/* Memory Barrier */ wmb ();
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 319/671 KVM: PPC: Book3S HV: Fix lockdep warning when entering the guest
In reply to Sasha LevinFrom: Alexey Kardashevskiy <[email protected]>
[ Upstream commit 3309bec85e60d60d6394802cb8e183a4f4a72def ]
The trace_hardirqs_on() sets current->hardirqs_enabled and from here the lockdep assumes interrupts are enabled although they are remain disabled until the context switches to the guest. Consequent srcu_read_lock() checks the flags in rcu_lock_acquire(), observes disabled interrupts and prints a warning (see below).
This moves trace_hardirqs_on/off closer to __kvmppc_vcore_entry to prevent lockdep from being confused.
DEBUG_LOCKS_WARN_ON(current->hardirqs_enabled)
WARNING: CPU: 16 PID: 8038 at kernel/locking/lockdep.c:4128 check_flags.part.25+0x224/0x280 [...] NIP [c000000000185b84] check_flags.part.25+0x224/0x280 LR [c000000000185b80] check_flags.part.25+0x220/0x280 Call Trace: [c000003fec253710] [c000000000185b80] check_flags.part.25+0x220/0x280 (unreliable) [c000003fec253780] [c000000000187ea4] lock_acquire+0x94/0x260 [c000003fec253840] [c00800001a1e9768] kvmppc_run_core+0xa60/0x1ab0 [kvm_hv] [c000003fec253a10] [c00800001a1ed944] kvmppc_vcpu_run_hv+0x73c/0xec0 [kvm_hv] [c000003fec253ae0] [c00800001a1095dc] kvmppc_vcpu_run+0x34/0x48 [kvm] [c000003fec253b00] [c00800001a1056bc] kvm_arch_vcpu_ioctl_run+0x2f4/0x400 [kvm] [c000003fec253b90] [c00800001a0f3618] kvm_vcpu_ioctl+0x460/0x850 [kvm] [c000003fec253d00] [c00000000041c4f4] do_vfs_ioctl+0xe4/0x930 [c000003fec253db0] [c00000000041ce04] ksys_ioctl+0xc4/0x110 [c000003fec253e00] [c00000000041ce78] sys_ioctl+0x28/0x80 [c000003fec253e20] [c00000000000b5a4] system_call+0x5c/0x70 Instruction dump: 419e0034 3d220004 39291730 81290000 2f890000 409e0020 3c82ffc6 3c62ffc5 3884be70 386329c0 4bf6ea71 60000000 <0fe00000> 3c62ffc6 3863be90 4801273d irq event stamp: 1025 hardirqs last enabled at (1025): [<c00800001a1e9728>] kvmppc_run_core+0xa20/0x1ab0 [kvm_hv] hardirqs last disabled at (1024): [<c00800001a1e9358>] kvmppc_run_core+0x650/0x1ab0 [kvm_hv] softirqs last enabled at (0): [<c0000000000f1210>] copy_process.isra.4.part.5+0x5f0/0x1d00 softirqs last disabled at (0): [<0000000000000000>] (null) ---[ end trace 31180adcc848993e ]--- possible reason: unannotated irqs-off. irq event stamp: 1025 hardirqs last enabled at (1025): [<c00800001a1e9728>] kvmppc_run_core+0xa20/0x1ab0 [kvm_hv] hardirqs last disabled at (1024): [<c00800001a1e9358>] kvmppc_run_core+0x650/0x1ab0 [kvm_hv] softirqs last enabled at (0): [<c0000000000f1210>] copy_process.isra.4.part.5+0x5f0/0x1d00 softirqs last disabled at (0): [<0000000000000000>] (null)
--- arch/powerpc/kvm/book3s_hv.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)
arch/powerpc/kvm/book3s_hv.c +8 -7
@@ -2993,25 +2993,26 @@ static noinline void kvmppc_run_core(struct kvmppc_vcore *vc) } } -/* -* Interrupts will be enabled once we get into the guest, -* so tell lockdep that we're about to enable interrupts. -*/ -trace_hardirqs_on (); -guest_enter_irqoff (); srcu_idx =srcu_read_lock (&vc->kvm->srcu);this_cpu_disable_ftrace (); +/* +* Interrupts will be enabled once we get into the guest, +* so tell lockdep that we're about to enable interrupts. +*/ +trace_hardirqs_on (); + trap =__kvmppc_vcore_entry (); +trace_hardirqs_off (); +this_cpu_enable_ftrace ();srcu_read_unlock (&vc->kvm->srcu, srcu_idx); -trace_hardirqs_off ();set_irq_happened (trap);spin_lock (&vc->lock);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 320/671 netfilter: nft_flow_offload: add entry to flowtable after confirmation
In reply to Sasha LevinFrom: Pablo Neira Ayuso <[email protected]>
[ Upstream commit 270a8a297f42ecff82060aaa53118361f09c1f7d ]
This is fixing flow offload for UDP traffic where packets only follow one single direction.
The flow_offload_fixup_tcp() mechanism works fine in case that the offloaded entry remains in SYN_RECV state, given sequence tracking is reset and that conntrack handles syn+ack packets as a retransmission, ie.
sES + synack => sIG
for reply traffic.
--- net/netfilter/nft_flow_offload.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
net/netfilter/nft_flow_offload.c +1 -2
@@ -103,8 +103,7 @@ static void nft_flow_offload_eval(const struct nft_expr *expr, ct->status & IPS_SEQ_ADJUST) goto out; -if (ctinfo ==IP_CT_NEW || - ctinfo ==IP_CT_RELATED ) +if (!nf_ct_is_confirmed (ct)) goto out;if (test_and_set_bit (IPS_OFFLOAD_BIT , &ct->status))
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 321/671 PCI: iproc: Enable iProc config read for PAXBv2
In reply to Sasha LevinFrom: Srinath Mannam <[email protected]>
[ Upstream commit 8cff995405eb0b563e7a0d2c49838611ea3f2692 ]
iProc config read flag has to be enabled for PAXBv2 instead of PAXB.
--- drivers/pci/controller/pcie-iproc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/controller/pcie-iproc.c +1 -1
@@ -1347,7 +1347,6 @@ static int iproc_pcie_rev_init(struct iproc_pcie *pcie)break ;case IPROC_PCIE_PAXB : regs = iproc_pcie_reg_paxb; - pcie->iproc_cfg_read = true; pcie->has_apb_err_disable = true;if (pcie->need_ob_cfg) { pcie->ob_map = paxb_ob_map;
@@ -1356,6 +1355,7 @@ static int iproc_pcie_rev_init(struct iproc_pcie *pcie)break ;case IPROC_PCIE_PAXB_V2 : regs = iproc_pcie_reg_paxb_v2; + pcie->iproc_cfg_read = true; pcie->has_apb_err_disable = true;if (pcie->need_ob_cfg) { pcie->ob_map = paxb_v2_ob_map;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 322/671 ARM: dts: logicpd-som-lv: Fix MMC1 card detect
In reply to Sasha LevinFrom: Adam Ford <[email protected]>
[ Upstream commit 6a38df676a0a06bfc7ff8607ac62ccd6d95969ad ]
The card detect pin was incorrectly using IRQ_TYPE_LEVEL_LOW instead of GPIO_ACTIVE_LOW when reading the state of the CD pin.
This was previosly fixed on Torpedo, but missed on the SOM-LV
--- arch/arm/boot/dts/logicpd-som-lv-baseboard.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/logicpd-som-lv-baseboard.dtsi +1 -1
@@ -153,7 +153,7 @@ pinctrl-names = "default"; pinctrl-0 = <&mmc1_pins>; wp-gpios = <&gpio4 30 GPIO_ACTIVE_HIGH>; /* gpio_126 */ - cd-gpios = <&gpio4 14 IRQ_TYPE_LEVEL_LOW>; /* gpio_110 */ + cd-gpios = <&gpio4 14 GPIO_ACTIVE_LOW>; /* gpio_110 */ vmmc-supply = <&vmmc1>; bus-width = <4>; cap-power-off-card;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 323/671 packet: in recvmsg msg_name return at least sizeof sockaddr_ll
In reply to Sasha LevinFrom: Willem de Bruijn <[email protected]>
[ Upstream commit b2cf86e1563e33a14a1c69b3e508d15dc12f804c ]
Packet send checks that msg_name is at least sizeof sockaddr_ll. Packet recv must return at least this length, so that its output can be passed unmodified to packet send.
This ceased to be true since adding support for lladdr longer than sll_addr. Since, the return value uses true address length.
Always return at least sizeof sockaddr_ll, even if address length is shorter. Zero the padding bytes.
Change v1->v2: do not overwrite zeroed padding again. use copy_len.
--- net/packet/af_packet.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
net/packet/af_packet.c +11 -2
@@ -3371,20 +3371,29 @@ static int packet_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,sock_recv_ts_and_drops (msg, sk, skb);if (msg->msg_name) { +int copy_len; +/* If the address length field is there to be filled * in, we fill it in now. */ if (sock->type ==SOCK_PACKET ) {__sockaddr_check_size (sizeof (struct sockaddr_pkt )); msg->msg_namelen =sizeof (struct sockaddr_pkt ); + copy_len = msg->msg_namelen; }else {struct sockaddr_ll *sll = &PACKET_SKB_CB (skb)->sa.ll; msg->msg_namelen = sll->sll_halen + offsetof(struct sockaddr_ll , sll_addr); + copy_len = msg->msg_namelen; +if (msg->msg_namelen <sizeof (struct sockaddr_ll )) { +memset (msg->msg_name + + offsetof(struct sockaddr_ll , sll_addr), +0 ,sizeof (sll->sll_addr)); + msg->msg_namelen =sizeof (struct sockaddr_ll ); + } } -memcpy (msg->msg_name, &PACKET_SKB_CB (skb)->sa, - msg->msg_namelen); +memcpy (msg->msg_name, &PACKET_SKB_CB (skb)->sa, copy_len); }if (pkt_sk (sk)->auxdata) {
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 324/671 ASoC: fix valid stream condition
In reply to Sasha LevinFrom: Jerome Brunet <[email protected]>
[ Upstream commit 6a7c59c6d9f3b280e81d7a04bbe4e55e90152dce ]
A stream may specify a rate range using 'rate_min' and 'rate_max', so a stream may be valid and not specify any rates. However, as stream cannot be valid and not have any channel. Let's use this condition instead to determine if a stream is valid or not.
--- sound/soc/soc-pcm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/soc-pcm.c +2 -2
@@ -42,8 +42,8 @@ static bool snd_soc_dai_stream_valid(struct snd_soc_dai *dai, int stream)else codec_stream = &dai->driver->capture; -/* If the codec specifies any rate at all, it supports the stream. */ -return codec_stream->rates; +/* If the codec specifies any channels at all, it supports the stream */ +return codec_stream->channels_min; }/**
Signature · 6 lines
2.20.1 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Sasha Levin
maintainerPATCH 325/671 usb: gadget: fsl: fix link error against usb-gadget module
In reply to Sasha LevinFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 2100e3ca3676e894fa48b8f6f01d01733387fe81 ]
The dependency to ensure this driver links correctly fails since it can not be a loadable module:
drivers/usb/phy/phy-fsl-usb.o: In function `fsl_otg_set_peripheral':
phy-fsl-usb.c:(.text+0x2224): undefined reference to `usb_gadget_vbus_disconnect'
Make the option 'tristate' so it can work correctly.
--- drivers/usb/phy/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/phy/Kconfig +1 -1
@@ -20,7 +20,7 @@ config AB8500_USB in host mode, low speed. config FSL_USB2_OTG - bool "Freescale USB OTG Transceiver Driver" + tristate "Freescale USB OTG Transceiver Driver" depends on USB_EHCI_FSL && USB_FSL_USB2 && USB_OTG_FSM=y && PM depends on USB_GADGET || !USB_GADGET # if USB_GADGET=m, this can't be 'y' select USB_PHY
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 326/671 dwc2: gadget: Fix completed transfer size calculation in DDMA
In reply to Sasha LevinFrom: Minas Harutyunyan <[email protected]>
[ Upstream commit 5acb4b970184d189d901192d075997c933b82260 ]
Fix calculation of transfer size on completion in function dwc2_gadget_get_xfersize_ddma().
Added increment of descriptor pointer to move to next descriptor in the loop.
--- drivers/usb/dwc2/gadget.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/dwc2/gadget.c +1 -0
@@ -2230,6 +2230,7 @@ static unsigned int dwc2_gadget_get_xfersize_ddma(struct dwc2_hsotg_ep *hs_ep)if (status &DEV_DMA_STS_MASK )dev_err (hsotg->dev,"descriptor %d closed with %x\n" , i, status &DEV_DMA_STS_MASK ); + desc++; }return bytes_rem;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 327/671 IB/mlx5: Add missing XRC options to QP optional params mask
In reply to Sasha LevinFrom: Jack Morgenstein <[email protected]>
[ Upstream commit 8f4426aa19fcdb9326ac44154a117b1a3a5ae126 ]
The QP transition optional parameters for the various transition for XRC QPs are identical to those for RC QPs.
Many of the XRC QP transition optional parameter bits are missing from the QP optional mask table. These omissions caused failures when doing XRC QP state transitions.
For example, when trying to change the response timer of an XRC receive QP via the RTS2RTS transition, the new timer value was ignored because MLX5_QP_OPTPAR_RNR_TIMEOUT bit was missing from the optional params mask for XRC qps for the RTS2RTS transition.
Fix this by adding the missing XRC optional parameters for all QP transitions to the opt_mask table.
--- drivers/infiniband/hw/mlx5/qp.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
drivers/infiniband/hw/mlx5/qp.c +21 -0
@@ -2598,6 +2598,11 @@ static enum mlx5_qp_optpar opt_mask[MLX5_QP_NUM_STATE][MLX5_QP_NUM_STATE][MLX5_Q [MLX5_QP_ST_UD ] =MLX5_QP_OPTPAR_PKEY_INDEX |MLX5_QP_OPTPAR_Q_KEY | MLX5_QP_OPTPAR_PRI_PORT, + [MLX5_QP_ST_XRC ] =MLX5_QP_OPTPAR_RRE | +MLX5_QP_OPTPAR_RAE | +MLX5_QP_OPTPAR_RWE | +MLX5_QP_OPTPAR_PKEY_INDEX | +MLX5_QP_OPTPAR_PRI_PORT , }, [MLX5_QP_STATE_RTR] = { [MLX5_QP_ST_RC] = MLX5_QP_OPTPAR_ALT_ADDR_PATH |
@@ -2631,6 +2636,12 @@ static enum mlx5_qp_optpar opt_mask[MLX5_QP_NUM_STATE][MLX5_QP_NUM_STATE][MLX5_QMLX5_QP_OPTPAR_RWE | MLX5_QP_OPTPAR_PM_STATE, [MLX5_QP_ST_UD] = MLX5_QP_OPTPAR_Q_KEY, + [MLX5_QP_ST_XRC ] =MLX5_QP_OPTPAR_ALT_ADDR_PATH | +MLX5_QP_OPTPAR_RRE | +MLX5_QP_OPTPAR_RAE | +MLX5_QP_OPTPAR_RWE | +MLX5_QP_OPTPAR_PM_STATE | + MLX5_QP_OPTPAR_RNR_TIMEOUT, }, }, [MLX5_QP_STATE_RTS] = {
@@ -2647,6 +2658,12 @@ static enum mlx5_qp_optpar opt_mask[MLX5_QP_NUM_STATE][MLX5_QP_NUM_STATE][MLX5_Q [MLX5_QP_ST_UD ] =MLX5_QP_OPTPAR_Q_KEY |MLX5_QP_OPTPAR_SRQN | MLX5_QP_OPTPAR_CQN_RCV, + [MLX5_QP_ST_XRC ] =MLX5_QP_OPTPAR_RRE | +MLX5_QP_OPTPAR_RAE | +MLX5_QP_OPTPAR_RWE | +MLX5_QP_OPTPAR_RNR_TIMEOUT | +MLX5_QP_OPTPAR_PM_STATE | + MLX5_QP_OPTPAR_ALT_ADDR_PATH, }, }, [MLX5_QP_STATE_SQER] = {
@@ -2658,6 +2675,10 @@ static enum mlx5_qp_optpar opt_mask[MLX5_QP_NUM_STATE][MLX5_QP_NUM_STATE][MLX5_QMLX5_QP_OPTPAR_RWE |MLX5_QP_OPTPAR_RAE | MLX5_QP_OPTPAR_RRE, + [MLX5_QP_ST_XRC ] =MLX5_QP_OPTPAR_RNR_TIMEOUT | +MLX5_QP_OPTPAR_RWE | +MLX5_QP_OPTPAR_RAE | + MLX5_QP_OPTPAR_RRE, }, }, };
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 328/671 RDMA/rxe: Consider skb reserve space based on netdev of GID
In reply to Sasha LevinFrom: Parav Pandit <[email protected]>
[ Upstream commit 3bf3e2b881c1412d0329ce9376dfe1518489b8fc ]
Always consider the skb reserve space based on netdevice of the GID attribute, regardless of vlan or non vlan netdevice.
--- drivers/infiniband/sw/rxe/rxe_net.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/infiniband/sw/rxe/rxe_net.c +2 -1
@@ -533,8 +533,9 @@ struct sk_buff *rxe_init_packet(struct rxe_dev *rxe, struct rxe_av *av,if (unlikely (!skb)) goto out; -skb_reserve (skb, hdr_len +LL_RESERVED_SPACE (rxe->ndev)); +skb_reserve (skb, hdr_len +LL_RESERVED_SPACE (ndev)); +/* FIXME: hold reference to this netdev until life of this skb. */ skb->dev = ndev;if (av->network_type ==RDMA_NETWORK_IPV4 ) skb->protocol =htons (ETH_P_IP );
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 329/671 iommu/vt-d: Make kernel parameter igfx_off work with vIOMMU
In reply to Sasha LevinFrom: Lu Baolu <[email protected]>
[ Upstream commit 5daab58043ee2bca861068e2595564828f3bc663 ]
The kernel parameter igfx_off is used by users to disable DMA remapping for the Intel integrated graphic device. It was designed for bare metal cases where a dedicated IOMMU is used for graphic. This doesn't apply to virtual IOMMU case where an include-all IOMMU is used. This makes the kernel parameter work with virtual IOMMU as well.
--- drivers/iommu/intel-iommu.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/iommu/intel-iommu.c +4 -1
@@ -3387,9 +3387,12 @@ static int __init init_dmars(void) iommu_identity_mapping |=IDENTMAP_ALL ;#ifdef CONFIG_INTEL_IOMMU_BROKEN_GFX_WA - iommu_identity_mapping |=IDENTMAP_GFX ; + dmar_map_gfx =0 ;#endif +if (!dmar_map_gfx) + iommu_identity_mapping |=IDENTMAP_GFX ; +check_tylersburg_isoch ();if (iommu_identity_mapping) {
Signature · 6 lines
2.20.1 _______________________________________________ iommu mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/iommu
Sasha Levin
maintainerPATCH 330/671 net: ena: fix swapped parameters when calling ena_com_indirect_table_fill_entry
In reply to Sasha LevinFrom: Sameeh Jubran <[email protected]>
[ Upstream commit 3c6eeff295f01bdf1c6c3addcb0a04c0c6c029e9 ]
second parameter should be the index of the table rather than the value.
--- drivers/net/ethernet/amazon/ena/ena_ethtool.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/amazon/ena/ena_ethtool.c +2 -2
@@ -695,8 +695,8 @@ static int ena_set_rxfh(struct net_device *netdev, const u32 *indir,if (indir) {for (i =0 ; i <ENA_RX_RSS_TABLE_SIZE ; i++) { rc =ena_com_indirect_table_fill_entry (ena_dev, -ENA_IO_RXQ_IDX (indir[i]), - i); + i, +ENA_IO_RXQ_IDX (indir[i]));if (unlikely (rc)) {netif_err (adapter, drv, netdev,"Cannot fill indirect table (index is too large)\n" );
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 331/671 net: ena: fix: Free napi resources when ena_up() fails
In reply to Sasha LevinFrom: Sameeh Jubran <[email protected]>
[ Upstream commit b287cdbd1cedfc9606682c6e02b58d00ff3a33ae ]
ena_up() calls ena_init_napi() but does not call ena_del_napi() in case of failure. This causes a segmentation fault upon rmmod when netif_napi_del() is called. Fix this bug by calling ena_del_napi() before returning error from ena_up().
--- drivers/net/ethernet/amazon/ena/ena_netdev.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/amazon/ena/ena_netdev.c +1 -0
@@ -1800,6 +1800,7 @@ static int ena_up(struct ena_adapter *adapter) err_setup_tx:ena_free_io_irq (adapter); err_req_irq: +ena_del_napi (adapter);return rc; }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 332/671 net: ena: fix incorrect test of supported hash function
In reply to Sasha LevinFrom: Sameeh Jubran <[email protected]>
[ Upstream commit d3cfe7ddbc3dfbb9b201615b7fef8fd66d1b5fe8 ]
ena_com_set_hash_function() tests if a hash function is supported by the device before setting it.
The test returns the opposite result than needed. Reverse the condition to return the correct value.
Also use the BIT macro instead of inline shift.
--- drivers/net/ethernet/amazon/ena/ena_com.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/amazon/ena/ena_com.c +1 -1
@@ -2008,7 +2008,7 @@ int ena_com_set_hash_function(struct ena_com_dev *ena_dev)if (unlikely (ret))return ret; -if (get_resp.u.flow_hash_func.supported_func & (1 << rss->hash_func)) { +if (!(get_resp.u.flow_hash_func.supported_func &BIT (rss->hash_func))) {pr_err ("Func hash %d isn't supported by device, abort\n" , rss->hash_func);return -EOPNOTSUPP ;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 333/671 net: ena: fix ena_com_fill_hash_function() implementation
In reply to Sasha LevinFrom: Sameeh Jubran <[email protected]>
[ Upstream commit 11bd7a00c0d8ffe33d1e926f8e789b4aea787186 ]
ena_com_fill_hash_function() didn't configure the rss->hash_func.
--- drivers/net/ethernet/amazon/ena/ena_com.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/amazon/ena/ena_com.c +1 -0
@@ -2093,6 +2093,7 @@ int ena_com_fill_hash_function(struct ena_com_dev *ena_dev,return -EINVAL ; } + rss->hash_func = func; rc =ena_com_set_hash_function (ena_dev);/* Restore the old function */
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 334/671 dmaengine: tegra210-adma: restore channel status
In reply to Sasha LevinFrom: Sameer Pujar <[email protected]>
[ Upstream commit f33e7bb3eb922618612a90f0a828c790e8880773 ]
Status of ADMA channel registers is not saved and restored during system suspend. During active playback if system enters suspend, this results in wrong state of channel registers during system resume and playback fails to resume properly. Fix this by saving following channel registers in runtime suspend and restore during runtime resume.
* ADMA_CH_LOWER_SRC_ADDR
* ADMA_CH_LOWER_TRG_ADDR
* ADMA_CH_FIFO_CTRL
* ADMA_CH_CONFIG
* ADMA_CH_CTRL
* ADMA_CH_CMD
* ADMA_CH_TC
Runtime PM calls will be inovked during system resume path if a playback or capture needs to be resumed. Hence above changes work fine for system suspend case.
--- drivers/dma/tegra210-adma.c | 46 ++++++++++++++++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-)
drivers/dma/tegra210-adma.c +45 -1
@@ -98,6 +98,7 @@ struct tegra_adma_chan_regs {unsigned int src_addr;unsigned int trg_addr;unsigned int fifo_ctrl; +unsigned int cmd;unsigned int tc; };
@@ -127,6 +128,7 @@ struct tegra_adma_chan {enum dma_transfer_direction sreq_dir;unsigned int sreq_index;bool sreq_reserved; +struct tegra_adma_chan_regs ch_regs;/* Transfer count and position info */ unsigned int tx_buf_count;
@@ -635,8 +637,30 @@ static struct dma_chan *tegra_dma_of_xlate(struct of_phandle_args *dma_spec,static int tegra_adma_runtime_suspend (struct device *dev) {struct tegra_adma *tdma =dev_get_drvdata (dev); +struct tegra_adma_chan_regs *ch_reg; +struct tegra_adma_chan *tdc; +int i; tdma->global_cmd =tdma_read (tdma,ADMA_GLOBAL_CMD ); +if (!tdma->global_cmd) + goto clk_disable; + +for (i =0 ; i < tdma->nr_channels; i++) { + tdc = &tdma->channels[i]; + ch_reg = &tdc->ch_regs; + ch_reg->cmd =tdma_ch_read (tdc,ADMA_CH_CMD ); +/* skip if channel is not active */ +if (!ch_reg->cmd) +continue ; + ch_reg->tc =tdma_ch_read (tdc,ADMA_CH_TC ); + ch_reg->src_addr =tdma_ch_read (tdc,ADMA_CH_LOWER_SRC_ADDR ); + ch_reg->trg_addr =tdma_ch_read (tdc,ADMA_CH_LOWER_TRG_ADDR ); + ch_reg->ctrl =tdma_ch_read (tdc,ADMA_CH_CTRL ); + ch_reg->fifo_ctrl =tdma_ch_read (tdc,ADMA_CH_FIFO_CTRL ); + ch_reg->config =tdma_ch_read (tdc,ADMA_CH_CONFIG ); + } + +clk_disable:clk_disable_unprepare (tdma->ahub_clk);return 0 ;
@@ -645,7 +669,9 @@ static int tegra_adma_runtime_suspend(struct device *dev)static int tegra_adma_runtime_resume (struct device *dev) {struct tegra_adma *tdma =dev_get_drvdata (dev); -int ret; +struct tegra_adma_chan_regs *ch_reg; +struct tegra_adma_chan *tdc; +int ret, i; ret =clk_prepare_enable (tdma->ahub_clk);if (ret) {
@@ -654,6 +680,24 @@ static int tegra_adma_runtime_resume(struct device *dev) }tdma_write (tdma,ADMA_GLOBAL_CMD , tdma->global_cmd); +if (!tdma->global_cmd) +return 0 ; + +for (i =0 ; i < tdma->nr_channels; i++) { + tdc = &tdma->channels[i]; + ch_reg = &tdc->ch_regs; +/* skip if channel was not active earlier */ +if (!ch_reg->cmd) +continue ; +tdma_ch_write (tdc,ADMA_CH_TC , ch_reg->tc); +tdma_ch_write (tdc,ADMA_CH_LOWER_SRC_ADDR , ch_reg->src_addr); +tdma_ch_write (tdc,ADMA_CH_LOWER_TRG_ADDR , ch_reg->trg_addr); +tdma_ch_write (tdc,ADMA_CH_CTRL , ch_reg->ctrl); +tdma_ch_write (tdc,ADMA_CH_FIFO_CTRL , ch_reg->fifo_ctrl); +tdma_ch_write (tdc,ADMA_CH_CONFIG , ch_reg->config); +tdma_ch_write (tdc,ADMA_CH_CMD , ch_reg->cmd); + } +return 0 ; }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 335/671 watchdog: rtd119x_wdt: Fix remove function
In reply to Sasha LevinFrom: Guenter Roeck <[email protected]>
[ Upstream commit 8dd29f19512cc75ee470d7bb8ec86af199de23a8 ]
The driver registers the watchdog with devm_watchdog_register_device() but still calls watchdog_unregister_device() on remove. Since clocks have to be stopped when removing the driver, after the watchdog device has been unregistered, we can not drop the call to watchdog_unregister_device(). Use watchdog_register_device() to register the watchdog.
--- drivers/watchdog/rtd119x_wdt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/watchdog/rtd119x_wdt.c +1 -1
@@ -135,7 +135,7 @@ static int rtd119x_wdt_probe(struct platform_device *pdev)rtd119x_wdt_set_timeout (&data->wdt_dev, data->wdt_dev.timeout);rtd119x_wdt_stop (&data->wdt_dev); - ret =devm_watchdog_register_device (&pdev->dev, &data->wdt_dev); + ret =watchdog_register_device (&data->wdt_dev);if (ret) {clk_disable_unprepare (data->clk);clk_put (data->clk);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 336/671 mmc: core: fix possible use after free of host
In reply to Sasha LevinFrom: Pan Bian <[email protected]>
[ Upstream commit 8e1943af2986db42bee2b8dddf49a36cdb2e9219 ]
In the function mmc_alloc_host, the function put_device is called to release allocated resources when mmc_gpio_alloc fails. Finally, the function pointed by host->class_dev.class->dev_release (i.e., mmc_host_classdev_release) is used to release resources including the host structure. However, after put_device, host is used and released again. Resulting in a use-after-free bug.
--- drivers/mmc/core/host.c | 2 -- 1 file changed, 2 deletions(-)
drivers/mmc/core/host.c +0 -2
@@ -385,8 +385,6 @@ struct mmc_host *mmc_alloc_host(int extra, struct device *dev)if (mmc_gpio_alloc (host)) {put_device (&host->class_dev); -ida_simple_remove (&mmc_host_ida, host->index); -kfree (host);return NULL ; }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 337/671 lightnvm: pblk: fix lock order in pblk_rb_tear_down_check
In reply to Sasha LevinFrom: Igor Konopko <[email protected]>
[ Upstream commit 486b5aac85f6ec0b2df3e82a6a629d5eb7804db5 ]
In pblk_rb_tear_down_check() the spinlock functions are not called in proper order.
--- drivers/lightnvm/pblk-rb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/lightnvm/pblk-rb.c +1 -1
@@ -784,8 +784,8 @@ int pblk_rb_tear_down_check(struct pblk_rb *rb) } out: -spin_unlock (&rb->w_lock);spin_unlock_irq (&rb->s_lock); +spin_unlock (&rb->w_lock);return ret; }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 338/671 ath10k: Fix encoding for protected management frames
In reply to Sasha LevinFrom: Rakesh Pillai <[email protected]>
[ Upstream commit 42f1bc43e6a97b9ddbe976eba9bd05306c990c75 ]
Currently the protected management frames are
not appended with the MIC_LEN which results in
the protected management frames being encoded
incorrectly.
Add the extra space at the end of the protected
management frames to fix this encoding error for
the protected management frames.
Tested HW: WCN3990
Tested FW: WLAN.HL.3.1-00784-QCAHLSWMTPLZ-1
--- drivers/net/wireless/ath/ath10k/wmi-tlv.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/ath10k/wmi-tlv.c +3 -1
@@ -2692,8 +2692,10 @@ ath10k_wmi_tlv_op_gen_mgmt_tx_send(struct ath10k *ar, struct sk_buff *msdu,if ((ieee80211_is_action (hdr->frame_control) ||ieee80211_is_deauth (hdr->frame_control) ||ieee80211_is_disassoc (hdr->frame_control)) && -ieee80211_has_protected (hdr->frame_control)) +ieee80211_has_protected (hdr->frame_control)) { +skb_put (msdu,IEEE80211_CCMP_MIC_LEN ); buf_len +=IEEE80211_CCMP_MIC_LEN ; + } buf_len =min_t (u32, buf_len,WMI_TLV_MGMT_TX_FRAME_MAX_LEN ); buf_len =round_up (buf_len,4 );
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 339/671 afs: Fix the afs.cell and afs.volume xattr handlers
In reply to Sasha LevinFrom: David Howells <[email protected]>
[ Upstream commit c73aa4102f5b9f261a907c3b3df94cd2c478504d ]
Fix the ->get handlers for the afs.cell and afs.volume xattrs to pass the source data size to memcpy() rather than target buffer size.
Overcopying the source data occasionally causes the kernel to oops.
--- fs/afs/xattr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/afs/xattr.c +2 -2
@@ -50,7 +50,7 @@ static int afs_xattr_get_cell(const struct xattr_handler *handler,return namelen;if (namelen > size)return -ERANGE ; -memcpy (buffer, cell->name, size); +memcpy (buffer, cell->name, namelen);return namelen; }
@@ -104,7 +104,7 @@ static int afs_xattr_get_volume(const struct xattr_handler *handler,return namelen;if (namelen > size)return -ERANGE ; -memcpy (buffer, volname, size); +memcpy (buffer, volname, namelen);return namelen; }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 340/671 vfio/mdev: Avoid release parent reference during error path
In reply to Sasha LevinFrom: Parav Pandit <[email protected]>
[ Upstream commit 60e7f2c3fe9919cee9534b422865eed49f4efb15 ]
During mdev parent registration in mdev_register_device(), if parent device is duplicate, it releases the reference of existing parent device.
This is incorrect. Existing parent device should not be touched.
--- drivers/vfio/mdev/mdev_core.c | 1 + 1 file changed, 1 insertion(+)
drivers/vfio/mdev/mdev_core.c +1 -0
@@ -182,6 +182,7 @@ int mdev_register_device(struct device *dev, const struct mdev_parent_ops *ops)/* Check for duplicate */ parent =__find_parent_device (dev);if (parent) { + parent =NULL ; ret = -EEXIST ; goto add_dev_err; }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 341/671 vfio/mdev: Follow correct remove sequence
In reply to Sasha LevinFrom: Parav Pandit <[email protected]>
[ Upstream commit a6d6f4f160f76d840e59affe664b8d3159e23056 ]
mdev_remove_sysfs_files() should follow exact mirror sequence of a create, similar to what is followed in error unwinding path of mdev_create_sysfs_files().
--- drivers/vfio/mdev/mdev_sysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/vfio/mdev/mdev_sysfs.c +1 -1
@@ -280,7 +280,7 @@ int mdev_create_sysfs_files(struct device *dev, struct mdev_type *type)void mdev_remove_sysfs_files (struct device *dev,struct mdev_type *type) { +sysfs_remove_files (&dev->kobj, mdev_device_attrs);sysfs_remove_link (&dev->kobj,"mdev_type" );sysfs_remove_link (type->devices_kobj,dev_name (dev)); -sysfs_remove_files (&dev->kobj, mdev_device_attrs); }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 342/671 vfio/mdev: Fix aborting mdev child device removal if one fails
In reply to Sasha LevinFrom: Parav Pandit <[email protected]>
[ Upstream commit 6093e348a5e2475c5bb2e571346460f939998670 ]
device_for_each_child() stops executing callback function for remaining child devices, if callback hits an error.
Each child mdev device is independent of each other.
While unregistering parent device, mdev core must remove all child mdev devices.
Therefore, mdev_device_remove_cb() always returns success so that device_for_each_child doesn't abort if one child removal hits error.
While at it, improve remove and unregister functions for below simplicity.
There isn't need to pass forced flag pointer during mdev parent removal which invokes mdev_device_remove(). So simplify the flow.
mdev_device_remove() is called from two paths.
1. mdev_unregister_driver()
mdev_device_remove_cb()
mdev_device_remove()
2. remove_store()
mdev_device_remove()
--- drivers/vfio/mdev/mdev_core.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/vfio/mdev/mdev_core.c +4 -6
@@ -150,10 +150,10 @@ static int mdev_device_remove_ops(struct mdev_device *mdev, bool force_remove)static int mdev_device_remove_cb (struct device *dev,void *data) { -if (!dev_is_mdev (dev)) -return 0 ; +if (dev_is_mdev (dev)) +mdev_device_remove (dev, true); -return mdev_device_remove (dev, data ? *(bool *)data : true); +return 0 ; }/*
@@ -241,7 +241,6 @@ EXPORT_SYMBOL(mdev_register_device);void mdev_unregister_device (struct device *dev) {struct mdev_parent *parent; -bool force_remove = true;mutex_lock (&parent_list_lock); parent =__find_parent_device (dev);
@@ -255,8 +254,7 @@ void mdev_unregister_device(struct device *dev)list_del (&parent->next);class_compat_remove_link (mdev_bus_compat_class, dev,NULL ); -device_for_each_child (dev, (void *)&force_remove, - mdev_device_remove_cb); +device_for_each_child (dev,NULL , mdev_device_remove_cb);parent_remove_sysfs_files (parent);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 343/671 l2tp: Fix possible NULL pointer dereference
In reply to Sasha LevinFrom: YueHaibing <[email protected]>
[ Upstream commit 638a3a1e349ddf5b82f222ff5cb3b4f266e7c278 ]
BUG: unable to handle kernel NULL pointer dereference at 0000000000000128 PGD 0 P4D 0 Oops: 0000 [#1 CPU: 0 PID: 5697 Comm: modprobe Tainted: G W 5.1.0-rc7+ #1 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.9.3-0-ge2fc41e-prebuilt.qemu-project.org 04/01/2014 RIP: 0010:__lock_acquire+0x53/0x10b0 Code: 8b 1c 25 40 5e 01 00 4c 8b 6d 10 45 85 e4 0f 84 bd 06 00 00 44 8b 1d 7c d2 09 02 49 89 fe 41 89 d2 45 85 db 0f 84 47 02 00 00 <48> 81 3f a0 05 70 83 b8 00 00 00 00 44 0f 44 c0 83 fe 01 0f 86 3a RSP: 0018:ffffc90001c07a28 EFLAGS: 00010002 RAX: 0000000000000000 RBX: ffff88822f038440 RCX: 0000000000000000 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000128 RBP: ffffc90001c07a88 R08: 0000000000000001 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000001 R12: 0000000000000001 R13: 0000000000000000 R14: 0000000000000128 R15: 0000000000000000 FS: 00007fead0811540(0000) GS:ffff888237a00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000000128 CR3: 00000002310da000 CR4: 00000000000006f0 Call Trace: ? __lock_acquire+0x24e/0x10b0 lock_acquire+0xdf/0x230 ? flush_workqueue+0x71/0x530 flush_workqueue+0x97/0x530 ? flush_workqueue+0x71/0x530 l2tp_exit_net+0x170/0x2b0 [l2tp_core ? l2tp_exit_net+0x93/0x2b0 [l2tp_core ops_exit_list.isra.6+0x36/0x60 unregister_pernet_operations+0xb8/0x110 unregister_pernet_device+0x25/0x40 l2tp_init+0x55/0x1000 [l2tp_core ? 0xffffffffa018d000 do_one_initcall+0x6c/0x3cc ? do_init_module+0x22/0x1f1 ? rcu_read_lock_sched_held+0x97/0xb0 ? kmem_cache_alloc_trace+0x325/0x3b0 do_init_module+0x5b/0x1f1 load_module+0x1db1/0x2690 ? m_show+0x1d0/0x1d0 __do_sys_finit_module+0xc5/0xd0 __x64_sys_finit_module+0x15/0x20 do_syscall_64+0x6b/0x1d0 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x7fead031a839 Code: 00 f3 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 1f f6 2c 00 f7 d8 64 89 01 48 RSP: 002b:00007ffe8d9acca8 EFLAGS: 00000246 ORIG_RAX: 0000000000000139 RAX: ffffffffffffffda RBX: 0000560078398b80 RCX: 00007fead031a839 RDX: 0000000000000000 RSI: 000056007659dc2e RDI: 0000000000000003 RBP: 000056007659dc2e R08: 0000000000000000 R09: 0000560078398b80 R10: 0000000000000003 R11: 0000000000000246 R12: 0000000000000000 R13: 00005600783a04a0 R14: 0000000000040000 R15: 0000560078398b80 Modules linked in: l2tp_core(+) e1000 ip_tables ipv6 [last unloaded: l2tp_core CR2: 0000000000000128 ---[ end trace 8322b2b8bf83f8e1
If alloc_workqueue fails in l2tp_init, l2tp_net_ops is unregistered on failure path. Then l2tp_exit_net is called which will flush NULL workqueue, this patch add a NULL check to fix it.
--- net/l2tp/l2tp_core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/l2tp/l2tp_core.c +2 -1
@@ -1735,7 +1735,8 @@ static __net_exit void l2tp_exit_net(struct net *net) }rcu_read_unlock_bh (); -flush_workqueue (l2tp_wq); +if (l2tp_wq) +flush_workqueue (l2tp_wq);rcu_barrier ();for (hash =0 ; hash <L2TP_HASH_SIZE_2 ; hash++)
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 344/671 ALSA: aica: Fix a long-time build breakage
In reply to Sasha LevinFrom: Takashi Iwai <[email protected]>
[ Upstream commit 534420c6ff87d3052540f1fd346e0adcff440819 ]
The build of aica sound driver has been broken since the timer API conversion and some code rewrite. This patch fixes the breakage by using the common substream field, as well as a bit cleaning up wrt the timer handling in the code.
--- sound/sh/aica.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-)
sound/sh/aica.c +4 -10
@@ -303,7 +303,7 @@ static void aica_period_elapsed(struct timer_list *t) {struct snd_card_aica *dreamcastcard =from_timer (dreamcastcard, t, timer); -struct snd_pcm_substream *substream = dreamcastcard->timer_substream; +struct snd_pcm_substream *substream = dreamcastcard->substream;/*timer function - so cannot sleep */ int play_period;struct snd_pcm_runtime *runtime;
@@ -335,13 +335,6 @@ static void spu_begin_dma(struct snd_pcm_substream *substream) dreamcastcard = substream->pcm->private_data;/*get the queue to do the work */ schedule_work (&(dreamcastcard->spu_dma_work)); -/* Timer may already be running */ -if (unlikely (dreamcastcard->timer_substream)) { -mod_timer (&dreamcastcard->timer, jiffies +4 ); -return ; - } -timer_setup (&dreamcastcard->timer, aica_period_elapsed,0 ); - dreamcastcard->timer_substream = substream;mod_timer (&dreamcastcard->timer, jiffies +4 ); }
@@ -379,8 +372,8 @@ static int snd_aicapcm_pcm_close(struct snd_pcm_substream {struct snd_card_aica *dreamcastcard = substream->pcm->private_data;flush_work (&(dreamcastcard->spu_dma_work)); -if (dreamcastcard->timer_substream) -del_timer (&dreamcastcard->timer); +del_timer (&dreamcastcard->timer); + dreamcastcard->substream =NULL ;kfree (dreamcastcard->channel);spu_disable ();return 0 ;
@@ -615,6 +608,7 @@ static int snd_aica_probe(struct platform_device *devptr) "Yamaha AICA Super Intelligent Sound Processor for SEGA Dreamcast");/* Prepare to use the queue */ INIT_WORK (&(dreamcastcard->spu_dma_work), run_spu_dma); +timer_setup (&dreamcastcard->timer, aica_period_elapsed,0 );/* Load the PCM 'chip' */ err =snd_aicapcmchip (dreamcastcard,0 );if (unlikely (err <0 ))
Signature · 6 lines
2.20.1 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Sasha Levin
maintainerPATCH 345/671 media: omap_vout: potential buffer overflow in vidioc_dqbuf()
In reply to Sasha LevinFrom: Dan Carpenter <[email protected]>
[ Upstream commit dd6e2a981bfe83aa4a493143fd8cf1edcda6c091 ]
The "b->index" is a u32 the comes from the user in the ioctl. It hasn't been checked. We aren't supposed to use it but we're instead supposed to use the value that gets written to it when we call videobuf_dqbuf().
The videobuf_dqbuf() first memsets it to zero and then re-initializes it inside the videobuf_status() function. It's this final value which we want.
Hans Verkuil pointed out that we need to check the return from videobuf_dqbuf(). I ended up doing a little cleanup related to that as well.
--- drivers/media/platform/omap/omap_vout.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-)
drivers/media/platform/omap/omap_vout.c +6 -9
@@ -1527,23 +1527,20 @@ static int vidioc_dqbuf(struct file *file, void *fh, struct v4l2_buffer *b)unsigned long size;struct videobuf_buffer *vb; - vb = q->bufs[b->index]; -if (!vout->streaming)return -EINVAL ; -if (file->f_flags &O_NONBLOCK ) -/* Call videobuf_dqbuf for non blocking mode */ - ret =videobuf_dqbuf (q, (struct v4l2_buffer *)b,1 ); -else -/* Call videobuf_dqbuf for blocking mode */ - ret =videobuf_dqbuf (q, (struct v4l2_buffer *)b,0 ); + ret =videobuf_dqbuf (q, b, !!(file->f_flags &O_NONBLOCK )); +if (ret) +return ret; + + vb = q->bufs[b->index]; addr = (unsigned long ) vout->buf_phy_addr[vb->i]; size = (unsigned long ) vb->size;dma_unmap_single (vout->vid_dev->v4l2_dev.dev, addr, size,DMA_TO_DEVICE ); -return ret; +return 0 ; }static int vidioc_streamon (struct file *file,void *fh,enum v4l2_buf_type i)
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 346/671 media: davinci/vpbe: array underflow in vpbe_enum_outputs()
In reply to Sasha LevinFrom: Dan Carpenter <[email protected]>
[ Upstream commit b72845ee5577b227131b1fef23f9d9a296621d7b ]
In vpbe_enum_outputs() we check if (temp_index >= cfg->num_outputs) but the problem is that "temp_index" can be negative. This patch changes the types to unsigned to address this array underflow bug.
--- drivers/media/platform/davinci/vpbe.c | 2 +- include/media/davinci/vpbe.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/media/platform/davinci/vpbe.c +1 -1
@@ -126,7 +126,7 @@ static int vpbe_enum_outputs(struct vpbe_device *vpbe_dev, struct v4l2_output *output) {struct vpbe_config *cfg = vpbe_dev->cfg; -int temp_index = output->index; +unsigned int temp_index = output->index;if (temp_index >= cfg->num_outputs)return -EINVAL ;
include/media/davinci/vpbe.h +1 -1
@@ -92,7 +92,7 @@ struct vpbe_config {struct encoder_config_info *ext_encoders;/* amplifier information goes here */ struct amp_config_info *amp; -int num_outputs; +unsigned int num_outputs;/* Order is venc outputs followed by LCD and then external encoders */ struct vpbe_output *outputs; };
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 347/671 platform/x86: alienware-wmi: printing the wrong error code
In reply to Sasha LevinFrom: Dan Carpenter <[email protected]>
[ Upstream commit 6d1f8b3d75419a8659ac916a1e9543bb3513a882 ]
The "out_data" variable is uninitialized at the point. Originally, this used to print "status" instead and that seems like the correct thing to print.
--- drivers/platform/x86/alienware-wmi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/platform/x86/alienware-wmi.c +1 -1
@@ -587,7 +587,7 @@ static ssize_t show_hdmi_source(struct device *dev,return scnprintf (buf,PAGE_SIZE ,"input [gpu] unknown\n" ); } -pr_err ("alienware-wmi: unknown HDMI source status: %d\n" , out_data); +pr_err ("alienware-wmi: unknown HDMI source status: %u\n" , status);return scnprintf (buf,PAGE_SIZE ,"input gpu [unknown]\n" ); }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 348/671 crypto: caam - fix caam_dump_sg that iterates through scatterlist
In reply to Sasha LevinFrom: Iuliana Prodan <[email protected]>
[ Upstream commit 8c65d35435e8cbfdf953cafe5ebe3648ee9276a2 ]
Fix caam_dump_sg by correctly determining the next scatterlist entry in the list.
--- drivers/crypto/caam/error.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/crypto/caam/error.c +1 -1
@@ -22,7 +22,7 @@ void caam_dump_sg(const char *level, const char *prefix_str, int prefix_type,size_t len;void *buf; -for (it = sg; it && tlen >0 ; it =sg_next (sg)) { +for (it = sg; it && tlen >0 ; it =sg_next (it)) {/* * make sure the scatterlist's page * has a valid virtual memory mapping
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 349/671 netfilter: ebtables: CONFIG_COMPAT: reject trailing data after last rule
In reply to Sasha LevinFrom: Florian Westphal <[email protected]>
[ Upstream commit 680f6af5337c98d116e4f127cea7845339dba8da ]
If userspace provides a rule blob with trailing data after last target, we trigger a splat, then convert ruleset to 64bit format (with trailing data), then pass that to do_replace_finish() which then returns -EINVAL.
Erroring out right away avoids the splat plus unneeded translation and error unwind.
--- net/bridge/netfilter/ebtables.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/bridge/netfilter/ebtables.c +3 -1
@@ -2165,7 +2165,9 @@ static int compat_copy_entries(unsigned char *data, unsigned int size_user,if (ret <0 )return ret; -WARN_ON (size_remaining); +if (size_remaining) +return -EINVAL ; +return state->buf_kern_offset; }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 350/671 pwm: meson: Consider 128 a valid pre-divider
In reply to Sasha LevinFrom: Martin Blumenstingl <[email protected]>
[ Upstream commit 51496e4446875726d50a5617a6e0e0dabbc2e6da ]
The pre-divider allows configuring longer PWM periods compared to using the input clock directly. The pre-divider is 7 bit wide, meaning it's maximum value is 128 (the register value is off-by-one: 0x7f or 127).
Change the loop to also allow for the maximum possible value to be considered valid.
--- drivers/pwm/pwm-meson.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pwm/pwm-meson.c +2 -2
@@ -188,7 +188,7 @@ static int meson_pwm_calc(struct meson_pwm *meson,do_div (fin_ps, fin_freq);/* Calc pre_div with the period */ -for (pre_div =0 ; pre_div <MISC_CLK_DIV_MASK ; pre_div++) { +for (pre_div =0 ; pre_div <=MISC_CLK_DIV_MASK ; pre_div++) { cnt =DIV_ROUND_CLOSEST_ULL ((u64 )period *1000 , fin_ps * (pre_div +1 )); dev_dbg(meson->chip.dev, "fin_ps=%llu pre_div=%u cnt=%u\n",
@@ -197,7 +197,7 @@ static int meson_pwm_calc(struct meson_pwm *meson,break ; } -if (pre_div ==MISC_CLK_DIV_MASK ) { +if (pre_div >MISC_CLK_DIV_MASK ) {dev_err (meson->chip.dev,"unable to get period pre_div\n" );return -EINVAL ; }
Signature · 7 lines
2.20.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Sasha Levin
maintainerPATCH 351/671 pwm: meson: Don't disable PWM when setting duty repeatedly
In reply to Sasha LevinFrom: Bichao Zheng <[email protected]>
[ Upstream commit a279345807e1e0ae79567a52cfdd9d30c9174a3c ]
There is an abnormally low about 20ms,when setting duty repeatedly. Because setting the duty will disable PWM and then enable. Delete this operation now.
--- drivers/pwm/pwm-meson.c | 5 ----- 1 file changed, 5 deletions(-)
drivers/pwm/pwm-meson.c +0 -5
@@ -325,11 +325,6 @@ static int meson_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,if (state->period != channel->state.period || state->duty_cycle != channel->state.duty_cycle || state->polarity != channel->state.polarity) { -if (channel->state.enabled) { -meson_pwm_disable (meson, pwm->hwpwm); - channel->state.enabled = false; - } -if (state->polarity != channel->state.polarity) {if (state->polarity ==PWM_POLARITY_NORMAL ) meson->inverter_mask |=BIT (pwm->hwpwm);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 352/671 ARM: riscpc: fix lack of keyboard interrupts after irq conversion
In reply to Sasha LevinFrom: Russell King <[email protected]>
[ Upstream commit 63a0666bca9311f35017be454587f3ba903644b8 ]
Fix lack of keyboard interrupts for RiscPC due to incorrect conversion.
--- arch/arm/mach-rpc/irq.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm/mach-rpc/irq.c +2 -1
@@ -118,7 +118,7 @@ extern unsigned char rpc_default_fiq_start, rpc_default_fiq_end;void __init rpc_init_irq (void ) { -unsigned int irq, clr, set =0 ; +unsigned int irq, clr, set;iomd_writeb (0 ,IOMD_IRQMASKA );iomd_writeb (0 ,IOMD_IRQMASKB );
@@ -130,6 +130,7 @@ void __init rpc_init_irq(void)for (irq =0 ; irq <NR_IRQS ; irq++) { clr =IRQ_NOREQUEST ; + set =0 ;if (irq <=6 || (irq >=9 && irq <=15 )) clr |=IRQ_NOPROBE ;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 353/671 nfp: bpf: fix static check error through tightening shift amount adjustment
In reply to Sasha LevinFrom: Jiong Wang <[email protected]>
[ Upstream commit 69e168ebdcfcb87ce7252d4857d570f99996fa27 ]
NFP shift instruction has something special. If shift direction is left then shift amount of 1 to 31 is specified as 32 minus the amount to shift.
But no need to do this for indirect shift which has shift amount be 0. Even after we do this subtraction, shift amount 0 will be turned into 32 which will eventually be encoded the same as 0 because only low 5 bits are encoded, but shift amount be 32 will fail the FIELD_PREP check done later on shift mask (0x1f), due to 32 is out of mask range. Such error has been observed when compiling nfp/bpf/jit.c using gcc 8.3 + O3.
This issue has started when indirect shift support added after which the incoming shift amount to __emit_shf could be 0, therefore it is at that time shift amount adjustment inside __emit_shf should have been tightened.
--- drivers/net/ethernet/netronome/nfp/bpf/jit.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
drivers/net/ethernet/netronome/nfp/bpf/jit.c +12 -1
@@ -326,7 +326,18 @@ __emit_shf(struct nfp_prog *nfp_prog, u16 dst, enum alu_dst_ab dst_ab,return ; } -if (sc ==SHF_SC_L_SHF ) +/* NFP shift instruction has something special. If shift direction is +* left then shift amount of 1 to 31 is specified as 32 minus the amount +* to shift. +* +* But no need to do this for indirect shift which has shift amount be +* 0. Even after we do this subtraction, shift amount 0 will be turned +* into 32 which will eventually be encoded the same as 0 because only +* low 5 bits are encoded, but shift amount be 32 will fail the +* FIELD_PREP check done later on shift mask (0x1f), due to 32 is out of +* mask range. +*/ +if (sc ==SHF_SC_L_SHF && shift) shift =32 - shift; insn = OP_SHF_BASE |
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 354/671 kdb: do a sanity check on the cpu in kdb_per_cpu()
In reply to Sasha LevinFrom: Dan Carpenter <[email protected]>
[ Upstream commit b586627e10f57ee3aa8f0cfab0d6f7dc4ae63760 ]
The "whichcpu" comes from argv[3]. The cpu_online() macro looks up the cpu in a bitmap of online cpus, but if the value is too high then it could read beyond the end of the bitmap and possibly Oops.
--- kernel/debug/kdb/kdb_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/debug/kdb/kdb_main.c +1 -1
@@ -2604,7 +2604,7 @@ static int kdb_per_cpu(int argc, const char **argv) diag =kdbgetularg (argv[3 ], &whichcpu);if (diag)return diag; -if (!cpu_online (whichcpu)) { +if (whichcpu >= nr_cpu_ids || !cpu_online (whichcpu)) {kdb_printf ("cpu %ld is not online\n" , whichcpu);return KDB_BADCPUNUM ; }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 355/671 netfilter: nf_tables: correct NFT_LOGLEVEL_MAX value
In reply to Sasha LevinFrom: Florian Westphal <[email protected]>
[ Upstream commit 92285a079eedfe104a773a7c4293f77a01f456fb ]
should be same as NFT_LOGLEVEL_AUDIT, so use -, not +.
--- include/uapi/linux/netfilter/nf_tables.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/uapi/linux/netfilter/nf_tables.h +1 -1
@@ -1128,7 +1128,7 @@ enum nft_log_level {NFT_LOGLEVEL_AUDIT , __NFT_LOGLEVEL_MAX }; -#define NFT_LOGLEVEL_MAX (__NFT_LOGLEVEL_MAX + 1) +#define NFT_LOGLEVEL_MAX (__NFT_LOGLEVEL_MAX - 1)/** * enum nft_queue_attributes - nf_tables queue expression netlink attributes
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 356/671 backlight: lm3630a: Return 0 on success in update_status functions
In reply to Sasha LevinFrom: Brian Masney <[email protected]>
[ Upstream commit d3f48ec0954c6aac736ab21c34a35d7554409112 ]
lm3630a_bank_a_update_status() and lm3630a_bank_b_update_status() both return the brightness value if the brightness was successfully updated. Writing to these attributes via sysfs would cause a 'Bad address' error to be returned. These functions should return 0 on success, so let's change it to correct that error.
--- drivers/video/backlight/lm3630a_bl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/video/backlight/lm3630a_bl.c +2 -2
@@ -201,7 +201,7 @@ static int lm3630a_bank_a_update_status(struct backlight_device *bl) LM3630A_LEDA_ENABLE, LM3630A_LEDA_ENABLE);if (ret <0 ) goto out_i2c_err; -return bl->props.brightness; +return 0 ; out_i2c_err:dev_err (pchip->dev,"i2c failed to access\n" );
@@ -278,7 +278,7 @@ static int lm3630a_bank_b_update_status(struct backlight_device *bl) LM3630A_LEDB_ENABLE, LM3630A_LEDB_ENABLE);if (ret <0 ) goto out_i2c_err; -return bl->props.brightness; +return 0 ; out_i2c_err:dev_err (pchip->dev,"i2c failed to access REG_CTRL\n" );
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 357/671 thermal: rcar_gen3_thermal: fix interrupt type
In reply to Sasha LevinFrom: Jiada Wang <[email protected]>
[ Upstream commit 2c0928c9e004589dc9e7672c40a38d6c4ca12701 ]
Currently IRQF_SHARED type interrupt line is allocated, but it is not appropriate, as the interrupt line isn't shared between different devices, instead IRQF_ONESHOT is the proper type.
By changing interrupt type to IRQF_ONESHOT, now irq handler is no longer needed, as clear of interrupt status can be done in threaded interrupt context.
Because IRQF_ONESHOT type interrupt line is kept disabled until the threaded handler has been run, so there is no need to protect read/write of REG_GEN3_IRQSTR with lock.
--- drivers/thermal/rcar_gen3_thermal.c | 38 +++++------------------------ 1 file changed, 6 insertions(+), 32 deletions(-)
drivers/thermal/rcar_gen3_thermal.c +6 -32
@@ -14,7 +14,6 @@#include <linux/of_device.h> #include <linux/platform_device.h> #include <linux/pm_runtime.h> -#include <linux/spinlock.h> #include <linux/sys_soc.h> #include <linux/thermal.h>
@@ -81,7 +80,6 @@ struct rcar_gen3_thermal_tsc {struct rcar_gen3_thermal_priv {struct rcar_gen3_thermal_tsc *tscs[TSC_MAX_NUM ];unsigned int num_tscs; -spinlock_t lock;/* Protect interrupts on and off */ void (*thermal_init)(struct rcar_gen3_thermal_tsc *tsc); };
@@ -231,38 +229,16 @@ static irqreturn_t rcar_gen3_thermal_irq(int irq, void *data) {struct rcar_gen3_thermal_priv *priv = data;u32 status; -int i, ret =IRQ_HANDLED ; +int i; -spin_lock (&priv->lock);for (i =0 ; i < priv->num_tscs; i++) { status =rcar_gen3_thermal_read (priv->tscs[i],REG_GEN3_IRQSTR );rcar_gen3_thermal_write (priv->tscs[i],REG_GEN3_IRQSTR ,0 );if (status) - ret =IRQ_WAKE_THREAD ; +thermal_zone_device_update (priv->tscs[i]->zone, +THERMAL_EVENT_UNSPECIFIED ); } -if (ret ==IRQ_WAKE_THREAD ) -rcar_thermal_irq_set (priv, false); - -spin_unlock (&priv->lock); - -return ret; -} - -static irqreturn_t rcar_gen3_thermal_irq_thread (int irq,void *data) -{ -struct rcar_gen3_thermal_priv *priv = data; -unsigned long flags; -int i; - -for (i =0 ; i < priv->num_tscs; i++) -thermal_zone_device_update (priv->tscs[i]->zone, -THERMAL_EVENT_UNSPECIFIED ); - -spin_lock_irqsave (&priv->lock, flags); -rcar_thermal_irq_set (priv, true); -spin_unlock_irqrestore (&priv->lock, flags); -return IRQ_HANDLED ; }
@@ -364,8 +340,6 @@ static int rcar_gen3_thermal_probe(struct platform_device *pdev)if (soc_device_match (r8a7795es1)) priv->thermal_init = rcar_gen3_thermal_init_r8a7795es1; -spin_lock_init (&priv->lock); -platform_set_drvdata (pdev, priv);/*
@@ -383,9 +357,9 @@ static int rcar_gen3_thermal_probe(struct platform_device *pdev)if (!irqname)return -ENOMEM ; - ret =devm_request_threaded_irq (dev, irq, rcar_gen3_thermal_irq, - rcar_gen3_thermal_irq_thread, -IRQF_SHARED , irqname, priv); + ret =devm_request_threaded_irq (dev, irq,NULL , + rcar_gen3_thermal_irq, +IRQF_ONESHOT , irqname, priv);if (ret)return ret; }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 358/671 thermal: cpu_cooling: Actually trace CPU load in thermal_power_cpu_get_power
In reply to Sasha LevinFrom: Matthias Kaehlcke <[email protected]>
[ Upstream commit bf45ac18b78038e43af3c1a273cae4ab5704d2ce ]
The CPU load values passed to the thermal_power_cpu_get_power tracepoint are zero for all CPUs, unless, unless the thermal_power_cpu_limit tracepoint is enabled too:
irq/41-rockchip-98 [000] .... 290.972410: thermal_power_cpu_get_power:
cpus=0000000f freq=1800000 load={{0x0,0x0,0x0,0x0}} dynamic_power=4815
vs
irq/41-rockchip-96 [000] .... 95.773585: thermal_power_cpu_get_power:
cpus=0000000f freq=1800000 load={{0x56,0x64,0x64,0x5e}} dynamic_power=4959
irq/41-rockchip-96 [000] .... 95.773596: thermal_power_cpu_limit:
cpus=0000000f freq=408000 cdev_state=10 power=416
There seems to be no good reason for omitting the CPU load information depending on another tracepoint. My guess is that the intention was to check whether thermal_power_cpu_get_power is (still) enabled, however 'load_cpu != NULL' already indicates that it was at least enabled when cpufreq_get_requested_power() was entered, there seems little gain from omitting the assignment if the tracepoint was just disabled, so just remove the check.
--- drivers/thermal/cpu_cooling.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/thermal/cpu_cooling.c +1 -1
@@ -458,7 +458,7 @@ static int cpufreq_get_requested_power(struct thermal_cooling_device *cdev, load =0 ; total_load += load; -if (trace_thermal_power_cpu_limit_enabled () && load_cpu) +if (load_cpu) load_cpu[i] = load; i++;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 359/671 EDAC/mc: Fix edac_mc_find() in case no device is found
In reply to Sasha LevinFrom: Robert Richter <[email protected]>
[ Upstream commit 29a0c843973bc385918158c6976e4dbe891df969 ]
The function should return NULL in case no device is found, but it always returns the last checked mc device from the list even if the index did not match. Fix that.
I did some analysis why this did not raise any issues for about 3 years and the reason is that edac_mc_find() is mostly used to search for existing devices. Thus, the bug is not triggered.
[ bp: Drop the if (mci->mc_idx > idx) test in favor of readability. ]
--- drivers/edac/edac_mc.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
drivers/edac/edac_mc.c +4 -8
@@ -681,22 +681,18 @@ static int del_mc_from_global_list(struct mem_ctl_info *mci)struct mem_ctl_info *edac_mc_find (int idx) { -struct mem_ctl_info *mci =NULL ; +struct mem_ctl_info *mci;struct list_head *item;mutex_lock (&mem_ctls_mutex);list_for_each (item, &mc_devices) { mci = list_entry(item, struct mem_ctl_info, link); - -if (mci->mc_idx >= idx) { -if (mci->mc_idx == idx) { - goto unlock; - } -break ; - } +if (mci->mc_idx == idx) + goto unlock; } + mci =NULL ; unlock:mutex_unlock (&mem_ctls_mutex);return mci;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 360/671 afs: Fix key leak in afs_release() and afs_evict_inode()
In reply to Sasha LevinFrom: David Howells <[email protected]>
[ Upstream commit a1b879eefc2b34cd3f17187ef6fc1cf3960e9518 ]
Fix afs_release() to go through the cleanup part of the function if FMODE_WRITE is set rather than exiting through vfs_fsync() (which skips the cleanup). The cleanup involves discarding the refs on the key used for file ops and the writeback key record.
Also fix afs_evict_inode() to clean up any left over wb keys attached to the inode/vnode when it is removed.
--- fs/afs/file.c | 7 ++++--- fs/afs/inode.c | 1 + 2 files changed, 5 insertions(+), 3 deletions(-)
fs/afs/file.c +4 -3
@@ -169,11 +169,12 @@ int afs_release(struct inode *inode, struct file *file) {struct afs_vnode *vnode =AFS_FS_I (inode);struct afs_file *af = file->private_data; +int ret =0 ;_enter ("{%x:%u}," , vnode->fid.vid, vnode->fid.vnode);if ((file->f_mode &FMODE_WRITE )) -return vfs_fsync (file,0 ); + ret =vfs_fsync (file,0 ); file->private_data =NULL ;if (af->wb)
@@ -181,8 +182,8 @@ int afs_release(struct inode *inode, struct file *file)key_put (af->key);kfree (af);afs_prune_wb_keys (vnode); -_leave (" = 0" ); -return 0 ; +_leave (" = %d" , ret); +return ret; }/*
fs/afs/inode.c +1 -0
@@ -541,6 +541,7 @@ void afs_evict_inode(struct inode *inode) }#endif +afs_prune_wb_keys (vnode);afs_put_permits (rcu_access_pointer (vnode->permit_cache));key_put (vnode->lock_key); vnode->lock_key =NULL ;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 361/671 afs: Don't invalidate callback if AFS_VNODE_DIR_VALID not set
In reply to Sasha LevinFrom: David Howells <[email protected]>
[ Upstream commit d9052dda8a39069312218f913d22d99c48d90004 ]
Don't invalidate the callback promise on a directory if the AFS_VNODE_DIR_VALID flag is not set (which indicates that the directory contents are invalid, due to edit failure, callback break, page reclaim).
The directory will be reloaded next time the directory is accessed, so clearing the callback flag at this point may race with a reload of the directory and cancel it's recorded callback promise.
--- fs/afs/inode.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
fs/afs/inode.c +2 -5
@@ -398,12 +398,9 @@ int afs_validate(struct afs_vnode *vnode, struct key *key) vnode->cb_s_break = vnode->cb_interest->server->cb_s_break; vnode->cb_v_break = vnode->volume->cb_v_break; valid = false; - }else if (vnode->status.type ==AFS_FTYPE_DIR && - (!test_bit (AFS_VNODE_DIR_VALID , &vnode->flags) || - vnode->cb_expires_at -10 <= now)) { + }else if (test_bit (AFS_VNODE_ZAP_DATA , &vnode->flags)) { valid = false; - }else if (test_bit (AFS_VNODE_ZAP_DATA , &vnode->flags) || - vnode->cb_expires_at -10 <= now) { + }else if (vnode->cb_expires_at -10 <= now) { valid = false; }else { valid = true;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 362/671 afs: Fix lock-wait/callback-break double locking
In reply to Sasha LevinFrom: David Howells <[email protected]>
[ Upstream commit c7226e407b6065d3bda8bd9dc627663d2c505ea3 ]
__afs_break_callback() holds vnode->lock around its call of afs_lock_may_be_available() - which also takes that lock.
Fix this by not taking the lock in __afs_break_callback().
Also, there's no point checking the granted_locks and pending_locks queues; it's sufficient to check lock_state, so move that check out of afs_lock_may_be_available() into __afs_break_callback() to replace the queue checks.
--- fs/afs/callback.c | 8 +------- fs/afs/flock.c | 3 --- 2 files changed, 1 insertion(+), 10 deletions(-)
fs/afs/callback.c +1 -7
@@ -221,14 +221,8 @@ void afs_break_callback(struct afs_vnode *vnode) vnode->cb_break++;afs_clear_permits (vnode); -spin_lock (&vnode->lock); - -_debug ("break callback" ); - -if (list_empty (&vnode->granted_locks) && - !list_empty (&vnode->pending_locks)) +if (vnode->lock_state ==AFS_VNODE_LOCK_WAITING_FOR_CB )afs_lock_may_be_available (vnode); -spin_unlock (&vnode->lock); }write_sequnlock (&vnode->cb_lock);
fs/afs/flock.c +0 -3
@@ -39,9 +39,6 @@ void afs_lock_may_be_available(struct afs_vnode *vnode) {_enter ("{%x:%u}" , vnode->fid.vid, vnode->fid.vnode); -if (vnode->lock_state !=AFS_VNODE_LOCK_WAITING_FOR_CB ) -return ; -spin_lock (&vnode->lock);if (vnode->lock_state ==AFS_VNODE_LOCK_WAITING_FOR_CB )afs_next_locker (vnode,0 );
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 363/671 afs: Fix double inc of vnode->cb_break
In reply to Sasha LevinFrom: David Howells <[email protected]>
[ Upstream commit fd711586bb7d63f257da5eff234e68c446ac35ea ]
When __afs_break_callback() clears the CB_PROMISED flag, it increments vnode->cb_break to trigger a future refetch of the status and callback - however it also calls afs_clear_permits(), which also increments vnode->cb_break.
Fix this by removing the increment from afs_clear_permits().
Whilst we're at it, fix the conditional call to afs_put_permits() as the function checks to see if the argument is NULL, so the check is redundant.
--- fs/afs/security.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
fs/afs/security.c +1 -3
@@ -87,11 +87,9 @@ void afs_clear_permits(struct afs_vnode *vnode) permits =rcu_dereference_protected (vnode->permit_cache,lockdep_is_held (&vnode->lock));RCU_INIT_POINTER (vnode->permit_cache,NULL ); - vnode->cb_break++;spin_unlock (&vnode->lock); -if (permits) -afs_put_permits (permits); +afs_put_permits (permits); }/*
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 364/671 ARM: dts: sun8i-h3: Fix wifi in Beelink X2 DT
In reply to Sasha LevinFrom: Jernej Skrabec <[email protected]>
[ Upstream commit ca0961011db57e39880df0b5708df8aa3339dc6f ]
mmc1 node where wifi module is connected doesn't have properly defined power supplies so wifi module is never powered up. Fix that by specifying additional power supplies.
Additionally, this STB may have either Realtek or Broadcom based wifi module. One based on Broadcom module also needs external clock to work properly. Fix that by adding clock property to wifi_pwrseq node.
--- arch/arm/boot/dts/sun8i-h3-beelink-x2.dts | 4 ++++ 1 file changed, 4 insertions(+)
arch/arm/boot/dts/sun8i-h3-beelink-x2.dts +4 -0
@@ -90,6 +90,8 @@ wifi_pwrseq: wifi_pwrseq { compatible = "mmc-pwrseq-simple"; reset-gpios = <&r_pio 0 7 GPIO_ACTIVE_LOW>; /* PL7 */ + clocks = <&rtc 1>; + clock-names = "ext_clock"; }; sound_spdif {
@@ -155,6 +157,8 @@ &mmc1 { vmmc-supply = <®_vcc3v3>; + vqmmc-supply = <®_vcc3v3>; + mmc-pwrseq = <&wifi_pwrseq>; bus-width = <4>; non-removable; status = "okay";
Signature · 7 lines
2.20.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Sasha Levin
maintainerPATCH 365/671 clk: meson: gxbb: no spread spectrum on mpll0
In reply to Sasha LevinFrom: Jerome Brunet <[email protected]>
[ Upstream commit 8925dbd03bb29b1b0de30ac4e02c18faf8ddc9db ]
The documentation says there is an SSEN bit on mpll0 but, after testing it, no spread spectrum function appears to be enabled by this bit on any of the MPLLs.
Let's remove it until we know more
--- drivers/clk/meson/gxbb.c | 5 ----- 1 file changed, 5 deletions(-)
drivers/clk/meson/gxbb.c +0 -5
@@ -650,11 +650,6 @@ static struct clk_regmap gxbb_mpll0_div = { .shift = 16, .width = 9, }, - .ssen = { - .reg_off = HHI_MPLL_CNTL, - .shift = 25, - .width = 1, - }, .lock = &meson_clk_lock, }, .hw.init = &(struct clk_init_data ){
Signature · 7 lines
2.20.1 _______________________________________________ linux-amlogic mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-amlogic
Sasha Levin
maintainerPATCH 366/671 clk: meson: axg: spread spectrum is on mpll2
In reply to Sasha LevinFrom: Jerome Brunet <[email protected]>
[ Upstream commit dc4e62d373f881cbf51513296a6db7806516a01a ]
After testing, it appears that the SSEN bit controls the spread spectrum function on MPLL2, not MPLL0.
--- drivers/clk/meson/axg.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/clk/meson/axg.c +5 -5
@@ -461,11 +461,6 @@ static struct clk_regmap axg_mpll0_div = { .shift = 16, .width = 9, }, - .ssen = { - .reg_off = HHI_MPLL_CNTL, - .shift = 25, - .width = 1, - }, .misc = { .reg_off = HHI_PLL_TOP_MISC, .shift = 0,
@@ -560,6 +555,11 @@ static struct clk_regmap axg_mpll2_div = { .shift = 16, .width = 9, }, + .ssen = { + .reg_off = HHI_MPLL_CNTL, + .shift = 25, + .width = 1, + }, .misc = { .reg_off = HHI_PLL_TOP_MISC, .shift = 2,
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 367/671 dmaengine: tegra210-adma: Fix crash during probe
In reply to Sasha LevinFrom: Jon Hunter <[email protected]>
[ Upstream commit b53611fb1ce9b1786bd18205473e0c1d6bfa8934 ]
Commit f33e7bb3eb92 ("dmaengine: tegra210-adma: restore channel status") added support to save and restore the DMA channel registers when runtime suspending the ADMA. This change is causing the kernel to crash when probing the ADMA, if the device is probed deferred when looking up the channel interrupts. The crash occurs because not all of the channel base addresses have been setup at this point and in the clean-up path of the probe, pm_runtime_suspend() is called invoking its callback which expects all the channel base addresses to be initialised.
Although this could be fixed by simply checking for a NULL address, on further review of the driver it seems more appropriate that we only call pm_runtime_get_sync() after all the channel interrupts and base addresses have been configured. Therefore, fix this crash by moving the calls to pm_runtime_enable(), pm_runtime_get_sync() and tegra_adma_init() after the DMA channels have been initialised.
--- drivers/dma/tegra210-adma.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-)
drivers/dma/tegra210-adma.c +13 -13
@@ -744,16 +744,6 @@ static int tegra_adma_probe(struct platform_device *pdev)return PTR_ERR (tdma->ahub_clk); } -pm_runtime_enable (&pdev->dev); - - ret =pm_runtime_get_sync (&pdev->dev); -if (ret <0 ) - goto rpm_disable; - - ret =tegra_adma_init (tdma); -if (ret) - goto rpm_put; -INIT_LIST_HEAD (&tdma->dma_dev.channels);for (i =0 ; i < tdma->nr_channels; i++) {struct tegra_adma_chan *tdc = &tdma->channels[i];
@@ -771,6 +761,16 @@ static int tegra_adma_probe(struct platform_device *pdev) tdc->tdma = tdma; } +pm_runtime_enable (&pdev->dev); + + ret =pm_runtime_get_sync (&pdev->dev); +if (ret <0 ) + goto rpm_disable; + + ret =tegra_adma_init (tdma); +if (ret) + goto rpm_put; +dma_cap_set (DMA_SLAVE , tdma->dma_dev.cap_mask);dma_cap_set (DMA_PRIVATE , tdma->dma_dev.cap_mask);dma_cap_set (DMA_CYCLIC , tdma->dma_dev.cap_mask);
@@ -812,13 +812,13 @@ static int tegra_adma_probe(struct platform_device *pdev) dma_remove:dma_async_device_unregister (&tdma->dma_dev); -irq_dispose: -while (--i >=0 ) -irq_dispose_mapping (tdma->channels[i].irq); rpm_put:pm_runtime_put_sync (&pdev->dev); rpm_disable:pm_runtime_disable (&pdev->dev); +irq_dispose: +while (--i >=0 ) +irq_dispose_mapping (tdma->channels[i].irq);return ret; }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 368/671 arm64: dts: meson: libretech-cc: set eMMC as removable
In reply to Sasha LevinFrom: Jerome Brunet <[email protected]>
[ Upstream commit 9f72e321d5506fe3e162a6308a4a295d7f10bb5d ]
The eMMC on this board is add-on module which is not mandatory. Removing 'non-removable' property should prevent some errors when booting a board w/o an eMMC module present.
--- arch/arm64/boot/dts/amlogic/meson-gxl-s905x-libretech-cc.dts | 1 - 1 file changed, 1 deletion(-)
arch/arm64/boot/dts/amlogic/meson-gxl-s905x-libretech-cc.dts +0 -1
@@ -256,7 +256,6 @@ cap-mmc-highspeed; mmc-ddr-3_3v; max-frequency = <50000000>; - non-removable; disable-wp; mmc-pwrseq = <&emmc_pwrseq>;
Signature · 7 lines
2.20.1 _______________________________________________ linux-amlogic mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-amlogic
Sasha Levin
maintainerPATCH 369/671 RDMA/qedr: Fix incorrect device rate.
In reply to Sasha LevinFrom: Sagiv Ozeri <[email protected]>
[ Upstream commit 69054666df0a9b4e8331319f98b6b9a88bc3fcc4 ]
Use the correct enum value introduced in commit 12113a35ada6 ("IB/core:
Add HDR speed enum") Prior to this change a 50Gbps port would show 40Gbps.
This patch also cleaned up the redundant redefiniton of ib speeds for qedr.
--- drivers/infiniband/hw/qedr/verbs.c | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-)
drivers/infiniband/hw/qedr/verbs.c +9 -16
@@ -158,54 +158,47 @@ int qedr_query_device(struct ib_device *ibdev,return 0 ; } -#define QEDR_SPEED_SDR (1) -#define QEDR_SPEED_DDR (2) -#define QEDR_SPEED_QDR (4) -#define QEDR_SPEED_FDR10 (8) -#define QEDR_SPEED_FDR (16) -#define QEDR_SPEED_EDR (32) -static inline void get_link_speed_and_width (int speed,u8 *ib_speed,u8 *ib_width) {switch (speed) {case 1000 : - *ib_speed =QEDR_SPEED_SDR ; + *ib_speed =IB_SPEED_SDR ; *ib_width =IB_WIDTH_1X ;break ;case 10000 : - *ib_speed =QEDR_SPEED_QDR ; + *ib_speed =IB_SPEED_QDR ; *ib_width =IB_WIDTH_1X ;break ;case 20000 : - *ib_speed =QEDR_SPEED_DDR ; + *ib_speed =IB_SPEED_DDR ; *ib_width =IB_WIDTH_4X ;break ;case 25000 : - *ib_speed =QEDR_SPEED_EDR ; + *ib_speed =IB_SPEED_EDR ; *ib_width =IB_WIDTH_1X ;break ;case 40000 : - *ib_speed =QEDR_SPEED_QDR ; + *ib_speed =IB_SPEED_QDR ; *ib_width =IB_WIDTH_4X ;break ;case 50000 : - *ib_speed =QEDR_SPEED_QDR ; - *ib_width =IB_WIDTH_4X ; + *ib_speed =IB_SPEED_HDR ; + *ib_width =IB_WIDTH_1X ;break ;case 100000 : - *ib_speed =QEDR_SPEED_EDR ; + *ib_speed =IB_SPEED_EDR ; *ib_width =IB_WIDTH_4X ;break ;default :/* Unsupported */ - *ib_speed =QEDR_SPEED_SDR ; + *ib_speed =IB_SPEED_SDR ; *ib_width =IB_WIDTH_1X ; } }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 370/671 spi: spi-fsl-spi: call spi_finalize_current_message() at the end
In reply to Sasha LevinFrom: Christophe Leroy <[email protected]>
[ Upstream commit 44a042182cb1e9f7916e015c836967bf638b33c4 ]
spi_finalize_current_message() shall be called once all actions are finished, otherwise the last actions might step over a newly started transfer.
--- drivers/spi/spi-fsl-spi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/spi/spi-fsl-spi.c +1 -1
@@ -407,7 +407,6 @@ static int fsl_spi_do_one_msg(struct spi_master *master, } m->status = status; -spi_finalize_current_message (master);if (status || !cs_change) {ndelay (nsecs);
@@ -415,6 +414,7 @@ static int fsl_spi_do_one_msg(struct spi_master *master, }fsl_spi_setup_transfer (spi,NULL ); +spi_finalize_current_message (master);return 0 ; }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 371/671 crypto: ccp - fix AES CFB error exposed by new test vectors
In reply to Sasha LevinFrom: "Hook, Gary" <[email protected]>
[ Upstream commit c3b359d6567c0b8f413e924feb37cf025067d55a ]
Updated testmgr will exhibit this error message when loading the ccp-crypto module:
alg: skcipher: cfb-aes-ccp encryption failed with err -22 on test vector 3, cfg="in-place"
Update the CCP crypto driver to correctly treat CFB as a streaming mode cipher (instead of block mode). Update the configuration for CFB to specify the block size as a single byte;
--- drivers/crypto/ccp/ccp-crypto-aes.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/crypto/ccp/ccp-crypto-aes.c +4 -4
@@ -1,7 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0 /* * AMD Cryptographic Coprocessor (CCP) AES crypto API support * -* Copyright (C) 2013,2016 Advanced Micro Devices, Inc. +* Copyright (C) 2013-2019 Advanced Micro Devices, Inc. * * Author: Tom Lendacky <[email protected]> *
@@ -79,8 +80,7 @@ static int ccp_aes_crypt(struct ablkcipher_request *req, bool encrypt)return -EINVAL ;if (((ctx->u.aes.mode ==CCP_AES_MODE_ECB ) || - (ctx->u.aes.mode ==CCP_AES_MODE_CBC ) || - (ctx->u.aes.mode ==CCP_AES_MODE_CFB )) && + (ctx->u.aes.mode ==CCP_AES_MODE_CBC )) && (req->nbytes & (AES_BLOCK_SIZE -1 )))return -EINVAL ;
@@ -291,7 +291,7 @@ static struct ccp_aes_def aes_algs[] = { .version = CCP_VERSION(3, 0), .name = "cfb(aes)", .driver_name = "cfb-aes-ccp", - .blocksize = AES_BLOCK_SIZE, + .blocksize = 1, .ivsize = AES_BLOCK_SIZE, .alg_defaults = &ccp_aes_defaults, },
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 372/671 crypto: ccp - Fix 3DES complaint from ccp-crypto module
In reply to Sasha LevinFrom: "Hook, Gary" <[email protected]>
[ Upstream commit 89646fdda4cae203185444ac7988835f36a21ee1 ]
Crypto self-tests reveal an error:
alg: skcipher: cbc-des3-ccp encryption test failed (wrong output IV) on test vector 0, cfg="in-place"
The offset value should not be recomputed when retrieving the context. Also, a code path exists which makes decisions based on older (version 3) hardware; a v3 device deosn't support 3DES so remove this check.
--- drivers/crypto/ccp/ccp-ops.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-)
drivers/crypto/ccp/ccp-ops.c +4 -11
@@ -1293,6 +1293,9 @@ static int ccp_run_des3_cmd(struct ccp_cmd_queue *cmd_q, struct ccp_cmd *cmd)int ret;/* Error checks */ +if (cmd_q->ccp->vdata->version <CCP_VERSION (5 ,0 )) +return -EINVAL ; +if (!cmd_q->ccp->vdata->perform->des3)return -EINVAL ;
@@ -1375,8 +1378,6 @@ static int ccp_run_des3_cmd(struct ccp_cmd_queue *cmd_q, struct ccp_cmd *cmd)* passthru option to convert from big endian to little endian. */ if (des3->mode !=CCP_DES3_MODE_ECB ) { -u32 load_mode; - op.sb_ctx = cmd_q->sb_ctx; ret = ccp_init_dm_workarea(&ctx, cmd_q,
@@ -1392,12 +1393,8 @@ static int ccp_run_des3_cmd(struct ccp_cmd_queue *cmd_q, struct ccp_cmd *cmd)if (ret) goto e_ctx; -if (cmd_q->ccp->vdata->version ==CCP_VERSION (3 ,0 )) - load_mode =CCP_PASSTHRU_BYTESWAP_NOOP ; -else - load_mode =CCP_PASSTHRU_BYTESWAP_256BIT ; ret =ccp_copy_to_sb (cmd_q, &ctx, op.jobid, op.sb_ctx, - load_mode); +CCP_PASSTHRU_BYTESWAP_256BIT );if (ret) { cmd->engine_error = cmd_q->cmd_error; goto e_ctx;
@@ -1459,10 +1456,6 @@ static int ccp_run_des3_cmd(struct ccp_cmd_queue *cmd_q, struct ccp_cmd *cmd) }/* ...but we only need the last DES3_EDE_BLOCK_SIZE bytes */ -if (cmd_q->ccp->vdata->version ==CCP_VERSION (3 ,0 )) - dm_offset =CCP_SB_BYTES - des3->iv_len; -else - dm_offset =0 ;ccp_get_dm_area (&ctx, dm_offset, des3->iv,0 ,DES3_EDE_BLOCK_SIZE ); }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 373/671 serial: stm32: fix word length configuration
In reply to Sasha LevinFrom: Erwan Le Ray <[email protected]>
[ Upstream commit c8a9d043947b4acb19a65f7fac2bd0893e581cd5 ]
STM32 supports either:
- 8 and 9 bits word length (including parity bit) for stm32f4 compatible devices
- 7, 8 and 9 bits word length (including parity bit) for stm32f7 and stm32h7 compatible devices.
As a consequence STM32 supports the following termios configurations:
- CS7 with parity bit, and CS8 (with or without parity bit) for stm32f4 compatible devices.
- CS6 with parity bit, CS7 and CS8 (with or without parity bit) for stm32f7 and stm32h7 compatible devices.
This patch is fixing word length by configuring correctly the SoC with supported configurations.
--- drivers/tty/serial/stm32-usart.c | 56 ++++++++++++++++++++++++++++---- drivers/tty/serial/stm32-usart.h | 3 +- 2 files changed, 50 insertions(+), 9 deletions(-)
drivers/tty/serial/stm32-usart.c +49 -7
@@ -599,6 +599,36 @@ static void stm32_shutdown(struct uart_port *port)free_irq (port->irq, port); } +unsigned int stm32_get_databits (struct ktermios *termios) +{ +unsigned int bits; + +tcflag_t cflag = termios->c_cflag; + +switch (cflag &CSIZE ) { +/* +* CSIZE settings are not necessarily supported in hardware. +* CSIZE unsupported configurations are handled here to set word length +* to 8 bits word as default configuration and to print debug message. +*/ +case CS5 : + bits =5 ; +break ; +case CS6 : + bits =6 ; +break ; +case CS7 : + bits =7 ; +break ; +/* default including CS8 */ +default : + bits =8 ; +break ; + } + +return bits; +} +static void stm32_set_termios (struct uart_port *port,struct ktermios *termios,struct ktermios *old) {
@@ -606,7 +636,7 @@ static void stm32_set_termios(struct uart_port *port, struct ktermios *termios,struct stm32_usart_offsets *ofs = &stm32_port->info->ofs;struct stm32_usart_config *cfg = &stm32_port->info->cfg;struct serial_rs485 *rs485conf = &port->rs485; -unsigned int baud; +unsigned int baud, bits;u32 usartdiv, mantissa, fraction, oversampling;tcflag_t cflag = termios->c_cflag;u32 cr1, cr2, cr3;
@@ -632,16 +662,28 @@ static void stm32_set_termios(struct uart_port *port, struct ktermios *termios,if (cflag &CSTOPB ) cr2 |=USART_CR2_STOP_2B ; + bits =stm32_get_databits (termios); +if (cflag &PARENB ) { + bits++; cr1 |=USART_CR1_PCE ; -if ((cflag &CSIZE ) ==CS8 ) { -if (cfg->has_7bits_data) - cr1 |=USART_CR1_M0 ; -else - cr1 |=USART_CR1_M ; - } } +/* +* Word length configuration: +* CS8 + parity, 9 bits word aka [M1:M0] = 0b01 +* CS7 or (CS6 + parity), 7 bits word aka [M1:M0] = 0b10 +* CS8 or (CS7 + parity), 8 bits word aka [M1:M0] = 0b00 +* M0 and M1 already cleared by cr1 initialization. +*/ +if (bits ==9 ) + cr1 |=USART_CR1_M0 ; +else if ((bits ==7 ) && cfg->has_7bits_data) + cr1 |=USART_CR1_M1 ; +else if (bits !=8 ) +dev_dbg (port->dev,"Unsupported data bits config: %u bits\n" + , bits); +if (cflag &PARODD ) cr1 |=USART_CR1_PS ;
drivers/tty/serial/stm32-usart.h +1 -2
@@ -151,8 +151,7 @@ struct stm32_usart_info stm32h7_info = {#define USART_CR1_PS BIT(9)#define USART_CR1_PCE BIT(10)#define USART_CR1_WAKE BIT(11) -#define USART_CR1_M BIT(12) -#define USART_CR1_M0 BIT(12)/* F7 */ +#define USART_CR1_M0 BIT(12)/* F7 (CR1_M for F4) */ #define USART_CR1_MME BIT(13)/* F7 */ #define USART_CR1_CMIE BIT(14)/* F7 */ #define USART_CR1_OVER8 BIT(15)
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 374/671 serial: stm32: fix rx error handling
In reply to Sasha LevinFrom: Erwan Le Ray <[email protected]>
[ Upstream commit 4f01d833fdcdd6f9b85d9e5d5d7568eb683626a7 ]
- Fixes parity and framing error bit by clearing parity and framing error flag. The current implementation doesn't clear the error bits when an error is detected.
- Fixes the incorrect name of framing error clearing flag in header file.
- Fixes misalignement between data frame and errors status. The status read for "n" frame was the status of "n+1" frame".
- Fixes break detection was not triggered by the expected register.
--- drivers/tty/serial/stm32-usart.c | 54 +++++++++++++++++++++----------- drivers/tty/serial/stm32-usart.h | 10 ++---- 2 files changed, 37 insertions(+), 27 deletions(-)
drivers/tty/serial/stm32-usart.c +35 -19
@@ -225,35 +225,51 @@ static void stm32_receive_chars(struct uart_port *port, bool threaded)while (stm32_pending_rx (port, &sr, &stm32_port->last_res, threaded)) { sr |=USART_SR_DUMMY_RX ; - c =stm32_get_char (port, &sr, &stm32_port->last_res); flag =TTY_NORMAL ; - port->icount.rx++; +/* +* Status bits has to be cleared before reading the RDR: +* In FIFO mode, reading the RDR will pop the next data +* (if any) along with its status bits into the SR. +* Not doing so leads to misalignement between RDR and SR, +* and clear status bits of the next rx data. +* +* Clear errors flags for stm32f7 and stm32h7 compatible +* devices. On stm32f4 compatible devices, the error bit is +* cleared by the sequence [read SR - read DR]. +*/ +if ((sr &USART_SR_ERR_MASK ) && ofs->icr !=UNDEF_REG ) +stm32_clr_bits (port, ofs->icr,USART_ICR_ORECF | +USART_ICR_PECF |USART_ICR_FECF ); + + c =stm32_get_char (port, &sr, &stm32_port->last_res); + port->icount.rx++;if (sr &USART_SR_ERR_MASK ) { -if (sr &USART_SR_LBD ) { - port->icount.brk++; -if (uart_handle_break (port)) -continue ; - }else if (sr &USART_SR_ORE ) { -if (ofs->icr !=UNDEF_REG ) -writel_relaxed (USART_ICR_ORECF , - port->membase + - ofs->icr); +if (sr &USART_SR_ORE ) { port->icount.overrun++; }else if (sr &USART_SR_PE ) { port->icount.parity++; }else if (sr &USART_SR_FE ) { - port->icount.frame++; +/* Break detection if character is null */ +if (!c) { + port->icount.brk++; +if (uart_handle_break (port)) +continue ; + }else { + port->icount.frame++; + } } sr &= port->read_status_mask; -if (sr &USART_SR_LBD ) - flag =TTY_BREAK ; -else if (sr &USART_SR_PE ) +if (sr &USART_SR_PE ) { flag =TTY_PARITY ; -else if (sr &USART_SR_FE ) - flag =TTY_FRAME ; + }else if (sr &USART_SR_FE ) { +if (!c) + flag =TTY_BREAK ; +else + flag =TTY_FRAME ; + } }if (uart_handle_sysrq_char (port, c))
@@ -721,14 +737,14 @@ static void stm32_set_termios(struct uart_port *port, struct ktermios *termios,if (termios->c_iflag &INPCK ) port->read_status_mask |=USART_SR_PE |USART_SR_FE ;if (termios->c_iflag & (IGNBRK |BRKINT |PARMRK )) - port->read_status_mask |=USART_SR_LBD ; + port->read_status_mask |=USART_SR_FE ;/* Characters to ignore */ port->ignore_status_mask =0 ;if (termios->c_iflag &IGNPAR ) port->ignore_status_mask =USART_SR_PE |USART_SR_FE ;if (termios->c_iflag &IGNBRK ) { - port->ignore_status_mask |=USART_SR_LBD ; + port->ignore_status_mask |=USART_SR_FE ;/* * If we're ignoring parity and break indicators, * ignore overruns too (for real raw support).
drivers/tty/serial/stm32-usart.h +2 -8
@@ -108,7 +108,6 @@ struct stm32_usart_info stm32h7_info = {#define USART_SR_RXNE BIT(5)#define USART_SR_TC BIT(6)#define USART_SR_TXE BIT(7) -#define USART_SR_LBD BIT(8)#define USART_SR_CTSIF BIT(9)#define USART_SR_CTS BIT(10)/* F7 */ #define USART_SR_RTOF BIT(11)/* F7 */
@@ -120,8 +119,7 @@ struct stm32_usart_info stm32h7_info = {#define USART_SR_SBKF BIT(18)/* F7 */ #define USART_SR_WUF BIT(20)/* H7 */ #define USART_SR_TEACK BIT(21)/* F7 */ -#define USART_SR_ERR_MASK (USART_SR_LBD | USART_SR_ORE | \ - USART_SR_FE | USART_SR_PE) +#define USART_SR_ERR_MASK (USART_SR_ORE | USART_SR_FE | USART_SR_PE)/* Dummy bits */ #define USART_SR_DUMMY_RX BIT(16)
@@ -168,8 +166,6 @@ struct stm32_usart_info stm32h7_info = {/* USART_CR2 */ #define USART_CR2_ADD_MASK GENMASK(3, 0)/* F4 */ #define USART_CR2_ADDM7 BIT(4)/* F7 */ -#define USART_CR2_LBDL BIT(5) -#define USART_CR2_LBDIE BIT(6)#define USART_CR2_LBCL BIT(8)#define USART_CR2_CPHA BIT(9)#define USART_CR2_CPOL BIT(10)
@@ -226,12 +222,10 @@ struct stm32_usart_info stm32h7_info = {/* USART_ICR */ #define USART_ICR_PECF BIT(0)/* F7 */ -#define USART_ICR_FFECF BIT(1)/* F7 */ -#define USART_ICR_NCF BIT(2)/* F7 */ +#define USART_ICR_FECF BIT(1)/* F7 */ #define USART_ICR_ORECF BIT(3)/* F7 */ #define USART_ICR_IDLECF BIT(4)/* F7 */ #define USART_ICR_TCCF BIT(6)/* F7 */ -#define USART_ICR_LBDCF BIT(8)/* F7 */ #define USART_ICR_CTSCF BIT(9)/* F7 */ #define USART_ICR_RTOCF BIT(11)/* F7 */ #define USART_ICR_EOBCF BIT(12)/* F7 */
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 375/671 serial: stm32: fix rx data length when parity enabled
In reply to Sasha LevinFrom: Erwan Le Ray <[email protected]>
[ Upstream commit 6c5962f30bce147b1c83869085f3ddde3b34c9e3 ]
- Fixes a rx data error when data length < 8 bits and parity is enabled. RDR register MSB is used for parity bit reception.
- Adds a mask to ignore MSB when data is get from RDR.
--- drivers/tty/serial/stm32-usart.c | 12 ++++++++---- drivers/tty/serial/stm32-usart.h | 1 + 2 files changed, 9 insertions(+), 4 deletions(-)
drivers/tty/serial/stm32-usart.c +8 -4
@@ -194,8 +194,8 @@ static int stm32_pending_rx(struct uart_port *port, u32 *sr, int *last_res,return 0 ; } -static unsigned long -stm32_get_char (struct uart_port *port,u32 *sr,int *last_res) +static unsigned long stm32_get_char (struct uart_port *port,u32 *sr, +int *last_res) {struct stm32_port *stm32_port =to_stm32_port (port);struct stm32_usart_offsets *ofs = &stm32_port->info->ofs;
@@ -205,10 +205,13 @@ stm32_get_char(struct uart_port *port, u32 *sr, int *last_res) c = stm32_port->rx_buf[RX_BUF_L - (*last_res)--];if ((*last_res) ==0 ) *last_res =RX_BUF_L ; -return c; }else { -return readl_relaxed (port->membase + ofs->rdr); + c =readl_relaxed (port->membase + ofs->rdr); +/* apply RDR data mask */ + c &= stm32_port->rdr_mask; } + +return c; }static void stm32_receive_chars (struct uart_port *port,bool threaded)
@@ -679,6 +682,7 @@ static void stm32_set_termios(struct uart_port *port, struct ktermios *termios, cr2 |=USART_CR2_STOP_2B ; bits =stm32_get_databits (termios); + stm32_port->rdr_mask = (BIT (bits) -1 );if (cflag &PARENB ) { bits++;
drivers/tty/serial/stm32-usart.h +1 -0
@@ -254,6 +254,7 @@ struct stm32_port {bool hw_flow_control;bool fifoen;int wakeirq; +int rdr_mask;/* receive data register mask */ };static struct stm32_port stm32_ports[STM32_MAX_PORTS ];
Signature · 7 lines
2.20.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Sasha Levin
maintainerPATCH 376/671 serial: stm32: fix transmit_chars when tx is stopped
In reply to Sasha LevinFrom: Erwan Le Ray <[email protected]>
[ Upstream commit b83b957c91f68e53f0dc596e129e8305761f2a32 ]
Disables the tx irq when the transmission is ended and updates stop_tx conditions for code cleanup.
--- drivers/tty/serial/stm32-usart.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)
drivers/tty/serial/stm32-usart.c +3 -8
@@ -420,13 +420,8 @@ static void stm32_transmit_chars(struct uart_port *port)return ; } -if (uart_tx_stopped (port)) { -stm32_stop_tx (port); -return ; - } - -if (uart_circ_empty (xmit)) { -stm32_stop_tx (port); +if (uart_circ_empty (xmit) ||uart_tx_stopped (port)) { +stm32_clr_bits (port, ofs->cr1,USART_CR1_TXEIE );return ; }
@@ -439,7 +434,7 @@ static void stm32_transmit_chars(struct uart_port *port)uart_write_wakeup (port);if (uart_circ_empty (xmit)) -stm32_stop_tx (port); +stm32_clr_bits (port, ofs->cr1,USART_CR1_TXEIE ); }static irqreturn_t stm32_interrupt (int irq,void *ptr)
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 377/671 serial: stm32: Add support of TC bit status check
In reply to Sasha LevinFrom: Erwan Le Ray <[email protected]>
[ Upstream commit 64c32eab660386f9904bb295a104c9c425e9f8b2 ]
Adds a check on the Transmission Complete bit status before closing the com port. Prevents the port closure before the end of the transmission. TC poll loop is moved from stm32_tx_dma_complete to stm32_shutdown routine, in order to check TC before shutdown in both dma and PIO tx modes.
TC clear is added in stm32_transmit_char routine, in order to be cleared before transmitting in both dma and PIO tx modes.
--- drivers/tty/serial/stm32-usart.c | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-)
drivers/tty/serial/stm32-usart.c +15 -17
@@ -290,21 +290,6 @@ static void stm32_tx_dma_complete(void *arg)struct uart_port *port = arg;struct stm32_port *stm32port =to_stm32_port (port);struct stm32_usart_offsets *ofs = &stm32port->info->ofs; -unsigned int isr; -int ret; - - ret =readl_relaxed_poll_timeout_atomic (port->membase + ofs->isr, - isr, - (isr &USART_SR_TC ), -10 ,100000 ); - -if (ret) -dev_err (port->dev,"terminal count not set\n" ); - -if (ofs->icr ==UNDEF_REG ) -stm32_clr_bits (port, ofs->isr,USART_SR_TC ); -else -stm32_set_bits (port, ofs->icr,USART_CR_TC );stm32_clr_bits (port, ofs->cr3,USART_CR3_DMAT ); stm32port->tx_dma_busy = false;
@@ -396,7 +381,6 @@ static void stm32_transmit_chars_dma(struct uart_port *port)/* Issue pending DMA TX requests */ dma_async_issue_pending (stm32port->tx_ch); -stm32_clr_bits (port, ofs->isr,USART_SR_TC );stm32_set_bits (port, ofs->cr3,USART_CR3_DMAT ); xmit->tail = (xmit->tail + count) & (UART_XMIT_SIZE -1 );
@@ -425,6 +409,11 @@ static void stm32_transmit_chars(struct uart_port *port)return ; } +if (ofs->icr ==UNDEF_REG ) +stm32_clr_bits (port, ofs->isr,USART_SR_TC ); +else +stm32_set_bits (port, ofs->icr,USART_ICR_TCCF ); +if (stm32_port->tx_ch)stm32_transmit_chars_dma (port);else
@@ -601,12 +590,21 @@ static void stm32_shutdown(struct uart_port *port)struct stm32_port *stm32_port =to_stm32_port (port);struct stm32_usart_offsets *ofs = &stm32_port->info->ofs;struct stm32_usart_config *cfg = &stm32_port->info->cfg; -u32 val; +u32 val, isr; +int ret; val =USART_CR1_TXEIE |USART_CR1_RXNEIE |USART_CR1_TE |USART_CR1_RE ; val |=BIT (cfg->uart_enable_bit);if (stm32_port->fifoen) val |=USART_CR1_FIFOEN ; + + ret =readl_relaxed_poll_timeout (port->membase + ofs->isr, + isr, (isr &USART_SR_TC ), +10 ,100000 ); + +if (ret) +dev_err (port->dev,"transmission complete not set\n" ); +stm32_clr_bits (port, ofs->cr1, val);dev_pm_clear_wake_irq (port->dev);
Signature · 7 lines
2.20.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Sasha Levin
maintainerPATCH 378/671 serial: stm32: fix wakeup source initialization
In reply to Sasha LevinFrom: Erwan Le Ray <[email protected]>
[ Upstream commit 5297f274e8b61ceb9676cba6649d3de9d03387ad ]
Fixes dedicated_irq_wakeup issue and deactivated uart as wakeup source by default.
--- drivers/tty/serial/stm32-usart.c | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-)
drivers/tty/serial/stm32-usart.c +15 -13
@@ -557,7 +557,6 @@ static int stm32_startup(struct uart_port *port) {struct stm32_port *stm32_port =to_stm32_port (port);struct stm32_usart_offsets *ofs = &stm32_port->info->ofs; -struct stm32_usart_config *cfg = &stm32_port->info->cfg;const char *name =to_platform_device (port->dev)->name;u32 val;int ret;
@@ -568,15 +567,6 @@ static int stm32_startup(struct uart_port *port)if (ret)return ret; -if (cfg->has_wakeup && stm32_port->wakeirq >=0 ) { - ret =dev_pm_set_dedicated_wake_irq (port->dev, - stm32_port->wakeirq); -if (ret) { -free_irq (port->irq, port); -return ret; - } - } - val =USART_CR1_RXNEIE |USART_CR1_TE |USART_CR1_RE ;if (stm32_port->fifoen) val |=USART_CR1_FIFOEN ;
@@ -607,7 +597,6 @@ static void stm32_shutdown(struct uart_port *port)stm32_clr_bits (port, ofs->cr1, val); -dev_pm_clear_wake_irq (port->dev);free_irq (port->irq, port); }
@@ -1079,11 +1068,18 @@ static int stm32_serial_probe(struct platform_device *pdev) ret =device_init_wakeup (&pdev->dev, true);if (ret) goto err_uninit; + + ret =dev_pm_set_dedicated_wake_irq (&pdev->dev, + stm32port->wakeirq); +if (ret) + goto err_nowup; + +device_set_wakeup_enable (&pdev->dev, false); } ret =uart_add_one_port (&stm32_usart_driver, &stm32port->port);if (ret) - goto err_nowup; + goto err_wirq; ret =stm32_of_dma_rx_probe (stm32port, pdev);if (ret)
@@ -1097,6 +1093,10 @@ static int stm32_serial_probe(struct platform_device *pdev)return 0 ; +err_wirq: +if (stm32port->info->cfg.has_wakeup && stm32port->wakeirq >=0 ) +dev_pm_clear_wake_irq (&pdev->dev); + err_nowup:if (stm32port->info->cfg.has_wakeup && stm32port->wakeirq >=0 )device_init_wakeup (&pdev->dev, false);
@@ -1134,8 +1134,10 @@ static int stm32_serial_remove(struct platform_device *pdev)TX_BUF_L , stm32_port->tx_buf, stm32_port->tx_dma_buf); -if (cfg->has_wakeup && stm32_port->wakeirq >=0 ) +if (cfg->has_wakeup && stm32_port->wakeirq >=0 ) { +dev_pm_clear_wake_irq (&pdev->dev);device_init_wakeup (&pdev->dev, false); + }clk_disable_unprepare (stm32_port->clk);
Signature · 7 lines
2.20.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Sasha Levin
maintainerPATCH 379/671 misc: sgi-xp: Properly initialize buf in xpc_get_rsvd_page_pa
In reply to Sasha LevinFrom: Nathan Chancellor <[email protected]>
[ Upstream commit b0576f9ecb5c51e9932531d23c447b2739261841 ]
Clang warns:
drivers/misc/sgi-xp/xpc_partition.c:73:14: warning: variable 'buf' is uninitialized when used within its own initialization [-Wuninitialized]
void *buf = buf;
~~~ ^~~1 warning generated.
Arnd's explanation during review:
/*
* Returns the physical address of the partition's reserved page through
* an iterative number of calls.
*
* On first call, 'cookie' and 'len' should be set to 0, and 'addr'
* set to the nasid of the partition whose reserved page's address is
* being sought.
* On subsequent calls, pass the values, that were passed back on the
* previous call.
*
* While the return status equals SALRET_MORE_PASSES, keep calling
* this function after first copying 'len' bytes starting at 'addr'
* into 'buf'. Once the return status equals SALRET_OK, 'addr' will
* be the physical address of the partition's reserved page. If the
* return status equals neither of these, an error as occurred. */
static inline s64
sn_partition_reserved_page_pa(u64 buf, u64 *cookie, u64 *addr, u64 *len)
so *len is set to zero on the first call and tells the bios how many bytes are accessible at 'buf', and it does get updated by the BIOS to tell us how many bytes it needs, and then we allocate that and try again.
--- drivers/misc/sgi-xp/xpc_partition.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/misc/sgi-xp/xpc_partition.c +1 -1
@@ -70,7 +70,7 @@ xpc_get_rsvd_page_pa(int nasid)unsigned long rp_pa = nasid;/* seed with nasid */ size_t len =0 ;size_t buf_len =0 ; -void *buf = buf; +void *buf =NULL ;void *buf_base =NULL ;enum xp_retval (*get_partition_rsvd_page_pa) (void *, u64 *, unsigned long *, size_t *) =
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 380/671 PCI: PM: Avoid possible suspend-to-idle issue
In reply to Sasha LevinFrom: "Rafael J. Wysocki" <[email protected]>
[ Upstream commit d491f2b75237ef37d8867830ab7fad8d9659e853 ]
If a PCI driver leaves the device handled by it in D0 and calls pci_save_state() on the device in its ->suspend() or ->suspend_late() callback, it can expect the device to stay in D0 over the whole s2idle cycle. However, that may not be the case if there is a spurious wakeup while the system is suspended, because in that case pci_pm_suspend_noirq() will run again after pci_pm_resume_noirq() which calls pci_restore_state(), via pci_pm_default_resume_early(), so state_saved is cleared and the second iteration of pci_pm_suspend_noirq() will invoke pci_prepare_to_sleep() which may change the power state of the device.
To avoid that, add a new internal flag, skip_bus_pm, that will be set by pci_pm_suspend_noirq() when it runs for the first time during the given system suspend-resume cycle if the state of the device has been saved already and the device is still in D0. Setting that flag will cause the next iterations of pci_pm_suspend_noirq() to set state_saved for pci_pm_resume_noirq(), so that it always restores the device state from the originally saved data, and avoid calling pci_prepare_to_sleep() for the device.
--- drivers/pci/pci-driver.c | 17 ++++++++++++++++- include/linux/pci.h | 1 + 2 files changed, 17 insertions(+), 1 deletion(-)
drivers/pci/pci-driver.c +16 -1
@@ -736,6 +736,8 @@ static int pci_pm_suspend(struct device *dev)struct pci_dev *pci_dev =to_pci_dev (dev);const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm :NULL ; + pci_dev->skip_bus_pm = false; +if (pci_has_legacy_pm_support (pci_dev))return pci_legacy_suspend (dev,PMSG_SUSPEND );
@@ -829,7 +831,20 @@ static int pci_pm_suspend_noirq(struct device *dev) } } -if (!pci_dev->state_saved) { +if (pci_dev->skip_bus_pm) { +/* +* The function is running for the second time in a row without +* going through full resume, which is possible only during +* suspend-to-idle in a spurious wakeup case. Moreover, the +* device was originally left in D0, so its power state should +* not be changed here and the device register values saved +* originally should be restored on resume again. +*/ + pci_dev->state_saved = true; + }else if (pci_dev->state_saved) { +if (pci_dev->current_state ==PCI_D0 ) + pci_dev->skip_bus_pm = true; + }else {pci_save_state (pci_dev);if (pci_power_manageable (pci_dev))pci_prepare_to_sleep (pci_dev);
include/linux/pci.h +1 -0
@@ -342,6 +342,7 @@ struct pci_dev {D3cold, not set for devices powered on/off by the corresponding bridge */ + unsigned int skip_bus_pm:1; /* Internal: Skip bus-level PM */ unsigned int ignore_hotplug:1; /* Ignore hotplug events */ unsigned int hotplug_user_indicators:1; /* SlotCtl indicatorscontrolled exclusively by
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 381/671 iommu: Add missing new line for dma type
In reply to Sasha LevinFrom: Lu Baolu <[email protected]>
[ Upstream commit 24f307d8abf79486dd3c1b645037df7d91602aaa ]
So that all types are printed in the same format.
--- drivers/iommu/iommu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iommu/iommu.c +1 -1
@@ -317,7 +317,7 @@ static ssize_t iommu_group_show_type(struct iommu_group *group, type ="unmanaged\n" ;break ;case IOMMU_DOMAIN_DMA : - type ="DMA" ; + type ="DMA\n" ;break ; } }
Signature · 6 lines
2.20.1 _______________________________________________ iommu mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/iommu
Sasha Levin
maintainerPATCH 382/671 iommu: Use right function to get group for device
In reply to Sasha LevinFrom: Lu Baolu <[email protected]>
[ Upstream commit 57274ea25736496ee019a5c40479855b21888839 ]
The iommu_group_get_for_dev() will allocate a group for a device if it isn't in any group. This isn't the use case in iommu_request_dm_for_dev(). Let's use iommu_group_get() instead.
--- drivers/iommu/iommu.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/iommu/iommu.c +3 -3
@@ -1899,9 +1899,9 @@ int iommu_request_dm_for_dev(struct device *dev)int ret;/* Device must already be in a group before calling this function */ - group =iommu_group_get_for_dev (dev); -if (IS_ERR (group)) -return PTR_ERR (group); + group =iommu_group_get (dev); +if (!group) +return -EINVAL ;mutex_lock (&group->mutex);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 383/671 signal/bpfilter: Fix bpfilter_kernl to use send_sig not force_sig
In reply to Sasha LevinFrom: "Eric W. Biederman" <[email protected]>
[ Upstream commit 1dfd1711de2952fd1bfeea7152bd1687a4eea771 ]
The locking in force_sig_info is not prepared to deal with a task that exits or execs (as sighand may change). As force_sig is only built to handle synchronous exceptions.
Further the function force_sig_info changes the signal state if the signal is ignored, or blocked or if SIGNAL_UNKILLABLE will prevent the delivery of the signal. The signal SIGKILL can not be ignored and can not be blocked and SIGNAL_UNKILLABLE won't prevent it from being delivered.
So using force_sig rather than send_sig for SIGKILL is pointless.
Because it won't impact the sending of the signal and and because using force_sig is wrong, replace force_sig with send_sig.
--- net/bpfilter/bpfilter_kern.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/bpfilter/bpfilter_kern.c +1 -1
@@ -25,7 +25,7 @@ static void shutdown_umh(struct umh_info *info)return ; tsk =get_pid_task (find_vpid (info->pid),PIDTYPE_PID );if (tsk) { -force_sig (SIGKILL , tsk); +send_sig (SIGKILL , tsk,1 );put_task_struct (tsk); }fput (info->pipe_to_umh);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 384/671 signal/cifs: Fix cifs_put_tcp_session to call send_sig instead of force_sig
In reply to Sasha LevinFrom: "Eric W. Biederman" <[email protected]>
[ Upstream commit 72abe3bcf0911d69b46c1e8bdb5612675e0ac42c ]
The locking in force_sig_info is not prepared to deal with a task that exits or execs (as sighand may change). The is not a locking problem in force_sig as force_sig is only built to handle synchronous exceptions.
Further the function force_sig_info changes the signal state if the signal is ignored, or blocked or if SIGNAL_UNKILLABLE will prevent the delivery of the signal. The signal SIGKILL can not be ignored and can not be blocked and SIGNAL_UNKILLABLE won't prevent it from being delivered.
So using force_sig rather than send_sig for SIGKILL is confusing and pointless.
Because it won't impact the sending of the signal and and because using force_sig is wrong, replace force_sig with send_sig.
--- fs/cifs/connect.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/cifs/connect.c +1 -1
@@ -2454,7 +2454,7 @@ cifs_put_tcp_session(struct TCP_Server_Info *server, int from_reconnect) task =xchg (&server->tsk,NULL );if (task) -force_sig (SIGKILL , task); +send_sig (SIGKILL , task,1 ); } static struct TCP_Server_Info *
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 385/671 inet: frags: call inet_frags_fini() after unregister_pernet_subsys()
In reply to Sasha LevinFrom: Eric Dumazet <[email protected]>
[ Upstream commit ae7352d384a552d8c799c242e74a934809990a71 ]
Both IPv6 and 6lowpan are calling inet_frags_fini() too soon.
inet_frags_fini() is dismantling a kmem_cache, that might be needed later when unregister_pernet_subsys() eventually has to remove frags queues from hash tables and free them.
This fixes potential use-after-free, and is a prereq for the following patch.
--- net/ieee802154/6lowpan/reassembly.c | 2 +- net/ipv6/reassembly.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
net/ieee802154/6lowpan/reassembly.c +1 -1
@@ -629,7 +629,7 @@ int __init lowpan_net_frag_init(void)void lowpan_net_frag_exit (void ) { -inet_frags_fini (&lowpan_frags);lowpan_frags_sysctl_unregister ();unregister_pernet_subsys (&lowpan_frags_ops); +inet_frags_fini (&lowpan_frags); }
net/ipv6/reassembly.c +1 -1
@@ -593,8 +593,8 @@ int __init ipv6_frag_init(void)void ipv6_frag_exit (void ) { -inet_frags_fini (&ip6_frags);ip6_frags_sysctl_unregister ();unregister_pernet_subsys (&ip6_frags_ops);inet6_del_protocol (&frag_protocol,IPPROTO_FRAGMENT ); +inet_frags_fini (&ip6_frags); }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 386/671 net: hns3: fix a memory leak issue for hclge_map_unmap_ring_to_vf_vector
In reply to Sasha LevinFrom: Huazhong Tan <[email protected]>
[ Upstream commit 49f971bd308571fe466687227130a7082b662d0e ]
When hclge_bind_ring_with_vector() fails, hclge_map_unmap_ring_to_vf_vector() returns the error directly, so nobody will free the memory allocated by hclge_get_ring_chain_from_mbx().
So hclge_free_vector_ring_chain() should be called no matter hclge_bind_ring_with_vector() fails or not.
--- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c +1 -3
@@ -181,12 +181,10 @@ static int hclge_map_unmap_ring_to_vf_vector(struct hclge_vport *vport, bool en,return ret; ret =hclge_bind_ring_with_vector (vport, vector_id, en, &ring_chain); -if (ret) -return ret;hclge_free_vector_ring_chain (&ring_chain); -return 0 ; +return ret; } static int hclge_set_vf_promisc_mode(struct hclge_vport *vport,
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 387/671 media: Staging: media: Release the correct resource in an error handling path
In reply to Sasha LevinFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 3b6471c7becd06325eb5e701cc2602b2edbbc7b6 ]
'res' is reassigned several times in the function and if we 'goto error_unmap', its value is not the returned value of 'request_mem_region()' anymore.
Introduce a new 'struct resource *' variable (i.e. res2) to keep a pointer to the right resource, if needed in the error handling path.
--- drivers/staging/media/davinci_vpfe/dm365_ipipe.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/staging/media/davinci_vpfe/dm365_ipipe.c +5 -5
@@ -1777,7 +1777,7 @@ vpfe_ipipe_init(struct vpfe_ipipe_device *ipipe, struct platform_device *pdev)struct media_pad *pads = &ipipe->pads[0 ];struct v4l2_subdev *sd = &ipipe->subdev;struct media_entity *me = &sd->entity; -struct resource *res, *memres; +struct resource *res, *res2, *memres; res =platform_get_resource (pdev,IORESOURCE_MEM ,4 );if (!res)
@@ -1791,11 +1791,11 @@ vpfe_ipipe_init(struct vpfe_ipipe_device *ipipe, struct platform_device *pdev)if (!ipipe->base_addr) goto error_release; - res =platform_get_resource (pdev,IORESOURCE_MEM ,6 ); -if (!res) + res2 =platform_get_resource (pdev,IORESOURCE_MEM ,6 ); +if (!res2) goto error_unmap; - ipipe->isp5_base_addr =ioremap_nocache (res->start, -resource_size (res)); + ipipe->isp5_base_addr =ioremap_nocache (res2->start, +resource_size (res2));if (!ipipe->isp5_base_addr) goto error_unmap;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 388/671 crypto: talitos - fix AEAD processing.
In reply to Sasha LevinFrom: Christophe Leroy <[email protected]>
[ Upstream commit e345177ded17611e36c067751d63d64bf106cb54 ]
This driver is working well in 'simple cases', but as soon as more exotic SG lists are provided (dst different from src, auth part not in a single SG fragment, ...) there are wrong results, overruns, etc ...
This patch cleans up the AEAD processing by:
- Simplifying the location of 'out of line' ICV
- Never using 'out of line' ICV on encryp
- Always using 'out of line' ICV on decrypt
- Forcing the generation of a SG table on decrypt
--- drivers/crypto/talitos.c | 158 +++++++++++++-------------------------- drivers/crypto/talitos.h | 2 +- 2 files changed, 55 insertions(+), 105 deletions(-)
drivers/crypto/talitos.c +54 -104
@@ -974,8 +974,8 @@ static void ipsec_esp_unmap(struct device *dev, DMA_FROM_DEVICE);unmap_single_talitos_ptr (dev, civ_ptr,DMA_TO_DEVICE ); -talitos_sg_unmap (dev, edesc, areq->src, areq->dst, cryptlen, - areq->assoclen); +talitos_sg_unmap (dev, edesc, areq->src, areq->dst, + cryptlen + authsize, areq->assoclen);if (edesc->dma_len) dma_unmap_single(dev, edesc->dma_link_tbl, edesc->dma_len,
@@ -996,30 +996,15 @@ static void ipsec_esp_encrypt_done(struct device *dev, struct talitos_desc *desc, void *context, int err) { - struct talitos_private *priv = dev_get_drvdata(dev); -bool is_sec1 =has_ftr_sec1 (priv); struct aead_request *areq = context;struct crypto_aead *authenc =crypto_aead_reqtfm (areq); -unsigned int authsize =crypto_aead_authsize (authenc);unsigned int ivsize =crypto_aead_ivsize (authenc);struct talitos_edesc *edesc; -void *icvdata; edesc = container_of(desc, struct talitos_edesc, desc);ipsec_esp_unmap (dev, edesc, areq, true); -/* copy the generated ICV to dst */ -if (edesc->icv_ool) { -if (is_sec1) - icvdata = edesc->buf + areq->assoclen + areq->cryptlen; -else - icvdata = &edesc->link_tbl[edesc->src_nents + - edesc->dst_nents +2 ]; -sg_pcopy_from_buffer (areq->dst, edesc->dst_nents ? :1 , icvdata, - authsize, areq->assoclen + areq->cryptlen); - } -dma_unmap_single (dev, edesc->iv_dma, ivsize,DMA_TO_DEVICE );kfree (edesc);
@@ -1036,39 +1021,15 @@ static void ipsec_esp_decrypt_swauth_done(struct device *dev,unsigned int authsize =crypto_aead_authsize (authenc);struct talitos_edesc *edesc;char *oicv, *icv; -struct talitos_private *priv =dev_get_drvdata (dev); -bool is_sec1 =has_ftr_sec1 (priv); edesc = container_of(desc, struct talitos_edesc, desc);ipsec_esp_unmap (dev, edesc, req, false);if (!err) { -char icvdata[SHA512_DIGEST_SIZE ]; -int nents = edesc->dst_nents ? :1 ; -unsigned int len = req->assoclen + req->cryptlen; -/* auth check */ -if (nents >1 ) { -sg_pcopy_to_buffer (req->dst, nents, icvdata, authsize, - len - authsize); - icv = icvdata; - }else { - icv = (char *)sg_virt (req->dst) + len - authsize; - } - -if (edesc->dma_len) { -if (is_sec1) - oicv = (char *)&edesc->dma_link_tbl + - req->assoclen + req->cryptlen; -else - oicv = (char *) - &edesc->link_tbl[edesc->src_nents + - edesc->dst_nents +2 ]; -if (edesc->icv_ool) - icv = oicv + authsize; - }else - oicv = (char *)&edesc->link_tbl[0 ]; + oicv = edesc->buf + edesc->dma_len; + icv = oicv - authsize; err =crypto_memneq (oicv, icv, authsize) ? -EBADMSG :0 ; }
@@ -1104,11 +1065,12 @@ static void ipsec_esp_decrypt_hwauth_done(struct device *dev,* stop at cryptlen bytes */ static int sg_to_link_tbl_offset (struct scatterlist *sg,int sg_count, -unsigned int offset,int cryptlen, +unsigned int offset,int datalen,int elen,struct talitos_ptr *link_tbl_ptr) { -int n_sg = sg_count; +int n_sg = elen ? sg_count +1 : sg_count;int count =0 ; +int cryptlen = datalen + elen;while (cryptlen && sg && n_sg--) {unsigned int len =sg_dma_len (sg);
@@ -1123,11 +1085,20 @@ static int sg_to_link_tbl_offset(struct scatterlist *sg, int sg_count,if (len > cryptlen) len = cryptlen; +if (datalen >0 && len > datalen) { +to_talitos_ptr (link_tbl_ptr + count, +sg_dma_address (sg) + offset, datalen,0 ); +to_talitos_ptr_ext_set (link_tbl_ptr + count,0 ,0 ); + count++; + len -= datalen; + offset += datalen; + }to_talitos_ptr (link_tbl_ptr + count,sg_dma_address (sg) + offset, len,0 );to_talitos_ptr_ext_set (link_tbl_ptr + count,0 ,0 ); count++; cryptlen -= len; + datalen -= len; offset =0 ; next:
@@ -1137,7 +1108,7 @@ static int sg_to_link_tbl_offset(struct scatterlist *sg, int sg_count,/* tag end of link table */ if (count >0 )to_talitos_ptr_ext_set (link_tbl_ptr + count -1 , -DESC_PTR_LNKTBL_RETURN ,0 ); +DESC_PTR_LNKTBL_RET ,0 );return count; }
@@ -1145,7 +1116,8 @@ static int sg_to_link_tbl_offset(struct scatterlist *sg, int sg_count,static int talitos_sg_map_ext (struct device *dev,struct scatterlist *src,unsigned int len,struct talitos_edesc *edesc,struct talitos_ptr *ptr,int sg_count, -unsigned int offset,int tbl_off,int elen) +unsigned int offset,int tbl_off,int elen, +bool force) {struct talitos_private *priv =dev_get_drvdata (dev);bool is_sec1 =has_ftr_sec1 (priv);
@@ -1155,7 +1127,7 @@ static int talitos_sg_map_ext(struct device *dev, struct scatterlist *src,return 1 ; }to_talitos_ptr_ext_set (ptr, elen, is_sec1); -if (sg_count ==1 ) { +if (sg_count ==1 && !force) {to_talitos_ptr (ptr,sg_dma_address (src) + offset, len, is_sec1);return sg_count; }
@@ -1163,9 +1135,9 @@ static int talitos_sg_map_ext(struct device *dev, struct scatterlist *src,to_talitos_ptr (ptr, edesc->dma_link_tbl + offset, len, is_sec1);return sg_count; } - sg_count =sg_to_link_tbl_offset (src, sg_count, offset, len + elen, + sg_count =sg_to_link_tbl_offset (src, sg_count, offset, len, elen, &edesc->link_tbl[tbl_off]); -if (sg_count ==1 ) { +if (sg_count ==1 && !force) {/* Only one segment now, so no link tbl needed*/ copy_talitos_ptr (ptr, &edesc->link_tbl[tbl_off], is_sec1);return sg_count;
@@ -1183,7 +1155,7 @@ static int talitos_sg_map(struct device *dev, struct scatterlist *src, unsigned int offset, int tbl_off) {return talitos_sg_map_ext (dev, src, len, edesc, ptr, sg_count, offset, - tbl_off,0 ); + tbl_off,0 , false); }/*
@@ -1211,6 +1183,7 @@ static int ipsec_esp(struct talitos_edesc *edesc, struct aead_request *areq,bool is_ipsec_esp = desc->hdr &DESC_HDR_TYPE_IPSEC_ESP ;struct talitos_ptr *civ_ptr = &desc->ptr[is_ipsec_esp ?2 :3 ];struct talitos_ptr *ckey_ptr = &desc->ptr[is_ipsec_esp ?3 :2 ]; +dma_addr_t dma_icv = edesc->dma_link_tbl + edesc->dma_len - authsize;/* hmac key */ to_talitos_ptr (&desc->ptr[0 ], ctx->dma_key, ctx->authkeylen, is_sec1);
@@ -1250,7 +1223,8 @@ static int ipsec_esp(struct talitos_edesc *edesc, struct aead_request *areq, elen = authsize; ret =talitos_sg_map_ext (dev, areq->src, cryptlen, edesc, &desc->ptr[4 ], - sg_count, areq->assoclen, tbl_off, elen); + sg_count, areq->assoclen, tbl_off, elen, + false);if (ret >1 ) { tbl_off += ret;
@@ -1264,55 +1238,35 @@ static int ipsec_esp(struct talitos_edesc *edesc, struct aead_request *areq,dma_map_sg (dev, areq->dst, sg_count,DMA_FROM_DEVICE ); } - ret =talitos_sg_map (dev, areq->dst, cryptlen, edesc, &desc->ptr[5 ], - sg_count, areq->assoclen, tbl_off); - -if (is_ipsec_esp) -to_talitos_ptr_ext_or (&desc->ptr[5 ], authsize, is_sec1); +if (is_ipsec_esp && encrypt) + elen = authsize; +else + elen =0 ; + ret =talitos_sg_map_ext (dev, areq->dst, cryptlen, edesc, &desc->ptr[5 ], + sg_count, areq->assoclen, tbl_off, elen, + is_ipsec_esp && !encrypt); + tbl_off += ret;/* ICV data */ -if (ret >1 ) { - tbl_off += ret; - edesc->icv_ool = true; - sync_needed = true; + edesc->icv_ool = !encrypt; -if (is_ipsec_esp) { -struct talitos_ptr *tbl_ptr = &edesc->link_tbl[tbl_off]; -int offset = (edesc->src_nents + edesc->dst_nents +2 ) * -sizeof (struct talitos_ptr ) + authsize; +if (!encrypt && is_ipsec_esp) { +struct talitos_ptr *tbl_ptr = &edesc->link_tbl[tbl_off]; -/* Add an entry to the link table for ICV data */ -to_talitos_ptr_ext_set (tbl_ptr -1 ,0 , is_sec1); -to_talitos_ptr_ext_set (tbl_ptr,DESC_PTR_LNKTBL_RETURN , - is_sec1); +/* Add an entry to the link table for ICV data */ +to_talitos_ptr_ext_set (tbl_ptr -1 ,0 , is_sec1); +to_talitos_ptr_ext_set (tbl_ptr,DESC_PTR_LNKTBL_RET , is_sec1); -/* icv data follows link tables */ -to_talitos_ptr (tbl_ptr, edesc->dma_link_tbl + offset, - authsize, is_sec1); - }else { -dma_addr_t addr = edesc->dma_link_tbl; - -if (is_sec1) - addr += areq->assoclen + cryptlen; -else - addr +=sizeof (struct talitos_ptr ) * tbl_off; - -to_talitos_ptr (&desc->ptr[6 ], addr, authsize, is_sec1); - } +/* icv data follows link tables */ +to_talitos_ptr (tbl_ptr, dma_icv, authsize, is_sec1); +to_talitos_ptr_ext_or (&desc->ptr[5 ], authsize, is_sec1); + sync_needed = true; + }else if (!encrypt) { +to_talitos_ptr (&desc->ptr[6 ], dma_icv, authsize, is_sec1); + sync_needed = true; }else if (!is_ipsec_esp) { - ret =talitos_sg_map (dev, areq->dst, authsize, edesc, - &desc->ptr[6 ], sg_count, areq->assoclen + - cryptlen, - tbl_off); -if (ret >1 ) { - tbl_off += ret; - edesc->icv_ool = true; - sync_needed = true; - }else { - edesc->icv_ool = false; - } - }else { - edesc->icv_ool = false; +talitos_sg_map (dev, areq->dst, authsize, edesc, &desc->ptr[6 ], + sg_count, areq->assoclen + cryptlen, tbl_off); }/* iv out */
@@ -1395,18 +1349,18 @@ static struct talitos_edesc *talitos_edesc_alloc(struct device *dev,* and space for two sets of ICVs (stashed and generated) */ alloc_len =sizeof (struct talitos_edesc ); -if (src_nents || dst_nents) { +if (src_nents || dst_nents || !encrypt) {if (is_sec1) dma_len = (src_nents ? src_len :0 ) + - (dst_nents ? dst_len :0 ); + (dst_nents ? dst_len :0 ) + authsize;else dma_len = (src_nents + dst_nents +2 ) * -sizeof (struct talitos_ptr ) + authsize *2 ; +sizeof (struct talitos_ptr ) + authsize; alloc_len += dma_len; }else { dma_len =0 ; - alloc_len += icv_stashing ? authsize :0 ; } + alloc_len += icv_stashing ? authsize :0 ;/* if its a ahash, add space for a second desc next to the first one */ if (is_sec1 && !dst)
@@ -1500,11 +1454,7 @@ static int aead_decrypt(struct aead_request *req) edesc->desc.hdr = ctx->desc_hdr_template |DESC_HDR_DIR_INBOUND ;/* stash incoming ICV for later cmp with ICV generated by the h/w */ -if (edesc->dma_len) - icvdata = (char *)&edesc->link_tbl[edesc->src_nents + - edesc->dst_nents +2 ]; -else - icvdata = &edesc->link_tbl[0 ]; + icvdata = edesc->buf + edesc->dma_len;sg_pcopy_to_buffer (req->src, edesc->src_nents ? :1 , icvdata, authsize, req->assoclen + req->cryptlen - authsize);
drivers/crypto/talitos.h +1 -1
@@ -442,5 +442,5 @@ static inline bool has_ftr_sec1(struct talitos_private *priv)/* link table extent field bits */ #define DESC_PTR_LNKTBL_JUMP 0x80 -#define DESC_PTR_LNKTBL_RETURN 0x02 +#define DESC_PTR_LNKTBL_RET 0x02#define DESC_PTR_LNKTBL_NEXT 0x01
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 389/671 netvsc: unshare skb in VF rx handler
In reply to Sasha LevinFrom: Stephen Hemminger <[email protected]>
[ Upstream commit 996ed04741467f6d1552440c92988b132a9487ec ]
The netvsc VF skb handler should make sure that skb is not shared. Similar logic already exists in bonding and team device drivers.
This is not an issue in practice because the VF devicex does not send up shared skb's. But the netvsc driver should do the right thing if it did.
--- drivers/net/hyperv/netvsc_drv.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/net/hyperv/netvsc_drv.c +6 -0
@@ -2004,6 +2004,12 @@ static rx_handler_result_t netvsc_vf_handle_frame(struct sk_buff **pskb)struct netvsc_vf_pcpu_stats *pcpu_stats =this_cpu_ptr (ndev_ctx->vf_stats); + skb =skb_share_check (skb,GFP_ATOMIC ); +if (unlikely (!skb)) +return RX_HANDLER_CONSUMED ; + + *pskb = skb; + skb->dev = ndev;u64_stats_update_begin (&pcpu_stats->syncp);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 390/671 net: core: support XDP generic on stacked devices.
In reply to Sasha LevinFrom: Stephen Hemminger <[email protected]>
[ Upstream commit 458bf2f224f04a513b0be972f8708e78ee2c986e ]
When a device is stacked like (team, bonding, failsafe or netvsc) the XDP generic program for the parent device was not called.
Move the call to XDP generic inside __netif_receive_skb_core where it can be done multiple times for stacked case.
--- net/core/dev.c | 58 +++++++++++--------------------------------------- 1 file changed, 12 insertions(+), 46 deletions(-)
net/core/dev.c +12 -46
@@ -4465,23 +4465,6 @@ static int netif_rx_internal(struct sk_buff *skb)trace_netif_rx (skb); -if (static_branch_unlikely (&generic_xdp_needed_key)) { -int ret; - -preempt_disable (); -rcu_read_lock (); - ret =do_xdp_generic (rcu_dereference (skb->dev->xdp_prog), skb); -rcu_read_unlock (); -preempt_enable (); - -/* Consider XDP consuming the packet a success from -* the netdev point of view we do not want to count -* this as an error. -*/ -if (ret !=XDP_PASS ) -return NET_RX_SUCCESS ; - } -#ifdef CONFIG_RPS if (static_key_false (&rps_needed)) {struct rps_dev_flow voidflow, *rflow = &voidflow;
@@ -4815,6 +4798,18 @@ static int __netif_receive_skb_core(struct sk_buff *skb, bool pfmemalloc,__this_cpu_inc (softnet_data.processed); +if (static_branch_unlikely (&generic_xdp_needed_key)) { +int ret2; + +preempt_disable (); + ret2 =do_xdp_generic (rcu_dereference (skb->dev->xdp_prog), skb); +preempt_enable (); + +if (ret2 !=XDP_PASS ) +return NET_RX_DROP ; +skb_reset_mac_len (skb); + } +if (skb->protocol ==cpu_to_be16 (ETH_P_8021Q ) || skb->protocol ==cpu_to_be16 (ETH_P_8021AD )) { skb =skb_vlan_untag (skb);
@@ -5133,19 +5128,6 @@ static int netif_receive_skb_internal(struct sk_buff *skb)if (skb_defer_rx_timestamp (skb))return NET_RX_SUCCESS ; -if (static_branch_unlikely (&generic_xdp_needed_key)) { -int ret; - -preempt_disable (); -rcu_read_lock (); - ret =do_xdp_generic (rcu_dereference (skb->dev->xdp_prog), skb); -rcu_read_unlock (); -preempt_enable (); - -if (ret !=XDP_PASS ) -return NET_RX_DROP ; - } -rcu_read_lock ();#ifdef CONFIG_RPS if (static_key_false (&rps_needed)) {
@@ -5166,7 +5148,6 @@ static int netif_receive_skb_internal(struct sk_buff *skb)static void netif_receive_skb_list_internal (struct list_head *head) { -struct bpf_prog *xdp_prog =NULL ;struct sk_buff *skb, *next;struct list_head sublist;
@@ -5179,21 +5160,6 @@ static void netif_receive_skb_list_internal(struct list_head *head) }list_splice_init (&sublist, head); -if (static_branch_unlikely (&generic_xdp_needed_key)) { -preempt_disable (); -rcu_read_lock (); -list_for_each_entry_safe (skb, next, head, list) { - xdp_prog =rcu_dereference (skb->dev->xdp_prog); -skb_list_del_init (skb); -if (do_xdp_generic (xdp_prog, skb) ==XDP_PASS ) -list_add_tail (&skb->list, &sublist); - } -rcu_read_unlock (); -preempt_enable (); -/* Put passed packets back on main list */ -list_splice_init (&sublist, head); - } -rcu_read_lock ();#ifdef CONFIG_RPS if (static_key_false (&rps_needed)) {
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 391/671 RDMA/uverbs: check for allocation failure in uapi_add_elm()
In reply to Sasha LevinFrom: Dan Carpenter <[email protected]>
[ Upstream commit cac2a301c02a9b178842e22df34217da7854e588 ]
If the kzalloc() fails then we should return ERR_PTR(-ENOMEM). In the current code it's possible that the kzalloc() fails and the radix_tree_insert() inserts the NULL pointer successfully and we return the NULL "elm" pointer to the caller. That results in a NULL pointer dereference.
--- drivers/infiniband/core/uverbs_uapi.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/infiniband/core/uverbs_uapi.c +2 -0
@@ -17,6 +17,8 @@ static void *uapi_add_elm(struct uverbs_api *uapi, u32 key, size_t alloc_size)return ERR_PTR (-EOVERFLOW ); elm =kzalloc (alloc_size,GFP_KERNEL ); +if (!elm) +return ERR_PTR (-ENOMEM ); rc =radix_tree_insert (&uapi->radix, key, elm);if (rc) {kfree (elm);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 392/671 net: don't clear sock->sk early to avoid trouble in strparser
In reply to Sasha LevinFrom: Jakub Kicinski <[email protected]>
[ Upstream commit 2b81f8161dfeda4017cef4f2498ccb64b13f0d61 ]
af_inet sets sock->sk to NULL which trips strparser over:
BUG: kernel NULL pointer dereference, address: 0000000000000012 PGD 0 P4D 0 Oops: 0000 [#1] SMP PTI CPU: 7 PID: 0 Comm: swapper/7 Not tainted 5.2.0-rc1-00139-g14629453a6d3 #21 RIP: 0010:tcp_peek_len+0x10/0x60 RSP: 0018:ffffc02e41c54b98 EFLAGS: 00010246 RAX: 0000000000000000 RBX: ffff9cf924c4e030 RCX: 0000000000000051 RDX: 0000000000000000 RSI: 000000000000000c RDI: ffff9cf97128f480 RBP: ffff9cf9365e0300 R08: ffff9cf94fe7d2c0 R09: 0000000000000000 R10: 000000000000036b R11: ffff9cf939735e00 R12: ffff9cf91ad9ae40 R13: ffff9cf924c4e000 R14: ffff9cf9a8fcbaae R15: 0000000000000020 FS: 0000000000000000(0000) GS:ffff9cf9af7c0000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000000012 CR3: 000000013920a003 CR4: 00000000003606e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: <IRQ> strp_data_ready+0x48/0x90 tls_data_ready+0x22/0xd0 [tls] tcp_rcv_established+0x569/0x620 tcp_v4_do_rcv+0x127/0x1e0 tcp_v4_rcv+0xad7/0xbf0 ip_protocol_deliver_rcu+0x2c/0x1c0 ip_local_deliver_finish+0x41/0x50 ip_local_deliver+0x6b/0xe0 ? ip_protocol_deliver_rcu+0x1c0/0x1c0 ip_rcv+0x52/0xd0 ? ip_rcv_finish_core.isra.20+0x380/0x380 __netif_receive_skb_one_core+0x7e/0x90 netif_receive_skb_internal+0x42/0xf0 napi_gro_receive+0xed/0x150 nfp_net_poll+0x7a2/0xd30 [nfp] ? kmem_cache_free_bulk+0x286/0x310 net_rx_action+0x149/0x3b0 __do_softirq+0xe3/0x30a ? handle_irq_event_percpu+0x6a/0x80 irq_exit+0xe8/0xf0 do_IRQ+0x85/0xd0 common_interrupt+0xf/0xf </IRQ> RIP: 0010:cpuidle_enter_state+0xbc/0x450
To avoid this issue set sock->sk after sk_prot->close. My grepping and testing did not discover any code which would depend on the current behaviour.
--- net/ipv4/af_inet.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv4/af_inet.c +1 -1
@@ -424,8 +424,8 @@ int inet_release(struct socket *sock)if (sock_flag (sk,SOCK_LINGER ) && !(current->flags &PF_EXITING )) timeout = sk->sk_lingertime; - sock->sk =NULL ; sk->sk_prot->close (sk, timeout); + sock->sk =NULL ; }return 0 ; }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 393/671 phy: qcom-qusb2: fix missing assignment of ret when calling clk_prepare_enable
In reply to Sasha LevinFrom: Colin Ian King <[email protected]>
[ Upstream commit d98010817a26eba8d4d1e8a639e0b7d7f042308a ]
The error return from the call to clk_prepare_enable is not being assigned to variable ret even though ret is being used to check if the call failed. Fix this by adding in the missing assignment.
Addresses-Coverity: ("Logically dead code")
--- drivers/phy/qualcomm/phy-qcom-qusb2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/phy/qualcomm/phy-qcom-qusb2.c +1 -1
@@ -526,7 +526,7 @@ static int __maybe_unused qusb2_phy_runtime_resume(struct device *dev) }if (!qphy->has_se_clk_scheme) { -clk_prepare_enable (qphy->ref_clk); + ret =clk_prepare_enable (qphy->ref_clk);if (ret) {dev_err (dev,"failed to enable ref clk, %d\n" , ret); goto disable_ahb_clk;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 394/671 cpufreq: brcmstb-avs-cpufreq: Fix initial command check
In reply to Sasha LevinFrom: Florian Fainelli <[email protected]>
[ Upstream commit 22a26cc6a51ef73dcfeb64c50513903f6b2d53d8 ]
There is a logical error in brcm_avs_is_firmware_loaded() whereby if the firmware returns -EINVAL, we will be reporting this as an error. The comment is correct, the code was not.
--- drivers/cpufreq/brcmstb-avs-cpufreq.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/cpufreq/brcmstb-avs-cpufreq.c +2 -2
@@ -446,8 +446,8 @@ static bool brcm_avs_is_firmware_loaded(struct private_data *priv) rc =brcm_avs_get_pmap (priv,NULL ); magic =readl (priv->base +AVS_MBOX_MAGIC ); -return (magic ==AVS_FIRMWARE_MAGIC ) && (rc != -ENOTSUPP ) && - (rc != -EINVAL ); +return (magic ==AVS_FIRMWARE_MAGIC ) && ((rc != -ENOTSUPP ) || + (rc != -EINVAL )); }static unsigned int brcm_avs_cpufreq_get (unsigned int cpu)
Signature · 7 lines
2.20.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Sasha Levin
maintainerPATCH 395/671 cpufreq: brcmstb-avs-cpufreq: Fix types for voltage/frequency
In reply to Sasha LevinFrom: Florian Fainelli <[email protected]>
[ Upstream commit 4c5681fcc684c762b09435de3e82ffeee7769d21 ]
What we read back from the register is going to be capped at 32-bits, and cpufreq_freq_table.frequency is an unsigned int. Avoid any possible value truncation by using the appropriate return value.
--- drivers/cpufreq/brcmstb-avs-cpufreq.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/cpufreq/brcmstb-avs-cpufreq.c +4 -4
@@ -384,12 +384,12 @@ static int brcm_avs_set_pstate(struct private_data *priv, unsigned int pstate)return __issue_avs_command (priv,AVS_CMD_SET_PSTATE , true, args); } -static unsigned long brcm_avs_get_voltage (void __iomem *base) +static u32 brcm_avs_get_voltage (void __iomem *base) {return readl (base +AVS_MBOX_VOLTAGE1 ); } -static unsigned long brcm_avs_get_frequency (void __iomem *base) +static u32 brcm_avs_get_frequency (void __iomem *base) {return readl (base +AVS_MBOX_FREQUENCY ) *1000 ;/* in kHz */ }
@@ -653,14 +653,14 @@ static ssize_t show_brcm_avs_voltage(struct cpufreq_policy *policy, char *buf) {struct private_data *priv = policy->driver_data; -return sprintf (buf,"0x%08lx\n" ,brcm_avs_get_voltage (priv->base)); +return sprintf (buf,"0x%08x\n" ,brcm_avs_get_voltage (priv->base)); }static ssize_t show_brcm_avs_frequency (struct cpufreq_policy *policy,char *buf) {struct private_data *priv = policy->driver_data; -return sprintf (buf,"0x%08lx\n" ,brcm_avs_get_frequency (priv->base)); +return sprintf (buf,"0x%08x\n" ,brcm_avs_get_frequency (priv->base)); }cpufreq_freq_attr_ro (brcm_avs_pstate);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 396/671 clk: sunxi-ng: sun50i-h6-r: Fix incorrect W1 clock gate register
In reply to Sasha LevinFrom: Ondrej Jirman <[email protected]>
[ Upstream commit f167675486c37b88620d344fbb12d06e34f11d47 ]
The current code defines W1 clock gate to be at 0x1cc, overlaying it with the IR gate.
Clock gate for r-apb1-w1 is at 0x1ec. This fixes issues with IR receiver causing interrupt floods on H6 (because interrupt flags can't be cleared, due to IR module's bus being disabled).
--- drivers/clk/sunxi-ng/ccu-sun50i-h6-r.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/sunxi-ng/ccu-sun50i-h6-r.c +1 -1
@@ -104,7 +104,7 @@ static SUNXI_CCU_GATE(r_apb2_i2c_clk, "r-apb2-i2c", "r-apb2", static SUNXI_CCU_GATE(r_apb1_ir_clk, "r-apb1-ir", "r-apb1", 0x1cc, BIT(0), 0); static SUNXI_CCU_GATE(r_apb1_w1_clk, "r-apb1-w1", "r-apb1", - 0x1cc, BIT(0), 0); + 0x1ec, BIT(0), 0);/* Information of IR(RX) mod clock is gathered from BSP source code */ static const char *const r_mod0_default_parents[] = {"osc32k" ,"osc24M" };
Signature · 7 lines
2.20.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Sasha Levin
maintainerPATCH 397/671 media: vivid: fix incorrect assignment operation when setting video mode
In reply to Sasha LevinFrom: Colin Ian King <[email protected]>
[ Upstream commit d4ec9550e4b2d2e357a46fdc65d8ef3d4d15984c ]
The assigment of FB_VMODE_NONINTERLACE to var->vmode should be a bit-wise or of FB_VMODE_NONINTERLACE instead of an assignment, otherwise the previous clearing of the FB_VMODE_MASK bits of var->vmode makes no sense and is redundant.
Addresses-Coverity: ("Unused value")
--- drivers/media/platform/vivid/vivid-osd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/vivid/vivid-osd.c +1 -1
@@ -155,7 +155,7 @@ static int _vivid_fb_check_var(struct fb_var_screeninfo *var, struct vivid_dev * var->nonstd =0 ; var->vmode &= ~FB_VMODE_MASK ; - var->vmode =FB_VMODE_NONINTERLACED ; + var->vmode |=FB_VMODE_NONINTERLACED ;/* Dummy values */ var->hsync_len =24 ;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 398/671 crypto: inside-secure - fix zeroing of the request in ahash_exit_inv
In reply to Sasha LevinFrom: Antoine Tenart <[email protected]>
[ Upstream commit b926213d6fede9c9427d7c12eaf7d9f0895deb4e ]
A request is zeroed in safexcel_ahash_exit_inv(). This request total size is EIP197_AHASH_REQ_SIZE while the memset zeroing it uses sizeof(struct ahash_request), which happens to be less than EIP197_AHASH_REQ_SIZE. This patch fixes it.
--- drivers/crypto/inside-secure/safexcel_hash.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/crypto/inside-secure/safexcel_hash.c +1 -1
@@ -486,7 +486,7 @@ static int safexcel_ahash_exit_inv(struct crypto_tfm *tfm)struct safexcel_inv_result result = {};int ring = ctx->base.ring; -memset (req,0 ,sizeof (struct ahash_request )); +memset (req,0 ,EIP197_AHASH_REQ_SIZE );/* create invalidation request */ init_completion (&result.completion);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 399/671 crypto: inside-secure - fix queued len computation
In reply to Sasha LevinFrom: Antoine Tenart <[email protected]>
[ Upstream commit ccd65a206a5025cf953a2e4f37e894921b131a5c ]
This patch fixes the queued len computation, which could theoretically be wrong if req->len[1] - req->processed[1] > 1. Be future-proof here, and fix it.
--- drivers/crypto/inside-secure/safexcel_hash.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/crypto/inside-secure/safexcel_hash.c +5 -3
@@ -50,10 +50,12 @@ struct safexcel_ahash_req {static inline u64 safexcel_queued_len (struct safexcel_ahash_req *req) { -if (req->len[1 ] > req->processed[1 ]) -return 0xffffffff - (req->len[0 ] - req->processed[0 ]); +u64 len, processed; -return req->len[0 ] - req->processed[0 ]; + len = (0xffffffff * req->len[1 ]) + req->len[0 ]; + processed = (0xffffffff * req->processed[1 ]) + req->processed[0 ]; + +return len - processed; } static void safexcel_hash_token(struct safexcel_command_desc *cdesc,
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 400/671 arm64: dts: renesas: ebisu: Remove renesas, no-ether-link property
In reply to Sasha LevinFrom: Takeshi Kihara <[email protected]>
[ Upstream commit 90d4fa39d028f2e46c57c3d0e1b759e5287d98b7 ]
It is incorrect to specify the no-ether-link property for the AVB device on the Ebisu board. This is because the property should only be used when a board does not provide a proper AVB_LINK signal. However, the Ebisu board does provide this signal.
As per 87c059e9c39d ("arm64: dts: renesas: salvator-x: Remove renesas, no-ether-link property") this fixes a bug:
Steps to reproduce:
- start AVB TX stream (Using aplay via MSE),
- disconnect+reconnect the eth cable,
- after a reconnection the eth connection goes iteratively up/down without user interaction,
- this may heal after some seconds or even stay for minutes.
As the documentation specifies, the "renesas,no-ether-link" option should be used when a board does not provide a proper AVB_LINK signal. There is no need for this option enabled on RCAR H3/M3 Salvator-X/XS and ULCB starter kits since the AVB_LINK is correctly handled by HW.
Choosing to keep or remove the "renesas,no-ether-link" option will have impact on the code flow in the following ways:
- keeping this option enabled may lead to unexpected behavior since the RX & TX are enabled/disabled directly from adjust_link function without any HW interrogation,
- removing this option, the RX & TX will only be enabled/disabled after HW interrogation. The HW check is made through the LMON pin in PSR register which specifies AVB_LINK signal value (0 - at low level; 1 - at high level).
In conclusion, the present change is also a safety improvement because it removes the "renesas,no-ether-link" option leading to a proper way of detecting the link state based on HW interrogation and not on software heuristic.
--- arch/arm64/boot/dts/renesas/r8a77990-ebisu.dts | 1 - 1 file changed, 1 deletion(-)
arch/arm64/boot/dts/renesas/r8a77990-ebisu.dts +0 -1
@@ -33,7 +33,6 @@ &avb { pinctrl-0 = <&avb_pins>; pinctrl-names = "default"; - renesas,no-ether-link; phy-handle = <&phy0>; phy-mode = "rgmii-txid"; status = "okay";
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 401/671 mpls: fix warning with multi-label encap
In reply to Sasha LevinFrom: George Wilkie <[email protected]>
[ Upstream commit 2f3f7d1fa0d1039b24a55d127ed190f196fc3e79 ]
If you configure a route with multiple labels, e.g.
ip route add 10.10.3.0/24 encap mpls 16/100 via 10.10.2.2 dev ens4
A warning is logged:
kernel: [ 130.561819] netlink: 'ip': attribute type 1 has an invalid length.
This happens because mpls_iptunnel_policy has set the type of MPLS_IPTUNNEL_DST to fixed size NLA_U32.
Change it to a minimum size.nla_get_labels() does the remaining validation.
--- net/mpls/mpls_iptunnel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/mpls/mpls_iptunnel.c +1 -1
@@ -28,7 +28,7 @@#include "internal.h" static const struct nla_policy mpls_iptunnel_policy[MPLS_IPTUNNEL_MAX +1 ] = { - [MPLS_IPTUNNEL_DST ] = { .type =NLA_U32 }, + [MPLS_IPTUNNEL_DST ] = { .len =sizeof (u32) }, [MPLS_IPTUNNEL_TTL ] = { .type =NLA_U8 }, };
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 402/671 serial: stm32: fix a recursive locking in stm32_config_rs485
In reply to Sasha LevinFrom: Borut Seljak <[email protected]>
[ Upstream commit 707aeea13a9c85520262e11899d86df3c4b48262 ]
Remove spin_lock_irqsave in stm32_config_rs485, it cause recursive locking. Already locked in uart_set_rs485_config.
--- drivers/tty/serial/stm32-usart.c | 3 --- 1 file changed, 3 deletions(-)
drivers/tty/serial/stm32-usart.c +0 -3
@@ -105,9 +105,7 @@ static int stm32_config_rs485(struct uart_port *port,struct stm32_usart_config *cfg = &stm32_port->info->cfg;u32 usartdiv, baud, cr1, cr3;bool over8; -unsigned long flags; -spin_lock_irqsave (&port->lock, flags);stm32_clr_bits (port, ofs->cr1,BIT (cfg->uart_enable_bit)); port->rs485 = *rs485conf;
@@ -147,7 +145,6 @@ static int stm32_config_rs485(struct uart_port *port, }stm32_set_bits (port, ofs->cr1,BIT (cfg->uart_enable_bit)); -spin_unlock_irqrestore (&port->lock, flags);return 0 ; }
Signature · 7 lines
2.20.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Sasha Levin
maintainerPATCH 403/671 arm64: dts: meson-gxm-khadas-vim2: fix gpio-keys-polled node
In reply to Sasha LevinFrom: Christian Hewitt <[email protected]>
[ Upstream commit 0afd24c2fb61bd5163bab08ea1ee54d60d3ea37e ]
Fix DTC warnings:
meson-gxm-khadas-vim2.dtb: Warning (avoid_unnecessary_addr_size):
/gpio-keys-polled: unnecessary #address-cells/#size-cells
without "ranges" or child "reg" property
--- arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts +1 -3
@@ -63,11 +63,9 @@ gpio-keys-polled { compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; poll-interval = <100>; - button@0 { + power-button { label = "power"; linux,code = <KEY_POWER>; gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_LOW>;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 404/671 arm64: dts: meson-gxm-khadas-vim2: fix Bluetooth support
In reply to Sasha LevinFrom: Christian Hewitt <[email protected]>
[ Upstream commit 33344e2111a3a07097a66f339ad213b047ccdfd2 ]
- Remove serial1 alias
- Add support for uart_A rts/cts
- Add bluetooth uart_A subnode qith shutdown gpio
--- arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts +7 -2
@@ -18,7 +18,6 @@ aliases { serial0 = &uart_AO; - serial1 = &uart_A; serial2 = &uart_AO_B; };
@@ -407,8 +406,14 @@ /* This one is connected to the Bluetooth module */ &uart_A { status = "okay"; - pinctrl-0 = <&uart_a_pins>; + pinctrl-0 = <&uart_a_pins>, <&uart_a_cts_rts_pins>; pinctrl-names = "default"; + uart-has-rtscts; + + bluetooth { + compatible = "brcm,bcm43438-bt"; + shutdown-gpios = <&gpio GPIOX_17 GPIO_ACTIVE_HIGH>; + }; }; /* This is brought out on the Linux_RX (18) and Linux_TX (19) pins: */
Signature · 7 lines
2.20.1 _______________________________________________ linux-amlogic mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-amlogic
Sasha Levin
maintainerPATCH 405/671 iommu/vt-d: Duplicate iommu_resv_region objects per device list
In reply to Sasha LevinFrom: Eric Auger <[email protected]>
[ Upstream commit 5f64ce5411b467f1cfea6c63e2494c22b773582b ]
intel_iommu_get_resv_regions() aims to return the list of reserved regions accessible by a given @device. However several devices can access the same reserved memory region and when building the list it is not safe to use a single iommu_resv_region object, whose container is the RMRR. This iommu_resv_region must be duplicated per device reserved region list.
Let's remove the struct iommu_resv_region from the RMRR unit and allocate the iommu_resv_region directly in intel_iommu_get_resv_regions(). We hold the dmar_global_lock instead of the rcu-lock to allow sleeping.
--- drivers/iommu/intel-iommu.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-)
drivers/iommu/intel-iommu.c +17 -17
@@ -387,7 +387,6 @@ struct dmar_rmrr_unit {u64 end_address;/* reserved end address */ struct dmar_dev_scope *devices;/* target devices */ int devices_cnt;/* target device count */ -struct iommu_resv_region *resv;/* reserved region handle */ };struct dmar_atsr_unit {
@@ -4185,7 +4184,6 @@ static inline void init_iommu_pm_ops(void) {}int __init dmar_parse_one_rmrr (struct acpi_dmar_header *header,void *arg) {struct acpi_dmar_reserved_memory *rmrr; -int prot =DMA_PTE_READ |DMA_PTE_WRITE ;struct dmar_rmrr_unit *rmrru;size_t length;
@@ -4199,22 +4197,16 @@ int __init dmar_parse_one_rmrr(struct acpi_dmar_header *header, void *arg) rmrru->end_address = rmrr->end_address; length = rmrr->end_address - rmrr->base_address +1 ; - rmrru->resv =iommu_alloc_resv_region (rmrr->base_address, length, prot, -IOMMU_RESV_DIRECT ); -if (!rmrru->resv) - goto free_rmrru; rmrru->devices =dmar_alloc_dev_scope ((void *)(rmrr +1 ), ((void *)rmrr) + rmrr->header.length, &rmrru->devices_cnt);if (rmrru->devices_cnt && rmrru->devices ==NULL ) - goto free_all; + goto free_rmrru;list_add (&rmrru->list, &dmar_rmrr_units);return 0 ; -free_all: -kfree (rmrru->resv); free_rmrru:kfree (rmrru); out:
@@ -4432,7 +4424,6 @@ static void intel_iommu_free_dmars(void)list_for_each_entry_safe (rmrru, rmrr_n, &dmar_rmrr_units, list) {list_del (&rmrru->list);dmar_free_dev_scope (&rmrru->devices, &rmrru->devices_cnt); -kfree (rmrru->resv);kfree (rmrru); }
@@ -5206,22 +5197,33 @@ static void intel_iommu_remove_device(struct device *dev)static void intel_iommu_get_resv_regions (struct device *device,struct list_head *head) { +int prot =DMA_PTE_READ |DMA_PTE_WRITE ;struct iommu_resv_region *reg;struct dmar_rmrr_unit *rmrr;struct device *i_dev;int i; -rcu_read_lock (); +down_read (&dmar_global_lock);for_each_rmrr_units (rmrr) {for_each_active_dev_scope (rmrr->devices, rmrr->devices_cnt, i, i_dev) { +struct iommu_resv_region *resv; +size_t length; +if (i_dev != device)continue ; -list_add_tail (&rmrr->resv->list, head); + length = rmrr->end_address - rmrr->base_address +1 ; + resv =iommu_alloc_resv_region (rmrr->base_address, + length, prot, +IOMMU_RESV_DIRECT ); +if (!resv) +break ; + +list_add_tail (&resv->list, head); } } -rcu_read_unlock (); +up_read (&dmar_global_lock); reg = iommu_alloc_resv_region(IOAPIC_RANGE_START, IOAPIC_RANGE_END - IOAPIC_RANGE_START + 1,
@@ -5236,10 +5238,8 @@ static void intel_iommu_put_resv_regions(struct device *dev, {struct iommu_resv_region *entry, *next; -list_for_each_entry_safe (entry, next, head, list) { -if (entry->type ==IOMMU_RESV_MSI ) -kfree (entry); - } +list_for_each_entry_safe (entry, next, head, list) +kfree (entry); }#ifdef CONFIG_INTEL_IOMMU_SVM
Signature · 6 lines
2.20.1 _______________________________________________ iommu mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/iommu
Sasha Levin
maintainerPATCH 406/671 phy: usb: phy-brcm-usb: Remove sysfs attributes upon driver removal
In reply to Sasha LevinFrom: Florian Fainelli <[email protected]>
[ Upstream commit d9e100829fca6cbd270d7e005b0c0bb2d14924b8 ]
We are not destroying the sysfs attribute groupe we registered during the probe function which will make subsequent probe calls to that driver fail. Correct that with adding a remove function which only removes those attributes since the reference counting on clocks did its job already.
--- drivers/phy/broadcom/phy-brcm-usb.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/phy/broadcom/phy-brcm-usb.c +8 -0
@@ -378,6 +378,13 @@ static int brcm_usb_phy_probe(struct platform_device *pdev)return 0 ; } +static int brcm_usb_phy_remove (struct platform_device *pdev) +{ +sysfs_remove_group (&pdev->dev.kobj, &brcm_usb_phy_group); + +return 0 ; +} +#ifdef CONFIG_PM_SLEEP static int brcm_usb_phy_suspend (struct device *dev) {
@@ -443,6 +450,7 @@ MODULE_DEVICE_TABLE(of, brcm_usb_dt_ids);static struct platform_driver brcm_usb_driver = { .probe = brcm_usb_phy_probe, + .remove = brcm_usb_phy_remove, .driver = { .name ="brcmstb-usb-phy" , .owner =THIS_MODULE ,
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 407/671 firmware: arm_scmi: fix bitfield definitions for SENSOR_DESC attributes
In reply to Sasha LevinFrom: Sudeep Holla <[email protected]>
[ Upstream commit 430daaf96ad133be5ce7c3a5c60e94247f7c6f71 ]
As per the SCMI specification the bitfields for SENSOR_DESC attributes are as follows:attributes_low [7:0] Number of trip points supportedattributes_high [15:11] The power-of-10 multiplier in 2's-complement
format that is applied to the sensor units
Looks like the code developed during the draft versions of the specification slipped through and are wrong with respect to final released version. Fix them by adjusting the bitfields appropriately.
--- drivers/firmware/arm_scmi/sensors.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/firmware/arm_scmi/sensors.c +2 -2
@@ -30,10 +30,10 @@ struct scmi_msg_resp_sensor_description {__le32 id;__le32 attributes_low;#define SUPPORTS_ASYNC_READ (x) ((x) & BIT(31)) -#define NUM_TRIP_POINTS (x) (((x) >> 4) & 0xff) +#define NUM_TRIP_POINTS (x) ((x) & 0xff)__le32 attributes_high;#define SENSOR_TYPE (x) ((x) & 0xff) -#define SENSOR_SCALE (x) (((x) >> 11) & 0x3f) +#define SENSOR_SCALE (x) (((x) >> 11) & 0x1f)#define SENSOR_UPDATE_SCALE (x) (((x) >> 22) & 0x1f)#define SENSOR_UPDATE_BASE (x) (((x) >> 27) & 0x1f)u8 name[SCMI_MAX_STR_SIZE ];
Signature · 7 lines
2.20.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Sasha Levin
maintainerPATCH 408/671 firmware: arm_scmi: update rate_discrete in clock_describe_rates_get
In reply to Sasha LevinFrom: Peng Fan <[email protected]>
[ Upstream commit c0759b9b5d411ab27c479125cee9bae391a96436 ]
The boolean rate_discrete needs to be assigned to clk->rate_discrete, so that clock driver can distinguish between the continuous range and discrete rates. It uses this in scmi_clk_round_rate could get the rounded value if it's a continuous range.
--- drivers/firmware/arm_scmi/clock.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/firmware/arm_scmi/clock.c +2 -0
@@ -185,6 +185,8 @@ scmi_clock_describe_rates_get(const struct scmi_handle *handle, u32 clk_id,if (rate_discrete) clk->list.num_rates = tot_rate_cnt; + clk->rate_discrete = rate_discrete; + err:scmi_xfer_put (handle, t);return ret;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 409/671 ntb_hw_switchtec: potential shift wrapping bug in switchtec_ntb_init_sndev()
In reply to Sasha LevinFrom: Dan Carpenter <[email protected]>
[ Upstream commit ff148d8ac53e59802645bd3200c811620317eb9f ]
This code triggers a Smatch warning:
drivers/ntb/hw/mscc/ntb_hw_switchtec.c:884 switchtec_ntb_init_sndev()
warn: should '(1 << sndev->peer_partition)' be a 64 bit type?The "part_map" and "tpart_vec" variables are u64 type so this seems like a valid warning.
--- drivers/ntb/hw/mscc/ntb_hw_switchtec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ntb/hw/mscc/ntb_hw_switchtec.c +1 -1
@@ -899,7 +899,7 @@ static int switchtec_ntb_init_sndev(struct switchtec_ntb *sndev) } sndev->peer_partition =ffs (tpart_vec) -1 ; -if (!(part_map & (1 << sndev->peer_partition))) { +if (!(part_map & (1ULL << sndev->peer_partition))) {dev_err (&sndev->stdev->dev,"ntb target partition is not NT partition\n" );return -ENODEV ;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 410/671 ASoC: meson: axg-tdmin: right_j is not supported
In reply to Sasha LevinFrom: Jerome Brunet <[email protected]>
[ Upstream commit 47c317b786b6c1efc2cb3cdb894fd323422fe5ea ]
Right justified format is actually not supported by the amlogic tdm input decoder.
--- sound/soc/meson/axg-tdmin.c | 1 - 1 file changed, 1 deletion(-)
sound/soc/meson/axg-tdmin.c +0 -1
@@ -119,7 +119,6 @@ static int axg_tdmin_prepare(struct regmap *map, struct axg_tdm_stream *ts)break ;case SND_SOC_DAIFMT_LEFT_J : -case SND_SOC_DAIFMT_RIGHT_J :case SND_SOC_DAIFMT_DSP_B : val =TDMIN_CTRL_IN_BIT_SKEW (2 );break ;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 411/671 ASoC: meson: axg-tdmout: right_j is not supported
In reply to Sasha LevinFrom: Jerome Brunet <[email protected]>
[ Upstream commit 7e0d7d0fbd06af0507611f85dba8daf24832abd9 ]
Right justified format is actually not supported by the amlogic tdm output encoder.
--- sound/soc/meson/axg-tdmout.c | 1 - 1 file changed, 1 deletion(-)
sound/soc/meson/axg-tdmout.c +0 -1
@@ -136,7 +136,6 @@ static int axg_tdmout_prepare(struct regmap *map, struct axg_tdm_stream *ts)break ;case SND_SOC_DAIFMT_LEFT_J : -case SND_SOC_DAIFMT_RIGHT_J :case SND_SOC_DAIFMT_DSP_B : val |=TDMOUT_CTRL0_INIT_BITNUM (2 );break ;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 412/671 PCI: PM: Skip devices in D0 for suspend-to-idle
In reply to Sasha LevinFrom: "Rafael J. Wysocki" <[email protected]>
[ Upstream commit 3e26c5feed2add218046ecf91bab3cfa9bf762a6 ]
Commit d491f2b75237 ("PCI: PM: Avoid possible suspend-to-idle issue") attempted to avoid a problem with devices whose drivers want them to stay in D0 over suspend-to-idle and resume, but it did not go as far as it should with that.
Namely, first of all, the power state of a PCI bridge with a downstream device in D0 must be D0 (based on the PCI PM spec r1.2, sec 6, table 6-1, if the bridge is not in D0, there can be no PCI transactions on its secondary bus), but that is not actively enforced during system-wide PM transitions, so use the skip_bus_pm flag introduced by commit d491f2b75237 for that.
Second, the configuration of devices left in D0 (whatever the reason) during suspend-to-idle need not be changed and attempting to put them into D0 again by force is pointless, so explicitly avoid doing that.
--- drivers/pci/pci-driver.c | 47 ++++++++++++++++++++++++++++++---------- 1 file changed, 35 insertions(+), 12 deletions(-)
drivers/pci/pci-driver.c +35 -12
@@ -526,7 +526,6 @@ static void pci_pm_default_resume_early(struct pci_dev *pci_dev)pci_power_up (pci_dev);pci_restore_state (pci_dev);pci_pme_restore (pci_dev); -pci_fixup_device (pci_fixup_resume_early, pci_dev); }/*
@@ -833,18 +832,16 @@ static int pci_pm_suspend_noirq(struct device *dev)if (pci_dev->skip_bus_pm) {/* -* The function is running for the second time in a row without +* Either the device is a bridge with a child in D0 below it, or +* the function is running for the second time in a row without * going through full resume, which is possible only during -* suspend-to-idle in a spurious wakeup case. Moreover, the -* device was originally left in D0, so its power state should -* not be changed here and the device register values saved -* originally should be restored on resume again. +* suspend-to-idle in a spurious wakeup case. The device should +* be in D0 at this point, but if it is a bridge, it may be +* necessary to save its state. */ - pci_dev->state_saved = true; - }else if (pci_dev->state_saved) { -if (pci_dev->current_state ==PCI_D0 ) - pci_dev->skip_bus_pm = true; - }else { +if (!pci_dev->state_saved) +pci_save_state (pci_dev); + }else if (!pci_dev->state_saved) {pci_save_state (pci_dev);if (pci_power_manageable (pci_dev))pci_prepare_to_sleep (pci_dev);
@@ -853,6 +850,22 @@ static int pci_pm_suspend_noirq(struct device *dev)dev_dbg (dev,"PCI PM: Suspend power state: %s\n" ,pci_power_name (pci_dev->current_state)); +if (pci_dev->current_state ==PCI_D0 ) { + pci_dev->skip_bus_pm = true; +/* +* Per PCI PM r1.2, table 6-1, a bridge must be in D0 if any +* downstream device is in D0, so avoid changing the power state +* of the parent bridge by setting the skip_bus_pm flag for it. +*/ +if (pci_dev->bus->self) + pci_dev->bus->self->skip_bus_pm = true; + } + +if (pci_dev->skip_bus_pm && !pm_suspend_via_firmware ()) { +dev_dbg (dev,"PCI PM: Skipped\n" ); + goto Fixup; + } +pci_pm_set_unknown_state (pci_dev);/*
@@ -900,7 +913,16 @@ static int pci_pm_resume_noirq(struct device *dev)if (dev_pm_smart_suspend_and_suspended (dev))pm_runtime_set_active (dev); -pci_pm_default_resume_early (pci_dev); +/* +* In the suspend-to-idle case, devices left in D0 during suspend will +* stay in D0, so it is not necessary to restore or update their +* configuration here and attempting to put them into D0 again may +* confuse some firmware, so avoid doing that. +*/ +if (!pci_dev->skip_bus_pm ||pm_suspend_via_firmware ()) +pci_pm_default_resume_early (pci_dev); + +pci_fixup_device (pci_fixup_resume_early, pci_dev);if (pci_has_legacy_pm_support (pci_dev))return pci_legacy_resume_early (dev);
@@ -1201,6 +1223,7 @@ static int pci_pm_restore_noirq(struct device *dev) }pci_pm_default_resume_early (pci_dev); +pci_fixup_device (pci_fixup_resume_early, pci_dev);if (pci_has_legacy_pm_support (pci_dev))return pci_legacy_resume_early (dev);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 413/671 qed: iWARP - Use READ_ONCE and smp_store_release to access ep->state
In reply to Sasha LevinFrom: Michal Kalderon <[email protected]>
[ Upstream commit 6117561e1bb30b2fe7f51e1961f34dbedd0bec8a ]
Destroy QP waits for it's ep object state to be set to CLOSED before proceeding. ep->state can be updated from a different context. Add smp_store_release/READ_ONCE to synchronize.
--- drivers/net/ethernet/qlogic/qed/qed_iwarp.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)
drivers/net/ethernet/qlogic/qed/qed_iwarp.c +11 -5
@@ -532,7 +532,8 @@ int qed_iwarp_destroy_qp(struct qed_hwfn *p_hwfn, struct qed_rdma_qp *qp)/* Make sure ep is closed before returning and freeing memory. */ if (ep) { -while (ep->state !=QED_IWARP_EP_CLOSED && wait_count++ <200 ) +while (READ_ONCE (ep->state) !=QED_IWARP_EP_CLOSED && + wait_count++ <200 )msleep (100 );if (ep->state !=QED_IWARP_EP_CLOSED )
@@ -1023,8 +1024,6 @@ qed_iwarp_mpa_complete(struct qed_hwfn *p_hwfn, params.ep_context = ep; - ep->state =QED_IWARP_EP_CLOSED ; -switch (fw_return_code) {case RDMA_RETURN_OK : ep->qp->max_rd_atomic_req = ep->cm_info.ord;
@@ -1084,6 +1083,10 @@ qed_iwarp_mpa_complete(struct qed_hwfn *p_hwfn,break ; } +if (fw_return_code !=RDMA_RETURN_OK ) +/* paired with READ_ONCE in destroy_qp */ +smp_store_release (&ep->state,QED_IWARP_EP_CLOSED ); + ep->event_cb (ep->cb_context, ¶ms);/* on passive side, if there is no associated QP (REJECT) we need to
@@ -2828,7 +2831,9 @@ static void qed_iwarp_qp_in_error(struct qed_hwfn *p_hwfn, params.status = (fw_return_code ==IWARP_QP_IN_ERROR_GOOD_CLOSE ) ?0 : -ECONNRESET ; - ep->state =QED_IWARP_EP_CLOSED ; +/* paired with READ_ONCE in destroy_qp */ +smp_store_release (&ep->state,QED_IWARP_EP_CLOSED ); +spin_lock_bh (&p_hwfn->p_rdma_info->iwarp.iw_lock);list_del (&ep->list_entry);spin_unlock_bh (&p_hwfn->p_rdma_info->iwarp.iw_lock);
@@ -2917,7 +2922,8 @@ qed_iwarp_tcp_connect_unsuccessful(struct qed_hwfn *p_hwfn, params.event =QED_IWARP_EVENT_ACTIVE_COMPLETE ; params.ep_context = ep; params.cm_info = &ep->cm_info; - ep->state =QED_IWARP_EP_CLOSED ; +/* paired with READ_ONCE in destroy_qp */ +smp_store_release (&ep->state,QED_IWARP_EP_CLOSED );switch (fw_return_code) {case IWARP_CONN_ERROR_TCP_CONNECT_INVALID_PACKET :
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 414/671 qed: iWARP - fix uninitialized callback
In reply to Sasha LevinFrom: Michal Kalderon <[email protected]>
[ Upstream commit 43cf40d93fadbb0d3edf0942a4612f8ff67478a1 ]
Fix uninitialized variable warning by static checker.
--- drivers/net/ethernet/qlogic/qed/qed_iwarp.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/qlogic/qed/qed_iwarp.c +1 -0
@@ -2641,6 +2641,7 @@ qed_iwarp_ll2_start(struct qed_hwfn *p_hwfn, cbs.rx_release_cb = qed_iwarp_ll2_rel_rx_pkt; cbs.tx_comp_cb = qed_iwarp_ll2_comp_tx_pkt; cbs.tx_release_cb = qed_iwarp_ll2_rel_tx_pkt; + cbs.slowpath_cb =NULL ; cbs.cookie = p_hwfn;memset (&data,0 ,sizeof (data));
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 415/671 powerpc/cacheinfo: add cacheinfo_teardown, cacheinfo_rebuild
In reply to Sasha LevinFrom: Nathan Lynch <[email protected]>
[ Upstream commit d4aa219a074a5abaf95a756b9f0d190b5c03a945 ]
Allow external callers to force the cacheinfo code to release all its references to cache nodes, e.g. before processing device tree updates post-migration, and to rebuild the hierarchy afterward.
CPU online/offline must be blocked by callers; enforce this.
--- arch/powerpc/kernel/cacheinfo.c | 21 +++++++++++++++++++++ arch/powerpc/kernel/cacheinfo.h | 4 ++++ 2 files changed, 25 insertions(+)
arch/powerpc/kernel/cacheinfo.c +21 -0
@@ -865,4 +865,25 @@ void cacheinfo_cpu_offline(unsigned int cpu_id)if (cache) cache_cpu_clear(cache, cpu_id); } + +void cacheinfo_teardown (void ) +{ +unsigned int cpu; + +lockdep_assert_cpus_held (); + +for_each_online_cpu (cpu) +cacheinfo_cpu_offline (cpu); +} + +void cacheinfo_rebuild (void ) +{ +unsigned int cpu; + +lockdep_assert_cpus_held (); + +for_each_online_cpu (cpu) +cacheinfo_cpu_online (cpu); +} +#endif /* (CONFIG_PPC_PSERIES && CONFIG_SUSPEND) || CONFIG_HOTPLUG_CPU */
arch/powerpc/kernel/cacheinfo.h +4 -0
@@ -6,4 +6,8 @@extern void cacheinfo_cpu_online (unsigned int cpu_id);extern void cacheinfo_cpu_offline (unsigned int cpu_id); +/* Allow migration/suspend to tear down and rebuild the hierarchy. */ +extern void cacheinfo_teardown (void ); +extern void cacheinfo_rebuild (void ); +#endif /* _PPC_CACHEINFO_H */
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 416/671 powerpc/pseries/mobility: rebuild cacheinfo hierarchy post-migration
In reply to Sasha LevinFrom: Nathan Lynch <[email protected]>
[ Upstream commit e610a466d16a086e321f0bd421e2fc75cff28605 ]
It's common for the platform to replace the cache device nodes after a migration. Since the cacheinfo code is never informed about this, it never drops its references to the source system's cache nodes, causing it to wind up in an inconsistent state resulting in warnings and oopses as soon as CPU online/offline occurs after the migration, e.g.
cache for /cpus/l3-cache@3113(Unified) refers to cache for /cpus/l2-cache@200d(Unified)
WARNING: CPU: 15 PID: 86 at arch/powerpc/kernel/cacheinfo.c:176 release_cache+0x1bc/0x1d0
[...]
NIP release_cache+0x1bc/0x1d0
LR release_cache+0x1b8/0x1d0
Call Trace:
release_cache+0x1b8/0x1d0 (unreliable)
cacheinfo_cpu_offline+0x1c4/0x2c0
unregister_cpu_online+0x1b8/0x260
cpuhp_invoke_callback+0x114/0xf40
cpuhp_thread_fun+0x270/0x310
smpboot_thread_fn+0x2c8/0x390
kthread+0x1b8/0x1c0
ret_from_kernel_thread+0x5c/0x68Using device tree notifiers won't work since we want to rebuild the hierarchy only after all the removals and additions have occurred and the device tree is in a consistent state. Call cacheinfo_teardown() before processing device tree updates, and rebuild the hierarchy afterward.
--- arch/powerpc/platforms/pseries/mobility.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
arch/powerpc/platforms/pseries/mobility.c +10 -0
@@ -24,6 +24,7 @@#include <asm/machdep.h> #include <asm/rtas.h> #include "pseries.h" +#include "../../kernel/cacheinfo.h" static struct kobject *mobility_kobj;
@@ -360,11 +361,20 @@ void post_mobility_fixup(void)*/ cpus_read_lock (); +/* +* It's common for the destination firmware to replace cache +* nodes. Release all of the cacheinfo hierarchy's references +* before updating the device tree. +*/ +cacheinfo_teardown (); + rc =pseries_devicetree_update (MIGRATION_SCOPE );if (rc)printk (KERN_ERR "Post-mobility device tree update " "failed: %d\n" , rc); +cacheinfo_rebuild (); +cpus_read_unlock ();/* Possibly switch to a new RFI flush type */
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 417/671 bpf: fix the check that forwarding is enabled in bpf_ipv6_fib_lookup
In reply to Sasha LevinFrom: Anton Protopopov <[email protected]>
[ Upstream commit 56f0f84e69c7a7f229dfa524b13b0ceb6ce9b09e ]
The bpf_ipv6_fib_lookup function should return BPF_FIB_LKUP_RET_FWD_DISABLED when forwarding is disabled for the input device. However instead of checking if forwarding is enabled on the input device, it checked the global net->ipv6.devconf_all->forwarding flag. Change it to behave as expected.
--- net/core/filter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/core/filter.c +1 -1
@@ -4367,7 +4367,7 @@ static int bpf_ipv6_fib_lookup(struct net *net, struct bpf_fib_lookup *params,return -ENODEV ; idev =__in6_dev_get_safely (dev); -if (unlikely (!idev || !net->ipv6.devconf_all->forwarding)) +if (unlikely (!idev || !idev->cnf.forwarding))return BPF_FIB_LKUP_RET_FWD_DISABLED ;if (flags &BPF_FIB_LOOKUP_OUTPUT ) {
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 418/671 IB/hfi1: Handle port down properly in pio
In reply to Sasha LevinFrom: Mike Marciniszyn <[email protected]>
[ Upstream commit 942a899335707fc9cfc97cb382a60734b2ff4e03 ]
The call to sc_buffer_alloc currently returns NULL (no buffer) or a buffer descriptor.
There is a third case when the port is down. Currently that returns NULL and this prevents the caller from properly handling the sc_buffer_alloc() failure. A verbs code link test after the call is racy so the indication needs to come from the state check inside the allocation routine to be valid.
Fix by encoding the ECOMM failure like SDMA. IS_ERR_OR_NULL() tests
are added at all call sites. For verbs send, this needs to treat any error by returning a completion without any MMIO copy.
--- drivers/infiniband/hw/hfi1/pio.c | 5 +++-- drivers/infiniband/hw/hfi1/rc.c | 2 +- drivers/infiniband/hw/hfi1/ud.c | 4 ++-- drivers/infiniband/hw/hfi1/verbs.c | 4 ++-- 4 files changed, 8 insertions(+), 7 deletions(-)
drivers/infiniband/hw/hfi1/pio.c +3 -2
@@ -1434,7 +1434,8 @@ void sc_stop(struct send_context *sc, int flag)* @cb: optional callback to call when the buffer is finished sending * @arg: argument for cb * -* Return a pointer to a PIO buffer if successful, NULL if not enough room. +* Return a pointer to a PIO buffer, NULL if not enough room, -ECOMM +* when link is down. */ struct pio_buf *sc_buffer_alloc (struct send_context *sc,u32 dw_len,pio_release_cb cb,void *arg)
@@ -1450,7 +1451,7 @@ struct pio_buf *sc_buffer_alloc(struct send_context *sc, u32 dw_len,spin_lock_irqsave (&sc->alloc_lock, flags);if (!(sc->flags &SCF_ENABLED )) {spin_unlock_irqrestore (&sc->alloc_lock, flags); - goto done; +return ERR_PTR (-ECOMM ); } retry:
drivers/infiniband/hw/hfi1/rc.c +1 -1
@@ -914,7 +914,7 @@ void hfi1_send_rc_ack(struct hfi1_packet *packet, bool is_fecn) pbc =create_pbc (ppd, pbc_flags, qp->srate_mbps,sc_to_vlt (ppd->dd, sc5), plen); pbuf =sc_buffer_alloc (rcd->sc, plen,NULL ,NULL ); -if (!pbuf) { +if (IS_ERR_OR_NULL (pbuf)) {/* * We have no room to send at the moment. Pass * responsibility for sending the ACK to the send engine
drivers/infiniband/hw/hfi1/ud.c +2 -2
@@ -703,7 +703,7 @@ void return_cnp_16B(struct hfi1_ibport *ibp, struct rvt_qp *qp, pbc =create_pbc (ppd, pbc_flags, qp->srate_mbps, vl, plen);if (ctxt) { pbuf =sc_buffer_alloc (ctxt, plen,NULL ,NULL ); -if (pbuf) { +if (!IS_ERR_OR_NULL (pbuf)) {trace_pio_output_ibhdr (ppd->dd, &hdr, sc5); ppd->dd->pio_inline_send (ppd->dd, pbuf, pbc, &hdr, hwords);
@@ -758,7 +758,7 @@ void return_cnp(struct hfi1_ibport *ibp, struct rvt_qp *qp, u32 remote_qpn, pbc =create_pbc (ppd, pbc_flags, qp->srate_mbps, vl, plen);if (ctxt) { pbuf =sc_buffer_alloc (ctxt, plen,NULL ,NULL ); -if (pbuf) { +if (!IS_ERR_OR_NULL (pbuf)) {trace_pio_output_ibhdr (ppd->dd, &hdr, sc5); ppd->dd->pio_inline_send (ppd->dd, pbuf, pbc, &hdr, hwords);
drivers/infiniband/hw/hfi1/verbs.c +2 -2
@@ -1096,10 +1096,10 @@ int hfi1_verbs_send_pio(struct rvt_qp *qp, struct hfi1_pkt_state *ps,if (cb)iowait_pio_inc (&priv->s_iowait); pbuf =sc_buffer_alloc (sc, plen, cb, qp); -if (unlikely (!pbuf)) { +if (unlikely (IS_ERR_OR_NULL (pbuf))) {if (cb)verbs_pio_complete (qp,0 ); -if (ppd->host_link_state !=HLS_UP_ACTIVE ) { +if (IS_ERR (pbuf)) {/* * If we have filled the PIO buffers to capacity and are * not in an active state this request is not going to
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 419/671 drm/msm/mdp5: Fix mdp5_cfg_init error return
In reply to Sasha LevinFrom: Jeffrey Hugo <[email protected]>
[ Upstream commit fc19cbb785d7bbd1a1af26229b5240a3ab332744 ]
If mdp5_cfg_init fails because of an unknown major version, a null pointer dereference occurs. This is because the caller of init expects error pointers, but init returns NULL on error. Fix this by returning the expected values on error.
--- drivers/gpu/drm/msm/disp/mdp5/mdp5_cfg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/msm/disp/mdp5/mdp5_cfg.c +1 -1
@@ -635,7 +635,7 @@ struct mdp5_cfg_handler *mdp5_cfg_init(struct mdp5_kms *mdp5_kms,if (cfg_handler)mdp5_cfg_destroy (cfg_handler); -return NULL ; +return ERR_PTR (ret); }static struct mdp5_cfg_platform *mdp5_get_config (struct platform_device *dev)
Signature · 6 lines
2.20.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Sasha Levin
maintainerPATCH 420/671 net: netem: fix backlog accounting for corrupted GSO frames
In reply to Sasha LevinFrom: Jakub Kicinski <[email protected]>
[ Upstream commit 177b8007463c4f36c9a2c7ce7aa9875a4cad9bd5 ]
When GSO frame has to be corrupted netem uses skb_gso_segment() to produce the list of frames, and re-enqueues the segments one by one. The backlog length has to be adjusted to account for new frames.
The current calculation is incorrect, leading to wrong backlog lengths in the parent qdisc (both bytes and packets), and incorrect packet backlog count in netem itself.
Parent backlog goes negative, netem's packet backlog counts all non-first segments twice (thus remaining non-zero even after qdisc is emptied).
Move the variables used to count the adjustment into local scope to make 100% sure they aren't used at any stage in backports.
--- net/sched/sch_netem.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
net/sched/sch_netem.c +8 -5
@@ -436,8 +436,7 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch,struct netem_skb_cb *cb;struct sk_buff *skb2;struct sk_buff *segs =NULL ; -unsigned int len =0 , last_len, prev_len =qdisc_pkt_len (skb); -int nb =0 ; +unsigned int prev_len =qdisc_pkt_len (skb);int count =1 ;int rc =NET_XMIT_SUCCESS ;int rc_drop =NET_XMIT_DROP ;
@@ -494,6 +493,7 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch, segs =netem_segment (skb, sch, to_free);if (!segs)return rc_drop; +qdisc_skb_cb (segs)->pkt_len = segs->len; }else { segs = skb; }
@@ -583,6 +583,11 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch, finish_segs:if (segs) { +unsigned int len, last_len; +int nb =0 ; + + len = skb->len; +while (segs) { skb2 = segs->next; segs->next =NULL ;
@@ -598,9 +603,7 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch, } segs = skb2; } - sch->q.qlen += nb; -if (nb >1 ) -qdisc_tree_reduce_backlog (sch,1 - nb, prev_len - len); +qdisc_tree_reduce_backlog (sch, -nb, prev_len - len); }return NET_XMIT_SUCCESS ; }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 421/671 net/udp_gso: Allow TX timestamp with UDP GSO
In reply to Sasha LevinFrom: Fred Klassen <[email protected]>
[ Upstream commit 76e21533a48bb42d1fa894f93f6233bf4554f45e ]
Fixes an issue where TX Timestamps are not arriving on the error queue when UDP_SEGMENT CMSG type is combined with CMSG type SO_TIMESTAMPING. This can be illustrated with an updated updgso_bench_tx program which includes the '-T' option to test for this condition. It also introduces the '-P' option which will call poll() before reading the error queue.
./udpgso_bench_tx -4ucTPv -S 1472 -l2 -D 172.16.120.18 poll timeout
udp tx: 0 MB/s 1 calls/s 1 msg/s
The "poll timeout" message above indicates that TX timestamp never arrived.
This patch preserves tx_flags for the first UDP GSO segment. Only the first segment is timestamped, even though in some cases there may be benefital in timestamping both the first and last segment.
Factors in deciding on first segment timestamp only:
- Timestamping both first and last segmented is not feasible. Hardware can only have one outstanding TS request at a time.
- Timestamping last segment may under report network latency of the previous segments. Even though the doorbell is suppressed, the ring producer counter has been incremented.
- Timestamping the first segment has the upside in that it reports timestamps from the application's view, e.g. RTT.
- Timestamping the first segment has the downside that it may underreport tx host network latency. It appears that we have to pick one or the other. And possibly follow-up with a config flag to choose behavior.
v2: Remove tests as noted by Willem de Bruijn <[email protected]>
Moving tests from net to net-next
v3: Update only relevant tx_flag bits as per
Willem de Bruijn <[email protected]>
v4: Update comments and commit message as per
Willem de Bruijn <[email protected]>
--- net/ipv4/udp_offload.c | 5 +++++ 1 file changed, 5 insertions(+)
net/ipv4/udp_offload.c +5 -0
@@ -227,6 +227,11 @@ struct sk_buff *__udp_gso_segment(struct sk_buff *gso_skb, seg = segs; uh =udp_hdr (seg); +/* preserve TX timestamp flags and TS key for first segment */ +skb_shinfo (seg)->tskey =skb_shinfo (gso_skb)->tskey; +skb_shinfo (seg)->tx_flags |= + (skb_shinfo (gso_skb)->tx_flags &SKBTX_ANY_TSTAMP ); +/* compute checksum adjustment based on old length versus new */ newlen =htons (sizeof (*uh) + mss); check =csum16_add (csum16_sub (uh->check, uh->len), newlen);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 422/671 net/af_iucv: build proper skbs for HiperTransport
In reply to Sasha LevinFrom: Julian Wiedmann <[email protected]>
[ Upstream commit 238965b71b968dc5b3c0fe430e946f488322c4b5 ]
The HiperSockets-based transport path in af_iucv is still too closely entangled with qeth.
With commit a647a02512ca ("s390/qeth: speed-up L3 IQD xmit"), the relevant xmit code in qeth has begun to use skb_cow_head(). So to avoid unnecessary skb head expansions, af_iucv must learn to
1) respect dev->needed_headroom when allocating skbs, and
2) drop the header reference before cloning the skb.
While at it, also stop hard-coding the LL-header creation stage and just use the appropriate helper.
--- net/iucv/af_iucv.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
net/iucv/af_iucv.c +11 -2
@@ -13,6 +13,7 @@#define pr_fmt (fmt) KMSG_COMPONENT ": " fmt#include <linux/module.h> +#include <linux/netdevice.h> #include <linux/types.h> #include <linux/list.h> #include <linux/errno.h>
@@ -355,6 +356,9 @@ static int afiucv_hs_send(struct iucv_message *imsg, struct sock *sock, err = -ENODEV ; goto err_free; } + +dev_hard_header (skb, skb->dev,ETH_P_AF_IUCV ,NULL ,NULL , skb->len); +if (!(skb->dev->flags &IFF_UP ) || !netif_carrier_ok (skb->dev)) { err = -ENETDOWN ; goto err_free;
@@ -367,6 +371,8 @@ static int afiucv_hs_send(struct iucv_message *imsg, struct sock *sock,skb_trim (skb, skb->dev->mtu); } skb->protocol =cpu_to_be16 (ETH_P_AF_IUCV ); + +__skb_header_release (skb); nskb =skb_clone (skb,GFP_ATOMIC );if (!nskb) { err = -ENOMEM ;
@@ -466,12 +472,14 @@ static void iucv_sever_path(struct sock *sk, int with_user_data)/* Send controlling flags through an IUCV socket for HIPER transport */ static int iucv_send_ctrl (struct sock *sk,u8 flags) { +struct iucv_sock *iucv =iucv_sk (sk);int err =0 ;int blen;struct sk_buff *skb;u8 shutdown =0 ; - blen =sizeof (struct af_iucv_trans_hdr ) +ETH_HLEN ; + blen =sizeof (struct af_iucv_trans_hdr ) + +LL_RESERVED_SPACE (iucv->hs_dev);if (sk->sk_shutdown &SEND_SHUTDOWN ) {/* controlling flags should be sent anyway */ shutdown = sk->sk_shutdown;
@@ -1131,7 +1139,8 @@ static int iucv_sock_sendmsg(struct socket *sock, struct msghdr *msg,* segmented records using the MSG_EOR flag), but * for SOCK_STREAM we might want to improve it in future */ if (iucv->transport ==AF_IUCV_TRANS_HIPER ) { - headroom =sizeof (struct af_iucv_trans_hdr ) +ETH_HLEN ; + headroom =sizeof (struct af_iucv_trans_hdr ) + +LL_RESERVED_SPACE (iucv->hs_dev); linear = len; }else {if (len <PAGE_SIZE ) {
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 423/671 net/af_iucv: always register net_device notifier
In reply to Sasha LevinFrom: Julian Wiedmann <[email protected]>
[ Upstream commit 06996c1d4088a0d5f3e7789d7f96b4653cc947cc ]
Even when running as VM guest (ie pr_iucv != NULL), af_iucv can still open HiperTransport-based connections. For robust operation these connections require the af_iucv_netdev_notifier, so register it unconditionally.
Also handle any error that register_netdevice_notifier() returns.
--- net/iucv/af_iucv.c | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-)
net/iucv/af_iucv.c +20 -7
@@ -2465,6 +2465,13 @@ static int afiucv_iucv_init(void)return err; } +static void afiucv_iucv_exit (void ) +{ +device_unregister (af_iucv_dev); +driver_unregister (&af_iucv_driver); + pr_iucv->iucv_unregister (&af_iucv_handler,0 ); +} +static int __init afiucv_init (void ) {int err;
@@ -2498,11 +2505,18 @@ static int __init afiucv_init(void) err =afiucv_iucv_init ();if (err) goto out_sock; - }else -register_netdevice_notifier (&afiucv_netdev_notifier); + } + + err =register_netdevice_notifier (&afiucv_netdev_notifier); +if (err) + goto out_notifier; +dev_add_pack (&iucv_packet_type);return 0 ; +out_notifier: +if (pr_iucv) +afiucv_iucv_exit (); out_sock:sock_unregister (PF_IUCV ); out_proto:
@@ -2516,12 +2530,11 @@ static int __init afiucv_init(void) static void __exit afiucv_exit(void) {if (pr_iucv) { -device_unregister (af_iucv_dev); -driver_unregister (&af_iucv_driver); - pr_iucv->iucv_unregister (&af_iucv_handler,0 ); +afiucv_iucv_exit ();symbol_put (iucv_if); - }else -unregister_netdevice_notifier (&afiucv_netdev_notifier); + } + +unregister_netdevice_notifier (&afiucv_netdev_notifier);dev_remove_pack (&iucv_packet_type);sock_unregister (PF_IUCV );proto_unregister (&iucv_proto);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 424/671 ASoC: ti: davinci-mcasp: Fix slot mask settings when using multiple AXRs
In reply to Sasha LevinFrom: Peter Ujfalusi <[email protected]>
[ Upstream commit fd14f4436fd47d5418023c90e933e66d3645552e ]
If multiple serializers are connected in the system and the number of channels will need to use more than one serializer the mask to enable the serializers were left to 0 if tdm_mask is provided
--- sound/soc/davinci/davinci-mcasp.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
sound/soc/davinci/davinci-mcasp.c +6 -7
@@ -874,14 +874,13 @@ static int mcasp_i2s_hw_param(struct davinci_mcasp *mcasp, int stream, active_slots =hweight32 (mcasp->tdm_mask[stream]); active_serializers = (channels + active_slots -1 ) / active_slots; -if (active_serializers ==1 ) { +if (active_serializers ==1 ) active_slots = channels; -for (i =0 ; i < total_slots; i++) { -if ((1 << i) & mcasp->tdm_mask[stream]) { - mask |= (1 << i); -if (--active_slots <=0 ) -break ; - } +for (i =0 ; i < total_slots; i++) { +if ((1 << i) & mcasp->tdm_mask[stream]) { + mask |= (1 << i); +if (--active_slots <=0 ) +break ; } } }else {
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 425/671 rtc: pcf8563: Fix interrupt trigger method
In reply to Sasha LevinFrom: Chen-Yu Tsai <[email protected]>
[ Upstream commit 65f662cbf829834fa4d94190eb7691e5a9cb92d8 ]
The PCF8563 datasheet says the interrupt line is active low and stays active until the events are cleared, i.e. a level trigger interrupt.
Fix the flags used to request the interrupt.
--- drivers/rtc/rtc-pcf8563.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-pcf8563.c +1 -1
@@ -605,7 +605,7 @@ static int pcf8563_probe(struct i2c_client *client,if (client->irq >0 ) { err =devm_request_threaded_irq (&client->dev, client->irq,NULL , pcf8563_irq, -IRQF_SHARED |IRQF_ONESHOT |IRQF_TRIGGER_FALLING , +IRQF_SHARED |IRQF_ONESHOT |IRQF_TRIGGER_LOW , pcf8563_driver.driver.name, client);if (err) { dev_err(&client->dev, "unable to request IRQ %d\n",
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 426/671 rtc: pcf8563: Clear event flags and disable interrupts before requesting irq
In reply to Sasha LevinFrom: Chen-Yu Tsai <[email protected]>
[ Upstream commit 3572e8aea3bf925dac1dbf86127657c39fe5c254 ]
Besides the alarm, the PCF8563 also has a timer triggered interrupt. In cases where the previous system left the timer and interrupts on, or somehow the bits got enabled, the interrupt would keep triggering as the kernel doesn't know about it.
Clear both the alarm and timer event flags, and disable the interrupts, before requesting the interrupt line.
--- drivers/rtc/rtc-pcf8563.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
drivers/rtc/rtc-pcf8563.c +5 -6
@@ -563,7 +563,6 @@ static int pcf8563_probe(struct i2c_client *client,struct pcf8563 *pcf8563;int err;unsigned char buf; -unsigned char alm_pending;dev_dbg (&client->dev,"%s\n" , __func__);
@@ -587,13 +586,13 @@ static int pcf8563_probe(struct i2c_client *client,return err; } - err =pcf8563_get_alarm_mode (client,NULL , &alm_pending); -if (err) { -dev_err (&client->dev,"%s: read error\n" , __func__); +/* Clear flags and disable interrupts */ + buf =0 ; + err =pcf8563_write_block_data (client,PCF8563_REG_ST2 ,1 , &buf); +if (err <0 ) { +dev_err (&client->dev,"%s: write error\n" , __func__);return err; } -if (alm_pending) -pcf8563_set_alarm_mode (client,0 ); pcf8563->rtc = devm_rtc_device_register(&client->dev, pcf8563_driver.driver.name,
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 427/671 ARM: dts: iwg20d-q7-common: Fix SDHI1 VccQ regularor
In reply to Sasha LevinFrom: Fabrizio Castro <[email protected]>
[ Upstream commit d211650a87edc7f4130651c0ccbc0a4583fd72d3 ]
SDR50 isn't working anymore because the GPIO regulator driver is using descriptors since
commit d6cd33ad7102 ("regulator: gpio: Convert to use descriptors") which in turn causes the system to use the polarity of the GPIOs (as specified in the DT) for selecting the states, but the polarity specified in the DT is wrong.
This patch fixes the regulator DT definition, and that fixes SDR50.
--- arch/arm/boot/dts/iwg20d-q7-common.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/iwg20d-q7-common.dtsi +1 -1
@@ -87,7 +87,7 @@ regulator-min-microvolt = <1800000>; regulator-max-microvolt = <3300000>; - gpios = <&gpio2 30 GPIO_ACTIVE_LOW>; + gpios = <&gpio2 30 GPIO_ACTIVE_HIGH>; gpios-states = <1>; states = <3300000 1 1800000 0>;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 428/671 net/sched: cbs: Fix error path of cbs_module_init
In reply to Sasha LevinFrom: YueHaibing <[email protected]>
[ Upstream commit 45d5cb137c3638b3a310f41b31d8e79daf647f14 ]
If register_qdisc fails, we should unregister
netdevice notifier.
--- net/sched/sch_cbs.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
net/sched/sch_cbs.c +7 -2
@@ -552,12 +552,17 @@ static struct notifier_block cbs_device_notifier = {static int __init cbs_module_init (void ) { -int err =register_netdevice_notifier (&cbs_device_notifier); +int err; + err =register_netdevice_notifier (&cbs_device_notifier);if (err)return err; -return register_qdisc (&cbs_qdisc_ops); + err =register_qdisc (&cbs_qdisc_ops); +if (err) +unregister_netdevice_notifier (&cbs_device_notifier); + +return err; } static void __exit cbs_module_exit(void)
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 429/671 arm64: dts: allwinner: h6: Pine H64: Add interrupt line for RTC
In reply to Sasha LevinFrom: Chen-Yu Tsai <[email protected]>
[ Upstream commit 0bb9d1876c0605815ea0452f68cb819a775a75f9 ]
The external PCF8563 RTC chip's interrupt line is connected to the NMI line on the SoC.
Add the interrupt line to the device tree.
--- arch/arm64/boot/dts/allwinner/sun50i-h6-pine-h64.dts | 2 ++ 1 file changed, 2 insertions(+)
arch/arm64/boot/dts/allwinner/sun50i-h6-pine-h64.dts +2 -0
@@ -176,6 +176,8 @@ pcf8563: rtc@51 { compatible = "nxp,pcf8563"; reg = <0x51>; + interrupt-parent = <&r_intc>; + interrupts = <0 IRQ_TYPE_LEVEL_LOW>; #clock-cells = <0>; }; };
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 430/671 drm/msm/a3xx: remove TPL1 regs from snapshot
In reply to Sasha LevinFrom: Rob Clark <[email protected]>
[ Upstream commit f47bee2ba447bebc304111c16ef1e1a73a9744dd ]
These regs are write-only, and the hw throws a hissy-fit (ie. reboots) when we try to read them for GPU state snapshot, in response to a GPU hang. It is rather impolite when GPU recovery triggers an insta- reboot, so lets remove the TPL1 registers from the snapshot.
--- drivers/gpu/drm/msm/adreno/a3xx_gpu.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-)
drivers/gpu/drm/msm/adreno/a3xx_gpu.c +11 -13
@@ -395,19 +395,17 @@ static const unsigned int a3xx_registers[] = {0x2200 ,0x2212 ,0x2214 ,0x2217 ,0x221a ,0x221a ,0x2240 ,0x227e ,0x2280 ,0x228b ,0x22c0 ,0x22c0 ,0x22c4 ,0x22ce ,0x22d0 ,0x22d8 ,0x22df ,0x22e6 ,0x22e8 ,0x22e9 ,0x22ec ,0x22ec ,0x22f0 ,0x22f7 , -0x22ff ,0x22ff ,0x2340 ,0x2343 ,0x2348 ,0x2349 ,0x2350 ,0x2356 , -0x2360 ,0x2360 ,0x2440 ,0x2440 ,0x2444 ,0x2444 ,0x2448 ,0x244d , -0x2468 ,0x2469 ,0x246c ,0x246d ,0x2470 ,0x2470 ,0x2472 ,0x2472 , -0x2474 ,0x2475 ,0x2479 ,0x247a ,0x24c0 ,0x24d3 ,0x24e4 ,0x24ef , -0x2500 ,0x2509 ,0x250c ,0x250c ,0x250e ,0x250e ,0x2510 ,0x2511 , -0x2514 ,0x2515 ,0x25e4 ,0x25e4 ,0x25ea ,0x25ea ,0x25ec ,0x25ed , -0x25f0 ,0x25f0 ,0x2600 ,0x2612 ,0x2614 ,0x2617 ,0x261a ,0x261a , -0x2640 ,0x267e ,0x2680 ,0x268b ,0x26c0 ,0x26c0 ,0x26c4 ,0x26ce , -0x26d0 ,0x26d8 ,0x26df ,0x26e6 ,0x26e8 ,0x26e9 ,0x26ec ,0x26ec , -0x26f0 ,0x26f7 ,0x26ff ,0x26ff ,0x2740 ,0x2743 ,0x2748 ,0x2749 , -0x2750 ,0x2756 ,0x2760 ,0x2760 ,0x300c ,0x300e ,0x301c ,0x301d , -0x302a ,0x302a ,0x302c ,0x302d ,0x3030 ,0x3031 ,0x3034 ,0x3036 , -0x303c ,0x303c ,0x305e ,0x305f , +0x22ff ,0x22ff ,0x2340 ,0x2343 ,0x2440 ,0x2440 ,0x2444 ,0x2444 , +0x2448 ,0x244d ,0x2468 ,0x2469 ,0x246c ,0x246d ,0x2470 ,0x2470 , +0x2472 ,0x2472 ,0x2474 ,0x2475 ,0x2479 ,0x247a ,0x24c0 ,0x24d3 , +0x24e4 ,0x24ef ,0x2500 ,0x2509 ,0x250c ,0x250c ,0x250e ,0x250e , +0x2510 ,0x2511 ,0x2514 ,0x2515 ,0x25e4 ,0x25e4 ,0x25ea ,0x25ea , +0x25ec ,0x25ed ,0x25f0 ,0x25f0 ,0x2600 ,0x2612 ,0x2614 ,0x2617 , +0x261a ,0x261a ,0x2640 ,0x267e ,0x2680 ,0x268b ,0x26c0 ,0x26c0 , +0x26c4 ,0x26ce ,0x26d0 ,0x26d8 ,0x26df ,0x26e6 ,0x26e8 ,0x26e9 , +0x26ec ,0x26ec ,0x26f0 ,0x26f7 ,0x26ff ,0x26ff ,0x2740 ,0x2743 , +0x300c ,0x300e ,0x301c ,0x301d ,0x302a ,0x302a ,0x302c ,0x302d , +0x3030 ,0x3031 ,0x3034 ,0x3036 ,0x303c ,0x303c ,0x305e ,0x305f , ~0 /* sentinel */ };
Signature · 6 lines
2.20.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Sasha Levin
maintainerPATCH 431/671 ip6_fib: Don't discard nodes with valid routing information in fib6_locate_1()
In reply to Sasha LevinFrom: Stefano Brivio <[email protected]>
[ Upstream commit 40cb35d5dc04e7f89cbc7b1fc9b4b48d9f1e5343 ]
When we perform an inexact match on FIB nodes via fib6_locate_1(), longer prefixes will be preferred to shorter ones. However, it might happen that a node, with higher fn_bit value than some other, has no valid routing information.
In this case, we'll pick that node, but it will be discarded by the check on RTN_RTINFO in fib6_locate(), and we might miss nodes with valid routing information but with lower fn_bit value.
This is apparent when a routing exception is created for a default route:
# ip -6 route list fc00:1::/64 dev veth_A-R1 proto kernel metric 256 pref medium fc00:2::/64 dev veth_A-R2 proto kernel metric 256 pref medium fc00:4::1 via fc00:2::2 dev veth_A-R2 metric 1024 pref medium fe80::/64 dev veth_A-R1 proto kernel metric 256 pref medium fe80::/64 dev veth_A-R2 proto kernel metric 256 pref medium default via fc00:1::2 dev veth_A-R1 metric 1024 pref medium # ip -6 route list cache fc00:4::1 via fc00:2::2 dev veth_A-R2 metric 1024 expires 593sec mtu 1500 pref medium fc00:3::1 via fc00:1::2 dev veth_A-R1 metric 1024 expires 593sec mtu 1500 pref medium # ip -6 route flush cache # node for default route is discarded Failed to send flush request: No such process # ip -6 route list cache fc00:3::1 via fc00:1::2 dev veth_A-R1 metric 1024 expires 586sec mtu 1500 pref medium
Check right away if the node has a RTN_RTINFO flag, before replacing the 'prev' pointer, that indicates the longest matching prefix found so far.
--- net/ipv6/ip6_fib.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/ipv6/ip6_fib.c +2 -1
@@ -1529,7 +1529,8 @@ static struct fib6_node *fib6_locate_1(struct fib6_node *root,if (plen == fn->fn_bit)return fn; - prev = fn; +if (fn->fn_flags &RTN_RTINFO ) + prev = fn; next:/*
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 432/671 perf/ioctl: Add check for the sample_period value
In reply to Sasha LevinFrom: Ravi Bangoria <[email protected]>
[ Upstream commit 913a90bc5a3a06b1f04c337320e9aeee2328dd77 ]
perf_event_open() limits the sample_period to 63 bits. See:
0819b2e30ccb ("perf: Limit perf_event_attr::sample_period to 63 bits")
Make ioctl() consistent with it.
Also on PowerPC, negative sample_period could cause a recursive PMIs leading to a hang (reported when running perf-fuzzer).
--- kernel/events/core.c | 3 +++ 1 file changed, 3 insertions(+)
kernel/events/core.c +3 -0
@@ -5012,6 +5012,9 @@ static int perf_event_period(struct perf_event *event, u64 __user *arg)if (perf_event_check_period (event, value))return -EINVAL ; +if (!event->attr.freq && (value & (1ULL <<63 ))) +return -EINVAL ; +event_function_call (event, __perf_event_period, &value);return 0 ;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 433/671 dmaengine: hsu: Revert "set HSU_CH_MTSR to memory width"
In reply to Sasha LevinFrom: Andy Shevchenko <[email protected]>
[ Upstream commit c24a5c735f87d0549060de31367c095e8810b895 ]
The commit
080edf75d337 ("dmaengine: hsu: set HSU_CH_MTSR to memory width")
has been mistakenly submitted. The further investigations show that the original code does better job since the memory side transfer size has never been configured by DMA users.
As per latest revision of documentation: "Channel minimum transfer size (CHnMTSR)... For IOSF UART, maximum value that can be programmed is 64 and minimum value that can be programmed is 1."
This reverts commit 080edf75d337d35faa6fc3df99342b10d2848d16.
--- drivers/dma/hsu/hsu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/dma/hsu/hsu.c +2 -2
@@ -64,10 +64,10 @@ static void hsu_dma_chan_start(struct hsu_dma_chan *hsuc)if (hsuc->direction ==DMA_MEM_TO_DEV ) { bsr = config->dst_maxburst; - mtsr = config->src_addr_width; + mtsr = config->dst_addr_width; }else if (hsuc->direction ==DMA_DEV_TO_MEM ) { bsr = config->src_maxburst; - mtsr = config->dst_addr_width; + mtsr = config->src_addr_width; }hsu_chan_disable (hsuc);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 434/671 clk: qcom: Fix -Wunused-const-variable
In reply to Sasha LevinFrom: Nathan Huckleberry <[email protected]>
[ Upstream commit da642427bd7710ec4f4140f693f59aa8521a358c ]
Clang produces the following warning
drivers/clk/qcom/gcc-msm8996.c:133:32: warning: unused variable 'gcc_xo_gpll0_gpll2_gpll3_gpll0_early_div_map' [-Wunused-const-variable] static const structparent_map gcc_xo_gpll0_gpll2_gpll3_gpll0_early_div_map[] =
{ ^drivers/clk/qcom/gcc-msm8996.c:141:27: warning: unused variable 'gcc_xo_gpll0_gpll2_gpll3_gpll0_early_div' [-Wunused-const-variable] static const char * const gcc_xo_gpll0_gpll2_gpll3_gpll0_early_div[] = { ^ drivers/clk/qcom/gcc-msm8996.c:187:32: warning: unused variable 'gcc_xo_gpll0_gpll2_gpll3_gpll1_gpll4_gpll0_early_div_map' [-Wunused-const-variable] static const struct parent_map gcc_xo_gpll0_gpll2_gpll3_gpll1_gpll4_gpll0_early_div_map[] = { ^ drivers/clk/qcom/gcc-msm8996.c:197:27: warning: unused variable 'gcc_xo_gpll0_gpll2_gpll3_gpll1_gpll4_gpll0_early_div' [-Wunused-const-variable] static const char * const gcc_xo_gpll0_gpll2_gpll3_gpll1_gpll4_gpll0_early_div[] = {
It looks like these were never used.
--- drivers/clk/qcom/gcc-msm8996.c | 36 ---------------------------------- 1 file changed, 36 deletions(-)
drivers/clk/qcom/gcc-msm8996.c +0 -36
@@ -138,22 +138,6 @@ static const char * const gcc_xo_gpll0_gpll4_gpll0_early_div[] = {"gpll0_early_div" }; -static const struct parent_map gcc_xo_gpll0_gpll2_gpll3_gpll0_early_div_map[] = { - {P_XO ,0 }, - {P_GPLL0 ,1 }, - {P_GPLL2 ,2 }, - {P_GPLL3 ,3 }, - {P_GPLL0_EARLY_DIV ,6 } -}; - -static const char *const gcc_xo_gpll0_gpll2_gpll3_gpll0_early_div[] = { -"xo" , -"gpll0" , -"gpll2" , -"gpll3" , -"gpll0_early_div" -}; -static const struct parent_map gcc_xo_gpll0_gpll1_early_div_gpll1_gpll4_gpll0_early_div_map[] = { {P_XO ,0 }, {P_GPLL0 ,1 },
@@ -192,26 +176,6 @@ static const char * const gcc_xo_gpll0_gpll2_gpll3_gpll1_gpll2_early_gpll0_early"gpll0_early_div" }; -static const struct parent_map gcc_xo_gpll0_gpll2_gpll3_gpll1_gpll4_gpll0_early_div_map[] = { - {P_XO ,0 }, - {P_GPLL0 ,1 }, - {P_GPLL2 ,2 }, - {P_GPLL3 ,3 }, - {P_GPLL1 ,4 }, - {P_GPLL4 ,5 }, - {P_GPLL0_EARLY_DIV ,6 } -}; - -static const char *const gcc_xo_gpll0_gpll2_gpll3_gpll1_gpll4_gpll0_early_div[] = { -"xo" , -"gpll0" , -"gpll2" , -"gpll3" , -"gpll1" , -"gpll4" , -"gpll0_early_div" -}; -static struct clk_fixed_factor xo = { .mult =1 , .div =1 ,
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 435/671 nvmem: imx-ocotp: Ensure WAIT bits are preserved when setting timing
In reply to Sasha LevinFrom: Bryan O'Donoghue <[email protected]>
[ Upstream commit 0493c4792b4eb260441e57f52cc11a9ded48b5a7 ]
The i.MX6 and i.MX8 both have a bit-field spanning bits 27:22 called the WAIT field.
The WAIT field according to the documentation for both parts "specifies time interval between auto read and write access in one time program. It is given in number of ipg_clk periods."
This patch ensures that the relevant field is read and written back to the timing register.
--- drivers/nvmem/imx-ocotp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/nvmem/imx-ocotp.c +2 -1
@@ -189,7 +189,8 @@ static void imx_ocotp_set_imx6_timing(struct ocotp_priv *priv) strobe_prog = clk_rate / (1000000000 /10000 ) +2 * (DEF_RELAX +1 ) -1 ; strobe_read = clk_rate / (1000000000 /40 ) +2 * (DEF_RELAX +1 ) -1 ; - timing = strobe_prog &0x00000FFF ; + timing =readl (priv->base +IMX_OCOTP_ADDR_TIMING ) &0x0FC00000 ; + timing |= strobe_prog &0x00000FFF ; timing |= (relax <<12 ) &0x0000F000 ; timing |= (strobe_read <<16 ) &0x003F0000 ;
Signature · 7 lines
2.20.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel