[patch v5 2/3] drivers: jtag: Add Aspeed SoC 24xx and 25xx families JTAG master driver

2017-08-21 Thread Oleksandr Shamray
Driver adds support of Aspeed 2500/2400 series SOC JTAG master controller.

Driver implements the following jtag ops:
- freq_get;
- freq_set;
- status_get;
- idle;
- xfer;

It has been tested on Mellanox system with BMC equipped with
Aspeed 2520 SoC for programming CPLD devices.

Signed-off-by: Oleksandr Shamray 
Signed-off-by: Jiri Pirko 
---
v4->v5
Comments pointed by Arnd Bergmann 
- Added HAS_IOMEM dependence in Kconfig to avoid
  "undefined reference to `devm_ioremap_resource'" error,
  because in some arch this not supported

v3->v4
Comments pointed by Arnd Bergmann 
- change transaction pointer tdio type  to __u64
- change internal status type from enum to __u32

v2->v3

v1->v2
Comments pointed by Greg KH 
- change license type from GPLv2/BSD to GPLv2

Comments pointed by Neil Armstrong 
- Add clk_prepare_enable/clk_disable_unprepare in clock init/deinit
- Change .compatible to soc-specific compatible names
  aspeed,aspeed4000-jtag/aspeed5000-jtag
- Added dt-bindings

Comments pointed by Arnd Bergmann 
- Reorder functions and removed the forward declarations
- Add static const qualifier to state machine states transitions
- Change .compatible to soc-specific compatible names
  aspeed,aspeed4000-jtag/aspeed5000-jtag
- Add dt-bindings

Comments pointed by Randy Dunlap 
- Change module name jtag-aspeed in description in Kconfig

Comments pointed by kbuild test robot 
- Remove invalid include 
- add resource_size instead of calculation
---
 drivers/jtag/Kconfig   |   13 +
 drivers/jtag/Makefile  |1 +
 drivers/jtag/jtag-aspeed.c |  772 
 3 files changed, 786 insertions(+), 0 deletions(-)
 create mode 100644 drivers/jtag/jtag-aspeed.c

diff --git a/drivers/jtag/Kconfig b/drivers/jtag/Kconfig
index 0fad1a3..098beb0 100644
--- a/drivers/jtag/Kconfig
+++ b/drivers/jtag/Kconfig
@@ -14,3 +14,16 @@ menuconfig JTAG
 
  To compile this driver as a module, choose M here: the module will
  be called jtag.
+
+menuconfig JTAG_ASPEED
+   tristate "Aspeed SoC JTAG controller support"
+   depends on JTAG && HAS_IOMEM
+   ---help---
+ This provides a support for Aspeed JTAG device, equipped on
+ Aspeed SoC 24xx and 25xx families. Drivers allows programming
+ of hardware devices, connected to SoC through the JTAG interface.
+
+ If you want this support, you should say Y here.
+
+ To compile this driver as a module, choose M here: the module will
+ be called jtag-aspeed.
diff --git a/drivers/jtag/Makefile b/drivers/jtag/Makefile
index af37493..04a855e 100644
--- a/drivers/jtag/Makefile
+++ b/drivers/jtag/Makefile
@@ -1 +1,2 @@
 obj-$(CONFIG_JTAG) += jtag.o
+obj-$(CONFIG_JTAG_ASPEED)  += jtag-aspeed.o
diff --git a/drivers/jtag/jtag-aspeed.c b/drivers/jtag/jtag-aspeed.c
new file mode 100644
index 000..252bd91
--- /dev/null
+++ b/drivers/jtag/jtag-aspeed.c
@@ -0,0 +1,772 @@
+/*
+ * drivers/jtag/jtag.c
+ *
+ * Copyright (c) 2017 Mellanox Technologies. All rights reserved.
+ * Copyright (c) 2017 Oleksandr Shamray 
+ *
+ * Released under the GPLv2 only.
+ * SPDX-License-Identifier: GPL-2.0
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define ASPEED_JTAG_DATA   0x00
+#define ASPEED_JTAG_INST   0x04
+#define ASPEED_JTAG_CTRL   0x08
+#define ASPEED_JTAG_ISR0x0C
+#define ASPEED_JTAG_SW 0x10
+#define ASPEED_JTAG_TCK0x14
+#define ASPEED_JTAG_EC 0x18
+
+#define ASPEED_JTAG_DATA_MSB   0x01
+#define ASPEED_JTAG_DATA_CHUNK_SIZE0x20
+
+/* ASPEED_JTAG_CTRL: Engine Control */
+#define ASPEED_JTAG_CTL_ENG_EN BIT(31)
+#define ASPEED_JTAG_CTL_ENG_OUT_EN BIT(30)
+#define ASPEED_JTAG_CTL_FORCE_TMS  BIT(29)
+#define ASPEED_JTAG_CTL_INST_LEN(x)((x) << 20)
+#define ASPEED_JTAG_CTL_LASPEED_INST   BIT(17)
+#define ASPEED_JTAG_CTL_INST_ENBIT(16)
+#define ASPEED_JTAG_CTL_DR_UPDATE  BIT(10)
+#define ASPEED_JTAG_CTL_DATA_LEN(x)((x) << 4)
+#define ASPEED_JTAG_CTL_LASPEED_DATA   BIT(1)
+#define ASPEED_JTAG_CTL_DATA_ENBIT(0)
+
+/* ASPEED_JTAG_ISR : Interrupt status and enable */
+#define ASPEED_JTAG_ISR_INST_PAUSE BIT(19)
+#define ASPEED_JTAG_ISR_INST_COMPLETE  BIT(18)
+#define ASPEED_JTAG_ISR_DATA_PAUSE BIT(17)
+#define ASPEED_JTAG_ISR_DATA_COMPLETE  BIT(16)
+#define ASPEED_JTAG_ISR_INST_PAUSE_EN  BIT(3)
+#define ASPEED_JTAG_ISR_INST_COMPLETE_EN BIT(2)
+#define ASPEED_JTAG_ISR_DATA_PAUSE_EN  BIT(1)
+#define ASPEED_JTAG_ISR_DATA_COMPLETE_EN BIT(0)
+#define ASPEED_JTAG_ISR_INT_EN_MASKGENMASK(3, 0)
+#define ASPEED_JTAG_ISR_INT_MASK   

[patch v5 0/3] JTAG driver introduction

2017-08-21 Thread Oleksandr Shamray
When a need raise up to use JTAG interface for system's devices
programming or CPU debugging, usually the user layer
application implements jtag protocol by bit-bang or using a 
proprietary connection to vendor hardware.
This method can be slow and not generic.
 
We propose to implement general JTAG interface and infrastructure
to communicate with user layer application. In such way, we can
have the standard JTAG interface core part and separation from
specific HW implementation.
This allow new capability to debug the CPU or program system's 
device via BMC without additional devices nor cost. 

This patch purpose is to add JTAG master core infrastructure by 
defining new JTAG class and provide generic JTAG interface
to allow hardware specific drivers to connect this interface.
This will enable all JTAG drivers to use the common interface
part and will have separate for hardware implementation.

The JTAG (Joint Test Action Group) core driver provides minimal generic
JTAG interface, which can be used by hardware specific JTAG master
controllers. By providing common interface for the JTAG controllers,
user space device programing is hardware independent.
 
Modern SoC which in use for embedded system' equipped with
internal JTAG master interface.
This interface is used for programming and debugging system's
hardware components, like CPLD, FPGA, CPU, voltage and
industrial controllers.
Firmware for such devices can be upgraded through JTAG interface during
Runtime. The JTAG standard support for multiple devices programming,
is in case their lines are daisy-chained together.

For example, systems which equipped with host CPU, BMC SoC or/and 
number of programmable devices are capable to connect a pin and
select system components dynamically for programming and debugging,
This is using by the BMC which is equipped with internal SoC master
controller.
For example:

BMC JTAG master --> pin selected to CPLDs chain for programming (filed
upgrade, production) 
BMC JTAG master --> pin selected to voltage monitors for programming 
(field upgrade, production) 
BMC JTAG master --> pin selected to host CPU (on-site debugging 
and developers debugging)

For example, we can have application in user space which using calls
to JTAG driver executes CPLD programming directly from SVF file
 
The JTAG standard (IEEE 1149.1) defines the next connector pins:
- TDI (Test Data In);
- TDO (Test Data Out);
- TCK (Test Clock);
- TMS (Test Mode Select);
- TRST (Test Reset) (Optional);

The SoC equipped with JTAG master controller, performs
device programming on command or vector level. For example
a file in a standard SVF (Serial Vector Format) that contains
boundary scan vectors, can be used by sending each vector
to the JTAG interface and the JTAG controller will execute
the programming.

Initial version provides the system calls set for:
- SIR (Scan Instruction Register, IEEE 1149.1 Data Register scan);
- SDR (Scan Data Register, IEEE 1149.1 Instruction Register scan);
- RUNTEST (Forces the IEEE 1149.1 bus to a run state for a specified
  number of clocks.

SoC which are not equipped with JTAG master interface, can be built
on top of JTAG core driver infrastructure, by applying bit-banging of
TDI, TDO, TCK and TMS pins within the hardware specific driver.

Oleksandr Shamray (3):
  drivers: jtag: Add JTAG core driver
  drivers: jtag: Add Aspeed SoC 24xx and 25xx families JTAG master
driver
  doccumentation: jtag: Add bindings for Aspeed SoC 24xx and 25xx
families JTAG master driver

 .../devicetree/bindings/jtag/aspeed-jtag.txt   |   18 +
 Documentation/ioctl/ioctl-number.txt   |2 +
 MAINTAINERS|8 +
 drivers/Kconfig|2 +
 drivers/Makefile   |1 +
 drivers/jtag/Kconfig   |   29 +
 drivers/jtag/Makefile  |2 +
 drivers/jtag/jtag-aspeed.c |  772 
 drivers/jtag/jtag.c|  311 
 include/linux/jtag.h   |   48 ++
 include/uapi/linux/jtag.h  |  113 +++
 11 files changed, 1306 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/jtag/aspeed-jtag.txt
 create mode 100644 drivers/jtag/Kconfig
 create mode 100644 drivers/jtag/Makefile
 create mode 100644 drivers/jtag/jtag-aspeed.c
 create mode 100644 drivers/jtag/jtag.c
 create mode 100644 include/linux/jtag.h
 create mode 100644 include/uapi/linux/jtag.h



[patch v5 3/3] doccumentation: jtag: Add bindings for Aspeed SoC 24xx and 25xx families JTAG master driver

2017-08-21 Thread Oleksandr Shamray
It has been tested on Mellanox system with BMC equipped with
Aspeed 2520 SoC for programming CPLD devices.

Signed-off-by: Oleksandr Shamray 
Signed-off-by: Jiri Pirko 
Acked-by: Rob Herring 
---
v4->v5

V3->v4
Comments pointed by Rob Herring 
- delete unnecessary "status" and "reg-shift" descriptions in
  bndings file

v2->v3
Comments pointed by Rob Herring 
- split Aspeed jtag driver and binding to sepatrate patches
- delete unnecessary "status" and "reg-shift" descriptions in
  bndings file
---
 .../devicetree/bindings/jtag/aspeed-jtag.txt   |   18 ++
 1 files changed, 18 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/jtag/aspeed-jtag.txt

diff --git a/Documentation/devicetree/bindings/jtag/aspeed-jtag.txt 
b/Documentation/devicetree/bindings/jtag/aspeed-jtag.txt
new file mode 100644
index 000..f4ded49
--- /dev/null
+++ b/Documentation/devicetree/bindings/jtag/aspeed-jtag.txt
@@ -0,0 +1,18 @@
+Aspeed JTAG driver for ast2400 and ast2500 SoC
+
+Required properties:
+- compatible:  Should be one of
+  - "aspeed,aspeed2400-jtag"
+  - "aspeed,aspeed2500-jtag"
+- reg  contains the offset and length of the JTAG memory
+   region
+- clocks   root clock of bus, should reference the APB clock
+- interrupts   should contain JTAG controller interrupt
+
+Example:
+jtag: jtag@1e6e4000 {
+   compatible = "aspeed,aspeed2500-jtag";
+   reg = <0x1e6e4000 0x1c>;
+   clocks = <_apb>;
+   interrupts = <43>;
+};
-- 
1.7.1



Re: [PATCH v2 1/2] arm64: dts: rockchip: add usb3 controller node for RK3328 SoCs

2017-08-21 Thread wlf

Dear Heiko,

在 2017年08月18日 17:24, Heiko Stuebner 写道:

Hi William,

Am Donnerstag, 17. August 2017, 15:54:49 CEST schrieb William Wu:

RK3328 has one USB 3.0 OTG controller which uses DWC_USB3
core's general architecture. It can act as static xHCI host
controller, static device controller, USB 3.0/2.0 OTG basing
on ID of USB3.0 PHY.

Signed-off-by: William Wu 
---
Changes in v2:
- Modify the dwc3 quirk "snps,tx-ipgap-linecheck-dis-quirk" to
   "snps,dis-tx-ipgap-linecheck-quirk"

  .../devicetree/bindings/usb/rockchip,dwc3.txt  |  4 +++-
  arch/arm64/boot/dts/rockchip/rk3328.dtsi   | 27 ++
  2 files changed, 30 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/usb/rockchip,dwc3.txt 
b/Documentation/devicetree/bindings/usb/rockchip,dwc3.txt
index 0536a93..d6b2e47 100644
--- a/Documentation/devicetree/bindings/usb/rockchip,dwc3.txt
+++ b/Documentation/devicetree/bindings/usb/rockchip,dwc3.txt
@@ -1,7 +1,9 @@
  Rockchip SuperSpeed DWC3 USB SoC controller
  
  Required properties:

-- compatible:  should contain "rockchip,rk3399-dwc3" for rk3399 SoC
+- compatible:  should be one of the following:
+  - "rockchip,rk3399-dwc3": for rk3399 SoC
+  - "rockchip,rk3328-dwc3", "rockchip,rk3399-dwc3": for rk3328 SoC
  - clocks: A list of phandle + clock-specifier pairs for the
clocks listed in clock-names
  - clock-names:Should contain the following:

This probably shouldn't be part of the patch adding the dts node, but
instead should be a separate patch and should either go through some
usb tree or at least get an Ack from usb maintainers (Felipe Balbi and/or
Greg Kroah Hartman), so you should definitly include them into your
recipient list.
Thanks for your  suggestion. I will submit two patches separately, and 
add usb maintainers in

the recipient list.



Heiko






--
吴良峰 William.Wu
福建省福州市铜盘路软件大道89号软件园A区21号楼
No.21 Building, A District, No.89,software Boulevard Fuzhou,Fujian, PRC
手机: 13685012275
座机: 0591-83991906-8520
邮件:w...@rock-chips.com




[PATCH 1/7 v3] media: vb2: add bidirectional flag in vb2_queue

2017-08-21 Thread Stanimir Varbanov
This change is intended to give to the v4l2 drivers a choice to
change the default behavior of the v4l2-core DMA mapping direction
from DMA_TO/FROM_DEVICE (depending on the buffer type CAPTURE or
OUTPUT) to DMA_BIDIRECTIONAL during queue_init time.

Initially the issue with DMA mapping direction has been found in
Venus encoder driver where the hardware (firmware side) adds few
lines padding on bottom of the image buffer, and the consequence
is triggering of IOMMU protection faults.

This will help supporting venus encoder (and probably other drivers
in the future) which wants to map output type of buffers as
read/write.

Signed-off-by: Stanimir Varbanov 
---
v3: update V4L2 dma-sg/contig and vmalloc memory type ops with a
check for DMA_BIDIRECTIONAL.
v2: move dma_dir into private section.

 drivers/media/v4l2-core/videobuf2-core.c   | 17 -
 drivers/media/v4l2-core/videobuf2-dma-contig.c |  3 ++-
 drivers/media/v4l2-core/videobuf2-dma-sg.c |  6 --
 drivers/media/v4l2-core/videobuf2-vmalloc.c|  6 --
 include/media/videobuf2-core.h | 13 +
 5 files changed, 31 insertions(+), 14 deletions(-)

diff --git a/drivers/media/v4l2-core/videobuf2-core.c 
b/drivers/media/v4l2-core/videobuf2-core.c
index 0924594989b4..cb115ba6a1d2 100644
--- a/drivers/media/v4l2-core/videobuf2-core.c
+++ b/drivers/media/v4l2-core/videobuf2-core.c
@@ -194,8 +194,6 @@ static void __enqueue_in_driver(struct vb2_buffer *vb);
 static int __vb2_buf_mem_alloc(struct vb2_buffer *vb)
 {
struct vb2_queue *q = vb->vb2_queue;
-   enum dma_data_direction dma_dir =
-   q->is_output ? DMA_TO_DEVICE : DMA_FROM_DEVICE;
void *mem_priv;
int plane;
int ret = -ENOMEM;
@@ -209,7 +207,7 @@ static int __vb2_buf_mem_alloc(struct vb2_buffer *vb)
 
mem_priv = call_ptr_memop(vb, alloc,
q->alloc_devs[plane] ? : q->dev,
-   q->dma_attrs, size, dma_dir, q->gfp_flags);
+   q->dma_attrs, size, q->dma_dir, q->gfp_flags);
if (IS_ERR_OR_NULL(mem_priv)) {
if (mem_priv)
ret = PTR_ERR(mem_priv);
@@ -978,8 +976,6 @@ static int __prepare_userptr(struct vb2_buffer *vb, const 
void *pb)
void *mem_priv;
unsigned int plane;
int ret = 0;
-   enum dma_data_direction dma_dir =
-   q->is_output ? DMA_TO_DEVICE : DMA_FROM_DEVICE;
bool reacquired = vb->planes[0].mem_priv == NULL;
 
memset(planes, 0, sizeof(planes[0]) * vb->num_planes);
@@ -1030,7 +1026,7 @@ static int __prepare_userptr(struct vb2_buffer *vb, const 
void *pb)
mem_priv = call_ptr_memop(vb, get_userptr,
q->alloc_devs[plane] ? : q->dev,
planes[plane].m.userptr,
-   planes[plane].length, dma_dir);
+   planes[plane].length, q->dma_dir);
if (IS_ERR(mem_priv)) {
dprintk(1, "failed acquiring userspace memory for plane 
%d\n",
plane);
@@ -1096,8 +1092,6 @@ static int __prepare_dmabuf(struct vb2_buffer *vb, const 
void *pb)
void *mem_priv;
unsigned int plane;
int ret = 0;
-   enum dma_data_direction dma_dir =
-   q->is_output ? DMA_TO_DEVICE : DMA_FROM_DEVICE;
bool reacquired = vb->planes[0].mem_priv == NULL;
 
memset(planes, 0, sizeof(planes[0]) * vb->num_planes);
@@ -1156,7 +1150,7 @@ static int __prepare_dmabuf(struct vb2_buffer *vb, const 
void *pb)
/* Acquire each plane's memory */
mem_priv = call_ptr_memop(vb, attach_dmabuf,
q->alloc_devs[plane] ? : q->dev,
-   dbuf, planes[plane].length, dma_dir);
+   dbuf, planes[plane].length, q->dma_dir);
if (IS_ERR(mem_priv)) {
dprintk(1, "failed to attach dmabuf\n");
ret = PTR_ERR(mem_priv);
@@ -2003,6 +1997,11 @@ int vb2_core_queue_init(struct vb2_queue *q)
if (q->buf_struct_size == 0)
q->buf_struct_size = sizeof(struct vb2_buffer);
 
+   if (q->bidirectional)
+   q->dma_dir = DMA_BIDIRECTIONAL;
+   else
+   q->dma_dir = q->is_output ? DMA_TO_DEVICE : DMA_FROM_DEVICE;
+
return 0;
 }
 EXPORT_SYMBOL_GPL(vb2_core_queue_init);
diff --git a/drivers/media/v4l2-core/videobuf2-dma-contig.c 
b/drivers/media/v4l2-core/videobuf2-dma-contig.c
index 5b90a66b9e78..9f389f36566d 100644
--- a/drivers/media/v4l2-core/videobuf2-dma-contig.c
+++ b/drivers/media/v4l2-core/videobuf2-dma-contig.c
@@ -508,7 +508,8 @@ static void *vb2_dc_get_userptr(struct device *dev, 
unsigned long vaddr,
buf->dma_dir = dma_dir;
 

Build regressions/improvements in v4.13-rc6

2017-08-21 Thread Geert Uytterhoeven
Below is the list of build error/warning regressions/improvements in
v4.13-rc6[1] compared to v4.12[2].

Summarized:
  - build errors: +2/-0
  - build warnings: +1330/-906

JFYI, when comparing v4.13-rc6[1] to v4.13-rc5[3], the summaries are:
  - build errors: +2/-0
  - build warnings: +623/-512

Happy fixing! ;-)

Thanks to the linux-next team for providing the build service.

[1] 
http://kisskb.ellerman.id.au/kisskb/head/14ccee78fc82f5512908f4424f541549a5705b89/
 (all 267 configs)
[2] 
http://kisskb.ellerman.id.au/kisskb/head/6f7da290413ba713f0cdd9ff1a2a9bb129ef4f6c/
 (all 267 configs)
[3] 
http://kisskb.ellerman.id.au/kisskb/head/ef954844c7ace62f773f4f23e28d2d915adc419f/
 (all 267 configs)


*** ERRORS ***

2 error regressions:
  + /home/kisskb/slave/src/arch/sh/mm/cache-sh4.c: error: 'cached_to_uncached' 
undeclared (first use in this function):  => 99:17
  + /home/kisskb/slave/src/arch/sh/mm/cache-sh4.c: error: implicit declaration 
of function 'cpu_context' [-Werror=implicit-function-declaration]:  => 192:2


*** WARNINGS ***

[Deleted 661 lines about "warning: ... [-Wpointer-sign]" on parisc-allmodconfig]
[Deleted 1186 lines about "warning: -ffunction-sections disabled; it makes 
profiling impossible [enabled by default]" on parisc-allmodconfig]

1330 warning regressions:
  + /home/kisskb/slave/src/arch/powerpc/boot/mpc8xx.c: warning: variable 'div' 
set but not used [-Wunused-but-set-variable]  BOOTCC  
arch/powerpc/boot/cuboot-8xx.o:  => 27:26
  + /home/kisskb/slave/src/arch/sh/kernel/cpu/sh2/../../entry-common.S: 
Warning: /home/kisskb/slave/src/arch/sh/math-emu/math.c:122:1: warning: right 
shift count is negative [enabled by default]overflow in branch to 
syscall_trace_entry; converted into longer instruction sequence:  => 356
  + /home/kisskb/slave/src/arch/sh/kernel/cpu/sh4/../sh3/../../entry-common.S: 
Warning: overflow in branch to __restore_all; converted into longer instruction 
sequence:  => 89
  + /home/kisskb/slave/src/arch/sh/kernel/cpu/sh4/../sh3/../../entry-common.S: 
Warning: overflow in branch to syscall_call; converted into longer instruction 
sequence:  => 208
  + /home/kisskb/slave/src/arch/sh/kernel/cpu/sh4/../sh3/../../entry-common.S: 
Warning: overflow in branch to syscall_trace_entry; converted into longer 
instruction sequence:  => 356, 358
  + /home/kisskb/slave/src/crypto/ecc.c: warning: 'ecc_gen_privkey' uses 
dynamic stack allocation [enabled by default]:  => 984:1
  + /home/kisskb/slave/src/crypto/ecc.c: warning: 'ecc_make_pub_key' uses 
dynamic stack allocation [enabled by default]:  => 1020:1
  + /home/kisskb/slave/src/drivers/crypto/chelsio/chcr_algo.c: warning: 
'chcr_cipher_fallback' uses dynamic stack allocation [enabled by default]:  => 
576:1
  + /home/kisskb/slave/src/drivers/crypto/chelsio/chcr_algo.c: warning: 
'chcr_copy_assoc.isra.19' uses dynamic stack allocation [enabled by default]:  
=> 1898:1
  + /home/kisskb/slave/src/drivers/crypto/inside-secure/safexcel_cipher.c: 
warning: (near initialization for 'result.completion') [-Wmissing-braces]:  => 
389:9
  + /home/kisskb/slave/src/drivers/crypto/inside-secure/safexcel_cipher.c: 
warning: missing braces around initializer [-Wmissing-braces]:  => 389:9
  + /home/kisskb/slave/src/drivers/crypto/inside-secure/safexcel_hash.c: 
warning: (near initialization for 'result.completion') [-Wmissing-braces]:  => 
422:9
  + /home/kisskb/slave/src/drivers/crypto/inside-secure/safexcel_hash.c: 
warning: missing braces around initializer [-Wmissing-braces]:  => 422:9
  + /home/kisskb/slave/src/drivers/gpio/gpio-dln2.c: warning: 'packed' 
attribute ignored for field of type '__le16' [-Wattributes]:  => 73:2
  + /home/kisskb/slave/src/drivers/gpio/gpio-wm831x.c: warning: 'powerdomain' 
may be used uninitialized in this function [-Wuninitialized]:  => 234:13
  + /home/kisskb/slave/src/drivers/gpio/gpio-xra1403.c: warning: 
'xra1403_dbg_show' uses dynamic stack allocation [enabled by default]:  => 157:1
  + /home/kisskb/slave/src/drivers/ide/ide-floppy.c: warning: 'pc' may be used 
uninitialized in this function [-Wuninitialized]:  => 301:2
  + /home/kisskb/slave/src/drivers/infiniband/core/security.c: warning: 
'new_pps' may be used uninitialized in this function [-Wuninitialized]:  => 
604:28
  + /home/kisskb/slave/src/drivers/iommu/io-pgtable-arm-v7s.c: warning: 'cptep' 
may be used uninitialized in this function [-Wuninitialized]:  => 468:2, 433:7
  + /home/kisskb/slave/src/drivers/media/platform/rcar_drif.c: warning: 'ret' 
may be used uninitialized in this function [-Wuninitialized]:  => 658:2, 756:5
  + /home/kisskb/slave/src/drivers/mtd/spi-nor/stm32-quadspi.c: warning: 'ret' 
may be used uninitialized in this function [-Wuninitialized]:  => 248:2, 309:5
  + /home/kisskb/slave/src/drivers/net/ethernet/mellanox/mlx5/core/fpga/sdk.c: 
warning: 'err' may be used uninitialized in this function [-Wuninitialized]:  
=> 126:6, 147:6
  + /home/kisskb/slave/src/drivers/net/wireless/ath/ath10k/sdio.c: warning: 
'ret' may be 

Re: [PATCH v3 1/4] mmc: sdhci-cadence: add suspend / resume support

2017-08-21 Thread Adrian Hunter
On 15/08/17 18:45, Masahiro Yamada wrote:
> Currently, the probe function initializes the PHY, but PHY settings
> are lost during the sleep state.  Restore the PHY registers when
> resuming.
> 
> To facilitate this, split sdhci_cdns_phy_init() into the DT parse
> part and PHY update part so that the latter can be invoked from the
> resume hook.
> 
> Signed-off-by: Masahiro Yamada 

Just one comment about using clk_disable_unprepare() on the error path.

> ---
> 
> Changes in v3:
>  - Use #ifdef CONFIG_PM_SLEEP instead of __maybe_unused
>  - Add own sdhci_cdns_suspend implementation to not depend on
>the core change
> 
> Changes in v2: None
> 
>  drivers/mmc/host/sdhci-cadence.c | 97 
> 
>  1 file changed, 88 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/mmc/host/sdhci-cadence.c 
> b/drivers/mmc/host/sdhci-cadence.c
> index 19d5698244b5..751ba706bf03 100644
> --- a/drivers/mmc/host/sdhci-cadence.c
> +++ b/drivers/mmc/host/sdhci-cadence.c
> @@ -67,9 +67,16 @@
>   */
>  #define SDHCI_CDNS_MAX_TUNING_LOOP   40
>  
> +struct sdhci_cdns_phy_param {
> + u8 addr;
> + u8 data;
> +};
> +
>  struct sdhci_cdns_priv {
>   void __iomem *hrs_addr;
>   bool enhanced_strobe;
> + unsigned int nr_phy_params;
> + struct sdhci_cdns_phy_param phy_params[0];
>  };
>  
>  struct sdhci_cdns_phy_cfg {
> @@ -115,9 +122,22 @@ static int sdhci_cdns_write_phy_reg(struct 
> sdhci_cdns_priv *priv,
>   return 0;
>  }
>  
> -static int sdhci_cdns_phy_init(struct device_node *np,
> -struct sdhci_cdns_priv *priv)
> +static unsigned int sdhci_cdns_phy_param_count(struct device_node *np)
>  {
> + unsigned int count = 0;
> + int i;
> +
> + for (i = 0; i < ARRAY_SIZE(sdhci_cdns_phy_cfgs); i++)
> + if (of_property_read_bool(np, sdhci_cdns_phy_cfgs[i].property))
> + count++;
> +
> + return count;
> +}
> +
> +static void sdhci_cdns_phy_param_parse(struct device_node *np,
> +struct sdhci_cdns_priv *priv)
> +{
> + struct sdhci_cdns_phy_param *p = priv->phy_params;
>   u32 val;
>   int ret, i;
>  
> @@ -127,9 +147,19 @@ static int sdhci_cdns_phy_init(struct device_node *np,
>   if (ret)
>   continue;
>  
> - ret = sdhci_cdns_write_phy_reg(priv,
> -sdhci_cdns_phy_cfgs[i].addr,
> -val);
> + p->addr = sdhci_cdns_phy_cfgs[i].addr;
> + p->data = val;
> + p++;
> + }
> +}
> +
> +static int sdhci_cdns_phy_init(struct sdhci_cdns_priv *priv)
> +{
> + int ret, i;
> +
> + for (i = 0; i < priv->nr_phy_params; i++) {
> + ret = sdhci_cdns_write_phy_reg(priv, priv->phy_params[i].addr,
> +priv->phy_params[i].data);
>   if (ret)
>   return ret;
>   }
> @@ -302,6 +332,8 @@ static int sdhci_cdns_probe(struct platform_device *pdev)
>   struct sdhci_pltfm_host *pltfm_host;
>   struct sdhci_cdns_priv *priv;
>   struct clk *clk;
> + size_t priv_size;
> + unsigned int nr_phy_params;
>   int ret;
>   struct device *dev = >dev;
>  
> @@ -313,7 +345,9 @@ static int sdhci_cdns_probe(struct platform_device *pdev)
>   if (ret)
>   return ret;
>  
> - host = sdhci_pltfm_init(pdev, _cdns_pltfm_data, sizeof(*priv));
> + nr_phy_params = sdhci_cdns_phy_param_count(dev->of_node);
> + priv_size = sizeof(*priv) + sizeof(priv->phy_params[0]) * nr_phy_params;
> + host = sdhci_pltfm_init(pdev, _cdns_pltfm_data, priv_size);
>   if (IS_ERR(host)) {
>   ret = PTR_ERR(host);
>   goto disable_clk;
> @@ -322,7 +356,8 @@ static int sdhci_cdns_probe(struct platform_device *pdev)
>   pltfm_host = sdhci_priv(host);
>   pltfm_host->clk = clk;
>  
> - priv = sdhci_cdns_priv(host);
> + priv = sdhci_pltfm_priv(pltfm_host);
> + priv->nr_phy_params = nr_phy_params;
>   priv->hrs_addr = host->ioaddr;
>   priv->enhanced_strobe = false;
>   host->ioaddr += SDHCI_CDNS_SRS_BASE;
> @@ -336,7 +371,9 @@ static int sdhci_cdns_probe(struct platform_device *pdev)
>   if (ret)
>   goto free;
>  
> - ret = sdhci_cdns_phy_init(dev->of_node, priv);
> + sdhci_cdns_phy_param_parse(dev->of_node, priv);
> +
> + ret = sdhci_cdns_phy_init(priv);
>   if (ret)
>   goto free;
>  
> @@ -353,6 +390,48 @@ static int sdhci_cdns_probe(struct platform_device *pdev)
>   return ret;
>  }
>  
> +#ifdef CONFIG_PM_SLEEP
> +static int sdhci_cdns_suspend(struct device *dev)
> +{
> + struct sdhci_host *host = dev_get_drvdata(dev);
> + struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
> + int ret;
> +
> + if (host->tuning_mode != SDHCI_TUNING_MODE_3)
> +   

[PATCH] arm64: dts: uniphier: add reset controller node of analog amplifier

2017-08-21 Thread Katsuhiro Suzuki
This patch adds reset controller node of analog signal amplifier
core (ADAMV) for UniPhier LD11/LD20 SoCs.

Signed-off-by: Katsuhiro Suzuki 
---
 arch/arm64/boot/dts/socionext/uniphier-ld11.dtsi | 11 +++
 arch/arm64/boot/dts/socionext/uniphier-ld20.dtsi | 11 +++
 2 files changed, 22 insertions(+)

diff --git a/arch/arm64/boot/dts/socionext/uniphier-ld11.dtsi 
b/arch/arm64/boot/dts/socionext/uniphier-ld11.dtsi
index bdce5b89baec..35ffea71bc55 100644
--- a/arch/arm64/boot/dts/socionext/uniphier-ld11.dtsi
+++ b/arch/arm64/boot/dts/socionext/uniphier-ld11.dtsi
@@ -150,6 +150,17 @@
clocks = <_clk 3>;
};
 
+   adamv@5792 {
+   compatible = "socionext,uniphier-ld11-adamv",
+"simple-mfd", "syscon";
+   reg = <0x5792 0x1000>;
+
+   adamv_rst: reset {
+   compatible = 
"socionext,uniphier-ld11-adamv-reset";
+   #reset-cells = <1>;
+   };
+   };
+
i2c0: i2c@5878 {
compatible = "socionext,uniphier-fi2c";
status = "disabled";
diff --git a/arch/arm64/boot/dts/socionext/uniphier-ld20.dtsi 
b/arch/arm64/boot/dts/socionext/uniphier-ld20.dtsi
index de1e75362817..b21b8bf523ff 100644
--- a/arch/arm64/boot/dts/socionext/uniphier-ld20.dtsi
+++ b/arch/arm64/boot/dts/socionext/uniphier-ld20.dtsi
@@ -219,6 +219,17 @@
clocks = <_clk 3>;
};
 
+   adamv@5792 {
+   compatible = "socionext,uniphier-ld20-adamv",
+"simple-mfd", "syscon";
+   reg = <0x5792 0x1000>;
+
+   adamv_rst: reset {
+   compatible = 
"socionext,uniphier-ld20-adamv-reset";
+   #reset-cells = <1>;
+   };
+   };
+
i2c0: i2c@5878 {
compatible = "socionext,uniphier-fi2c";
status = "disabled";
-- 
2.13.2



Re: [PATCH 03/14] mmc: meson-gx: clean up some constants

2017-08-21 Thread Jerome Brunet
On Mon, 2017-08-07 at 14:06 -0700, Kevin Hilman wrote:
> Jerome Brunet  writes:
> 
> > Remove useless clock rate defines. These should not be defined but
> 
> To be more precise, they're also unused, so maybe s/useless/unused/ ?
> 
> > equested from the clock framework.
> 
> s/equested/requested/
> 

Thx Kevin !

> > Also correct typo on the DELAY register
> > 
> > Signed-off-by: Jerome Brunet 
> 
> Otherwise,
> 
> Reviewed-by: Kevin Hilman 
> 
> > ---
> >  drivers/mmc/host/meson-gx-mmc.c | 4 +---
> >  1 file changed, 1 insertion(+), 3 deletions(-)
> > 
> > diff --git a/drivers/mmc/host/meson-gx-mmc.c b/drivers/mmc/host/meson-gx-
> > mmc.c
> > index d480a8052a06..8a74a048db88 100644
> > --- a/drivers/mmc/host/meson-gx-mmc.c
> > +++ b/drivers/mmc/host/meson-gx-mmc.c
> > @@ -45,9 +45,7 @@
> >  #define   CLK_DIV_MAX 63
> >  #define   CLK_SRC_MASK GENMASK(7, 6)
> >  #define   CLK_SRC_XTAL 0   /* external crystal */
> > -#define   CLK_SRC_XTAL_RATE 2400
> >  #define   CLK_SRC_PLL 1/* FCLK_DIV2 */
> > -#define   CLK_SRC_PLL_RATE 10
> >  #define   CLK_CORE_PHASE_MASK GENMASK(9, 8)
> >  #define   CLK_TX_PHASE_MASK GENMASK(11, 10)
> >  #define   CLK_RX_PHASE_MASK GENMASK(13, 12)
> > @@ -57,7 +55,7 @@
> >  #define   CLK_PHASE_270 3
> >  #define   CLK_ALWAYS_ON BIT(24)
> >  
> > -#define SD_EMMC_DElAY 0x4
> > +#define SD_EMMC_DELAY 0x4
> >  #define SD_EMMC_ADJUST 0x8
> >  #define SD_EMMC_CALOUT 0x10
> >  #define SD_EMMC_START 0x40



[RESEND PATCH v8 0/3] clk: stm32h7: Add stm32h743 clock driver

2017-08-21 Thread gabriel.fernandez
From: Gabriel Fernandez 

v8:
  - Documentation remarks from Valdimir:
- rename 'rcc' node name into 'reset-clock-controller'
- delete source paths into the device tree bindings documentation
- other cosmetic changes
v7:
  - Documentation: put 'st,syscfg' phandle in optional section
  - rename nxp gate op with lpc32xx_ prefix
  - Suppress useless code to disable/enable backup domain write protection
(backup domaine write is disable at the init and never enabled)

v6:
  - rename clk_gate_is_enabled() in nxp lpc32xx driver.
  - add EXPORT_SYMBOL_GPL(clk_gate_is_enabled)

v5:
  - return bool instead int for enable_power_domain_write_protection()
  - add comment to explain use of CLK_OF_DECLARE_DRIVER()
  - add comment to explain why we can't use read_poll_timeout()
  - expose clk_gate_ops::is_enabled
  - use of __clk_mux_determine_rate & clk_gate_is_enabled to avoid wrapper
function.

v4:
  - rename lock into stm32rcc_lock
  - don't use clk_readl() 
  - remove useless parentheses with GENMASK
  - fix parents of timer_x clocks
  - suppress pll configuration from DT
  - fix kbuild warning

v3:
  - fix compatible string "stm32h7-pll" into "st,stm32h7-pll"
  - fix bad parent name for mco2 clock
  - set CLK_SET_RATE_PARENT for ltdc clock
  - set CLK_IGNORE_UNUSED for pll1
  - disable power domain write protection on disable ops if needed


v2:
  - rename compatible string "stm32,pll" into "stm32h7-pll"
  - suppress "st,pllrge" property
  - suppress "st, frac-status" property
  - change management of "st,frac"  property
0 : enable 0 pll integer mode 
other values : enable pll in fractional mode (value is
the fractional factor)

Gabriel Fernandez (3):
  clk: nxp: clk-lpc32xx: rename clk_gate_is_enabled()
  clk: gate: expose clk_gate_ops::is_enabled
  clk: stm32h7: Add stm32h743 clock driver

 .../devicetree/bindings/clock/st,stm32h7-rcc.txt   |   71 +
 drivers/clk/Makefile   |1 +
 drivers/clk/clk-gate.c |3 +-
 drivers/clk/clk-stm32h7.c  | 1410 
 drivers/clk/nxp/clk-lpc32xx.c  |   12 +-
 include/dt-bindings/clock/stm32h7-clks.h   |  165 +++
 include/dt-bindings/mfd/stm32h7-rcc.h  |  136 ++
 include/linux/clk-provider.h   |1 +
 8 files changed, 1792 insertions(+), 7 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/clock/st,stm32h7-rcc.txt
 create mode 100644 drivers/clk/clk-stm32h7.c
 create mode 100644 include/dt-bindings/clock/stm32h7-clks.h
 create mode 100644 include/dt-bindings/mfd/stm32h7-rcc.h

-- 
1.9.1



[RESEND PATCH v8 2/3] clk: gate: expose clk_gate_ops::is_enabled

2017-08-21 Thread gabriel.fernandez
From: Gabriel Fernandez 

This patch exposes clk_gate_ops::is_enabled as functions
that can be directly called and assigned in places like this so
we don't need wrapper functions that do nothing besides forward
the call.

Signed-off-by: Gabriel Fernandez 
Suggested-by: Stephen Boyd 
---
 drivers/clk/clk-gate.c   | 3 ++-
 include/linux/clk-provider.h | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/clk-gate.c b/drivers/clk/clk-gate.c
index 4e0c054a..dd82485 100644
--- a/drivers/clk/clk-gate.c
+++ b/drivers/clk/clk-gate.c
@@ -86,7 +86,7 @@ static void clk_gate_disable(struct clk_hw *hw)
clk_gate_endisable(hw, 0);
 }
 
-static int clk_gate_is_enabled(struct clk_hw *hw)
+int clk_gate_is_enabled(struct clk_hw *hw)
 {
u32 reg;
struct clk_gate *gate = to_clk_gate(hw);
@@ -101,6 +101,7 @@ static int clk_gate_is_enabled(struct clk_hw *hw)
 
return reg ? 1 : 0;
 }
+EXPORT_SYMBOL_GPL(clk_gate_is_enabled);
 
 const struct clk_ops clk_gate_ops = {
.enable = clk_gate_enable,
diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h
index c59c625..e9587ab 100644
--- a/include/linux/clk-provider.h
+++ b/include/linux/clk-provider.h
@@ -343,6 +343,7 @@ struct clk_hw *clk_hw_register_gate(struct device *dev, 
const char *name,
u8 clk_gate_flags, spinlock_t *lock);
 void clk_unregister_gate(struct clk *clk);
 void clk_hw_unregister_gate(struct clk_hw *hw);
+int clk_gate_is_enabled(struct clk_hw *hw);
 
 struct clk_div_table {
unsigned intval;
-- 
1.9.1



Re: [PATCH 08/14] mmc: meson-gx: rework clock init function

2017-08-21 Thread Jerome Brunet
On Mon, 2017-08-07 at 14:34 -0700, Kevin Hilman wrote:
> Jerome Brunet  writes:
> 
> > Perform basic initialisation of the clk register before providing it to
> > the CCF.
> > 
> > Thanks to devm, carrying the clock structure around after init is not
> > necessary. Rework the function to remove these from the controller host
> > data.
> > 
> > Finally, set initial mmc clock rate before enabling it, simplifying the
> > exit condition.
> > 
> > Signed-off-by: Jerome Brunet 
> > ---
> >  drivers/mmc/host/meson-gx-mmc.c | 101 +++
> > -
> >  1 file changed, 49 insertions(+), 52 deletions(-)
> > 
> > diff --git a/drivers/mmc/host/meson-gx-mmc.c b/drivers/mmc/host/meson-gx-
> > mmc.c
> > index 8f9ba5190c18..4cc7d6530536 100644
> > --- a/drivers/mmc/host/meson-gx-mmc.c
> > +++ b/drivers/mmc/host/meson-gx-mmc.c
> > @@ -42,10 +42,7 @@
> >  
> >  #define SD_EMMC_CLOCK 0x0
> >  #define   CLK_DIV_MASK GENMASK(5, 0)
> > -#define   CLK_DIV_MAX 63
> >  #define   CLK_SRC_MASK GENMASK(7, 6)
> > -#define   CLK_SRC_XTAL 0   /* external crystal */
> > -#define   CLK_SRC_PLL 1/* FCLK_DIV2 */
> >  #define   CLK_CORE_PHASE_MASK GENMASK(9, 8)
> >  #define   CLK_TX_PHASE_MASK GENMASK(11, 10)
> >  #define   CLK_RX_PHASE_MASK GENMASK(13, 12)
> > @@ -137,13 +134,9 @@ struct meson_host {
> >     spinlock_t lock;
> >     void __iomem *regs;
> >     struct clk *core_clk;
> > -   struct clk_mux mux;
> > -   struct clk *mux_clk;
> > +   struct clk *signal_clk;
> >     unsigned long req_rate;
> >  
> > -   struct clk_divider cfg_div;
> > -   struct clk *cfg_div_clk;
> > -
> >     unsigned int bounce_buf_size;
> >     void *bounce_buf;
> >     dma_addr_t bounce_dma_addr;
> > @@ -291,7 +284,7 @@ static int meson_mmc_clk_set(struct meson_host *host,
> > unsigned long clk_rate)
> >     return 0;
> >     }
> >  
> > -   ret = clk_set_rate(host->cfg_div_clk, clk_rate);
> > +   ret = clk_set_rate(host->signal_clk, clk_rate);
> 
> minor nit: where does the name "signal" come from?  I called this
> "div_clk" because it's the output of the divider right before the
> sd/emmc IP block. 

Actually, no before but inside.

> Admittedly, that's not a great name either, and I'm
> not too picky about the naming, just curious...

Well, I thought div_clk was not great name too ... since the clock is actually
the one used for the mmc signal (as opposed to the clock gate named "core") I
thought it was ok.

In the v2, I added the handling of clock phase through CCF. With this change,
div_clk does not make sense anymore.

According to the datasheet, It should be named "core_clk" (it is the clock
coming out of the CORE_PHASE setting), unfortunately we already used this name
for the clock gate ... changing it would mean changing the clock names in the
bindings as well, which would probably be very confusing.

In the v2, I named it mmc_clk ... probably not great either :( If you have
another idea, I'm happy to sed it.

> 
> Looking at the diagram we have since I initially wrote the driver, this
> is more commonly referred to as device_clk.
> 
> Anyways, if you're going to rename...
> 
> [...]
> 
> >  static void meson_mmc_set_tuning_params(struct mmc_host *mmc)
> > @@ -987,7 +984,7 @@ static int meson_mmc_probe(struct platform_device *pdev)
> >     dma_free_coherent(host->dev, host->bounce_buf_size,
> >       host->bounce_buf, host->bounce_dma_addr);
> >  err_div_clk:
> 
> ... probably should rename this too.

Indeed !

> 
> Otherwise,
> 
> Reviewed-by: Kevin Hilman 
> 
> Kevin



Re: [RFC 1/2] misc: Add vboxguest driver for Virtual Box Guest integration

2017-08-21 Thread Hans de Goede

Hi,

On 21-08-17 13:43, Hans de Goede wrote:




I'm also thinking that under Linux since we never use userspace to
alloc memory for the balloon, we don't need to involve userspace at
all, the drivers interrupt handler could detect the event that the
host wants to change the balloonsize itself and start a workqueue
item which then asks for what the new size should be and do the
adjustment all inside the kernel.  I think that will even lead to
simpler code as we no longer need to track the balloon userspace
owner and do reclaim when it dies.

Typing this out I really see no reason to not do this inside the
kernel, so I think I'm going to implement that right away / for
the [RFC v2] I plan to post later today or tomorrow.


Done:

https://github.com/jwrdegoede/vboxguest/commit/2920882cb0ce9af11a843affc58d4a08ef47e16b

Regards,

Hans



[no subject]

2017-08-21 Thread Ciprian
Good evening 

http://www.albit.ro/s2daddr.php?fight=27sfbr9drm6n4




Ciprian

Re: system hung up when offlining CPUs

2017-08-21 Thread Christoph Hellwig
Hi Marc,

in general the driver should know not to use the queue / irq,
as blk-mq will never schedule I/O to queues that have no online
cpus.

The real bugs seems to be that we're using affinity for a device
that only has one real queue (as the config queue should not
have affinity).  Let me dig into what's going on here with virtio.


[PATCH v2 5/6] MIPS: math-emu: Add FP emu debugfs clear functionality

2017-08-21 Thread Aleksandar Markovic
From: Aleksandar Markovic 

Add capability for the user to clear all FP emu debugfs counters.

This is achieved by having a special debugfs file "fpuemustats_clear"
(under default location "/sys/kernel/debug/mips"). Each access to the
file results in setting all counters to zero (it is enough, let's say,
to issue a "cat /sys/kernel/debug/mips/fpuemustats_clear").

This functionality already exists for R2 emulation statistics,
but was missing for FP emulation statistics. The implementation in
this patch is consistent with its R2 emulation counterpart.

Signed-off-by: Miodrag Dinic 
Signed-off-by: Goran Ferenc 
Signed-off-by: Aleksandar Markovic 
---
 arch/mips/math-emu/me-debugfs.c | 38 +-
 1 file changed, 37 insertions(+), 1 deletion(-)

diff --git a/arch/mips/math-emu/me-debugfs.c b/arch/mips/math-emu/me-debugfs.c
index 78b26c8..f080493 100644
--- a/arch/mips/math-emu/me-debugfs.c
+++ b/arch/mips/math-emu/me-debugfs.c
@@ -28,15 +28,51 @@ static int fpuemu_stat_get(void *data, u64 *val)
 }
 DEFINE_SIMPLE_ATTRIBUTE(fops_fpuemu_stat, fpuemu_stat_get, NULL, "%llu\n");
 
+static int fpuemustats_clear_show(struct seq_file *s, void *unused)
+{
+   __this_cpu_write((fpuemustats).emulated, 0);
+   __this_cpu_write((fpuemustats).loads, 0);
+   __this_cpu_write((fpuemustats).stores, 0);
+   __this_cpu_write((fpuemustats).branches, 0);
+   __this_cpu_write((fpuemustats).cp1ops, 0);
+   __this_cpu_write((fpuemustats).cp1xops, 0);
+   __this_cpu_write((fpuemustats).errors, 0);
+   __this_cpu_write((fpuemustats).ieee754_inexact, 0);
+   __this_cpu_write((fpuemustats).ieee754_underflow, 0);
+   __this_cpu_write((fpuemustats).ieee754_overflow, 0);
+   __this_cpu_write((fpuemustats).ieee754_zerodiv, 0);
+   __this_cpu_write((fpuemustats).ieee754_invalidop, 0);
+   __this_cpu_write((fpuemustats).ds_emul, 0);
+
+   return 0;
+}
+
+static int fpuemustats_clear_open(struct inode *inode, struct file *file)
+{
+   return single_open(file, fpuemustats_clear_show, inode->i_private);
+}
+
+static const struct file_operations fpuemustats_clear_fops = {
+   .open   = fpuemustats_clear_open,
+   .read   = seq_read,
+   .llseek = seq_lseek,
+   .release= single_release,
+};
+
 static int __init debugfs_fpuemu(void)
 {
-   struct dentry *d, *dir;
+   struct dentry *d, *dir, *reset_file;
 
if (!mips_debugfs_dir)
return -ENODEV;
dir = debugfs_create_dir("fpuemustats", mips_debugfs_dir);
if (!dir)
return -ENOMEM;
+   reset_file = debugfs_create_file("fpuemustats_clear", 0444,
+mips_debugfs_dir, NULL,
+_clear_fops);
+   if (!reset_file)
+   return -ENOMEM;
 
 #define FPU_EMU_STAT_OFFSET(m) \
offsetof(struct mips_fpu_emulator_stats, m)
-- 
2.9.3



[PATCH v2 2/6] MIPS: math-emu: RINT.<D|S>: Fix several problems by reimplementation

2017-08-21 Thread Aleksandar Markovic
From: Aleksandar Markovic 

Reimplement RINT. kernel emulation so that all RINT.
specifications are met.

For the sake of simplicity, let's analyze RINT.S only. Prior to
this patch, RINT.S emulation was essentially implemented as (in
pseudocode)  = ieee754sp_flong(ieee754sp_tlong()),
where ieee754sp_tlong() and ieee754sp_flong() are functions
providing conversion from double to integer, and from integer
to double, respectively. On surface, this implementation looks
correct, but actually fails in many cases. Following problems
were detected:

1. NaN and infinity cases will not be handled properly. The
   function ieee754sp_flong() never returns NaN nor infinity.
2. For RINT.S, for all inputs larger than LONG_MAX, and smaller
   than FLT_MAX, the result will be wrong, and the overflow
   exception will be erroneously set. A similar problem for
   negative inputs exists as well.
3. For some rounding modes, for some negative inputs close to zero,
   the return value will be zero, and should be -zero. This is
   because ieee754sp_flong() never returns -zero.

This patch removes the problems above by implementing dedicated
functions for RINT. emulation.

The core of the new function functionality is adapted version of
the core of the function ieee754sp_tlong(). However, there are many
details that are implemented to match RINT. specification. It
should be said that the functionality of ieee754sp_tlong() actually
closely corresponds to CVT.L.S instruction, and it is used while
emulating CVT.L.S. However, RINT.S and CVT.L.S instructions differ
in many aspects. This patch fulfills missing support for RINT..

Signed-off-by: Miodrag Dinic 
Signed-off-by: Goran Ferenc 
Signed-off-by: Aleksandar Markovic 
---
 MAINTAINERS  |  7 
 arch/mips/math-emu/Makefile  |  6 ++-
 arch/mips/math-emu/cp1emu.c  |  6 +--
 arch/mips/math-emu/dp_rint.c | 89 +++
 arch/mips/math-emu/ieee754.h |  2 +
 arch/mips/math-emu/sp_rint.c | 90 
 6 files changed, 194 insertions(+), 6 deletions(-)
 create mode 100644 arch/mips/math-emu/dp_rint.c
 create mode 100644 arch/mips/math-emu/sp_rint.c

diff --git a/MAINTAINERS b/MAINTAINERS
index 1c3feff..5a6a0e6 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -8802,6 +8802,13 @@ F:   arch/mips/include/asm/mach-loongson32/
 F: drivers/*/*loongson1*
 F: drivers/*/*/*loongson1*
 
+MIPS RINT INSTRUCTION EMULATION
+M: Aleksandar Markovic 
+L: linux-m...@linux-mips.org
+S: Supported
+F: arch/mips/math-emu/sp_rint.c
+F: arch/mips/math-emu/dp_rint.c
+
 MIROSOUND PCM20 FM RADIO RECEIVER DRIVER
 M: Hans Verkuil 
 L: linux-me...@vger.kernel.org
diff --git a/arch/mips/math-emu/Makefile b/arch/mips/math-emu/Makefile
index e9bbc2a..e9f10b8 100644
--- a/arch/mips/math-emu/Makefile
+++ b/arch/mips/math-emu/Makefile
@@ -4,9 +4,11 @@
 
 obj-y  += cp1emu.o ieee754dp.o ieee754sp.o ieee754.o \
   dp_div.o dp_mul.o dp_sub.o dp_add.o dp_fsp.o dp_cmp.o dp_simple.o \
-  dp_tint.o dp_fint.o dp_maddf.o dp_2008class.o dp_fmin.o dp_fmax.o \
+  dp_tint.o dp_fint.o dp_rint.o dp_maddf.o dp_2008class.o dp_fmin.o \
+  dp_fmax.o \
   sp_div.o sp_mul.o sp_sub.o sp_add.o sp_fdp.o sp_cmp.o sp_simple.o \
-  sp_tint.o sp_fint.o sp_maddf.o sp_2008class.o sp_fmin.o sp_fmax.o \
+  sp_tint.o sp_fint.o sp_rint.o sp_maddf.o sp_2008class.o sp_fmin.o \
+  sp_fmax.o \
   dsemul.o
 
 lib-y  += ieee754d.o \
diff --git a/arch/mips/math-emu/cp1emu.c b/arch/mips/math-emu/cp1emu.c
index 520a5ac..cabcf2c 100644
--- a/arch/mips/math-emu/cp1emu.c
+++ b/arch/mips/math-emu/cp1emu.c
@@ -1805,8 +1805,7 @@ static int fpu_emu(struct pt_regs *xcp, struct 
mips_fpu_struct *ctx,
return SIGILL;
 
SPFROMREG(fs, MIPSInst_FS(ir));
-   rv.l = ieee754sp_tlong(fs);
-   rv.s = ieee754sp_flong(rv.l);
+   rv.s = ieee754sp_rint(fs);
goto copcsr;
}
 
@@ -2134,8 +2133,7 @@ static int fpu_emu(struct pt_regs *xcp, struct 
mips_fpu_struct *ctx,
return SIGILL;
 
DPFROMREG(fs, MIPSInst_FS(ir));
-   rv.l = ieee754dp_tlong(fs);
-   rv.d = ieee754dp_flong(rv.l);
+   rv.d = ieee754dp_rint(fs);
goto copcsr;
}
 
diff --git a/arch/mips/math-emu/dp_rint.c b/arch/mips/math-emu/dp_rint.c
new file mode 100644
index 000..c3b9077
--- /dev/null
+++ b/arch/mips/math-emu/dp_rint.c
@@ 

[PATCH v2 3/6] MIPS: math-emu: CLASS.D: Zero bits 32-63 of the result

2017-08-21 Thread Aleksandar Markovic
From: Aleksandar Markovic 

Fix content of CLASS.D output bits 32-63 to match hardware behavior.

Prior to this patch, bits 32-63 of CLASS.D output were not
initialized, causing different 32-63 bits content of CLASS.D, based on
circumstances. However, the hardware consistently returns all these
bits zeroed. The documentation is not clear whether these bits should
be zero or unpredictable. Since technically "all zero" case still can
be viewed as belonging to "unpredictable" class of results, it is
better to zero bits 32-63.

Signed-off-by: Miodrag Dinic 
Signed-off-by: Goran Ferenc 
Signed-off-by: Aleksandar Markovic 
---
 arch/mips/math-emu/cp1emu.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/mips/math-emu/cp1emu.c b/arch/mips/math-emu/cp1emu.c
index cabcf2c..1ad15f8 100644
--- a/arch/mips/math-emu/cp1emu.c
+++ b/arch/mips/math-emu/cp1emu.c
@@ -2144,8 +2144,8 @@ static int fpu_emu(struct pt_regs *xcp, struct 
mips_fpu_struct *ctx,
return SIGILL;
 
DPFROMREG(fs, MIPSInst_FS(ir));
-   rv.w = ieee754dp_2008class(fs);
-   rfmt = w_fmt;
+   rv.l = ieee754dp_2008class(fs);
+   rfmt = l_fmt;
break;
}
 
-- 
2.9.3



[PATCH v2 1/6] MIPS: math-emu: CMP.Sxxx.<D|S>: Prevent occurrences of SIGILL crashes

2017-08-21 Thread Aleksandar Markovic
From: Aleksandar Markovic 

Fix CMP.Sxxx. SIGILL crashes by fixing main switch/case statement
in fpu_emul() function so that inadvertent fall-troughs are prevented.

Consider, let's say, CMP.SAF.S instruction when one of inputs is zero
and another input is a signaling NaN. The desired output is zero, and
the exception flag "invalid operation" set. For such case, the main
portion of the implementation is within "d_fmt" case of the main
"switch/case" statement in fpu_emul() function. The execution will
follow one of "if-else" branches that doesn't contain "goto cop1scr;"
statement, and will therefore reach the end of "d_fmt" case. It will
subsequently fall through to the next case, "l_fmt". After following
similar pattern, the execution will fall through to the succeeding
case, which is "default". The "default" case contains "return SIGILL;"
statement only. This means that the caller application will crash
with "illegal instruction" message.

It is obvious that above described fall-throughs are unnecessary and
harmful. This patch rectifies that behavior by providing "break;"
statements at the end of cases "d_fmt" and "l_fmt".

There are 22 instructions affected by this problem:

CMP...

Signed-off-by: Miodrag Dinic 
Signed-off-by: Goran Ferenc 
Signed-off-by: Aleksandar Markovic 
---
 arch/mips/math-emu/cp1emu.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/mips/math-emu/cp1emu.c b/arch/mips/math-emu/cp1emu.c
index f08a7b4..520a5ac 100644
--- a/arch/mips/math-emu/cp1emu.c
+++ b/arch/mips/math-emu/cp1emu.c
@@ -2394,6 +2394,7 @@ static int fpu_emu(struct pt_regs *xcp, struct 
mips_fpu_struct *ctx,
break;
}
}
+   break;
}
 
case l_fmt:
@@ -2468,6 +2469,8 @@ static int fpu_emu(struct pt_regs *xcp, struct 
mips_fpu_struct *ctx,
break;
}
}
+   break;
+
default:
return SIGILL;
}
-- 
2.9.3



[PATCH v2 0/6] MIPS: math-emu: FP emulation fixes and improvements

2017-08-21 Thread Aleksandar Markovic
From: Aleksandar Markovic 

v1->v2:

   - corrected a number of spelling and other minor mistakes in commit
 messages
   - rebased to the latest code

This series includes:

  - a fix for certain SIGILL program crashes on issuing a valid CMP
instruction
  - a fix for RINT emulation inaccuracies
  - a fix for the output of CLASS.D instruction emulation
  - several FP emulation debugfs statistics improvements

The patches in this series are logically and physically independent on
the patches previously sent in "Misc" series. This means that these
two series can be applied independently, in any order.

Aleksandar Markovic (6):
  MIPS: math-emu: CMP.Sxxx.: Prevent occurrences of SIGILL crashes
  MIPS: math-emu: RINT.: Fix several problems by reimplementation
  MIPS: math-emu: CLASS.D: Zero bits 32-63 of the result
  MIPS: math-emu: Add FP emu debugfs statistics for branches
  MIPS: math-emu: Add FP emu debugfs clear functionality
  MIPS: math-emu: Add FP emu debugfs stats for individual instructions

 MAINTAINERS  |   7 +
 arch/mips/include/asm/fpu_emulator.h | 116 +
 arch/mips/math-emu/Makefile  |   6 +-
 arch/mips/math-emu/cp1emu.c  | 272 +-
 arch/mips/math-emu/dp_rint.c |  89 ++
 arch/mips/math-emu/ieee754.h |   2 +
 arch/mips/math-emu/me-debugfs.c  | 318 ++-
 arch/mips/math-emu/sp_rint.c |  90 ++
 8 files changed, 888 insertions(+), 12 deletions(-)
 create mode 100644 arch/mips/math-emu/dp_rint.c
 create mode 100644 arch/mips/math-emu/sp_rint.c

-- 
2.9.3



[PATCH v2 4/6] MIPS: math-emu: Add FP emu debugfs statistics for branches

2017-08-21 Thread Aleksandar Markovic
From: Aleksandar Markovic 

Add FP emu debugfs counter for branches.

The new counter is displayed the same way as existing counter, and
its default path is /sys/kernel/debug/mips/fpuemustats/.

The limitation of this counter is that it counts only R6 branch
instructions BC1NEZ and BC1EQZ.

Signed-off-by: Miodrag Dinic 
Signed-off-by: Goran Ferenc 
Signed-off-by: Aleksandar Markovic 
---
 arch/mips/include/asm/fpu_emulator.h | 1 +
 arch/mips/math-emu/cp1emu.c  | 1 +
 arch/mips/math-emu/me-debugfs.c  | 1 +
 3 files changed, 3 insertions(+)

diff --git a/arch/mips/include/asm/fpu_emulator.h 
b/arch/mips/include/asm/fpu_emulator.h
index c05369e..7f5cf1f 100644
--- a/arch/mips/include/asm/fpu_emulator.h
+++ b/arch/mips/include/asm/fpu_emulator.h
@@ -36,6 +36,7 @@ struct mips_fpu_emulator_stats {
unsigned long emulated;
unsigned long loads;
unsigned long stores;
+   unsigned long branches;
unsigned long cp1ops;
unsigned long cp1xops;
unsigned long errors;
diff --git a/arch/mips/math-emu/cp1emu.c b/arch/mips/math-emu/cp1emu.c
index 1ad15f8..40c74e1 100644
--- a/arch/mips/math-emu/cp1emu.c
+++ b/arch/mips/math-emu/cp1emu.c
@@ -1230,6 +1230,7 @@ static int cop1Emulate(struct pt_regs *xcp, struct 
mips_fpu_struct *ctx,
break;
}
 branch_common:
+   MIPS_FPU_EMU_INC_STATS(branches);
set_delay_slot(xcp);
if (cond) {
/*
diff --git a/arch/mips/math-emu/me-debugfs.c b/arch/mips/math-emu/me-debugfs.c
index be650ed..78b26c8 100644
--- a/arch/mips/math-emu/me-debugfs.c
+++ b/arch/mips/math-emu/me-debugfs.c
@@ -53,6 +53,7 @@ do {  
\
FPU_STAT_CREATE(emulated);
FPU_STAT_CREATE(loads);
FPU_STAT_CREATE(stores);
+   FPU_STAT_CREATE(branches);
FPU_STAT_CREATE(cp1ops);
FPU_STAT_CREATE(cp1xops);
FPU_STAT_CREATE(errors);
-- 
2.9.3



[PATCH 3/5] btrfs: Use common error handling code in btrfs_update_root()

2017-08-21 Thread SF Markus Elfring
From: Markus Elfring 
Date: Mon, 21 Aug 2017 13:10:15 +0200

Add a jump target so that a bit of exception handling can be better reused
at the end of this function.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring 
---
 fs/btrfs/root-tree.c | 27 +++
 1 file changed, 11 insertions(+), 16 deletions(-)

diff --git a/fs/btrfs/root-tree.c b/fs/btrfs/root-tree.c
index 5b488af6f25e..bc497ba9d9d1 100644
--- a/fs/btrfs/root-tree.c
+++ b/fs/btrfs/root-tree.c
@@ -145,10 +145,8 @@ int btrfs_update_root(struct btrfs_trans_handle *trans, 
struct btrfs_root
return -ENOMEM;
 
ret = btrfs_search_slot(trans, root, key, path, 0, 1);
-   if (ret < 0) {
-   btrfs_abort_transaction(trans, ret);
-   goto out;
-   }
+   if (ret < 0)
+   goto abort_transaction;
 
if (ret != 0) {
btrfs_print_leaf(path->nodes[0]);
@@ -171,23 +169,17 @@ int btrfs_update_root(struct btrfs_trans_handle *trans, 
struct btrfs_root
btrfs_release_path(path);
ret = btrfs_search_slot(trans, root, key, path,
-1, 1);
-   if (ret < 0) {
-   btrfs_abort_transaction(trans, ret);
-   goto out;
-   }
+   if (ret < 0)
+   goto abort_transaction;
 
ret = btrfs_del_item(trans, root, path);
-   if (ret < 0) {
-   btrfs_abort_transaction(trans, ret);
-   goto out;
-   }
+   if (ret < 0)
+   goto abort_transaction;
btrfs_release_path(path);
ret = btrfs_insert_empty_item(trans, root, path,
key, sizeof(*item));
-   if (ret < 0) {
-   btrfs_abort_transaction(trans, ret);
-   goto out;
-   }
+   if (ret < 0)
+   goto abort_transaction;
l = path->nodes[0];
slot = path->slots[0];
ptr = btrfs_item_ptr_offset(l, slot);
@@ -204,6 +196,9 @@ int btrfs_update_root(struct btrfs_trans_handle *trans, 
struct btrfs_root
 out:
btrfs_free_path(path);
return ret;
+abort_transaction:
+   btrfs_abort_transaction(trans, ret);
+   goto out;
 }
 
 int btrfs_insert_root(struct btrfs_trans_handle *trans, struct btrfs_root 
*root,
-- 
2.14.0



[PATCH v2 2/2] hwmon: (ltq-cputemp) add devicetree bindings documentation

2017-08-21 Thread Florian Eckert
Document the devicetree bindings for the ltq-cputemp

Signed-off-by: Florian Eckert 
---
 Documentation/devicetree/bindings/hwmon/ltq-cputemp.txt | 10 ++
 1 file changed, 10 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/hwmon/ltq-cputemp.txt

diff --git a/Documentation/devicetree/bindings/hwmon/ltq-cputemp.txt 
b/Documentation/devicetree/bindings/hwmon/ltq-cputemp.txt
new file mode 100644
index ..991b05cbcb4a
--- /dev/null
+++ b/Documentation/devicetree/bindings/hwmon/ltq-cputemp.txt
@@ -0,0 +1,10 @@
+Lantiq cpu temperatur sensor driver
+
+Requires node properties:
+- "compatible" value :
+   "lantiq,cputemp"
+
+Example:
+   cputemp@0 {
+   compatible = "lantiq,cputemp";
+   };
-- 
2.11.0



[PATCH 4/5] btrfs: Use common error handling code in update_ref_path()

2017-08-21 Thread SF Markus Elfring
From: Markus Elfring 
Date: Mon, 21 Aug 2017 13:34:29 +0200

Add a jump target so that a bit of exception handling can be better reused
in this function.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring 
---
 fs/btrfs/send.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c
index 59fb1ed6ca20..a96edc91a101 100644
--- a/fs/btrfs/send.c
+++ b/fs/btrfs/send.c
@@ -3697,12 +3697,12 @@ static int update_ref_path(struct send_ctx *sctx, 
struct recorded_ref *ref)
return -ENOMEM;
 
ret = get_cur_path(sctx, ref->dir, ref->dir_gen, new_path);
-   if (ret < 0) {
-   fs_path_free(new_path);
-   return ret;
-   }
+   if (ret < 0)
+   goto free_path;
+
ret = fs_path_add(new_path, ref->name, ref->name_len);
if (ret < 0) {
+free_path:
fs_path_free(new_path);
return ret;
}
-- 
2.14.0



Re: [PATCH v5 05/19] crypto: introduce crypto wait for async op

2017-08-21 Thread Gilad Ben-Yossef
On Tue, Aug 15, 2017 at 5:23 AM, Jonathan Cameron
 wrote:
> On Mon, 14 Aug 2017 18:21:15 +0300
> Gilad Ben-Yossef  wrote:
>
>> Invoking a possibly async. crypto op and waiting for completion
>> while correctly handling backlog processing is a common task
>> in the crypto API implementation and outside users of it.
>>
>> This patch adds a generic implementation for doing so in
>> preparation for using it across the board instead of hand
>> rolled versions.

>
> Trivial observation.  Shouldn't have this bonus blank line inserted here.
>
>>  #endif   /* _LINUX_CRYPTO_H */
>>
>

Indeed. Will be fixed.

Thanks,
Gilad

-- 
Gilad Ben-Yossef
Chief Coffee Drinker

"If you take a class in large-scale robotics, can you end up in a
situation where the homework eats your dog?"
 -- Jean-Baptiste Queru


Re: [PATCH v3 4/9] pwm: Add STM32 LPTimer PWM driver

2017-08-21 Thread Thierry Reding
On Fri, Jul 07, 2017 at 06:31:03PM +0200, Fabrice Gasnier wrote:
> Add support for single PWM channel on Low-Power Timer, that can be
> found on some STM32 platforms.
> 
> Signed-off-by: Fabrice Gasnier 
> ---
> Changes in v3:
> - remove prescalers[] array, use power-of-2 presc directly
> - Update following Thierry's comments:
> - fix issue using FIELD_GET() macro
> - Add get_state() callback
> - remove some checks in probe
> - slight rework 'reenable' flag
> - use more common method to disable pwm in remove()
> 
> Changes in v2:
> - s/Low Power/Low-Power
> - update few comment lines
> ---
>  drivers/pwm/Kconfig|  10 ++
>  drivers/pwm/Makefile   |   1 +
>  drivers/pwm/pwm-stm32-lp.c | 246 
> +
>  3 files changed, 257 insertions(+)
>  create mode 100644 drivers/pwm/pwm-stm32-lp.c

Sorry, this fell through the cracks: changes in v3 look good to me:

Acked-by: Thierry Reding 


signature.asc
Description: PGP signature


Re: [PATCH v2] soc: ti: knav: Add a NULL pointer check for kdev in knav_pool_create

2017-08-21 Thread Arnd Bergmann
On Mon, Aug 21, 2017 at 7:44 AM, santosh.shilim...@oracle.com
 wrote:
> Hi Arnd,
>
> On 7/30/17 9:31 PM, Keerthy wrote:
>>
>> knav_pool_create is an exported function. In the event of a call
>> before knav_queue_probe, we encounter a NULL pointer dereference
>> in the following line. Hence return -EPROBE_DEFER to the caller till
>> the kdev pointer is non-NULL.
>>
>> Signed-off-by: Keerthy 
>> ---
>>
>> Changes in v2:
>>
>>* Fixed returning an int to returning pointer.
>
> FWIW, Acked-by: Santosh Shilimkar 
>
> Can you please also apply this fix in your fixes branch ?

Applied now, thanks!

  Arnd


Re: [PATCH 2/2] PM: docs: Delete the obsolete states.txt document

2017-08-21 Thread Markus Heiser

> Am 20.08.2017 um 18:06 schrieb Rafael J. Wysocki :
> 
> From: Rafael J. Wysocki 
> 
> The Documentation/power/states.txt document is now redundant and
> sonewhat outdated, so delete it.
> 
> Signed-off-by: Rafael J. Wysocki 
> ---
> Documentation/power/states.txt |  127 
> -
> 1 file changed, 127 deletions(-)

strange, I tried to apply the series, 1/2 applied but with 2/2 I get a 
"sha1 information is lacking or useless", did I miss something?

-- Markus --



[PATCH 1/2] net: stmmac: Delete dead code for MDIO registration

2017-08-21 Thread Romain Perier
This code is no longer used, the logging function was changed by commit
fbca164776e4 ("net: stmmac: Use the right logging functi").

Fixes: commit fbca164776e4 ("net: stmmac: Use the right logging functi")
Signed-off-by: Romain Perier 
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 16 
 1 file changed, 16 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c 
b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
index 72ec711fcba2..f5f37bfa1d58 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
@@ -248,9 +248,6 @@ int stmmac_mdio_register(struct net_device *ndev)
found = 0;
for (addr = 0; addr < PHY_MAX_ADDR; addr++) {
struct phy_device *phydev = mdiobus_get_phy(new_bus, addr);
-   int act = 0;
-   char irq_num[4];
-   char *irq_str;
 
if (!phydev)
continue;
@@ -273,19 +270,6 @@ int stmmac_mdio_register(struct net_device *ndev)
if (priv->plat->phy_addr == -1)
priv->plat->phy_addr = addr;
 
-   act = (priv->plat->phy_addr == addr);
-   switch (phydev->irq) {
-   case PHY_POLL:
-   irq_str = "POLL";
-   break;
-   case PHY_IGNORE_INTERRUPT:
-   irq_str = "IGNORE";
-   break;
-   default:
-   sprintf(irq_num, "%d", phydev->irq);
-   irq_str = irq_num;
-   break;
-   }
phy_attached_info(phydev);
found = 1;
}
-- 
2.11.0



[PATCH 0/2] net: stmmac: phy logging fixes

2017-08-21 Thread Romain Perier
This set of patches fixes issues related to logging. First it delete old
code that is no longer used in stmmac_mdio_register(). Then, it fixes a
crash that happens when phydev->drv is NULL and phy_attached_info() is
called prior phy_driver is binded to phydev.

Romain Perier (2):
  net: stmmac: Delete dead code for MDIO registration
  net: phy: Don't use drv when it is NULL in phy_attached_info

 drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 16 
 drivers/net/phy/phy_device.c  | 13 +++--
 2 files changed, 11 insertions(+), 18 deletions(-)

-- 
2.11.0



Re: [PATCH] x86/build: Use cc-option to validate stack alignment parameter

2017-08-21 Thread Ingo Molnar

* Matthias Kaehlcke  wrote:

> With 8f91869766c0 ("x86/build: Fix stack alignment for CLang") cc-option
> is only used to determine the name of the stack alignment option supported
> by the compiler, but not to verify that the actual parameter =N is
> valid in combination with the other CFLAGS. This causes problems with older
> gcc versions which only support stack alignment on a boundary of 16 bytes
> or higher.
> 
> Also use (__)cc_option to add the stack alignment option to CFLAGS to
> make sure only valid options are added.
> 
> Fixes: 8f91869766c0 ("x86/build: Fix stack alignment for CLang")
> Signed-off-by: Matthias Kaehlcke 

I've added the kbuild-bot Reported-by tag to document (and credit) how this bug 
was found.

Thanks,

Ingo


Re: [alsa-devel] [PATCH 09/12] ASoC: qcom: Remove unnecessary function call

2017-08-21 Thread Banajit Goswami
On Sun, Aug 20, 2017 at 01:44:58PM +0800, Peng Donglin wrote:
> First of all,the address of pdev->dev is assigned to card->dev,then
> the function platform_set_drvdata copies the value the variable card
> to pdev->dev.driver_data, but when calling snd_soc_register_card,the
> function dev_set_drvdata(card->dev, card) will also do the same copy
> operation,so i think that the former copy operation can be removed.
> 
> Signed-off-by: Peng Donglin 

Acked-by: Banajit Goswami 

> ---
>  sound/soc/qcom/storm.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/sound/soc/qcom/storm.c b/sound/soc/qcom/storm.c
> index c5207af..a9fa972 100644
> --- a/sound/soc/qcom/storm.c
> +++ b/sound/soc/qcom/storm.c
> @@ -99,7 +99,6 @@ static int storm_platform_probe(struct platform_device 
> *pdev)
>   return -ENOMEM;
>  
>   card->dev = >dev;
> - platform_set_drvdata(pdev, card);
>  
>   ret = snd_soc_of_parse_card_name(card, "qcom,model");
>   if (ret) {
> -- 
> 1.9.1
> 
> ___
> Alsa-devel mailing list
> alsa-de...@alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel


Re: [PATCH v3 3/4] net: stmmac: register parent MDIO node for sun8i-h3-emac

2017-08-21 Thread Chen-Yu Tsai
On Sun, Aug 20, 2017 at 10:25 PM, Andrew Lunn  wrote:
>> I think we cannot use mdio-mux-mmioreg since the register for doing
>> the switch is in middle of the "System Control" and shared with
>> other functions.  This is why we use a sycon/regmap for selecting
>> the MDIO.
>
> You could add a mdio-mux-regmap.c.
>
> However, it probably need restructuring of the stmmac mdio code, to
> make the mdio bus usable as a separate driver. You need stmmac mdio
> to probe first, then mdio-mux-remap should probe, and then lastly
> stmmmac mac driver.
>
> With stmmac mdio and stmmac mac being in one driver, there is no time
> in the middle to allow the mux driver to probe.
>
> It is some effort, but a nice cleanup and generalization.

I'm not sure mdio-mux is the right thing here.

Looking at mdio-mux, it seems to provide a way to access multiplexed
MDIO buses. It says nothing about the MAC<->PHY connection.

With our hardware, and likely Rockchip's as well, the muxed connections
include the MDIO and MII connections, which are muxed at the same time.
It's likely to cause some confusion or even bugs if we implement it as
a separate driver.

ChenYu


[PATCH v2] mfd: Add support for RTS5250S power saving

2017-08-21 Thread rui_feng
From: rui_feng 

Signed-off-by: rui_feng 
---
 drivers/mfd/rts5249.c| 183 ++
 drivers/mfd/rtsx_pcr.c   | 206 +--
 drivers/mfd/rtsx_pcr.h   |   2 +
 include/linux/mfd/rtsx_pci.h |  47 ++
 4 files changed, 433 insertions(+), 5 deletions(-)

diff --git a/drivers/mfd/rts5249.c b/drivers/mfd/rts5249.c
index 40f8bb1..a560b5a 100644
--- a/drivers/mfd/rts5249.c
+++ b/drivers/mfd/rts5249.c
@@ -103,8 +103,70 @@ static void rtsx_base_force_power_down(struct rtsx_pcr 
*pcr, u8 pm_state)
rtsx_pci_write_register(pcr, FPDCTL, 0x03, 0x03);
 }
 
+static int rts5249_init_from_cfg(struct rtsx_pcr *pcr)
+{
+   struct cr_option *option = &(pcr->option);
+   u32 lval;
+
+   if (CHK_PCI_PID(pcr, 0x524A))
+   rtsx_pci_read_config_dword(pcr, 0x160, );
+   else
+   rtsx_pci_read_config_dword(pcr, 0x168, );
+
+   if (lval & (1 << 3))
+   set_dev_flag(pcr, ASPM_L1_1_EN);
+   else
+   clear_dev_flag(pcr, ASPM_L1_1_EN);
+   if (lval & (1 << 2))
+   set_dev_flag(pcr, ASPM_L1_2_EN);
+   else
+   clear_dev_flag(pcr, ASPM_L1_2_EN);
+
+   if (lval & (1 << 1))
+   set_dev_flag(pcr, PM_L1_1_EN);
+   else
+   clear_dev_flag(pcr, PM_L1_1_EN);
+   if (lval & (1 << 0))
+   set_dev_flag(pcr, PM_L1_2_EN);
+   else
+   clear_dev_flag(pcr, PM_L1_2_EN);
+
+   if (option->ltr_en) {
+   u16 val;
+
+   pcie_capability_read_word(pcr->pci, PCI_EXP_DEVCTL2, );
+   if (val & PCI_EXP_DEVCTL2_LTR_EN) {
+   option->ltr_enabled = 1;
+   option->ltr_active = 1;
+   rtsx_set_ltr_latency(pcr, option->ltr_active_latency);
+   } else {
+   option->ltr_enabled = 0;
+   }
+   }
+
+   return 0;
+}
+
+static int rts5249_init_from_hw(struct rtsx_pcr *pcr)
+{
+   struct cr_option *option = &(pcr->option);
+
+   if (check_dev_flag(pcr, ASPM_L1_1_EN | ASPM_L1_2_EN
+   | PM_L1_1_EN | PM_L1_2_EN))
+   option->force_clkreq_0 = 0;
+   else
+   option->force_clkreq_0 = 1;
+
+   return 0;
+}
+
 static int rts5249_extra_init_hw(struct rtsx_pcr *pcr)
 {
+   struct cr_option *option = &(pcr->option);
+
+   rts5249_init_from_cfg(pcr);
+   rts5249_init_from_hw(pcr);
+
rtsx_pci_init_cmd(pcr);
 
/* Rest L1SUB Config */
@@ -125,6 +187,14 @@ static int rts5249_extra_init_hw(struct rtsx_pcr *pcr)
else
rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, PETXCFG, 0xB0, 0x80);
 
+   /* u_force_clkreq_0
+* If 1, CLKREQ# PIN will be forced to drive 0 to request clock
+*/
+   if (option->force_clkreq_0)
+   rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, PETXCFG, 0x80, 0x80);
+   else
+   rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, PETXCFG, 0x80, 0x00);
+
return rtsx_pci_send_cmd(pcr, 100);
 }
 
@@ -353,6 +423,8 @@ static int rtsx_base_switch_output_voltage(struct rtsx_pcr 
*pcr, u8 voltage)
 
 void rts5249_init_params(struct rtsx_pcr *pcr)
 {
+   struct cr_option *option = &(pcr->option);
+
pcr->extra_caps = EXTRA_CAPS_SD_SDR50 | EXTRA_CAPS_SD_SDR104;
pcr->num_slots = 2;
pcr->ops = _pcr_ops;
@@ -372,6 +444,19 @@ void rts5249_init_params(struct rtsx_pcr *pcr)
pcr->ms_pull_ctl_disable_tbl = rts5249_ms_pull_ctl_disable_tbl;
 
pcr->reg_pm_ctrl3 = PM_CTRL3;
+
+   option->dev_flags |= LTR_L1SS_PWR_GATE_CHECK_CARD_EN;
+   option->dev_flags |= LTR_L1SS_PWR_GATE_EN;
+   option->ltr_en = 1;
+   /* init latency of active, idle, L1OFF to 60us, 300us, 3ms */
+   /* 60us:0x883C, 300us:0x892C, 3ms:0x9003 */
+   option->ltr_active_latency = 0x883C;
+   option->ltr_idle_latency = 0x892C;
+   option->ltr_l1off_latency = 0x9003;
+   option->dev_aspm_mode = DEV_ASPM_DYNAMIC;
+   option->l1_snooze_delay = 1;
+   option->ltr_l1off_sspwrgate = 0xAF;
+   option->ltr_l1off_snooze_sspwrgate = 0xAC;
 }
 
 static int rts524a_write_phy(struct rtsx_pcr *pcr, u8 addr, u16 val)
@@ -459,6 +544,54 @@ static int rts524a_extra_init_hw(struct rtsx_pcr *pcr)
return 0;
 }
 
+static void rts5250_set_l1off_cfg_sub_D0(struct rtsx_pcr *pcr, int active)
+{
+   struct cr_option *option = &(pcr->option);
+
+   u32 interrupt = rtsx_pci_readl(pcr, RTSX_BIPR);
+   int card_exist = (interrupt & SD_EXIST) | (interrupt & MS_EXIST);
+   int aspm_L1_1, aspm_L1_2;
+
+   aspm_L1_1 = check_dev_flag(pcr, ASPM_L1_1_EN);
+   aspm_L1_2 = check_dev_flag(pcr, ASPM_L1_2_EN);
+
+   if (active) {
+   /* run, latency: 60us */
+   if (aspm_L1_1) {
+   u8 val = 

Re: [PATCH v9 RESEND 8/9] mfd: rk808: Add RK805 pinctrl support

2017-08-21 Thread Lee Jones
On Mon, 21 Aug 2017, Heiko Stuebner wrote:

> From: Joseph Chen 
> 
> Signed-off-by: Joseph Chen 
> Acked-by: Linus Walleij 
> Acked-for-MFD-by: Lee Jones 
> Signed-off-by: Heiko Stuebner 
> ---
>  drivers/mfd/rk808.c | 1 +
>  1 file changed, 1 insertion(+)

Applied, thanks.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog


Re: [PATCH v9 RESEND 6/9] pinctrl: dt-bindings: add bindings for Rockchip RK805 PMIC

2017-08-21 Thread Lee Jones
On Mon, 21 Aug 2017, Heiko Stuebner wrote:

> From: Joseph Chen 
> 
> Signed-off-by: Joseph Chen 
> Acked-by: Linus Walleij 
> Acked-by: Rob Herring 
> Signed-off-by: Heiko Stuebner 
> ---
>  .../devicetree/bindings/pinctrl/pinctrl-rk805.txt  | 63 
> ++
>  1 file changed, 63 insertions(+)
>  create mode 100644 
> Documentation/devicetree/bindings/pinctrl/pinctrl-rk805.txt

Applied, thanks.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog


Re: [PATCH v9 RESEND 9/9] mfd: rk808: Add RK805 power key support

2017-08-21 Thread Lee Jones
On Mon, 21 Aug 2017, Heiko Stuebner wrote:

> From: Joseph Chen 
> 
> Signed-off-by: Joseph Chen 
> Acked-for-MFD-by: Lee Jones 
> Signed-off-by: Heiko Stuebner 
> ---
>  drivers/mfd/rk808.c | 17 +
>  1 file changed, 17 insertions(+)

Applied, thanks.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog


Re: [PATCH v9 RESEND 7/9] pinctrl: Add pinctrl driver for the RK805 PMIC

2017-08-21 Thread Lee Jones
On Mon, 21 Aug 2017, Heiko Stuebner wrote:

> From: Joseph Chen 
> 
> RK805 is one of Rockchip PMICs family, it has 2 output only GPIOs.
> 
> This driver is also designed for other Rockchip PMICs to expend.
> Different PMIC maybe have different pin features, for example,
> RK816 has one pin which can be used for TS or GPIO(input/out).
> The mainly difference between PMICs pins are pinmux, direction
> and output value, that is 'struct rk805_pin_config'.
> 
> Signed-off-by: Joseph Chen 
> Acked-by: Linus Walleij 
> Signed-off-by: Heiko Stuebner 
> ---
>  drivers/pinctrl/Kconfig |   9 +
>  drivers/pinctrl/Makefile|   1 +
>  drivers/pinctrl/pinctrl-rk805.c | 493 
> 
>  3 files changed, 503 insertions(+)
>  create mode 100644 drivers/pinctrl/pinctrl-rk805.c

Applied, thanks.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog


Re: [rfc patch] sched/topology: fix domain reconstruction memory leakage

2017-08-21 Thread Peter Zijlstra
On Sat, Aug 19, 2017 at 08:10:49AM +0200, Mike Galbraith wrote:
> Greetings,
> 
> While beating on cpu hotplug with the shiny new topology fixes
> backported, my memory poor 8 socket box fairly quickly leaked itself to
> death, 0c0e776a9b0f being the culprit.  With the below applied, box
> took a severe beating overnight without a whimper.
> 
> I'm wondering (ergo rfc) if free_sched_groups() shouldn't be renamed to
> put_sched_groups() instead, with overlapping domains taking a group
> reference reference as well so they can put both sg/sgc rather than put
> one free the other.  Those places that want an explicit free can pass
> free to only explicitly free sg (or use two functions).  Minimalist
> approach works (minus signs, yay), but could perhaps use some "pretty".
> 
> sched/topology: fix domain reconstruction memory leakage

I was sitting on this one:

  
https://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git/commit/?h=sched/core=c63d18dd6ea59eec5cba857835f788943ff9f0d5

is that the same?


Re: [PATCH v2 2/3] pwm: pwm-samsung: fix suspend/resume support

2017-08-21 Thread Thierry Reding
On Mon, Apr 24, 2017 at 12:01:08PM +0200, Bartlomiej Zolnierkiewicz wrote:
> Fix suspend/resume support:
> 
> - add disabled_mask to struct samsung_pwm_chip to track PWM
>   disabled state information in pwm_samsung_{disable,enable}()
> 
> - rename pwm_samsung_config() to __pwm_samsung_config() and
>   add extra force_period parameter to be used during resume
>   (to force tin_ns and tcnt recalculation)
> 
> - add pwm_samsung_config() wrapper for preserving old behavior
> 
> - properly restore PWM configuration in pwm_samsung_resume()
> 
> - remove no longer needed pwm_samsung_suspend()
> 
> - update Copyrights
> 
> Signed-off-by: Bartlomiej Zolnierkiewicz 
> ---
>  drivers/pwm/pwm-samsung.c | 67 
> +--
>  1 file changed, 35 insertions(+), 32 deletions(-)

Applied to for-4.14/drivers, thanks.

Thierry


signature.asc
Description: PGP signature


[PATCH 2/3] ARM: dts: rockchip: add usb nodes for rv1108 SoCs

2017-08-21 Thread Frank Wang
This patch adds usb otg/host controllers and phys nodes for RV1108 SoCs.

Signed-off-by: Frank Wang 
---
 arch/arm/boot/dts/rv1108.dtsi | 73 ++-
 1 file changed, 72 insertions(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/rv1108.dtsi b/arch/arm/boot/dts/rv1108.dtsi
index 25fab0b..2322328 100644
--- a/arch/arm/boot/dts/rv1108.dtsi
+++ b/arch/arm/boot/dts/rv1108.dtsi
@@ -262,8 +262,35 @@
};
 
grf: syscon@1030 {
-   compatible = "rockchip,rv1108-grf", "syscon";
+   compatible = "rockchip,rv1108-grf", "syscon", "simple-mfd";
reg = <0x1030 0x1000>;
+   #address-cells = <1>;
+   #size-cells = <1>;
+
+   u2phy: usb2-phy@100 {
+   compatible = "rockchip,rv1108-usb2phy";
+   reg = <0x100 0x0c>;
+   rockchip,usbgrf = <>;
+   clocks = < SCLK_USBPHY>;
+   clock-names = "phyclk";
+   #clock-cells = <0>;
+   clock-output-names = "usbphy";
+   status = "disabled";
+
+   u2phy_otg: otg-port {
+   #phy-cells = <0>;
+   interrupts = ;
+   interrupt-names = "otg-mux";
+   status = "disabled";
+   };
+
+   u2phy_host: host-port {
+   #phy-cells = <0>;
+   interrupts = ;
+   interrupt-names = "linestate";
+   status = "disabled";
+   };
+   };
};
 
watchdog: wdt@1036 {
@@ -353,6 +380,11 @@
reg = <0x2006 0x1000>;
};
 
+   usbgrf: syscon@202a {
+   compatible = "rockchip,rv1108-usbgrf", "syscon";
+   reg = <0x202a 0x1000>;
+   };
+
cru: clock-controller@2020 {
compatible = "rockchip,rv1108-cru";
reg = <0x2020 0x1000>;
@@ -399,6 +431,45 @@
status = "disabled";
};
 
+   usb_host_ehci: usb@3014 {
+   compatible = "generic-ehci";
+   reg = <0x3014 0x2>;
+   interrupts = ;
+   clocks = < HCLK_HOST0>, <>;
+   clock-names = "usbhost", "utmi";
+   phys = <_host>;
+   phy-names = "usb";
+   status = "disabled";
+   };
+
+   usb_host_ohci: usb@3016 {
+   compatible = "generic-ohci";
+   reg = <0x3016 0x2>;
+   interrupts = ;
+   clocks = < HCLK_HOST0>, <>;
+   clock-names = "usbhost", "utmi";
+   phys = <_host>;
+   phy-names = "usb";
+   status = "disabled";
+   };
+
+   usb_otg: usb@3018 {
+   compatible = "rockchip,rv1108-usb", "rockchip,rk3066-usb",
+"snps,dwc2";
+   reg = <0x3018 0x4>;
+   interrupts = ;
+   clocks = < HCLK_OTG>;
+   clock-names = "otg";
+   dr_mode = "otg";
+   g-np-tx-fifo-size = <16>;
+   g-rx-fifo-size = <280>;
+   g-tx-fifo-size = <256 128 128 64 32 16>;
+   g-use-dma;
+   phys = <_otg>;
+   phy-names = "usb2-phy";
+   status = "disabled";
+   };
+
gic: interrupt-controller@3201 {
compatible = "arm,gic-400";
interrupt-controller;
-- 
2.0.0




Re: [PATCH] ARM: sun8i: a33: add dts for Q8 tablets with different resolution

2017-08-21 Thread Maxime Ripard
On Thu, Aug 17, 2017 at 03:49:26PM +0800, Icenowy Zheng wrote:
> Q8 tablets with Allwinner A33 SoC now come with two kind of LCD, either
> 800x480 or 1024x600.
> 
> In order for sun4i-drm to be able to choose correct LCD configuration,
> two different device trees should be present, one for a resolution.
> 
> Add stub device trees for two resolutions.
> 
> As the sun4i-drm driver still has some problems to support the LCDs, the
> real LCD device nodes are not added to the device tree files.
> 
> Signed-off-by: Icenowy Zheng 

This should be an overlay, ideally applied by the bootloader.

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com


signature.asc
Description: PGP signature


Re: [PATCH v4 00/10] make L2's kvm-clock stable, get rid of pvclock_gtod_copy in KVM

2017-08-21 Thread Denis Plotnikov

ping!

On 02.08.2017 20:11, Paolo Bonzini wrote:

On 02/08/2017 18:49, John Stultz wrote:

On Wed, Aug 2, 2017 at 7:38 AM, Denis Plotnikov
 wrote:

V4:
   * removed "is stable" function with vague definition of stability
 there is the only function which does time with cycle stamp getting
   * some variables renamed
   * some patches split into smaller once
   * atomic64_t usage is replaced with atomic_t

V3:
   Changing the timekeeper interface for clocksource reading looks like
   an overkill to achive the goal of getting cycles stamp for KVM.
   Instead extend the timekeeping interface and add functions which provide
   necessary data: read clocksource with cycles stamp, check whether the
   clock source is stable.

   Use those functions and improve existing timekeeper functionality to
   replace pvclock_gtod_copy scheme in masterclock data calculation.

V2:
   The main goal is to make L2 kvm-clock be stable when it's running over L1
   with stable kvm-clock.

   The patch series is for x86 architecture only. If the series is approved
   I'll do changes for other architectures but I don't have an ability to
   compile and check for every single on (help needed)

   The patch series do the following:

 * change timekeeper interface to get cycles stamp value from
   the timekeeper
 * get rid of pvclock copy in KVM by using the changed timekeeper
   interface: get time and cycles right from the timekeeper
 * make KVM recognize a stable kvm-clock as stable clocksource
   and use the KVM masterclock in this case, which means making
   L2 stable when running over stable L1 kvm-clock


So, from a brief skim, I'm not a big fan of this patchset. Though this
is likely in part due to that I haven't seen anything about *why*
these changes are needed.


 From my selfish KVM maintainer point of view, one advantage is that it
drops knowledge of internal timekeeping functioning from KVM, using
ktime_get_snapshot instead.  These are patches 1-5.  Structuring the
series like this was my idea so I take the blame.

As to patches 6-10, KVM is currently only able to provide vsyscalls if
the host is using the TSC.  However, when using nested virtualization
you have

L0: bare-metal hypervisor (uses TSC)
L1: nested hypervisor (uses kvmclock, can use vsyscall)
L2: nested guest

and L2 cannot use vsyscall because it is not using the TSC.  This series
lets you use the vsyscall in L2 as long as L1 can.

There is one point where I couldn't help Denis as much as I wanted.
That's a definition of what's a "good" clocksource that can be used by
KVM to provide the vsyscall.  I know why the patch is correct, but I
couldn't really define the concept.

In ktime_get_snapshot and struct system_counterval_t's users, they seem
to use "cycles" to map from TSC to ART; this is not unlike kvmclock's
use of "cycles" to map from TSC to nanoseconds at an origin point.
However, it's not clear to me whether "cycles" may be used by
adjust_historical_crosststamp even for non-TSC clocksources (or
non-kvmclock after this series).  It doesn't help that
adjust_historical_crosststamp is essentially dead code, since
get_device_system_crosststamp is always called with a NULL history argument.

I'm also CCing Marcelo who wrote the KVM vsyscall code.

Paolo


Can you briefly explain the issue you're trying to solve, and why you
think this approach is the way to go?
(Its usually a good idea to have such rational included in the patchset)




--
Best,
Denis


[tip:efi/core] efi/arm/arm64: Add missing assignment of efi.config_table

2017-08-21 Thread tip-bot for Ard Biesheuvel
Commit-ID:  9a9de5c044be14c3337ef45174ac8baa568a0f93
Gitweb: http://git.kernel.org/tip/9a9de5c044be14c3337ef45174ac8baa568a0f93
Author: Ard Biesheuvel 
AuthorDate: Fri, 18 Aug 2017 20:49:38 +0100
Committer:  Ingo Molnar 
CommitDate: Mon, 21 Aug 2017 09:43:49 +0200

efi/arm/arm64: Add missing assignment of efi.config_table

The ARM EFI init code never assigns the config_table member of the
efi struct, which means the sysfs device node is missing, and other
in-kernel users will not work correctly. So add the missing assignment.

Note that, for now, the runtime and fw_vendor members are still
omitted. This is deliberate: exposing physical addresses via sysfs nodes
encourages behavior that we would like to avoid on ARM (given how it is
more finicky about using correct memory attributes when mapping memory
in userland that may be mapped by the kernel already as well).

Signed-off-by: Ard Biesheuvel 
Cc: Linus Torvalds 
Cc: Matt Fleming 
Cc: Peter Zijlstra 
Cc: Thomas Gleixner 
Cc: linux-...@vger.kernel.org
Link: http://lkml.kernel.org/r/20170818194947.19347-6-ard.biesheu...@linaro.org
Signed-off-by: Ingo Molnar 
---
 drivers/firmware/efi/arm-init.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/firmware/efi/arm-init.c b/drivers/firmware/efi/arm-init.c
index 0aa4ce7..80d1a88 100644
--- a/drivers/firmware/efi/arm-init.c
+++ b/drivers/firmware/efi/arm-init.c
@@ -145,6 +145,9 @@ static int __init uefi_init(void)
 sizeof(efi_config_table_t),
 arch_tables);
 
+   if (!retval)
+   efi.config_table = (unsigned long)efi.systab->tables;
+
early_memunmap(config_tables, table_size);
 out:
early_memunmap(efi.systab,  sizeof(efi_system_table_t));


[tip:efi/core] efi/reboot: Fall back to original power-off method if EFI_RESET_SHUTDOWN returns

2017-08-21 Thread tip-bot for Hans de Goede
Commit-ID:  b6a3780dad74f6e3d1d45eca843ae623cc3216a8
Gitweb: http://git.kernel.org/tip/b6a3780dad74f6e3d1d45eca843ae623cc3216a8
Author: Hans de Goede 
AuthorDate: Fri, 18 Aug 2017 20:49:39 +0100
Committer:  Ingo Molnar 
CommitDate: Mon, 21 Aug 2017 09:43:50 +0200

efi/reboot: Fall back to original power-off method if EFI_RESET_SHUTDOWN returns

Commit:

  44be28e9dd98 ("x86/reboot: Add EFI reboot quirk for ACPI Hardware Reduced 
flag")

sets pm_power_off to efi_power_off() when the acpi_gbl_reduced_hardware
flag is set.

According to its commit message this is necessary because: "BayTrail-T
class of hardware requires EFI in order to powerdown and reboot and no
other reliable method exists".

But I have a Bay Trail CR tablet where the EFI_RESET_SHUTDOWN call does
not work, it simply returns without doing anything (AFAICT).

So it seems that some Bay Trail devices must use EFI for power-off, while
for others only ACPI works.

Note that efi_power_off() only gets used if the platform code defines
efi_poweroff_required() and that returns true, this currently only ever
happens on x86.

Since on the devices which need ACPI for power-off the EFI_RESET_SHUTDOWN
call simply returns, this patch makes the efi-reboot code remember the
old pm_power_off handler and if EFI_RESET_SHUTDOWN returns it falls back
to calling that.

This seems preferable to dmi-quirking our way out of this, since there
are likely quite a few devices suffering from this.

Signed-off-by: Hans de Goede 
Signed-off-by: Matt Fleming 
Signed-off-by: Ard Biesheuvel 
Cc: Andy Shevchenko 
Cc: Len Brown 
Cc: Linus Torvalds 
Cc: Mark Salter 
Cc: Peter Jones 
Cc: Peter Zijlstra 
Cc: Rafael J. Wysocki 
Cc: Thomas Gleixner 
Cc: linux-...@vger.kernel.org
Link: http://lkml.kernel.org/r/20170818194947.19347-7-ard.biesheu...@linaro.org
Signed-off-by: Ingo Molnar 
---
 drivers/firmware/efi/reboot.c | 12 +++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/firmware/efi/reboot.c b/drivers/firmware/efi/reboot.c
index 62ead9b..7117e2d 100644
--- a/drivers/firmware/efi/reboot.c
+++ b/drivers/firmware/efi/reboot.c
@@ -5,6 +5,8 @@
 #include 
 #include 
 
+void (*orig_pm_power_off)(void);
+
 int efi_reboot_quirk_mode = -1;
 
 void efi_reboot(enum reboot_mode reboot_mode, const char *__unused)
@@ -51,6 +53,12 @@ bool __weak efi_poweroff_required(void)
 static void efi_power_off(void)
 {
efi.reset_system(EFI_RESET_SHUTDOWN, EFI_SUCCESS, 0, NULL);
+   /*
+* The above call should not return, if it does fall back to
+* the original power off method (typically ACPI poweroff).
+*/
+   if (orig_pm_power_off)
+   orig_pm_power_off();
 }
 
 static int __init efi_shutdown_init(void)
@@ -58,8 +66,10 @@ static int __init efi_shutdown_init(void)
if (!efi_enabled(EFI_RUNTIME_SERVICES))
return -ENODEV;
 
-   if (efi_poweroff_required())
+   if (efi_poweroff_required()) {
+   orig_pm_power_off = pm_power_off;
pm_power_off = efi_power_off;
+   }
 
return 0;
 }


[tip:efi/core] efi/libstub/arm64: Use hidden attribute for struct screen_info reference

2017-08-21 Thread tip-bot for Ard Biesheuvel
Commit-ID:  760b61d76da6d6a99eb245ab61abf71ca5415cea
Gitweb: http://git.kernel.org/tip/760b61d76da6d6a99eb245ab61abf71ca5415cea
Author: Ard Biesheuvel 
AuthorDate: Fri, 18 Aug 2017 20:49:35 +0100
Committer:  Ingo Molnar 
CommitDate: Mon, 21 Aug 2017 09:43:49 +0200

efi/libstub/arm64: Use hidden attribute for struct screen_info reference

To prevent the compiler from emitting absolute references to screen_info
when building position independent code, redeclare the symbol with hidden
visibility.

Tested-by: Matthias Kaehlcke 
Signed-off-by: Ard Biesheuvel 
Cc: Linus Torvalds 
Cc: Matt Fleming 
Cc: Peter Zijlstra 
Cc: Thomas Gleixner 
Cc: linux-...@vger.kernel.org
Link: http://lkml.kernel.org/r/20170818194947.19347-3-ard.biesheu...@linaro.org
Signed-off-by: Ingo Molnar 
---
 arch/arm64/include/asm/efi.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/arm64/include/asm/efi.h b/arch/arm64/include/asm/efi.h
index 8f3043a..464ac85 100644
--- a/arch/arm64/include/asm/efi.h
+++ b/arch/arm64/include/asm/efi.h
@@ -81,6 +81,9 @@ static inline unsigned long efi_get_max_initrd_addr(unsigned 
long dram_base,
 #define alloc_screen_info(x...)_info
 #define free_screen_info(x...)
 
+/* redeclare as 'hidden' so the compiler will generate relative references */
+extern struct screen_info screen_info 
__attribute__((__visibility__("hidden")));
+
 static inline void efifb_setup_from_dmi(struct screen_info *si, const char 
*opt)
 {
 }


[tip:efi/core] efi/libstub/arm64: Force 'hidden' visibility for section markers

2017-08-21 Thread tip-bot for Ard Biesheuvel
Commit-ID:  0426a4e68f18d75515414361de9e3e1445d2644e
Gitweb: http://git.kernel.org/tip/0426a4e68f18d75515414361de9e3e1445d2644e
Author: Ard Biesheuvel 
AuthorDate: Fri, 18 Aug 2017 20:49:36 +0100
Committer:  Ingo Molnar 
CommitDate: Mon, 21 Aug 2017 09:43:49 +0200

efi/libstub/arm64: Force 'hidden' visibility for section markers

To prevent the compiler from emitting absolute references to the section
markers when running in PIC mode, override the visibility to 'hidden' for
all contents of asm/sections.h

Tested-by: Matthias Kaehlcke 
Signed-off-by: Ard Biesheuvel 
Cc: Linus Torvalds 
Cc: Matt Fleming 
Cc: Peter Zijlstra 
Cc: Thomas Gleixner 
Cc: linux-...@vger.kernel.org
Link: http://lkml.kernel.org/r/20170818194947.19347-4-ard.biesheu...@linaro.org
Signed-off-by: Ingo Molnar 
---
 drivers/firmware/efi/libstub/arm64-stub.c | 10 +-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/firmware/efi/libstub/arm64-stub.c 
b/drivers/firmware/efi/libstub/arm64-stub.c
index b4c2589..f7a6970 100644
--- a/drivers/firmware/efi/libstub/arm64-stub.c
+++ b/drivers/firmware/efi/libstub/arm64-stub.c
@@ -9,9 +9,17 @@
  * published by the Free Software Foundation.
  *
  */
+
+/*
+ * To prevent the compiler from emitting GOT-indirected (and thus absolute)
+ * references to the section markers, override their visibility as 'hidden'
+ */
+#pragma GCC visibility push(hidden)
+#include 
+#pragma GCC visibility pop
+
 #include 
 #include 
-#include 
 #include 
 
 #include "efistub.h"


[tip:efi/core] efi/libstub/arm64: Set -fpie when building the EFI stub

2017-08-21 Thread tip-bot for Ard Biesheuvel
Commit-ID:  91ee5b21ee026c49e4e7483de69b55b8b47042be
Gitweb: http://git.kernel.org/tip/91ee5b21ee026c49e4e7483de69b55b8b47042be
Author: Ard Biesheuvel 
AuthorDate: Fri, 18 Aug 2017 20:49:37 +0100
Committer:  Ingo Molnar 
CommitDate: Mon, 21 Aug 2017 09:43:49 +0200

efi/libstub/arm64: Set -fpie when building the EFI stub

Clang may emit absolute symbol references when building in non-PIC mode,
even when using the default 'small' code model, which is already mostly
position independent to begin with, due to its use of adrp/add pairs
that have a relative range of +/- 4 GB. The remedy is to pass the -fpie
flag, which can be done safely now that the code has been updated to avoid
GOT indirections (which may be emitted due to the compiler assuming that
the PIC/PIE code may end up in a shared library that is subject to ELF
symbol preemption)

Passing -fpie when building code that needs to execute at an a priori
unknown offset is arguably an improvement in any case, and given that
the recent visibility changes allow the PIC build to pass with GCC as
well, let's add -fpie for all arm64 builds rather than only for Clang.

Tested-by: Matthias Kaehlcke 
Signed-off-by: Ard Biesheuvel 
Cc: Linus Torvalds 
Cc: Matt Fleming 
Cc: Peter Zijlstra 
Cc: Thomas Gleixner 
Cc: linux-...@vger.kernel.org
Link: http://lkml.kernel.org/r/20170818194947.19347-5-ard.biesheu...@linaro.org
Signed-off-by: Ingo Molnar 
---
 drivers/firmware/efi/libstub/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/firmware/efi/libstub/Makefile 
b/drivers/firmware/efi/libstub/Makefile
index 37e24f5..cf81e6c 100644
--- a/drivers/firmware/efi/libstub/Makefile
+++ b/drivers/firmware/efi/libstub/Makefile
@@ -10,7 +10,7 @@ cflags-$(CONFIG_X86)  += -m$(BITS) -D__KERNEL__ -O2 \
   -fPIC -fno-strict-aliasing -mno-red-zone \
   -mno-mmx -mno-sse
 
-cflags-$(CONFIG_ARM64) := $(subst -pg,,$(KBUILD_CFLAGS))
+cflags-$(CONFIG_ARM64) := $(subst -pg,,$(KBUILD_CFLAGS)) -fpie
 cflags-$(CONFIG_ARM)   := $(subst -pg,,$(KBUILD_CFLAGS)) \
   -fno-builtin -fpic -mno-single-pic-base
 


Re: [PATCH 1/7 v2] media: vb2: add bidirectional flag in vb2_queue

2017-08-21 Thread Marek Szyprowski

Hi Stanimir,

On 2017-08-21 11:09, Stanimir Varbanov wrote:

This change is intended to give to the v4l2 drivers a choice to
change the default behavior of the v4l2-core DMA mapping direction
from DMA_TO/FROM_DEVICE (depending on the buffer type CAPTURE or
OUTPUT) to DMA_BIDIRECTIONAL during queue_init time.

Initially the issue with DMA mapping direction has been found in
Venus encoder driver where the hardware (firmware side) adds few
lines padding on bottom of the image buffer, and the consequence
is triggering of IOMMU protection faults.

This will help supporting venus encoder (and probably other drivers
in the future) which wants to map output type of buffers as
read/write.

Signed-off-by: Stanimir Varbanov 


This has been already discussed about a year ago, but it got lost in
meantime, probably due to lack of users. I hope that this time it
finally will get into vb2.

For the reference, see https://patchwork.kernel.org/patch/9388163/


---
v2: move dma_dir into private section.

  drivers/media/v4l2-core/videobuf2-core.c | 17 -
  include/media/videobuf2-core.h   | 13 +
  2 files changed, 21 insertions(+), 9 deletions(-)

diff --git a/drivers/media/v4l2-core/videobuf2-core.c 
b/drivers/media/v4l2-core/videobuf2-core.c
index 0924594989b4..cb115ba6a1d2 100644
--- a/drivers/media/v4l2-core/videobuf2-core.c
+++ b/drivers/media/v4l2-core/videobuf2-core.c
@@ -194,8 +194,6 @@ static void __enqueue_in_driver(struct vb2_buffer *vb);
  static int __vb2_buf_mem_alloc(struct vb2_buffer *vb)
  {
struct vb2_queue *q = vb->vb2_queue;
-   enum dma_data_direction dma_dir =
-   q->is_output ? DMA_TO_DEVICE : DMA_FROM_DEVICE;
void *mem_priv;
int plane;
int ret = -ENOMEM;
@@ -209,7 +207,7 @@ static int __vb2_buf_mem_alloc(struct vb2_buffer *vb)
  
  		mem_priv = call_ptr_memop(vb, alloc,

q->alloc_devs[plane] ? : q->dev,
-   q->dma_attrs, size, dma_dir, q->gfp_flags);
+   q->dma_attrs, size, q->dma_dir, q->gfp_flags);
if (IS_ERR_OR_NULL(mem_priv)) {
if (mem_priv)
ret = PTR_ERR(mem_priv);
@@ -978,8 +976,6 @@ static int __prepare_userptr(struct vb2_buffer *vb, const 
void *pb)
void *mem_priv;
unsigned int plane;
int ret = 0;
-   enum dma_data_direction dma_dir =
-   q->is_output ? DMA_TO_DEVICE : DMA_FROM_DEVICE;
bool reacquired = vb->planes[0].mem_priv == NULL;
  
  	memset(planes, 0, sizeof(planes[0]) * vb->num_planes);

@@ -1030,7 +1026,7 @@ static int __prepare_userptr(struct vb2_buffer *vb, const 
void *pb)
mem_priv = call_ptr_memop(vb, get_userptr,
q->alloc_devs[plane] ? : q->dev,
planes[plane].m.userptr,
-   planes[plane].length, dma_dir);
+   planes[plane].length, q->dma_dir);
if (IS_ERR(mem_priv)) {
dprintk(1, "failed acquiring userspace memory for plane 
%d\n",
plane);
@@ -1096,8 +1092,6 @@ static int __prepare_dmabuf(struct vb2_buffer *vb, const 
void *pb)
void *mem_priv;
unsigned int plane;
int ret = 0;
-   enum dma_data_direction dma_dir =
-   q->is_output ? DMA_TO_DEVICE : DMA_FROM_DEVICE;
bool reacquired = vb->planes[0].mem_priv == NULL;
  
  	memset(planes, 0, sizeof(planes[0]) * vb->num_planes);

@@ -1156,7 +1150,7 @@ static int __prepare_dmabuf(struct vb2_buffer *vb, const 
void *pb)
/* Acquire each plane's memory */
mem_priv = call_ptr_memop(vb, attach_dmabuf,
q->alloc_devs[plane] ? : q->dev,
-   dbuf, planes[plane].length, dma_dir);
+   dbuf, planes[plane].length, q->dma_dir);
if (IS_ERR(mem_priv)) {
dprintk(1, "failed to attach dmabuf\n");
ret = PTR_ERR(mem_priv);
@@ -2003,6 +1997,11 @@ int vb2_core_queue_init(struct vb2_queue *q)
if (q->buf_struct_size == 0)
q->buf_struct_size = sizeof(struct vb2_buffer);
  
+	if (q->bidirectional)

+   q->dma_dir = DMA_BIDIRECTIONAL;
+   else
+   q->dma_dir = q->is_output ? DMA_TO_DEVICE : DMA_FROM_DEVICE;
+
return 0;
  }
  EXPORT_SYMBOL_GPL(vb2_core_queue_init);
diff --git a/include/media/videobuf2-core.h b/include/media/videobuf2-core.h
index cb97c224be73..ef9b64398c8c 100644
--- a/include/media/videobuf2-core.h
+++ b/include/media/videobuf2-core.h
@@ -427,6 +427,16 @@ struct vb2_buf_ops {
   * @dev:  device to use for the default allocation context if the driver
   *doesn't fill in the @alloc_devs array.
   * @dma_attrs:DMA 

Re: [PATCH v2 4/7] ghes_edac: avoid multiple calls to dmi_walk()

2017-08-21 Thread Borislav Petkov
On Thu, Aug 17, 2017 at 09:08:40PM +, Kani, Toshimitsu wrote:
> 1. It creates mc0 and mc1.  
> I think this is because you called edac_mc_alloc() with mc_num 1.

Fixed, see below.

> 
> 2. 'ras-mc-ctl --layout' does not show all DIMMs.

Yap, that's strange.

$ grep . /sys/devices/system/edac/mc/mc0/dimm*/size
/sys/devices/system/edac/mc/mc0/dimm10/size:2048
/sys/devices/system/edac/mc/mc0/dimm11/size:2048
/sys/devices/system/edac/mc/mc0/dimm12/size:2048
/sys/devices/system/edac/mc/mc0/dimm13/size:2048
/sys/devices/system/edac/mc/mc0/dimm14/size:2048
/sys/devices/system/edac/mc/mc0/dimm15/size:2048
/sys/devices/system/edac/mc/mc0/dimm8/size:2048
/sys/devices/system/edac/mc/mc0/dimm9/size:2048
$ ras-mc-ctl --layout
 +---+
 |mc0|
-+---+
memory9: |  2048 MB  |
memory8: |  2048 MB  |
-+---+
memory7: | 0 MB  |
memory6: | 0 MB  |
-+---+
memory5: | 0 MB  |
memory4: | 0 MB  |
-+---+
memory3: | 0 MB  |
memory2: | 0 MB  |
-+---+
memory1: | 0 MB  |
memory0: | 0 MB  |
-+---+

the driver detects them correctly though:

[7.900694] ghes_edac: This system has 16 DIMM sockets.
[7.911366] EDAC DEBUG: ghes_edac_dmidecode: DIMM8: Unbuffered DDR3 RAM size 
= 2048 MB(ECC)
[7.928437] EDAC DEBUG: ghes_edac_dmidecode: type 24, detail 0x80, 
width 72(total 64)
[7.944628] EDAC DEBUG: ghes_edac_dmidecode: DIMM9: Unbuffered DDR3 RAM size 
= 2048 MB(ECC)
[7.961683] EDAC DEBUG: ghes_edac_dmidecode: type 24, detail 0x80, 
width 72(total 64)
[7.977871] EDAC DEBUG: ghes_edac_dmidecode: DIMM10: Unbuffered DDR3 RAM 
size = 2048 MB(ECC)
[7.995105] EDAC DEBUG: ghes_edac_dmidecode: type 24, detail 0x80, 
width 72(total 64)
[8.011291] EDAC DEBUG: ghes_edac_dmidecode: DIMM11: Unbuffered DDR3 RAM 
size = 2048 MB(ECC)
[8.028524] EDAC DEBUG: ghes_edac_dmidecode: type 24, detail 0x80, 
width 72(total 64)
[8.044712] EDAC DEBUG: ghes_edac_dmidecode: DIMM12: Unbuffered DDR3 RAM 
size = 2048 MB(ECC)
[8.061942] EDAC DEBUG: ghes_edac_dmidecode: type 24, detail 0x80, 
width 72(total 64)
[8.078129] EDAC DEBUG: ghes_edac_dmidecode: DIMM13: Unbuffered DDR3 RAM 
size = 2048 MB(ECC)
[8.095360] EDAC DEBUG: ghes_edac_dmidecode: type 24, detail 0x80, 
width 72(total 64)
[8.111547] EDAC DEBUG: ghes_edac_dmidecode: DIMM14: Unbuffered DDR3 RAM 
size = 2048 MB(ECC)
[8.161703] EDAC DEBUG: ghes_edac_dmidecode: type 24, detail 0x80, 
width 72(total 64)
[8.177904] EDAC DEBUG: ghes_edac_dmidecode: DIMM15: Unbuffered DDR3 RAM 
size = 2048 MB(ECC)
[8.195132] EDAC DEBUG: ghes_edac_dmidecode: type 24, detail 0x80, 
width 72(total 64)
[8.211321] EDAC DEBUG: edac_mc_add_mc_with_groups: 
[8.221456] EDAC DEBUG: edac_create_sysfs_mci_device: creating bus mc0
[8.234736] EDAC DEBUG: edac_create_sysfs_mci_device: creating device mc0
[8.248545] EDAC DEBUG: edac_create_sysfs_mci_device: creating dimm8, 
located at memory 8 
[8.265457] EDAC DEBUG: edac_create_dimm_object: creating rank/dimm device 
dimm8
[8.280601] EDAC DEBUG: edac_create_sysfs_mci_device: creating dimm9, 
located at memory 9 
[8.297503] EDAC DEBUG: edac_create_dimm_object: creating rank/dimm device 
dimm9
[8.312650] EDAC DEBUG: edac_create_sysfs_mci_device: creating dimm10, 
located at memory 10 
[8.329900] EDAC DEBUG: edac_create_dimm_object: creating rank/dimm device 
dimm10
[8.345220] EDAC DEBUG: edac_create_sysfs_mci_device: creating dimm11, 
located at memory 11 
[8.362470] EDAC DEBUG: edac_create_dimm_object: creating rank/dimm device 
dimm11
[8.377789] EDAC DEBUG: edac_create_sysfs_mci_device: creating dimm12, 
located at memory 12 
[8.395039] EDAC DEBUG: edac_create_dimm_object: creating rank/dimm device 
dimm12
[8.410358] EDAC DEBUG: edac_create_sysfs_mci_device: creating dimm13, 
located at memory 13 
[8.427608] EDAC DEBUG: edac_create_dimm_object: creating rank/dimm device 
dimm13
[8.442928] EDAC DEBUG: edac_create_sysfs_mci_device: creating dimm14, 
located at memory 14 
[8.460194] EDAC DEBUG: edac_create_dimm_object: creating rank/dimm device 
dimm14
[8.475517] EDAC DEBUG: edac_create_sysfs_mci_device: creating dimm15, 
located at memory 15 
[8.492768] EDAC DEBUG: edac_create_dimm_object: creating rank/dimm device 
dimm15

Mauro?

---
From: Borislav Petkov 
Date: Wed, 16 Aug 2017 10:33:44 +0200
Subject: [PATCH] EDAC, ghes: Model a single, logical memory controller

We're enumerating the DIMMs through a DMI walk and since we can't get
any more detailed topological information about which DIMMs belong to
which memory controller, convert it to a single, logical controller
which contains all the DIMMs.

The error reporting path from GHES ghes_edac_report_mem_error() doesn't
get called in NMI context but add a warning about it to 

[WARNING] stmmac: refcount_t: saturated; leaking memory

2017-08-21 Thread Corentin Labbe
Hello

I got on all my stmmac boards the following warning:

[12605.062840] [ cut here ]
[12605.062956] WARNING: CPU: 0 PID: 15637 at /linux-next/lib/refcount.c:77 
refcount_add_not_zero+0xa8/0xb8
[12605.062972] refcount_t: saturated; leaking memory.
[12605.062987] Modules linked in: iptable_filter ip_tables x_tables 
nfnetlink_log nfnetlink sun8i_ce crypto_engine
[12605.063122] CPU: 0 PID: 15637 Comm: kworker/0:1 Not tainted 
4.13.0-rc5-next-20170817+ #403
[12605.063136] Hardware name: Allwinner sun8i Family
[12605.063161] Workqueue: rpciod rpc_async_schedule
[12605.063186] Backtrace: 
[12605.063222] [] (dump_backtrace) from [] 
(show_stack+0x18/0x1c)
[12605.063241]  r7:c0c51700 r6: r5:600d0013 r4:c0c51700
[12605.063262] [] (show_stack) from [] 
(dump_stack+0xac/0xd8)
[12605.063283] [] (dump_stack) from [] (__warn+0xec/0x104)
[12605.063304]  r10:c064c3c8 r9:c0400ea8 r8:004d r7:0009 r6:c0987468 
r5:
[12605.063319]  r4:ed8cd7b0 r3:00040d00
[12605.063339] [] (__warn) from [] 
(warn_slowpath_fmt+0x40/0x48)
[12605.063359]  r9:ee2c5bb8 r8:ebf8e6c0 r7:c064c3c8 r6:ebf8ee40 r5:0a028725 
r4:c0987440
[12605.063379] [] (warn_slowpath_fmt) from [] 
(refcount_add_not_zero+0xa8/0xb8)
[12605.063395]  r3:c0c5262c r2:c0987440
[12605.063408]  r4:0001
[12605.063427] [] (refcount_add_not_zero) from [] 
(refcount_add+0x10/0x50)
[12605.063443]  r5:0a028725 r4:ee5f4e80
[12605.063465] [] (refcount_add) from [] 
(tcp_gso_segment+0x448/0x47c)
[12605.063486] [] (tcp_gso_segment) from [] 
(tcp4_gso_segment+0x4c/0xac)
[12605.063506]  r10:c08744bc r9:005e r8: r7:0020 r6:4833 
r5:006c
[12605.063520]  r4:ee2c5bb8
[12605.063541] [] (tcp4_gso_segment) from [] 
(inet_gso_segment+0x1a0/0x330)
[12605.063559]  r7: r6:184e r5:006c r4:ee2c5bb8
[12605.063582] [] (inet_gso_segment) from [] 
(skb_mac_gso_segment+0xe8/0x1f4)
[12605.063602]  r10:ee842850 r9:ee9e8000 r8:c0671e8c r7:ee2c5bb8 r6:0008 
r5:0020
[12605.063616]  r4:4833
[12605.063638] [] (skb_mac_gso_segment) from [] 
(__skb_gso_segment+0xd0/0x198)
[12605.063657]  r8: r7:0020 r6:4833 r5:0001 r4:ee2c5bb8
[12605.063679] [] (__skb_gso_segment) from [] 
(validate_xmit_skb+0x124/0x2e4)
[12605.063698]  r9:ee9e8000 r8: r7:0020 r6:4833 r5: 
r4:ee2c5bb8
[12605.063720] [] (validate_xmit_skb) from [] 
(validate_xmit_skb_list+0x38/0x68)
[12605.063740]  r10:ee842850 r9: r8: r7:ee9e8000 r6: 
r5:ee2c5bb8
[12605.063754]  r4:
[12605.063777] [] (validate_xmit_skb_list) from [] 
(sch_direct_xmit+0x154/0x19c)
[12605.063797]  r9: r8:0001 r7:ee9e8000 r6:ee91d800 r5:ee2c5bb8 
r4:ee842800
[12605.063817] [] (sch_direct_xmit) from [] 
(__dev_queue_xmit+0x614/0x7ec)
[12605.063836]  r8:013ba711 r7: r6:0bd4 r5:ee842800 r4:0001
[12605.063858] [] (__dev_queue_xmit) from [] 
(dev_queue_xmit+0x14/0x18)
[12605.063877]  r10: r9:000e r8:ee2c5bb8 r7:ee84210c r6: 
r5:ee842144
[12605.063891]  r4:ee842000
[12605.063913] [] (dev_queue_xmit) from [] 
(ip_finish_output2+0x2e8/0x758)
[12605.063933] [] (ip_finish_output2) from [] 
(ip_finish_output+0x238/0x348)
[12605.063953]  r10:ee9e8000 r9:0001 r8:05dc r7: r6:c0c4a580 
r5:ee336580
[12605.063966]  r4:ee2c5bb8
[12605.063985] [] (ip_finish_output) from [] 
(ip_output+0x10c/0x30c)
[12605.064005]  r10:ee9e8000 r9: r8:3eb6 r7: r6:00291fb3 
r5:ee2c5bb8
[12605.064018]  r4:ef7b1288
[12605.064037] [] (ip_output) from [] 
(ip_local_out+0x48/0x84)
[12605.064057]  r10:ee27f900 r9:00026900 r8:00026900 r7: r6:ee336580 
r5:c0c4a580
[12605.064070]  r4:ee2c5bb8
[12605.064089] [] (ip_local_out) from [] 
(ip_queue_xmit+0x1e8/0x634)
[12605.064107]  r7: r6:ee3368b0 r5:ee336580 r4:ee2c5bb8
[12605.064129] [] (ip_queue_xmit) from [] 
(tcp_transmit_skb+0x444/0x8e4)
[12605.064149]  r10: r9:00026900 r8:00026900 r7: r6: 
r5:ee2c5bb8
[12605.064163]  r4:ee336580
[12605.064184] [] (tcp_transmit_skb) from [] 
(tcp_write_xmit+0x21c/0xfe0)
[12605.064204]  r9:05a8 r8:0a02817d r7: r6:ee2c5b00 r5:0b50 
r4:ee336580
[12605.064225] [] (tcp_write_xmit) from [] 
(__tcp_push_pending_frames+0x3c/0xa4)
[12605.064245]  r10:05a8 r9: r8:0f03 r7:0a02817d r6:8000 
r5:ee2c5b00
[12605.064259]  r4:ee336580
[12605.064280] [] (__tcp_push_pending_frames) from [] 
(tcp_push+0xcc/0x138)
[12605.064294]  r4:ee336580
[12605.064314] [] (tcp_push) from [] 
(do_tcp_sendpages+0x568/0x5b0)
[12605.064331]  r7:c040 r6:0f03 r5:ee2c5b00 r4:ee336580
[12605.064351] [] (do_tcp_sendpages) from [] 
(tcp_sendpage_locked+0xac/0xc8)
[12605.064371]  r10:ed8cddf4 r9:0f03 r8:0f03 r7: r6:0008 
r5:eff47880
[12605.064385]  r4:ee336580
[12605.064405] [] (tcp_sendpage_locked) from [] 
(tcp_sendpage+0x44/0x5c)
[12605.064423]  r7: r6:eff47880 r5:c040 r4:ee336580
[12605.064443] [] (tcp_sendpage) 

[PATCH] iio staging: tsl2x7x: clean up limit checks

2017-08-21 Thread Dan Carpenter
The second part of this patch is probably the most interesting.  We
use "TSL2X7X_MAX_LUX_TABLE_SIZE * 3" as the limit instead of just
"TSL2X7X_MAX_LUX_TABLE_SIZE".  It creates a static checker warning that
we are going of of bounds, but in real life we always hit the break
statement on the last element so it's fine.

The situation is that we normally have arrays with 3 elements of struct
tsl2x7x_lux which has 3 unsigned integers.  If we load the table with
sysfs then we're allow to have 9 elements instead.

So the size of the default table in bytes is sizeof(int) times 3 struct
members times 3 elements.  The original code wrote it as sizeof(int)
times the number of elements in the bigger table (9).  It happens that
9 is the same thing as 3 * 3 but expressing it that way is misleading.

For the second part of the patch, the original code just had an extra
"multiply by three" and now that is removed.  The last element in the
array is always zeroed memory whether this uses the default tables or it
gets loaded with sysfs so we always hit the break statement anyway.

Signed-off-by: Dan Carpenter 

diff --git a/drivers/staging/iio/light/tsl2x7x.h 
b/drivers/staging/iio/light/tsl2x7x.h
index ecae92211216..1beb8d2eb848 100644
--- a/drivers/staging/iio/light/tsl2x7x.h
+++ b/drivers/staging/iio/light/tsl2x7x.h
@@ -23,10 +23,6 @@
 #define __TSL2X7X_H
 #include 
 
-/* Max number of segments allowable in LUX table */
-#define TSL2X7X_MAX_LUX_TABLE_SIZE 9
-#define MAX_DEFAULT_TABLE_BYTES (sizeof(int) * TSL2X7X_MAX_LUX_TABLE_SIZE)
-
 struct iio_dev;
 
 struct tsl2x7x_lux {
@@ -35,6 +31,11 @@ struct tsl2x7x_lux {
unsigned int ch1;
 };
 
+/* Max number of segments allowable in LUX table */
+#define TSL2X7X_MAX_LUX_TABLE_SIZE 9
+/* The default tables are all 3 elements */
+#define MAX_DEFAULT_TABLE_BYTES (sizeof(struct tsl2x7x_lux) * 3)
+
 /**
  * struct tsl2x7x_default_settings - power on defaults unless
  *   overridden by platform data.
diff --git a/drivers/staging/iio/light/tsl2x7x.c 
b/drivers/staging/iio/light/tsl2x7x.c
index 786e93f16ce9..2db1715ff659 100644
--- a/drivers/staging/iio/light/tsl2x7x.c
+++ b/drivers/staging/iio/light/tsl2x7x.c
@@ -1113,7 +1113,7 @@ static ssize_t in_illuminance0_lux_table_show(struct 
device *dev,
int i = 0;
int offset = 0;
 
-   while (i < (TSL2X7X_MAX_LUX_TABLE_SIZE * 3)) {
+   while (i < TSL2X7X_MAX_LUX_TABLE_SIZE) {
offset += snprintf(buf + offset, PAGE_SIZE, "%u,%u,%u,",
chip->tsl2x7x_device_lux[i].ratio,
chip->tsl2x7x_device_lux[i].ch0,


[PATCH] mfd: max77693: Add muic of_compatible in mfd_cell

2017-08-21 Thread Maciej Purski
This patch adds muic of_compatible in order to use the muic device
driver in device tree.

Signed-off-by: Maciej Purski 
---
 drivers/mfd/max77693.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/mfd/max77693.c b/drivers/mfd/max77693.c
index 662ae0d..1c05ea0 100644
--- a/drivers/mfd/max77693.c
+++ b/drivers/mfd/max77693.c
@@ -48,7 +48,10 @@ static const struct mfd_cell max77693_devs[] = {
.name = "max77693-charger",
.of_compatible = "maxim,max77693-charger",
},
-   { .name = "max77693-muic", },
+   {
+   .name = "max77693-muic",
+   .of_compatible = "maxim,max77693-muic",
+   },
{
.name = "max77693-haptic",
.of_compatible = "maxim,max77693-haptic",
-- 
2.7.4



[PATCH v2] PM / AVS: rockchip-io: add io selectors and supplies for RV1108

2017-08-21 Thread David Wu
This adds the necessary data for handling io voltage domains on the RV1108.

Signed-off-by: David Wu 
---
change in v2:
 - Alphabetic order for the binding string

 .../bindings/power/rockchip-io-domain.txt  |  2 ++
 drivers/power/avs/rockchip-io-domain.c | 38 ++
 2 files changed, 40 insertions(+)

diff --git a/Documentation/devicetree/bindings/power/rockchip-io-domain.txt 
b/Documentation/devicetree/bindings/power/rockchip-io-domain.txt
index 43c21fb..4a4766e 100644
--- a/Documentation/devicetree/bindings/power/rockchip-io-domain.txt
+++ b/Documentation/devicetree/bindings/power/rockchip-io-domain.txt
@@ -39,6 +39,8 @@ Required properties:
   - "rockchip,rk3368-pmu-io-voltage-domain" for rk3368 pmu-domains
   - "rockchip,rk3399-io-voltage-domain" for rk3399
   - "rockchip,rk3399-pmu-io-voltage-domain" for rk3399 pmu-domains
+  - "rockchip,rv1108-io-voltage-domain" for rv1108
+  - "rockchip,rv1108-pmu-io-voltage-domain" for rv1108 pmu-domains
 
 Deprecated properties:
 - rockchip,grf: phandle to the syscon managing the "general register files"
diff --git a/drivers/power/avs/rockchip-io-domain.c 
b/drivers/power/avs/rockchip-io-domain.c
index 031a343..75f63e3 100644
--- a/drivers/power/avs/rockchip-io-domain.c
+++ b/drivers/power/avs/rockchip-io-domain.c
@@ -349,6 +349,36 @@ static void rk3399_pmu_iodomain_init(struct 
rockchip_iodomain *iod)
.init = rk3399_pmu_iodomain_init,
 };
 
+static const struct rockchip_iodomain_soc_data soc_data_rv1108 = {
+   .grf_offset = 0x404,
+   .supply_names = {
+   NULL,
+   NULL,
+   NULL,
+   NULL,
+   NULL,
+   NULL,
+   NULL,
+   NULL,
+   NULL,
+   NULL,
+   NULL,
+   "vccio1",
+   "vccio2",
+   "vccio3",
+   "vccio5",
+   "vccio6",
+   },
+
+};
+
+static const struct rockchip_iodomain_soc_data soc_data_rv1108_pmu = {
+   .grf_offset = 0x104,
+   .supply_names = {
+   "pmu",
+   },
+};
+
 static const struct of_device_id rockchip_iodomain_match[] = {
{
.compatible = "rockchip,rk3188-io-voltage-domain",
@@ -382,6 +412,14 @@ static void rk3399_pmu_iodomain_init(struct 
rockchip_iodomain *iod)
.compatible = "rockchip,rk3399-pmu-io-voltage-domain",
.data = (void *)_data_rk3399_pmu
},
+   {
+   .compatible = "rockchip,rv1108-io-voltage-domain",
+   .data = (void *)_data_rv1108
+   },
+   {
+   .compatible = "rockchip,rv1108-pmu-io-voltage-domain",
+   .data = (void *)_data_rv1108_pmu
+   },
{ /* sentinel */ },
 };
 MODULE_DEVICE_TABLE(of, rockchip_iodomain_match);
-- 
1.9.1




[PATCH] drm: virtio: constify drm_fb_helper_funcs

2017-08-21 Thread Arvind Yadav
drm_fb_helper_funcs are not supposed to change at runtime.
All functions working with drm_fb_helper_funcs provided
by  work with const drm_fb_helper_funcs.
So mark the non-const structs as const.

Signed-off-by: Arvind Yadav 
---
 drivers/gpu/drm/virtio/virtgpu_fb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/virtio/virtgpu_fb.c 
b/drivers/gpu/drm/virtio/virtgpu_fb.c
index 33df067..61f33ec 100644
--- a/drivers/gpu/drm/virtio/virtgpu_fb.c
+++ b/drivers/gpu/drm/virtio/virtgpu_fb.c
@@ -309,7 +309,7 @@ static int virtio_gpu_fbdev_destroy(struct drm_device *dev,
 
return 0;
 }
-static struct drm_fb_helper_funcs virtio_gpu_fb_helper_funcs = {
+static const struct drm_fb_helper_funcs virtio_gpu_fb_helper_funcs = {
.fb_probe = virtio_gpufb_create,
 };
 
-- 
1.9.1



[PATCH] extcon: max77693: Allow MHL attach notifier

2017-08-21 Thread Maciej Purski
Without this patch extcon couldn't notify attaching MHL cable.

Signed-off-by: Maciej Purski 
---
 drivers/extcon/extcon-max77693.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/extcon/extcon-max77693.c b/drivers/extcon/extcon-max77693.c
index 6216346..b325be8 100644
--- a/drivers/extcon/extcon-max77693.c
+++ b/drivers/extcon/extcon-max77693.c
@@ -811,8 +811,7 @@ static int max77693_muic_chg_handler(struct 
max77693_muic_info *info)
 */
extcon_set_state_sync(info->edev, EXTCON_CHG_USB_DCP,
attached);
-   if (!cable_attached)
-   extcon_set_state_sync(info->edev,
+   extcon_set_state_sync(info->edev,
EXTCON_DISP_MHL, cable_attached);
break;
}
-- 
2.7.4



Re: [PATCHv6 2/4] mfd: da9052: make touchscreen registration optional

2017-08-21 Thread Lee Jones
On Tue, 18 Jul 2017, Sebastian Reichel wrote:

> If the touchscreen pins are used as general purpose analogue
> input, the touchscreen driver should not be used. The pins
> will be handled by the existing hwmon driver instead.
> 
> Signed-off-by: Sebastian Reichel 
> ---
>  drivers/mfd/da9052-core.c | 26 +++---
>  1 file changed, 23 insertions(+), 3 deletions(-)

For my own reference:
  Acked-for-MFD-by: Lee Jones 

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog


[PATCH v2 1/9] devicetree: bindings: Add sata port phy config parameters in ahci-ceva

2017-08-21 Thread Michal Simek
From: Anurag Kumar Vulisha 

This patch adds device tree bindings for sata port phy parameters
in the ahci-ceva.txt file.

Signed-off-by: Anurag Kumar Vulisha 
Signed-off-by: Michal Simek 
---

Changes in v2:
- DT fix naming in parameters description use pN instead of phy
  reported by Rob

 .../devicetree/bindings/ata/ahci-ceva.txt  | 39 ++
 1 file changed, 39 insertions(+)

diff --git a/Documentation/devicetree/bindings/ata/ahci-ceva.txt 
b/Documentation/devicetree/bindings/ata/ahci-ceva.txt
index 7ca8b976c13a..7561cc4de371 100644
--- a/Documentation/devicetree/bindings/ata/ahci-ceva.txt
+++ b/Documentation/devicetree/bindings/ata/ahci-ceva.txt
@@ -5,6 +5,36 @@ Required properties:
   - compatible: Compatibility string. Must be 'ceva,ahci-1v84'.
   - clocks: Input clock specifier. Refer to common clock bindings.
   - interrupts: Interrupt specifier. Refer to interrupt binding.
+  - ceva,p0-cominit-params: OOB timing value for COMINIT parameter for port 0.
+  - ceva,p1-cominit-params: OOB timing value for COMINIT parameter for port 1.
+   The fields for the above parameter must be as shown 
below:
+   ceva,pN-cominit-params = /bits/ 8 ;
+   CINMP : COMINIT Negate Minimum Period.
+   CIBGN : COMINIT Burst Gap Nominal.
+   CIBGMX: COMINIT Burst Gap Maximum.
+   CIBGMN: COMINIT Burst Gap Minimum.
+  - ceva,p0-comwake-params: OOB timing value for COMWAKE parameter for port 0.
+  - ceva,p1-comwake-params: OOB timing value for COMWAKE parameter for port 1.
+   The fields for the above parameter must be as shown 
below:
+   ceva,pN-comwake-params = /bits/ 8 ;
+   CWBGMN: COMWAKE Burst Gap Minimum.
+   CWBGMX: COMWAKE Burst Gap Maximum.
+   CWBGN: COMWAKE Burst Gap Nominal.
+   CWNMP: COMWAKE Negate Minimum Period.
+  - ceva,p0-burst-params: Burst timing value for COM parameter for port 0.
+  - ceva,p1-burst-params: Burst timing value for COM parameter for port 1.
+   The fields for the above parameter must be as shown 
below:
+   ceva,pN-burst-params = /bits/ 8 ;
+   BMX: COM Burst Maximum.
+   BNM: COM Burst Nominal.
+   SFD: Signal Failure Detection value.
+   PTST: Partial to Slumber timer value.
+  - ceva,p0-retry-params: Retry interval timing value for port 0.
+  - ceva,p1-retry-params: Retry interval timing value for port 1.
+   The fields for the above parameter must be as shown 
below:
+   ceva,pN-retry-params = /bits/ 16 ;
+   RIT:  Retry Interval Timer.
+   RCT:  Rate Change Timer.
 
 Optional properties:
   - ceva,broken-gen2: limit to gen1 speed instead of gen2.
@@ -16,5 +46,14 @@ Examples:
interrupt-parent = <>;
interrupts = <0 133 4>;
clocks = < SATA_CLK_ID>;
+   ceva,p0-cominit-params = /bits/ 8 <0x0F 0x25 0x18 0x29>;
+   ceva,p0-comwake-params = /bits/ 8 <0x04 0x0B 0x08 0x0F>;
+   ceva,p0-burst-params = /bits/ 8 <0x0A 0x08 0x4A 0x06>;
+   ceva,p0-retry-params = /bits/ 16 <0x0216 0x7F06>;
+
+   ceva,p1-cominit-params = /bits/ 8 <0x0F 0x25 0x18 0x29>;
+   ceva,p1-comwake-params = /bits/ 8 <0x04 0x0B 0x08 0x0F>;
+   ceva,p1-burst-params = /bits/ 8 <0x0A 0x08 0x4A 0x06>;
+   ceva,p1-retry-params = /bits/ 16 <0x0216 0x7F06>;
ceva,broken-gen2;
};
-- 
1.9.1



[PATCH v2 0/9] Ata ceva patches

2017-08-21 Thread Michal Simek
Hi,

this patchset contains the latest changes which are available in Xilinx tree.

Thanks,
Michal

Changes in v2:
- DT fix naming in parameters description use pN instead of phy
  reported by Rob

Anurag Kumar Vulisha (9):
  devicetree: bindings: Add sata port phy config parameters in ahci-ceva
  ata: ceva: Move sata port phy oob settings to device-tree
  ata: ceva: Add gen 3 mode support in driver
  ata: ceva: Disable Device Sleep capability
  ata: ceva: Make RxWaterMark value as module parameter
  ata: ceva: Add CCI support for SATA if CCI is enabled
  ata: ceva: Correct the AXI bus configuration for SATA ports
  ata: ceva: Correct the suspend and resume logic for SATA
  ata: ceva: Add SMMU support for SATA IP

 .../devicetree/bindings/ata/ahci-ceva.txt  |  39 
 drivers/ata/ahci_ceva.c| 197 +
 2 files changed, 198 insertions(+), 38 deletions(-)

-- 
1.9.1



[PATCH v2 4/9] ata: ceva: Disable Device Sleep capability

2017-08-21 Thread Michal Simek
From: Anurag Kumar Vulisha 

Since CEVA controller does not support Device Sleep capability,
we need to clear that feature by clearing the DEVSLP bit in word78
of IDENTIFY DEVICE data. This patch does the same.

Signed-off-by: Anurag Kumar Vulisha 
Signed-off-by: Michal Simek 
---

Changes in v2: None

 drivers/ata/ahci_ceva.c | 18 ++
 1 file changed, 18 insertions(+)

diff --git a/drivers/ata/ahci_ceva.c b/drivers/ata/ahci_ceva.c
index aa32c8a0f083..b63fab2507fa 100644
--- a/drivers/ata/ahci_ceva.c
+++ b/drivers/ata/ahci_ceva.c
@@ -81,8 +81,26 @@ struct ceva_ahci_priv {
int flags;
 };
 
+static unsigned int ceva_ahci_read_id(struct ata_device *dev,
+   struct ata_taskfile *tf, u16 *id)
+{
+   u32 err_mask;
+
+   err_mask = ata_do_dev_read_id(dev, tf, id);
+   if (err_mask)
+   return err_mask;
+   /*
+* Since CEVA controller does not support device sleep feature, we
+* need to clear DEVSLP (bit 8) in word78 of the IDENTIFY DEVICE data.
+*/
+   id[ATA_ID_FEATURE_SUPP] &= cpu_to_le16(~(1 << 8));
+
+   return 0;
+}
+
 static struct ata_port_operations ahci_ceva_ops = {
.inherits = _platform_ops,
+   .read_id = ceva_ahci_read_id,
 };
 
 static const struct ata_port_info ahci_ceva_port_info = {
-- 
1.9.1



Re: [PATCH 0/2] extend PWM framework to support PWM dead-times

2017-08-21 Thread Thierry Reding
On Mon, Aug 21, 2017 at 01:23:08PM +0300, m18063 wrote:
> Hi Thierry,
> 
> Thank you for your response. I added few comments below.
> 
> Thank you,
> Claudiu
> 
> On 21.08.2017 11:25, Thierry Reding wrote:
> > On Tue, May 09, 2017 at 03:15:51PM +0300, Claudiu Beznea wrote:
> >> Hi all,
> >>
> >> Please give feedback on these patches which extends the PWM
> >> framework in order to support multiple PWM signal types.
> >> Since I didn't receive any inputs on RFC series I'm resending it as
> >> normal patch series.
> >>
> >> The current patch series add the following PWM signal types:
> >> - PWM complementary signals
> >> - PWM push-pull signal
> >>
> >> Definition of PWM complementary mode:
> >> For a PWM controllers with more than one outputs per PWM channel,
> >> e.g. with 2 outputs per PWM channels, the PWM complementary signals
> >> have opposite levels, same duration and same starting times,
> >> as in the following diagram:
> >>
> >> ________
> >> PWMH __|  |__|  |__|  |__|  |__
> >>  __________
> >> PWML   |__|  |__|  |__|  |__|
> >><--T-->
> >> Where T is the signal period.
> >>
> >> Definition of PWM push-pull mode:
> >> For PWM controllers with more than one outputs per PWM channel,
> >> e.g. with 2 outputs per PWM channel, the PWM push-pull signals
> >> have same levels, same duration and are delayed until the begining
> >> of the next period, as in the following diagram:
> >>
> >> __  __
> >> PWMH __|  ||  |
> >>   __  __
> >> PWML |  ||  |__
> >><--T-->
> >>
> >> Where T is the signal period.
> >>
> >> These output signals could be configured by setting PWM mode
> >> (a new input in sysfs has been added in order to support this
> >> operation).
> >>
> >> root@sama5d2-xplained:/sys/devices/platform/ahb/ahb:apb/f802c000.pwm/pwm/pwmchip0/pwm2#
> >>  ls -l
> >> -r--r--r--1 root root  4096 Feb  9 10:54 capture
> >> -rw-r--r--1 root root  4096 Feb  9 10:54 duty_cycle
> >> -rw-r--r--1 root root  4096 Feb  9 10:54 enable
> >> -rw-r--r--1 root root  4096 Feb  9 10:54 mode
> >> -rw-r--r--1 root root  4096 Feb  9 10:54 period
> >> -rw-r--r--1 root root  4096 Feb  9 10:55 polarity
> >> drwxr-xr-x2 root root 0 Feb  9 10:54 power
> >> -rw-r--r--1 root root  4096 Feb  9 10:54 uevent
> >>
> >> The PWM push-pull mode could be usefull in applications like
> >> half bridge converters.
> > 
> > Sorry for taking an absurdly long time to get back to you on this.
> > 
> > One problem I see with this is that the PWM framework is built on the
> > assumption that we have a single output per PWM channel. This becomes
> > important when you start adding features such as this because now the
> > users have no way of determining whether or not the PWM they retrieve
> > will actually be able to do what they want.
> I was thinking that the framework is there to offer support in configuring
> the underlying hardware without taking into account how many outputs per
> PWM channels are actually present. It is true I only worked with 
> Atmel/Microchip
> PWM controllers which for instance, SAMA5 SoC has a PWM controller
> with 2 outputs per PWM channel. Taking into account that the driver is
> already mainlined I though that the user is aware of what he is using
> (either a one output per PWM channel controller, or 2 outputs or
> more than 2) and about the underlying hardware support. I understand your
> position on this. I'm just explaining myself on the approach I've chose
> for this implementation.

So currently we assume that there will be (at least) one output per PWM
channel. However there are currently no drivers that actually use any
output other than the "primary" one.

That means, even if there are currently PWM controllers that support
multiple outputs per PWM channel, we have no code making assumptions
about it.

Before we can add code that makes any assumptions about the number of
outputs per PWM channel, we have to add facitilities for such code to
detect capabilities, so that they can deal with PWMs that don't match
what they need.

> > For example, let's say you have a half bridge converter driver in the
> > kernel and it does a pwm_get() to obtain a PWM to use. There's nothing
> > preventing it from using a simple one-output PWM and there's no way to
> > check that we're actually doing something wrong.
> I understand your position here. I've chose this approach taking into
> account that the user of the PWM will be aware of the capabilities
> of the underlying hardware because I worked on a controller which already
> has a mainlined driver and which has more than one output per PWM channel
> and I believe there are also other controllers with this kind of capability
> and with already mainlined driver (e.g. reading the code of STM32 PWM driver
> I saw a bool type 

Re: [PATCH v4] livepatch: introduce shadow variable API

2017-08-21 Thread Petr Mladek
On Fri 2017-08-18 16:25:42, Joe Lawrence wrote:
> On 08/17/2017 10:05 AM, Petr Mladek wrote:
> > On Mon 2017-08-14 16:02:43, Joe Lawrence wrote:
> >> [ ... snip ... ]
> >> +  /* Allocate a new shadow variable for use inside the lock below */
> >> +  new_shadow = kzalloc(size + sizeof(*new_shadow), gfp_flags);
> > 
> > We should print an error message when the memory cannot be allocated.
> > Otherwise we will return NULL without explanation. It will be
> > especially helpful when a caller forgets to check for NULL.
> 
> Interesting, I hadn't seen this checkpatch complaint before:
> 
> WARNING: Possible unnecessary 'out of memory' message
> #416: FILE: kernel/livepatch/shadow.c:143:
> +   if (!new_shadow) {
> +   pr_err("failed to allocate shadow variable <0x%p, %lu>\n",
> 
> Discussion thread:
> https://lkml.org/lkml/2014/6/10/382

Interesting, I was not aware of this.

> Think the stack trace that the memory subsystem would emit is good
> enough, or would you like to see  for debugging purposes?

I agree that the backtrace should be enough to locate the problematic call
quickly. Feel free to omit it.

Now, I just need to update my patterns when looking for problematic
code.

Best Regards,
Petr


Re: [PATCH v7 3/4] lib/cmdline.c Remove quotes symmetrically.

2017-08-21 Thread Michal Suchánek
On Mon, 21 Aug 2017 18:27:12 +0800
Baoquan He  wrote:

> On 08/17/17 at 10:14pm, Michal Suchanek wrote:
> > Remove quotes from argument value only if there is qoute on both
> > sides.
> > 
> > Signed-off-by: Michal Suchanek   
> 
> Sounds reasonable. Just for curiosity, do we have chance to pass in
> option with a single '"'?

No, we don't. Perhaps it would work if it was at the end of the
commandline.

next_arg checks that quoting is closed.

It was possible but undocumented with previous behavior - you would
place the quote in the middle and the closing quote at start or end so
that next_arg would remove the closing quote but not the one in the
middle.

It would be also possible with shell-like backslash escaping but that
is not implemented.

Thanks

Michal


Re: [PATCH 1/7 v2] media: vb2: add bidirectional flag in vb2_queue

2017-08-21 Thread Stanimir Varbanov
Hi,

On 08/21/2017 01:21 PM, Hans Verkuil wrote:
> On 08/21/2017 11:29 AM, Marek Szyprowski wrote:
>> Hi Stanimir,
>>
>> On 2017-08-21 11:09, Stanimir Varbanov wrote:
>>> This change is intended to give to the v4l2 drivers a choice to
>>> change the default behavior of the v4l2-core DMA mapping direction
>>> from DMA_TO/FROM_DEVICE (depending on the buffer type CAPTURE or
>>> OUTPUT) to DMA_BIDIRECTIONAL during queue_init time.
>>>
>>> Initially the issue with DMA mapping direction has been found in
>>> Venus encoder driver where the hardware (firmware side) adds few
>>> lines padding on bottom of the image buffer, and the consequence
>>> is triggering of IOMMU protection faults.
>>>
>>> This will help supporting venus encoder (and probably other drivers
>>> in the future) which wants to map output type of buffers as
>>> read/write.
>>>
>>> Signed-off-by: Stanimir Varbanov 
>>
>> This has been already discussed about a year ago, but it got lost in
>> meantime, probably due to lack of users. I hope that this time it
>> finally will get into vb2.
>>
>> For the reference, see https://patchwork.kernel.org/patch/9388163/
> 
> Interesting.
> 
> Stanimir, I like your implementation better than the macro in the old
> patch. But as it said there, videobuf2-dma-sg/contig/vmalloc.c have references
> to DMA_FROM_DEVICE that won't work with BIDIRECTIONAL, so those need
> to be adapted as well. I missed that when I reviewed your patch :-(
Thanks for catching this, I didn't thought too much about usrptr. Sent v3.

-- 
regards,
Stan


Re: [RFC 1/2] misc: Add vboxguest driver for Virtual Box Guest integration

2017-08-21 Thread Hans de Goede

Hi,

On 14-08-17 14:15, Hans de Goede wrote:

Hi,

On 14-08-17 11:30, Arnd Bergmann wrote:

On Sat, Aug 12, 2017 at 11:56 PM, Hans de Goede  wrote:

On 11-08-17 23:23, Arnd Bergmann wrote:

On Fri, Aug 11, 2017 at 3:23 PM, Hans de Goede 
wrote:
Most of the issues I would normally comment on are already moot based
on the assumption that we won't be able to make substantial changes to
either the user space portion or the hypervisor side.


+/**
+ * Inflate the balloon by one chunk.
+ *
+ * The caller owns the balloon mutex.
+ *
+ * @returns VBox status code
+ * @param   gdevThe Guest extension device.
+ * @param   chunk_idx  Index of the chunk.
+ */
+static int vbg_balloon_inflate(PVBOXGUESTDEVEXT gdev, u32 chunk_idx)
+{
+   VMMDevChangeMemBalloon *req = gdev->mem_balloon.change_req;
+   struct page **pages;
+   int i, rc;
+
+   pages = kmalloc(sizeof(*pages) *
VMMDEV_MEMORY_BALLOON_CHUNK_PAGES,
+   GFP_KERNEL | __GFP_NOWARN);
+   if (!pages)
+   return VERR_NO_MEMORY;
+
+   req->header.size = sizeof(*req);
+   req->inflate = true;
+   req->pages = VMMDEV_MEMORY_BALLOON_CHUNK_PAGES;



The balloon section seems to be rather simplistic with its ioctl
interface.
Ideally this should use CONFIG_BALLOON_COMPACTION and an
oom notifier like the virtio_balloon driver does. Yes, I realize that only
one of the six (or more) balloon drivers we have in the kernel does it ;-)



The way the balloon code works is that the baloon-size is fully controlled
by the host, all the guest-additions do is wait for an event indicating that
the host wants to change it and then call this ioctl which will get the
desired balloon size from the host and tries to adjust the size accordingly.

Hooking into the oom killer is not really useful because there is no way we
can indicate to the host we are running low on mem and I don't think that
trying to shrink the balloon to be smaller then the host requested size
is a good idea.


Are you sure the guest can't just claim the memory back by using it?


I don't think so the original code certainly does not do anything of
the sorts, the balloon code uses alloc_page(GFP_KERNEL | __GFP_NOWARN)
and only calls __free_page() again on the pages after a successful
deflate request to the host.

So first we tell the host we want a chunk (1MiB worth of pages) back and
only if the host says ok do we call __free_page which means it can
get used for something else again.


Ok, so while working on the final cleanups of the code I realized that
the kernel driver will actually re-claim the memory without the host
indicating that this is ok when the vboxservice which monitors for
host events to change the balloon size dies. When it dies the kernel
tries to reclaim all the memory from the host and this seems to work fine.

So we could hook up to an OOM signal and try to reclaim some memory here
then, but the out-of-tree version of the driver does not do this.

Michael, Knut, what is the intended behavior of the kernel here?

I'm also thinking that under Linux since we never use userspace to
alloc memory for the balloon, we don't need to involve userspace at
all, the drivers interrupt handler could detect the event that the
host wants to change the balloonsize itself and start a workqueue
item which then asks for what the new size should be and do the
adjustment all inside the kernel.  I think that will even lead to
simpler code as we no longer need to track the balloon userspace
owner and do reclaim when it dies.

Typing this out I really see no reason to not do this inside the
kernel, so I think I'm going to implement that right away / for
the [RFC v2] I plan to post later today or tomorrow.

Regards,

Hans






Michael, Knut can you shed some light on this ?


Usually that is how the balloon drivers work: the host asks the guest
to free up some memory, and the guest frees up memory that it
tells to the host, but if the guest runs out of memory, it just starts using
it again and the host faults in empty pages.

For CONFIG_BALLOON_COMPACTION, you don't even need that,
you just put some memory into the balloon before you take some
other page out that is required for compaction. This might be less
of an issue here when the balloon always operates on 1MB chunks.





+*/
+   if (cbData <= sizeof(au64Buf) &&
+   VBOXGUEST_IOCTL_STRIP_SIZE(uCmd) !=
+   VBOXGUEST_IOCTL_STRIP_SIZE(VBOXGUEST_IOCTL_VMMREQUEST(0))) {
+   pvBufFree = NULL;
+   pvBuf = [0];
+   } else {
+   /* __GFP_DMA32 for VBOXGUEST_IOCTL_VMMREQUEST */
+   pvBufFree = pvBuf = kmalloc(cbData, GFP_KERNEL |
__GFP_DMA32);
+   if (!pvBuf)
+   return -ENOMEM;
+   }
+   if (copy_from_user(pvBuf, (void *)ulArg, cbData) == 0) {





I'd also change the commands
to not always do both read and write, but only whichever applies. This

[PATCH 3/6] hid: make device_attribute const

2017-08-21 Thread Bhumika Goyal
Make this const as it is only passed as an argument to the
function device_create_file and device_remove_file and the corresponding
arguments are of type const.
Done using Coccinelle

Signed-off-by: Bhumika Goyal 
---
 drivers/hid/hid-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 9bc9116..24e929c 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1662,7 +1662,7 @@ static bool hid_hiddev(struct hid_device *hdev)
.size = HID_MAX_DESCRIPTOR_SIZE,
 };
 
-static struct device_attribute dev_attr_country = {
+static const struct device_attribute dev_attr_country = {
.attr = { .name = "country", .mode = 0444 },
.show = show_country,
 };
-- 
1.9.1



[PATCH 0/6] drivers: make device_attribute const

2017-08-21 Thread Bhumika Goyal
Make these const. Done using Coccinelle.

@match disable optional_qualifier@
identifier s;
@@
static struct device_attribute s = {...};

@ref@
position p;
identifier match.s;
@@
s@p

@good1@
identifier match.s;
expression e1;
position ref.p;
@@
device_remove_file(e1,@p,...)

@good2@
identifier match.s;
expression e1;
position ref.p;
@@
device_create_file(e1,@p,...)


@bad depends on  !good1 && !good2@
position ref.p;
identifier match.s;
@@
s@p

@depends on forall !bad disable optional_qualifier@
identifier match.s;
@@
static
+ const
struct device_attribute s;

Bhumika Goyal (6):
  ACPI: make device_attribute const
  nbd: make device_attribute const
  hid: make device_attribute const
  qlogic:  make device_attribute const
  platform/x86: make device_attribute const
  power: supply: make device_attribute const

 drivers/acpi/battery.c   | 2 +-
 drivers/acpi/sbs.c   | 2 +-
 drivers/block/nbd.c  | 2 +-
 drivers/hid/hid-core.c   | 2 +-
 drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c | 4 ++--
 drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c| 6 +++---
 drivers/platform/x86/classmate-laptop.c  | 6 +++---
 drivers/platform/x86/intel-rst.c | 4 ++--
 drivers/power/supply/olpc_battery.c  | 2 +-
 9 files changed, 15 insertions(+), 15 deletions(-)

-- 
1.9.1



[PATCH 1/6] ACPI: make device_attribute const

2017-08-21 Thread Bhumika Goyal
Make these const as they are only passed as an argument to the function
device_create_file and device_remove_file and the corresponding
arguments are of type const.
Done using Coccinelle

Signed-off-by: Bhumika Goyal 
---
 drivers/acpi/battery.c | 2 +-
 drivers/acpi/sbs.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
index 1cbb88d..13e7b56 100644
--- a/drivers/acpi/battery.c
+++ b/drivers/acpi/battery.c
@@ -620,7 +620,7 @@ static ssize_t acpi_battery_alarm_store(struct device *dev,
return count;
 }
 
-static struct device_attribute alarm_attr = {
+static const struct device_attribute alarm_attr = {
.attr = {.name = "alarm", .mode = 0644},
.show = acpi_battery_alarm_show,
.store = acpi_battery_alarm_store,
diff --git a/drivers/acpi/sbs.c b/drivers/acpi/sbs.c
index a184637..a2428e9 100644
--- a/drivers/acpi/sbs.c
+++ b/drivers/acpi/sbs.c
@@ -474,7 +474,7 @@ static ssize_t acpi_battery_alarm_store(struct device *dev,
return count;
 }
 
-static struct device_attribute alarm_attr = {
+static const struct device_attribute alarm_attr = {
.attr = {.name = "alarm", .mode = 0644},
.show = acpi_battery_alarm_show,
.store = acpi_battery_alarm_store,
-- 
1.9.1



Re: [PATCH v2] irqchip: uniphier-aidet: add UniPhier AIDET irqchip driver

2017-08-21 Thread Marc Zyngier
On 21/08/17 11:54, Masahiro Yamada wrote:

>>> + /* parent is GIC */
>>> + parent_fwspec.fwnode = domain->parent->fwnode;
>>> + parent_fwspec.param_count = 3;
>>> + parent_fwspec.param[0] = 0; /* SPI */
>>> + parent_fwspec.param[1] = hwirq;
>>> + parent_fwspec.param[2] = IRQ_TYPE_LEVEL_HIGH;   /* properly set later 
>>> */
>>
>> Why defer it to later? You already have the right information in "type",
>> so you might as well provide it immediately.
> 
> 
> Because .irq_set_type() will set it up
> before the IRQ is really in use.
> 
> 
> If we look gic_irq_domain_alloc() implementation,
> it does not care "type".
> 
> gic_set_type() will manipulate hardware registers.

But that's out of the scope of this driver. Whatever the GIC driver does
(or doesn't), you should pass it the right information.

> Having said that, it shouldn't hurt to set type here.
Exactly.

Thanks,

M.
-- 
Jazz is not dead. It just smells funny...


[PATCH V3] dmaengine: qcom-bam: Process multiple pending descriptors

2017-08-21 Thread Sricharan R
The bam dmaengine has a circular FIFO to which we
add hw descriptors that describes the transaction.
The FIFO has space for about 4096 hw descriptors.

Currently we add one descriptor and wait for it to
complete with interrupt and then add the next pending
descriptor. In this way, the FIFO is underutilized
since only one descriptor is processed at a time, although
there is space in FIFO for the BAM to process more.

Instead keep adding descriptors to FIFO till its full,
that allows BAM to continue to work on the next descriptor
immediately after signalling completion interrupt for the
previous descriptor.

Also when the client has not set the DMA_PREP_INTERRUPT for
a descriptor, then do not configure BAM to trigger a interrupt
upon completion of that descriptor. This way we get a interrupt
only for the descriptor for which DMA_PREP_INTERRUPT was
requested and there signal completion of all the previous completed
descriptors. So we still do callbacks for all requested descriptors,
but just that the number of interrupts are reduced.

CURRENT:

--  ---   ---
|DES 0| |DESC 1|  |DESC 2 + INT |
--  ---   ---
   |   ||
   |   ||
INTERRUPT:   (INT)   (INT)(INT)
CALLBACK: (CB)(CB) (CB)

MTD_SPEEDTEST READ PAGE: 3560 KiB/s
MTD_SPEEDTEST WRITE PAGE: 2664 KiB/s
IOZONE READ: 2456 KB/s
IOZONE WRITE: 1230 KB/s

bam dma interrupts (after tests): 96508

CHANGE:

--  ----
|DES 0| |DESC 1   |DESC 2 + INT |
--  ---   --
|
|
  (INT)
  (CB for 0, 1, 2)

MTD_SPEEDTEST READ PAGE: 3860 KiB/s
MTD_SPEEDTEST WRITE PAGE: 2837 KiB/s
IOZONE READ: 2677 KB/s
IOZONE WRITE: 1308 KB/s

bam dma interrupts (after tests): 58806

Signed-off-by: Sricharan R 
Tested-by: Abhishek Sahu 
---
 [V3] Removed the use of is_busy variable and corrected
  terminate_all, added tags
  Please note that this will cause a merge conflict with
  https://patchwork.kernel.org/patch/9874691/ if that goes
  in first.

 drivers/dma/qcom/bam_dma.c | 169 +
 1 file changed, 109 insertions(+), 60 deletions(-)

diff --git a/drivers/dma/qcom/bam_dma.c b/drivers/dma/qcom/bam_dma.c
index 03c4eb3..ad58634 100644
--- a/drivers/dma/qcom/bam_dma.c
+++ b/drivers/dma/qcom/bam_dma.c
@@ -46,6 +46,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -77,6 +78,8 @@ struct bam_async_desc {
 
struct bam_desc_hw *curr_desc;
 
+   /* list node for the desc in the bam_chan list of descriptors */
+   struct list_head desc_node;
enum dma_transfer_direction dir;
size_t length;
struct bam_desc_hw desc[0];
@@ -346,6 +349,8 @@ struct reg_offset_data {
 #define BAM_DESC_FIFO_SIZE SZ_32K
 #define MAX_DESCRIPTORS (BAM_DESC_FIFO_SIZE / sizeof(struct bam_desc_hw) - 1)
 #define BAM_FIFO_SIZE  (SZ_32K - 8)
+#define IS_BUSY(chan)  (CIRC_SPACE(bchan->tail, bchan->head,\
+MAX_DESCRIPTORS + 1) == 0)
 
 struct bam_chan {
struct virt_dma_chan vc;
@@ -355,8 +360,6 @@ struct bam_chan {
/* configuration from device tree */
u32 id;
 
-   struct bam_async_desc *curr_txd;/* current running dma */
-
/* runtime configuration */
struct dma_slave_config slave;
 
@@ -371,6 +374,8 @@ struct bam_chan {
unsigned int initialized;   /* is the channel hw initialized? */
unsigned int paused;/* is the channel paused? */
unsigned int reconfigure;   /* new slave config? */
+   /* list of descriptors currently processed */
+   struct list_head desc_list;
 
struct list_head node;
 };
@@ -538,7 +543,7 @@ static void bam_free_chan(struct dma_chan *chan)
 
vchan_free_chan_resources(to_virt_chan(chan));
 
-   if (bchan->curr_txd) {
+   if (!list_empty(>desc_list)) {
dev_err(bchan->bdev->dev, "Cannot free busy channel\n");
goto err;
}
@@ -631,8 +636,6 @@ static struct dma_async_tx_descriptor 
*bam_prep_slave_sg(struct dma_chan *chan,
 
if (flags & DMA_PREP_INTERRUPT)
async_desc->flags |= DESC_FLAG_EOT;
-   else
-   async_desc->flags |= DESC_FLAG_INT;
 
async_desc->num_desc = num_alloc;
async_desc->curr_desc = async_desc->desc;
@@ -680,14 +683,16 @@ static struct dma_async_tx_descriptor 
*bam_prep_slave_sg(struct dma_chan *chan,
 static int bam_dma_terminate_all(struct dma_chan *chan)
 {
struct 

Re: [linux-next][bisected c64e09ce] sysctl command hung indefinitely

2017-08-21 Thread Stephen Rothwell
Hi Michal,

On Mon, 21 Aug 2017 09:50:01 +0200 Michal Hocko  wrote:
>
> commit 69885605ee3ba681deb54021e3df645f46589ba1
> Author: Michal Hocko 
> Date:   Mon Aug 21 09:46:04 2017 +0200
> 
> mmotm: mm-page_alloc-rip-out-zonelist_order_zone-fix
> 
> Abdul has noticed that reading sysctl vm.numa_zonelist_order
> read will never terminate. This is because of
> http://lkml.kernel.org/r/20170714080006.7250-2-mho...@kernel.org
> where the reading side doesn't update ppos and so the reader will
> never get 0. Return back to proc_dostring which does all the necessary
> stuff.
> 
> Reported-by: Abdul Haleem 
> Signed-off-by: Michal Hocko 

I have added that to linux-next for tomorrow.

-- 
Cheers,
Stephen Rothwell


Re: [PATCH v3 2/4] mmc: sdhci-pxav2: switch to managed clk and sdhci_pltfm_unregister()

2017-08-21 Thread Adrian Hunter
On 15/08/17 18:45, Masahiro Yamada wrote:
> The difference between sdhci_pxav2_remove() and sdhci_pltfm_unregister()
> is clk_put().  It will go away by using the managed resource clk, then
> sdhci_pltfm_unregister() can be reused.
> 
> Also, rename the jump labels to say what the goto does. (Coding style
> suggested by Documentation/process/coding-style.rst)
> 
> Signed-off-by: Masahiro Yamada 

Cc'ing Jisheng Zhang, but looks ok to me.

Acked-by: Adrian Hunter 

> ---
> 
> Changes in v3:
>   - Newly added
> 
> Changes in v2: None
> 
>  drivers/mmc/host/sdhci-pxav2.c | 30 +++---
>  1 file changed, 7 insertions(+), 23 deletions(-)
> 
> diff --git a/drivers/mmc/host/sdhci-pxav2.c b/drivers/mmc/host/sdhci-pxav2.c
> index 995083ce1c46..8986f9d9cf98 100644
> --- a/drivers/mmc/host/sdhci-pxav2.c
> +++ b/drivers/mmc/host/sdhci-pxav2.c
> @@ -178,17 +178,17 @@ static int sdhci_pxav2_probe(struct platform_device 
> *pdev)
>  
>   pltfm_host = sdhci_priv(host);
>  
> - clk = clk_get(dev, "PXA-SDHCLK");
> + clk = devm_clk_get(dev, "PXA-SDHCLK");
>   if (IS_ERR(clk)) {
>   dev_err(dev, "failed to get io clock\n");
>   ret = PTR_ERR(clk);
> - goto err_clk_get;
> + goto free;
>   }
>   pltfm_host->clk = clk;
>   ret = clk_prepare_enable(clk);
>   if (ret) {
>   dev_err(>dev, "failed to enable io clock\n");
> - goto err_clk_enable;
> + goto free;
>   }
>  
>   host->quirks = SDHCI_QUIRK_BROKEN_ADMA
> @@ -223,34 +223,18 @@ static int sdhci_pxav2_probe(struct platform_device 
> *pdev)
>   ret = sdhci_add_host(host);
>   if (ret) {
>   dev_err(>dev, "failed to add host\n");
> - goto err_add_host;
> + goto disable_clk;
>   }
>  
>   return 0;
>  
> -err_add_host:
> +disable_clk:
>   clk_disable_unprepare(clk);
> -err_clk_enable:
> - clk_put(clk);
> -err_clk_get:
> +free:
>   sdhci_pltfm_free(pdev);
>   return ret;
>  }
>  
> -static int sdhci_pxav2_remove(struct platform_device *pdev)
> -{
> - struct sdhci_host *host = platform_get_drvdata(pdev);
> - struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
> -
> - sdhci_remove_host(host, 1);
> -
> - clk_disable_unprepare(pltfm_host->clk);
> - clk_put(pltfm_host->clk);
> - sdhci_pltfm_free(pdev);
> -
> - return 0;
> -}
> -
>  static struct platform_driver sdhci_pxav2_driver = {
>   .driver = {
>   .name   = "sdhci-pxav2",
> @@ -258,7 +242,7 @@ static struct platform_driver sdhci_pxav2_driver = {
>   .pm = _pltfm_pmops,
>   },
>   .probe  = sdhci_pxav2_probe,
> - .remove = sdhci_pxav2_remove,
> + .remove = sdhci_pltfm_unregister,
>  };
>  
>  module_platform_driver(sdhci_pxav2_driver);
> 



Re: [PATCH 0/3] Fix y2038 issues for security/keys subsystem

2017-08-21 Thread Baolin Wang
Hi David and James,

On 9 August 2017 at 16:28, David Howells  wrote:
> The rxrpc patch isn't part of the security/keys subsystem.  I'll push it
> to the network tree.  The other two I'll push to James.

Could you apply this patch serials if there are no other comments? Thanks.

-- 
Baolin.wang
Best Regards


[PATCH] i2c: busses: make i2c_adapter_quirks const

2017-08-21 Thread Bhumika Goyal
Make these const as they are only stored as a reference in the quirks
field of an i2c_adapter structure, which is const.

Done using Coccinelle:
@match disable optional_qualifier@
identifier s;
@@
static struct i2c_adapter_quirks s = {...};

@ref@
position p;
identifier match.s;
@@
s@p

@good1@
identifier y;
position ref.p;
identifier match.s;
@@
struct i2c_adapter y = {...,.quirks=@p,...};

@good2@
struct i2c_adapter y;
identifier match.s;
position ref.p;
@@
y.quirks = @p

@bad depends on  !good1 && !good2@
position ref.p;
identifier match.s;
@@
s@p

@depends on forall !bad disable optional_qualifier@
identifier match.s;
@@
static
+ const
struct i2c_adapter_quirks s;

Signed-off-by: Bhumika Goyal 
---
 drivers/i2c/busses/i2c-at91.c | 2 +-
 drivers/i2c/busses/i2c-cpm.c  | 2 +-
 drivers/i2c/busses/i2c-mlxcpld.c  | 2 +-
 drivers/i2c/busses/i2c-opal.c | 2 +-
 drivers/i2c/busses/i2c-powermac.c | 2 +-
 drivers/i2c/busses/i2c-qup.c  | 2 +-
 drivers/i2c/busses/i2c-tegra.c| 2 +-
 7 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/i2c/busses/i2c-at91.c b/drivers/i2c/busses/i2c-at91.c
index 38dd61d..bfd1fdf 100644
--- a/drivers/i2c/busses/i2c-at91.c
+++ b/drivers/i2c/busses/i2c-at91.c
@@ -809,7 +809,7 @@ static int at91_twi_xfer(struct i2c_adapter *adap, struct 
i2c_msg *msg, int num)
  * The hardware can handle at most two messages concatenated by a
  * repeated start via it's internal address feature.
  */
-static struct i2c_adapter_quirks at91_twi_quirks = {
+static const struct i2c_adapter_quirks at91_twi_quirks = {
.flags = I2C_AQ_COMB | I2C_AQ_COMB_WRITE_FIRST | I2C_AQ_COMB_SAME_ADDR,
.max_comb_1st_msg_len = 3,
 };
diff --git a/drivers/i2c/busses/i2c-cpm.c b/drivers/i2c/busses/i2c-cpm.c
index d89bde2..8a8ca94 100644
--- a/drivers/i2c/busses/i2c-cpm.c
+++ b/drivers/i2c/busses/i2c-cpm.c
@@ -413,7 +413,7 @@ static u32 cpm_i2c_func(struct i2c_adapter *adap)
 };
 
 /* CPM_MAX_READ is also limiting writes according to the code! */
-static struct i2c_adapter_quirks cpm_i2c_quirks = {
+static const struct i2c_adapter_quirks cpm_i2c_quirks = {
.max_num_msgs = CPM_MAXBD,
.max_read_len = CPM_MAX_READ,
.max_write_len = CPM_MAX_READ,
diff --git a/drivers/i2c/busses/i2c-mlxcpld.c b/drivers/i2c/busses/i2c-mlxcpld.c
index d271e6a..4c28fa2 100644
--- a/drivers/i2c/busses/i2c-mlxcpld.c
+++ b/drivers/i2c/busses/i2c-mlxcpld.c
@@ -433,7 +433,7 @@ static u32 mlxcpld_i2c_func(struct i2c_adapter *adap)
.functionality  = mlxcpld_i2c_func
 };
 
-static struct i2c_adapter_quirks mlxcpld_i2c_quirks = {
+static const struct i2c_adapter_quirks mlxcpld_i2c_quirks = {
.flags = I2C_AQ_COMB_WRITE_THEN_READ,
.max_read_len = MLXCPLD_I2C_DATA_REG_SZ - MLXCPLD_I2C_MAX_ADDR_LEN,
.max_write_len = MLXCPLD_I2C_DATA_REG_SZ,
diff --git a/drivers/i2c/busses/i2c-opal.c b/drivers/i2c/busses/i2c-opal.c
index 11e2a1f..0aabb7e 100644
--- a/drivers/i2c/busses/i2c-opal.c
+++ b/drivers/i2c/busses/i2c-opal.c
@@ -204,7 +204,7 @@ static u32 i2c_opal_func(struct i2c_adapter *adapter)
  * For two messages, we basically support simple smbus transactions of a
  * write-then-anything.
  */
-static struct i2c_adapter_quirks i2c_opal_quirks = {
+static const struct i2c_adapter_quirks i2c_opal_quirks = {
.flags = I2C_AQ_COMB | I2C_AQ_COMB_WRITE_FIRST | I2C_AQ_COMB_SAME_ADDR,
.max_comb_1st_msg_len = 4,
 };
diff --git a/drivers/i2c/busses/i2c-powermac.c 
b/drivers/i2c/busses/i2c-powermac.c
index ef9c858..f2a2067 100644
--- a/drivers/i2c/busses/i2c-powermac.c
+++ b/drivers/i2c/busses/i2c-powermac.c
@@ -197,7 +197,7 @@ static u32 i2c_powermac_func(struct i2c_adapter * adapter)
.functionality  = i2c_powermac_func,
 };
 
-static struct i2c_adapter_quirks i2c_powermac_quirks = {
+static const struct i2c_adapter_quirks i2c_powermac_quirks = {
.max_num_msgs = 1,
 };
 
diff --git a/drivers/i2c/busses/i2c-qup.c b/drivers/i2c/busses/i2c-qup.c
index 1902d8a..08f8e01 100644
--- a/drivers/i2c/busses/i2c-qup.c
+++ b/drivers/i2c/busses/i2c-qup.c
@@ -1396,7 +1396,7 @@ static u32 qup_i2c_func(struct i2c_adapter *adap)
  * the end of the read, the length of the read is specified as one byte
  * which limits the possible read to 256 (QUP_READ_LIMIT) bytes.
  */
-static struct i2c_adapter_quirks qup_i2c_quirks = {
+static const struct i2c_adapter_quirks qup_i2c_quirks = {
.max_read_len = QUP_READ_LIMIT,
 };
 
diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c
index a238844..60292d2 100644
--- a/drivers/i2c/busses/i2c-tegra.c
+++ b/drivers/i2c/busses/i2c-tegra.c
@@ -793,7 +793,7 @@ static void tegra_i2c_parse_dt(struct tegra_i2c_dev 
*i2c_dev)
 };
 
 /* payload size is only 12 bit */
-static struct i2c_adapter_quirks tegra_i2c_quirks = {
+static const struct i2c_adapter_quirks tegra_i2c_quirks = {
.max_read_len = 4096,
.max_write_len = 4096,
 };
-- 
1.9.1



Re: [PATCH 0/6] drivers: make device_attribute const

2017-08-21 Thread Rafael J. Wysocki
On Mon, Aug 21, 2017 at 1:43 PM, Bhumika Goyal  wrote:
> Make these const. Done using Coccinelle.
>
> @match disable optional_qualifier@
> identifier s;
> @@
> static struct device_attribute s = {...};
>
> @ref@
> position p;
> identifier match.s;
> @@
> s@p
>
> @good1@
> identifier match.s;
> expression e1;
> position ref.p;
> @@
> device_remove_file(e1,@p,...)
>
> @good2@
> identifier match.s;
> expression e1;
> position ref.p;
> @@
> device_create_file(e1,@p,...)
>
>
> @bad depends on  !good1 && !good2@
> position ref.p;
> identifier match.s;
> @@
> s@p
>
> @depends on forall !bad disable optional_qualifier@
> identifier match.s;
> @@
> static
> + const
> struct device_attribute s;
>
> Bhumika Goyal (6):
>   ACPI: make device_attribute const
>   nbd: make device_attribute const
>   hid: make device_attribute const
>   qlogic:  make device_attribute const
>   platform/x86: make device_attribute const
>   power: supply: make device_attribute const

It would be better to send these patches separately, because they
touch code maintained by different people and I guess no one will take
the whole series.

I'll take care of the ACPI one, but the rest needs to go in via their
proper trees.

Thanks,
Rafael


RE: [PATCH 1/1] Revert "mfd: da9061: Fix to remove BBAT_CONT register from chip model"

2017-08-21 Thread Steve Twiss
On 21 August 2017 08:50, Lee Jones wrote:

Hi Lee,

> To: Steve Twiss
> Cc: linux-arm-ker...@lists.infradead.org; linux-kernel@vger.kernel.org
> Subject: Re: [PATCH 1/1] Revert "mfd: da9061: Fix to remove BBAT_CONT 
> register from chip model"
> 
> On Tue, 15 Aug 2017, Lee Jones wrote:
> 
> > This patch was applied to the MFD twice, causing unwanted behavour.
> >
> > This reverts commit b77eb79acca3203883e8d8dbc7f2b842def1bff8.
> >
> > Fixes: b77eb79acca3 ("mfd: da9061: Fix to remove BBAT_CONT register from 
> > chip model")
> > Reported-by: Steve Twiss 
> > Signed-off-by: Lee Jones 
> > ---
> >  drivers/mfd/da9062-core.c | 6 ++
> >  1 file changed, 6 insertions(+)
> 
> Steve, It would be good to obtain a {Reviewed|Acked}-by from you
> before applying.
>

Sure.

> > diff --git a/drivers/mfd/da9062-core.c b/drivers/mfd/da9062-core.c
> > index fbe0f245ce8e..fe1811523e4a 100644
> > --- a/drivers/mfd/da9062-core.c
> > +++ b/drivers/mfd/da9062-core.c
> > @@ -645,6 +645,9 @@ static const struct regmap_range 
> > da9062_aa_readable_ranges[] = {
> > .range_min = DA9062AA_VLDO1_B,
> > .range_max = DA9062AA_VLDO4_B,
> > }, {
> > +   .range_min = DA9062AA_BBAT_CONT,
> > +   .range_max = DA9062AA_BBAT_CONT,
> > +   }, {
> > .range_min = DA9062AA_INTERFACE,
> > .range_max = DA9062AA_CONFIG_E,
> > }, {
> > @@ -721,6 +724,9 @@ static const struct regmap_range 
> > da9062_aa_writeable_ranges[] = {
> > .range_min = DA9062AA_VLDO1_B,
> > .range_max = DA9062AA_VLDO4_B,
> > }, {
> > +   .range_min = DA9062AA_BBAT_CONT,
> > +   .range_max = DA9062AA_BBAT_CONT,
> > +   }, {
> > .range_min = DA9062AA_GP_ID_0,
> > .range_max = DA9062AA_GP_ID_19,
> > },

This looks good. Thanks for the changes.

Reviewed-by: Steve Twiss 
Acked-by: Steve Twiss 

Regards,
Steve


Re: [PATCH] staging: lustre: fix structure size for ARM OABI

2017-08-21 Thread Cihangir Akturk
On Sun, Aug 20, 2017 at 03:52:26AM +0100, James Simmons wrote:
> 
> > On Aug 17, 2017, at 10:26, Greg KH  wrote:
> > > 
> > > On Wed, Aug 16, 2017 at 05:44:15PM +0300, Cihangir Akturk wrote:
> > >> When building the kernel for the ARM architecture without setting
> > >> CONFIG_AEABI, size of struct lov_user_md_v3 and struct lov_mds_md_v3
> > >> differs, due to different alignment requirements of OABI and EABI.
> 
> I have to ask are you testing the lustre on ARM?

No, I was just compiling the kernel for ARM architecture, and I hit
this issue. If it's possible, I can give it a try with a bunch of
raspberry pis or another cheap board?

>  
> > >> Marking the anonymous union within struct lov_user_md_v3 as
> > >> '_packed' solves this issue. Otherwise we get the following
> > >> error:
> > >> 
> > >> drivers/staging/lustre/lustre/lov/lov_pack.c:352:2: note: in expansion
> > >> of macro ‘BUILD_BUG_ON’
> > >>  BUILD_BUG_ON(sizeof(lum) != sizeof(struct lov_mds_md_v3));
> > >> 
> > >> Signed-off-by: Cihangir Akturk 
> > >> ---
> > >> drivers/staging/lustre/lustre/include/lustre/lustre_user.h | 2 +-
> > >> 1 file changed, 1 insertion(+), 1 deletion(-)
> > > 
> > > This file is no longer in the tree :(
> > 
> > With James' recent patch series, this has moved to 
> > include/uapi/linux/lustre/lustre_user.h
> 
> BTW is __packed valid for UAPI headers?



[PATCH 1/5] btrfs: Use common error handling code in tree_mod_log_eb_copy()

2017-08-21 Thread SF Markus Elfring
From: Markus Elfring 
Date: Mon, 21 Aug 2017 09:36:48 +0200

Add a jump target so that a bit of exception handling can be better reused
in this function.

Signed-off-by: Markus Elfring 
---
 fs/btrfs/ctree.c | 14 ++
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
index 6d49db7d86be..d29cf946ebf9 100644
--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
@@ -823,17 +823,13 @@ tree_mod_log_eb_copy(struct btrfs_fs_info *fs_info, 
struct extent_buffer *dst,
for (i = 0; i < nr_items; i++) {
tm_list_rem[i] = alloc_tree_mod_elem(src, i + src_offset,
MOD_LOG_KEY_REMOVE, GFP_NOFS);
-   if (!tm_list_rem[i]) {
-   ret = -ENOMEM;
-   goto free_tms;
-   }
+   if (!tm_list_rem[i])
+   goto e_nomem;
 
tm_list_add[i] = alloc_tree_mod_elem(dst, i + dst_offset,
MOD_LOG_KEY_ADD, GFP_NOFS);
-   if (!tm_list_add[i]) {
-   ret = -ENOMEM;
-   goto free_tms;
-   }
+   if (!tm_list_add[i])
+   goto e_nomem;
}
 
if (tree_mod_dont_log(fs_info, NULL))
@@ -854,6 +850,8 @@ tree_mod_log_eb_copy(struct btrfs_fs_info *fs_info, struct 
extent_buffer *dst,
 
return 0;
 
+e_nomem:
+   ret = -ENOMEM;
 free_tms:
for (i = 0; i < nr_items * 2; i++) {
if (tm_list[i] && !RB_EMPTY_NODE(_list[i]->node))
-- 
2.14.0



[PATCH 2/5] btrfs: Use common error handling code in __btrfs_free_extent()

2017-08-21 Thread SF Markus Elfring
From: Markus Elfring 
Date: Mon, 21 Aug 2017 10:03:00 +0200

Add a jump target so that a bit of exception handling can be better reused
at the end of this function.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring 
---
 fs/btrfs/extent-tree.c | 69 --
 1 file changed, 27 insertions(+), 42 deletions(-)

diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 116c5615d6c2..c6b7aca88491 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -6913,10 +6913,9 @@ static int __btrfs_free_extent(struct btrfs_trans_handle 
*trans,
ret = remove_extent_backref(trans, info, path, NULL,
refs_to_drop,
is_data, _ref);
-   if (ret) {
-   btrfs_abort_transaction(trans, ret);
-   goto out;
-   }
+   if (ret)
+   goto abort_transaction;
+
btrfs_release_path(path);
path->leave_spinning = 1;
 
@@ -6962,10 +6961,9 @@ static int __btrfs_free_extent(struct btrfs_trans_handle 
*trans,
if (ret > 0)
btrfs_print_leaf(path->nodes[0]);
}
-   if (ret < 0) {
-   btrfs_abort_transaction(trans, ret);
-   goto out;
-   }
+   if (ret < 0)
+   goto abort_transaction;
+
extent_slot = path->slots[0];
}
} else if (WARN_ON(ret == -ENOENT)) {
@@ -6974,11 +6972,9 @@ static int __btrfs_free_extent(struct btrfs_trans_handle 
*trans,
"unable to find ref byte nr %llu parent %llu root %llu  
owner %llu offset %llu",
bytenr, parent, root_objectid, owner_objectid,
owner_offset);
-   btrfs_abort_transaction(trans, ret);
-   goto out;
+   goto abort_transaction;
} else {
-   btrfs_abort_transaction(trans, ret);
-   goto out;
+   goto abort_transaction;
}
 
leaf = path->nodes[0];
@@ -6988,10 +6984,8 @@ static int __btrfs_free_extent(struct btrfs_trans_handle 
*trans,
BUG_ON(found_extent || extent_slot != path->slots[0]);
ret = convert_extent_item_v0(trans, info, path, owner_objectid,
 0);
-   if (ret < 0) {
-   btrfs_abort_transaction(trans, ret);
-   goto out;
-   }
+   if (ret < 0)
+   goto abort_transaction;
 
btrfs_release_path(path);
path->leave_spinning = 1;
@@ -7008,10 +7002,8 @@ static int __btrfs_free_extent(struct btrfs_trans_handle 
*trans,
ret, bytenr);
btrfs_print_leaf(path->nodes[0]);
}
-   if (ret < 0) {
-   btrfs_abort_transaction(trans, ret);
-   goto out;
-   }
+   if (ret < 0)
+   goto abort_transaction;
 
extent_slot = path->slots[0];
leaf = path->nodes[0];
@@ -7035,8 +7027,7 @@ static int __btrfs_free_extent(struct btrfs_trans_handle 
*trans,
  "trying to drop %d refs but we only have %Lu for 
bytenr %Lu",
  refs_to_drop, refs, bytenr);
ret = -EINVAL;
-   btrfs_abort_transaction(trans, ret);
-   goto out;
+   goto abort_transaction;
}
refs -= refs_to_drop;
 
@@ -7057,10 +7048,8 @@ static int __btrfs_free_extent(struct btrfs_trans_handle 
*trans,
ret = remove_extent_backref(trans, info, path,
iref, refs_to_drop,
is_data, _ref);
-   if (ret) {
-   btrfs_abort_transaction(trans, ret);
-   goto out;
-   }
+   if (ret)
+   goto abort_transaction;
}
} else {
if (found_extent) {
@@ -7078,37 +7067,33 @@ static int __btrfs_free_extent(struct 
btrfs_trans_handle *trans,
last_ref = 1;
ret = btrfs_del_items(trans, extent_root, path, path->slots[0],
  num_to_del);
-   if (ret) {
-   

[PATCH] drivers: tty: Fix improper spaces and braces

2017-08-21 Thread Himanshu Jha
Fixes improper spacing by adding/subtracting necessary spaces
around expression and keywords, and removing unnecessary braces.

Signed-off-by: Himanshu Jha 
---
 drivers/tty/amiserial.c | 107 +++-
 1 file changed, 51 insertions(+), 56 deletions(-)

diff --git a/drivers/tty/amiserial.c b/drivers/tty/amiserial.c
index 4b057f8..bd07f50 100644
--- a/drivers/tty/amiserial.c
+++ b/drivers/tty/amiserial.c
@@ -16,8 +16,8 @@
  * Richard Lucock 28/12/99
  *
  *  Copyright (C) 1991, 1992  Linus Torvalds
- *  Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 
- * 1998, 1999  Theodore Ts'o
+ *  Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997,
+ * 1998, 1999  Theodore Ts'o
  *
  */
 
@@ -25,8 +25,8 @@
  * Serial driver configuration section.  Here are the various options:
  *
  * SERIAL_PARANOIA_CHECK
- * Check the magic number for the async_structure where
- * ever possible.
+ * Check the magic number for the async_structure where
+ * ever possible.
  */
 
 #include 
@@ -44,7 +44,7 @@
 
 #if defined(MODULE) && defined(SERIAL_DEBUG_MCOUNT)
 #define DBG_CNT(s) printk("(%s): [%x] refc=%d, serc=%d, ttyc=%d -> %s\n", \
- tty->name, (info->tport.flags), 
serial_driver->refcount,info->count,tty->count,s)
+tty->name, (info->tport.flags), serial_driver->refcount, info->count, 
tty->count, s)
 #else
 #define DBG_CNT(s)
 #endif
@@ -103,7 +103,7 @@ struct serial_state {
int ignore_status_mask;
int timeout;
int quot;
-   int IER;/* Interrupt Enable Register */
+   int IER;/* Interrupt Enable Register */
int MCR;/* Modem control register */
int x_char; /* xon/xoff character */
 };
@@ -237,12 +237,12 @@ static void rs_start(struct tty_struct *tty)
  * rs_interrupt() should try to keep the interrupt handler as fast as
  * possible.  After you are done making modifications, it is not a bad
  * idea to do:
- * 
+ *
  * gcc -S -DKERNEL -Wall -Wstrict-prototypes -O6 -fomit-frame-pointer serial.c
  *
  * and look at the resulting assemble code in serial.s.
  *
- * - Ted Ts'o (ty...@mit.edu), 7-Mar-93
+ * - Ted Ts'o (ty...@mit.edu), 7-Mar-93
  * ---
  */
 
@@ -262,10 +262,10 @@ static void receive_chars(struct serial_state *info)
custom.intreq = IF_RBF;
mb();
 
-   if((serdatr & 0x1ff) == 0)
-   status |= UART_LSR_BI;
-   if(serdatr & SDR_OVRUN)
-   status |= UART_LSR_OE;
+   if ((serdatr & 0x1ff) == 0)
+status |= UART_LSR_BI;
+   if (serdatr & SDR_OVRUN)
+   status |= UART_LSR_OE;
 
ch = serdatr & 0xff;
icount->rx++;
@@ -390,9 +390,8 @@ static void check_modem_status(struct serial_state *info)
/* update input line counters */
if (dstatus & SER_DSR)
icount->dsr++;
-   if (dstatus & SER_DCD) {
+   if (dstatus & SER_DCD)
icount->dcd++;
-   }
if (dstatus & SER_CTS)
icount->cts++;
wake_up_interruptible(>delta_msr_wait);
@@ -446,7 +445,7 @@ static void check_modem_status(struct serial_state *info)
}
 }
 
-static irqreturn_t ser_vbl_int( int irq, void *data)
+static irqreturn_t ser_vbl_int(int irq, void *data)
 {
/* vbl is just a periodic interrupt we tie into to update modem status 
*/
struct serial_state *info = data;
@@ -454,7 +453,7 @@ static irqreturn_t ser_vbl_int( int irq, void *data)
 * TBD - is it better to unregister from this interrupt or to
 * ignore it if MSI is clear ?
 */
-   if(info->IER & UART_IER_MSI)
+   if (info->IER & UART_IER_MSI)
  check_modem_status(info);
return IRQ_HANDLED;
 }
@@ -516,7 +515,7 @@ static int startup(struct tty_struct *tty, struct 
serial_state *info)
 {
struct tty_port *port = >tport;
unsigned long flags;
-   int retval=0;
+   int retval = 0;
unsigned long page;
 
page = get_zeroed_page(GFP_KERNEL);
@@ -744,7 +743,7 @@ static void change_speed(struct tty_struct *tty, struct 
serial_state *info,
if (I_IGNBRK(tty)) {
info->ignore_status_mask |= UART_LSR_BI;
/*
-* If we're ignore parity and break indicators, ignore 
+* If we're ignore parity and break indicators, ignore
 * overruns too.  (For real raw support).
 */
if (I_IGNPAR(tty))
@@ -765,7 +764,7 @@ static void change_speed(struct tty_struct *tty, struct 
serial_state *info,
 
/* Enable or 

Re: [PATCH 0/6] drivers: make device_attribute const

2017-08-21 Thread Bhumika Goyal
On Mon, Aug 21, 2017 at 5:13 PM, Bhumika Goyal  wrote:
> Make these const. Done using Coccinelle.
>
> @match disable optional_qualifier@
> identifier s;
> @@
> static struct device_attribute s = {...};
>
> @ref@
> position p;
> identifier match.s;
> @@
> s@p
>
> @good1@
> identifier match.s;
> expression e1;
> position ref.p;
> @@
> device_remove_file(e1,@p,...)
>
> @good2@
> identifier match.s;
> expression e1;
> position ref.p;
> @@
> device_create_file(e1,@p,...)
>
>
> @bad depends on  !good1 && !good2@
> position ref.p;
> identifier match.s;
> @@
> s@p
>
> @depends on forall !bad disable optional_qualifier@
> identifier match.s;
> @@
> static
> + const
> struct device_attribute s;
>
> Bhumika Goyal (6):
>   ACPI: make device_attribute const
>   nbd: make device_attribute const
>   hid: make device_attribute const
>   qlogic:  make device_attribute const
>   platform/x86: make device_attribute const
>   power: supply: make device_attribute const
>

Hello all,

The patches are all independent, so please take what seems relevant.

Thanks,
Bhumika

>  drivers/acpi/battery.c   | 2 +-
>  drivers/acpi/sbs.c   | 2 +-
>  drivers/block/nbd.c  | 2 +-
>  drivers/hid/hid-core.c   | 2 +-
>  drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c | 4 ++--
>  drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c| 6 +++---
>  drivers/platform/x86/classmate-laptop.c  | 6 +++---
>  drivers/platform/x86/intel-rst.c | 4 ++--
>  drivers/power/supply/olpc_battery.c  | 2 +-
>  9 files changed, 15 insertions(+), 15 deletions(-)
>
> --
> 1.9.1
>


Re: [PATCH][RFC v4] PM / Hibernate: Feed the wathdog when creating snapshot

2017-08-21 Thread Michal Hocko
On Sat 19-08-17 18:21:26, Chen Yu wrote:
> There is a problem that when counting the pages for creating
> the hibernation snapshot will take significant amount of
> time, especially on system with large memory. Since the counting
> job is performed with irq disabled, this might lead to NMI lockup.
> The following warning were found on a system with 1.5TB DRAM:
> 
> [ 1124.758184] Freezing user space processes ... (elapsed 0.002 seconds) done.
> [ 1124.768721] OOM killer disabled.
> [ 1124.847009] PM: Preallocating image memory...
> [ 1139.392042] NMI watchdog: Watchdog detected hard LOCKUP on cpu 27
> [ 1139.392076] CPU: 27 PID: 3128 Comm: systemd-sleep Not tainted 
> 4.13.0-0.rc2.git0.1.fc27.x86_64 #1
> [ 1139.392077] task: 9f01971ac000 task.stack: b1a3f325c000
> [ 1139.392083] RIP: 0010:memory_bm_find_bit+0xf4/0x100
> [ 1139.392084] RSP: 0018:b1a3f325fc20 EFLAGS: 0006
> [ 1139.392084] RAX:  RBX: 13b83000 RCX: 
> 9fbe89caf000
> [ 1139.392085] RDX: b1a3f325fc30 RSI: 3200 RDI: 
> 9fbeae80
> [ 1139.392085] RBP: b1a3f325fc40 R08: 13b8 R09: 
> 9fbe89c54878
> [ 1139.392085] R10: b1a3f325fc2c R11: 13b83200 R12: 
> 0400
> [ 1139.392086] R13: fd552e0c R14: 9fc1bffd31e0 R15: 
> 0202
> [ 1139.392086] FS:  7f3189704180() GS:9fbec8ec() 
> knlGS:
> [ 1139.392087] CS:  0010 DS:  ES:  CR0: 80050033
> [ 1139.392087] CR2: 0085da0f7398 CR3: 01771cf9a000 CR4: 
> 007406e0
> [ 1139.392088] DR0:  DR1:  DR2: 
> 
> [ 1139.392088] DR3:  DR6: fffe0ff0 DR7: 
> 0400
> [ 1139.392088] PKRU: 5554
> [ 1139.392089] Call Trace:
> [ 1139.392092]  ? memory_bm_set_bit+0x29/0x60
> [ 1139.392094]  swsusp_set_page_free+0x2b/0x30
> [ 1139.392098]  mark_free_pages+0x147/0x1c0
> [ 1139.392099]  count_data_pages+0x41/0xa0
> [ 1139.392101]  hibernate_preallocate_memory+0x80/0x450
> [ 1139.392102]  hibernation_snapshot+0x58/0x410
> [ 1139.392103]  hibernate+0x17c/0x310
> [ 1139.392104]  state_store+0xdf/0xf0
> [ 1139.392107]  kobj_attr_store+0xf/0x20
> [ 1139.392111]  sysfs_kf_write+0x37/0x40
> [ 1139.392113]  kernfs_fop_write+0x11c/0x1a0
> [ 1139.392117]  __vfs_write+0x37/0x170
> [ 1139.392121]  ? handle_mm_fault+0xd8/0x230
> [ 1139.392122]  vfs_write+0xb1/0x1a0
> [ 1139.392123]  SyS_write+0x55/0xc0
> [ 1139.392126]  entry_SYSCALL_64_fastpath+0x1a/0xa5
> ...
> [ 1144.690405] done (allocated 6590003 pages)
> [ 1144.694971] PM: Allocated 26360012 kbytes in 19.89 seconds (1325.28 MB/s)
> 
> It has taken nearly 20 seconds(2.10GHz CPU) thus the NMI lockup
> was triggered. In case the timeout of the NMI watch dog has been
> set to 1 second, a safe interval should be 6590003/20 = 320k pages
> in theory. However there might also be some platforms running at a
> lower frequency, so feed the watchdog every 100k pages.
> 
> Reported-by: Jan Filipcewicz 
> Suggested-by: Michal Hocko 
> Cc: Andrew Morton 
> Cc: Michal Hocko 
> Cc: Mel Gorman 
> Cc: Vlastimil Babka 
> Cc: "Rafael J. Wysocki" 
> Cc: Len Brown 
> Cc: Dan Williams 
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Chen Yu 

OK, this looks better. Feel free to add
Reviewed-by: Michal Hocko 

> ---
>  mm/page_alloc.c | 14 --
>  1 file changed, 12 insertions(+), 2 deletions(-)
> 
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index 6d00f74..543726a 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -66,6 +66,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  
>  #include 
>  #include 
> @@ -2531,9 +2532,12 @@ void drain_all_pages(struct zone *zone)
>  
>  #ifdef CONFIG_HIBERNATION
>  
> +/* Touch watchdog for every WD_INTERVAL_PAGE pages. */
> +#define WD_INTERVAL_PAGE (100*1024)
> +
>  void mark_free_pages(struct zone *zone)
>  {
> - unsigned long pfn, max_zone_pfn;
> + unsigned long pfn, max_zone_pfn, page_num = 0;
>   unsigned long flags;
>   unsigned int order, t;
>   struct page *page;
> @@ -2548,6 +2552,9 @@ void mark_free_pages(struct zone *zone)
>   if (pfn_valid(pfn)) {
>   page = pfn_to_page(pfn);
>  
> + if (!((page_num++) % WD_INTERVAL_PAGE))
> + touch_nmi_watchdog();
> +
>   if (page_zone(page) != zone)
>   continue;
>  
> @@ -2561,8 +2568,11 @@ void mark_free_pages(struct zone *zone)
>   unsigned long i;
>  
>   pfn = page_to_pfn(page);
> - for (i = 0; i < (1UL << order); i++)
> + for (i = 0; i < (1UL << 

Re: [PATCH v2 19/20] x86/mm: Add speculative pagefault handling

2017-08-21 Thread Anshuman Khandual
On 08/18/2017 03:35 AM, Laurent Dufour wrote:
> From: Peter Zijlstra 
> 
> Try a speculative fault before acquiring mmap_sem, if it returns with
> VM_FAULT_RETRY continue with the mmap_sem acquisition and do the
> traditional fault.
> 
> Signed-off-by: Peter Zijlstra (Intel) 
> 
> [Clearing of FAULT_FLAG_ALLOW_RETRY is now done in
>  handle_speculative_fault()]
> [Retry with usual fault path in the case VM_ERROR is returned by
>  handle_speculative_fault(). This allows signal to be delivered]
> Signed-off-by: Laurent Dufour 
> ---
>  arch/x86/include/asm/pgtable_types.h |  7 +++
>  arch/x86/mm/fault.c  | 19 +++
>  2 files changed, 26 insertions(+)
> 
> diff --git a/arch/x86/include/asm/pgtable_types.h 
> b/arch/x86/include/asm/pgtable_types.h
> index bf9638e1ee42..4fd2693a037e 100644
> --- a/arch/x86/include/asm/pgtable_types.h
> +++ b/arch/x86/include/asm/pgtable_types.h
> @@ -234,6 +234,13 @@ enum page_cache_mode {
>  #define PGD_IDENT_ATTR0x001  /* PRESENT (no other 
> attributes) */
>  #endif
>  
> +/*
> + * Advertise that we call the Speculative Page Fault handler.
> + */
> +#ifdef CONFIG_X86_64
> +#define __HAVE_ARCH_CALL_SPF
> +#endif
> +
>  #ifdef CONFIG_X86_32
>  # include 
>  #else
> diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
> index 2a1fa10c6a98..4c070b9a4362 100644
> --- a/arch/x86/mm/fault.c
> +++ b/arch/x86/mm/fault.c
> @@ -1365,6 +1365,24 @@ __do_page_fault(struct pt_regs *regs, unsigned long 
> error_code,
>   if (error_code & PF_INSTR)
>   flags |= FAULT_FLAG_INSTRUCTION;
>  
> +#ifdef __HAVE_ARCH_CALL_SPF
> + if (error_code & PF_USER) {
> + fault = handle_speculative_fault(mm, address, flags);
> +
> + /*
> +  * We also check against VM_FAULT_ERROR because we have to
> +  * raise a signal by calling later mm_fault_error() which
> +  * requires the vma pointer to be set. So in that case,
> +  * we fall through the normal path.

Cant mm_fault_error() be called inside handle_speculative_fault() ?
Falling through the normal page fault path again just to raise a
signal seems overkill. Looking into mm_fault_error(), it seems they
are different for x86 and powerpc.

X86:

mm_fault_error(struct pt_regs *regs, unsigned long error_code,
   unsigned long address, struct vm_area_struct *vma,
   unsigned int fault)

powerpc:

mm_fault_error(struct pt_regs *regs, unsigned long addr, int fault)

Even in case of X86, I guess we would have reference to the faulting
VMA (after the SRCU search) which can be used to call this function
directly.



Re: [PATCH v3 1/6] pwm: kconfig: modify mediatek information

2017-08-21 Thread Thierry Reding
On Fri, Jun 30, 2017 at 02:05:16PM +0800, Zhi Mao wrote:
> modify mediatek information
> 
> Signed-off-by: Zhi Mao 
> ---
>  drivers/pwm/Kconfig |2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied to for-4.14/drivers, with a slightly modified subject and commit
message.

Thanks,
Thierry


signature.asc
Description: PGP signature


[PATCH 0/5] mmc: Add OMAP SDHCI driver

2017-08-21 Thread Kishon Vijay Abraham I
This is the first step in deprecating omap_hsmmc driver completely
and moving to sdhci-omap driver which uses the sdhci library.

This series adds a new SDHCI quirk to indicate MMC_RSP_136 has CRC (since
sdhci in OMAP has CRC)

Apart from the quirk, sdhci-omap has it's own callbacks
to set_clock (clock divider programming is different from generic sdhci)
, set_power, set_bus_width, set_bus_mode and platform_send_init_74_clocks.
These callback functions are implemented based on omap_hsmmc driver.

The sdhci-omap driver supports only the high speed mode and UHS/HS200
mode will be added in a later series.

It has been tested only in boards having DRA7 SoCs like dra7-evm, dra72-evm,
am571x-idk, am572x-idk, am57xx-evm. (Tested only eMMC and SD.
SDIO support will be added later). The plan is to fully convert DRA7
SoC to use SDHCI driver and then convert other legacy platforms to use
SDHCI.

Next Steps:
*) Add UHS support to sdhci-omap
*) Add SDIO support
*) Add support for older TI platforms

Changes from v1:
*) Remove the quirks and instead use sdhci_omap specific callbacks for
   set_power, set_busmode etc.
*) Add a patch from Adrian to tidy reading 136-bit responses

I've also pushed the entire series along with dependent dt patches @
https://github.com/kishon/linux-wip.git sdhci_omap_v1 (in case someone
wants to test)

Adrian Hunter (1):
  mmc: sdhci: Tidy reading 136-bit responses

Kishon Vijay Abraham I (4):
  mmc: sdhci: Add quirk to indicate MMC_RSP_136 has CRC
  dt-bindings: ti-omap-hsmmc: Document new compatible for sdhci omap
  mmc: sdhci-omap: Add OMAP SDHCI driver
  MAINTAINERS: Add TI OMAP SDHCI Maintainer

 .../devicetree/bindings/mmc/ti-omap-hsmmc.txt  |   1 +
 MAINTAINERS|   6 +
 drivers/mmc/host/Kconfig   |  12 +
 drivers/mmc/host/Makefile  |   1 +
 drivers/mmc/host/sdhci-omap.c  | 629 +
 drivers/mmc/host/sdhci.c   |  31 +-
 drivers/mmc/host/sdhci.h   |   2 +
 7 files changed, 672 insertions(+), 10 deletions(-)
 create mode 100644 drivers/mmc/host/sdhci-omap.c

-- 
2.11.0



[PATCH 5/5] MAINTAINERS: Add TI OMAP SDHCI Maintainer

2017-08-21 Thread Kishon Vijay Abraham I
Add Maintainer for the TI OMAP SDHCI driver.

Signed-off-by: Kishon Vijay Abraham I 
---
 MAINTAINERS | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 44cb004c765d..c9871351c16f 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -11777,6 +11777,12 @@ L: linux-...@vger.kernel.org
 S: Maintained
 F: drivers/mmc/host/sdhci-spear.c
 
+SECURE DIGITAL HOST CONTROLLER INTERFACE (SDHCI) TI OMAP DRIVER
+M: Kishon Vijay Abraham I 
+L: linux-...@vger.kernel.org
+S: Maintained
+F: drivers/mmc/host/sdhci-omap.c
+
 SECURE ENCRYPTING DEVICE (SED) OPAL DRIVER
 M: Scott Bauer 
 M: Jonathan Derrick 
-- 
2.11.0



[PATCH 2/5] mmc: sdhci: Add quirk to indicate MMC_RSP_136 has CRC

2017-08-21 Thread Kishon Vijay Abraham I
TI's implementation of sdhci controller used in DRA7 SoC's has
CRC in responses with length 136 bits. Add quirk to indicate
the controller has CRC in MMC_RSP_136. If this quirk is
set sdhci library shouldn't shift the response present in
SDHCI_RESPONSE register.

Signed-off-by: Kishon Vijay Abraham I 
---
 drivers/mmc/host/sdhci.c | 3 +++
 drivers/mmc/host/sdhci.h | 2 ++
 2 files changed, 5 insertions(+)

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index ba639b7851cb..9c8d7428df3c 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -1182,6 +1182,9 @@ static void sdhci_read_rsp_136(struct sdhci_host *host, 
struct mmc_command *cmd)
cmd->resp[i] = sdhci_readl(host, reg);
}
 
+   if (host->quirks2 & SDHCI_QUIRK2_RSP_136_HAS_CRC)
+   return;
+
/* CRC is stripped so we need to do some shifting */
for (i = 0; i < 4; i++) {
cmd->resp[i] <<= 8;
diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
index 399edc681623..54bc444c317f 100644
--- a/drivers/mmc/host/sdhci.h
+++ b/drivers/mmc/host/sdhci.h
@@ -435,6 +435,8 @@ struct sdhci_host {
 #define SDHCI_QUIRK2_ACMD23_BROKEN (1<<14)
 /* Broken Clock divider zero in controller */
 #define SDHCI_QUIRK2_CLOCK_DIV_ZERO_BROKEN (1<<15)
+/* Controller has CRC in 136 bit Command Response */
+#define SDHCI_QUIRK2_RSP_136_HAS_CRC   (1<<16)
 
int irq;/* Device IRQ */
void __iomem *ioaddr;   /* Mapped address */
-- 
2.11.0



[PATCH 1/5] mmc: sdhci: Tidy reading 136-bit responses

2017-08-21 Thread Kishon Vijay Abraham I
From: Adrian Hunter 

Read each register only once and move the code to a separate function so
that it is not jammed against the 80 column margin.

Signed-off-by: Adrian Hunter 
Signed-off-by: Kishon Vijay Abraham I 
---
 drivers/mmc/host/sdhci.c | 28 ++--
 1 file changed, 18 insertions(+), 10 deletions(-)

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index a1ad2ddadca1..ba639b7851cb 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -1173,24 +1173,32 @@ void sdhci_send_command(struct sdhci_host *host, struct 
mmc_command *cmd)
 }
 EXPORT_SYMBOL_GPL(sdhci_send_command);
 
+static void sdhci_read_rsp_136(struct sdhci_host *host, struct mmc_command 
*cmd)
+{
+   int i, reg;
+
+   for (i = 0; i < 4; i++) {
+   reg = SDHCI_RESPONSE + (3 - i) * 4;
+   cmd->resp[i] = sdhci_readl(host, reg);
+   }
+
+   /* CRC is stripped so we need to do some shifting */
+   for (i = 0; i < 4; i++) {
+   cmd->resp[i] <<= 8;
+   if (i != 3)
+   cmd->resp[i] |= cmd->resp[i + 1] >> 24;
+   }
+}
+
 static void sdhci_finish_command(struct sdhci_host *host)
 {
struct mmc_command *cmd = host->cmd;
-   int i;
 
host->cmd = NULL;
 
if (cmd->flags & MMC_RSP_PRESENT) {
if (cmd->flags & MMC_RSP_136) {
-   /* CRC is stripped so we need to do some shifting. */
-   for (i = 0;i < 4;i++) {
-   cmd->resp[i] = sdhci_readl(host,
-   SDHCI_RESPONSE + (3-i)*4) << 8;
-   if (i != 3)
-   cmd->resp[i] |=
-   sdhci_readb(host,
-   SDHCI_RESPONSE + (3-i)*4-1);
-   }
+   sdhci_read_rsp_136(host, cmd);
} else {
cmd->resp[0] = sdhci_readl(host, SDHCI_RESPONSE);
}
-- 
2.11.0



Re: [linux-next][bisected c64e09ce] sysctl command hung indefinitely

2017-08-21 Thread Michal Hocko
On Sat 19-08-17 15:49:31, Abdul Haleem wrote:
> Hi Michal,
> 
> 'sysctl -a' command never completes on my PowerPC machine with latest
> next kernel (As of next-20170811)
> 
> Machine Type : Power8 bare-metal
> Kernel version : 4.13.0-rc4-next-20170817
> gcc version : 4.8.5
> 
> 
> command output
> --
> $ sysctl -a
> [...
> vm.hugetlb_shm_group = 0
> vm.laptop_mode = 0
> vm.legacy_va_layout = 0
> vm.lowmem_reserve_ratio = 256 256 32
> vm.max_map_count = 65530
> vm.min_free_kbytes = 6637
> vm.min_slab_ratio = 5
> vm.min_unmapped_ratio = 1
> vm.mmap_min_addr = 4096
> vm.mmap_rnd_bits = 14
> vm.mmap_rnd_compat_bits = 7
> vm.nr_hugepages = 0
> vm.nr_hugepages_mempolicy = 0
> vm.nr_overcommit_hugepages = 0
> vm.nr_pdflush_threads = 0
> vm.numa_zonelist_order = Node
> vm.numa_zonelist_order = e
> vm.numa_zonelist_order = ode
> vm.numa_zonelist_order = 
> vm.numa_zonelist_order = de
> vm.numa_zonelist_order = Node
> vm.numa_zonelist_order = e
> vm.numa_zonelist_order = ode
> vm.numa_zonelist_order = 
> vm.numa_zonelist_order = de
> vm.numa_zonelist_order = Node
> vm.numa_zonelist_order = e
> vm.numa_zonelist_order = ode
> vm.numa_zonelist_order = 
> vm.numa_zonelist_order = de
> vm.numa_zonelist_order = Node
> vm.numa_zonelist_order = e
> vm.numa_zonelist_order = ode
> ]
> 
> The last string 'vm.numa_zonelist_order = ' keeps flooding the stdout
> and command never exit.
> 
> A bisection resulted commit c64e09ce mm, page_alloc: rip out
> ZONELIST_ORDER_ZONE

Yeah, my read implementation is broken. I do not update the ppos and so
the reader doesn't know it should exit. Mel was suggesting to keep the
proc_dostring but I thought I was more clever. Sigh...

This should do the trick. Andrew, could you fold it into
mm-page_alloc-rip-out-zonelist_order_zone.patch please?

Thanks for the report Abdul!

---
commit 69885605ee3ba681deb54021e3df645f46589ba1
Author: Michal Hocko 
Date:   Mon Aug 21 09:46:04 2017 +0200

mmotm: mm-page_alloc-rip-out-zonelist_order_zone-fix

Abdul has noticed that reading sysctl vm.numa_zonelist_order
read will never terminate. This is because of
http://lkml.kernel.org/r/20170714080006.7250-2-mho...@kernel.org
where the reading side doesn't update ppos and so the reader will
never get 0. Return back to proc_dostring which does all the necessary
stuff.

Reported-by: Abdul Haleem 
Signed-off-by: Michal Hocko 

diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index fda9afbd14d9..e7e92c8f4883 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -894,6 +894,8 @@ int sysctl_min_slab_ratio_sysctl_handler(struct ctl_table 
*, int,
 
 extern int numa_zonelist_order_handler(struct ctl_table *, int,
void __user *, size_t *, loff_t *);
+extern char numa_zonelist_order[];
+#define NUMA_ZONELIST_ORDER_LEN16
 
 #ifndef CONFIG_NEED_MULTIPLE_NODES
 
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 0cbce40f5426..655686d546cb 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -1553,6 +1553,8 @@ static struct ctl_table vm_table[] = {
 #ifdef CONFIG_NUMA
{
.procname   = "numa_zonelist_order",
+   .data   = _zonelist_order,
+   .maxlen = NUMA_ZONELIST_ORDER_LEN,
.mode   = 0644,
.proc_handler   = numa_zonelist_order_handler,
},
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 5cba36337893..b55e97decac4 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -4859,6 +4859,8 @@ static __init int setup_numa_zonelist_order(char *s)
 }
 early_param("numa_zonelist_order", setup_numa_zonelist_order);
 
+char numa_zonelist_order[] = "Node";
+
 /*
  * sysctl handler for numa_zonelist_order
  */
@@ -4869,12 +4871,8 @@ int numa_zonelist_order_handler(struct ctl_table *table, 
int write,
char *str;
int ret;
 
-   if (!write) {
-   int len = sizeof("Node");
-   if (copy_to_user(buffer, "Node", len))
-   return -EFAULT;
-   return len;
-   }
+   if (!write)
+   return proc_dostring(table, write, buffer, length, ppos);
str = memdup_user_nul(buffer, 16);
if (IS_ERR(str))
return PTR_ERR(str);
-- 
Michal Hocko
SUSE Labs


Re: [PATCH v4] mfd: intel-lpss: Add missing PCI ID for Intel Sunrise Point LPSS devices

2017-08-21 Thread Lee Jones
On Sat, 19 Aug 2017, Florian R. Hölzlwimmer wrote:

> This patch adds a missing PCI ID of the Intel Sunrise Point chipset to the 
> Intel LPSS driver.
> It fixes a bug causing the touchpad of the Lenovo Yoga 720-15 not to be 
> recognized.
> See also bug 1700657 on bugs.launchpad.net.
> 
> Many thanks to CoolStar, who found this solution!
> 
> Reported-by: CoolStar 
> Tested-by: Mike Schwartz 
> Tested-by: Björn Dahlgren 
> Signed-off-by: Florian R. Hölzlwimmer 
> ---
>  drivers/mfd/intel-lpss-pci.c | 1 +
>  1 file changed, 1 insertion(+)

Applied, thanks.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog


Re: [PATCH v1 4/4] KVM: MMU: Expose the LA57 feature to VM.

2017-08-21 Thread Yu Zhang



On 8/18/2017 8:50 PM, Paolo Bonzini wrote:

On 18/08/2017 10:28, Yu Zhang wrote:


On 8/17/2017 10:29 PM, Paolo Bonzini wrote:

On 17/08/2017 13:53, Yu Zhang wrote:

On 8/17/2017 7:57 PM, Paolo Bonzini wrote:

On 12/08/2017 15:35, Yu Zhang wrote:

index a98b88a..50107ae 100644
--- a/arch/x86/kvm/emulate.c
+++ b/arch/x86/kvm/emulate.c
@@ -694,7 +694,7 @@ static __always_inline int __linearize(struct
x86_emulate_ctxt *ctxt,
switch (mode) {
case X86EMUL_MODE_PROT64:
*linear = la;
-if (is_noncanonical_address(la))
+if (emul_is_noncanonical_address(la, ctxt))
goto bad;
  *max_size = min_t(u64, ~0u, (1ull << 48) - la);

Oops, you missed one here.  Probably best to use ctxt_virt_addr_bits
and
then "inline" emul_is_noncanonical_address as "get_canonical(la,
va_bits) != la".

Sorry, I just sent out the v2 patch set without noticing this reply. :-)

The emul_is_noncanonical() is defined in x86.h so that no
ctxt_virt_addr_bits needed in emulate.c, are you
suggesting to use ctx_virt_addr_bits in this file each time before
emul_is_noncanonical_address() is called?

No, only in this instance which uses "48" after the call to
emul_is_noncanonical_address.

Sorry, Paolo. I still do not quite get it.
Do you mean the
  *max_size = min_t(u64, ~0u, (1ull << 48) - la);
also need to be changed?

But I do not understand why this statement is used like this. My
understanding is that
for 64 bit scenario, the *max_size is calculated to guarantee la +
*max_size still falls in
the canonical address space.

And if above understanding is correct, I think it should be something
like below:
   *max_size = min_t(u64, ~0u - la, (1ull << 48) - la);

The "~0u" part is simply because max_size has 32-bit size (it's an
unsigned int variable), while (1ull << 48) - la has 64-bit size.  It
protects from the overflow.


Oh, right. "~0u" is only an unsigned int. Thanks for your clarification. :-)

But what if value of "la" falls in between 0x and 
0x?
(1ull << 48) - la may result in something between 0x10001 and 
0x2,

and the *max_size would be 4G - 1 in this scenario.
For instance, when "la" is 0xFFF0(unlikely in practice 
though), the *max_size

we are expecting should be 15, instead of 4G - 1.

If above understanding is correct, maybe we should change this code as 
below:
@@ -690,16 +690,21 @@ static __always_inline int __linearize(struct 
x86_emulate_ctxt *ctxt,

    ulong la;
    u32 lim;
    u16 sel;
+   u64 canonical_limit;
+   u8 va_bits;

    la = seg_base(ctxt, addr.seg) + addr.ea;
    *max_size = 0;
    switch (mode) {
    case X86EMUL_MODE_PROT64:
    *linear = la;
-   if (emul_is_noncanonical_address(la, ctxt))
+   va_bits = ctxt_virt_addr_bits(ctxt);
+   if (get_canonical(la, va_bits) != la)
    goto bad;

-   *max_size = min_t(u64, ~0u, (1ull << 48) - la);
+   canonical_limit = (la & (1 << va_bits)) ?
+ ~0ull : ((1 << va_bits) -1);
+   *max_size = min_t(u64, ~0u, canonical_limit - la + 1);

Does this sound reasonable?
BTW, I did not use min_t(u64, ~0ull - la + 1, (1 << va_bits) - la) here, 
because I still would like to
keep *max_size as an unsigned int, and my previous suggestion may cause 
the return value of

min_t be truncated.

Yu


And with LA57, may better be changed to:
   *max_size = min_t(u64, ~0u - la, (1ull << ctxt_virt_addr_bits(ctxt)) -
la);

And for the above
   if (emul_is_noncanonical_address(la, ctxt))
we may just leave it as it is.

Yes, exactly.  But since emul_is_noncanonical_address is already using
ctxt_virt_addr_bits(ctxt), it may make sense to compute
ctxt_virt_addr_bits(ctxt) once and then reuse it twice, once in
get_canonical(la, va_bits) != la and once in (1ull << va_bits) - la.

Paolo


Is this understanding correct? Or did I misunderstand your comments? :-)

Thanks
Yu

Paolo







Re: [PATCH 1/1] Revert "mfd: da9061: Fix to remove BBAT_CONT register from chip model"

2017-08-21 Thread Lee Jones
On Tue, 15 Aug 2017, Lee Jones wrote:

> This patch was applied to the MFD twice, causing unwanted behavour.
> 
> This reverts commit b77eb79acca3203883e8d8dbc7f2b842def1bff8.
> 
> Fixes: b77eb79acca3 ("mfd: da9061: Fix to remove BBAT_CONT register from chip 
> model")
> Reported-by: Steve Twiss 
> Signed-off-by: Lee Jones 
> ---
>  drivers/mfd/da9062-core.c | 6 ++
>  1 file changed, 6 insertions(+)

Steve, It would be good to obtain a {Reviewed|Acked}-by from you
before applying.

> diff --git a/drivers/mfd/da9062-core.c b/drivers/mfd/da9062-core.c
> index fbe0f245ce8e..fe1811523e4a 100644
> --- a/drivers/mfd/da9062-core.c
> +++ b/drivers/mfd/da9062-core.c
> @@ -645,6 +645,9 @@ static const struct regmap_range 
> da9062_aa_readable_ranges[] = {
>   .range_min = DA9062AA_VLDO1_B,
>   .range_max = DA9062AA_VLDO4_B,
>   }, {
> + .range_min = DA9062AA_BBAT_CONT,
> + .range_max = DA9062AA_BBAT_CONT,
> + }, {
>   .range_min = DA9062AA_INTERFACE,
>   .range_max = DA9062AA_CONFIG_E,
>   }, {
> @@ -721,6 +724,9 @@ static const struct regmap_range 
> da9062_aa_writeable_ranges[] = {
>   .range_min = DA9062AA_VLDO1_B,
>   .range_max = DA9062AA_VLDO4_B,
>   }, {
> + .range_min = DA9062AA_BBAT_CONT,
> + .range_max = DA9062AA_BBAT_CONT,
> + }, {
>   .range_min = DA9062AA_GP_ID_0,
>   .range_max = DA9062AA_GP_ID_19,
>   },

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog


[PATCH v2 1/4] clk: rockchip: add rv1108 ACLK_GAMC and PCLK_GMAC ID

2017-08-21 Thread Elaine Zhang
This patch exports gmac aclk and pclk for dts reference.

Signed-off-by: Elaine Zhang 
---
 include/dt-bindings/clock/rv1108-cru.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/dt-bindings/clock/rv1108-cru.h 
b/include/dt-bindings/clock/rv1108-cru.h
index f269d833e41a..2239ae2a19b9 100644
--- a/include/dt-bindings/clock/rv1108-cru.h
+++ b/include/dt-bindings/clock/rv1108-cru.h
@@ -110,6 +110,7 @@
 #define ACLK_CIF2  207
 #define ACLK_CIF3  208
 #define ACLK_PERI  209
+#define ACLK_GMAC  210
 
 /* pclk gates */
 #define PCLK_GPIO1 256
@@ -141,6 +142,7 @@
 #define PCLK_EFUSE0282
 #define PCLK_EFUSE1283
 #define PCLK_WDT   284
+#define PCLK_GMAC  285
 
 /* hclk gates */
 #define HCLK_I2S0_8CH  320
-- 
1.9.1




[PATCH v2 2/4] clk: rockchip: rv1108: add ACLK_GMAC and PCLK_GMAC clk id

2017-08-21 Thread Elaine Zhang
Signed-off-by: Elaine Zhang 
---
 drivers/clk/rockchip/clk-rv1108.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/clk/rockchip/clk-rv1108.c 
b/drivers/clk/rockchip/clk-rv1108.c
index d1065dd9f442..0e441ec21e90 100644
--- a/drivers/clk/rockchip/clk-rv1108.c
+++ b/drivers/clk/rockchip/clk-rv1108.c
@@ -763,6 +763,8 @@ enum rv1108_plls {
GATE(SCLK_MACPHY_RX, "sclk_macphy_rx", "sclk_macphy", 0, 
RV1108_CLKGATE_CON(4), 8, GFLAGS),
GATE(SCLK_MAC_REF, "sclk_mac_ref", "sclk_macphy", 0, 
RV1108_CLKGATE_CON(4), 6, GFLAGS),
GATE(SCLK_MAC_REFOUT, "sclk_mac_refout", "sclk_macphy", 0, 
RV1108_CLKGATE_CON(4), 7, GFLAGS),
+   GATE(ACLK_GMAC, "aclk_gmac", "aclk_periph", 0, RV1108_CLKGATE_CON(15), 
4, GFLAGS),
+   GATE(PCLK_GMAC, "pclk_gmac", "pclk_periph", 0, RV1108_CLKGATE_CON(15), 
5, GFLAGS),
 
MMC(SCLK_SDMMC_DRV,"sdmmc_drv","sclk_sdmmc", RV1108_SDMMC_CON0, 
1),
MMC(SCLK_SDMMC_SAMPLE, "sdmmc_sample", "sclk_sdmmc", RV1108_SDMMC_CON1, 
1),
-- 
1.9.1




[PATCH v2 4/4] clk: rockchip: rv1108: fix up the clk_mac sel register description

2017-08-21 Thread Elaine Zhang
cru_sel24_con[8]
rmii_extclk_sel
clock source select control register
1'b0: from internal PLL
1'b1: from external IO

Signed-off-by: Elaine Zhang 
---
 drivers/clk/rockchip/clk-rv1108.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/rockchip/clk-rv1108.c 
b/drivers/clk/rockchip/clk-rv1108.c
index 658da17c9d99..4d87828df4f7 100644
--- a/drivers/clk/rockchip/clk-rv1108.c
+++ b/drivers/clk/rockchip/clk-rv1108.c
@@ -140,7 +140,7 @@ enum rv1108_plls {
 PNAME(mux_uart0_p) = { "uart0_src", "uart0_frac", "xin24m" };
 PNAME(mux_uart1_p) = { "uart1_src", "uart1_frac", "xin24m" };
 PNAME(mux_uart2_p) = { "uart2_src", "uart2_frac", "xin24m" };
-PNAME(mux_sclk_mac_p)  = { "ext_gmac", "sclk_mac_pre" };
+PNAME(mux_sclk_mac_p)  = { "sclk_mac_pre", "ext_gmac" };
 PNAME(mux_i2s0_pre_p)  = { "i2s0_src", "i2s0_frac", "ext_i2s", 
"xin12m" };
 PNAME(mux_i2s_out_p)   = { "i2s0_pre", "xin12m" };
 PNAME(mux_i2s1_p)  = { "i2s1_src", "i2s1_frac", "dummy", "xin12m" 
};
-- 
1.9.1




Re: events: possible deadlock in __perf_event_task_sched_out

2017-08-21 Thread Shubham Bansal
> This is a WARN, printk is a pig.

So, its not a bug?


[PATCH v2 1/2] arm64: dts: rockchip: add rk3328 pdm node

2017-08-21 Thread Sugar Zhang
This patch add pdm controller device node for rk3328.

Signed-off-by: Sugar Zhang 

---

Changes in v2:
- separate pinctrl pins
  remove unused fsync clk, it's debug pins

 arch/arm64/boot/dts/rockchip/rk3328.dtsi | 77 
 1 file changed, 77 insertions(+)

diff --git a/arch/arm64/boot/dts/rockchip/rk3328.dtsi 
b/arch/arm64/boot/dts/rockchip/rk3328.dtsi
index 0be96ce..c4f52ec 100644
--- a/arch/arm64/boot/dts/rockchip/rk3328.dtsi
+++ b/arch/arm64/boot/dts/rockchip/rk3328.dtsi
@@ -156,6 +156,27 @@
clock-output-names = "xin24m";
};
 
+   pdm: pdm@ff04 {
+   compatible = "rockchip,pdm";
+   reg = <0x0 0xff04 0x0 0x1000>;
+   clocks = < SCLK_PDM>, < HCLK_PDM>;
+   clock-names = "pdm_clk", "pdm_hclk";
+   dmas = < 16>;
+   dma-names = "rx";
+   pinctrl-names = "default", "sleep";
+   pinctrl-0 = <_clk
+_sdi0
+_sdi1
+_sdi2
+_sdi3>;
+   pinctrl-1 = <_clk_sleep
+_sdi0_sleep
+_sdi1_sleep
+_sdi2_sleep
+_sdi3_sleep>;
+   status = "disabled";
+   };
+
grf: syscon@ff10 {
compatible = "rockchip,rk3328-grf", "syscon", "simple-mfd";
reg = <0x0 0xff10 0x0 0x1000>;
@@ -734,6 +755,62 @@
};
};
 
+   pdm-0 {
+   pdmm0_clk: pdmm0-clk {
+   rockchip,pins = <2 RK_PC2 2 _pull_none>;
+   };
+
+   pdmm0_fsync: pdmm0-fsync {
+   rockchip,pins = <2 RK_PC7 2 _pull_none>;
+   };
+
+   pdmm0_sdi0: pdmm0-sdi0 {
+   rockchip,pins = <2 RK_PC3 2 _pull_none>;
+   };
+
+   pdmm0_sdi1: pdmm0-sdi1 {
+   rockchip,pins = <2 RK_PC4 2 _pull_none>;
+   };
+
+   pdmm0_sdi2: pdmm0-sdi2 {
+   rockchip,pins = <2 RK_PC5 2 _pull_none>;
+   };
+
+   pdmm0_sdi3: pdmm0-sdi3 {
+   rockchip,pins = <2 RK_PC6 2 _pull_none>;
+   };
+
+   pdmm0_clk_sleep: pdmm0-clk-sleep {
+   rockchip,pins =
+   <2 RK_PC2 RK_FUNC_GPIO 
_input_high>;
+   };
+
+   pdmm0_sdi0_sleep: pdmm0-sdi0-sleep {
+   rockchip,pins =
+   <2 RK_PC3 RK_FUNC_GPIO 
_input_high>;
+   };
+
+   pdmm0_sdi1_sleep: pdmm0-sdi1-sleep {
+   rockchip,pins =
+   <2 RK_PC4 RK_FUNC_GPIO 
_input_high>;
+   };
+
+   pdmm0_sdi2_sleep: pdmm0-sdi2-sleep {
+   rockchip,pins =
+   <2 RK_PC5 RK_FUNC_GPIO 
_input_high>;
+   };
+
+   pdmm0_sdi3_sleep: pdmm0-sdi3-sleep {
+   rockchip,pins =
+   <2 RK_PC6 RK_FUNC_GPIO 
_input_high>;
+   };
+
+   pdmm0_fsync_sleep: pdmm0-fsync-sleep {
+   rockchip,pins =
+   <2 RK_PC7 RK_FUNC_GPIO 
_input_high>;
+   };
+   };
+
i2s1 {
i2s1_mclk: i2s1-mclk {
rockchip,pins = <2 RK_PB7 1 _pull_none>;
-- 
2.7.4




[PATCH v2 2/2] ASoC: rockchip: separate pinctrl pins from each other

2017-08-21 Thread Sugar Zhang
pdm sdi0~3 pins are optional, for example, if 4ch required,
only sdi0~1 need to be enabled.

Signed-off-by: Sugar Zhang 
---

Changes in v2: None

 Documentation/devicetree/bindings/sound/rockchip,pdm.txt | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/sound/rockchip,pdm.txt 
b/Documentation/devicetree/bindings/sound/rockchip,pdm.txt
index 921729d..2ad66f6 100644
--- a/Documentation/devicetree/bindings/sound/rockchip,pdm.txt
+++ b/Documentation/devicetree/bindings/sound/rockchip,pdm.txt
@@ -29,11 +29,14 @@ pdm: pdm@ff04 {
dma-names = "rx";
pinctrl-names = "default", "sleep";
pinctrl-0 = <_clk
-_fsync
 _sdi0
 _sdi1
 _sdi2
 _sdi3>;
-   pinctrl-1 = <_sleep>;
+   pinctrl-1 = <_clk_sleep
+_sdi0_sleep
+_sdi1_sleep
+_sdi2_sleep
+_sdi3_sleep>;
status = "disabled";
 };
-- 
2.7.4




[PATCH v2 0/2] Patches to add support pdm controller for rk3328

2017-08-21 Thread Sugar Zhang
These patches to add support pdm for rk3328 socs.

Changes in v2:
- separate pinctrl pins
  remove unused fsync clk, it's debug pins

Sugar Zhang (2):
  arm64: dts: rockchip: add rk3328 pdm node
  ASoC: rockchip: separate pinctrl pins from each other

 .../devicetree/bindings/sound/rockchip,pdm.txt |  7 +-
 arch/arm64/boot/dts/rockchip/rk3328.dtsi   | 77 ++
 2 files changed, 82 insertions(+), 2 deletions(-)

-- 
2.7.4




[PATCH 3/3] ARM: dts: rockchip: enable usb for rv1108-evb

2017-08-21 Thread Frank Wang
Rockchip's rv1108-evb board has one usb otg controller and one usb
host controller, each usb controller connect with one usb-phy port
through UTMI+ interface. This patch enables them to support usb on
rv1108-evb board.

Signed-off-by: Frank Wang 
---
 arch/arm/boot/dts/rv1108-evb.dts | 24 
 1 file changed, 24 insertions(+)

diff --git a/arch/arm/boot/dts/rv1108-evb.dts b/arch/arm/boot/dts/rv1108-evb.dts
index 010763f..5a48e79 100644
--- a/arch/arm/boot/dts/rv1108-evb.dts
+++ b/arch/arm/boot/dts/rv1108-evb.dts
@@ -103,6 +103,18 @@
status = "okay";
 };
 
+ {
+   status = "okay";
+
+   u2phy_otg: otg-port {
+   status = "okay";
+   };
+
+   u2phy_host: host-port {
+   status = "okay";
+   };
+};
+
  {
status = "okay";
 };
@@ -114,3 +126,15 @@
  {
status = "okay";
 };
+
+_host_ehci {
+   status = "okay";
+};
+
+_host_ohci {
+   status = "okay";
+};
+
+_otg {
+   status = "okay";
+};
-- 
2.0.0




<    1   2   3   4   5   6   7   8   9   10   >