[PATCH v10 2/3] mmc: sdhci-msm: Initial support for Qualcomm chipsets

2014-03-04 Thread Georgi Djakov
This platform driver adds the initial support of Secure
Digital Host Controller Interface compliant controller
found in Qualcomm chipsets.

Signed-off-by: Asutosh Das asuto...@codeaurora.org
Signed-off-by: Venkat Gopalakrishnan venk...@codeaurora.org
Tested-by: Ivan T. Ivanov iiva...@mm-sol.com
Signed-off-by: Georgi Djakov gdja...@mm-sol.com
---
 drivers/mmc/host/Kconfig |   13 ++
 drivers/mmc/host/Makefile|1 +
 drivers/mmc/host/sdhci-msm.c |  427 ++
 3 files changed, 441 insertions(+)
 create mode 100644 drivers/mmc/host/sdhci-msm.c

diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig
index 82cc34d..66ef8b9 100644
--- a/drivers/mmc/host/Kconfig
+++ b/drivers/mmc/host/Kconfig
@@ -334,6 +334,19 @@ config MMC_ATMELMCI
 
  If unsure, say N.
 
+config MMC_SDHCI_MSM
+   tristate Qualcomm SDHCI Controller Support
+   depends on ARCH_QCOM
+   depends on MMC_SDHCI_PLTFM
+   help
+ This selects the Secure Digital Host Controller Interface (SDHCI)
+ support present in Qualcomm SOCs. The controller supports
+ SD/MMC/SDIO devices.
+
+ If you have a controller with this interface, say Y or M here.
+
+ If unsure, say N.
+
 config MMC_MSM
tristate Qualcomm SDCC Controller Support
depends on MMC  (ARCH_MSM7X00A || ARCH_MSM7X30 || ARCH_QSD8X50)
diff --git a/drivers/mmc/host/Makefile b/drivers/mmc/host/Makefile
index f162f87a0..0c8aa5e 100644
--- a/drivers/mmc/host/Makefile
+++ b/drivers/mmc/host/Makefile
@@ -63,6 +63,7 @@ obj-$(CONFIG_MMC_SDHCI_OF_ESDHC)  += sdhci-of-esdhc.o
 obj-$(CONFIG_MMC_SDHCI_OF_HLWD)+= sdhci-of-hlwd.o
 obj-$(CONFIG_MMC_SDHCI_BCM_KONA)   += sdhci-bcm-kona.o
 obj-$(CONFIG_MMC_SDHCI_BCM2835)+= sdhci-bcm2835.o
+obj-$(CONFIG_MMC_SDHCI_MSM)+= sdhci-msm.o
 
 ifeq ($(CONFIG_CB710_DEBUG),y)
CFLAGS-cb710-mmc+= -DDEBUG
diff --git a/drivers/mmc/host/sdhci-msm.c b/drivers/mmc/host/sdhci-msm.c
new file mode 100644
index 000..46e4e0b
--- /dev/null
+++ b/drivers/mmc/host/sdhci-msm.c
@@ -0,0 +1,427 @@
+/*
+ * drivers/mmc/host/sdhci-msm.c - Qualcomm SDHCI Platform driver
+ *
+ * Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include linux/module.h
+#include linux/of_device.h
+#include linux/regulator/consumer.h
+#include linux/delay.h
+
+#include sdhci-pltfm.h
+
+#define CORE_HC_MODE   0x78
+#define HC_MODE_EN 0x1
+
+#define CORE_POWER 0x0
+#define CORE_SW_RSTBIT(7)
+
+#define CORE_PWRCTL_STATUS 0xdc
+#define CORE_PWRCTL_MASK   0xe0
+#define CORE_PWRCTL_CLEAR  0xe4
+#define CORE_PWRCTL_CTL0xe8
+
+#define CORE_PWRCTL_BUS_OFFBIT(0)
+#define CORE_PWRCTL_BUS_ON BIT(1)
+#define CORE_PWRCTL_IO_LOW BIT(2)
+#define CORE_PWRCTL_IO_HIGHBIT(3)
+
+#define CORE_PWRCTL_BUS_SUCCESSBIT(0)
+#define CORE_PWRCTL_BUS_FAIL   BIT(1)
+#define CORE_PWRCTL_IO_SUCCESS BIT(2)
+#define CORE_PWRCTL_IO_FAILBIT(3)
+
+#define INT_MASK   0xf
+
+#define QCOM_SDHCI_VOLTAGE_LOW 180
+#define QCOM_SDHCI_VOLTAGE_HIGH295
+
+
+struct sdhci_msm_pltfm_data {
+   u32 caps;   /* Supported UHS-I Modes */
+   u32 caps2;  /* More capabilities */
+   struct regulator *vdd;  /* VDD/VCC regulator */
+   struct regulator *vdd_io;   /* VDD IO regulator */
+};
+
+struct sdhci_msm_host {
+   struct platform_device *pdev;
+   void __iomem *core_mem; /* MSM SDCC mapped address */
+   int pwr_irq;/* power irq */
+   struct clk *clk;/* main SD/MMC bus clock */
+   struct clk *pclk;   /* SDHC peripheral bus clock */
+   struct clk *bus_clk;/* SDHC bus voter clock */
+   struct sdhci_msm_pltfm_data pdata;
+   struct mmc_host *mmc;
+   struct sdhci_pltfm_data sdhci_msm_pdata;
+};
+
+/* MSM platform specific tuning */
+int sdhci_msm_execute_tuning(struct sdhci_host *host, u32 opcode)
+{
+   /*
+* Tuning is required for SDR104, HS200 and HS400 cards and if the clock
+* frequency greater than 100MHz in those modes. The standard tuning
+* procedure should not be executed, but a custom implementation will be
+* added here instead.
+*/
+   return 0;
+}
+
+static int sdhci_msm_vreg_enable(struct device *dev, struct regulator *vreg)
+{
+   int 

[PATCH v2 2/2] usb: Make DELAY_INIT quirk wait 100ms between Get Configuration requests

2014-03-04 Thread Julius Werner
The DELAY_INIT quirk only reduces the frequency of enumeration failures
with the Logitech HD Pro C920 and C930e webcams, but does not quite
eliminate them. We have found that adding a delay of 100ms between the
first and second Get Configuration request makes the device enumerate
perfectly reliable even after several weeks of extensive testing. The
reasons for that are anyone's guess, but since the DELAY_INIT quirk
already delays enumeration by a whole second, wating for another 10th of
that isn't really a big deal for the one other device that uses it, and
it will resolve the problems with these webcams.

Signed-off-by: Julius Werner jwer...@chromium.org
---
 drivers/usb/core/config.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c
index 8d72f0c..062967c 100644
--- a/drivers/usb/core/config.c
+++ b/drivers/usb/core/config.c
@@ -717,6 +717,10 @@ int usb_get_configuration(struct usb_device *dev)
result = -ENOMEM;
goto err;
}
+
+   if (dev-quirks  USB_QUIRK_DELAY_INIT)
+   msleep(100);
+
result = usb_get_descriptor(dev, USB_DT_CONFIG, cfgno,
bigbuffer, length);
if (result  0) {
-- 
1.8.3.2

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v10 0/3] mmc: sdhci-msm: Add support for Qualcomm chipsets

2014-03-04 Thread Georgi Djakov
This patchset adds basic support of the Secure Digital Host Controller
Interface compliant controller found in Qualcomm SoCs.

Tested with eMMC and various micro SD cards on APQ8074 Dragonboard.
Applies to linux-next.

Changes from v9:
- Make platform_execute_tuning() static (suggested by Josh Cartwright) 
- Fix buffer size in platform_execute_tuning() (suggested by Josh Cartwright)
- Fix typo in patch subject (suggested by Kumar Gala)
- Move voltage ranges from DT to the driver (suggested by Bjorn Andersson)
- Simplify sdhci_msm_setup_vreg and irq handler (suggested by Bjorn Andersson)
- Disable prw irq in sdhci_msm_remove (suggested by Bjorn Andersson)
- Fail on peripheral clock errors (suggested by Bjorn Andersson)
- Remove unnecessary core_memres assignment (suggested by Bjorn Andersson)
- Fixes on freeing resources in probe() (suggested by Bjorn Andersson)

Changes from v8:
- Added controller version suffix to the DT compatible string.
- Switched Kconfig dependency from ARCH_MSM to the new ARCH_QCOM multiplatform.
- Addressed comments from Stephen Boyd on the 3rd patch (execute tunning).
- Added signed-off-by lines of the initial driver authors.
- Picked up tested-by. https://lkml.org/lkml/2013/11/14/85
- Minor changes on comments, prints and formatting.

Changes from v7:
- Added call to sdhci_get_of_property().
- Refactored sdhci_msm_dt_parse_vreg_info().
- Fixed possible ERR_PTR() dereferencing.
- Updated DT binding documentation.
- Removed lpm and currents from DT.
- Removed bus-speed-mode from DT.
- Updated and moved the sanity checks.
- Various typo and coding style fixes.
- Added platform_execute_tunning implementation.

Changes from v6:
- Fixed wrong pointer in sdhci_msm_pwr_irq().
- Added platform_execute_tuning() callback as the MSM SDHC does not
  support tuning as in SDHC 3.0 spec and will need custom implementation
  in order to support SDR104, HS200 and HS400.
- Removed the always-on devicetree property - if the regulator is
  configured as always-on, it will not be disabled anyway.
- Removed devm_pinctrl_get_select_default() - the default pins are 
  already set from the device core.
- Removed wrapper function sdhci_msm_set_vdd_io_vol() and enum
  vdd_io_level and now calling regulator_set_voltage() directly.
- Converted #defines to use BIT() macro.
- Added IS_ERR(vreg-reg) check at the beginning of sdhci_msm_vreg
  functions.
- Do not print errors when regulators init return -EPROBE_DEFER as the
  deffered init is not an actual error.
- Handle each power irq status bit separately in sdhci_msm_pwr_irq().
- Ensure that any pending power irq is acknowledged before enabling it,
  otherwise the irq handler will be fired prematurely.
- Minor changes.

Changes from v5:
- Driver is split into multiple patches
- Do not initialize variables that are assigned later in code
- Remove some useless comments
- Use shorter variable names
- Change pr_err() to dev_err()
- Optimized sdhci_msm_setup_vreg()
- Some code alignment fixes
- Improved DT values sanity check
- Added dev_dbg print for sdhci controller version in probe()
- Added usleep_range() after SW reset - it can take some time
- Added SDHCI_QUIRK_SINGLE_POWER_WRITE - power handled by PMIC
- Renamed DT property vdd-io to vddio

Changes from v4:
- Simplified sdhci_msm_vreg_disable() and sdhci_msm_set_vdd_io_vol()
- Use devm_ioremap_resource() instead of devm_ioremap()
- Converted IS_ERR_OR_NULL to IS_ERR
- Disable regulators in sdhci_msm_remove()
- Check for DT node at the beginning in sdhci_msm_probe()
- Removed more redundant code
- Changes in some error messages
- Minor fixes

Changes from v3:
- Allocate memory for all required structs at once
- Added termination entry in sdhci_msm_dt_match[]
- Fixed a missing sdhci_pltfm_free() in probe()
- Removed redundant of_match_ptr
- Removed the unneeded function sdhci_msm_vreg_reset()

Changes from v2:
- Added DT bindings for clocks
- Moved voltage regulators data to platform data
- Removed unneeded includes
- Removed obsolete and wrapper functions
- Removed error checking where unnecessary
- Removed redundant _clk suffix from clock names
- Just return instead of goto where possible
- Minor fixes

Georgi Djakov (3):
  mmc: sdhci-msm: Qualcomm SDHCI binding documentation
  mmc: sdhci-msm: Initial support for Qualcomm chipsets
  mmc: sdhci-msm: Add platform_execute_tuning implementation

 .../devicetree/bindings/mmc/sdhci-msm.txt  |   63 ++
 drivers/mmc/host/Kconfig   |   13 +
 drivers/mmc/host/Makefile  |1 +
 drivers/mmc/host/sdhci-msm.c   |  838 
 4 files changed, 915 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mmc/sdhci-msm.txt
 create mode 100644 drivers/mmc/host/sdhci-msm.c

-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Re: Making a universal list of syscalls?

2014-03-04 Thread H. Peter Anvin
On 02/27/2014 12:40 PM, Andy Lutomirski wrote:
 Currently, dealing with Linux syscalls in an architecture-independent
 way is a mess.  Here are some issues:
 
  1. There's no clean way to map between syscall names and numbers on
 different architectures.  The kernel contains a number of tables (that
 work differently for different architectures).  strace has some arcane
 mechanism.  libseccomp has another.
 
  2. There's no clean way to map between syscall argument registers and
 logical syscall arguments.  Each architecture knows how to do it, as
 do strace and glibc, but I suspect that *everyone* else gets it wrong.
  Especially on ARM.
 
  3. Determining which architectures have which syscalls is a mess.
 Recent kernel builds love to warn me that finit_module is missing on
 x86_64.  This is simply not true.  I have no idea why.
 
  4. Actually issuing a nontrivial syscall is annoying.  syscall(2) can
 do it for the native architecture (only).
 
  5. Decoding ucontext from SIGSYS is a mess.  I have prototype code
 for libseccomp that can do it, but it gets the arguments wrong due to
 ABI issues.  See (2).
 
 I'd like to see a master list in the kernel that lists, for every
 syscall, the name, the number for each architecture that implements it
 (using the AUDIT_ARCH semantics, probably), and the signature.  The
 build process could parse this table to replace the current per-arch
 mess.
 

Hi Andy,

I have brought that up a lot of times, originally dating back from my
work on klibc.  I have tried to keep the klibc syscall list in a sane
format with architecture annotations, but it doesn't contain all the
syscalls in the system.

Extending that work and making it encompass everything the kernel
exports would be highly useful, but it would take a lot of work.

-hpa


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] staging: usbip: userspace: don't throw error when trying to read configuration specific attributes

2014-03-04 Thread Valentina Manea
When a device has just been bound to usbip-host but the client hasn't
set a configuration on it, certain attributes will not exist. Don't
treat this as an error.

Signed-off-by: Valentina Manea valentina.mane...@gmail.com
---
 drivers/staging/usbip/userspace/libsrc/usbip_common.c | 17 +++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/usbip/userspace/libsrc/usbip_common.c 
b/drivers/staging/usbip/userspace/libsrc/usbip_common.c
index 8d675a9..ac32a36 100644
--- a/drivers/staging/usbip/userspace/libsrc/usbip_common.c
+++ b/drivers/staging/usbip/userspace/libsrc/usbip_common.c
@@ -127,10 +127,23 @@ int read_attr_value(struct udev_device *dev, const char 
*name,
goto err;
}
 
+   /* The client chooses the device configuration
+* when attaching it so right after being bound
+* to usbip-host on the server the device will
+* have no configuration.
+* Therefore, attributes such as bConfigurationValue
+* and bNumInterfaces will not exist and sscanf will
+* fail. Check for these cases and don't treat them
+* as errors.
+*/
+
ret = sscanf(attr, format, num);
if (ret  1) {
-   dbg(sscanf failed);
-   goto err;
+   if (strcmp(name, bConfigurationValue) 
+   strcmp(name, bNumInterfaces)) {
+   dbg(sscanf failed);
+   goto err;
+   }
}
 
 err:
-- 
1.8.1.2

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] staging: usbip: userspace: add hwdata as optional dependency in README

2014-03-04 Thread Valentina Manea
This is an optional dependency since USB/IP can fully work without
it. However, it is needed to display device information such as
vendor.

Signed-off-by: Valentina Manea valentina.mane...@gmail.com
---
 drivers/staging/usbip/userspace/README | 4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/staging/usbip/userspace/README 
b/drivers/staging/usbip/userspace/README
index 6ead290..f528ba4 100644
--- a/drivers/staging/usbip/userspace/README
+++ b/drivers/staging/usbip/userspace/README
@@ -19,6 +19,10 @@
 
 - libtool, automake = 1.9, autoconf = 2.5.0, pkg-config
 
+[Optional]
+- hwdata
+Contains USB device identification data.
+
 
 [Install]
 0. Generate configuration scripts.
-- 
1.8.1.2

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


RE: [PATCH net-next] hyperv: Move state setting for link query

2014-03-04 Thread Haiyang Zhang


 -Original Message-
 From: Jason Wang [mailto:jasow...@redhat.com]
 Sent: Monday, March 3, 2014 10:10 PM
 To: Haiyang Zhang; da...@davemloft.net; net...@vger.kernel.org
 Cc: KY Srinivasan; o...@aepfle.de; linux-kernel@vger.kernel.org; driverdev-
 de...@linuxdriverproject.org
 Subject: Re: [PATCH net-next] hyperv: Move state setting for link query
 
 On 03/04/2014 07:54 AM, Haiyang Zhang wrote:
  It moves the state setting for query into rndis_filter_receive_response().
  All callbacks including query-complete and status-callback are
  synchronized by channel-inbound_lock. This prevents pentential race
 between them.
 
 This still looks racy to me. The problem is workqueue is not synchronized with
 those here.
 
 Consider the following case in netvsc_link_change():
 
 if (rdev-link_state) {
 ... receive interrupt ...
 rndis_filter_receice_response() which changes rdev-link_state
 ...
 netif_carrier_off()
 }
 
 And also it need to schedule a work otherwise the link status is out of sync.

I will update this patch to schedule a work by the end of probe function.

Thanks,
- Haiyang

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH RFC 3/6] tty: Rename xilinx_uart - cadence_uart

2014-03-04 Thread One Thousand Gnomes
On Tue,  4 Mar 2014 09:17:26 -0800
Soren Brinkmann soren.brinkm...@xilinx.com wrote:

 The UART controller in Zynq is Cadence IP. Rename the driver
 accordingly.
 Furthermore, this affects the DT bindings:
  - the compatibility string changes to 'cdns,uart-r1p8'
  - clock inputs are named according to Cadence documentation - 'pclk'
and 'uart_clk'
 
 Signed-off-by: Soren Brinkmann soren.brinkm...@xilinx.com
 Acked-by: Peter Crosthwaite peter.crosthwa...@xilinx.com

NAK. This breaks existing userspace builds, it breaks modules, it messes
with the history and it breaks third prty DT files. It's an absolute
no-no.

Yes this happens - it's happened before and will happen again. She who
merges first wins. If Cadence had submitted a driver first they'd have
won 8)

The following aspects of the change set are IMHO acceptable

- Cleaning up all the code formatting
- Update the driver comments and header to explain the Cadence/Xilinx
  thing
- change Xilinx PS UART Support text to Cadence (Xilinx PS) Support
  or similar wording in Kconfig
- Adding the cadence devicetree compatibility strings and inputs *in
  addition* to the existing ones.
- Documentation for the new options

Alan
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] staging: usbip: claim ports used by shared devices

2014-03-04 Thread Alan Stern
On Tue, 4 Mar 2014, Valentina Manea wrote:

 diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
 index 90e18f6..a91dc1f 100644
 --- a/drivers/usb/core/devio.c
 +++ b/drivers/usb/core/devio.c
 @@ -62,23 +62,6 @@
  /* Mutual exclusion for removal, open, and release */
  DEFINE_MUTEX(usbfs_mutex);
  
 -struct dev_state {
 - struct list_head list;  /* state list */
 - struct usb_device *dev;
 - struct file *file;
 - spinlock_t lock;/* protects the async urb lists */
 - struct list_head async_pending;
 - struct list_head async_completed;
 - wait_queue_head_t wait; /* wake up if a request completed */
 - unsigned int discsignr;
 - struct pid *disc_pid;
 - const struct cred *cred;
 - void __user *disccontext;
 - unsigned long ifclaimed;
 - u32 secid;
 - u32 disabled_bulk_eps;
 -};
 -

Don't remove this definition.

 diff --git a/include/linux/usb.h b/include/linux/usb.h
 index 22de4af..e0843a4 100644
 --- a/include/linux/usb.h
 +++ b/include/linux/usb.h
 @@ -366,6 +366,24 @@ struct usb_bus {
  #endif
  };
  
 +struct dev_state {
 + struct list_head list;  /* state list */
 + struct usb_device *dev;
 + struct file *file;
 + spinlock_t lock;/* protects the async urb lists */
 + struct list_head async_pending;
 + struct list_head async_completed;
 + wait_queue_head_t wait; /* wake up if a request completed */
 + unsigned int discsignr;
 + struct pid *disc_pid;
 + const struct cred *cred;
 + void __user *disccontext;
 + unsigned long ifclaimed;
 + u32 secid;
 + u32 disabled_bulk_eps;
 +};

And don't put this here.  Instead, just put

struct dev_state;

Alan Stern

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Stable backport of cifs nlink workaround?

2014-03-04 Thread Greg Kroah-Hartman
On Tue, Feb 25, 2014 at 09:43:06AM -0800, Jeff Layton wrote:
 On Tue, 25 Feb 2014 08:11:56 -0800
 Greg Kroah-Hartman gre...@linuxfoundation.org wrote:
 
  On Tue, Feb 25, 2014 at 03:24:43PM +, Sitsofe Wheeler wrote:
   Hi,
   
   Is there any chance that 74d290da476f672ad756634d12aa707375d3564d
   ([CIFS] Provide sane values for nlink) could be backported to the stable
   3.2 kernel?
  
  Why just 3.2?  What's wrong with all of the other kernels before 3.12
  that do not have this patch in it?
  
  thanks,
  
  greg k-h
 
 Yeah, you'd probably need to apply it to every stable kernel  3.2 or
 you'd technically have a regression. I've no real objection to putting
 that fix in, but backporting to older kernels may not be trivial. There
 have been other changes in this area over the years...

It doesn't apply to 3.10 or 3.4-stable trees, so I'll wait for someone
to provide a working backport before I can commit it.

thanks,

greg k-h
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] cgroup: missing rcu read lock around task_css_set

2014-03-04 Thread Tejun Heo
On Tue, Mar 04, 2014 at 12:20:45PM -0500, Sasha Levin wrote:
 Hrm... there is a PF_EXITING check there already:
 
  #define task_css_set_check(task, __c)\
  rcu_dereference_check((task)-cgroups,\
  lockdep_is_held(cgroup_mutex) ||\
  lockdep_is_held(css_set_rwsem) ||\
  ((task)-flags  PF_EXITING) || (__c))
 
 I see it's not happening on Linus's master so I'll run a bisection to figure 
 out what broke it.
 
 Hi Tejun,
 
 It bisects down to your patch: cgroup: drop task_lock() protection
 around task-cgroups. I'll look into it later unless it's obvious
 to you.

Hmmm... maybe I'm confused and PF_EXITING is not set there and
task_lock was what held off the lockdep warning.  Confused

Thanks.

-- 
tejun
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2] usb: gadget: return the right length in ffs_epfile_io()

2014-03-04 Thread Michal Nazarewicz
 On 03/04/2014 10:34 AM, Chuansheng Liu wrote:
 @@ -845,12 +845,14 @@ static ssize_t ffs_epfile_io(struct file *file, 
 struct ffs_io_data *io_data)
  * we may end up with more data then user space has
  * space for.
  */
 -   ret = ep-status;
 -   if (io_data-read  ret  0 
 -   unlikely(copy_to_user(io_data-buf, data,
 - min_t(size_t, ret,
 - io_data-len
 -   ret = -EFAULT;
 +   ret = ep-status;

On Tue, Mar 04 2014, Felipe Balbi wrote:
Why the indentation jumped suddenly to the right?

 On Tue, Mar 04, 2014 at 08:01:15PM +0300, Sergei Shtylyov wrote:
 because it was wrong before ;-)

Yep.  It looks like Robert's [2e4c7553: add aio support] introduced an
if-else-if-else flow but did not indent the code and I didn't caught it
when reviewing that patch.

-- 
Best regards, _ _
.o. | Liege of Serenely Enlightened Majesty of  o' \,=./ `o
..o | Computer Science,  Michał “mina86” Nazarewicz(o o)
ooo +--m...@google.com--xmpp:min...@jabber.org--ooO--(_)--Ooo--


signature.asc
Description: PGP signature


Re: [PATCH][RESEND 3] hwrng: add randomness to system from rng sources

2014-03-04 Thread Jason Cooper
On Tue, Mar 04, 2014 at 11:01:49AM -0800, Kees Cook wrote:
 On Tue, Mar 4, 2014 at 7:38 AM, Jason Cooper ja...@lakedaemon.net wrote:
  Kees, Ted,
 
  On Mon, Mar 03, 2014 at 03:51:48PM -0800, Kees Cook wrote:
  When bringing a new RNG source online, it seems like it would make sense
  to use some of its bytes to make the system entropy pool more random,
  as done with all sorts of other devices that contain per-device or
  per-boot differences.
 
  Why is this necessary?  init_std_data() already calls
  arch_get_random_long() while stirring each of the pools.
 
 I may be misunderstanding something here, but hwrng isn't going to get
 hit by a arch_get_random_long(). 

ahh, you are correct.  It appears it's only used on x86 and powerpc.
Bad assumption on my part.

 That's just for arch-specific RNGs (e.g. RDRAND), where as hwrng is
 for, effectively, add-on devices (e.g. TPMs).
 
  I'm a little concerned here because this gives potentially untrusted
  hwrngs more influence over the entropy pools initial state than most
  users of random.c expect.  Many of the drivers in hw_random/ are
  platform drivers and are initialized before random.c.
 
  I'm comfortable with the design decisions Ted has made wrt random.c and
  hwrngs.  However, I think that this changes that trust relationship in a
  fundamental way.  I'm ok with building support into my kernels for
  hwrngs as long as random.c's internal use of them is limited to the
  mixing in extract_buf() and init_std_data().
 
  By adding this patch, even without crediting entropy to the pool, a
  rogue hwrng now has significantly more influence over the initial state
  of the entropy pools.  Or, am I missing something?
 
 I wasn't viewing this as dealing with rouge hwrngs (though shouldn't
 that state still be covered due to the existing mixing), but more as a
 hey this thing has some randomness associated with it, similar to
 the mixing done for things like NIC MAC, etc. (Better, actually, since
 NIC MAC is going to be the same every boot.) It seemed silly to ignore
 an actual entropy source when seeding.

Agreed, but I think we need to be careful about how random.c interacts
with any hwrng.  Ideally, the drivers in hw_random/ could provide
arch_get_random_long().  This way, random.c still determines when and
how to use the hwrng.

Ultimately, the user (person compiling the kernel) will decide to trust
or not trust the hwrng by enabling support for it or not.  My concern
with this patch is that it changes the magnitude of that trust decision.
And only the most diligent user would discover the change.

To date, all discussion wrt random.c and hwrngs are that the output of
the hwrng (in particular, RDRAND) is XORd with the output of the mixer.
Now, we're saying it can provide input as well.  

Please understand, my point-of-view is as someone who installs Linux on
equipment *after* purchase (hobbyist, tinkers).  If I control the part
selection and sourcing of the board components, of course I have more
trust in the hwrng.

So my situation is similar to buying an Intel based laptop.  I can't do
a special order at Bestbuy and ask for a system without the RDRAND
instruction.  Same with the hobbyist market.  We buy the gear, but we
have no control over what's inside it.

In that situation, without this patch, I would enable the hwrng for the
board.  With the patch in it's current form, I would start looking for
research papers and discussions regarding using the hwrng for input.  If
the patch provided arch_get_random_long(), I would feel comfortable
enabling the hwrng.

Perhaps I'm being too conservative, but I'd rather have the discussion
now and have concerns proven unfounded than have someone say How the
hell did this happen? three releases down the road.

thx,

Jason.


  Signed-off-by: Kees Cook keesc...@chromium.org
  ---
   drivers/char/hw_random/core.c |7 +++
   1 file changed, 7 insertions(+)
 
  diff --git a/drivers/char/hw_random/core.c b/drivers/char/hw_random/core.c
  index a0f7724852eb..6e5bb68a708c 100644
  --- a/drivers/char/hw_random/core.c
  +++ b/drivers/char/hw_random/core.c
  @@ -41,6 +41,7 @@
   #include linux/miscdevice.h
   #include linux/delay.h
   #include linux/slab.h
  +#include linux/random.h
   #include asm/uaccess.h
 
 
  @@ -305,6 +306,8 @@ int hwrng_register(struct hwrng *rng)
int must_register_misc;
int err = -EINVAL;
struct hwrng *old_rng, *tmp;
  + unsigned char bytes[16];
  + int bytes_read;
 
if (rng-name == NULL ||
(rng-data_read == NULL  rng-read == NULL))
  @@ -348,6 +351,10 @@ int hwrng_register(struct hwrng *rng)
}
INIT_LIST_HEAD(rng-list);
list_add_tail(rng-list, rng_list);
  +
  + bytes_read = rng_get_data(rng, bytes, sizeof(bytes), 1);
  + if (bytes_read  0)
  + add_device_randomness(bytes, bytes_read);
   out_unlock:
mutex_unlock(rng_mutex);
   out:
  --
  1.7.9.5
 
 
  --
  Kees Cook
  Chrome OS Security
  --

Re: [PATCH v2] usb: gadget: return the right length in ffs_epfile_io()

2014-03-04 Thread Felipe Balbi
On Tue, Mar 04, 2014 at 08:53:40PM +0100, Michal Nazarewicz wrote:
  On 03/04/2014 10:34 AM, Chuansheng Liu wrote:
  @@ -845,12 +845,14 @@ static ssize_t ffs_epfile_io(struct file *file, 
  struct ffs_io_data *io_data)
 * we may end up with more data then user space 
   has
 * space for.
 */
  - ret = ep-status;
  - if (io_data-read  ret  0 
  - unlikely(copy_to_user(io_data-buf, data,
  -   min_t(size_t, ret,
  -   io_data-len
  - ret = -EFAULT;
  + ret = ep-status;
 
 On Tue, Mar 04 2014, Felipe Balbi wrote:
 Why the indentation jumped suddenly to the right?
 
  On Tue, Mar 04, 2014 at 08:01:15PM +0300, Sergei Shtylyov wrote:
  because it was wrong before ;-)
 
 Yep.  It looks like Robert's [2e4c7553: add aio support] introduced an
 if-else-if-else flow but did not indent the code and I didn't caught it
 when reviewing that patch.

it's in my testing/next now, I also fixed the comment indentation which
was also wrong.

-- 
balbi


signature.asc
Description: Digital signature


Re: [PATCH][RESEND 3] hwrng: add randomness to system from rng sources

2014-03-04 Thread Kees Cook
On Tue, Mar 4, 2014 at 11:53 AM, Jason Cooper ja...@lakedaemon.net wrote:
 On Tue, Mar 04, 2014 at 11:01:49AM -0800, Kees Cook wrote:
 On Tue, Mar 4, 2014 at 7:38 AM, Jason Cooper ja...@lakedaemon.net wrote:
  Kees, Ted,
 
  On Mon, Mar 03, 2014 at 03:51:48PM -0800, Kees Cook wrote:
  When bringing a new RNG source online, it seems like it would make sense
  to use some of its bytes to make the system entropy pool more random,
  as done with all sorts of other devices that contain per-device or
  per-boot differences.
 
  Why is this necessary?  init_std_data() already calls
  arch_get_random_long() while stirring each of the pools.

 I may be misunderstanding something here, but hwrng isn't going to get
 hit by a arch_get_random_long().

 ahh, you are correct.  It appears it's only used on x86 and powerpc.
 Bad assumption on my part.

 That's just for arch-specific RNGs (e.g. RDRAND), where as hwrng is
 for, effectively, add-on devices (e.g. TPMs).

  I'm a little concerned here because this gives potentially untrusted
  hwrngs more influence over the entropy pools initial state than most
  users of random.c expect.  Many of the drivers in hw_random/ are
  platform drivers and are initialized before random.c.
 
  I'm comfortable with the design decisions Ted has made wrt random.c and
  hwrngs.  However, I think that this changes that trust relationship in a
  fundamental way.  I'm ok with building support into my kernels for
  hwrngs as long as random.c's internal use of them is limited to the
  mixing in extract_buf() and init_std_data().
 
  By adding this patch, even without crediting entropy to the pool, a
  rogue hwrng now has significantly more influence over the initial state
  of the entropy pools.  Or, am I missing something?

 I wasn't viewing this as dealing with rouge hwrngs (though shouldn't
 that state still be covered due to the existing mixing), but more as a
 hey this thing has some randomness associated with it, similar to
 the mixing done for things like NIC MAC, etc. (Better, actually, since
 NIC MAC is going to be the same every boot.) It seemed silly to ignore
 an actual entropy source when seeding.

 Agreed, but I think we need to be careful about how random.c interacts
 with any hwrng.  Ideally, the drivers in hw_random/ could provide
 arch_get_random_long().  This way, random.c still determines when and
 how to use the hwrng.

 Ultimately, the user (person compiling the kernel) will decide to trust
 or not trust the hwrng by enabling support for it or not.  My concern
 with this patch is that it changes the magnitude of that trust decision.
 And only the most diligent user would discover the change.

 To date, all discussion wrt random.c and hwrngs are that the output of
 the hwrng (in particular, RDRAND) is XORd with the output of the mixer.
 Now, we're saying it can provide input as well.

Well, I think there's confusion here over the hwrng and a hwrng. I
have devices with multiple entropy sources, and all my hwrngs are
built as modules, so I choose when to load them into my kernel. The
arch-specific entropy source (e.g. RDRAND) is very different.


 Please understand, my point-of-view is as someone who installs Linux on
 equipment *after* purchase (hobbyist, tinkers).  If I control the part
 selection and sourcing of the board components, of course I have more
 trust in the hwrng.

 So my situation is similar to buying an Intel based laptop.  I can't do
 a special order at Bestbuy and ask for a system without the RDRAND
 instruction.  Same with the hobbyist market.  We buy the gear, but we
 have no control over what's inside it.

 In that situation, without this patch, I would enable the hwrng for the
 board.  With the patch in it's current form, I would start looking for
 research papers and discussions regarding using the hwrng for input.  If
 the patch provided arch_get_random_long(), I would feel comfortable
 enabling the hwrng.

 Perhaps I'm being too conservative, but I'd rather have the discussion
 now and have concerns proven unfounded than have someone say How the
 hell did this happen? three releases down the road.

Sure, and I don't want to be the one weakening the entropy pool.
However, I think this patch is no different from the ones that stuff a
NIC MAC into the pool -- it's taking something from my system that is
unique or random and pushing the entropy seed around. It seems silly
that if I've loaded the hwrng-tpm module, my system entropy pool isn't
bumped.

-Kees


 thx,

 Jason.


  Signed-off-by: Kees Cook keesc...@chromium.org
  ---
   drivers/char/hw_random/core.c |7 +++
   1 file changed, 7 insertions(+)
 
  diff --git a/drivers/char/hw_random/core.c b/drivers/char/hw_random/core.c
  index a0f7724852eb..6e5bb68a708c 100644
  --- a/drivers/char/hw_random/core.c
  +++ b/drivers/char/hw_random/core.c
  @@ -41,6 +41,7 @@
   #include linux/miscdevice.h
   #include linux/delay.h
   #include linux/slab.h
  +#include linux/random.h
   #include 

Re: [RFC] [PATCH] Pre-emption control for userspace

2014-03-04 Thread Oleg Nesterov
On 03/04, Khalid Aziz wrote:

 On 03/04/2014 06:56 AM, Oleg Nesterov wrote:
 Hmm. In fact I think do_exit() should crash after munmap? -mmap_state
 should be NULL ?? Perhaps I misread this patch completely...

 do_exit() unmaps mmap_state-uaddr, and frees up mmap_state-kaddr and
 mmap_state. mmap_state should not be NULL after unmap.

Can't understand... do_exit() does:

+#if CONFIG_SCHED_PREEMPT_DELAY
+   if (tsk-sched_preempt_delay.mmap_state) {
+   sys_munmap((unsigned long)
+   tsk-sched_preempt_delay.mmap_state-uaddr, 
PAGE_SIZE);
+   vfree(tsk-sched_preempt_delay.mmap_state-kaddr);
+   kfree(tsk-sched_preempt_delay.mmap_state);

sys_munmap() (which btw should not be used) obviously unmaps that
vma and vma_ops()-close() should be called.

close_preempt_delay_vmops() does:

state-task-sched_preempt_delay.mmap_state = NULL;

vfree(tsk-sched_preempt_delay.mmap_state-kaddr) above will try to
dereference .mmap_state == NULL.

IOW, I think that with this patch this trivial program

int main(void)
{
fd = open(/proc/self/task/$TID/sched_preempt_delay, O_RDWR);
mmap(NULL, 4096, PROT_READ,MAP_SHARED, fd, 0);
return 0;
}

should crash the kernel.

 +   if (current-sched_preempt_delay.mmap_state != NULL) {
 +   retval = -EEXIST;
 +   goto error;

 This assumes that we are going to setup 
 current-sched_preempt_delay.mmap_state,
 but what if the task opens /proc/random_tid/sched_preempt_delay ?

 Good point. A thread should not be allowed to request preemption delay
 for another thread. I would recommend leaving this code alone and adding
 following code before this:

 if (get_proc_task(inode) != current) {
   retval = -EPERM;
   goto error;
 }

 Sounds reasonable?

Yes, we should check == current, but this interface looks strange anyway, imho.

 +   state-page = page;
 +   state-kaddr = kaddr;
 +   state-uaddr = (void *)vma-vm_start;

 This is used by do_exit(). But -vm_start can be changed by mremap() ?


 Hmm. And mremap() can do vm_ops-close() too. But the new vma will
 have the same vm_ops/vm_private_data, so exit_mmap() will try to do
 this again... Perhaps I missed something, but I bet this all can't be
 right.

 Would you say sys_munmap() of mmap_state-uaddr is not even needed since
 exit_mm() will do this any way further down in do_exit()?

No.

I meant:

1. mremap() can move this vma, so do_exit() can't trust -uaddr

2. Even worse, mremap() itself is not safe. It can do -close()
   too and create the new vma with the same vm_ops. Another
   unmap from (say) exit_mm() won't be happy.

 +   vma-vm_flags |= VM_DONTCOPY | VM_DONTEXPAND | VM_SHARED | VM_WRITE;

 This probably also needs VM_IO, to protect from madvise(MADV_DOFORK).

 Yes, you are right. I will add that.

 VM_SHARED/VM_WRITE doesn't look right.

 VM_SHARED is wrong but VM_WRITE is needed I think since the thread will
 write to the mmap'd page to signal to request preemption delay.

But -mmap() should not set VM_WRITE if application does mmap(PROT_READ) ?
VM_WRITE-or-not should be decided by do_mmap_pgoff/mprotect, -mmap()
should not play with this bit.

Oleg.

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] bridge: multicast: add sanity check for query source addresses

2014-03-04 Thread Hannes Frederic Sowa
On Tue, Mar 04, 2014 at 11:43:55AM +0100, Linus Lüssing wrote:
 On Tue, Mar 04, 2014 at 10:06:14AM +0100, Hannes Frederic Sowa wrote:
   diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c
   index ef66365..fb0e36f 100644
   --- a/net/bridge/br_multicast.c
   +++ b/net/bridge/br_multicast.c
   @@ -1235,6 +1235,12 @@ static int br_ip6_multicast_query(struct 
   net_bridge *br,
 (port  port-state == BR_STATE_DISABLED))
 goto out;

   + /* RFC2710+RFC3810 (MLDv1+MLDv2) require link-local source addresses */
   + if (!(ipv6_addr_type(ip6h-saddr)  IPV6_ADDR_LINKLOCAL)) {
   + err = -EINVAL;
   + goto out;
   + }
   +
  
  Shouldn't we allow empty source address, here?
  
  Routers are supposed to drop them but bridges care. Linux uses ::
  as source address as long as no valid LL addresses are available,
  e.g. at boot-up (RFC3810 5.2.13.).
 
 RFC3810, 5.2.13. refers to MLD reports, not queries, so that
 shouldn't be relevant, section 5.1.14 should apply. Also the
 bridge code only issues queries with a valid link-local source
 address (see br_ip6_multicast_alloc_query() in
 net/bridge/br_multicast.c). Where does Linux use :: for queries?

Sorry, I confused queries with reports.
Your patch looks good, same check as in igmp6_event_query.

Reviewed-by: Hannes Frederic Sowa han...@stressinduktion.org

Bye,

  Hannes

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Update of file offset on write() etc. is non-atomic with I/O

2014-03-04 Thread Al Viro
On Tue, Mar 04, 2014 at 01:05:17AM +, Al Viro wrote:

 It's probably not worth replacing struct fd with typedef to unsigned long -
 too easy to have it confused with a file descriptor itself and pass to
 something that expects e.g. int.  In any case, since we leave fdget()
 inlined, compiler will see the unsigned long it's been initialized with,
 so if it decides that it's cheaper to replace f.file with v  ~3 through
 the whole thing, keep v around and discard local struct fd completely,
 it'll be able to do so just fine...
 
 I'll play around with cross-builds a bit and see what falls out of all
 that.

OK, with the attached set (the first one is essentially unchanged from
your first one), it seems to work and produce better code on all targets
I've tried.  Comments?

I've also pushed those (on top of old ocfs2 fix) into vfs.git#for-linus,
if you prefer to read it that way.  Should propagate in a few...
From 61660f7691b301dce7ed2d995d9e95ca4353e51d Mon Sep 17 00:00:00 2001
From: Linus Torvalds torva...@linux-foundation.org
Date: Mon, 3 Mar 2014 09:36:58 -0800
Subject: [PATCH 1/3] vfs: atomic f_pos accesses as per POSIX

Our write() system call has always been atomic in the sense that you get
the expected thread-safe contiguous write, but we haven't actually
guaranteed that concurrent writes are serialized wrt f_pos accesses, so
threads (or processes) that share a file descriptor and use write()
concurrently would quite likely overwrite each others data.

This violates POSIX.1-2008/SUSv4 Section XSI 2.9.7 that says:

 2.9.7 Thread Interactions with Regular File Operations

  All of the following functions shall be atomic with respect to each
  other in the effects specified in POSIX.1-2008 when they operate on
  regular files or symbolic links: [...]

and one of the effects is the file position update.

This unprotected file position behavior is not new behavior, and nobody
has ever cared.  Until now.  Yongzhi Pan reported unexpected behavior to
Michael Kerrisk that was due to this.

This resolves the issue with a f_pos-specific lock that is taken by
read/write/lseek on file descriptors that may be shared across threads
or processes.

Reported-by: Yongzhi Pan panyong...@gmail.com
Reported-by: Michael Kerrisk mtk.manpa...@gmail.com
Cc: Al Viro v...@zeniv.linux.org.uk
Signed-off-by: Linus Torvalds torva...@linux-foundation.org
Signed-off-by: Al Viro v...@zeniv.linux.org.uk
---
 fs/file_table.c  |1 +
 fs/namei.c   |2 +-
 fs/open.c|4 
 fs/read_write.c  |   54 +-
 include/linux/file.h |6 --
 include/linux/fs.h   |6 +-
 6 files changed, 55 insertions(+), 18 deletions(-)

diff --git a/fs/file_table.c b/fs/file_table.c
index 5fff903..5b24008 100644
--- a/fs/file_table.c
+++ b/fs/file_table.c
@@ -135,6 +135,7 @@ struct file *get_empty_filp(void)
atomic_long_set(f-f_count, 1);
rwlock_init(f-f_owner.lock);
spin_lock_init(f-f_lock);
+   mutex_init(f-f_pos_lock);
eventpoll_init_file(f);
/* f-f_version: 0 */
return f;
diff --git a/fs/namei.c b/fs/namei.c
index 385f781..2f730ef 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1884,7 +1884,7 @@ static int path_init(int dfd, const char *name, unsigned 
int flags,
 
nd-path = f.file-f_path;
if (flags  LOOKUP_RCU) {
-   if (f.need_put)
+   if (f.flags  FDPUT_FPUT)
*fp = f.file;
nd-seq = 
__read_seqcount_begin(nd-path.dentry-d_seq);
rcu_read_lock();
diff --git a/fs/open.c b/fs/open.c
index 4b3e1ed..b9ed8b2 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -705,6 +705,10 @@ static int do_dentry_open(struct file *f,
return 0;
}
 
+   /* POSIX.1-2008/SUSv4 Section XSI 2.9.7 */
+   if (S_ISREG(inode-i_mode))
+   f-f_mode |= FMODE_ATOMIC_POS;
+
f-f_op = fops_get(inode-i_fop);
if (unlikely(WARN_ON(!f-f_op))) {
error = -ENODEV;
diff --git a/fs/read_write.c b/fs/read_write.c
index edc5746..932bb34 100644
--- a/fs/read_write.c
+++ b/fs/read_write.c
@@ -264,10 +264,36 @@ loff_t vfs_llseek(struct file *file, loff_t offset, int 
whence)
 }
 EXPORT_SYMBOL(vfs_llseek);
 
+/*
+ * We only lock f_pos if we have threads or if the file might be
+ * shared with another process. In both cases we'll have an elevated
+ * file count (done either by fdget() or by fork()).
+ */
+static inline struct fd fdget_pos(int fd)
+{
+   struct fd f = fdget(fd);
+   struct file *file = f.file;
+
+   if (file  (file-f_mode  FMODE_ATOMIC_POS)) {
+   if (file_count(file)  1) {
+   f.flags |= FDPUT_POS_UNLOCK;
+   mutex_lock(file-f_pos_lock);
+   }
+   }
+   return f;
+}
+
+static inline void fdput_pos(struct fd f)
+{
+   if (f.flags  FDPUT_POS_UNLOCK)
+   

Re: [PATCH] ACPI / hotplug: Rework deferred execution of acpi_device_hotplug()

2014-03-04 Thread Toshi Kani
On Sat, 2014-03-01 at 20:57 +, Rafael J. Wysocki wrote:
 From: Rafael J. Wysocki rafael.j.wyso...@intel.com
 
 Since the only function executed by acpi_hotplug_execute() is
 acpi_device_hotplug() and it only is called by the ACPI core,
 simplify its definition so that it only takes two arguments, the
 ACPI device object pointer and event code, rename it to
 acpi_hotplug_schedule() and move its header from acpi_bus.h to
 the ACPI core's internal header file internal.h.  Modify the
 definition of acpi_device_hotplug() so that its first argument is
 an ACPI device object pointer and modify the definition of
 struct acpi_hp_work accordingly.
 
 Signed-off-by: Rafael J. Wysocki rafael.j.wyso...@intel.com

The change looks good to me.  I wonder if acpi_hotplug_schedule() should
still be in acpi/osl.c after this change, though.

Acked-by: Toshi Kani toshi.k...@hp.com

Thanks,
-Toshi


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.13 018/172] ARM: 7955/1: spinlock: ensure we have a compiler barrier before sev

2014-03-04 Thread Greg Kroah-Hartman
3.13-stable review patch.  If anyone has any objections, please let me know.

--

From: Will Deacon will.dea...@arm.com

commit 7c8746a9eb287642deaad0e7c2cdf482dce5e4be upstream.

When unlocking a spinlock, we require the following, strictly ordered
sequence of events:

barrier   /* dmb */
unlock
barrier   /* dsb */
sev

Whilst the code does indeed reflect this in terms of the architecture,
the final barrier + sev have been contracted into a single inline
asm without a memory clobber, therefore the compiler is at liberty to
reorder the unlock to the end of the above sequence. In such a case,
a waiting CPU may be woken up before the lock has been unlocked, leading
to extremely poor performance.

This patch reworks the dsb_sev() function to make use of the dsb()
macro and ensure ordering against the unlock.

Reported-by: Mark Rutland mark.rutl...@arm.com
Signed-off-by: Will Deacon will.dea...@arm.com
Signed-off-by: Russell King rmk+ker...@arm.linux.org.uk
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org

---
 arch/arm/include/asm/spinlock.h |   15 +++
 1 file changed, 3 insertions(+), 12 deletions(-)

--- a/arch/arm/include/asm/spinlock.h
+++ b/arch/arm/include/asm/spinlock.h
@@ -37,18 +37,9 @@
 
 static inline void dsb_sev(void)
 {
-#if __LINUX_ARM_ARCH__ = 7
-   __asm__ __volatile__ (
-   dsb ishst\n
-   SEV
-   );
-#else
-   __asm__ __volatile__ (
-   mcr p15, 0, %0, c7, c10, 4\n
-   SEV
-   : : r (0)
-   );
-#endif
+
+   dsb(ishst);
+   __asm__(SEV);
 }
 
 /*


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.13 071/172] batman-adv: avoid double free when orig_node initialization fails

2014-03-04 Thread Greg Kroah-Hartman
3.13-stable review patch.  If anyone has any objections, please let me know.

--

From: Antonio Quartulli anto...@meshcoding.com

[ Upstream commit a5a5cb8cab526af2f6cbe9715f8ca843192f0d81 ]

In the failure path of the orig_node initialization routine
the orig_node-bat_iv.bcast_own field is free'd twice: first
in batadv_iv_ogm_orig_get() and then later in
batadv_orig_node_free_rcu().

Fix it by removing the kfree in batadv_iv_ogm_orig_get().

Signed-off-by: Antonio Quartulli anto...@meshcoding.com
Signed-off-by: Marek Lindner mareklind...@neomailbox.ch
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org
---
 net/batman-adv/bat_iv_ogm.c |6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

--- a/net/batman-adv/bat_iv_ogm.c
+++ b/net/batman-adv/bat_iv_ogm.c
@@ -243,18 +243,16 @@ batadv_iv_ogm_orig_get(struct batadv_pri
size = bat_priv-num_ifaces * sizeof(uint8_t);
orig_node-bat_iv.bcast_own_sum = kzalloc(size, GFP_ATOMIC);
if (!orig_node-bat_iv.bcast_own_sum)
-   goto free_bcast_own;
+   goto free_orig_node;
 
hash_added = batadv_hash_add(bat_priv-orig_hash, batadv_compare_orig,
 batadv_choose_orig, orig_node,
 orig_node-hash_entry);
if (hash_added != 0)
-   goto free_bcast_own;
+   goto free_orig_node;
 
return orig_node;
 
-free_bcast_own:
-   kfree(orig_node-bat_iv.bcast_own);
 free_orig_node:
/* free twice, as batadv_orig_node_new sets refcount to 2 */
batadv_orig_node_free_ref(orig_node);


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.13 082/172] fs: fix iversion handling

2014-03-04 Thread Greg Kroah-Hartman
3.13-stable review patch.  If anyone has any objections, please let me know.

--

From: Christoph Hellwig h...@infradead.org

commit dff6efc326a4d5f305797d4a6bba14f374fdd633 upstream.

Currently notify_change directly updates i_version for size updates,
which not only is counter to how all other fields are updated through
struct iattr, but also breaks XFS, which need inode updates to happen
under its own lock, and synchronized to the structure that gets written
to the log.

Remove the update in the common code, and it to btrfs and ext4,
XFS already does a proper updaste internally and currently gets a
double update with the existing code.

IMHO this is 3.13 and -stable material and should go in through the XFS
tree.

Signed-off-by: Christoph Hellwig h...@lst.de
Reviewed-by: Andreas Dilger adil...@dilger.ca
Acked-by: Jan Kara j...@suse.cz
Reviewed-by: Dave Chinner dchin...@redhat.com
Signed-off-by: Chris Mason c...@fb.com
Signed-off-by: Ben Myers b...@sgi.com
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org

---
 fs/attr.c|5 -
 fs/btrfs/inode.c |8 ++--
 fs/ext4/inode.c  |4 
 3 files changed, 10 insertions(+), 7 deletions(-)

--- a/fs/attr.c
+++ b/fs/attr.c
@@ -202,11 +202,6 @@ int notify_change(struct dentry * dentry
return -EPERM;
}
 
-   if ((ia_valid  ATTR_SIZE)  IS_I_VERSION(inode)) {
-   if (attr-ia_size != inode-i_size)
-   inode_inc_iversion(inode);
-   }
-
if ((ia_valid  ATTR_MODE)) {
umode_t amode = attr-ia_mode;
/* Flag setting protected by i_mutex */
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -4354,8 +4354,12 @@ static int btrfs_setsize(struct inode *i
 * these flags set.  For all other operations the VFS set these flags
 * explicitly if it wants a timestamp update.
 */
-   if (newsize != oldsize  (!(mask  (ATTR_CTIME | ATTR_MTIME
-   inode-i_ctime = inode-i_mtime = current_fs_time(inode-i_sb);
+   if (newsize != oldsize) {
+   inode_inc_iversion(inode);
+   if (!(mask  (ATTR_CTIME | ATTR_MTIME)))
+   inode-i_ctime = inode-i_mtime =
+   current_fs_time(inode-i_sb);
+   }
 
if (newsize  oldsize) {
truncate_pagecache(inode, newsize);
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -4586,6 +4586,10 @@ int ext4_setattr(struct dentry *dentry,
if (attr-ia_size  sbi-s_bitmap_maxbytes)
return -EFBIG;
}
+
+   if (IS_I_VERSION(inode)  attr-ia_size != inode-i_size)
+   inode_inc_iversion(inode);
+
if (S_ISREG(inode-i_mode) 
(attr-ia_size  inode-i_size)) {
if (ext4_should_order_data(inode)) {


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.13 124/172] usb: ehci: fix deadlock when threadirqs option is used

2014-03-04 Thread Greg Kroah-Hartman
3.13-stable review patch.  If anyone has any objections, please let me know.

--

From: Stanislaw Gruszka sgrus...@redhat.com

commit a1227f3c1030e96ebc51d677d2f636268845c5fb upstream.

ehci_irq() and ehci_hrtimer_func() can deadlock on ehci-lock when
threadirqs option is used. To prevent the deadlock use
spin_lock_irqsave() in ehci_irq().

This change can be reverted when hrtimer callbacks become threaded.

Signed-off-by: Stanislaw Gruszka sgrus...@redhat.com
Acked-by: Alan Stern st...@rowland.harvard.edu
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org

---
 drivers/usb/host/ehci-hcd.c |   13 ++---
 1 file changed, 10 insertions(+), 3 deletions(-)

--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -686,8 +686,15 @@ static irqreturn_t ehci_irq (struct usb_
struct ehci_hcd *ehci = hcd_to_ehci (hcd);
u32 status, masked_status, pcd_status = 0, cmd;
int bh;
+   unsigned long   flags;
 
-   spin_lock (ehci-lock);
+   /*
+* For threadirqs option we use spin_lock_irqsave() variant to prevent
+* deadlock with ehci hrtimer callback, because hrtimer callbacks run
+* in interrupt context even when threadirqs is specified. We can go
+* back to spin_lock() variant when hrtimer callbacks become threaded.
+*/
+   spin_lock_irqsave(ehci-lock, flags);
 
status = ehci_readl(ehci, ehci-regs-status);
 
@@ -705,7 +712,7 @@ static irqreturn_t ehci_irq (struct usb_
 
/* Shared IRQ? */
if (!masked_status || unlikely(ehci-rh_state == EHCI_RH_HALTED)) {
-   spin_unlock(ehci-lock);
+   spin_unlock_irqrestore(ehci-lock, flags);
return IRQ_NONE;
}
 
@@ -823,7 +830,7 @@ dead:
 
if (bh)
ehci_work (ehci);
-   spin_unlock (ehci-lock);
+   spin_unlock_irqrestore(ehci-lock, flags);
if (pcd_status)
usb_hcd_poll_rh_status(hcd);
return IRQ_HANDLED;


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.10 53/97] powerpc/le: Ensure that the stop-self RTAS token is handled correctly

2014-03-04 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Tony Breeds t...@bakeyournoodle.com

commit 41dd03a94c7d408d2ef32530545097f7d1befe5c upstream.

Currently we're storing a host endian RTAS token in
rtas_stop_self_args.token.  We then pass that directly to rtas.  This is
fine on big endian however on little endian the token is not what we
expect.

This will typically result in hitting:
panic(Alas, I survived.\n);

To fix this we always use the stop-self token in host order and always
convert it to be32 before passing this to rtas.

Signed-off-by: Tony Breeds t...@bakeyournoodle.com
Signed-off-by: Benjamin Herrenschmidt b...@kernel.crashing.org
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org

---
 arch/powerpc/platforms/pseries/hotplug-cpu.c |   22 +++---
 1 file changed, 11 insertions(+), 11 deletions(-)

--- a/arch/powerpc/platforms/pseries/hotplug-cpu.c
+++ b/arch/powerpc/platforms/pseries/hotplug-cpu.c
@@ -34,12 +34,7 @@
 #include offline_states.h
 
 /* This version can't take the spinlock, because it never returns */
-static struct rtas_args rtas_stop_self_args = {
-   .token = RTAS_UNKNOWN_SERVICE,
-   .nargs = 0,
-   .nret = 1,
-   .rets = rtas_stop_self_args.args[0],
-};
+static int rtas_stop_self_token = RTAS_UNKNOWN_SERVICE;
 
 static DEFINE_PER_CPU(enum cpu_state_vals, preferred_offline_state) =
CPU_STATE_OFFLINE;
@@ -92,15 +87,20 @@ void set_default_offline_state(int cpu)
 
 static void rtas_stop_self(void)
 {
-   struct rtas_args *args = rtas_stop_self_args;
+   struct rtas_args args = {
+   .token = cpu_to_be32(rtas_stop_self_token),
+   .nargs = 0,
+   .nret = 1,
+   .rets = args.args[0],
+   };
 
local_irq_disable();
 
-   BUG_ON(args-token == RTAS_UNKNOWN_SERVICE);
+   BUG_ON(rtas_stop_self_token == RTAS_UNKNOWN_SERVICE);
 
printk(cpu %u (hwid %u) Ready to die...\n,
   smp_processor_id(), hard_smp_processor_id());
-   enter_rtas(__pa(args));
+   enter_rtas(__pa(args));
 
panic(Alas, I survived.\n);
 }
@@ -391,10 +391,10 @@ static int __init pseries_cpu_hotplug_in
}
}
 
-   rtas_stop_self_args.token = rtas_token(stop-self);
+   rtas_stop_self_token = rtas_token(stop-self);
qcss_tok = rtas_token(query-cpu-stopped-state);
 
-   if (rtas_stop_self_args.token == RTAS_UNKNOWN_SERVICE ||
+   if (rtas_stop_self_token == RTAS_UNKNOWN_SERVICE ||
qcss_tok == RTAS_UNKNOWN_SERVICE) {
printk(KERN_INFO CPU Hotplug not supported by firmware 
- disabling.\n);


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.10 94/97] dm thin: fix the error path for the thin device constructor

2014-03-04 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Mike Snitzer snit...@redhat.com

commit 1acacc0784aab45627b6009e0e9224886279ac0b upstream.

dm_pool_close_thin_device() must be called if dm_set_target_max_io_len()
fails in thin_ctr().  Otherwise __pool_destroy() will fail because the
pool will still have an open thin device:

 device-mapper: thin metadata: attempt to close pmd when 1 device(s) are still 
open
 device-mapper: thin: __pool_destroy: dm_pool_metadata_close() failed.

Also, must establish error code if failing thin_ctr() because the pool
is in fail_io mode.

Signed-off-by: Mike Snitzer snit...@redhat.com
Acked-by: Joe Thornber e...@redhat.com
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org

---
 drivers/md/dm-thin.c |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

--- a/drivers/md/dm-thin.c
+++ b/drivers/md/dm-thin.c
@@ -2784,6 +2784,7 @@ static int thin_ctr(struct dm_target *ti
 
if (get_pool_mode(tc-pool) == PM_FAIL) {
ti-error = Couldn't open thin device, Pool is in fail mode;
+   r = -EINVAL;
goto bad_thin_open;
}
 
@@ -2795,7 +2796,7 @@ static int thin_ctr(struct dm_target *ti
 
r = dm_set_target_max_io_len(ti, tc-pool-sectors_per_block);
if (r)
-   goto bad_thin_open;
+   goto bad_target_max_io_len;
 
ti-num_flush_bios = 1;
ti-flush_supported = true;
@@ -2816,6 +2817,8 @@ static int thin_ctr(struct dm_target *ti
 
return 0;
 
+bad_target_max_io_len:
+   dm_pool_close_thin_device(tc-td);
 bad_thin_open:
__pool_dec(tc-pool);
 bad_pool_lookup:


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.10 97/97] drm/radeon: disable pll sharing for DP on DCE4.1

2014-03-04 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Alex Deucher alexander.deuc...@amd.com

commit 9ef4e1d000a5b335fcebfcf8aef3405e59574c89 upstream.

Causes display problems.  We had already disabled
sharing for non-DP displays.

Based on a patch from:
Niels Ole Salscheider niels_...@salscheider-online.de

bug:
https://bugzilla.kernel.org/show_bug.cgi?id=58121

Signed-off-by: Alex Deucher alexander.deuc...@amd.com
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org

---
 drivers/gpu/drm/radeon/atombios_crtc.c |   16 +++-
 1 file changed, 15 insertions(+), 1 deletion(-)

--- a/drivers/gpu/drm/radeon/atombios_crtc.c
+++ b/drivers/gpu/drm/radeon/atombios_crtc.c
@@ -1661,6 +1661,20 @@ static int radeon_atom_pick_pll(struct d
return ATOM_PPLL1;
DRM_ERROR(unable to allocate a PPLL\n);
return ATOM_PPLL_INVALID;
+   } else if (ASIC_IS_DCE41(rdev)) {
+   /* Don't share PLLs on DCE4.1 chips */
+   if 
(ENCODER_MODE_IS_DP(atombios_get_encoder_mode(radeon_crtc-encoder))) {
+   if (rdev-clock.dp_extclk)
+   /* skip PPLL programming if using ext clock */
+   return ATOM_PPLL_INVALID;
+   }
+   pll_in_use = radeon_get_pll_use_mask(crtc);
+   if (!(pll_in_use  (1  ATOM_PPLL1)))
+   return ATOM_PPLL1;
+   if (!(pll_in_use  (1  ATOM_PPLL2)))
+   return ATOM_PPLL2;
+   DRM_ERROR(unable to allocate a PPLL\n);
+   return ATOM_PPLL_INVALID;
} else if (ASIC_IS_DCE4(rdev)) {
/* in DP mode, the DP ref clock can come from PPLL, DCPLL, or 
ext clock,
 * depending on the asic:
@@ -1688,7 +1702,7 @@ static int radeon_atom_pick_pll(struct d
if (pll != ATOM_PPLL_INVALID)
return pll;
}
-   } else if (!ASIC_IS_DCE41(rdev)) { /* Don't share PLLs on 
DCE4.1 chips */
+   } else {
/* use the same PPLL for all monitors with the same 
clock */
pll = radeon_get_shared_nondp_ppll(crtc);
if (pll != ATOM_PPLL_INVALID)


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.10 88/97] ARM: 7812/1: rwlocks: retry trylock operation if strex fails on free lock

2014-03-04 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Will Deacon will.dea...@arm.com

commit 00efaa0250939dc148e2d3104fb3c18395d24a2d upstream.

Commit 15e7e5c1ebf5 (ARM: 7749/1: spinlock: retry trylock operation if
strex fails on free lock) modifying our arch_spin_trylock to retry the
acquisition if the lock appeared uncontended, but the strex failed.

This patch does the same for rwlocks, which were missed by the original
patch.

Signed-off-by: Will Deacon will.dea...@arm.com
Signed-off-by: Russell King rmk+ker...@arm.linux.org.uk
Cc: Li Zefan lize...@huawei.com
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org

---
 arch/arm/include/asm/spinlock.h |   49 
 1 file changed, 30 insertions(+), 19 deletions(-)

--- a/arch/arm/include/asm/spinlock.h
+++ b/arch/arm/include/asm/spinlock.h
@@ -168,17 +168,20 @@ static inline void arch_write_lock(arch_
 
 static inline int arch_write_trylock(arch_rwlock_t *rw)
 {
-   unsigned long tmp;
+   unsigned long contended, res;
 
-   __asm__ __volatile__(
-  ldrex   %0, [%1]\n
-  teq %0, #0\n
-  strexeq %0, %2, [%1]
-   : =r (tmp)
-   : r (rw-lock), r (0x8000)
-   : cc);
+   do {
+   __asm__ __volatile__(
+  ldrex   %0, [%2]\n
+  mov %1, #0\n
+  teq %0, #0\n
+  strexeq %1, %3, [%2]
+   : =r (contended), =r (res)
+   : r (rw-lock), r (0x8000)
+   : cc);
+   } while (res);
 
-   if (tmp == 0) {
+   if (!contended) {
smp_mb();
return 1;
} else {
@@ -254,18 +257,26 @@ static inline void arch_read_unlock(arch
 
 static inline int arch_read_trylock(arch_rwlock_t *rw)
 {
-   unsigned long tmp, tmp2 = 1;
+   unsigned long contended, res;
 
-   __asm__ __volatile__(
-  ldrex   %0, [%2]\n
-  adds%0, %0, #1\n
-  strexpl %1, %0, [%2]\n
-   : =r (tmp), +r (tmp2)
-   : r (rw-lock)
-   : cc);
+   do {
+   __asm__ __volatile__(
+  ldrex   %0, [%2]\n
+  mov %1, #0\n
+  adds%0, %0, #1\n
+  strexpl %1, %0, [%2]
+   : =r (contended), =r (res)
+   : r (rw-lock)
+   : cc);
+   } while (res);
 
-   smp_mb();
-   return tmp2 == 0;
+   /* If the lock is negative, then it is already held for write. */
+   if (contended  0x8000) {
+   smp_mb();
+   return 1;
+   } else {
+   return 0;
+   }
 }
 
 /* read_can_lock - would read_trylock() succeed? */


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.10 95/97] drm/radeon: print the supported atpx function mask

2014-03-04 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Alex Deucher alexander.deuc...@amd.com

commit 9f050c7f9738ffa746c63415136645ad231b1348 upstream.

Print the supported functions mask in addition to
the version.  This is useful in debugging PX
problems since we can see what functions are available.

Signed-off-by: Alex Deucher alexander.deuc...@amd.com
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org

---
 drivers/gpu/drm/radeon/radeon_atpx_handler.c |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/drivers/gpu/drm/radeon/radeon_atpx_handler.c
+++ b/drivers/gpu/drm/radeon/radeon_atpx_handler.c
@@ -215,7 +215,8 @@ static int radeon_atpx_verify_interface(
memcpy(output, info-buffer.pointer, size);
 
/* TODO: check version? */
-   printk(ATPX version %u\n, output.version);
+   printk(ATPX version %u, functions 0x%08x\n,
+  output.version, output.function_bits);
 
radeon_atpx_parse_functions(atpx-functions, output.function_bits);
 


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.10 92/97] dm mpath: fix stalls when handling invalid ioctls

2014-03-04 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Hannes Reinecke h...@suse.de

commit a1989b330093578ea5470bea0a00f940c444c466 upstream.

An invalid ioctl will never be valid, irrespective of whether multipath
has active paths or not.  So for invalid ioctls we do not have to wait
for multipath to activate any paths, but can rather return an error
code immediately.  This fix resolves numerous instances of:

 udevd[]: worker [] unexpectedly returned with status 0x0100

that have been seen during testing.

Signed-off-by: Hannes Reinecke h...@suse.de
Signed-off-by: Mike Snitzer snit...@redhat.com
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org

---
 drivers/md/dm-mpath.c |7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

--- a/drivers/md/dm-mpath.c
+++ b/drivers/md/dm-mpath.c
@@ -1608,8 +1608,11 @@ static int multipath_ioctl(struct dm_tar
/*
 * Only pass ioctls through if the device sizes match exactly.
 */
-   if (!r  ti-len != i_size_read(bdev-bd_inode)  SECTOR_SHIFT)
-   r = scsi_verify_blk_ioctl(NULL, cmd);
+   if (!bdev || ti-len != i_size_read(bdev-bd_inode)  SECTOR_SHIFT) {
+   int err = scsi_verify_blk_ioctl(NULL, cmd);
+   if (err)
+   r = err;
+   }
 
if (r == -ENOTCONN  !fatal_signal_pending(current))
queue_work(kmultipathd, m-process_queued_ios);


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.10 79/97] xtensa: introduce spill_registers_kernel macro

2014-03-04 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Max Filippov jcmvb...@gmail.com

commit e2fd1374c705abe4661df3fb6fadb3879c7c1846 upstream.

Most in-kernel users want registers spilled on the kernel stack and
don't require PS.EXCM to be set. That means that they don't need fixup
routine and could reuse regular window overflow mechanism for that,
which makes spill routine very simple.

Suggested-by: Chris Zankel ch...@zankel.net
Signed-off-by: Max Filippov jcmvb...@gmail.com
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org

---
 arch/xtensa/include/asm/traps.h |   44 ++---
 arch/xtensa/kernel/entry.S  |   60 
 2 files changed, 76 insertions(+), 28 deletions(-)

--- a/arch/xtensa/include/asm/traps.h
+++ b/arch/xtensa/include/asm/traps.h
@@ -22,25 +22,37 @@ extern void do_unhandled(struct pt_regs
 
 static inline void spill_registers(void)
 {
-
+#if XCHAL_NUM_AREGS  16
__asm__ __volatile__ (
-   movi   a14, __stringify((1  PS_EXCM_BIT) | LOCKLEVEL)\n\t
-   mova12, a0\n\t
-   rsra13, sar\n\t
-   xsra14, ps\n\t
-   movi   a0, _spill_registers\n\t
-   rsync\n\t
-   callx0 a0\n\t
-   mova0, a12\n\t
-   wsra13, sar\n\t
-   wsra14, ps\n\t
-   : :
-#if defined(CONFIG_FRAME_POINTER)
-   : a2, a3, a4,   a11, a12, a13, a14, a15,
+  call12  1f\n
+  _j  2f\n
+  retw\n
+  .align  4\n
+   1:\n
+  _entry  a1, 48\n
+  addia12, a0, 3\n
+#if XCHAL_NUM_AREGS  32
+  .rept   ( __stringify(XCHAL_NUM_AREGS)  - 32) / 12\n
+  _entry  a1, 48\n
+  mov a12, a0\n
+  .endr\n
+#endif
+  _entry  a1, 48\n
+#if XCHAL_NUM_AREGS % 12 == 0
+  mov a8, a8\n
+#elif XCHAL_NUM_AREGS % 12 == 4
+  mov a12, a12\n
+#elif XCHAL_NUM_AREGS % 12 == 8
+  mov a4, a4\n
+#endif
+  retw\n
+   2:\n
+   : : : a12, a13, memory);
 #else
-   : a2, a3, a4, a7, a11, a12, a13, a14, a15,
+   __asm__ __volatile__ (
+  mov a12, a12\n
+   : : : memory);
 #endif
- memory);
 }
 
 #endif /* _XTENSA_TRAPS_H */
--- a/arch/xtensa/kernel/entry.S
+++ b/arch/xtensa/kernel/entry.S
@@ -1912,6 +1912,43 @@ ENTRY(system_call)
 
 ENDPROC(system_call)
 
+/*
+ * Spill live registers on the kernel stack macro.
+ *
+ * Entry condition: ps.woe is set, ps.excm is cleared
+ * Exit condition: windowstart has single bit set
+ * May clobber: a12, a13
+ */
+   .macro  spill_registers_kernel
+
+#if XCHAL_NUM_AREGS  16
+   call12  1f
+   _j  2f
+   retw
+   .align  4
+1:
+   _entry  a1, 48
+   addia12, a0, 3
+#if XCHAL_NUM_AREGS  32
+   .rept   (XCHAL_NUM_AREGS - 32) / 12
+   _entry  a1, 48
+   mov a12, a0
+   .endr
+#endif
+   _entry  a1, 48
+#if XCHAL_NUM_AREGS % 12 == 0
+   mov a8, a8
+#elif XCHAL_NUM_AREGS % 12 == 4
+   mov a12, a12
+#elif XCHAL_NUM_AREGS % 12 == 8
+   mov a4, a4
+#endif
+   retw
+2:
+#else
+   mov a12, a12
+#endif
+   .endm
 
 /*
  * Task switch.
@@ -1924,21 +1961,20 @@ ENTRY(_switch_to)
 
entry   a1, 16
 
-   mov a12, a2 # preserve 'prev' (a2)
-   mov a13, a3 # and 'next' (a3)
+   mov a10, a2 # preserve 'prev' (a2)
+   mov a11, a3 # and 'next' (a3)
 
l32ia4, a2, TASK_THREAD_INFO
l32ia5, a3, TASK_THREAD_INFO
 
-   save_xtregs_user a4 a6 a8 a9 a10 a11 THREAD_XTREGS_USER
+   save_xtregs_user a4 a6 a8 a9 a12 a13 THREAD_XTREGS_USER
 
-   s32ia0, a12, THREAD_RA  # save return address
-   s32ia1, a12, THREAD_SP  # save stack pointer
+   s32ia0, a10, THREAD_RA  # save return address
+   s32ia1, a10, THREAD_SP  # save stack pointer
 
/* Disable ints while we manipulate the stack pointer. */
 
-   movia14, (1  PS_EXCM_BIT) | LOCKLEVEL
-   xsr a14, ps
+   rsila14, LOCKLEVEL
rsr a3, excsave1
rsync
s32ia3, a3, EXC_TABLE_FIXUP /* enter critical section */
@@ -1953,7 +1989,7 @@ ENTRY(_switch_to)
 
/* Flush register file. */
 
-   call0   _spill_registers# destroys a3, a4, and SAR
+   spill_registers_kernel
 
/* Set kernel stack (and leave critical section)
 * Note: It's save to set it here. The stack will not be overwritten
@@ -1969,13 +2005,13 @@ ENTRY(_switch_to)
 
/* 

[PATCH 3.10 93/97] dm thin: avoid metadata commit if a pools thin devices havent changed

2014-03-04 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Mike Snitzer snit...@redhat.com

commit 4d1662a30dde6e545086fe0e8fd7e474c4e0b639 upstream.

Commit 905e51b (dm thin: commit outstanding data every second)
introduced a periodic commit.  This commit occurs regardless of whether
any thin devices have made changes.

Fix the periodic commit to check if any of a pool's thin devices have
changed using dm_pool_changed_this_transaction().

Reported-by: Alexander Larsson al...@redhat.com
Signed-off-by: Mike Snitzer snit...@redhat.com
Acked-by: Joe Thornber e...@redhat.com
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org

---
 drivers/md/dm-thin-metadata.c |   17 +
 drivers/md/dm-thin-metadata.h |2 ++
 drivers/md/dm-thin.c  |3 ++-
 3 files changed, 21 insertions(+), 1 deletion(-)

--- a/drivers/md/dm-thin-metadata.c
+++ b/drivers/md/dm-thin-metadata.c
@@ -1489,6 +1489,23 @@ bool dm_thin_changed_this_transaction(st
return r;
 }
 
+bool dm_pool_changed_this_transaction(struct dm_pool_metadata *pmd)
+{
+   bool r = false;
+   struct dm_thin_device *td, *tmp;
+
+   down_read(pmd-root_lock);
+   list_for_each_entry_safe(td, tmp, pmd-thin_devices, list) {
+   if (td-changed) {
+   r = td-changed;
+   break;
+   }
+   }
+   up_read(pmd-root_lock);
+
+   return r;
+}
+
 bool dm_thin_aborted_changes(struct dm_thin_device *td)
 {
bool r;
--- a/drivers/md/dm-thin-metadata.h
+++ b/drivers/md/dm-thin-metadata.h
@@ -161,6 +161,8 @@ int dm_thin_remove_block(struct dm_thin_
  */
 bool dm_thin_changed_this_transaction(struct dm_thin_device *td);
 
+bool dm_pool_changed_this_transaction(struct dm_pool_metadata *pmd);
+
 bool dm_thin_aborted_changes(struct dm_thin_device *td);
 
 int dm_thin_get_highest_mapped_block(struct dm_thin_device *td,
--- a/drivers/md/dm-thin.c
+++ b/drivers/md/dm-thin.c
@@ -1344,7 +1344,8 @@ static void process_deferred_bios(struct
bio_list_init(pool-deferred_flush_bios);
spin_unlock_irqrestore(pool-lock, flags);
 
-   if (bio_list_empty(bios)  !need_commit_due_to_time(pool))
+   if (bio_list_empty(bios) 
+   !(dm_pool_changed_this_transaction(pool-pmd)  
need_commit_due_to_time(pool)))
return;
 
if (commit_or_fallback(pool)) {


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.10 73/97] hwmon: (max1668) Fix writing the minimum temperature

2014-03-04 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Guenter Roeck li...@roeck-us.net

commit 500a91571f0a5d0d3242d83802ea2fd1faccc66e upstream.

When trying to set the minimum temperature, the driver was erroneously
writing the maximum temperature into the chip.

Signed-off-by: Guenter Roeck li...@roeck-us.net
Reviewed-by: Jean Delvare jdelv...@suse.de
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org

---
 drivers/hwmon/max1668.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/hwmon/max1668.c
+++ b/drivers/hwmon/max1668.c
@@ -243,7 +243,7 @@ static ssize_t set_temp_min(struct devic
data-temp_min[index] = clamp_val(temp/1000, -128, 127);
if (i2c_smbus_write_byte_data(client,
MAX1668_REG_LIML_WR(index),
-   data-temp_max[index]))
+   data-temp_min[index]))
count = -EIO;
mutex_unlock(data-update_lock);
 


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.10 91/97] dma: ste_dma40: dont dereference free:d descriptor

2014-03-04 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Linus Walleij linus.wall...@linaro.org

commit e9baa9d9d520fb0e24cca671e430689de2d4a4b2 upstream.

It appears that in the DMA40 driver the DMA tasklet will very
often dereference memory for a descriptor just free:d from the
DMA40 slab. Nothing happens because no other part of the driver
has yet had a chance to claim this memory, but it's really
nasty to dereference free:d memory, so let's check the flag
before the descriptor is free and store it in a bool variable.

Reported-by: Dan Carpenter dan.carpen...@oracle.com
Signed-off-by: Linus Walleij linus.wall...@linaro.org
Signed-off-by: Vinod Koul vinod.k...@intel.com
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org

---
 drivers/dma/ste_dma40.c |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

--- a/drivers/dma/ste_dma40.c
+++ b/drivers/dma/ste_dma40.c
@@ -1587,6 +1587,7 @@ static void dma_tasklet(unsigned long da
struct d40_chan *d40c = (struct d40_chan *) data;
struct d40_desc *d40d;
unsigned long flags;
+   bool callback_active;
dma_async_tx_callback callback;
void *callback_param;
 
@@ -1614,6 +1615,7 @@ static void dma_tasklet(unsigned long da
}
 
/* Callback to client */
+   callback_active = !!(d40d-txd.flags  DMA_PREP_INTERRUPT);
callback = d40d-txd.callback;
callback_param = d40d-txd.callback_param;
 
@@ -1636,7 +1638,7 @@ static void dma_tasklet(unsigned long da
 
spin_unlock_irqrestore(d40c-lock, flags);
 
-   if (callback  (d40d-txd.flags  DMA_PREP_INTERRUPT))
+   if (callback_active  callback)
callback(callback_param);
 
return;


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.10 89/97] qla2xxx: Fix kernel panic on selective retransmission request

2014-03-04 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Dr. Greg Wettstein g...@enjellic.com

commit 6f58c780e5a5b43a6d2121e0d43cdcba1d3cc5fc upstream.

A selective retransmission request (SRR) is a fibre-channel
protocol control request which provides support for requesting
retransmission of a data sequence in response to an issue such as
frame loss or corruption.  These events are experienced
infrequently in fibre-channel based networks which makes
it difficult to test and assess codepaths which handle these
events.

We were fortunate enough, for some definition of fortunate, to
have a metro-area single-mode SAN link which, at 10 GBPS
sustained load levels, would consistently generate SRR's in
a SCST based target implementation using our SCST/in-kernel
Qlogic target interface driver.  In response to an SRR the
in-kernel Qlogic target driver immediately panics resulting
in a catastrophic storage failure for serviced initiators.

The culprit was a debug statement in the qla_target.c file which
does not verify that a pointer to the SCSI CDB is not null.
The unchecked pointer dereference results in the kernel panic
and resultant system failure.

The other two references to the SCSI CDB by the SRR handling code
use a ternary operator to verify a non-null pointer is being
acted on.  This patch simply adds a similar test to the implicated
debug statement.

This patch is a candidate for any stable kernel being maintained
since it addresses a potentially catastrophic event with
minimal downside.

Signed-off-by: Dr. Greg Wettstein g...@enjellic.com
Signed-off-by: Nicholas Bellinger n...@linux-iscsi.org
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org

---
 drivers/scsi/qla2xxx/qla_target.c |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/drivers/scsi/qla2xxx/qla_target.c
+++ b/drivers/scsi/qla2xxx/qla_target.c
@@ -3339,7 +3339,8 @@ restart:
ql_dbg(ql_dbg_tgt_mgt, vha, 0xf02c,
SRR cmd %p (se_cmd %p, tag %d, op %x), 
sg_cnt=%d, offset=%d, cmd, cmd-se_cmd, cmd-tag,
-   se_cmd-t_task_cdb[0], cmd-sg_cnt, cmd-offset);
+   se_cmd-t_task_cdb ? se_cmd-t_task_cdb[0] : 0,
+   cmd-sg_cnt, cmd-offset);
 
qlt_handle_srr(vha, sctio, imm);
 


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.10 80/97] SELinux: bigendian problems with filename trans rules

2014-03-04 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Eric Paris epa...@redhat.com

commit 9085a6422900092886da8c404e1c5340c4ff1cbf upstream.

When writing policy via /sys/fs/selinux/policy I wrote the type and class
of filename trans rules in CPU endian instead of little endian.  On
x86_64 this works just fine, but it means that on big endian arch's like
ppc64 and s390 userspace reads the policy and converts it from
le32_to_cpu.  So the values are all screwed up.  Write the values in le
format like it should have been to start.

Signed-off-by: Eric Paris epa...@redhat.com
Acked-by:  Stephen Smalley s...@tycho.nsa.gov
Signed-off-by: Paul Moore pmo...@redhat.com
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org

---
 security/selinux/ss/policydb.c |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

--- a/security/selinux/ss/policydb.c
+++ b/security/selinux/ss/policydb.c
@@ -3258,10 +3258,10 @@ static int filename_write_helper(void *k
if (rc)
return rc;
 
-   buf[0] = ft-stype;
-   buf[1] = ft-ttype;
-   buf[2] = ft-tclass;
-   buf[3] = otype-otype;
+   buf[0] = cpu_to_le32(ft-stype);
+   buf[1] = cpu_to_le32(ft-ttype);
+   buf[2] = cpu_to_le32(ft-tclass);
+   buf[3] = cpu_to_le32(otype-otype);
 
rc = put_entry(buf, sizeof(u32), 4, fp);
if (rc)


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.10 90/97] i7300_edac: Fix device reference count

2014-03-04 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Jean Delvare jdelv...@suse.de

commit 75135da0d68419ef8a925f4c1d5f63d8046e314d upstream.

pci_get_device() decrements the reference count of from (last
argument) so when we break off the loop successfully we have only one
device reference - and we don't know which device we have. If we want
a reference to each device, we must take them explicitly and let
the pci_get_device() walk complete to avoid duplicate references.

This is serious, as over-putting device references will cause
the device to eventually disappear. Without this fix, the kernel
crashes after a few insmod/rmmod cycles.

Tested on an Intel S7000FC4UR system with a 7300 chipset.

Signed-off-by: Jean Delvare jdelv...@suse.de
Link: http://lkml.kernel.org/r/20140224111656.09bbb7ed@endymion.delvare
Cc: Mauro Carvalho Chehab m.che...@samsung.com
Cc: Doug Thompson dougthomp...@xmission.com
Signed-off-by: Borislav Petkov b...@suse.de
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org

---
 drivers/edac/i7300_edac.c |   38 --
 1 file changed, 20 insertions(+), 18 deletions(-)

--- a/drivers/edac/i7300_edac.c
+++ b/drivers/edac/i7300_edac.c
@@ -943,33 +943,35 @@ static int i7300_get_devices(struct mem_
 
/* Attempt to 'get' the MCH register we want */
pdev = NULL;
-   while (!pvt-pci_dev_16_1_fsb_addr_map ||
-  !pvt-pci_dev_16_2_fsb_err_regs) {
-   pdev = pci_get_device(PCI_VENDOR_ID_INTEL,
- PCI_DEVICE_ID_INTEL_I7300_MCH_ERR, pdev);
-   if (!pdev) {
-   /* End of list, leave */
-   i7300_printk(KERN_ERR,
-   'system address,Process Bus' 
-   device not found:
-   vendor 0x%x device 0x%x ERR funcs 
-   (broken BIOS?)\n,
-   PCI_VENDOR_ID_INTEL,
-   PCI_DEVICE_ID_INTEL_I7300_MCH_ERR);
-   goto error;
-   }
-
+   while ((pdev = pci_get_device(PCI_VENDOR_ID_INTEL,
+ PCI_DEVICE_ID_INTEL_I7300_MCH_ERR,
+ pdev))) {
/* Store device 16 funcs 1 and 2 */
switch (PCI_FUNC(pdev-devfn)) {
case 1:
-   pvt-pci_dev_16_1_fsb_addr_map = pdev;
+   if (!pvt-pci_dev_16_1_fsb_addr_map)
+   pvt-pci_dev_16_1_fsb_addr_map =
+   pci_dev_get(pdev);
break;
case 2:
-   pvt-pci_dev_16_2_fsb_err_regs = pdev;
+   if (!pvt-pci_dev_16_2_fsb_err_regs)
+   pvt-pci_dev_16_2_fsb_err_regs =
+   pci_dev_get(pdev);
break;
}
}
 
+   if (!pvt-pci_dev_16_1_fsb_addr_map ||
+   !pvt-pci_dev_16_2_fsb_err_regs) {
+   /* At least one device was not found */
+   i7300_printk(KERN_ERR,
+   'system address,Process Bus' device not found:
+   vendor 0x%x device 0x%x ERR funcs (broken BIOS?)\n,
+   PCI_VENDOR_ID_INTEL,
+   PCI_DEVICE_ID_INTEL_I7300_MCH_ERR);
+   goto error;
+   }
+
edac_dbg(1, System Address, processor bus- PCI Bus ID: %s  %x:%x\n,
 pci_name(pvt-pci_dev_16_0_fsb_ctlr),
 pvt-pci_dev_16_0_fsb_ctlr-vendor,


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 0/5] mm: generic early_ioremap support

2014-03-04 Thread Mark Salter
To: linux-kernel@vger.kernel.org
CC: x...@kernel.org
CC: linux-arm-ker...@lists.infradead.org
CC: Andrew Morton a...@linux-foundation.org
CC: Arnd Bergmann a...@arndb.de
CC: Ingo Molnar mi...@kernel.org
CC: Thomas Gleixner t...@linutronix.de
CC: H. Peter Anvin h...@zytor.com
CC: Russell King li...@arm.linux.org.uk
CC: Catalin Marinas catalin.mari...@arm.com
CC: Will Deacon will.dea...@arm.com
CC: Dave Young dyo...@redhat.com
CC: Rob Herring robherri...@gmail.com
CC: Leif Lindholm leif.lindh...@linaro.org
CC: patc...@linaro.org

This patch series takes the common bits from the x86 early ioremap
implementation and creates a generic implementation which may be used
by other architectures. The early ioremap interfaces are intended for
situations where boot code needs to make temporary virtual mappings
before the normal ioremap interfaces are available. Typically, this
means before paging_init() has run.

These patches are layered on top of generic fixmap patches which
were pulled into upstream 3.14-rc kernels.

This is version 5 of the patch series. These patches fixmap patches
 may be found at:

  git://github.com/mosalter/linux.git (early-ioremap-v5 branch)

Changes from version 4:

  * Dropped arm bits from this series. There is work to be done to
support permanent fixmap mappings on ARM and that will be part
of a separate arm-only patch series.

  * Added Acks for common, x86, and arm64 bits.

Changes from version 3:

  * Removed dependency on MMU. In the case of no-MMU, the early remap
functions return the address passed in. This helps simplify use of
early_ioremap functions on architectures such as ARM which have
optional MMU support.

  * Added L_PTE_XN to arm page flags so mappings are non-executable.

  * Include linux/io.h rather than asm/io.h in arm setup.c

  * Moved early_ioremap_init() before setup_machine_fdt() in arm
setup_arch().

  * Fixed mispelling in config EARLY_IOREMAP help text.

Changes from version 2:

  * Added some Acks

  * Incorporated a patch from Dave Young to change the signature
of early_memremap() (dropping __iomem from returned pointer)
which is the first patch in a larger series:

https://lkml.org/lkml/2013/12/22/69

This allows the change of just the x86 function signature
to be bisected.

Changes from version 1:

  * Moved the generic code into linux/mm instead of linux/lib

  * Have early_memremap() return normal pointer instead of __iomem
This is in response to sparse warning cleanups being made in
an unrelated patch series:

https://lkml.org/lkml/2013/12/22/69

  * Added arm64 patch to call init_mem_pgprot() earlier so that
the pgprot macros are valid in time for early_ioremap use

  * Added validity checking for early_ioremap pgd, pud, and pmd
in arm64

Dave Young (1):
  x86/mm: sparse warning fix for early_memremap

Mark Salter (4):
  mm: create generic early_ioremap() support
  x86: use generic early_ioremap
  arm64: initialize pgprot info earlier in boot
  arm64: add early_ioremap support

 Documentation/arm64/memory.txt  |   4 +-
 arch/arm64/Kconfig  |   1 +
 arch/arm64/include/asm/Kbuild   |   1 +
 arch/arm64/include/asm/fixmap.h |  67 +
 arch/arm64/include/asm/io.h |   1 +
 arch/arm64/include/asm/memory.h |   2 +-
 arch/arm64/include/asm/mmu.h|   1 +
 arch/arm64/kernel/early_printk.c|   8 +-
 arch/arm64/kernel/head.S|   9 +-
 arch/arm64/kernel/setup.c   |   4 +
 arch/arm64/mm/ioremap.c |  85 +++
 arch/arm64/mm/mmu.c |  44 +-
 arch/x86/Kconfig|   1 +
 arch/x86/include/asm/Kbuild |   1 +
 arch/x86/include/asm/fixmap.h   |   6 +
 arch/x86/include/asm/io.h   |  14 +-
 arch/x86/mm/ioremap.c   | 224 +
 arch/x86/mm/pgtable_32.c|   2 +-
 include/asm-generic/early_ioremap.h |  42 ++
 mm/Kconfig  |   3 +
 mm/Makefile |   1 +
 mm/early_ioremap.c  | 271 
 22 files changed, 503 insertions(+), 289 deletions(-)
 create mode 100644 arch/arm64/include/asm/fixmap.h
 create mode 100644 include/asm-generic/early_ioremap.h
 create mode 100644 mm/early_ioremap.c

-- 
1.8.5.3

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3/5] x86: use generic early_ioremap

2014-03-04 Thread Mark Salter
Move x86 over to the generic early ioremap implementation.

Signed-off-by: Mark Salter msal...@redhat.com
Acked-by: H. Peter Anvin h...@zytor.com
---
 arch/x86/Kconfig  |   1 +
 arch/x86/include/asm/Kbuild   |   1 +
 arch/x86/include/asm/fixmap.h |   6 ++
 arch/x86/include/asm/io.h |  15 +--
 arch/x86/mm/ioremap.c | 228 +-
 arch/x86/mm/pgtable_32.c  |   2 +-
 6 files changed, 13 insertions(+), 240 deletions(-)

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 0af5250..fb479bc 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -127,6 +127,7 @@ config X86
select HAVE_DEBUG_STACKOVERFLOW
select HAVE_IRQ_EXIT_ON_IRQ_STACK if X86_64
select HAVE_CC_STACKPROTECTOR
+   select GENERIC_EARLY_IOREMAP
 
 config INSTRUCTION_DECODER
def_bool y
diff --git a/arch/x86/include/asm/Kbuild b/arch/x86/include/asm/Kbuild
index 7f66985..203f5f9 100644
--- a/arch/x86/include/asm/Kbuild
+++ b/arch/x86/include/asm/Kbuild
@@ -5,3 +5,4 @@ genhdr-y += unistd_64.h
 genhdr-y += unistd_x32.h
 
 generic-y += clkdev.h
+generic-y += early_ioremap.h
diff --git a/arch/x86/include/asm/fixmap.h b/arch/x86/include/asm/fixmap.h
index 7252cd3..e5f236d 100644
--- a/arch/x86/include/asm/fixmap.h
+++ b/arch/x86/include/asm/fixmap.h
@@ -177,5 +177,11 @@ static inline void __set_fixmap(enum fixed_addresses idx,
 
 #include asm-generic/fixmap.h
 
+#define __late_set_fixmap(idx, phys, flags) __set_fixmap(idx, phys, flags)
+#define __late_clear_fixmap(idx) __set_fixmap(idx, 0, __pgprot(0))
+
+void __early_set_fixmap(enum fixed_addresses idx,
+   phys_addr_t phys, pgprot_t flags);
+
 #endif /* !__ASSEMBLY__ */
 #endif /* _ASM_X86_FIXMAP_H */
diff --git a/arch/x86/include/asm/io.h b/arch/x86/include/asm/io.h
index 1db414f..aae7010 100644
--- a/arch/x86/include/asm/io.h
+++ b/arch/x86/include/asm/io.h
@@ -39,6 +39,7 @@
 #include linux/string.h
 #include linux/compiler.h
 #include asm/page.h
+#include asm/early_ioremap.h
 
 #define build_mmio_read(name, size, type, reg, barrier) \
 static inline type name(const volatile void __iomem *addr) \
@@ -316,20 +317,6 @@ extern int ioremap_change_attr(unsigned long vaddr, 
unsigned long size,
unsigned long prot_val);
 extern void __iomem *ioremap_wc(resource_size_t offset, unsigned long size);
 
-/*
- * early_ioremap() and early_iounmap() are for temporary early boot-time
- * mappings, before the real ioremap() is functional.
- * A boot-time mapping is currently limited to at most 16 pages.
- */
-extern void early_ioremap_init(void);
-extern void early_ioremap_reset(void);
-extern void __iomem *early_ioremap(resource_size_t phys_addr,
-  unsigned long size);
-extern void *early_memremap(resource_size_t phys_addr,
-   unsigned long size);
-extern void early_iounmap(void __iomem *addr, unsigned long size);
-extern void early_memunmap(void *addr, unsigned long size);
-extern void fixup_early_ioremap(void);
 extern bool is_early_ioremap_ptep(pte_t *ptep);
 
 #ifdef CONFIG_XEN
diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c
index bbb4504..597ac15 100644
--- a/arch/x86/mm/ioremap.c
+++ b/arch/x86/mm/ioremap.c
@@ -328,17 +328,6 @@ void unxlate_dev_mem_ptr(unsigned long phys, void *addr)
return;
 }
 
-static int __initdata early_ioremap_debug;
-
-static int __init early_ioremap_debug_setup(char *str)
-{
-   early_ioremap_debug = 1;
-
-   return 0;
-}
-early_param(early_ioremap_debug, early_ioremap_debug_setup);
-
-static __initdata int after_paging_init;
 static pte_t bm_pte[PAGE_SIZE/sizeof(pte_t)] __page_aligned_bss;
 
 static inline pmd_t * __init early_ioremap_pmd(unsigned long addr)
@@ -362,18 +351,11 @@ bool __init is_early_ioremap_ptep(pte_t *ptep)
return ptep = bm_pte[0]  ptep  bm_pte[PAGE_SIZE/sizeof(pte_t)];
 }
 
-static unsigned long slot_virt[FIX_BTMAPS_SLOTS] __initdata;
-
 void __init early_ioremap_init(void)
 {
pmd_t *pmd;
-   int i;
 
-   if (early_ioremap_debug)
-   printk(KERN_INFO early_ioremap_init()\n);
-
-   for (i = 0; i  FIX_BTMAPS_SLOTS; i++)
-   slot_virt[i] = __fix_to_virt(FIX_BTMAP_BEGIN - NR_FIX_BTMAPS*i);
+   early_ioremap_setup();
 
pmd = early_ioremap_pmd(fix_to_virt(FIX_BTMAP_BEGIN));
memset(bm_pte, 0, sizeof(bm_pte));
@@ -402,13 +384,8 @@ void __init early_ioremap_init(void)
}
 }
 
-void __init early_ioremap_reset(void)
-{
-   after_paging_init = 1;
-}
-
-static void __init __early_set_fixmap(enum fixed_addresses idx,
- phys_addr_t phys, pgprot_t flags)
+void __init __early_set_fixmap(enum fixed_addresses idx,
+  phys_addr_t phys, pgprot_t flags)
 {
unsigned long addr = __fix_to_virt(idx);
pte_t *pte;
@@ -425,202 +402,3 @@ static void __init __early_set_fixmap(enum 

[PATCH 3.10 78/97] ALSA: hda - Add a fixup for HP Folio 13 mute LED

2014-03-04 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Takashi Iwai ti...@suse.de

commit 37c367ecdb9a01c9acc980e6e17913570a1788a7 upstream.

HP Folio 13 may have a broken BIOS that doesn't set up the mute LED
GPIO properly, and the driver guesses it wrongly, too.  Add a new
fixup entry for setting the GPIO pin statically for this laptop.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=70991
Signed-off-by: Takashi Iwai ti...@suse.de
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org

---
 sound/pci/hda/patch_sigmatel.c |   20 
 1 file changed, 20 insertions(+)

--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -98,6 +98,7 @@ enum {
STAC_92HD83XXX_HP_LED,
STAC_92HD83XXX_HP_INV_LED,
STAC_92HD83XXX_HP_MIC_LED,
+   STAC_HP_LED_GPIO10,
STAC_92HD83XXX_HEADSET_JACK,
STAC_92HD83XXX_HP,
STAC_HP_ENVY_BASS,
@@ -2107,6 +2108,17 @@ static void stac92hd83xxx_fixup_hp_mic_l
spec-mic_mute_led_gpio = 0x08; /* GPIO3 */
 }
 
+static void stac92hd83xxx_fixup_hp_led_gpio10(struct hda_codec *codec,
+  const struct hda_fixup *fix, int action)
+{
+   struct sigmatel_spec *spec = codec-spec;
+
+   if (action == HDA_FIXUP_ACT_PRE_PROBE) {
+   spec-gpio_led = 0x10; /* GPIO4 */
+   spec-default_polarity = 0;
+   }
+}
+
 static void stac92hd83xxx_fixup_headset_jack(struct hda_codec *codec,
   const struct hda_fixup *fix, int action)
 {
@@ -2173,6 +2185,12 @@ static const struct hda_fixup stac92hd83
.chained = true,
.chain_id = STAC_92HD83XXX_HP,
},
+   [STAC_HP_LED_GPIO10] = {
+   .type = HDA_FIXUP_FUNC,
+   .v.func = stac92hd83xxx_fixup_hp_led_gpio10,
+   .chained = true,
+   .chain_id = STAC_92HD83XXX_HP,
+   },
[STAC_92HD83XXX_HEADSET_JACK] = {
.type = HDA_FIXUP_FUNC,
.v.func = stac92hd83xxx_fixup_headset_jack,
@@ -2244,6 +2262,8 @@ static const struct snd_pci_quirk stac92
  HP, STAC_92HD83XXX_HP_cNB11_INTQUAD),
SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1888,
  HP Envy Spectre, STAC_HP_ENVY_BASS),
+   SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1899,
+ HP Folio 13, STAC_HP_LED_GPIO10),
SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x18df,
  HP Folio, STAC_92HD83XXX_HP_MIC_LED),
SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xff00, 0x1900,


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/5] mm: create generic early_ioremap() support

2014-03-04 Thread Mark Salter
This patch creates a generic implementation of early_ioremap() support
based on the existing x86 implementation. early_ioremp() is useful for
early boot code which needs to temporarily map I/O or memory regions
before normal mapping functions such as ioremap() are available.

Some architectures have optional MMU. In the no-MMU case, the remap
functions simply return the passed in physical address and the unmap
functions do nothing.

Signed-off-by: Mark Salter msal...@redhat.com
Acked-by: Catalin Marinas catalin.mari...@arm.com
Acked-by: H. Peter Anvin h...@zytor.com
---
 include/asm-generic/early_ioremap.h |  42 ++
 mm/Kconfig  |   3 +
 mm/Makefile |   1 +
 mm/early_ioremap.c  | 271 
 4 files changed, 317 insertions(+)
 create mode 100644 include/asm-generic/early_ioremap.h
 create mode 100644 mm/early_ioremap.c

diff --git a/include/asm-generic/early_ioremap.h 
b/include/asm-generic/early_ioremap.h
new file mode 100644
index 000..a5de55c
--- /dev/null
+++ b/include/asm-generic/early_ioremap.h
@@ -0,0 +1,42 @@
+#ifndef _ASM_EARLY_IOREMAP_H_
+#define _ASM_EARLY_IOREMAP_H_
+
+#include linux/types.h
+
+/*
+ * early_ioremap() and early_iounmap() are for temporary early boot-time
+ * mappings, before the real ioremap() is functional.
+ */
+extern void __iomem *early_ioremap(resource_size_t phys_addr,
+  unsigned long size);
+extern void *early_memremap(resource_size_t phys_addr,
+   unsigned long size);
+extern void early_iounmap(void __iomem *addr, unsigned long size);
+extern void early_memunmap(void *addr, unsigned long size);
+
+/*
+ * Weak function called by early_ioremap_reset(). It does nothing, but
+ * architectures may provide their own version to do any needed cleanups.
+ */
+extern void early_ioremap_shutdown(void);
+
+#if defined(CONFIG_GENERIC_EARLY_IOREMAP)  defined(CONFIG_MMU)
+/* Arch-specific initialization */
+extern void early_ioremap_init(void);
+
+/* Generic initialization called by architecture code */
+extern void early_ioremap_setup(void);
+
+/*
+ * Called as last step in paging_init() so library can act
+ * accordingly for subsequent map/unmap requests.
+ */
+extern void early_ioremap_reset(void);
+
+#else
+static inline void early_ioremap_init(void) { }
+static inline void early_ioremap_setup(void) { }
+static inline void early_ioremap_reset(void) { }
+#endif
+
+#endif /* _ASM_EARLY_IOREMAP_H_ */
diff --git a/mm/Kconfig b/mm/Kconfig
index 2d9f150..bf846a2 100644
--- a/mm/Kconfig
+++ b/mm/Kconfig
@@ -577,3 +577,6 @@ config PGTABLE_MAPPING
 
  You can check speed with zsmalloc benchmark[1].
  [1] https://github.com/spartacus06/zsmalloc
+
+config GENERIC_EARLY_IOREMAP
+   bool
diff --git a/mm/Makefile b/mm/Makefile
index 310c90a..9d9c587 100644
--- a/mm/Makefile
+++ b/mm/Makefile
@@ -61,3 +61,4 @@ obj-$(CONFIG_CLEANCACHE) += cleancache.o
 obj-$(CONFIG_MEMORY_ISOLATION) += page_isolation.o
 obj-$(CONFIG_ZBUD) += zbud.o
 obj-$(CONFIG_ZSMALLOC) += zsmalloc.o
+obj-$(CONFIG_GENERIC_EARLY_IOREMAP) += early_ioremap.o
diff --git a/mm/early_ioremap.c b/mm/early_ioremap.c
new file mode 100644
index 000..6591759
--- /dev/null
+++ b/mm/early_ioremap.c
@@ -0,0 +1,271 @@
+/*
+ * Provide common bits of early_ioremap() support for architectures needing
+ * temporary mappings during boot before ioremap() is available.
+ *
+ * This is mostly a direct copy of the x86 early_ioremap implementation.
+ *
+ * (C) Copyright 1995 1996, 2014 Linus Torvalds
+ *
+ */
+#include linux/init.h
+#include linux/io.h
+#include linux/module.h
+#include linux/slab.h
+#include linux/mm.h
+#include linux/vmalloc.h
+#include asm/fixmap.h
+
+#ifdef CONFIG_MMU
+static int early_ioremap_debug __initdata;
+
+static int __init early_ioremap_debug_setup(char *str)
+{
+   early_ioremap_debug = 1;
+
+   return 0;
+}
+early_param(early_ioremap_debug, early_ioremap_debug_setup);
+
+static int after_paging_init __initdata;
+
+void __init __attribute__((weak)) early_ioremap_shutdown(void)
+{
+}
+
+void __init early_ioremap_reset(void)
+{
+   early_ioremap_shutdown();
+   after_paging_init = 1;
+}
+
+/*
+ * Generally, ioremap() is available after paging_init() has been called.
+ * Architectures wanting to allow early_ioremap after paging_init() can
+ * define __late_set_fixmap and __late_clear_fixmap to do the right thing.
+ */
+#ifndef __late_set_fixmap
+static inline void __init __late_set_fixmap(enum fixed_addresses idx,
+   phys_addr_t phys, pgprot_t prot)
+{
+   BUG();
+}
+#endif
+
+#ifndef __late_clear_fixmap
+static inline void __init __late_clear_fixmap(enum fixed_addresses idx)
+{
+   BUG();
+}
+#endif
+
+static void __iomem *prev_map[FIX_BTMAPS_SLOTS] __initdata;
+static unsigned long prev_size[FIX_BTMAPS_SLOTS] __initdata;
+static unsigned long slot_virt[FIX_BTMAPS_SLOTS] 

[PATCH 4/5] arm64: initialize pgprot info earlier in boot

2014-03-04 Thread Mark Salter
Presently, paging_init() calls init_mem_pgprot() to initialize pgprot
values used by macros such as PAGE_KERNEL, PAGE_KERNEL_EXEC, etc. The
new fixmap and early_ioremap support also needs to use these macros
before paging_init() is called. This patch moves the init_mem_pgprot()
call out of paging_init() and into setup_arch() so that pgprot_default
gets initialized in time for fixmap and early_ioremap.

Signed-off-by: Mark Salter msal...@redhat.com
Acked-by: Catalin Marinas catalin.mari...@arm.com
---
 arch/arm64/include/asm/mmu.h | 1 +
 arch/arm64/kernel/setup.c| 2 ++
 arch/arm64/mm/mmu.c  | 3 +--
 3 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/arm64/include/asm/mmu.h b/arch/arm64/include/asm/mmu.h
index 2494fc0..f600d40 100644
--- a/arch/arm64/include/asm/mmu.h
+++ b/arch/arm64/include/asm/mmu.h
@@ -27,5 +27,6 @@ typedef struct {
 extern void paging_init(void);
 extern void setup_mm_for_reboot(void);
 extern void __iomem *early_io_map(phys_addr_t phys, unsigned long virt);
+extern void init_mem_pgprot(void);
 
 #endif
diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c
index c8e9eff..1c66cfb 100644
--- a/arch/arm64/kernel/setup.c
+++ b/arch/arm64/kernel/setup.c
@@ -327,6 +327,8 @@ void __init setup_arch(char **cmdline_p)
 
*cmdline_p = boot_command_line;
 
+   init_mem_pgprot();
+
parse_early_param();
 
arm64_memblock_init();
diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c
index f8dc7e8..ba259a0 100644
--- a/arch/arm64/mm/mmu.c
+++ b/arch/arm64/mm/mmu.c
@@ -125,7 +125,7 @@ early_param(cachepolicy, early_cachepolicy);
 /*
  * Adjust the PMD section entries according to the CPU in use.
  */
-static void __init init_mem_pgprot(void)
+void __init init_mem_pgprot(void)
 {
pteval_t default_pgprot;
int i;
@@ -357,7 +357,6 @@ void __init paging_init(void)
 {
void *zero_page;
 
-   init_mem_pgprot();
map_mem();
 
/*
-- 
1.8.5.3

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/5] x86/mm: sparse warning fix for early_memremap

2014-03-04 Thread Mark Salter
From: Dave Young dyo...@redhat.com

There's a lot of sparse warnings for code like below:
void *a = early_memremap(phys_addr, size);

early_memremap intend to map kernel memory with ioremap facility, the return
pointer should be a kernel ram pointer instead of iomem one.

For making the function clearer and supressing sparse warnings this patch
do below two things:
1. cast to (__force void *) for the return value of early_memremap
2. add early_memunmap function and pass (__force void __iomem *) to iounmap

From Boris:
 Ingo told me yesterday, it makes sense too. I'd guess we can try it.
 FWIW, all callers of early_memremap use the memory they get remapped as
 normal memory so we should be safe.

Signed-off-by: Dave Young dyo...@redhat.com
Signed-off-by: Mark Salter msal...@redhat.com
Acked-by: H. Peter Anvin h...@zytor.com
---
 arch/x86/include/asm/io.h |  3 ++-
 arch/x86/mm/ioremap.c | 10 +++---
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/arch/x86/include/asm/io.h b/arch/x86/include/asm/io.h
index 34f69cb..1db414f 100644
--- a/arch/x86/include/asm/io.h
+++ b/arch/x86/include/asm/io.h
@@ -325,9 +325,10 @@ extern void early_ioremap_init(void);
 extern void early_ioremap_reset(void);
 extern void __iomem *early_ioremap(resource_size_t phys_addr,
   unsigned long size);
-extern void __iomem *early_memremap(resource_size_t phys_addr,
+extern void *early_memremap(resource_size_t phys_addr,
unsigned long size);
 extern void early_iounmap(void __iomem *addr, unsigned long size);
+extern void early_memunmap(void *addr, unsigned long size);
 extern void fixup_early_ioremap(void);
 extern bool is_early_ioremap_ptep(pte_t *ptep);
 
diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c
index 799580c..bbb4504 100644
--- a/arch/x86/mm/ioremap.c
+++ b/arch/x86/mm/ioremap.c
@@ -562,10 +562,9 @@ early_ioremap(resource_size_t phys_addr, unsigned long 
size)
 }
 
 /* Remap memory */
-void __init __iomem *
-early_memremap(resource_size_t phys_addr, unsigned long size)
+void __init *early_memremap(resource_size_t phys_addr, unsigned long size)
 {
-   return __early_ioremap(phys_addr, size, PAGE_KERNEL);
+   return (__force void *)__early_ioremap(phys_addr, size, PAGE_KERNEL);
 }
 
 void __init early_iounmap(void __iomem *addr, unsigned long size)
@@ -620,3 +619,8 @@ void __init early_iounmap(void __iomem *addr, unsigned long 
size)
}
prev_map[slot] = NULL;
 }
+
+void __init early_memunmap(void *addr, unsigned long size)
+{
+   early_iounmap((__force void __iomem *)addr, size);
+}
-- 
1.8.5.3

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 5/5] arm64: add early_ioremap support

2014-03-04 Thread Mark Salter
Add support for early IO or memory mappings which are needed
before the normal ioremap() is usable. This also adds fixmap
support for permanent fixed mappings such as that used by the
earlyprintk device register region.

Signed-off-by: Mark Salter msal...@redhat.com
Acked-by: Catalin Marinas catalin.mari...@arm.com
---
 Documentation/arm64/memory.txt   |  4 +-
 arch/arm64/Kconfig   |  1 +
 arch/arm64/include/asm/Kbuild|  1 +
 arch/arm64/include/asm/fixmap.h  | 67 +++
 arch/arm64/include/asm/io.h  |  1 +
 arch/arm64/include/asm/memory.h  |  2 +-
 arch/arm64/kernel/early_printk.c |  8 +++-
 arch/arm64/kernel/head.S |  9 ++---
 arch/arm64/kernel/setup.c|  2 +
 arch/arm64/mm/ioremap.c  | 85 
 arch/arm64/mm/mmu.c  | 41 ---
 11 files changed, 169 insertions(+), 52 deletions(-)
 create mode 100644 arch/arm64/include/asm/fixmap.h

diff --git a/Documentation/arm64/memory.txt b/Documentation/arm64/memory.txt
index 5e054bf..953c81e 100644
--- a/Documentation/arm64/memory.txt
+++ b/Documentation/arm64/memory.txt
@@ -35,7 +35,7 @@ ffbc  ffbd   8GB  
vmemmap
 
 ffbe   ffbffbbf  ~8GB  [guard, future 
vmmemap]
 
-ffbffbc0   ffbffbdf   2MB  earlyprintk 
device
+ffbffbc0   ffbffbdf   2MB  fixed mappings
 
 ffbffbe0   ffbffbe0  64KB  PCI I/O space
 
@@ -60,7 +60,7 @@ fdfc  fdfd   8GB  
vmemmap
 
 fdfe   fdfffbbf  ~8GB  [guard, future 
vmmemap]
 
-fdfffbc0   fdfffbdf   2MB  earlyprintk 
device
+fdfffbc0   fdfffbdf   2MB  fixed mappings
 
 fdfffbe0   fdfffbe0  64KB  PCI I/O space
 
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 27bbcfc..da4304a 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -16,6 +16,7 @@ config ARM64
select DCACHE_WORD_ACCESS
select GENERIC_CLOCKEVENTS
select GENERIC_CLOCKEVENTS_BROADCAST if SMP
+   select GENERIC_EARLY_IOREMAP
select GENERIC_IOMAP
select GENERIC_IRQ_PROBE
select GENERIC_IRQ_SHOW
diff --git a/arch/arm64/include/asm/Kbuild b/arch/arm64/include/asm/Kbuild
index 71c53ec..27e3c6b 100644
--- a/arch/arm64/include/asm/Kbuild
+++ b/arch/arm64/include/asm/Kbuild
@@ -10,6 +10,7 @@ generic-y += delay.h
 generic-y += div64.h
 generic-y += dma.h
 generic-y += emergency-restart.h
+generic-y += early_ioremap.h
 generic-y += errno.h
 generic-y += ftrace.h
 generic-y += hw_irq.h
diff --git a/arch/arm64/include/asm/fixmap.h b/arch/arm64/include/asm/fixmap.h
new file mode 100644
index 000..9c1fb65
--- /dev/null
+++ b/arch/arm64/include/asm/fixmap.h
@@ -0,0 +1,67 @@
+/*
+ * fixmap.h: compile-time virtual memory allocation
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file COPYING in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 1998 Ingo Molnar
+ * Copyright (C) 2013 Mark Salter msal...@redhat.com
+ *
+ * Adapted from arch/x86_64 version.
+ *
+ */
+
+#ifndef _ASM_ARM64_FIXMAP_H
+#define _ASM_ARM64_FIXMAP_H
+
+#ifndef __ASSEMBLY__
+#include linux/kernel.h
+#include asm/page.h
+
+/*
+ * Here we define all the compile-time 'special' virtual
+ * addresses. The point is to have a constant address at
+ * compile time, but to set the physical address only
+ * in the boot process.
+ *
+ * These 'compile-time allocated' memory buffers are
+ * page-sized. Use set_fixmap(idx,phys) to associate
+ * physical memory with fixmap indices.
+ *
+ */
+enum fixed_addresses {
+   FIX_EARLYCON,
+   __end_of_permanent_fixed_addresses,
+
+   /*
+* Temporary boot-time mappings, used by early_ioremap(),
+* before ioremap() is functional.
+*/
+#ifdef CONFIG_ARM64_64K_PAGES
+#define NR_FIX_BTMAPS  4
+#else
+#define NR_FIX_BTMAPS  64
+#endif
+#define FIX_BTMAPS_SLOTS   7
+#define TOTAL_FIX_BTMAPS   (NR_FIX_BTMAPS * FIX_BTMAPS_SLOTS)
+
+   FIX_BTMAP_END = __end_of_permanent_fixed_addresses,
+   FIX_BTMAP_BEGIN = FIX_BTMAP_END + TOTAL_FIX_BTMAPS - 1,
+   __end_of_fixed_addresses
+};
+
+#define FIXADDR_SIZE   (__end_of_permanent_fixed_addresses  PAGE_SHIFT)
+#define FIXADDR_START  (FIXADDR_TOP - FIXADDR_SIZE)
+
+#define FIXMAP_PAGE_IO __pgprot(PROT_DEVICE_nGnRE)
+
+extern void __early_set_fixmap(enum fixed_addresses idx,
+  phys_addr_t phys, pgprot_t flags);
+
+#define __set_fixmap __early_set_fixmap
+
+#include asm-generic/fixmap.h
+
+#endif /* !__ASSEMBLY__ */
+#endif /* _ASM_ARM64_FIXMAP_H */
diff --git a/arch/arm64/include/asm/io.h 

Re: Update of file offset on write() etc. is non-atomic with I/O

2014-03-04 Thread Cedric Blancher
On 4 March 2014 00:39, Al Viro v...@zeniv.linux.org.uk wrote:
 On Mon, Mar 03, 2014 at 03:23:55PM -0800, Linus Torvalds wrote:

 This just uses a flags field, and we currently only have two bits
 that we use: FDPUT_FPUT and FDPUT_POS_UNLOCK. The first patch knows
 that fget_light() writes 0/1 for that, which is the same as the
 FDPUT_FPUT bit. I didn't bother to comment on it or clean it up, since
 the second patch just removes that whole fget_light() mess.

 Comments?

 do_sendfile() is also there and this one is even more unpleasant ;-/
 We probably can ignore that one (until POSIX learns of its existence),
 thouhg...

I've forwarded your request to the Austin Group (who manage the POSIX stuff).

Ced
-- 
Cedric Blancher cedric.blanc...@gmail.com
Institute Pasteur
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.10 82/97] ipc,mqueue: remove limits for the amount of system-wide queues

2014-03-04 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Davidlohr Bueso davidl...@hp.com

commit f3713fd9cff733d9df83116422d8e4af6e86b2bb upstream.

Commit 93e6f119c0ce (ipc/mqueue: cleanup definition names and
locations) added global hardcoded limits to the amount of message
queues that can be created.  While these limits are per-namespace,
reality is that it ends up breaking userspace applications.
Historically users have, at least in theory, been able to create up to
INT_MAX queues, and limiting it to just 1024 is way too low and dramatic
for some workloads and use cases.  For instance, Madars reports:

 This update imposes bad limits on our multi-process application.  As
  our app uses approaches that each process opens its own set of queues
  (usually something about 3-5 queues per process).  In some scenarios
  we might run up to 3000 processes or more (which of-course for linux
  is not a problem).  Thus we might need up to 9000 queues or more.  All
  processes run under one user.

Other affected users can be found in launchpad bug #1155695:
  https://bugs.launchpad.net/ubuntu/+source/manpages/+bug/1155695

Instead of increasing this limit, revert it entirely and fallback to the
original way of dealing queue limits -- where once a user's resource
limit is reached, and all memory is used, new queues cannot be created.

Signed-off-by: Davidlohr Bueso davidl...@hp.com
Reported-by: Madars Vitolins m...@silodev.com
Acked-by: Doug Ledford dledf...@redhat.com
Cc: Manfred Spraul manf...@colorfullife.com
Signed-off-by: Andrew Morton a...@linux-foundation.org
Signed-off-by: Linus Torvalds torva...@linux-foundation.org
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org

---
 include/linux/ipc_namespace.h |2 --
 ipc/mq_sysctl.c   |   18 --
 ipc/mqueue.c  |6 +++---
 3 files changed, 15 insertions(+), 11 deletions(-)

--- a/include/linux/ipc_namespace.h
+++ b/include/linux/ipc_namespace.h
@@ -119,9 +119,7 @@ extern int mq_init_ns(struct ipc_namespa
  * the new maximum will handle anyone else.  I may have to revisit this
  * in the future.
  */
-#define MIN_QUEUESMAX  1
 #define DFLT_QUEUESMAX   256
-#define HARD_QUEUESMAX  1024
 #define MIN_MSGMAX 1
 #define DFLT_MSG  10U
 #define DFLT_MSGMAX   10
--- a/ipc/mq_sysctl.c
+++ b/ipc/mq_sysctl.c
@@ -22,6 +22,16 @@ static void *get_mq(ctl_table *table)
return which;
 }
 
+static int proc_mq_dointvec(ctl_table *table, int write,
+   void __user *buffer, size_t *lenp, loff_t *ppos)
+{
+   struct ctl_table mq_table;
+   memcpy(mq_table, table, sizeof(mq_table));
+   mq_table.data = get_mq(table);
+
+   return proc_dointvec(mq_table, write, buffer, lenp, ppos);
+}
+
 static int proc_mq_dointvec_minmax(ctl_table *table, int write,
void __user *buffer, size_t *lenp, loff_t *ppos)
 {
@@ -33,12 +43,10 @@ static int proc_mq_dointvec_minmax(ctl_t
lenp, ppos);
 }
 #else
+#define proc_mq_dointvec NULL
 #define proc_mq_dointvec_minmax NULL
 #endif
 
-static int msg_queues_limit_min = MIN_QUEUESMAX;
-static int msg_queues_limit_max = HARD_QUEUESMAX;
-
 static int msg_max_limit_min = MIN_MSGMAX;
 static int msg_max_limit_max = HARD_MSGMAX;
 
@@ -51,9 +59,7 @@ static ctl_table mq_sysctls[] = {
.data   = init_ipc_ns.mq_queues_max,
.maxlen = sizeof(int),
.mode   = 0644,
-   .proc_handler   = proc_mq_dointvec_minmax,
-   .extra1 = msg_queues_limit_min,
-   .extra2 = msg_queues_limit_max,
+   .proc_handler   = proc_mq_dointvec,
},
{
.procname   = msg_max,
--- a/ipc/mqueue.c
+++ b/ipc/mqueue.c
@@ -433,9 +433,9 @@ static int mqueue_create(struct inode *d
error = -EACCES;
goto out_unlock;
}
-   if (ipc_ns-mq_queues_count = HARD_QUEUESMAX ||
-   (ipc_ns-mq_queues_count = ipc_ns-mq_queues_max 
-!capable(CAP_SYS_RESOURCE))) {
+
+   if (ipc_ns-mq_queues_count = ipc_ns-mq_queues_max 
+   !capable(CAP_SYS_RESOURCE)) {
error = -ENOSPC;
goto out_unlock;
}


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.10 81/97] quota: Fix race between dqput() and dquot_scan_active()

2014-03-04 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Jan Kara j...@suse.cz

commit 1362f4ea20fa63688ba6026e586d9746ff13a846 upstream.

Currently last dqput() can race with dquot_scan_active() causing it to
call callback for an already deactivated dquot. The race is as follows:

CPU1CPU2
  dqput()
spin_lock(dq_list_lock);
if (atomic_read(dquot-dq_count)  1) {
 - not taken
if (test_bit(DQ_ACTIVE_B, dquot-dq_flags)) {
  spin_unlock(dq_list_lock);
  -release_dquot(dquot);
if (atomic_read(dquot-dq_count)  1)
 - not taken
  dquot_scan_active()
spin_lock(dq_list_lock);
if (!test_bit(DQ_ACTIVE_B, 
dquot-dq_flags))
 - not taken
atomic_inc(dquot-dq_count);
spin_unlock(dq_list_lock);
- proceeds to release dquot
ret = fn(dquot, priv);
 - called for inactive dquot

Fix the problem by making sure possible -release_dquot() is finished by
the time we call the callback and new calls to it will notice reference
dquot_scan_active() has taken and bail out.

Signed-off-by: Jan Kara j...@suse.cz
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org

---
 fs/quota/dquot.c |   14 +++---
 1 file changed, 11 insertions(+), 3 deletions(-)

--- a/fs/quota/dquot.c
+++ b/fs/quota/dquot.c
@@ -581,9 +581,17 @@ int dquot_scan_active(struct super_block
dqstats_inc(DQST_LOOKUPS);
dqput(old_dquot);
old_dquot = dquot;
-   ret = fn(dquot, priv);
-   if (ret  0)
-   goto out;
+   /*
+* -release_dquot() can be racing with us. Our reference
+* protects us from new calls to it so just wait for any
+* outstanding call and recheck the DQ_ACTIVE_B after that.
+*/
+   wait_on_dquot(dquot);
+   if (test_bit(DQ_ACTIVE_B, dquot-dq_flags)) {
+   ret = fn(dquot, priv);
+   if (ret  0)
+   goto out;
+   }
spin_lock(dq_list_lock);
/* We are safe to continue now because our dquot could not
 * be moved out of the inuse list while we hold the reference */


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] touchscreen: tps6507x-ts: only poll while touch event is occurring

2014-03-04 Thread Jon Ringle
We only need to poll for touch events after an interrupt occurs due to the
user touching the screen. We continue to poll until the user stops touching
the screen

Signed-off-by: Jon Ringle jrin...@gridpoint.com
---
 drivers/input/touchscreen/tps6507x-ts.c | 191 +---
 include/linux/mfd/tps6507x.h|   1 +
 2 files changed, 153 insertions(+), 39 deletions(-)

diff --git a/drivers/input/touchscreen/tps6507x-ts.c 
b/drivers/input/touchscreen/tps6507x-ts.c
index 94cde2c..fa1fb24 100644
--- a/drivers/input/touchscreen/tps6507x-ts.c
+++ b/drivers/input/touchscreen/tps6507x-ts.c
@@ -17,11 +17,14 @@
 #include linux/workqueue.h
 #include linux/slab.h
 #include linux/input.h
-#include linux/input-polldev.h
 #include linux/platform_device.h
 #include linux/mfd/tps6507x.h
 #include linux/input/tps6507x-ts.h
 #include linux/delay.h
+#include linux/gpio.h
+#include linux/i2c.h
+#include linux/irq.h
+#include linux/interrupt.h

 #define TSC_DEFAULT_POLL_PERIOD 30 /* ms */
 #define TPS_DEFAULT_MIN_PRESSURE 0x30
@@ -39,13 +42,17 @@ struct ts_event {
 };

 struct tps6507x_ts {
+   struct input_dev*input_dev;
struct device   *dev;
-   struct input_polled_dev *poll_dev;
struct tps6507x_dev *mfd;
charphys[32];
+   struct delayed_work work;
struct ts_event tc;
+   int irq;
+   unsigned long   poll_period;/* ms */
u16 min_pressure;
boolpendown;
+   int open_count;
 };

 static int tps6507x_read_u8(struct tps6507x_ts *tsc, u8 reg, u8 *data)
@@ -155,13 +162,20 @@ static s32 tps6507x_adc_standby(struct tps6507x_ts *tsc)
return ret;
 }

-static void tps6507x_ts_poll(struct input_polled_dev *poll_dev)
+static void tps6507x_ts_handler(struct work_struct *work)
 {
-   struct tps6507x_ts *tsc = poll_dev-private;
-   struct input_dev *input_dev = poll_dev-input;
+   struct tps6507x_ts *tsc =  container_of(work, struct tps6507x_ts, 
work.work);
+   struct input_dev *input_dev = tsc-input_dev;
bool pendown;
+   int schd;
+   int poll = 0;
s32 ret;

+   if (tsc-irq) {
+   // Disable the touch interrupt
+   tps6507x_write_u8(tsc, TPS6507X_REG_INT, 0);
+   }
+
ret = tps6507x_adc_conversion(tsc, TPS6507X_TSCMODE_PRESSURE,
  tsc-tc.pressure);
if (ret)
@@ -178,9 +192,11 @@ static void tps6507x_ts_poll(struct input_polled_dev 
*poll_dev)
}

if (pendown) {
+   int report_pendown = 0;

if (!tsc-pendown) {
dev_dbg(tsc-dev, DOWN\n);
+   report_pendown = 1;
input_report_key(input_dev, BTN_TOUCH, 1);
} else
dev_dbg(tsc-dev, still down\n);
@@ -195,15 +211,89 @@ static void tps6507x_ts_poll(struct input_polled_dev 
*poll_dev)
if (ret)
goto done;

-   input_report_abs(input_dev, ABS_X, tsc-tc.x);
-   input_report_abs(input_dev, ABS_Y, tsc-tc.y);
-   input_report_abs(input_dev, ABS_PRESSURE, tsc-tc.pressure);
-   input_sync(input_dev);
-   tsc-pendown = true;
+   if (tsc-tc.x  tsc-tc.y) {
+   if (report_pendown)
+   input_report_key(input_dev, BTN_TOUCH, 1);
+
+   input_report_abs(input_dev, ABS_X, tsc-tc.x);
+   input_report_abs(input_dev, ABS_Y, tsc-tc.y);
+   input_report_abs(input_dev, ABS_PRESSURE, 
tsc-tc.pressure);
+   input_sync(input_dev);
+   tsc-pendown = true;
+   } else {
+   dev_dbg(tsc-dev, discarding bogus read x=%d, y=%d, 
pressure=%d\n, tsc-tc.x, tsc-tc.y, tsc-tc.pressure);
+   }
+   poll = 1;
}

 done:
tps6507x_adc_standby(tsc);
+   if (tsc-irq  !poll) {
+   // Re-enable the interrupt
+   tps6507x_write_u8(tsc, TPS6507X_REG_INT, TPS6507X_REG_MASK_TSC);
+   } else {
+   /* always poll if not using interrupts */
+   schd = schedule_delayed_work(tsc-work,
+
msecs_to_jiffies(tsc-poll_period));
+   }
+}
+
+static irqreturn_t tps6507x_ts_irq(int irq, void * dev_id)
+{
+   struct tps6507x_ts * tsc = (struct tps6507x_ts *)dev_id;
+
+   schedule_delayed_work(tsc-work, 0);
+
+   return IRQ_HANDLED;
+}
+
+static int tps6507x_ts_open(struct input_dev *input_dev)
+{
+   int ret;
+   struct tps6507x_ts *tsc = input_get_drvdata(input_dev);
+
+   tsc-open_count++;
+
+// printk(%s: %s\n, __func__, comm);
+   dump_stack();
+
+   if (tsc-irq) {
+
+   

[PATCH 3.10 87/97] ARM: 7749/1: spinlock: retry trylock operation if strex fails on free lock

2014-03-04 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Will Deacon will.dea...@arm.com

commit 15e7e5c1ebf556cd620c9b091e121091ac760f6d upstream.

An exclusive store instruction may fail for reasons other than lock
contention (e.g. a cache eviction during the critical section) so, in
line with other architectures using similar exclusive instructions
(alpha, mips, powerpc), retry the trylock operation if the lock appears
to be free but the strex reported failure.

Reported-by: Tony Thompson anthony.thomp...@arm.com
Signed-off-by: Will Deacon will.dea...@arm.com
Signed-off-by: Russell King rmk+ker...@arm.linux.org.uk
Cc: Li Zefan lize...@huawei.com
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org

---
 arch/arm/include/asm/spinlock.h |   23 +--
 1 file changed, 13 insertions(+), 10 deletions(-)

--- a/arch/arm/include/asm/spinlock.h
+++ b/arch/arm/include/asm/spinlock.h
@@ -97,19 +97,22 @@ static inline void arch_spin_lock(arch_s
 
 static inline int arch_spin_trylock(arch_spinlock_t *lock)
 {
-   unsigned long tmp;
+   unsigned long contended, res;
u32 slock;
 
-   __asm__ __volatile__(
-  ldrex   %0, [%2]\n
-  subs%1, %0, %0, ror #16\n
-  addeq   %0, %0, %3\n
-  strexeq %1, %0, [%2]
-   : =r (slock), =r (tmp)
-   : r (lock-slock), I (1  TICKET_SHIFT)
-   : cc);
+   do {
+   __asm__ __volatile__(
+  ldrex   %0, [%3]\n
+  mov %2, #0\n
+  subs%1, %0, %0, ror #16\n
+  addeq   %0, %0, %4\n
+  strexeq %2, %0, [%3]
+   : =r (slock), =r (contended), =r (res)
+   : r (lock-slock), I (1  TICKET_SHIFT)
+   : cc);
+   } while (res);
 
-   if (tmp == 0) {
+   if (!contended) {
smp_mb();
return 1;
} else {


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.10 86/97] ARM: tegra: only run PL310 init on systems with one

2014-03-04 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Stephen Warren swar...@nvidia.com

commit 8859685785bfafadf9bc922dd3a2278e59886947 upstream.

Fix tegra_init_cache() to check whether the system has a PL310 cache
before touching the PL310 registers. This prevents access to non-existent
registers on Tegra114 and later.

Note for stable kernels:
In = v3.12, the file to patch is arch/arm/mach-tegra/common.c.

Signed-off-by: Stephen Warren swar...@nvidia.com
Signed-off-by: Olof Johansson o...@lixom.net
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org

---
 arch/arm/mach-tegra/common.c |   11 +++
 1 file changed, 11 insertions(+)

--- a/arch/arm/mach-tegra/common.c
+++ b/arch/arm/mach-tegra/common.c
@@ -22,6 +22,7 @@
 #include linux/io.h
 #include linux/clk.h
 #include linux/delay.h
+#include linux/of.h
 #include linux/irqchip.h
 #include linux/clk/tegra.h
 
@@ -80,10 +81,20 @@ void tegra_assert_system_reset(char mode
 static void __init tegra_init_cache(void)
 {
 #ifdef CONFIG_CACHE_L2X0
+   static const struct of_device_id pl310_ids[] __initconst = {
+   { .compatible = arm,pl310-cache,  },
+   {}
+   };
+
+   struct device_node *np;
int ret;
void __iomem *p = IO_ADDRESS(TEGRA_ARM_PERIF_BASE) + 0x3000;
u32 aux_ctrl, cache_type;
 
+   np = of_find_matching_node(NULL, pl310_ids);
+   if (!np)
+   return;
+
cache_type = readl(p + L2X0_CACHE_TYPE);
aux_ctrl = (cache_type  0x700)  (17-8);
aux_ctrl |= 0x7C41;


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.10 85/97] ARM64: unwind: Fix PC calculation

2014-03-04 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Olof Johansson o...@lixom.net

commit e306dfd06fcb44d21c80acb8e5a88d55f3d1cf63 upstream.

The frame PC value in the unwind code used to just take the saved LR
value and use that.  That's incorrect as a stack trace, since it shows
the return path stack, not the call path stack.

In particular, it shows faulty information in case the bl is done as
the very last instruction of one label, since the return point will be
in the next label. That can easily be seen with tail calls to panic(),
which is marked __noreturn and thus doesn't have anything useful after it.

Easiest here is to just correct the unwind code and do a -4, to get the
actual call site for the backtrace instead of the return site.

Signed-off-by: Olof Johansson o...@lixom.net
Signed-off-by: Catalin Marinas catalin.mari...@arm.com
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org

---
 arch/arm64/kernel/stacktrace.c |6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

--- a/arch/arm64/kernel/stacktrace.c
+++ b/arch/arm64/kernel/stacktrace.c
@@ -48,7 +48,11 @@ int unwind_frame(struct stackframe *fram
 
frame-sp = fp + 0x10;
frame-fp = *(unsigned long *)(fp);
-   frame-pc = *(unsigned long *)(fp + 8);
+   /*
+* -4 here because we care about the PC at time of bl,
+* not where the return will go.
+*/
+   frame-pc = *(unsigned long *)(fp + 8) - 4;
 
return 0;
 }


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.10 71/97] USB: ftdi_sio: add Cressi Leonardo PID

2014-03-04 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Joerg Dorchain jo...@dorchain.net

commit 6dbd46c849e071e6afc1e0cad489b0175bca9318 upstream.

Hello,

the following patch adds an entry for the PID of a Cressi Leonardo
diving computer interface to kernel 3.13.0.
It is detected as FT232RL.
Works with subsurface.

Signed-off-by: Joerg Dorchain jo...@dorchain.net
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org

---
 drivers/usb/serial/ftdi_sio.c |2 ++
 drivers/usb/serial/ftdi_sio_ids.h |6 ++
 2 files changed, 8 insertions(+)

--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -910,6 +910,8 @@ static struct usb_device_id id_table_com
/* Crucible Devices */
{ USB_DEVICE(FTDI_VID, FTDI_CT_COMET_PID) },
{ USB_DEVICE(FTDI_VID, FTDI_Z3X_PID) },
+   /* Cressi Devices */
+   { USB_DEVICE(FTDI_VID, FTDI_CRESSI_PID) },
{ },/* Optional parameter entry */
{ } /* Terminating entry */
 };
--- a/drivers/usb/serial/ftdi_sio_ids.h
+++ b/drivers/usb/serial/ftdi_sio_ids.h
@@ -1320,3 +1320,9 @@
  * Manufacturer: Smart GSM Team
  */
 #define FTDI_Z3X_PID   0x0011
+
+/*
+ * Product: Cressi PC Interface
+ * Manufacturer: Cressi
+ */
+#define FTDI_CRESSI_PID0x87d0


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.10 77/97] perf: Fix hotplug splat

2014-03-04 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Peter Zijlstra pet...@infradead.org

commit e3703f8cdfcf39c25c4338c3ad8e68891cca3731 upstream.

Drew Richardson reported that he could make the kernel go *boom* when 
hotplugging
while having perf events active.

It turned out that when you have a group event, the code in
__perf_event_exit_context() fails to remove the group siblings from
the context.

We then proceed with destroying and freeing the event, and when you
re-plug the CPU and try and add another event to that CPU, things go
*boom* because you've still got dead entries there.

Reported-by: Drew Richardson drew.richard...@arm.com
Signed-off-by: Peter Zijlstra pet...@infradead.org
Cc: Will Deacon will.dea...@arm.com
Link: http://lkml.kernel.org/n/tip-k6v5wundvusvcseqj1si0...@git.kernel.org
Signed-off-by: Ingo Molnar mi...@kernel.org
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org

---
 kernel/events/core.c |   12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -7421,14 +7421,14 @@ static void perf_pmu_rotate_stop(struct
 static void __perf_event_exit_context(void *__info)
 {
struct perf_event_context *ctx = __info;
-   struct perf_event *event, *tmp;
+   struct perf_event *event;
 
perf_pmu_rotate_stop(ctx-pmu);
 
-   list_for_each_entry_safe(event, tmp, ctx-pinned_groups, group_entry)
-   __perf_remove_from_context(event);
-   list_for_each_entry_safe(event, tmp, ctx-flexible_groups, group_entry)
+   rcu_read_lock();
+   list_for_each_entry_rcu(event, ctx-event_list, event_entry)
__perf_remove_from_context(event);
+   rcu_read_unlock();
 }
 
 static void perf_event_exit_cpu_context(int cpu)
@@ -7452,11 +7452,11 @@ static void perf_event_exit_cpu(int cpu)
 {
struct swevent_htable *swhash = per_cpu(swevent_htable, cpu);
 
+   perf_event_exit_cpu_context(cpu);
+
mutex_lock(swhash-hlist_mutex);
swevent_hlist_release(swhash);
mutex_unlock(swhash-hlist_mutex);
-
-   perf_event_exit_cpu_context(cpu);
 }
 #else
 static inline void perf_event_exit_cpu(int cpu) { }


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.10 76/97] iio:gyro: bug on L3GD20H gyroscope support

2014-03-04 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Denis CIOCCA denis.cio...@st.com

commit a0657716416f834ef7710a9044614d50a36c3bdc upstream.

The driver was not able to manage the sensor: during probe function
and wai check, the driver stops and writes: device name and WhoAmI mismatch.
The correct value of L3GD20H wai is 0xd7 instead of 0xd4.
Dropped support for the sensor.

Signed-off-by: Denis Ciocca denis.cio...@st.com
Signed-off-by: Jonathan Cameron ji...@kernel.org
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org

---
 drivers/iio/gyro/Kconfig|2 +-
 drivers/iio/gyro/st_gyro.h  |1 -
 drivers/iio/gyro/st_gyro_core.c |9 -
 drivers/iio/gyro/st_gyro_i2c.c  |1 -
 drivers/iio/gyro/st_gyro_spi.c  |1 -
 5 files changed, 5 insertions(+), 9 deletions(-)

--- a/drivers/iio/gyro/Kconfig
+++ b/drivers/iio/gyro/Kconfig
@@ -50,7 +50,7 @@ config IIO_ST_GYRO_3AXIS
select IIO_ST_GYRO_BUFFER if (IIO_TRIGGERED_BUFFER)
help
  Say yes here to build support for STMicroelectronics gyroscopes:
- L3G4200D, LSM330DL, L3GD20, L3GD20H, LSM330DLC, L3G4IS, LSM330.
+ L3G4200D, LSM330DL, L3GD20, LSM330DLC, L3G4IS, LSM330.
 
  This driver can also be built as a module. If so, will be created
  these modules:
--- a/drivers/iio/gyro/st_gyro.h
+++ b/drivers/iio/gyro/st_gyro.h
@@ -19,7 +19,6 @@
 #define LSM330DL_GYRO_DEV_NAME lsm330dl_gyro
 #define LSM330DLC_GYRO_DEV_NAMElsm330dlc_gyro
 #define L3GD20_GYRO_DEV_NAME   l3gd20
-#define L3GD20H_GYRO_DEV_NAME  l3gd20h
 #define L3G4IS_GYRO_DEV_NAME   l3g4is_ui
 #define LSM330_GYRO_DEV_NAME   lsm330_gyro
 
--- a/drivers/iio/gyro/st_gyro_core.c
+++ b/drivers/iio/gyro/st_gyro_core.c
@@ -162,11 +162,10 @@ static const struct st_sensors st_gyro_s
.wai = ST_GYRO_2_WAI_EXP,
.sensors_supported = {
[0] = L3GD20_GYRO_DEV_NAME,
-   [1] = L3GD20H_GYRO_DEV_NAME,
-   [2] = LSM330D_GYRO_DEV_NAME,
-   [3] = LSM330DLC_GYRO_DEV_NAME,
-   [4] = L3G4IS_GYRO_DEV_NAME,
-   [5] = LSM330_GYRO_DEV_NAME,
+   [1] = LSM330D_GYRO_DEV_NAME,
+   [2] = LSM330DLC_GYRO_DEV_NAME,
+   [3] = L3G4IS_GYRO_DEV_NAME,
+   [4] = LSM330_GYRO_DEV_NAME,
},
.ch = (struct iio_chan_spec *)st_gyro_16bit_channels,
.odr = {
--- a/drivers/iio/gyro/st_gyro_i2c.c
+++ b/drivers/iio/gyro/st_gyro_i2c.c
@@ -61,7 +61,6 @@ static const struct i2c_device_id st_gyr
{ LSM330DL_GYRO_DEV_NAME },
{ LSM330DLC_GYRO_DEV_NAME },
{ L3GD20_GYRO_DEV_NAME },
-   { L3GD20H_GYRO_DEV_NAME },
{ L3G4IS_GYRO_DEV_NAME },
{ LSM330_GYRO_DEV_NAME },
{},
--- a/drivers/iio/gyro/st_gyro_spi.c
+++ b/drivers/iio/gyro/st_gyro_spi.c
@@ -60,7 +60,6 @@ static const struct spi_device_id st_gyr
{ LSM330DL_GYRO_DEV_NAME },
{ LSM330DLC_GYRO_DEV_NAME },
{ L3GD20_GYRO_DEV_NAME },
-   { L3GD20H_GYRO_DEV_NAME },
{ L3G4IS_GYRO_DEV_NAME },
{ LSM330_GYRO_DEV_NAME },
{},


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.10 74/97] workqueue: ensure @task is valid across kthread_stop()

2014-03-04 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Lai Jiangshan la...@cn.fujitsu.com

commit 5bdfff96c69a4d5ab9c49e60abf9e070ecd2acbb upstream.

When a kworker should die, the kworkre is notified through WORKER_DIE
flag instead of kthread_should_stop().  This, IIRC, is primarily to
keep the test synchronized inside worker_pool lock.  WORKER_DIE is
first set while holding pool-lock, the lock is dropped and
kthread_stop() is called.

Unfortunately, this means that there's a slight chance that the target
kworker may see WORKER_DIE before kthread_stop() finishes and exits
and frees the target task before or during kthread_stop().

Fix it by pinning the target task before setting WORKER_DIE and
putting it after kthread_stop() is done.

tj: Improved patch description and comment.  Moved pinning above
WORKER_DIE for better signify what it's protecting.

Signed-off-by: Lai Jiangshan la...@cn.fujitsu.com
Signed-off-by: Tejun Heo t...@kernel.org
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org

---
 kernel/workqueue.c |7 +++
 1 file changed, 7 insertions(+)

--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -1823,6 +1823,12 @@ static void destroy_worker(struct worker
if (worker-flags  WORKER_IDLE)
pool-nr_idle--;
 
+   /*
+* Once WORKER_DIE is set, the kworker may destroy itself at any
+* point.  Pin to ensure the task stays until we're done with it.
+*/
+   get_task_struct(worker-task);
+
list_del_init(worker-entry);
worker-flags |= WORKER_DIE;
 
@@ -1831,6 +1837,7 @@ static void destroy_worker(struct worker
spin_unlock_irq(pool-lock);
 
kthread_stop(worker-task);
+   put_task_struct(worker-task);
kfree(worker);
 
spin_lock_irq(pool-lock);


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.10 83/97] Input - arizona-haptics: Fix double lock of dapm_mutex

2014-03-04 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Charles Keepax ckee...@opensource.wolfsonmicro.com

commit c4204960e9d0ba99459dbf1db918f99a45e7a62a upstream.

snd_soc_dapm_sync takes the dapm_mutex internally, but we currently take
it externally as well. This patch fixes this.

Signed-off-by: Charles Keepax ckee...@opensource.wolfsonmicro.com
Signed-off-by: Mark Brown broo...@linaro.org
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org

---
 drivers/input/misc/arizona-haptics.c |   11 ---
 1 file changed, 4 insertions(+), 7 deletions(-)

--- a/drivers/input/misc/arizona-haptics.c
+++ b/drivers/input/misc/arizona-haptics.c
@@ -77,16 +77,14 @@ static void arizona_haptics_work(struct
return;
}
 
+   mutex_unlock(dapm_mutex);
+
ret = snd_soc_dapm_sync(arizona-dapm);
if (ret != 0) {
dev_err(arizona-dev, Failed to sync DAPM: %d\n,
ret);
-   mutex_unlock(dapm_mutex);
return;
}
-
-   mutex_unlock(dapm_mutex);
-
} else {
/* This disable sequence will be a noop if already enabled */
mutex_lock_nested(dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME);
@@ -99,16 +97,15 @@ static void arizona_haptics_work(struct
return;
}
 
+   mutex_unlock(dapm_mutex);
+
ret = snd_soc_dapm_sync(arizona-dapm);
if (ret != 0) {
dev_err(arizona-dev, Failed to sync DAPM: %d\n,
ret);
-   mutex_unlock(dapm_mutex);
return;
}
 
-   mutex_unlock(dapm_mutex);
-
ret = regmap_update_bits(arizona-regmap,
 ARIZONA_HAPTICS_CONTROL_1,
 ARIZONA_HAP_CTRL_MASK,


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.10 84/97] irq-metag*: stop set_affinity vectoring to offline cpus

2014-03-04 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: James Hogan james.ho...@imgtec.com

commit f229006ec6beabf7b844653d92fa61f025fe3dcf upstream.

Fix irq_set_affinity callbacks in the Meta IRQ chip drivers to AND
cpu_online_mask into the cpumask when picking a CPU to vector the
interrupt to.

As Thomas pointed out, the /proc/irq/$N/smp_affinity interface doesn't
filter out offline CPUs, so without this patch if you offline CPU0 and
set an IRQ affinity to 0x3 it vectors the interrupt onto CPU0 even
though it is offline.

Reported-by: Thomas Gleixner t...@linutronix.de
Signed-off-by: James Hogan james.ho...@imgtec.com
Cc: Thomas Gleixner t...@linutronix.de
Cc: linux-me...@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org

---
 drivers/irqchip/irq-metag-ext.c |2 +-
 drivers/irqchip/irq-metag.c |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

--- a/drivers/irqchip/irq-metag-ext.c
+++ b/drivers/irqchip/irq-metag-ext.c
@@ -515,7 +515,7 @@ static int meta_intc_set_affinity(struct
 * one cpu (the interrupt code doesn't support it), so we just
 * pick the first cpu we find in 'cpumask'.
 */
-   cpu = cpumask_any(cpumask);
+   cpu = cpumask_any_and(cpumask, cpu_online_mask);
thread = cpu_2_hwthread_id[cpu];
 
metag_out32(TBI_TRIG_VEC(TBID_SIGNUM_TR2(thread)), vec_addr);
--- a/drivers/irqchip/irq-metag.c
+++ b/drivers/irqchip/irq-metag.c
@@ -201,7 +201,7 @@ static int metag_internal_irq_set_affini
 * one cpu (the interrupt code doesn't support it), so we just
 * pick the first cpu we find in 'cpumask'.
 */
-   cpu = cpumask_any(cpumask);
+   cpu = cpumask_any_and(cpumask, cpu_online_mask);
thread = cpu_2_hwthread_id[cpu];
 
metag_out32(TBI_TRIG_VEC(TBID_SIGNUM_TR1(thread)),


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.10 70/97] usb: ehci: fix deadlock when threadirqs option is used

2014-03-04 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Stanislaw Gruszka sgrus...@redhat.com

commit a1227f3c1030e96ebc51d677d2f636268845c5fb upstream.

ehci_irq() and ehci_hrtimer_func() can deadlock on ehci-lock when
threadirqs option is used. To prevent the deadlock use
spin_lock_irqsave() in ehci_irq().

This change can be reverted when hrtimer callbacks become threaded.

Signed-off-by: Stanislaw Gruszka sgrus...@redhat.com
Acked-by: Alan Stern st...@rowland.harvard.edu
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org

---
 drivers/usb/host/ehci-hcd.c |   13 ++---
 1 file changed, 10 insertions(+), 3 deletions(-)

--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -686,8 +686,15 @@ static irqreturn_t ehci_irq (struct usb_
struct ehci_hcd *ehci = hcd_to_ehci (hcd);
u32 status, masked_status, pcd_status = 0, cmd;
int bh;
+   unsigned long   flags;
 
-   spin_lock (ehci-lock);
+   /*
+* For threadirqs option we use spin_lock_irqsave() variant to prevent
+* deadlock with ehci hrtimer callback, because hrtimer callbacks run
+* in interrupt context even when threadirqs is specified. We can go
+* back to spin_lock() variant when hrtimer callbacks become threaded.
+*/
+   spin_lock_irqsave(ehci-lock, flags);
 
status = ehci_readl(ehci, ehci-regs-status);
 
@@ -705,7 +712,7 @@ static irqreturn_t ehci_irq (struct usb_
 
/* Shared IRQ? */
if (!masked_status || unlikely(ehci-rh_state == EHCI_RH_HALTED)) {
-   spin_unlock(ehci-lock);
+   spin_unlock_irqrestore(ehci-lock, flags);
return IRQ_NONE;
}
 
@@ -823,7 +830,7 @@ dead:
 
if (bh)
ehci_work (ehci);
-   spin_unlock (ehci-lock);
+   spin_unlock_irqrestore(ehci-lock, flags);
if (pcd_status)
usb_hcd_poll_rh_status(hcd);
return IRQ_HANDLED;


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC] [PATCH] Pre-emption control for userspace

2014-03-04 Thread Khalid Aziz

On 03/04/2014 12:03 PM, Oleg Nesterov wrote:

On 03/04, Khalid Aziz wrote:


On 03/04/2014 06:56 AM, Oleg Nesterov wrote:

Hmm. In fact I think do_exit() should crash after munmap? -mmap_state
should be NULL ?? Perhaps I misread this patch completely...


do_exit() unmaps mmap_state-uaddr, and frees up mmap_state-kaddr and
mmap_state. mmap_state should not be NULL after unmap.


Can't understand... do_exit() does:

+#if CONFIG_SCHED_PREEMPT_DELAY
+   if (tsk-sched_preempt_delay.mmap_state) {
+   sys_munmap((unsigned long)
+   tsk-sched_preempt_delay.mmap_state-uaddr, 
PAGE_SIZE);
+   vfree(tsk-sched_preempt_delay.mmap_state-kaddr);
+   kfree(tsk-sched_preempt_delay.mmap_state);

sys_munmap() (which btw should not be used) obviously unmaps that
vma and vma_ops()-close() should be called.

close_preempt_delay_vmops() does:

state-task-sched_preempt_delay.mmap_state = NULL;

vfree(tsk-sched_preempt_delay.mmap_state-kaddr) above will try to
dereference .mmap_state == NULL.

IOW, I think that with this patch this trivial program

int main(void)
{
fd = open(/proc/self/task/$TID/sched_preempt_delay, O_RDWR);
mmap(NULL, 4096, PROT_READ,MAP_SHARED, fd, 0);
return 0;
}

should crash the kernel.


+   state-page = page;
+   state-kaddr = kaddr;
+   state-uaddr = (void *)vma-vm_start;


This is used by do_exit(). But -vm_start can be changed by mremap() ?


Hmm. And mremap() can do vm_ops-close() too. But the new vma will
have the same vm_ops/vm_private_data, so exit_mmap() will try to do
this again... Perhaps I missed something, but I bet this all can't be
right.


Would you say sys_munmap() of mmap_state-uaddr is not even needed since
exit_mm() will do this any way further down in do_exit()?


No.

I meant:

1. mremap() can move this vma, so do_exit() can't trust -uaddr

2. Even worse, mremap() itself is not safe. It can do -close()
   too and create the new vma with the same vm_ops. Another
   unmap from (say) exit_mm() won't be happy.


I agree this looks like a potential spot for trouble. I was asking if 
removing sys_munmap() of uaddr from do_exit() solves both of the above 
problems? You have convinced me this sys_munmap() I added is unnecessary.





+   vma-vm_flags |= VM_DONTCOPY | VM_DONTEXPAND | VM_SHARED | VM_WRITE;


This probably also needs VM_IO, to protect from madvise(MADV_DOFORK).


Yes, you are right. I will add that.


VM_SHARED/VM_WRITE doesn't look right.


VM_SHARED is wrong but VM_WRITE is needed I think since the thread will
write to the mmap'd page to signal to request preemption delay.


But -mmap() should not set VM_WRITE if application does mmap(PROT_READ) ?
VM_WRITE-or-not should be decided by do_mmap_pgoff/mprotect, -mmap()
should not play with this bit.



Ah, I see. This makes sense. I will remove it.

Thanks,
Khalid


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.10 58/97] ata: enable quirk from jmicron JMB350 for JMB394

2014-03-04 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Denis V. Lunev d...@openvz.org

commit efb9e0f4f43780f0ae0c6428d66bd03e805c7539 upstream.

Without the patch the kernel generates the following error.

 ata11.15: SATA link up 1.5 Gbps (SStatus 113 SControl 310)
 ata11.15: Port Multiplier vendor mismatch '0x197b' != '0x123'
 ata11.15: PMP revalidation failed (errno=-19)
 ata11.15: failed to recover PMP after 5 tries, giving up

This patch helps to bypass this error and the device becomes
functional.

Signed-off-by: Denis V. Lunev d...@openvz.org
Signed-off-by: Tejun Heo t...@kernel.org
Cc: linux-...@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org

---
 drivers/ata/libata-pmp.c |7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

--- a/drivers/ata/libata-pmp.c
+++ b/drivers/ata/libata-pmp.c
@@ -447,8 +447,11 @@ static void sata_pmp_quirks(struct ata_p
 * otherwise.  Don't try hard to recover it.
 */
ap-pmp_link[ap-nr_pmp_links - 1].flags |= ATA_LFLAG_NO_RETRY;
-   } else if (vendor == 0x197b  devid == 0x2352) {
-   /* chip found in Thermaltake BlackX Duet, jmicron JMB350? */
+   } else if (vendor == 0x197b  (devid == 0x2352 || devid == 0x0325)) {
+   /*
+* 0x2352: found in Thermaltake BlackX Duet, jmicron JMB350?
+* 0x0325: jmicron JMB394.
+*/
ata_for_each_link(link, ap, EDGE) {
/* SRST breaks detection and disks get misclassified
 * LPM disabled to avoid potential problems


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.10 65/97] ACPI / processor: Rework processor throttling with work_on_cpu()

2014-03-04 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Lan Tianyu tianyu@intel.com

commit f3ca4164529b875374c410193bbbac0ee960895f upstream.

acpi_processor_set_throttling() uses set_cpus_allowed_ptr() to make
sure that the (struct acpi_processor)-acpi_processor_set_throttling()
callback will run on the right CPU.  However, the function may be
called from a worker thread already bound to a different CPU in which
case that won't work.

Make acpi_processor_set_throttling() use work_on_cpu() as appropriate
instead of abusing set_cpus_allowed_ptr().

Reported-and-tested-by: Jiri Olsa jo...@redhat.com
Signed-off-by: Lan Tianyu tianyu@intel.com
[rjw: Changelog]
Signed-off-by: Rafael J. Wysocki rafael.j.wyso...@intel.com
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org

---
 drivers/acpi/processor_throttling.c |   69 
 1 file changed, 32 insertions(+), 37 deletions(-)

--- a/drivers/acpi/processor_throttling.c
+++ b/drivers/acpi/processor_throttling.c
@@ -59,6 +59,12 @@ struct throttling_tstate {
int target_state;   /* target T-state */
 };
 
+struct acpi_processor_throttling_arg {
+   struct acpi_processor *pr;
+   int target_state;
+   bool force;
+};
+
 #define THROTTLING_PRECHANGE   (1)
 #define THROTTLING_POSTCHANGE  (2)
 
@@ -1063,16 +1069,24 @@ static int acpi_processor_set_throttling
return 0;
 }
 
+static long acpi_processor_throttling_fn(void *data)
+{
+   struct acpi_processor_throttling_arg *arg = data;
+   struct acpi_processor *pr = arg-pr;
+
+   return pr-throttling.acpi_processor_set_throttling(pr,
+   arg-target_state, arg-force);
+}
+
 int acpi_processor_set_throttling(struct acpi_processor *pr,
int state, bool force)
 {
-   cpumask_var_t saved_mask;
int ret = 0;
unsigned int i;
struct acpi_processor *match_pr;
struct acpi_processor_throttling *p_throttling;
+   struct acpi_processor_throttling_arg arg;
struct throttling_tstate t_state;
-   cpumask_var_t online_throttling_cpus;
 
if (!pr)
return -EINVAL;
@@ -1083,14 +1097,6 @@ int acpi_processor_set_throttling(struct
if ((state  0) || (state  (pr-throttling.state_count - 1)))
return -EINVAL;
 
-   if (!alloc_cpumask_var(saved_mask, GFP_KERNEL))
-   return -ENOMEM;
-
-   if (!alloc_cpumask_var(online_throttling_cpus, GFP_KERNEL)) {
-   free_cpumask_var(saved_mask);
-   return -ENOMEM;
-   }
-
if (cpu_is_offline(pr-id)) {
/*
 * the cpu pointed by pr-id is offline. Unnecessary to change
@@ -1099,17 +1105,15 @@ int acpi_processor_set_throttling(struct
return -ENODEV;
}
 
-   cpumask_copy(saved_mask, current-cpus_allowed);
t_state.target_state = state;
p_throttling = (pr-throttling);
-   cpumask_and(online_throttling_cpus, cpu_online_mask,
-   p_throttling-shared_cpu_map);
+
/*
 * The throttling notifier will be called for every
 * affected cpu in order to get one proper T-state.
 * The notifier event is THROTTLING_PRECHANGE.
 */
-   for_each_cpu(i, online_throttling_cpus) {
+   for_each_cpu_and(i, cpu_online_mask, p_throttling-shared_cpu_map) {
t_state.cpu = i;
acpi_processor_throttling_notifier(THROTTLING_PRECHANGE,
t_state);
@@ -1121,21 +1125,18 @@ int acpi_processor_set_throttling(struct
 * it can be called only for the cpu pointed by pr.
 */
if (p_throttling-shared_type == DOMAIN_COORD_TYPE_SW_ANY) {
-   /* FIXME: use work_on_cpu() */
-   if (set_cpus_allowed_ptr(current, cpumask_of(pr-id))) {
-   /* Can't migrate to the pr-id CPU. Exit */
-   ret = -ENODEV;
-   goto exit;
-   }
-   ret = p_throttling-acpi_processor_set_throttling(pr,
-   t_state.target_state, force);
+   arg.pr = pr;
+   arg.target_state = state;
+   arg.force = force;
+   ret = work_on_cpu(pr-id, acpi_processor_throttling_fn, arg);
} else {
/*
 * When the T-state coordination is SW_ALL or HW_ALL,
 * it is necessary to set T-state for every affected
 * cpus.
 */
-   for_each_cpu(i, online_throttling_cpus) {
+   for_each_cpu_and(i, cpu_online_mask,
+   p_throttling-shared_cpu_map) {
match_pr = per_cpu(processors, i);
/*
 * If the pointer is invalid, we 

[PATCH 3.10 67/97] usb: chipidea: need to mask when writting endptflush and endptprime

2014-03-04 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Matthieu CASTET matthieu.cas...@parrot.com

commit 5bf5dbeda2454296f1984adfbfc8e6f5965ac389 upstream.

ENDPTFLUSH and ENDPTPRIME registers are set by software and clear
by hardware. There is a bit for each endpoint. When we are setting
a bit for an endpoint we should make sure we do not touch other
endpoint bit. There is a race condition if the hardware clear the
bit between the read and the write in hw_write.

Signed-off-by: Peter Chen peter.c...@freescale.com
Signed-off-by: Matthieu CASTET matthieu.cas...@parrot.com
Tested-by: Michael Grzeschik mgrzesc...@pengutronix.de
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org

---
 drivers/usb/chipidea/udc.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/drivers/usb/chipidea/udc.c
+++ b/drivers/usb/chipidea/udc.c
@@ -103,7 +103,7 @@ static int hw_ep_flush(struct ci13xxx *c
 
do {
/* flush any pending transfer */
-   hw_write(ci, OP_ENDPTFLUSH, BIT(n), BIT(n));
+   hw_write(ci, OP_ENDPTFLUSH, ~0, BIT(n));
while (hw_read(ci, OP_ENDPTFLUSH, BIT(n)))
cpu_relax();
} while (hw_read(ci, OP_ENDPTSTAT, BIT(n)));
@@ -203,7 +203,7 @@ static int hw_ep_prime(struct ci13xxx *c
if (is_ctrl  dir == RX  hw_read(ci, OP_ENDPTSETUPSTAT, BIT(num)))
return -EAGAIN;
 
-   hw_write(ci, OP_ENDPTPRIME, BIT(n), BIT(n));
+   hw_write(ci, OP_ENDPTPRIME, ~0, BIT(n));
 
while (hw_read(ci, OP_ENDPTPRIME, BIT(n)))
cpu_relax();


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.10 66/97] can: kvaser_usb: check number of channels returned by HW

2014-03-04 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Olivier Sobrie oliv...@sobrie.be

commit 862474f8b46f6c1e600d4934e40ba40646c696ec upstream.

It is needed to check the number of channels returned by the HW because it
cannot be greater than MAX_NET_DEVICES otherwise it will crash.

Signed-off-by: Olivier Sobrie oliv...@sobrie.be
Signed-off-by: Marc Kleine-Budde m...@pengutronix.de
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org

---
 drivers/net/can/usb/kvaser_usb.c |2 ++
 1 file changed, 2 insertions(+)

--- a/drivers/net/can/usb/kvaser_usb.c
+++ b/drivers/net/can/usb/kvaser_usb.c
@@ -474,6 +474,8 @@ static int kvaser_usb_get_card_info(stru
return err;
 
dev-nchannels = msg.u.cardinfo.nchannels;
+   if (dev-nchannels  MAX_NET_DEVICES)
+   return -EINVAL;
 
return 0;
 }


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.10 68/97] usb: gadget: bcm63xx_udc: fix build failure on DMA channel code

2014-03-04 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Florian Fainelli flor...@openwrt.org

commit 2d1f7af3d60dd09794e0738a915d272c6c27abc5 upstream.

Commit 3dc6475 (bcm63xx_enet: add support Broadcom BCM6345 Ethernet)
changed the ENETDMA[CS] macros such that they are no longer macros, but
actual register offset definitions. The bcm63xx_udc driver was not
updated, and as a result, causes the following build error to pop up:

 CC  drivers/usb/gadget/u_ether.o
drivers/usb/gadget/bcm63xx_udc.c: In function 'iudma_write':
drivers/usb/gadget/bcm63xx_udc.c:642:24: error: called object '0' is not
a function
drivers/usb/gadget/bcm63xx_udc.c: In function 'iudma_reset_channel':
drivers/usb/gadget/bcm63xx_udc.c:698:46: error: called object '0' is not
a function
drivers/usb/gadget/bcm63xx_udc.c:700:49: error: called object '0' is not
a function

Fix this by updating usb_dmac_{read,write}l and usb_dmas_{read,write}l to
take an extra channel argument, and use the channel width
(ENETDMA_CHAN_WIDTH) to offset the register we want to access, hence
doing again what the macro implicitely did for us.

Cc: Kevin Cernekee cerne...@gmail.com
Cc: Jonas Gorski j...@openwrt.org
Signed-off-by: Florian Fainelli flor...@openwrt.org
Signed-off-by: Felipe Balbi ba...@ti.com
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org

---
 drivers/usb/gadget/bcm63xx_udc.c |   58 +--
 1 file changed, 32 insertions(+), 26 deletions(-)

--- a/drivers/usb/gadget/bcm63xx_udc.c
+++ b/drivers/usb/gadget/bcm63xx_udc.c
@@ -361,24 +361,30 @@ static inline void usb_dma_writel(struct
bcm_writel(val, udc-iudma_regs + off);
 }
 
-static inline u32 usb_dmac_readl(struct bcm63xx_udc *udc, u32 off)
+static inline u32 usb_dmac_readl(struct bcm63xx_udc *udc, u32 off, int chan)
 {
-   return bcm_readl(udc-iudma_regs + IUDMA_DMAC_OFFSET + off);
+   return bcm_readl(udc-iudma_regs + IUDMA_DMAC_OFFSET + off +
+   (ENETDMA_CHAN_WIDTH * chan));
 }
 
-static inline void usb_dmac_writel(struct bcm63xx_udc *udc, u32 val, u32 off)
+static inline void usb_dmac_writel(struct bcm63xx_udc *udc, u32 val, u32 off,
+   int chan)
 {
-   bcm_writel(val, udc-iudma_regs + IUDMA_DMAC_OFFSET + off);
+   bcm_writel(val, udc-iudma_regs + IUDMA_DMAC_OFFSET + off +
+   (ENETDMA_CHAN_WIDTH * chan));
 }
 
-static inline u32 usb_dmas_readl(struct bcm63xx_udc *udc, u32 off)
+static inline u32 usb_dmas_readl(struct bcm63xx_udc *udc, u32 off, int chan)
 {
-   return bcm_readl(udc-iudma_regs + IUDMA_DMAS_OFFSET + off);
+   return bcm_readl(udc-iudma_regs + IUDMA_DMAS_OFFSET + off +
+   (ENETDMA_CHAN_WIDTH * chan));
 }
 
-static inline void usb_dmas_writel(struct bcm63xx_udc *udc, u32 val, u32 off)
+static inline void usb_dmas_writel(struct bcm63xx_udc *udc, u32 val, u32 off,
+   int chan)
 {
-   bcm_writel(val, udc-iudma_regs + IUDMA_DMAS_OFFSET + off);
+   bcm_writel(val, udc-iudma_regs + IUDMA_DMAS_OFFSET + off +
+   (ENETDMA_CHAN_WIDTH * chan));
 }
 
 static inline void set_clocks(struct bcm63xx_udc *udc, bool is_enabled)
@@ -639,7 +645,7 @@ static void iudma_write(struct bcm63xx_u
} while (!last_bd);
 
usb_dmac_writel(udc, ENETDMAC_CHANCFG_EN_MASK,
-   ENETDMAC_CHANCFG_REG(iudma-ch_idx));
+   ENETDMAC_CHANCFG_REG, iudma-ch_idx);
 }
 
 /**
@@ -695,9 +701,9 @@ static void iudma_reset_channel(struct b
bcm63xx_fifo_reset_ep(udc, max(0, iudma-ep_num));
 
/* stop DMA, then wait for the hardware to wrap up */
-   usb_dmac_writel(udc, 0, ENETDMAC_CHANCFG_REG(ch_idx));
+   usb_dmac_writel(udc, 0, ENETDMAC_CHANCFG_REG, ch_idx);
 
-   while (usb_dmac_readl(udc, ENETDMAC_CHANCFG_REG(ch_idx)) 
+   while (usb_dmac_readl(udc, ENETDMAC_CHANCFG_REG, ch_idx) 
   ENETDMAC_CHANCFG_EN_MASK) {
udelay(1);
 
@@ -714,10 +720,10 @@ static void iudma_reset_channel(struct b
dev_warn(udc-dev, forcibly halting IUDMA channel 
%d\n,
 ch_idx);
usb_dmac_writel(udc, ENETDMAC_CHANCFG_BUFHALT_MASK,
-   ENETDMAC_CHANCFG_REG(ch_idx));
+   ENETDMAC_CHANCFG_REG, ch_idx);
}
}
-   usb_dmac_writel(udc, ~0, ENETDMAC_IR_REG(ch_idx));
+   usb_dmac_writel(udc, ~0, ENETDMAC_IR_REG, ch_idx);
 
/* don't leave live HW-owned entries for the next guy to step on */
for (d = iudma-bd_ring; d = iudma-end_bd; d++)
@@ -729,11 +735,11 @@ static void iudma_reset_channel(struct b
 
/* set up IRQs, UBUS burst size, and BD base for this channel */
usb_dmac_writel(udc, ENETDMAC_IR_BUFDONE_MASK,
-  

[PATCH 3.10 59/97] sata_sil: apply MOD15WRITE quirk to TOSHIBA MK2561GSYN

2014-03-04 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Tejun Heo t...@kernel.org

commit 9f9c47f00ce99329b1a82e2ac4f70f0fe3db549c upstream.

It's a bit odd to see a newer device showing mod15write; however, the
reported behavior is highly consistent and other factors which could
contribute seem to have been verified well enough.  Also, both
sata_sil itself and the drive are fairly outdated at this point making
the risk of this change fairly low.  It is possible, probably likely,
that other drive models in the same family have the same problem;
however, for now, let's just add the specific model which was tested.

Signed-off-by: Tejun Heo t...@kernel.org
Reported-by: matson lists-matso...@luxsci.me
References: 
http://lkml.kernel.org/g/201401211912.s0ljck7f015...@rs103.luxsci.com
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org

---
 drivers/ata/sata_sil.c |1 +
 1 file changed, 1 insertion(+)

--- a/drivers/ata/sata_sil.c
+++ b/drivers/ata/sata_sil.c
@@ -157,6 +157,7 @@ static const struct sil_drivelist {
{ ST380011ASL,SIL_QUIRK_MOD15WRITE },
{ ST3120022ASL,   SIL_QUIRK_MOD15WRITE },
{ ST3160021ASL,   SIL_QUIRK_MOD15WRITE },
+   { TOSHIBA MK2561GSYN, SIL_QUIRK_MOD15WRITE },
{ Maxtor 4D060H3, SIL_QUIRK_UDMA5MAX },
{ }
 };


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.10 63/97] i7core_edac: Fix PCI device reference count

2014-03-04 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Jean Delvare jdelv...@suse.de

commit c0f5eeed0f4cef4f05b74883a7160e7edde58b6a upstream.

The reference count changes done by pci_get_device can be a little
misleading when the usage diverges from the most common scheme. The
reference count of the device passed as the last parameter is always
decreased, even if the function returns no new device. So if we are
going to try alternative device IDs, we must manually increment the
device reference count before each retry. If we don't, we end up
decreasing the reference count, and after a few modprobe/rmmod cycles
the PCI devices will vanish.

In other words and as Alan put it: without this fix the EDAC code
corrupts the PCI device list.

This fixes kernel bug #50491:
https://bugzilla.kernel.org/show_bug.cgi?id=50491

Signed-off-by: Jean Delvare jdelv...@suse.de
Link: http://lkml.kernel.org/r/20140224093927.7659dd9d@endymion.delvare
Reviewed-by: Alan Cox a...@linux.intel.com
Cc: Mauro Carvalho Chehab m.che...@samsung.com
Cc: Doug Thompson dougthomp...@xmission.com
Signed-off-by: Borislav Petkov b...@suse.de
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org

---
 drivers/edac/i7core_edac.c |9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

--- a/drivers/edac/i7core_edac.c
+++ b/drivers/edac/i7core_edac.c
@@ -1334,14 +1334,19 @@ static int i7core_get_onedevice(struct p
 * is at addr 8086:2c40, instead of 8086:2c41. So, we need
 * to probe for the alternate address in case of failure
 */
-   if (dev_descr-dev_id == PCI_DEVICE_ID_INTEL_I7_NONCORE  !pdev)
+   if (dev_descr-dev_id == PCI_DEVICE_ID_INTEL_I7_NONCORE  !pdev) {
+   pci_dev_get(*prev); /* pci_get_device will put it */
pdev = pci_get_device(PCI_VENDOR_ID_INTEL,
  PCI_DEVICE_ID_INTEL_I7_NONCORE_ALT, 
*prev);
+   }
 
-   if (dev_descr-dev_id == PCI_DEVICE_ID_INTEL_LYNNFIELD_NONCORE  !pdev)
+   if (dev_descr-dev_id == PCI_DEVICE_ID_INTEL_LYNNFIELD_NONCORE 
+   !pdev) {
+   pci_dev_get(*prev); /* pci_get_device will put it */
pdev = pci_get_device(PCI_VENDOR_ID_INTEL,
  PCI_DEVICE_ID_INTEL_LYNNFIELD_NONCORE_ALT,
  *prev);
+   }
 
if (!pdev) {
if (*prev) {


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.10 64/97] ACPI / video: Filter the _BCL table for duplicate brightness values

2014-03-04 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Hans de Goede hdego...@redhat.com

commit bd8ba20597f0cfef3ef65c3fd2aa92ab23d4c8e1 upstream.

Some devices have duplicate entries in there brightness levels table, ie
on my Dell Latitude E6430 the table looks like this:

[3.686060] acpi backlight index   0, val 80
[3.686095] acpi backlight index   1, val 50
[3.686122] acpi backlight index   2, val 5
[3.686147] acpi backlight index   3, val 5
[3.686172] acpi backlight index   4, val 5
[3.686197] acpi backlight index   5, val 5
[3.686223] acpi backlight index   6, val 5
[3.686248] acpi backlight index   7, val 5
[3.686273] acpi backlight index   8, val 6
[3.686332] acpi backlight index   9, val 7
[3.686356] acpi backlight index  10, val 8
[3.686380] acpi backlight index  11, val 9
etc.

Notice that brightness values 0-5 are all mapped to 5. This means that
if userspace writes any value between 0 and 5 to the brightness sysfs attribute
and then reads it, it will always return 0, which is somewhat unexpected.

This is a problem for ie gnome-settings-daemon, which uses read-modify-write
logic when the users presses the brightness up or down keys. This is done
this way to take brightness changes from other sources into account.

On this specific laptop what happens once the brightness has been set to 0,
is that gsd reads 0, adds 5, writes 5, and on the next brightness up key press
again reads 0, so things get stuck at the lowest brightness setting.

Filtering out the duplicate table entries, makes any write to brightness
read back as the written value as one would expect, fixing this.

Signed-off-by: Hans de Goede hdego...@redhat.com
Reviewed-by: Aaron Lu aaron...@intel.com
Signed-off-by: Rafael J. Wysocki rafael.j.wyso...@intel.com
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org

---
 drivers/acpi/video.c |8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

--- a/drivers/acpi/video.c
+++ b/drivers/acpi/video.c
@@ -733,6 +733,7 @@ acpi_video_init_brightness(struct acpi_v
union acpi_object *o;
struct acpi_video_device_brightness *br = NULL;
int result = -EINVAL;
+   u32 value;
 
if (!ACPI_SUCCESS(acpi_video_device_lcd_query_levels(device, obj))) {
ACPI_DEBUG_PRINT((ACPI_DB_INFO, Could not query available 
@@ -763,7 +764,12 @@ acpi_video_init_brightness(struct acpi_v
printk(KERN_ERR PREFIX Invalid data\n);
continue;
}
-   br-levels[count] = (u32) o-integer.value;
+   value = (u32) o-integer.value;
+   /* Skip duplicate entries */
+   if (count  2  br-levels[count - 1] == value)
+   continue;
+
+   br-levels[count] = value;
 
if (br-levels[count]  max_level)
max_level = br-levels[count];


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.10 62/97] ACPI / PCI: Fix memory leak in acpi_pci_irq_enable()

2014-03-04 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Tomasz Nowicki tomasz.nowi...@linaro.org

commit b685f3b1744061aa9ad822548ba9c674de5be7c6 upstream.

acpi_pci_link_allocate_irq() can return negative gsi even if
entry != NULL.  For that case we have a memory leak, so free
entry before returning from acpi_pci_irq_enable() for gsi  0.

Signed-off-by: Tomasz Nowicki tomasz.nowi...@linaro.org
[rjw: Subject and changelog]
Signed-off-by: Rafael J. Wysocki rafael.j.wyso...@intel.com
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org

---
 drivers/acpi/pci_irq.c |1 +
 1 file changed, 1 insertion(+)

--- a/drivers/acpi/pci_irq.c
+++ b/drivers/acpi/pci_irq.c
@@ -432,6 +432,7 @@ int acpi_pci_irq_enable(struct pci_dev *
 pin_name(pin));
}
 
+   kfree(entry);
return 0;
}
 


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.10 69/97] USB: serial: option: blacklist interface 4 for Cinterion PHS8 and PXS8

2014-03-04 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Aleksander Morgado aleksan...@aleksander.es

commit 12df84d4a80278a5b1abfec3206795291da52fc9 upstream.

This interface is to be handled by the qmi_wwan driver.

CC: Hans-Christoph Schemmel hans-christoph.schem...@gemalto.com
CC: Christian Schmiedl christian.schmi...@gemalto.com
CC: Nicolaus Colberg nicolaus.colb...@gemalto.com
CC: David McCullough david.mccullo...@accelecon.com
Signed-off-by: Aleksander Morgado aleksan...@aleksander.es
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org

---
 drivers/usb/serial/option.c |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -1526,7 +1526,8 @@ static const struct usb_device_id option
/* Cinterion */
{ USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_EU3_E) },
{ USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_EU3_P) },
-   { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_PH8) },
+   { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_PH8),
+   .driver_info = (kernel_ulong_t)net_intf4_blacklist },
{ USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_AHXX) },
{ USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_PLXX),
.driver_info = (kernel_ulong_t)net_intf4_blacklist },


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.10 61/97] PCI: Enable INTx if BIOS left them disabled

2014-03-04 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Bjorn Helgaas bhelg...@google.com

commit 1f42db786b14a31bf807fc41ee5583a00c08fcb1 upstream.

Some firmware leaves the Interrupt Disable bit set even if the device uses
INTx interrupts.  Clear Interrupt Disable so we get those interrupts.

Based on the report mentioned below, if the user selects the EHCI only
option in the Intel Baytrail BIOS, the EHCI device is handed off to the OS
with the PCI_COMMAND_INTX_DISABLE bit set.

Link: http://lkml.kernel.org/r/20140114181721.GC12126@xanatos
Link: https://bugzilla.kernel.org/show_bug.cgi?id=70601
Reported-by: Chris Cheng chris.ch...@atrustcorp.com
Reported-and-tested-by: Jamie Chen jamie.c...@intel.com
Signed-off-by: Bjorn Helgaas bhelg...@google.com
CC: Sarah Sharp sarah.a.sh...@linux.intel.com
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org

---
 drivers/pci/pci.c |   10 ++
 1 file changed, 10 insertions(+)

--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -1119,6 +1119,8 @@ EXPORT_SYMBOL_GPL(pci_load_and_free_save
 static int do_pci_enable_device(struct pci_dev *dev, int bars)
 {
int err;
+   u16 cmd;
+   u8 pin;
 
err = pci_set_power_state(dev, PCI_D0);
if (err  0  err != -EIO)
@@ -1128,6 +1130,14 @@ static int do_pci_enable_device(struct p
return err;
pci_fixup_device(pci_fixup_enable, dev);
 
+   pci_read_config_byte(dev, PCI_INTERRUPT_PIN, pin);
+   if (pin) {
+   pci_read_config_word(dev, PCI_COMMAND, cmd);
+   if (cmd  PCI_COMMAND_INTX_DISABLE)
+   pci_write_config_word(dev, PCI_COMMAND,
+ cmd  ~PCI_COMMAND_INTX_DISABLE);
+   }
+
return 0;
 }
 


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.10 60/97] cpufreq: powernow-k8: Initialize per-cpu data-structures properly

2014-03-04 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Srivatsa S. Bhat srivatsa.b...@linux.vnet.ibm.com

commit c3274763bfc3bf1ececa269ed6e6c4d7ec1c3e5e upstream.

The powernow-k8 driver maintains a per-cpu data-structure called
powernow_data that is used to perform the frequency transitions.
It initializes this data structure only for the policy-cpu. So,
accesses to this data structure by other CPUs results in various
problems because they would have been uninitialized.

Specifically, if a cpu (!= policy-cpu) invokes the drivers' -get()
function, it returns 0 as the KHz value, since its per-cpu memory
doesn't point to anything valid. This causes problems during
suspend/resume since cpufreq_update_policy() tries to enforce this
(0 KHz) as the current frequency of the CPU, and this madness gets
propagated to adjust_jiffies() as well. Eventually, lots of things
start breaking down, including the r8169 ethernet card, in one
particularly interesting case reported by Pierre Ossman.

Fix this by initializing the per-cpu data-structures of all the CPUs
in the policy appropriately.

References: https://bugzilla.kernel.org/show_bug.cgi?id=70311
Reported-by: Pierre Ossman pie...@ossman.eu
Signed-off-by: Srivatsa S. Bhat srivatsa.b...@linux.vnet.ibm.com
Acked-by: Viresh Kumar viresh.ku...@linaro.org
Signed-off-by: Rafael J. Wysocki rafael.j.wyso...@intel.com
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org

---
 drivers/cpufreq/powernow-k8.c |   10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

--- a/drivers/cpufreq/powernow-k8.c
+++ b/drivers/cpufreq/powernow-k8.c
@@ -1100,7 +1100,7 @@ static int __cpuinit powernowk8_cpu_init
 {
struct powernow_k8_data *data;
struct init_on_cpu init_on_cpu;
-   int rc;
+   int rc, cpu;
 
smp_call_function_single(pol-cpu, check_supported_cpu, rc, 1);
if (rc)
@@ -1169,7 +1169,9 @@ static int __cpuinit powernowk8_cpu_init
pr_debug(cpu_init done, current fid 0x%x, vid 0x%x\n,
 data-currfid, data-currvid);
 
-   per_cpu(powernow_data, pol-cpu) = data;
+   /* Point all the CPUs in this policy to the same data */
+   for_each_cpu(cpu, pol-cpus)
+   per_cpu(powernow_data, cpu) = data;
 
return 0;
 
@@ -1184,6 +1186,7 @@ err_out:
 static int powernowk8_cpu_exit(struct cpufreq_policy *pol)
 {
struct powernow_k8_data *data = per_cpu(powernow_data, pol-cpu);
+   int cpu;
 
if (!data)
return -EINVAL;
@@ -1194,7 +1197,8 @@ static int powernowk8_cpu_exit(struct cp
 
kfree(data-powernow_table);
kfree(data);
-   per_cpu(powernow_data, pol-cpu) = NULL;
+   for_each_cpu(cpu, pol-cpus)
+   per_cpu(powernow_data, cpu) = NULL;
 
return 0;
 }


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2] touchscreen: tps6507x-ts: only poll while touch event is occurring

2014-03-04 Thread Jon Ringle
We only need to poll for touch events after an interrupt occurs due to the
user touching the screen. We continue to poll until the user stops touching
the screen

Signed-off-by: Jon Ringle jrin...@gridpoint.com
---
 drivers/input/touchscreen/tps6507x-ts.c | 188 +---
 include/linux/input/tps6507x-ts.h   |   1 +
 include/linux/mfd/tps6507x.h|   1 +
 3 files changed, 151 insertions(+), 39 deletions(-)

diff --git a/drivers/input/touchscreen/tps6507x-ts.c 
b/drivers/input/touchscreen/tps6507x-ts.c
index 94cde2c..24043ff 100644
--- a/drivers/input/touchscreen/tps6507x-ts.c
+++ b/drivers/input/touchscreen/tps6507x-ts.c
@@ -17,11 +17,14 @@
 #include linux/workqueue.h
 #include linux/slab.h
 #include linux/input.h
-#include linux/input-polldev.h
 #include linux/platform_device.h
 #include linux/mfd/tps6507x.h
 #include linux/input/tps6507x-ts.h
 #include linux/delay.h
+#include linux/gpio.h
+#include linux/i2c.h
+#include linux/irq.h
+#include linux/interrupt.h

 #define TSC_DEFAULT_POLL_PERIOD 30 /* ms */
 #define TPS_DEFAULT_MIN_PRESSURE 0x30
@@ -39,13 +42,17 @@ struct ts_event {
 };

 struct tps6507x_ts {
+   struct input_dev*input_dev;
struct device   *dev;
-   struct input_polled_dev *poll_dev;
struct tps6507x_dev *mfd;
charphys[32];
+   struct delayed_work work;
struct ts_event tc;
+   int irq;
+   unsigned long   poll_period;/* ms */
u16 min_pressure;
boolpendown;
+   int open_count;
 };

 static int tps6507x_read_u8(struct tps6507x_ts *tsc, u8 reg, u8 *data)
@@ -155,13 +162,20 @@ static s32 tps6507x_adc_standby(struct tps6507x_ts *tsc)
return ret;
 }

-static void tps6507x_ts_poll(struct input_polled_dev *poll_dev)
+static void tps6507x_ts_handler(struct work_struct *work)
 {
-   struct tps6507x_ts *tsc = poll_dev-private;
-   struct input_dev *input_dev = poll_dev-input;
+   struct tps6507x_ts *tsc =  container_of(work, struct tps6507x_ts, 
work.work);
+   struct input_dev *input_dev = tsc-input_dev;
bool pendown;
+   int schd;
+   int poll = 0;
s32 ret;

+   if (tsc-irq) {
+   // Disable the touch interrupt
+   tps6507x_write_u8(tsc, TPS6507X_REG_INT, 0);
+   }
+
ret = tps6507x_adc_conversion(tsc, TPS6507X_TSCMODE_PRESSURE,
  tsc-tc.pressure);
if (ret)
@@ -178,9 +192,11 @@ static void tps6507x_ts_poll(struct input_polled_dev 
*poll_dev)
}

if (pendown) {
+   int report_pendown = 0;

if (!tsc-pendown) {
dev_dbg(tsc-dev, DOWN\n);
+   report_pendown = 1;
input_report_key(input_dev, BTN_TOUCH, 1);
} else
dev_dbg(tsc-dev, still down\n);
@@ -195,15 +211,86 @@ static void tps6507x_ts_poll(struct input_polled_dev 
*poll_dev)
if (ret)
goto done;

-   input_report_abs(input_dev, ABS_X, tsc-tc.x);
-   input_report_abs(input_dev, ABS_Y, tsc-tc.y);
-   input_report_abs(input_dev, ABS_PRESSURE, tsc-tc.pressure);
-   input_sync(input_dev);
-   tsc-pendown = true;
+   if (tsc-tc.x  tsc-tc.y) {
+   if (report_pendown)
+   input_report_key(input_dev, BTN_TOUCH, 1);
+
+   input_report_abs(input_dev, ABS_X, tsc-tc.x);
+   input_report_abs(input_dev, ABS_Y, tsc-tc.y);
+   input_report_abs(input_dev, ABS_PRESSURE, 
tsc-tc.pressure);
+   input_sync(input_dev);
+   tsc-pendown = true;
+   } else {
+   dev_dbg(tsc-dev, discarding bogus read x=%d, y=%d, 
pressure=%d\n, tsc-tc.x, tsc-tc.y, tsc-tc.pressure);
+   }
+   poll = 1;
}

 done:
tps6507x_adc_standby(tsc);
+   if (tsc-irq  !poll) {
+   // Re-enable the interrupt
+   tps6507x_write_u8(tsc, TPS6507X_REG_INT, TPS6507X_REG_MASK_TSC);
+   } else {
+   /* always poll if not using interrupts */
+   schd = schedule_delayed_work(tsc-work,
+
msecs_to_jiffies(tsc-poll_period));
+   }
+}
+
+static irqreturn_t tps6507x_ts_irq(int irq, void * dev_id)
+{
+   struct tps6507x_ts * tsc = (struct tps6507x_ts *)dev_id;
+
+   schedule_delayed_work(tsc-work, 0);
+
+   return IRQ_HANDLED;
+}
+
+static int tps6507x_ts_open(struct input_dev *input_dev)
+{
+   int ret;
+   struct tps6507x_ts *tsc = input_get_drvdata(input_dev);
+
+   tsc-open_count++;
+
+   if (tsc-irq) {
+
+   

[PATCH 3.10 72/97] mei: set clients read_cb to NULL when flow control fails

2014-03-04 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Chao Bi chao...@intel.com

commit accb884b32e82f943340688c9cd30290531e73e0 upstream.

In mei_cl_read_start(), if it fails to send flow control request, it
will release cl-read_cb but forget to set pointer to NULL, leaving
cl-read_cb still pointing to random memory, next time this client is
operated like mei_release(), it has chance to refer to this wrong pointer.

Fixes:  PANIC at kfree in mei_release()

[228781.826904] Call Trace:
[228781.829737]  [c16249b8] ? mei_cl_unlink+0x48/0xa0
[228781.835283]  [c1624487] mei_io_cb_free+0x17/0x30
[228781.840733]  [c16265d8] mei_release+0xa8/0x180
[228781.845989]  [c135c610] ? __fsnotify_parent+0xa0/0xf0
[228781.851925]  [c1325a69] __fput+0xd9/0x200
[228781.856696]  [c1325b9d] fput+0xd/0x10
[228781.861467]  [c125cae1] task_work_run+0x81/0xb0
[228781.866821]  [c1242e53] do_exit+0x283/0xa00
[228781.871786]  [c1a82b36] ? kprobe_flush_task+0x66/0xc0
[228781.877722]  [c124eeb8] ? __dequeue_signal+0x18/0x1a0
[228781.883657]  [c124f072] ? dequeue_signal+0x32/0x190
[228781.889397]  [c1243744] do_group_exit+0x34/0xa0
[228781.894750]  [c12517b6] get_signal_to_deliver+0x206/0x610
[228781.901075]  [c12018d8] do_signal+0x38/0x100
[228781.906136]  [c1626d1c] ? mei_read+0x42c/0x4e0
[228781.911393]  [c12600a0] ? wake_up_bit+0x30/0x30
[228781.916745]  [c16268f0] ? mei_poll+0x120/0x120
[228781.922001]  [c1324be9] ? vfs_read+0x89/0x160
[228781.927158]  [c16268f0] ? mei_poll+0x120/0x120
[228781.932414]  [c133ca34] ? fget_light+0x44/0xe0
[228781.937670]  [c1324e58] ? SyS_read+0x68/0x80
[228781.942730]  [c12019f5] do_notify_resume+0x55/0x70
[228781.948376]  [c1a7de5d] work_notifysig+0x29/0x30
[228781.953827]  [c1a7] ? bad_area+0x5/0x3e

Signed-off-by: Chao Bi chao...@intel.com
Signed-off-by: Tomas Winkler tomas.wink...@intel.com
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org

---
 drivers/misc/mei/client.c |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

--- a/drivers/misc/mei/client.c
+++ b/drivers/misc/mei/client.c
@@ -664,7 +664,6 @@ int mei_cl_read_start(struct mei_cl *cl,
goto err;
 
cb-fop_type = MEI_FOP_READ;
-   cl-read_cb = cb;
if (dev-hbuf_is_ready) {
dev-hbuf_is_ready = false;
if (mei_hbm_cl_flow_control_req(dev, cl)) {
@@ -675,6 +674,9 @@ int mei_cl_read_start(struct mei_cl *cl,
} else {
list_add_tail(cb-list, dev-ctrl_wr_list.list);
}
+
+   cl-read_cb = cb;
+
return rets;
 err:
mei_io_cb_free(cb);


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.10 43/97] ALSA: hda - Enable front audio jacks on one HP desktop model

2014-03-04 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Hui Wang hui.w...@canonical.com

commit 1de7ca5e844866f56bebb2fc47fa18e090677e88 upstream.

The front headphone and mic jackes on a HP desktop model (Vendor Id:
0x111d76c7 Subsystem Id: 0x103c2b17) can not work, the codec on this
machine has 8 physical ports, 6 of them are routed to rear jackes
and all of them work very well, while the remaining 2 ports are
routed to front headphone and mic jackes, but the corresponding
pin complex node are not defined correctly.

After apply this fix, the front audio jackes can work very well.

[trivial fix of enum definition by tiwai]

BugLink: https://bugs.launchpad.net/bugs/1282369
Cc: David Henningsson david.hennings...@canonical.com
Tested-by: Gerald Yang gerald.y...@canonical.com
Signed-off-by: Hui Wang hui.w...@canonical.com
Signed-off-by: Takashi Iwai ti...@suse.de
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org

---
 sound/pci/hda/patch_sigmatel.c |   13 +
 1 file changed, 13 insertions(+)

--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -83,6 +83,7 @@ enum {
STAC_DELL_M6_BOTH,
STAC_DELL_EQ,
STAC_ALIENWARE_M17X,
+   STAC_92HD89XX_HP_FRONT_JACK,
STAC_92HD73XX_MODELS
 };
 
@@ -1775,6 +1776,12 @@ static const struct hda_pintbl intel_dg4
{}
 };
 
+static const struct hda_pintbl stac92hd89xx_hp_front_jack_pin_configs[] = {
+   { 0x0a, 0x02214030 },
+   { 0x0b, 0x02A19010 },
+   {}
+};
+
 static void stac92hd73xx_fixup_ref(struct hda_codec *codec,
   const struct hda_fixup *fix, int action)
 {
@@ -1893,6 +1900,10 @@ static const struct hda_fixup stac92hd73
[STAC_92HD73XX_NO_JD] = {
.type = HDA_FIXUP_FUNC,
.v.func = stac92hd73xx_fixup_no_jd,
+   },
+   [STAC_92HD89XX_HP_FRONT_JACK] = {
+   .type = HDA_FIXUP_PINS,
+   .v.pins = stac92hd89xx_hp_front_jack_pin_configs,
}
 };
 
@@ -1953,6 +1964,8 @@ static const struct snd_pci_quirk stac92
  Alienware M17x, STAC_ALIENWARE_M17X),
SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0490,
  Alienware M17x R3, STAC_DELL_EQ),
+   SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x2b17,
+   unknown HP, STAC_92HD89XX_HP_FRONT_JACK),
{} /* terminator */
 };
 


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] [RESEND] ARM: footbridge: remove obsolete IRQF_DISABLED

2014-03-04 Thread Michael Opdenacker
This patch proposes to remove the IRQF_DISABLED flag from footbridge
code. It's a NOOP since 2.6.35.

Signed-off-by: Michael Opdenacker michael.opdenac...@free-electrons.com
---
 arch/arm/mach-footbridge/dc21285-timer.c |  2 +-
 arch/arm/mach-footbridge/dc21285.c   | 10 +-
 arch/arm/mach-footbridge/isa-timer.c |  2 +-
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/arch/arm/mach-footbridge/dc21285-timer.c 
b/arch/arm/mach-footbridge/dc21285-timer.c
index 3971104d32d4..952508f58ffb 100644
--- a/arch/arm/mach-footbridge/dc21285-timer.c
+++ b/arch/arm/mach-footbridge/dc21285-timer.c
@@ -105,7 +105,7 @@ static irqreturn_t timer1_interrupt(int irq, void *dev_id)
 static struct irqaction footbridge_timer_irq = {
.name   = dc21285_timer1,
.handler= timer1_interrupt,
-   .flags  = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
+   .flags  = IRQF_TIMER | IRQF_IRQPOLL,
.dev_id = ckevt_dc21285,
 };
 
diff --git a/arch/arm/mach-footbridge/dc21285.c 
b/arch/arm/mach-footbridge/dc21285.c
index 7c2fdae9a38b..96a3d73ef4bf 100644
--- a/arch/arm/mach-footbridge/dc21285.c
+++ b/arch/arm/mach-footbridge/dc21285.c
@@ -334,15 +334,15 @@ void __init dc21285_preinit(void)
/*
 * We don't care if these fail.
 */
-   dc21285_request_irq(IRQ_PCI_SERR, dc21285_serr_irq, IRQF_DISABLED,
+   dc21285_request_irq(IRQ_PCI_SERR, dc21285_serr_irq, 0,
PCI system error, serr_timer);
-   dc21285_request_irq(IRQ_PCI_PERR, dc21285_parity_irq, IRQF_DISABLED,
+   dc21285_request_irq(IRQ_PCI_PERR, dc21285_parity_irq, 0,
PCI parity error, perr_timer);
-   dc21285_request_irq(IRQ_PCI_ABORT, dc21285_abort_irq, IRQF_DISABLED,
+   dc21285_request_irq(IRQ_PCI_ABORT, dc21285_abort_irq, 0,
PCI abort, NULL);
-   dc21285_request_irq(IRQ_DISCARD_TIMER, dc21285_discard_irq, 
IRQF_DISABLED,
+   dc21285_request_irq(IRQ_DISCARD_TIMER, dc21285_discard_irq, 0,
Discard timer, NULL);
-   dc21285_request_irq(IRQ_PCI_DPERR, dc21285_dparity_irq, IRQF_DISABLED,
+   dc21285_request_irq(IRQ_PCI_DPERR, dc21285_dparity_irq, 0,
PCI data parity, NULL);
 
if (cfn_mode) {
diff --git a/arch/arm/mach-footbridge/isa-timer.c 
b/arch/arm/mach-footbridge/isa-timer.c
index d9301dd56354..b73f52e196b9 100644
--- a/arch/arm/mach-footbridge/isa-timer.c
+++ b/arch/arm/mach-footbridge/isa-timer.c
@@ -27,7 +27,7 @@ static irqreturn_t pit_timer_interrupt(int irq, void *dev_id)
 static struct irqaction pit_timer_irq = {
.name   = pit,
.handler= pit_timer_interrupt,
-   .flags  = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
+   .flags  = IRQF_TIMER | IRQF_IRQPOLL,
.dev_id = i8253_clockevent,
 };
 
-- 
1.8.3.2

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.10 56/97] x86: dma-mapping: fix GFP_ATOMIC macro usage

2014-03-04 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Marek Szyprowski m.szyprow...@samsung.com

commit c091c71ad2218fc50a07b3d1dab85783f3b77efd upstream.

GFP_ATOMIC is not a single gfp flag, but a macro which expands to the other
flags, where meaningful is the LACK of __GFP_WAIT flag. To check if caller
wants to perform an atomic allocation, the code must test for a lack of the
__GFP_WAIT flag. This patch fixes the issue introduced in v3.5-rc1.

Signed-off-by: Marek Szyprowski m.szyprow...@samsung.com
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org

---
 arch/x86/kernel/pci-dma.c |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

--- a/arch/x86/kernel/pci-dma.c
+++ b/arch/x86/kernel/pci-dma.c
@@ -100,8 +100,10 @@ void *dma_generic_alloc_coherent(struct
flag |= __GFP_ZERO;
 again:
page = NULL;
-   if (!(flag  GFP_ATOMIC))
+   /* CMA can be used only in the context which permits sleeping */
+   if (flag  __GFP_WAIT)
page = dma_alloc_from_contiguous(dev, count, get_order(size));
+   /* fallback */
if (!page)
page = alloc_pages_node(dev_to_node(dev), flag, 
get_order(size));
if (!page)


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.10 52/97] SUNRPC: Fix races in xs_nospace()

2014-03-04 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Trond Myklebust trond.mykleb...@primarydata.com

commit 06ea0bfe6e6043cb56a78935a19f6f8ebc636226 upstream.

When a send failure occurs due to the socket being out of buffer space,
we call xs_nospace() in order to have the RPC task wait until the
socket has drained enough to make it worth while trying again.
The current patch fixes a race in which the socket is drained before
we get round to setting up the machinery in xs_nospace(), and which
is reported to cause hangs.

Link: http://lkml.kernel.org/r/20140210170315.33dfc621@notabene.brown
Fixes: a9a6b52ee1ba (SUNRPC: Don't start the retransmission timer...)
Reported-by: Neil Brown ne...@suse.com
Signed-off-by: Trond Myklebust trond.mykleb...@primarydata.com
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org

---
 net/sunrpc/xprtsock.c |6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -502,6 +502,7 @@ static int xs_nospace(struct rpc_task *t
struct rpc_rqst *req = task-tk_rqstp;
struct rpc_xprt *xprt = req-rq_xprt;
struct sock_xprt *transport = container_of(xprt, struct sock_xprt, 
xprt);
+   struct sock *sk = transport-inet;
int ret = -EAGAIN;
 
dprintk(RPC: %5u xmit incomplete (%u left of %u)\n,
@@ -519,7 +520,7 @@ static int xs_nospace(struct rpc_task *t
 * window size
 */
set_bit(SOCK_NOSPACE, transport-sock-flags);
-   transport-inet-sk_write_pending++;
+   sk-sk_write_pending++;
/* ...and wait for more buffer space */
xprt_wait_for_buffer_space(task, xs_nospace_callback);
}
@@ -529,6 +530,9 @@ static int xs_nospace(struct rpc_task *t
}
 
spin_unlock_bh(xprt-transport_lock);
+
+   /* Race breaker in case memory is freed before above code is called */
+   sk-sk_write_space(sk);
return ret;
 }
 


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.10 51/97] ASoC: wm8958-dsp: Fix firmware block loading

2014-03-04 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Lars-Peter Clausen l...@metafoo.de

commit 548da08fc1e245faf9b0d7c41ecd8e07984fc332 upstream.

The codec-control_data contains a pointer to the device's regmap struct. But
wm8994_bulk_write() expects a pointer to the parent wm8998 device.

The issue was introduced in commit d9a7666f (ASoC: Remove ASoC-specific
WM8994 I/O code).

Fixes: d9a7666f (ASoC: Remove ASoC-specific WM8994 I/O code)
Signed-off-by: Lars-Peter Clausen l...@metafoo.de
Signed-off-by: Mark Brown broo...@linaro.org
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org

---
 sound/soc/codecs/wm8958-dsp2.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/sound/soc/codecs/wm8958-dsp2.c
+++ b/sound/soc/codecs/wm8958-dsp2.c
@@ -153,7 +153,7 @@ static int wm8958_dsp2_fw(struct snd_soc
 
data32 = 0xff;
 
-   wm8994_bulk_write(codec-control_data,
+   wm8994_bulk_write(wm8994-wm8994,
  data32  0xff,
  block_len / 2,
  (void *)(data + 8));


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.10 47/97] ASoC: da732x: Mark DC offset control registers volatile

2014-03-04 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Mark Brown broo...@linaro.org

commit 75306820248e26d15d84acf4e297b9fb27dd3bb2 upstream.

The driver reads from the DC offset control registers during callibration
but since the registers are marked as volatile and there is a register
cache the values will not be read from the hardware after the first reading
rendering the callibration ineffective.

It appears that the driver was originally written for the ASoC level
register I/O code but converted to regmap prior to merge and this issue
was missed during the conversion as the framework level volatile register
functionality was not being used.

Signed-off-by: Mark Brown broo...@linaro.org
Acked-by: Adam Thomson adam.thomson.opensou...@diasemi.com
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org

---
 sound/soc/codecs/da732x.c |   12 
 1 file changed, 12 insertions(+)

--- a/sound/soc/codecs/da732x.c
+++ b/sound/soc/codecs/da732x.c
@@ -1268,11 +1268,23 @@ static struct snd_soc_dai_driver da732x_
},
 };
 
+static bool da732x_volatile(struct device *dev, unsigned int reg)
+{
+   switch (reg) {
+   case DA732X_REG_HPL_DAC_OFF_CNTL:
+   case DA732X_REG_HPR_DAC_OFF_CNTL:
+   return true;
+   default:
+   return false;
+   }
+}
+
 static const struct regmap_config da732x_regmap = {
.reg_bits   = 8,
.val_bits   = 8,
 
.max_register   = DA732X_MAX_REG,
+   .volatile_reg   = da732x_volatile,
.reg_defaults   = da732x_reg_cache,
.num_reg_defaults   = ARRAY_SIZE(da732x_reg_cache),
.cache_type = REGCACHE_RBTREE,


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.10 55/97] ahci: disable NCQ on Samsung pci-e SSDs on macbooks

2014-03-04 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Levente Kurusa le...@linux.com

commit 67809f85d31eac600f6b28defa5386c9d2a13b1d upstream.

Samsung's pci-e SSDs with device ID 0x1600 which are found on some
macbooks time out on NCQ commands.  Blacklist NCQ on the device so
that the affected machines can at least boot.

Original-patch-by: Levente Kurusa le...@linux.com
Signed-off-by: Tejun Heo t...@kernel.org
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=60731
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org

---
 drivers/ata/ahci.c |   14 ++
 1 file changed, 14 insertions(+)

--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -61,6 +61,7 @@ enum board_ids {
/* board IDs by feature in alphabetical order */
board_ahci,
board_ahci_ign_iferr,
+   board_ahci_noncq,
board_ahci_nosntf,
board_ahci_yes_fbs,
 
@@ -119,6 +120,13 @@ static const struct ata_port_info ahci_p
.udma_mask  = ATA_UDMA6,
.port_ops   = ahci_ops,
},
+   [board_ahci_noncq] = {
+   AHCI_HFLAGS (AHCI_HFLAG_NO_NCQ),
+   .flags  = AHCI_FLAG_COMMON,
+   .pio_mask   = ATA_PIO4,
+   .udma_mask  = ATA_UDMA6,
+   .port_ops   = ahci_ops,
+   },
[board_ahci_nosntf] = {
AHCI_HFLAGS (AHCI_HFLAG_NO_SNTF),
.flags  = AHCI_FLAG_COMMON,
@@ -450,6 +458,12 @@ static const struct pci_device_id ahci_p
{ PCI_VDEVICE(ASMEDIA, 0x0611), board_ahci },   /* ASM1061 */
{ PCI_VDEVICE(ASMEDIA, 0x0612), board_ahci },   /* ASM1062 */
 
+   /*
+* Samsung SSDs found on some macbooks.  NCQ times out.
+* https://bugzilla.kernel.org/show_bug.cgi?id=60731
+*/
+   { PCI_VDEVICE(SAMSUNG, 0x1600), board_ahci_noncq },
+
/* Enmotus */
{ PCI_DEVICE(0x1c44, 0x8000), board_ahci },
 


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2] mmc: sdhci: add quirk for broken write protect detection

2014-03-04 Thread Eli Billauer

Hello Sören,

wp-inverted solves the practical problem indeed, and fools the driver 
into thinking that the card has an inverted write protection sensor, and 
the logic zero that it finds in the hardware register means that the 
card isn't write protected.


I'm insisting on this patch, because I think that the device tree should 
describe the hardware as it is, and not fool the driver into behaving 
the way we want it to. These tricks always bite back later on.


Regards,
   Eli

On 04/03/14 21:26, Sören Brinkmann wrote:

Hi Eli,

On Sun, 2014-03-02 at 01:20PM +0200, Eli Billauer wrote:
   

The write protection signal is absent on a board based upon Xilinx' Zynq
processor (ZyBo). This leads the kernel to think that the MicroSD card is
write protected, and causes a kernel panic during boot, as root fails to
mount RW.
 

I talked to some people here at Xilinx. According to them, you have the
option to pin out the WP signal, which would mean the board needs to
tie/connect the signal properly. Or, if you select to not pin out the WP
signal, it should be tied to 0 within the chip.
Currently, I have some doubts that is the case, since Mike reported the
same issue, but would you mind double checking?
In theory the signal should default to logic zero which would at most
require to add the, already existing, 'wp-inverted' quirk when using
micro-sd on Zynq.

Thanks,
Sören



   



--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.10 48/97] ASoC: sta32x: Fix cache sync

2014-03-04 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Lars-Peter Clausen l...@metafoo.de

commit 70ff00f82a6af0ff68f8f7b411738634ce2f20d0 upstream.

codec-control_data contains a pointer to the regmap struct of the device, not
to the device private data. Use snd_soc_codec_get_drvdata() instead.

The issue was introduced in commit 29fdf4fbbe (ASoC: sta32x: Convert to
regmap).

Fixes: 29fdf4fbbe (ASoC: sta32x: Convert to regmap)
Signed-off-by: Lars-Peter Clausen l...@metafoo.de
Signed-off-by: Mark Brown broo...@linaro.org
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org

---
 sound/soc/codecs/sta32x.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/sound/soc/codecs/sta32x.c
+++ b/sound/soc/codecs/sta32x.c
@@ -331,7 +331,7 @@ static int sta32x_sync_coef_shadow(struc
 
 static int sta32x_cache_sync(struct snd_soc_codec *codec)
 {
-   struct sta32x_priv *sta32x = codec-control_data;
+   struct sta32x_priv *sta32x = snd_soc_codec_get_drvdata(codec);
unsigned int mute;
int rc;
 


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.10 50/97] ASoC: sta32x: Fix array access overflow

2014-03-04 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Takashi Iwai ti...@suse.de

commit 025c3fa9256d4c54506b7a29dc3befac54f5c68d upstream.

Preset EQ enum of sta32x codec driver declares too many number of
items and it may lead to the access over the actual array size.

Use SOC_ENUM_SINGLE_DECL() helper and it's automatically fixed.

Signed-off-by: Takashi Iwai ti...@suse.de
Acked-by: Liam Girdwood liam.r.girdw...@linux.intel.com
Acked-by: Lars-Peter Clausen l...@metafoo.de
Signed-off-by: Mark Brown broo...@linaro.org
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org

---
 sound/soc/codecs/sta32x.c |   72 +++---
 1 file changed, 36 insertions(+), 36 deletions(-)

--- a/sound/soc/codecs/sta32x.c
+++ b/sound/soc/codecs/sta32x.c
@@ -187,42 +187,42 @@ static const unsigned int sta32x_limiter
13, 16, TLV_DB_SCALE_ITEM(-1500, 300, 0),
 };
 
-static const struct soc_enum sta32x_drc_ac_enum =
-   SOC_ENUM_SINGLE(STA32X_CONFD, STA32X_CONFD_DRC_SHIFT,
-   2, sta32x_drc_ac);
-static const struct soc_enum sta32x_auto_eq_enum =
-   SOC_ENUM_SINGLE(STA32X_AUTO1, STA32X_AUTO1_AMEQ_SHIFT,
-   3, sta32x_auto_eq_mode);
-static const struct soc_enum sta32x_auto_gc_enum =
-   SOC_ENUM_SINGLE(STA32X_AUTO1, STA32X_AUTO1_AMGC_SHIFT,
-   4, sta32x_auto_gc_mode);
-static const struct soc_enum sta32x_auto_xo_enum =
-   SOC_ENUM_SINGLE(STA32X_AUTO2, STA32X_AUTO2_XO_SHIFT,
-   16, sta32x_auto_xo_mode);
-static const struct soc_enum sta32x_preset_eq_enum =
-   SOC_ENUM_SINGLE(STA32X_AUTO3, STA32X_AUTO3_PEQ_SHIFT,
-   32, sta32x_preset_eq_mode);
-static const struct soc_enum sta32x_limiter_ch1_enum =
-   SOC_ENUM_SINGLE(STA32X_C1CFG, STA32X_CxCFG_LS_SHIFT,
-   3, sta32x_limiter_select);
-static const struct soc_enum sta32x_limiter_ch2_enum =
-   SOC_ENUM_SINGLE(STA32X_C2CFG, STA32X_CxCFG_LS_SHIFT,
-   3, sta32x_limiter_select);
-static const struct soc_enum sta32x_limiter_ch3_enum =
-   SOC_ENUM_SINGLE(STA32X_C3CFG, STA32X_CxCFG_LS_SHIFT,
-   3, sta32x_limiter_select);
-static const struct soc_enum sta32x_limiter1_attack_rate_enum =
-   SOC_ENUM_SINGLE(STA32X_L1AR, STA32X_LxA_SHIFT,
-   16, sta32x_limiter_attack_rate);
-static const struct soc_enum sta32x_limiter2_attack_rate_enum =
-   SOC_ENUM_SINGLE(STA32X_L2AR, STA32X_LxA_SHIFT,
-   16, sta32x_limiter_attack_rate);
-static const struct soc_enum sta32x_limiter1_release_rate_enum =
-   SOC_ENUM_SINGLE(STA32X_L1AR, STA32X_LxR_SHIFT,
-   16, sta32x_limiter_release_rate);
-static const struct soc_enum sta32x_limiter2_release_rate_enum =
-   SOC_ENUM_SINGLE(STA32X_L2AR, STA32X_LxR_SHIFT,
-   16, sta32x_limiter_release_rate);
+static SOC_ENUM_SINGLE_DECL(sta32x_drc_ac_enum,
+   STA32X_CONFD, STA32X_CONFD_DRC_SHIFT,
+   sta32x_drc_ac);
+static SOC_ENUM_SINGLE_DECL(sta32x_auto_eq_enum,
+   STA32X_AUTO1, STA32X_AUTO1_AMEQ_SHIFT,
+   sta32x_auto_eq_mode);
+static SOC_ENUM_SINGLE_DECL(sta32x_auto_gc_enum,
+   STA32X_AUTO1, STA32X_AUTO1_AMGC_SHIFT,
+   sta32x_auto_gc_mode);
+static SOC_ENUM_SINGLE_DECL(sta32x_auto_xo_enum,
+   STA32X_AUTO2, STA32X_AUTO2_XO_SHIFT,
+   sta32x_auto_xo_mode);
+static SOC_ENUM_SINGLE_DECL(sta32x_preset_eq_enum,
+   STA32X_AUTO3, STA32X_AUTO3_PEQ_SHIFT,
+   sta32x_preset_eq_mode);
+static SOC_ENUM_SINGLE_DECL(sta32x_limiter_ch1_enum,
+   STA32X_C1CFG, STA32X_CxCFG_LS_SHIFT,
+   sta32x_limiter_select);
+static SOC_ENUM_SINGLE_DECL(sta32x_limiter_ch2_enum,
+   STA32X_C2CFG, STA32X_CxCFG_LS_SHIFT,
+   sta32x_limiter_select);
+static SOC_ENUM_SINGLE_DECL(sta32x_limiter_ch3_enum,
+   STA32X_C3CFG, STA32X_CxCFG_LS_SHIFT,
+   sta32x_limiter_select);
+static SOC_ENUM_SINGLE_DECL(sta32x_limiter1_attack_rate_enum,
+   STA32X_L1AR, STA32X_LxA_SHIFT,
+   sta32x_limiter_attack_rate);
+static SOC_ENUM_SINGLE_DECL(sta32x_limiter2_attack_rate_enum,
+   STA32X_L2AR, STA32X_LxA_SHIFT,
+   sta32x_limiter_attack_rate);
+static SOC_ENUM_SINGLE_DECL(sta32x_limiter1_release_rate_enum,
+   STA32X_L1AR, STA32X_LxR_SHIFT,
+   sta32x_limiter_release_rate);
+static SOC_ENUM_SINGLE_DECL(sta32x_limiter2_release_rate_enum,
+   STA32X_L2AR, STA32X_LxR_SHIFT,
+   

[PATCH 3.10 46/97] ASoC: wm8770: Fix wrong number of enum items

2014-03-04 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Takashi Iwai ti...@suse.de

commit 7a6c0a58dc824523966f212c76322d47c5b0e6fe upstream.

wm8770 codec driver defines ain_enum with a wrong number of items.

Use SOC_ENUM_DOUBLE_DECL() macro and it's automatically fixed.

Signed-off-by: Takashi Iwai ti...@suse.de
Acked-by: Liam Girdwood liam.r.girdw...@linux.intel.com
Acked-by: Charles Keepax ckee...@opensource.wolfsonmicro.com
Acked-by: Lars-Peter Clausen l...@metafoo.de
Signed-off-by: Mark Brown broo...@linaro.org
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org

---
 sound/soc/codecs/wm8770.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/sound/soc/codecs/wm8770.c
+++ b/sound/soc/codecs/wm8770.c
@@ -196,8 +196,8 @@ static const char *ain_text[] = {
AIN5, AIN6, AIN7, AIN8
 };
 
-static const struct soc_enum ain_enum =
-   SOC_ENUM_DOUBLE(WM8770_ADCMUX, 0, 4, 8, ain_text);
+static SOC_ENUM_DOUBLE_DECL(ain_enum,
+   WM8770_ADCMUX, 0, 4, ain_text);
 
 static const struct snd_kcontrol_new ain_mux =
SOC_DAPM_ENUM(Capture Mux, ain_enum);


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[RFC PATCH] Remove CONFIG_DCACHE_WORD_ACCESS

2014-03-04 Thread Joe Perches
It seems to duplicate CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
so use that instead.

This changes the !CPU_LITTLE_ENDIAN powerpc arch to use unaligned
accesses in fs/dcache.c and fs/namei.c as
CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS is enabled for that arch.

Remove the now unused DCACHE_WORD_ACCESS defines  uses.

Signed-off-by: Joe Perches j...@perches.com
---
 arch/arm/Kconfig  | 1 -
 arch/arm/include/asm/word-at-a-time.h | 4 ++--
 arch/arm64/Kconfig| 1 -
 arch/x86/Kconfig  | 1 -
 fs/Kconfig| 4 
 fs/dcache.c   | 2 +-
 fs/namei.c| 2 +-
 7 files changed, 4 insertions(+), 11 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 623a272..d5a2e60 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -12,7 +12,6 @@ config ARM
select BUILDTIME_EXTABLE_SORT if MMU
select CLONE_BACKWARDS
select CPU_PM if (SUSPEND || CPU_IDLE)
-   select DCACHE_WORD_ACCESS if HAVE_EFFICIENT_UNALIGNED_ACCESS
select GENERIC_ATOMIC64 if (CPU_V7M || CPU_V6 || !CPU_32v6K || !AEABI)
select GENERIC_CLOCKEVENTS_BROADCAST if SMP
select GENERIC_IDLE_POLL_SETUP
diff --git a/arch/arm/include/asm/word-at-a-time.h 
b/arch/arm/include/asm/word-at-a-time.h
index a6d0a29..778b2ad 100644
--- a/arch/arm/include/asm/word-at-a-time.h
+++ b/arch/arm/include/asm/word-at-a-time.h
@@ -54,7 +54,7 @@ static inline unsigned long find_zero(unsigned long mask)
 #include asm-generic/word-at-a-time.h
 #endif
 
-#ifdef CONFIG_DCACHE_WORD_ACCESS
+#ifdef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
 
 /*
  * Load an unaligned word from kernel space.
@@ -94,5 +94,5 @@ static inline unsigned long load_unaligned_zeropad(const void 
*addr)
return ret;
 }
 
-#endif /* DCACHE_WORD_ACCESS */
+#endif /* HAVE_EFFICIENT_UNALIGNED_ACCESS */
 #endif /* __ASM_ARM_WORD_AT_A_TIME_H */
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 764d682..2d6978c 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -13,7 +13,6 @@ config ARM64
select CLONE_BACKWARDS
select COMMON_CLK
select CPU_PM if (SUSPEND || CPU_IDLE)
-   select DCACHE_WORD_ACCESS
select GENERIC_CLOCKEVENTS
select GENERIC_CLOCKEVENTS_BROADCAST if SMP
select GENERIC_IOMAP
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index abb261e..60cfa073 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -98,7 +98,6 @@ config X86
select CLKEVT_I8253
select ARCH_HAVE_NMI_SAFE_CMPXCHG
select GENERIC_IOMAP
-   select DCACHE_WORD_ACCESS
select GENERIC_SMP_IDLE_THREAD
select ARCH_WANT_IPC_PARSE_VERSION if X86_32
select HAVE_ARCH_SECCOMP_FILTER
diff --git a/fs/Kconfig b/fs/Kconfig
index 312393f..7511271 100644
--- a/fs/Kconfig
+++ b/fs/Kconfig
@@ -4,10 +4,6 @@
 
 menu File systems
 
-# Use unaligned word dcache accesses
-config DCACHE_WORD_ACCESS
-   bool
-
 if BLOCK
 
 source fs/ext2/Kconfig
diff --git a/fs/dcache.c b/fs/dcache.c
index 265e0ce..4e3c195 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -163,7 +163,7 @@ int proc_nr_dentry(ctl_table *table, int write, void __user 
*buffer,
  * Compare 2 name strings, return 0 if they match, otherwise non-zero.
  * The strings are both count bytes long, and count is non-zero.
  */
-#ifdef CONFIG_DCACHE_WORD_ACCESS
+#ifdef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
 
 #include asm/word-at-a-time.h
 /*
diff --git a/fs/namei.c b/fs/namei.c
index 385f781..1ee33ca 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1618,7 +1618,7 @@ static inline int nested_symlink(struct path *path, 
struct nameidata *nd)
  *   the final mask. Again, that could be replaced with a
  *   efficient population count instruction or similar.
  */
-#ifdef CONFIG_DCACHE_WORD_ACCESS
+#ifdef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
 
 #include asm/word-at-a-time.h
 


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.10 45/97] ASoC: max98090: sync regcache on entering STANDBY

2014-03-04 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Dylan Reid dgr...@chromium.org

commit c42c8922c46d33ed769e99618bdfba06866a0c72 upstream.

Sync regcache when entering STANDBY from OFF.  ON isn't entered with
OFF as the current state, so the registers were not being re-synced
after suspend/resume.

The 98088 and 98095 already call regcache_sync from STANDBY.

Signed-off-by: Dylan Reid dgr...@chromium.org
Signed-off-by: Mark Brown broo...@linaro.org
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org

---
 sound/soc/codecs/max98090.c |   20 ++--
 1 file changed, 10 insertions(+), 10 deletions(-)

--- a/sound/soc/codecs/max98090.c
+++ b/sound/soc/codecs/max98090.c
@@ -1755,16 +1755,6 @@ static int max98090_set_bias_level(struc
 
switch (level) {
case SND_SOC_BIAS_ON:
-   if (codec-dapm.bias_level == SND_SOC_BIAS_OFF) {
-   ret = regcache_sync(max98090-regmap);
-
-   if (ret != 0) {
-   dev_err(codec-dev,
-   Failed to sync cache: %d\n, ret);
-   return ret;
-   }
-   }
-
if (max98090-jack_state == M98090_JACK_STATE_HEADSET) {
/*
 * Set to normal bias level.
@@ -1778,6 +1768,16 @@ static int max98090_set_bias_level(struc
break;
 
case SND_SOC_BIAS_STANDBY:
+   if (codec-dapm.bias_level == SND_SOC_BIAS_OFF) {
+   ret = regcache_sync(max98090-regmap);
+   if (ret != 0) {
+   dev_err(codec-dev,
+   Failed to sync cache: %d\n, ret);
+   return ret;
+   }
+   }
+   break;
+
case SND_SOC_BIAS_OFF:
/* Set internal pull-up to lowest power mode */
snd_soc_update_bits(codec, M98090_REG_JACK_DETECT,


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.10 54/97] powerpc/crashdump : Fix page frame number check in copy_oldmem_page

2014-03-04 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Laurent Dufour lduf...@linux.vnet.ibm.com

commit f5295bd8ea8a65dc5eac608b151386314cb978f1 upstream.

In copy_oldmem_page, the current check using max_pfn and min_low_pfn to
decide if the page is backed or not, is not valid when the memory layout is
not continuous.

This happens when running as a QEMU/KVM guest, where RTAS is mapped higher
in the memory. In that case max_pfn points to the end of RTAS, and a hole
between the end of the kdump kernel and RTAS is not backed by PTEs. As a
consequence, the kdump kernel is crashing in copy_oldmem_page when accessing
in a direct way the pages in that hole.

This fix relies on the memblock's service memblock_is_region_memory to
check if the read page is part or not of the directly accessible memory.

Signed-off-by: Laurent Dufour lduf...@linux.vnet.ibm.com
Tested-by: Mahesh Salgaonkar mah...@linux.vnet.ibm.com
Signed-off-by: Benjamin Herrenschmidt b...@kernel.crashing.org
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org

---
 arch/powerpc/kernel/crash_dump.c |8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

--- a/arch/powerpc/kernel/crash_dump.c
+++ b/arch/powerpc/kernel/crash_dump.c
@@ -108,17 +108,19 @@ ssize_t copy_oldmem_page(unsigned long p
size_t csize, unsigned long offset, int userbuf)
 {
void  *vaddr;
+   phys_addr_t paddr;
 
if (!csize)
return 0;
 
csize = min_t(size_t, csize, PAGE_SIZE);
+   paddr = pfn  PAGE_SHIFT;
 
-   if ((min_low_pfn  pfn)  (pfn  max_pfn)) {
-   vaddr = __va(pfn  PAGE_SHIFT);
+   if (memblock_is_region_memory(paddr, csize)) {
+   vaddr = __va(paddr);
csize = copy_oldmem_vaddr(vaddr, buf, csize, offset, userbuf);
} else {
-   vaddr = __ioremap(pfn  PAGE_SHIFT, PAGE_SIZE, 0);
+   vaddr = __ioremap(paddr, PAGE_SIZE, 0);
csize = copy_oldmem_vaddr(vaddr, buf, csize, offset, userbuf);
iounmap(vaddr);
}


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.10 57/97] perf/x86: Fix event scheduling

2014-03-04 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Peter Zijlstra pet...@infradead.org

commit 26e61e8939b1fe8729572dabe9a9e97d930dd4f6 upstream.

Vince Super Tester Weaver reported a new round of syscall fuzzing (Trinity) 
failures,
with perf WARN_ON()s triggering. He also provided traces of the failures.

This is I think the relevant bit:

pec_1076_warn-2804  [000] d...   147.926153: x86_pmu_disable: 
x86_pmu_disable
pec_1076_warn-2804  [000] d...   147.926153: x86_pmu_state: 
Events: {
pec_1076_warn-2804  [000] d...   147.926156: x86_pmu_state:   0: 
state: .R config:  (  (null))
pec_1076_warn-2804  [000] d...   147.926158: x86_pmu_state:   33: 
state: AR config: 0 (88011ac99800)
pec_1076_warn-2804  [000] d...   147.926159: x86_pmu_state: }
pec_1076_warn-2804  [000] d...   147.926160: x86_pmu_state: 
n_events: 1, n_added: 0, n_txn: 1
pec_1076_warn-2804  [000] d...   147.926161: x86_pmu_state: 
Assignment: {
pec_1076_warn-2804  [000] d...   147.926162: x86_pmu_state:   
0-33 tag: 1 config: 0 (88011ac99800)
pec_1076_warn-2804  [000] d...   147.926163: x86_pmu_state: }
pec_1076_warn-2804  [000] d...   147.926166: collect_events: 
Adding event: 1 (880119ec8800)

So we add the insn:p event (fd[23]).

At this point we should have:

  n_events = 2, n_added = 1, n_txn = 1

pec_1076_warn-2804  [000] d...   147.926170: collect_events: 
Adding event: 0 (8800c9e01800)
pec_1076_warn-2804  [000] d...   147.926172: collect_events: 
Adding event: 4 (8800cbab2c00)

We try and add the {BP,cycles,br_insn} group (fd[3], fd[4], fd[15]).
These events are 0:cycles and 4:br_insn, the BP event isn't x86_pmu so
that's not visible.

group_sched_in()
  pmu-start_txn() /* nop - BP pmu */
  event_sched_in()
 event-pmu-add()

So here we should end up with:

  0: n_events = 3, n_added = 2, n_txn = 2
  4: n_events = 4, n_added = 3, n_txn = 3

But seeing the below state on x86_pmu_enable(), the must have failed,
because the 0 and 4 events aren't there anymore.

Looking at group_sched_in(), since the BP is the leader, its
event_sched_in() must have succeeded, for otherwise we would not have
seen the sibling adds.

But since neither 0 or 4 are in the below state; their event_sched_in()
must have failed; but I don't see why, the complete state: 0,0,1:p,4
fits perfectly fine on a core2.

However, since we try and schedule 4 it means the 0 event must have
succeeded!  Therefore the 4 event must have failed, its failure will
have put group_sched_in() into the fail path, which will call:

event_sched_out()
  event-pmu-del()

on 0 and the BP event.

Now x86_pmu_del() will reduce n_events; but it will not reduce n_added;
giving what we see below:

 n_event = 2, n_added = 2, n_txn = 2

pec_1076_warn-2804  [000] d...   147.926177: x86_pmu_enable: 
x86_pmu_enable
pec_1076_warn-2804  [000] d...   147.926177: x86_pmu_state: 
Events: {
pec_1076_warn-2804  [000] d...   147.926179: x86_pmu_state:   0: 
state: .R config:  (  (null))
pec_1076_warn-2804  [000] d...   147.926181: x86_pmu_state:   33: 
state: AR config: 0 (88011ac99800)
pec_1076_warn-2804  [000] d...   147.926182: x86_pmu_state: }
pec_1076_warn-2804  [000] d...   147.926184: x86_pmu_state: 
n_events: 2, n_added: 2, n_txn: 2
pec_1076_warn-2804  [000] d...   147.926184: x86_pmu_state: 
Assignment: {
pec_1076_warn-2804  [000] d...   147.926186: x86_pmu_state:   
0-33 tag: 1 config: 0 (88011ac99800)
pec_1076_warn-2804  [000] d...   147.926188: x86_pmu_state:   1-0 
tag: 1 config: 1 (880119ec8800)
pec_1076_warn-2804  [000] d...   147.926188: x86_pmu_state: }
pec_1076_warn-2804  [000] d...   147.926190: x86_pmu_enable: S0: 
hwc-idx: 33, hwc-last_cpu: 0, hwc-last_tag: 1 hwc-state: 0

So the problem is that x86_pmu_del(), when called from a
group_sched_in() that fails (for whatever reason), and without x86_pmu
TXN support (because the leader is !x86_pmu), will corrupt the n_added
state.

Reported-and-Tested-by: Vince Weaver vincent.wea...@maine.edu
Signed-off-by: Peter Zijlstra pet...@infradead.org
Cc: Paul Mackerras pau...@samba.org
Cc: Steven Rostedt rost...@goodmis.org
Cc: Stephane Eranian eran...@google.com
Cc: Dave Jones da...@redhat.com
Link: 
http://lkml.kernel.org/r/20140221150312.gf3...@twins.programming.kicks-ass.net
Signed-off-by: Ingo Molnar mi...@kernel.org
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org

---
 arch/x86/kernel/cpu/perf_event.c |3 +++
 1 file changed, 3 insertions(+)

--- a/arch/x86/kernel/cpu/perf_event.c
+++ b/arch/x86/kernel/cpu/perf_event.c
@@ -1165,6 +1165,9 @@ static void x86_pmu_del(struct 

[PATCH 3.10 39/97] fs: fix iversion handling

2014-03-04 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Christoph Hellwig h...@infradead.org

commit dff6efc326a4d5f305797d4a6bba14f374fdd633 upstream.

Currently notify_change directly updates i_version for size updates,
which not only is counter to how all other fields are updated through
struct iattr, but also breaks XFS, which need inode updates to happen
under its own lock, and synchronized to the structure that gets written
to the log.

Remove the update in the common code, and it to btrfs and ext4,
XFS already does a proper updaste internally and currently gets a
double update with the existing code.

IMHO this is 3.13 and -stable material and should go in through the XFS
tree.

Signed-off-by: Christoph Hellwig h...@lst.de
Reviewed-by: Andreas Dilger adil...@dilger.ca
Acked-by: Jan Kara j...@suse.cz
Reviewed-by: Dave Chinner dchin...@redhat.com
Signed-off-by: Chris Mason c...@fb.com
Signed-off-by: Ben Myers b...@sgi.com
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org

---
 fs/attr.c|5 -
 fs/btrfs/inode.c |8 ++--
 fs/ext4/inode.c  |4 
 3 files changed, 10 insertions(+), 7 deletions(-)

--- a/fs/attr.c
+++ b/fs/attr.c
@@ -182,11 +182,6 @@ int notify_change(struct dentry * dentry
return -EPERM;
}
 
-   if ((ia_valid  ATTR_SIZE)  IS_I_VERSION(inode)) {
-   if (attr-ia_size != inode-i_size)
-   inode_inc_iversion(inode);
-   }
-
if ((ia_valid  ATTR_MODE)) {
umode_t amode = attr-ia_mode;
/* Flag setting protected by i_mutex */
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -4527,8 +4527,12 @@ static int btrfs_setsize(struct inode *i
 * these flags set.  For all other operations the VFS set these flags
 * explicitly if it wants a timestamp update.
 */
-   if (newsize != oldsize  (!(mask  (ATTR_CTIME | ATTR_MTIME
-   inode-i_ctime = inode-i_mtime = current_fs_time(inode-i_sb);
+   if (newsize != oldsize) {
+   inode_inc_iversion(inode);
+   if (!(mask  (ATTR_CTIME | ATTR_MTIME)))
+   inode-i_ctime = inode-i_mtime =
+   current_fs_time(inode-i_sb);
+   }
 
if (newsize  oldsize) {
truncate_pagecache(inode, oldsize, newsize);
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -4704,6 +4704,10 @@ int ext4_setattr(struct dentry *dentry,
if (attr-ia_size  sbi-s_bitmap_maxbytes)
return -EFBIG;
}
+
+   if (IS_I_VERSION(inode)  attr-ia_size != inode-i_size)
+   inode_inc_iversion(inode);
+
if (S_ISREG(inode-i_mode) 
(attr-ia_size  inode-i_size)) {
if (ext4_should_order_data(inode)) {


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.10 44/97] kvm: x86: fix emulator buffer overflow (CVE-2014-0049)

2014-03-04 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Andrew Honig aho...@google.com

commit a08d3b3b99efd509133946056531cdf8f3a0c09b upstream.

The problem occurs when the guest performs a pusha with the stack
address pointing to an mmio address (or an invalid guest physical
address) to start with, but then extending into an ordinary guest
physical address.  When doing repeated emulated pushes
emulator_read_write sets mmio_needed to 1 on the first one.  On a
later push when the stack points to regular memory,
mmio_nr_fragments is set to 0, but mmio_is_needed is not set to 0.

As a result, KVM exits to userspace, and then returns to
complete_emulated_mmio.  In complete_emulated_mmio
vcpu-mmio_cur_fragment is incremented.  The termination condition of
vcpu-mmio_cur_fragment == vcpu-mmio_nr_fragments is never achieved.
The code bounces back and fourth to userspace incrementing
mmio_cur_fragment past it's buffer.  If the guest does nothing else it
eventually leads to a a crash on a memcpy from invalid memory address.

However if a guest code can cause the vm to be destroyed in another
vcpu with excellent timing, then kvm_clear_async_pf_completion_queue
can be used by the guest to control the data that's pointed to by the
call to cancel_work_item, which can be used to gain execution.

Fixes: f78146b0f9230765c6315b2e14f56112513389ad
Signed-off-by: Andrew Honig aho...@google.com
Signed-off-by: Paolo Bonzini pbonz...@redhat.com
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org

---
 arch/x86/kvm/x86.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -5982,7 +5982,7 @@ static int complete_emulated_mmio(struct
frag-len -= len;
}
 
-   if (vcpu-mmio_cur_fragment == vcpu-mmio_nr_fragments) {
+   if (vcpu-mmio_cur_fragment = vcpu-mmio_nr_fragments) {
vcpu-mmio_needed = 0;
if (vcpu-mmio_is_write)
return 1;


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] PM / devfreq: Rewrite devfreq_update_status() to fix multiple bugs

2014-03-04 Thread Saravana Kannan
On 03/04/2014 02:06 AM, MyungJoo Ham wrote:
 The current devfreq_update_status() has the following bugs:
 - If previous frequency doesn't have a valid level, it does an out of bounds
access into the trans_table and causes memory corruption.
 - When the new frequency doesn't have a valid level, the time spent in the
new frequency is counted towards the next valid frequency switch instead 
 of
being ignored.
 - The time spent on the previous frequency is added to the new frequency's
stats instead of the previous frequency's stats.

 This patch fixes all of this.

 Signed-off-by: Saravana Kannan skan...@codeaurora.org
 
 Merged.
 
 It appears to be Greg's LTS material as well.
 

Thanks!

-Saravana

-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] [RESEND] frv: remove deprecated IRQF_DISABLED

2014-03-04 Thread Michael Opdenacker
This patch removes the IRQF_DISABLED flag from FRV architecture
code. It's a NOOP since 2.6.35 and it will be removed one day.

Signed-off-by: Michael Opdenacker michael.opdenac...@free-electrons.com
---
 arch/frv/kernel/irq-mb93091.c | 8 
 arch/frv/kernel/irq-mb93093.c | 1 -
 arch/frv/kernel/irq-mb93493.c | 4 ++--
 arch/frv/kernel/time.c| 1 -
 4 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/arch/frv/kernel/irq-mb93091.c b/arch/frv/kernel/irq-mb93091.c
index 2cc327a1ca44..091b2839be90 100644
--- a/arch/frv/kernel/irq-mb93091.c
+++ b/arch/frv/kernel/irq-mb93091.c
@@ -107,25 +107,25 @@ static irqreturn_t fpga_interrupt(int irq, void *_mask)
 static struct irqaction fpga_irq[4]  = {
[0] = {
.handler= fpga_interrupt,
-   .flags  = IRQF_DISABLED | IRQF_SHARED,
+   .flags  = IRQF_SHARED,
.name   = fpga.0,
.dev_id = (void *) 0x0028UL,
},
[1] = {
.handler= fpga_interrupt,
-   .flags  = IRQF_DISABLED | IRQF_SHARED,
+   .flags  = IRQF_SHARED,
.name   = fpga.1,
.dev_id = (void *) 0x0050UL,
},
[2] = {
.handler= fpga_interrupt,
-   .flags  = IRQF_DISABLED | IRQF_SHARED,
+   .flags  = IRQF_SHARED,
.name   = fpga.2,
.dev_id = (void *) 0x1c00UL,
},
[3] = {
.handler= fpga_interrupt,
-   .flags  = IRQF_DISABLED | IRQF_SHARED,
+   .flags  = IRQF_SHARED,
.name   = fpga.3,
.dev_id = (void *) 0x6386UL,
}
diff --git a/arch/frv/kernel/irq-mb93093.c b/arch/frv/kernel/irq-mb93093.c
index 95e4eb4f1f38..1f3015cf80f5 100644
--- a/arch/frv/kernel/irq-mb93093.c
+++ b/arch/frv/kernel/irq-mb93093.c
@@ -105,7 +105,6 @@ static irqreturn_t fpga_interrupt(int irq, void *_mask)
 static struct irqaction fpga_irq[1]  = {
[0] = {
.handler= fpga_interrupt,
-   .flags  = IRQF_DISABLED,
.name   = fpga.0,
.dev_id = (void *) 0x0700UL,
}
diff --git a/arch/frv/kernel/irq-mb93493.c b/arch/frv/kernel/irq-mb93493.c
index ba648da0932d..8ca5aa4ff595 100644
--- a/arch/frv/kernel/irq-mb93493.c
+++ b/arch/frv/kernel/irq-mb93493.c
@@ -118,13 +118,13 @@ static irqreturn_t mb93493_interrupt(int irq, void 
*_piqsr)
 static struct irqaction mb93493_irq[2]  = {
[0] = {
.handler= mb93493_interrupt,
-   .flags  = IRQF_DISABLED | IRQF_SHARED,
+   .flags  = IRQF_SHARED,
.name   = mb93493.0,
.dev_id = (void *) __addr_MB93493_IQSR(0),
},
[1] = {
.handler= mb93493_interrupt,
-   .flags  = IRQF_DISABLED | IRQF_SHARED,
+   .flags  = IRQF_SHARED,
.name   = mb93493.1,
.dev_id = (void *) __addr_MB93493_IQSR(1),
}
diff --git a/arch/frv/kernel/time.c b/arch/frv/kernel/time.c
index b457de496b70..332e00bf9d06 100644
--- a/arch/frv/kernel/time.c
+++ b/arch/frv/kernel/time.c
@@ -44,7 +44,6 @@ static irqreturn_t timer_interrupt(int irq, void *dummy);
 
 static struct irqaction timer_irq  = {
.handler = timer_interrupt,
-   .flags = IRQF_DISABLED,
.name = timer,
 };
 
-- 
1.8.3.2

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.10 33/97] net: sctp: fix sctp_connectx abi for ia32 emulation/compat mode

2014-03-04 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Daniel Borkmann dbork...@redhat.com

[ Upstream commit ffd5939381c609056b33b7585fb05a77b4c695f3 ]

SCTP's sctp_connectx() abi breaks for 64bit kernels compiled with 32bit
emulation (e.g. ia32 emulation or x86_x32). Due to internal usage of
'struct sctp_getaddrs_old' which includes a struct sockaddr pointer,
sizeof(param) check will always fail in kernel as the structure in
64bit kernel space is 4bytes larger than for user binaries compiled
in 32bit mode. Thus, applications making use of sctp_connectx() won't
be able to run under such circumstances.

Introduce a compat interface in the kernel to deal with such
situations by using a 'struct compat_sctp_getaddrs_old' structure
where user data is copied into it, and then sucessively transformed
into a 'struct sctp_getaddrs_old' structure with the help of
compat_ptr(). That fixes sctp_connectx() abi without any changes
needed in user space, and lets the SCTP test suite pass when compiled
in 32bit and run on 64bit kernels.

Fixes: f9c67811ebc0 (sctp: Fix regression introduced by new sctp_connectx api)
Signed-off-by: Daniel Borkmann dbork...@redhat.com
Acked-by: Neil Horman nhor...@tuxdriver.com
Acked-by: Vlad Yasevich vyasev...@gmail.com
Signed-off-by: David S. Miller da...@davemloft.net
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org
---
 net/sctp/socket.c |   41 -
 1 file changed, 32 insertions(+), 9 deletions(-)

--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -71,6 +71,7 @@
 #include linux/crypto.h
 #include linux/slab.h
 #include linux/file.h
+#include linux/compat.h
 
 #include net/ip.h
 #include net/icmp.h
@@ -1384,11 +1385,19 @@ SCTP_STATIC int sctp_setsockopt_connectx
 /*
  * New (hopefully final) interface for the API.
  * We use the sctp_getaddrs_old structure so that use-space library
- * can avoid any unnecessary allocations.   The only defferent part
+ * can avoid any unnecessary allocations. The only different part
  * is that we store the actual length of the address buffer into the
- * addrs_num structure member.  That way we can re-use the existing
+ * addrs_num structure member. That way we can re-use the existing
  * code.
  */
+#ifdef CONFIG_COMPAT
+struct compat_sctp_getaddrs_old {
+   sctp_assoc_tassoc_id;
+   s32 addr_num;
+   compat_uptr_t   addrs;  /* struct sockaddr * */
+};
+#endif
+
 SCTP_STATIC int sctp_getsockopt_connectx3(struct sock* sk, int len,
char __user *optval,
int __user *optlen)
@@ -1397,16 +1406,30 @@ SCTP_STATIC int sctp_getsockopt_connectx
sctp_assoc_t assoc_id = 0;
int err = 0;
 
-   if (len  sizeof(param))
-   return -EINVAL;
+#ifdef CONFIG_COMPAT
+   if (is_compat_task()) {
+   struct compat_sctp_getaddrs_old param32;
 
-   if (copy_from_user(param, optval, sizeof(param)))
-   return -EFAULT;
+   if (len  sizeof(param32))
+   return -EINVAL;
+   if (copy_from_user(param32, optval, sizeof(param32)))
+   return -EFAULT;
 
-   err = __sctp_setsockopt_connectx(sk,
-   (struct sockaddr __user *)param.addrs,
-   param.addr_num, assoc_id);
+   param.assoc_id = param32.assoc_id;
+   param.addr_num = param32.addr_num;
+   param.addrs = compat_ptr(param32.addrs);
+   } else
+#endif
+   {
+   if (len  sizeof(param))
+   return -EINVAL;
+   if (copy_from_user(param, optval, sizeof(param)))
+   return -EFAULT;
+   }
 
+   err = __sctp_setsockopt_connectx(sk, (struct sockaddr __user *)
+param.addrs, param.addr_num,
+assoc_id);
if (err == 0 || err == -EINPROGRESS) {
if (copy_to_user(optval, assoc_id, sizeof(assoc_id)))
return -EFAULT;


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.10 35/97] net: core: introduce netif_skb_dev_features

2014-03-04 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Florian Westphal f...@strlen.de

commit d206940319c41df4299db75ed56142177bb2e5f6 upstream.

Will be used by upcoming ipv4 forward path change that needs to
determine feature mask using skb-dst-dev instead of skb-dev.

Signed-off-by: Florian Westphal f...@strlen.de
Signed-off-by: David S. Miller da...@davemloft.net
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org
---
 include/linux/netdevice.h |7 ++-
 net/core/dev.c|   27 ---
 2 files changed, 22 insertions(+), 12 deletions(-)

--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -2761,7 +2761,12 @@ void netdev_change_features(struct net_d
 void netif_stacked_transfer_operstate(const struct net_device *rootdev,
struct net_device *dev);
 
-netdev_features_t netif_skb_features(struct sk_buff *skb);
+netdev_features_t netif_skb_dev_features(struct sk_buff *skb,
+const struct net_device *dev);
+static inline netdev_features_t netif_skb_features(struct sk_buff *skb)
+{
+   return netif_skb_dev_features(skb, skb-dev);
+}
 
 static inline bool net_gso_ok(netdev_features_t features, int gso_type)
 {
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2374,7 +2374,7 @@ EXPORT_SYMBOL(netdev_rx_csum_fault);
  * 2. No high memory really exists on this machine.
  */
 
-static int illegal_highdma(struct net_device *dev, struct sk_buff *skb)
+static int illegal_highdma(const struct net_device *dev, struct sk_buff *skb)
 {
 #ifdef CONFIG_HIGHMEM
int i;
@@ -2454,46 +2454,51 @@ static int dev_gso_segment(struct sk_buf
 }
 
 static netdev_features_t harmonize_features(struct sk_buff *skb,
-   __be16 protocol, netdev_features_t features)
+   __be16 protocol,
+   const struct net_device *dev,
+   netdev_features_t features)
 {
if (skb-ip_summed != CHECKSUM_NONE 
!can_checksum_protocol(features, protocol)) {
features = ~NETIF_F_ALL_CSUM;
-   } else if (illegal_highdma(skb-dev, skb)) {
+   } else if (illegal_highdma(dev, skb)) {
features = ~NETIF_F_SG;
}
 
return features;
 }
 
-netdev_features_t netif_skb_features(struct sk_buff *skb)
+netdev_features_t netif_skb_dev_features(struct sk_buff *skb,
+const struct net_device *dev)
 {
__be16 protocol = skb-protocol;
-   netdev_features_t features = skb-dev-features;
+   netdev_features_t features = dev-features;
 
-   if (skb_shinfo(skb)-gso_segs  skb-dev-gso_max_segs)
+   if (skb_shinfo(skb)-gso_segs  dev-gso_max_segs)
features = ~NETIF_F_GSO_MASK;
 
if (protocol == htons(ETH_P_8021Q) || protocol == htons(ETH_P_8021AD)) {
struct vlan_ethhdr *veh = (struct vlan_ethhdr *)skb-data;
protocol = veh-h_vlan_encapsulated_proto;
} else if (!vlan_tx_tag_present(skb)) {
-   return harmonize_features(skb, protocol, features);
+   return harmonize_features(skb, protocol, dev, features);
}
 
-   features = (skb-dev-vlan_features | NETIF_F_HW_VLAN_CTAG_TX |
+   features = (dev-vlan_features | NETIF_F_HW_VLAN_CTAG_TX |
   NETIF_F_HW_VLAN_STAG_TX);
 
if (protocol != htons(ETH_P_8021Q)  protocol != htons(ETH_P_8021AD)) {
-   return harmonize_features(skb, protocol, features);
+   return harmonize_features(skb, protocol, dev, features);
} else {
features = NETIF_F_SG | NETIF_F_HIGHDMA | NETIF_F_FRAGLIST |
NETIF_F_GEN_CSUM | NETIF_F_HW_VLAN_CTAG_TX |
NETIF_F_HW_VLAN_STAG_TX;
-   return harmonize_features(skb, protocol, features);
+   return harmonize_features(skb, protocol, dev, features);
}
+
+   return harmonize_features(skb, protocol, dev, features);
 }
-EXPORT_SYMBOL(netif_skb_features);
+EXPORT_SYMBOL(netif_skb_dev_features);
 
 /*
  * Returns true if either:


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.10 32/97] ipv4: fix counter in_slow_tot

2014-03-04 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Duan Jiong duanj.f...@cn.fujitsu.com

[ Upstream commit a6254864c08109c66a194612585afc0439005286 ]

since commit 89aef8921bf(ipv4: Delete routing cache.), the counter
in_slow_tot can't work correctly.

The counter in_slow_tot increase by one when fib_lookup() return successfully
in ip_route_input_slow(), but actually the dst struct maybe not be created and
cached, so we can increase in_slow_tot after the dst struct is created.

Signed-off-by: Duan Jiong duanj.f...@cn.fujitsu.com
Signed-off-by: David S. Miller da...@davemloft.net
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org
---
 net/ipv4/route.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -1544,6 +1544,7 @@ static int __mkroute_input(struct sk_buf
rth-rt_gateway = 0;
rth-rt_uses_gateway = 0;
INIT_LIST_HEAD(rth-rt_uncached);
+   RT_CACHE_STAT_INC(in_slow_tot);
 
rth-dst.input = ip_forward;
rth-dst.output = ip_output;
@@ -1645,8 +1646,6 @@ static int ip_route_input_slow(struct sk
if (err != 0)
goto no_route;
 
-   RT_CACHE_STAT_INC(in_slow_tot);
-
if (res.type == RTN_BROADCAST)
goto brd_input;
 
@@ -1715,6 +1714,7 @@ local_input:
rth-rt_gateway = 0;
rth-rt_uses_gateway = 0;
INIT_LIST_HEAD(rth-rt_uncached);
+   RT_CACHE_STAT_INC(in_slow_tot);
if (res.type == RTN_UNREACHABLE) {
rth-dst.input= ip_error;
rth-dst.error= -err;


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.10 34/97] net: add and use skb_gso_transport_seglen()

2014-03-04 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Florian Westphal f...@strlen.de

commit de960aa9ab4decc3304959f69533eef64d05d8e8 upstream.

[ no skb_gso_seglen helper in 3.10, leave tbf alone ]

This moves part of Eric Dumazets skb_gso_seglen helper from tbf sched to
skbuff core so it may be reused by upcoming ip forwarding path patch.

Signed-off-by: Florian Westphal f...@strlen.de
Acked-by: Eric Dumazet eduma...@google.com
Signed-off-by: David S. Miller da...@davemloft.net
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org
---
 include/linux/skbuff.h |2 ++
 net/core/skbuff.c  |   25 +
 2 files changed, 27 insertions(+)

--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -2488,6 +2488,8 @@ extern int   skb_shift(struct sk_bu
 extern struct sk_buff *skb_segment(struct sk_buff *skb,
   netdev_features_t features);
 
+unsigned int skb_gso_transport_seglen(const struct sk_buff *skb);
+
 static inline void *skb_header_pointer(const struct sk_buff *skb, int offset,
   int len, void *buffer)
 {
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -47,6 +47,8 @@
 #include linux/in.h
 #include linux/inet.h
 #include linux/slab.h
+#include linux/tcp.h
+#include linux/udp.h
 #include linux/netdevice.h
 #ifdef CONFIG_NET_CLS_ACT
 #include net/pkt_sched.h
@@ -3471,3 +3473,26 @@ bool skb_try_coalesce(struct sk_buff *to
return true;
 }
 EXPORT_SYMBOL(skb_try_coalesce);
+
+/**
+ * skb_gso_transport_seglen - Return length of individual segments of a gso 
packet
+ *
+ * @skb: GSO skb
+ *
+ * skb_gso_transport_seglen is used to determine the real size of the
+ * individual segments, including Layer4 headers (TCP/UDP).
+ *
+ * The MAC/L2 or network (IP, IPv6) headers are not accounted for.
+ */
+unsigned int skb_gso_transport_seglen(const struct sk_buff *skb)
+{
+   const struct skb_shared_info *shinfo = skb_shinfo(skb);
+   unsigned int hdr_len;
+
+   if (likely(shinfo-gso_type  (SKB_GSO_TCPV4 | SKB_GSO_TCPV6)))
+   hdr_len = tcp_hdrlen(skb);
+   else
+   hdr_len = sizeof(struct udphdr);
+   return hdr_len + shinfo-gso_size;
+}
+EXPORT_SYMBOL_GPL(skb_gso_transport_seglen);


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.10 37/97] net: use __GFP_NORETRY for high order allocations

2014-03-04 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Eric Dumazet eduma...@google.com

[ Upstream commit ed98df3361f059db42786c830ea96e2d18b8d4db ]

sock_alloc_send_pskb()  sk_page_frag_refill()
have a loop trying high order allocations to prepare
skb with low number of fragments as this increases performance.

Problem is that under memory pressure/fragmentation, this can
trigger OOM while the intent was only to try the high order
allocations, then fallback to order-0 allocations.

We had various reports from unexpected regressions.

According to David, setting __GFP_NORETRY should be fine,
as the asynchronous compaction is still enabled, and this
will prevent OOM from kicking as in :

CFSClientEventm invoked oom-killer: gfp_mask=0x42d0, order=3, oom_adj=0,
oom_score_adj=0, oom_score_badness=2 (enabled),memcg_scoring=disabled
CFSClientEventm

Call Trace:
 [8043766c] dump_header+0xe1/0x23e
 [80437a02] oom_kill_process+0x6a/0x323
 [80438443] out_of_memory+0x4b3/0x50d
 [8043a4a6] __alloc_pages_may_oom+0xa2/0xc7
 [80236f42] __alloc_pages_nodemask+0x1002/0x17f0
 [8024bd23] alloc_pages_current+0x103/0x2b0
 [8028567f] sk_page_frag_refill+0x8f/0x160
 [80295fa0] tcp_sendmsg+0x560/0xee0
 [802a5037] inet_sendmsg+0x67/0x100
 [80283c9c] __sock_sendmsg_nosec+0x6c/0x90
 [80283e85] sock_sendmsg+0xc5/0xf0
 [802847b6] __sys_sendmsg+0x136/0x430
 [80284ec8] sys_sendmsg+0x88/0x110
 [80711472] system_call_fastpath+0x16/0x1b
Out of Memory: Kill process 2856 (bash) score  or sacrifice child

Signed-off-by: Eric Dumazet eduma...@google.com
Acked-by: David Rientjes rient...@google.com
Acked-by: Eric W. Biederman ebied...@xmission.com
Signed-off-by: David S. Miller da...@davemloft.net
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org
---
 net/core/sock.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -1814,7 +1814,7 @@ bool sk_page_frag_refill(struct sock *sk
gfp_t gfp = sk-sk_allocation;
 
if (order)
-   gfp |= __GFP_COMP | __GFP_NOWARN;
+   gfp |= __GFP_COMP | __GFP_NOWARN | __GFP_NORETRY;
pfrag-page = alloc_pages(gfp, order);
if (likely(pfrag-page)) {
pfrag-offset = 0;


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.10 31/97] bonding: 802.3ad: make aggregator_identifier bond-private

2014-03-04 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Jiri Bohac j...@boha.cz

[ Upstream commit 163c8ff30dbe473abfbb24a7eac5536c87f3baa9 ]

aggregator_identifier is used to assign unique aggregator identifiers
to aggregators of a bond during device enslaving.

aggregator_identifier is currently a global variable that is zeroed in
bond_3ad_initialize().

This sequence will lead to duplicate aggregator identifiers for eth1 and eth3:

create bond0
change bond0 mode to 802.3ad
enslave eth0 to bond0   //eth0 gets agg id 1
enslave eth1 to bond0   //eth1 gets agg id 2
create bond1
change bond1 mode to 802.3ad
enslave eth2 to bond1   //aggregator_identifier is reset to 0
//eth2 gets agg id 1
enslave eth3 to bond0   //eth3 gets agg id 2

Fix this by making aggregator_identifier private to the bond.

Signed-off-by: Jiri Bohac jbo...@suse.cz
Acked-by: Veaceslav Falico vfal...@redhat.com
Signed-off-by: David S. Miller da...@davemloft.net
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org
---
 drivers/net/bonding/bond_3ad.c |6 ++
 drivers/net/bonding/bond_3ad.h |1 +
 2 files changed, 3 insertions(+), 4 deletions(-)

--- a/drivers/net/bonding/bond_3ad.c
+++ b/drivers/net/bonding/bond_3ad.c
@@ -1854,8 +1854,6 @@ void bond_3ad_initiate_agg_selection(str
BOND_AD_INFO(bond).agg_select_timer = timeout;
 }
 
-static u16 aggregator_identifier;
-
 /**
  * bond_3ad_initialize - initialize a bond's 802.3ad parameters and structures
  * @bond: bonding struct to work on
@@ -1869,7 +1867,7 @@ void bond_3ad_initialize(struct bonding
if (MAC_ADDRESS_COMPARE((BOND_AD_INFO(bond).system.sys_mac_addr),
bond-dev-dev_addr)) {
 
-   aggregator_identifier = 0;
+   BOND_AD_INFO(bond).aggregator_identifier = 0;
 
BOND_AD_INFO(bond).system.sys_priority = 0x;
BOND_AD_INFO(bond).system.sys_mac_addr = *((struct mac_addr 
*)bond-dev-dev_addr);
@@ -1940,7 +1938,7 @@ int bond_3ad_bind_slave(struct slave *sl
ad_initialize_agg(aggregator);
 
aggregator-aggregator_mac_address = *((struct mac_addr 
*)bond-dev-dev_addr);
-   aggregator-aggregator_identifier = (++aggregator_identifier);
+   aggregator-aggregator_identifier = 
++BOND_AD_INFO(bond).aggregator_identifier;
aggregator-slave = slave;
aggregator-is_active = 0;
aggregator-num_of_ports = 0;
--- a/drivers/net/bonding/bond_3ad.h
+++ b/drivers/net/bonding/bond_3ad.h
@@ -253,6 +253,7 @@ struct ad_system {
 struct ad_bond_info {
struct ad_system system;/* 802.3ad system structure */
u32 agg_select_timer;   // Timer to select aggregator after all 
adapter's hand shakes
+   u16 aggregator_identifier;
 };
 
 struct ad_slave_info {


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.10 30/97] usbnet: remove generic hard_header_len check

2014-03-04 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Emil Goode emilgo...@gmail.com

[ Upstream commit eb85569fe2d06c2fbf4de7b66c263ca095b397aa ]

This patch removes a generic hard_header_len check from the usbnet
module that is causing dropped packages under certain circumstances
for devices that send rx packets that cross urb boundaries.

One example is the AX88772B which occasionally send rx packets that
cross urb boundaries where the remaining partial packet is sent with
no hardware header. When the buffer with a partial packet is of less
number of octets than the value of hard_header_len the buffer is
discarded by the usbnet module.

With AX88772B this can be reproduced by using ping with a packet
size between 1965-1976.

The bug has been reported here:

https://bugzilla.kernel.org/show_bug.cgi?id=29082

This patch introduces the following changes:
- Removes the generic hard_header_len check in the rx_complete
  function in the usbnet module.
- Introduces a ETH_HLEN check for skbs that are not cloned from
  within a rx_fixup callback.
- For safety a hard_header_len check is added to each rx_fixup
  callback function that could be affected by this change.
  These extra checks could possibly be removed by someone
  who has the hardware to test.
- Removes a call to dev_kfree_skb_any() and instead utilizes the
  dev-done list to queue skbs for cleanup.

The changes place full responsibility on the rx_fixup callback
functions that clone skbs to only pass valid skbs to the
usbnet_skb_return function.

Signed-off-by: Emil Goode emilgo...@gmail.com
Reported-by: Igor Gnatenko i.gnatenko.br...@gmail.com
Signed-off-by: David S. Miller da...@davemloft.net
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org
---
 drivers/net/usb/ax88179_178a.c |4 
 drivers/net/usb/gl620a.c   |4 
 drivers/net/usb/mcs7830.c  |5 +++--
 drivers/net/usb/net1080.c  |4 
 drivers/net/usb/qmi_wwan.c |8 
 drivers/net/usb/rndis_host.c   |4 
 drivers/net/usb/smsc75xx.c |4 
 drivers/net/usb/smsc95xx.c |4 
 drivers/net/usb/usbnet.c   |   25 ++---
 9 files changed, 41 insertions(+), 21 deletions(-)

--- a/drivers/net/usb/ax88179_178a.c
+++ b/drivers/net/usb/ax88179_178a.c
@@ -1109,6 +1109,10 @@ static int ax88179_rx_fixup(struct usbne
u16 hdr_off;
u32 *pkt_hdr;
 
+   /* This check is no longer done by usbnet */
+   if (skb-len  dev-net-hard_header_len)
+   return 0;
+
skb_trim(skb, skb-len - 4);
memcpy(rx_hdr, skb_tail_pointer(skb), 4);
le32_to_cpus(rx_hdr);
--- a/drivers/net/usb/gl620a.c
+++ b/drivers/net/usb/gl620a.c
@@ -86,6 +86,10 @@ static int genelink_rx_fixup(struct usbn
u32 size;
u32 count;
 
+   /* This check is no longer done by usbnet */
+   if (skb-len  dev-net-hard_header_len)
+   return 0;
+
header = (struct gl_header *) skb-data;
 
// get the packet count of the received skb
--- a/drivers/net/usb/mcs7830.c
+++ b/drivers/net/usb/mcs7830.c
@@ -529,8 +529,9 @@ static int mcs7830_rx_fixup(struct usbne
 {
u8 status;
 
-   if (skb-len == 0) {
-   dev_err(dev-udev-dev, unexpected empty rx frame\n);
+   /* This check is no longer done by usbnet */
+   if (skb-len  dev-net-hard_header_len) {
+   dev_err(dev-udev-dev, unexpected tiny rx frame\n);
return 0;
}
 
--- a/drivers/net/usb/net1080.c
+++ b/drivers/net/usb/net1080.c
@@ -366,6 +366,10 @@ static int net1080_rx_fixup(struct usbne
struct nc_trailer   *trailer;
u16 hdr_len, packet_len;
 
+   /* This check is no longer done by usbnet */
+   if (skb-len  dev-net-hard_header_len)
+   return 0;
+
if (!(skb-len  0x01)) {
netdev_dbg(dev-net, rx framesize %d range %d..%d mtu %d\n,
   skb-len, dev-net-hard_header_len, dev-hard_mtu,
--- a/drivers/net/usb/qmi_wwan.c
+++ b/drivers/net/usb/qmi_wwan.c
@@ -80,10 +80,10 @@ static int qmi_wwan_rx_fixup(struct usbn
 {
__be16 proto;
 
-   /* usbnet rx_complete guarantees that skb-len is at least
-* hard_header_len, so we can inspect the dest address without
-* checking skb-len
-*/
+   /* This check is no longer done by usbnet */
+   if (skb-len  dev-net-hard_header_len)
+   return 0;
+
switch (skb-data[0]  0xf0) {
case 0x40:
proto = htons(ETH_P_IP);
--- a/drivers/net/usb/rndis_host.c
+++ b/drivers/net/usb/rndis_host.c
@@ -494,6 +494,10 @@ EXPORT_SYMBOL_GPL(rndis_unbind);
  */
 int rndis_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
 {
+   /* This check is no longer done by usbnet */
+   if (skb-len  dev-net-hard_header_len)
+   return 0;
+
/* 

[PATCH 3.10 42/97] ALSA: hda/ca0132 - Fix recording from mode id 0x8

2014-03-04 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Hsin-Yu Chao hyc...@chromium.org

commit 13c12dbe3a2ce17227f7ddef652b6a53c78fa51f upstream.

Incorrect ADC is picked in ca0132_capture_pcm_prepare(),
where it assumes multiple streams while there is one stream
per ADC. Note that ca0132_capture_pcm_cleanup() already does
the right thing.

The Chromebook Pixel has a microphone under the keyboard that
is attached to node id 0x8. Before this fix, recording would
always go to the main internal mic (node id 0x7).

Signed-off-by: Hsin-Yu Chao hyc...@chromium.org
Reviewed-by: Dylan Reid dgr...@chromium.org
Signed-off-by: Takashi Iwai ti...@suse.de
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org

---
 sound/pci/hda/patch_ca0132.c |4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

--- a/sound/pci/hda/patch_ca0132.c
+++ b/sound/pci/hda/patch_ca0132.c
@@ -2768,9 +2768,7 @@ static int ca0132_capture_pcm_prepare(st
unsigned int format,
struct snd_pcm_substream *substream)
 {
-   struct ca0132_spec *spec = codec-spec;
-
-   snd_hda_codec_setup_stream(codec, spec-adcs[substream-number],
+   snd_hda_codec_setup_stream(codec, hinfo-nid,
   stream_tag, 0, format);
 
return 0;


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.10 28/97] tg3: Fix deadlock in tg3_change_mtu()

2014-03-04 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Nithin Sujir nsu...@broadcom.com

[ Upstream commit c6993dfd7db9b0c6b7ca7503a56fda9236a4710f ]

Quoting David Vrabel -
5780 cards cannot have jumbo frames and TSO enabled together.  When
jumbo frames are enabled by setting the MTU, the TSO feature must be
cleared.  This is done indirectly by calling netdev_update_features()
which will call tg3_fix_features() to actually clear the flags.

netdev_update_features() will also trigger a new netlink message for the
feature change event which will result in a call to tg3_get_stats64()
which deadlocks on the tg3 lock.

tg3_set_mtu() does not need to be under the tg3 lock since converting
the flags to use set_bit(). Move it out to after tg3_netif_stop().

Reported-by: David Vrabel david.vra...@citrix.com
Tested-by: David Vrabel david.vra...@citrix.com
Signed-off-by: Michael Chan mc...@broadcom.com
Signed-off-by: Nithin Nayak Sujir nsu...@broadcom.com
Signed-off-by: David S. Miller da...@davemloft.net
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org
---
 drivers/net/ethernet/broadcom/tg3.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -13777,12 +13777,12 @@ static int tg3_change_mtu(struct net_dev
 
tg3_netif_stop(tp);
 
+   tg3_set_mtu(dev, tp, new_mtu);
+
tg3_full_lock(tp, 1);
 
tg3_halt(tp, RESET_KIND_SHUTDOWN, 1);
 
-   tg3_set_mtu(dev, tp, new_mtu);
-
/* Reset PHY, otherwise the read DMA engine will be in a mode that
 * breaks all requests to 256 bytes.
 */


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


<    1   2   3   4   5   6   7   8   9   10   >