OSDN Git Service

Merge tag 'vfio-v4.17' of git://github.com/awilliam/linux-vfio
authorLinus Torvalds <torvalds@linux-foundation.org>
Sat, 2 Jun 2018 17:08:45 +0000 (10:08 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 2 Jun 2018 17:08:45 +0000 (10:08 -0700)
Pull VFIO fix from Alex Williamson:
 "Revert a pfn page mapping optimization identified as introducing a bad
  page state regression (Alex Williamson)"

* tag 'vfio-v4.17' of git://github.com/awilliam/linux-vfio:
  Revert "vfio/type1: Improve memory pinning process for raw PFN mapping"

30 files changed:
Documentation/i2c/busses/i2c-ocores
MAINTAINERS
drivers/hwtracing/intel_th/msu.c
drivers/hwtracing/stm/core.c
drivers/i2c/busses/i2c-ocores.c
drivers/iio/adc/Kconfig
drivers/iio/adc/ad7793.c
drivers/iio/adc/at91-sama5d2_adc.c
drivers/iio/adc/stm32-dfsdm-adc.c
drivers/iio/buffer/industrialio-buffer-dma.c
drivers/iio/buffer/kfifo_buf.c
drivers/iio/common/hid-sensors/hid-sensor-trigger.c
drivers/infiniband/core/cache.c
drivers/infiniband/hw/bnxt_re/main.c
drivers/infiniband/hw/bnxt_re/qplib_fp.c
drivers/infiniband/hw/bnxt_re/qplib_fp.h
drivers/infiniband/hw/bnxt_re/qplib_rcfw.c
drivers/infiniband/hw/bnxt_re/qplib_rcfw.h
drivers/infiniband/ulp/srpt/Kconfig
drivers/nvme/host/Kconfig
drivers/nvme/target/Kconfig
drivers/staging/lustre/lnet/Kconfig
drivers/thunderbolt/icm.c
fs/cifs/Kconfig
include/linux/iio/buffer_impl.h
mm/huge_memory.c
mm/vmscan.c
net/9p/Kconfig
net/rds/Kconfig
net/sunrpc/Kconfig

index c269aaa..9e1dfe7 100644 (file)
@@ -2,7 +2,7 @@ Kernel driver i2c-ocores
 
 Supported adapters:
   * OpenCores.org I2C controller by Richard Herveille (see datasheet link)
-    Datasheet: http://www.opencores.org/projects.cgi/web/i2c/overview
+    https://opencores.org/project/i2c/overview
 
 Author: Peter Korsgaard <jacmet@sunsite.dk>
 
index ca4afd6..9c125f7 100644 (file)
@@ -15513,6 +15513,14 @@ L:     linux-kernel@vger.kernel.org
 S:     Supported
 F:     drivers/char/xillybus/
 
+XLP9XX I2C DRIVER
+M:     George Cherian <george.cherian@cavium.com>
+M:     Jan Glauber <jglauber@cavium.com>
+L:     linux-i2c@vger.kernel.org
+W:     http://www.cavium.com
+S:     Supported
+F:     drivers/i2c/busses/i2c-xlp9xx.c
+
 XRA1403 GPIO EXPANDER
 M:     Nandor Han <nandor.han@ge.com>
 M:     Semi Malinen <semi.malinen@ge.com>
index ede3883..634f580 100644 (file)
@@ -733,8 +733,8 @@ err_nomem:
                /* Reset the page to write-back before releasing */
                set_memory_wb((unsigned long)win->block[i].bdesc, 1);
 #endif
-               dma_free_coherent(msc_dev(msc), size, win->block[i].bdesc,
-                                 win->block[i].addr);
+               dma_free_coherent(msc_dev(msc)->parent->parent, size,
+                                 win->block[i].bdesc, win->block[i].addr);
        }
        kfree(win);
 
@@ -769,7 +769,7 @@ static void msc_buffer_win_free(struct msc *msc, struct msc_window *win)
                /* Reset the page to write-back before releasing */
                set_memory_wb((unsigned long)win->block[i].bdesc, 1);
 #endif
-               dma_free_coherent(msc_dev(win->msc), PAGE_SIZE,
+               dma_free_coherent(msc_dev(win->msc)->parent->parent, PAGE_SIZE,
                                  win->block[i].bdesc, win->block[i].addr);
        }
 
index 05386b7..10bcb5d 100644 (file)
@@ -19,6 +19,7 @@
 #include <linux/stm.h>
 #include <linux/fs.h>
 #include <linux/mm.h>
+#include <linux/vmalloc.h>
 #include "stm.h"
 
 #include <uapi/linux/stm.h>
@@ -674,7 +675,7 @@ static void stm_device_release(struct device *dev)
 {
        struct stm_device *stm = to_stm_device(dev);
 
-       kfree(stm);
+       vfree(stm);
 }
 
 int stm_register_device(struct device *parent, struct stm_data *stm_data,
@@ -691,7 +692,7 @@ int stm_register_device(struct device *parent, struct stm_data *stm_data,
                return -EINVAL;
 
        nmasters = stm_data->sw_end - stm_data->sw_start + 1;
-       stm = kzalloc(sizeof(*stm) + nmasters * sizeof(void *), GFP_KERNEL);
+       stm = vzalloc(sizeof(*stm) + nmasters * sizeof(void *));
        if (!stm)
                return -ENOMEM;
 
@@ -744,7 +745,7 @@ err_device:
        /* matches device_initialize() above */
        put_device(&stm->dev);
 err_free:
-       kfree(stm);
+       vfree(stm);
 
        return err;
 }
index 8c42ca7..45ae3c0 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * i2c-ocores.c: I2C bus driver for OpenCores I2C controller
- * (http://www.opencores.org/projects.cgi/web/i2c/overview).
+ * (https://opencores.org/project/i2c/overview)
  *
  * Peter Korsgaard <jacmet@sunsite.dk>
  *
index 15606f2..9da7907 100644 (file)
@@ -158,6 +158,7 @@ config AT91_SAMA5D2_ADC
        depends on ARCH_AT91 || COMPILE_TEST
        depends on HAS_IOMEM
        depends on HAS_DMA
+       select IIO_BUFFER
        select IIO_TRIGGERED_BUFFER
        help
          Say yes here to build support for Atmel SAMA5D2 ADC which is
index 801afb6..d4bbe5b 100644 (file)
@@ -348,55 +348,6 @@ static const u16 ad7793_sample_freq_avail[16] = {0, 470, 242, 123, 62, 50, 39,
 static const u16 ad7797_sample_freq_avail[16] = {0, 0, 0, 123, 62, 50, 0,
                                        33, 0, 17, 16, 12, 10, 8, 6, 4};
 
-static ssize_t ad7793_read_frequency(struct device *dev,
-               struct device_attribute *attr,
-               char *buf)
-{
-       struct iio_dev *indio_dev = dev_to_iio_dev(dev);
-       struct ad7793_state *st = iio_priv(indio_dev);
-
-       return sprintf(buf, "%d\n",
-              st->chip_info->sample_freq_avail[AD7793_MODE_RATE(st->mode)]);
-}
-
-static ssize_t ad7793_write_frequency(struct device *dev,
-               struct device_attribute *attr,
-               const char *buf,
-               size_t len)
-{
-       struct iio_dev *indio_dev = dev_to_iio_dev(dev);
-       struct ad7793_state *st = iio_priv(indio_dev);
-       long lval;
-       int i, ret;
-
-       ret = kstrtol(buf, 10, &lval);
-       if (ret)
-               return ret;
-
-       if (lval == 0)
-               return -EINVAL;
-
-       for (i = 0; i < 16; i++)
-               if (lval == st->chip_info->sample_freq_avail[i])
-                       break;
-       if (i == 16)
-               return -EINVAL;
-
-       ret = iio_device_claim_direct_mode(indio_dev);
-       if (ret)
-               return ret;
-       st->mode &= ~AD7793_MODE_RATE(-1);
-       st->mode |= AD7793_MODE_RATE(i);
-       ad_sd_write_reg(&st->sd, AD7793_REG_MODE, sizeof(st->mode), st->mode);
-       iio_device_release_direct_mode(indio_dev);
-
-       return len;
-}
-
-static IIO_DEV_ATTR_SAMP_FREQ(S_IWUSR | S_IRUGO,
-               ad7793_read_frequency,
-               ad7793_write_frequency);
-
 static IIO_CONST_ATTR_SAMP_FREQ_AVAIL(
        "470 242 123 62 50 39 33 19 17 16 12 10 8 6 4");
 
@@ -424,7 +375,6 @@ static IIO_DEVICE_ATTR_NAMED(in_m_in_scale_available,
                ad7793_show_scale_available, NULL, 0);
 
 static struct attribute *ad7793_attributes[] = {
-       &iio_dev_attr_sampling_frequency.dev_attr.attr,
        &iio_const_attr_sampling_frequency_available.dev_attr.attr,
        &iio_dev_attr_in_m_in_scale_available.dev_attr.attr,
        NULL
@@ -435,7 +385,6 @@ static const struct attribute_group ad7793_attribute_group = {
 };
 
 static struct attribute *ad7797_attributes[] = {
-       &iio_dev_attr_sampling_frequency.dev_attr.attr,
        &iio_const_attr_sampling_frequency_available_ad7797.dev_attr.attr,
        NULL
 };
@@ -505,6 +454,10 @@ static int ad7793_read_raw(struct iio_dev *indio_dev,
                        *val -= offset;
                }
                return IIO_VAL_INT;
+       case IIO_CHAN_INFO_SAMP_FREQ:
+               *val = st->chip_info
+                              ->sample_freq_avail[AD7793_MODE_RATE(st->mode)];
+               return IIO_VAL_INT;
        }
        return -EINVAL;
 }
@@ -542,6 +495,26 @@ static int ad7793_write_raw(struct iio_dev *indio_dev,
                                break;
                        }
                break;
+       case IIO_CHAN_INFO_SAMP_FREQ:
+               if (!val) {
+                       ret = -EINVAL;
+                       break;
+               }
+
+               for (i = 0; i < 16; i++)
+                       if (val == st->chip_info->sample_freq_avail[i])
+                               break;
+
+               if (i == 16) {
+                       ret = -EINVAL;
+                       break;
+               }
+
+               st->mode &= ~AD7793_MODE_RATE(-1);
+               st->mode |= AD7793_MODE_RATE(i);
+               ad_sd_write_reg(&st->sd, AD7793_REG_MODE, sizeof(st->mode),
+                               st->mode);
+               break;
        default:
                ret = -EINVAL;
        }
index 4eff835..8729d65 100644 (file)
@@ -333,6 +333,27 @@ static const struct iio_chan_spec at91_adc_channels[] = {
                                + AT91_SAMA5D2_DIFF_CHAN_CNT + 1),
 };
 
+static int at91_adc_chan_xlate(struct iio_dev *indio_dev, int chan)
+{
+       int i;
+
+       for (i = 0; i < indio_dev->num_channels; i++) {
+               if (indio_dev->channels[i].scan_index == chan)
+                       return i;
+       }
+       return -EINVAL;
+}
+
+static inline struct iio_chan_spec const *
+at91_adc_chan_get(struct iio_dev *indio_dev, int chan)
+{
+       int index = at91_adc_chan_xlate(indio_dev, chan);
+
+       if (index < 0)
+               return NULL;
+       return indio_dev->channels + index;
+}
+
 static int at91_adc_configure_trigger(struct iio_trigger *trig, bool state)
 {
        struct iio_dev *indio = iio_trigger_get_drvdata(trig);
@@ -350,8 +371,10 @@ static int at91_adc_configure_trigger(struct iio_trigger *trig, bool state)
        at91_adc_writel(st, AT91_SAMA5D2_TRGR, status);
 
        for_each_set_bit(bit, indio->active_scan_mask, indio->num_channels) {
-               struct iio_chan_spec const *chan = indio->channels + bit;
+               struct iio_chan_spec const *chan = at91_adc_chan_get(indio, bit);
 
+               if (!chan)
+                       continue;
                if (state) {
                        at91_adc_writel(st, AT91_SAMA5D2_CHER,
                                        BIT(chan->channel));
@@ -448,7 +471,11 @@ static int at91_adc_dma_start(struct iio_dev *indio_dev)
 
        for_each_set_bit(bit, indio_dev->active_scan_mask,
                         indio_dev->num_channels) {
-               struct iio_chan_spec const *chan = indio_dev->channels + bit;
+               struct iio_chan_spec const *chan =
+                                        at91_adc_chan_get(indio_dev, bit);
+
+               if (!chan)
+                       continue;
 
                st->dma_st.rx_buf_sz += chan->scan_type.storagebits / 8;
        }
@@ -526,8 +553,11 @@ static int at91_adc_buffer_predisable(struct iio_dev *indio_dev)
         */
        for_each_set_bit(bit, indio_dev->active_scan_mask,
                         indio_dev->num_channels) {
-               struct iio_chan_spec const *chan = indio_dev->channels + bit;
+               struct iio_chan_spec const *chan =
+                                       at91_adc_chan_get(indio_dev, bit);
 
+               if (!chan)
+                       continue;
                if (st->dma_st.dma_chan)
                        at91_adc_readl(st, chan->address);
        }
@@ -587,8 +617,11 @@ static void at91_adc_trigger_handler_nodma(struct iio_dev *indio_dev,
 
        for_each_set_bit(bit, indio_dev->active_scan_mask,
                         indio_dev->num_channels) {
-               struct iio_chan_spec const *chan = indio_dev->channels + bit;
+               struct iio_chan_spec const *chan =
+                                       at91_adc_chan_get(indio_dev, bit);
 
+               if (!chan)
+                       continue;
                st->buffer[i] = at91_adc_readl(st, chan->address);
                i++;
        }
index 01422d1..b28a716 100644 (file)
@@ -144,6 +144,7 @@ static int stm32_dfsdm_set_osrs(struct stm32_dfsdm_filter *fl,
         * Leave as soon as if exact resolution if reached.
         * Otherwise the higher resolution below 32 bits is kept.
         */
+       fl->res = 0;
        for (fosr = 1; fosr <= DFSDM_MAX_FL_OVERSAMPLING; fosr++) {
                for (iosr = 1; iosr <= DFSDM_MAX_INT_OVERSAMPLING; iosr++) {
                        if (fast)
@@ -193,7 +194,7 @@ static int stm32_dfsdm_set_osrs(struct stm32_dfsdm_filter *fl,
                }
        }
 
-       if (!fl->fosr)
+       if (!fl->res)
                return -EINVAL;
 
        return 0;
@@ -770,7 +771,7 @@ static int stm32_dfsdm_write_raw(struct iio_dev *indio_dev,
        struct stm32_dfsdm_adc *adc = iio_priv(indio_dev);
        struct stm32_dfsdm_filter *fl = &adc->dfsdm->fl_list[adc->fl_id];
        struct stm32_dfsdm_channel *ch = &adc->dfsdm->ch_list[chan->channel];
-       unsigned int spi_freq = adc->spi_freq;
+       unsigned int spi_freq;
        int ret = -EINVAL;
 
        switch (mask) {
@@ -784,8 +785,18 @@ static int stm32_dfsdm_write_raw(struct iio_dev *indio_dev,
        case IIO_CHAN_INFO_SAMP_FREQ:
                if (!val)
                        return -EINVAL;
-               if (ch->src != DFSDM_CHANNEL_SPI_CLOCK_EXTERNAL)
+
+               switch (ch->src) {
+               case DFSDM_CHANNEL_SPI_CLOCK_INTERNAL:
                        spi_freq = adc->dfsdm->spi_master_freq;
+                       break;
+               case DFSDM_CHANNEL_SPI_CLOCK_INTERNAL_DIV2_FALLING:
+               case DFSDM_CHANNEL_SPI_CLOCK_INTERNAL_DIV2_RISING:
+                       spi_freq = adc->dfsdm->spi_master_freq / 2;
+                       break;
+               default:
+                       spi_freq = adc->spi_freq;
+               }
 
                if (spi_freq % val)
                        dev_warn(&indio_dev->dev,
index 05e0c35..b32bf57 100644 (file)
@@ -587,7 +587,7 @@ EXPORT_SYMBOL_GPL(iio_dma_buffer_set_bytes_per_datum);
  * Should be used as the set_length callback for iio_buffer_access_ops
  * struct for DMA buffers.
  */
-int iio_dma_buffer_set_length(struct iio_buffer *buffer, int length)
+int iio_dma_buffer_set_length(struct iio_buffer *buffer, unsigned int length)
 {
        /* Avoid an invalid state */
        if (length < 2)
index 047fe75..70c302a 100644 (file)
@@ -22,11 +22,18 @@ struct iio_kfifo {
 #define iio_to_kfifo(r) container_of(r, struct iio_kfifo, buffer)
 
 static inline int __iio_allocate_kfifo(struct iio_kfifo *buf,
-                               int bytes_per_datum, int length)
+                       size_t bytes_per_datum, unsigned int length)
 {
        if ((length == 0) || (bytes_per_datum == 0))
                return -EINVAL;
 
+       /*
+        * Make sure we don't overflow an unsigned int after kfifo rounds up to
+        * the next power of 2.
+        */
+       if (roundup_pow_of_two(length) > UINT_MAX / bytes_per_datum)
+               return -EINVAL;
+
        return __kfifo_alloc((struct __kfifo *)&buf->kf, length,
                             bytes_per_datum, GFP_KERNEL);
 }
@@ -67,7 +74,7 @@ static int iio_set_bytes_per_datum_kfifo(struct iio_buffer *r, size_t bpd)
        return 0;
 }
 
-static int iio_set_length_kfifo(struct iio_buffer *r, int length)
+static int iio_set_length_kfifo(struct iio_buffer *r, unsigned int length)
 {
        /* Avoid an invalid state */
        if (length < 2)
index cfb6588..4905a99 100644 (file)
@@ -178,14 +178,14 @@ int hid_sensor_power_state(struct hid_sensor_common *st, bool state)
 #ifdef CONFIG_PM
        int ret;
 
-       atomic_set(&st->user_requested_state, state);
-
        if (atomic_add_unless(&st->runtime_pm_enable, 1, 1))
                pm_runtime_enable(&st->pdev->dev);
 
-       if (state)
+       if (state) {
+               atomic_inc(&st->user_requested_state);
                ret = pm_runtime_get_sync(&st->pdev->dev);
-       else {
+       } else {
+               atomic_dec(&st->user_requested_state);
                pm_runtime_mark_last_busy(&st->pdev->dev);
                pm_runtime_use_autosuspend(&st->pdev->dev);
                ret = pm_runtime_put_autosuspend(&st->pdev->dev);
index fb2d347..ecc55e9 100644 (file)
@@ -502,7 +502,7 @@ static int __ib_cache_gid_get(struct ib_device *ib_dev, u8 port, int index,
                return -EINVAL;
 
        if (table->data_vec[index].props & GID_TABLE_ENTRY_INVALID)
-               return -EAGAIN;
+               return -EINVAL;
 
        memcpy(gid, &table->data_vec[index].gid, sizeof(*gid));
        if (attr) {
index f6c739e..20b9f31 100644 (file)
@@ -185,12 +185,65 @@ static void bnxt_re_shutdown(void *p)
        bnxt_re_ib_unreg(rdev, false);
 }
 
+static void bnxt_re_stop_irq(void *handle)
+{
+       struct bnxt_re_dev *rdev = (struct bnxt_re_dev *)handle;
+       struct bnxt_qplib_rcfw *rcfw = &rdev->rcfw;
+       struct bnxt_qplib_nq *nq;
+       int indx;
+
+       for (indx = BNXT_RE_NQ_IDX; indx < rdev->num_msix; indx++) {
+               nq = &rdev->nq[indx - 1];
+               bnxt_qplib_nq_stop_irq(nq, false);
+       }
+
+       bnxt_qplib_rcfw_stop_irq(rcfw, false);
+}
+
+static void bnxt_re_start_irq(void *handle, struct bnxt_msix_entry *ent)
+{
+       struct bnxt_re_dev *rdev = (struct bnxt_re_dev *)handle;
+       struct bnxt_msix_entry *msix_ent = rdev->msix_entries;
+       struct bnxt_qplib_rcfw *rcfw = &rdev->rcfw;
+       struct bnxt_qplib_nq *nq;
+       int indx, rc;
+
+       if (!ent) {
+               /* Not setting the f/w timeout bit in rcfw.
+                * During the driver unload the first command
+                * to f/w will timeout and that will set the
+                * timeout bit.
+                */
+               dev_err(rdev_to_dev(rdev), "Failed to re-start IRQs\n");
+               return;
+       }
+
+       /* Vectors may change after restart, so update with new vectors
+        * in device sctructure.
+        */
+       for (indx = 0; indx < rdev->num_msix; indx++)
+               rdev->msix_entries[indx].vector = ent[indx].vector;
+
+       bnxt_qplib_rcfw_start_irq(rcfw, msix_ent[BNXT_RE_AEQ_IDX].vector,
+                                 false);
+       for (indx = BNXT_RE_NQ_IDX ; indx < rdev->num_msix; indx++) {
+               nq = &rdev->nq[indx - 1];
+               rc = bnxt_qplib_nq_start_irq(nq, indx - 1,
+                                            msix_ent[indx].vector, false);
+               if (rc)
+                       dev_warn(rdev_to_dev(rdev),
+                                "Failed to reinit NQ index %d\n", indx - 1);
+       }
+}
+
 static struct bnxt_ulp_ops bnxt_re_ulp_ops = {
        .ulp_async_notifier = NULL,
        .ulp_stop = bnxt_re_stop,
        .ulp_start = bnxt_re_start,
        .ulp_sriov_config = bnxt_re_sriov_config,
-       .ulp_shutdown = bnxt_re_shutdown
+       .ulp_shutdown = bnxt_re_shutdown,
+       .ulp_irq_stop = bnxt_re_stop_irq,
+       .ulp_irq_restart = bnxt_re_start_irq
 };
 
 /* RoCE -> Net driver */
index 3a78fab..50d8f1f 100644 (file)
@@ -336,22 +336,32 @@ static irqreturn_t bnxt_qplib_nq_irq(int irq, void *dev_instance)
        return IRQ_HANDLED;
 }
 
+void bnxt_qplib_nq_stop_irq(struct bnxt_qplib_nq *nq, bool kill)
+{
+       tasklet_disable(&nq->worker);
+       /* Mask h/w interrupt */
+       NQ_DB(nq->bar_reg_iomem, nq->hwq.cons, nq->hwq.max_elements);
+       /* Sync with last running IRQ handler */
+       synchronize_irq(nq->vector);
+       if (kill)
+               tasklet_kill(&nq->worker);
+       if (nq->requested) {
+               irq_set_affinity_hint(nq->vector, NULL);
+               free_irq(nq->vector, nq);
+               nq->requested = false;
+       }
+}
+
 void bnxt_qplib_disable_nq(struct bnxt_qplib_nq *nq)
 {
        if (nq->cqn_wq) {
                destroy_workqueue(nq->cqn_wq);
                nq->cqn_wq = NULL;
        }
+
        /* Make sure the HW is stopped! */
-       synchronize_irq(nq->vector);
-       tasklet_disable(&nq->worker);
-       tasklet_kill(&nq->worker);
+       bnxt_qplib_nq_stop_irq(nq, true);
 
-       if (nq->requested) {
-               irq_set_affinity_hint(nq->vector, NULL);
-               free_irq(nq->vector, nq);
-               nq->requested = false;
-       }
        if (nq->bar_reg_iomem)
                iounmap(nq->bar_reg_iomem);
        nq->bar_reg_iomem = NULL;
@@ -361,6 +371,40 @@ void bnxt_qplib_disable_nq(struct bnxt_qplib_nq *nq)
        nq->vector = 0;
 }
 
+int bnxt_qplib_nq_start_irq(struct bnxt_qplib_nq *nq, int nq_indx,
+                           int msix_vector, bool need_init)
+{
+       int rc;
+
+       if (nq->requested)
+               return -EFAULT;
+
+       nq->vector = msix_vector;
+       if (need_init)
+               tasklet_init(&nq->worker, bnxt_qplib_service_nq,
+                            (unsigned long)nq);
+       else
+               tasklet_enable(&nq->worker);
+
+       snprintf(nq->name, sizeof(nq->name), "bnxt_qplib_nq-%d", nq_indx);
+       rc = request_irq(nq->vector, bnxt_qplib_nq_irq, 0, nq->name, nq);
+       if (rc)
+               return rc;
+
+       cpumask_clear(&nq->mask);
+       cpumask_set_cpu(nq_indx, &nq->mask);
+       rc = irq_set_affinity_hint(nq->vector, &nq->mask);
+       if (rc) {
+               dev_warn(&nq->pdev->dev,
+                        "QPLIB: set affinity failed; vector: %d nq_idx: %d\n",
+                        nq->vector, nq_indx);
+       }
+       nq->requested = true;
+       NQ_DB_REARM(nq->bar_reg_iomem, nq->hwq.cons, nq->hwq.max_elements);
+
+       return rc;
+}
+
 int bnxt_qplib_enable_nq(struct pci_dev *pdev, struct bnxt_qplib_nq *nq,
                         int nq_idx, int msix_vector, int bar_reg_offset,
                         int (*cqn_handler)(struct bnxt_qplib_nq *nq,
@@ -372,41 +416,17 @@ int bnxt_qplib_enable_nq(struct pci_dev *pdev, struct bnxt_qplib_nq *nq,
        resource_size_t nq_base;
        int rc = -1;
 
-       nq->pdev = pdev;
-       nq->vector = msix_vector;
        if (cqn_handler)
                nq->cqn_handler = cqn_handler;
 
        if (srqn_handler)
                nq->srqn_handler = srqn_handler;
 
-       tasklet_init(&nq->worker, bnxt_qplib_service_nq, (unsigned long)nq);
-
        /* Have a task to schedule CQ notifiers in post send case */
        nq->cqn_wq  = create_singlethread_workqueue("bnxt_qplib_nq");
        if (!nq->cqn_wq)
-               goto fail;
-
-       nq->requested = false;
-       memset(nq->name, 0, 32);
-       sprintf(nq->name, "bnxt_qplib_nq-%d", nq_idx);
-       rc = request_irq(nq->vector, bnxt_qplib_nq_irq, 0, nq->name, nq);
-       if (rc) {
-               dev_err(&nq->pdev->dev,
-                       "Failed to request IRQ for NQ: %#x", rc);
-               goto fail;
-       }
-
-       cpumask_clear(&nq->mask);
-       cpumask_set_cpu(nq_idx, &nq->mask);
-       rc = irq_set_affinity_hint(nq->vector, &nq->mask);
-       if (rc) {
-               dev_warn(&nq->pdev->dev,
-                        "QPLIB: set affinity failed; vector: %d nq_idx: %d\n",
-                        nq->vector, nq_idx);
-       }
+               return -ENOMEM;
 
-       nq->requested = true;
        nq->bar_reg = NQ_CONS_PCI_BAR_REGION;
        nq->bar_reg_off = bar_reg_offset;
        nq_base = pci_resource_start(pdev, nq->bar_reg);
@@ -419,7 +439,13 @@ int bnxt_qplib_enable_nq(struct pci_dev *pdev, struct bnxt_qplib_nq *nq,
                rc = -ENOMEM;
                goto fail;
        }
-       NQ_DB_REARM(nq->bar_reg_iomem, nq->hwq.cons, nq->hwq.max_elements);
+
+       rc = bnxt_qplib_nq_start_irq(nq, nq_idx, msix_vector, true);
+       if (rc) {
+               dev_err(&nq->pdev->dev,
+                       "QPLIB: Failed to request irq for nq-idx %d", nq_idx);
+               goto fail;
+       }
 
        return 0;
 fail:
index ade9f13..72352ca 100644 (file)
@@ -467,7 +467,10 @@ struct bnxt_qplib_nq_work {
        struct bnxt_qplib_cq    *cq;
 };
 
+void bnxt_qplib_nq_stop_irq(struct bnxt_qplib_nq *nq, bool kill);
 void bnxt_qplib_disable_nq(struct bnxt_qplib_nq *nq);
+int bnxt_qplib_nq_start_irq(struct bnxt_qplib_nq *nq, int nq_indx,
+                           int msix_vector, bool need_init);
 int bnxt_qplib_enable_nq(struct pci_dev *pdev, struct bnxt_qplib_nq *nq,
                         int nq_idx, int msix_vector, int bar_reg_offset,
                         int (*cqn_handler)(struct bnxt_qplib_nq *nq,
index 80027a4..2852d35 100644 (file)
@@ -582,19 +582,29 @@ fail:
        return -ENOMEM;
 }
 
-void bnxt_qplib_disable_rcfw_channel(struct bnxt_qplib_rcfw *rcfw)
+void bnxt_qplib_rcfw_stop_irq(struct bnxt_qplib_rcfw *rcfw, bool kill)
 {
-       unsigned long indx;
-
-       /* Make sure the HW channel is stopped! */
-       synchronize_irq(rcfw->vector);
        tasklet_disable(&rcfw->worker);
-       tasklet_kill(&rcfw->worker);
+       /* Mask h/w interrupts */
+       CREQ_DB(rcfw->creq_bar_reg_iomem, rcfw->creq.cons,
+               rcfw->creq.max_elements);
+       /* Sync with last running IRQ-handler */
+       synchronize_irq(rcfw->vector);
+       if (kill)
+               tasklet_kill(&rcfw->worker);
 
        if (rcfw->requested) {
                free_irq(rcfw->vector, rcfw);
                rcfw->requested = false;
        }
+}
+
+void bnxt_qplib_disable_rcfw_channel(struct bnxt_qplib_rcfw *rcfw)
+{
+       unsigned long indx;
+
+       bnxt_qplib_rcfw_stop_irq(rcfw, true);
+
        if (rcfw->cmdq_bar_reg_iomem)
                iounmap(rcfw->cmdq_bar_reg_iomem);
        rcfw->cmdq_bar_reg_iomem = NULL;
@@ -614,6 +624,31 @@ void bnxt_qplib_disable_rcfw_channel(struct bnxt_qplib_rcfw *rcfw)
        rcfw->vector = 0;
 }
 
+int bnxt_qplib_rcfw_start_irq(struct bnxt_qplib_rcfw *rcfw, int msix_vector,
+                             bool need_init)
+{
+       int rc;
+
+       if (rcfw->requested)
+               return -EFAULT;
+
+       rcfw->vector = msix_vector;
+       if (need_init)
+               tasklet_init(&rcfw->worker,
+                            bnxt_qplib_service_creq, (unsigned long)rcfw);
+       else
+               tasklet_enable(&rcfw->worker);
+       rc = request_irq(rcfw->vector, bnxt_qplib_creq_irq, 0,
+                        "bnxt_qplib_creq", rcfw);
+       if (rc)
+               return rc;
+       rcfw->requested = true;
+       CREQ_DB_REARM(rcfw->creq_bar_reg_iomem, rcfw->creq.cons,
+                     rcfw->creq.max_elements);
+
+       return 0;
+}
+
 int bnxt_qplib_enable_rcfw_channel(struct pci_dev *pdev,
                                   struct bnxt_qplib_rcfw *rcfw,
                                   int msix_vector,
@@ -675,27 +710,17 @@ int bnxt_qplib_enable_rcfw_channel(struct pci_dev *pdev,
        rcfw->creq_qp_event_processed = 0;
        rcfw->creq_func_event_processed = 0;
 
-       rcfw->vector = msix_vector;
        if (aeq_handler)
                rcfw->aeq_handler = aeq_handler;
+       init_waitqueue_head(&rcfw->waitq);
 
-       tasklet_init(&rcfw->worker, bnxt_qplib_service_creq,
-                    (unsigned long)rcfw);
-
-       rcfw->requested = false;
-       rc = request_irq(rcfw->vector, bnxt_qplib_creq_irq, 0,
-                        "bnxt_qplib_creq", rcfw);
+       rc = bnxt_qplib_rcfw_start_irq(rcfw, msix_vector, true);
        if (rc) {
                dev_err(&rcfw->pdev->dev,
                        "QPLIB: Failed to request IRQ for CREQ rc = 0x%x", rc);
                bnxt_qplib_disable_rcfw_channel(rcfw);
                return rc;
        }
-       rcfw->requested = true;
-
-       init_waitqueue_head(&rcfw->waitq);
-
-       CREQ_DB_REARM(rcfw->creq_bar_reg_iomem, 0, rcfw->creq.max_elements);
 
        init.cmdq_pbl = cpu_to_le64(rcfw->cmdq.pbl[PBL_LVL_0].pg_map_arr[0]);
        init.cmdq_size_cmdq_lvl = cpu_to_le16(
index c7cce2e..46416df 100644 (file)
@@ -195,7 +195,10 @@ struct bnxt_qplib_rcfw {
 void bnxt_qplib_free_rcfw_channel(struct bnxt_qplib_rcfw *rcfw);
 int bnxt_qplib_alloc_rcfw_channel(struct pci_dev *pdev,
                                  struct bnxt_qplib_rcfw *rcfw, int qp_tbl_sz);
+void bnxt_qplib_rcfw_stop_irq(struct bnxt_qplib_rcfw *rcfw, bool kill);
 void bnxt_qplib_disable_rcfw_channel(struct bnxt_qplib_rcfw *rcfw);
+int bnxt_qplib_rcfw_start_irq(struct bnxt_qplib_rcfw *rcfw, int msix_vector,
+                             bool need_init);
 int bnxt_qplib_enable_rcfw_channel(struct pci_dev *pdev,
                                   struct bnxt_qplib_rcfw *rcfw,
                                   int msix_vector,
index 25bf695..fb8b718 100644 (file)
@@ -1,6 +1,6 @@
 config INFINIBAND_SRPT
        tristate "InfiniBand SCSI RDMA Protocol target support"
-       depends on INFINIBAND_ADDR_TRANS && TARGET_CORE
+       depends on INFINIBAND && INFINIBAND_ADDR_TRANS && TARGET_CORE
        ---help---
 
          Support for the SCSI RDMA Protocol (SRP) Target driver. The
index dbb7464..88a8b59 100644 (file)
@@ -27,7 +27,7 @@ config NVME_FABRICS
 
 config NVME_RDMA
        tristate "NVM Express over Fabrics RDMA host driver"
-       depends on INFINIBAND_ADDR_TRANS && BLOCK
+       depends on INFINIBAND && INFINIBAND_ADDR_TRANS && BLOCK
        select NVME_CORE
        select NVME_FABRICS
        select SG_POOL
index 7595664..3c7b61d 100644 (file)
@@ -27,7 +27,7 @@ config NVME_TARGET_LOOP
 
 config NVME_TARGET_RDMA
        tristate "NVMe over Fabrics RDMA target support"
-       depends on INFINIBAND_ADDR_TRANS
+       depends on INFINIBAND && INFINIBAND_ADDR_TRANS
        depends on NVME_TARGET
        select SGL_ALLOC
        help
index f3b1ad4..ad049e6 100644 (file)
@@ -34,7 +34,7 @@ config LNET_SELFTEST
 
 config LNET_XPRT_IB
        tristate "LNET infiniband support"
-       depends on LNET && PCI && INFINIBAND_ADDR_TRANS
+       depends on LNET && PCI && INFINIBAND && INFINIBAND_ADDR_TRANS
        default LNET && INFINIBAND
        help
          This option allows the LNET users to use infiniband as an
index 2d2ceda..500911f 100644 (file)
@@ -1255,7 +1255,7 @@ static int icm_ar_get_boot_acl(struct tb *tb, uuid_t *uuids, size_t nuuids)
                        /* Map empty entries to null UUID */
                        uuid[0] = 0;
                        uuid[1] = 0;
-               } else {
+               } else if (uuid[0] != 0 || uuid[1] != 0) {
                        /* Upper two DWs are always one's */
                        uuid[2] = 0xffffffff;
                        uuid[3] = 0xffffffff;
index d61e2de..5f132d5 100644 (file)
@@ -197,7 +197,7 @@ config CIFS_SMB311
 
 config CIFS_SMB_DIRECT
        bool "SMB Direct support (Experimental)"
-       depends on CIFS=m && INFINIBAND_ADDR_TRANS || CIFS=y && INFINIBAND_ADDR_TRANS=y
+       depends on CIFS=m && INFINIBAND && INFINIBAND_ADDR_TRANS || CIFS=y && INFINIBAND=y && INFINIBAND_ADDR_TRANS=y
        help
          Enables SMB Direct experimental support for SMB 3.0, 3.02 and 3.1.1.
          SMB Direct allows transferring SMB packets over RDMA. If unsure,
index b9e22b7..d1171db 100644 (file)
@@ -53,7 +53,7 @@ struct iio_buffer_access_funcs {
        int (*request_update)(struct iio_buffer *buffer);
 
        int (*set_bytes_per_datum)(struct iio_buffer *buffer, size_t bpd);
-       int (*set_length)(struct iio_buffer *buffer, int length);
+       int (*set_length)(struct iio_buffer *buffer, unsigned int length);
 
        int (*enable)(struct iio_buffer *buffer, struct iio_dev *indio_dev);
        int (*disable)(struct iio_buffer *buffer, struct iio_dev *indio_dev);
@@ -72,10 +72,10 @@ struct iio_buffer_access_funcs {
  */
 struct iio_buffer {
        /** @length: Number of datums in buffer. */
-       int length;
+       unsigned int length;
 
        /**  @bytes_per_datum: Size of individual datum including timestamp. */
-       int bytes_per_datum;
+       size_t bytes_per_datum;
 
        /**
         * @access: Buffer access functions associated with the
index a3a1815..b9f3dbd 100644 (file)
@@ -2431,7 +2431,7 @@ static void __split_huge_page(struct page *page, struct list_head *list,
                __split_huge_page_tail(head, i, lruvec, list);
                /* Some pages can be beyond i_size: drop them from page cache */
                if (head[i].index >= end) {
-                       __ClearPageDirty(head + i);
+                       ClearPageDirty(head + i);
                        __delete_from_page_cache(head + i, NULL);
                        if (IS_ENABLED(CONFIG_SHMEM) && PageSwapBacked(head))
                                shmem_uncharge(head->mapping->host, 1);
index 9b69732..9270a43 100644 (file)
@@ -1418,7 +1418,7 @@ int __isolate_lru_page(struct page *page, isolate_mode_t mode)
                                return ret;
 
                        mapping = page_mapping(page);
-                       migrate_dirty = mapping && mapping->a_ops->migratepage;
+                       migrate_dirty = !mapping || mapping->a_ops->migratepage;
                        unlock_page(page);
                        if (!migrate_dirty)
                                return ret;
index 46c39f7..e6014e0 100644 (file)
@@ -32,7 +32,7 @@ config NET_9P_XEN
 
 
 config NET_9P_RDMA
-       depends on INET && INFINIBAND_ADDR_TRANS
+       depends on INET && INFINIBAND && INFINIBAND_ADDR_TRANS
        tristate "9P RDMA Transport (Experimental)"
        help
          This builds support for an RDMA transport.
index 1a31502..bffde4b 100644 (file)
@@ -8,7 +8,7 @@ config RDS
 
 config RDS_RDMA
        tristate "RDS over Infiniband"
-       depends on RDS && INFINIBAND_ADDR_TRANS
+       depends on RDS && INFINIBAND && INFINIBAND_ADDR_TRANS
        ---help---
          Allow RDS to use Infiniband as a transport.
          This transport supports RDMA operations.
index 6358e52..ac09ca8 100644 (file)
@@ -50,7 +50,7 @@ config SUNRPC_DEBUG
 
 config SUNRPC_XPRT_RDMA
        tristate "RPC-over-RDMA transport"
-       depends on SUNRPC && INFINIBAND_ADDR_TRANS
+       depends on SUNRPC && INFINIBAND && INFINIBAND_ADDR_TRANS
        default SUNRPC && INFINIBAND
        select SG_POOL
        help