3.5.5-stable review
Subsystems (128)
Greg Kroah-Hartman
maintainerPATCH 162/262 USB: add device quirk for Joss Optical touchboard
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alan Stern <[email protected]>
commit 92fc7a8b0f20bdb243c706daf42658e8e0cd2ef0 upstream.
This patch (as1604) adds a CONFIG_INTF_STRINGS quirk for the Joss infrared touchboard device. The device doesn't like to be asked for its interface strings.
--- drivers/usb/core/quirks.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/usb/core/quirks.c +4 -0
@@ -96,6 +96,10 @@ static const struct usb_device_id usb_qu { USB_DEVICE(0x04b4, 0x0526), .driver_info = USB_QUIRK_CONFIG_INTF_STRINGS }, + /* Microchip Joss Optical infrared touchboard device */ + { USB_DEVICE(0x04d8, 0x000c), .driver_info = + USB_QUIRK_CONFIG_INTF_STRINGS }, + /* Samsung Android phone modem - ID conflict with SPH-I500 */ { USB_DEVICE(0x04e8, 0x6601), .driver_info = USB_QUIRK_CONFIG_INTF_STRINGS },
Greg Kroah-Hartman
maintainerPATCH 163/262 rt2800usb: Added rx packet length validity check
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sergei Poselenov <[email protected]>
commit efd5d6b03bd9c9e0df646c56fb5f4f3e25e5c1ac upstream.
On our system (ARM Cortex-M3 SOC running linux-2.6.33) frequent crashes were observed in the rt2800usb module because of the invalid length of the received packet (3392, 46920...). This patch adds the sanity check on the packet legth. Also, changed WARNING to ERROR in rt2x00lib_rxdone() so that the bad packet condition would be noticed.
The fix was tested on the latest compat-wireless-3.5.1-1-snpc.
--- drivers/net/wireless/rt2x00/rt2800usb.c | 10 +++++++++- drivers/net/wireless/rt2x00/rt2x00dev.c | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-)
drivers/net/wireless/rt2x00/rt2800usb.c +9 -1
@@ -667,8 +667,16 @@ static void rt2800usb_fill_rxdone(structskb_pull (entry->skb,RXINFO_DESC_SIZE );/* -* FIXME: we need to check for rx_pkt_len validity +* Check for rx_pkt_len validity. Return if invalid, leaving +* rxdesc->size zeroed out by the upper level. */ +if (unlikely (rx_pkt_len ==0 || + rx_pkt_len > entry->queue->data_size)) { +ERROR (entry->queue->rt2x00dev, +"Bad frame size %d, forcing to 0\n" , rx_pkt_len); +return ; + } + rxd = (__le32 *)(entry->skb->data + rx_pkt_len);/*
drivers/net/wireless/rt2x00/rt2x00dev.c +1 -1
@@ -629,7 +629,7 @@ void rt2x00lib_rxdone(struct queue_entry*/ if (unlikely (rxdesc.size ==0 || rxdesc.size > entry->queue->data_size)) { -WARNING (rt2x00dev,"Wrong frame size %d max %d.\n" , +ERROR (rt2x00dev,"Wrong frame size %d max %d.\n" , rxdesc.size, entry->queue->data_size);dev_kfree_skb (entry->skb); goto renew_skb;
Greg Kroah-Hartman
maintainerPATCH 164/262 usb: host: xhci: Fix Compliance Mode on SN65LVPE502CP Hardware
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Alexis R. Cortes" <[email protected]>
commit 71c731a296f1b08a3724bd1b514b64f1bda87a23 upstream.
This patch is intended to work around a known issue on the SN65LVPE502CP USB3.0 re-driver that can delay the negotiation between a device and the host past the usual handshake timeout.
If that happens on the first insertion, the host controller port will enter in Compliance Mode and NO port status event will be generated (as per xHCI Spec) making impossible to detect this event by software. The port will remain in compliance mode until a warm reset is applied to it.
As a result of this, the port will seem "dead" to the user and no device connections or disconnections will be detected.
For solving this, the patch creates a timer which polls every 2 seconds the link state of each host controller's port (this by reading the PORTSC register) and recovers the port by issuing a Warm reset every time Compliance mode is detected.
If a xHC USB3.0 port has previously entered to U0, the compliance mode issue will NOT occur only until system resumes from sleep/hibernate, therefore, the compliance mode timer is stopped when all xHC USB 3.0 ports have entered U0. The timer is initialized again after each system resume.
Since the issue is being caused by a piece of hardware, the timer will be enabled ONLY on those systems that have the SN65LVPE502CP installed (this patch uses DMI strings for detecting those systems) therefore making this patch to act as a quirk (XHCI_COMP_MODE_QUIRK has been added to the xhci stack).
This patch applies for these systems:
Vendor: Hewlett-Packard. System Models: Z420, Z620 and Z820.
This patch should be backported to kernels as old as 3.2, as that was the first kernel to support warm reset. The kernels will need to contain both commit 10d674a82e553cb8a1f41027bb3c3e309b3f6804 "USB: When hot reset for USB3 fails, try warm reset" and commit 8bea2bd37df08aaa599aa361a9f8b836ba98e554 "usb: Add support for root hub port status CAS". The first patch add warm reset support, and the second patch modifies the USB core to issue a warm reset when the port is in compliance mode.
--- drivers/usb/host/xhci-hub.c | 42 +++++++++++++++ drivers/usb/host/xhci.c | 121 ++++++++++++++++++++++++++++++++++++++++++++ drivers/usb/host/xhci.h | 6 ++ 3 files changed, 169 insertions(+)
drivers/usb/host/xhci-hub.c +42 -0
@@ -493,11 +493,48 @@ static void xhci_hub_report_link_state(u* when this bit is set. */ pls |=USB_PORT_STAT_CONNECTION ; + }else { +/* +* If CAS bit isn't set but the Port is already at +* Compliance Mode, fake a connection so the USB core +* notices the Compliance state and resets the port. +* This resolves an issue generated by the SN65LVPE502CP +* in which sometimes the port enters compliance mode +* caused by a delay on the host-device negotiation. +*/ +if (pls ==USB_SS_PORT_LS_COMP_MOD ) + pls |=USB_PORT_STAT_CONNECTION ; } +/* update status field */ *status |= pls; } +/* +* Function for Compliance Mode Quirk. +* +* This Function verifies if all xhc USB3 ports have entered U0, if so, +* the compliance mode timer is deleted. A port won't enter +* compliance mode if it has previously entered U0. +*/ +void xhci_del_comp_mod_timer (struct xhci_hcd *xhci,u32 status,u16 wIndex) +{ +u32 all_ports_seen_u0 = ((1 << xhci->num_usb3_ports)-1 ); +bool port_in_u0 = ((status &PORT_PLS_MASK ) ==XDEV_U0 ); + +if (!(xhci->quirks &XHCI_COMP_MODE_QUIRK )) +return ; + +if ((xhci->port_status_u0 != all_ports_seen_u0) && port_in_u0) { + xhci->port_status_u0 |=1 << wIndex; +if (xhci->port_status_u0 == all_ports_seen_u0) { +del_timer_sync (&xhci->comp_mode_recovery_timer); +xhci_dbg (xhci,"All USB3 ports have entered U0 already!\n" ); +xhci_dbg (xhci,"Compliance Mode Recovery Timer Deleted.\n" ); + } + } +} +int xhci_hub_control (struct usb_hcd *hcd,u16 typeReq,u16 wValue,u16 wIndex,char *buf,u16 wLength) {
@@ -645,6 +682,11 @@ int xhci_hub_control(struct usb_hcd *hcd/* Update Port Link State for super speed ports*/ if (hcd->speed ==HCD_USB3 ) {xhci_hub_report_link_state (&status, temp); +/* +* Verify if all USB3 Ports Have entered U0 already. +* Delete Compliance Mode Timer if so. +*/ +xhci_del_comp_mod_timer (xhci, temp, wIndex); }if (bus_state->port_c_suspend & (1 << wIndex)) status |=1 <<USB_PORT_FEAT_C_SUSPEND ;
drivers/usb/host/xhci.c +121 -0
157 lines not on this page · raw message
drivers/usb/host/xhci.h +6 -0
@@ -1495,6 +1495,7 @@ struct xhci_hcd {#define XHCI_LPM_SUPPORT (1 << 11)#define XHCI_INTEL_HOST (1 << 12)#define XHCI_SPURIOUS_REBOOT (1 << 13) +#define XHCI_COMP_MODE_QUIRK (1 << 14)unsigned int num_active_eps;unsigned int limit_active_eps;/* There are two roothubs to keep track of bus suspend info for */
@@ -1511,6 +1512,11 @@ struct xhci_hcd { unsigned sw_lpm_support:1;/* support xHCI 1.0 spec USB2 hardware LPM */ unsigned hw_lpm_support:1; +/* Compliance Mode Recovery Data */ +struct timer_list comp_mode_recovery_timer; +u32 port_status_u0; +/* Compliance Mode Timer Triggered every 2 seconds */ +#define COMP_MODE_RCVRY_MSECS 2000 };/* convert between an HCD pointer and the corresponding EHCI_HCD */
Greg Kroah-Hartman
maintainerPATCH 165/262 Intel xhci: Only switch the switchable ports
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Keng-Yu Lin <[email protected]>
commit a96874a2a92feaef607ddd3137277a788cb927a6 upstream.
With a previous patch to enable the EHCI/XHCI port switching, it switches all the available ports.
The assumption is not correct because the BIOS may expect some ports not switchable by the OS.
There are two more registers that contains the information of the switchable and non-switchable ports.
This patch adds the checking code for the two register so that only the switchable ports are altered.
This patch should be backported to kernels as old as 3.0, that contain commit ID 69e848c2090aebba5698a1620604c7dccb448684 "Intel xhci: Support EHCI/xHCI port switching."
--- drivers/usb/host/pci-quirks.c | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-)
drivers/usb/host/pci-quirks.c +23 -4
@@ -75,7 +75,9 @@#define NB_PIF0_PWRDOWN_1 0x01100013#define USB_INTEL_XUSB2PR 0xD0 +#define USB_INTEL_USB2PRM 0xD4#define USB_INTEL_USB3_PSSEN 0xD8 +#define USB_INTEL_USB3PRM 0xDC static struct amd_chipset_info { struct pci_dev *nb_dev;
@@ -772,10 +774,18 @@ void usb_enable_xhci_ports(struct pci_dereturn ; } - ports_available =0xffffffff ; +/* Read USB3PRM, the USB 3.0 Port Routing Mask Register +* Indicate the ports that can be changed from OS. +*/ +pci_read_config_dword (xhci_pdev,USB_INTEL_USB3PRM , + &ports_available); + +dev_dbg (&xhci_pdev->dev,"Configurable ports to enable SuperSpeed: 0x%x\n" , + ports_available); +/* Write USB3_PSSEN, the USB 3.0 Port SuperSpeed Enable -* Register, to turn on SuperSpeed terminations for all -* available ports. +* Register, to turn on SuperSpeed terminations for the +* switchable ports. */ pci_write_config_dword (xhci_pdev,USB_INTEL_USB3_PSSEN ,cpu_to_le32 (ports_available));
@@ -785,7 +795,16 @@ void usb_enable_xhci_ports(struct pci_dedev_dbg (&xhci_pdev->dev,"USB 3.0 ports that are now enabled " "under xHCI: 0x%x\n" , ports_available); - ports_available =0xffffffff ; +/* Read XUSB2PRM, xHCI USB 2.0 Port Routing Mask Register +* Indicate the USB 2.0 ports to be controlled by the xHCI host. +*/ + +pci_read_config_dword (xhci_pdev,USB_INTEL_USB2PRM , + &ports_available); + +dev_dbg (&xhci_pdev->dev,"Configurable USB 2.0 ports to hand over to xCHI: 0x%x\n" , + ports_available); +/* Write XUSB2PR, the xHC USB 2.0 Port Routing Register, to * switch the USB 2.0 power and data lines over to the xHCI * host.
Greg Kroah-Hartman
maintainerPATCH 166/262 usb: host: xhci-plat: use ioremap_nocache
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ruchika Kharwar <[email protected]>
commit 319acdfc064169023cd9ada5085b434fbcdacec2 upstream.
Use the ioremap_nocache variant of the ioremap API in order to make sure our memory will be marked uncachable.
This patch should be backported to kernels as old as 3.4, that contain the commit 3429e91a661e1f383aecc86c6bbcf65afb15c892 "usb: host: xhci:
add platform driver support".
--- drivers/usb/host/xhci-plat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/host/xhci-plat.c +1 -1
@@ -118,7 +118,7 @@ static int xhci_plat_probe(struct platfo goto put_hcd; } - hcd->regs =ioremap (hcd->rsrc_start, hcd->rsrc_len); + hcd->regs =ioremap_nocache (hcd->rsrc_start, hcd->rsrc_len);if (!hcd->regs) {dev_dbg (&pdev->dev,"error mapping memory\n" ); ret = -EFAULT ;
Greg Kroah-Hartman
maintainerPATCH 167/262 xhci: Fix a logical vs bitwise AND bug
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit 052c7f9ffb0e95843e75448d02664459253f9ff8 upstream.
The intent was to test whether the flag was set.
This patch should be backported to stable kernels as old as 3.0, since it fixes a bug in commit e95829f474f0db3a4d940cae1423783edd966027 "xhci:
Switch PPT ports to EHCI on shutdown.", which was marked for stable.
--- drivers/usb/host/xhci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/host/xhci.c +1 -1
@@ -760,7 +760,7 @@ void xhci_shutdown(struct usb_hcd *hcd) {struct xhci_hcd *xhci =hcd_to_xhci (hcd); -if (xhci->quirks &&XHCI_SPURIOUS_REBOOT ) +if (xhci->quirks &XHCI_SPURIOUS_REBOOT )usb_disable_xhci_ports (to_pci_dev (hcd->self.controller));spin_lock_irq (&xhci->lock);
Greg Kroah-Hartman
maintainerPATCH 168/262 xhci: Make handover code more robust
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matthew Garrett <[email protected]>
commit e955a1cd086de4d165ae0f4c7be7289d84b63bdc upstream.
My test platform (Intel DX79SI) boots reliably under BIOS, but frequently crashes when booting via UEFI. I finally tracked this down to the xhci handoff code. It seems that reads from the device occasionally just return 0xff, resulting in xhci_find_next_cap_offset generating a value that's larger than the resource region. We then oops when attempting to read the value. Sanity checking that value lets us avoid the crash.
I've no idea what's causing the underlying problem, and xhci still doesn't actually *work* even with this, but the machine at least boots which will probably make further debugging easier.
This should be backported to kernels as old as 2.6.31, that contain the commit 66d4eadd8d067269ea8fead1a50fe87c2979a80d "USB: xhci: BIOS handoff and HW initialization."
--- drivers/usb/host/pci-quirks.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/usb/host/pci-quirks.c +10 -2
@@ -841,12 +841,12 @@ static void __devinit quirk_usb_handoff_void __iomem *op_reg_base;u32 val;int timeout; +int len =pci_resource_len (pdev,0 );if (!mmio_resource_enabled (pdev,0 ))return ; - base =ioremap_nocache (pci_resource_start (pdev,0 ), -pci_resource_len (pdev,0 )); + base =ioremap_nocache (pci_resource_start (pdev,0 ), len);if (base ==NULL )return ;
@@ -856,9 +856,17 @@ static void __devinit quirk_usb_handoff_*/ ext_cap_offset =xhci_find_next_cap_offset (base,XHCI_HCC_PARAMS_OFFSET ); do { + if ((ext_cap_offset + sizeof(val)) > len) { + /* We're reading garbage from the controller */ + dev_warn(&pdev->dev, + "xHCI controller failing to respond"); + return; + } + if (!ext_cap_offset) /* We've reached the end of the extended capabilities */ goto hc_init; + val = readl(base + ext_cap_offset); if (XHCI_EXT_CAPS_ID(val) == XHCI_EXT_CAPS_LEGACY) break;
Greg Kroah-Hartman
maintainerPATCH 169/262 xhci: Recognize USB 3.0 devices as superspeed at powerup
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Manoj Iyer <[email protected]>
commit 29d214576f936db627ff62afb9ef438eea18bcd2 upstream.
On Intel Panther Point chipset USB 3.0 devices show up as high-speed devices on powerup, but after an s3 cycle they are correctly recognized as SuperSpeed. At powerup switch the port to xHCI so that USB 3.0 devices are correctly recognized.
This patch should be backported to kernels as old as 3.0, that contain commit ID 69e848c2090aebba5698a1620604c7dccb448684 "Intel xhci: Support EHCI/xHCI port switching."
--- drivers/usb/host/pci-quirks.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/usb/host/pci-quirks.c +2 -1
@@ -897,9 +897,10 @@ static void __devinit quirk_usb_handoff_/* Disable any BIOS SMIs and clear all SMI events*/ writel (val, base + ext_cap_offset +XHCI_LEGACY_CONTROL_OFFSET ); +hc_init:if (usb_is_intel_switchable_xhci (pdev))usb_enable_xhci_ports (pdev); -hc_init: + op_reg_base = base +XHCI_HC_LENGTH (readl (base));/* Wait for the host controller to be ready before writing any
Greg Kroah-Hartman
maintainerPATCH 170/262 usb: host: xhci: fix compilation error for non-PCI based stacks
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Moiz Sonasath <[email protected]>
commit 296365781903226a3fb8758901eaeec09d2798e4 upstream.
For non PCI-based stacks, this function call usb_disable_xhci_ports(to_pci_dev(hcd->self.controller)); made from xhci_shutdown is not applicable.
Ideally, we wouldn't have any PCI-specific code on a generic driver such as the xHCI stack, but it looks like we should just stub usb_disable_xhci_ports() out for non-PCI devices.
[ [email protected]: slight improvement to commit log ]
This patch should be backported to kernels as old as 3.0, since the commit it fixes (e95829f474f0db3a4d940cae1423783edd966027 "xhci: Switch PPT ports to EHCI on shutdown.") was marked for stable.
--- drivers/usb/host/pci-quirks.h | 1 + 1 file changed, 1 insertion(+)
drivers/usb/host/pci-quirks.h +1 -0
@@ -15,6 +15,7 @@ void usb_disable_xhci_ports(struct pci_dstatic inline void usb_amd_quirk_pll_disable (void ) {}static inline void usb_amd_quirk_pll_enable (void ) {}static inline void usb_amd_dev_put (void ) {} +static inline void usb_disable_xhci_ports (struct pci_dev *xhci_pdev) {}#endif /* CONFIG_PCI */ #endif /* __LINUX_USB_PCI_QUIRKS_H */
Greg Kroah-Hartman
maintainerPATCH 171/262 tty: serial: imx: console write routing is unsafe on SMP
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xinyu Chen <[email protected]>
commit 9ec1882df244c4ee1baa692676fef5e8b0f5487d upstream.
The console feature's write routing is unsafe on SMP with the startup/shutdown call.
There could be several consumers of the console
* the kernel printk
* the init process using /dev/kmsg to call printk to show log
* shell, which open /dev/console and write with sys_write()
The shell goes into the normal uart open/write routing, but the other two go into the console operations.
The open routing calls imx serial startup, which will write USR1/2 register without any lock and critical with imx_console_write call.
Add a spin_lock for startup/shutdown/console_write routing.
This patch is a port from Freescale's Android kernel.
--- drivers/tty/serial/imx.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/tty/serial/imx.c +11 -1
@@ -758,6 +758,7 @@ static int imx_startup(struct uart_port } } +spin_lock_irqsave (&sport->port.lock, flags);/* * Finally, clear and enable interrupts */
@@ -811,7 +812,6 @@ static int imx_startup(struct uart_port/* * Enable modem status interrupts */ -spin_lock_irqsave (&sport->port.lock,flags);imx_enable_ms (&sport->port);spin_unlock_irqrestore (&sport->port.lock,flags);
@@ -841,10 +841,13 @@ static void imx_shutdown(struct uart_por {struct imx_port *sport = (struct imx_port *)port;unsigned long temp; +unsigned long flags; +spin_lock_irqsave (&sport->port.lock, flags); temp =readl (sport->port.membase +UCR2 ); temp &= ~(UCR2_TXEN );writel (temp, sport->port.membase +UCR2 ); +spin_unlock_irqrestore (&sport->port.lock, flags);if (USE_IRDA (sport)) {struct imxuart_platform_data *pdata;
@@ -873,12 +876,14 @@ static void imx_shutdown(struct uart_por* Disable all interrupts, port and break condition. */ +spin_lock_irqsave (&sport->port.lock, flags); temp =readl (sport->port.membase +UCR1 ); temp &= ~(UCR1_TXMPTYEN |UCR1_RRDYEN |UCR1_RTSDEN |UCR1_UARTEN );if (USE_IRDA (sport)) temp &= ~(UCR1_IREN );writel (temp, sport->port.membase +UCR1 ); +spin_unlock_irqrestore (&sport->port.lock, flags); } static void
@@ -1221,6 +1226,9 @@ imx_console_write(struct console *co, costruct imx_port *sport = imx_ports[co->index];struct imx_port_ucrs old_ucr;unsigned int ucr1; +unsigned long flags; + +spin_lock_irqsave (&sport->port.lock, flags);/* * First, save UCR1/2/3 and then disable interrupts
@@ -1246,6 +1254,8 @@ imx_console_write(struct console *co, cowhile (!(readl (sport->port.membase +USR2 ) &USR2_TXDC ));imx_port_ucrs_restore (&sport->port, &old_ucr); + +spin_unlock_irqrestore (&sport->port.lock, flags); }/*
Greg Kroah-Hartman
maintainerPATCH 172/262 tty: serial: imx: dont reinit clock in imx_setup_ufcr()
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dirk Behme <[email protected]>
commit 7be0670f7b9198382938a03ff3db7f47ef6b4780 upstream.
Remove the clock configuration from imx_setup_ufcr(). This isn't needed here and will cause garbage output if done.
To be be sure that we only touch the bits we want (TXTL and RXTL) we have to mask out all other bits of the UFCR register. Add one non-existing bit macro for this, too (bit 6, DCEDTE on i.MX6).
--- drivers/tty/serial/imx.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-)
drivers/tty/serial/imx.c +4 -14
@@ -132,6 +132,7 @@#define UCR4_OREN (1<<1)/* Receiver overrun interrupt enable */ #define UCR4_DREN (1<<0)/* Recv data ready interrupt enable */ #define UFCR_RXTL_SHF 0/* Receiver trigger level shift */ +#define UFCR_DCEDTE (1<<6)/* DCE/DTE mode select */ #define UFCR_RFDIV (7<<7)/* Reference freq divider mask */ #define UFCR_RFDIV_REG (x) (((x) < 7 ? 6 - (x) : 6) << 7)#define UFCR_TXTL_SHF 10/* Transmitter trigger level shift */
@@ -668,22 +669,11 @@ static void imx_break_ctl(struct uart_postatic int imx_setup_ufcr (struct imx_port *sport,unsigned int mode) {unsigned int val; -unsigned int ufcr_rfdiv; - -/* set receiver / transmitter trigger level. -* RFDIV is set such way to satisfy requested uartclk value -*/ - val =TXTL <<10 |RXTL ; - ufcr_rfdiv = (clk_get_rate (sport->clk_per) + sport->port.uartclk /2 ) - / sport->port.uartclk; - -if (!ufcr_rfdiv) - ufcr_rfdiv =1 ; - - val |=UFCR_RFDIV_REG (ufcr_rfdiv); +/* set receiver / transmitter trigger level */ + val =readl (sport->port.membase +UFCR ) & (UFCR_RFDIV |UFCR_DCEDTE ); + val |=TXTL <<UFCR_TXTL_SHF |RXTL ;writel (val, sport->port.membase +UFCR ); -return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 173/262 mutex: Place lock in contended state after fastpath_lock failure
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Will Deacon <[email protected]>
commit 0bce9c46bf3b15f485d82d7e81dabed6ebcc24b1 upstream.
ARM recently moved to asm-generic/mutex-xchg.h for its mutex implementation after the previous implementation was found to be missing some crucial memory barriers. However, this has revealed some problems running hackbench on SMP platforms due to the way in which the MUTEX_SPIN_ON_OWNER code operates.
The symptoms are that a bunch of hackbench tasks are left waiting on an unlocked mutex and therefore never get woken up to claim it. This boils down to the following sequence of events:
Task A Task B Task C Lock value
0 1 1 lock() 0 2 lock() 0 3 spin(A) 0 4 unlock() 1 5 lock() 0 6 cmpxchg(1,0) 0 7 contended() -1 8 lock() 0 9 spin(C) 0 10 unlock() 1 11 cmpxchg(1,0) 0 12 unlock() 1
At this point, the lock is unlocked, but Task B is in an uninterruptible sleep with nobody to wake it up.
This patch fixes the problem by ensuring we put the lock into the contended state if we fail to acquire it on the fastpath, ensuring that any blocked waiters are woken up when the mutex is released.
--- include/asm-generic/mutex-xchg.h | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
include/asm-generic/mutex-xchg.h +9 -2
@@ -26,7 +26,13 @@ static inline void __mutex_fastpath_lock(atomic_t *count, void (*fail_fn)(atomic_t *)) {if (unlikely (atomic_xchg (count,0 ) !=1 )) -fail_fn (count); +/* +* We failed to acquire the lock, so mark it contended +* to ensure that any waiting tasks are woken up by the +* unlock slow path. +*/ +if (likely (atomic_xchg (count,-1 ) !=1 )) +fail_fn (count); }/**
@@ -43,7 +49,8 @@ static inline int __mutex_fastpath_lock_retval(atomic_t *count, int (*fail_fn)(atomic_t *)) {if (unlikely (atomic_xchg (count,0 ) !=1 )) -return fail_fn (count); +if (likely (atomic_xchg (count,-1 ) !=1 )) +return fail_fn (count);return 0 ; }
Re: [ 173/262] mutex: Place lock in contended state after fastpath_lock failure
Quoted 9 lines · Greg Kroah-Hartman
From: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Will Deacon <[email protected]>
commit
0bce9c46bf3b15f485d82d7e81dabed6ebcc24b1upstream.
Now that you've queued this one, could you pick up a76d7bd96d as well please?
Thanks
Nicolas
Greg Kroah-Hartman
maintainerRe: [ 173/262] mutex: Place lock in contended state after fastpath_lock failure
Quoted 6 lines · Nicolas Pitre
Quoted 4 lines · Greg Kroah-Hartman
From: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
Quoted 8 lines
Quoted 5 lines
------------------
From: Will Deacon <[email protected]>
commit
0bce9c46bf3b15f485d82d7e81dabed6ebcc24b1upstream.Now that you've queued this one, could you pick up
a76d7bd96das well please?
Sure, for just 3.5.y or any other stable trees?
thanks,
greg k-h
Re: [ 173/262] mutex: Place lock in contended state after fastpath_lock failure
Quoted 9 lines · Greg Kroah-Hartman
Quoted 8 lines · Nicolas Pitre
Quoted 6 lines · Greg Kroah-Hartman
From: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
From: Will Deacon <[email protected]>
commit
0bce9c46bf3b15f485d82d7e81dabed6ebcc24b1upstream.Now that you've queued this one, could you pick up
a76d7bd96das well please?Sure, for just 3.5.y or any other stable trees?
Any other stable tree where commit 0bce9c46bf has also been merged.
Nicolas
Greg Kroah-Hartman
maintainerRe: [ 173/262] mutex: Place lock in contended state after fastpath_lock failure
Quoted 13 lines · Nicolas Pitre
Quoted 11 lines · Greg Kroah-Hartman
Quoted 10 lines · Nicolas Pitre
Quoted 8 lines · Greg Kroah-Hartman
From: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Will Deacon <[email protected]>
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
commit
0bce9c46bf3b15f485d82d7e81dabed6ebcc24b1upstream.Now that you've queued this one, could you pick up
a76d7bd96das well please?Sure, for just 3.5.y or any other stable trees?
Any other stable tree where commit
0bce9c46bfhas also been merged.
Ok, now applied to 3.0.y and 3.4.y and 3.5.y
greg k-h
Greg Kroah-Hartman
maintainerPATCH 174/262 x86, avx: dont use avx instructions with "noxsave" boot param
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Suresh Siddha <[email protected]>
commit c6fd893da927c6cefb2ece22402765379921a834 upstream.
Clear AVX, AVX2 features along with clearing XSAVE feature bits, as part of the parsing "noxsave" parameter.
Fixes the kernel boot panic with "noxsave" boot parameter.
We could have checked cpu_has_osxsave along with cpu_has_avx etc, but Peter mentioned clearing the feature bits will be better for uses like static_cpu_has() etc.
--- arch/x86/kernel/cpu/common.c | 2 ++ 1 file changed, 2 insertions(+)
arch/x86/kernel/cpu/common.c +2 -0
@@ -144,6 +144,8 @@ static int __init x86_xsave_setup(char * {setup_clear_cpu_cap (X86_FEATURE_XSAVE );setup_clear_cpu_cap (X86_FEATURE_XSAVEOPT ); +setup_clear_cpu_cap (X86_FEATURE_AVX ); +setup_clear_cpu_cap (X86_FEATURE_AVX2 );return 1 ; }__setup ("noxsave" , x86_xsave_setup);
Re: [ 174/262] x86, avx: dont use avx instructions with "noxsave" boot param
Quoted 10 lines · Greg Kroah-Hartman
From: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Suresh Siddha <[email protected]>
commit
c6fd893da927c6cefb2ece22402765379921a834upstream.
Quoted 8 lines
Clear AVX, AVX2 features along with clearing XSAVE feature bits, as part of the parsing "noxsave" parameter.
Fixes the kernel boot panic with "noxsave" boot parameter.
We could have checked
cpu_has_osxsavealong withcpu_has_avxetc, but Peter mentioned clearing the feature bits will be better for uses likestatic_cpu_has()etc.
This was marked as needed for 3.5 only - presumably because the kernel wasn't using AVX before this - but don't we also need to clear these bits even in earlier versions so userland knows not to use it?
Ben.
Quoted 20 lines
Signed-off-by Suresh Siddha <[email protected]>Signed-off-by H. Peter Anvin <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- arch/x86/kernel/cpu/common.c | 2 ++ 1 file changed, 2 insertions(+)arch/x86/kernel/cpu/common.c +2
-0@@ -144,6 +144,8 @@ static int __init x86_xsave_setup(char * {setup_clear_cpu_cap (X86_FEATURE_XSAVE );setup_clear_cpu_cap (X86_FEATURE_XSAVEOPT ); +setup_clear_cpu_cap (X86_FEATURE_AVX ); +setup_clear_cpu_cap (X86_FEATURE_AVX2 );return 1 ; }__setup ("noxsave" , x86_xsave_setup);
Signature · 2 lines
Ben Hutchings You can't have everything. Where would you put it?
H. Peter Anvin
reviewerRe: [ 174/262] x86, avx: dont use avx instructions with "noxsave" boot param
Userland should use a different query mechanism. On the other hand, it will not hurt either. On pre-xsave kernels AVX is a non-option.
Quoted 49 lines · Ben Hutchings
Quoted 3 lines · Greg Kroah-Hartman
From: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me
know.
Quoted 5 lines
------------------
From: Suresh Siddha <[email protected]>
Quoted 8 lines
commit
c6fd893da927c6cefb2ece22402765379921a834upstream.Clear AVX, AVX2 features along with clearing XSAVE feature bits, as part of the parsing "noxsave" parameter.
Fixes the kernel boot panic with "noxsave" boot parameter.
We could have checked
cpu_has_osxsavealong withcpu_has_avxetc, butPeter
Quoted 2 lines
mentioned clearing the feature bits will be better for uses like
static_cpu_has()etc.This was marked as needed for 3.5 only - presumably because the kernel wasn't using AVX before this - but don't we also need to clear these bits even in earlier versions so userland knows not to use it?
Ben.
Quoted 2 lines
Signed-off-by Suresh Siddha <[email protected]>Link:
http://lkml.kernel.org/r/[email protected]
Quoted 18 lines
Signed-off-by H. Peter Anvin <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- arch/x86/kernel/cpu/common.c | 2 ++ 1 file changed, 2 insertions(+)arch/x86/kernel/cpu/common.c +2
-0@@ -144,6 +144,8 @@ static int __init x86_xsave_setup(char * {setup_clear_cpu_cap (X86_FEATURE_XSAVE );setup_clear_cpu_cap (X86_FEATURE_XSAVEOPT ); +setup_clear_cpu_cap (X86_FEATURE_AVX ); +setup_clear_cpu_cap (X86_FEATURE_AVX2 );return 1 ; }__setup ("noxsave" , x86_xsave_setup);
Signature · 1 line
Sent from my mobile phone. Please excuse brevity and lack of formatting.
Re: [ 174/262] x86, avx: dont use avx instructions with "noxsave" boot param
Quoted 2 lines · H. Peter Anvin
Userland should use a different query mechanism. On the other hand, it will not hurt either. On pre-xsave kernels AVX is a non-option.
[...]
OK, having looked at what the SDM says I agree that there shouldn't be a problem for userland.
Ben.
Signature · 2 lines
Ben Hutchings Who are all these weirdos? - David Bowie, about L-Space IRC channel #afp
Greg Kroah-Hartman
maintainerPATCH 175/262 drivers/rtc/rtc-rs5c348.c: fix hour decoding in 12-hour mode
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Atsushi Nemoto <[email protected]>
commit 7dbfb315b2aaef0a115765946bf3026d074c33a7 upstream.
Correct the offset by subtracting 20 from tm_hour before taking the modulo 12.
[ "Why 20?" I hear you ask. Or at least I did.
Here's the reason why: RS5C348_BIT_PM is 32, and is - stupidly - included in the RS5C348_HOURS_MASK define. So it's really subtracting out that bit to get "hour+12". But then because it does things modulo 12, it needs to add the 12 in again afterwards anyway.
This code is confused. It would be much clearer if RS5C348_HOURS_MASK just didn't include the RS5C348_BIT_PM bit at all, then it wouldn't need to do the silly subtract either.
Whatever. It's all just math, the end result is the same. - Linus ]
--- drivers/rtc/rtc-rs5c348.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/rtc/rtc-rs5c348.c +5 -2
@@ -122,9 +122,12 @@ rs5c348_rtc_read_time(struct device *dev tm->tm_min =bcd2bin (rxbuf[RS5C348_REG_MINS ] &RS5C348_MINS_MASK ); tm->tm_hour =bcd2bin (rxbuf[RS5C348_REG_HOURS ] &RS5C348_HOURS_MASK );if (!pdata->rtc_24h) { - tm->tm_hour %=12 ; -if (rxbuf[RS5C348_REG_HOURS ] &RS5C348_BIT_PM ) +if (rxbuf[RS5C348_REG_HOURS ] &RS5C348_BIT_PM ) { + tm->tm_hour -=20 ; + tm->tm_hour %=12 ; tm->tm_hour +=12 ; + }else + tm->tm_hour %=12 ; } tm->tm_wday =bcd2bin (rxbuf[RS5C348_REG_WDAY ] &RS5C348_WDAY_MASK ); tm->tm_mday =bcd2bin (rxbuf[RS5C348_REG_DAY ] &RS5C348_DAY_MASK );
Greg Kroah-Hartman
maintainerPATCH 176/262 PM / Runtime: Fix rpm_resume() return value for power.no_callbacks set
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Rafael J. Wysocki" <[email protected]>
commit 7f321c26c04807834fef4c524d2b21573423fc74 upstream.
For devices whose power.no_callbacks flag is set, rpm_resume() should return 1 if the device's parent is already active, so that the callers of pm_runtime_get() don't think that they have to wait for the device to resume (asynchronously) in that case (the core won't queue up an asynchronous resume in that case, so there's nothing to wait for anyway).
Modify the code accordingly (and make sure that an idle notification will be queued up on success, even if 1 is to be returned).
--- drivers/base/power/runtime.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/base/power/runtime.c +2 -1
@@ -584,6 +584,7 @@ static int rpm_resume(struct device *dev || dev->parent->power.runtime_status == RPM_ACTIVE) {atomic_inc (&dev->parent->power.child_count);spin_unlock (&dev->parent->power.lock); + retval =1 ; goto no_callback;/* Assume success. */ }spin_unlock (&dev->parent->power.lock);
@@ -664,7 +665,7 @@ static int rpm_resume(struct device *dev }wake_up_all (&dev->power.wait_queue); -if (!retval) +if (retval >=0 )rpm_idle (dev,RPM_ASYNC ); out:
Greg Kroah-Hartman
maintainerPATCH 177/262 PM / Runtime: Clear power.deferred_resume on success in rpm_suspend()
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Rafael J. Wysocki" <[email protected]>
commit 58a34de7b1a920d287d17d2ca08bc9aaf7e6d35b upstream.
The power.deferred_resume can only be set if the runtime PM status of device is RPM_SUSPENDING and it should be cleared after its status has been changed, regardless of whether or not the runtime suspend has been successful. However, it only is cleared on suspend failure, while it may remain set on successful suspend and is happily leaked to rpm_resume() executed in that case.
That shouldn't happen, so if power.deferred_resume is set in rpm_suspend() after the status has been changed to RPM_SUSPENDED, clear it before calling rpm_resume(). Then, it doesn't need to be cleared before changing the status to RPM_SUSPENDING any more, because it's always cleared after the status has been changed to either RPM_SUSPENDED (on success) or RPM_ACTIVE (on failure).
--- drivers/base/power/runtime.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/base/power/runtime.c +1 -1
@@ -388,7 +388,6 @@ static int rpm_suspend(struct device *de goto repeat; } - dev->power.deferred_resume = false;if (dev->power.no_callbacks) goto no_callback;/* Assume success. */
@@ -440,6 +439,7 @@ static int rpm_suspend(struct device *dewake_up_all (&dev->power.wait_queue);if (dev->power.deferred_resume) { + dev->power.deferred_resume = false;rpm_resume (dev,0 ); retval = -EAGAIN ; goto out;
Greg Kroah-Hartman
maintainerPATCH 178/262 PM / Runtime: Check device PM QoS setting before "no callbacks" check
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Rafael J. Wysocki" <[email protected]>
commit 55d7ec4520e86d735d178c15d7df33d507bd43c6 upstream.
If __dev_pm_qos_read_value(dev) returns a negative value, rpm_suspend() should return -EPERM for dev even if its power.no_callbacks flag is set. For this to happen, the device's power.no_callbacks flag has to be checked after the PM QoS check, so move the PM QoS check to rpm_check_suspend_allowed() (this will make it cover idle notifications as well as runtime suspend too).
--- drivers/base/power/runtime.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/base/power/runtime.c +2 -6
@@ -147,6 +147,8 @@ static int rpm_check_suspend_allowed(str || (dev->power.request_pending && dev->power.request == RPM_REQ_RESUME)) retval = -EAGAIN ; + else if (__dev_pm_qos_read_value(dev) < 0) + retval = -EPERM ; else if (dev->power.runtime_status == RPM_SUSPENDED) retval =1 ;
@@ -402,12 +404,6 @@ static int rpm_suspend(struct device *de goto out; } -if (__dev_pm_qos_read_value (dev) <0 ) { -/* Negative PM QoS constraint means "never suspend". */ - retval = -EPERM ; - goto out; - } -__update_runtime_status (dev,RPM_SUSPENDING );if (dev->pm_domain)
Greg Kroah-Hartman
maintainerPATCH 179/262 drivers/misc/sgi-xp/xpc_uv.c: SGI XPC fails to load when cpu 0 is out of IRQ resources
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Robin Holt <[email protected]>
commit 7838f994b4fceff24c343f4e26a6cf4393869579 upstream.
On many of our larger systems, CPU 0 has had all of its IRQ resources consumed before XPC loads. Worst cases on machines with multiple 10 GigE cards and multiple IB cards have depleted the entire first socket of IRQs.
This patch makes selecting the node upon which IRQs are allocated (as well as all the other GRU Message Queue structures) specifiable as a module load param and has a default behavior of searching all nodes/cpus for an available resources.
--- drivers/misc/sgi-xp/xpc_uv.c | 84 +++++++++++++++++++++++++++++++++---------- 1 file changed, 65 insertions(+), 19 deletions(-)
drivers/misc/sgi-xp/xpc_uv.c +65 -19
@@ -18,6 +18,8 @@#include <linux/interrupt.h> #include <linux/delay.h> #include <linux/device.h> +#include <linux/cpu.h> +#include <linux/module.h> #include <linux/err.h> #include <linux/slab.h> #include <asm/uv/uv_hub.h>
@@ -59,6 +61,8 @@ static struct xpc_heartbeat_uv *xpc_hear XPC_NOTIFY_MSG_SIZE_UV)#define XPC_NOTIFY_IRQ_NAME "xpc_notify" +static int xpc_mq_node =-1 ; +static struct xpc_gru_mq_uv *xpc_activate_mq_uv;static struct xpc_gru_mq_uv *xpc_notify_mq_uv;
@@ -109,11 +113,8 @@ xpc_get_gru_mq_irq_uv(struct xpc_gru_mq_#if definedCONFIG_X86_64 mq->irq =uv_setup_irq (irq_name, cpu, mq->mmr_blade, mq->mmr_offset,UV_AFFINITY_CPU ); -if (mq->irq <0 ) { -dev_err (xpc_part,"uv_setup_irq() returned error=%d\n" , - -mq->irq); +if (mq->irq <0 )return mq->irq; - } mq->mmr_value =uv_read_global_mmr64 (mmr_pnode, mq->mmr_offset);
@@ -238,8 +239,9 @@ xpc_create_gru_mq_uv(unsigned int mq_siz mq->mmr_blade =uv_cpu_to_blade_id (cpu); nid =cpu_to_node (cpu); - page =alloc_pages_exact_node (nid,GFP_KERNEL | __GFP_ZERO |GFP_THISNODE , - pg_order); + page =alloc_pages_exact_node (nid, +GFP_KERNEL | __GFP_ZERO |GFP_THISNODE , + pg_order);if (page ==NULL ) {dev_err (xpc_part,"xpc_create_gru_mq_uv() failed to alloc %d " "bytes of memory on nid=%d for GRU mq\n" , mq_size, nid);
@@ -1731,9 +1733,50 @@ static struct xpc_arch_operations xpc_ar .notify_senders_of_disconnect = xpc_notify_senders_of_disconnect_uv, }; +static int +xpc_init_mq_node (int nid) +{ +int cpu; + +get_online_cpus (); + +for_each_cpu (cpu,cpumask_of_node (nid)) { + xpc_activate_mq_uv = +xpc_create_gru_mq_uv (XPC_ACTIVATE_MQ_SIZE_UV , nid, +XPC_ACTIVATE_IRQ_NAME , + xpc_handle_activate_IRQ_uv); +if (!IS_ERR (xpc_activate_mq_uv)) +break ; + } +if (IS_ERR (xpc_activate_mq_uv)) { +put_online_cpus (); +return PTR_ERR (xpc_activate_mq_uv); + } + +for_each_cpu (cpu,cpumask_of_node (nid)) { + xpc_notify_mq_uv = +xpc_create_gru_mq_uv (XPC_NOTIFY_MQ_SIZE_UV , nid, +XPC_NOTIFY_IRQ_NAME , + xpc_handle_notify_IRQ_uv); +if (!IS_ERR (xpc_notify_mq_uv)) +break ; + } +if (IS_ERR (xpc_notify_mq_uv)) { +xpc_destroy_gru_mq_uv (xpc_activate_mq_uv); +put_online_cpus (); +return PTR_ERR (xpc_notify_mq_uv); + } + +put_online_cpus (); +return 0 ; +} +int xpc_init_uv (void ) { +int nid; +int ret =0 ; + xpc_arch_ops = xpc_arch_ops_uv;if (sizeof (struct xpc_notify_mq_msghdr_uv ) >XPC_MSG_HDR_MAX_SIZE ) {
@@ -1742,21 +1785,21 @@ xpc_init_uv(void)return -E2BIG ; } - xpc_activate_mq_uv =xpc_create_gru_mq_uv (XPC_ACTIVATE_MQ_SIZE_UV ,0 , -XPC_ACTIVATE_IRQ_NAME , - xpc_handle_activate_IRQ_uv); -if (IS_ERR (xpc_activate_mq_uv)) -return PTR_ERR (xpc_activate_mq_uv); +if (xpc_mq_node <0 ) +for_each_online_node (nid) { + ret =xpc_init_mq_node (nid); - xpc_notify_mq_uv =xpc_create_gru_mq_uv (XPC_NOTIFY_MQ_SIZE_UV ,0 , -XPC_NOTIFY_IRQ_NAME , - xpc_handle_notify_IRQ_uv); -if (IS_ERR (xpc_notify_mq_uv)) { -xpc_destroy_gru_mq_uv (xpc_activate_mq_uv); -return PTR_ERR (xpc_notify_mq_uv); - } +if (!ret) +break ; + } +else + ret =xpc_init_mq_node (xpc_mq_node); -return 0 ; +if (ret <0 ) +dev_err (xpc_part,"xpc_init_mq_node() returned error=%d\n" , + -ret); + +return ret; }void
@@ -1765,3 +1808,6 @@ xpc_exit_uv(void)xpc_destroy_gru_mq_uv (xpc_notify_mq_uv);xpc_destroy_gru_mq_uv (xpc_activate_mq_uv); } + +module_param (xpc_mq_node, int,0 ); +MODULE_PARM_DESC (xpc_mq_node,"Node number on which to allocate message queues." );
Greg Kroah-Hartman
maintainerPATCH 180/262 fbcon: fix race condition between console lock and cursor timer (v1.1)
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Airlie <[email protected]>
commit d8636a2717bb3da2a7ce2154bf08de90bb8c87b0 upstream.
So we've had a fair few reports of fbcon handover breakage between efi/vesafb and i915 surface recently, so I dedicated a couple of days to finding the problem.
Essentially the last thing we saw was the conflicting framebuffer message and that was all.
So after much tracing with direct netconsole writes (printks under console_lock not so useful), I think I found the race.
Thread A (driver load) Thread B (timer thread)
unbind_con_driver -> |
bind_con_driver -> |
vc->vc_sw->con_deinit -> |
fbcon_deinit -> |
console_lock() |
| |
| fbcon_flashcursor timer fires
| console_lock() <- blocked for A
|
|fbcon_del_cursor_timer ->
del_timer_sync
(BOOM)
Of course because all of this is under the console lock, we never see anything, also since we also just unbound the active console guess what we never see anything.
Hopefully this fixes the problem for anyone seeing vesafb->kms driver handoff.
v1.1: add comment suggestion from Alan.
--- drivers/video/console/fbcon.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/video/console/fbcon.c +8 -1
@@ -372,8 +372,15 @@ static void fb_flashcursor(struct work_sstruct vc_data *vc =NULL ;int c;int mode; +int ret; + +/* FIXME: we should sort out the unbind locking instead */ +/* instead we just fail to flash the cursor if we can't get +* the lock instead of blocking fbcon deinit */ + ret =console_trylock (); +if (ret ==0 ) +return ; -console_lock ();if (ops && ops->currcon !=-1 ) vc = vc_cons[ops->currcon].d;
Greg Kroah-Hartman
maintainerPATCH 181/262 drm/radeon: avoid turning off spread spectrum for used pll
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jerome Glisse <[email protected]>
commit 5efcc76c13a745f98e7b6604d6aca49761be1970 upstream.
If spread spectrum is enabled and in use for a given pll we should not turn it off as it will lead to turning off display for crtc that use the pll (this behavior was observed on chelsea edp).
--- drivers/gpu/drm/radeon/atombios_crtc.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-)
drivers/gpu/drm/radeon/atombios_crtc.c +21 -4
@@ -444,11 +444,28 @@ union atom_enable_ss {static void atombios_crtc_program_ss (struct radeon_device *rdev,int enable,int pll_id, +int crtc_id,struct radeon_atom_ss *ss) { +unsigned i;int index =GetIndexIntoMasterTable (COMMAND , EnableSpreadSpectrumOnPPLL);union atom_enable_ss args; +if (!enable) { +for (i =0 ; i <6 ; i++) { +if (rdev->mode_info.crtcs[i] && + rdev->mode_info.crtcs[i]->enabled && + i != crtc_id && + pll_id == rdev->mode_info.crtcs[i]->pll_id) { +/* one other crtc is using this pll don't turn +* off spread spectrum as it might turn off +* display on active crtc +*/ +return ; + } + } + } +memset (&args,0 ,sizeof (args));if (ASIC_IS_DCE5 (rdev)) {
@@ -1036,7 +1053,7 @@ static void atombios_crtc_set_pll(structradeon_compute_pll_legacy (pll, adjusted_clock, &pll_clock, &fb_div, &frac_fb_div, &ref_div, &post_div); -atombios_crtc_program_ss (rdev,ATOM_DISABLE , radeon_crtc->pll_id, &ss); +atombios_crtc_program_ss (rdev,ATOM_DISABLE , radeon_crtc->pll_id, radeon_crtc->crtc_id, &ss); atombios_crtc_program_pll(crtc, radeon_crtc->crtc_id, radeon_crtc->pll_id, encoder_mode, radeon_encoder->encoder_id, mode->clock,
@@ -1059,7 +1076,7 @@ static void atombios_crtc_set_pll(struct ss.step = step_size; } -atombios_crtc_program_ss (rdev,ATOM_ENABLE , radeon_crtc->pll_id, &ss); +atombios_crtc_program_ss (rdev,ATOM_ENABLE , radeon_crtc->pll_id, radeon_crtc->crtc_id, &ss); } }
@@ -1576,11 +1593,11 @@ void radeon_atom_disp_eng_pll_init(strucASIC_INTERNAL_SS_ON_DCPLL , rdev->clock.default_dispclk);if (ss_enabled) -atombios_crtc_program_ss (rdev,ATOM_DISABLE ,ATOM_DCPLL , &ss); +atombios_crtc_program_ss (rdev,ATOM_DISABLE ,ATOM_DCPLL ,-1 , &ss);/* XXX: DCE5, make sure voltage, dispclk is high enough */ atombios_crtc_set_disp_eng_pll (rdev, rdev->clock.default_dispclk);if (ss_enabled) -atombios_crtc_program_ss (rdev,ATOM_ENABLE ,ATOM_DCPLL , &ss); +atombios_crtc_program_ss (rdev,ATOM_ENABLE ,ATOM_DCPLL ,-1 , &ss); } }
Greg Kroah-Hartman
maintainerPATCH 182/262 drm/radeon/ss: use num_crtc rather than hardcoded 6
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
commit 5317670692f61675394db2eb6713484b67383750 upstream.
When checking if a pll is in use.
--- drivers/gpu/drm/radeon/atombios_crtc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/radeon/atombios_crtc.c +1 -1
@@ -452,7 +452,7 @@ static void atombios_crtc_program_ss(strunion atom_enable_ss args;if (!enable) { -for (i =0 ; i <6 ; i++) { +for (i =0 ; i < rdev->num_crtc; i++) { if (rdev->mode_info.crtcs[i] && rdev->mode_info.crtcs[i]->enabled && i != crtc_id &&
Greg Kroah-Hartman
maintainerPATCH 183/262 drm/radeon: fence virtual address and free it once idle v4
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jerome Glisse <[email protected]>
commit e43b5ec05afdc232be25aa481315035c1888d389 upstream.
Virtual address need to be fenced to know when we can safely remove it. This patch also properly clear the pagetable. Previously it was serouisly broken.
Kernel 3.5/3.4 need a similar patch but adapted for difference in mutex locking.
v2: For to update pagetable when unbinding bo (don't bailout if
bo_va->valid is true).
v3: Add kernel 3.5/3.4 comment.
v4: Fix compilation warnings.
--- drivers/gpu/drm/radeon/radeon.h | 1 + drivers/gpu/drm/radeon/radeon_cs.c | 30 +++++++++++++++++++++++++++--- drivers/gpu/drm/radeon/radeon_gart.c | 24 ++++++++++++++++++++++-- drivers/gpu/drm/radeon/radeon_gem.c | 13 ++----------- drivers/gpu/drm/radeon/radeon_object.c | 6 +----- 5 files changed, 53 insertions(+), 21 deletions(-)
drivers/gpu/drm/radeon/radeon.h +1 -0
@@ -323,6 +323,7 @@ struct radeon_bo_va {uint64_t soffset;uint64_t eoffset;uint32_t flags; +struct radeon_fence *fence;bool valid; };
drivers/gpu/drm/radeon/radeon_cs.c +27 -3
@@ -294,6 +294,28 @@ int radeon_cs_parser_init(struct radeon_return 0 ; } +static void radeon_bo_vm_fence_va (struct radeon_cs_parser *parser, +struct radeon_fence *fence) +{ +struct radeon_fpriv *fpriv = parser->filp->driver_priv; +struct radeon_vm *vm = &fpriv->vm; +struct radeon_bo_list *lobj; + +if (parser->chunk_ib_idx ==-1 ) +return ; +if ((parser->cs_flags &RADEON_CS_USE_VM ) ==0 ) +return ; + +list_for_each_entry (lobj, &parser->validated, tv.head) { +struct radeon_bo_va *bo_va; +struct radeon_bo *rbo = lobj->bo; + + bo_va =radeon_bo_va (rbo, vm); +radeon_fence_unref (&bo_va->fence); + bo_va->fence =radeon_fence_ref (fence); + } +} +/** * cs_parser_fini() - clean parser states * @parser: parser structure holding parsing context.
@@ -306,11 +328,14 @@ static void radeon_cs_parser_fini(struct {unsigned i; -if (!error) +if (!error) { +/* fence all bo va before ttm_eu_fence_buffer_objects so bo are still reserved */ +radeon_bo_vm_fence_va (parser, parser->ib.fence);ttm_eu_fence_buffer_objects (&parser->validated, parser->ib.fence); -else + }else {ttm_eu_backoff_reservation (&parser->validated); + }if (parser->relocs !=NULL ) {for (i =0 ; i < parser->nrelocs; i++) {
@@ -407,7 +432,6 @@ static int radeon_cs_ib_vm_chunk(structif (parser->chunk_ib_idx ==-1 )return 0 ; -if ((parser->cs_flags &RADEON_CS_USE_VM ) ==0 )return 0 ;
drivers/gpu/drm/radeon/radeon_gart.c +22 -2
@@ -564,7 +564,7 @@ int radeon_vm_bo_update_pte(struct radeoreturn -EINVAL ; } -if (bo_va->valid) +if (bo_va->valid && mem)return 0 ; ngpu_pages =radeon_bo_ngpu_pages (bo);
@@ -597,11 +597,27 @@ int radeon_vm_bo_rmv(struct radeon_devic struct radeon_bo *bo) {struct radeon_bo_va *bo_va; +int r; bo_va =radeon_bo_va (bo, vm);if (bo_va ==NULL )return 0 ; +/* wait for va use to end */ +while (bo_va->fence) { + r =radeon_fence_wait (bo_va->fence, false); +if (r) { +DRM_ERROR ("error while waiting for fence: %d\n" , r); + } +if (r == -EDEADLK ) { + r =radeon_gpu_reset (rdev); +if (!r) +continue ; + } +break ; + } +radeon_fence_unref (&bo_va->fence); +radeon_mutex_lock (&rdev->cs_mutex);mutex_lock (&vm->mutex);radeon_vm_bo_update_pte (rdev, vm, bo,NULL );
@@ -661,12 +677,15 @@ void radeon_vm_fini(struct radeon_deviceradeon_vm_unbind_locked (rdev, vm);radeon_mutex_unlock (&rdev->cs_mutex); -/* remove all bo */ +/* remove all bo at this point non are busy any more because unbind +* waited for the last vm fence to signal +*/ r =radeon_bo_reserve (rdev->ring_tmp_bo.bo, false);if (!r) { bo_va =radeon_bo_va (rdev->ring_tmp_bo.bo, vm);list_del_init (&bo_va->bo_list);list_del_init (&bo_va->vm_list); +radeon_fence_unref (&bo_va->fence);radeon_bo_unreserve (rdev->ring_tmp_bo.bo);kfree (bo_va); }
@@ -678,6 +697,7 @@ void radeon_vm_fini(struct radeon_device r =radeon_bo_reserve (bo_va->bo, false);if (!r) {list_del_init (&bo_va->bo_list); +radeon_fence_unref (&bo_va->fence);radeon_bo_unreserve (bo_va->bo);kfree (bo_va); }
drivers/gpu/drm/radeon/radeon_gem.c +2 -11
@@ -134,25 +134,16 @@ void radeon_gem_object_close(struct drm_struct radeon_device *rdev = rbo->rdev;struct radeon_fpriv *fpriv = file_priv->driver_priv;struct radeon_vm *vm = &fpriv->vm; -struct radeon_bo_va *bo_va, *tmp;if (rdev->family <CHIP_CAYMAN ) {return ; }if (radeon_bo_reserve (rbo, false)) { +dev_err (rdev->dev,"leaking bo va because we fail to reserve bo\n" );return ; } -list_for_each_entry_safe (bo_va, tmp, &rbo->va, bo_list) { -if (bo_va->vm == vm) { -/* remove from this vm address space */ -mutex_lock (&vm->mutex); -list_del (&bo_va->vm_list); -mutex_unlock (&vm->mutex); -list_del (&bo_va->bo_list); -kfree (bo_va); - } - } +radeon_vm_bo_rmv (rdev, vm, rbo);radeon_bo_unreserve (rbo); }
drivers/gpu/drm/radeon/radeon_object.c +1 -5
@@ -52,11 +52,7 @@ void radeon_bo_clear_va(struct radeon_bolist_for_each_entry_safe (bo_va, tmp, &bo->va, bo_list) {/* remove from all vm address space */ -mutex_lock (&bo_va->vm->mutex); -list_del (&bo_va->vm_list); -mutex_unlock (&bo_va->vm->mutex); -list_del (&bo_va->bo_list); -kfree (bo_va); +radeon_vm_bo_rmv (bo->rdev, bo_va->vm, bo); } }
Greg Kroah-Hartman
maintainerPATCH 184/262 drm/radeon: split ATRM support out from the ATPX handler (v3)
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
commit c61e2775873f603148e8e998a938721b7d222d24 upstream.
There are systems that use ATRM, but not ATPX.
Fixes:
https://bugs.freedesktop.org/show_bug.cgi?id=41265
V2: fix #ifdefs as per Greg's comments
V3: fix it harder
--- drivers/gpu/drm/radeon/radeon.h | 15 ----- drivers/gpu/drm/radeon/radeon_atpx_handler.c | 56 ------------------ drivers/gpu/drm/radeon/radeon_bios.c | 80 +++++++++++++++++++++++++-- 3 files changed, 77 insertions(+), 74 deletions(-)
drivers/gpu/drm/radeon/radeon.h +0 -15
@@ -143,21 +143,6 @@ struct radeon_device;/* * BIOS. */ -#define ATRM_BIOS_PAGE 4096 - -#if defined(CONFIG_VGA_SWITCHEROO ) -bool radeon_atrm_supported (struct pci_dev *pdev); -int radeon_atrm_get_bios_chunk (uint8_t *bios,int offset,int len); -#else -static inline bool radeon_atrm_supported (struct pci_dev *pdev) -{ -return false; -} - -static inline int radeon_atrm_get_bios_chunk (uint8_t *bios,int offset,int len){ -return -EINVAL ; -} -#endif bool radeon_get_bios (struct radeon_device *rdev);
drivers/gpu/drm/radeon/radeon_atpx_handler.c +1 -55
78 lines not on this page · raw message
drivers/gpu/drm/radeon/radeon_bios.c +76 -4
107 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 185/262 drm/radeon: implement ACPI VFCT vbios fetch (v3)
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Lamparter <[email protected]>
commit 268ba0a99f89a84dc5eb312470896113d0709c74 upstream.
This is required for pure UEFI systems. The vbios is stored in ACPI rather than at the legacy vga location.
Fixes:
https://bugs.freedesktop.org/show_bug.cgi?id=26891
V2: fix #ifdefs as per Greg's comments
V3: fix it harder
--- drivers/gpu/drm/radeon/radeon_bios.c | 60 +++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+)
drivers/gpu/drm/radeon/radeon_bios.c +60 -0
@@ -32,6 +32,7 @@#include <linux/vga_switcheroo.h> #include <linux/slab.h> +#include <linux/acpi.h> /* * BIOS. */
@@ -548,6 +549,63 @@ static bool radeon_read_disabled_bios(streturn legacy_read_disabled_bios (rdev); } +#ifdef CONFIG_ACPI +static bool radeon_acpi_vfct_bios (struct radeon_device *rdev) +{ +bool ret = false; +struct acpi_table_header *hdr; +/* acpi_get_table_with_size is not exported :( */ +acpi_size tbl_size =0x7fffffff ; +UEFI_ACPI_VFCT *vfct; +GOP_VBIOS_CONTENT *vbios; +VFCT_IMAGE_HEADER *vhdr; + +if (!ACPI_SUCCESS (acpi_get_table ("VFCT" ,1 , &hdr))) +return false; +if (tbl_size <sizeof (UEFI_ACPI_VFCT )) { +DRM_ERROR ("ACPI VFCT table present but broken (too short #1)\n" ); + goto out_unmap; + } + + vfct = (UEFI_ACPI_VFCT *)hdr; +if (vfct->VBIOSImageOffset +sizeof (VFCT_IMAGE_HEADER ) > tbl_size) { +DRM_ERROR ("ACPI VFCT table present but broken (too short #2)\n" ); + goto out_unmap; + } + + vbios = (GOP_VBIOS_CONTENT *)((char *)hdr + vfct->VBIOSImageOffset); + vhdr = &vbios->VbiosHeader; +DRM_INFO ("ACPI VFCT contains a BIOS for %02x:%02x.%d %04x:%04x, size %d\n" , + vhdr->PCIBus, vhdr->PCIDevice, vhdr->PCIFunction, + vhdr->VendorID, vhdr->DeviceID, vhdr->ImageLength); + +if (vhdr->PCIBus != rdev->pdev->bus->number || + vhdr->PCIDevice !=PCI_SLOT (rdev->pdev->devfn) || + vhdr->PCIFunction !=PCI_FUNC (rdev->pdev->devfn) || + vhdr->VendorID != rdev->pdev->vendor || + vhdr->DeviceID != rdev->pdev->device) { +DRM_INFO ("ACPI VFCT table is not for this card\n" ); + goto out_unmap; + }; + +if (vfct->VBIOSImageOffset +sizeof (VFCT_IMAGE_HEADER ) + vhdr->ImageLength > tbl_size) { +DRM_ERROR ("ACPI VFCT image truncated\n" ); + goto out_unmap; + } + + rdev->bios =kmemdup (&vbios->VbiosContent, vhdr->ImageLength,GFP_KERNEL ); + ret = !!rdev->bios; + +out_unmap: +/* uh, no idea what to do here... */ +return ret; +} +#else +static inline bool radeon_acpi_vfct_bios (struct radeon_device *rdev) +{ +return false; +} +#endif bool radeon_get_bios (struct radeon_device *rdev) {
@@ -556,6 +614,8 @@ bool radeon_get_bios(struct radeon_devic r =radeon_atrm_get_bios (rdev);if (r == false) + r =radeon_acpi_vfct_bios (rdev); +if (r == false) r =igp_read_bios_from_vram (rdev);if (r == false) r =radeon_read_bios (rdev);
Greg Kroah-Hartman
maintainerPATCH 186/262 drm/radeon/kms: extend the Fujitsu D3003-S2 board connector quirk to cover later silicon stepping
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tvrtko Ursulin <[email protected]>
commit 52e9b39d9a89ae33662596bd30e62dd56bddbe73 upstream.
There is a more recent APU stepping with a new PCI ID shipping in the same board by Fujitsu which needs the same quirk to correctly mark the back plane connectors.
--- drivers/gpu/drm/radeon/radeon_atombios.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/radeon/radeon_atombios.c +1 -1
@@ -452,7 +452,7 @@ static bool radeon_atom_apply_quirks(str }/* Fujitsu D3003-S2 board lists DVI-I as DVI-D and VGA */ -if ((dev->pdev->device ==0x9802 ) && +if (((dev->pdev->device ==0x9802 ) || (dev->pdev->device ==0x9806 )) && (dev->pdev->subsystem_vendor ==0x1734 ) && (dev->pdev->subsystem_device ==0x11bd )) {if (*connector_type ==DRM_MODE_CONNECTOR_VGA ) {
Greg Kroah-Hartman
maintainerPATCH 187/262 drm/radeon: init lockup timeout on ring init
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christian König <[email protected]>
commit 48c0ac9911839daf188e4a0b6b132ac31050a241 upstream.
Reset the lockup timeout on ring (re-)initialisation.
Otherwise we get error messages like this on gpu resets:
[ 1559.949177] radeon 0000:01:00.0: GPU lockup CP stall for more than 1482270msec
--- drivers/gpu/drm/radeon/radeon_ring.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/radeon/radeon_ring.c +1 -0
@@ -394,6 +394,7 @@ int radeon_ring_init(struct radeon_devicif (radeon_debugfs_ring_init (rdev, ring)) {DRM_ERROR ("Failed to register debugfs file for rings !\n" ); } +radeon_ring_lockup_update (ring);return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 188/262 drm/i915: extract connector update from intel_ddc_get_modes() for reuse
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jani Nikula <[email protected]>
commit 4eab81366465aedcfd26de960c595bc03599c09f upstream.
Refactor the connector update part of intel_ddc_get_modes() into a separate intel_connector_update_modes() function for reuse. No functional changes.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=45881
--- drivers/gpu/drm/i915/intel_drv.h | 2 ++ drivers/gpu/drm/i915/intel_modes.c | 31 ++++++++++++++++++++++--------- 2 files changed, 24 insertions(+), 9 deletions(-)
drivers/gpu/drm/i915/intel_drv.h +2 -0
@@ -334,6 +334,8 @@ struct intel_fbc_work {int interval; }; +int intel_connector_update_modes (struct drm_connector *connector, +struct edid *edid);int intel_ddc_get_modes (struct drm_connector *c,struct i2c_adapter *adapter);extern bool intel_ddc_probe (struct intel_encoder *intel_encoder,int ddc_bus);
drivers/gpu/drm/i915/intel_modes.c +22 -9
@@ -61,6 +61,25 @@ bool intel_ddc_probe(struct intel_encode }/** +* intel_connector_update_modes - update connector from edid +* @connector: DRM connector device to use +* @edid: previously read EDID information +*/ +int intel_connector_update_modes (struct drm_connector *connector, +struct edid *edid) +{ +int ret; + +drm_mode_connector_update_edid_property (connector, edid); + ret =drm_add_edid_modes (connector, edid); +drm_edid_to_eld (connector, edid); + connector->display_info.raw_edid =NULL ; +kfree (edid); + +return ret; +} + +/** * intel_ddc_get_modes - get modelist from monitor * @connector: DRM connector device to use * @adapter: i2c adapter
@@ -71,18 +90,12 @@ int intel_ddc_get_modes(struct drm_conne struct i2c_adapter *adapter) {struct edid *edid; -int ret =0 ; edid =drm_get_edid (connector, adapter); -if (edid) { -drm_mode_connector_update_edid_property (connector, edid); - ret =drm_add_edid_modes (connector, edid); -drm_edid_to_eld (connector, edid); - connector->display_info.raw_edid =NULL ; -kfree (edid); - } +if (!edid) +return 0 ; -return ret; +return intel_connector_update_modes (connector, edid); }static const struct drm_prop_enum_list force_audio_names[] = {
Greg Kroah-Hartman
maintainerPATCH 189/262 drm/i915: fall back to bit-banging if GMBUS fails in CRT EDID reads
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jani Nikula <[email protected]>
commit f1a2f5b7c5f0941d23eef0a095c0b99bf8d051e6 upstream.
GMBUS was enabled over bit-banging as the default in commits:
commit c3dfefa0a6d235bd465309e12f4c56ea16e71111
Author: Daniel Vetter <[email protected]> Date: Tue Feb 14 22:37:25 2012 +0100
drm/i915: reenable gmbus on gen3+ again
and
commit 0fb3f969c8683505fb7323c06bf8a999a5a45a15
Author: Daniel Vetter <[email protected]> Date: Fri Mar 2 19:38:30 2012 +0100
drm/i915: enable gmbus on gen2
Unfortunately, GMBUS seems to fail on some CRT displays. Add a bit-banging fallback to CRT EDID reads.
LKML-Reference: <[email protected]>
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=45881
--- drivers/gpu/drm/i915/intel_crt.c | 36 +++++++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_crt.c +33 -3
@@ -284,6 +284,36 @@ static bool intel_crt_detect_hotplug(strreturn ret; } +static struct edid *intel_crt_get_edid (struct drm_connector *connector, +struct i2c_adapter *i2c) +{ +struct edid *edid; + + edid =drm_get_edid (connector, i2c); + +if (!edid && !intel_gmbus_is_forced_bit (i2c)) { +DRM_DEBUG_KMS ("CRT GMBUS EDID read failed, retry using GPIO bit-banging\n" ); +intel_gmbus_force_bit (i2c, true); + edid =drm_get_edid (connector, i2c); +intel_gmbus_force_bit (i2c, false); + } + +return edid; +} + +/* local version of intel_ddc_get_modes() to use intel_crt_get_edid() */ +static int intel_crt_ddc_get_modes (struct drm_connector *connector, +struct i2c_adapter *adapter) +{ +struct edid *edid; + + edid =intel_crt_get_edid (connector, adapter); +if (!edid) +return 0 ; + +return intel_connector_update_modes (connector, edid); +} +static bool intel_crt_detect_ddc (struct drm_connector *connector) {struct intel_crt *crt =intel_attached_crt (connector);
@@ -299,7 +329,7 @@ static bool intel_crt_detect_ddc(structstruct i2c_adapter *i2c; i2c =intel_gmbus_get_adapter (dev_priv, dev_priv->crt_ddc_pin); - edid =drm_get_edid (connector, i2c); + edid =intel_crt_get_edid (connector, i2c);/* * This may be a DVI-I connector with a shared DDC * link between analog and digital outputs, so we
@@ -498,13 +528,13 @@ static int intel_crt_get_modes(struct drstruct i2c_adapter *i2c; i2c =intel_gmbus_get_adapter (dev_priv, dev_priv->crt_ddc_pin); - ret =intel_ddc_get_modes (connector, i2c); + ret =intel_crt_ddc_get_modes (connector, i2c);if (ret || !IS_G4X (dev))return ret;/* Try to probe digital port for output in DVI-I -> VGA mode. */ i2c =intel_gmbus_get_adapter (dev_priv,GMBUS_PORT_DPB ); -return intel_ddc_get_modes (connector, i2c); +return intel_crt_ddc_get_modes (connector, i2c); } static int intel_crt_set_property(struct drm_connector *connector,
Greg Kroah-Hartman
maintainerPATCH 190/262 drm/i915: use hsw rps tuning values everywhere on gen6+
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Vetter <[email protected]>
commit 1ee9ae3244c4789f3184c5123f3b2d7e405b3f4c upstream.
James Bottomley reported [1] a massive power regression, due to the enabling of semaphores by default in 3.5. A workaround for him is to again disable semaphores. And indeed, his system has a very hard time to enter rc6 with semaphores enabled.
Ben Widawsky run around with a kill-a-watt a lot and noticed:
- There are indeed a few rare systems that seem to have a hard time entering rc6 when desktop-idle.
- One machine, The Indestructible Toshiba regressed in this behaviour between 3.5 and 3.6 in a merge commit! So rc6 behaviour with the current setting seems to be highly timing dependent and not robust at all.
- The behaviour James reported wrt semaphores seems to be a freak timing thing that only happens on his specific machine, confirming that enabling semaphores shouldn't reduce rc6 residency.
Now furthermore the Google ChromeOS guys reported [2] a while ago that at least on some machines a simply a blinking cursor can keep the gpu turbo at the highest frequency. This is because the current rps limits used on snb/ivb are highly asymmetric.
On the theory that gpu turbo and rc6 tuning values are related, we've tried whether the much saner looking (since much less asymmetric) rps tuning values used for hsw would also help entering rc6 more robustly.
And it seems to mostly work, and we don't really have the resources to through-roughly tune things in any better way: The values from the ChromeOS ppl seem to fare a bit worse for James' machine, so I guess we better stick with something vpg (the gpu hw/windows group) provided, hoping that they've done their jobs.
Reference[1]: http://lists.freedesktop.org/archives/dri-devel/2012-July/025675.html
Reference[2]: http://lists.freedesktop.org/archives/intel-gfx/2012-July/018692.html
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=53393
--- drivers/gpu/drm/i915/intel_pm.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/intel_pm.c +4 -4
@@ -2431,10 +2431,10 @@ void gen6_enable_rps(struct drm_i915_priI915_WRITE (GEN6_RP_INTERRUPT_LIMITS , dev_priv->max_delay <<24 | dev_priv->min_delay <<16 ); -I915_WRITE (GEN6_RP_UP_THRESHOLD ,10000 ); -I915_WRITE (GEN6_RP_DOWN_THRESHOLD ,1000000 ); -I915_WRITE (GEN6_RP_UP_EI ,100000 ); -I915_WRITE (GEN6_RP_DOWN_EI ,5000000 ); +I915_WRITE (GEN6_RP_UP_THRESHOLD ,59400 ); +I915_WRITE (GEN6_RP_DOWN_THRESHOLD ,245000 ); +I915_WRITE (GEN6_RP_UP_EI ,66000 ); +I915_WRITE (GEN6_RP_DOWN_EI ,350000 );I915_WRITE (GEN6_RP_IDLE_HYSTERSIS ,10 ); I915_WRITE(GEN6_RP_CONTROL, GEN6_RP_MEDIA_TURBO |
Greg Kroah-Hartman
maintainerPATCH 191/262 asus-laptop: HRWS/HWRS typo
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Corentin Chary <[email protected]>
commit 8871e99f89b7d7b1ea99de550eea2a56273f42ab upstream.
Resolves-bug: https://bugzilla.kernel.org/show_bug.cgi?id=24222
--- drivers/platform/x86/asus-laptop.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/platform/x86/asus-laptop.c +4 -4
@@ -863,9 +863,9 @@ static ssize_t show_infos(struct device* The significance of others is yet to be found. * If we don't find the method, we assume the device are present. */ - rv =acpi_evaluate_integer (asus->handle,"HRWS" ,NULL , &temp); + rv =acpi_evaluate_integer (asus->handle,"HWRS" ,NULL , &temp);if (!ACPI_FAILURE (rv)) - len +=sprintf (page + len,"HRWS value : %#x\n" , + len +=sprintf (page + len,"HWRS value : %#x\n" , (uint ) temp);/* * Another value for userspace: the ASYM method returns 0x02 for
@@ -1751,9 +1751,9 @@ static int asus_laptop_get_info(struct a* The significance of others is yet to be found. */ status = -acpi_evaluate_integer (asus->handle,"HRWS" ,NULL , &hwrs_result); +acpi_evaluate_integer (asus->handle,"HWRS" ,NULL , &hwrs_result);if (!ACPI_FAILURE (status)) -pr_notice (" HRWS returned %x" , (int )hwrs_result); +pr_notice (" HWRS returned %x" , (int )hwrs_result);if (!acpi_check_handle (asus->handle,METHOD_WL_STATUS ,NULL )) asus->have_rsts = true;
Greg Kroah-Hartman
maintainerPATCH 192/262 drm: Add EDID_QUIRK_FORCE_REDUCED_BLANKING for ASUS VW222S
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paul Menzel <[email protected]>
commit 6f33814bd4d9cfe76033a31b1c0c76c960cd8e4b upstream.
Connecting an ASUS VW222S [1] over VGA a garbled screen is shown with vertical stripes in the top half.
In commit bc42aabc [2]
commit bc42aabc6a01b92b0f961d65671564e0e1cd7592
Author: Adam Jackson <[email protected]>
Date: Wed May 23 16:26:54 2012 -0400
drm/edid/quirks: ViewSonic VA2026w
Adam Jackson added the quirk EDID_QUIRK_FORCE_REDUCED_BLANKING which is also needed for this ASUS monitor.
All log files and output from xrandr is included in the referenced Bugzilla report #17629.
Please note that this monitor only has a VGA (D-Sub) connector [1].
[1] http://www.asus.com/Display/LCD_Monitors/VW222S/
[2] http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=commit;h=bc42aabc6a01b92b0f961d65671564e0e1cd7592
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=17629
--- drivers/gpu/drm/drm_edid.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/drm_edid.c +3 -0
@@ -87,6 +87,9 @@ static struct edid_quirk {int product_id;u32 quirks; } edid_quirk_list[] = { +/* ASUS VW222S */ + { "ACI", 0x22a2, EDID_QUIRK_FORCE_REDUCED_BLANKING }, +/* Acer AL1706 */ { "ACR", 44358, EDID_QUIRK_PREFER_LARGE_60 },/* Acer F51 */
Greg Kroah-Hartman
maintainerPATCH 193/262 asus-nb-wmi: add some video toggle keys
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: AceLan Kao <[email protected]>
commit 3766054fff4af1b58a1440a284907887f4d2e8be upstream.
There are some new video switch keys that used by newer machines. 0xA0 - SDSP HDMI only0xA1 - SDSP LCD + HDMI0xA2 - SDSP CRT + HDMI0xA3 - SDSP TV + HDMI
But in Linux, there is no suitable userspace application to handle this, so, mapping them all to KEY_SWITCHVIDEOMODE.
--- drivers/platform/x86/asus-nb-wmi.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/platform/x86/asus-nb-wmi.c +4 -0
@@ -94,6 +94,10 @@ static const struct key_entry asus_nb_wm { KE_KEY, 0x8A, { KEY_PROG1 } }, { KE_KEY, 0x95, { KEY_MEDIA } }, { KE_KEY, 0x99, { KEY_PHONE } }, + { KE_KEY, 0xA0, { KEY_SWITCHVIDEOMODE } }, /* SDSP HDMI only */ + { KE_KEY, 0xA1, { KEY_SWITCHVIDEOMODE } }, /* SDSP LCD + HDMI */ + { KE_KEY, 0xA2, { KEY_SWITCHVIDEOMODE } }, /* SDSP CRT + HDMI */ + { KE_KEY, 0xA3, { KEY_SWITCHVIDEOMODE } }, /* SDSP TV + HDMI */ { KE_KEY, 0xb5, { KEY_CALC } }, { KE_KEY, 0xc4, { KEY_KBDILLUMUP } }, { KE_KEY, 0xc5, { KEY_KBDILLUMDOWN } },
Greg Kroah-Hartman
maintainerPATCH 194/262 drm: Check for invalid cursor flags
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jakob Bornecrantz <[email protected]>
commit 7c4eaca4162d0b5ad4fb39f974d7ffd71b9daa09 upstream.
--- drivers/gpu/drm/drm_crtc.c | 2 +- include/drm/drm_mode.h | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-)
drivers/gpu/drm/drm_crtc.c +1 -1
@@ -1981,7 +1981,7 @@ int drm_mode_cursor_ioctl(struct drm_devif (!drm_core_check_feature (dev,DRIVER_MODESET ))return -EINVAL ; -if (!req->flags) +if (!req->flags || (~DRM_MODE_CURSOR_FLAGS & req->flags))return -EINVAL ;mutex_lock (&dev->mode_config.mutex);
include/drm/drm_mode.h +3 -2
@@ -359,8 +359,9 @@ struct drm_mode_mode_cmd {struct drm_mode_modeinfo mode; }; -#define DRM_MODE_CURSOR_BO (1<<0) -#define DRM_MODE_CURSOR_MOVE (1<<1) +#define DRM_MODE_CURSOR_BO 0x01 +#define DRM_MODE_CURSOR_MOVE 0x02 +#define DRM_MODE_CURSOR_FLAGS 0x03/* * depending on the value in flags different members are used.
Greg Kroah-Hartman
maintainerPATCH 195/262 drm/nvc0/copy: check PUNITS to determine which copy engines are disabled
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ben Skeggs <[email protected]>
commit 14f0458a41e033dee31ba605137419385c03fc78 upstream.
On some Fermi chipsets (NVCE particularly) PCOPY1 doesn't exist. And if what I've seen on Kepler is true of Fermi too, chipsets of the same type can have different PCOPY units available.
This should fix a v3.5 regression reported by a number of people effecting suspend/resume on NVC8/NVCE chipsets.
--- drivers/gpu/drm/nouveau/nouveau_state.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/nouveau/nouveau_state.c +4 -2
@@ -737,9 +737,11 @@ nouveau_card_init(struct drm_device *dev }break ;case NV_C0 : -nvc0_copy_create (dev,1 ); +if (!(nv_rd32 (dev,0x022500 ) &0x00000200 )) +nvc0_copy_create (dev,1 );case NV_D0 : -nvc0_copy_create (dev,0 ); +if (!(nv_rd32 (dev,0x022500 ) &0x00000100 )) +nvc0_copy_create (dev,0 );break ;default :break ;
Greg Kroah-Hartman
maintainerPATCH 196/262 drm/radeon/atom: rework DIG modesetting on DCE3+
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
commit 8d1af57ae3c4458ed0de93ef97f388dd1b3239c7 upstream.
The ordering is important and the current drm code wasn't cutting it for modern DIG encoders. We need to have information about crtc before setting up the encoders so I've shifted the ordering a bit. Probably we'll need a full rework akin to danvet's recent intel patchs. This patch fixes numerous issues with DP bridge chips and makes link training much more reliable.
--- drivers/gpu/drm/radeon/atombios_encoders.c | 109 ++++++++++++----------------- 1 file changed, 47 insertions(+), 62 deletions(-)
drivers/gpu/drm/radeon/atombios_encoders.c +47 -62
@@ -1379,6 +1379,8 @@ radeon_atom_encoder_dpms_dig(struct drm_struct drm_device *dev = encoder->dev;struct radeon_device *rdev = dev->dev_private;struct radeon_encoder *radeon_encoder =to_radeon_encoder (encoder); +struct drm_encoder *ext_encoder =radeon_get_external_encoder (encoder); +struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv;struct drm_connector *connector =radeon_get_connector_for_encoder (encoder);struct radeon_connector *radeon_connector =NULL ;struct radeon_connector_atom_dig *radeon_dig_connector =NULL ;
@@ -1390,19 +1392,37 @@ radeon_atom_encoder_dpms_dig(struct drm_switch (mode) {case DRM_MODE_DPMS_ON : -/* some early dce3.2 boards have a bug in their transmitter control table */ -if ((rdev->family ==CHIP_RV710 ) || (rdev->family ==CHIP_RV730 ) || -ASIC_IS_DCE41 (rdev) ||ASIC_IS_DCE5 (rdev)) { -if (ASIC_IS_DCE6 (rdev)) { -/* It seems we need to call ATOM_ENCODER_CMD_SETUP again -* before reenabling encoder on DPMS ON, otherwise we never -* get picture -*/ -atombios_dig_encoder_setup (encoder,ATOM_ENCODER_CMD_SETUP ,0 ); +if (ASIC_IS_DCE41 (rdev) ||ASIC_IS_DCE5 (rdev)) { +if (!connector) + dig->panel_mode =DP_PANEL_MODE_EXTERNAL_DP_MODE ; +else + dig->panel_mode =radeon_dp_get_panel_mode (encoder, connector); + +/* setup and enable the encoder */ +atombios_dig_encoder_setup (encoder,ATOM_ENCODER_CMD_SETUP ,0 ); +atombios_dig_encoder_setup (encoder, +ATOM_ENCODER_CMD_SETUP_PANEL_MODE , + dig->panel_mode); +if (ext_encoder) { +if (ASIC_IS_DCE41 (rdev) ||ASIC_IS_DCE61 (rdev)) +atombios_external_encoder_setup (encoder, ext_encoder, +EXTERNAL_ENCODER_ACTION_V3_ENCODER_SETUP ); }atombios_dig_transmitter_setup (encoder,ATOM_TRANSMITTER_ACTION_ENABLE ,0 ,0 ); - }else { + }else if (ASIC_IS_DCE4 (rdev)) { +/* setup and enable the encoder */ +atombios_dig_encoder_setup (encoder,ATOM_ENCODER_CMD_SETUP ,0 ); +/* enable the transmitter */ +atombios_dig_transmitter_setup (encoder,ATOM_TRANSMITTER_ACTION_ENABLE ,0 ,0 );atombios_dig_transmitter_setup (encoder,ATOM_TRANSMITTER_ACTION_ENABLE_OUTPUT ,0 ,0 ); + }else { +/* setup and enable the encoder and transmitter */ +atombios_dig_encoder_setup (encoder,ATOM_ENABLE ,0 ); +atombios_dig_transmitter_setup (encoder,ATOM_TRANSMITTER_ACTION_SETUP ,0 ,0 ); +atombios_dig_transmitter_setup (encoder,ATOM_TRANSMITTER_ACTION_ENABLE ,0 ,0 ); +/* some early dce3.2 boards have a bug in their transmitter control table */ +if ((rdev->family !=CHIP_RV710 ) || (rdev->family !=CHIP_RV730 )) +atombios_dig_transmitter_setup (encoder,ATOM_TRANSMITTER_ACTION_ENABLE_OUTPUT ,0 ,0 ); }if (ENCODER_MODE_IS_DP (atombios_get_encoder_mode (encoder)) && connector) {if (connector->connector_type == DRM_MODE_CONNECTOR_eDP) {
@@ -1420,10 +1440,19 @@ radeon_atom_encoder_dpms_dig(struct drm_case DRM_MODE_DPMS_STANDBY :case DRM_MODE_DPMS_SUSPEND :case DRM_MODE_DPMS_OFF : -if (ASIC_IS_DCE41 (rdev) ||ASIC_IS_DCE5 (rdev)) +if (ASIC_IS_DCE41 (rdev) ||ASIC_IS_DCE5 (rdev)) { +/* disable the transmitter */ atombios_dig_transmitter_setup (encoder,ATOM_TRANSMITTER_ACTION_DISABLE ,0 ,0 ); -else + }else if (ASIC_IS_DCE4 (rdev)) { +/* disable the transmitter */ +atombios_dig_transmitter_setup (encoder,ATOM_TRANSMITTER_ACTION_DISABLE_OUTPUT ,0 ,0 ); +atombios_dig_transmitter_setup (encoder,ATOM_TRANSMITTER_ACTION_DISABLE ,0 ,0 ); + }else { +/* disable the encoder and transmitter */ atombios_dig_transmitter_setup (encoder,ATOM_TRANSMITTER_ACTION_DISABLE_OUTPUT ,0 ,0 ); +atombios_dig_transmitter_setup (encoder,ATOM_TRANSMITTER_ACTION_DISABLE ,0 ,0 ); +atombios_dig_encoder_setup (encoder,ATOM_DISABLE ,0 ); + }if (ENCODER_MODE_IS_DP (atombios_get_encoder_mode (encoder)) && connector) {if (ASIC_IS_DCE4 (rdev))atombios_dig_encoder_setup (encoder,ATOM_ENCODER_CMD_DP_VIDEO_OFF ,0 );
@@ -1848,10 +1877,12 @@ radeon_atom_encoder_mode_set(struct drm_struct drm_device *dev = encoder->dev;struct radeon_device *rdev = dev->dev_private;struct radeon_encoder *radeon_encoder =to_radeon_encoder (encoder); -struct drm_encoder *ext_encoder =radeon_get_external_encoder (encoder); radeon_encoder->pixel_clock = adjusted_mode->clock; +/* need to call this here rather than in prepare() since we need some crtc info */ +radeon_atom_encoder_dpms (encoder,DRM_MODE_DPMS_OFF ); +if (ASIC_IS_AVIVO (rdev) && !ASIC_IS_DCE4 (rdev)) {if (radeon_encoder->active_device & (ATOM_DEVICE_CV_SUPPORT |ATOM_DEVICE_TV_SUPPORT ))atombios_yuv_setup (encoder, true);
@@ -1870,38 +1901,7 @@ radeon_atom_encoder_mode_set(struct drm_case ENCODER_OBJECT_ID_INTERNAL_UNIPHY1 :case ENCODER_OBJECT_ID_INTERNAL_UNIPHY2 :case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_LVTMA : -if (ASIC_IS_DCE41 (rdev) ||ASIC_IS_DCE5 (rdev)) { -struct drm_connector *connector =radeon_get_connector_for_encoder (encoder); -struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv; - -if (!connector) - dig->panel_mode =DP_PANEL_MODE_EXTERNAL_DP_MODE ; -else - dig->panel_mode =radeon_dp_get_panel_mode (encoder, connector); - -/* setup and enable the encoder */ -atombios_dig_encoder_setup (encoder,ATOM_ENCODER_CMD_SETUP ,0 ); -atombios_dig_encoder_setup (encoder, -ATOM_ENCODER_CMD_SETUP_PANEL_MODE , - dig->panel_mode); - }else if (ASIC_IS_DCE4 (rdev)) { -/* disable the transmitter */ -atombios_dig_transmitter_setup (encoder,ATOM_TRANSMITTER_ACTION_DISABLE ,0 ,0 ); -/* setup and enable the encoder */ -atombios_dig_encoder_setup (encoder,ATOM_ENCODER_CMD_SETUP ,0 ); - -/* enable the transmitter */ -atombios_dig_transmitter_setup (encoder,ATOM_TRANSMITTER_ACTION_ENABLE ,0 ,0 ); - }else { -/* disable the encoder and transmitter */ -atombios_dig_transmitter_setup (encoder,ATOM_TRANSMITTER_ACTION_DISABLE ,0 ,0 ); -atombios_dig_encoder_setup (encoder,ATOM_DISABLE ,0 ); - -/* setup and enable the encoder and transmitter */ -atombios_dig_encoder_setup (encoder,ATOM_ENABLE ,0 ); -atombios_dig_transmitter_setup (encoder,ATOM_TRANSMITTER_ACTION_SETUP ,0 ,0 ); -atombios_dig_transmitter_setup (encoder,ATOM_TRANSMITTER_ACTION_ENABLE ,0 ,0 ); - } +/* handled in dpms */ break ;case ENCODER_OBJECT_ID_INTERNAL_DDI :case ENCODER_OBJECT_ID_INTERNAL_DVO1 :
@@ -1922,14 +1922,6 @@ radeon_atom_encoder_mode_set(struct drm_break ; } -if (ext_encoder) { -if (ASIC_IS_DCE41 (rdev) ||ASIC_IS_DCE61 (rdev)) -atombios_external_encoder_setup (encoder, ext_encoder, -EXTERNAL_ENCODER_ACTION_V3_ENCODER_SETUP ); -else -atombios_external_encoder_setup (encoder, ext_encoder,ATOM_ENABLE ); - } -atombios_apply_encoder_quirks (encoder, adjusted_mode);if (atombios_get_encoder_mode (encoder) ==ATOM_ENCODER_MODE_HDMI ) {
@@ -2116,7 +2108,6 @@ static void radeon_atom_encoder_prepare( }radeon_atom_output_lock (encoder, true); -radeon_atom_encoder_dpms (encoder,DRM_MODE_DPMS_OFF );if (connector) {struct radeon_connector *radeon_connector =to_radeon_connector (connector);
@@ -2137,6 +2128,7 @@ static void radeon_atom_encoder_prepare(static void radeon_atom_encoder_commit (struct drm_encoder *encoder) { +/* need to call this here as we need the crtc set up */ radeon_atom_encoder_dpms (encoder,DRM_MODE_DPMS_ON );radeon_atom_output_lock (encoder, false); }
@@ -2177,14 +2169,7 @@ static void radeon_atom_encoder_disable(case ENCODER_OBJECT_ID_INTERNAL_UNIPHY1 :case ENCODER_OBJECT_ID_INTERNAL_UNIPHY2 :case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_LVTMA : -if (ASIC_IS_DCE4 (rdev)) -/* disable the transmitter */ -atombios_dig_transmitter_setup (encoder,ATOM_TRANSMITTER_ACTION_DISABLE ,0 ,0 ); -else { -/* disable the encoder and transmitter */ -atombios_dig_transmitter_setup (encoder,ATOM_TRANSMITTER_ACTION_DISABLE ,0 ,0 ); -atombios_dig_encoder_setup (encoder,ATOM_DISABLE ,0 ); - } +/* handled in dpms */ break ;case ENCODER_OBJECT_ID_INTERNAL_DDI :case ENCODER_OBJECT_ID_INTERNAL_DVO1 :
Greg Kroah-Hartman
maintainerPATCH 197/262 drm/radeon/atom: powergating fixes for DCE6
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
commit c205b232a64fed6d26edd7e40985b396de99a27f upstream.
Power gating is per crtc pair, but the powergating registers should be called individually. The hw handles power up/down properly. The pair is powered up if either crtc in the pair is powered up and the pair is not powered down until both crtcs in the pair are powered down. This simplifies programming and should save additional power as the previous code never actually power gated the crtc pair.
--- drivers/gpu/drm/radeon/atombios_crtc.c | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-)
drivers/gpu/drm/radeon/atombios_crtc.c +2 -20
@@ -258,7 +258,6 @@ void atombios_crtc_dpms(struct drm_crtc radeon_crtc->enabled = true;/* adjust pm to dpms changes BEFORE enabling crtcs */ radeon_pm_compute_clocks (rdev); -/* disable crtc pair power gating before programming */ if (ASIC_IS_DCE6 (rdev) && !radeon_crtc->in_mode_set)atombios_powergate_crtc (crtc,ATOM_DISABLE );atombios_enable_crtc (crtc,ATOM_ENABLE );
@@ -278,25 +277,8 @@ void atombios_crtc_dpms(struct drm_crtcatombios_enable_crtc_memreq (crtc,ATOM_DISABLE );atombios_enable_crtc (crtc,ATOM_DISABLE ); radeon_crtc->enabled = false; -/* power gating is per-pair */ -if (ASIC_IS_DCE6 (rdev) && !radeon_crtc->in_mode_set) { -struct drm_crtc *other_crtc; -struct radeon_crtc *other_radeon_crtc; -list_for_each_entry (other_crtc, &rdev->ddev->mode_config.crtc_list, head) { - other_radeon_crtc =to_radeon_crtc (other_crtc); -if (((radeon_crtc->crtc_id ==0 ) && (other_radeon_crtc->crtc_id ==1 )) || - ((radeon_crtc->crtc_id ==1 ) && (other_radeon_crtc->crtc_id ==0 )) || - ((radeon_crtc->crtc_id ==2 ) && (other_radeon_crtc->crtc_id ==3 )) || - ((radeon_crtc->crtc_id ==3 ) && (other_radeon_crtc->crtc_id ==2 )) || - ((radeon_crtc->crtc_id ==4 ) && (other_radeon_crtc->crtc_id ==5 )) || - ((radeon_crtc->crtc_id ==5 ) && (other_radeon_crtc->crtc_id ==4 ))) { -/* if both crtcs in the pair are off, enable power gating */ -if (other_radeon_crtc->enabled == false) -atombios_powergate_crtc (crtc,ATOM_ENABLE ); -break ; - } - } - } +if (ASIC_IS_DCE6 (rdev) && !radeon_crtc->in_mode_set) +atombios_powergate_crtc (crtc,ATOM_ENABLE );/* adjust pm to dpms changes AFTER disabling crtcs */ radeon_pm_compute_clocks (rdev);break ;
Greg Kroah-Hartman
maintainerPATCH 198/262 drm/i915: fix wrong order of parameters in port checking functions
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Xu, Anhua" <[email protected]>
commit b70ad586162609141f0aa9eb34790f31a8954f89 upstream.
Wrong order of parameters passed-in when calling hdmi/adpa /lvds_pipe_enabled(), 2nd and 3rd parameters are reversed.
This bug was indroduced by
commit 1519b9956eb4b4180fa3f47c73341463cdcfaa37
Author: Keith Packard <[email protected]> Date: Sat Aug 6 10:35:34 2011 -0700
drm/i915: Fix PCH port pipe select in CPT disable paths
The reachable tag for this commit is v3.1-rc1-3-g1519b99
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=44876
--- drivers/gpu/drm/i915/intel_display.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/intel_display.c +6 -6
@@ -1238,7 +1238,7 @@ static void assert_pch_hdmi_disabled(str enum pipe pipe, int reg) {u32 val =I915_READ (reg); -WARN (hdmi_pipe_enabled (dev_priv, val, pipe), +WARN (hdmi_pipe_enabled (dev_priv, pipe, val),"PCH HDMI (0x%08x) enabled on transcoder %c, should be disabled\n" , reg,pipe_name (pipe)); }
@@ -1255,13 +1255,13 @@ static void assert_pch_ports_disabled(st reg =PCH_ADPA ; val =I915_READ (reg); -WARN (adpa_pipe_enabled (dev_priv, val, pipe), +WARN (adpa_pipe_enabled (dev_priv, pipe, val),"PCH VGA enabled on transcoder %c, should be disabled\n" ,pipe_name (pipe)); reg =PCH_LVDS ; val =I915_READ (reg); -WARN (lvds_pipe_enabled (dev_priv, val, pipe), +WARN (lvds_pipe_enabled (dev_priv, pipe, val),"PCH LVDS enabled on transcoder %c, should be disabled\n" ,pipe_name (pipe));
@@ -1723,7 +1723,7 @@ static void disable_pch_hdmi(struct drm_ enum pipe pipe, int reg) {u32 val =I915_READ (reg); -if (hdmi_pipe_enabled (dev_priv, val, pipe)) { +if (hdmi_pipe_enabled (dev_priv, pipe, val)) {DRM_DEBUG_KMS ("Disabling pch HDMI %x on pipe %d\n" , reg, pipe);I915_WRITE (reg, val & ~PORT_ENABLE );
@@ -1745,12 +1745,12 @@ static void intel_disable_pch_ports(stru reg =PCH_ADPA ; val =I915_READ (reg); -if (adpa_pipe_enabled (dev_priv, val, pipe)) +if (adpa_pipe_enabled (dev_priv, pipe, val))I915_WRITE (reg, val & ~ADPA_DAC_ENABLE ); reg =PCH_LVDS ; val =I915_READ (reg); -if (lvds_pipe_enabled (dev_priv, val, pipe)) { +if (lvds_pipe_enabled (dev_priv, pipe, val)) {DRM_DEBUG_KMS ("disable lvds on pipe %d val 0x%08x\n" , pipe, val);I915_WRITE (reg, val & ~LVDS_PORT_EN );POSTING_READ (reg);
Greg Kroah-Hartman
maintainerPATCH 199/262 drm/radeon: convert radeon vfct code to use acpi_get_table_with_size
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
commit 7c3906d04a4587dceaa78cc1ae6b14e6454ee02a upstream.
Allows us to verify the table size.
--- drivers/gpu/drm/radeon/radeon_bios.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/gpu/drm/radeon/radeon_bios.c +2 -4
@@ -554,13 +554,12 @@ static bool radeon_acpi_vfct_bios(struct {bool ret = false;struct acpi_table_header *hdr; -/* acpi_get_table_with_size is not exported :( */ -acpi_size tbl_size =0x7fffffff ; +acpi_size tbl_size;UEFI_ACPI_VFCT *vfct;GOP_VBIOS_CONTENT *vbios;VFCT_IMAGE_HEADER *vhdr; -if (!ACPI_SUCCESS (acpi_get_table ("VFCT" ,1 , &hdr))) +if (!ACPI_SUCCESS (acpi_get_table_with_size ("VFCT" ,1 , &hdr, &tbl_size)))return false;if (tbl_size <sizeof (UEFI_ACPI_VFCT )) {DRM_ERROR ("ACPI VFCT table present but broken (too short #1)\n" );
@@ -597,7 +596,6 @@ static bool radeon_acpi_vfct_bios(struct ret = !!rdev->bios; out_unmap: -/* uh, no idea what to do here... */ return ret; }#else
Greg Kroah-Hartman
maintainerPATCH 200/262 drm/radeon: dont disable plls that are in use by other crtcs
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
commit 4e58591c8961b3e31709313f75819f2eec06e322 upstream.
Some plls are shared for DP.
--- drivers/gpu/drm/radeon/atombios_crtc.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
drivers/gpu/drm/radeon/atombios_crtc.c +14 -0
@@ -1668,9 +1668,22 @@ static void atombios_crtc_disable(structstruct drm_device *dev = crtc->dev;struct radeon_device *rdev = dev->dev_private;struct radeon_atom_ss ss; +int i;atombios_crtc_dpms (crtc,DRM_MODE_DPMS_OFF ); +for (i =0 ; i < rdev->num_crtc; i++) { +if (rdev->mode_info.crtcs[i] && + rdev->mode_info.crtcs[i]->enabled && + i != radeon_crtc->crtc_id && + radeon_crtc->pll_id == rdev->mode_info.crtcs[i]->pll_id) { +/* one other crtc is using this pll don't turn +* off the pll +*/ + goto done; + } + } +switch (radeon_crtc->pll_id) {case ATOM_PPLL1 :case ATOM_PPLL2 :
@@ -1687,6 +1700,7 @@ static void atombios_crtc_disable(structdefault :break ; } +done: radeon_crtc->pll_id =-1 ; }
Greg Kroah-Hartman
maintainerPATCH 201/262 drm/radeon: force dma32 to fix regression rs4xx,rs6xx,rs740
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jerome Glisse <[email protected]>
commit 4a2b6662c3632176b4fdf012243dd3751367bf1f upstream.
It seems some of those IGP dislike non dma32 page despite what documentation says. Fix regression since we allowed non dma32 pages. It seems it only affect some revision of those IGP chips as we don't know which one just force dma32 for all of them.
https://bugzilla.redhat.com/show_bug.cgi?id=785375
--- drivers/gpu/drm/radeon/radeon_device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/radeon/radeon_device.c +1 -1
@@ -774,7 +774,7 @@ int radeon_device_init(struct radeon_devif (rdev->flags &RADEON_IS_AGP ) rdev->need_dma32 = true;if ((rdev->flags &RADEON_IS_PCI ) && - (rdev->family <CHIP_RS400 )) + (rdev->family <=CHIP_RS740 )) rdev->need_dma32 = true; dma_bits = rdev->need_dma32 ?32 :40 ;
Greg Kroah-Hartman
maintainerPATCH 202/262 drm/radeon: fix dig encoder selection on DCE61
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
commit 41fa54377057ab38bc3e08ebb46168a7daf2e63b upstream.
Was using the DCE41 code which was wrong. Fixes
blank displays on a number of Trinity systems.
--- drivers/gpu/drm/radeon/atombios_encoders.c | 31 ++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-)
drivers/gpu/drm/radeon/atombios_encoders.c +26 -5
@@ -1769,13 +1769,34 @@ static int radeon_atom_pick_dig_encoder(struct radeon_crtc *radeon_crtc =to_radeon_crtc (encoder->crtc);struct radeon_encoder *radeon_encoder =to_radeon_encoder (encoder);struct drm_encoder *test_encoder; -struct radeon_encoder_atom_dig *dig; +struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv;uint32_t dig_enc_in_use =0 ; -/* DCE4/5 */ -if (ASIC_IS_DCE4 (rdev)) { - dig = radeon_encoder->enc_priv; -if (ASIC_IS_DCE41 (rdev)) { +if (ASIC_IS_DCE6 (rdev)) { +/* DCE6 */ +switch (radeon_encoder->encoder_id) { +case ENCODER_OBJECT_ID_INTERNAL_UNIPHY : +if (dig->linkb) +return 1 ; +else +return 0 ; +break ; +case ENCODER_OBJECT_ID_INTERNAL_UNIPHY1 : +if (dig->linkb) +return 3 ; +else +return 2 ; +break ; +case ENCODER_OBJECT_ID_INTERNAL_UNIPHY2 : +if (dig->linkb) +return 5 ; +else +return 4 ; +break ; + } + }else if (ASIC_IS_DCE4 (rdev)) { +/* DCE4/5 */ +if (ASIC_IS_DCE41 (rdev) && !ASIC_IS_DCE61 (rdev)) {/* ontario follows DCE4 */ if (rdev->family ==CHIP_PALM ) {if (dig->linkb)
Greg Kroah-Hartman
maintainerPATCH 203/262 drm/radeon: make 64bit fences more robust v3
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christian König <[email protected]>
commit f492c171a38d77fc13a8998a0721f2da50835224 upstream.
Only increase the higher 32bits if we really detect a wrap around.
v2: instead of increasing the higher 32bits just use the higher
32bits from the last emitted fence.
v3: also use last emitted fence value as upper limit.
The intention of this patch is to make fences as robust as they where before introducing 64bit fences. This is necessary because on older systems it looks like the fence value gets corrupted on initialization.
Fixes:
https://bugs.freedesktop.org/show_bug.cgi?id=51344
Should also fix:
https://bugs.freedesktop.org/show_bug.cgi?id=54129
https://bugs.freedesktop.org/show_bug.cgi?id=54662
https://bugzilla.redhat.com/show_bug.cgi?id=846505
https://bugzilla.redhat.com/show_bug.cgi?id=845639
3.5 needs a separate patch due to changes in the fence code. Will send that out separately.
--- drivers/gpu/drm/radeon/radeon_fence.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/gpu/drm/radeon/radeon_fence.c +5 -3
@@ -75,7 +75,7 @@ int radeon_fence_emit(struct radeon_devivoid radeon_fence_process (struct radeon_device *rdev,int ring) { -uint64_t seq, last_seq; +uint64_t seq, last_seq, last_emitted;unsigned count_loop =0 ;bool wake = false;
@@ -102,13 +102,15 @@ void radeon_fence_process(struct radeon_*/ last_seq =atomic64_read (&rdev->fence_drv[ring].last_seq); do { + last_emitted = rdev->fence_drv[ring].seq; seq = radeon_fence_read(rdev, ring); seq |= last_seq & 0xffffffff00000000LL; if (seq < last_seq) { - seq += 0x100000000LL; + seq &= 0xffffffff; + seq |= last_emitted & 0xffffffff00000000LL; } - if (seq == last_seq) { + if (seq <= last_seq || seq > last_emitted) { break; } /* If we loop over we don't want to return without
Greg Kroah-Hartman
maintainerPATCH 204/262 drm/nouveau: fix booting with plymouth + dumb support
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Airlie <[email protected]>
commit 610bd7da160f76f1644ecb4cd7f39511b49a22cc upstream.
We noticed a plymouth bug on Fedora 18, and I then noticed this stupid thinko, fixing it fixed the problem with plymouth.
--- drivers/gpu/drm/nouveau/nouveau_display.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nouveau_display.c +1 -1
@@ -598,7 +598,7 @@ nouveau_display_dumb_create(struct drm_f args->size = args->pitch * args->height; args->size =roundup (args->size,PAGE_SIZE ); - ret =nouveau_gem_new (dev, args->size,0 ,TTM_PL_FLAG_VRAM ,0 ,0 , &bo); + ret =nouveau_gem_new (dev, args->size,0 ,NOUVEAU_GEM_DOMAIN_VRAM ,0 ,0 , &bo);if (ret)return ret;
Greg Kroah-Hartman
maintainerPATCH 205/262 drm/i915: set the right gen3 flip_done mode also at resume
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Vetter <[email protected]>
commit 974a3b0f9f05b748fe11f1afc31efc32aa5160cb upstream.
Currently we've only frobbed this bit at irq_init time, but did not restore it at resume time. Move it to the gen3 clock gating function to fix this.
Notice while reading through code.
--- drivers/gpu/drm/i915/i915_irq.c | 3 --- drivers/gpu/drm/i915/intel_pm.c | 3 +++ 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +0 -3
@@ -2626,9 +2626,6 @@ void intel_irq_init(struct drm_device *d dev->driver->irq_handler = i8xx_irq_handler; dev->driver->irq_uninstall = i8xx_irq_uninstall; }else if (INTEL_INFO (dev)->gen ==3 ) { -/* IIR "flip pending" means done if this bit is set */ -I915_WRITE (ECOSKPD ,_MASKED_BIT_DISABLE (ECO_FLIP_DONE )); - dev->driver->irq_preinstall = i915_irq_preinstall; dev->driver->irq_postinstall = i915_irq_postinstall; dev->driver->irq_uninstall = i915_irq_uninstall;
drivers/gpu/drm/i915/intel_pm.c +3 -0
@@ -3528,6 +3528,9 @@ static void gen3_init_clock_gating(strucif (IS_PINEVIEW (dev))I915_WRITE (ECOSKPD ,_MASKED_BIT_ENABLE (ECO_GATING_CX_ONLY )); + +/* IIR "flip pending" means done if this bit is set */ +I915_WRITE (ECOSKPD ,_MASKED_BIT_DISABLE (ECO_FLIP_DONE )); }static void i85x_init_clock_gating (struct drm_device *dev)
Greg Kroah-Hartman
maintainerPATCH 206/262 drm/i915: enable lvds pin pairs before dpll on gen2
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Vetter <[email protected]>
commit 5b5896e4e1f353ef3dbc4e4e9ee44d53ccf105d7 upstream.
Otherwise things migt not work too well.
Breakage introduced in
commit eb1cbe4848b01f9f073064377875bc7d71eb401b
Author: Daniel Vetter <[email protected]> Date: Wed Mar 28 23:12:16 2012 +0200
drm/i915: split PLL update code out of i9xx_crtc_mode_set
--- drivers/gpu/drm/i915/intel_display.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/intel_display.c +6 -6
@@ -3926,12 +3926,6 @@ static void i8xx_update_pll(struct drm_cPOSTING_READ (DPLL (pipe));udelay (150 ); -I915_WRITE (DPLL (pipe), dpll); - -/* Wait for the clocks to stabilize. */ -POSTING_READ (DPLL (pipe)); -udelay (150 ); -/* The LVDS pin pair needs to be on before the DPLLs are enabled. * This is an exception to the general rule that mode_set doesn't turn * things on.
@@ -3939,6 +3933,12 @@ static void i8xx_update_pll(struct drm_cif (intel_pipe_has_type (crtc,INTEL_OUTPUT_LVDS ))intel_update_lvds (crtc, clock, adjusted_mode); +I915_WRITE (DPLL (pipe), dpll); + +/* Wait for the clocks to stabilize. */ +POSTING_READ (DPLL (pipe)); +udelay (150 ); +/* The pixel multiplier can only be updated once the * DPLL is enabled and the clocks are stable. *
Greg Kroah-Hartman
maintainerPATCH 207/262 drm/i915: HDMI - Clear Audio Enable bit for Hot Plug
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wang Xingchao <[email protected]>
commit b98b60167279df3acac9422c3c9820d9ebbcf9fb upstream.
Clear Audio Enable bit to trigger unsolicated event to notify Audio Driver part the HDMI hot plug change. The patch fixed the bug when remove HDMI cable the bit was not cleared correctly.
In intel_hdmi_dpms(), if intel_hdmi->has_audio been true, the "Audio enable bit" will be set to trigger unsolicated event to notify Alsa driver the change.
intel_hdmi->has_audio will be reset to false from intel_hdmi_detect() after remove the hdmi cable, here's debug log:
[ 187.494153] [drm:output_poll_execute], [CONNECTOR:17:HDMI-A-1] status updated from 1 to 2 [ 187.525349] [drm:intel_hdmi_detect], HDMI: has_audio = 0
so when comes back to intel_hdmi_dpms(), the "Audio enable bit" will not be cleared. And this cause the eld infomation and pin presence doesnot update accordingly in alsa driver side.
This patch will also trigger unsolicated event to alsa driver to notify the hot plug event:
[ 187.853159] ALSA sound/pci/hda/patch_hdmi.c:772 HDMI hot plug event: Codec=3 Pin=5 Presence_Detect=0 ELD_Valid=1 [ 187.853268] ALSA sound/pci/hda/patch_hdmi.c:990 HDMI status: Codec=3 Pin=5 Presence_Detect=0 ELD_Valid=0
--- drivers/gpu/drm/i915/intel_hdmi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_hdmi.c +1 -1
@@ -400,7 +400,7 @@ static void intel_hdmi_dpms(struct drm_eu32 temp;u32 enable_bits =SDVO_ENABLE ; -if (intel_hdmi->has_audio) +if (intel_hdmi->has_audio || mode !=DRM_MODE_DPMS_ON ) enable_bits |=SDVO_AUDIO_ENABLE ; temp =I915_READ (intel_hdmi->sdvox_reg);
Greg Kroah-Hartman
maintainerPATCH 208/262 drm/i915: Reduce a pin-leak BUG into a WARN
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chris Wilson <[email protected]>
commit 7e81a42e341a4f15d76624b7c02ffb21b085b56f upstream.
Pin-leaks persist and we get the perennial bug reports of machine lockups to the BUG_ON(pin_count==MAX). If we instead loudly report that the object cannot be pinned at that time it should prevent the driver from locking up, and hopefully restore a semblance of working whilst still leaving us a OOPS to debug.
--- drivers/gpu/drm/i915/i915_gem.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_gem.c +2 -1
@@ -3044,7 +3044,8 @@ i915_gem_object_pin(struct drm_i915_gem_ {int ret; -BUG_ON (obj->pin_count ==DRM_I915_GEM_OBJECT_MAX_PIN_COUNT ); +if (WARN_ON (obj->pin_count ==DRM_I915_GEM_OBJECT_MAX_PIN_COUNT )) +return -EBUSY ;if (obj->gtt_space !=NULL ) { if ((alignment && obj->gtt_offset & (alignment - 1)) ||
Greg Kroah-Hartman
maintainerPATCH 209/262 drm/nv86/fifo: suspend fix
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maxim Levitsky <[email protected]>
commit 2064db725cc6d4ea19a24c138bc37939b63e3ae6 upstream.
This fix is a backport from the reworked nouveau driver. It masks off the engines we're not expecting to use before attempting a channel kickoff.
--- drivers/gpu/drm/nouveau/nv84_fifo.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/gpu/drm/nouveau/nv84_fifo.c +9 -0
@@ -117,17 +117,22 @@ nv84_fifo_context_del(struct nouveau_chastruct drm_device *dev = chan->dev;struct drm_nouveau_private *dev_priv = dev->dev_private;unsigned long flags; +u32 save;/* remove channel from playlist, will context switch if active */ spin_lock_irqsave (&dev_priv->context_switch_lock, flags);nv_mask (dev,0x002600 + (chan->id *4 ),0x80000000 ,0x00000000 );nv50_fifo_playlist_update (dev); + save =nv_mask (dev,0x002520 ,0x0000003f ,0x15 ); +/* tell any engines on this channel to unload their contexts */ nv_wr32 (dev,0x0032fc , chan->ramin->vinst >>12 );if (!nv_wait_ne (dev,0x0032fc ,0xffffffff ,0xffffffff ))NV_INFO (dev,"PFIFO: channel %d unload timeout\n" , chan->id); +nv_wr32 (dev,0x002520 , save); +nv_wr32 (dev,0x002600 + (chan->id *4 ),0x00000000 );spin_unlock_irqrestore (&dev_priv->context_switch_lock, flags);
@@ -184,10 +189,13 @@ nv84_fifo_fini(struct drm_device *dev, istruct drm_nouveau_private *dev_priv = dev->dev_private;struct nv84_fifo_priv *priv =nv_engine (dev, engine);int i; +u32 save;/* set playlist length to zero, fifo will unload context */ nv_wr32 (dev,0x0032ec ,0 ); + save =nv_mask (dev,0x002520 ,0x0000003f ,0x15 ); +/* tell all connected engines to unload their contexts */ for (i =0 ; i < priv->base.channels; i++) {struct nouveau_channel *chan = dev_priv->channels.ptr[i];
@@ -199,6 +207,7 @@ nv84_fifo_fini(struct drm_device *dev, i } } +nv_wr32 (dev,0x002520 , save);nv_wr32 (dev,0x002140 ,0 );return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 210/262 iwlwifi: dont double free the interrupt in failure path
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Emmanuel Grumbach <[email protected]>
commit a7be50b7e30f9d77cb059a7ffdb781bb0fb92eba upstream.
When the driver can't get the HW ready, we would release the interrupt twice which made the kernel complain loudly.
--- drivers/net/wireless/iwlwifi/iwl-trans-pcie.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/iwlwifi/iwl-trans-pcie.c +1 -0
@@ -1437,6 +1437,7 @@ static int iwl_trans_pcie_start_hw(strucreturn err; err_free_irq: + trans_pcie->irq_requested = false;free_irq (trans_pcie->irq, trans); error:iwl_free_isr_ict (trans);
Greg Kroah-Hartman
maintainerPATCH 211/262 iwlwifi: protect SRAM debugfs
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johannes Berg <[email protected]>
commit 4fc79db178f0a0ede479b4713e00df2d106028b3 upstream.
If the device is not started, we can't read its SRAM and attempting to do so will cause issues. Protect the debugfs read.
--- drivers/net/wireless/iwlwifi/iwl-debugfs.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/wireless/iwlwifi/iwl-debugfs.c +3 -0
@@ -128,6 +128,9 @@ static ssize_t iwl_dbgfs_sram_read(strucconst struct fw_img *img;size_t bufsz; +if (!iwl_is_ready_rf (priv)) +return -EAGAIN ; +/* default is to dump the entire data segment */ if (!priv->dbgfs_sram_offset && !priv->dbgfs_sram_len) { priv->dbgfs_sram_offset =0x800000 ;
Greg Kroah-Hartman
maintainerPATCH 212/262 iwlwifi: fix flow handler debug code
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johannes Berg <[email protected]>
commit 94543a8d4fb302817014981489f15cb3b92ec3c2 upstream.
iwl_dbgfs_fh_reg_read() can cause crashes and/orBUG_ON in slub because the ifdefs are wrong, the
code in iwl_dump_fh() should use DEBUGFS, not
DEBUG to protect the buffer writing code.
Also, while at it, clean up the arguments to the
function, some code and make it generally safer.
--- drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h | 2 - drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c | 2 - drivers/net/wireless/iwlwifi/iwl-trans-pcie.c | 30 +++++++++++----------- 3 files changed, 18 insertions(+), 16 deletions(-)
drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h +1 -1
@@ -355,7 +355,7 @@ int iwl_queue_space(const struct iwl_que/***************************************************** * Error handling ******************************************************/ -int iwl_dump_fh (struct iwl_trans *trans,char **buf,bool display); +int iwl_dump_fh (struct iwl_trans *trans,char **buf);void iwl_dump_csr (struct iwl_trans *trans);/*****************************************************
drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c +1 -1
@@ -559,7 +559,7 @@ static void iwl_irq_handle_error(struct }iwl_dump_csr (trans); -iwl_dump_fh (trans,NULL , false); +iwl_dump_fh (trans,NULL );iwl_op_mode_nic_error (trans->op_mode); }
drivers/net/wireless/iwlwifi/iwl-trans-pcie.c +16 -14
@@ -1655,13 +1655,9 @@ static const char *get_fh_string(int cmd#undef IWL_CMD } -int iwl_dump_fh (struct iwl_trans *trans,char **buf,bool display) +int iwl_dump_fh (struct iwl_trans *trans,char **buf) {int i; -#ifdef CONFIG_IWLWIFI_DEBUG -int pos =0 ; -size_t bufsz =0 ; -#endif static const u32 fh_tbl[] = {FH_RSCSR_CHNL0_STTS_WPTR_REG ,FH_RSCSR_CHNL0_RBDCB_BASE_REG ,
@@ -1673,29 +1669,35 @@ int iwl_dump_fh(struct iwl_trans *trans,FH_TSSR_TX_STATUS_REG ,FH_TSSR_TX_ERROR_REG }; -#ifdef CONFIG_IWLWIFI_DEBUG -if (display) { - bufsz =ARRAY_SIZE (fh_tbl) *48 +40 ; + +#ifdef CONFIG_IWLWIFI_DEBUGFS +if (buf) { +int pos =0 ; +size_t bufsz =ARRAY_SIZE (fh_tbl) *48 +40 ; + *buf =kmalloc (bufsz,GFP_KERNEL );if (!*buf)return -ENOMEM ; + pos +=scnprintf (*buf + pos, bufsz - pos,"FH register values:\n" ); -for (i =0 ; i <ARRAY_SIZE (fh_tbl); i++) { + +for (i =0 ; i <ARRAY_SIZE (fh_tbl); i++) pos +=scnprintf (*buf + pos, bufsz - pos," %34s: 0X%08x\n" ,get_fh_string (fh_tbl[i]),iwl_read_direct32 (trans, fh_tbl[i])); - } +return pos; }#endif +IWL_ERR (trans,"FH register values:\n" ); -for (i =0 ; i <ARRAY_SIZE (fh_tbl); i++) { +for (i =0 ; i <ARRAY_SIZE (fh_tbl); i++)IWL_ERR (trans," %34s: 0X%08x\n" ,get_fh_string (fh_tbl[i]),iwl_read_direct32 (trans, fh_tbl[i])); - } +return 0 ; }
@@ -1990,11 +1992,11 @@ static ssize_t iwl_dbgfs_fh_reg_read(str size_t count, loff_t *ppos) { struct iwl_trans *trans = file->private_data; -char *buf; +char *buf =NULL ;int pos =0 ;ssize_t ret = -EFAULT ; - ret = pos =iwl_dump_fh (trans, &buf, true); + ret = pos =iwl_dump_fh (trans, &buf);if (buf) { ret =simple_read_from_buffer (user_buf, count, ppos, buf, pos);
Greg Kroah-Hartman
maintainerPATCH 213/262 gianfar: fix phc index build failure
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Richard Cochran <[email protected]>
commit 28889b7e7818342f6c254e27b9b2c68702ab867a upstream.
This patch fixes a build failure introduced in commit 66636287 ("gianfar: Support the get_ts_info ethtool method."). Not only was a global variable inconsistently named, but also it was not exported as it should have been.
This fix is also needed in stable version 3.5.
--- drivers/net/ethernet/freescale/gianfar_ethtool.c | 1 + drivers/net/ethernet/freescale/gianfar_ptp.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-)
drivers/net/ethernet/freescale/gianfar_ethtool.c +1 -0
@@ -1741,6 +1741,7 @@ static int gfar_get_nfc(struct net_devic }int gfar_phc_index =-1 ; +EXPORT_SYMBOL (gfar_phc_index);static int gfar_get_ts_info (struct net_device *dev,struct ethtool_ts_info *info)
drivers/net/ethernet/freescale/gianfar_ptp.c +2 -2
@@ -515,7 +515,7 @@ static int gianfar_ptp_probe(struct plat err =PTR_ERR (etsects->clock); goto no_clock; } - gfar_phc_clock =ptp_clock_index (etsects->clock); + gfar_phc_index =ptp_clock_index (etsects->clock);dev_set_drvdata (&dev->dev, etsects);
@@ -539,7 +539,7 @@ static int gianfar_ptp_remove(struct plagfar_write (&etsects->regs->tmr_temask,0 );gfar_write (&etsects->regs->tmr_ctrl,0 ); - gfar_phc_clock =-1 ; + gfar_phc_index =-1 ;ptp_clock_unregister (etsects->clock);iounmap (etsects->regs);release_resource (etsects->rsrc);
Greg Kroah-Hartman
maintainerPATCH 214/262 workqueue: UNBOUND -> REBIND morphing in rebind_workers() should be atomic
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lai Jiangshan <[email protected]>
commit 96e65306b81351b656835c15931d1d237b252f27 upstream.
The compiler may compile the following code into TWO write/modify instructions.
worker->flags &= ~WORKER_UNBOUND; worker->flags |= WORKER_REBIND;
so the other CPU may temporarily see worker->flags which doesn't have either WORKER_UNBOUND or WORKER_REBIND set and perform local wakeup prematurely.
Fix it by using single explicit assignment via ACCESS_ONCE().
Because idle workers have another WORKER_NOT_RUNNING flag, this bug doesn't exist for them; however, update it to use the same pattern for consistency.
tj: Applied the change to idle workers too and updated comments and
patch description a bit.
--- kernel/workqueue.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
kernel/workqueue.c +6 -3
@@ -3441,14 +3441,17 @@ static int __cpuinit trustee_thread(voidfor_each_busy_worker (worker, i, pos, gcwq) {struct work_struct *rebind_work = &worker->rebind_work; +unsigned long worker_flags = worker->flags;/* * Rebind_work may race with future cpu hotplug * operations. Use a separate flag to mark that -* rebinding is scheduled. +* rebinding is scheduled. The morphing should +* be atomic. */ - worker->flags |=WORKER_REBIND ; - worker->flags &= ~WORKER_ROGUE ; + worker_flags |=WORKER_REBIND ; + worker_flags &= ~WORKER_ROGUE ; +ACCESS_ONCE (worker->flags) = worker_flags;/* queue rebind_work, wq doesn't matter, use the default one */ if (test_and_set_bit(WORK_STRUCT_PENDING_BIT,
Greg Kroah-Hartman
maintainerPATCH 215/262 Input: wacom - add support to Cintiq 22HD
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ping Cheng <[email protected]>
commit d838c644fea603eb24811333c6e2cf4f9722bf10 upstream.
--- drivers/input/tablet/wacom_wac.c | 21 +++++++++++++++++++-- drivers/input/tablet/wacom_wac.h | 3 ++- 2 files changed, 21 insertions(+), 3 deletions(-)
drivers/input/tablet/wacom_wac.c +19 -2
@@ -464,7 +464,7 @@ static void wacom_intuos_general(struct t = (data[6 ] <<2 ) | ((data[7 ] >>6 ) &3 );if ((features->type >=INTUOS4S && features->type <=INTUOS4L ) || (features->type >=INTUOS5S && features->type <=INTUOS5L ) || - features->type ==WACOM_21UX2 || features->type ==WACOM_24HD ) { + (features->type >=WACOM_21UX2 && features->type <=WACOM_24HD )) { t = (t <<1 ) | (data[1 ] &1 ); }input_report_abs (input,ABS_PRESSURE , t);
@@ -614,7 +614,7 @@ static int wacom_intuos_irq(struct wacominput_report_abs (input,ABS_MISC ,0 ); } }else { -if (features->type ==WACOM_21UX2 ) { +if (features->type ==WACOM_21UX2 || features->type ==WACOM_22HD ) {input_report_key (input,BTN_0 , (data[5 ] &0x01 ));input_report_key (input,BTN_1 , (data[6 ] &0x01 ));input_report_key (input,BTN_2 , (data[6 ] &0x02 ));
@@ -633,6 +633,12 @@ static int wacom_intuos_irq(struct wacominput_report_key (input,BTN_Z , (data[8 ] &0x20 ));input_report_key (input,BTN_BASE , (data[8 ] &0x40 ));input_report_key (input,BTN_BASE2 , (data[8 ] &0x80 )); + +if (features->type ==WACOM_22HD ) { +input_report_key (input,KEY_PROG1 , data[9 ] &0x01 ); +input_report_key (input,KEY_PROG2 , data[9 ] &0x02 ); +input_report_key (input,KEY_PROG3 , data[9 ] &0x04 ); + } }else {input_report_key (input,BTN_0 , (data[5 ] &0x01 ));input_report_key (input,BTN_1 , (data[5 ] &0x02 ));
@@ -1230,6 +1236,7 @@ void wacom_wac_irq(struct wacom_wac *waccase CINTIQ :case WACOM_BEE :case WACOM_21UX2 : +case WACOM_22HD :case WACOM_24HD : sync =wacom_intuos_irq (wacom_wac);break ;
@@ -1432,6 +1439,12 @@ int wacom_setup_input_capabilities(strucwacom_setup_cintiq (wacom_wac);break ; +case WACOM_22HD : +__set_bit (KEY_PROG1 , input_dev->keybit); +__set_bit (KEY_PROG2 , input_dev->keybit); +__set_bit (KEY_PROG3 , input_dev->keybit); +/* fall through */ +case WACOM_21UX2 :__set_bit (BTN_A , input_dev->keybit);__set_bit (BTN_B , input_dev->keybit);
@@ -1855,6 +1868,9 @@ static const struct wacom_features wacomstatic const struct wacom_features wacom_features_0xCC = {"Wacom Cintiq 21UX2" ,WACOM_PKGLEN_INTUOS ,87200 ,65600 ,2047 ,63 ,WACOM_21UX2 ,WACOM_INTUOS3_RES ,WACOM_INTUOS3_RES }; +static const struct wacom_features wacom_features_0xFA = + {"Wacom Cintiq 22HD" ,WACOM_PKGLEN_INTUOS ,95840 ,54260 ,2047 , +63 ,WACOM_22HD ,WACOM_INTUOS3_RES ,WACOM_INTUOS3_RES };static const struct wacom_features wacom_features_0x90 = {"Wacom ISDv4 90" ,WACOM_PKGLEN_GRAPHIRE ,26202 ,16325 ,255 ,0 ,TABLETPC ,WACOM_INTUOS_RES ,WACOM_INTUOS_RES };
@@ -2064,6 +2080,7 @@ const struct usb_device_id wacom_ids[] = { USB_DEVICE_WACOM(0xEC) }, { USB_DEVICE_WACOM(0x47) }, { USB_DEVICE_WACOM(0xF4) }, + { USB_DEVICE_WACOM(0xFA) }, { USB_DEVICE_LENOVO(0x6004) }, { } };
drivers/input/tablet/wacom_wac.h +2 -1
@@ -74,8 +74,9 @@ enum {INTUOS5S ,INTUOS5 ,INTUOS5L , -WACOM_24HD ,WACOM_21UX2 , +WACOM_22HD , +WACOM_24HD ,CINTIQ ,WACOM_BEE , WACOM_MO,
Greg Kroah-Hartman
maintainerPATCH 216/262 Input: wacom - rearrange type enum
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ping Cheng <[email protected]>
commit ea2e60244573a9204c8cee9b4fb181106784c617 upstream.
So we can simplify a few type related if statements
Also fixes https://bugzilla.kernel.org/show_bug.cgi?id=46821
--- drivers/input/tablet/wacom_sys.c | 10 +++------- drivers/input/tablet/wacom_wac.c | 6 ++---- drivers/input/tablet/wacom_wac.h | 6 +++--- 3 files changed, 8 insertions(+), 14 deletions(-)
drivers/input/tablet/wacom_sys.c +3 -7
@@ -445,8 +445,7 @@ static int wacom_query_tablet_data(struc/* ask to report Wacom data */ if (features->device_type ==BTN_TOOL_FINGER ) {/* if it is an MT Tablet PC touch */ -if (features->type ==TABLETPC2FG || - features->type ==MTSCREEN ) { +if (features->type >TABLETPC ) { do { rep_data[0] = 3; rep_data[1] = 4;
@@ -465,7 +464,7 @@ static int wacom_query_tablet_data(struc }while ((error <0 || rep_data[1 ] !=4 ) && limit++ <WAC_MSG_RETRIES ); } - }else if (features->type !=TABLETPC && + }else if (features->type <=BAMBOO_PT && features->type !=WIRELESS && features->device_type ==BTN_TOOL_PEN ) { do {
@@ -515,10 +514,7 @@ static int wacom_retrieve_hid_descriptor }/* only devices that support touch need to retrieve the info */ -if (features->type !=TABLETPC && - features->type !=TABLETPC2FG && - features->type !=BAMBOO_PT && - features->type !=MTSCREEN ) { +if (features->type <BAMBOO_PT ) { goto out; }
drivers/input/tablet/wacom_wac.c +2 -4
@@ -1324,10 +1324,8 @@ void wacom_setup_device_quirks(struct wa }/* these device have multiple inputs */ -if (features->type ==TABLETPC || features->type ==TABLETPC2FG || - features->type ==BAMBOO_PT || features->type ==WIRELESS || - (features->type >=INTUOS5S && features->type <=INTUOS5L ) || - features->type ==MTSCREEN ) +if (features->type >=WIRELESS || + (features->type >=INTUOS5S && features->type <=INTUOS5L )) features->quirks |=WACOM_QUIRK_MULTI_INPUT ;/* quirk for bamboo touch with 2 low res touches */
drivers/input/tablet/wacom_wac.h +3 -3
@@ -62,8 +62,6 @@ enum {PTU ,PL ,DTU , -BAMBOO_PT , -WIRELESS ,INTUOS ,INTUOS3S , INTUOS3,
@@ -80,7 +78,9 @@ enum {CINTIQ ,WACOM_BEE ,WACOM_MO , -TABLETPC , +WIRELESS , +BAMBOO_PT , +TABLETPC ,/* add new TPC below */ TABLETPC2FG ,MTSCREEN ,MAX_TYPE
Greg Kroah-Hartman
maintainerPATCH 217/262 Bluetooth: btusb: Add vendor specific ID (0a5c:21f4) BCM20702A0
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Manoj Iyer <[email protected]>
commit 61c964ba1748e984cb232b431582815899bf10fe upstream.
Patch adds support for BCM20702A0 device id (0a5c:21f4).
usb-devices after patch was applied:
T: Bus=03 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#= 2 Spd=12 MxCh= 0
D: Ver= 2.00 Cls=ff(vend.) Sub=01 Prot=01 MxPS=64 #Cfgs= 1
P: Vendor=0a5c ProdID=21f4 Rev=01.12
S: Manufacturer=Broadcom Corp
S: Product=BCM20702A0
S: SerialNumber=E4D53DF154D6
C: #Ifs= 4 Cfg#= 1 Atr=e0 MxPwr=0mA
I: If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=01 Prot=01 Driver=btusb
I: If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=01 Driver=btusb
I: If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
I: If#= 3 Alt= 0 #EPs= 0 Cls=fe(app. ) Sub=01 Prot=01 Driver=(none)
usb-devices before patch was applied:
T: Bus=03 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#= 2 Spd=12 MxCh= 0
D: Ver= 2.00 Cls=ff(vend.) Sub=01 Prot=01 MxPS=64 #Cfgs= 1
P: Vendor=0a5c ProdID=21f4 Rev=01.12
S: Manufacturer=Broadcom Corp
S: Product=BCM20702A0
S: SerialNumber=E4D53DF154D6
C: #Ifs= 4 Cfg#= 1 Atr=e0 MxPwr=0mA
I: If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=01 Prot=01 Driver=(none)
I: If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=01 Driver=(none)
I: If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
I: If#= 3 Alt= 0 #EPs= 0 Cls=fe(app. ) Sub=01 Prot=01 Driver=(none)
--- drivers/bluetooth/btusb.c | 1 + 1 file changed, 1 insertion(+)
drivers/bluetooth/btusb.c +1 -0
@@ -106,6 +106,7 @@ static struct usb_device_id btusb_table[ { USB_DEVICE(0x0a5c, 0x21e6) }, { USB_DEVICE(0x0a5c, 0x21e8) }, { USB_DEVICE(0x0a5c, 0x21f3) }, + { USB_DEVICE(0x0a5c, 0x21f4) }, { USB_DEVICE(0x413c, 0x8197) },/* Foxconn - Hon Hai */
Greg Kroah-Hartman
maintainerPATCH 218/262 Bluetooth: add support for atheros 0489:e057
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peng Chen <[email protected]>
commit 2096ae6ca647302d50a68aa36cb66a00e7dfac70 upstream.
Add support for the AR3012 chip found on Fioxconn.
usb-devices shows:
T: Bus=06 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 44 Spd=12 MxCh= 0
D: Ver= 1.10 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs= 1
P: Vendor=0489 ProdID=e057 Rev= 0.02
C:* #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=100mA
I:* If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
E: Ad=81(I) Atr=03(Int.) MxPS= 16 Ivl=1ms
E: Ad=82(I) Atr=02(Bulk) MxPS= 64 Ivl=0ms
E: Ad=02(O) Atr=02(Bulk) MxPS= 64 Ivl=0ms
I:* If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
E: Ad=83(I) Atr=01(Isoc) MxPS= 0 Ivl=1ms
E: Ad=03(O) Atr=01(Isoc) MxPS= 0 Ivl=1ms
I: If#= 1 Alt= 1 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
E: Ad=83(I) Atr=01(Isoc) MxPS= 9 Ivl=1ms
E: Ad=03(O) Atr=01(Isoc) MxPS= 9 Ivl=1ms
I: If#= 1 Alt= 2 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
E: Ad=83(I) Atr=01(Isoc) MxPS= 17 Ivl=1ms
E: Ad=03(O) Atr=01(Isoc) MxPS= 17 Ivl=1ms
I: If#= 1 Alt= 3 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
E: Ad=83(I) Atr=01(Isoc) MxPS= 25 Ivl=1ms
E: Ad=03(O) Atr=01(Isoc) MxPS= 25 Ivl=1ms
I: If#= 1 Alt= 4 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
E: Ad=83(I) Atr=01(Isoc) MxPS= 33 Ivl=1ms
E: Ad=03(O) Atr=01(Isoc) MxPS= 33 Ivl=1ms
I: If#= 1 Alt= 5 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
E: Ad=83(I) Atr=01(Isoc) MxPS= 49 Ivl=1ms
E: Ad=03(O) Atr=01(Isoc) MxPS= 49 Ivl=1ms--- drivers/bluetooth/ath3k.c | 2 ++ drivers/bluetooth/btusb.c | 1 + 2 files changed, 3 insertions(+)
drivers/bluetooth/ath3k.c +2 -0
@@ -79,6 +79,7 @@ static struct usb_device_id ath3k_table[ { USB_DEVICE(0x13d3, 0x3362) }, { USB_DEVICE(0x0CF3, 0xE004) }, { USB_DEVICE(0x0930, 0x0219) }, + { USB_DEVICE(0x0489, 0xe057) },/* Atheros AR5BBU12 with sflash firmware */ { USB_DEVICE(0x0489, 0xE02C) },
@@ -104,6 +105,7 @@ static struct usb_device_id ath3k_blist_ { USB_DEVICE(0x13d3, 0x3362), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x0cf3, 0xe004), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x0930, 0x0219), .driver_info = BTUSB_ATH3012 }, + { USB_DEVICE(0x0489, 0xe057), .driver_info = BTUSB_ATH3012 }, /* Atheros AR5BBU22 with sflash firmware */ { USB_DEVICE(0x0489, 0xE03C), .driver_info = BTUSB_ATH3012 },
drivers/bluetooth/btusb.c +1 -0
@@ -142,6 +142,7 @@ static struct usb_device_id blacklist_ta { USB_DEVICE(0x13d3, 0x3362), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x0cf3, 0xe004), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x0930, 0x0219), .driver_info = BTUSB_ATH3012 }, + { USB_DEVICE(0x0489, 0xe057), .driver_info = BTUSB_ATH3012 }, /* Atheros AR5BBU12 with sflash firmware */ { USB_DEVICE(0x0489, 0xe02c), .driver_info = BTUSB_IGNORE },
Greg Kroah-Hartman
maintainerPATCH 219/262 Bluetooth: Add support for Sony Vaio T-Series
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yevgeniy Melnichuk <[email protected]>
commit bc21fde2d549d1cb1ebef04016eb7affa43bb5c1 upstream.
Add Sony Vaio T-Series Bluetooth Module( 0x489:0xE036) to the blacklist of btusb module and add it to the ath3k module.
output of cat /sys/kernel/debug/usb/devices
T: Bus=01 Lev=02 Prnt=02 Port=01 Cnt=01 Dev#= 5 Spd=12 MxCh= 0 D: Ver= 1.10 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs= 1 P: Vendor=0489 ProdID=e036 Rev= 0.02 S: Manufacturer=Atheros Communications S: Product=Bluetooth USB Host Controller S: SerialNumber=Alaska Day 2006 C:* #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=100mA I:* If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=81(I) Atr=03(Int.) MxPS= 16 Ivl=1ms E: Ad=82(I) Atr=02(Bulk) MxPS= 64 Ivl=0ms E: Ad=02(O) Atr=02(Bulk) MxPS= 64 Ivl=0ms I:* If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=83(I) Atr=01(Isoc) MxPS= 0 Ivl=1ms E: Ad=03(O) Atr=01(Isoc) MxPS= 0 Ivl=1ms I: If#= 1 Alt= 1 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=83(I) Atr=01(Isoc) MxPS= 9 Ivl=1ms E: Ad=03(O) Atr=01(Isoc) MxPS= 9 Ivl=1ms I: If#= 1 Alt= 2 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=83(I) Atr=01(Isoc) MxPS= 17 Ivl=1ms E: Ad=03(O) Atr=01(Isoc) MxPS= 17 Ivl=1ms I: If#= 1 Alt= 3 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=83(I) Atr=01(Isoc) MxPS= 25 Ivl=1ms E: Ad=03(O) Atr=01(Isoc) MxPS= 25 Ivl=1ms I: If#= 1 Alt= 4 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=83(I) Atr=01(Isoc) MxPS= 33 Ivl=1ms E: Ad=03(O) Atr=01(Isoc) MxPS= 33 Ivl=1ms I: If#= 1 Alt= 5 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=83(I) Atr=01(Isoc) MxPS= 49 Ivl=1ms E: Ad=03(O) Atr=01(Isoc) MxPS= 49 Ivl=1ms
--- drivers/bluetooth/ath3k.c | 2 ++ drivers/bluetooth/btusb.c | 1 + 2 files changed, 3 insertions(+)
drivers/bluetooth/ath3k.c +2 -0
@@ -86,6 +86,7 @@ static struct usb_device_id ath3k_table[/* Atheros AR5BBU22 with sflash firmware */ { USB_DEVICE(0x0489, 0xE03C) }, + { USB_DEVICE(0x0489, 0xE036) }, { } /* Terminating entry */ };
@@ -109,6 +110,7 @@ static struct usb_device_id ath3k_blist_/* Atheros AR5BBU22 with sflash firmware */ { USB_DEVICE(0x0489, 0xE03C), .driver_info = BTUSB_ATH3012 }, + { USB_DEVICE(0x0489, 0xE036), .driver_info = BTUSB_ATH3012 }, { }/* Terminating entry */ };
drivers/bluetooth/btusb.c +1 -0
@@ -149,6 +149,7 @@ static struct usb_device_id blacklist_ta/* Atheros AR5BBU12 with sflash firmware */ { USB_DEVICE(0x0489, 0xe03c), .driver_info = BTUSB_ATH3012 }, + { USB_DEVICE(0x0489, 0xe036), .driver_info = BTUSB_ATH3012 }, /* Broadcom BCM2035 */ { USB_DEVICE(0x0a5c, 0x2035), .driver_info = BTUSB_WRONG_SCO_MTU },
Greg Kroah-Hartman
maintainerPATCH 220/262 Bluetooth: Use USB_VENDOR_AND_INTERFACE() for Broadcom devices
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gustavo Padovan <[email protected]>
commit 92c385f46b30f4954e9dd2d2005c12d233b479ea upstream.
Many Broadcom devices has a vendor specific devices class, with this rule we match all existent and future controllers with this behavior.
We also remove old rules to that matches product id for Broadcom devices.
--- drivers/bluetooth/btusb.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/bluetooth/btusb.c +3 -5
@@ -102,16 +102,14 @@ static struct usb_device_id btusb_table[/* Broadcom BCM20702A0 */ { USB_DEVICE(0x0489, 0xe042) }, - { USB_DEVICE(0x0a5c, 0x21e3) }, - { USB_DEVICE(0x0a5c, 0x21e6) }, - { USB_DEVICE(0x0a5c, 0x21e8) }, - { USB_DEVICE(0x0a5c, 0x21f3) }, - { USB_DEVICE(0x0a5c, 0x21f4) }, { USB_DEVICE(0x413c, 0x8197) },/* Foxconn - Hon Hai */ { USB_DEVICE(0x0489, 0xe033) }, +/*Broadcom devices with vendor specific id */ + { USB_VENDOR_AND_INTERFACE_INFO(0x0a5c, 0xff, 0x01, 0x01) }, + { } /* Terminating entry */ };
Greg Kroah-Hartman
maintainerPATCH 221/262 Bluetooth: Add support for Apple vendor-specific devices
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Henrik Rydberg <[email protected]>
commit 1fa6535faf055cd71311ab887e94fc234f04ee18 upstream.
As pointed out by Gustavo and Marcel, all Apple-specific Broadcom devices seen so far have the same interface class, subclass and protocol numbers. This patch adds an entry which matches all of them, using the new USB_VENDOR_AND_INTERFACE_INFO() macro.
In particular, this patch adds support for the MacBook Pro Retina (05ac:8286), which is not in the present list.
--- drivers/bluetooth/btusb.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/bluetooth/btusb.c +3 -0
@@ -60,6 +60,9 @@ static struct usb_device_id btusb_table[/* Generic Bluetooth USB device */ { USB_DEVICE_INFO(0xe0, 0x01, 0x01) }, +/* Apple-specific (Broadcom) devices */ + { USB_VENDOR_AND_INTERFACE_INFO(0x05ac, 0xff, 0x01, 0x01) }, +/* Broadcom SoftSailing reporting vendor specific */ { USB_DEVICE(0x0a5c, 0x21e1) },
Greg Kroah-Hartman
maintainerPATCH 222/262 Bluetooth: Fix use-after-free bug in SMP
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andre Guedes <[email protected]>
commit 61a0cfb008f57ecf7eb28ee762952fb42dc15d15 upstream.
If SMP fails, we should always cancel security_timer delayed work. Otherwise, security_timer function may run after l2cap_conn object has been freed.
This patch fixes the following warning reported by ODEBUG:
WARNING: at lib/debugobjects.c:261 debug_print_object+0x7c/0x8d() Hardware name: Bochs ODEBUG: free active (active state 0) object type: timer_list hint: delayed_work_timer_fn+0x0/0x27 Modules linked in: btusb bluetooth Pid: 440, comm: kworker/u:2 Not tainted 3.5.0-rc1+ #4 Call Trace: [<ffffffff81174600>] ? free_obj_work+0x4a/0x7f [<ffffffff81023eb8>] warn_slowpath_common+0x7e/0x97 [<ffffffff81023f65>] warn_slowpath_fmt+0x41/0x43 [<ffffffff811746b1>] debug_print_object+0x7c/0x8d [<ffffffff810394f0>] ? __queue_work+0x241/0x241 [<ffffffff81174fdd>] debug_check_no_obj_freed+0x92/0x159 [<ffffffff810ac08e>] slab_free_hook+0x6f/0x77 [<ffffffffa0019145>] ? l2cap_conn_del+0x148/0x157 [bluetooth] [<ffffffff810ae408>] kfree+0x59/0xac [<ffffffffa0019145>] l2cap_conn_del+0x148/0x157 [bluetooth] [<ffffffffa001b9a2>] l2cap_recv_frame+0xa77/0xfa4 [bluetooth] [<ffffffff810592f9>] ? trace_hardirqs_on_caller+0x112/0x1ad [<ffffffffa001c86c>] l2cap_recv_acldata+0xe2/0x264 [bluetooth] [<ffffffffa0002b2f>] hci_rx_work+0x235/0x33c [bluetooth] [<ffffffff81038dc3>] ? process_one_work+0x126/0x2fe [<ffffffff81038e22>] process_one_work+0x185/0x2fe [<ffffffff81038dc3>] ? process_one_work+0x126/0x2fe [<ffffffff81059f2e>] ? lock_acquired+0x1b5/0x1cf [<ffffffffa00028fa>] ? le_scan_work+0x11d/0x11d [bluetooth] [<ffffffff81036fb6>] ? spin_lock_irq+0x9/0xb [<ffffffff81039209>] worker_thread+0xcf/0x175 [<ffffffff8103913a>] ? rescuer_thread+0x175/0x175 [<ffffffff8103cfe0>] kthread+0x95/0x9d [<ffffffff812c5054>] kernel_threadi_helper+0x4/0x10 [<ffffffff812c36b0>] ? retint_restore_args+0x13/0x13 [<ffffffff8103cf4b>] ? flush_kthread_worker+0xdb/0xdb [<ffffffff812c5050>] ? gs_change+0x13/0x13
This bug can be reproduced using hctool lecc or l2test tools and bluetoothd not running.
--- net/bluetooth/smp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
net/bluetooth/smp.c +3 -3
@@ -266,10 +266,10 @@ static void smp_failure(struct l2cap_conmgmt_auth_failed (conn->hcon->hdev, conn->dst, hcon->type, hcon->dst_type, reason); -if (test_and_clear_bit (HCI_CONN_LE_SMP_PEND , &conn->hcon->flags)) { -cancel_delayed_work_sync (&conn->security_timer); +cancel_delayed_work_sync (&conn->security_timer); + +if (test_and_clear_bit (HCI_CONN_LE_SMP_PEND , &conn->hcon->flags))smp_chan_destroy (conn); - } }#define JUST_WORKS 0x00
Greg Kroah-Hartman
maintainerPATCH 223/262 Bluetooth: Change signature of smp_conn_security()
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vinicius Costa Gomes <[email protected]>
commit cc110922da7e902b62d18641a370fec01a9fa794 upstream.
To make it clear that it may be called from contexts that may not have any knowledge of L2CAP, we change the connection parameter, to receive a hci_conn.
This also makes it clear that it is checking the security of the link.
--- include/net/bluetooth/smp.h | 2 +- net/bluetooth/l2cap_core.c | 11 ++++++----- net/bluetooth/l2cap_sock.c | 2 +- net/bluetooth/smp.c | 4 ++-- 4 files changed, 10 insertions(+), 9 deletions(-)
include/net/bluetooth/smp.h +1 -1
@@ -136,7 +136,7 @@ struct smp_chan { };/* SMP Commands */ -int smp_conn_security (struct l2cap_conn *conn,__u8 sec_level); +int smp_conn_security (struct hci_conn *hcon,__u8 sec_level);int smp_sig_channel (struct l2cap_conn *conn,struct sk_buff *skb);int smp_distribute_keys (struct l2cap_conn *conn,__u8 force);int smp_user_confirm_reply (struct hci_conn *conn,u16 mgmt_op,__le32 passkey);
net/bluetooth/l2cap_core.c +6 -5
@@ -1184,14 +1184,15 @@ clean:static void l2cap_conn_ready (struct l2cap_conn *conn) {struct l2cap_chan *chan; +struct hci_conn *hcon = conn->hcon;BT_DBG ("conn %p" , conn); -if (!conn->hcon->out && conn->hcon->type ==LE_LINK ) +if (!hcon->out && hcon->type ==LE_LINK )l2cap_le_conn_ready (conn); -if (conn->hcon->out && conn->hcon->type ==LE_LINK ) -smp_conn_security (conn, conn->hcon->pending_sec_level); +if (hcon->out && hcon->type ==LE_LINK ) +smp_conn_security (hcon, hcon->pending_sec_level);mutex_lock (&conn->chan_lock);
@@ -1199,8 +1200,8 @@ static void l2cap_conn_ready(struct l2cal2cap_chan_lock (chan); -if (conn->hcon->type ==LE_LINK ) { -if (smp_conn_security (conn, chan->sec_level)) +if (hcon->type ==LE_LINK ) { +if (smp_conn_security (hcon, chan->sec_level))l2cap_chan_ready (chan); }else if (chan->chan_type !=L2CAP_CHAN_CONN_ORIENTED ) {
net/bluetooth/l2cap_sock.c +1 -1
@@ -596,7 +596,7 @@ static int l2cap_sock_setsockopt(structbreak ; } -if (smp_conn_security (conn, sec.level)) +if (smp_conn_security (conn->hcon, sec.level))break ; sk->sk_state =BT_CONFIG ; chan->state =BT_CONFIG ;
net/bluetooth/smp.c +2 -2
@@ -756,9 +756,9 @@ static u8 smp_cmd_security_req(struct l2return 0 ; } -int smp_conn_security (struct l2cap_conn *conn,__u8 sec_level) +int smp_conn_security (struct hci_conn *hcon,__u8 sec_level) { -struct hci_conn *hcon = conn->hcon; +struct l2cap_conn *conn = hcon->l2cap_data;struct smp_chan *smp = conn->smp_chan;__u8 authreq;
Greg Kroah-Hartman
maintainerPATCH 224/262 Bluetooth: Fix sending a HCI Authorization Request over LE links
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vinicius Costa Gomes <[email protected]>
commit d8343f125710fb596f7a88cd756679f14f4e77b9 upstream.
In the case that the link is already in the connected state and a Pairing request arrives from the mgmt interface, hci_conn_security() would be called but it was not considering LE links.
--- net/bluetooth/hci_conn.c | 4 ++++ 1 file changed, 4 insertions(+)
net/bluetooth/hci_conn.c +4 -0
@@ -42,6 +42,7 @@#include <net/bluetooth/bluetooth.h> #include <net/bluetooth/hci_core.h> +#include <net/bluetooth/smp.h> static void hci_le_connect (struct hci_conn *conn) {
@@ -627,6 +628,9 @@ int hci_conn_security(struct hci_conn *c {BT_DBG ("conn %p" , conn); +if (conn->type ==LE_LINK ) +return smp_conn_security (conn, sec_level); +/* For sdp we don't need the link key. */ if (sec_level ==BT_SECURITY_SDP )return 1 ;
Greg Kroah-Hartman
maintainerPATCH 225/262 Fix a dead loop in async_synchronize_full()
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Li Zhong <[email protected]>
[Fixed upstream by commits 2955b47d2c1983998a8c5915cb96884e67f7cb53 and a4683487f90bfe3049686fc5c566bdc1ad03ace6 from Dan Williams, but they are much more intrusive than this tiny fix, according to Andrew - gregkh]
This patch tries to fix a dead loop in async_synchronize_full(), which could be seen when preemption is disabled on a single cpu machine.
void async_synchronize_full(void)
{
do {
async_synchronize_cookie(next_cookie);
} while (!list_empty(&async_running) || !list_empty(&async_pending));
}
async_synchronize_cookie() calls async_synchronize_cookie_domain() with &async_running as the default domain to synchronize.
However, there might be some works in the async_pending list from other domains. On a single cpu system, without preemption, there is no chance for the other works to finish, so async_synchronize_full() enters a dead loop.
It seems async_synchronize_full() wants to synchronize all entries in all running lists(domains), so maybe we could just check the entry_count to know whether all works are finished.
Currently, async_synchronize_cookie_domain() expects a non-NULL running list ( if NULL, there would be NULL pointer dereference ), so maybe a NULL pointer could be used as an indication for the functions to synchronize all works in all domains.
--- kernel/async.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
kernel/async.c +9 -4
@@ -86,6 +86,13 @@ static async_cookie_t __lowest_in_progr {struct async_entry *entry; +if (!running) {/* just check the entry count */ +if (atomic_read (&entry_count)) +return 0 ;/* smaller than any cookie */ +else +return next_cookie; + } +if (!list_empty (running)) { entry =list_first_entry (running, struct async_entry, list);
@@ -236,9 +243,7 @@ EXPORT_SYMBOL_GPL(async_schedule_domain)*/ void async_synchronize_full (void ) { -do { -async_synchronize_cookie (next_cookie); - }while (!list_empty (&async_running) || !list_empty (&async_pending)); +async_synchronize_cookie_domain (next_cookie,NULL ); }EXPORT_SYMBOL_GPL (async_synchronize_full);
@@ -258,7 +263,7 @@ EXPORT_SYMBOL_GPL(async_synchronize_full/** * async_synchronize_cookie_domain - synchronize asynchronous function calls within a certain domain with cookie checkpointing * @cookie: async_cookie_t to use as checkpoint -* @running: running list to synchronize on +* @running: running list to synchronize on, NULL indicates all lists * * This function waits until all asynchronous function calls for the * synchronization domain specified by the running list @list submitted
Greg Kroah-Hartman
maintainerPATCH 226/262 rds: set correct msg_namelen
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Weiping Pan <[email protected]>
commit 06b6a1cf6e776426766298d055bb3991957d90a7 upstream.
Jay Fenlason ([email protected]) found a bug,
that recvfrom() on an RDS socket can return the contents of random kernel memory to userspace if it was called with a address length larger than sizeof(struct sockaddr_in).rds_recvmsg() also fails to set the addr_len paramater properly before returning, but that's just a bug.
There are also a number of cases wher recvfrom() can return an entirely bogus address. Anything in rds_recvmsg() that returns a non-negative value but does not go through the "sin = (struct sockaddr_in *)msg->msg_name;" code path at the end of the while(1) loop will return up to 128 bytes of kernel memory to userspace.
And I write two test programs to reproduce this bug, you will see that in rds_server, fromAddr will be overwritten and the following sock_fd will be destroyed.
Yes, it is the programmer's fault to set msg_namelen incorrectly, but it is better to make the kernel copy the real length of address to user space in such case.
How to run the test programs ?
I test them on 32bit x86 system, 3.5.0-rc7.
1 compile
gcc -o rds_client rds_client.c
gcc -o rds_server rds_server.c
2 run ./rds_server on one console
3 run ./rds_client on another console
4 you will see something like:
server is waiting to receive data...
old socket fd=3
server received data from client:data from client
msg.msg_namelen=32
new socket fd=-1067277685sendmsg()
: Bad file descriptor
/***************** rds_client.c ********************/
int main(void)
{
int sock_fd;
struct sockaddr_in serverAddr;
struct sockaddr_in toAddr;
char recvBuffer[128] = "data from client";
struct msghdr msg;
struct iovec iov;
sock_fd = socket(AF_RDS, SOCK_SEQPACKET, 0);
if (sock_fd < 0) {
perror("create socket error\n");
exit(1);
}
memset(&serverAddr, 0, sizeof(serverAddr));
serverAddr.sin_family = AF_INET;
serverAddr.sin_addr.s_addr = inet_addr("127.0.0.1");
serverAddr.sin_port = htons(4001);
if (bind(sock_fd, (struct sockaddr*)&serverAddr, sizeof(serverAddr)) < 0) {
perror("bind() error\n");
close(sock_fd);
exit(1);
}
memset(&toAddr, 0, sizeof(toAddr));
toAddr.sin_family = AF_INET;
toAddr.sin_addr.s_addr = inet_addr("127.0.0.1");
toAddr.sin_port = htons(4000);
msg.msg_name = &toAddr;
msg.msg_namelen = sizeof(toAddr);
msg.msg_iov = &iov;
msg.msg_iovlen = 1;
msg.msg_iov->iov_base = recvBuffer;
msg.msg_iov->iov_len = strlen(recvBuffer) + 1;
msg.msg_control = 0;
msg.msg_controllen = 0;
msg.msg_flags = 0;
if (sendmsg(sock_fd, &msg, 0) == -1) {
perror("sendto() error\n");
close(sock_fd);
exit(1);
}
printf("client send data:%s\n", recvBuffer);
memset(recvBuffer, '\0', 128);
msg.msg_name = &toAddr;
msg.msg_namelen = sizeof(toAddr);
msg.msg_iov = &iov;
msg.msg_iovlen = 1;
msg.msg_iov->iov_base = recvBuffer;
msg.msg_iov->iov_len = 128;
msg.msg_control = 0;
msg.msg_controllen = 0;
msg.msg_flags = 0;
if (recvmsg(sock_fd, &msg, 0) == -1) {
perror("recvmsg() error\n");
close(sock_fd);
exit(1);
}
printf("receive data from server:%s\n", recvBuffer);
close(sock_fd);
return 0;
}/***************** rds_server.c ********************/
int main(void)
{
struct sockaddr_in fromAddr;
int sock_fd;
struct sockaddr_in serverAddr;
unsigned int addrLen;
char recvBuffer[128];
struct msghdr msg;
struct iovec iov;
sock_fd = socket(AF_RDS, SOCK_SEQPACKET, 0);
if(sock_fd < 0) {
perror("create socket error\n");
exit(0);
}
memset(&serverAddr, 0, sizeof(serverAddr));
serverAddr.sin_family = AF_INET;
serverAddr.sin_addr.s_addr = inet_addr("127.0.0.1");
serverAddr.sin_port = htons(4000);
if (bind(sock_fd, (struct sockaddr*)&serverAddr, sizeof(serverAddr)) < 0) {
perror("bind error\n");
close(sock_fd);
exit(1);
}
printf("server is waiting to receive data...\n");
msg.msg_name = &fromAddr;
/*
* I add 16 to sizeof(fromAddr), ie 32,
* and pay attention to the definition of fromAddr,
* recvmsg() will overwrite sock_fd,
* since kernel will copy 32 bytes to userspace.
*
* If you just use sizeof(fromAddr), it works fine.
* */
msg.msg_namelen = sizeof(fromAddr) + 16;
/* msg.msg_namelen = sizeof(fromAddr); */
msg.msg_iov = &iov;
msg.msg_iovlen = 1;
msg.msg_iov->iov_base = recvBuffer;
msg.msg_iov->iov_len = 128;
msg.msg_control = 0;
msg.msg_controllen = 0;
msg.msg_flags = 0;
while (1) {
printf("old socket fd=%d\n", sock_fd);
if (recvmsg(sock_fd, &msg, 0) == -1) {
perror("recvmsg() error\n");
close(sock_fd);
exit(1);
}
printf("server received data from client:%s\n", recvBuffer);
printf("msg.msg_namelen=%d\n", msg.msg_namelen);
printf("new socket fd=%d\n", sock_fd);
strcat(recvBuffer, "--data from server");
if (sendmsg(sock_fd, &msg, 0) == -1) {
perror("sendmsg()\n");
close(sock_fd);
exit(1);
}
}
close(sock_fd);
return 0;
}--- net/rds/recv.c | 3 +++ 1 file changed, 3 insertions(+)
net/rds/recv.c +3 -0
@@ -410,6 +410,8 @@ int rds_recvmsg(struct kiocb *iocb, strurdsdebug ("size %zu flags 0x%x timeo %ld\n" , size, msg_flags, timeo); + msg->msg_namelen =0 ; +if (msg_flags &MSG_OOB ) goto out;
@@ -485,6 +487,7 @@ int rds_recvmsg(struct kiocb *iocb, stru sin->sin_port = inc->i_hdr.h_sport; sin->sin_addr.s_addr = inc->i_saddr;memset (sin->sin_zero,0 ,sizeof (sin->sin_zero)); + msg->msg_namelen =sizeof (*sin); }break ; }
Greg Kroah-Hartman
maintainerPATCH 227/262 libata: Prevent interface errors with Seagate FreeAgent GoFlex
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel J Blueman <[email protected]>
commit c531077f40abc9f2129c4c83a30b3f8d6ce1c0e7 upstream.
When using my Seagate FreeAgent GoFlex eSATAp external disk enclosure, interface errors are always seen until 1.5Gbps is negotiated [1]. This occurs using any disk in the enclosure, and when the disk is connected directly with a generic passive eSATAp cable, we see stable 3Gbps operation as expected.
Blacklist 3Gbps mode to avoid dataloss and the ~30s delay bus reset and renegotiation incurs.
--- drivers/ata/libata-core.c | 1 + 1 file changed, 1 insertion(+)
drivers/ata/libata-core.c +1 -0
@@ -4126,6 +4126,7 @@ static const struct ata_blacklist_entry/* Devices which aren't very happy with higher link speeds */ { "WD My Book", NULL, ATA_HORKAGE_1_5_GBPS, }, + { "Seagate FreeAgent GoFlex", NULL, ATA_HORKAGE_1_5_GBPS, },/* * Devices which choke on SETXFER. Applies only if both the
Greg Kroah-Hartman
maintainerPATCH 228/262 sched: Fix race in task_group()
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Zijlstra <[email protected]>
commit 8323f26ce3425460769605a6aece7a174edaa7d1 upstream.
Stefan reported a crash on a kernel before a3e5d1091c1 ("sched:
Don't call task_group() too many times in set_task_rq()"), he found the reason to be that the multiple task_group() invocations in set_task_rq() returned different values.
Looking at all that I found a lack of serialization and plain wrong comments.
The below tries to fix it using an extra pointer which is updated under the appropriate scheduler locks. Its not pretty, but I can't really see another way given how all the cgroup stuff works.
--- include/linux/init_task.h | 12 +++++++++++- include/linux/sched.h | 5 ++++- kernel/sched/core.c | 9 ++++++++- kernel/sched/sched.h | 23 ++++++++++------------- 4 files changed, 33 insertions(+), 16 deletions(-)
include/linux/init_task.h +11 -1
@@ -123,8 +123,17 @@ extern struct group_info init_groups;extern struct cred init_cred; +extern struct task_group root_task_group; + +#ifdef CONFIG_CGROUP_SCHED +# define INIT_CGROUP_SCHED (tsk) \ + .sched_task_group = &root_task_group, +#else +# define INIT_CGROUP_SCHED (tsk) +#endif +#ifdef CONFIG_PERF_EVENTS -# define INIT_PERF_EVENTS (tsk) \ +# define INIT_PERF_EVENTS (tsk) \ .perf_event_mutex = \ __MUTEX_INITIALIZER(tsk.perf_event_mutex), \ .perf_event_list = LIST_HEAD_INIT(tsk.perf_event_list),
@@ -161,6 +170,7 @@ extern struct cred init_cred; }, \ .tasks = LIST_HEAD_INIT(tsk.tasks), \ INIT_PUSHABLE_TASKS(tsk) \ +INIT_CGROUP_SCHED (tsk) \ .ptraced = LIST_HEAD_INIT(tsk.ptraced), \ .ptrace_entry = LIST_HEAD_INIT(tsk.ptrace_entry), \ .real_parent = &tsk, \
include/linux/sched.h +4 -1
@@ -1244,6 +1244,9 @@ struct task_struct {const struct sched_class *sched_class;struct sched_entity se;struct sched_rt_entity rt; +#ifdef CONFIG_CGROUP_SCHED +struct task_group *sched_task_group; +#endif #ifdef CONFIG_PREEMPT_NOTIFIERS /* list of struct preempt_notifier: */
@@ -2723,7 +2726,7 @@ extern int sched_group_set_rt_period(strextern long sched_group_rt_period (struct task_group *tg);extern int sched_rt_can_attach (struct task_group *tg,struct task_struct *tsk);#endif -#endif +#endif /* CONFIG_CGROUP_SCHED */ extern int task_can_switch_user (struct user_struct *up,struct task_struct *tsk);
kernel/sched/core.c +8 -1
@@ -1096,7 +1096,7 @@ void set_task_cpu(struct task_struct *p,* a task's CPU. ->pi_lock for waking tasks, rq->lock for runnable tasks. * * sched_move_task() holds both and thus holding either pins the cgroup, -* see set_task_rq(). +* see task_group(). * * Furthermore, all task_rq users should acquire both locks, see * task_rq_lock().
@@ -7596,6 +7596,7 @@ void sched_destroy_group(struct task_gro*/ void sched_move_task (struct task_struct *tsk) { +struct task_group *tg;int on_rq, running;unsigned long flags;struct rq *rq;
@@ -7610,6 +7611,12 @@ void sched_move_task(struct task_structif (unlikely (running)) tsk->sched_class->put_prev_task (rq, tsk); + tg =container_of (task_subsys_state_check (tsk, cpu_cgroup_subsys_id, +lockdep_is_held (&tsk->sighand->siglock)), + struct task_group, css); + tg =autogroup_task_group (tsk, tg); + tsk->sched_task_group = tg; +#ifdef CONFIG_FAIR_GROUP_SCHED if (tsk->sched_class->task_move_group) tsk->sched_class->task_move_group (tsk, on_rq);
kernel/sched/sched.h +10 -13
@@ -538,22 +538,19 @@ extern int group_balance_cpu(struct sche/* * Return the group to which this tasks belongs. * -* We use task_subsys_state_check() and extend the RCU verification with -* pi->lock and rq->lock because cpu_cgroup_attach() holds those locks for each -* task it moves into the cgroup. Therefore by holding either of those locks, -* we pin the task to the current cgroup. +* We cannot use task_subsys_state() and friends because the cgroup +* subsystem changes that value before the cgroup_subsys::attach() method +* is called, therefore we cannot pin it and might observe the wrong value. +* +* The same is true for autogroup's p->signal->autogroup->tg, the autogroup +* core changes this before calling sched_move_task(). +* +* Instead we use a 'copy' which is updated from sched_move_task() while +* holding both task_struct::pi_lock and rq::lock. */ static inline struct task_group *task_group (struct task_struct *p) { -struct task_group *tg; -struct cgroup_subsys_state *css; - - css =task_subsys_state_check (p, cpu_cgroup_subsys_id, -lockdep_is_held (&p->pi_lock) || -lockdep_is_held (&task_rq (p)->lock)); - tg = container_of(css, struct task_group, css); - -return autogroup_task_group (p, tg); +return p->sched_task_group; }/* Change a task's cfs_rq and parent entity if it moves across CPUs/groups */
Greg Kroah-Hartman
maintainerPATCH 229/262 media: lirc_sir: make device registration work
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jarod Wilson <[email protected]>
commit 4b71ca6bce8fab3d08c61bf330e781f957934ae1 upstream.
For one, the driver device pointer needs to be filled in, or the lirc core will refuse to load the driver. And we really need to wire up all the platform_device bits. This has been tested via the lirc sourceforge tree and verified to work, been sitting there for months, finally getting around to sending it. :\
--- drivers/staging/media/lirc/lirc_sir.c | 60 ++++++++++++++++++++++++++++++++-- 1 file changed, 58 insertions(+), 2 deletions(-)
drivers/staging/media/lirc/lirc_sir.c +58 -2
@@ -52,6 +52,7 @@#include <linux/io.h> #include <asm/irq.h> #include <linux/fcntl.h> +#include <linux/platform_device.h> #ifdef LIRC_ON_SA1100 #include <asm/hardware.h> #ifdef CONFIG_SA1100_COLLIE
@@ -487,9 +488,11 @@ static struct lirc_driver driver = { .owner = THIS_MODULE, }; +static struct platform_device *lirc_sir_dev;static int init_chrdev (void ) { + driver.dev = &lirc_sir_dev->dev; driver.minor =lirc_register_driver (&driver);if (driver.minor <0 ) { printk(KERN_ERR LIRC_DRIVER_NAME ": init_chrdev() failed.\n");
@@ -1215,20 +1218,71 @@ static int init_lirc_sir(void)return 0 ; } +static int __devinit lirc_sir_probe (struct platform_device *dev) +{ +return 0 ; +} + +static int __devexit lirc_sir_remove(struct platform_device *dev) +{ +return 0 ; +} + +static struct platform_driver lirc_sir_driver = { + .probe = lirc_sir_probe, + .remove =__devexit_p (lirc_sir_remove), + .driver = { + .name ="lirc_sir" , + .owner =THIS_MODULE , + }, +};static int __init lirc_sir_init (void ) {int retval; + retval =platform_driver_register (&lirc_sir_driver); +if (retval) { + printk(KERN_ERR LIRC_DRIVER_NAME ": Platform driver register " + "failed!\n"); +return -ENODEV ; + } + + lirc_sir_dev =platform_device_alloc ("lirc_dev" ,0 ); +if (!lirc_sir_dev) { + printk(KERN_ERR LIRC_DRIVER_NAME ": Platform device alloc " + "failed!\n"); + retval = -ENOMEM ; + goto pdev_alloc_fail; + } + + retval =platform_device_add (lirc_sir_dev); +if (retval) { + printk(KERN_ERR LIRC_DRIVER_NAME ": Platform device add " + "failed!\n"); + retval = -ENODEV ; + goto pdev_add_fail; + } + retval =init_chrdev ();if (retval <0 ) -return retval; + goto fail; + retval =init_lirc_sir ();if (retval) {drop_chrdev (); -return retval; + goto fail; } +return 0 ; + +fail: +platform_device_del (lirc_sir_dev); +pdev_add_fail: +platform_device_put (lirc_sir_dev); +pdev_alloc_fail: +platform_driver_unregister (&lirc_sir_driver); +return retval; } static void __exit lirc_sir_exit(void)
@@ -1236,6 +1290,8 @@ static void __exit lirc_sir_exit(void)drop_hardware ();drop_chrdev ();drop_port (); +platform_device_unregister (lirc_sir_dev); +platform_driver_unregister (&lirc_sir_driver); printk(KERN_INFO LIRC_DRIVER_NAME ": Uninstalled.\n"); }
Greg Kroah-Hartman
maintainerPATCH 230/262 time: Improve sanity checking of timekeeping inputs
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: John Stultz <[email protected]>
commit 4e8b14526ca7fb046a81c94002c1c43b6fdf0e9b upstream.
Unexpected behavior could occur if the time is set to a value large enough to overflow a 64bit ktime_t (which is something larger then the year 2262).
Also unexpected behavior could occur if large negative offsets are injected via adjtimex.
So this patch improves the sanity check timekeeping inputs by improving the timespec_valid() check, and then makes better use of timespec_valid() to make sure we don't set the time to an invalid negative value or one that overflows ktime_t.
Note: This does not protect from setting the time close to overflowing ktime_t and then letting natural accumulation cause the overflow.
--- include/linux/ktime.h | 7 ------- include/linux/time.h | 22 ++++++++++++++++++++-- kernel/time/timekeeping.c | 26 ++++++++++++++++++++++++-- 3 files changed, 44 insertions(+), 11 deletions(-)
include/linux/ktime.h +0 -7
@@ -58,13 +58,6 @@ union ktime {typedef union ktime ktime_t ;/* Kill this */ -#define KTIME_MAX ((s64)~((u64)1 << 63)) -#if (BITS_PER_LONG ==64 ) -# define KTIME_SEC_MAX (KTIME_MAX / NSEC_PER_SEC) -#else -# define KTIME_SEC_MAX LONG_MAX -#endif -/* * ktime_t definitions when using the 64-bit scalar representation: */
include/linux/time.h +20 -2
@@ -107,11 +107,29 @@ static inline struct timespec timespec_sreturn ts_delta; } +#define KTIME_MAX ((s64)~((u64)1 << 63)) +#if (BITS_PER_LONG ==64 ) +# define KTIME_SEC_MAX (KTIME_MAX / NSEC_PER_SEC) +#else +# define KTIME_SEC_MAX LONG_MAX +#endif +/* * Returns true if the timespec is norm, false if denorm: */ -#define timespec_valid (ts) \ - (((ts)->tv_sec >= 0) && (((unsigned long) (ts)->tv_nsec) < NSEC_PER_SEC)) +static inline bool timespec_valid (const struct timespec *ts) +{ +/* Dates before 1970 are bogus */ +if (ts->tv_sec <0 ) +return false; +/* Can't have more nanoseconds then a second */ +if ((unsigned long )ts->tv_nsec >=NSEC_PER_SEC ) +return false; +/* Disallow values that could overflow ktime_t */ +if ((unsigned long long )ts->tv_sec >=KTIME_SEC_MAX ) +return false; +return true; +}extern void read_persistent_clock (struct timespec *ts);extern void read_boot_clock (struct timespec *ts);
kernel/time/timekeeping.c +24 -2
@@ -384,7 +384,7 @@ int do_settimeofday(const struct timespestruct timespec ts_delta;unsigned long flags; -if ((unsigned long )tv->tv_nsec >=NSEC_PER_SEC ) +if (!timespec_valid (tv))return -EINVAL ;write_seqlock_irqsave (&timekeeper.lock, flags);
@@ -418,6 +418,8 @@ EXPORT_SYMBOL(do_settimeofday);int timekeeping_inject_offset (struct timespec *ts) {unsigned long flags; +struct timespec tmp; +int ret =0 ;if ((unsigned long )ts->tv_nsec >=NSEC_PER_SEC )return -EINVAL ;
@@ -426,10 +428,17 @@ int timekeeping_inject_offset(struct timtimekeeping_forward_now (); + tmp =timespec_add (timekeeper.xtime, *ts); +if (!timespec_valid (&tmp)) { + ret = -EINVAL ; + goto error; + } + timekeeper.xtime =timespec_add (timekeeper.xtime, *ts); timekeeper.wall_to_monotonic =timespec_sub (timekeeper.wall_to_monotonic, *ts); +error:/* even if we error out, we forwarded the time, so call update */ timekeeping_update (true);write_sequnlock_irqrestore (&timekeeper.lock, flags);
@@ -437,7 +446,7 @@ int timekeeping_inject_offset(struct tim/* signal hrtimers about time change */ clock_was_set (); -return 0 ; +return ret; }EXPORT_SYMBOL (timekeeping_inject_offset);
@@ -597,7 +606,20 @@ void __init timekeeping_init(void)struct timespec now, boot;read_persistent_clock (&now); +if (!timespec_valid (&now)) { +pr_warn ("WARNING: Persistent clock returned invalid value!\n" +" Check your CMOS/BIOS settings.\n" ); + now.tv_sec =0 ; + now.tv_nsec =0 ; + } +read_boot_clock (&boot); +if (!timespec_valid (&boot)) { +pr_warn ("WARNING: Boot clock returned invalid value!\n" +" Check your CMOS/BIOS settings.\n" ); + boot.tv_sec =0 ; + boot.tv_nsec =0 ; + }seqlock_init (&timekeeper.lock);
Greg Kroah-Hartman
maintainerPATCH 231/262 time: Avoid making adjustments if we havent accumulated anything
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: John Stultz <[email protected]>
commit bf2ac312195155511a0f79325515cbb61929898a upstream.
If update_wall_time() is called and the current offset isn't large enough to accumulate, avoid re-calling timekeeping_adjust which may change the clock freq and can cause 1ns inconsistencies with CLOCK_REALTIME_COARSE/CLOCK_MONOTONIC_COARSE.
--- kernel/time/timekeeping.c | 4 ++++ 1 file changed, 4 insertions(+)
kernel/time/timekeeping.c +4 -0
@@ -1055,6 +1055,10 @@ static void update_wall_time(void)#else offset = (clock->read (clock) - clock->cycle_last) & clock->mask;#endif +/* Check if there's really nothing to do */ +if (offset < timekeeper.cycle_interval) + goto out; + timekeeper.xtime_nsec = (s64 )timekeeper.xtime.tv_nsec << timekeeper.shift;
Greg Kroah-Hartman
maintainerPATCH 232/262 time: Move ktime_t overflow checking into timespec_valid_strict
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: John Stultz <[email protected]>
commit cee58483cf56e0ba355fdd97ff5e8925329aa936 upstream.
Andreas Bombe reported that the added ktime_t overflow checking added to timespec_valid in commit 4e8b14526ca7 ("time: Improve sanity checking of timekeeping inputs") was causing problems with X.org because it caused timeouts larger then KTIME_T to be invalid.
Previously, these large timeouts would be clamped to KTIME_MAX and would never expire, which is valid.
This patch splits the ktime_t overflow checking into a new timespec_valid_strict function, and converts the timekeeping codes internal checking to use this more strict function.
--- include/linux/time.h | 7 +++++++ kernel/time/timekeeping.c | 10 +++++----- 2 files changed, 12 insertions(+), 5 deletions(-)
include/linux/time.h +7 -0
@@ -125,6 +125,13 @@ static inline bool timespec_valid(const/* Can't have more nanoseconds then a second */ if ((unsigned long )ts->tv_nsec >=NSEC_PER_SEC )return false; +return true; +} + +static inline bool timespec_valid_strict (const struct timespec *ts) +{ +if (!timespec_valid (ts)) +return false;/* Disallow values that could overflow ktime_t */ if ((unsigned long long )ts->tv_sec >=KTIME_SEC_MAX )return false;
kernel/time/timekeeping.c +5 -5
@@ -384,7 +384,7 @@ int do_settimeofday(const struct timespestruct timespec ts_delta;unsigned long flags; -if (!timespec_valid (tv)) +if (!timespec_valid_strict (tv))return -EINVAL ;write_seqlock_irqsave (&timekeeper.lock, flags);
@@ -429,7 +429,7 @@ int timekeeping_inject_offset(struct timtimekeeping_forward_now (); tmp =timespec_add (timekeeper.xtime, *ts); -if (!timespec_valid (&tmp)) { +if (!timespec_valid_strict (&tmp)) { ret = -EINVAL ; goto error; }
@@ -606,7 +606,7 @@ void __init timekeeping_init(void)struct timespec now, boot;read_persistent_clock (&now); -if (!timespec_valid (&now)) { +if (!timespec_valid_strict (&now)) {pr_warn ("WARNING: Persistent clock returned invalid value!\n" " Check your CMOS/BIOS settings.\n" ); now.tv_sec =0 ;
@@ -614,7 +614,7 @@ void __init timekeeping_init(void) }read_boot_clock (&boot); -if (!timespec_valid (&boot)) { +if (!timespec_valid_strict (&boot)) {pr_warn ("WARNING: Boot clock returned invalid value!\n" " Check your CMOS/BIOS settings.\n" ); boot.tv_sec =0 ;
@@ -665,7 +665,7 @@ static void update_sleep_time(struct tim*/ static void __timekeeping_inject_sleeptime (struct timespec *delta) { -if (!timespec_valid (delta)) { +if (!timespec_valid_strict (delta)) {printk (KERN_WARNING "__timekeeping_inject_sleeptime: Invalid " "sleep delta value!\n" );return ;
Greg Kroah-Hartman
maintainerPATCH 233/262 media: Avoid sysfs oops when an rc_devs raw device is absent
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Douglas Bagnall <[email protected]>
commit 720bb6436ff30fccad05cf5bdf961ea5b1f5686d upstream.
For some reason, when the lirc daemon learns that a usb remote control has been unplugged, it wants to read the sysfs attributes of the disappearing device. This is useful for uncovering transient inconsistencies, but less so for keeping the system running when such inconsistencies exist.
Under some circumstances (like every time I unplug my dvb stick from my laptop), lirc catches an rc_dev whose raw event handler has been removed (presumably by ir_raw_event_unregister), and proceeds to interrogate the raw protocols supported by the NULL pointer.
This patch avoids the NULL dereference, and ignores the issue of how this state of affairs came about in the first place.
Version 2 incorporates changes recommended by Mauro Carvalho Chehab (-ENODEV instead of -EINVAL, and a signed-off-by).
--- drivers/media/rc/rc-main.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/media/rc/rc-main.c +3 -2
@@ -775,10 +775,11 @@ static ssize_t show_protocols(struct devif (dev->driver_type ==RC_DRIVER_SCANCODE ) { enabled = dev->rc_map.rc_type; allowed = dev->allowed_protos; - }else { + }else if (dev->raw) { enabled = dev->raw->enabled_protocols; allowed =ir_raw_get_allowed_protocols (); - } + }else +return -ENODEV ; IR_dprintk(1, "allowed - 0x%llx, enabled - 0x%llx\n", (long long)allowed,
Greg Kroah-Hartman
maintainerPATCH 234/262 pch_uart: Fix missing break for 16 byte fifo
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alan Cox <[email protected]>
commit 9bc03743fff0770dc5a5324ba92e67cc377f16ca upstream.
Otherwise we fall back to the wrong value.
Resolves-bug: https://bugzilla.kernel.org/show_bug.cgi?id=44091
--- drivers/tty/serial/pch_uart.c | 1 + 1 file changed, 1 insertion(+)
drivers/tty/serial/pch_uart.c +1 -0
@@ -1263,6 +1263,7 @@ static int pch_uart_startup(struct uart_break ;case 16 : fifo_size =PCH_UART_HAL_FIFO16 ; +break ;case 1 :default : fifo_size =PCH_UART_HAL_FIFO_DIS ;
Greg Kroah-Hartman
maintainerPATCH 235/262 pch_uart: Fix rx error interrupt setting issue
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tomoya MORINAGA <[email protected]>
commit 9539dfb7ac1c84522fe1f79bb7dac2990f3de44a upstream.
Rx Error interrupt(E.G. parity error) is not enabled. So, when parity error occurs, error interrupt is not occurred. As a result, the received data is not dropped.
This patch adds enable/disable rx error interrupt code.
--- drivers/tty/serial/pch_uart.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-)
drivers/tty/serial/pch_uart.c +12 -6
@@ -754,7 +754,8 @@ static void pch_dma_rx_complete(void *artty_flip_buffer_push (tty);tty_kref_put (tty);async_tx_ack (priv->desc_rx); -pch_uart_hal_enable_interrupt (priv,PCH_UART_HAL_RX_INT ); +pch_uart_hal_enable_interrupt (priv,PCH_UART_HAL_RX_INT | +PCH_UART_HAL_RX_ERR_INT ); }static void pch_dma_tx_complete (void *arg)
@@ -809,7 +810,8 @@ static int handle_rx_to(struct eg20t_porint rx_size;int ret;if (!priv->start_rx) { -pch_uart_hal_disable_interrupt (priv,PCH_UART_HAL_RX_INT ); +pch_uart_hal_disable_interrupt (priv,PCH_UART_HAL_RX_INT | +PCH_UART_HAL_RX_ERR_INT );return 0 ; } buf = &priv->rxbuf;
@@ -1078,11 +1080,13 @@ static irqreturn_t pch_uart_interrupt(incase PCH_UART_IID_RDR :/* Received Data Ready */ if (priv->use_dma) {pch_uart_hal_disable_interrupt (priv, -PCH_UART_HAL_RX_INT ); +PCH_UART_HAL_RX_INT | +PCH_UART_HAL_RX_ERR_INT ); ret =dma_handle_rx (priv);if (!ret)pch_uart_hal_enable_interrupt (priv, -PCH_UART_HAL_RX_INT ); +PCH_UART_HAL_RX_INT | +PCH_UART_HAL_RX_ERR_INT ); }else { ret =handle_rx (priv); }
@@ -1208,7 +1212,8 @@ static void pch_uart_stop_rx(struct uartstruct eg20t_port *priv; priv = container_of(port, struct eg20t_port, port); priv->start_rx =0 ; -pch_uart_hal_disable_interrupt (priv,PCH_UART_HAL_RX_INT ); +pch_uart_hal_disable_interrupt (priv,PCH_UART_HAL_RX_INT | +PCH_UART_HAL_RX_ERR_INT ); }/* Enable the modem status interrupts. */
@@ -1301,7 +1306,8 @@ static int pch_uart_startup(struct uart_pch_request_dma (port); priv->start_rx =1 ; -pch_uart_hal_enable_interrupt (priv,PCH_UART_HAL_RX_INT ); +pch_uart_hal_enable_interrupt (priv,PCH_UART_HAL_RX_INT | +PCH_UART_HAL_RX_ERR_INT );uart_update_timeout (port,CS8 , default_baud);return 0 ;
Greg Kroah-Hartman
maintainerPATCH 236/262 pch_uart: Fix parity setting issue
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tomoya MORINAGA <[email protected]>
commit 38bd2a1ac736901d1cf4971c78ef952ba92ef78b upstream.
Parity Setting value is reverse.
E.G. In case of setting ODD parity, EVEN value is set. This patch inverts "if" condition.
--- drivers/tty/serial/pch_uart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/pch_uart.c +1 -1
@@ -1365,7 +1365,7 @@ static void pch_uart_set_termios(struct stb =PCH_UART_HAL_STB1 ;if (termios->c_cflag &PARENB ) { -if (!(termios->c_cflag &PARODD )) +if (termios->c_cflag &PARODD ) parity =PCH_UART_HAL_PARITY_ODD ;else parity =PCH_UART_HAL_PARITY_EVEN ;
Greg Kroah-Hartman
maintainerPATCH 237/262 powerpc/85xx: p1022ds: disable the NAND flash node if video is enabled
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Timur Tabi <[email protected]>
commit 6269f2584a359766f53005c676daff8aee60cbed upstream.
The Freescale P1022 has a unique pin muxing "feature" where the DIU video controller's video signals are muxed with 24 of the local bus address signals. When the DIU is enabled, the bulk of the local bus is disabled, preventing access to memory-mapped devices like NAND flash and the pixis FPGA.
Therefore, if the DIU is going to be enabled, then memory-mapped devices on the localbus, like NAND flash, need to be disabled.
This patch is similar to "powerpc/85xx: p1022ds: disable the NOR flash node if video is enabled", except that it disables the NAND flash node instead. This PIXIS node needs to remain enabled because it is used by platform code to switch into indirect mode.
--- arch/powerpc/platforms/85xx/p1022_ds.c | 38 +++++++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 9 deletions(-)
arch/powerpc/platforms/85xx/p1022_ds.c +29 -9
@@ -435,6 +435,8 @@ static void __init disable_one_node(struprom_update_property (np, new, old); elseprom_add_property (np ,new ); + +pr_info ("p1022ds: disabling %s node\n" , np->full_name); }/* TRUE if there is a "video=fslfb" command-line parameter. */
@@ -499,28 +501,46 @@ static void __init p1022_ds_setup_arch(v diu_ops.valid_monitor_port = p1022ds_valid_monitor_port;/* -* Disable the NOR flash node if there is video=fslfb... command-line -* parameter. When the DIU is active, NOR flash is unavailable, so we -* have to disable the node before the MTD driver loads. +* Disable the NOR and NAND flash nodes if there is video=fslfb... +* command-line parameter. When the DIU is active, the localbus is +* unavailable, so we have to disable these nodes before the MTD +* driver loads. */ if (fslfb) {struct device_node *np =of_find_compatible_node (NULL ,NULL ,"fsl,p1022-elbc" );if (np) { - np =of_find_compatible_node (np,NULL ,"cfi-flash" ); -if (np) { +struct device_node *np2; + +of_node_get (np); + np2 =of_find_compatible_node (np,NULL ,"cfi-flash" ); +if (np2) {static struct property nor_status = { .name ="status" , .value ="disabled" , .length =sizeof ("disabled" ), }; -pr_info ("p1022ds: disabling %s node" , - np->full_name); -disable_one_node (np, &nor_status); -of_node_put (np); +disable_one_node (np2, &nor_status); +of_node_put (np2); + } + +of_node_get (np); + np2 =of_find_compatible_node (np,NULL , +"fsl,elbc-fcm-nand" ); +if (np2) { +static struct property nand_status = { + .name ="status" , + .value ="disabled" , + .length =sizeof ("disabled" ), + }; + +disable_one_node (np2, &nand_status); +of_node_put (np2); } + +of_node_put (np); } }
Greg Kroah-Hartman
maintainerPATCH 238/262 powerpc/85xx: p1022ds: fix DIU/LBC switching with NAND enabled
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Timur Tabi <[email protected]>
commit 896c01cb4bb3cfc2c0ea9873fa7a9f8bd0a7c8d8 upstream.
In order for indirect mode on the PIXIS to work properly, both chip selects need to be set to GPCM mode, otherwise writes to the chip select base addresses will not actually post to the local bus -- they'll go to the NAND controller instead. Therefore, we need to set BR0 and BR1 to GPCM mode before switching to indirect mode.
--- arch/powerpc/platforms/85xx/p1022_ds.c | 64 +++++++++++++++++++++++++++++++-- 1 file changed, 62 insertions(+), 2 deletions(-)
arch/powerpc/platforms/85xx/p1022_ds.c +62 -2
@@ -208,6 +208,7 @@ static void p1022ds_set_monitor_port(enuu8 __iomem *lbc_lcs0_ba =NULL ;u8 __iomem *lbc_lcs1_ba =NULL ;phys_addr_t cs0_addr, cs1_addr; +u32 br0, or0, br1, or1;const __be32 *iprop;unsigned int num_laws;u8 b;
@@ -256,11 +257,70 @@ static void p1022ds_set_monitor_port(enu } num_laws =be32_to_cpup (iprop); - cs0_addr =lbc_br_to_phys (ecm, num_laws,in_be32 (&lbc->bank[0 ].br)); - cs1_addr =lbc_br_to_phys (ecm, num_laws,in_be32 (&lbc->bank[1 ].br)); +/* +* Indirect mode requires both BR0 and BR1 to be set to "GPCM", +* otherwise writes to these addresses won't actually appear on the +* local bus, and so the PIXIS won't see them. +* +* In FCM mode, writes go to the NAND controller, which does not pass +* them to the localbus directly. So we force BR0 and BR1 into GPCM +* mode, since we don't care about what's behind the localbus any +* more. +*/ + br0 =in_be32 (&lbc->bank[0 ].br); + br1 =in_be32 (&lbc->bank[1 ].br); + or0 =in_be32 (&lbc->bank[0 ].or); + or1 =in_be32 (&lbc->bank[1 ].or); + +/* Make sure CS0 and CS1 are programmed */ +if (!(br0 &BR_V ) || !(br1 &BR_V )) { +pr_err ("p1022ds: CS0 and/or CS1 is not programmed\n" ); + goto exit; + } + +/* +* Use the existing BRx/ORx values if it's already GPCM. Otherwise, +* force the values to simple 32KB GPCM windows with the most +* conservative timing. +*/ +if ((br0 &BR_MSEL ) !=BR_MS_GPCM ) { + br0 = (br0 &BR_BA ) |BR_V ; + or0 =0xFFFF8000 |0xFF7 ; +out_be32 (&lbc->bank[0 ].br, br0); +out_be32 (&lbc->bank[0 ].or, or0); + } +if ((br1 &BR_MSEL ) !=BR_MS_GPCM ) { + br1 = (br1 &BR_BA ) |BR_V ; + or1 =0xFFFF8000 |0xFF7 ; +out_be32 (&lbc->bank[1 ].br, br1); +out_be32 (&lbc->bank[1 ].or, or1); + } + + cs0_addr =lbc_br_to_phys (ecm, num_laws, br0); +if (!cs0_addr) { +pr_err ("p1022ds: could not determine physical address for CS0" +" (BR0=%08x)\n" , br0); + goto exit; + } + cs1_addr =lbc_br_to_phys (ecm, num_laws, br1); +if (!cs0_addr) { +pr_err ("p1022ds: could not determine physical address for CS1" +" (BR1=%08x)\n" , br1); + goto exit; + } lbc_lcs0_ba =ioremap (cs0_addr,1 ); +if (!lbc_lcs0_ba) { +pr_err ("p1022ds: could not ioremap CS0 address %llx\n" , + (unsigned long long )cs0_addr); + goto exit; + } lbc_lcs1_ba =ioremap (cs1_addr,1 ); +if (!lbc_lcs1_ba) { +pr_err ("p1022ds: could not ioremap CS1 address %llx\n" , + (unsigned long long )cs1_addr); + goto exit; + }/* Make sure we're in indirect mode first. */ if ((in_be32(&guts->pmuxcr) & PMUXCR_ELBCDIU_MASK) !=
Greg Kroah-Hartman
maintainerPATCH 239/262 pch_uart: Add eg20t_port lock field, avoid recursive spinlocks
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Darren Hart <[email protected]>
commit 2588aba002d14e938c2f56d299ecf3e7ce1302a5 upstream.
pch_uart_interrupt() takes priv->port.lock which leads to two recursive spinlock calls if low_latency==1 or CONFIG_PREEMPT_RT_FULL=y (one otherwise):
pch_uart_interrupt
spin_lock_irqsave(priv->port.lock, flags)
case PCH_UART_IID_RDR_TO (data ready)
handle_rx_to
push_rx
tty_port_tty_get
spin_lock_irqsave(&port->lock, flags) <--- already hold this lock
...
tty_flip_buffer_push
...
flush_to_ldisc
spin_lock_irqsave(&tty->buf.lock)
spin_lock_irqsave(&tty->buf.lock)
disc->ops->receive_buf(tty, char_buf)
n_tty_receive_buf
tty->ops->flush_chars()
uart_flush_chars
uart_start
spin_lock_irqsave(&port->lock) <--- already hold this lockAvoid this by using a dedicated lock to protect the eg20t_port structure and IO access to its membase. This is more consistent with the 8250 driver. Ensure priv->lock is always take prior to priv->port.lock when taken at the same time.
V2: Remove inadvertent whitespace change.
V3: Account for oops_in_progress for the private lock in
pch_console_write().
Note: Like the 8250 driver, if a printk is introduced anywhere inside
the pch_console_write() critical section, the kernel will hang on a recursive spinlock on the private lock. The oops case is handled by using a trylock in the oops_in_progress case.
--- drivers/tty/serial/pch_uart.c | 38 ++++++++++++++++++++++++++------------ 1 file changed, 26 insertions(+), 12 deletions(-)
drivers/tty/serial/pch_uart.c +26 -12
@@ -253,6 +253,9 @@ struct eg20t_port {dma_addr_t rx_buf_dma;struct dentry *debugfs; + +/* protect the eg20t_port private structure and io access to membase */ +spinlock_t lock; };/**
@@ -1060,7 +1063,7 @@ static irqreturn_t pch_uart_interrupt(inint next =1 ;u8 msr; -spin_lock_irqsave (&priv->port.lock, flags); +spin_lock_irqsave (&priv->lock, flags); handled =0 ;while (next) { iid =pch_uart_hal_get_iid (priv);
@@ -1120,7 +1123,7 @@ static irqreturn_t pch_uart_interrupt(in handled |= (unsigned int )ret; } -spin_unlock_irqrestore (&priv->port.lock, flags); +spin_unlock_irqrestore (&priv->lock, flags);return IRQ_RETVAL (handled); }
@@ -1231,9 +1234,9 @@ static void pch_uart_break_ctl(struct uaunsigned long flags; priv = container_of(port, struct eg20t_port, port); -spin_lock_irqsave (&port->lock, flags); +spin_lock_irqsave (&priv->lock, flags);pch_uart_hal_set_break (priv, ctl); -spin_unlock_irqrestore (&port->lock, flags); +spin_unlock_irqrestore (&priv->lock, flags); }/* Grab any interrupt resources and initialise any low level driver state. */
@@ -1383,7 +1386,8 @@ static void pch_uart_set_termios(struct baud =uart_get_baud_rate (port, termios, old,0 , port->uartclk /16 ); -spin_lock_irqsave (&port->lock, flags); +spin_lock_irqsave (&priv->lock, flags); +spin_lock (&port->lock);uart_update_timeout (port, termios->c_cflag, baud); rtn =pch_uart_hal_set_line (priv, baud, parity, bits, stb);
@@ -1396,7 +1400,8 @@ static void pch_uart_set_termios(structtty_termios_encode_baud_rate (termios, baud, baud); out: -spin_unlock_irqrestore (&port->lock, flags); +spin_unlock (&port->lock); +spin_unlock_irqrestore (&priv->lock, flags); }static const char *pch_uart_type (struct uart_port *port)
@@ -1545,8 +1550,9 @@ pch_console_write(struct console *co, co {struct eg20t_port *priv;unsigned long flags; +int priv_locked =1 ; +int port_locked =1 ;u8 ier; -int locked =1 ; priv = pch_uart_ports[co->index];
@@ -1554,12 +1560,16 @@ pch_console_write(struct console *co, colocal_irq_save (flags);if (priv->port.sysrq) { -/* serial8250_handle_port() already took the lock */ - locked =0 ; +spin_lock (&priv->lock); +/* serial8250_handle_port() already took the port lock */ + port_locked =0 ; }else if (oops_in_progress) { - locked =spin_trylock (&priv->port.lock); - }else + priv_locked =spin_trylock (&priv->lock); + port_locked =spin_trylock (&priv->port.lock); + }else { +spin_lock (&priv->lock);spin_lock (&priv->port.lock); + }/* * First save the IER then disable the interrupts
@@ -1577,8 +1587,10 @@ pch_console_write(struct console *co, cowait_for_xmitr (priv,BOTH_EMPTY );iowrite8 (ier, priv->membase +UART_IER ); -if (locked) +if (port_locked)spin_unlock (&priv->port.lock); +if (priv_locked) +spin_unlock (&priv->lock);local_irq_restore (flags); }
@@ -1676,6 +1688,8 @@ static struct eg20t_port *pch_uart_init_pci_enable_msi (pdev);pci_set_master (pdev); +spin_lock_init (&priv->lock); + iobase =pci_resource_start (pdev,0 ); mapbase =pci_resource_start (pdev,1 ); priv->mapbase = mapbase;
Greg Kroah-Hartman
maintainerPATCH 240/262 OMAP: USB : Fix the EHCI enumeration and core retention issue
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Keshava Munegowda <[email protected]>
commit 872c495dd0f9d1f48814a8ee80c2c7b3b7c3b4d9 upstream.
This commit 354ab8567ae3107a8cbe7228c3181990ba598aac titled "Fix OMAP EHCI suspend/resume failure (i693)" is causing the usb hub and device detection fails in beagle XM causeing NFS not functional. This affects the core retention too. The same commit logic needs to be revisted adhering to hwmod and device tree framework.
for now, this commit id 354ab8567ae3107a8cbe7228c3181990ba598aac titled "Fix OMAP EHCI suspend/resume failure (i693)" reverted.
This patch is validated on BeagleXM with NFS support over usb ethernet and USB mass storage and other device detection.
--- drivers/usb/host/ehci-omap.c | 164 ------------------------------------------- 1 file changed, 1 insertion(+), 163 deletions(-)
drivers/usb/host/ehci-omap.c +1 -163
@@ -56,15 +56,6 @@#define EHCI_INSNREG05_ULPI_EXTREGADD_SHIFT 8#define EHCI_INSNREG05_ULPI_WRDATA_SHIFT 0 -/* Errata i693 */ -static struct clk *utmi_p1_fck; -static struct clk *utmi_p2_fck; -static struct clk *xclk60mhsp1_ck; -static struct clk *xclk60mhsp2_ck; -static struct clk *usbhost_p1_fck; -static struct clk *usbhost_p2_fck; -static struct clk *init_60m_fclk; -/*-------------------------------------------------------------------------*/ static const struct hc_driver ehci_omap_hc_driver;
@@ -80,40 +71,6 @@ static inline u32 ehci_read(void __iomemreturn __raw_readl (base + reg); } -/* Erratum i693 workaround sequence */ -static void omap_ehci_erratum_i693 (struct ehci_hcd *ehci) -{ -int ret =0 ; - -/* Switch to the internal 60 MHz clock */ - ret =clk_set_parent (utmi_p1_fck, init_60m_fclk); -if (ret !=0 ) -ehci_err (ehci,"init_60m_fclk set parent" -"failed error:%d\n" , ret); - - ret =clk_set_parent (utmi_p2_fck, init_60m_fclk); -if (ret !=0 ) -ehci_err (ehci,"init_60m_fclk set parent" -"failed error:%d\n" , ret); - -clk_enable (usbhost_p1_fck); -clk_enable (usbhost_p2_fck); - -/* Wait 1ms and switch back to the external clock */ -mdelay (1 ); - ret =clk_set_parent (utmi_p1_fck, xclk60mhsp1_ck); -if (ret !=0 ) -ehci_err (ehci,"xclk60mhsp1_ck set parent" -"failed error:%d\n" , ret); - - ret =clk_set_parent (utmi_p2_fck, xclk60mhsp2_ck); -if (ret !=0 ) -ehci_err (ehci,"xclk60mhsp2_ck set parent" -"failed error:%d\n" , ret); - -clk_disable (usbhost_p1_fck); -clk_disable (usbhost_p2_fck); -}static void omap_ehci_soft_phy_reset (struct platform_device *pdev,u8 port) {
@@ -145,50 +102,6 @@ static void omap_ehci_soft_phy_reset(str } } -static int omap_ehci_hub_control ( -struct usb_hcd *hcd, -u16 typeReq, -u16 wValue, -u16 wIndex, -char *buf, -u16 wLength -) -{ -struct ehci_hcd *ehci =hcd_to_ehci (hcd); -u32 __iomem *status_reg = &ehci->regs->port_status[ - (wIndex &0xff ) -1 ]; -u32 temp; -unsigned long flags; -int retval =0 ; - -spin_lock_irqsave (&ehci->lock, flags); - -if (typeReq == SetPortFeature && wValue ==USB_PORT_FEAT_SUSPEND ) { - temp =ehci_readl (ehci, status_reg); -if ((temp &PORT_PE ) ==0 || (temp &PORT_RESET ) !=0 ) { - retval = -EPIPE ; - goto done; - } - - temp &= ~PORT_WKCONN_E ; - temp |=PORT_WKDISC_E |PORT_WKOC_E ; -ehci_writel (ehci, temp |PORT_SUSPEND , status_reg); - -omap_ehci_erratum_i693 (ehci); - -set_bit ((wIndex &0xff ) -1 , &ehci->suspended_ports); - goto done; - } - -spin_unlock_irqrestore (&ehci->lock, flags); - -/* Handle the hub control events here */ -return ehci_hub_control (hcd, typeReq, wValue, wIndex, buf, wLength); -done: -spin_unlock_irqrestore (&ehci->lock, flags); -return retval; -} -static void disable_put_regulator (struct ehci_hcd_omap_platform_data *pdata) {
@@ -351,76 +264,9 @@ static int ehci_hcd_omap_probe(struct pl/* root ports should always stay powered */ ehci_port_power (omap_ehci,1 ); -/* get clocks */ - utmi_p1_fck =clk_get (dev,"utmi_p1_gfclk" ); -if (IS_ERR (utmi_p1_fck)) { - ret =PTR_ERR (utmi_p1_fck); -dev_err (dev,"utmi_p1_gfclk failed error:%d\n" , ret); - goto err_add_hcd; - } - - xclk60mhsp1_ck =clk_get (dev,"xclk60mhsp1_ck" ); -if (IS_ERR (xclk60mhsp1_ck)) { - ret =PTR_ERR (xclk60mhsp1_ck); -dev_err (dev,"xclk60mhsp1_ck failed error:%d\n" , ret); - goto err_utmi_p1_fck; - } - - utmi_p2_fck =clk_get (dev,"utmi_p2_gfclk" ); -if (IS_ERR (utmi_p2_fck)) { - ret =PTR_ERR (utmi_p2_fck); -dev_err (dev,"utmi_p2_gfclk failed error:%d\n" , ret); - goto err_xclk60mhsp1_ck; - } - - xclk60mhsp2_ck =clk_get (dev,"xclk60mhsp2_ck" ); -if (IS_ERR (xclk60mhsp2_ck)) { - ret =PTR_ERR (xclk60mhsp2_ck); -dev_err (dev,"xclk60mhsp2_ck failed error:%d\n" , ret); - goto err_utmi_p2_fck; - } - - usbhost_p1_fck =clk_get (dev,"usb_host_hs_utmi_p1_clk" ); -if (IS_ERR (usbhost_p1_fck)) { - ret =PTR_ERR (usbhost_p1_fck); -dev_err (dev,"usbhost_p1_fck failed error:%d\n" , ret); - goto err_xclk60mhsp2_ck; - } - - usbhost_p2_fck =clk_get (dev,"usb_host_hs_utmi_p2_clk" ); -if (IS_ERR (usbhost_p2_fck)) { - ret =PTR_ERR (usbhost_p2_fck); -dev_err (dev,"usbhost_p2_fck failed error:%d\n" , ret); - goto err_usbhost_p1_fck; - } - - init_60m_fclk =clk_get (dev,"init_60m_fclk" ); -if (IS_ERR (init_60m_fclk)) { - ret =PTR_ERR (init_60m_fclk); -dev_err (dev,"init_60m_fclk failed error:%d\n" , ret); - goto err_usbhost_p2_fck; - }return 0 ; -err_usbhost_p2_fck: -clk_put (usbhost_p2_fck); - -err_usbhost_p1_fck: -clk_put (usbhost_p1_fck); - -err_xclk60mhsp2_ck: -clk_put (xclk60mhsp2_ck); - -err_utmi_p2_fck: -clk_put (utmi_p2_fck); - -err_xclk60mhsp1_ck: -clk_put (xclk60mhsp1_ck); - -err_utmi_p1_fck: -clk_put (utmi_p1_fck); - err_add_hcd:disable_put_regulator (pdata);pm_runtime_put_sync (dev);
@@ -450,14 +296,6 @@ static int ehci_hcd_omap_remove(struct piounmap (hcd->regs);usb_put_hcd (hcd); -clk_put (utmi_p1_fck); -clk_put (utmi_p2_fck); -clk_put (xclk60mhsp1_ck); -clk_put (xclk60mhsp2_ck); -clk_put (usbhost_p1_fck); -clk_put (usbhost_p2_fck); -clk_put (init_60m_fclk); -pm_runtime_put_sync (dev);pm_runtime_disable (dev);
@@ -528,7 +366,7 @@ static const struct hc_driver ehci_omap_* root hub support */ .hub_status_data = ehci_hub_status_data, - .hub_control = omap_ehci_hub_control, + .hub_control = ehci_hub_control, .bus_suspend = ehci_bus_suspend, .bus_resume = ehci_bus_resume,
Greg Kroah-Hartman
maintainerPATCH 241/262 i2c/powermac: Improve detection of devices from device-tree
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Benjamin Herrenschmidt <[email protected]>
commit 3a3dd0186f619b74e61e6f29dddcaf59af7d3cac upstream.
This patch adds a number of workarounds for broken Apple device-trees mostly around sound chips. It handles creating the missing audio codec devices and works around various issues with missing addresses or missing compatible properties.
--- drivers/i2c/busses/i2c-powermac.c | 157 ++++++++++++++++++++++++++++++++------ 1 file changed, 133 insertions(+), 24 deletions(-)
drivers/i2c/busses/i2c-powermac.c +133 -24
@@ -227,28 +227,138 @@ static int __devexit i2c_powermac_removereturn 0 ; } +static u32 __devinit i2c_powermac_get_addr (struct i2c_adapter *adap, +struct pmac_i2c_bus *bus, +struct device_node *node) +{ +const __be32 *prop; +int len; + +/* First check for valid "reg" */ + prop =of_get_property (node,"reg" , &len); +if (prop && (len >=sizeof (int ))) +return (be32_to_cpup (prop) &0xff ) >>1 ; + +/* Then check old-style "i2c-address" */ + prop =of_get_property (node,"i2c-address" , &len); +if (prop && (len >=sizeof (int ))) +return (be32_to_cpup (prop) &0xff ) >>1 ; + +/* Now handle some devices with missing "reg" properties */ +if (!strcmp (node->name,"cereal" )) +return 0x60 ; +else if (!strcmp (node->name,"deq" )) +return 0x34 ; + +dev_warn (&adap->dev,"No i2c address for %s\n" , node->full_name); + +return 0xffffffff ; +} + +static void __devinit i2c_powermac_create_one (struct i2c_adapter *adap, +const char *type, +u32 addr) +{ +struct i2c_board_info info = {}; +struct i2c_client *newdev; + +strncpy (info.type, type,sizeof (info.type)); + info.addr = addr; + newdev =i2c_new_device (adap, &info); +if (!newdev) +dev_err (&adap->dev, +"i2c-powermac: Failure to register missing %s\n" , + type); +} + +static void __devinit i2c_powermac_add_missing (struct i2c_adapter *adap, +struct pmac_i2c_bus *bus, +bool found_onyx) +{ +struct device_node *busnode =pmac_i2c_get_bus_node (bus); +int rc; + +/* Check for the onyx audio codec */ +#define ONYX_REG_CONTROL 67 +if (of_device_is_compatible (busnode,"k2-i2c" ) && !found_onyx) { +union i2c_smbus_data data; + + rc =i2c_smbus_xfer (adap,0x46 ,0 ,I2C_SMBUS_READ , +ONYX_REG_CONTROL ,I2C_SMBUS_BYTE_DATA , + &data); +if (rc >=0 ) +i2c_powermac_create_one (adap,"MAC,pcm3052" ,0x46 ); + + rc =i2c_smbus_xfer (adap,0x47 ,0 ,I2C_SMBUS_READ , +ONYX_REG_CONTROL ,I2C_SMBUS_BYTE_DATA , + &data); +if (rc >=0 ) +i2c_powermac_create_one (adap,"MAC,pcm3052" ,0x47 ); + } +} + +static bool __devinit i2c_powermac_get_type (struct i2c_adapter *adap, +struct device_node *node, +u32 addr,char *type,int type_size) +{ +char tmp[16 ]; + +/* Note: we to _NOT_ want the standard +* i2c drivers to match with any of our powermac stuff +* unless they have been specifically modified to handle +* it on a case by case basis. For example, for thermal +* control, things like lm75 etc... shall match with their +* corresponding windfarm drivers, _NOT_ the generic ones, +* so we force a prefix of AAPL, onto the modalias to +* make that happen +*/ + +/* First try proper modalias */ +if (of_modalias_node (node, tmp,sizeof (tmp)) >=0 ) { +snprintf (type, type_size,"MAC,%s" , tmp); +return true; + } + +/* Now look for known workarounds */ +if (!strcmp (node->name,"deq" )) { +/* Apple uses address 0x34 for TAS3001 and 0x35 for TAS3004 */ +if (addr ==0x34 ) { +snprintf (type, type_size,"MAC,tas3001" ); +return true; + }else if (addr ==0x35 ) { +snprintf (type, type_size,"MAC,tas3004" ); +return true; + } + } + +dev_err (&adap->dev,"i2c-powermac: modalias failure" +" on %s\n" , node->full_name); +return false; +} +static void __devinit i2c_powermac_register_devices (struct i2c_adapter *adap,struct pmac_i2c_bus *bus) {struct i2c_client *newdev;struct device_node *node; +bool found_onyx =0 ; + +/* +* In some cases we end up with the via-pmu node itself, in this +* case we skip this function completely as the device-tree will +* not contain anything useful. +*/ +if (!strcmp (adap->dev.of_node->name,"via-pmu" )) +return ;for_each_child_of_node (adap->dev.of_node, node) {struct i2c_board_info info = {}; -struct dev_archdata dev_ad = {}; -const __be32 *reg; -char tmp[16 ];u32 addr; -int len;/* Get address & channel */ - reg =of_get_property (node,"reg" , &len); -if (!reg || (len <sizeof (int ))) { -dev_err (&adap->dev,"i2c-powermac: invalid reg on %s\n" , - node->full_name); + addr =i2c_powermac_get_addr (adap, bus, node); +if (addr ==0xffffffff )continue ; - } - addr =be32_to_cpup (reg);/* Multibus setup, check channel */ if (!pmac_i2c_match_adapter (node, adap))
@@ -257,27 +367,23 @@ static void __devinit i2c_powermac_regisdev_dbg (&adap->dev,"i2c-powermac: register %s\n" , node->full_name); -/* Make up a modalias. Note: we to _NOT_ want the standard -* i2c drivers to match with any of our powermac stuff -* unless they have been specifically modified to handle -* it on a case by case basis. For example, for thermal -* control, things like lm75 etc... shall match with their -* corresponding windfarm drivers, _NOT_ the generic ones, -* so we force a prefix of AAPL, onto the modalias to -* make that happen +/* +* Keep track of some device existence to handle +* workarounds later. */ -if (of_modalias_node (node, tmp,sizeof (tmp)) <0 ) { -dev_err (&adap->dev,"i2c-powermac: modalias failure" -" on %s\n" , node->full_name); +if (of_device_is_compatible (node,"pcm3052" )) + found_onyx = true; + +/* Make up a modalias */ +if (!i2c_powermac_get_type (adap, node, addr, + info.type,sizeof (info.type))) {continue ; } -snprintf (info.type,sizeof (info.type),"MAC,%s" , tmp);/* Fill out the rest of the info structure */ - info.addr = (addr &0xff ) >>1 ; + info.addr = addr; info.irq =irq_of_parse_and_map (node,0 ); info.of_node =of_node_get (node); - info.archdata = &dev_ad; newdev =i2c_new_device (adap, &info);if (!newdev) {
@@ -292,6 +398,9 @@ static void __devinit i2c_powermac_regiscontinue ; } } + +/* Additional workarounds */ +i2c_powermac_add_missing (adap, bus, found_onyx); }static int __devinit i2c_powermac_probe (struct platform_device *dev)
Greg Kroah-Hartman
maintainerPATCH 242/262 sound/aoa: Adapt to new i2c probing scheme
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andreas Schwab <[email protected]>
commit 26b0d14106954ae46d2f4f7eec3481828a210f7d upstream.
The i2c-powermac driver now creates the i2c devices properly from the device-tree, including workarounds for broken or missing device-tree bits, so let's just use the normal probe methods and get rid of the hand made device creation code.
--- sound/aoa/codecs/onyx.c | 75 +-------------------------------------------- sound/aoa/codecs/tas.c | 80 +----------------------------------------------- 2 files changed, 6 insertions(+), 149 deletions(-)
sound/aoa/codecs/onyx.c +3 -72
@@ -997,45 +997,10 @@ static void onyx_exit_codec(struct aoa_c onyx->codec.soundbus_dev->detach_codec (onyx->codec.soundbus_dev, onyx); } -static int onyx_create (struct i2c_adapter *adapter, -struct device_node *node, -int addr) -{ -struct i2c_board_info info; -struct i2c_client *client; - -memset (&info,0 ,sizeof (struct i2c_board_info )); -strlcpy (info.type,"aoa_codec_onyx" ,I2C_NAME_SIZE ); - info.addr = addr; - info.platform_data = node; - client =i2c_new_device (adapter, &info); -if (!client) -return -ENODEV ; - -/* -* We know the driver is already loaded, so the device should be -* already bound. If not it means binding failed, which suggests -* the device doesn't really exist and should be deleted. -* Ideally this would be replaced by better checks _before_ -* instantiating the device. -*/ -if (!client->driver) { -i2c_unregister_device (client); -return -ENODEV ; - } - -/* -* Let i2c-core delete that device on driver removal. -* This is safe because i2c-core holds the core_lock mutex for us. -*/ -list_add_tail (&client->detected, &client->driver->clients); -return 0 ; -} -static int onyx_i2c_probe (struct i2c_client *client,const struct i2c_device_id *id) { -struct device_node *node = client->dev.platform_data; +struct device_node *node = client->dev.of_node;struct onyx *onyx;u8 dummy;
@@ -1071,40 +1036,6 @@ static int onyx_i2c_probe(struct i2c_clireturn -ENODEV ; } -static int onyx_i2c_attach (struct i2c_adapter *adapter) -{ -struct device_node *busnode, *dev =NULL ; -struct pmac_i2c_bus *bus; - - bus =pmac_i2c_adapter_to_bus (adapter); -if (bus ==NULL ) -return -ENODEV ; - busnode =pmac_i2c_get_bus_node (bus); - -while ((dev =of_get_next_child (busnode, dev)) !=NULL ) { -if (of_device_is_compatible (dev,"pcm3052" )) { -const u32 *addr; - printk(KERN_DEBUG PFX "found pcm3052\n"); - addr =of_get_property (dev,"reg" ,NULL ); -if (!addr) -return -ENODEV ; -return onyx_create (adapter, dev, (*addr)>>1 ); - } - } - -/* if that didn't work, try desperate mode for older -* machines that have stuff missing from the device tree */ - -if (!of_device_is_compatible (busnode,"k2-i2c" )) -return -ENODEV ; - - printk(KERN_DEBUG PFX "found k2-i2c, checking if onyx chip is on it\n"); -/* probe both possible addresses for the onyx chip */ -if (onyx_create (adapter,NULL ,0x46 ) ==0 ) -return 0 ; -return onyx_create (adapter,NULL ,0x47 ); -} -static int onyx_i2c_remove (struct i2c_client *client) {struct onyx *onyx =i2c_get_clientdata (client);
@@ -1117,16 +1048,16 @@ static int onyx_i2c_remove(struct i2c_cl }static const struct i2c_device_id onyx_i2c_id[] = { - {"aoa_codec_onyx" ,0 }, + {"MAC,pcm3052" ,0 }, { } }; +MODULE_DEVICE_TABLE (i2c,onyx_i2c_id);static struct i2c_driver onyx_driver = { .driver = { .name ="aoa_codec_onyx" , .owner =THIS_MODULE , }, - .attach_adapter = onyx_i2c_attach, .probe = onyx_i2c_probe, .remove = onyx_i2c_remove, .id_table = onyx_i2c_id,
sound/aoa/codecs/tas.c +3 -77
109 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 243/262 NFS: Fix Oopses in nfs_lookup_revalidate and nfs4_lookup_revalidate
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Trond Myklebust <[email protected]>
[Fixed upstream as part of 0b728e1911c, but that's a much larger patch, this is only the nfs portion backported as needed.]
Fix the following Oops in 3.5.1:
BUG: unable to handle kernel NULL pointer dereference at 0000000000000038 IP: [<ffffffffa03789cd>] nfs_lookup_revalidate+0x2d/0x480 [nfs] PGD 337c63067 PUD 0 Oops: 0000 [#1] SMP CPU 5 Modules linked in: nfs fscache nfsd lockd nfs_acl auth_rpcgss sunrpc af_packet binfmt_misc cpufreq_conservative cpufreq_userspace cpufreq_powersave dm_mod acpi_cpufreq mperf coretemp gpio_ich kvm_intel joydev kvm ioatdma hid_generic igb lpc_ich i7core_edac edac_core ptp serio_raw dca pcspkr i2c_i801 mfd_core sg pps_core usbhid crc32c_intel microcode button autofs4 uhci_hcd ttm drm_kms_helper drm i2c_algo_bit sysimgblt sysfillrect syscopyarea ehci_hcd usbcore usb_common scsi_dh_rdac scsi_dh_emc scsi_dh_hp_sw scsi_dh_alua scsi_dh edd fan ata_piix thermal processor thermal_sys
Pid: 30431, comm: java Not tainted 3.5.1-2-default #1 Supermicro X8DTT/X8DTT
RIP: 0010:[<ffffffffa03789cd>] [<ffffffffa03789cd>] nfs_lookup_revalidate+0x2d/0x480 [nfs] RSP: 0018:ffff8801b418bd38 EFLAGS: 00010292 RAX: 00000000fffffff6 RBX: ffff88032016d800 RCX: 0000000000000020 RDX: ffffffff00000000 RSI: 0000000000000000 RDI: ffff8801824a7b00 RBP: ffff8801b418bdf8 R08: 7fffff0034323030 R09: fffffffff04c03ed R10: ffff8801824a7b00 R11: 0000000000000002 R12: ffff8801824a7b00 R13: ffff8801824a7b00 R14: 0000000000000000 R15: ffff8803201725d0 FS: 00002b53a46cb700(0000) GS:ffff88033fc20000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000000038 CR3: 000000020a426000 CR4: 00000000000007e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400 Process java (pid: 30431, threadinfo ffff8801b418a000, task ffff8801b5d20600) Stack: ffff8801b418be44 ffff88032016d800 ffff8801b418bdf8 0000000000000000 ffff8801824a7b00 ffff8801b418bdd7 ffff8803201725d0 ffffffff8116a9c0 ffff8801b5c38dc0 0000000000000007 ffff88032016d800 0000000000000000 Call Trace: [<ffffffff8116a9c0>] lookup_dcache+0x80/0xe0 [<ffffffff8116aa43>] __lookup_hash+0x23/0x90 [<ffffffff8116b4a5>] lookup_one_len+0xc5/0x100 [<ffffffffa03869a3>] nfs_sillyrename+0xe3/0x210 [nfs] [<ffffffff8116cadf>] vfs_unlink.part.25+0x7f/0xe0 [<ffffffff8116f22c>] do_unlinkat+0x1ac/0x1d0 [<ffffffff815717b9>] system_call_fastpath+0x16/0x1b [<00002b5348b5f527>] 0x2b5348b5f526 Code: ec 38 b8 f6 ff ff ff 4c 89 64 24 18 4c 89 74 24 28 49 89 fc 48 89 5c 24 08 48 89 6c 24 10 49 89 f6 4c 89 6c 24 20 4c 89 7c 24 30 <f6> 46 38 40 0f 85 d1 00 00 00 e8 c4 c4 df e0 48 8b 58 30 49 89 RIP [<ffffffffa03789cd>] nfs_lookup_revalidate+0x2d/0x480 [nfs] RSP <ffff8801b418bd38> CR2: 0000000000000038 ---[ end trace 845113ed191985dd ]---
This Oops affects 3.5 kernels and older, and is due to lookup_one_len() calling down to the dentry revalidation code with a NULL pointer to struct nameidata.
It is fixed upstream by commit 0b728e1911c (stop passing nameidata * to ->d_revalidate())
--- fs/nfs/dir.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/nfs/dir.c +2 -2
@@ -1123,7 +1123,7 @@ static int nfs_lookup_revalidate(structstruct nfs_fattr *fattr =NULL ;int error; -if (nd->flags &LOOKUP_RCU ) +if (nd && (nd->flags &LOOKUP_RCU ))return -ECHILD ; parent =dget_parent (dentry);
@@ -1526,7 +1526,7 @@ static int nfs4_lookup_revalidate(structstruct inode *dir;int openflags, ret =0 ; -if (nd->flags &LOOKUP_RCU ) +if (nd && (nd->flags &LOOKUP_RCU ))return -ECHILD ; inode = dentry->d_inode;
Re: [ 243/262] NFS: Fix Oopses in nfs_lookup_revalidate and nfs4_lookup_revalidate
Quoted 3 lines · Greg Kroah-Hartman
From: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
Hi Greg,
Can we please apply this patch to the older stable kernels too? I see that Ben has already applied it to the 3.2 kernel, but it really wants to go into 3.4 and 3.0 as well...
Thanks!
Trond
Quoted 85 lines
------------------
From: Trond Myklebust <[email protected]>
[Fixed upstream as part of
0b728e1911c, but that's a much larger patch, this is only the nfs portion backported as needed.]Fix the following Oops in 3.5.1:
BUG: unable to handle kernel NULL pointer dereference at 0000000000000038 IP: [<ffffffffa03789cd>] nfs_lookup_revalidate+0x2d/0x480 [nfs] PGD 337c63067 PUD 0 Oops: 0000 [#1] SMP CPU 5 Modules linked in: nfs fscache nfsd lockd nfs_acl auth_rpcgss sunrpc af_packet binfmt_misc cpufreq_conservative cpufreq_userspace cpufreq_powersave dm_mod acpi_cpufreq mperf coretemp gpio_ich kvm_intel joydev kvm ioatdma hid_generic igb lpc_ich i7core_edac edac_core ptp serio_raw dca pcspkr i2c_i801 mfd_core sg pps_core usbhid crc32c_intel microcode button autofs4 uhci_hcd ttm drm_kms_helper drm i2c_algo_bit sysimgblt sysfillrect syscopyarea ehci_hcd usbcore usb_common scsi_dh_rdac scsi_dh_emc scsi_dh_hp_sw scsi_dh_alua scsi_dh edd fan ata_piix thermal processor thermal_sysPid: 30431, comm: java Not tainted 3.5.1-2-default #1 Supermicro X8DTT/X8DTT
RIP: 0010:[<ffffffffa03789cd>] [<ffffffffa03789cd>] nfs_lookup_revalidate+0x2d/0x480 [nfs] RSP: 0018:ffff8801b418bd38 EFLAGS: 00010292 RAX: 00000000fffffff6 RBX: ffff88032016d800 RCX: 0000000000000020 RDX: ffffffff00000000 RSI: 0000000000000000 RDI: ffff8801824a7b00 RBP: ffff8801b418bdf8 R08: 7fffff0034323030 R09: fffffffff04c03ed R10: ffff8801824a7b00 R11: 0000000000000002 R12: ffff8801824a7b00 R13: ffff8801824a7b00 R14: 0000000000000000 R15: ffff8803201725d0 FS: 00002b53a46cb700(0000) GS:ffff88033fc20000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000000038 CR3: 000000020a426000 CR4: 00000000000007e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400 Process java (pid: 30431, threadinfo ffff8801b418a000, task ffff8801b5d20600) Stack: ffff8801b418be44 ffff88032016d800 ffff8801b418bdf8 0000000000000000 ffff8801824a7b00 ffff8801b418bdd7 ffff8803201725d0 ffffffff8116a9c0 ffff8801b5c38dc0 0000000000000007 ffff88032016d800 0000000000000000 Call Trace: [<ffffffff8116a9c0>] lookup_dcache+0x80/0xe0 [<ffffffff8116aa43>] __lookup_hash+0x23/0x90 [<ffffffff8116b4a5>] lookup_one_len+0xc5/0x100 [<ffffffffa03869a3>] nfs_sillyrename+0xe3/0x210 [nfs] [<ffffffff8116cadf>] vfs_unlink.part.25+0x7f/0xe0 [<ffffffff8116f22c>] do_unlinkat+0x1ac/0x1d0 [<ffffffff815717b9>] system_call_fastpath+0x16/0x1b [<00002b5348b5f527>] 0x2b5348b5f526 Code: ec 38 b8 f6 ff ff ff 4c 89 64 24 18 4c 89 74 24 28 49 89 fc 48 89 5c 24 08 48 89 6c 24 10 49 89 f6 4c 89 6c 24 20 4c 89 7c 24 30 <f6> 46 38 40 0f 85 d1 00 00 00 e8 c4 c4 df e0 48 8b 58 30 49 89 RIP [<ffffffffa03789cd>] nfs_lookup_revalidate+0x2d/0x480 [nfs] RSP <ffff8801b418bd38> CR2: 0000000000000038 ---[ end trace 845113ed191985dd ]---This Oops affects 3.5 kernels and older, and is due to
lookup_one_len()calling down to the dentry revalidation code with a NULL pointer to struct nameidata.It is fixed upstream by commit
0b728e1911c(stop passing nameidata * to ->d_revalidate())Reported-by Richard Ems <[email protected]>Signed-off-by Trond Myklebust <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- fs/nfs/dir.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)fs/nfs/dir.c +2
-2@@ -1123,7 +1123,7 @@ static int nfs_lookup_revalidate(structstruct nfs_fattr *fattr =NULL ;int error; -if (nd->flags &LOOKUP_RCU ) +if (nd && (nd->flags &LOOKUP_RCU ))return -ECHILD ; parent =dget_parent (dentry);@@ -1526,7 +1526,7 @@ static int nfs4_lookup_revalidate(structstruct inode *dir;int openflags, ret =0 ; -if (nd->flags &LOOKUP_RCU ) +if (nd && (nd->flags &LOOKUP_RCU ))return -ECHILD ; inode = dentry->d_inode;
Signature · 7 lines
Trond Myklebust Linux NFS client maintainer NetApp [email protected] www.netapp.com ���{.n�+�������+%�����ݶ��w��{.n�+����{��G�����{ay�ʇڙ�,j��f���h��������z_�(�階�ݢj"���m������G������?����&���~��iO��z��v�^�m����������?�I�
Greg Kroah-Hartman
maintainerRe: [ 243/262] NFS: Fix Oopses in nfs_lookup_revalidate and nfs4_lookup_revalidate
Quoted 11 lines · Trond
Quoted 3 lines · Greg Kroah-Hartman
From: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
Hi Greg,
Can we please apply this patch to the older stable kernels too? I see that Ben has already applied it to the 3.2 kernel, but it really wants to go into 3.4 and 3.0 as well...
Ok, I'll queue this up for the next round of releases.
thanks,
greg k-h
Greg Kroah-Hartman
maintainerRe: [ 243/262] NFS: Fix Oopses in nfs_lookup_revalidate and nfs4_lookup_revalidate
Quoted 7 lines · Greg Kroah-Hartman
Quoted 6 lines · Trond
Quoted 3 lines · Greg Kroah-Hartman
From: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
Quoted 7 lines
Quoted 5 lines
Hi Greg,
Can we please apply this patch to the older stable kernels too? I see that Ben has already applied it to the 3.2 kernel, but it really wants to go into 3.4 and 3.0 as well...
Ok, I'll queue this up for the next round of releases.
Now applied, thanks.
greg k-h
Greg Kroah-Hartman
maintainerPATCH 244/262 net: qmi_wwan: add ZTE MF821D
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bjørn Mork <[email protected]>
commit db8dacf953a70274172236957a4b97d4fdb376f0 upstream.
Sold by O2 (telefonica germany) under the name "LTE4G"
--- drivers/net/usb/qmi_wwan.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/net/usb/qmi_wwan.c +9 -0
@@ -453,6 +453,15 @@ static const struct usb_device_id produc .bInterfaceProtocol = 0xff, .driver_info = (unsigned long)&qmi_wwan_force_int4, }, + {/* ZTE MF821D */ + .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, + .idVendor = 0x19d2, + .idProduct = 0x0326, + .bInterfaceClass = 0xff, + .bInterfaceSubClass = 0xff, + .bInterfaceProtocol = 0xff, + .driver_info = (unsigned long)&qmi_wwan_force_int4, + }, { /* ZTE (Vodafone) K3520-Z */ .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, .idVendor = 0x19d2,
Greg Kroah-Hartman
maintainerPATCH 245/262 net: qmi_wwan: add Sierra Wireless devices
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bj�rn Mork <[email protected]>
commit 9b469a60d68b13c288d5c3fc23de29d9d482dbe6 upstream.
Add 6 new devices and one modified device, based on information from laptop vendor Windows drivers.
Sony provides a driver with two new devices using a Gobi 2k+ layout (1199:68a5 and 1199:68a9). The Sony driver also adds a non-standard QMI/net interface to the already supported 1199:9011 Gobi device. We do not know whether this is an alternate interface number or an additional interface which might be present, but that doesn't really matter.
Lenovo provides a driver supporting 4 new devices:
- MC7770 (1199:901b) with standard Gobi 2k+ layout
- MC7700 (0f3d:68a2) with layout similar to MC7710
- MC7750 (114f:68a2) with layout similar to MC7710
- EM7700 (1199:901c) with layout similar to MC7710
Note regaring the three devices similar to MC7710:
The Windows drivers only support interface #8 on these devices. The MC7710 can support QMI/net functions on interface #19 and #20 as well, and this driver is verified to work on interface #19 (a firmware bug is suspected to prevent #20 from working).
We do not enable these additional interfaces until they either show up in a Windows driver or are verified to work in some other way. Therefore limiting the new devices to interface #8 for now.
---
for stable: v3.4 and v3.5
drivers/net/usb/qmi_wwan.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+)
drivers/net/usb/qmi_wwan.c +31 -0
@@ -534,6 +534,33 @@ static const struct usb_device_id produc .bInterfaceProtocol = 0xff, .driver_info = (unsigned long)&qmi_wwan_sierra, }, + { /* Sierra Wireless MC7700 */ + .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, + .idVendor = 0x0f3d, + .idProduct = 0x68a2, + .bInterfaceClass = 0xff, + .bInterfaceSubClass = 0xff, + .bInterfaceProtocol = 0xff, + .driver_info = (unsigned long)&qmi_wwan_sierra, + }, + { /* Sierra Wireless MC7750 */ + .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, + .idVendor = 0x114f, + .idProduct = 0x68a2, + .bInterfaceClass = 0xff, + .bInterfaceSubClass = 0xff, + .bInterfaceProtocol = 0xff, + .driver_info = (unsigned long)&qmi_wwan_sierra, + }, + { /* Sierra Wireless EM7700 */ + .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, + .idVendor = 0x1199, + .idProduct = 0x901c, + .bInterfaceClass = 0xff, + .bInterfaceSubClass = 0xff, + .bInterfaceProtocol = 0xff, + .driver_info = (unsigned long)&qmi_wwan_sierra, + }, /* Gobi 1000 devices */ {QMI_GOBI1K_DEVICE(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */
@@ -561,6 +588,8 @@ static const struct usb_device_id produc {QMI_GOBI_DEVICE(0x05c6, 0x9265)}, /* Asus Gobi 2000 Modem device (VR305) */ {QMI_GOBI_DEVICE(0x05c6, 0x9235)}, /* Top Global Gobi 2000 Modem device (VR306) */ {QMI_GOBI_DEVICE(0x05c6, 0x9275)}, /* iRex Technologies Gobi 2000 Modem device (VR307) */ + {QMI_GOBI_DEVICE(0x1199, 0x68a5)}, /* Sierra Wireless Modem */ + {QMI_GOBI_DEVICE(0x1199, 0x68a9)}, /* Sierra Wireless Modem */ {QMI_GOBI_DEVICE(0x1199, 0x9001)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */ {QMI_GOBI_DEVICE(0x1199, 0x9002)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */ {QMI_GOBI_DEVICE(0x1199, 0x9003)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */
@@ -577,6 +606,8 @@ static const struct usb_device_id produc {QMI_GOBI_DEVICE(0x1199, 0x9013)}, /* Sierra Wireless Gobi 3000 Modem device (MC8355) */ {QMI_GOBI_DEVICE(0x1199, 0x9015)}, /* Sierra Wireless Gobi 3000 Modem device */ {QMI_GOBI_DEVICE(0x1199, 0x9019)}, /* Sierra Wireless Gobi 3000 Modem device */ + {QMI_GOBI_DEVICE(0x1199, 0x901b)}, /* Sierra Wireless MC7770 */ + { } /* END */ };MODULE_DEVICE_TABLE (usb, products);
Greg Kroah-Hartman
maintainerPATCH 246/262 net: qmi_wwan: new devices: UML290 and K5006-Z
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bj�rn Mork <[email protected]>
commit 10cbc1d97a7c7f9ae862fffe27b771ef0da9c461 upstream.
Newer firmware versions for the Pantech UML290 use a different subclass ID. The Windows driver match on both IDs, so we do that as well.
The ZTE (Vodafone) K5006-Z is a new device.
---
for stable: v3.4 and v3.5
drivers/net/usb/qmi_wwan.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
drivers/net/usb/qmi_wwan.c +18 -0
@@ -444,6 +444,15 @@ static const struct usb_device_id produc .bInterfaceProtocol = 0xff, .driver_info = (unsigned long)&qmi_wwan_shared, }, + {/* Pantech UML290 - newer firmware */ + .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, + .idVendor = 0x106c, + .idProduct = 0x3718, + .bInterfaceClass = 0xff, + .bInterfaceSubClass = 0xf1, + .bInterfaceProtocol = 0xff, + .driver_info = (unsigned long)&qmi_wwan_shared, + }, { /* ZTE MF820D */ .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, .idVendor = 0x19d2,
@@ -516,6 +525,15 @@ static const struct usb_device_id produc .bInterfaceProtocol = 0xff, .driver_info = (unsigned long)&qmi_wwan_force_int4, }, + {/* ZTE (Vodafone) K5006-Z */ + .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, + .idVendor = 0x19d2, + .idProduct = 0x1018, + .bInterfaceClass = 0xff, + .bInterfaceSubClass = 0xff, + .bInterfaceProtocol = 0xff, + .driver_info = (unsigned long)&qmi_wwan_force_int3, + }, { /* ZTE MF60 */ .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, .idVendor = 0x19d2,
Greg Kroah-Hartman
maintainerPATCH 247/262 irq_remap: disable IRQ remapping if any IOAPIC lacks an IOMMU
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Seth Forshee <[email protected]>
commit 32ab31e01e2def6f48294d872d9bb42573aae00f upstream.
The ACPI tables in the Macbook Air 5,1 define a single IOAPIC with id 2, but the only remapping unit described in the DMAR table matches id 0. Interrupt remapping fails as a result, and the kernel panics with the message "timer doesn't work through Interrupt-remapped IO-APIC."
To fix this, check each IOAPIC for a corresponding IOMMU. If an IOMMU is not found, do not allow IRQ remapping to be enabled.
v2: Move check to parse_ioapics_under_ir(), raise log level to KERN_ERR,
and add FW_BUG to the log message
v3: Skip check if IOMMU doesn't support interrupt remapping and remove
existing check that the IOMMU count equals the IOAPIC count
--- drivers/iommu/intel_irq_remapping.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-)
drivers/iommu/intel_irq_remapping.c +13 -5
@@ -736,6 +736,7 @@ int __init parse_ioapics_under_ir(void) {struct dmar_drhd_unit *drhd;int ir_supported =0 ; +int ioapic_idx;for_each_drhd_unit (drhd) {struct intel_iommu *iommu = drhd->iommu;
@@ -748,13 +749,20 @@ int __init parse_ioapics_under_ir(void) } } -if (ir_supported && ir_ioapic_num != nr_ioapics) { -printk (KERN_WARNING -"Not all IO-APIC's listed under remapping hardware\n" ); -return -1 ; +if (!ir_supported) +return 0 ; + +for (ioapic_idx =0 ; ioapic_idx < nr_ioapics; ioapic_idx++) { +int ioapic_id =mpc_ioapic_id (ioapic_idx); +if (!map_ioapic_to_ir (ioapic_id)) { +pr_err (FW_BUG "ioapic %d has no mapping iommu, " +"interrupt remapping will be disabled\n" , + ioapic_id); +return -1 ; + } } -return ir_supported; +return 1 ; }int __init ir_dev_scope_init (void )
Greg Kroah-Hartman
maintainerPATCH 248/262 NFSd: introduce nfsd_destroy() helper
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stanislav Kinsbursky <[email protected]>
commit 19f7e2ca44dfc3c1b3f499fc46801f98d403500f upstream.
--- fs/nfsd/nfsctl.c | 8 ++------ fs/nfsd/nfsd.h | 9 +++++++++ fs/nfsd/nfssvc.c | 14 +++----------- 3 files changed, 14 insertions(+), 17 deletions(-)
fs/nfsd/nfsctl.c +2 -6
@@ -673,9 +673,7 @@ static ssize_t __write_ports_addfd(char err =svc_addsock (nfsd_serv, fd, buf,SIMPLE_TRANSACTION_LIMIT );if (err <0 ) { -if (nfsd_serv->sv_nrthreads ==1 ) -svc_shutdown_net (nfsd_serv, net); -svc_destroy (nfsd_serv); +nfsd_destroy (net);return err; }
@@ -744,9 +742,7 @@ out_close:svc_xprt_put (xprt); } out_err: -if (nfsd_serv->sv_nrthreads ==1 ) -svc_shutdown_net (nfsd_serv, net); -svc_destroy (nfsd_serv); +nfsd_destroy (net);return err; }
fs/nfsd/nfsd.h +9 -0
@@ -73,6 +73,15 @@ int nfsd_nrpools(void);int nfsd_get_nrthreads (int n,int *);int nfsd_set_nrthreads (int n,int *); +static inline void nfsd_destroy (struct net *net) +{ +int destroy = (nfsd_serv->sv_nrthreads ==1 ); + +if (destroy) +svc_shutdown_net (nfsd_serv, net); +svc_destroy (nfsd_serv); +} +#if defined(CONFIG_NFSD_V2_ACL ) || defined(CONFIG_NFSD_V3_ACL )#ifdef CONFIG_NFSD_V2_ACL extern struct svc_version nfsd_acl_version2;
fs/nfsd/nfssvc.c +3 -11
@@ -427,11 +427,7 @@ int nfsd_set_nrthreads(int n, int *nthreif (err)break ; } - -if (nfsd_serv->sv_nrthreads ==1 ) -svc_shutdown_net (nfsd_serv, net); -svc_destroy (nfsd_serv); - +nfsd_destroy (net);return err; }
@@ -478,9 +474,7 @@ out_shutdown:if (error <0 && !nfsd_up_before)nfsd_shutdown (); out_destroy: -if (nfsd_serv->sv_nrthreads ==1 ) -svc_shutdown_net (nfsd_serv, net); -svc_destroy (nfsd_serv);/* Release server */ +nfsd_destroy (net);/* Release server */ out:mutex_unlock (&nfsd_mutex);return error;
@@ -682,9 +676,7 @@ int nfsd_pool_stats_release(struct inodemutex_lock (&nfsd_mutex);/* this function really, really should have been called svc_put() */ -if (nfsd_serv->sv_nrthreads ==1 ) -svc_shutdown_net (nfsd_serv, net); -svc_destroy (nfsd_serv); +nfsd_destroy (net);mutex_unlock (&nfsd_mutex);return ret; }
Greg Kroah-Hartman
maintainerPATCH 249/262 NFSd: set nfsd_serv to NULL after service destruction
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stanislav Kinsbursky <[email protected]>
commit 57c8b13e3cd0f94944c9691ce7f58e5fcef8a12d upstream.
In nfsd_destroy():
if (destroy) svc_shutdown_net(nfsd_serv, net); svc_destroy(nfsd_server);
svc_shutdown_net(nfsd_serv, net) calls nfsd_last_thread(), which sets nfsd_serv to NULL, causing a NULL dereference on the following line.
--- fs/nfsd/nfsd.h | 2 ++ fs/nfsd/nfssvc.c | 10 +++++----- 2 files changed, 7 insertions(+), 5 deletions(-)
fs/nfsd/nfsd.h +2 -0
@@ -80,6 +80,8 @@ static inline void nfsd_destroy(struct nif (destroy)svc_shutdown_net (nfsd_serv, net);svc_destroy (nfsd_serv); +if (destroy) + nfsd_serv =NULL ; }#if defined(CONFIG_NFSD_V2_ACL ) || defined(CONFIG_NFSD_V3_ACL )
fs/nfsd/nfssvc.c +5 -5
@@ -254,8 +254,6 @@ static void nfsd_shutdown(void)static void nfsd_last_thread (struct svc_serv *serv,struct net *net) { -/* When last nfsd thread exits we need to do some clean-up */ - nfsd_serv =NULL ;nfsd_shutdown ();svc_rpcb_cleanup (serv, net);
@@ -332,6 +330,7 @@ static int nfsd_get_default_max_blksize(int nfsd_create_serv (void ) {int error; +struct net *net = current->nsproxy->net_ns;WARN_ON (!mutex_is_locked (&nfsd_mutex));if (nfsd_serv) {
@@ -346,7 +345,7 @@ int nfsd_create_serv(void)if (nfsd_serv ==NULL )return -ENOMEM ; - error =svc_bind (nfsd_serv, current->nsproxy->net_ns); + error =svc_bind (nfsd_serv, net);if (error <0 ) {svc_destroy (nfsd_serv);return error;
@@ -557,12 +556,13 @@ nfsd(void *vrqstp) nfsdstats.th_cnt --; out: -if (rqstp->rq_server->sv_nrthreads ==1 ) -svc_shutdown_net (rqstp->rq_server, &init_net); + rqstp->rq_server =NULL ;/* Release the thread */ svc_exit_thread (rqstp); +nfsd_destroy (&init_net); +/* Release module */ mutex_unlock (&nfsd_mutex);module_put_and_exit (0 );
Greg Kroah-Hartman
maintainerPATCH 250/262 kthread_worker: reorganize to prepare for flush_kthread_work() reimplementation
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tejun Heo <[email protected]>
commit 9a2e03d8ed518a61154f18d83d6466628e519f94 upstream.
Make the following two non-functional changes.
* Separate out insert_kthread_work() from queue_kthread_work().
* Relocate struct kthread_flush_work and kthread_flush_work_fn() definitions above flush_kthread_work().
v2: Added lockdep_assert_held() in insert_kthread_work() as suggested
by Andy Walls.
--- kernel/kthread.c | 42 ++++++++++++++++++++++++++---------------- 1 file changed, 26 insertions(+), 16 deletions(-)
kernel/kthread.c +26 -16
@@ -378,6 +378,19 @@ repeat: }EXPORT_SYMBOL_GPL (kthread_worker_fn); +/* insert @work before @pos in @worker */ +static void insert_kthread_work (struct kthread_worker *worker, +struct kthread_work *work, +struct list_head *pos) +{ +lockdep_assert_held (&worker->lock); + +list_add_tail (&work->node, pos); + work->queue_seq++; +if (likely (worker->task)) +wake_up_process (worker->task); +} +/** * queue_kthread_work - queue a kthread_work * @worker: target kthread_worker
@@ -395,10 +408,7 @@ bool queue_kthread_work(struct kthread_wspin_lock_irqsave (&worker->lock, flags);if (list_empty (&work->node)) { -list_add_tail (&work->node, &worker->work_list); - work->queue_seq++; -if (likely (worker->task)) -wake_up_process (worker->task); +insert_kthread_work (worker, work, &worker->work_list); ret = true; }spin_unlock_irqrestore (&worker->lock, flags);
@@ -406,6 +416,18 @@ bool queue_kthread_work(struct kthread_w }EXPORT_SYMBOL_GPL (queue_kthread_work); +struct kthread_flush_work { +struct kthread_work work; +struct completion done; +}; + +static void kthread_flush_work_fn (struct kthread_work *work) +{ +struct kthread_flush_work *fwork = + container_of(work, struct kthread_flush_work, work); +complete (&fwork->done); +} +/** * flush_kthread_work - flush a kthread_work * @work: work to flush
@@ -436,18 +458,6 @@ void flush_kthread_work(struct kthread_w }EXPORT_SYMBOL_GPL (flush_kthread_work); -struct kthread_flush_work { -struct kthread_work work; -struct completion done; -}; - -static void kthread_flush_work_fn (struct kthread_work *work) -{ -struct kthread_flush_work *fwork = - container_of(work, struct kthread_flush_work, work); -complete (&fwork->done); -} -/** * flush_kthread_worker - flush all current works on a kthread_worker * @worker: worker to flush
Greg Kroah-Hartman
maintainerPATCH 251/262 kthread_worker: reimplement flush_kthread_work() to allow freeing the work item being executed
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tejun Heo <[email protected]>
commit 46f3d976213452350f9d10b0c2780c2681f7075b upstream.
kthread_worker provides minimalistic workqueue-like interface for users which need a dedicated worker thread (e.g. for realtime priority). It has basic queue, flush_work, flush_worker operations which mostly match the workqueue counterparts; however, due to the way flush_work() is implemented, it has a noticeable difference of not allowing work items to be freed while being executed.
While the current users of kthread_worker are okay with the current behavior, the restriction does impede some valid use cases. Also, removing this difference isn't difficult and actually makes the code easier to understand.
This patch reimplements flush_kthread_work() such that it uses a flush_work item instead of queue/done sequence numbers.
--- include/linux/kthread.h | 8 +------ kernel/kthread.c | 52 ++++++++++++++++++++++++++---------------------- 2 files changed, 31 insertions(+), 29 deletions(-)
include/linux/kthread.h +2 -6
@@ -49,8 +49,6 @@ extern int tsk_fork_get_node(struct task* can be queued and flushed using queue/flush_kthread_work() * respectively. Queued kthread_works are processed by a kthread * running kthread_worker_fn(). -* -* A kthread_work can't be freed while it is executing. */ struct kthread_work ;typedef void (*kthread_work_func_t )(struct kthread_work *work);
@@ -59,15 +57,14 @@ struct kthread_worker {spinlock_t lock;struct list_head work_list;struct task_struct *task; +struct kthread_work *current_work; };struct kthread_work {struct list_head node;kthread_work_func_t func;wait_queue_head_t done; -atomic_t flushing; -int queue_seq; -int done_seq; +struct kthread_worker *worker; };#define KTHREAD_WORKER_INIT (worker) { \
@@ -79,7 +76,6 @@ struct kthread_work { .node = LIST_HEAD_INIT((work).node), \ .func = (fn), \ .done = __WAIT_QUEUE_HEAD_INITIALIZER((work).done), \ - .flushing = ATOMIC_INIT(0), \ }#define DEFINE_KTHREAD_WORKER (worker) \
kernel/kthread.c +29 -23
77 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 252/262 usb: chipidea: udc: fix error path in udc_start()
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marc Kleine-Budde <[email protected]>
commit c9d1f947a85e38b6dded469470c95ed62430cb3f upstream.
This patch fixes the error path of udc_start(). Now NULL is used to unset the peripheral with otg_set_peripheral().
--- drivers/usb/chipidea/udc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/chipidea/udc.c +1 -1
@@ -1747,7 +1747,7 @@ static int udc_start(struct ci13xxx *udc remove_trans:if (udc->transceiver) { -otg_set_peripheral (udc->transceiver->otg, &udc->gadget); +otg_set_peripheral (udc->transceiver->otg,NULL );usb_put_transceiver (udc->transceiver); }
Greg Kroah-Hartman
maintainerPATCH 253/262 usb: chipidea: cleanup dma_pool if udc_start() fails
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marc Kleine-Budde <[email protected]>
commit ad6b1b97fe8504957d017cd6e4168cac8903d3f3 upstream.
If udc_start() fails the qh_pool dma-pool cannot be closed because it's still in use. This patch factors out the dma_pool_free() loop into destroy_eps() and calls it in the error path of udc_start(), too.
--- drivers/usb/chipidea/udc.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-)
drivers/usb/chipidea/udc.c +15 -8
@@ -1500,6 +1500,17 @@ static int init_eps(struct ci13xxx *udc)return retval; } +static void destroy_eps (struct ci13xxx *udc) +{ +int i; + +for (i =0 ; i < udc->hw_ep_max; i++) { +struct ci13xxx_ep *mEp = &udc->ci13xxx_ep[i]; + +dma_pool_free (udc->qh_pool, mEp->qh.ptr, mEp->qh.dma); + } +} +/** * ci13xxx_start: register a gadget driver * @gadget: our gadget
@@ -1709,7 +1720,7 @@ static int udc_start(struct ci13xxx *udcif (udc->udc_driver->flags &CI13XXX_REQUIRE_TRANSCEIVER ) {if (udc->transceiver ==NULL ) { retval = -ENODEV ; - goto free_pools; + goto destroy_eps; } }
@@ -1759,6 +1770,8 @@ unreg_device: put_transceiver:if (udc->transceiver)usb_put_transceiver (udc->transceiver); +destroy_eps: +destroy_eps (udc); free_pools:dma_pool_destroy (udc->td_pool); free_qh_pool:
@@ -1773,18 +1786,12 @@ free_qh_pool:*/ static void udc_stop (struct ci13xxx *udc) { -int i; -if (udc ==NULL )return ;usb_del_gadget_udc (&udc->gadget); -for (i =0 ; i < udc->hw_ep_max; i++) { -struct ci13xxx_ep *mEp = &udc->ci13xxx_ep[i]; - -dma_pool_free (udc->qh_pool, mEp->qh.ptr, mEp->qh.dma); - } +destroy_eps (udc);dma_pool_destroy (udc->td_pool);dma_pool_destroy (udc->qh_pool);
Greg Kroah-Hartman
maintainerPATCH 254/262 USB: ohci-at91: fix null pointer in ohci_hcd_at91_overcurrent_irq
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joachim Eastwood <[email protected]>
commit 01bb6501779ed0b6dc6c55be34b49eaa6306fdd8 upstream.
Fixes the following NULL pointer dereference:
[ 7.740000] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver [ 7.810000] Unable to handle kernel NULL pointer dereference at virtual address 00000028 [ 7.810000] pgd = c3a38000 [ 7.810000] [00000028] *pgd=23a8c831, *pte=00000000, *ppte=00000000 [ 7.810000] Internal error: Oops: 17 [#1] PREEMPT ARM [ 7.810000] Modules linked in: ohci_hcd(+) regmap_i2c snd_pcm usbcore snd_page_alloc at91_cf snd_timer pcmcia_rsrc snd soundcore gpio_keys regmap_spi pcmcia_core usb_common nls_base [ 7.810000] CPU: 0 Not tainted (3.6.0-rc6-mpa+ #264) [ 7.810000] PC is at __gpio_to_irq+0x18/0x40 [ 7.810000] LR is at ohci_hcd_at91_overcurrent_irq+0x24/0xb4 [ohci_hcd] [ 7.810000] pc : [<c01392d4>] lr : [<bf08f694>] psr: 40000093 [ 7.810000] sp : c3a11c40 ip : c3a11c50 fp : c3a11c4c [ 7.810000] r10: 00000000 r9 : c02dcd6e r8 : fefff400 [ 7.810000] r7 : 00000000 r6 : c02cc928 r5 : 00000030 r4 : c02dd168 [ 7.810000] r3 : c02e7350 r2 : ffffffea r1 : c02cc928 r0 : 00000000 [ 7.810000] Flags: nZcv IRQs off FIQs on Mode SVC_32 ISA ARM Segment user [ 7.810000] Control: c000717f Table: 23a38000 DAC: 00000015 [ 7.810000] Process modprobe (pid: 285, stack limit = 0xc3a10270) [ 7.810000] Stack: (0xc3a11c40 to 0xc3a12000) [ 7.810000] 1c40: c3a11c6c c3a11c50 bf08f694 c01392cc c3a11c84 c2c38b00 c3806900 00000030 [ 7.810000] 1c60: c3a11ca4 c3a11c70 c0051264 bf08f680 c3a11cac c3a11c80 c003e764 c3806900 [ 7.810000] 1c80: c2c38b00 c02cb05c c02cb000 fefff400 c3806930 c3a11cf4 c3a11cbc c3a11ca8 [ 7.810000] 1ca0: c005142c c005123c c3806900 c3805a00 c3a11cd4 c3a11cc0 c0053f24 c00513e4 [ 7.810000] 1cc0: c3a11cf4 00000030 c3a11cec c3a11cd8 c005120c c0053e88 00000000 00000000 [ 7.810000] 1ce0: c3a11d1c c3a11cf0 c00124d0 c00511e0 01400000 00000001 00000012 00000000 [ 7.810000] 1d00: ffffffff c3a11d94 00000030 00000000 c3a11d34 c3a11d20 c005120c c0012438 [ 7.810000] 1d20: c001dac4 00000012 c3a11d4c c3a11d38 c0009b08 c00511e0 c00523fc 60000013 [ 7.810000] 1d40: c3a11d5c c3a11d50 c0008510 c0009ab4 c3a11ddc c3a11d60 c0008eb4 c00084f0 [ 7.810000] 1d60: 00000000 00000030 00000000 00000080 60000013 bf08f670 c3806900 c2c38b00 [ 7.810000] 1d80: 00000030 c3806930 00000000 c3a11ddc c3a11d88 c3a11da8 c0054190 c00523fc [ 7.810000] 1da0: 60000013 ffffffff c3a11dec c3a11db8 00000000 c2c38b00 bf08f670 c3806900 [ 7.810000] 1dc0: 00000000 00000080 c02cc928 00000030 c3a11e0c c3a11de0 c0052764 c00520d8 [ 7.810000] 1de0: c3a11dfc 00000000 00000000 00000002 bf090f61 00000004 c02cc930 c02cc928 [ 7.810000] 1e00: c3a11e4c c3a11e10 bf090978 c005269c bf090f61 c02cc928 bf093000 c02dd170 [ 7.810000] 1e20: c3a11e3c c02cc930 c02cc930 bf0911d0 bf0911d0 bf093000 c3a10000 00000000 [ 7.810000] 1e40: c3a11e5c c3a11e50 c0155b7c bf090808 c3a11e7c c3a11e60 c0154690 c0155b6c [ 7.810000] 1e60: c02cc930 c02cc964 bf0911d0 c3a11ea0 c3a11e9c c3a11e80 c015484c c01545e8 [ 7.810000] 1e80: 00000000 00000000 c01547e4 bf0911d0 c3a11ec4 c3a11ea0 c0152e58 c01547f4 [ 7.810000] 1ea0: c381b88c c384ab10 c2c10540 bf0911d0 00000000 c02d7518 c3a11ed4 c3a11ec8 [ 7.810000] 1ec0: c01544c0 c0152e0c c3a11efc c3a11ed8 c01536cc c01544b0 bf091075 c3a11ee8 [ 7.810000] 1ee0: bf049af0 bf09120c bf0911d0 00000000 c3a11f1c c3a11f00 c0154e9c c0153628 [ 7.810000] 1f00: bf049af0 bf09120c 000ae190 00000000 c3a11f2c c3a11f20 c0155f58 c0154e04 [ 7.810000] 1f20: c3a11f44 c3a11f30 bf093054 c0155f1c 00000000 00006a4f c3a11f7c c3a11f48 [ 7.810000] 1f40: c0008638 bf093010 bf09120c 000ae190 00000000 c00093c4 00006a4f bf09120c [ 7.810000] 1f60: 000ae190 00000000 c00093c4 00000000 c3a11fa4 c3a11f80 c004fdc4 c000859c [ 7.810000] 1f80: c3a11fa4 000ae190 00006a4f 00016eb8 000ad018 00000080 00000000 c3a11fa8 [ 7.810000] 1fa0: c0009260 c004fd58 00006a4f 00016eb8 000ae190 00006a4f 000ae100 00000000 [ 7.810000] 1fc0: 00006a4f 00016eb8 000ad018 00000080 000adba0 000ad208 00000000 000ad3d8 [ 7.810000] 1fe0: beaf7ae8 beaf7ad8 000172b8 b6e4e940 20000010 000ae190 00000000 00000000 [ 7.810000] Backtrace: [ 7.810000] [<c01392bc>] (__gpio_to_irq+0x0/0x40) from [<bf08f694>] (ohci_hcd_at91_overcurrent_irq+0x24/0xb4 [ohci_hcd]) [ 7.810000] [<bf08f670>] (ohci_hcd_at91_overcurrent_irq+0x0/0xb4 [ohci_hcd]) from [<c0051264>] (handle_irq_event_percpu+0x38/0x1a8) [ 7.810000] r6:00000030 r5:c3806900 r4:c2c38b00 [ 7.810000] [<c005122c>] (handle_irq_event_percpu+0x0/0x1a8) from [<c005142c>] (handle_irq_event+0x58/0x7c) [ 7.810000] [<c00513d4>] (handle_irq_event+0x0/0x7c) from [<c0053f24>] (handle_simple_irq+0xac/0xd8) [ 7.810000] r5:c3805a00 r4:c3806900 [ 7.810000] [<c0053e78>] (handle_simple_irq+0x0/0xd8) from [<c005120c>] (generic_handle_irq+0x3c/0x48) [ 7.810000] r4:00000030 [ 7.810000] [<c00511d0>] (generic_handle_irq+0x0/0x48) from [<c00124d0>] (gpio_irq_handler+0xa8/0xfc) [ 7.810000] r4:00000000 [ 7.810000] [<c0012428>] (gpio_irq_handler+0x0/0xfc) from [<c005120c>] (generic_handle_irq+0x3c/0x48) [ 7.810000] [<c00511d0>] (generic_handle_irq+0x0/0x48) from [<c0009b08>] (handle_IRQ+0x64/0x88) [ 7.810000] r4:00000012 [ 7.810000] [<c0009aa4>] (handle_IRQ+0x0/0x88) from [<c0008510>] (at91_aic_handle_irq+0x30/0x38) [ 7.810000] r5:60000013 r4:c00523fc [ 7.810000] [<c00084e0>] (at91_aic_handle_irq+0x0/0x38) from [<c0008eb4>] (__irq_svc+0x34/0x60) [ 7.810000] Exception stack(0xc3a11d60 to 0xc3a11da8) [ 7.810000] 1d60: 00000000 00000030 00000000 00000080 60000013 bf08f670 c3806900 c2c38b00 [ 7.810000] 1d80: 00000030 c3806930 00000000 c3a11ddc c3a11d88 c3a11da8 c0054190 c00523fc [ 7.810000] 1da0: 60000013 ffffffff [ 7.810000] [<c00520c8>] (__setup_irq+0x0/0x458) from [<c0052764>] (request_threaded_irq+0xd8/0x134) [ 7.810000] [<c005268c>] (request_threaded_irq+0x0/0x134) from [<bf090978>] (ohci_hcd_at91_drv_probe+0x180/0x41c [ohci_hcd]) [ 7.810000] [<bf0907f8>] (ohci_hcd_at91_drv_probe+0x0/0x41c [ohci_hcd]) from [<c0155b7c>] (platform_drv_probe+0x20/0x24) [ 7.810000] [<c0155b5c>] (platform_drv_probe+0x0/0x24) from [<c0154690>] (driver_probe_device+0xb8/0x20c) [ 7.810000] [<c01545d8>] (driver_probe_device+0x0/0x20c) from [<c015484c>] (__driver_attach+0x68/0x88) [ 7.810000] r7:c3a11ea0 r6:bf0911d0 r5:c02cc964 r4:c02cc930 [ 7.810000] [<c01547e4>] (__driver_attach+0x0/0x88) from [<c0152e58>] (bus_for_each_dev+0x5c/0x9c) [ 7.810000] r6:bf0911d0 r5:c01547e4 r4:00000000 [ 7.810000] [<c0152dfc>] (bus_for_each_dev+0x0/0x9c) from [<c01544c0>] (driver_attach+0x20/0x28) [ 7.810000] r7:c02d7518 r6:00000000 r5:bf0911d0 r4:c2c10540 [ 7.810000] [<c01544a0>] (driver_attach+0x0/0x28) from [<c01536cc>] (bus_add_driver+0xb4/0x22c) [ 7.810000] [<c0153618>] (bus_add_driver+0x0/0x22c) from [<c0154e9c>] (driver_register+0xa8/0x144) [ 7.810000] r7:00000000 r6:bf0911d0 r5:bf09120c r4:bf049af0 [ 7.810000] [<c0154df4>] (driver_register+0x0/0x144) from [<c0155f58>] (platform_driver_register+0x4c/0x60) [ 7.810000] r7:00000000 r6:000ae190 r5:bf09120c r4:bf049af0 [ 7.810000] [<c0155f0c>] (platform_driver_register+0x0/0x60) from [<bf093054>] (ohci_hcd_mod_init+0x54/0x8c [ohci_hcd]) [ 7.810000] [<bf093000>] (ohci_hcd_mod_init+0x0/0x8c [ohci_hcd]) from [<c0008638>] (do_one_initcall+0xac/0x174) [ 7.810000] r4:00006a4f [ 7.810000] [<c000858c>] (do_one_initcall+0x0/0x174) from [<c004fdc4>] (sys_init_module+0x7c/0x1a0) [ 7.810000] [<c004fd48>] (sys_init_module+0x0/0x1a0) from [<c0009260>] (ret_fast_syscall+0x0/0x2c) [ 7.810000] r7:00000080 r6:000ad018 r5:00016eb8 r4:00006a4f [ 7.810000] Code: e24cb004 e59f3028 e1a02000 e7930180 (e5903028) [ 7.810000] ---[ end trace 85aa37ed128143b5 ]--- [ 7.810000] Kernel panic - not syncing: Fatal exception in interrupt
Commit 6fffb77c (USB: ohci-at91: fix PIO handling in relation with number of ports) started setting unused pins to EINVAL. But this exposed a bug in the ohci_hcd_at91_overcurrent_irq function where the gpio was used without being checked to see if it is valid.
This patches fixed the issue by adding the gpio valid check.
--- drivers/usb/host/ohci-at91.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/usb/host/ohci-at91.c +2 -1
@@ -467,7 +467,8 @@ static irqreturn_t ohci_hcd_at91_overcur/* From the GPIO notifying the over-current situation, find * out the corresponding port */ at91_for_each_port (port) { -if (gpio_to_irq (pdata->overcurrent_pin[port]) == irq) { +if (gpio_is_valid (pdata->overcurrent_pin[port]) && +gpio_to_irq (pdata->overcurrent_pin[port]) == irq) { gpio = pdata->overcurrent_pin[port];break ; }
Greg Kroah-Hartman
maintainerPATCH 255/262 USB: Fix race condition when removing host controllers
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alan Stern <[email protected]>
commit 0d00dc2611abbe6ad244d50569c2ee82ce42846c upstream.
This patch (as1607) fixes a race that can occur if a USB host controller is removed while a process is reading the /sys/kernel/debug/usb/devices file.
The usb_device_read() routine uses the bus->root_hub pointer to determine whether or not the root hub is registered. The is not a valid test, because the pointer is set before the root hub gets registered and remains set even after the root hub is unregistered and deallocated. As a result, usb_device_read() or usb_device_dump() can access freed memory, causing an oops.
The patch changes the test to use the hcd->rh_registered flag, which does get set and cleared at the appropriate times. It also makes sure to hold the usb_bus_list_lock mutex while setting the flag, so that usb_device_read() will become aware of new root hubs as soon as they are registered.
--- drivers/usb/core/devices.c | 2 +- drivers/usb/core/hcd.c | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-)
drivers/usb/core/devices.c +1 -1
@@ -624,7 +624,7 @@ static ssize_t usb_device_read(struct fi/* print devices for all busses */ list_for_each_entry (bus, &usb_bus_list, bus_list) {/* recurse through all children of the root hub */ -if (!bus->root_hub) +if (!bus_to_hcd (bus)->rh_registered)continue ;usb_lock_device (bus->root_hub); ret = usb_device_dump(&buf, &nbytes, &skip_bytes, ppos,
drivers/usb/core/hcd.c +2 -4
@@ -1011,10 +1011,7 @@ static int register_root_hub(struct usb_if (retval) {dev_err (parent_dev,"can't register root hub for %s, %d\n" ,dev_name (&usb_dev->dev), retval); - } -mutex_unlock (&usb_bus_list_lock); - -if (retval ==0 ) { + }else {spin_lock_irq (&hcd_root_hub_lock); hcd->rh_registered =1 ;spin_unlock_irq (&hcd_root_hub_lock);
@@ -1023,6 +1020,7 @@ static int register_root_hub(struct usb_if (HCD_DEAD (hcd))usb_hc_died (hcd);/* This time clean up */ } +mutex_unlock (&usb_bus_list_lock);return retval; }
Greg Kroah-Hartman
maintainerPATCH 256/262 ALSA: snd-usb: fix next_packet_size calls for pause case
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Mack <[email protected]>
commit 8dce30c89113e314d29d3b8f362aadff8087fccb upstream.
Also fix the calls to next_packet_size() for the pause case. This was missed in 245baf983 ("ALSA: snd-usb: fix calls to next_packet_size").
--- sound/usb/endpoint.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
sound/usb/endpoint.c +7 -1
@@ -197,7 +197,13 @@ static void prepare_outbound_urb(struct/* no data provider, so send silence */ unsigned int offs =0 ;for (i =0 ; i < ctx->packets; ++i) { -int counts = ctx->packet_size[i]; +int counts; + +if (ctx->packet_size[i]) + counts = ctx->packet_size[i]; +else + counts =snd_usb_endpoint_next_packet_size (ep); + urb->iso_frame_desc[i].offset = offs * ep->stride; urb->iso_frame_desc[i].length = counts * ep->stride; offs += counts;
Greg Kroah-Hartman
maintainerPATCH 257/262 ASoC: wm2000: Correct register size
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mark Brown <[email protected]>
commit d0e12f3ff3472cbd8f52d3c0e6ee07a841787c40 upstream.
--- sound/soc/codecs/wm2000.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/wm2000.c +1 -1
@@ -675,7 +675,7 @@ static int wm2000_resume(struct snd_soc_#endif static const struct regmap_config wm2000_regmap = { - .reg_bits =8 , + .reg_bits =16 , .val_bits =8 , };
Greg Kroah-Hartman
maintainerPATCH 258/262 gpio-lpc32xx: Fix value handling of gpio_direction_output()
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Roland Stigge <[email protected]>
commit b1268d3737c6316016026245eef276eda6b0a621 upstream.
For GPIOs of gpio-lpc32xx, gpio_direction_output() ignores the value argument (initial value of output). This patch fixes this by setting the level accordingly.
--- drivers/gpio/gpio-lpc32xx.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/gpio/gpio-lpc32xx.c +5 -0
@@ -307,6 +307,7 @@ static int lpc32xx_gpio_dir_output_p012( {struct lpc32xx_gpio_chip *group =to_lpc32xx_gpio (chip); +__set_gpio_level_p012 (group, pin, value);__set_gpio_dir_p012 (group, pin,0 );return 0 ;
@@ -317,6 +318,7 @@ static int lpc32xx_gpio_dir_output_p3(st {struct lpc32xx_gpio_chip *group =to_lpc32xx_gpio (chip); +__set_gpio_level_p3 (group, pin, value);__set_gpio_dir_p3 (group, pin,0 );return 0 ;
@@ -325,6 +327,9 @@ static int lpc32xx_gpio_dir_output_p3(ststatic int lpc32xx_gpio_dir_out_always (struct gpio_chip *chip,unsigned pin,int value) { +struct lpc32xx_gpio_chip *group =to_lpc32xx_gpio (chip); + +__set_gpo_level_p3 (group, pin, value);return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 259/262 md/raid10: fix "enough" function for detecting if array is failed.
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: NeilBrown <[email protected]>
commit 80b4812407c6b1f66a4f2430e69747a13f010839 upstream.
The 'enough' function is written to work with 'near' arrays only in that is implicitly assumes that the offset from one 'group' of devices to the next is the same as the number of copies. In reality it is the number of 'near' copies.
So change it to make this number explicit.
This bug makes it possible to run arrays without enough drives present, which is dangerous.
It is appropriate for an -stable kernel, but will almost certainly need to be modified for some of them.
--- drivers/md/raid10.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/md/raid10.c +5 -3
@@ -1492,14 +1492,16 @@ static int _enough(struct r10conf *conf,do {int n = conf->copies;int cnt =0 ; +int this = first;while (n--) { -if (conf->mirrors[first].rdev && - first != ignore) +if (conf->mirrors[this].rdev && + this != ignore) cnt++; - first = (first+1 ) % geo->raid_disks; + this = (this+1 ) % geo->raid_disks; }if (cnt ==0 )return 0 ; + first = (first + geo->near_copies) % geo->raid_disks; }while (first !=0 );return 1 ; }
Greg Kroah-Hartman
maintainerPATCH 260/262 drm/udl: limit modes to the sku pixel limits.
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Airlie <[email protected]>
commit 3a75885848996baab5276ff37ebf7295c3c753f0 upstream.
Otherwise when X starts we commonly get a black screen scanning out nothing, its wierd dpms on/off from userspace brings it back,
With this on F18, multi-seat works again with my 1920x1200 monitor which is above the sku limit for the device I have.
--- drivers/gpu/drm/udl/udl_connector.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/gpu/drm/udl/udl_connector.c +7 -0
@@ -69,6 +69,13 @@ static int udl_get_modes(struct drm_connstatic int udl_mode_valid (struct drm_connector *connector,struct drm_display_mode *mode) { +struct udl_device *udl = connector->dev->dev_private; +if (!udl->sku_pixel_limit) +return 0 ; + +if (mode->vdisplay * mode->hdisplay > udl->sku_pixel_limit) +return MODE_VIRTUAL_Y ; +return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 261/262 drm/i915: only enable sdvo hotplug irq if needed
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jani Nikula <[email protected]>
commit fcbc50da7753b210b4442ca9abc4efbd4e481f6e upstream.
Avoid constant wakeups caused by noisy irq lines when we don't even care about the irq. This should be particularly useful for i945g/gm where the hotplug has been disabled:
commit 768b107e4b3be0acf6f58e914afe4f337c00932b
Author: Daniel Vetter <[email protected]> Date: Fri May 4 11:29:56 2012 +0200
drm/i915: disable sdvo hotplug on i945g/gm
v2: While at it, remove the bogus hotplug_active read, and do not mask hotplug_active[0] before checking whether the irq is needed, per discussion with Daniel on IRC.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=38442
--- drivers/gpu/drm/i915/intel_sdvo.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-)
drivers/gpu/drm/i915/intel_sdvo.c +10 -13
@@ -2552,25 +2552,12 @@ bool intel_sdvo_init(struct drm_device * } } -if (intel_sdvo->is_sdvob) - dev_priv->hotplug_supported_mask |=SDVOB_HOTPLUG_INT_STATUS ; -else - dev_priv->hotplug_supported_mask |=SDVOC_HOTPLUG_INT_STATUS ; -drm_encoder_helper_add (&intel_encoder->base, &intel_sdvo_helper_funcs);/* In default case sdvo lvds is false */ if (!intel_sdvo_get_capabilities (intel_sdvo, &intel_sdvo->caps)) goto err; -/* Set up hotplug command - note paranoia about contents of reply. -* We assume that the hardware is in a sane state, and only touch -* the bits we think we understand. -*/ -intel_sdvo_get_value (intel_sdvo,SDVO_CMD_GET_ACTIVE_HOT_PLUG , - &intel_sdvo->hotplug_active,2 ); - intel_sdvo->hotplug_active[0 ] &= ~0x3 ; -if (intel_sdvo_output_setup (intel_sdvo, intel_sdvo->caps.output_flags) != true) { DRM_DEBUG_KMS("SDVO output failed to setup on %s\n",
@@ -2578,6 +2565,16 @@ bool intel_sdvo_init(struct drm_device * goto err; } +/* Only enable the hotplug irq if we need it, to work around noisy +* hotplug lines. +*/ +if (intel_sdvo->hotplug_active[0 ]) { +if (intel_sdvo->is_sdvob) + dev_priv->hotplug_supported_mask |=SDVOB_HOTPLUG_INT_STATUS ; +else + dev_priv->hotplug_supported_mask |=SDVOC_HOTPLUG_INT_STATUS ; + } +intel_sdvo_select_ddc_bus (dev_priv, intel_sdvo, sdvo_reg);/* Set the input timing to the screen. Assume always input 0. */
Greg Kroah-Hartman
maintainerPATCH 262/262 vmwgfx: corruption in vmw_event_fence_action_create()
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit 68c4fce737c4b963e336435f225621dc21138397 upstream.
We don't allocate enough data for this struct. As soon as we start modifying event->event on the next lines, then we're going beyond the end of the memory we allocated.
--- drivers/gpu/drm/vmwgfx/vmwgfx_fence.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/vmwgfx/vmwgfx_fence.c +1 -1
@@ -1018,7 +1018,7 @@ int vmw_event_fence_action_create(struct } - event =kzalloc (sizeof (event->event),GFP_KERNEL ); + event =kzalloc (sizeof (*event),GFP_KERNEL );if (unlikely (event ==NULL )) {DRM_ERROR ("Failed to allocate an event.\n" ); ret = -ENOMEM ;