1. 15 Dec, 2015 2 commits
    • Lijun Pan's avatar
      fsl-ifc: add missing include on ARM64 · c4aa1937
      Lijun Pan authored
      Need to include sched.h to fix the following compilation error
      if FSL_IFC is enabled on ARM64 machine.
      
      In file included from include/linux/mmzone.h:9:0,
                       from include/linux/gfp.h:5,
                       from include/linux/kmod.h:22,
                       from include/linux/module.h:13,
                       from drivers/memory/fsl_ifc.c:22:
      drivers/memory/fsl_ifc.c: In function ‘check_nand_stat’:
      include/linux/wait.h:165:35: error: ‘TASK_NORMAL’ undeclared (first use in this function)
       #define wake_up(x)   __wake_up(x, TASK_NORMAL, 1, NULL)
                                         ^
      drivers/memory/fsl_ifc.c:136:3: note: in expansion of macro ‘wake_up’
         wake_up(&ctrl->nand_wait);
         ^
      include/linux/wait.h:165:35: note: each undeclared identifier is reported only once for each function it appears in
       #define wake_up(x)   __wake_up(x, TASK_NORMAL, 1, NULL)
                                         ^
      drivers/memory/fsl_ifc.c:136:3: note: in expansion of macro ‘wake_up’
         wake_up(&ctrl->nand_wait);
         ^
      
      Analysis is as follows:
      I put some instrumental code and get the
      following .h files inclusion sequence:
      
      In file included from ./arch/arm64/include/asm/compat.h:25:0,
                       from ./arch/arm64/include/asm/stat.h:23,
                       from include/linux/stat.h:5,
                       from include/linux/module.h:10,
                       from drivers/memory/fsl_ifc.c:23:
      include/linux/sched.h:113:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘struct’
       struct sched_attr {
       ^
      
      CONFIG_COMPAT=y is enabled while 39 and 48 bit VA is selected.
      When 42 bit VA is selected, it does not enable CONFIG_COMPAT=y
      
      In ./arch/arm64/include/asm/stat.h:23, it has
      "#ifdef CONFIG_COMPAT"
      "#include <asm/compat.h>"
      "..."
      "#endif"
      
      Since ./arch/arm64/include/asm/stat.h does not
      include ./arch/arm64/include/asm/compat.h,
      then it will not include include/linux/sched.h
      Hence we have to manually add "#include <linux/sched.h>"
      in drivers/memory/fsl_ifc.c
      Signed-off-by: default avatarLijun Pan <Lijun.Pan@freescale.com>
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      c4aa1937
    • Kevin Hilman's avatar
      Merge tag 'sunxi-fixes-for-4.4' of... · 8fcacc03
      Kevin Hilman authored
      Merge tag 'sunxi-fixes-for-4.4' of https://git.kernel.org/pub/scm/linux/kernel/git/mripard/linux into fixes
      
      Merge "Allwinner fixes for 4.4" from Maxime Ripard:
      
      Allwinner fixes for 4.4
      
      Two patches, one to fix the touchscreen axis on one Allwinner board, and
      the other one fixing a mutex unlocking issue on one error path in the RSB
      driver.
      
      * tag 'sunxi-fixes-for-4.4' of https://git.kernel.org/pub/scm/linux/kernel/git/mripard/linux:
        bus: sunxi-rsb: unlock on error in sunxi_rsb_read()
        ARM: dts: sunxi: sun6i-a31s-primo81.dts: add touchscreen axis swapping property
      8fcacc03
  2. 12 Dec, 2015 4 commits
  3. 11 Dec, 2015 1 commit
    • Stefan Agner's avatar
      ARM: dts: vf610: use reset values for L2 cache latencies · 9c171905
      Stefan Agner authored
      Linux on Vybrid used several different L2 latencies so far, none
      of them seem to be the right ones. According to the application note
      AN4947 ("Understanding Vybrid Architecture"), the tag portion runs
      on CPU clock and is inside the L2 cache controller, whereas the data
      portion is stored in the external SRAM running on platform clock.
      Hence it is likely that the correct value requires a higher data
      latency then tag latency.
      
      These are the values which have been used so far:
      - The mainline values:
        arm,data-latency = <1 1 1>;
        arm,tag-latency = <2 2 2>;
        Those values have lead to problems on higher clocks. They look
        like a poor translation from the reset values (missing +1 offset
        and a mix up between tag/latency values).
      - The Linux 3.0 (SoC vendor BSP) values (converted to DT notation):
        arm,data-latency = <4 2 3>
        arm,tag-latency = <4 2 3>
        The cache initialization function along with the value matches the
        i.MX6 code from the same kernel, so it seems that those values have
        just been copied.
      - The Colibri values:
        arm,data-latency = <2 1 2>;
        arm,tag-latency = <3 2 3>;
        Those were a mix between the values of the Linux 3.0 based BSP and
        the mainline values above.
      - The SoC Reset values (converted to DT notation):
        arm,data-latency = <3 3 3>;
        arm,tag-latency = <2 2 2>;
      
      So far there is no official statement on what the correct values are.
      See also the related Freescale community thread:
      https://community.freescale.com/message/579785#579785
      
      For now, the reset values seem to be the best bet. Remove all other
      "bogus" values and use the reset value on vf610.dtsi level.
      Signed-off-by: default avatarStefan Agner <stefan@agner.ch>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarShawn Guo <shawnguo@kernel.org>
      9c171905
  4. 10 Dec, 2015 8 commits
  5. 04 Dec, 2015 2 commits
  6. 02 Dec, 2015 2 commits
    • Stefan Agner's avatar
      ARM: dts: vf610: fix clock definition for SAI2 · 531ee1f4
      Stefan Agner authored
      So far, only the bus clock has been assigned, but in reality the
      SAI IP has for clock inputs. The driver has been updated to
      make use of the additional clock inputs by c3ecef21 ("ASoC:
      fsl_sai: add sai master mode support"). Due to a bug in the
      clock tree, the audio clock has been enabled none the less by
      the specified bus clock (see "ARM: imx: clk-vf610: fix SAI
      clock tree"), which made master mode even without the proper
      clock assigned working.
      
      This patch completes the clock definition for SAI2. On Vybrid,
      only two MCLK out of the four options are available (the first
      being the bus clock itself). See chapter 8.10.1.2.3 of the
      Vybrid Reference manual ("SAI transmitter and receiver options
      for MCLK selection"). Note: The audio clocks are only required
      in master mode.
      Signed-off-by: default avatarStefan Agner <stefan@agner.ch>
      Signed-off-by: default avatarShawn Guo <shawnguo@kernel.org>
      531ee1f4
    • Stefan Agner's avatar
      ARM: imx: clk-vf610: fix SAI clock tree · 3b60a26f
      Stefan Agner authored
      The Synchronous Audio Interface (SAI) instances are clocked by
      independent clocks: The bus clock and the audio clock (as shown in
      Figure 51-1 in the Vybrid Reference Manual). The clock gates in
      CCGR0/CCGR1 for SAI0 through SAI3 are bus clock gates, as access
      tests to the registers with/without gating those clocks have shown.
      The audio clock is gated by the SAIx_EN gates in CCM_CSCDR1,
      followed by a clock divider (SAIx_DIV). Currently, the parent of
      the bus clock gates has been assigned to SAIx_DIV, which is not
      involved in the bus clock path for the SAI instances (see chapter
      9.10.12, SAI clocking in the Vybrid Reference Manual).
      
      Fix this by define the parent clock of VF610_CLK_SAIx to be the bus
      clock.
      
      If the driver needs the audio clock (when used in master mode), a
      fixed device tree is required which assign the audio clock properly
      to VF610_CLK_SAIx_DIV.
      Signed-off-by: default avatarStefan Agner <stefan@agner.ch>
      Acked-by: default avatarStephen Boyd <sboyd@codeaurora.org>
      Signed-off-by: default avatarShawn Guo <shawnguo@kernel.org>
      3b60a26f
  7. 01 Dec, 2015 2 commits
    • Arnd Bergmann's avatar
      ARM: ixp4xx: fix read{b,w,l} return types · d66e5139
      Arnd Bergmann authored
      On ixp4xx, the readl() function returns an 'unsigned long' output
      when indirect I/O is used. This is unlike any other platform, and
      it causes lots of harmless compiler warnings, such as:
      
      drivers/ata/libahci.c: In function 'ahci_show_host_version':
      drivers/ata/libahci.c:254:22: warning: format '%x' expects argument of type 'unsigned int', but argument 3 has type 'long unsigned int' [-Wformat=]
      drivers/block/mtip32xx/mtip32xx.c: In function 'mtip_hw_read_registers':
      drivers/block/mtip32xx/mtip32xx.c:2602:31: warning: format '%X' expects argument of type 'unsigned int', but argument 3 has type 'long unsigned int' [-Wformat=]
      drivers/block/cciss.c: In function 'print_cfg_table':
      drivers/block/cciss.c:3845:25: warning: format '%d' expects argument of type 'int', but argument 4 has type 'long unsigned int' [-Wformat=]
      
      This changes all six of the ixp4xx specific I/O read functions
      to return the same types that we have in the normal asm/io.h,
      to avoid the warnings.
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Acked-by: default avatarKrzysztof Halasa <khalasa@piap.pl>
      d66e5139
    • Guillaume Delbergue's avatar
      irqchip/versatile-fpga: Fix PCI IRQ mapping on Versatile PB · d5d4fdd8
      Guillaume Delbergue authored
      This patch is specifically for PCI support on the Versatile PB board using
      a DT. Currently, the dynamic IRQ mapping is broken when using DTs. For
      example, on QEMU, the SCSI driver is unable to request the IRQ. To fix
      this issue, this patch replaces the current dynamic mechanism with a
      static value as is done in the non-DT case.
      Signed-off-by: default avatarGuillaume Delbergue <guillaume.delbergue@greensocs.com>
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Cc: stable@vger.kernel.org
      d5d4fdd8
  8. 30 Nov, 2015 9 commits
  9. 29 Nov, 2015 10 commits
    • Linus Torvalds's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending · 36511e86
      Linus Torvalds authored
      Pull SCSI target fixes from Nicholas Bellinger:
       - fix tcm-user backend driver expired cmd time processing (agrover)
       - eliminate kref_put_spinlock_irqsave() for I/O completion (bart)
       - fix iscsi login kthread failure case hung task regression (nab)
       - fix COMPARE_AND_WRITE completion use-after-free race (nab)
       - fix COMPARE_AND_WRITE with SCF_PASSTHROUGH_SG_TO_MEM_NOALLOC non zero
         SGL offset data corruption.  (Jan + Doug)
       - fix >= v4.4-rc1 regression for tcm_qla2xxx enable configfs attribute
         (Himanshu + HCH)
      
      * git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending:
        target/stat: print full t10_wwn.model buffer
        target: fix COMPARE_AND_WRITE non zero SGL offset data corruption
        qla2xxx: Fix regression introduced by target configFS changes
        kref: Remove kref_put_spinlock_irqsave()
        target: Invoke release_cmd() callback without holding a spinlock
        target: Fix race for SCF_COMPARE_AND_WRITE_POST checking
        iscsi-target: Fix rx_login_comp hang after login failure
        iscsi-target: return -ENOMEM instead of -1 in case of failed kmalloc()
        target/user: Do not set unused fields in tcmu_ops
        target/user: Fix time calc in expired cmd processing
      36511e86
    • Linus Torvalds's avatar
      Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux · 75a29ec1
      Linus Torvalds authored
      Pull thermal management fixes from Zhang Rui:
       "Specifics:
      
       - several fixes and cleanups on Rockchip thermal drivers.
      
       - add the missing support of RK3368 SoCs in Rockchip driver.
      
       - small fixes on of-thermal, power_allocator, rcar driver, IMX, and
         QCOM drivers, and also compilation fixes, on thermal.h, when thermal
         is not selected"
      
      * 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux:
        imx: thermal: use CPU temperature grade info for thresholds
        thermal: fix thermal_zone_bind_cooling_device prototype
        Revert "thermal: qcom_spmi: allow compile test"
        thermal: rcar_thermal: remove redundant operation
        thermal: of-thermal: Reduce log level for message when can't fine thermal zone
        thermal: power_allocator: Use temperature reading from tz
        thermal: rockchip: Support the RK3368 SoCs in thermal driver
        thermal: rockchip: consistently use int for temperatures
        thermal: rockchip: Add the sort mode for adc value increment or decrement
        thermal: rockchip: improve the conversion function
        thermal: rockchip: trivial: fix typo in commit
        thermal: rockchip: better to compatible the driver for different SoCs
        dt-bindings: rockchip-thermal: Support the RK3368 SoCs compatible
      75a29ec1
    • David Disseldorp's avatar
      target/stat: print full t10_wwn.model buffer · 8f903539
      David Disseldorp authored
      Cut 'n paste error saw it only process sizeof(t10_wwn.vendor) characters.
      Signed-off-by: default avatarDavid Disseldorp <ddiss@suse.de>
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      8f903539
    • Jan Engelhardt's avatar
      target: fix COMPARE_AND_WRITE non zero SGL offset data corruption · d94e5a61
      Jan Engelhardt authored
      target_core_sbc's compare_and_write functionality suffers from taking
      data at the wrong memory location when writing a CAW request to disk
      when a SGL offset is non-zero.
      
      This can happen with loopback and vhost-scsi fabric drivers when
      SCF_PASSTHROUGH_SG_TO_MEM_NOALLOC is used to map existing user-space
      SGL memory into COMPARE_AND_WRITE READ/WRITE payload buffers.
      
      Given the following sample LIO subtopology,
      
      % targetcli ls /loopback/
      o- loopback ................................. [1 Target]
        o- naa.6001405ebb8df14a ....... [naa.60014059143ed2b3]
          o- luns ................................... [2 LUNs]
            o- lun0 ................ [iblock/ram0 (/dev/ram0)]
            o- lun1 ................ [iblock/ram1 (/dev/ram1)]
      % lsscsi -g
      [3:0:1:0]    disk    LIO-ORG  IBLOCK           4.0   /dev/sdc   /dev/sg3
      [3:0:1:1]    disk    LIO-ORG  IBLOCK           4.0   /dev/sdd   /dev/sg4
      
      the following bug can be observed in Linux 4.3 and 4.4~rc1:
      
      % perl -e 'print chr$_ for 0..255,reverse 0..255' >rand
      % perl -e 'print "\0" x 512' >zero
      % cat rand >/dev/sdd
      % sg_compare_and_write -i rand -D zero --lba 0 /dev/sdd
      % sg_compare_and_write -i zero -D rand --lba 0 /dev/sdd
      Miscompare reported
      % hexdump -Cn 512 /dev/sdd
      00000000  0f 0e 0d 0c 0b 0a 09 08  07 06 05 04 03 02 01 00
      00000010  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
      *
      00000200
      
      Rather than writing all-zeroes as instructed with the -D file, it
      corrupts the data in the sector by splicing some of the original
      bytes in. The page of the first entry of cmd->t_data_sg includes the
      CDB, and sg->offset is set to a position past the CDB. I presume that
      sg->offset is also the right choice to use for subsequent sglist
      members.
      Signed-off-by: default avatarJan Engelhardt <jengelh@netitwork.de>
      Tested-by: default avatarDouglas Gilbert <dgilbert@interlog.com>
      Cc: <stable@vger.kernel.org> # v3.12+
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      d94e5a61
    • Himanshu Madhani's avatar
      qla2xxx: Fix regression introduced by target configFS changes · 3786dc45
      Himanshu Madhani authored
      this patch fixes following regression
      
       # targetcli
       [Errno 13] Permission denied: '/sys/kernel/config/target/qla2xxx/21:00:00:0e:1e:08:c7:20/tpgt_1/enable'
      
      Fixes: 2eafd729 ("target: use per-attribute show and store methods")
      Signed-off-by: default avatarHimanshu Madhani <himanshu.madhani@qlogic.com>
      Signed-off-by: default avatarGiridhar Malavali <giridhar.malavali@qlogic.com>
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      3786dc45
    • Bart Van Assche's avatar
      kref: Remove kref_put_spinlock_irqsave() · 3a66d7dc
      Bart Van Assche authored
      The last user is gone. Hence remove this function.
      Signed-off-by: default avatarBart Van Assche <bart.vanassche@sandisk.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Joern Engel <joern@logfs.org>
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      3a66d7dc
    • Bart Van Assche's avatar
      target: Invoke release_cmd() callback without holding a spinlock · 9ff9d15e
      Bart Van Assche authored
      This patch fixes the following kernel warning because it avoids that
      IRQs are disabled while ft_release_cmd() is invoked (fc_seq_set_resp()
      invokes spin_unlock_bh()):
      
      WARNING: CPU: 3 PID: 117 at kernel/softirq.c:150 __local_bh_enable_ip+0xaa/0x110()
      Call Trace:
       [<ffffffff814f71eb>] dump_stack+0x4f/0x7b
       [<ffffffff8105e56a>] warn_slowpath_common+0x8a/0xc0
       [<ffffffff8105e65a>] warn_slowpath_null+0x1a/0x20
       [<ffffffff81062b2a>] __local_bh_enable_ip+0xaa/0x110
       [<ffffffff814ff229>] _raw_spin_unlock_bh+0x39/0x40
       [<ffffffffa03a7f94>] fc_seq_set_resp+0xe4/0x100 [libfc]
       [<ffffffffa02e604a>] ft_free_cmd+0x4a/0x90 [tcm_fc]
       [<ffffffffa02e6972>] ft_release_cmd+0x12/0x20 [tcm_fc]
       [<ffffffffa042bd66>] target_release_cmd_kref+0x56/0x90 [target_core_mod]
       [<ffffffffa042caf0>] target_put_sess_cmd+0xc0/0x110 [target_core_mod]
       [<ffffffffa042cb81>] transport_release_cmd+0x41/0x70 [target_core_mod]
       [<ffffffffa042d975>] transport_generic_free_cmd+0x35/0x420 [target_core_mod]
      Signed-off-by: default avatarBart Van Assche <bart.vanassche@sandisk.com>
      Acked-by: default avatarJoern Engel <joern@logfs.org>
      Reviewed-by: default avatarAndy Grover <agrover@redhat.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Hannes Reinecke <hare@suse.de>
      Cc: Sagi Grimberg <sagig@mellanox.com>
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      9ff9d15e
    • Nicholas Bellinger's avatar
      target: Fix race for SCF_COMPARE_AND_WRITE_POST checking · 057085e5
      Nicholas Bellinger authored
      This patch addresses a race + use after free where the first
      stage of COMPARE_AND_WRITE in compare_and_write_callback()
      is rescheduled after the backend sends the secondary WRITE,
      resulting in second stage compare_and_write_post() callback
      completing in target_complete_ok_work() before the first
      can return.
      
      Because current code depends on checking se_cmd->se_cmd_flags
      after return from se_cmd->transport_complete_callback(),
      this results in first stage having SCF_COMPARE_AND_WRITE_POST
      set, which incorrectly falls through into second stage CAW
      processing code, eventually triggering a NULL pointer
      dereference due to use after free.
      
      To address this bug, pass in a new *post_ret parameter into
      se_cmd->transport_complete_callback(), and depend upon this
      value instead of ->se_cmd_flags to determine when to return
      or fall through into ->queue_status() code for CAW.
      
      Cc: Sagi Grimberg <sagig@mellanox.com>
      Cc: <stable@vger.kernel.org> # v3.12+
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      057085e5
    • Nicholas Bellinger's avatar
      iscsi-target: Fix rx_login_comp hang after login failure · ca82c2bd
      Nicholas Bellinger authored
      This patch addresses a case where iscsi_target_do_tx_login_io()
      fails sending the last login response PDU, after the RX/TX
      threads have already been started.
      
      The case centers around iscsi_target_rx_thread() not invoking
      allow_signal(SIGINT) before the send_sig(SIGINT, ...) occurs
      from the failure path, resulting in RX thread hanging
      indefinately on iscsi_conn->rx_login_comp.
      
      Note this bug is a regression introduced by:
      
        commit e5419865
        Author: Nicholas Bellinger <nab@linux-iscsi.org>
        Date:   Wed Jul 22 23:14:19 2015 -0700
      
            iscsi-target: Fix iscsit_start_kthreads failure OOPs
      
      To address this bug, complete ->rx_login_complete for good
      measure in the failure path, and immediately return from
      RX thread context if connection state did not actually reach
      full feature phase (TARG_CONN_STATE_LOGGED_IN).
      
      Cc: Sagi Grimberg <sagig@mellanox.com>
      Cc: <stable@vger.kernel.org> # v3.10+
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      ca82c2bd
    • Luis de Bethencourt's avatar
      iscsi-target: return -ENOMEM instead of -1 in case of failed kmalloc() · 82a819e8
      Luis de Bethencourt authored
      Smatch complains about returning hard coded error codes, silence this
      warning.
      
      drivers/target/iscsi/iscsi_target_parameters.c:211
         iscsi_create_default_params() warn: returning -1 instead of -ENOMEM is sloppy
      Signed-off-by: default avatarLuis de Bethencourt <luisbg@osg.samsung.com>
      Reviewed-by: default avatarSagi Grimberg <sagig@mellanox.com>
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      82a819e8