4.0.3-stable review
Subsystems (2)
Greg Kroah-Hartman
maintainercover 4.0.3-stable review
This is the start of the stable review cycle for the 4.0.3 release. There are 72 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed May 13 17:54:19 UTC 2015. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.0.3-rc1.gz
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 4.0.3-rc1
K. Y. Srinivasan <[email protected]>
Drivers: hv: vmbus: Don't wait after requesting offers
Thomas Hebb <[email protected]>
hfsplus: don't store special "osx" xattr prefix on-disk
Christian König <[email protected]>
drm/radeon: check new address before removing old one
Christian König <[email protected]>
drm/radeon: reset BOs address after clearing it.
Christian König <[email protected]>
drm/radeon: fix lockup when BOs aren't part of the VM on release
Alex Deucher <[email protected]>
drm/radeon: add SI DPM quirk for Sapphire R9 270 Dual-X 2G GDDR5
Alex Deucher <[email protected]>
drm/radeon: adjust pll when audio is not enabled
Michel Dänzer <[email protected]>
drm/radeon: Use drm_calloc_ab for CS relocs
Alex Deucher <[email protected]>
drm/radeon: only enable audio streams if the monitor supports it
Alex Deucher <[email protected]>
drm/radeon: only mark audio as connected if the monitor supports it (v3)
Alex Deucher <[email protected]>
drm/radeon/audio: don't enable packets until the end
Alex Deucher <[email protected]>
drm/radeon: drop dce6_dp_enable
Alex Deucher <[email protected]>
drm/radeon: fix ordering of AVI packet setup
Christoph Hellwig <[email protected]>
3w-sas: fix command completion race
Christoph Hellwig <[email protected]>
3w-9xxx: fix command completion race
Christoph Hellwig <[email protected]>
3w-xxxx: fix command completion race
Mike Christie <[email protected]>
SCSI: add 1024 max sectors black list flag
Davide Italiano <[email protected]>
ext4: move check under lock scope to close a race.
Lukas Czerner <[email protected]>
ext4: fix data corruption caused by unwritten and delayed extents
Hans de Goede <[email protected]>
uas: Set max_sectors_240 quirk for ASM1053 devices
Hans de Goede <[email protected]>
uas: Add US_FL_MAX_SECTORS_240 flag
Hans de Goede <[email protected]>
uas: Allow uas_use_uas_driver to return usb-storage flags
Ilya Dryomov <[email protected]>
rbd: end I/O the entire obj_request on error
Ludovic Desroches <[email protected]>
tty/serial: at91: maxburst was missing for dma transfers
Chris Bainbridge <[email protected]>
ACPI / SBS: Enable battery manager when present
Omar Sandoval <[email protected]>
btrfs: unlock i_mutex after attempting to delete subvolume during send
Bard Liao <[email protected]>
ASoC: rt5677: fixed wrong DMIC ref clock
Charles Keepax <[email protected]>
ASoC: dapm: Enable autodisable on SOC_DAPM_SINGLE_TLV_AUTODISABLE
Bard Liao <[email protected]>
ASoC: rt5677: add register patch for PLL
Wei Yongjun <[email protected]>
ASoC: tfa9879: Fix return value check in tfa9879_i2c_probe()
Wei Yongjun <[email protected]>
ASoC: samsung: s3c24xx-i2s: Fix return value check in s3c24xx_iis_dev_probe()
Li Jun <[email protected]>
usb: chipidea: otg: remove mutex unlock and lock while stop and start role
Dean Nelson <[email protected]>
arm64: add missing PAGE_ALIGN() to __dma_free()
Marek Szyprowski <[email protected]>
arm64: dma-mapping: always clear allocated buffers
Michal Simek <[email protected]>
serial: xilinx: Use platform_get_irq to get irq description structure
Michal Simek <[email protected]>
serial: of-serial: Remove device_type = "serial" registration
Quentin Casasnovas <[email protected]>
cdc-acm: prevent infinite loop when parsing CDC headers.
Takashi Iwai <[email protected]>
ALSA: hda - Add mute-LED mode control to Thinkpad
Takashi Iwai <[email protected]>
ALSA: hda - Fix mute-LED fixed mode
Peter Zubaj <[email protected]>
ALSA: emu10k1: Emu10k2 32 bit DMA mode
Takashi Iwai <[email protected]>
ALSA: emu10k1: Fix card shortname string buffer overflow
Takashi Iwai <[email protected]>
ALSA: emux: Fix mutex deadlock in OSS emulation
Takashi Iwai <[email protected]>
ALSA: emux: Fix mutex deadlock at unloading
Markos Chandras <[email protected]>
MIPS: Makefile: Fix MIPS ASE detection code
Markos Chandras <[email protected]>
MIPS: asm: elf: Set O32 default FPU flags
Rafał Miłecki <[email protected]>
MIPS: BCM47XX: Fix detecting Microsoft MN-700 & Asus WL500G
Markos Chandras <[email protected]>
MIPS: Kconfig: Disable SMP/CPS for 64-bit
Niklas Cassel <[email protected]>
MIPS: smp-cps: cpu_set FPU mask if FPU present
John Crispin <[email protected]>
MIPS: ralink: add missing symbol for RALINK_ILL_ACC
John Crispin <[email protected]>
MIPS: ralink: Fix bad config symbol in PCI makefile.
Adrien Schildknecht <[email protected]>
SSB: fix Kconfig dependencies
Ralf Baechle <[email protected]>
Revert "MIPS: Avoid pipeline stalls on some MIPS32R2 cores."
Ralf Baechle <[email protected]>
MIPS: Octeon: Delete override of cpu_has_mips_r2_exec_hazard.
Ralf Baechle <[email protected]>
MIPS: Fix cpu_has_mips_r2_exec_hazard.
Markos Chandras <[email protected]>
MIPS: kernel: entry.S: Set correct ISA level for mips_ihb
Markos Chandras <[email protected]>
MIPS: asm: spinlock: Fix addiu instruction for R10000_LLSC_WAR case
Markos Chandras <[email protected]>
MIPS: r4kcache: Use correct base register for MIPS R6 cache flushes
Markos Chandras <[email protected]>
MIPS: Kconfig: Fix typo for the r2-to-r6 emulator kernel parameter
Ganesan Ramalingam <[email protected]>
MIPS: Netlogic: Fix for SATA PHY init
Aaro Koskinen <[email protected]>
MIPS: OCTEON: fix PCI interrupt mapping for D-Link DSR-1000N
Alexander Sverdlin <[email protected]>
MIPS: Octeon: Remove udelay() causing huge IRQ latency
Lars Persson <[email protected]>
MIPS: Fix race condition in lazy cache flushing.
Lars Persson <[email protected]>
Revert "MIPS: Remove race window in page fault handling"
Chandrakala Chavva <[email protected]>
MIPS: OCTEON: Use correct CSR to soft reset
Aaro Koskinen <[email protected]>
MIPS: OCTEON: dma-octeon: fix OHCI USB config check
Nicolas Schichan <[email protected]>
MIPS: BCM63xx: Move bcm63xx_gpio_init() to bcm63xx_register_devices().
David S. Miller <[email protected]>
ipv4: Missing sk_nulls_node_init() in ping_unhash().
Ido Shamay <[email protected]>
net/mlx4_en: Schedule napi when RX buffers allocation fails
Hariprasad Shenai <[email protected]>
cxgb4: Fix MC1 memory offset calculation
Benjamin Poirier <[email protected]>
mlx4: Fix tx ring affinity_mask creation
Herbert Xu <[email protected]>
route: Use ipv4_mtu instead of raw rt_pmtu
Alexei Starovoitov <[email protected]>
bpf: fix 64-bit divide
-------------
Diffstat:
Documentation/kernel-parameters.txt | 2 + Makefile | 4 +- arch/arm64/mm/dma-mapping.c | 9 +-- arch/mips/Kconfig | 4 +- arch/mips/Makefile | 14 +++- arch/mips/bcm47xx/board.c | 4 +- arch/mips/bcm63xx/prom.c | 4 - arch/mips/bcm63xx/setup.c | 4 + arch/mips/cavium-octeon/dma-octeon.c | 2 +- arch/mips/cavium-octeon/setup.c | 5 +- arch/mips/include/asm/cacheflush.h | 38 +++++---- arch/mips/include/asm/cpu-features.h | 33 +++++++- arch/mips/include/asm/elf.h | 5 ++ .../asm/mach-cavium-octeon/cpu-feature-overrides.h | 1 - arch/mips/include/asm/octeon/cvmx.h | 8 -- arch/mips/include/asm/octeon/pci-octeon.h | 3 - arch/mips/include/asm/pgtable.h | 9 ++- arch/mips/include/asm/r4kcache.h | 89 +++++++++++----------- arch/mips/include/asm/spinlock.h | 2 +- arch/mips/kernel/entry.S | 3 +- arch/mips/kernel/smp-cps.c | 6 ++ arch/mips/mm/cache.c | 39 +++++----- arch/mips/mm/tlbex.c | 21 +---- arch/mips/netlogic/xlp/ahci-init-xlp2.c | 13 ++++ arch/mips/pci/Makefile | 2 +- arch/mips/pci/pci-octeon.c | 8 +- arch/mips/pci/pcie-octeon.c | 8 -- arch/mips/ralink/Kconfig | 5 ++ drivers/acpi/sbs.c | 2 +- drivers/block/rbd.c | 5 ++ drivers/gpu/drm/radeon/atombios_crtc.c | 3 + drivers/gpu/drm/radeon/atombios_encoders.c | 6 +- drivers/gpu/drm/radeon/dce6_afmt.c | 25 ------ drivers/gpu/drm/radeon/evergreen_hdmi.c | 53 ++++++++----- drivers/gpu/drm/radeon/r600_hdmi.c | 9 ++- drivers/gpu/drm/radeon/radeon_audio.c | 30 ++++---- drivers/gpu/drm/radeon/radeon_connectors.c | 8 +- drivers/gpu/drm/radeon/radeon_cs.c | 4 +- drivers/gpu/drm/radeon/radeon_vm.c | 36 +++++---- drivers/gpu/drm/radeon/si_dpm.c | 1 + drivers/hv/channel_mgmt.c | 12 +-- drivers/net/ethernet/chelsio/cxgb4/t4_hw.c | 2 +- drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 1 + drivers/net/ethernet/mellanox/mlx4/en_rx.c | 26 ++++++- drivers/net/ethernet/mellanox/mlx4/en_tx.c | 8 +- drivers/net/ethernet/mellanox/mlx4/mlx4_en.h | 1 + drivers/scsi/3w-9xxx.c | 57 ++++---------- drivers/scsi/3w-9xxx.h | 5 -- drivers/scsi/3w-sas.c | 50 +++--------- drivers/scsi/3w-sas.h | 4 - drivers/scsi/3w-xxxx.c | 42 ++-------- drivers/scsi/3w-xxxx.h | 5 -- drivers/scsi/scsi_devinfo.c | 1 + drivers/scsi/scsi_scan.c | 6 ++ drivers/ssb/Kconfig | 1 + drivers/tty/serial/atmel_serial.c | 2 + drivers/tty/serial/of_serial.c | 1 - drivers/tty/serial/uartlite.c | 11 +-- drivers/tty/serial/xilinx_uartps.c | 12 +-- drivers/usb/chipidea/otg_fsm.c | 4 - drivers/usb/class/cdc-acm.c | 7 +- drivers/usb/storage/uas-detect.h | 11 ++- drivers/usb/storage/uas.c | 16 +++- drivers/usb/storage/usb.c | 8 +- fs/btrfs/ioctl.c | 3 +- fs/ext4/extents.c | 15 ++-- fs/ext4/extents_status.c | 8 ++ fs/ext4/inode.c | 2 + fs/hfsplus/xattr.c | 38 ++++----- include/linux/usb_usual.h | 2 + include/scsi/scsi_devinfo.h | 1 + include/sound/emu10k1.h | 14 ++-- include/sound/soc-dapm.h | 2 +- kernel/bpf/core.c | 12 +-- net/ipv4/ping.c | 1 + net/ipv4/route.c | 5 +- sound/pci/emu10k1/emu10k1.c | 6 +- sound/pci/emu10k1/emu10k1_callback.c | 4 +- sound/pci/emu10k1/emu10k1_main.c | 21 +++-- sound/pci/emu10k1/emupcm.c | 2 +- sound/pci/emu10k1/memory.c | 11 +-- sound/pci/hda/hda_codec.c | 21 ++--- sound/pci/hda/thinkpad_helper.c | 1 + sound/soc/codecs/rt5677.c | 5 +- sound/soc/codecs/tfa9879.c | 4 +- sound/soc/samsung/s3c24xx-i2s.c | 4 +- sound/synth/emux/emux_oss.c | 11 +-- sound/synth/emux/emux_seq.c | 29 +++++-- 88 files changed, 531 insertions(+), 511 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/72 bpf: fix 64-bit divide
4.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexei Starovoitov <[email protected]>
[ Upstream commit 876a7ae65b86d8cec8efe7d15d050ac61116874e ]
ALU64_DIV instruction should be dividing 64-bit by 64-bit, whereas do_div() does 64-bit by 32-bit divide.
x64 and arm64 JITs correctly implement 64 by 64 unsigned divide. llvm BPF backend emits code assuming that ALU64_DIV does 64 by 64.
--- kernel/bpf/core.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
kernel/bpf/core.c +6 -6
@@ -357,8 +357,8 @@ select_insn: ALU64_MOD_X:if (unlikely (SRC ==0 ))return 0 ; - tmp =DST ; -DST =do_div (tmp,SRC ); +div64_u64_rem (DST ,SRC , &tmp); +DST = tmp;CONT ; ALU_MOD_X:if (unlikely (SRC ==0 ))
@@ -367,8 +367,8 @@ select_insn:DST =do_div (tmp, (u32 )SRC );CONT ; ALU64_MOD_K: - tmp =DST ; -DST =do_div (tmp,IMM ); +div64_u64_rem (DST ,IMM , &tmp); +DST = tmp;CONT ; ALU_MOD_K: tmp = (u32 )DST ;
@@ -377,7 +377,7 @@ select_insn: ALU64_DIV_X:if (unlikely (SRC ==0 ))return 0 ; -do_div (DST ,SRC ); +DST =div64_u64 (DST ,SRC );CONT ; ALU_DIV_X:if (unlikely (SRC ==0 ))
@@ -387,7 +387,7 @@ select_insn:DST = (u32 ) tmp;CONT ; ALU64_DIV_K: -do_div (DST ,IMM ); +DST =div64_u64 (DST ,IMM );CONT ; ALU_DIV_K: tmp = (u32 )DST ;
Greg Kroah-Hartman
maintainerPATCH 2/72 route: Use ipv4_mtu instead of raw rt_pmtu
In reply to Greg Kroah-Hartman4.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Herbert Xu <[email protected]>
[ Upstream commit cb6ccf09d6b94bec4def1ac5cf4678d12b216474 ]
The commit 3cdaa5be9e81a914e633a6be7b7d2ef75b528562 ("ipv4: Don't increase PMTU with Datagram Too Big message") broke PMTU in cases where the rt_pmtu value has expired but is smaller than the new PMTU value.
This obsolete rt_pmtu then prevents the new PMTU value from being installed.
--- net/ipv4/route.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
net/ipv4/route.c +1 -4
@@ -963,10 +963,7 @@ static void __ip_rt_update_pmtu(struct rif (dst_metric_locked (dst,RTAX_MTU ))return ; -if (dst->dev->mtu < mtu) -return ; - -if (rt->rt_pmtu && rt->rt_pmtu < mtu) +if (ipv4_mtu (dst) < mtu)return ;if (mtu < ip_rt_min_pmtu)
Greg Kroah-Hartman
maintainerPATCH 3/72 mlx4: Fix tx ring affinity_mask creation
In reply to Greg Kroah-Hartman4.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Benjamin Poirier <[email protected]>
[ Upstream commit 42eab005a5dd5d7ea2b0328aecc4d6cc0c23c9c2 ]
By default, the number of tx queues is limited by the number of online cpus in mlx4_en_get_profile(). However, this limit no longer holds after the ethtool .set_channels method has been called. In that situation, the driver may access invalid bits of certain cpumask variables when queue_index >= nr_cpu_ids.
--- drivers/net/ethernet/mellanox/mlx4/en_tx.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/net/ethernet/mellanox/mlx4/en_tx.c +5 -3
@@ -143,8 +143,10 @@ int mlx4_en_create_tx_ring(struct mlx4_e ring->hwtstamp_tx_type = priv->hwtstamp_config.tx_type; ring->queue_index = queue_index; -if (queue_index < priv->num_tx_rings_p_up &&cpu_online (queue_index)) -cpumask_set_cpu (queue_index, &ring->affinity_mask); +if (queue_index < priv->num_tx_rings_p_up) +cpumask_set_cpu_local_first (queue_index, + priv->mdev->dev->numa_node, + &ring->affinity_mask); *pring = ring;return 0 ;
@@ -213,7 +215,7 @@ int mlx4_en_activate_tx_ring(struct mlx4 err =mlx4_qp_to_ready (mdev->dev, &ring->wqres.mtt, &ring->context, &ring->qp, &ring->qp_state); -if (!user_prio &&cpu_online (ring->queue_index)) +if (!cpumask_empty (&ring->affinity_mask))netif_set_xps_queue (priv->dev, &ring->affinity_mask, ring->queue_index);
Greg Kroah-Hartman
maintainerPATCH 4/72 cxgb4: Fix MC1 memory offset calculation
In reply to Greg Kroah-Hartman4.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hariprasad Shenai <[email protected]>
[ Upstream commit 7f0b8a56c978b0a3315ac84c6cbb065413afb8e9 ]
Commit 6559a7e8296002b4 ("cxgb4: Cleanup macros so they follow the same style and look consistent") introduced a regression where reading MC1 memory in adapters where MC0 isn't present or MC0 size is not equal to MC1 size caused the adapter to crash due to incorrect computation of memoffset. Fix is to read the size of MC0 instead of MC1 for offset calculation
--- drivers/net/ethernet/chelsio/cxgb4/t4_hw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/chelsio/cxgb4/t4_hw.c +1 -1
@@ -492,7 +492,7 @@ int t4_memory_rw(struct adapter *adap, i memoffset = (mtype * (edc_size *1024 *1024 )); else { mc_size =EXT_MEM0_SIZE_G (t4_read_reg (adap, -MA_EXT_MEMORY1_BAR_A )); +MA_EXT_MEMORY0_BAR_A )); memoffset = (MEM_MC0 * edc_size + mc_size) *1024 *1024 ; }
Greg Kroah-Hartman
maintainerPATCH 5/72 net/mlx4_en: Schedule napi when RX buffers allocation fails
In reply to Greg Kroah-Hartman4.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ido Shamay <[email protected]>
[ Upstream commit 07841f9d94c11afe00c0498cf242edf4075729f4 ]
When system is out of memory, refilling of RX buffers fails while the driver continue to pass the received packets to the kernel stack. At some point, when all RX buffers deplete, driver may fall into a sleep, and not recover when memory for new RX buffers is once again availible. This is because hardware does not have valid descriptors, so no interrupt will be generated for the driver to return to work in napi context. Fix it by schedule the napi poll function from stats_task delayed workqueue, as long as the allocations fail.
--- drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 1 drivers/net/ethernet/mellanox/mlx4/en_rx.c | 26 +++++++++++++++++++++++-- drivers/net/ethernet/mellanox/mlx4/mlx4_en.h | 1 3 files changed, 26 insertions(+), 2 deletions(-)
drivers/net/ethernet/mellanox/mlx4/en_netdev.c +1 -0
@@ -1467,6 +1467,7 @@ static void mlx4_en_service_task(structif (mdev->dev->caps.flags2 &MLX4_DEV_CAP_FLAG2_TS )mlx4_en_ptp_overflow_check (mdev); +mlx4_en_recover_from_oom (priv);queue_delayed_work (mdev->workqueue, &priv->service_task,SERVICE_TASK_DELAY ); }
drivers/net/ethernet/mellanox/mlx4/en_rx.c +24 -2
@@ -244,6 +244,12 @@ static int mlx4_en_prepare_rx_desc(strucreturn mlx4_en_alloc_frags (priv, rx_desc, frags, ring->page_alloc, gfp); } +static inline bool mlx4_en_is_ring_empty (struct mlx4_en_rx_ring *ring) +{ +BUG_ON ((u32)(ring->prod - ring->cons) > ring->actual_size); +return ring->prod == ring->cons; +} +static inline void mlx4_en_update_rx_prod_db (struct mlx4_en_rx_ring *ring) { *ring->wqres.db.db =cpu_to_be32 (ring->prod &0xffff );
@@ -315,8 +321,7 @@ static void mlx4_en_free_rx_buf(struct m ring->cons, ring->prod);/* Unmap and free Rx buffers */ -BUG_ON ((u32) (ring->prod - ring->cons) > ring->actual_size); -while (ring->cons != ring->prod) { +while (!mlx4_en_is_ring_empty (ring)) { index = ring->cons & ring->size_mask;en_dbg (DRV , priv,"Processing descriptor:%d\n" , index);mlx4_en_free_rx_desc (priv, ring, index);
@@ -491,6 +496,23 @@ err_allocator:return err; } +/* We recover from out of memory by scheduling our napi poll +* function (mlx4_en_process_cq), which tries to allocate +* all missing RX buffers (call to mlx4_en_refill_rx_buffers). +*/ +void mlx4_en_recover_from_oom (struct mlx4_en_priv *priv) +{ +int ring; + +if (!priv->port_up) +return ; + +for (ring =0 ; ring < priv->rx_ring_num; ring++) { +if (mlx4_en_is_ring_empty (priv->rx_ring[ring])) +napi_reschedule (&priv->rx_cq[ring]->napi); + } +} +void mlx4_en_destroy_rx_ring (struct mlx4_en_priv *priv,struct mlx4_en_rx_ring **pring,u32 size,u16 stride)
drivers/net/ethernet/mellanox/mlx4/mlx4_en.h +1 -0
@@ -790,6 +790,7 @@ int mlx4_en_activate_tx_ring(struct mlx4void mlx4_en_deactivate_tx_ring (struct mlx4_en_priv *priv,struct mlx4_en_tx_ring *ring);void mlx4_en_set_num_rx_rings (struct mlx4_en_dev *mdev); +void mlx4_en_recover_from_oom (struct mlx4_en_priv *priv);int mlx4_en_create_rx_ring (struct mlx4_en_priv *priv,struct mlx4_en_rx_ring **pring,u32 size,u16 stride,int node);
Greg Kroah-Hartman
maintainerPATCH 6/72 ipv4: Missing sk_nulls_node_init() in ping_unhash().
In reply to Greg Kroah-Hartman4.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: "David S. Miller" <[email protected]>
[ Upstream commit a134f083e79fb4c3d0a925691e732c56911b4326 ]
If we don't do that, then the poison value is left in the ->pprev backlink.
This can cause crashes if we do a disconnect, followed by a connect().
--- net/ipv4/ping.c | 1 + 1 file changed, 1 insertion(+)
net/ipv4/ping.c +1 -0
@@ -158,6 +158,7 @@ void ping_unhash(struct sock *sk)if (sk_hashed (sk)) {write_lock_bh (&ping_table.lock);hlist_nulls_del (&sk->sk_nulls_node); +sk_nulls_node_init (&sk->sk_nulls_node);sock_put (sk); isk->inet_num =0 ; isk->inet_sport =0 ;
Greg Kroah-Hartman
maintainerPATCH 7/72 MIPS: BCM63xx: Move bcm63xx_gpio_init() to bcm63xx_register_devices().
In reply to Greg Kroah-Hartman4.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicolas Schichan <[email protected]>
Commit 2ec459f2a77b808c1e5a3616c88b613d3f720c8d upstream.
When called from prom init code, bcm63xx_gpio_init() will fail as it will call gpiochip_add() which relies on a working kmalloc() to alloc the gpio_desc array and kmalloc is not useable yet at prom init time.
Move bcm63xx_gpio_init() to bcm63xx_register_devices() (an arch_initcall) where kmalloc works.
Patchwork: https://patchwork.linux-mips.org/patch/9530/
--- arch/mips/bcm63xx/prom.c | 4 ---- arch/mips/bcm63xx/setup.c | 4 ++++ 2 files changed, 4 insertions(+), 4 deletions(-)
arch/mips/bcm63xx/prom.c +0 -4
@@ -17,7 +17,6 @@#include <bcm63xx_cpu.h> #include <bcm63xx_io.h> #include <bcm63xx_regs.h> -#include <bcm63xx_gpio.h> void __init prom_init (void ) {
@@ -53,9 +52,6 @@ void __init prom_init(void) reg &= ~mask;bcm_perf_writel (reg,PERF_CKCTL_REG ); -/* register gpiochip */ -bcm63xx_gpio_init (); -/* do low level board init */ board_prom_init ();
arch/mips/bcm63xx/setup.c +4 -0
@@ -20,6 +20,7 @@#include <bcm63xx_cpu.h> #include <bcm63xx_regs.h> #include <bcm63xx_io.h> +#include <bcm63xx_gpio.h> void bcm63xx_machine_halt (void ) {
@@ -160,6 +161,9 @@ void __init plat_mem_setup(void)int __init bcm63xx_register_devices (void ) { +/* register gpiochip */ +bcm63xx_gpio_init (); +return board_register_devices (); }
Greg Kroah-Hartman
maintainerPATCH 8/72 MIPS: OCTEON: dma-octeon: fix OHCI USB config check
In reply to Greg Kroah-Hartman4.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aaro Koskinen <[email protected]>
Commit a8667d706dfa394ef9fe5f9013dee92d40a096e8 upstream.
CONFIG_USB_OCTEON_OHCI is deprecated and no longer needed to use OHCI on OCTEON II. Instead, CONFIG_USB_OHCI_HCD_PLATFORM should be used.
Patchwork: https://patchwork.linux-mips.org/patch/9421/
--- arch/mips/cavium-octeon/dma-octeon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/mips/cavium-octeon/dma-octeon.c +1 -1
@@ -306,7 +306,7 @@ void __init plat_swiotlb_setup(void) swiotlbsize = 64 * (1<<20); }#endif -#ifdef CONFIG_USB_OCTEON_OHCI +#ifdef CONFIG_USB_OHCI_HCD_PLATFORM /* OCTEON II ohci is only 32-bit. */ if (OCTEON_IS_OCTEON2 () && max_addr >=0x100000000ul ) swiotlbsize =64 * (1 <<20 );
Greg Kroah-Hartman
maintainerPATCH 9/72 MIPS: OCTEON: Use correct CSR to soft reset
In reply to Greg Kroah-Hartman4.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chandrakala Chavva <[email protected]>
Commit 9a49899eb88803dcc0ef437f09912f9a7b7a66fd upstream.
Also delete unused cvmx_reset_octeon()
This fixes reboot for Octeon III boards
Patchwork: https://patchwork.linux-mips.org/patch/9471/
--- arch/mips/cavium-octeon/setup.c | 5 ++++- arch/mips/include/asm/octeon/cvmx.h | 8 -------- 2 files changed, 4 insertions(+), 9 deletions(-)
arch/mips/cavium-octeon/setup.c +4 -1
@@ -413,7 +413,10 @@ static void octeon_restart(char *commandmb ();while (1 ) -cvmx_write_csr (CVMX_CIU_SOFT_RST ,1 ); +if (OCTEON_IS_OCTEON3 ()) +cvmx_write_csr (CVMX_RST_SOFT_RST ,1 ); +else +cvmx_write_csr (CVMX_CIU_SOFT_RST ,1 ); }
arch/mips/include/asm/octeon/cvmx.h +0 -8
@@ -436,14 +436,6 @@ static inline uint64_t cvmx_get_cycle_gl/***************************************************************************/ -static inline void cvmx_reset_octeon (void ) -{ -union cvmx_ciu_soft_rst ciu_soft_rst; - ciu_soft_rst.u64 =0 ; - ciu_soft_rst.s.soft_rst =1 ; -cvmx_write_csr (CVMX_CIU_SOFT_RST , ciu_soft_rst.u64); -} -/* Return the number of cores available in the chip */ static inline uint32_t cvmx_octeon_num_cores (void ) {
Greg Kroah-Hartman
maintainerPATCH 10/72 Revert "MIPS: Remove race window in page fault handling"
In reply to Greg Kroah-Hartman4.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lars Persson <[email protected]>
Commit 5b9593f3bccb9904f260f9ad7f184e1d2921bd1e upstream.
Revert commit 2a4a8b1e5d9d ("MIPS: Remove race window in page fault handling") because it increased the number of flushed dcache pages and became a performance problem for some workloads.
Patchwork: https://patchwork.linux-mips.org/patch/9345/
--- arch/mips/include/asm/pgtable.h | 9 +++++---- arch/mips/mm/cache.c | 27 ++++++++------------------- 2 files changed, 13 insertions(+), 23 deletions(-)
arch/mips/include/asm/pgtable.h +5 -4
@@ -127,10 +127,6 @@ do { \ } \ } while(0) - -extern void set_pte_at(struct mm_struct *mm, unsigned long addr, pte_t *ptep, -pte_t pteval); -#if defined(CONFIG_PHYS_ADDR_T_64BIT ) && defined(CONFIG_CPU_MIPS32 )#define pte_none (pte) (!(((pte).pte_low | (pte).pte_high) & ~_PAGE_GLOBAL))
@@ -154,6 +150,7 @@ static inline void set_pte(pte_t *ptep, } } } +#define set_pte_at (mm, addr, ptep, pteval) set_pte(ptep, pteval)static inline void pte_clear (struct mm_struct *mm,unsigned long addr,pte_t *ptep) {
@@ -192,6 +189,7 @@ static inline void set_pte(pte_t *ptep, }#endif } +#define set_pte_at (mm, addr, ptep, pteval) set_pte(ptep, pteval)static inline void pte_clear (struct mm_struct *mm,unsigned long addr,pte_t *ptep) {
@@ -407,12 +405,15 @@ static inline pte_t pte_modify(pte_t pteextern void __update_tlb (struct vm_area_struct *vma,unsigned long address,pte_t pte); +extern void __update_cache (struct vm_area_struct *vma,unsigned long address, +pte_t pte);static inline void update_mmu_cache (struct vm_area_struct *vma,unsigned long address,pte_t *ptep) {pte_t pte = *ptep;__update_tlb (vma, address, pte); +__update_cache (vma, address, pte); } static inline void update_mmu_cache_pmd(struct vm_area_struct *vma,
arch/mips/mm/cache.c +8 -19
@@ -119,36 +119,25 @@ void __flush_anon_page(struct page *pageEXPORT_SYMBOL (__flush_anon_page); -static void mips_flush_dcache_from_pte (pte_t pteval,unsigned long address) +void __update_cache (struct vm_area_struct *vma,unsigned long address, +pte_t pte) {struct page *page; -unsigned long pfn =pte_pfn (pteval); +unsigned long pfn, addr; +int exec = (vma->vm_flags &VM_EXEC ) && !cpu_has_ic_fills_f_dc; + pfn =pte_pfn (pte);if (unlikely (!pfn_valid (pfn)))return ; - page =pfn_to_page (pfn);if (page_mapping (page) &&Page_dcache_dirty (page)) { -unsigned long page_addr = (unsigned long )page_address (page); - -if (!cpu_has_ic_fills_f_dc || -pages_do_alias (page_addr, address &PAGE_MASK )) -flush_data_cache_page (page_addr); + addr = (unsigned long )page_address (page); +if (exec ||pages_do_alias (addr, address &PAGE_MASK )) +flush_data_cache_page (addr);ClearPageDcacheDirty (page); } } -void set_pte_at (struct mm_struct *mm,unsigned long addr, -pte_t *ptep,pte_t pteval) -{ -if (cpu_has_dc_aliases || !cpu_has_ic_fills_f_dc) { -if (pte_present (pteval)) -mips_flush_dcache_from_pte (pteval, addr); - } - -set_pte (ptep, pteval); -} -unsigned long _page_cachable_default;EXPORT_SYMBOL (_page_cachable_default);
Greg Kroah-Hartman
maintainerPATCH 11/72 MIPS: Fix race condition in lazy cache flushing.
In reply to Greg Kroah-Hartman4.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lars Persson <[email protected]>
Commit 4d46a67a3eb827ccf1125959936fd51ba318dabc upstream.
The lazy cache flushing implemented in the MIPS kernel suffers from a race condition that is exposed by do_set_pte() in mm/memory.c.
A pre-condition is a file-system that writes to the page from the CPU in its readpage method and then calls flush_dcache_page(). One example is ubifs. Another pre-condition is that the dcache flush is postponed in __flush_dcache_page().
Upon a page fault for an executable mapping not existing in the page-cache, the following will happen:
1. Write to the page
2. flush_dcache_page
3. flush_icache_page
4. set_pte_at
5. update_mmu_cache (commits the flush of a dcache-dirty page)
Between steps 4 and 5 another thread can hit the same page and it will encounter a valid pte. Because the data still is in the L1 dcache the CPU will fetch stale data from L2 into the icache and execute garbage.
This fix moves the commit of the cache flush to step 3 to close the race window. It also reduces the amount of flushes on non-executable mappings because we never enter __flush_dcache_page() for non-aliasing CPUs.
Regressions can occur in drivers that mistakenly relies on the flush_dcache_page() in get_user_pages() for DMA operations.
[[email protected]: Folded in patch 9346 to fix highmem issue.]
Patchwork: https://patchwork.linux-mips.org/patch/9346/
Patchwork: https://patchwork.linux-mips.org/patch/9738/
--- arch/mips/include/asm/cacheflush.h | 38 ++++++++++++++++++++++--------------- arch/mips/mm/cache.c | 12 +++++++++++ 2 files changed, 35 insertions(+), 15 deletions(-)
arch/mips/include/asm/cacheflush.h +23 -15
@@ -29,6 +29,20 @@* - flush_icache_all() flush the entire instruction cache * - flush_data_cache_page() flushes a page from the data cache */ + +/* +* This flag is used to indicate that the page pointed to by a pte +* is dirty and requires cleaning before returning it to the user. +*/ +#define PG_dcache_dirty PG_arch_1 + +#define Page_dcache_dirty (page) \ + test_bit(PG_dcache_dirty, &(page)->flags) +#define SetPageDcacheDirty (page) \ + set_bit(PG_dcache_dirty, &(page)->flags) +#define ClearPageDcacheDirty (page) \ + clear_bit(PG_dcache_dirty, &(page)->flags) +extern void (*flush_cache_all)(void );extern void (*__flush_cache_all)(void );extern void (*flush_cache_mm)(struct mm_struct *mm);
@@ -37,13 +51,15 @@ extern void (*flush_cache_range)(struct unsigned long start, unsigned long end);extern void (*flush_cache_page)(struct vm_area_struct *vma,unsigned long page,unsigned long pfn);extern void __flush_dcache_page (struct page *page); +extern void __flush_icache_page (struct vm_area_struct *vma,struct page *page);#define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 1static inline void flush_dcache_page (struct page *page) { -if (cpu_has_dc_aliases || !cpu_has_ic_fills_f_dc) +if (cpu_has_dc_aliases)__flush_dcache_page (page); - +else if (!cpu_has_ic_fills_f_dc) +SetPageDcacheDirty (page); }#define flush_dcache_mmap_lock (mapping) do { } while (0)
@@ -61,6 +77,11 @@ static inline void flush_anon_page(strucstatic inline void flush_icache_page (struct vm_area_struct *vma,struct page *page) { +if (!cpu_has_ic_fills_f_dc && (vma->vm_flags &VM_EXEC ) && +Page_dcache_dirty (page)) { +__flush_icache_page (vma, page); +ClearPageDcacheDirty (page); + } }extern void (*flush_icache_range)(unsigned long start,unsigned long end);
@@ -95,19 +116,6 @@ extern void (*flush_icache_all)(void);extern void (*local_flush_data_cache_page)(void * addr);extern void (*flush_data_cache_page)(unsigned long addr); -/* -* This flag is used to indicate that the page pointed to by a pte -* is dirty and requires cleaning before returning it to the user. -*/ -#define PG_dcache_dirty PG_arch_1 - -#define Page_dcache_dirty (page) \ - test_bit(PG_dcache_dirty, &(page)->flags) -#define SetPageDcacheDirty (page) \ - set_bit(PG_dcache_dirty, &(page)->flags) -#define ClearPageDcacheDirty (page) \ - clear_bit(PG_dcache_dirty, &(page)->flags) -/* Run kernel code uncached, useful for cache probing functions. */ unsigned long run_uncached (void *func);
arch/mips/mm/cache.c +12 -0
@@ -119,6 +119,18 @@ void __flush_anon_page(struct page *pageEXPORT_SYMBOL (__flush_anon_page); +void __flush_icache_page (struct vm_area_struct *vma,struct page *page) +{ +unsigned long addr; + +if (PageHighMem (page)) +return ; + + addr = (unsigned long )page_address (page); +flush_data_cache_page (addr); +} +EXPORT_SYMBOL_GPL (__flush_icache_page); +void __update_cache (struct vm_area_struct *vma,unsigned long address,pte_t pte) {
Greg Kroah-Hartman
maintainerPATCH 12/72 MIPS: Octeon: Remove udelay() causing huge IRQ latency
In reply to Greg Kroah-Hartman4.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Sverdlin <[email protected]>
Commit 73bf3c2a500b2db8ac966469591196bf55afb409 upstream.
udelay() in PCI/PCIe read/write callbacks cause 30ms IRQ latency on Octeon platforms because these operations are called from PCI_OP_READ() and PCI_OP_WRITE() under raw_spin_lock_irqsave().
Patchwork: https://patchwork.linux-mips.org/patch/9576/
--- arch/mips/include/asm/octeon/pci-octeon.h | 3 --- arch/mips/pci/pci-octeon.c | 6 ------ arch/mips/pci/pcie-octeon.c | 8 -------- 3 files changed, 17 deletions(-)
arch/mips/include/asm/octeon/pci-octeon.h +0 -3
@@ -11,9 +11,6 @@#include <linux/pci.h> -/* Some PCI cards require delays when accessing config space. */ -#define PCI_CONFIG_SPACE_DELAY 10000 -/* * The physical memory base mapped by BAR1. 256MB at the end of the * first 4GB.
arch/mips/pci/pci-octeon.c +0 -6
@@ -271,9 +271,6 @@ static int octeon_read_config(struct pci pci_addr.s.func = devfn &0x7 ; pci_addr.s.reg = reg; -#if PCI_CONFIG_SPACE_DELAY -udelay (PCI_CONFIG_SPACE_DELAY ); -#endif switch (size) {case 4 : *val =le32_to_cpu (cvmx_read64_uint32 (pci_addr.u64));
@@ -308,9 +305,6 @@ static int octeon_write_config(struct pc pci_addr.s.func = devfn &0x7 ; pci_addr.s.reg = reg; -#if PCI_CONFIG_SPACE_DELAY -udelay (PCI_CONFIG_SPACE_DELAY ); -#endif switch (size) {case 4 :cvmx_write64_uint32 (pci_addr.u64,cpu_to_le32 (val));
arch/mips/pci/pcie-octeon.c +0 -8
@@ -1762,14 +1762,6 @@ static int octeon_pcie_write_config(unsidefault :return PCIBIOS_FUNC_NOT_SUPPORTED ; } -#if PCI_CONFIG_SPACE_DELAY -/* -* Delay on writes so that devices have time to come up. Some -* bridges need this to allow time for the secondary busses to -* work -*/ -udelay (PCI_CONFIG_SPACE_DELAY ); -#endif return PCIBIOS_SUCCESSFUL ; }
Greg Kroah-Hartman
maintainerPATCH 13/72 MIPS: OCTEON: fix PCI interrupt mapping for D-Link DSR-1000N
In reply to Greg Kroah-Hartman4.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aaro Koskinen <[email protected]>
Commit b083518c52ab75a345d668ca7fa41e530df08d51 upstream.
Fix PCI interrupt mapping for DSR1000N. This will get the PCI slot interrupts working. The mapping is based on D-Link GPL tarball.
Patchwork: https://patchwork.linux-mips.org/patch/9593/
--- arch/mips/pci/pci-octeon.c | 2 ++ 1 file changed, 2 insertions(+)
arch/mips/pci/pci-octeon.c +2 -0
@@ -214,6 +214,8 @@ const char *octeon_get_pci_interrupts(voreturn "AAABAAAAAAAAAAAAAAAAAAAAAAAAAAAA" ;case CVMX_BOARD_TYPE_BBGW_REF :return "AABCD" ; +case CVMX_BOARD_TYPE_CUST_DSR1000N : +return "CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC" ;case CVMX_BOARD_TYPE_THUNDER :case CVMX_BOARD_TYPE_EBH3000 :default :
Greg Kroah-Hartman
maintainerPATCH 14/72 MIPS: Netlogic: Fix for SATA PHY init
In reply to Greg Kroah-Hartman4.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ganesan Ramalingam <[email protected]>
Commit 872cd4c2c617bb3a203ebe18115fd0c697112b87 upstream.
Update to the SATA PHY initialization. This is needed for SATA detection to succeed in all configurations.
Patchwork: https://patchwork.linux-mips.org/patch/8886/
--- arch/mips/netlogic/xlp/ahci-init-xlp2.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
arch/mips/netlogic/xlp/ahci-init-xlp2.c +13 -0
@@ -203,6 +203,7 @@ static u8 read_phy_reg(u64 regbase, u32static void config_sata_phy (u64 regbase) {u32 port, i, reg; +u8 val;for (port =0 ; port <2 ; port++) {for (i =0 , reg =RXCDRCALFOSC0 ; reg <=CALDUTY ; reg++, i++)
@@ -210,6 +211,18 @@ static void config_sata_phy(u64 regbase)for (i =0 , reg =RXDPIF ; reg <=PPMDRIFTMAX_HI ; reg++, i++)write_phy_reg (regbase, reg, port, sata_phy_config2[i]); + +/* Fix for PHY link up failures at lower temperatures */ +write_phy_reg (regbase,0x800F , port,0x1f ); + + val =read_phy_reg (regbase,0x0029 , port); +write_phy_reg (regbase,0x0029 , port, val | (0x7 <<1 )); + + val =read_phy_reg (regbase,0x0056 , port); +write_phy_reg (regbase,0x0056 , port, val & ~(1 <<3 )); + + val =read_phy_reg (regbase,0x0018 , port); +write_phy_reg (regbase,0x0018 , port, val & ~(0x7 <<0 )); } }
Greg Kroah-Hartman
maintainerPATCH 15/72 MIPS: Kconfig: Fix typo for the r2-to-r6 emulator kernel parameter
In reply to Greg Kroah-Hartman4.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Markos Chandras <[email protected]>
Commit 07edf0d46c07568d08feee95bbaa38c71b084150 upstream.
Commit b0a668fb2038 ("MIPS: kernel: mips-r2-to-r6-emul: Add R2 emulator for MIPS R6") added the mips r2-to-r6 emulator so an R2 userland can be executed on R6 kernels. This needed both build time and runtime support. The runtime support needed the "mipsr2emu" kernel parameter instead of the "mipsr2emul" listed in the Kconfig help message.
Patchwork: https://patchwork.linux-mips.org/patch/9504/
--- arch/mips/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/mips/Kconfig +1 -1
@@ -2072,7 +2072,7 @@ config MIPSR2_TO_R6_EMULATOR help Choose this option if you want to run non-R6 MIPS userland code. Even if you say 'Y' here, the emulator will still be disabled by - default. You can enable it using the 'mipsr2emul' kernel option. + default. You can enable it using the 'mipsr2emu' kernel option. The only reason this is a build-time option is to save ~14K from the final kernel image. comment "MIPS R2-to-R6 emulator is only available for UP kernels"
Greg Kroah-Hartman
maintainerPATCH 16/72 MIPS: r4kcache: Use correct base register for MIPS R6 cache flushes
In reply to Greg Kroah-Hartman4.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Markos Chandras <[email protected]>
Commit f6b39ae6f4d6ee835bb16e452086121aa010f1a7 upstream.
Commit 934c79231c1b("MIPS: asm: r4kcache: Add MIPS R6 cache unroll functions") added support for MIPS R6 cache flushes but it used the wrong base address register to perform the flushes so the same lines were flushed over and over. Moreover, replace the "addiu" instructions with LONG_ADDIU so the correct base address is calculated for 64-bit cores.
Patchwork: https://patchwork.linux-mips.org/patch/9384/
--- arch/mips/include/asm/r4kcache.h | 89 +++++++++++++++++++-------------------- 1 file changed, 45 insertions(+), 44 deletions(-)
arch/mips/include/asm/r4kcache.h +45 -44
@@ -12,6 +12,8 @@#ifndef _ASM_R4KCACHE_H#define _ASM_R4KCACHE_H +#include <linux/stringify.h> +#include <asm/asm.h> #include <asm/cacheops.h> #include <asm/compiler.h>
@@ -344,7 +346,7 @@ static inline void invalidate_tcache_pag" cache %1, 0x0a0(%0); cache %1, 0x0b0(%0)\n" \" cache %1, 0x0c0(%0); cache %1, 0x0d0(%0)\n" \" cache %1, 0x0e0(%0); cache %1, 0x0f0(%0)\n" \ -" addiu $1, $0, 0x100 \n" \ + " "__stringify(LONG_ADDIU)" $1, %0, 0x100 \n" \" cache %1, 0x000($1); cache %1, 0x010($1)\n" \" cache %1, 0x020($1); cache %1, 0x030($1)\n" \" cache %1, 0x040($1); cache %1, 0x050($1)\n" \
@@ -368,17 +370,17 @@ static inline void invalidate_tcache_pag" cache %1, 0x040(%0); cache %1, 0x060(%0)\n" \" cache %1, 0x080(%0); cache %1, 0x0a0(%0)\n" \" cache %1, 0x0c0(%0); cache %1, 0x0e0(%0)\n" \ -" addiu $1, %0, 0x100\n" \ + " "__stringify(LONG_ADDIU)" $1, %0, 0x100 \n" \" cache %1, 0x000($1); cache %1, 0x020($1)\n" \" cache %1, 0x040($1); cache %1, 0x060($1)\n" \" cache %1, 0x080($1); cache %1, 0x0a0($1)\n" \" cache %1, 0x0c0($1); cache %1, 0x0e0($1)\n" \ -" addiu $1, $1, 0x100\n" \ + " "__stringify(LONG_ADDIU)" $1, $1, 0x100 \n" \" cache %1, 0x000($1); cache %1, 0x020($1)\n" \" cache %1, 0x040($1); cache %1, 0x060($1)\n" \" cache %1, 0x080($1); cache %1, 0x0a0($1)\n" \" cache %1, 0x0c0($1); cache %1, 0x0e0($1)\n" \ -" addiu $1, $1, 0x100\n" \ + " "__stringify(LONG_ADDIU)" $1, $1, 0x100\n" \" cache %1, 0x000($1); cache %1, 0x020($1)\n" \" cache %1, 0x040($1); cache %1, 0x060($1)\n" \" cache %1, 0x080($1); cache %1, 0x0a0($1)\n" \
@@ -396,25 +398,25 @@ static inline void invalidate_tcache_pag" .set noat\n" \" cache %1, 0x000(%0); cache %1, 0x040(%0)\n" \" cache %1, 0x080(%0); cache %1, 0x0c0(%0)\n" \ -" addiu $1, %0, 0x100\n" \ + " "__stringify(LONG_ADDIU)" $1, %0, 0x100 \n" \" cache %1, 0x000($1); cache %1, 0x040($1)\n" \" cache %1, 0x080($1); cache %1, 0x0c0($1)\n" \ -" addiu $1, %0, 0x100\n" \ + " "__stringify(LONG_ADDIU)" $1, $1, 0x100 \n" \" cache %1, 0x000($1); cache %1, 0x040($1)\n" \" cache %1, 0x080($1); cache %1, 0x0c0($1)\n" \ -" addiu $1, %0, 0x100\n" \ + " "__stringify(LONG_ADDIU)" $1, $1, 0x100 \n" \" cache %1, 0x000($1); cache %1, 0x040($1)\n" \" cache %1, 0x080($1); cache %1, 0x0c0($1)\n" \ -" addiu $1, %0, 0x100\n" \ + " "__stringify(LONG_ADDIU)" $1, $1, 0x100 \n" \" cache %1, 0x000($1); cache %1, 0x040($1)\n" \" cache %1, 0x080($1); cache %1, 0x0c0($1)\n" \ -" addiu $1, %0, 0x100\n" \ + " "__stringify(LONG_ADDIU)" $1, $1, 0x100 \n" \" cache %1, 0x000($1); cache %1, 0x040($1)\n" \" cache %1, 0x080($1); cache %1, 0x0c0($1)\n" \ -" addiu $1, %0, 0x100\n" \ + " "__stringify(LONG_ADDIU)" $1, $1, 0x100 \n" \" cache %1, 0x000($1); cache %1, 0x040($1)\n" \" cache %1, 0x080($1); cache %1, 0x0c0($1)\n" \ -" addiu $1, %0, 0x100\n" \ + " "__stringify(LONG_ADDIU)" $1, $1, 0x100 \n" \" cache %1, 0x000($1); cache %1, 0x040($1)\n" \" cache %1, 0x080($1); cache %1, 0x0c0($1)\n" \" .set pop\n" \
@@ -429,39 +431,38 @@ static inline void invalidate_tcache_pag" .set mips64r6\n" \" .set noat\n" \" cache %1, 0x000(%0); cache %1, 0x080(%0)\n" \ -" addiu $1, %0, 0x100\n" \ -" cache %1, 0x000(%0); cache %1, 0x080(%0)\n" \ -" addiu $1, %0, 0x100\n" \ -" cache %1, 0x000(%0); cache %1, 0x080(%0)\n" \ -" addiu $1, %0, 0x100\n" \ -" cache %1, 0x000(%0); cache %1, 0x080(%0)\n" \ -" addiu $1, %0, 0x100\n" \ -" cache %1, 0x000(%0); cache %1, 0x080(%0)\n" \ -" addiu $1, %0, 0x100\n" \ -" cache %1, 0x000(%0); cache %1, 0x080(%0)\n" \ -" addiu $1, %0, 0x100\n" \ -" cache %1, 0x000(%0); cache %1, 0x080(%0)\n" \ -" addiu $1, %0, 0x100\n" \ -" cache %1, 0x000(%0); cache %1, 0x080(%0)\n" \ -" addiu $1, %0, 0x100\n" \ -" cache %1, 0x000(%0); cache %1, 0x080(%0)\n" \ -" addiu $1, %0, 0x100\n" \ -" cache %1, 0x000(%0); cache %1, 0x080(%0)\n" \ -" addiu $1, %0, 0x100\n" \ -" cache %1, 0x000(%0); cache %1, 0x080(%0)\n" \ -" addiu $1, %0, 0x100\n" \ -" cache %1, 0x000(%0); cache %1, 0x080(%0)\n" \ -" addiu $1, %0, 0x100\n" \ -" cache %1, 0x000(%0); cache %1, 0x080(%0)\n" \ -" addiu $1, %0, 0x100\n" \ -" cache %1, 0x000(%0); cache %1, 0x080(%0)\n" \ -" addiu $1, %0, 0x100\n" \ -" cache %1, 0x000(%0); cache %1, 0x080(%0)\n" \ -" addiu $1, %0, 0x100\n" \ -" cache %1, 0x000(%0); cache %1, 0x080(%0)\n" \ -" addiu $1, %0, 0x100\n" \ -" cache %1, 0x000(%0); cache %1, 0x080(%0)\n" \ -" addiu $1, %0, 0x100\n" \ + " "__stringify(LONG_ADDIU)" $1, %0, 0x100 \n" \ +" cache %1, 0x000($1); cache %1, 0x080($1)\n" \ + " "__stringify(LONG_ADDIU)" $1, $1, 0x100 \n" \ +" cache %1, 0x000($1); cache %1, 0x080($1)\n" \ + " "__stringify(LONG_ADDIU)" $1, $1, 0x100 \n" \ +" cache %1, 0x000($1); cache %1, 0x080($1)\n" \ + " "__stringify(LONG_ADDIU)" $1, $1, 0x100 \n" \ +" cache %1, 0x000($1); cache %1, 0x080($1)\n" \ + " "__stringify(LONG_ADDIU)" $1, $1, 0x100 \n" \ +" cache %1, 0x000($1); cache %1, 0x080($1)\n" \ + " "__stringify(LONG_ADDIU)" $1, $1, 0x100 \n" \ +" cache %1, 0x000($1); cache %1, 0x080($1)\n" \ + " "__stringify(LONG_ADDIU)" $1, $1, 0x100 \n" \ +" cache %1, 0x000($1); cache %1, 0x080($1)\n" \ + " "__stringify(LONG_ADDIU)" $1, $1, 0x100 \n" \ +" cache %1, 0x000($1); cache %1, 0x080($1)\n" \ + " "__stringify(LONG_ADDIU)" $1, $1, 0x100 \n" \ +" cache %1, 0x000($1); cache %1, 0x080($1)\n" \ + " "__stringify(LONG_ADDIU)" $1, $1, 0x100 \n" \ +" cache %1, 0x000($1); cache %1, 0x080($1)\n" \ + " "__stringify(LONG_ADDIU)" $1, $1, 0x100 \n" \ +" cache %1, 0x000($1); cache %1, 0x080($1)\n" \ + " "__stringify(LONG_ADDIU)" $1, $1, 0x100 \n" \ +" cache %1, 0x000($1); cache %1, 0x080($1)\n" \ + " "__stringify(LONG_ADDIU)" $1, $1, 0x100 \n" \ +" cache %1, 0x000($1); cache %1, 0x080($1)\n" \ + " "__stringify(LONG_ADDIU)" $1, $1, 0x100 \n" \ +" cache %1, 0x000($1); cache %1, 0x080($1)\n" \ + " "__stringify(LONG_ADDIU)" $1, $1, 0x100 \n" \ +" cache %1, 0x000($1); cache %1, 0x080($1)\n" \ + " "__stringify(LONG_ADDIU)" $1, $1, 0x100 \n" \ + " cache %1, 0x000($1); cache %1, 0x080($1)\n" \ " .set pop\n" \ : \ : "r" (base), \
Greg Kroah-Hartman
maintainerPATCH 17/72 MIPS: asm: spinlock: Fix addiu instruction for R10000_LLSC_WAR case
In reply to Greg Kroah-Hartman4.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Markos Chandras <[email protected]>
Commit 518222161d4a2d3f3b2700098563b62383f83878 upstream.
Commit 5753762cbd1c("MIPS: asm: spinlock: Replace "sub" instruction with "addiu") replaced the "sub" instruction with addiu but it did not update the immediate value in the R10000_LLSC_WAR case.
Patchwork: https://patchwork.linux-mips.org/patch/9385/
--- arch/mips/include/asm/spinlock.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/mips/include/asm/spinlock.h +1 -1
@@ -263,7 +263,7 @@ static inline void arch_read_unlock(archif (R10000_LLSC_WAR ) { __asm__ __volatile__("1: ll %1, %2 # arch_read_unlock \n" -" addiu %1, 1 \n" +" addiu %1, -1 \n" " sc %1, %0 \n" " beqzl %1, 1b \n" : "=" GCC_OFF_SMALL_ASM() (rw->lock), "=&r" (tmp)
Greg Kroah-Hartman
maintainerPATCH 18/72 MIPS: kernel: entry.S: Set correct ISA level for mips_ihb
In reply to Greg Kroah-Hartman4.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Markos Chandras <[email protected]>
Commit aebac99384f7a6d83a3dcd42bf2481eed2670083 upstream.
Commit 6ebb496ffc7e("MIPS: kernel: entry.S: Add MIPS R6 related definitions") added the MIPSR6 definition but it did not update the ISA level of the actual assembly code so a pre-MIPSR6 jr.hb instruction was generated instead. Fix this by using the MISP_ISA_LEVEL_RAW macro.
Patchwork: https://patchwork.linux-mips.org/patch/9386/
--- arch/mips/kernel/entry.S | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/mips/kernel/entry.S +2 -1
@@ -10,6 +10,7 @@ #include <asm/asm.h> #include <asm/asmmacro.h> +#include <asm/compiler.h> #include <asm/regdef.h> #include <asm/mipsregs.h> #include <asm/stackframe.h>
@@ -185,7 +186,7 @@ syscall_exit_work: * For C code use the inline version named instruction_hazard(). */ LEAF(mips_ihb) - .set mips32r2 + .set MIPS_ISA_LEVEL_RAW jr.hb ra nop END(mips_ihb)
Greg Kroah-Hartman
maintainerPATCH 19/72 MIPS: Fix cpu_has_mips_r2_exec_hazard.
In reply to Greg Kroah-Hartman4.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ralf Baechle <[email protected]>
Commit 9cdf30bd3bac697fc533988f44a117434a858f69 upstream.
Returns a non-zero value if the current processor implementation requires an IHB instruction to deal with an instruction hazard as per MIPS R2 architecture specification, zero otherwise.
For a discussion, see http://patchwork.linux-mips.org/patch/9539/.
--- arch/mips/include/asm/cpu-features.h | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-)
arch/mips/include/asm/cpu-features.h +32 -1
@@ -235,8 +235,39 @@/* MIPSR2 and MIPSR6 have a lot of similarities */ #define cpu_has_mips_r2_r6 (cpu_has_mips_r2 | cpu_has_mips_r6) +/* +* cpu_has_mips_r2_exec_hazard - return if IHB is required on current processor +* +* Returns non-zero value if the current processor implementation requires +* an IHB instruction to deal with an instruction hazard as per MIPS R2 +* architecture specification, zero otherwise. +*/ #ifndef cpu_has_mips_r2_exec_hazard -#define cpu_has_mips_r2_exec_hazard (cpu_has_mips_r2 | cpu_has_mips_r6) +#define cpu_has_mips_r2_exec_hazard \ +({ \ + int __res; \ + \ + switch (current_cpu_type()) { \ + case CPU_M14KC: \ + case CPU_74K: \ + case CPU_1074K: \ + case CPU_PROAPTIV: \ + case CPU_P5600: \ + case CPU_M5150: \ + case CPU_QEMU_GENERIC: \ + case CPU_CAVIUM_OCTEON: \ + case CPU_CAVIUM_OCTEON_PLUS: \ + case CPU_CAVIUM_OCTEON2: \ + case CPU_CAVIUM_OCTEON3: \ + __res = 0; \ + break; \ + \ + default: \ + __res = 1; \ + } \ + \ + __res; \ +})#endif /*
Greg Kroah-Hartman
maintainerPATCH 20/72 MIPS: Octeon: Delete override of cpu_has_mips_r2_exec_hazard.
In reply to Greg Kroah-Hartman4.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ralf Baechle <[email protected]>
Commit f05ff43355e6997c18f82ddcee370a6e5f8643ce upstream.
This is no longer needed with the fixed, new and improved definition of cpu_has_mips_r2_exec_hazard in <asm/cpu-features.h>.
For a discussion, see http://patchwork.linux-mips.org/patch/9539/.
--- arch/mips/include/asm/mach-cavium-octeon/cpu-feature-overrides.h | 1 - 1 file changed, 1 deletion(-)
arch/mips/include/asm/mach-cavium-octeon/cpu-feature-overrides.h +0 -1
@@ -50,7 +50,6 @@#define cpu_has_mips32r2 0#define cpu_has_mips64r1 0#define cpu_has_mips64r2 1 -#define cpu_has_mips_r2_exec_hazard 0#define cpu_has_dsp 0#define cpu_has_dsp2 0#define cpu_has_mipsmt 0
Greg Kroah-Hartman
maintainerPATCH 21/72 Revert "MIPS: Avoid pipeline stalls on some MIPS32R2 cores."
In reply to Greg Kroah-Hartman4.0-stable review patch. If anyone has any objections, please let me know.
------------------
Commit 9eaffa84a8a46adab065c983401fc9d5949c958f upstream.
For a discussion, see http://patchwork.linux-mips.org/patch/9539/.
This reverts commit 625c0a21700bdb90844d926a1508a17a77e369c9.
--- arch/mips/mm/tlbex.c | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-)
arch/mips/mm/tlbex.c +2 -19
@@ -501,26 +501,9 @@ static void build_tlb_write_entry(u32 **case tlb_indexed: tlbw = uasm_i_tlbwi;break ; } -if (cpu_has_mips_r2_exec_hazard) { -/* -* The architecture spec says an ehb is required here, -* but a number of cores do not have the hazard and -* using an ehb causes an expensive pipeline stall. -*/ -switch (current_cpu_type ()) { -case CPU_M14KC : -case CPU_74K : -case CPU_1074K : -case CPU_PROAPTIV : -case CPU_P5600 : -case CPU_M5150 : -case CPU_QEMU_GENERIC : -break ; - -default : +if (cpu_has_mips_r2_r6) { +if (cpu_has_mips_r2_exec_hazard)uasm_i_ehb (p); -break ; - }tlbw (p);return ; }
Greg Kroah-Hartman
maintainerPATCH 22/72 SSB: fix Kconfig dependencies
In reply to Greg Kroah-Hartman4.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Adrien Schildknecht <[email protected]>
Commit 179fa46fb666c8f2aa2bbb1f3114d5d826d59d3d upstream.
The commit 21400f252a97 ("MIPS: BCM47XX: Make ssb init NVRAM instead of bcm47xx polling it") introduces a dependency to SSB_SFLASH but did not add it to the Kconfig.
drivers/ssb/driver_mipscore.c:216:36: error: 'struct ssb_mipscore' has no member named 'sflash'
struct ssb_sflash *sflash = &mcore->sflash;
^
drivers/ssb/driver_mipscore.c:249:12: error: dereferencing pointer to
incomplete type
if (sflash->present) {
^Patchwork: https://patchwork.linux-mips.org/patch/9598/
--- drivers/ssb/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/ssb/Kconfig +1 -0
@@ -130,6 +130,7 @@ config SSB_DRIVER_MIPS bool "SSB Broadcom MIPS core driver" depends on SSB && MIPS select SSB_SERIAL + select SSB_SFLASH help Driver for the Sonics Silicon Backplane attached Broadcom MIPS core.
Greg Kroah-Hartman
maintainerPATCH 23/72 MIPS: ralink: Fix bad config symbol in PCI makefile.
In reply to Greg Kroah-Hartman4.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: John Crispin <[email protected]>
Commit 93a7de8819a661d06eb11f4de3d6888b9a842b30 upstream.
A wrong symbol is referenced by commit 187c26ddf0b2 ("MIPS: ralink: add rt2880 pci driver"). Fix this by changing it to the correct symbol.
Patchwork: https://patchwork.linux-mips.org/patch/9298/
--- arch/mips/pci/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/mips/pci/Makefile +1 -1
@@ -43,7 +43,7 @@ obj-$(CONFIG_SIBYTE_BCM1x80) += pci-bcm1 obj-$(CONFIG_SNI_RM) += fixup-sni.o ops-sni.o obj-$(CONFIG_LANTIQ) += fixup-lantiq.o obj-$(CONFIG_PCI_LANTIQ) += pci-lantiq.o ops-lantiq.o -obj-$(CONFIG_SOC_RT2880) += pci-rt2880.o +obj-$(CONFIG_SOC_RT288X) += pci-rt2880.o obj-$(CONFIG_SOC_RT3883) += pci-rt3883.o obj-$(CONFIG_TANBAC_TB0219) += fixup-tb0219.o obj-$(CONFIG_TANBAC_TB0226) += fixup-tb0226.o
Greg Kroah-Hartman
maintainerPATCH 24/72 MIPS: ralink: add missing symbol for RALINK_ILL_ACC
In reply to Greg Kroah-Hartman4.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: John Crispin <[email protected]>
Commit a7b7aad383c5dd9221a06e378197350dd27c1163 upstream.
A driver was added in commit 5433acd81e87 ("MIPS: ralink: add illegal access driver") without the Kconfig section being added. Fix this by adding the symbol to the Kconfig file.
Patchwork: https://patchwork.linux-mips.org/patch/9299/
--- arch/mips/ralink/Kconfig | 5 +++++ 1 file changed, 5 insertions(+)
arch/mips/ralink/Kconfig +5 -0
@@ -7,6 +7,11 @@ config CLKEVT_RT3352 select CLKSRC_OF select CLKSRC_MMIO +config RALINK_ILL_ACC + bool + depends on SOC_RT305X + default y + choice prompt "Ralink SoC selection" default SOC_RT305X
Greg Kroah-Hartman
maintainerPATCH 25/72 MIPS: smp-cps: cpu_set FPU mask if FPU present
In reply to Greg Kroah-Hartman4.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Niklas Cassel <[email protected]>
Commit 90db024f140d0d6ad960cc5f090e3c8ed890ca55 upstream.
If we have an FPU, enroll ourselves in the FPU-full mask. Matching the MT_SMP and CMP implementations of smp_setup.
Patchwork: https://patchwork.linux-mips.org/patch/8948/
--- arch/mips/kernel/smp-cps.c | 6 ++++++ 1 file changed, 6 insertions(+)
arch/mips/kernel/smp-cps.c +6 -0
@@ -88,6 +88,12 @@ static void __init cps_smp_setup(void)/* Make core 0 coherent with everything */ write_gcr_cl_coherence (0xff ); + +#ifdef CONFIG_MIPS_MT_FPAFF +/* If we have an FPU, enroll ourselves in the FPU-full mask */ +if (cpu_has_fpu) +cpu_set (0 , mt_fpu_cpumask); +#endif /* CONFIG_MIPS_MT_FPAFF */ }static void __init cps_prepare_cpus (unsigned int max_cpus)
Greg Kroah-Hartman
maintainerPATCH 26/72 MIPS: Kconfig: Disable SMP/CPS for 64-bit
In reply to Greg Kroah-Hartman4.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Markos Chandras <[email protected]>
Commit 6ca716f2e5571d25a3899c6c5c91ff72ea6d6f5e upstream.
A 64-bit build for Malta produces far too many build problems when SMP/CPS is selected. Moreover, there is currently no 64-bit product with SMP/CPS so we disable SMP/CPS when building for 64-bit until it is properly supported.
Patchwork: https://patchwork.linux-mips.org/patch/8573/
--- arch/mips/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/mips/Kconfig +1 -1
@@ -2142,7 +2142,7 @@ config MIPS_CMP config MIPS_CPS bool "MIPS Coherent Processing System support" - depends on SYS_SUPPORTS_MIPS_CPS + depends on SYS_SUPPORTS_MIPS_CPS && !64BIT select MIPS_CM select MIPS_CPC select MIPS_CPS_PM if HOTPLUG_CPU
Greg Kroah-Hartman
maintainerPATCH 27/72 MIPS: BCM47XX: Fix detecting Microsoft MN-700 & Asus WL500G
In reply to Greg Kroah-Hartman4.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rafał Miłecki <[email protected]>
Commit 96f7c21363e0e0d19f3471f54a719ed06d708513 upstream.
Since the day of adding this code it was broken. We were iterating over a wrong array and checking for wrong NVRAM entry.
Patchwork: https://patchwork.linux-mips.org/patch/9654/
--- arch/mips/bcm47xx/board.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/mips/bcm47xx/board.c +2 -2
@@ -247,8 +247,8 @@ static __init const struct bcm47xx_board }if (bcm47xx_nvram_getenv ("hardware_version" , buf1,sizeof (buf1)) >=0 && -bcm47xx_nvram_getenv ("boardtype" , buf2,sizeof (buf2)) >=0 ) { -for (e2 = bcm47xx_board_list_boot_hw; e2->value1; e2++) { +bcm47xx_nvram_getenv ("boardnum" , buf2,sizeof (buf2)) >=0 ) { +for (e2 = bcm47xx_board_list_hw_version_num; e2->value1; e2++) {if (!strstarts (buf1, e2->value1) && !strcmp (buf2, e2->value2))return &e2->board;
Greg Kroah-Hartman
maintainerPATCH 28/72 MIPS: asm: elf: Set O32 default FPU flags
In reply to Greg Kroah-Hartman4.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Markos Chandras <[email protected]>
Commit 48f8eaee3f59848809644507fc47363b37e54450 upstream.
Set good default FPU flags (FR0) for O32 binaries similar to what the kernel does for the N64/N32 ones. This also fixes a regression introduced in commit 46490b572544 ("MIPS: kernel: elf: Improve the overall ABI and FPU mode checks") when MIPS_O32_FP64_SUPPORT is disabled. In that case, the mips_set_personality_fp() did not set the FPU mode at all because it assumed that the FPU mode was already set properly. That led to O32 userland problems.
Patchwork: http://patchwork.linux-mips.org/patch/9344/
--- arch/mips/include/asm/elf.h | 5 +++++ 1 file changed, 5 insertions(+)
arch/mips/include/asm/elf.h +5 -0
@@ -294,6 +294,9 @@ do { \if (personality (current->personality) !=PER_LINUX ) \set_personality (PER_LINUX ); \ \ +clear_thread_flag (TIF_HYBRID_FPREGS ); \ +set_thread_flag (TIF_32BIT_FPREGS ); \ + \mips_set_personality_fp (state); \ \ current->thread.abi = &mips_abi; \
@@ -319,6 +322,8 @@ do { \ do { \ set_thread_flag(TIF_32BIT_REGS); \ set_thread_flag(TIF_32BIT_ADDR); \ + clear_thread_flag(TIF_HYBRID_FPREGS); \ + set_thread_flag(TIF_32BIT_FPREGS); \ \ mips_set_personality_fp(state); \ \
Greg Kroah-Hartman
maintainerPATCH 29/72 MIPS: Makefile: Fix MIPS ASE detection code
In reply to Greg Kroah-Hartman4.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Markos Chandras <[email protected]>
Commit 5306a5450824691e27d68f711758515debedeeac upstream.
Commit 32098ec7bcba ("MIPS: Makefile: Move the ASEs checks after setting the core's CFLAGS") re-arranged the MIPS ASE detection code and also added the current cflags to the detection logic. However, this introduced a few bugs. First of all, the mips-cflags should not be quoted since that ends up being passed as a string to subsequent commands leading to broken detection from the cc-option-* tools. Moreover, in order to avoid duplicating the cflags-y because of how cc-option works, we rework the logic so we pass only those cflags which are needed by the selected ASE. Finally, fix some typos resulting in MSA not being detected correctly.
Patchwork: https://patchwork.linux-mips.org/patch/9661/
--- arch/mips/Makefile | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
arch/mips/Makefile +10 -4
@@ -197,11 +197,17 @@ endif # Warning: the 64-bit MIPS architecture does not support the `smartmips' extension # Pass -Wa,--no-warn to disable all assembler warnings until the kernel code has # been fixed properly. -mips-cflags := "$(cflags-y)" -cflags-$(CONFIG_CPU_HAS_SMARTMIPS) += $(call cc-option,$(mips-cflags),-msmartmips) -Wa,--no-warn -cflags-$(CONFIG_CPU_MICROMIPS) += $(call cc-option,$(mips-cflags),-mmicromips) +mips-cflags := $(cflags-y) +ifeq ($(CONFIG_CPU_HAS_SMARTMIPS),y) +smartmips-ase := $(call cc-option-yn,$(mips-cflags) -msmartmips) +cflags-$(smartmips-ase) += -msmartmips -Wa,--no-warn +endif +ifeq ($(CONFIG_CPU_MICROMIPS),y) +micromips-ase := $(call cc-option-yn,$(mips-cflags) -mmicromips) +cflags-$(micromips-ase) += -mmicromips +endif ifeq ($(CONFIG_CPU_HAS_MSA),y) -toolchain-msa := $(call cc-option-yn,-$(mips-cflags),mhard-float -mfp64 -Wa$(comma)-mmsa) +toolchain-msa := $(call cc-option-yn,$(mips-cflags) -mhard-float -mfp64 -Wa$(comma)-mmsa) cflags-$(toolchain-msa) += -DTOOLCHAIN_SUPPORTS_MSA endif
Greg Kroah-Hartman
maintainerPATCH 30/72 ALSA: emux: Fix mutex deadlock at unloading
In reply to Greg Kroah-Hartman4.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit 07b0e5d49d227e3950cb13a3e8caf248ef2a310e upstream.
The emux-synth driver has a possible AB/BA mutex deadlock at unloading the emu10k1 driver:
snd_emux_free() ->
snd_emux_detach_seq(): mutex_lock(&emu->register_mutex) ->
snd_seq_delete_kernel_client() ->
snd_seq_free_client(): mutex_lock(®ister_mutex) snd_seq_release() ->
snd_seq_free_client(): mutex_lock(®ister_mutex) ->
snd_seq_delete_all_ports() ->
snd_emux_unuse(): mutex_lock(&emu->register_mutex)Basically snd_emux_detach_seq() doesn't need a protection of emu->register_mutex as it's already being unregistered. So, we can get rid of this for avoiding the deadlock.
--- sound/synth/emux/emux_seq.c | 2 -- 1 file changed, 2 deletions(-)
sound/synth/emux/emux_seq.c +0 -2
@@ -124,12 +124,10 @@ snd_emux_detach_seq(struct snd_emux *emuif (emu->voices)snd_emux_terminate_all (emu); -mutex_lock (&emu->register_mutex);if (emu->client >=0 ) {snd_seq_delete_kernel_client (emu->client); emu->client =-1 ; } -mutex_unlock (&emu->register_mutex); }
Greg Kroah-Hartman
maintainerPATCH 31/72 ALSA: emux: Fix mutex deadlock in OSS emulation
In reply to Greg Kroah-Hartman4.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit 1c94e65c668f44d2c69ae7e7fc268ab3268fba3e upstream.
The OSS emulation in synth-emux helper has a potential AB/BA deadlock at the simultaneous closing and opening:
close ->
snd_seq_release() ->
sne_seq_free_client() ->
snd_seq_delete_all_ports(): takes client->ports_mutex ->
port_delete() ->
snd_emux_unuse(): takes emux->register_mutexopen ->
snd_seq_oss_open() ->
snd_emux_open_seq_oss(): takes emux->register_mutex ->
snd_seq_event_port_attach() ->
snd_seq_create_port(): takes client->ports_mutexThis patch addresses the deadlock by reducing the rance taking emux->register_mutex in snd_emux_open_seq_oss(). The lock is needed for the refcount handling, so move it locally. The calls in emux_seq.c are already with the mutex, thus they are replaced with the version without mutex lock/unlock.
--- sound/synth/emux/emux_oss.c | 11 +---------- sound/synth/emux/emux_seq.c | 27 +++++++++++++++++++++------ 2 files changed, 22 insertions(+), 16 deletions(-)
sound/synth/emux/emux_oss.c +1 -10
@@ -118,12 +118,8 @@ snd_emux_open_seq_oss(struct snd_seq_ossif (snd_BUG_ON (!arg || !emu))return -ENXIO ; -mutex_lock (&emu->register_mutex); - -if (!snd_emux_inc_count (emu)) { -mutex_unlock (&emu->register_mutex); +if (!snd_emux_inc_count (emu))return -EFAULT ; - }memset (&callback,0 ,sizeof (callback)); callback.owner =THIS_MODULE ;
@@ -135,7 +131,6 @@ snd_emux_open_seq_oss(struct snd_seq_ossif (p ==NULL ) {snd_printk (KERN_ERR "can't create port\n" );snd_emux_dec_count (emu); -mutex_unlock (&emu->register_mutex);return -ENOMEM ; }
@@ -148,8 +143,6 @@ snd_emux_open_seq_oss(struct snd_seq_ossreset_port_mode (p, arg->seq_mode);snd_emux_reset_port (p); - -mutex_unlock (&emu->register_mutex);return 0 ; }
@@ -195,13 +188,11 @@ snd_emux_close_seq_oss(struct snd_seq_osif (snd_BUG_ON (!emu))return -ENXIO ; -mutex_lock (&emu->register_mutex);snd_emux_sounds_off_all (p);snd_soundfont_close_check (emu->sflist,SF_CLIENT_NO (p->chset.port));snd_seq_event_port_detach (p->chset.client, p->chset.port);snd_emux_dec_count (emu); -mutex_unlock (&emu->register_mutex);return 0 ; }
sound/synth/emux/emux_seq.c +21 -6
@@ -267,8 +267,8 @@ snd_emux_event_input(struct snd_seq_even/* * increment usage count */ -int -snd_emux_inc_count (struct snd_emux *emu) +static int +__snd_emux_inc_count (struct snd_emux *emu) { emu->used++;if (!try_module_get (emu->ops.owner))
@@ -282,12 +282,21 @@ snd_emux_inc_count(struct snd_emux *emu)return 1 ; } +int snd_emux_inc_count (struct snd_emux *emu) +{ +int ret; + +mutex_lock (&emu->register_mutex); + ret =__snd_emux_inc_count (emu); +mutex_unlock (&emu->register_mutex); +return ret; +}/* * decrease usage count */ -void -snd_emux_dec_count (struct snd_emux *emu) +static void +__snd_emux_dec_count (struct snd_emux *emu) {module_put (emu->card->module); emu->used--;
@@ -296,6 +305,12 @@ snd_emux_dec_count(struct snd_emux *emu)module_put (emu->ops.owner); } +void snd_emux_dec_count (struct snd_emux *emu) +{ +mutex_lock (&emu->register_mutex); +__snd_emux_dec_count (emu); +mutex_unlock (&emu->register_mutex); +}/* * Routine that is called upon a first use of a particular port
@@ -315,7 +330,7 @@ snd_emux_use(void *private_data, structmutex_lock (&emu->register_mutex);snd_emux_init_port (p); -snd_emux_inc_count (emu); +__snd_emux_inc_count (emu);mutex_unlock (&emu->register_mutex);return 0 ; }
@@ -338,7 +353,7 @@ snd_emux_unuse(void *private_data, strucmutex_lock (&emu->register_mutex);snd_emux_sounds_off_all (p); -snd_emux_dec_count (emu); +__snd_emux_dec_count (emu);mutex_unlock (&emu->register_mutex);return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 32/72 ALSA: emu10k1: Fix card shortname string buffer overflow
In reply to Greg Kroah-Hartman4.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit d02260824e2cad626fb2a9d62e27006d34b6dedc upstream.
Some models provide too long string for the shortname that has 32bytes including the terminator, and it results in a non-terminated string exposed to the user-space. This isn't too critical, though, as the string is stopped at the succeeding longname string.
This patch fixes such entries by dropping "SB" prefix (it's enough to fit within 32 bytes, so far). Meanwhile, it also changes strcpy() with strlcpy() to make sure that this kind of problem won't happen in future, too.
--- sound/pci/emu10k1/emu10k1.c | 6 ++++-- sound/pci/emu10k1/emu10k1_main.c | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-)
sound/pci/emu10k1/emu10k1.c +4 -2
@@ -183,8 +183,10 @@ static int snd_card_emu10k1_probe(struct }#endif -strcpy (card->driver, emu->card_capabilities->driver); -strcpy (card->shortname, emu->card_capabilities->name); +strlcpy (card->driver, emu->card_capabilities->driver, +sizeof (card->driver)); +strlcpy (card->shortname, emu->card_capabilities->name, +sizeof (card->shortname));snprintf (card->longname,sizeof (card->longname),"%s (rev.%d, serial:0x%x) at 0x%lx, irq %i" , card->shortname, emu->revision, emu->serial, emu->port, emu->irq);
sound/pci/emu10k1/emu10k1_main.c +2 -2
@@ -1421,7 +1421,7 @@ static struct snd_emu_chip_details emu_c* */ {.vendor = 0x1102, .device = 0x0008, .subsystem = 0x20011102, - .driver = "Audigy2", .name = "SB Audigy 2 ZS Notebook [SB0530]", + .driver = "Audigy2", .name = "Audigy 2 ZS Notebook [SB0530]", .id = "Audigy2", .emu10k2_chip = 1, .ca0108_chip = 1,
@@ -1571,7 +1571,7 @@ static struct snd_emu_chip_details emu_c .adc_1361t = 1, /* 24 bit capture instead of 16bit */ .ac97_chip = 1} , {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x10051102, - .driver = "Audigy2", .name = "SB Audigy 2 Platinum EX [SB0280]", + .driver = "Audigy2", .name = "Audigy 2 Platinum EX [SB0280]", .id = "Audigy2", .emu10k2_chip = 1, .ca0102_chip = 1,
Greg Kroah-Hartman
maintainerPATCH 33/72 ALSA: emu10k1: Emu10k2 32 bit DMA mode
In reply to Greg Kroah-Hartman4.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Zubaj <[email protected]>
commit 7241ea558c6715501e777396b5fc312c372e11d9 upstream.
Looks like audigy emu10k2 (probably emu10k1 - sb live too) support two modes for DMA. Second mode is useful for 64 bit os with more then 2 GB of ram (fixes problems with big soundfont loading)
1) 32MB from 2 GB address space using 8192 pages (used now as default)
2) 16MB from 4 GB address space using 4096 pages
Mode is set using HCFG_EXPANDED_MEM flag in HCFG register. Also format of emu10k2 page table is then different.
--- include/sound/emu10k1.h | 14 +++++++++----- sound/pci/emu10k1/emu10k1_callback.c | 4 ++-- sound/pci/emu10k1/emu10k1_main.c | 17 ++++++++++++----- sound/pci/emu10k1/emupcm.c | 2 +- sound/pci/emu10k1/memory.c | 11 ++++++----- 5 files changed, 30 insertions(+), 18 deletions(-)
include/sound/emu10k1.h +9 -5
@@ -41,7 +41,8 @@#define EMUPAGESIZE 4096#define MAXREQVOICES 8 -#define MAXPAGES 8192 +#define MAXPAGES0 4096/* 32 bit mode */ +#define MAXPAGES1 8192/* 31 bit mode */ #define RESERVED 0#define NUM_MIDI 16#define NUM_G 64/* use all channels */
@@ -50,8 +51,7 @@/* FIXME? - according to the OSS driver the EMU10K1 needs a 29 bit DMA mask */ #define EMU10K1_DMA_MASK 0x7fffffffUL/* 31bit */ -#define AUDIGY_DMA_MASK 0x7fffffffUL/* 31bit FIXME - 32 should work? */ -/* See ALSA bug #1276 - rlrevell */ +#define AUDIGY_DMA_MASK 0xffffffffUL/* 32bit mode */ #define TMEMSIZE 256*1024#define TMEMSIZEREG 4
@@ -466,8 +466,11 @@#define MAPB 0x0d/* Cache map B */ -#define MAP_PTE_MASK 0xffffe000/* The 19 MSBs of the PTE indexed by the PTI */ -#define MAP_PTI_MASK 0x00001fff/* The 13 bit index to one of the 8192 PTE dwords */ +#define MAP_PTE_MASK0 0xfffff000/* The 20 MSBs of the PTE indexed by the PTI */ +#define MAP_PTI_MASK0 0x00000fff/* The 12 bit index to one of the 4096 PTE dwords */ + +#define MAP_PTE_MASK1 0xffffe000/* The 19 MSBs of the PTE indexed by the PTI */ +#define MAP_PTI_MASK1 0x00001fff/* The 13 bit index to one of the 8192 PTE dwords */ /* 0x0e, 0x0f: Not used */
@@ -1704,6 +1707,7 @@ struct snd_emu10k1 {unsigned short model;/* subsystem id */ unsigned int card_type;/* EMU10K1_CARD_* */ unsigned int ecard_ctrl;/* ecard control bits */ +unsigned int address_mode;/* address mode */ unsigned long dma_mask;/* PCI DMA mask */ unsigned int delay_pcm_irq;/* in samples */ int max_cache_pages;/* max memory size / PAGE_SIZE */
sound/pci/emu10k1/emu10k1_callback.c +2 -2
@@ -415,7 +415,7 @@ start_voice(struct snd_emux_voice *vp)snd_emu10k1_ptr_write (hw,Z2 , ch,0 );/* invalidate maps */ - temp = (hw->silent_page.addr <<1 ) |MAP_PTI_MASK ; + temp = (hw->silent_page.addr << hw->address_mode) | (hw->address_mode ?MAP_PTI_MASK1 :MAP_PTI_MASK0 );snd_emu10k1_ptr_write (hw,MAPA , ch, temp);snd_emu10k1_ptr_write (hw,MAPB , ch, temp);#if 0
@@ -436,7 +436,7 @@ start_voice(struct snd_emux_voice *vp)snd_emu10k1_ptr_write (hw,CDF , ch, sample);/* invalidate maps */ - temp = ((unsigned int )hw->silent_page.addr <<1 ) |MAP_PTI_MASK ; + temp = ((unsigned int )hw->silent_page.addr << hw_address_mode) | (hw->address_mode ?MAP_PTI_MASK1 :MAP_PTI_MASK0 );snd_emu10k1_ptr_write (hw,MAPA , ch, temp);snd_emu10k1_ptr_write (hw,MAPB , ch, temp);
sound/pci/emu10k1/emu10k1_main.c +12 -5
@@ -282,7 +282,7 @@ static int snd_emu10k1_init(struct snd_esnd_emu10k1_ptr_write (emu,TCB ,0 ,0 );/* taken from original driver */ snd_emu10k1_ptr_write (emu,TCBS ,0 ,4 );/* taken from original driver */ - silent_page = (emu->silent_page.addr <<1 ) |MAP_PTI_MASK ; + silent_page = (emu->silent_page.addr << emu->address_mode) | (emu->address_mode ?MAP_PTI_MASK1 :MAP_PTI_MASK0 );for (ch =0 ; ch <NUM_G ; ch++) {snd_emu10k1_ptr_write (emu,MAPA , ch, silent_page);snd_emu10k1_ptr_write (emu,MAPB , ch, silent_page);
@@ -348,6 +348,11 @@ static int snd_emu10k1_init(struct snd_eoutl (reg |A_IOCFG_GPOUT0 , emu->port +A_IOCFG ); } +if (emu->address_mode ==0 ) { +/* use 16M in 4G */ +outl (inl (emu->port +HCFG ) |HCFG_EXPANDED_MEM , emu->port +HCFG ); + } +return 0 ; }
@@ -1877,8 +1882,10 @@ int snd_emu10k1_create(struct snd_card * is_audigy = emu->audigy = c->emu10k2_chip; +/* set addressing mode */ + emu->address_mode = is_audigy ?0 :1 ;/* set the DMA transfer mask */ - emu->dma_mask = is_audigy ?AUDIGY_DMA_MASK :EMU10K1_DMA_MASK ; + emu->dma_mask = emu->address_mode ?EMU10K1_DMA_MASK :AUDIGY_DMA_MASK ;if (pci_set_dma_mask (pci, emu->dma_mask) <0 ||pci_set_consistent_dma_mask (pci, emu->dma_mask) <0 ) { dev_err(card->dev,
@@ -1903,7 +1910,7 @@ int snd_emu10k1_create(struct snd_card * emu->max_cache_pages = max_cache_bytes >>PAGE_SHIFT ;if (snd_dma_alloc_pages (SNDRV_DMA_TYPE_DEV ,snd_dma_pci_data (pci), -32 *1024 , &emu->ptb_pages) <0 ) { + (emu->address_mode ?32 :16 ) *1024 , &emu->ptb_pages) <0 ) { err = -ENOMEM ; goto error; }
@@ -2002,8 +2009,8 @@ int snd_emu10k1_create(struct snd_card */* Clear silent pages and set up pointers */ memset (emu->silent_page.area,0 ,PAGE_SIZE ); - silent_page = emu->silent_page.addr <<1 ; -for (idx =0 ; idx <MAXPAGES ; idx++) + silent_page = emu->silent_page.addr << emu->address_mode; +for (idx =0 ; idx < (emu->address_mode ?MAXPAGES1 :MAXPAGES0 ); idx++) ((u32 *)emu->ptb_pages.area)[idx] =cpu_to_le32 (silent_page | idx);/* set up voice indices */
sound/pci/emu10k1/emupcm.c +1 -1
@@ -380,7 +380,7 @@ static void snd_emu10k1_pcm_init_voice(ssnd_emu10k1_ptr_write (emu,Z1 , voice,0 );snd_emu10k1_ptr_write (emu,Z2 , voice,0 );/* invalidate maps */ - silent_page = ((unsigned int )emu->silent_page.addr <<1 ) |MAP_PTI_MASK ; + silent_page = ((unsigned int )emu->silent_page.addr << emu->address_mode) | (emu->address_mode ?MAP_PTI_MASK1 :MAP_PTI_MASK0 );snd_emu10k1_ptr_write (emu,MAPA , voice, silent_page);snd_emu10k1_ptr_write (emu,MAPB , voice, silent_page);/* modulation envelope */
sound/pci/emu10k1/memory.c +6 -5
@@ -34,10 +34,11 @@* aligned pages in others */ #define __set_ptb_entry (emu,page,addr) \ - (((u32 *)(emu)->ptb_pages.area)[page] = cpu_to_le32(((addr) << 1) | (page))) + (((u32 *)(emu)->ptb_pages.area)[page] = cpu_to_le32(((addr) << (emu->address_mode)) | (page)))#define UNIT_PAGES (PAGE_SIZE / EMUPAGESIZE) -#define MAX_ALIGN_PAGES (MAXPAGES / UNIT_PAGES) +#define MAX_ALIGN_PAGES0 (MAXPAGES0 / UNIT_PAGES) +#define MAX_ALIGN_PAGES1 (MAXPAGES1 / UNIT_PAGES)/* get aligned page from offset address */ #define get_aligned_page (offset) ((offset) >> PAGE_SHIFT)/* get offset address from aligned page */
@@ -124,7 +125,7 @@ static int search_empty_map_area(struct } page = blk->mapped_page + blk->pages; } - size =MAX_ALIGN_PAGES - page; + size = (emu->address_mode ?MAX_ALIGN_PAGES1 :MAX_ALIGN_PAGES0 ) - page;if (size >= max_size) { *nextp = pos;return page;
@@ -181,7 +182,7 @@ static int unmap_memblk(struct snd_emu10 q =get_emu10k1_memblk (p, mapped_link); end_page = q->mapped_page; }else - end_page =MAX_ALIGN_PAGES ; + end_page = (emu->address_mode ?MAX_ALIGN_PAGES1 :MAX_ALIGN_PAGES0 );/* remove links */ list_del (&blk->mapped_link);
@@ -307,7 +308,7 @@ snd_emu10k1_alloc_pages(struct snd_emu10if (snd_BUG_ON (!emu))return NULL ;if (snd_BUG_ON (runtime->dma_bytes <=0 || - runtime->dma_bytes >=MAXPAGES *EMUPAGESIZE )) + runtime->dma_bytes >= (emu->address_mode ?MAXPAGES1 :MAXPAGES0 ) *EMUPAGESIZE ))return NULL ; hdr = emu->memhdr;if (snd_BUG_ON (!hdr))
Greg Kroah-Hartman
maintainerPATCH 36/72 cdc-acm: prevent infinite loop when parsing CDC headers.
In reply to Greg Kroah-Hartman4.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Quentin Casasnovas <[email protected]>
commit 0d3bba0287d4e284c3ec7d3397e81eec920d5e7e upstream.
Phil and I found out a problem with commit:
7e860a6e7aa6 ("cdc-acm: add sanity checks")
It added some sanity checks to ignore potential garbage in CDC headers but also introduced a potential infinite loop. This can happen at the first loop iteration (elength = 0 in that case) if the description isn't a DT_CS_INTERFACE or later if 'buffer[0]' is zero.
It should also be noted that the wrong length was being added to 'buffer' in case 'buffer[1]' was not a DT_CS_INTERFACE descriptor, since elength was assigned after that check in the loop.
A specially crafted USB device could be used to trigger this infinite loop.
--- drivers/usb/class/cdc-acm.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/usb/class/cdc-acm.c +6 -1
@@ -1133,11 +1133,16 @@ static int acm_probe(struct usb_interfac }while (buflen >0 ) { + elength = buffer[0 ]; +if (!elength) { +dev_err (&intf->dev,"skipping garbage byte\n" ); + elength =1 ; + goto next_desc; + }if (buffer[1 ] !=USB_DT_CS_INTERFACE ) {dev_err (&intf->dev,"skipping garbage\n" ); goto next_desc; } - elength = buffer[0 ];switch (buffer[2 ]) {case USB_CDC_UNION_TYPE :/* we've found it */
Greg Kroah-Hartman
maintainerPATCH 37/72 serial: of-serial: Remove device_type = "serial" registration
In reply to Greg Kroah-Hartman4.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Simek <[email protected]>
commit 6befa9d883385c580369a2cc9e53fbf329771f6d upstream.
Do not probe all serial drivers by of_serial.c which are using device_type = "serial"; property. Only drivers which have valid compatible strings listed in the driver should be probed.
When PORT_UNKNOWN is setup probe will fail anyway.
Arnd quotation about driver historical background:
"when I wrote that driver initially, the idea was that it would get used as a stub to hook up all other serial drivers but after that, the common code learned to create platform devices from DT"
This patch fix the problem with on the system with xilinx_uartps and 16550a where of_serial failed to register for xilinx_uartps and because of irq_dispose_mapping() removed irq_desc. Then when xilinx_uartps was asking for irq with request_irq() EINVAL is returned.
--- drivers/tty/serial/of_serial.c | 1 - 1 file changed, 1 deletion(-)
drivers/tty/serial/of_serial.c +0 -1
@@ -344,7 +344,6 @@ static struct of_device_id of_platform_s { .compatible = "ibm,qpace-nwp-serial", .data = (void *)PORT_NWPSERIAL, }, #endif - { .type = "serial", .data = (void *)PORT_UNKNOWN, }, { /* end of list */ }, };
Greg Kroah-Hartman
maintainerPATCH 38/72 serial: xilinx: Use platform_get_irq to get irq description structure
In reply to Greg Kroah-Hartman4.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Simek <[email protected]>
commit 5c90c07b98c02198d9777a7c4f3047b0a94bf7ed upstream.
For systems with CONFIG_SERIAL_OF_PLATFORM=y and device_type = "serial"; property in DT of_serial.c driver maps and unmaps IRQ (because driver probe fails). Then a driver is called but irq mapping is not created that's why driver is failing again in again on request_irq(). Based on this use platform_get_irq() instead of platform_get_resource() which is doing irq_desc allocation and driver itself can request IRQ.
Fix both xilinx serial drivers in the tree.
--- drivers/tty/serial/uartlite.c | 11 ++++++----- drivers/tty/serial/xilinx_uartps.c | 12 ++++++------ 2 files changed, 12 insertions(+), 11 deletions(-)
drivers/tty/serial/uartlite.c +6 -5
@@ -632,7 +632,8 @@ MODULE_DEVICE_TABLE(of, ulite_of_match);static int ulite_probe (struct platform_device *pdev) { -struct resource *res, *res2; +struct resource *res; +int irq;int id = pdev->id;#ifdef CONFIG_OF const __be32 *prop;
@@ -646,11 +647,11 @@ static int ulite_probe(struct platform_dif (!res)return -ENODEV ; - res2 =platform_get_resource (pdev,IORESOURCE_IRQ ,0 ); -if (!res2) -return -ENODEV ; + irq =platform_get_irq (pdev,0 ); +if (irq <=0 ) +return -ENXIO ; -return ulite_assign (&pdev->dev, id, res->start, res2->start); +return ulite_assign (&pdev->dev, id, res->start, irq); }static int ulite_remove (struct platform_device *pdev)
drivers/tty/serial/xilinx_uartps.c +6 -6
@@ -1325,9 +1325,9 @@ static SIMPLE_DEV_PM_OPS(cdns_uart_dev_p*/ static int cdns_uart_probe (struct platform_device *pdev) { -int rc, id; +int rc, id, irq;struct uart_port *port; -struct resource *res, *res2; +struct resource *res;struct cdns_uart *cdns_uart_data; cdns_uart_data = devm_kzalloc(&pdev->dev, sizeof(*cdns_uart_data),
@@ -1374,9 +1374,9 @@ static int cdns_uart_probe(struct platfo goto err_out_clk_disable; } - res2 =platform_get_resource (pdev,IORESOURCE_IRQ ,0 ); -if (!res2) { - rc = -ENODEV ; + irq =platform_get_irq (pdev,0 ); +if (irq <=0 ) { + rc = -ENXIO ; goto err_out_clk_disable; }
@@ -1405,7 +1405,7 @@ static int cdns_uart_probe(struct platfo* and triggers invocation of the config_port() entry point. */ port->mapbase = res->start; - port->irq = res2->start; + port->irq = irq; port->dev = &pdev->dev; port->uartclk =clk_get_rate (cdns_uart_data->uartclk); port->private_data = cdns_uart_data;
Greg Kroah-Hartman
maintainerPATCH 39/72 arm64: dma-mapping: always clear allocated buffers
In reply to Greg Kroah-Hartman4.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marek Szyprowski <[email protected]>
commit 6829e274a623187c24f7cfc0e3d35f25d087fcc5 upstream.
Buffers allocated by dma_alloc_coherent() are always zeroed on Alpha, ARM (32bit), MIPS, PowerPC, x86/x86_64 and probably other architectures. It turned out that some drivers rely on this 'feature'. Allocated buffer might be also exposed to userspace with dma_mmap() call, so clearing it is desired from security point of view to avoid exposing random memory to userspace. This patch unifies dma_alloc_coherent() behavior on ARM64 architecture with other implementations by unconditionally zeroing allocated buffer.
--- arch/arm64/mm/dma-mapping.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
arch/arm64/mm/dma-mapping.c +2 -4
@@ -67,8 +67,7 @@ static void *__alloc_from_pool(size_t si *ret_page =phys_to_page (phys); ptr = (void *)val; -if (flags & __GFP_ZERO) -memset (ptr,0 , size); +memset (ptr,0 , size); }return ptr;
@@ -113,8 +112,7 @@ static void *__dma_alloc_coherent(struct *dma_handle =phys_to_dma (dev,page_to_phys (page)); addr =page_address (page); -if (flags & __GFP_ZERO) -memset (addr,0 , size); +memset (addr,0 , size);return addr; }else {return swiotlb_alloc_coherent (dev, size, dma_handle, flags);
Greg Kroah-Hartman
maintainerPATCH 40/72 arm64: add missing PAGE_ALIGN() to __dma_free()
In reply to Greg Kroah-Hartman4.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dean Nelson <[email protected]>
commit 2cff98b99c469880ce830cbcde015b53b67e0a7b upstream.
__dma_alloc() does a PAGE_ALIGN() on the passed in size argument before doing anything else. __dma_free() does not. And because it doesn't, it is possible to leak memory should size not be an integer multiple of PAGE_SIZE.
The solution is to add a PAGE_ALIGN() to __dma_free() like is done in __dma_alloc().
Additionally, this patch removes a redundant PAGE_ALIGN() from __dma_alloc_coherent(), since __dma_alloc_coherent() can only be called from __dma_alloc(), which already does a PAGE_ALIGN() before the call.
--- arch/arm64/mm/dma-mapping.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm64/mm/dma-mapping.c +2 -1
@@ -104,7 +104,6 @@ static void *__dma_alloc_coherent(structstruct page *page;void *addr; - size =PAGE_ALIGN (size); page =dma_alloc_from_contiguous (dev, size >>PAGE_SHIFT ,get_order (size));if (!page)
@@ -193,6 +192,8 @@ static void __dma_free(struct device *de {void *swiotlb_addr =phys_to_virt (dma_to_phys (dev, dma_handle)); + size =PAGE_ALIGN (size); +if (!is_device_dma_coherent (dev)) {if (__free_from_pool (vaddr, size))return ;
Greg Kroah-Hartman
maintainerPATCH 41/72 usb: chipidea: otg: remove mutex unlock and lock while stop and start role
In reply to Greg Kroah-Hartman4.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Li Jun <[email protected]>
commit a5a356cee89f86ff86cc3ce24136ca1f802c1bf1 upstream.
Wrongly release mutex lock during otg_statemachine may result in re-enter otg_statemachine, which is not allowed, we should do next state transtition after previous one completed.
--- drivers/usb/chipidea/otg_fsm.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/usb/chipidea/otg_fsm.c +0 -4
@@ -537,7 +537,6 @@ static int ci_otg_start_host(struct otg_ { struct ci_hdrc *ci = container_of(fsm, struct ci_hdrc, fsm); -mutex_unlock (&fsm->lock);if (on) {ci_role_stop (ci);ci_role_start (ci,CI_ROLE_HOST );
@@ -546,7 +545,6 @@ static int ci_otg_start_host(struct otg_hw_device_reset (ci);ci_role_start (ci,CI_ROLE_GADGET ); } -mutex_lock (&fsm->lock);return 0 ; }
@@ -554,12 +552,10 @@ static int ci_otg_start_gadget(struct ot { struct ci_hdrc *ci = container_of(fsm, struct ci_hdrc, fsm); -mutex_unlock (&fsm->lock);if (on)usb_gadget_vbus_connect (&ci->gadget);else usb_gadget_vbus_disconnect (&ci->gadget); -mutex_lock (&fsm->lock);return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 42/72 ASoC: samsung: s3c24xx-i2s: Fix return value check in s3c24xx_iis_dev_probe()
In reply to Greg Kroah-Hartman4.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wei Yongjun <[email protected]>
commit c479163a1b6ab424786fbcd9225b4e3c1c58eb0b upstream.
In case of error, the function devm_ioremap_resource() returns ERR_PTR() and never returns NULL. The NULL test in the return value check should be replaced with IS_ERR().
--- sound/soc/samsung/s3c24xx-i2s.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/samsung/s3c24xx-i2s.c +2 -2
@@ -461,8 +461,8 @@ static int s3c24xx_iis_dev_probe(structreturn -ENOENT ; } s3c24xx_i2s.regs =devm_ioremap_resource (&pdev->dev, res); -if (s3c24xx_i2s.regs ==NULL ) -return -ENXIO ; +if (IS_ERR (s3c24xx_i2s.regs)) +return PTR_ERR (s3c24xx_i2s.regs); s3c24xx_i2s_pcm_stereo_out.dma_addr = res->start +S3C2410_IISFIFO ; s3c24xx_i2s_pcm_stereo_in.dma_addr = res->start +S3C2410_IISFIFO ;
Greg Kroah-Hartman
maintainerPATCH 43/72 ASoC: tfa9879: Fix return value check in tfa9879_i2c_probe()
In reply to Greg Kroah-Hartman4.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wei Yongjun <[email protected]>
commit 427ced4b203dfea4f08b1298cd1f88e19039fca4 upstream.
In case of error, the function devm_kzalloc() returns NULL not ERR_PTR(). The IS_ERR() test in the return value check should be replaced with NULL test.
--- sound/soc/codecs/tfa9879.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/codecs/tfa9879.c +2 -2
@@ -280,8 +280,8 @@ static int tfa9879_i2c_probe(struct i2c_int i; tfa9879 =devm_kzalloc (&i2c->dev,sizeof (*tfa9879),GFP_KERNEL ); -if (IS_ERR (tfa9879)) -return PTR_ERR (tfa9879); +if (!tfa9879) +return -ENOMEM ;i2c_set_clientdata (i2c, tfa9879);
Greg Kroah-Hartman
maintainerPATCH 44/72 ASoC: rt5677: add register patch for PLL
In reply to Greg Kroah-Hartman4.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bard Liao <[email protected]>
commit 74d6ea52aeef0236242221c6eff6d892565c5a92 upstream.
The PLL output will be unstable in some cases. We can fix it by setting some registers.
--- sound/soc/codecs/rt5677.c | 3 +++ 1 file changed, 3 insertions(+)
sound/soc/codecs/rt5677.c +3 -0
@@ -62,6 +62,9 @@ static const struct reg_default init_lis {RT5677_PR_BASE + 0x1e, 0x0000}, {RT5677_PR_BASE + 0x12, 0x0eaa}, {RT5677_PR_BASE + 0x14, 0x018a}, + {RT5677_PR_BASE + 0x15, 0x0490}, + {RT5677_PR_BASE + 0x38, 0x0f71}, + {RT5677_PR_BASE + 0x39, 0x0f71}, };#define RT5677_INIT_REG_LEN ARRAY_SIZE(init_list)
Greg Kroah-Hartman
maintainerPATCH 45/72 ASoC: dapm: Enable autodisable on SOC_DAPM_SINGLE_TLV_AUTODISABLE
In reply to Greg Kroah-Hartman4.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Charles Keepax <[email protected]>
commit a2d97723cb3a7741af81868427b36bba274b681b upstream.
Correct small copy and paste error where autodisable was not being enabled for the SOC_DAPM_SINGLE_TLV_AUTODISABLE control.
--- include/sound/soc-dapm.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/sound/soc-dapm.h +1 -1
@@ -287,7 +287,7 @@ struct device; .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | SNDRV_CTL_ELEM_ACCESS_READWRITE,\ .tlv.p = (tlv_array), \ .get = snd_soc_dapm_get_volsw, .put = snd_soc_dapm_put_volsw, \ - .private_value = SOC_SINGLE_VALUE(reg, shift, max, invert, 0) } + .private_value = SOC_SINGLE_VALUE(reg, shift, max, invert, 1) }#define SOC_DAPM_SINGLE_TLV_VIRT (xname, max, tlv_array) \ SOC_DAPM_SINGLE(xname, SND_SOC_NOPM, 0, max, 0, tlv_array)#define SOC_DAPM_ENUM (xname, xenum) \
Greg Kroah-Hartman
maintainerPATCH 46/72 ASoC: rt5677: fixed wrong DMIC ref clock
In reply to Greg Kroah-Hartman4.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bard Liao <[email protected]>
commit 60a8d62b8497c23eb3d48149af7e55dac2dd83a2 upstream.
DMIC clock source is not from codec system clock directly. it is generated from the division of system clock. And it should be 256 * sample rate of AIF1.
--- sound/soc/codecs/rt5677.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/rt5677.c +1 -1
@@ -904,7 +904,7 @@ static int set_dmic_clk(struct snd_soc_d {struct snd_soc_codec *codec =snd_soc_dapm_to_codec (w->dapm);struct rt5677_priv *rt5677 =snd_soc_codec_get_drvdata (codec); -int idx =rl6231_calc_dmic_clk (rt5677->sysclk); +int idx =rl6231_calc_dmic_clk (rt5677->lrck[RT5677_AIF1 ] <<8 );if (idx <0 )dev_err (codec->dev,"Failed to set DMIC clock\n" );
Greg Kroah-Hartman
maintainerPATCH 47/72 btrfs: unlock i_mutex after attempting to delete subvolume during send
In reply to Greg Kroah-Hartman4.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Omar Sandoval <[email protected]>
commit 909e26dce3f7600f5e293ac0522c28790a0c8c9c upstream.
Whenever the check for a send in progress introduced in commit 521e0546c970 (btrfs: protect snapshots from deleting during send) is hit, we return without unlocking inode->i_mutex. This is easy to see with lockdep enabled:
[ +0.000059] ================================================
[ +0.000028] [ BUG: lock held when returning to user space! ]
[ +0.000029] 4.0.0-rc5-00096-g3c435c1 #93 Not tainted
[ +0.000026] ------------------------------------------------
[ +0.000029] btrfs/211 is leaving the kernel with locks still held!
[ +0.000029] 1 lock held by btrfs/211:
[ +0.000023] #0: (&type->i_mutex_dir_key){+.+.+.}, at: [<ffffffff8135b8df>] btrfs_ioctl_snap_destroy+0x2df/0x7a0Make sure we unlock it in the error path.
--- fs/btrfs/ioctl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/btrfs/ioctl.c +2 -1
@@ -2403,7 +2403,7 @@ static noinline int btrfs_ioctl_snap_des"Attempt to delete subvolume %llu during send" , dest->root_key.objectid); err = -EPERM ; - goto out_dput; + goto out_unlock_inode; }d_invalidate (dentry);
@@ -2498,6 +2498,7 @@ out_up_write: root_flags & ~BTRFS_ROOT_SUBVOL_DEAD);spin_unlock (&dest->root_item_lock); } +out_unlock_inode:mutex_unlock (&inode->i_mutex);if (!err) {shrink_dcache_sb (root->fs_info->sb);
Greg Kroah-Hartman
maintainerPATCH 48/72 ACPI / SBS: Enable battery manager when present
In reply to Greg Kroah-Hartman4.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chris Bainbridge <[email protected]>
commit 61f8ff693923e4b19748b0e8287b99778f2661c7 upstream.
Commit 9faf6136ff46 (ACPI / SBS: Disable smart battery manager on Apple) introduced a regression disabling the SBS battery manager. The battery manager should be marked as present when acpi_manager_get_info() returns 0.
--- drivers/acpi/sbs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/acpi/sbs.c +1 -1
@@ -670,7 +670,7 @@ static int acpi_sbs_add(struct acpi_deviif (!sbs_manager_broken) { result =acpi_manager_get_info (sbs);if (!result) { - sbs->manager_present =0 ; + sbs->manager_present =1 ;for (id =0 ; id <MAX_SBS_BAT ; ++id)if ((sbs->batteries_supported & (1 << id)))acpi_battery_add (sbs, id);
Greg Kroah-Hartman
maintainerPATCH 49/72 tty/serial: at91: maxburst was missing for dma transfers
In reply to Greg Kroah-Hartman4.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ludovic Desroches <[email protected]>
commit a8d4e01637902311c5643b69a5c80e2805f04054 upstream.
Maxburst was not set when doing the dma slave configuration. This value is checked by the recently introduced xdmac. It causes an error when doing the slave configuration and so prevents from using dma.
--- drivers/tty/serial/atmel_serial.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/tty/serial/atmel_serial.c +2 -0
@@ -880,6 +880,7 @@ static int atmel_prepare_tx_dma(struct u config.direction =DMA_MEM_TO_DEV ; config.dst_addr_width =DMA_SLAVE_BUSWIDTH_1_BYTE ; config.dst_addr = port->mapbase +ATMEL_US_THR ; + config.dst_maxburst =1 ; ret =dmaengine_slave_config (atmel_port->chan_tx, &config);
@@ -1059,6 +1060,7 @@ static int atmel_prepare_rx_dma(struct u config.direction =DMA_DEV_TO_MEM ; config.src_addr_width =DMA_SLAVE_BUSWIDTH_1_BYTE ; config.src_addr = port->mapbase +ATMEL_US_RHR ; + config.src_maxburst =1 ; ret =dmaengine_slave_config (atmel_port->chan_rx, &config);
Greg Kroah-Hartman
maintainerPATCH 50/72 rbd: end I/O the entire obj_request on error
In reply to Greg Kroah-Hartman4.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ilya Dryomov <[email protected]>
commit 082a75dad84d79d1c15ea9e50f31cb4bb4fa7fd6 upstream.
When we end I/O struct request with error, we need to pass obj_request->length as @nr_bytes so that the entire obj_request worth of bytes is completed. Otherwise block layer ends up confused and we trip on
rbd_assert(more ^ (which == img_request->obj_request_count));
in rbd_img_obj_callback() due to more being true no matter what. We already do it in most cases but we are missing some, in particular those where we don't even get a chance to submit any obj_requests, due to an early -ENOMEM for example.
A number of obj_request->xferred assignments seem to be redundant but I haven't touched any of obj_request->xferred stuff to keep this small and isolated.
--- drivers/block/rbd.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/block/rbd.c +5 -0
@@ -2264,6 +2264,11 @@ static bool rbd_img_obj_end_request(stru result, xferred);if (!img_request->result) img_request->result = result; +/* +* Need to end I/O on the entire obj_request worth of +* bytes in case of error. +*/ + xferred = obj_request->length; }/* Image object requests don't own their page array */
Greg Kroah-Hartman
maintainerPATCH 51/72 uas: Allow uas_use_uas_driver to return usb-storage flags
In reply to Greg Kroah-Hartman4.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
commit a5011d44f0e1117a6db14b19b57c51f8be5673a0 upstream.
uas_use_uas_driver may set some US_FL_foo flags during detection, currently these are stored in a local variable and then throw away, but these may be of interest to the caller, so add an extra parameter to (optionally) return the detected flags, and use this in the uas driver.
--- drivers/usb/storage/uas-detect.h | 6 +++++- drivers/usb/storage/uas.c | 6 +++--- drivers/usb/storage/usb.c | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-)
drivers/usb/storage/uas-detect.h +5 -1
@@ -51,7 +51,8 @@ static int uas_find_endpoints(struct usb }static int uas_use_uas_driver (struct usb_interface *intf, -const struct usb_device_id *id) +const struct usb_device_id *id, +unsigned long *flags_ret) {struct usb_host_endpoint *eps[4 ] = { };struct usb_device *udev =interface_to_usbdev (intf);
@@ -132,5 +133,8 @@ static int uas_use_uas_driver(struct usbreturn 0 ; } +if (flags_ret) + *flags_ret = flags; +return 1 ; }
drivers/usb/storage/uas.c +3 -3
@@ -887,8 +887,9 @@ static int uas_probe(struct usb_interfacstruct Scsi_Host *shost =NULL ;struct uas_dev_info *devinfo;struct usb_device *udev =interface_to_usbdev (intf); +unsigned long dev_flags; -if (!uas_use_uas_driver (intf, id)) +if (!uas_use_uas_driver (intf, id, &dev_flags))return -ENODEV ;if (uas_switch_interface (udev, intf))
@@ -910,8 +911,7 @@ static int uas_probe(struct usb_interfac devinfo->udev = udev; devinfo->resetting =0 ; devinfo->shutdown =0 ; - devinfo->flags = id->driver_info; -usb_stor_adjust_quirks (udev, &devinfo->flags); + devinfo->flags = dev_flags;init_usb_anchor (&devinfo->cmd_urbs);init_usb_anchor (&devinfo->sense_urbs);init_usb_anchor (&devinfo->data_urbs);
drivers/usb/storage/usb.c +1 -1
@@ -1080,7 +1080,7 @@ static int storage_probe(struct usb_inte/* If uas is enabled and this device can do uas then ignore it. */ #if IS_ENABLED (CONFIG_USB_UAS ) -if (uas_use_uas_driver (intf, id)) +if (uas_use_uas_driver (intf, id,NULL ))return -ENXIO ;#endif
Greg Kroah-Hartman
maintainerPATCH 52/72 uas: Add US_FL_MAX_SECTORS_240 flag
In reply to Greg Kroah-Hartman4.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
commit ee136af4a064c2f61e2025873584d2c7ec93f4ae upstream.
The usb-storage driver sets max_sectors = 240 in its scsi-host template, for uas we do not want to do that for all devices, but testing has shown that some devices need it.
This commit adds a US_FL_MAX_SECTORS_240 flag for such devices, and implements support for it in uas.c, while at it it also adds support for US_FL_MAX_SECTORS_64 to uas.c.
--- Documentation/kernel-parameters.txt | 2 ++ drivers/usb/storage/uas.c | 10 +++++++++- drivers/usb/storage/usb.c | 6 +++++- include/linux/usb_usual.h | 2 ++ 4 files changed, 18 insertions(+), 2 deletions(-)
Documentation/kernel-parameters.txt +2 -0
@@ -3746,6 +3746,8 @@ bytes respectively. Such letter suffixes READ_CAPACITY_16 command); f = NO_REPORT_OPCODES (don't use report opcodes command, uas only); + g = MAX_SECTORS_240 (don't transfer more than + 240 sectors at a time, uas only); h = CAPACITY_HEURISTICS (decrease the reported device capacity by one sector if the number is odd);
drivers/usb/storage/uas.c +9 -1
@@ -759,7 +759,10 @@ static int uas_eh_bus_reset_handler(strustatic int uas_slave_alloc (struct scsi_device *sdev) { - sdev->hostdata = (void *)sdev->host->hostdata; +struct uas_dev_info *devinfo = + (struct uas_dev_info *)sdev->host->hostdata; + + sdev->hostdata = devinfo;/* USB has unusual DMA-alignment requirements: Although the * starting address of each scatter-gather element doesn't matter,
@@ -778,6 +781,11 @@ static int uas_slave_alloc(struct scsi_d*/ blk_queue_update_dma_alignment (sdev->request_queue, (512 -1 )); +if (devinfo->flags &US_FL_MAX_SECTORS_64 ) +blk_queue_max_hw_sectors (sdev->request_queue,64 ); +else if (devinfo->flags &US_FL_MAX_SECTORS_240 ) +blk_queue_max_hw_sectors (sdev->request_queue,240 ); +return 0 ; }
drivers/usb/storage/usb.c +5 -1
@@ -479,7 +479,8 @@ void usb_stor_adjust_quirks(struct usb_dUS_FL_SINGLE_LUN |US_FL_NO_WP_DETECT |US_FL_NO_READ_DISC_INFO |US_FL_NO_READ_CAPACITY_16 |US_FL_INITIAL_READ10 |US_FL_WRITE_CACHE | - US_FL_NO_ATA_1X | US_FL_NO_REPORT_OPCODES); +US_FL_NO_ATA_1X |US_FL_NO_REPORT_OPCODES | + US_FL_MAX_SECTORS_240); p = quirks;while (*p) {
@@ -520,6 +521,9 @@ void usb_stor_adjust_quirks(struct usb_dcase 'f' : f |=US_FL_NO_REPORT_OPCODES ;break ; +case 'g' : + f |=US_FL_MAX_SECTORS_240 ; +break ;case 'h' : f |=US_FL_CAPACITY_HEURISTICS ;break ;
include/linux/usb_usual.h +2 -0
@@ -77,6 +77,8 @@/* Cannot handle ATA_12 or ATA_16 CDBs */ \US_FLAG (NO_REPORT_OPCODES ,0x04000000 ) \ /* Cannot handle MI_REPORT_SUPPORTED_OPERATION_CODES */ \ +US_FLAG (MAX_SECTORS_240 ,0x08000000 ) \ + /* Sets max_sectors to 240 */ \#define US_FLAG (name, value) US_FL_##name = value ,enum {US_DO_ALL_FLAGS };
Greg Kroah-Hartman
maintainerPATCH 53/72 uas: Set max_sectors_240 quirk for ASM1053 devices
In reply to Greg Kroah-Hartman4.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
commit 8e779c6c4a398763c21371fe40f649206041dc1e upstream.
Testing has shown that ASM1053 devices do not work properly with transfers larger than 240 sectors, so set max_sectors to 240 on these.
--- drivers/usb/storage/uas-detect.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/usb/storage/uas-detect.h +4 -1
@@ -74,7 +74,7 @@ static int uas_use_uas_driver(struct usb* this writing the following versions exist: * ASM1051 - no uas support version * ASM1051 - with broken (*) uas support -* ASM1053 - with working uas support +* ASM1053 - with working uas support, but problems with large xfers * ASM1153 - with working uas support * * Devices with these chips re-use a number of device-ids over the
@@ -104,6 +104,9 @@ static int uas_use_uas_driver(struct usb }else if (usb_ss_max_streams (&eps[1 ]->ss_ep_comp) ==32 ) {/* Possibly an ASM1051, disable uas */ flags |=US_FL_IGNORE_UAS ; + }else { +/* ASM1053, these have issues with large transfers */ + flags |=US_FL_MAX_SECTORS_240 ; } }
Greg Kroah-Hartman
maintainerPATCH 54/72 ext4: fix data corruption caused by unwritten and delayed extents
In reply to Greg Kroah-Hartman4.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lukas Czerner <[email protected]>
commit d2dc317d564a46dfc683978a2e5a4f91434e9711 upstream.
Currently it is possible to lose whole file system block worth of data when we hit the specific interaction with unwritten and delayed extents in status extent tree.
The problem is that when we insert delayed extent into extent status tree the only way to get rid of it is when we write out delayed buffer. However there is a limitation in the extent status tree implementation so that when inserting unwritten extent should there be even a single delayed block the whole unwritten extent would be marked as delayed.
At this point, there is no way to get rid of the delayed extents, because there are no delayed buffers to write out. So when a we write into said unwritten extent we will convert it to written, but it still remains delayed.
When we try to write into that block later ext4_da_map_blocks() will set the buffer new and delayed and map it to invalid block which causes the rest of the block to be zeroed loosing already written data.
For now we can fix this by simply not allowing to set delayed status on written extent in the extent status tree. Also add WARN_ON() to make sure that we notice if this happens in the future.
This problem can be easily reproduced by running the following xfs_io.
xfs_io -f -c "pwrite -S 0xaa 4096 2048" \
-c "falloc 0 131072" \
-c "pwrite -S 0xbb 65536 2048" \
-c "fsync" /mnt/test/fffecho 3 > /proc/sys/vm/drop_cachesxfs_io -c "pwrite -S 0xdd 67584 2048" /mnt/test/fff
This can be theoretically also reproduced by at random by running fsx, but it's not very reliable, though on machines with bigger page size (like ppc) this can be seen more often (especially xfstest generic/127)
--- fs/ext4/extents_status.c | 8 ++++++++ fs/ext4/inode.c | 2 ++ 2 files changed, 10 insertions(+)
fs/ext4/extents_status.c +8 -0
@@ -705,6 +705,14 @@ int ext4_es_insert_extent(struct inode *BUG_ON (end < lblk); +if ((status &EXTENT_STATUS_DELAYED ) && + (status &EXTENT_STATUS_WRITTEN )) { +ext4_warning (inode->i_sb,"Inserting extent [%u/%u] as " +" delayed and written which can potentially " +" cause data loss.\n" , lblk, len); +WARN_ON (1 ); + } + newes.es_lblk = lblk; newes.es_len = len;ext4_es_store_pblock_status (&newes, pblk, status);
fs/ext4/inode.c +2 -0
@@ -534,6 +534,7 @@ int ext4_map_blocks(handle_t *handle, st status = map->m_flags &EXT4_MAP_UNWRITTEN ?EXTENT_STATUS_UNWRITTEN :EXTENT_STATUS_WRITTEN ;if (!(flags &EXT4_GET_BLOCKS_DELALLOC_RESERVE ) && + !(status &EXTENT_STATUS_WRITTEN ) &&ext4_find_delalloc_range (inode, map->m_lblk, map->m_lblk + map->m_len -1 )) status |=EXTENT_STATUS_DELAYED ;
@@ -638,6 +639,7 @@ found: status = map->m_flags &EXT4_MAP_UNWRITTEN ?EXTENT_STATUS_UNWRITTEN :EXTENT_STATUS_WRITTEN ;if (!(flags &EXT4_GET_BLOCKS_DELALLOC_RESERVE ) && + !(status &EXTENT_STATUS_WRITTEN ) &&ext4_find_delalloc_range (inode, map->m_lblk, map->m_lblk + map->m_len -1 )) status |=EXTENT_STATUS_DELAYED ;
Greg Kroah-Hartman
maintainerPATCH 55/72 ext4: move check under lock scope to close a race.
In reply to Greg Kroah-Hartman4.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Davide Italiano <[email protected]>
commit 280227a75b56ab5d35854f3a77ef74a7ad56a203 upstream.
fallocate() checks that the file is extent-based and returns EOPNOTSUPP in case is not. Other tasks can convert from and to indirect and extent so it's safe to check only after grabbing the inode mutex.
--- fs/ext4/extents.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)
fs/ext4/extents.c +8 -7
@@ -4934,13 +4934,6 @@ long ext4_fallocate(struct file *file, iif (ret)return ret; -/* -* currently supporting (pre)allocate mode for extent-based -* files _only_ -*/ -if (!(ext4_test_inode_flag (inode,EXT4_INODE_EXTENTS ))) -return -EOPNOTSUPP ; -if (mode &FALLOC_FL_COLLAPSE_RANGE )return ext4_collapse_range (inode, offset, len);
@@ -4962,6 +4955,14 @@ long ext4_fallocate(struct file *file, imutex_lock (&inode->i_mutex); +/* +* We only support preallocation for extent-based files only +*/ +if (!(ext4_test_inode_flag (inode,EXT4_INODE_EXTENTS ))) { + ret = -EOPNOTSUPP ; + goto out; + } +if (!(mode &FALLOC_FL_KEEP_SIZE ) && offset + len >i_size_read (inode)) { new_size = offset + len;
Greg Kroah-Hartman
maintainerPATCH 56/72 SCSI: add 1024 max sectors black list flag
In reply to Greg Kroah-Hartman4.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mike Christie <[email protected]>
commit 35e9a9f93994d7f7d12afa41169c7ba05513721b upstream.
This works around a issue with qnap iscsi targets not handling large IOs very well.
The target returns:
VPD INQUIRY: Block limits page (SBC)
Maximum compare and write length: 1 blocks Optimal transfer length granularity: 1 blocks Maximum transfer length: 4294967295 blocks Optimal transfer length: 4294967295 blocks Maximum prefetch, xdread, xdwrite transfer length: 0 blocks Maximum unmap LBA count: 8388607
Maximum unmap block descriptor count: 1
Optimal unmap granularity: 16383
Unmap granularity alignment valid: 0
Unmap granularity alignment: 0
Maximum write same length: 0xffffffff blocks Maximum atomic transfer length: 0
Atomic alignment: 0
Atomic transfer length granularity: 0
and it is *sometimes* able to handle at least one IO of size up to 8 MB. We have seen in traces where it will sometimes work, but other times it looks like it fails and it looks like it returns failures if we send multiple large IOs sometimes. Also it looks like it can return 2 different errors. It will sometimes send iscsi reject errors indicating out of resources or it will send invalid cdb illegal requests check conditions. And then when it sends iscsi rejects it does not seem to handle retries when there are command sequence holes, so I could not just add code to try and gracefully handle that error code.
The problem is that we do not have a good contact for the company, so we are not able to determine under what conditions it returns which error and why it sometimes works.
So, this patch just adds a new black list flag to set targets like this to the old max safe sectors of 1024. The max_hw_sectors changes added in 3.19 caused this regression, so I also ccing stable.
--- drivers/scsi/scsi_devinfo.c | 1 + drivers/scsi/scsi_scan.c | 6 ++++++ include/scsi/scsi_devinfo.h | 1 + 3 files changed, 8 insertions(+)
drivers/scsi/scsi_devinfo.c +1 -0
@@ -226,6 +226,7 @@ static struct { {"PIONEER", "CD-ROM DRM-624X", NULL, BLIST_FORCELUN | BLIST_SINGLELUN}, {"Promise", "VTrak E610f", NULL, BLIST_SPARSELUN | BLIST_NO_RSOC}, {"Promise", "", NULL, BLIST_SPARSELUN}, + {"QNAP", "iSCSI Storage", NULL, BLIST_MAX_1024}, {"QUANTUM", "XP34301", "1071", BLIST_NOTQ}, {"REGAL", "CDC-4X", NULL, BLIST_MAX5LUN | BLIST_SINGLELUN}, {"SanDisk", "ImageMate CF-SD1", NULL, BLIST_FORCELUN},
drivers/scsi/scsi_scan.c +6 -0
@@ -897,6 +897,12 @@ static int scsi_add_lun(struct scsi_devi*/ if (*bflags &BLIST_MAX_512 )blk_queue_max_hw_sectors (sdev->request_queue,512 ); +/* +* Max 1024 sector transfer length for targets that report incorrect +* max/optimal lengths and relied on the old block layer safe default +*/ +else if (*bflags &BLIST_MAX_1024 ) +blk_queue_max_hw_sectors (sdev->request_queue,1024 );/* * Some devices may not want to have a start command automatically
include/scsi/scsi_devinfo.h +1 -0
@@ -36,5 +36,6 @@for sequential scan */ #define BLIST_TRY_VPD_PAGES 0x10000000/* Attempt to read VPD pages */ #define BLIST_NO_RSOC 0x20000000/* don't try to issue RSOC */ +#define BLIST_MAX_1024 0x40000000/* maximum 1024 sector cdb length */ #endif
Greg Kroah-Hartman
maintainerPATCH 57/72 3w-xxxx: fix command completion race
In reply to Greg Kroah-Hartman4.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christoph Hellwig <[email protected]>
commit 9cd9554615cba14f0877cc9972a6537ad2bdde61 upstream.
The 3w-xxxx driver needs to tear down the dma mappings before returning the command to the midlayer, as there is no guarantee the sglist and count are valid after that point. Also remove the dma mapping helpers which have another inherent race due to the request_id index.
--- drivers/scsi/3w-xxxx.c | 42 ++++++------------------------------------ drivers/scsi/3w-xxxx.h | 5 ----- 2 files changed, 6 insertions(+), 41 deletions(-)
drivers/scsi/3w-xxxx.c +6 -36
@@ -1271,32 +1271,6 @@ static int tw_initialize_device_extensioreturn 0 ; }/* End tw_initialize_device_extension() */ -static int tw_map_scsi_sg_data (struct pci_dev *pdev,struct scsi_cmnd *cmd) -{ -int use_sg; - -dprintk (KERN_WARNING "3w-xxxx: tw_map_scsi_sg_data()\n" ); - - use_sg =scsi_dma_map (cmd); -if (use_sg <0 ) { -printk (KERN_WARNING "3w-xxxx: tw_map_scsi_sg_data(): pci_map_sg() failed.\n" ); -return 0 ; - } - - cmd->SCp.phase =TW_PHASE_SGLIST ; - cmd->SCp.have_data_in = use_sg; - -return use_sg; -}/* End tw_map_scsi_sg_data() */ - -static void tw_unmap_scsi_data (struct pci_dev *pdev,struct scsi_cmnd *cmd) -{ -dprintk (KERN_WARNING "3w-xxxx: tw_unmap_scsi_data()\n" ); - -if (cmd->SCp.phase ==TW_PHASE_SGLIST ) -scsi_dma_unmap (cmd); -}/* End tw_unmap_scsi_data() */ -/* This function will reset a device extension */ static int tw_reset_device_extension (TW_Device_Extension *tw_dev) {
@@ -1319,8 +1293,8 @@ static int tw_reset_device_extension(TW_ srb = tw_dev->srb[i];if (srb !=NULL ) { srb->result = (DID_RESET <<16 ); - tw_dev->srb[i]->scsi_done (tw_dev->srb[i]); -tw_unmap_scsi_data (tw_dev->tw_pci_dev, tw_dev->srb[i]); +scsi_dma_unmap (srb); + srb->scsi_done (srb); } } }
@@ -1767,8 +1741,8 @@ static int tw_scsiop_read_write(TW_Devic command_packet->byte8.io.lba = lba; command_packet->byte6.block_count = num_sectors; - use_sg =tw_map_scsi_sg_data (tw_dev->tw_pci_dev, tw_dev->srb[request_id]); -if (!use_sg) + use_sg =scsi_dma_map (srb); +if (use_sg <=0 )return 1 ;scsi_for_each_sg (tw_dev->srb[request_id], sg, use_sg, i) {
@@ -1955,9 +1929,6 @@ static int tw_scsi_queue_lck(struct scsi/* Save the scsi command for use by the ISR */ tw_dev->srb[request_id] = SCpnt; -/* Initialize phase to zero */ - SCpnt->SCp.phase =TW_PHASE_INITIAL ; -switch (*command) {case READ_10 :case READ_6 :
@@ -2185,12 +2156,11 @@ static irqreturn_t tw_interrupt(int irq,/* Now complete the io */ if ((error !=TW_ISR_DONT_COMPLETE )) { +scsi_dma_unmap (tw_dev->srb[request_id]); + tw_dev->srb[request_id]->scsi_done (tw_dev->srb[request_id]); tw_dev->state[request_id] =TW_S_COMPLETED ;tw_state_request_finish (tw_dev, request_id); tw_dev->posted_request_count--; - tw_dev->srb[request_id]->scsi_done (tw_dev->srb[request_id]); - -tw_unmap_scsi_data (tw_dev->tw_pci_dev, tw_dev->srb[request_id]); } }
drivers/scsi/3w-xxxx.h +0 -5
@@ -195,11 +195,6 @@ static unsigned char tw_sense_table[][4]#define TW_AEN_SMART_FAIL 0x000F#define TW_AEN_SBUF_FAIL 0x0024 -/* Phase defines */ -#define TW_PHASE_INITIAL 0 -#define TW_PHASE_SINGLE 1 -#define TW_PHASE_SGLIST 2 -/* Misc defines */ #define TW_ALIGNMENT_6000 64/* 64 bytes */ #define TW_ALIGNMENT_7000 4/* 4 bytes */
Greg Kroah-Hartman
maintainerPATCH 58/72 3w-9xxx: fix command completion race
In reply to Greg Kroah-Hartman4.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christoph Hellwig <[email protected]>
commit 118c855b5623f3e2e6204f02623d88c09e0c34de upstream.
The 3w-9xxx driver needs to tear down the dma mappings before returning the command to the midlayer, as there is no guarantee the sglist and count are valid after that point. Also remove the dma mapping helpers which have another inherent race due to the request_id index.
--- drivers/scsi/3w-9xxx.c | 57 +++++++++++-------------------------------------- drivers/scsi/3w-9xxx.h | 5 ---- 2 files changed, 13 insertions(+), 49 deletions(-)
drivers/scsi/3w-9xxx.c +13 -44
@@ -149,7 +149,6 @@ static int twa_reset_sequence(TW_Device_static int twa_scsiop_execute_scsi (TW_Device_Extension *tw_dev,int request_id,char *cdb,int use_sg,TW_SG_Entry *sglistarg);static void twa_scsiop_execute_scsi_complete (TW_Device_Extension *tw_dev,int request_id);static char *twa_string_lookup (twa_message_type *table,unsigned int aen_code); -static void twa_unmap_scsi_data (TW_Device_Extension *tw_dev,int request_id);/* Functions */
@@ -1340,11 +1339,11 @@ static irqreturn_t twa_interrupt(int irq }/* Now complete the io */ +scsi_dma_unmap (cmd); + cmd->scsi_done (cmd); tw_dev->state[request_id] =TW_S_COMPLETED ;twa_free_request_id (tw_dev, request_id); tw_dev->posted_request_count--; - tw_dev->srb[request_id]->scsi_done (tw_dev->srb[request_id]); -twa_unmap_scsi_data (tw_dev, request_id); }/* Check for valid status after each drain */
@@ -1402,26 +1401,6 @@ static void twa_load_sgl(TW_Device_Exten } }/* End twa_load_sgl() */ -/* This function will perform a pci-dma mapping for a scatter gather list */ -static int twa_map_scsi_sg_data (TW_Device_Extension *tw_dev,int request_id) -{ -int use_sg; -struct scsi_cmnd *cmd = tw_dev->srb[request_id]; - - use_sg =scsi_dma_map (cmd); -if (!use_sg) -return 0 ; -else if (use_sg <0 ) { -TW_PRINTK (tw_dev->host,TW_DRIVER ,0x1c ,"Failed to map scatter gather list" ); -return 0 ; - } - - cmd->SCp.phase =TW_PHASE_SGLIST ; - cmd->SCp.have_data_in = use_sg; - -return use_sg; -}/* End twa_map_scsi_sg_data() */ -/* This function will poll for a response interrupt of a request */ static int twa_poll_response (TW_Device_Extension *tw_dev,int request_id,int seconds) {
@@ -1600,9 +1579,11 @@ static int twa_reset_device_extension(TW (tw_dev->state[i] != TW_S_INITIAL) && (tw_dev->state[i] != TW_S_COMPLETED)) {if (tw_dev->srb[i]) { - tw_dev->srb[i]->result = (DID_RESET <<16 ); - tw_dev->srb[i]->scsi_done (tw_dev->srb[i]); -twa_unmap_scsi_data (tw_dev, i); +struct scsi_cmnd *cmd = tw_dev->srb[i]; + + cmd->result = (DID_RESET <<16 ); +scsi_dma_unmap (cmd); + cmd->scsi_done (cmd); } } }
@@ -1781,21 +1762,18 @@ static int twa_scsi_queue_lck(struct scs/* Save the scsi command for use by the ISR */ tw_dev->srb[request_id] = SCpnt; -/* Initialize phase to zero */ - SCpnt->SCp.phase =TW_PHASE_INITIAL ; - retval =twa_scsiop_execute_scsi (tw_dev, request_id,NULL ,0 ,NULL );switch (retval) {case SCSI_MLQUEUE_HOST_BUSY : +scsi_dma_unmap (SCpnt);twa_free_request_id (tw_dev, request_id); -twa_unmap_scsi_data (tw_dev, request_id);break ;case 1 : - tw_dev->state[request_id] =TW_S_COMPLETED ; -twa_free_request_id (tw_dev, request_id); -twa_unmap_scsi_data (tw_dev, request_id); SCpnt->result = (DID_ERROR <<16 ); +scsi_dma_unmap (SCpnt);done (SCpnt); + tw_dev->state[request_id] =TW_S_COMPLETED ; +twa_free_request_id (tw_dev, request_id); retval =0 ; } out:
@@ -1863,8 +1841,8 @@ static int twa_scsiop_execute_scsi(TW_De command_packet->sg_list[0 ].address =TW_CPU_TO_SGL (tw_dev->generic_buffer_phys[request_id]); command_packet->sg_list[0 ].length =cpu_to_le32 (TW_MIN_SGL_LENGTH ); }else { - sg_count =twa_map_scsi_sg_data (tw_dev, request_id); -if (sg_count ==0 ) + sg_count =scsi_dma_map (srb); +if (sg_count <0 ) goto out;scsi_for_each_sg (srb, sg, sg_count, i) {
@@ -1979,15 +1957,6 @@ static char *twa_string_lookup(twa_messareturn (table[index].text); }/* End twa_string_lookup() */ -/* This function will perform a pci-dma unmap */ -static void twa_unmap_scsi_data (TW_Device_Extension *tw_dev,int request_id) -{ -struct scsi_cmnd *cmd = tw_dev->srb[request_id]; - -if (cmd->SCp.phase ==TW_PHASE_SGLIST ) -scsi_dma_unmap (cmd); -}/* End twa_unmap_scsi_data() */ -/* This function gets called when a disk is coming on-line */ static int twa_slave_configure (struct scsi_device *sdev) {
drivers/scsi/3w-9xxx.h +0 -5
@@ -324,11 +324,6 @@ static twa_message_type twa_error_table[#define TW_CURRENT_DRIVER_BUILD 0#define TW_CURRENT_DRIVER_BRANCH 0 -/* Phase defines */ -#define TW_PHASE_INITIAL 0 -#define TW_PHASE_SINGLE 1 -#define TW_PHASE_SGLIST 2 -/* Misc defines */ #define TW_9550SX_DRAIN_COMPLETED 0xFFFF#define TW_SECTOR_SIZE 512
Greg Kroah-Hartman
maintainerPATCH 59/72 3w-sas: fix command completion race
In reply to Greg Kroah-Hartman4.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christoph Hellwig <[email protected]>
commit 579d69bc1fd56d5af5761969aa529d1d1c188300 upstream.
The 3w-sas driver needs to tear down the dma mappings before returning the command to the midlayer, as there is no guarantee the sglist and count are valid after that point. Also remove the dma mapping helpers which have another inherent race due to the request_id index.
--- drivers/scsi/3w-sas.c | 50 ++++++++++---------------------------------------- drivers/scsi/3w-sas.h | 4 ---- 2 files changed, 10 insertions(+), 44 deletions(-)
drivers/scsi/3w-sas.c +10 -40
@@ -290,26 +290,6 @@ static int twl_post_command_packet(TW_Dereturn 0 ; }/* End twl_post_command_packet() */ -/* This function will perform a pci-dma mapping for a scatter gather list */ -static int twl_map_scsi_sg_data (TW_Device_Extension *tw_dev,int request_id) -{ -int use_sg; -struct scsi_cmnd *cmd = tw_dev->srb[request_id]; - - use_sg =scsi_dma_map (cmd); -if (!use_sg) -return 0 ; -else if (use_sg <0 ) { -TW_PRINTK (tw_dev->host,TW_DRIVER ,0x1 ,"Failed to map scatter gather list" ); -return 0 ; - } - - cmd->SCp.phase =TW_PHASE_SGLIST ; - cmd->SCp.have_data_in = use_sg; - -return use_sg; -}/* End twl_map_scsi_sg_data() */ -/* This function hands scsi cdb's to the firmware */ static int twl_scsiop_execute_scsi (TW_Device_Extension *tw_dev,int request_id,char *cdb,int use_sg,TW_SG_Entry_ISO *sglistarg) {
@@ -357,8 +337,8 @@ static int twl_scsiop_execute_scsi(TW_Deif (!sglistarg) {/* Map sglist from scsi layer to cmd packet */ if (scsi_sg_count (srb)) { - sg_count =twl_map_scsi_sg_data (tw_dev, request_id); -if (sg_count ==0 ) + sg_count =scsi_dma_map (srb); +if (sg_count <=0 ) goto out;scsi_for_each_sg (srb, sg, sg_count, i) {
@@ -1102,15 +1082,6 @@ out:return retval; }/* End twl_initialize_device_extension() */ -/* This function will perform a pci-dma unmap */ -static void twl_unmap_scsi_data (TW_Device_Extension *tw_dev,int request_id) -{ -struct scsi_cmnd *cmd = tw_dev->srb[request_id]; - -if (cmd->SCp.phase ==TW_PHASE_SGLIST ) -scsi_dma_unmap (cmd); -}/* End twl_unmap_scsi_data() */ -/* This function will handle attention interrupts */ static int twl_handle_attention_interrupt (TW_Device_Extension *tw_dev) {
@@ -1251,11 +1222,11 @@ static irqreturn_t twl_interrupt(int irq }/* Now complete the io */ +scsi_dma_unmap (cmd); + cmd->scsi_done (cmd); tw_dev->state[request_id] =TW_S_COMPLETED ;twl_free_request_id (tw_dev, request_id); tw_dev->posted_request_count--; - tw_dev->srb[request_id]->scsi_done (tw_dev->srb[request_id]); -twl_unmap_scsi_data (tw_dev, request_id); }/* Check for another response interrupt */
@@ -1400,10 +1371,12 @@ static int twl_reset_device_extension(TWif ((tw_dev->state[i] !=TW_S_FINISHED ) && (tw_dev->state[i] !=TW_S_INITIAL ) && (tw_dev->state[i] !=TW_S_COMPLETED )) { -if (tw_dev->srb[i]) { - tw_dev->srb[i]->result = (DID_RESET <<16 ); - tw_dev->srb[i]->scsi_done (tw_dev->srb[i]); -twl_unmap_scsi_data (tw_dev, i); +struct scsi_cmnd *cmd = tw_dev->srb[i]; + +if (cmd) { + cmd->result = (DID_RESET <<16 ); +scsi_dma_unmap (cmd); + cmd->scsi_done (cmd); } } }
@@ -1507,9 +1480,6 @@ static int twl_scsi_queue_lck(struct scs/* Save the scsi command for use by the ISR */ tw_dev->srb[request_id] = SCpnt; -/* Initialize phase to zero */ - SCpnt->SCp.phase =TW_PHASE_INITIAL ; - retval =twl_scsiop_execute_scsi (tw_dev, request_id,NULL ,0 ,NULL );if (retval) { tw_dev->state[request_id] =TW_S_COMPLETED ;
drivers/scsi/3w-sas.h +0 -4
@@ -103,10 +103,6 @@ static char *twl_aen_severity_table[] =#define TW_CURRENT_DRIVER_BUILD 0#define TW_CURRENT_DRIVER_BRANCH 0 -/* Phase defines */ -#define TW_PHASE_INITIAL 0 -#define TW_PHASE_SGLIST 2 -/* Misc defines */ #define TW_SECTOR_SIZE 512#define TW_MAX_UNITS 32
Greg Kroah-Hartman
maintainerPATCH 60/72 drm/radeon: fix ordering of AVI packet setup
In reply to Greg Kroah-Hartman4.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
commit 304f07e9c8d302cf3183248cbabb40598eb5b732 upstream.
Set the line first, then enable the stream. May fix pink line problems on some displays.
--- drivers/gpu/drm/radeon/evergreen_hdmi.c | 12 ++++++------ drivers/gpu/drm/radeon/r600_hdmi.c | 9 +++++---- 2 files changed, 11 insertions(+), 10 deletions(-)
drivers/gpu/drm/radeon/evergreen_hdmi.c +6 -6
@@ -219,13 +219,13 @@ void evergreen_set_avi_packet(struct radWREG32 (AFMT_AVI_INFO3 + offset, frame[0xC ] | (frame[0xD ] <<8 ) | (buffer[1 ] <<24 )); -WREG32_OR (HDMI_INFOFRAME_CONTROL0 + offset, -HDMI_AVI_INFO_SEND |/* enable AVI info frames */ -HDMI_AVI_INFO_CONT );/* required for audio info values to be updated */ -WREG32_P (HDMI_INFOFRAME_CONTROL1 + offset, -HDMI_AVI_INFO_LINE (2 ),/* anything other than 0 */ - ~HDMI_AVI_INFO_LINE_MASK ); +HDMI_AVI_INFO_LINE (2 ),/* anything other than 0 */ + ~HDMI_AVI_INFO_LINE_MASK ); + +WREG32_OR (HDMI_INFOFRAME_CONTROL0 + offset, +HDMI_AVI_INFO_SEND |/* enable AVI info frames */ +HDMI_AVI_INFO_CONT );/* required for audio info values to be updated */ } void dce4_hdmi_audio_set_dto(struct radeon_device *rdev,
drivers/gpu/drm/radeon/r600_hdmi.c +5 -4
@@ -228,12 +228,13 @@ void r600_set_avi_packet(struct radeon_dWREG32 (HDMI0_AVI_INFO3 + offset, frame[0xC ] | (frame[0xD ] <<8 ) | (buffer[1 ] <<24 )); +WREG32_OR (HDMI0_INFOFRAME_CONTROL1 + offset, +HDMI0_AVI_INFO_LINE (2 ));/* anything other than 0 */ +WREG32_OR (HDMI0_INFOFRAME_CONTROL0 + offset, -HDMI0_AVI_INFO_SEND |/* enable AVI info frames */ -HDMI0_AVI_INFO_CONT );/* send AVI info frames every frame/field */ +HDMI0_AVI_INFO_SEND |/* enable AVI info frames */ +HDMI0_AVI_INFO_CONT );/* send AVI info frames every frame/field */ -WREG32_OR (HDMI0_INFOFRAME_CONTROL1 + offset, -HDMI0_AVI_INFO_LINE (2 ));/* anything other than 0 */ }/*
Greg Kroah-Hartman
maintainerPATCH 61/72 drm/radeon: drop dce6_dp_enable
In reply to Greg Kroah-Hartman4.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
commit 12428327bbd1180b5d8ef83fdf9482b878d0502a upstream.
It's mostly duplicated with evergreen_dp_enable. This is a prerequisite for fix implemented in another patch.
--- drivers/gpu/drm/radeon/dce6_afmt.c | 25 ------------------------- drivers/gpu/drm/radeon/evergreen_hdmi.c | 2 +- drivers/gpu/drm/radeon/radeon_audio.c | 3 +-- 3 files changed, 2 insertions(+), 28 deletions(-)
drivers/gpu/drm/radeon/dce6_afmt.c +0 -25
@@ -295,28 +295,3 @@ void dce6_dp_audio_set_dto(struct radeonWREG32 (DCCG_AUDIO_DTO1_MODULE , clock); } } - -void dce6_dp_enable (struct drm_encoder *encoder,bool enable) -{ -struct drm_device *dev = encoder->dev; -struct radeon_device *rdev = dev->dev_private; -struct radeon_encoder *radeon_encoder =to_radeon_encoder (encoder); -struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv; - -if (!dig || !dig->afmt) -return ; - -if (enable) { -WREG32 (EVERGREEN_DP_SEC_TIMESTAMP + dig->afmt->offset, -EVERGREEN_DP_SEC_TIMESTAMP_MODE (1 )); -WREG32 (EVERGREEN_DP_SEC_CNTL + dig->afmt->offset, -EVERGREEN_DP_SEC_ASP_ENABLE |/* Audio packet transmission */ -EVERGREEN_DP_SEC_ATP_ENABLE |/* Audio timestamp packet transmission */ -EVERGREEN_DP_SEC_AIP_ENABLE |/* Audio infoframe packet transmission */ -EVERGREEN_DP_SEC_STREAM_ENABLE );/* Master enable for secondary stream engine */ - }else { -WREG32 (EVERGREEN_DP_SEC_CNTL + dig->afmt->offset,0 ); - } - - dig->afmt->enabled = enable; -}
drivers/gpu/drm/radeon/evergreen_hdmi.c +1 -1
@@ -437,7 +437,7 @@ void evergreen_dp_enable(struct drm_encoWREG32 (EVERGREEN_DP_SEC_TIMESTAMP + dig->afmt->offset,EVERGREEN_DP_SEC_TIMESTAMP_MODE (1 )); -if (radeon_connector->con_priv) { +if (!ASIC_IS_DCE6 (rdev) && radeon_connector->con_priv) { dig_connector = radeon_connector->con_priv; val =RREG32 (EVERGREEN_DP_SEC_AUD_N + dig->afmt->offset); val &= ~EVERGREEN_DP_SEC_N_BASE_MULTIPLE (0xf );
drivers/gpu/drm/radeon/radeon_audio.c +1 -2
@@ -102,7 +102,6 @@ static void radeon_audio_dp_mode_set(strvoid r600_hdmi_enable (struct drm_encoder *encoder,bool enable);void evergreen_hdmi_enable (struct drm_encoder *encoder,bool enable);void evergreen_dp_enable (struct drm_encoder *encoder,bool enable); -void dce6_dp_enable (struct drm_encoder *encoder,bool enable);static const u32 pin_offsets[7 ] = {
@@ -240,7 +239,7 @@ static struct radeon_audio_funcs dce6_dp .set_avi_packet = evergreen_set_avi_packet, .set_audio_packet = dce4_set_audio_packet, .mode_set = radeon_audio_dp_mode_set, - .dpms = dce6_dp_enable, + .dpms = evergreen_dp_enable, };static void radeon_audio_interface_init (struct radeon_device *rdev)
Greg Kroah-Hartman
maintainerPATCH 62/72 drm/radeon/audio: dont enable packets until the end
In reply to Greg Kroah-Hartman4.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
commit 362ff251390f3d1f8fe94666f4fc4e5876381114 upstream.
Don't enable the audio and avi infoframes and audio stream until all the state is set up.
--- drivers/gpu/drm/radeon/evergreen_hdmi.c | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-)
drivers/gpu/drm/radeon/evergreen_hdmi.c +17 -13
@@ -222,10 +222,6 @@ void evergreen_set_avi_packet(struct radWREG32_P (HDMI_INFOFRAME_CONTROL1 + offset,HDMI_AVI_INFO_LINE (2 ),/* anything other than 0 */ ~HDMI_AVI_INFO_LINE_MASK ); - -WREG32_OR (HDMI_INFOFRAME_CONTROL0 + offset, -HDMI_AVI_INFO_SEND |/* enable AVI info frames */ -HDMI_AVI_INFO_CONT );/* required for audio info values to be updated */ } void dce4_hdmi_audio_set_dto(struct radeon_device *rdev,
@@ -370,9 +366,13 @@ void dce4_set_audio_packet(struct drm_enWREG32 (AFMT_AUDIO_PACKET_CONTROL2 + offset,AFMT_AUDIO_CHANNEL_ENABLE (0xff )); +WREG32 (HDMI_AUDIO_PACKET_CONTROL + offset, +HDMI_AUDIO_DELAY_EN (1 ) |/* set the default audio delay */ +HDMI_AUDIO_PACKETS_PER_LINE (3 ));/* should be suffient for all audio modes and small enough for all hblanks */ +/* allow 60958 channel status and send audio packets fields to be updated */ -WREG32 (AFMT_AUDIO_PACKET_CONTROL + offset, -AFMT_AUDIO_SAMPLE_SEND |AFMT_RESET_FIFO_WHEN_AUDIO_DIS |AFMT_60958_CS_UPDATE ); +WREG32_OR (AFMT_AUDIO_PACKET_CONTROL + offset, +AFMT_RESET_FIFO_WHEN_AUDIO_DIS |AFMT_60958_CS_UPDATE ); }
@@ -398,17 +398,16 @@ void evergreen_hdmi_enable(struct drm_enreturn ;if (enable) { -WREG32 (HDMI_INFOFRAME_CONTROL1 + dig->afmt->offset, -HDMI_AUDIO_INFO_LINE (2 ));/* anything other than 0 */ - -WREG32 (HDMI_AUDIO_PACKET_CONTROL + dig->afmt->offset, -HDMI_AUDIO_DELAY_EN (1 ) |/* set the default audio delay */ -HDMI_AUDIO_PACKETS_PER_LINE (3 ));/* should be suffient for all audio modes and small enough for all hblanks */ -WREG32 (HDMI_INFOFRAME_CONTROL0 + dig->afmt->offset, +HDMI_AVI_INFO_SEND |/* enable AVI info frames */ +HDMI_AVI_INFO_CONT |/* required for audio info values to be updated */ HDMI_AUDIO_INFO_SEND |/* enable audio info frames (frames won't be set until audio is enabled) */ HDMI_AUDIO_INFO_CONT );/* required for audio info values to be updated */ +WREG32_OR (AFMT_AUDIO_PACKET_CONTROL + dig->afmt->offset, +AFMT_AUDIO_SAMPLE_SEND ); }else { +WREG32_AND (AFMT_AUDIO_PACKET_CONTROL + dig->afmt->offset, + ~AFMT_AUDIO_SAMPLE_SEND );WREG32 (HDMI_INFOFRAME_CONTROL0 + dig->afmt->offset,0 ); }
@@ -434,6 +433,9 @@ void evergreen_dp_enable(struct drm_encostruct radeon_connector_atom_dig *dig_connector;uint32_t val; +WREG32_OR (AFMT_AUDIO_PACKET_CONTROL + dig->afmt->offset, +AFMT_AUDIO_SAMPLE_SEND ); +WREG32 (EVERGREEN_DP_SEC_TIMESTAMP + dig->afmt->offset,EVERGREEN_DP_SEC_TIMESTAMP_MODE (1 ));
@@ -457,6 +459,8 @@ void evergreen_dp_enable(struct drm_enco EVERGREEN_DP_SEC_STREAM_ENABLE); /* Master enable for secondary stream engine */ }else {WREG32 (EVERGREEN_DP_SEC_CNTL + dig->afmt->offset,0 ); +WREG32_AND (AFMT_AUDIO_PACKET_CONTROL + dig->afmt->offset, + ~AFMT_AUDIO_SAMPLE_SEND ); } dig->afmt->enabled = enable;
Greg Kroah-Hartman
maintainerPATCH 63/72 drm/radeon: only mark audio as connected if the monitor supports it (v3)
In reply to Greg Kroah-Hartman4.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
commit 0f55db36d49d45b80eff0c0a2a498766016f458b upstream.
Otherwise the driver may try and send audio which may confuse the monitor.
v2: set pin to NULL if no audio
v3: avoid crash with analog encoders
--- drivers/gpu/drm/radeon/radeon_audio.c | 27 +++++++++++++++------------ drivers/gpu/drm/radeon/radeon_connectors.c | 8 ++++++-- 2 files changed, 21 insertions(+), 14 deletions(-)
drivers/gpu/drm/radeon/radeon_audio.c +15 -12
@@ -460,30 +460,33 @@ void radeon_audio_detect(struct drm_connif (!connector || !connector->encoder)return ; +if (!radeon_encoder_is_digital (connector->encoder)) +return ; + rdev = connector->encoder->dev->dev_private; radeon_encoder =to_radeon_encoder (connector->encoder); dig = radeon_encoder->enc_priv; -if (status == connector_status_connected) { -struct radeon_connector *radeon_connector; -int sink_type; - -if (!drm_detect_monitor_audio (radeon_connector_edid (connector))) { - radeon_encoder->audio =NULL ; -return ; - } +if (!dig->afmt) +return ; - radeon_connector =to_radeon_connector (connector); - sink_type =radeon_dp_getsinktype (radeon_connector); +if (status == connector_status_connected) { +struct radeon_connector *radeon_connector =to_radeon_connector (connector);if (connector->connector_type == DRM_MODE_CONNECTOR_DisplayPort && - sink_type ==CONNECTOR_OBJECT_ID_DISPLAYPORT ) +radeon_dp_getsinktype (radeon_connector) == +CONNECTOR_OBJECT_ID_DISPLAYPORT ) radeon_encoder->audio = rdev->audio.dp_funcs;else radeon_encoder->audio = rdev->audio.hdmi_funcs; dig->afmt->pin =radeon_audio_get_pin (connector->encoder); -radeon_audio_enable (rdev, dig->afmt->pin,0xf ); +if (drm_detect_monitor_audio (radeon_connector_edid (connector))) { +radeon_audio_enable (rdev, dig->afmt->pin,0xf ); + }else { +radeon_audio_enable (rdev, dig->afmt->pin,0 ); + dig->afmt->pin =NULL ; + } }else {radeon_audio_enable (rdev, dig->afmt->pin,0 ); dig->afmt->pin =NULL ;
drivers/gpu/drm/radeon/radeon_connectors.c +6 -2
@@ -1333,8 +1333,10 @@ out:/* updated in get modes as well since we need to know if it's analog or digital */ radeon_connector_update_scratch_regs (connector, ret); -if (radeon_audio !=0 ) +if (radeon_audio !=0 ) { +radeon_connector_get_edid (connector);radeon_audio_detect (connector, ret); + } exit:pm_runtime_mark_last_busy (connector->dev->dev);
@@ -1659,8 +1661,10 @@ radeon_dp_detect(struct drm_connector *cradeon_connector_update_scratch_regs (connector, ret); -if (radeon_audio !=0 ) +if (radeon_audio !=0 ) { +radeon_connector_get_edid (connector);radeon_audio_detect (connector, ret); + } out:pm_runtime_mark_last_busy (connector->dev->dev);
Greg Kroah-Hartman
maintainerPATCH 64/72 drm/radeon: only enable audio streams if the monitor supports it
In reply to Greg Kroah-Hartman4.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
commit 38aef1549b18539eaecd804383a6ccb6588a9ce1 upstream.
Selectively enable which packets we send based on monitor caps.
--- drivers/gpu/drm/radeon/atombios_encoders.c | 6 ++---- drivers/gpu/drm/radeon/evergreen_hdmi.c | 27 +++++++++++++++++++-------- 2 files changed, 21 insertions(+), 12 deletions(-)
drivers/gpu/drm/radeon/atombios_encoders.c +2 -4
@@ -1729,17 +1729,15 @@ radeon_atom_encoder_dpms(struct drm_encostruct drm_device *dev = encoder->dev;struct radeon_device *rdev = dev->dev_private;struct radeon_encoder *radeon_encoder =to_radeon_encoder (encoder); -struct drm_connector *connector =radeon_get_connector_for_encoder (encoder);int encoder_mode =atombios_get_encoder_mode (encoder);DRM_DEBUG_KMS ("encoder dpms %d to mode %d, devices %08x, active_devices %08x\n" , radeon_encoder->encoder_id, mode, radeon_encoder->devices, radeon_encoder->active_device); -if (connector && (radeon_audio !=0 ) && +if ((radeon_audio !=0 ) && ((encoder_mode ==ATOM_ENCODER_MODE_HDMI ) || - (ENCODER_MODE_IS_DP (encoder_mode) && -drm_detect_monitor_audio (radeon_connector_edid (connector))))) +ENCODER_MODE_IS_DP (encoder_mode)))radeon_audio_dpms (encoder, mode);switch (radeon_encoder->encoder_id) {
drivers/gpu/drm/radeon/evergreen_hdmi.c +19 -8
@@ -398,13 +398,23 @@ void evergreen_hdmi_enable(struct drm_enreturn ;if (enable) { -WREG32 (HDMI_INFOFRAME_CONTROL0 + dig->afmt->offset, -HDMI_AVI_INFO_SEND |/* enable AVI info frames */ -HDMI_AVI_INFO_CONT |/* required for audio info values to be updated */ -HDMI_AUDIO_INFO_SEND |/* enable audio info frames (frames won't be set until audio is enabled) */ -HDMI_AUDIO_INFO_CONT );/* required for audio info values to be updated */ -WREG32_OR (AFMT_AUDIO_PACKET_CONTROL + dig->afmt->offset, -AFMT_AUDIO_SAMPLE_SEND ); +struct drm_connector *connector =radeon_get_connector_for_encoder (encoder); + +if (drm_detect_monitor_audio (radeon_connector_edid (connector))) { +WREG32 (HDMI_INFOFRAME_CONTROL0 + dig->afmt->offset, +HDMI_AVI_INFO_SEND |/* enable AVI info frames */ +HDMI_AVI_INFO_CONT |/* required for audio info values to be updated */ +HDMI_AUDIO_INFO_SEND |/* enable audio info frames (frames won't be set until audio is enabled) */ +HDMI_AUDIO_INFO_CONT );/* required for audio info values to be updated */ +WREG32_OR (AFMT_AUDIO_PACKET_CONTROL + dig->afmt->offset, +AFMT_AUDIO_SAMPLE_SEND ); + }else { +WREG32 (HDMI_INFOFRAME_CONTROL0 + dig->afmt->offset, +HDMI_AVI_INFO_SEND |/* enable AVI info frames */ +HDMI_AVI_INFO_CONT );/* required for audio info values to be updated */ +WREG32_AND (AFMT_AUDIO_PACKET_CONTROL + dig->afmt->offset, + ~AFMT_AUDIO_SAMPLE_SEND ); + } }else {WREG32_AND (AFMT_AUDIO_PACKET_CONTROL + dig->afmt->offset, ~AFMT_AUDIO_SAMPLE_SEND );
@@ -423,11 +433,12 @@ void evergreen_dp_enable(struct drm_encostruct radeon_device *rdev = dev->dev_private;struct radeon_encoder *radeon_encoder =to_radeon_encoder (encoder);struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv; +struct drm_connector *connector =radeon_get_connector_for_encoder (encoder);if (!dig || !dig->afmt)return ; -if (enable) { +if (enable &&drm_detect_monitor_audio (radeon_connector_edid (connector))) {struct drm_connector *connector =radeon_get_connector_for_encoder (encoder);struct radeon_connector *radeon_connector =to_radeon_connector (connector);struct radeon_connector_atom_dig *dig_connector;
Greg Kroah-Hartman
maintainerPATCH 66/72 drm/radeon: adjust pll when audio is not enabled
In reply to Greg Kroah-Hartman4.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
commit 7fe04d6fa824ccea704535a597dc417c8687f990 upstream.
Fixes display problems with some monitors when audio is not enabled.
Bugs:
https://bugs.freedesktop.org/show_bug.cgi?id=89505
https://bugzilla.kernel.org/show_bug.cgi?id=94171
Plus several reports on IRC.
--- drivers/gpu/drm/radeon/atombios_crtc.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/radeon/atombios_crtc.c +3 -0
@@ -580,6 +580,9 @@ static u32 atombios_adjust_pll(struct drelse radeon_crtc->pll_flags |=RADEON_PLL_PREFER_LOW_REF_DIV ; +/* if there is no audio, set MINM_OVER_MAXP */ +if (!drm_detect_monitor_audio (radeon_connector_edid (connector))) + radeon_crtc->pll_flags |=RADEON_PLL_PREFER_MINM_OVER_MAXP ;if (rdev->family <CHIP_RV770 ) radeon_crtc->pll_flags |=RADEON_PLL_PREFER_MINM_OVER_MAXP ;/* use frac fb div on APUs */
Greg Kroah-Hartman
maintainerPATCH 67/72 drm/radeon: add SI DPM quirk for Sapphire R9 270 Dual-X 2G GDDR5
In reply to Greg Kroah-Hartman4.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
commit cd17e02ff4db58ec32d35cf331c705d295779930 upstream.
Seems to have problems with high mclks.
bug:
https://bugs.freedesktop.org/show_bug.cgi?id=76490
--- drivers/gpu/drm/radeon/si_dpm.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/radeon/si_dpm.c +1 -0
@@ -2924,6 +2924,7 @@ struct si_dpm_quirk {static struct si_dpm_quirk si_dpm_quirk_list[] = {/* PITCAIRN - https://bugs.freedesktop.org/show_bug.cgi?id=76490 */ {PCI_VENDOR_ID_ATI ,0x6810 ,0x1462 ,0x3036 ,0 ,120000 }, + {PCI_VENDOR_ID_ATI ,0x6811 ,0x174b ,0xe271 ,0 ,120000 }, {0 ,0 ,0 ,0 }, };
Greg Kroah-Hartman
maintainerPATCH 71/72 hfsplus: dont store special "osx" xattr prefix on-disk
In reply to Greg Kroah-Hartman4.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Hebb <[email protected]>
commit db579e76f06e78de011b2cb7e028740a82f5558c upstream.
On Mac OS X, HFS+ extended attributes are not namespaced. Since we want to be compatible with OS X filesystems and yet still support the Linux namespacing system, the hfsplus driver implements a special "osx" namespace that is reported for any attribute that is not namespaced on-disk. However, the current code for getting and setting these unprefixed attributes is broken.
hfsplus_osx_setattr() and hfsplus_osx_getattr() are passed names that have already had their "osx." prefixes stripped by the generic functions. The functions first, quite correctly, check those names to make sure that they aren't prefixed with a known namespace, which would allow namespace access restrictions to be bypassed. However, the functions then prepend "osx." to the name they're given before passing it on to hfsplus_getattr() and hfsplus_setattr(). Not only does this cause the "osx." prefix to be stored on-disk, defeating its purpose, it also breaks the check for the special "com.apple.FinderInfo" attribute, which is reported for all files, and as a consequence makes some userspace applications (e.g. GNU patch) fail even when extended attributes are not otherwise in use.
There are five commits which have touched this particular code:
127e5f5ae51e ("hfsplus: rework functionality of getting, setting and deleting of extended attributes") b168fff72109 ("hfsplus: use xattr handlers for removexattr")
bf29e886b242 ("hfsplus: correct usage of HFSPLUS_ATTR_MAX_STRLEN for non-English attributes") fcacbd95e121 ("fs/hfsplus: move xattr_name allocation in hfsplus_getxattr()") ec1bbd346f18 ("fs/hfsplus: move xattr_name allocation in hfsplus_setxattr()")
The first commit creates the functions to begin with. The namespace is prepended by the original code, which I believe was correct at the time, since hfsplus_?etattr() stripped the prefix if found. The second commit removes this behavior from hfsplus_?etattr() and appears to have been intended to also remove the prefixing from hfsplus_osx_?etattr(). However, what it actually does is remove a necessary strncpy() call completely, breaking the osx namespace entirely. The third commit re-adds the strncpy() call as it was originally, but doesn't mention it in its commit message. The final two commits refactor the code and don't affect its functionality.
This commit does what b168fff attempted to do (prevent the prefix from being added), but does it properly, instead of passing in an empty buffer (which is what b168fff actually did).
--- fs/hfsplus/xattr.c | 42 ++++++++++++++++-------------------------- 1 file changed, 16 insertions(+), 26 deletions(-)
fs/hfsplus/xattr.c +16 -26
@@ -806,9 +806,6 @@ end_removexattr:static int hfsplus_osx_getxattr (struct dentry *dentry,const char *name,void *buffer,size_t size,int type) { -char *xattr_name; -int res; -if (!strcmp (name,"" ))return -EINVAL ;
@@ -818,24 +815,19 @@ static int hfsplus_osx_getxattr(struct d*/ if (is_known_namespace (name))return -EOPNOTSUPP ; - xattr_name =kmalloc (NLS_MAX_CHARSET_SIZE *HFSPLUS_ATTR_MAX_STRLEN - +XATTR_MAC_OSX_PREFIX_LEN +1 ,GFP_KERNEL ); -if (!xattr_name) -return -ENOMEM ; -strcpy (xattr_name,XATTR_MAC_OSX_PREFIX ); -strcpy (xattr_name +XATTR_MAC_OSX_PREFIX_LEN , name); - - res =hfsplus_getxattr (dentry, xattr_name, buffer, size); -kfree (xattr_name); -return res; + +/* +* osx is the namespace we use to indicate an unprefixed +* attribute on the filesystem (like the ones that OS X +* creates), so we pass the name through unmodified (after +* ensuring it doesn't conflict with another namespace). +*/ +return hfsplus_getxattr (dentry, name, buffer, size); }static int hfsplus_osx_setxattr (struct dentry *dentry,const char *name,const void *buffer,size_t size,int flags,int type) { -char *xattr_name; -int res; -if (!strcmp (name,"" ))return -EINVAL ;
@@ -845,16 +837,14 @@ static int hfsplus_osx_setxattr(struct d*/ if (is_known_namespace (name))return -EOPNOTSUPP ; - xattr_name =kmalloc (NLS_MAX_CHARSET_SIZE *HFSPLUS_ATTR_MAX_STRLEN - +XATTR_MAC_OSX_PREFIX_LEN +1 ,GFP_KERNEL ); -if (!xattr_name) -return -ENOMEM ; -strcpy (xattr_name,XATTR_MAC_OSX_PREFIX ); -strcpy (xattr_name +XATTR_MAC_OSX_PREFIX_LEN , name); - - res =hfsplus_setxattr (dentry, xattr_name, buffer, size, flags); -kfree (xattr_name); -return res; + +/* +* osx is the namespace we use to indicate an unprefixed +* attribute on the filesystem (like the ones that OS X +* creates), so we pass the name through unmodified (after +* ensuring it doesn't conflict with another namespace). +*/ +return hfsplus_setxattr (dentry, name, buffer, size, flags); } static size_t hfsplus_osx_listxattr(struct dentry *dentry, char *list,
Greg Kroah-Hartman
maintainerPATCH 72/72 Drivers: hv: vmbus: Dont wait after requesting offers
In reply to Greg Kroah-Hartman4.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: "K. Y. Srinivasan" <[email protected]>
commit 73cffdb65e679b98893f484063462c045adcf212 upstream.
Don't wait after sending request for offers to the host. This wait is unnecessary and simply adds 5 seconds to the boot time.
--- drivers/hv/channel_mgmt.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-)
drivers/hv/channel_mgmt.c +1 -11
@@ -787,7 +787,7 @@ int vmbus_request_offers(void) {struct vmbus_channel_message_header *msg;struct vmbus_channel_msginfo *msginfo; -int ret, t; +int ret; msginfo = kmalloc(sizeof(*msginfo) + sizeof(struct vmbus_channel_message_header),
@@ -795,8 +795,6 @@ int vmbus_request_offers(void)if (!msginfo)return -ENOMEM ; -init_completion (&msginfo->waitevent); - msg = (struct vmbus_channel_message_header *)msginfo->msg; msg->msgtype =CHANNELMSG_REQUESTOFFERS ;
@@ -810,14 +808,6 @@ int vmbus_request_offers(void) goto cleanup; } - t =wait_for_completion_timeout (&msginfo->waitevent,5 *HZ ); -if (t ==0 ) { - ret = -ETIMEDOUT ; - goto cleanup; - } - - - cleanup:kfree (msginfo);
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.0.3 release. There are 72 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed May 13 17:54:19 UTC 2015. Anything received after that time might be too late.
Build results:
total: 125 pass: 125 fail: 0 Qemu test results: total: 30 pass: 30 fail: 0
Details are available at http://server.roeck-us.net:8010/builders.
Guenter
Greg Kroah-Hartman
maintainerQuoted 9 lines · Guenter Roeck
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.0.3 release. There are 72 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed May 13 17:54:19 UTC 2015. Anything received after that time might be too late.
Quoted 6 lines
Build results:
total: 125 pass: 125 fail: 0 Qemu test results: total: 30 pass: 30 fail: 0Details are available at http://server.roeck-us.net:8010/builders.
Great, thanks for letting me know about all 3 of these.
greg k-h
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.0.3 release. There are 72 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed May 13 17:54:19 UTC 2015. Anything received after that time might be too late.
Quoted 8 lines
The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.0.3-rc1.gzand the diffstat can be found below.
thanks,
greg k-h
Compiled and booted on my test system. No dmesg regressions.
thanks,
-- Shuah
Signature · 5 lines
Shuah Khan Sr. Linux Kernel Developer Open Source Innovation Group Samsung Research America (Silicon Valley) [email protected] | (970) 217-8978
Greg Kroah-Hartman
maintainerQuoted 13 lines · Shuah Khan
Quoted 12 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.0.3 release. There are 72 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed May 13 17:54:19 UTC 2015. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.0.3-rc1.gzand the diffstat can be found below.
Quoted 6 lines
Quoted 4 lines
thanks,
greg k-h
Compiled and booted on my test system. No dmesg regressions.
Thanks for testing all 3 of these and letting me know.
greg k-h