3.10.40-stable review
Subsystems (3)
Greg Kroah-Hartman
maintainercover 3.10.40-stable review
This is the start of the stable review cycle for the 3.10.40 release. There are 48 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 Tue May 13 19:19:30 UTC 2014. 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/v3.0/stable-review/patch-3.10.40-rc1.gz
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 3.10.40-rc1
Gerd Hoffmann <[email protected]>
drm: cirrus: add power management support
Hans de Goede <[email protected]>
Input: synaptics - add min/max quirk for ThinkPad Edge E431
Hans de Goede <[email protected]>
Input: synaptics - add min/max quirk for ThinkPad T431s, L440, L540, S1 Yoga and X1
Jeff Layton <[email protected]>
lockd: ensure we tear down any live sockets when socket creation fails during lockd_up
Mike Snitzer <[email protected]>
dm thin: fix dangling bio in process_deferred_bios error path
Joe Thornber <[email protected]>
dm transaction manager: fix corruption due to non-atomic transaction commit
Giacomo Comes <[email protected]>
Skip intel_crt_init for Dell XPS 8700
Dan Carpenter <[email protected]>
mtd: sm_ftl: heap corruption in sm_create_sysfs_attributes()
Dan Carpenter <[email protected]>
mtd: nuc900_nand: NULL dereference in nuc900_nand_enable()
Herve Codina <[email protected]>
mtd: atmel_nand: Disable subpage NAND write when using Atmel PMECC
Mikulas Patocka <[email protected]>
tgafb: fix data copying
Marek Vasut <[email protected]>
gpio: mxs: Allow for recursive enable_irq_wake() call
Colin Ian King <[email protected]>
rtlwifi: rtl8188ee: initialize packet_beacon
Larry Finger <[email protected]>
rtlwifi: rtl8192se: Fix regression due to commit 1bf4bbb
Larry Finger <[email protected]>
rtlwifi: rtl8192se: Fix too long disable of IRQs
Larry Finger <[email protected]>
rtlwifi: rtl8192cu: Fix too long disable of IRQs
Larry Finger <[email protected]>
rtlwifi: rtl8188ee: Fix too long disable of IRQs
Larry Finger <[email protected]>
rtlwifi: rtl8723ae: Fix too long disable of IRQs
Jeff Layton <[email protected]>
locks: allow __break_lease to sleep even when break_time is 0
Felix Fietkau <[email protected]>
mac80211: exclude AP_VLAN interfaces from tx power calculation
Johannes Berg <[email protected]>
mac80211: fix software remain-on-channel implementation
Michael Braun <[email protected]>
mac80211: fix WPA with VLAN on AP side with ps-sta again
Emmanuel Grumbach <[email protected]>
iwlwifi: dvm: take mutex when sending SYNC BT config command
Dan Williams <[email protected]>
libata/ahci: accommodate tag ordered controllers
Rafał Miłecki <[email protected]>
b43: Fix machine check error due to improper access of B43_MMIO_PSM_PHY_HDR
Mikulas Patocka <[email protected]>
mach64: fix cursor when character width is not a multiple of 8 pixels
Mikulas Patocka <[email protected]>
mach64: use unaligned access
Mikulas Patocka <[email protected]>
matroxfb: restore the registers M_ACCESS and M_PITCH
Mikulas Patocka <[email protected]>
framebuffer: fix cfb_copyarea
Vineet Gupta <[email protected]>
ARC: Entry Handler tweaks: Optimize away redundant IRQ_DISABLE_SAVE
Vineet Gupta <[email protected]>
ARC: Entry Handler tweaks: Simplify branch for in-kernel preemption
Martin Schwidefsky <[email protected]>
s390/bpf,jit: initialize A register if 1st insn is BPF_S_LDX_B_MSH
Sebastian Ott <[email protected]>
s390/chsc: fix SEI usage on old FW levels
Michael Neuling <[email protected]>
powerpc/tm: Disable IRQ in tm_recheckpoint
Anton Blanchard <[email protected]>
powerpc/compat: 32-bit little endian machine name is ppcle, not ppc
Tyler Stachecki <[email protected]>
mpt2sas: Don't disable device twice at suspend.
Fam Zheng <[email protected]>
virtio-scsi: Skip setting affinity on uninitialized vq
Rusty Russell <[email protected]>
virtio_balloon: don't softlockup on huge balloon changes.
Huacai Chen <[email protected]>
MIPS: Hibernate: Flush TLB entries in swsusp_arch_resume()
James Hogan <[email protected]>
MIPS: KVM: Pass reserved instruction exceptions to guest
Paolo Bonzini <[email protected]>
KVM: ioapic: fix assignment of ioapic->rtc_status.pending_eoi (CVE-2014-0155)
Sergey Dyasly <[email protected]>
ARM: 7840/1: LPAE: don't reject mapping /dev/mem above 4GB
Nicholas Bellinger <[email protected]>
iser-target: Add missing se_cmd put for WRITE_PENDING in tx_comp_err
Matthew Daley <[email protected]>
floppy: don't write kernel-only members to FDRAWCMD ioctl output
Matthew Daley <[email protected]>
floppy: ignore kernel-only members in FDRAWCMD ioctl input
Peter Hurley <[email protected]>
n_tty: Fix n_tty_write crash when echoing in raw mode
Michael Welling <[email protected]>
tty: serial: 8250_core.c Bug fix for Exar chips.
Tomoki Sekiyama <[email protected]>
drivers/tty/hvc: don't free hvc_console_setup after init
-------------
Diffstat:
Makefile | 4 +- arch/arc/include/asm/irqflags.h | 7 - arch/arc/kernel/entry.S | 16 +- arch/arm/mm/mmap.c | 6 +- arch/mips/kvm/kvm_mips_emul.c | 7 +- arch/mips/power/hibernate.S | 1 + arch/powerpc/include/asm/compat.h | 4 + arch/powerpc/include/asm/reg.h | 1 + arch/powerpc/kernel/process.c | 34 ++- arch/powerpc/kernel/signal_32.c | 2 + arch/powerpc/kernel/signal_64.c | 2 + arch/powerpc/kernel/tm.S | 2 +- arch/s390/net/bpf_jit_comp.c | 1 - drivers/ata/libata-core.c | 21 +- drivers/block/floppy.c | 11 +- drivers/gpio/gpio-mxs.c | 3 +- drivers/gpu/drm/cirrus/cirrus_drv.c | 42 ++++ drivers/gpu/drm/cirrus/cirrus_mode.c | 3 + drivers/gpu/drm/i915/intel_crt.c | 8 + drivers/infiniband/ulp/isert/ib_isert.c | 29 ++- drivers/input/mouse/synaptics.c | 50 ++++ drivers/md/dm-cache-metadata.c | 3 +- drivers/md/dm-thin.c | 2 +- drivers/md/persistent-data/dm-block-manager.c | 15 +- drivers/md/persistent-data/dm-block-manager.h | 3 +- .../md/persistent-data/dm-transaction-manager.c | 5 +- .../md/persistent-data/dm-transaction-manager.h | 17 +- drivers/mtd/nand/atmel_nand.c | 1 + drivers/mtd/nand/nuc900_nand.c | 2 +- drivers/mtd/sm_ftl.c | 11 +- drivers/net/wireless/b43/phy_n.c | 14 +- drivers/net/wireless/iwlwifi/dvm/main.c | 8 +- drivers/net/wireless/rtlwifi/rtl8188ee/hw.c | 20 +- drivers/net/wireless/rtlwifi/rtl8188ee/trx.c | 2 +- drivers/net/wireless/rtlwifi/rtl8192cu/hw.c | 15 +- drivers/net/wireless/rtlwifi/rtl8192se/hw.c | 27 ++- drivers/net/wireless/rtlwifi/rtl8192se/trx.c | 6 + drivers/net/wireless/rtlwifi/rtl8723ae/hw.c | 18 +- drivers/s390/cio/chsc.c | 22 +- drivers/scsi/mpt2sas/mpt2sas_scsih.c | 1 - drivers/scsi/virtio_scsi.c | 6 +- drivers/tty/hvc/hvc_console.c | 2 +- drivers/tty/n_tty.c | 4 + drivers/tty/serial/8250/8250_core.c | 2 +- drivers/video/aty/mach64_accel.c | 3 +- drivers/video/aty/mach64_cursor.c | 22 +- drivers/video/cfbcopyarea.c | 153 ++++++------ drivers/video/matrox/matroxfb_accel.c | 38 ++- drivers/video/matrox/matroxfb_base.h | 2 + drivers/video/tgafb.c | 264 ++++----------------- drivers/virtio/virtio_balloon.c | 6 + fs/lockd/svc.c | 1 + fs/locks.c | 7 +- include/linux/libata.h | 1 + net/mac80211/main.c | 2 + net/mac80211/offchannel.c | 1 + net/mac80211/tx.c | 2 +- virt/kvm/ioapic.c | 2 +- 58 files changed, 529 insertions(+), 435 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/48 drivers/tty/hvc: dont free hvc_console_setup after init
3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tomoki Sekiyama <[email protected]>
commit 501fed45b7e8836ee9373f4d31e2d85e3db6103a upstream.
When 'console=hvc0' is specified to the kernel parameter in x86 KVM guest, hvc console is setup within a kthread. However, that will cause SEGV and the boot will fail when the driver is builtin to the kernel, because currently hvc_console_setup() is annotated with '__init'. This patch removes '__init' to boot the guest successfully with 'console=hvc0'.
--- drivers/tty/hvc/hvc_console.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/hvc/hvc_console.c +1 -1
@@ -190,7 +190,7 @@ static struct tty_driver *hvc_console_dereturn hvc_driver; } -static int __init hvc_console_setup (struct console *co,char *options) +static int hvc_console_setup (struct console *co,char *options) {if (co->index <0 || co->index >=MAX_NR_HVC_CONSOLES )return -ENODEV ;
Greg Kroah-Hartman
maintainerPATCH 2/48 tty: serial: 8250_core.c Bug fix for Exar chips.
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Welling <[email protected]>
commit b790f210fe8423eff881b2a8a93ba5dbc45534d0 upstream.
The sleep function was updated to put the serial port to sleep only when necessary. This appears to resolve the errant behavior of the driver as described in Kernel Bug 61961 – "My Exar Corp. XR17C/D152 Dual PCI UART modem does not work with 3.8.0".
--- drivers/tty/serial/8250/8250_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/8250/8250_core.c +1 -1
@@ -555,7 +555,7 @@ static void serial8250_set_sleep(struct*/ if ((p->port.type ==PORT_XR17V35X ) || (p->port.type ==PORT_XR17D15X )) { -serial_out (p,UART_EXAR_SLEEP ,0xff ); +serial_out (p,UART_EXAR_SLEEP , sleep ?0xff :0 );return ; }
Greg Kroah-Hartman
maintainerPATCH 3/48 n_tty: Fix n_tty_write crash when echoing in raw mode
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Hurley <[email protected]>
commit 4291086b1f081b869c6d79e5b7441633dc3ace00 upstream.
The tty atomic_write_lock does not provide an exclusion guarantee for the tty driver if the termios settings are LECHO & !OPOST. And since it is unexpected and not allowed to call TTY buffer helpers like tty_insert_flip_string concurrently, this may lead to crashes when concurrect writers call pty_write. In that case the following two writers:
* the ECHOing from a workqueue and
* pty_write from the process
race and can overflow the corresponding TTY buffer like follows.
If we look into tty_insert_flip_string_fixed_flag, there is:
int space = __tty_buffer_request_room(port, goal, flags); struct tty_buffer *tb = port->buf.tail;
...
memcpy(char_buf_ptr(tb, tb->used), chars, space);
...
tb->used += space;
so the race of the two can result in something like this:
A B__tty_buffer_request_room
__tty_buffer_request_roommemcpy(buf(tb->used), ...)
tb->used += space;
memcpy(buf(tb->used), ...) ->BOOMB's memcpy is past the tty_buffer due to the previous A's tb->used increment.
Since the N_TTY line discipline input processing can output concurrently with a tty write, obtain the N_TTY ldisc output_lock to serialize echo output with normal tty writes. This ensures the tty buffer helper tty_insert_flip_string is not called concurrently and everything is fine.
Note that this is nicely reproducible by an ordinary user using forkpty and some setup around that (raw termios + ECHO). And it is present in kernels at least after commit d945cb9cce20ac7143c2de8d88b187f62db99bdc (pty: Rework the pty layer to use the normal buffering logic) in 2.6.31-rc3.
js: add more info to the commit log
js: switch to bool
js: lock unconditionally
js: lock only the tty->ops->write call
References: CVE-2014-0196
--- drivers/tty/n_tty.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/tty/n_tty.c +4 -0
@@ -2066,8 +2066,12 @@ static ssize_t n_tty_write(struct tty_stif (tty->ops->flush_chars) tty->ops->flush_chars (tty); }else { +struct n_tty_data *ldata = tty->disc_data; +while (nr >0 ) { +mutex_lock (&ldata->output_lock); c = tty->ops->write (tty, b, nr); +mutex_unlock (&ldata->output_lock);if (c <0 ) { retval = c; goto break_out;
Greg Kroah-Hartman
maintainerPATCH 4/48 floppy: ignore kernel-only members in FDRAWCMD ioctl input
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matthew Daley <[email protected]>
commit ef87dbe7614341c2e7bfe8d32fcb7028cc97442c upstream.
Always clear out these floppy_raw_cmd struct members after copying the entire structure from userspace so that the in-kernel version is always valid and never left in an interdeterminate state.
--- drivers/block/floppy.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/block/floppy.c +3 -3
@@ -3107,10 +3107,11 @@ loop:return -ENOMEM ; *rcmd = ptr; ret =copy_from_user (ptr, param,sizeof (*ptr)); -if (ret) -return -EFAULT ; ptr->next =NULL ; ptr->buffer_length =0 ; + ptr->kernel_data =NULL ; +if (ret) +return -EFAULT ; param +=sizeof (struct floppy_raw_cmd );if (ptr->cmd_count >33 )/* the command may now also take up the space
@@ -3126,7 +3127,6 @@ loop:for (i =0 ; i <16 ; i++) ptr->reply[i] =0 ; ptr->resultcode =0 ; - ptr->kernel_data =NULL ;if (ptr->flags & (FD_RAW_READ |FD_RAW_WRITE )) {if (ptr->length <=0 )
Greg Kroah-Hartman
maintainerPATCH 5/48 floppy: dont write kernel-only members to FDRAWCMD ioctl output
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matthew Daley <[email protected]>
commit 2145e15e0557a01b9195d1c7199a1b92cb9be81f upstream.
Do not leak kernel-only floppy_raw_cmd structure members to userspace. This includes the linked-list pointer and the pointer to the allocated DMA space.
--- drivers/block/floppy.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/block/floppy.c +4 -1
@@ -3053,7 +3053,10 @@ static int raw_cmd_copyout(int cmd, voidint ret;while (ptr) { - ret =copy_to_user (param, ptr,sizeof (*ptr)); +struct floppy_raw_cmd cmd = *ptr; + cmd.next =NULL ; + cmd.kernel_data =NULL ; + ret =copy_to_user (param, &cmd,sizeof (cmd));if (ret)return -EFAULT ; param +=sizeof (struct floppy_raw_cmd );
Greg Kroah-Hartman
maintainerPATCH 6/48 iser-target: Add missing se_cmd put for WRITE_PENDING in tx_comp_err
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicholas Bellinger <[email protected]>
commit 03e7848a64ed535a30f5d7fc6dede2d5a6a2534b upstream.
This patch fixes a bug where outstanding RDMA_READs with WRITE_PENDING status require an extra target_put_sess_cmd() in isert_put_cmd() code when called from isert_cq_tx_comp_err() + isert_cq_drain_comp_llist() context during session shutdown.
The extra kref PUT is required so that transport_generic_free_cmd() invokes the last target_put_sess_cmd() -> target_release_cmd_kref(), which will complete(&se_cmd->cmd_wait_comp) the outstanding se_cmd descriptor with WRITE_PENDING status, and awake the completion in target_wait_for_sess_cmds() to invoke TFO->release_cmd().
The bug was manifesting itself in target_wait_for_sess_cmds() where a se_cmd descriptor with WRITE_PENDING status would end up sleeping indefinately.
--- drivers/infiniband/ulp/isert/ib_isert.c | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-)
drivers/infiniband/ulp/isert/ib_isert.c +21 -8
@@ -1201,7 +1201,7 @@ isert_unmap_cmd(struct isert_cmd *isert_ }static void -isert_put_cmd (struct isert_cmd *isert_cmd) +isert_put_cmd (struct isert_cmd *isert_cmd,bool comp_err) {struct iscsi_cmd *cmd = &isert_cmd->iscsi_cmd;struct isert_conn *isert_conn = isert_cmd->conn;
@@ -1216,8 +1216,21 @@ isert_put_cmd(struct isert_cmd *isert_cmlist_del_init (&cmd->i_conn_node);spin_unlock_bh (&conn->cmd_lock); -if (cmd->data_direction ==DMA_TO_DEVICE ) +if (cmd->data_direction ==DMA_TO_DEVICE ) {iscsit_stop_dataout_timer (cmd); +/* +* Check for special case during comp_err where +* WRITE_PENDING has been handed off from core, +* but requires an extra target_put_sess_cmd() +* before transport_generic_free_cmd() below. +*/ +if (comp_err && + cmd->se_cmd.t_state ==TRANSPORT_WRITE_PENDING ) { +struct se_cmd *se_cmd = &cmd->se_cmd; + +target_put_sess_cmd (se_cmd->se_sess, se_cmd); + } + }isert_unmap_cmd (isert_cmd, isert_conn);transport_generic_free_cmd (&cmd->se_cmd,0 );
@@ -1271,7 +1284,7 @@ isert_unmap_tx_desc(struct iser_tx_descstatic void isert_completion_put (struct iser_tx_desc *tx_desc,struct isert_cmd *isert_cmd, -struct ib_device *ib_dev) +struct ib_device *ib_dev,bool comp_err) {if (isert_cmd->sense_buf_dma !=0 ) {pr_debug ("Calling ib_dma_unmap_single for isert_cmd->sense_buf_dma\n" );
@@ -1281,7 +1294,7 @@ isert_completion_put(struct iser_tx_desc }isert_unmap_tx_desc (tx_desc, ib_dev); -isert_put_cmd (isert_cmd); +isert_put_cmd (isert_cmd, comp_err); } static void
@@ -1336,14 +1349,14 @@ isert_do_control_comp(struct work_structiscsit_tmr_post_handler (cmd, cmd->conn); cmd->i_state =ISTATE_SENT_STATUS ; -isert_completion_put (&isert_cmd->tx_desc, isert_cmd, ib_dev); +isert_completion_put (&isert_cmd->tx_desc, isert_cmd, ib_dev, false);break ;case ISTATE_SEND_REJECT :pr_debug ("Got isert_do_control_comp ISTATE_SEND_REJECT: >>>\n" );atomic_dec (&isert_conn->post_send_buf_count); cmd->i_state =ISTATE_SENT_STATUS ; -isert_completion_put (&isert_cmd->tx_desc, isert_cmd, ib_dev); +isert_completion_put (&isert_cmd->tx_desc, isert_cmd, ib_dev, false);break ;case ISTATE_SEND_LOGOUTRSP :pr_debug ("Calling iscsit_logout_post_handler >>>>>>>>>>>>>>\n" );
@@ -1382,7 +1395,7 @@ isert_response_completion(struct iser_txatomic_sub (wr->send_wr_num +1 , &isert_conn->post_send_buf_count); cmd->i_state =ISTATE_SENT_STATUS ; -isert_completion_put (tx_desc, isert_cmd, ib_dev); +isert_completion_put (tx_desc, isert_cmd, ib_dev, false); } static void
@@ -1436,7 +1449,7 @@ isert_cq_tx_comp_err(struct iser_tx_descif (!isert_cmd)isert_unmap_tx_desc (tx_desc, ib_dev);else -isert_completion_put (tx_desc, isert_cmd, ib_dev); +isert_completion_put (tx_desc, isert_cmd, ib_dev, true); } static void
Greg Kroah-Hartman
maintainerPATCH 7/48 ARM: 7840/1: LPAE: dont reject mapping /dev/mem above 4GB
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sergey Dyasly <[email protected]>
commit 3159f372354e8e1f5dee714663d705dd2c7e0759 upstream.
With LPAE enabled, physical address space is larger than 4GB. Allow mapping any part of it via /dev/mem by using PHYS_MASK to determine valid range.
PHYS_MASK covers 40 bits with LPAE enabled and 32 bits otherwise.
--- arch/arm/mm/mmap.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
arch/arm/mm/mmap.c +2 -4
@@ -204,13 +204,11 @@ int valid_phys_addr_range(phys_addr_t ad }/* -* We don't use supersection mappings for mmap() on /dev/mem, which -* means that we can't map the memory area above the 4G barrier into -* userspace. +* Do not allow /dev/mem mappings beyond the supported physical range. */ int valid_mmap_phys_addr_range (unsigned long pfn,size_t size) { -return !(pfn + (size >>PAGE_SHIFT ) >0x00100000 ); +return (pfn + (size >>PAGE_SHIFT )) <= (1 + (PHYS_MASK >>PAGE_SHIFT )); }#ifdef CONFIG_STRICT_DEVMEM
Greg Kroah-Hartman
maintainerPATCH 8/48 KVM: ioapic: fix assignment of ioapic->rtc_status.pending_eoi (CVE-2014-0155)
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paolo Bonzini <[email protected]>
commit 5678de3f15010b9022ee45673f33bcfc71d47b60 upstream.
QE reported that they got the BUG_ON in ioapic_service to trigger. I cannot reproduce it, but there are two reasons why this could happen.
The less likely but also easiest one, is when kvm_irq_delivery_to_apic does not deliver to any APIC and returns -1.
Because irqe.shorthand == 0, the kvm_for_each_vcpu loop in that function is never reached. However, you can target the similar loop in kvm_irq_delivery_to_apic_fast; just program a zero logical destination address into the IOAPIC, or an out-of-range physical destination address.
--- virt/kvm/ioapic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
virt/kvm/ioapic.c +1 -1
@@ -306,7 +306,7 @@ static int ioapic_deliver(struct kvm_ioaBUG_ON (ioapic->rtc_status.pending_eoi !=0 ); ret =kvm_irq_delivery_to_apic (ioapic->kvm,NULL , &irqe, ioapic->rtc_status.dest_map); - ioapic->rtc_status.pending_eoi = ret; + ioapic->rtc_status.pending_eoi = (ret <0 ?0 : ret); }else ret =kvm_irq_delivery_to_apic (ioapic->kvm,NULL , &irqe,NULL );
Greg Kroah-Hartman
maintainerPATCH 9/48 MIPS: KVM: Pass reserved instruction exceptions to guest
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: James Hogan <[email protected]>
commit 15505679362270d02c449626385cb74af8905514 upstream.
Previously a reserved instruction exception while in guest code would cause a KVM internal error if kvm_mips_handle_ri() didn't recognise the instruction (including a RDHWR from an unrecognised hardware register).
However the guest OS should really have the opportunity to catch the exception so that it can take the appropriate actions such as sending a SIGILL to the guest user process or emulating the instruction itself.
Therefore in these cases emulate a guest RI exception and only return EMULATE_FAIL if that fails, being careful to revert the PC first in case the exception occurred in a branch delay slot in which case the PC will already point to the branch target.
Also turn the printk messages relating to these cases into kvm_debug messages so that they aren't usually visible.
This allows crashme to run in the guest without killing the entire VM.
--- arch/mips/kvm/kvm_mips_emul.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
arch/mips/kvm/kvm_mips_emul.c +4 -3
@@ -1571,17 +1571,17 @@ kvm_mips_handle_ri(unsigned long cause, arch->gprs[rt] =kvm_read_c0_guest_userlocal (cop0);#else /* UserLocal not implemented */ - er =kvm_mips_emulate_ri_exc (cause, opc, run, vcpu); + er =EMULATE_FAIL ;#endif break ;default : -printk ("RDHWR not supported\n" ); +kvm_debug ("RDHWR %#x not supported @ %p\n" , rd, opc); er =EMULATE_FAIL ;break ; } }else { -printk ("Emulate RI not supported @ %p: %#x\n" , opc, inst); +kvm_debug ("Emulate RI not supported @ %p: %#x\n" , opc, inst); er =EMULATE_FAIL ; }
@@ -1590,6 +1590,7 @@ kvm_mips_handle_ri(unsigned long cause,*/ if (er ==EMULATE_FAIL ) { vcpu->arch.pc = curr_pc; + er =kvm_mips_emulate_ri_exc (cause, opc, run, vcpu); }return er; }
Greg Kroah-Hartman
maintainerPATCH 10/48 MIPS: Hibernate: Flush TLB entries in swsusp_arch_resume()
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Huacai Chen <[email protected]>
commit c14af233fbe279d0e561ecf84f1208b1bae087ef upstream.
The original MIPS hibernate code flushes cache and TLB entries in swsusp_arch_resume(). But they are removed in Commit 44eeab67416711 (MIPS: Hibernation: Remove SMP TLB and cacheflushing code.). A cross- CPU flush is surely unnecessary because all but the local CPU have already been disabled. But a local flush (at least the TLB flush) is needed. When we do hibernation on Loongson-3 with an E1000E NIC, it is very easy to produce a kernel panic (kernel page fault, or unaligned access). The root cause is E1000E driver use vzalloc_node() to allocate pages, the stale TLB entries of the booting kernel will be misused by the resumed target kernel.
Patchwork: https://patchwork.linux-mips.org/patch/6643/
--- arch/mips/power/hibernate.S | 1 + 1 file changed, 1 insertion(+)
arch/mips/power/hibernate.S +1 -0
@@ -43,6 +43,7 @@ LEAF(swsusp_arch_resume) bne t1, t3, 1b PTR_L t0, PBE_NEXT(t0) bnez t0, 0b + jal local_flush_tlb_all /* Avoid TLB mismatch after kernel resume */ PTR_LA t0, saved_regs PTR_L ra, PT_R31(t0) PTR_L sp, PT_R29(t0)
Greg Kroah-Hartman
maintainerPATCH 11/48 virtio_balloon: dont softlockup on huge balloon changes.
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rusty Russell <[email protected]>
commit 1f74ef0f2d7d692fcd615621e0e734c3e7771413 upstream.
When adding or removing 100G from a balloon:
BUG: soft lockup - CPU#0 stuck for 22s! [vballoon:367]
We have a wait_event_interruptible(), but the condition is always true (more ballooning to do) so we don't ever sleep. We also have a wait_event() for the host to ack, but that is also always true as QEMU is synchronous for balloon operations.
--- drivers/virtio/virtio_balloon.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/virtio/virtio_balloon.c +6 -0
@@ -311,6 +311,12 @@ static int balloon(void *_vballoon)else if (diff <0 )leak_balloon (vb, -diff);update_balloon_size (vb); + +/* +* For large balloon changes, we could spend a lot of time +* and always have work to do. Be nice if preempt disabled. +*/ +cond_resched (); }return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 12/48 virtio-scsi: Skip setting affinity on uninitialized vq
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fam Zheng <[email protected]>
commit 0c8482ac92db5ac15792caf23b7f7df9e4f48ae1 upstream.
virtscsi_init calls virtscsi_remove_vqs on err, even before initializing the vqs. The latter calls virtscsi_set_affinity, so let's check the pointer there before setting affinity on it.
This fixes a panic when setting device's num_queues=2 on RHEL 6.5:
qemu-system-x86_64 ... \
-device virtio-scsi-pci,id=scsi0,addr=0x13,...,num_queues=2 \
-drive file=/stor/vm/dummy.raw,id=drive-scsi-disk,... \
-device scsi-hd,drive=drive-scsi-disk,...
[ 0.354734] scsi0 : Virtio SCSI HBA [ 0.379504] BUG: unable to handle kernel NULL pointer dereference at 0000000000000020 [ 0.380141] IP: [<ffffffff814741ef>] __virtscsi_set_affinity+0x4f/0x120 [ 0.380141] PGD 0 [ 0.380141] Oops: 0000 [#1] SMP [ 0.380141] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 3.14.0+ #5 [ 0.380141] Hardware name: Red Hat KVM, BIOS 0.5.1 01/01/2007 [ 0.380141] task: ffff88003c9f0000 ti: ffff88003c9f8000 task.ti: ffff88003c9f8000 [ 0.380141] RIP: 0010:[<ffffffff814741ef>] [<ffffffff814741ef>] __virtscsi_set_affinity+0x4f/0x120 [ 0.380141] RSP: 0000:ffff88003c9f9c08 EFLAGS: 00010256 [ 0.380141] RAX: 0000000000000000 RBX: ffff88003c3a9d40 RCX: 0000000000001070 [ 0.380141] RDX: 0000000000000002 RSI: 0000000000000000 RDI: 0000000000000000 [ 0.380141] RBP: ffff88003c9f9c28 R08: 00000000000136c0 R09: ffff88003c801c00 [ 0.380141] R10: ffffffff81475229 R11: 0000000000000008 R12: 0000000000000000 [ 0.380141] R13: ffffffff81cc7ca8 R14: ffff88003cac3d40 R15: ffff88003cac37a0 [ 0.380141] FS: 0000000000000000(0000) GS:ffff88003e400000(0000) knlGS:0000000000000000 [ 0.380141] CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b [ 0.380141] CR2: 0000000000000020 CR3: 0000000001c0e000 CR4: 00000000000006f0 [ 0.380141] Stack: [ 0.380141] ffff88003c3a9d40 0000000000000000 ffff88003cac3d80 ffff88003cac3d40 [ 0.380141] ffff88003c9f9c48 ffffffff814742e8 ffff88003c26d000 ffff88003c26d000 [ 0.380141] ffff88003c9f9c68 ffffffff81474321 ffff88003c26d000 ffff88003c3a9d40 [ 0.380141] Call Trace: [ 0.380141] [<ffffffff814742e8>] virtscsi_set_affinity+0x28/0x40 [ 0.380141] [<ffffffff81474321>] virtscsi_remove_vqs+0x21/0x50 [ 0.380141] [<ffffffff81475231>] virtscsi_init+0x91/0x240 [ 0.380141] [<ffffffff81365290>] ? vp_get+0x50/0x70 [ 0.380141] [<ffffffff81475544>] virtscsi_probe+0xf4/0x280 [ 0.380141] [<ffffffff81363ea5>] virtio_dev_probe+0xe5/0x140 [ 0.380141] [<ffffffff8144c669>] driver_probe_device+0x89/0x230 [ 0.380141] [<ffffffff8144c8ab>] __driver_attach+0x9b/0xa0 [ 0.380141] [<ffffffff8144c810>] ? driver_probe_device+0x230/0x230 [ 0.380141] [<ffffffff8144c810>] ? driver_probe_device+0x230/0x230 [ 0.380141] [<ffffffff8144ac1c>] bus_for_each_dev+0x8c/0xb0 [ 0.380141] [<ffffffff8144c499>] driver_attach+0x19/0x20 [ 0.380141] [<ffffffff8144bf28>] bus_add_driver+0x198/0x220 [ 0.380141] [<ffffffff8144ce9f>] driver_register+0x5f/0xf0 [ 0.380141] [<ffffffff81d27c91>] ? spi_transport_init+0x79/0x79 [ 0.380141] [<ffffffff8136403b>] register_virtio_driver+0x1b/0x30 [ 0.380141] [<ffffffff81d27d19>] init+0x88/0xd6 [ 0.380141] [<ffffffff81d27c18>] ? scsi_init_procfs+0x5b/0x5b [ 0.380141] [<ffffffff81ce88a7>] do_one_initcall+0x7f/0x10a [ 0.380141] [<ffffffff81ce8aa7>] kernel_init_freeable+0x14a/0x1de [ 0.380141] [<ffffffff81ce8b3b>] ? kernel_init_freeable+0x1de/0x1de [ 0.380141] [<ffffffff817dec20>] ? rest_init+0x80/0x80 [ 0.380141] [<ffffffff817dec29>] kernel_init+0x9/0xf0 [ 0.380141] [<ffffffff817e68fc>] ret_from_fork+0x7c/0xb0 [ 0.380141] [<ffffffff817dec20>] ? rest_init+0x80/0x80 [ 0.380141] RIP [<ffffffff814741ef>] __virtscsi_set_affinity+0x4f/0x120 [ 0.380141] RSP <ffff88003c9f9c08> [ 0.380141] CR2: 0000000000000020 [ 0.380141] ---[ end trace 8074b70c3d5e1d73 ]--- [ 0.475018] Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000009 [ 0.475018] [ 0.475068] Kernel Offset: 0x0 from 0xffffffff81000000 (relocation range: 0xffffffff80000000-0xffffffff9fffffff) [ 0.475068] ---[ end Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000009
--- drivers/scsi/virtio_scsi.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/scsi/virtio_scsi.c +5 -1
@@ -751,8 +751,12 @@ static void __virtscsi_set_affinity(stru vscsi->affinity_hint_set = true; }else { -for (i =0 ; i < vscsi->num_queues; i++) +for (i =0 ; i < vscsi->num_queues; i++) { +if (!vscsi->req_vqs[i].vq) +continue ; +virtqueue_set_affinity (vscsi->req_vqs[i].vq,-1 ); + } vscsi->affinity_hint_set = false; }
Greg Kroah-Hartman
maintainerPATCH 13/48 mpt2sas: Dont disable device twice at suspend.
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tyler Stachecki <[email protected]>
commit af61e27c3f77c7623b5335590ae24b6a5c323e22 upstream.
On suspend, _scsih_suspend calls mpt2sas_base_free_resources, which in turn calls pci_disable_device if the device is enabled prior to suspending. However, _scsih_suspend also calls pci_disable_device itself.
Thus, in the event that the device is enabled prior to suspending, pci_disable_device will be called twice. This patch removes the duplicate call to pci_disable_device in _scsi_suspend as it is both unnecessary and results in a kernel oops.
--- drivers/scsi/mpt2sas/mpt2sas_scsih.c | 1 - 1 file changed, 1 deletion(-)
drivers/scsi/mpt2sas/mpt2sas_scsih.c +0 -1
@@ -8174,7 +8174,6 @@ _scsih_suspend(struct pci_dev *pdev, pm_mpt2sas_base_free_resources (ioc);pci_save_state (pdev); -pci_disable_device (pdev);pci_set_power_state (pdev, device_state);return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 14/48 powerpc/compat: 32-bit little endian machine name is ppcle, not ppc
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Anton Blanchard <[email protected]>
commit 422b9b9684db3c511e65c91842275c43f5910ae9 upstream.
I noticed this when testing setarch. No, we don't magically support a big endian userspace on a little endian kernel.
--- arch/powerpc/include/asm/compat.h | 4 ++++ 1 file changed, 4 insertions(+)
arch/powerpc/include/asm/compat.h +4 -0
@@ -8,7 +8,11 @@#include <linux/sched.h> #define COMPAT_USER_HZ 100 +#ifdef __BIG_ENDIAN__#define COMPAT_UTS_MACHINE "ppc\0\0" +#else +#define COMPAT_UTS_MACHINE "ppcle\0\0" +#endif typedef u32 compat_size_t ;typedef s32 compat_ssize_t ;
Greg Kroah-Hartman
maintainerPATCH 15/48 powerpc/tm: Disable IRQ in tm_recheckpoint
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Neuling <[email protected]>
commit e6b8fd028b584ffca7a7255b8971f254932c9fce upstream.
We can't take an IRQ when we're about to do a trechkpt as our GPR state is set to user GPR values.
We've hit this when running some IBM Java stress tests in the lab resulting in the following dump:
cpu 0x3f: Vector: 700 (Program Check) at [c000000007eb3d40]
pc: c000000000050074: restore_gprs+0xc0/0x148
lr: 00000000b52a8184
sp: ac57d360
msr: 8000000100201030
current = 0xc00000002c500000
paca = 0xc000000007dbfc00 softe: 0 irq_happened: 0x00
pid = 34535, comm = Pooled Thread #
R00 = 00000000b52a8184 R16 = 00000000b3e48fda
R01 = 00000000ac57d360 R17 = 00000000ade79bd8
R02 = 00000000ac586930 R18 = 000000000fac9bcc
R03 = 00000000ade60000 R19 = 00000000ac57f930
R04 = 00000000f6624918 R20 = 00000000ade79be8
R05 = 00000000f663f238 R21 = 00000000ac218a54
R06 = 0000000000000002 R22 = 000000000f956280
R07 = 0000000000000008 R23 = 000000000000007e
R08 = 000000000000000a R24 = 000000000000000c
R09 = 00000000b6e69160 R25 = 00000000b424cf00
R10 = 0000000000000181 R26 = 00000000f66256d4
R11 = 000000000f365ec0 R27 = 00000000b6fdcdd0
R12 = 00000000f66400f0 R28 = 0000000000000001
R13 = 00000000ada71900 R29 = 00000000ade5a300
R14 = 00000000ac2185a8 R30 = 00000000f663f238
R15 = 0000000000000004 R31 = 00000000f6624918 pc = c000000000050074 restore_gprs+0xc0/0x148 cfar= c00000000004fe28 dont_restore_vec+0x1c/0x1a4 lr = 00000000b52a8184
msr = 8000000100201030 cr = 24804888
ctr = 0000000000000000 xer = 0000000000000000 trap = 700
This moves tm_recheckpoint to a C function and moves the tm_restore_sprs into that function. It then adds IRQ disabling over the trechkpt critical section. It also sets the TEXASR FS in the signals code to ensure this is never set now that we explictly write the TM sprs in tm_recheckpoint.
--- arch/powerpc/include/asm/reg.h | 1 + arch/powerpc/kernel/process.c | 34 ++++++++++++++++++++++++++++------ arch/powerpc/kernel/signal_32.c | 2 ++ arch/powerpc/kernel/signal_64.c | 2 ++ arch/powerpc/kernel/tm.S | 2 +- 5 files changed, 34 insertions(+), 7 deletions(-)
arch/powerpc/include/asm/reg.h +1 -0
@@ -208,6 +208,7 @@#define SPRN_ACOP 0x1F/* Available Coprocessor Register */ #define SPRN_TFIAR 0x81/* Transaction Failure Inst Addr */ #define SPRN_TEXASR 0x82/* Transaction EXception & Summary */ +#define TEXASR_FS __MASK(63-36)/* Transaction Failure Summary */ #define SPRN_TEXASRU 0x83/* '' '' '' Upper 32 */ #define SPRN_TFHAR 0x80/* Transaction Failure Handler Addr */ #define SPRN_CTRLF 0x088
arch/powerpc/kernel/process.c +28 -6
@@ -523,6 +523,31 @@ out_and_saveregs:tm_save_sprs (thr); } +extern void __tm_recheckpoint (struct thread_struct *thread, +unsigned long orig_msr); + +void tm_recheckpoint (struct thread_struct *thread, +unsigned long orig_msr) +{ +unsigned long flags; + +/* We really can't be interrupted here as the TEXASR registers can't +* change and later in the trecheckpoint code, we have a userspace R1. +* So let's hard disable over this region. +*/ +local_irq_save (flags); +hard_irq_disable (); + +/* The TM SPRs are restored here, so that TEXASR.FS can be set +* before the trecheckpoint and no explosion occurs. +*/ +tm_restore_sprs (thread); + +__tm_recheckpoint (thread, orig_msr); + +local_irq_restore (flags); +} +static inline void tm_recheckpoint_new_task (struct task_struct *new) {unsigned long msr;
@@ -541,13 +566,10 @@ static inline void tm_recheckpoint_new_tif (!new->thread.regs)return ; -/* The TM SPRs are restored here, so that TEXASR.FS can be set -* before the trecheckpoint and no explosion occurs. -*/ -tm_restore_sprs (&new->thread); - -if (!MSR_TM_ACTIVE (new->thread.regs->msr)) +if (!MSR_TM_ACTIVE (new->thread.regs->msr)){ +tm_restore_sprs (&new->thread);return ; + } msr = new->thread.tm_orig_msr;/* Recheckpoint to restore original checkpointed register state. */ TM_DEBUG("*** tm_recheckpoint of pid %d "
arch/powerpc/kernel/signal_32.c +2 -0
@@ -863,6 +863,8 @@ static long restore_tm_user_regs(struct* transactional versions should be loaded. */ tm_enable (); +/* Make sure the transaction is marked as failed */ + current->thread.tm_texasr |=TEXASR_FS ;/* This loads the checkpointed FP/VEC state, if used */ tm_recheckpoint (¤t->thread, msr);/* Get the top half of the MSR */
arch/powerpc/kernel/signal_64.c +2 -0
@@ -513,6 +513,8 @@ static long restore_tm_sigcontexts(struc }#endif tm_enable (); +/* Make sure the transaction is marked as failed */ + current->thread.tm_texasr |=TEXASR_FS ;/* This loads the checkpointed FP/VEC state, if used */ tm_recheckpoint (¤t->thread, msr);
arch/powerpc/kernel/tm.S +1 -1
@@ -296,7 +296,7 @@ dont_backup_fp: * Call with IRQs off, stacks get all out of sync for * some periods in here! */ -_GLOBAL(tm_recheckpoint) +_GLOBAL(__tm_recheckpoint) mfcr r5 mflr r0 std r5, 8(r1)
Greg Kroah-Hartman
maintainerPATCH 16/48 s390/chsc: fix SEI usage on old FW levels
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sebastian Ott <[email protected]>
commit 06cd7a874ec6e09d151aeb1fa8600e14f1ff89f6 upstream.
Using a notification type mask for the store event information chsc is unsupported on some firmware levels. Retry SEI with that mask set to zero (which is the old way of requesting only channel subsystem related events).
--- drivers/s390/cio/chsc.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-)
drivers/s390/cio/chsc.c +17 -5
@@ -500,18 +500,27 @@ static void chsc_process_sei_nt0(structstatic void chsc_process_event_information (struct chsc_sei *sei,u64 ntsm) { - do { +static int ntsm_unsupported; + +while (true) {memset (sei,0 ,sizeof (*sei)); sei->request.length =0x0010 ; sei->request.code =0x000e ; - sei->ntsm = ntsm; +if (!ntsm_unsupported) + sei->ntsm = ntsm;if (chsc (sei))break ;if (sei->response.code !=0x0001 ) { - CIO_CRW_EVENT(2, "chsc: sei failed (rc=%04x)\n", - sei->response.code); +CIO_CRW_EVENT (2 ,"chsc: sei failed (rc=%04x, ntsm=%llx)\n" , + sei->response.code, sei->ntsm); + +if (sei->response.code ==3 && sei->ntsm) { +/* Fallback for old firmware. */ + ntsm_unsupported =1 ; +continue ; + }break ; }
@@ -527,7 +536,10 @@ static void chsc_process_event_informatiCIO_CRW_EVENT (2 ,"chsc: unhandled nt: %d\n" , sei->nt);break ; } - }while (sei->u.nt0_area.flags &0x80 ); + +if (!(sei->u.nt0_area.flags &0x80 )) +break ; + } }/*
Greg Kroah-Hartman
maintainerPATCH 17/48 s390/bpf,jit: initialize A register if 1st insn is BPF_S_LDX_B_MSH
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Martin Schwidefsky <[email protected]>
commit 6e0de817594c61f3b392a9245deeb09609ec707d upstream.
The A register needs to be initialized to zero in the prolog if the first instruction of the BPF program is BPF_S_LDX_B_MSH to prevent leaking the content of %r5 to user space.
--- arch/s390/net/bpf_jit_comp.c | 1 - 1 file changed, 1 deletion(-)
arch/s390/net/bpf_jit_comp.c +0 -1
@@ -243,7 +243,6 @@ static void bpf_jit_noleaks(struct bpf_jcase BPF_S_LD_W_IND :case BPF_S_LD_H_IND :case BPF_S_LD_B_IND : -case BPF_S_LDX_B_MSH :case BPF_S_LD_IMM :case BPF_S_LD_MEM :case BPF_S_MISC_TXA :
Greg Kroah-Hartman
maintainerPATCH 18/48 ARC: Entry Handler tweaks: Simplify branch for in-kernel preemption
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vineet Gupta <[email protected]>
commit 147aece29b15051173eb1e767018135361cdba89 upstream.
--- arch/arc/kernel/entry.S | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
arch/arc/kernel/entry.S +2 -6
@@ -589,11 +589,7 @@ ARC_ENTRY ret_from_exception ; Pre-{IRQ,Trap,Exception} K/U mode from pt_regs->status32 ld r8, [sp, PT_status32] ; returning to User/Kernel Mode -#ifdef CONFIG_PREEMPT bbit0 r8, STATUS_U_BIT, resume_kernel_mode -#else - bbit0 r8, STATUS_U_BIT, restore_regs -#endif ; Before returning to User mode check-for-and-complete any pending work ; such as rescheduling/signal-delivery etc.
@@ -653,10 +649,10 @@ resume_user_mode_begin: b resume_user_mode_begin ; unconditionally back to U mode ret chks ; for single exit point from this block -#ifdef CONFIG_PREEMPT - resume_kernel_mode: +#ifdef CONFIG_PREEMPT + ; Can't preempt if preemption disabled GET_CURR_THR_INFO_FROM_SP r10 ld r8, [r10, THREAD_INFO_PREEMPT_COUNT]
Greg Kroah-Hartman
maintainerPATCH 19/48 ARC: Entry Handler tweaks: Optimize away redundant IRQ_DISABLE_SAVE
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vineet Gupta <[email protected]>
commit fce16bc35ae4a45634f3dc348d8d297a25c277cf upstream.
In the exception return path, for both U/K cases, intr are already disabled (for various existing reasons). So when we drop down to @restore_regs, we need not redo that.
There was subtle issue - when intr were NOT being disabled for ret-to-kernel-but-no-preemption case - now fixed by moving the IRQ_DISABLE further up in @resume_kernel_mode.
So what do we gain:
* Shaves off a few insn in return path.
* Eliminates the need for IRQ_DISABLE_SAVE assembler macro for ARCv2 hence allows for entry code sharing.
--- arch/arc/include/asm/irqflags.h | 7 ------- arch/arc/kernel/entry.S | 10 +++++----- 2 files changed, 5 insertions(+), 12 deletions(-)
arch/arc/include/asm/irqflags.h +0 -7
@@ -137,13 +137,6 @@ static inline void arch_unmask_irq(unsig flag \scratch .endm -.macro IRQ_DISABLE_SAVE scratch, save - lr \scratch, [status32] - mov \save, \scratch /* Make a copy */ - bic \scratch, \scratch, (STATUS_E1_MASK | STATUS_E2_MASK) - flag \scratch -.endm - .macro IRQ_ENABLE scratch lr \scratch, [status32] or \scratch, \scratch, (STATUS_E1_MASK | STATUS_E2_MASK)
arch/arc/kernel/entry.S +5 -5
@@ -653,6 +653,9 @@ resume_kernel_mode: #ifdef CONFIG_PREEMPT + ; This is a must for preempt_schedule_irq() + IRQ_DISABLE r9 + ; Can't preempt if preemption disabled GET_CURR_THR_INFO_FROM_SP r10 ld r8, [r10, THREAD_INFO_PREEMPT_COUNT]
@@ -662,8 +665,6 @@ resume_kernel_mode: ld r9, [r10, THREAD_INFO_FLAGS] bbit0 r9, TIF_NEED_RESCHED, restore_regs - IRQ_DISABLE r9 - ; Invoke PREEMPTION bl preempt_schedule_irq
@@ -676,12 +677,11 @@ resume_kernel_mode: ; ; Restore the saved sys context (common exit-path for EXCPN/IRQ/Trap) ; IRQ shd definitely not happen between now and rtie +; All 2 entry points to here already disable interrupts restore_regs : - ; Disable Interrupts while restoring reg-file back - ; XXX can this be optimised out - IRQ_DISABLE_SAVE r9, r10 ;@r10 has prisitine (pre-disable) copy + lr r10, [status32] #ifdef CONFIG_ARC_CURR_IN_REG ; Restore User R25
Greg Kroah-Hartman
maintainerPATCH 20/48 framebuffer: fix cfb_copyarea
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikulas Patocka <[email protected]>
commit 00a9d699bc85052d2d3ed56251cd928024ce06a3 upstream.
The function cfb_copyarea is buggy when the copy operation is not aligned on long boundary (4 bytes on 32-bit machines, 8 bytes on 64-bit machines).
How to reproduce:
- use x86-64 machine
- use a framebuffer driver without acceleration (for example uvesafb)
- set the framebuffer to 8-bit depth
(for example fbset -a 1024x768-60 -depth 8)
- load a font with character width that is not a multiple of 8 pixels
note: the console-tools package cannot load a font that has width different from 8 pixels. You need to install the packages "kbd" and "console-terminus" and use the program "setfont" to set font width (for example: setfont Uni2-Terminus20x10)
- move some text left and right on the bash command line and you get a screen corruption
To expose more bugs, put this line to the end of uvesafb_init_info:info->flags |= FBINFO_HWACCEL_COPYAREA | FBINFO_READS_FAST;
- Now framebuffer console will use cfb_copyarea for console scrolling. You get a screen corruption when console is scrolled.
This patch is a rewrite of cfb_copyarea. It fixes the bugs, with this patch, console scrolling in 8-bit depth with a font width that is not a multiple of 8 pixels works fine.
The cfb_copyarea code was very buggy and it looks like it was written and never tried with non-8-pixel font.
--- drivers/video/cfbcopyarea.c | 153 ++++++++++++++++++++++---------------------- 1 file changed, 78 insertions(+), 75 deletions(-)
drivers/video/cfbcopyarea.c +78 -75
@@ -43,13 +43,22 @@*/ static void -bitcpy (struct fb_info *p,unsigned long __iomem *dst,int dst_idx, -const unsigned long __iomem *src,int src_idx,int bits, +bitcpy (struct fb_info *p,unsigned long __iomem *dst,unsigned dst_idx, +const unsigned long __iomem *src,unsigned src_idx,int bits,unsigned n,u32 bswapmask) {unsigned long first, last;int const shift = dst_idx-src_idx; -int left, right; + +#if 0 +/* +* If you suspect bug in this function, compare it with this simple +* memmove implementation. +*/ +fb_memmove ((char *)dst + ((dst_idx & (bits -1 ))) /8 , + (char *)src + ((src_idx & (bits -1 ))) /8 , n /8 ); +return ; +#endif first =fb_shifted_pixels_mask_long (p, dst_idx, bswapmask); last = ~fb_shifted_pixels_mask_long (p, (dst_idx+n) % bits, bswapmask);
@@ -98,9 +107,8 @@ bitcpy(struct fb_info *p, unsigned longunsigned long d0, d1;int m; - right = shift & (bits -1 ); - left = -shift & (bits -1 ); - bswapmask &= shift; +int const left = shift & (bits -1 ); +int const right = -shift & (bits -1 );if (dst_idx+n <= bits) {// Single destination word
@@ -110,15 +118,15 @@ bitcpy(struct fb_info *p, unsigned long d0 =fb_rev_pixels_in_long (d0, bswapmask);if (shift >0 ) {// Single source word - d0 >>= right; + d0 <<= left; }else if (src_idx+n <= bits) {// Single source word - d0 <<= left; + d0 >>= right; }else {// 2 source words d1 =FB_READL (src +1 ); d1 =fb_rev_pixels_in_long (d1, bswapmask); - d0 = d0<<left | d1>>right; + d0 = d0 >> right | d1 << left; } d0 =fb_rev_pixels_in_long (d0, bswapmask);FB_WRITEL (comp (d0,FB_READL (dst), first), dst);
@@ -135,60 +143,59 @@ bitcpy(struct fb_info *p, unsigned longif (shift >0 ) {// Single source word d1 = d0; - d0 >>= right; - dst++; + d0 <<= left; n -= bits - dst_idx; }else {// 2 source words d1 =FB_READL (src++); d1 =fb_rev_pixels_in_long (d1, bswapmask); - d0 = d0<<left | d1>>right; - dst++; + d0 = d0 >> right | d1 << left; n -= bits - dst_idx; } d0 =fb_rev_pixels_in_long (d0, bswapmask);FB_WRITEL (comp (d0,FB_READL (dst), first), dst); d0 = d1; + dst++;// Main chunk m = n % bits; n /= bits;while ((n >=4 ) && !bswapmask) { d1 =FB_READL (src++); -FB_WRITEL (d0 << left | d1 >> right, dst++); +FB_WRITEL (d0 >> right | d1 << left, dst++); d0 = d1; d1 =FB_READL (src++); -FB_WRITEL (d0 << left | d1 >> right, dst++); +FB_WRITEL (d0 >> right | d1 << left, dst++); d0 = d1; d1 =FB_READL (src++); -FB_WRITEL (d0 << left | d1 >> right, dst++); +FB_WRITEL (d0 >> right | d1 << left, dst++); d0 = d1; d1 =FB_READL (src++); -FB_WRITEL (d0 << left | d1 >> right, dst++); +FB_WRITEL (d0 >> right | d1 << left, dst++); d0 = d1; n -=4 ; }while (n--) { d1 =FB_READL (src++); d1 =fb_rev_pixels_in_long (d1, bswapmask); - d0 = d0 << left | d1 >> right; + d0 = d0 >> right | d1 << left; d0 =fb_rev_pixels_in_long (d0, bswapmask);FB_WRITEL (d0, dst++); d0 = d1; }// Trailing bits -if (last) { -if (m <= right) { +if (m) { +if (m <= bits - right) {// Single source word - d0 <<= left; + d0 >>= right; }else {// 2 source words d1 =FB_READL (src); d1 =fb_rev_pixels_in_long (d1, bswapmask); - d0 = d0<<left | d1>>right; + d0 = d0 >> right | d1 << left; } d0 =fb_rev_pixels_in_long (d0, bswapmask);FB_WRITEL (comp (d0,FB_READL (dst), last), dst);
@@ -202,43 +209,46 @@ bitcpy(struct fb_info *p, unsigned long*/ static void -bitcpy_rev (struct fb_info *p,unsigned long __iomem *dst,int dst_idx, -const unsigned long __iomem *src,int src_idx,int bits, +bitcpy_rev (struct fb_info *p,unsigned long __iomem *dst,unsigned dst_idx, +const unsigned long __iomem *src,unsigned src_idx,int bits,unsigned n,u32 bswapmask) {unsigned long first, last;int shift; - dst += (n-1 )/bits; - src += (n-1 )/bits; -if ((n-1 ) % bits) { - dst_idx += (n-1 ) % bits; - dst += dst_idx >> (ffs (bits) -1 ); - dst_idx &= bits -1 ; - src_idx += (n-1 ) % bits; - src += src_idx >> (ffs (bits) -1 ); - src_idx &= bits -1 ; - } +#if 0 +/* +* If you suspect bug in this function, compare it with this simple +* memmove implementation. +*/ +fb_memmove ((char *)dst + ((dst_idx & (bits -1 ))) /8 , + (char *)src + ((src_idx & (bits -1 ))) /8 , n /8 ); +return ; +#endif + + dst += (dst_idx + n -1 ) / bits; + src += (src_idx + n -1 ) / bits; + dst_idx = (dst_idx + n -1 ) % bits; + src_idx = (src_idx + n -1 ) % bits; shift = dst_idx-src_idx; - first =fb_shifted_pixels_mask_long (p, bits -1 - dst_idx, bswapmask); - last = ~fb_shifted_pixels_mask_long (p, bits -1 - ((dst_idx-n) % bits), - bswapmask); + first = ~fb_shifted_pixels_mask_long (p, (dst_idx +1 ) % bits, bswapmask); + last =fb_shifted_pixels_mask_long (p, (bits + dst_idx +1 - n) % bits, bswapmask);if (!shift) {// Same alignment for source and dest if ((unsigned long )dst_idx+1 >= n) {// Single word -if (last) - first &= last; -FB_WRITEL (comp (FB_READL (src),FB_READL (dst), first), dst); +if (first) + last &= first; +FB_WRITEL (comp (FB_READL (src),FB_READL (dst), last), dst); }else {// Multiple destination words // Leading bits -if (first != ~0UL ) { +if (first) {FB_WRITEL (comp (FB_READL (src),FB_READL (dst), first), dst); dst--; src--;
@@ -262,7 +272,7 @@ bitcpy_rev(struct fb_info *p, unsigned lFB_WRITEL (FB_READL (src--), dst--);// Trailing bits -if (last) +if (last !=-1UL )FB_WRITEL (comp (FB_READL (src),FB_READL (dst), last), dst); } }else {
@@ -270,29 +280,28 @@ bitcpy_rev(struct fb_info *p, unsigned lunsigned long d0, d1;int m; -int const left = -shift & (bits-1 ); -int const right = shift & (bits-1 ); - bswapmask &= shift; +int const left = shift & (bits-1 ); +int const right = -shift & (bits-1 );if ((unsigned long )dst_idx+1 >= n) {// Single destination word -if (last) - first &= last; +if (first) + last &= first; d0 =FB_READL (src);if (shift <0 ) {// Single source word - d0 <<= left; + d0 >>= right; }else if (1 +(unsigned long )src_idx >= n) {// Single source word - d0 >>= right; + d0 <<= left; }else {// 2 source words d1 =FB_READL (src -1 ); d1 =fb_rev_pixels_in_long (d1, bswapmask); - d0 = d0>>right | d1<<left; + d0 = d0 << left | d1 >> right; } d0 =fb_rev_pixels_in_long (d0, bswapmask); -FB_WRITEL (comp (d0,FB_READL (dst), first), dst); +FB_WRITEL (comp (d0,FB_READL (dst), last), dst); }else {// Multiple destination words /** We must always remember the last value read, because in case
@@ -307,12 +316,12 @@ bitcpy_rev(struct fb_info *p, unsigned lif (shift <0 ) {// Single source word d1 = d0; - d0 <<= left; + d0 >>= right; }else {// 2 source words d1 =FB_READL (src--); d1 =fb_rev_pixels_in_long (d1, bswapmask); - d0 = d0>>right | d1<<left; + d0 = d0 << left | d1 >> right; } d0 =fb_rev_pixels_in_long (d0, bswapmask);FB_WRITEL (comp (d0,FB_READL (dst), first), dst);
@@ -325,39 +334,39 @@ bitcpy_rev(struct fb_info *p, unsigned l n /= bits;while ((n >=4 ) && !bswapmask) { d1 =FB_READL (src--); -FB_WRITEL (d0 >> right | d1 << left, dst--); +FB_WRITEL (d0 << left | d1 >> right, dst--); d0 = d1; d1 =FB_READL (src--); -FB_WRITEL (d0 >> right | d1 << left, dst--); +FB_WRITEL (d0 << left | d1 >> right, dst--); d0 = d1; d1 =FB_READL (src--); -FB_WRITEL (d0 >> right | d1 << left, dst--); +FB_WRITEL (d0 << left | d1 >> right, dst--); d0 = d1; d1 =FB_READL (src--); -FB_WRITEL (d0 >> right | d1 << left, dst--); +FB_WRITEL (d0 << left | d1 >> right, dst--); d0 = d1; n -=4 ; }while (n--) { d1 =FB_READL (src--); d1 =fb_rev_pixels_in_long (d1, bswapmask); - d0 = d0 >> right | d1 << left; + d0 = d0 << left | d1 >> right; d0 =fb_rev_pixels_in_long (d0, bswapmask);FB_WRITEL (d0, dst--); d0 = d1; }// Trailing bits -if (last) { -if (m <= left) { +if (m) { +if (m <= bits - left) {// Single source word - d0 >>= right; + d0 <<= left; }else {// 2 source words d1 =FB_READL (src); d1 =fb_rev_pixels_in_long (d1, bswapmask); - d0 = d0>>right | d1<<left; + d0 = d0 << left | d1 >> right; } d0 =fb_rev_pixels_in_long (d0, bswapmask);FB_WRITEL (comp (d0,FB_READL (dst), last), dst);
@@ -371,9 +380,9 @@ void cfb_copyarea(struct fb_info *p, conu32 dx = area->dx, dy = area->dy, sx = area->sx, sy = area->sy;u32 height = area->height, width = area->width;unsigned long const bits_per_line = p->fix.line_length*8u ; -unsigned long __iomem *dst =NULL , *src =NULL ; +unsigned long __iomem *base =NULL ;int bits =BITS_PER_LONG , bytes = bits >>3 ; -int dst_idx =0 , src_idx =0 , rev_copy =0 ; +unsigned dst_idx =0 , src_idx =0 , rev_copy =0 ;u32 bswapmask =fb_compute_bswapmask (p);if (p->state !=FBINFO_STATE_RUNNING )
@@ -389,7 +398,7 @@ void cfb_copyarea(struct fb_info *p, con// split the base of the framebuffer into a long-aligned address and the // index of the first bit - dst = src = (unsigned long __iomem *)((unsigned long )p->screen_base & ~(bytes-1 )); + base = (unsigned long __iomem *)((unsigned long )p->screen_base & ~(bytes-1 )); dst_idx = src_idx =8 *((unsigned long )p->screen_base & (bytes-1 ));// add offset of source and target area dst_idx += dy*bits_per_line + dx*p->var.bits_per_pixel;
@@ -402,20 +411,14 @@ void cfb_copyarea(struct fb_info *p, conwhile (height--) { dst_idx -= bits_per_line; src_idx -= bits_per_line; - dst += dst_idx >> (ffs (bits) -1 ); - dst_idx &= (bytes -1 ); - src += src_idx >> (ffs (bits) -1 ); - src_idx &= (bytes -1 ); -bitcpy_rev (p, dst, dst_idx, src, src_idx, bits, +bitcpy_rev (p, base + (dst_idx / bits), dst_idx % bits, + base + (src_idx / bits), src_idx % bits, bits, width*p->var.bits_per_pixel, bswapmask); } }else {while (height--) { - dst += dst_idx >> (ffs (bits) -1 ); - dst_idx &= (bytes -1 ); - src += src_idx >> (ffs (bits) -1 ); - src_idx &= (bytes -1 ); -bitcpy (p, dst, dst_idx, src, src_idx, bits, +bitcpy (p, base + (dst_idx / bits), dst_idx % bits, + base + (src_idx / bits), src_idx % bits, bits, width*p->var.bits_per_pixel, bswapmask); dst_idx += bits_per_line; src_idx += bits_per_line;
Greg Kroah-Hartman
maintainerPATCH 21/48 matroxfb: restore the registers M_ACCESS and M_PITCH
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikulas Patocka <[email protected]>
commit a772d4736641ec1b421ad965e13457c17379fc86 upstream.
When X11 is running and the user switches back to console, the card modifies the content of registers M_MACCESS and M_PITCH in periodic intervals.
This patch fixes it by restoring the content of these registers before issuing any accelerator command.
--- drivers/video/matrox/matroxfb_accel.c | 38 +++++++++++++++++++++++++--------- drivers/video/matrox/matroxfb_base.h | 2 + 2 files changed, 30 insertions(+), 10 deletions(-)
drivers/video/matrox/matroxfb_accel.c +28 -10
@@ -192,10 +192,18 @@ void matrox_cfbX_init(struct matrox_fb_i minfo->accel.m_dwg_rect =M_DWG_TRAP |M_DWG_SOLID |M_DWG_ARZERO |M_DWG_SGNZERO |M_DWG_SHIFTZERO ;if (isMilleniumII (minfo)) minfo->accel.m_dwg_rect |=M_DWG_TRANSC ; minfo->accel.m_opmode = mopmode; + minfo->accel.m_access = maccess; + minfo->accel.m_pitch = mpitch; }EXPORT_SYMBOL (matrox_cfbX_init); +static void matrox_accel_restore_maccess (struct matrox_fb_info *minfo) +{ +mga_outl (M_MACCESS , minfo->accel.m_access); +mga_outl (M_PITCH , minfo->accel.m_pitch); +} +static void matrox_accel_bmove (struct matrox_fb_info *minfo,int vxres,int sy,int sx,int dy,int dx,int height,int width) {
@@ -207,7 +215,8 @@ static void matrox_accel_bmove(struct maCRITBEGIN if ((dy < sy) || ((dy == sy) && (dx <= sx))) { -mga_fifo (2 ); +mga_fifo (4 ); +matrox_accel_restore_maccess (minfo);mga_outl (M_DWGCTL ,M_DWG_BITBLT |M_DWG_SHIFTZERO |M_DWG_SGNZERO |M_DWG_BFCOL |M_DWG_REPLACE );mga_outl (M_AR5 , vxres);
@@ -215,7 +224,8 @@ static void matrox_accel_bmove(struct ma start = sy*vxres+sx+curr_ydstorg (minfo); end = start+width; }else { -mga_fifo (3 ); +mga_fifo (5 ); +matrox_accel_restore_maccess (minfo);mga_outl (M_DWGCTL ,M_DWG_BITBLT |M_DWG_SHIFTZERO |M_DWG_BFCOL |M_DWG_REPLACE );mga_outl (M_SGN ,5 );mga_outl (M_AR5 , -vxres);
@@ -224,7 +234,8 @@ static void matrox_accel_bmove(struct ma start = end+width; dy += height-1 ; } -mga_fifo (4 ); +mga_fifo (6 ); +matrox_accel_restore_maccess (minfo);mga_outl (M_AR0 , end);mga_outl (M_AR3 , start);mga_outl (M_FXBNDRY , ((dx+width)<<16 ) | dx);
@@ -246,7 +257,8 @@ static void matrox_accel_bmove_lin(strucCRITBEGIN if ((dy < sy) || ((dy == sy) && (dx <= sx))) { -mga_fifo (2 ); +mga_fifo (4 ); +matrox_accel_restore_maccess (minfo);mga_outl (M_DWGCTL ,M_DWG_BITBLT |M_DWG_SHIFTZERO |M_DWG_SGNZERO |M_DWG_BFCOL |M_DWG_REPLACE );mga_outl (M_AR5 , vxres);
@@ -254,7 +266,8 @@ static void matrox_accel_bmove_lin(struc start = sy*vxres+sx+curr_ydstorg (minfo); end = start+width; }else { -mga_fifo (3 ); +mga_fifo (5 ); +matrox_accel_restore_maccess (minfo);mga_outl (M_DWGCTL ,M_DWG_BITBLT |M_DWG_SHIFTZERO |M_DWG_BFCOL |M_DWG_REPLACE );mga_outl (M_SGN ,5 );mga_outl (M_AR5 , -vxres);
@@ -263,7 +276,8 @@ static void matrox_accel_bmove_lin(struc start = end+width; dy += height-1 ; } -mga_fifo (5 ); +mga_fifo (7 ); +matrox_accel_restore_maccess (minfo);mga_outl (M_AR0 , end);mga_outl (M_AR3 , start);mga_outl (M_FXBNDRY , ((dx+width)<<16 ) | dx);
@@ -298,7 +312,8 @@ static void matroxfb_accel_clear(structCRITBEGIN - mga_fifo(5); + mga_fifo(7); +matrox_accel_restore_maccess (minfo);mga_outl (M_DWGCTL , minfo->accel.m_dwg_rect |M_DWG_REPLACE );mga_outl (M_FCOL , color);mga_outl (M_FXBNDRY , ((sx + width) <<16 ) | sx);
@@ -341,7 +356,8 @@ static void matroxfb_cfb4_clear(struct m width >>=1 ; sx >>=1 ;if (width) { -mga_fifo (5 ); +mga_fifo (7 ); +matrox_accel_restore_maccess (minfo);mga_outl (M_DWGCTL , minfo->accel.m_dwg_rect |M_DWG_REPLACE2 );mga_outl (M_FCOL , bgx);mga_outl (M_FXBNDRY , ((sx + width) <<16 ) | sx);
@@ -415,7 +431,8 @@ static void matroxfb_1bpp_imageblit(struCRITBEGIN - mga_fifo(3); + mga_fifo(5); +matrox_accel_restore_maccess (minfo);if (easy)mga_outl (M_DWGCTL ,M_DWG_ILOAD |M_DWG_SGNZERO |M_DWG_SHIFTZERO |M_DWG_BMONOWF |M_DWG_LINEAR |M_DWG_REPLACE );else
@@ -425,7 +442,8 @@ static void matroxfb_1bpp_imageblit(stru fxbndry = ((xx + width -1 ) <<16 ) | xx; mmio = minfo->mmio.vbase; -mga_fifo (6 ); +mga_fifo (8 ); +matrox_accel_restore_maccess (minfo);mga_writel (mmio,M_FXBNDRY , fxbndry);mga_writel (mmio,M_AR0 , ar0);mga_writel (mmio,M_AR3 ,0 );
drivers/video/matrox/matroxfb_base.h +2 -0
@@ -307,6 +307,8 @@ struct matrox_accel_data {#endif u_int32_t m_dwg_rect;u_int32_t m_opmode; +u_int32_t m_access; +u_int32_t m_pitch; };struct v4l2_queryctrl ;
Greg Kroah-Hartman
maintainerPATCH 22/48 mach64: use unaligned access
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikulas Patocka <[email protected]>
commit c29dd8696dc5dbd50b3ac441b8a26751277ba520 upstream.
This patch fixes mach64 to use unaligned access to the font bitmap.
This fixes unaligned access warning on sparc64 when 14x8 font is loaded.
On x86(64), unaligned access is handled in hardware, so both functions le32_to_cpup and get_unaligned_le32 perform the same operation.
On RISC machines, unaligned access is not handled in hardware, so we better use get_unaligned_le32 to avoid the unaligned trap and warning.
--- drivers/video/aty/mach64_accel.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/video/aty/mach64_accel.c +2 -1
@@ -4,6 +4,7 @@*/ #include <linux/delay.h> +#include <asm/unaligned.h> #include <linux/fb.h> #include <video/mach64.h> #include "atyfb.h"
@@ -419,7 +420,7 @@ void atyfb_imageblit(struct fb_info *infu32 *pbitmap, dwords = (src_bytes +3 ) /4 ;for (pbitmap = (u32 *)(image->data); dwords; dwords--, pbitmap++) {wait_for_fifo (1 , par); -aty_st_le32 (HOST_DATA0 ,le32_to_cpup (pbitmap), par); +aty_st_le32 (HOST_DATA0 ,get_unaligned_le32 (pbitmap), par); } }
Greg Kroah-Hartman
maintainerPATCH 23/48 mach64: fix cursor when character width is not a multiple of 8 pixels
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikulas Patocka <[email protected]>
commit 43751a1b8ee2e70ce392bf31ef3133da324e68b3 upstream.
This patch fixes the hardware cursor on mach64 when font width is not a multiple of 8 pixels.
If you load such a font, the cursor is expanded to the next 8-byte boundary and a part of the next character after the cursor is not visible.
For example, when you load a font with 12-pixel width, the cursor width is 16 pixels and when the cursor is displayed, 4 pixels of the next character are not visible.
The reason is this: atyfb_cursor is called with proper parameters to load an image that is 12-pixel wide. However, the number is aligned on the next 8-pixel boundary on the line
"unsigned int width = (cursor->image.width + 7) >> 3;" and the whole function acts as it is was loading a 16-pixel image.
This patch fixes it so that the value written to the framebuffer is padded with 0xaaaa (the transparent pattern) when the image size it not a multiple of 8 pixels. The transparent pattern causes that the cursor will not interfere with the next character.
--- drivers/video/aty/mach64_cursor.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-)
drivers/video/aty/mach64_cursor.c +16 -6
@@ -5,6 +5,7 @@#include <linux/fb.h> #include <linux/init.h> #include <linux/string.h> +#include "../fb_draw.h" #include <asm/io.h>
@@ -157,24 +158,33 @@ static int atyfb_cursor(struct fb_info *for (i =0 ; i < height; i++) {for (j =0 ; j < width; j++) { +u16 l =0xaaaa ; b = *src++; m = *msk++;switch (cursor->rop) {case ROP_XOR :// Upper 4 bits of mask data -fb_writeb (cursor_bits_lookup[(b ^ m) >>4 ], dst++); + l = cursor_bits_lookup[(b ^ m) >>4 ] |// Lower 4 bits of mask -fb_writeb (cursor_bits_lookup[(b ^ m) &0x0f ], - dst++); + (cursor_bits_lookup[(b ^ m) &0x0f ] <<8 );break ;case ROP_COPY :// Upper 4 bits of mask data -fb_writeb (cursor_bits_lookup[(b & m) >>4 ], dst++); + l = cursor_bits_lookup[(b & m) >>4 ] |// Lower 4 bits of mask -fb_writeb (cursor_bits_lookup[(b & m) &0x0f ], - dst++); + (cursor_bits_lookup[(b & m) &0x0f ] <<8 );break ; } +/* +* If cursor size is not a multiple of 8 characters +* we must pad it with transparent pattern (0xaaaa). +*/ +if ((j +1 ) *8 > cursor->image.width) { + l =comp (l,0xaaaa , + (1 << ((cursor->image.width &7 ) *2 )) -1 ); + } +fb_writeb (l &0xff , dst++); +fb_writeb (l >>8 , dst++); } dst += offset; }
Greg Kroah-Hartman
maintainerPATCH 24/48 b43: Fix machine check error due to improper access of B43_MMIO_PSM_PHY_HDR
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rafał Miłecki <[email protected]>
commit 12cd43c6ed6da7bf7c5afbd74da6959cda6d056b upstream.
Register B43_MMIO_PSM_PHY_HDR is 16 bit one, so accessing it with 32b functions isn't safe. On my machine it causes delayed (!) CPU exception:
Disabling lock debugging due to kernel taint
mce: [Hardware Error]: CPU 0: Machine Check Exception: 4 Bank 4: b200000000070f0f
mce: [Hardware Error]: TSC 164083803dc
mce: [Hardware Error]: PROCESSOR 2:20fc2 TIME 1396650505 SOCKET 0 APIC 0 microcode 0
mce: [Hardware Error]: Run the above through 'mcelog --ascii'
mce: [Hardware Error]: Machine check: Processor context corrupt
Kernel panic - not syncing: Fatal machine check on current CPU
Kernel Offset: 0x0 from 0xffffffff81000000 (relocation range: 0xffffffff80000000-0xffffffff9fffffff)
--- drivers/net/wireless/b43/phy_n.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/net/wireless/b43/phy_n.c +7 -7
@@ -5175,22 +5175,22 @@ static void b43_nphy_channel_setup(strucint ch = new_channel->hw_value;u16 old_band_5ghz; -u32 tmp32; +u16 tmp16; old_band_5ghz =b43_phy_read (dev,B43_NPHY_BANDCTL ) &B43_NPHY_BANDCTL_5GHZ ;if (new_channel->band ==IEEE80211_BAND_5GHZ && !old_band_5ghz) { - tmp32 =b43_read32 (dev,B43_MMIO_PSM_PHY_HDR ); -b43_write32 (dev,B43_MMIO_PSM_PHY_HDR , tmp32 |4 ); + tmp16 =b43_read16 (dev,B43_MMIO_PSM_PHY_HDR ); +b43_write16 (dev,B43_MMIO_PSM_PHY_HDR , tmp16 |4 );b43_phy_set (dev,B43_PHY_B_BBCFG ,0xC000 ); -b43_write32 (dev,B43_MMIO_PSM_PHY_HDR , tmp32); +b43_write16 (dev,B43_MMIO_PSM_PHY_HDR , tmp16);b43_phy_set (dev,B43_NPHY_BANDCTL ,B43_NPHY_BANDCTL_5GHZ ); }else if (new_channel->band ==IEEE80211_BAND_2GHZ && old_band_5ghz) {b43_phy_mask (dev,B43_NPHY_BANDCTL , ~B43_NPHY_BANDCTL_5GHZ ); - tmp32 =b43_read32 (dev,B43_MMIO_PSM_PHY_HDR ); -b43_write32 (dev,B43_MMIO_PSM_PHY_HDR , tmp32 |4 ); + tmp16 =b43_read16 (dev,B43_MMIO_PSM_PHY_HDR ); +b43_write16 (dev,B43_MMIO_PSM_PHY_HDR , tmp16 |4 );b43_phy_mask (dev,B43_PHY_B_BBCFG ,0x3FFF ); -b43_write32 (dev,B43_MMIO_PSM_PHY_HDR , tmp32); +b43_write16 (dev,B43_MMIO_PSM_PHY_HDR , tmp16); }b43_chantab_phy_upload (dev, e);
Greg Kroah-Hartman
maintainerPATCH 25/48 libata/ahci: accommodate tag ordered controllers
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Williams <[email protected]>
commit 8a4aeec8d2d6a3edeffbdfae451cdf05cbf0fefd upstream.
The AHCI spec allows implementations to issue commands in tag order rather than FIFO order:
5.3.2.12 P:SelectCmd
HBA sets pSlotLoc = (pSlotLoc + 1) mod (CAP.NCS + 1) or HBA selects the command to issue that has had the PxCI bit set to '1' longer than any other command pending to be issued.
The result is that commands posted sequentially (time-wise) may play out of sequence when issued by hardware.
This behavior has likely been hidden by drives that arrange for commands to complete in issue order. However, it appears recent drives (two from different vendors that we have found so far) inflict out-of-order completions as a matter of course. So, we need to take care to maintain ordered submission, otherwise we risk triggering a drive to fall out of sequential-io automation and back to random-io processing, which incurs large latency and degrades throughput.
This issue was found in simple benchmarks where QD=2 seq-write performance was 30-50% *greater* than QD=32 seq-write performance.
Tagging for -stable and making the change globally since it has a low risk-to-reward ratio. Also, word is that recent versions of an unnamed OS also does it this way now. So, drives in the field are already experienced with this tag ordering scheme.
--- drivers/ata/libata-core.c | 21 +++++++++++++-------- include/linux/libata.h | 1 + 2 files changed, 14 insertions(+), 8 deletions(-)
drivers/ata/libata-core.c +13 -8
@@ -4765,21 +4765,26 @@ void swap_buf_le16(u16 *buf, unsigned instatic struct ata_queued_cmd *ata_qc_new (struct ata_port *ap) {struct ata_queued_cmd *qc =NULL ; -unsigned int i; +unsigned int i, tag;/* no command while frozen */ if (unlikely (ap->pflags &ATA_PFLAG_FROZEN ))return NULL ; -/* the last tag is reserved for internal command. */ -for (i =0 ; i <ATA_MAX_QUEUE -1 ; i++) -if (!test_and_set_bit (i, &ap->qc_allocated)) { - qc =__ata_qc_from_tag (ap, i); +for (i =0 ; i <ATA_MAX_QUEUE ; i++) { + tag = (i + ap->last_tag +1 ) %ATA_MAX_QUEUE ; + +/* the last tag is reserved for internal command. */ +if (tag ==ATA_TAG_INTERNAL ) +continue ; + +if (!test_and_set_bit (tag, &ap->qc_allocated)) { + qc =__ata_qc_from_tag (ap, tag); + qc->tag = tag; + ap->last_tag = tag;break ; } - -if (qc) - qc->tag = i; + }return qc; }
include/linux/libata.h +1 -0
@@ -772,6 +772,7 @@ struct ata_port {unsigned long qc_allocated;unsigned int qc_active;int nr_active_links;/* #links with active qcs */ +unsigned int last_tag;/* track next tag hw expects */ struct ata_link link;/* host default link */ struct ata_link *slave_link;/* see ata_slave_link_init() */
Greg Kroah-Hartman
maintainerPATCH 26/48 iwlwifi: dvm: take mutex when sending SYNC BT config command
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Emmanuel Grumbach <[email protected]>
commit 82e5a649453a3cf23516277abb84273768a1592b upstream.
There is a flow in which we send the host command in SYNC mode, but we don't take priv->mutex.
--- drivers/net/wireless/iwlwifi/dvm/main.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/net/wireless/iwlwifi/dvm/main.c +6 -2
@@ -252,13 +252,17 @@ static void iwl_bg_bt_runtime_config(strstruct iwl_priv *priv = container_of(work, struct iwl_priv, bt_runtime_config); +mutex_lock (&priv->mutex);if (test_bit (STATUS_EXIT_PENDING , &priv->status)) -return ; + goto out;/* dont send host command if rf-kill is on */ if (!iwl_is_ready_rf (priv)) -return ; + goto out; +iwlagn_send_advance_bt_config (priv); +out: +mutex_unlock (&priv->mutex); }static void iwl_bg_bt_full_concurrency (struct work_struct *work)
Greg Kroah-Hartman
maintainerPATCH 27/48 mac80211: fix WPA with VLAN on AP side with ps-sta again
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Braun <[email protected]>
commit 112c44b2df0984121a52fbda89425843b8e1a457 upstream.
commit de74a1d9032f4d37ea453ad2a647e1aff4cd2591
"mac80211: fix WPA with VLAN on AP side with ps-sta"
fixed an issue where queued multicast packets would be sent out encrypted with the key of an other bss.
commit "7cbf9d017dbb5e3276de7d527925d42d4c11e732"
"mac80211: fix oops on mesh PS broadcast forwarding"
essentially reverted it, because vif.type cannot be AP_VLAN due to the check to vif.type in ieee80211_get_buffered_bc before.
As the later commit intended to fix the MESH case, fix it by checking for IFTYPE_AP instead of IFTYPE_AP_VLAN.
--- net/mac80211/tx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/mac80211/tx.c +1 -1
@@ -2711,7 +2711,7 @@ ieee80211_get_buffered_bc(struct ieee802cpu_to_le16 (IEEE80211_FCTL_MOREDATA ); } -if (sdata->vif.type ==NL80211_IFTYPE_AP_VLAN ) +if (sdata->vif.type ==NL80211_IFTYPE_AP ) sdata =IEEE80211_DEV_TO_SUB_IF (skb->dev);if (!ieee80211_tx_prepare (sdata, &tx, skb))break ;
Greg Kroah-Hartman
maintainerPATCH 28/48 mac80211: fix software remain-on-channel implementation
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johannes Berg <[email protected]>
commit 115b943a6ea12656088fa1ff6634c0d30815e55b upstream.
Jouni reported that when doing off-channel transmissions mixed with on-channel transmissions, the on-channel ones ended up on the off-channel in some cases.
The reason for that is that during the refactoring of the off- channel code, I lost the part that stopped all activity and as a consequence the on-channel frames (including data frames) were no longer queued but would be transmitted on the temporary channel.
Fix this by simply restoring the lost activity stop call.
--- net/mac80211/offchannel.c | 1 + 1 file changed, 1 insertion(+)
net/mac80211/offchannel.c +1 -0
@@ -355,6 +355,7 @@ void ieee80211_sw_roc_work(struct work_sstruct ieee80211_roc_work *dep;/* start this ROC */ +ieee80211_offchannel_stop_vifs (local);/* switch channel etc */ ieee80211_recalc_idle (local);
Greg Kroah-Hartman
maintainerPATCH 29/48 mac80211: exclude AP_VLAN interfaces from tx power calculation
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Felix Fietkau <[email protected]>
commit 764152ff66f4a8be1f9d7981e542ffdaa5bd7aff upstream.
Their power value is initialized to zero. This patch fixes an issue where the configured power drops to the minimum value when AP_VLAN interfaces are created/removed.
--- net/mac80211/main.c | 2 ++ 1 file changed, 2 insertions(+)
net/mac80211/main.c +2 -0
@@ -157,6 +157,8 @@ static u32 ieee80211_hw_conf_chan(structlist_for_each_entry_rcu (sdata, &local->interfaces, list) {if (!rcu_access_pointer (sdata->vif.chanctx_conf))continue ; +if (sdata->vif.type ==NL80211_IFTYPE_AP_VLAN ) +continue ; power =min (power, sdata->vif.bss_conf.txpower); }rcu_read_unlock ();
Greg Kroah-Hartman
maintainerPATCH 30/48 locks: allow __break_lease to sleep even when break_time is 0
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jeff Layton <[email protected]>
commit 4991a628a789dc5954e98e79476d9808812292ec upstream.
A fl->fl_break_time of 0 has a special meaning to the lease break code that basically means "never break the lease". knfsd uses this to ensure that leases don't disappear out from under it.
Unfortunately, the code in __break_lease can end up passing this value to wait_event_interruptible as a timeout, which prevents it from going to sleep at all. This causes __break_lease to spin in a tight loop and causes soft lockups.
Fix this by ensuring that we pass a minimum value of 1 as a timeout instead.
--- fs/locks.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
fs/locks.c +3 -4
@@ -1243,11 +1243,10 @@ int __break_lease(struct inode *inode, u restart: break_time = flock->fl_break_time; -if (break_time !=0 ) { +if (break_time !=0 ) break_time -= jiffies; -if (break_time ==0 ) - break_time++; - } +if (break_time ==0 ) + break_time++;locks_insert_block (flock, new_fl);unlock_flocks (); error = wait_event_interruptible_timeout(new_fl->fl_wait,
Greg Kroah-Hartman
maintainerPATCH 31/48 rtlwifi: rtl8723ae: Fix too long disable of IRQs
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Larry Finger <[email protected]>
commit bfc1010c418a22cbebd8b1bd1e75dad6a527a609 upstream.
In commit f78bccd79ba3cd9d9664981b501d57bdb81ab8a4 entitled "rtlwifi:
rtl8192ce: Fix too long disable of IRQs", Olivier Langlois <[email protected]> fixed a problem caused by an extra long disabling of interrupts. This patch makes the same fix for rtl8723ae.
--- drivers/net/wireless/rtlwifi/rtl8723ae/hw.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-)
drivers/net/wireless/rtlwifi/rtl8723ae/hw.c +15 -3
@@ -880,14 +880,25 @@ int rtl8723ae_hw_init(struct ieee80211_hbool rtstatus = true;int err;u8 tmp_u1b; +unsigned long flags; rtlpriv->rtlhal.being_init_adapter = true; +/* As this function can take a very long time (up to 350 ms) +* and can be called with irqs disabled, reenable the irqs +* to let the other devices continue being serviced. +* +* It is safe doing so since our own interrupts will only be enabled +* in a subsequent step. +*/ +local_save_flags (flags); +local_irq_enable (); + rtlpriv->intf_ops->disable_aspm (hw); rtstatus =_rtl8712e_init_mac (hw);if (rtstatus != true) {RT_TRACE (rtlpriv,COMP_ERR ,DBG_EMERG ,"Init MAC failed\n" ); err =1 ; -return err; + goto exit; } err =rtl8723ae_download_fw (hw);
@@ -895,8 +906,7 @@ int rtl8723ae_hw_init(struct ieee80211_hRT_TRACE (rtlpriv,COMP_ERR ,DBG_WARNING ,"Failed to download FW. Init HW without FW now..\n" ); err =1 ; - rtlhal->fw_ready = false; -return err; + goto exit; }else { rtlhal->fw_ready = true; }
@@ -971,6 +981,8 @@ int rtl8723ae_hw_init(struct ieee80211_hRT_TRACE (rtlpriv,COMP_INIT ,DBG_TRACE ,"under 1.5V\n" ); }rtl8723ae_dm_init (hw); +exit: +local_irq_restore (flags); rtlpriv->rtlhal.being_init_adapter = false;return err; }
Greg Kroah-Hartman
maintainerPATCH 32/48 rtlwifi: rtl8188ee: Fix too long disable of IRQs
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Larry Finger <[email protected]>
commit 6b6392715856d563719991e9ce95e773491a8983 upstream.
In commit f78bccd79ba3cd9d9664981b501d57bdb81ab8a4 entitled "rtlwifi:
rtl8192ce: Fix too long disable of IRQs", Olivier Langlois <[email protected]> fixed a problem caused by an extra long disabling of interrupts. This patch makes the same fix for rtl8188ee.
--- drivers/net/wireless/rtlwifi/rtl8188ee/hw.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-)
drivers/net/wireless/rtlwifi/rtl8188ee/hw.c +16 -4
@@ -1025,9 +1025,20 @@ int rtl88ee_hw_init(struct ieee80211_hwbool rtstatus = true;int err =0 ;u8 tmp_u1b, u1byte; +unsigned long flags;RT_TRACE (rtlpriv,COMP_INIT ,DBG_LOUD ,"Rtl8188EE hw init\n" ); rtlpriv->rtlhal.being_init_adapter = true; +/* As this function can take a very long time (up to 350 ms) +* and can be called with irqs disabled, reenable the irqs +* to let the other devices continue being serviced. +* +* It is safe doing so since our own interrupts will only be enabled +* in a subsequent step. +*/ +local_save_flags (flags); +local_irq_enable (); + rtlpriv->intf_ops->disable_aspm (hw); tmp_u1b =rtl_read_byte (rtlpriv,REG_SYS_CLKR +1 );
@@ -1043,7 +1054,7 @@ int rtl88ee_hw_init(struct ieee80211_hwif (rtstatus != true) {RT_TRACE (rtlpriv,COMP_ERR ,DBG_EMERG ,"Init MAC failed\n" ); err =1 ; -return err; + goto exit; } err =rtl88e_download_fw (hw, false);
@@ -1051,8 +1062,7 @@ int rtl88ee_hw_init(struct ieee80211_hwRT_TRACE (rtlpriv,COMP_ERR ,DBG_WARNING ,"Failed to download FW. Init HW without FW now..\n" ); err =1 ; - rtlhal->fw_ready = false; -return err; + goto exit; }else { rtlhal->fw_ready = true; }
@@ -1135,10 +1145,12 @@ int rtl88ee_hw_init(struct ieee80211_hw }rtl_write_byte (rtlpriv,REG_NAV_CTRL +2 , ((30000 +127 )/128 ));rtl88e_dm_init (hw); +exit: +local_irq_restore (flags); rtlpriv->rtlhal.being_init_adapter = false;RT_TRACE (rtlpriv,COMP_INIT ,DBG_LOUD ,"end of Rtl8188EE hw init %x\n" , err); -return 0 ; +return err; }static enum version_8188e _rtl88ee_read_chip_version (struct ieee80211_hw *hw)
Greg Kroah-Hartman
maintainerPATCH 33/48 rtlwifi: rtl8192cu: Fix too long disable of IRQs
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Larry Finger <[email protected]>
commit a53268be0cb9763f11da4f6fe3fb924cbe3a7d4a upstream.
In commit f78bccd79ba3cd9d9664981b501d57bdb81ab8a4 entitled "rtlwifi:
rtl8192ce: Fix too long disable of IRQs", Olivier Langlois <[email protected]> fixed a problem caused by an extra long disabling of interrupts. This patch makes the same fix for rtl8192cu.
--- drivers/net/wireless/rtlwifi/rtl8192cu/hw.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)
drivers/net/wireless/rtlwifi/rtl8192cu/hw.c +14 -1
@@ -985,6 +985,17 @@ int rtl92cu_hw_init(struct ieee80211_hwstruct rtl_ps_ctl *ppsc =rtl_psc (rtl_priv (hw));int err =0 ;static bool iqk_initialized; +unsigned long flags; + +/* As this function can take a very long time (up to 350 ms) +* and can be called with irqs disabled, reenable the irqs +* to let the other devices continue being serviced. +* +* It is safe doing so since our own interrupts will only be enabled +* in a subsequent step. +*/ +local_save_flags (flags); +local_irq_enable (); rtlhal->hw_type =HARDWARE_TYPE_RTL8192CU ; err =_rtl92cu_init_mac (hw);
@@ -997,7 +1008,7 @@ int rtl92cu_hw_init(struct ieee80211_hwRT_TRACE (rtlpriv,COMP_ERR ,DBG_WARNING ,"Failed to download FW. Init HW without FW now..\n" ); err =1 ; -return err; + goto exit; } rtlhal->last_hmeboxnum =0 ;/* h2c */ _rtl92cu_phy_param_tab_init (hw);
@@ -1034,6 +1045,8 @@ int rtl92cu_hw_init(struct ieee80211_hw_InitPABias (hw);_update_mac_setting (hw);rtl92c_dm_init (hw); +exit: +local_irq_restore (flags);return err; }
Greg Kroah-Hartman
maintainerPATCH 34/48 rtlwifi: rtl8192se: Fix too long disable of IRQs
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Larry Finger <[email protected]>
commit 2610decdd0b3808ba20471a999835cfee5275f98 upstream.
In commit f78bccd79ba3cd9d9664981b501d57bdb81ab8a4 entitled "rtlwifi:
rtl8192ce: Fix too long disable of IRQs", Olivier Langlois <[email protected]> fixed a problem caused by an extra long disabling of interrupts. This patch makes the same fix for rtl8192se.
--- drivers/net/wireless/rtlwifi/rtl8192se/hw.c | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-)
drivers/net/wireless/rtlwifi/rtl8192se/hw.c +21 -6
@@ -955,7 +955,7 @@ int rtl92se_hw_init(struct ieee80211_hwstruct rtl_pci *rtlpci =rtl_pcidev (rtl_pcipriv (hw));struct rtl_efuse *rtlefuse =rtl_efuse (rtl_priv (hw));u8 tmp_byte =0 ; - +unsigned long flags;bool rtstatus = true;u8 tmp_u1b;int err = false;
@@ -967,6 +967,16 @@ int rtl92se_hw_init(struct ieee80211_hw rtlpci->being_init_adapter = true; +/* As this function can take a very long time (up to 350 ms) +* and can be called with irqs disabled, reenable the irqs +* to let the other devices continue being serviced. +* +* It is safe doing so since our own interrupts will only be enabled +* in a subsequent step. +*/ +local_save_flags (flags); +local_irq_enable (); + rtlpriv->intf_ops->disable_aspm (hw);/* 1. MAC Initialize */
@@ -984,7 +994,8 @@ int rtl92se_hw_init(struct ieee80211_hwRT_TRACE (rtlpriv,COMP_ERR ,DBG_WARNING ,"Failed to download FW. Init HW without FW now... " "Please copy FW into /lib/firmware/rtlwifi\n" ); -return 1 ; + err =1 ; + goto exit; }/* After FW download, we have to reset MAC register */
@@ -997,7 +1008,8 @@ int rtl92se_hw_init(struct ieee80211_hw/* 3. Initialize MAC/PHY Config by MACPHY_reg.txt */ if (!rtl92s_phy_mac_config (hw)) {RT_TRACE (rtlpriv,COMP_ERR ,DBG_EMERG ,"MAC Config failed\n" ); -return rtstatus; + err = rtstatus; + goto exit; }/* because last function modify RCR, so we update
@@ -1016,7 +1028,8 @@ int rtl92se_hw_init(struct ieee80211_hw/* 4. Initialize BB After MAC Config PHY_reg.txt, AGC_Tab.txt */ if (!rtl92s_phy_bb_config (hw)) {RT_TRACE (rtlpriv,COMP_INIT ,DBG_EMERG ,"BB Config failed\n" ); -return rtstatus; + err = rtstatus; + goto exit; }/* 5. Initiailze RF RAIO_A.txt RF RAIO_B.txt */
@@ -1033,7 +1046,8 @@ int rtl92se_hw_init(struct ieee80211_hwif (!rtl92s_phy_rf_config (hw)) {RT_TRACE (rtlpriv,COMP_INIT ,DBG_DMESG ,"RF Config failed\n" ); -return rtstatus; + err = rtstatus; + goto exit; }/* After read predefined TXT, we must set BB/MAC/RF
@@ -1122,8 +1136,9 @@ int rtl92se_hw_init(struct ieee80211_hw rtlpriv->cfg->ops->led_control (hw,LED_CTL_POWER_ON );rtl92s_dm_init (hw); +exit: +local_irq_restore (flags); rtlpci->being_init_adapter = false; -return err; }
Greg Kroah-Hartman
maintainerPATCH 35/48 rtlwifi: rtl8192se: Fix regression due to commit 1bf4bbb
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Larry Finger <[email protected]>
commit 5f9186990ec4579ee5b7a99b3254c29eda479f36 upstream.
Beginning with kernel 3.13, this driver fails on some systems. The problem was bisected to:
Commit 1bf4bbb4024dcdab5e57634dd8ae1072d42a53ac
Author: Felix Fietkau <[email protected]>
Title: mac80211: send control port protocol frames to the VO queue
There is noting wrong with the above commit. The regression occurs because V0 queue on RTL8192SE cards uses priority 6, not the usual 7. The fix is to modify the rtl8192se routine that sets the correct transmit queue.
--- drivers/net/wireless/rtlwifi/rtl8192se/trx.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/net/wireless/rtlwifi/rtl8192se/trx.c +6 -0
@@ -49,6 +49,12 @@ static u8 _rtl92se_map_hwqueue_to_fwqueuif (ieee80211_is_nullfunc (fc))return QSLT_HIGH ; +/* Kernel commit 1bf4bbb4024dcdab changed EAPOL packets to use +* queue V0 at priority 7; however, the RTL8192SE appears to have +* that queue at priority 6 +*/ +if (skb->priority ==7 ) +return QSLT_VO ;return skb->priority; }
Greg Kroah-Hartman
maintainerPATCH 36/48 rtlwifi: rtl8188ee: initialize packet_beacon
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Colin Ian King <[email protected]>
commit 328e203fc35f0b4f6df1c4943f74cf553bcc04f8 upstream.
static code analysis from cppcheck reports:
[drivers/net/wireless/rtlwifi/rtl8188ee/trx.c:322]:
(error) Uninitialized variable: packet_beacon
packet_beacon is not initialized and hence packet_beacon contains garbage from the stack, so set it to false.
--- drivers/net/wireless/rtlwifi/rtl8188ee/trx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/rtlwifi/rtl8188ee/trx.c +1 -1
@@ -293,7 +293,7 @@ static void _rtl88ee_translate_rx_signalu8 *psaddr;__le16 fc;u16 type, ufc; -bool match_bssid, packet_toself, packet_beacon, addr; +bool match_bssid, packet_toself, packet_beacon = false, addr; tmp_buf = skb->data + pstatus->rx_drvinfo_size + pstatus->rx_bufshift;
Greg Kroah-Hartman
maintainerPATCH 37/48 gpio: mxs: Allow for recursive enable_irq_wake() call
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marek Vasut <[email protected]>
commit a585f87c863e4e1d496459d382b802bf5ebe3717 upstream.
The scenario here is that someone calls enable_irq_wake() from somewhere in the code. This will result in the lockdep producing a backtrace as can be seen below. In my case, this problem is triggered when using the wl1271 (TI WlCore) driver found in drivers/net/wireless/ti/ .
The problem cause is rather obvious from the backtrace, but let's outline the dependency. enable_irq_wake() grabs the IRQ buslock in irq_set_irq_wake(), which in turns calls mxs_gpio_set_wake_irq() . But mxs_gpio_set_wake_irq() calls enable_irq_wake() again on the one-level-higher IRQ , thus it tries to grab the IRQ buslock again in irq_set_irq_wake() . Because the spinlock in irq_set_irq_wake()->irq_get_desc_buslock()->__irq_get_desc_lock() is not marked as recursive, lockdep will spew the stuff below.
We know we can safely re-enter the lock, so use IRQ_GC_INIT_NESTED_LOCK to fix the spew.
=============================================
[ INFO: possible recursive locking detected ] 3.10.33-00012-gf06b763-dirty #61 Not tainted
---------------------------------------------
kworker/0:1/18 is trying to acquire lock:
(&irq_desc_lock_class){-.-...}, at: [<c00685f0>] __irq_get_desc_lock+0x48/0x88
but task is already holding lock:
(&irq_desc_lock_class){-.-...}, at: [<c00685f0>] __irq_get_desc_lock+0x48/0x88
other info that might help us debug this:
Possible unsafe locking scenario:
CPU0
---- lock(&irq_desc_lock_class);
lock(&irq_desc_lock_class);
*** DEADLOCK ***
May be due to missing lock nesting notation
3 locks held by kworker/0:1/18:
#0: (events){.+.+.+}, at: [<c0036308>] process_one_work+0x134/0x4a4
#1: ((&fw_work->work)){+.+.+.}, at: [<c0036308>] process_one_work+0x134/0x4a4
#2: (&irq_desc_lock_class){-.-...}, at: [<c00685f0>] __irq_get_desc_lock+0x48/0x88stack backtrace: CPU: 0 PID: 18 Comm: kworker/0:1 Not tainted 3.10.33-00012-gf06b763-dirty #61 Workqueue: events request_firmware_work_func [<c0013eb4>] (unwind_backtrace+0x0/0xf0) from [<c0011c74>] (show_stack+0x10/0x14) [<c0011c74>] (show_stack+0x10/0x14) from [<c005bb08>] (__lock_acquire+0x140c/0x1a64) [<c005bb08>] (__lock_acquire+0x140c/0x1a64) from [<c005c6a8>] (lock_acquire+0x9c/0x104) [<c005c6a8>] (lock_acquire+0x9c/0x104) from [<c051d5a4>] (_raw_spin_lock_irqsave+0x44/0x58) [<c051d5a4>] (_raw_spin_lock_irqsave+0x44/0x58) from [<c00685f0>] (__irq_get_desc_lock+0x48/0x88) [<c00685f0>] (__irq_get_desc_lock+0x48/0x88) from [<c0068e78>] (irq_set_irq_wake+0x20/0xf4) [<c0068e78>] (irq_set_irq_wake+0x20/0xf4) from [<c027260c>] (mxs_gpio_set_wake_irq+0x1c/0x24) [<c027260c>] (mxs_gpio_set_wake_irq+0x1c/0x24) from [<c0068cf4>] (set_irq_wake_real+0x30/0x44) [<c0068cf4>] (set_irq_wake_real+0x30/0x44) from [<c0068ee4>] (irq_set_irq_wake+0x8c/0xf4) [<c0068ee4>] (irq_set_irq_wake+0x8c/0xf4) from [<c0310748>] (wlcore_nvs_cb+0x10c/0x97c) [<c0310748>] (wlcore_nvs_cb+0x10c/0x97c) from [<c02be5e8>] (request_firmware_work_func+0x38/0x58) [<c02be5e8>] (request_firmware_work_func+0x38/0x58) from [<c0036394>] (process_one_work+0x1c0/0x4a4) [<c0036394>] (process_one_work+0x1c0/0x4a4) from [<c0036a4c>] (worker_thread+0x138/0x394) [<c0036a4c>] (worker_thread+0x138/0x394) from [<c003cb74>] (kthread+0xa4/0xb0) [<c003cb74>] (kthread+0xa4/0xb0) from [<c000ee00>] (ret_from_fork+0x14/0x34) wlcore: loaded
--- drivers/gpio/gpio-mxs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpio/gpio-mxs.c +2 -1
@@ -214,7 +214,8 @@ static void __init mxs_gpio_init_gc(stru ct->regs.ack =PINCTRL_IRQSTAT (port) +MXS_CLR ; ct->regs.mask =PINCTRL_IRQEN (port); -irq_setup_generic_chip (gc,IRQ_MSK (32 ),0 ,IRQ_NOREQUEST ,0 ); +irq_setup_generic_chip (gc,IRQ_MSK (32 ),IRQ_GC_INIT_NESTED_LOCK , +IRQ_NOREQUEST ,0 ); }static int mxs_gpio_to_irq (struct gpio_chip *gc,unsigned offset)
Greg Kroah-Hartman
maintainerPATCH 38/48 tgafb: fix data copying
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikulas Patocka <[email protected]>
commit 6b0df6827bb6fcacb158dff29ad0a62d6418b534 upstream.
The functions for data copying copyarea_foreward_8bpp and copyarea_backward_8bpp are buggy, they produce screen corruption.
This patch fixes the functions and moves the logic to one function "copyarea_8bpp". For simplicity, the function only handles copying that is aligned on 8 pixes. If we copy an unaligned area, generic function cfb_copyarea is used.
--- drivers/video/tgafb.c | 264 +++++++++----------------------------------------- 1 file changed, 51 insertions(+), 213 deletions(-)
drivers/video/tgafb.c +51 -213
@@ -1142,222 +1142,57 @@ copyarea_line_32bpp(struct fb_info *info__raw_writel (TGA_MODE_SBM_24BPP |TGA_MODE_SIMPLE , tga_regs+TGA_MODE_REG ); } -/* The general case of forward copy in 8bpp mode. */ +/* The (almost) general case of backward copy in 8bpp mode. */ static inline void -copyarea_foreward_8bpp (struct fb_info *info,u32 dx,u32 dy,u32 sx,u32 sy, -u32 height,u32 width,u32 line_length) +copyarea_8bpp (struct fb_info *info,u32 dx,u32 dy,u32 sx,u32 sy, +u32 height,u32 width,u32 line_length, +const struct fb_copyarea *area) {struct tga_par *par = (struct tga_par *) info->par; -unsigned long i, copied, left; -unsigned long dpos, spos, dalign, salign, yincr; -u32 smask_first, dmask_first, dmask_last; -int pixel_shift, need_prime, need_second; -unsigned long n64, n32, xincr_first; +unsigned i, yincr; +int depos, sepos, backward, last_step, step; +u32 mask_last; +unsigned n32;void __iomem *tga_regs;void __iomem *tga_fb; - yincr = line_length; -if (dy > sy) { - dy += height -1 ; - sy += height -1 ; - yincr = -yincr; - } - -/* Compute the offsets and alignments in the frame buffer. -More than anything else, these control how we do copies. */ - dpos = dy * line_length + dx; - spos = sy * line_length + sx; - dalign = dpos &7 ; - salign = spos &7 ; - dpos &=-8 ; - spos &=-8 ; - -/* Compute the value for the PIXELSHIFT register. This controls -both non-co-aligned source and destination and copy direction. */ -if (dalign >= salign) - pixel_shift = dalign - salign; -else - pixel_shift =8 - (salign - dalign); - -/* Figure out if we need an additional priming step for the -residue register. */ - need_prime = (salign > dalign); -if (need_prime) - dpos -=8 ; - -/* Begin by copying the leading unaligned destination. Copy enough -to make the next destination address 32-byte aligned. */ - copied =32 - (dalign + (dpos &31 )); -if (copied ==32 ) - copied =0 ; - xincr_first = (copied +7 ) &-8 ; - smask_first = dmask_first = (1ul << copied) -1 ; - smask_first <<= salign; - dmask_first <<= dalign + need_prime*8 ; -if (need_prime && copied >24 ) - copied -=8 ; - left = width - copied; - -/* Care for small copies. */ -if (copied > width) { -u32 t; - t = (1ul << width) -1 ; - t <<= dalign + need_prime*8 ; - dmask_first &= t; - left =0 ; - } - -/* Attempt to use 64-byte copies. This is only possible if the -source and destination are co-aligned at 64 bytes. */ - n64 = need_second =0 ; -if ((dpos &63 ) == (spos &63 ) - && (height ==1 || line_length %64 ==0 )) { -/* We may need a 32-byte copy to ensure 64 byte alignment. */ - need_second = (dpos + xincr_first) &63 ; -if ((need_second &32 ) != need_second) -printk (KERN_ERR "tgafb: need_second wrong\n" ); -if (left >= need_second +64 ) { - left -= need_second; - n64 = left /64 ; - left %=64 ; - }else - need_second =0 ; - } - -/* Copy trailing full 32-byte sections. This will be the main -loop if the 64 byte loop can't be used. */ - n32 = left /32 ; - left %=32 ; - -/* Copy the trailing unaligned destination. */ - dmask_last = (1ul << left) -1 ; - - tga_regs = par->tga_regs_base; - tga_fb = par->tga_fb_base; - -/* Set up the MODE and PIXELSHIFT registers. */ -__raw_writel (TGA_MODE_SBM_8BPP |TGA_MODE_COPY , tga_regs+TGA_MODE_REG ); -__raw_writel (pixel_shift, tga_regs+TGA_PIXELSHIFT_REG ); -wmb (); - -for (i =0 ; i < height; ++i) { -unsigned long j; -void __iomem *sfb; -void __iomem *dfb; - - sfb = tga_fb + spos; - dfb = tga_fb + dpos; -if (dmask_first) { -__raw_writel (smask_first, sfb); -wmb (); -__raw_writel (dmask_first, dfb); -wmb (); - sfb += xincr_first; - dfb += xincr_first; - } - -if (need_second) { -__raw_writel (0xffffffff , sfb); -wmb (); -__raw_writel (0xffffffff , dfb); -wmb (); - sfb +=32 ; - dfb +=32 ; - } - -if (n64 && (((unsigned long )sfb | (unsigned long )dfb) &63 )) -printk (KERN_ERR -"tgafb: misaligned copy64 (s:%p, d:%p)\n" , - sfb, dfb); - -for (j =0 ; j < n64; ++j) { -__raw_writel (sfb - tga_fb, tga_regs+TGA_COPY64_SRC ); -wmb (); -__raw_writel (dfb - tga_fb, tga_regs+TGA_COPY64_DST ); -wmb (); - sfb +=64 ; - dfb +=64 ; - } - -for (j =0 ; j < n32; ++j) { -__raw_writel (0xffffffff , sfb); -wmb (); -__raw_writel (0xffffffff , dfb); -wmb (); - sfb +=32 ; - dfb +=32 ; - } - -if (dmask_last) { -__raw_writel (0xffffffff , sfb); -wmb (); -__raw_writel (dmask_last, dfb); -wmb (); - } - - spos += yincr; - dpos += yincr; +/* Do acceleration only if we are aligned on 8 pixels */ +if ((dx | sx | width) &7 ) { +cfb_copyarea (info, area); +return ; } -/* Reset the MODE register to normal. */ -__raw_writel (TGA_MODE_SBM_8BPP |TGA_MODE_SIMPLE , tga_regs+TGA_MODE_REG ); -} - -/* The (almost) general case of backward copy in 8bpp mode. */ -static inline void -copyarea_backward_8bpp (struct fb_info *info,u32 dx,u32 dy,u32 sx,u32 sy, -u32 height,u32 width,u32 line_length, -const struct fb_copyarea *area) -{ -struct tga_par *par = (struct tga_par *) info->par; -unsigned long i, left, yincr; -unsigned long depos, sepos, dealign, sealign; -u32 mask_first, mask_last; -unsigned long n32; -void __iomem *tga_regs; -void __iomem *tga_fb; - yincr = line_length;if (dy > sy) { dy += height -1 ; sy += height -1 ; yincr = -yincr; } + backward = dy == sy && dx > sx && dx < sx + width;/* Compute the offsets and alignments in the frame buffer. More than anything else, these control how we do copies. */ - depos = dy * line_length + dx + width; - sepos = sy * line_length + sx + width; - dealign = depos &7 ; - sealign = sepos &7 ; - -/* ??? The documentation appears to be incorrect (or very -misleading) wrt how pixel shifting works in backward copy -mode, i.e. when PIXELSHIFT is negative. I give up for now. -Do handle the common case of co-aligned backward copies, -but frob everything else back on generic code. */ -if (dealign != sealign) { -cfb_copyarea (info, area); -return ; - } - -/* We begin the copy with the trailing pixels of the -unaligned destination. */ - mask_first = (1ul << dealign) -1 ; - left = width - dealign; - -/* Care for small copies. */ -if (dealign > width) { - mask_first ^= (1ul << (dealign - width)) -1 ; - left =0 ; - } + depos = dy * line_length + dx; + sepos = sy * line_length + sx; +if (backward) + depos += width, sepos += width;/* Next copy full words at a time. */ - n32 = left /32 ; - left %=32 ; + n32 = width /32 ; + last_step = width %32 ;/* Finally copy the unaligned head of the span. */ - mask_last =-1 << (32 - left); + mask_last = (1ul << last_step) -1 ; + +if (!backward) { + step =32 ; + last_step =32 ; + }else { + step =-32 ; + last_step = -last_step; + sepos -=32 ; + depos -=32 ; + } tga_regs = par->tga_regs_base; tga_fb = par->tga_fb_base;
@@ -1374,25 +1209,33 @@ copyarea_backward_8bpp(struct fb_info *i sfb = tga_fb + sepos; dfb = tga_fb + depos; -if (mask_first) { -__raw_writel (mask_first, sfb); -wmb (); -__raw_writel (mask_first, dfb); -wmb (); - } -for (j =0 ; j < n32; ++j) { - sfb -=32 ; - dfb -=32 ; +for (j =0 ; j < n32; j++) { +if (j <2 && j +1 < n32 && !backward && + !(((unsigned long )sfb | (unsigned long )dfb) &63 )) { +do { +__raw_writel (sfb - tga_fb, tga_regs+TGA_COPY64_SRC ); +wmb (); +__raw_writel (dfb - tga_fb, tga_regs+TGA_COPY64_DST ); +wmb (); + sfb +=64 ; + dfb +=64 ; + j +=2 ; + }while (j +1 < n32); + j--; +continue ; + }__raw_writel (0xffffffff , sfb);wmb ();__raw_writel (0xffffffff , dfb);wmb (); + sfb += step; + dfb += step; }if (mask_last) { - sfb -=32 ; - dfb -=32 ; + sfb += last_step - step; + dfb += last_step - step;__raw_writel (mask_last, sfb);wmb ();__raw_writel (mask_last, dfb);
@@ -1453,14 +1296,9 @@ tgafb_copyarea(struct fb_info *info, conelse if (bpp ==32 )cfb_copyarea (info, area); -/* Detect overlapping source and destination that requires -a backward copy. */ -else if (dy == sy && dx > sx && dx < sx + width) -copyarea_backward_8bpp (info, dx, dy, sx, sy, height, - width, line_length, area);else -copyarea_foreward_8bpp (info, dx, dy, sx, sy, height, - width, line_length); +copyarea_8bpp (info, dx, dy, sx, sy, height, + width, line_length, area); }
Greg Kroah-Hartman
maintainerPATCH 39/48 mtd: atmel_nand: Disable subpage NAND write when using Atmel PMECC
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Herve Codina <[email protected]>
commit 90445ff6241e2a13445310803e2efa606c61f276 upstream.
Crash detected on sam5d35 and its pmecc nand ecc controller.
The problem was a call to chip->ecc.hwctl from nand_write_subpage_hwecc (nand_base.c) when we write a sub page.chip->ecc.hwctl function is not set when we are using PMECC controller. As a workaround, set NAND_NO_SUBPAGE_WRITE for PMECC controller in order to disable sub page access in nand_write_page.
--- drivers/mtd/nand/atmel_nand.c | 1 + 1 file changed, 1 insertion(+)
drivers/mtd/nand/atmel_nand.c +1 -0
@@ -1096,6 +1096,7 @@ static int __init atmel_pmecc_nand_init_ goto err_pmecc_data_alloc; } + nand_chip->options |=NAND_NO_SUBPAGE_WRITE ; nand_chip->ecc.read_page = atmel_nand_pmecc_read_page; nand_chip->ecc.write_page = atmel_nand_pmecc_write_page;
Greg Kroah-Hartman
maintainerPATCH 40/48 mtd: nuc900_nand: NULL dereference in nuc900_nand_enable()
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit c69dbbf3335a21aae74376d7e5db50a486d52439 upstream.
Instead of writing to "nand->reg + REG_FMICSR" we write to "REG_FMICSR" which is NULL and not a valid register.
--- drivers/mtd/nand/nuc900_nand.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/nand/nuc900_nand.c +1 -1
@@ -225,7 +225,7 @@ static void nuc900_nand_enable(struct nu val =__raw_readl (nand->reg +REG_FMICSR );if (!(val &NAND_EN )) -__raw_writel (val |NAND_EN ,REG_FMICSR ); +__raw_writel (val |NAND_EN , nand->reg +REG_FMICSR ); val =__raw_readl (nand->reg +REG_SMCSR );
Greg Kroah-Hartman
maintainerPATCH 41/48 mtd: sm_ftl: heap corruption in sm_create_sysfs_attributes()
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit b4c233057771581698a13694ab6f33b48ce837dc upstream.
We always put a NUL terminator one space past the end of the "vendor" buffer. Walter Harms also pointed out that this should just use kstrndup().
--- drivers/mtd/sm_ftl.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)
drivers/mtd/sm_ftl.c +4 -7
@@ -59,15 +59,12 @@ struct attribute_group *sm_create_sysfs_struct attribute_group *attr_group;struct attribute **attributes;struct sm_sysfs_attribute *vendor_attribute; +char *vendor; -int vendor_len =strnlen (ftl->cis_buffer +SM_CIS_VENDOR_OFFSET , -SM_SMALL_PAGE -SM_CIS_VENDOR_OFFSET ); - -char *vendor =kmalloc (vendor_len,GFP_KERNEL ); + vendor =kstrndup (ftl->cis_buffer +SM_CIS_VENDOR_OFFSET , +SM_SMALL_PAGE -SM_CIS_VENDOR_OFFSET ,GFP_KERNEL );if (!vendor) goto error1; -memcpy (vendor, ftl->cis_buffer +SM_CIS_VENDOR_OFFSET , vendor_len); - vendor[vendor_len] =0 ;/* Initialize sysfs attributes */ vendor_attribute =
@@ -78,7 +75,7 @@ struct attribute_group *sm_create_sysfs_sysfs_attr_init (&vendor_attribute->dev_attr.attr); vendor_attribute->data = vendor; - vendor_attribute->len = vendor_len; + vendor_attribute->len =strlen (vendor); vendor_attribute->dev_attr.attr.name ="vendor" ; vendor_attribute->dev_attr.attr.mode =S_IRUGO ; vendor_attribute->dev_attr.show = sm_attr_show;
Greg Kroah-Hartman
maintainerPATCH 42/48 Skip intel_crt_init for Dell XPS 8700
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Giacomo Comes <[email protected]>
commit 10b6ee4a87811a110cb01eaca01eb04da6801baf upstream.
The Dell XPS 8700 has a onboard Display port and HDMI port and no VGA port. The call intel_crt_init freeze the machine, so skip such call.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=73559
--- drivers/gpu/drm/i915/intel_crt.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/gpu/drm/i915/intel_crt.c +8 -0
@@ -717,6 +717,14 @@ static const struct dmi_system_id intel_ DMI_MATCH(DMI_PRODUCT_NAME, "ZGB"), }, }, + { + .callback = intel_no_crt_dmi_callback, + .ident = "DELL XPS 8700", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), + DMI_MATCH(DMI_PRODUCT_NAME, "XPS 8700"), + }, + }, { } };
Greg Kroah-Hartman
maintainerPATCH 43/48 dm transaction manager: fix corruption due to non-atomic transaction commit
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joe Thornber <[email protected]>
commit a9d45396f5956d0b615c7ae3b936afd888351a47 upstream.
The persistent-data library used by dm-thin, dm-cache, etc is transactional. If anything goes wrong, such as an io error when writing new metadata or a power failure, then we roll back to the last transaction.
Atomicity when committing a transaction is achieved by:
a) Never overwriting data from the previous transaction.
b) Writing the superblock last, after all other metadata has hit the disk.
This commit and the following commit ("dm: take care to copy the space map roots before locking the superblock") fix a bug associated with (b). When committing it was possible for the superblock to still be written in spite of an io error occurring during the preceeding metadata flush. With these commits we're careful not to take the write lock out on the superblock until after the metadata flush has completed.
Change the transaction manager's semantics for dm_tm_commit() to assume all data has been flushed _before_ the single superblock that is passed in.
As a prerequisite, split the block manager's block unlocking and flushing by simplifying dm_bm_flush_and_unlock() to dm_bm_flush(). Now the unlocking must be done separately.
This issue was discovered by forcing io errors at the crucial time using dm-flakey.
--- drivers/md/dm-cache-metadata.c | 3 ++- drivers/md/persistent-data/dm-block-manager.c | 15 ++------------- drivers/md/persistent-data/dm-block-manager.h | 3 +-- drivers/md/persistent-data/dm-transaction-manager.c | 5 +++-- drivers/md/persistent-data/dm-transaction-manager.h | 17 ++++++++--------- 5 files changed, 16 insertions(+), 27 deletions(-)
drivers/md/dm-cache-metadata.c +2 -1
@@ -511,8 +511,9 @@ static int __begin_transaction_flags(str disk_super =dm_block_data (sblock);update_flags (disk_super, mutator);read_superblock_fields (cmd, disk_super); +dm_bm_unlock (sblock); -return dm_bm_flush_and_unlock (cmd->bm, sblock); +return dm_bm_flush (cmd->bm); }static int __begin_transaction (struct dm_cache_metadata *cmd)
drivers/md/persistent-data/dm-block-manager.c +2 -13
@@ -595,25 +595,14 @@ int dm_bm_unlock(struct dm_block *b) }EXPORT_SYMBOL_GPL (dm_bm_unlock); -int dm_bm_flush_and_unlock (struct dm_block_manager *bm, -struct dm_block *superblock) +int dm_bm_flush (struct dm_block_manager *bm) { -int r; -if (bm->read_only)return -EPERM ; - r =dm_bufio_write_dirty_buffers (bm->bufio); -if (unlikely (r)) { -dm_bm_unlock (superblock); -return r; - } - -dm_bm_unlock (superblock); -return dm_bufio_write_dirty_buffers (bm->bufio); } -EXPORT_SYMBOL_GPL (dm_bm_flush_and_unlock); +EXPORT_SYMBOL_GPL (dm_bm_flush);void dm_bm_set_read_only (struct dm_block_manager *bm) {
drivers/md/persistent-data/dm-block-manager.h +1 -2
@@ -105,8 +105,7 @@ int dm_bm_unlock(struct dm_block *b);* * This method always blocks. */ -int dm_bm_flush_and_unlock (struct dm_block_manager *bm, -struct dm_block *superblock); +int dm_bm_flush (struct dm_block_manager *bm);/* * Switches the bm to a read only mode. Once read-only mode
drivers/md/persistent-data/dm-transaction-manager.c +3 -2
@@ -154,7 +154,7 @@ int dm_tm_pre_commit(struct dm_transactiif (r <0 )return r; -return 0 ; +return dm_bm_flush (tm->bm); }EXPORT_SYMBOL_GPL (dm_tm_pre_commit);
@@ -164,8 +164,9 @@ int dm_tm_commit(struct dm_transaction_mreturn -EWOULDBLOCK ;wipe_shadow_table (tm); +dm_bm_unlock (root); -return dm_bm_flush_and_unlock (tm->bm, root); +return dm_bm_flush (tm->bm); }EXPORT_SYMBOL_GPL (dm_tm_commit);
drivers/md/persistent-data/dm-transaction-manager.h +8 -9
@@ -38,18 +38,17 @@ struct dm_transaction_manager *dm_tm_cre/* * We use a 2-phase commit here. * -* i) In the first phase the block manager is told to start flushing, and -* the changes to the space map are written to disk. You should interrogate -* your particular space map to get detail of its root node etc. to be -* included in your superblock. +* i) Make all changes for the transaction *except* for the superblock. +* Then call dm_tm_pre_commit() to flush them to disk. * -* ii) @root will be committed last. You shouldn't use more than the -* first 512 bytes of @root if you wish the transaction to survive a power -* failure. You *must* have a write lock held on @root for both stage (i) -* and (ii). The commit will drop the write lock. +* ii) Lock your superblock. Update. Then call dm_tm_commit() which will +* unlock the superblock and flush it. No other blocks should be updated +* during this period. Care should be taken to never unlock a partially +* updated superblock; perform any operations that could fail *before* you +* take the superblock lock. */ int dm_tm_pre_commit (struct dm_transaction_manager *tm); -int dm_tm_commit (struct dm_transaction_manager *tm,struct dm_block *root); +int dm_tm_commit (struct dm_transaction_manager *tm,struct dm_block *superblock);/* * These methods are the only way to get hold of a writeable block.
Greg Kroah-Hartman
maintainerPATCH 44/48 dm thin: fix dangling bio in process_deferred_bios error path
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mike Snitzer <[email protected]>
commit fe76cd88e654124d1431bb662a0fc6e99ca811a5 upstream.
If unable to ensure_next_mapping() we must add the current bio, which was removed from the @bios list via bio_list_pop, back to the deferred_bios list before all the remaining @bios.
--- drivers/md/dm-thin.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/dm-thin.c +1 -1
@@ -1322,9 +1322,9 @@ static void process_deferred_bios(struct*/ if (ensure_next_mapping (pool)) {spin_lock_irqsave (&pool->lock, flags); +bio_list_add (&pool->deferred_bios, bio);bio_list_merge (&pool->deferred_bios, &bios);spin_unlock_irqrestore (&pool->lock, flags); -break ; }
Greg Kroah-Hartman
maintainerPATCH 45/48 lockd: ensure we tear down any live sockets when socket creation fails during lockd_up
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jeff Layton <[email protected]>
commit 679b033df48422191c4cac52b610d9980e019f9b upstream.
We had a Fedora ABRT report with a stack trace like this:
kernel BUG at net/sunrpc/svc.c:550!
invalid opcode: 0000 [#1] SMP
[...]
CPU: 2 PID: 913 Comm: rpc.nfsd Not tainted 3.13.6-200.fc20.x86_64 #1 Hardware name: Hewlett-Packard HP ProBook 4740s/1846, BIOS 68IRR Ver. F.40 01/29/2013 task: ffff880146b00000 ti: ffff88003f9b8000 task.ti: ffff88003f9b8000 RIP: 0010:[<ffffffffa0305fa8>] [<ffffffffa0305fa8>] svc_destroy+0x128/0x130 [sunrpc] RSP: 0018:ffff88003f9b9de0 EFLAGS: 00010206 RAX: ffff88003f829628 RBX: ffff88003f829600 RCX: 00000000000041ee RDX: 0000000000000000 RSI: 0000000000000286 RDI: 0000000000000286 RBP: ffff88003f9b9de8 R08: 0000000000017360 R09: ffff88014fa97360 R10: ffffffff8114ce57 R11: ffffea00051c9c00 R12: ffff88003f829600 R13: 00000000ffffff9e R14: ffffffff81cc7cc0 R15: 0000000000000000 FS: 00007f4fde284840(0000) GS:ffff88014fa80000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f4fdf5192f8 CR3: 00000000a569a000 CR4: 00000000001407e0 Stack: ffff88003f792300 ffff88003f9b9e18 ffffffffa02de02a 0000000000000000 ffffffff81cc7cc0 ffff88003f9cb000 0000000000000008 ffff88003f9b9e60 ffffffffa033bb35 ffffffff8131c86c ffff88003f9cb000 ffff8800a5715008 Call Trace: [<ffffffffa02de02a>] lockd_up+0xaa/0x330 [lockd] [<ffffffffa033bb35>] nfsd_svc+0x1b5/0x2f0 [nfsd] [<ffffffff8131c86c>] ? simple_strtoull+0x2c/0x50 [<ffffffffa033c630>] ? write_pool_threads+0x280/0x280 [nfsd] [<ffffffffa033c6bb>] write_threads+0x8b/0xf0 [nfsd] [<ffffffff8114efa4>] ? __get_free_pages+0x14/0x50 [<ffffffff8114eff6>] ? get_zeroed_page+0x16/0x20 [<ffffffff811dec51>] ? simple_transaction_get+0xb1/0xd0 [<ffffffffa033c098>] nfsctl_transaction_write+0x48/0x80 [nfsd] [<ffffffff811b8b34>] vfs_write+0xb4/0x1f0 [<ffffffff811c3f99>] ? putname+0x29/0x40 [<ffffffff811b9569>] SyS_write+0x49/0xa0 [<ffffffff810fc2a6>] ? __audit_syscall_exit+0x1f6/0x2a0 [<ffffffff816962e9>] system_call_fastpath+0x16/0x1b Code: 31 c0 e8 82 db 37 e1 e9 2a ff ff ff 48 8b 07 8b 57 14 48 c7 c7 d5 c6 31 a0 48 8b 70 20 31 c0 e8 65 db 37 e1 e9 f4 fe ff ff 0f 0b <0f> 0b 66 0f 1f 44 00 00 0f 1f 44 00 00 55 48 89 e5 41 56 41 55 RIP [<ffffffffa0305fa8>] svc_destroy+0x128/0x130 [sunrpc] RSP <ffff88003f9b9de0>
Evidently, we created some lockd sockets and then failed to create others. make_socks then returned an error and we tried to tear down the svc, but svc->sv_permsocks was not empty so we ended up tripping over the BUG() in svc_destroy().
Fix this by ensuring that we tear down any live sockets we created when socket creation is going to return an error.
--- fs/lockd/svc.c | 1 + 1 file changed, 1 insertion(+)
fs/lockd/svc.c +1 -0
@@ -235,6 +235,7 @@ out_err:if (warned++ ==0 )printk (KERN_WARNING "lockd_up: makesock failed, error=%d\n" , err); +svc_shutdown_net (serv, net);return err; }
Greg Kroah-Hartman
maintainerPATCH 46/48 Input: synaptics - add min/max quirk for ThinkPad T431s, L440, L540, S1 Yoga and X1
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
commit 46a2986ebbe18757c2d8c352f8fb6e0f4f0754e3 upstream.
We expect that all the Haswell series will need such quirks, sigh.
The T431s seems to be T430 hardware in a T440s case, using the T440s touchpad, with the same min/max issue.
The X1 Carbon 3rd generation name says 2nd while it is a 3rd generation.
The X1 and T431s share a PnPID with the T540p, but the reported ranges are closer to those of the T440s.
HdG: Squashed 5 quirk patches into one. T431s + L440 + L540 are written by me, S1 Yoga and X1 are written by Benjamin Tissoires.
Hdg: Standardized S1 Yoga and X1 values, Yoga uses the same touchpad as the X240, X1 uses the same touchpad as the T440.
--- drivers/input/mouse/synaptics.c | 42 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+)
drivers/input/mouse/synaptics.c +42 -0
@@ -1515,6 +1515,14 @@ static const struct dmi_system_id min_ma .driver_data = (int []){1232, 5710, 1156, 4696}, }, { +/* Lenovo ThinkPad T431s */ + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"LENOVO" ), + DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T431"), + }, + .driver_data = (int []){1024, 5112, 2024, 4832}, + }, + {/* Lenovo ThinkPad T440s */ .matches = { DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
@@ -1523,6 +1531,14 @@ static const struct dmi_system_id min_ma .driver_data = (int []){1024, 5112, 2024, 4832}, }, { +/* Lenovo ThinkPad L440 */ + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"LENOVO" ), + DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad L440"), + }, + .driver_data = (int []){1024, 5112, 2024, 4832}, + }, + {/* Lenovo ThinkPad T540p */ .matches = { DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
@@ -1530,6 +1546,32 @@ static const struct dmi_system_id min_ma }, .driver_data = (int []){1024, 5056, 2058, 4832}, }, + { + /* Lenovo ThinkPad L540 */ + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), + DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad L540"), + }, + .driver_data = (int []){1024, 5112, 2024, 4832}, + }, + { + /* Lenovo Yoga S1 */ + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), + DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, + "ThinkPad S1 Yoga"), + }, + .driver_data = (int []){1232, 5710, 1156, 4696}, + }, + { + /* Lenovo ThinkPad X1 Carbon Haswell (3rd generation) */ + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), + DMI_MATCH(DMI_PRODUCT_VERSION, + "ThinkPad X1 Carbon 2nd"), + }, + .driver_data = (int []){1024, 5112, 2024, 4832}, + }, #endif { } };
Greg Kroah-Hartman
maintainerPATCH 47/48 Input: synaptics - add min/max quirk for ThinkPad Edge E431
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
commit 27a38856a948c3e8de30dc71647ff9e1778c99fc upstream.
--- drivers/input/mouse/synaptics.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/input/mouse/synaptics.c +8 -0
@@ -1515,6 +1515,14 @@ static const struct dmi_system_id min_ma .driver_data = (int []){1232, 5710, 1156, 4696}, }, { +/* Lenovo ThinkPad Edge E431 */ + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"LENOVO" ), + DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad Edge E431"), + }, + .driver_data = (int []){1024, 5022, 2508, 4832}, + }, + {/* Lenovo ThinkPad T431s */ .matches = { DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
Greg Kroah-Hartman
maintainerPATCH 48/48 drm: cirrus: add power management support
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gerd Hoffmann <[email protected]>
commit 2f1e800799bf478494cec3573cd63eb34ca89c9d upstream.
cirrus kms driver lacks power management support, thus the vga display doesn't work any more after S3 resume.
Fix this by adding suspend and resume functions. Also make the mode_set function unblank the screen.
--- drivers/gpu/drm/cirrus/cirrus_drv.c | 42 +++++++++++++++++++++++++++++++++++ drivers/gpu/drm/cirrus/cirrus_mode.c | 3 ++ 2 files changed, 45 insertions(+)
drivers/gpu/drm/cirrus/cirrus_drv.c +42 -0
@@ -11,6 +11,7 @@#include <linux/module.h> #include <linux/console.h> #include <drm/drmP.h> +#include <drm/drm_crtc_helper.h> #include "cirrus_drv.h"
@@ -75,6 +76,41 @@ static void cirrus_pci_remove(struct pcidrm_put_dev (dev); } +static int cirrus_pm_suspend (struct device *dev) +{ +struct pci_dev *pdev =to_pci_dev (dev); +struct drm_device *drm_dev =pci_get_drvdata (pdev); +struct cirrus_device *cdev = drm_dev->dev_private; + +drm_kms_helper_poll_disable (drm_dev); + +if (cdev->mode_info.gfbdev) { +console_lock (); +fb_set_suspend (cdev->mode_info.gfbdev->helper.fbdev,1 ); +console_unlock (); + } + +return 0 ; +} + +static int cirrus_pm_resume (struct device *dev) +{ +struct pci_dev *pdev =to_pci_dev (dev); +struct drm_device *drm_dev =pci_get_drvdata (pdev); +struct cirrus_device *cdev = drm_dev->dev_private; + +drm_helper_resume_force_mode (drm_dev); + +if (cdev->mode_info.gfbdev) { +console_lock (); +fb_set_suspend (cdev->mode_info.gfbdev->helper.fbdev,0 ); +console_unlock (); + } + +drm_kms_helper_poll_enable (drm_dev); +return 0 ; +} +static const struct file_operations cirrus_driver_fops = { .owner =THIS_MODULE , .open = drm_open,
@@ -105,11 +141,17 @@ static struct drm_driver driver = { .dumb_destroy = cirrus_dumb_destroy, }; +static const struct dev_pm_ops cirrus_pm_ops = { +SET_SYSTEM_SLEEP_PM_OPS (cirrus_pm_suspend, + cirrus_pm_resume) +}; +static struct pci_driver cirrus_pci_driver = { .name =DRIVER_NAME , .id_table = pciidlist, .probe = cirrus_pci_probe, .remove = cirrus_pci_remove, + .driver.pm = &cirrus_pm_ops, };static int __init cirrus_init (void )
drivers/gpu/drm/cirrus/cirrus_mode.c +3 -0
@@ -308,6 +308,9 @@ static int cirrus_crtc_mode_set(struct dWREG_HDR (hdr);cirrus_crtc_do_set_base (crtc, old_fb, x, y,0 ); + +/* Unblank (needed on S3 resume, vgabios doesn't do it then) */ +outb (0x20 ,0x3c0 );return 0 ; }
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 3.10.40 release. There are 48 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 Tue May 13 19:19:30 UTC 2014. Anything received after that time might be too late.
Build results:
total: 127 pass: 122 skipped: 4 fail: 1
Qemu tests all passed.
Results are as expected.
Details are available at http://server.roeck-us.net:8010/builders.
Guenter
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 3.10.40 release. There are 48 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 Tue May 13 19:19:30 UTC 2014. Anything received after that time might be too late.
Quoted 7 lines
The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.10.40-rc1.gzand the diffstat can be found below.
thanks,
greg k-h
Compiled and booted on my test systems. No dmesg regressions.
-- Shuah
Signature · 4 lines
Shuah Khan Senior Linux Kernel Developer - Open Source Group Samsung Research America(Silicon Valley) [email protected] | (970) 672-0658