Re: Why not make kdbus use CUSE?

2014-12-02 Thread Richard Yao
On 12/02/2014 12:48 AM, Greg Kroah-Hartman wrote:
 On Tue, Dec 02, 2014 at 12:40:09AM -0500, Richard Yao wrote:
 They regard a userland compatibility shim in the systemd repostory to 
 provide
 backward compatibility for applications. Unfortunately, this is 
 insufficient to
 ensure compatibility because dependency trees have multiple levels. If 
 cross
 platform package A depends on cross platform library B, which depends on 
 dbus,
 and cross platform library B decides to switch to kdbus, then it ceases to 
 be
 cross platform and cross platform package A is now dependent on Linux 
 kernels
 with kdbus. Not only does that affect other POSIX systems, but it also 
 affects
 LTS versions of Linux.

 What does LTS versions have anything to do here?  And what specific
 dependancies are you worried about?

 Lets say that you have a Linux 3.10 system and you want some package
 that indirectly depends on the new API due to library dependencies. You
 will have a problem. You could probably install an older version of the
 library, but if the older version has a CVE, most end users will end up
 between a rock and a hard place. This situation should merit some
 consideration because you are taking something that lived previously in
 userland, modifying it so that anything depending on the modifications
 is no longer backward compatible and then tying it to new kernels.
 
 Then you need to get a better distro, as any well run long-term
 enterprise distro handles stuff like this for you.  Otherwise you need
 to update systems properly.  There's nothing that I can do here to help
 with that, nor do I ever want to, sorry.

Another option is to include KVM-style kernel compatibility code to
allow the module to be built against older kernels. If you target
2.6.32.y, 3.2.y, 3.4.y and 3.10.y, the risk of people on older Linux
systems being left behind would be minimized.

 1. Debugging kernel code is a pain while debugging user code is
 relatively easy.
 
 You have full access to a debugger, what more do you need?  :)

I would prefer not to start bringing userland daemons into the kernel
unless there is no other choice. That way, a wider range of people can
tackle bugs and the code could be applied to a larger number of systems.

 And why would you need to debug the kernel kdbus code?  Is something not
 working properly in it?  Otherwise just use wireshark to read the kdbus
 data stream and all should be fine.

Putting daemons in the kernel means that we further complicate already
complex relationships with regard to things like memory utilization and
CPU time. It is easier to deal with this in userland where we could
better utilize cgroups.

 2. Security vulnerabilities in kernel code give complete access to
 everything while security vulnerabilities in userspace code can be
 limited in scope by SELinux.
 
 Kernel code is hard, security matters, yes I know this, we all have been
 doing this for a very long time.  Of course bugs happen, but if you look
 closely, your attack surface is now smaller using kdbus than it was
 using old-style dbus.

Lets say that I have a system running LXC containers, someone does full
disclosure of proof of concept code for an arbitrary code execution zero
day and then someone else tries the exploit in a LXC container on
mysystem. With old-style dbus, only the container is affected and if
selinux is used, then it is possible to restrict daemon to things in the
container using dbus. A FUSE daemon using the new protocol is similar.
However, an in-kernel version not only means that the attacker breaks
out, but he has the ability to execute code with full kernel privileges.
Every Linux container on the system is therefore compromised.

I heard quite clearly at LinuxCon Europe that there are no expected
benefits from using the shim with kdbus such that we have the equivalent
of the original dbus daemon in the kernel, but there were plenty of
benefits from the protocol. If that is the case, it seems that being in
the kernel is not a necessity, but the new protocol is. FUSE might be
somewhat slower than an in-kernel filesystem, but it allows us to
enforce least privilege like we can do now with the current dbus daemon.
We cannot do that with kdbus/kdbusfs. If the reduction in context switch
overhead actually mattered, I would understand the desire to put this
into the kernel, but I have heard quite consistently that the context
switch overhead is not a significant motivation for pushing this code
into the kernel. If it were, the current userland code could have been
adapted into a kernel module.

 3. Integration with things like LXC should be easier from userspace,
 where each container can have its own daemon.
 
 How does the current implementation not work properly for this?  The
 filesystem implementation makes this easier than ever, while sticking
 with the character device made this quite difficult in different ways.

As you pointed out, my information was out of date. Making this into a

[PATCH v7 4/7] clk: change clk_debugfs_add_file to take a struct clk_hw

2014-12-02 Thread Tomeu Vizoso
Instead of struct clk, as this should be only used by providers.

Signed-off-by: Tomeu Vizoso tomeu.viz...@collabora.com
Reviewed-by: Stephen Boyd sb...@codeaurora.org
---
 drivers/clk/clk.c| 6 +++---
 include/linux/clk-provider.h | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 73247e9..f549e8b 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -354,13 +354,13 @@ out:
mutex_unlock(clk_debug_lock);
 }
 
-struct dentry *clk_debugfs_add_file(struct clk *clk, char *name, umode_t mode,
+struct dentry *clk_debugfs_add_file(struct clk_hw *hw, char *name, umode_t 
mode,
void *data, const struct file_operations *fops)
 {
struct dentry *d = NULL;
 
-   if (clk-dentry)
-   d = debugfs_create_file(name, mode, clk-dentry, data, fops);
+   if (hw-clk-dentry)
+   d = debugfs_create_file(name, mode, hw-clk-dentry, data, 
fops);
 
return d;
 }
diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h
index 270137a..5e06f23 100644
--- a/include/linux/clk-provider.h
+++ b/include/linux/clk-provider.h
@@ -650,7 +650,7 @@ static inline void clk_writel(u32 val, u32 __iomem *reg)
 #endif /* platform dependent I/O accessors */
 
 #ifdef CONFIG_DEBUG_FS
-struct dentry *clk_debugfs_add_file(struct clk *clk, char *name, umode_t mode,
+struct dentry *clk_debugfs_add_file(struct clk_hw *hw, char *name, umode_t 
mode,
void *data, const struct file_operations *fops);
 #endif
 
-- 
1.9.3

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


Re: [PATCH 0/5] kvm: memslots lookup optimization

2014-12-02 Thread Igor Mammedov
On Mon, 01 Dec 2014 18:38:34 +0100
Paolo Bonzini pbonz...@redhat.com wrote:

 
 
 On 01/12/2014 18:29, Igor Mammedov wrote:
  Series speed-ups GFN to memslot lookup time by:
   * introducing LRU cache, which improves looukup time for
 same slot workload (typically boot time of Windows and Linux guest)
   * switching to binary search for GFN to memslot lookup,
 improving lookup time with large amount of memory slots
  
  Igor Mammedov (5):
kvm: update_memslots: drop not needed check for the same number of
  pages
kvm: update_memslots: drop not needed check for the same slot
kvm: search_memslots: add simple LRU memslot caching
kvm: change memslot sorting rule from size to GFN
kvm: optimize GFN to memslot lookup with large slots amount
  
   include/linux/kvm_host.h | 28 +++-
   virt/kvm/kvm_main.c  | 46 
  ++
   2 files changed, 49 insertions(+), 25 deletions(-)
  
 
 Applied patches 1-3 for now, I'm not in the mood for proving that the
 binary search is correct. :)
Following write up could help with improving a proving mood :)
http://community.topcoder.com/tc?module=Staticd1=tutorialsd2=binarySearch


 
 Paolo

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


Re: [PATCH 2/2] fs: Wire up sendfd() syscall (all architectures)

2014-12-02 Thread Geert Uytterhoeven
This really needs a CC to linux-arch (added).

On Tue, Dec 2, 2014 at 5:35 AM, Alex Dubov alex.du...@gmail.com wrote:
 Signed-off-by: Alex Dubov oa...@yahoo.com
 ---
  arch/arm/include/uapi/asm/unistd.h|  1 +
  arch/arm/kernel/calls.S   |  1 +
  arch/arm64/include/asm/unistd32.h |  2 ++
  arch/ia64/include/uapi/asm/unistd.h   |  1 +
  arch/ia64/kernel/entry.S  |  1 +
  arch/m68k/include/uapi/asm/unistd.h   |  1 +
  arch/m68k/kernel/syscalltable.S   |  1 +

You forgot to update NR_syscalls in arch/m68k/include/asm/unistd.h.

  arch/microblaze/include/uapi/asm/unistd.h |  1 +
  arch/microblaze/kernel/syscall_table.S|  1 +
  arch/mips/include/uapi/asm/unistd.h   | 15 +--
  arch/mips/kernel/scall32-o32.S|  1 +
  arch/mips/kernel/scall64-64.S |  1 +
  arch/mips/kernel/scall64-n32.S|  1 +
  arch/mips/kernel/scall64-o32.S|  1 +
  arch/parisc/include/uapi/asm/unistd.h |  3 ++-
  arch/powerpc/include/asm/systbl.h |  1 +
  arch/powerpc/include/uapi/asm/unistd.h|  1 +
  arch/s390/include/uapi/asm/unistd.h   |  3 ++-
  arch/s390/kernel/compat_wrapper.c |  1 +
  arch/s390/kernel/syscalls.S   |  1 +
  arch/sparc/include/uapi/asm/unistd.h  |  3 ++-
  arch/sparc/kernel/systbls_32.S|  2 +-
  arch/sparc/kernel/systbls_64.S|  4 ++--
  arch/x86/syscalls/syscall_32.tbl  |  1 +
  arch/x86/syscalls/syscall_64.tbl  |  1 +
  arch/xtensa/include/uapi/asm/unistd.h |  5 +++--
  include/linux/syscalls.h  |  1 +
  include/uapi/asm-generic/unistd.h |  4 +++-
  kernel/sys_ni.c   |  3 +++
  29 files changed, 48 insertions(+), 15 deletions(-)

 diff --git a/arch/arm/include/uapi/asm/unistd.h 
 b/arch/arm/include/uapi/asm/unistd.h
 index 705bb76..6428823 100644
 --- a/arch/arm/include/uapi/asm/unistd.h
 +++ b/arch/arm/include/uapi/asm/unistd.h
 @@ -413,6 +413,7 @@
  #define __NR_getrandom (__NR_SYSCALL_BASE+384)
  #define __NR_memfd_create  (__NR_SYSCALL_BASE+385)
  #define __NR_bpf   (__NR_SYSCALL_BASE+386)
 +#define __NR_sendfd(__NR_SYSCALL_BASE+387)

  /*
   * The following SWIs are ARM private.
 diff --git a/arch/arm/kernel/calls.S b/arch/arm/kernel/calls.S
 index e51833f..30bdeb5 100644
 --- a/arch/arm/kernel/calls.S
 +++ b/arch/arm/kernel/calls.S
 @@ -396,6 +396,7 @@
 CALL(sys_getrandom)
  /* 385 */  CALL(sys_memfd_create)
 CALL(sys_bpf)
 +   CALL(sys_sendfd)
  #ifndef syscalls_counted
  .equ syscalls_padding, ((NR_syscalls + 3)  ~3) - NR_syscalls
  #define syscalls_counted
 diff --git a/arch/arm64/include/asm/unistd32.h 
 b/arch/arm64/include/asm/unistd32.h
 index 9dfdac4..7f19595 100644
 --- a/arch/arm64/include/asm/unistd32.h
 +++ b/arch/arm64/include/asm/unistd32.h
 @@ -794,3 +794,5 @@ __SYSCALL(__NR_getrandom, sys_getrandom)
  __SYSCALL(__NR_memfd_create, sys_memfd_create)
  #define __NR_bpf 386
  __SYSCALL(__NR_bpf, sys_bpf)
 +#define __NR_sendfd 387
 +__SYSCALL(__NR_sendfd, sys_sendfd)
 diff --git a/arch/ia64/include/uapi/asm/unistd.h 
 b/arch/ia64/include/uapi/asm/unistd.h
 index 4c2240c..55be68c 100644
 --- a/arch/ia64/include/uapi/asm/unistd.h
 +++ b/arch/ia64/include/uapi/asm/unistd.h
 @@ -331,5 +331,6 @@
  #define __NR_getrandom 1339
  #define __NR_memfd_create  1340
  #define __NR_bpf   1341
 +#define __NR_sendfd1342

  #endif /* _UAPI_ASM_IA64_UNISTD_H */
 diff --git a/arch/ia64/kernel/entry.S b/arch/ia64/kernel/entry.S
 index f5e96df..97596a3 100644
 --- a/arch/ia64/kernel/entry.S
 +++ b/arch/ia64/kernel/entry.S
 @@ -1779,6 +1779,7 @@ sys_call_table:
 data8 sys_getrandom
 data8 sys_memfd_create  // 1340
 data8 sys_bpf
 +   data8 sys_sendfd

 .org sys_call_table + 8*NR_syscalls // guard against failures to 
 increase NR_syscalls
  #endif /* __IA64_ASM_PARAVIRTUALIZED_NATIVE */
 diff --git a/arch/m68k/include/uapi/asm/unistd.h 
 b/arch/m68k/include/uapi/asm/unistd.h
 index 2c1bec9..77e7098 100644
 --- a/arch/m68k/include/uapi/asm/unistd.h
 +++ b/arch/m68k/include/uapi/asm/unistd.h
 @@ -360,5 +360,6 @@
  #define __NR_getrandom 352
  #define __NR_memfd_create  353
  #define __NR_bpf   354
 +#define __NR_sendfd355

  #endif /* _UAPI_ASM_M68K_UNISTD_H_ */
 diff --git a/arch/m68k/kernel/syscalltable.S b/arch/m68k/kernel/syscalltable.S
 index 2ca219e..3ea20d4 100644
 --- a/arch/m68k/kernel/syscalltable.S
 +++ b/arch/m68k/kernel/syscalltable.S
 @@ -375,4 +375,5 @@ ENTRY(sys_call_table)
 .long sys_getrandom
 .long sys_memfd_create
 .long sys_bpf
 +   .long sys_sendfd

 diff --git a/arch/microblaze/include/uapi/asm/unistd.h 
 b/arch/microblaze/include/uapi/asm/unistd.h

[PATCH v7 1/7] clk: Remove unused function __clk_get_prepare_count

2014-12-02 Thread Tomeu Vizoso
Signed-off-by: Tomeu Vizoso tomeu.viz...@collabora.com
Reviewed-by: Stephen Boyd sb...@codeaurora.org
---
 drivers/clk/clk.c| 5 -
 include/linux/clk-provider.h | 1 -
 2 files changed, 6 deletions(-)

diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 5307225..42f940f 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -574,11 +574,6 @@ unsigned int __clk_get_enable_count(struct clk *clk)
return !clk ? 0 : clk-enable_count;
 }
 
-unsigned int __clk_get_prepare_count(struct clk *clk)
-{
-   return !clk ? 0 : clk-prepare_count;
-}
-
 unsigned long __clk_get_rate(struct clk *clk)
 {
unsigned long ret;
diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h
index 2839c63..fcf3252 100644
--- a/include/linux/clk-provider.h
+++ b/include/linux/clk-provider.h
@@ -544,7 +544,6 @@ u8 __clk_get_num_parents(struct clk *clk);
 struct clk *__clk_get_parent(struct clk *clk);
 struct clk *clk_get_parent_by_index(struct clk *clk, u8 index);
 unsigned int __clk_get_enable_count(struct clk *clk);
-unsigned int __clk_get_prepare_count(struct clk *clk);
 unsigned long __clk_get_rate(struct clk *clk);
 unsigned long __clk_get_accuracy(struct clk *clk);
 unsigned long __clk_get_flags(struct clk *clk);
-- 
1.9.3

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


staging: panel: suggestions needed

2014-12-02 Thread Sudip Mukherjee
Hi,
I have been looking at your panel driver, and am attaching a 20x4 alphanueric 
lcd to it. Will start testing it in a few days as and when I get time. Looks 
like, it is receiving mostly checkpatch and sparse cleanups.

Just wanted your opinion on few things I was thinking:
1) Number of lines you have fixed to 2 and 40 char per line. since I am 
going to connect 20x4 , i need to remember that after displaying 20 character 
in 1st line, next char will come to 3rd line. instead why don't we make the 
option of number of line to 4 ?
2) The lcd commands you are writing to the lcd in an escape sequence 
while writing to the lcd. Instead of that why don't we use ioctl for lcd 
commands, and writing to the device will involve only sending data to lcd ?
3) You have given fixed minor number in your code. Any problem if we 
make it dynamic ?
4) For now I am only attaching a LCD, but I also want to attach a 
keypad to it. Can you please let me know about the schematic of the keypad 
connection? I can find out from the code, but I have not yet seen the keypad 
code.

Waiting in anticipation of your reply.

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


[PATCH v9 1/8] mfd: Add support for Skyworks SKY81452 driver

2014-12-02 Thread gyungoh
From: Gyungoh Yoo jack@skyworksinc.com

Signed-off-by: Gyungoh Yoo jack@skyworksinc.com
Acked-by: Lee Jones lee.jo...@linaro.org
---
Changes v9:
Nothing

Changes v8:
Nothing

Changes v7:
Modified licensing text to GPLv2

Changes v6:
Added new line character at the end of line of dev_err()

Changes v5:
Move sky81452-backlight.h to include/linux/platform_data

Changes v4:
Removed MODULE_VERSION()
Modified license to GPLv2

Changes v3:
Fixed the backlight name from 'sky81452-bl' to 'sky81452-backlight'
Assigned mfd_cell.of_compatible for binding device node
Modified error messages

Changes v2:
Renamed CONFIG_SKY81452 to CONFIG_MFD_SKY81452
Changed the dependency from I2C=y to I2C, for CONFIG_MFD_SKY81452
Added message for exception or errors

 drivers/mfd/Kconfig  |  12 +
 drivers/mfd/Makefile |   1 +
 drivers/mfd/sky81452.c   | 108 +++
 include/linux/mfd/sky81452.h |  31 +
 4 files changed, 152 insertions(+)
 create mode 100644 drivers/mfd/sky81452.c
 create mode 100644 include/linux/mfd/sky81452.h

diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index 1456ea7..a54244c 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -693,6 +693,18 @@ config MFD_SM501_GPIO
 lines on the SM501. The platform data is used to supply the
 base number for the first GPIO line to register.
 
+config MFD_SKY81452
+   tristate Skyworks Solutions SKY81452
+   select MFD_CORE
+   select REGMAP_I2C
+   depends on I2C
+   help
+ This is the core driver for the Skyworks SKY81452 backlight and
+ voltage regulator device.
+
+ This driver can also be built as a module.  If so, the module
+ will be called sky81452.
+
 config MFD_SMSC
bool SMSC ECE1099 series chips
depends on I2C=y
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
index 8bd54b1..d9683ea 100644
--- a/drivers/mfd/Makefile
+++ b/drivers/mfd/Makefile
@@ -174,6 +174,7 @@ obj-$(CONFIG_MFD_STW481X)   += stw481x.o
 obj-$(CONFIG_MFD_IPAQ_MICRO)   += ipaq-micro.o
 obj-$(CONFIG_MFD_MENF21BMC)+= menf21bmc.o
 obj-$(CONFIG_MFD_HI6421_PMIC)  += hi6421-pmic-core.o
+obj-$(CONFIG_MFD_SKY81452) += sky81452.o
 
 intel-soc-pmic-objs:= intel_soc_pmic_core.o intel_soc_pmic_crc.o
 obj-$(CONFIG_INTEL_SOC_PMIC)   += intel-soc-pmic.o
diff --git a/drivers/mfd/sky81452.c b/drivers/mfd/sky81452.c
new file mode 100644
index 000..b0c9b04
--- /dev/null
+++ b/drivers/mfd/sky81452.c
@@ -0,0 +1,108 @@
+/*
+ * sky81452.c  SKY81452 MFD driver
+ *
+ * Copyright 2014 Skyworks Solutions Inc.
+ * Author : Gyungoh Yoo jack@skyworksinc.com
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, see http://www.gnu.org/licenses/.
+ */
+
+#include linux/kernel.h
+#include linux/module.h
+#include linux/init.h
+#include linux/err.h
+#include linux/slab.h
+#include linux/i2c.h
+#include linux/regmap.h
+#include linux/mfd/core.h
+#include linux/mfd/sky81452.h
+
+static const struct regmap_config sky81452_config = {
+   .reg_bits = 8,
+   .val_bits = 8,
+};
+
+static int sky81452_probe(struct i2c_client *client,
+   const struct i2c_device_id *id)
+{
+   struct device *dev = client-dev;
+   const struct sky81452_platform_data *pdata = dev_get_platdata(dev);
+   struct mfd_cell cells[2];
+   struct regmap *regmap;
+   int ret;
+
+   if (!pdata) {
+   pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
+   if (!pdata)
+   return -ENOMEM;
+   }
+
+   regmap = devm_regmap_init_i2c(client, sky81452_config);
+   if (IS_ERR(regmap)) {
+   dev_err(dev, failed to initialize.err=%ld\n, PTR_ERR(regmap));
+   return PTR_ERR(regmap);
+   }
+
+   i2c_set_clientdata(client, regmap);
+
+   memset(cells, 0, sizeof(cells));
+   cells[0].name = sky81452-backlight;
+   cells[0].of_compatible = skyworks,sky81452-backlight;
+   cells[0].platform_data = pdata-bl_pdata;
+   cells[0].pdata_size = sizeof(*pdata-bl_pdata);
+   cells[1].name = sky81452-regulator;
+   cells[1].platform_data = pdata-regulator_init_data;
+   cells[1].pdata_size = sizeof(*pdata-regulator_init_data);
+
+   ret = mfd_add_devices(dev, -1, cells, ARRAY_SIZE(cells), NULL, 0, NULL);
+   if (ret)
+   dev_err(dev, failed to add child devices. err=%d\n, ret);
+
+   

[PATCH v9 0/8] Add Skyworks SKY81452 device drivers

2014-12-02 Thread gyungoh
From: Gyungoh Yoo jack@skyworksinc.com

This patch set includes regulator and backlight driver for SKY81452.
Also it includes documents for device tree and module.
The initial version of sky81452-regulator was applied. Fo this, incremental
patches are included.

v9:
Removed the change to remove MODULE_VERSION() for sky81452-regulator

v8:
Renamed property names for backlight with vendor prefix
Modified gpio-enable property to generic property for GPIO
Made up the example for backlight DT
Changed the DT parsing of regulator using regulator_node and of_match

v7:
Modified licensing text to GPLv2
Splitted Kconfig renaming from DT patch

v6:
Added new line character at the end of line of dev_err()

v5:
Changed DT for regulator : 'lout' node should be defined under 'regulator'
Removed compatible string from sky81452-regulator driver
Modified sky81452-regulator to return EINVAL when of_node is NULL
Move sky81452-backlight.h to include/linux/platform_data

v4:
Removed MODULE_VERSION()
Modified license to GPLv2
Removed calling to backlight_device_unregister() in sky81452-backlight

v3:
Cleaned-up DBG messages
Cleaned-up DT
Fixed the backlight name from 'sky81452-bl' to 'sky81452-backlight'
Assigned mfd_cell.of_compatible for binding device node
Modified error messages
Modified sky81452-regulator to return ENODATA when of_node is NULL

v2:
Split the patches for each sub-system
Added 'reg' attribute for I2C address in device tree documents
Added 'compatible' attribute in child drivers
Renamed CONFIG_SKY81452 to CONFIG_MFD_SKY81452
Changed the dependency from I2C=y to I2C, for CONFIG_MFD_SKY81452
Added message for exception or errors.
Added vendor prefix for Skyworks Solutions, Inc.
Add SKY81452 to the Trivial Devices list


Gyungoh Yoo (8):
  mfd: Add support for Skyworks SKY81452 driver
  backlight: Add support Skyworks SKY81452 backlight driver
  devicetree: mfd: Add new SKY81452 mfd binding
  devicetree: backlight: Add new SKY81452 backlight binding
  devicetree: Add vendor prefix for Skyworks Solutions, Inc.
  devicetree: i2c: Add SKY81452 to the Trivial Devices list
  regulator: sky81452: Modify Device Tree structure
  devicetree: regulator: sky81452: Modify Device Tree structure

 .../devicetree/bindings/i2c/trivial-devices.txt|   1 +
 Documentation/devicetree/bindings/mfd/sky81452.txt |  36 +++
 .../bindings/regulator/sky81452-regulator.txt  |  10 +-
 .../devicetree/bindings/vendor-prefixes.txt|   1 +
 .../video/backlight/sky81452-backlight.txt |  29 ++
 drivers/mfd/Kconfig|  12 +
 drivers/mfd/Makefile   |   1 +
 drivers/mfd/sky81452.c | 108 +++
 drivers/regulator/sky81452-regulator.c |  45 +--
 drivers/video/backlight/Kconfig|  10 +
 drivers/video/backlight/Makefile   |   1 +
 drivers/video/backlight/sky81452-backlight.c   | 340 +
 include/linux/mfd/sky81452.h   |  31 ++
 include/linux/platform_data/sky81452-backlight.h   |  46 +++
 14 files changed, 631 insertions(+), 40 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/mfd/sky81452.txt
 create mode 100644 
Documentation/devicetree/bindings/video/backlight/sky81452-backlight.txt
 create mode 100644 drivers/mfd/sky81452.c
 create mode 100644 drivers/video/backlight/sky81452-backlight.c
 create mode 100644 include/linux/mfd/sky81452.h
 create mode 100644 include/linux/platform_data/sky81452-backlight.h

-- 
1.9.1

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


[PATCH v9 6/8] devicetree: i2c: Add SKY81452 to the Trivial Devices list

2014-12-02 Thread gyungoh
From: Gyungoh Yoo jack@skyworksinc.com

Signed-off-by: Gyungoh Yoo jack@skyworksinc.com
---
Changes v9:
Nothing

Changes v8:
Nothing

Changes v7:
Nothing

Changes v6:
Nothing

Changes v5:
Nothing

Changes v4:
Nothing

Changes v3:
Nothing

Changes v2:
Add SKY81452 to the Trivial Devices list

 Documentation/devicetree/bindings/i2c/trivial-devices.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/i2c/trivial-devices.txt 
b/Documentation/devicetree/bindings/i2c/trivial-devices.txt
index fbde415..122fa1e 100644
--- a/Documentation/devicetree/bindings/i2c/trivial-devices.txt
+++ b/Documentation/devicetree/bindings/i2c/trivial-devices.txt
@@ -77,6 +77,7 @@ ramtron,24c64 i2c serial eeprom  (24cxx)
 ricoh,rs5c372a I2C bus SERIAL INTERFACE REAL-TIME CLOCK IC
 samsung,24ad0xd1   S524AD0XF1 (128K/256K-bit Serial EEPROM for Low Power)
 sii,s35390a2-wire CMOS real-time clock
+skyworks,sky81452  Skyworks SKY81452: Six-Channel White LED Driver with 
Touch Panel Bias Supply
 st-micro,24c256i2c serial eeprom  (24cxx)
 stm,m41t00 Serial Access TIMEKEEPER
 stm,m41t62 Serial real-time clock (RTC) with alarm
-- 
1.9.1

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


[PATCH v9 4/8] devicetree: backlight: Add new SKY81452 backlight binding

2014-12-02 Thread gyungoh
From: Gyungoh Yoo jack@skyworksinc.com

Signed-off-by: Gyungoh Yoo jack@skyworksinc.com
---
Changes v9:
Nothing

Changes v8:
Renamed property names for backlight with vendor prefix
Modified gpio-enable property to generic property for GPIO
Made up the example for backlight DT

Changes v7:
Nothing

Changes v6:
Nothing

Changes v5:
Nothing

Changes v4:
Nothing

Changes v3:
Nothing

Changes v2:
Added reg attribute for I2C slave address

 .../video/backlight/sky81452-backlight.txt | 29 ++
 1 file changed, 29 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/video/backlight/sky81452-backlight.txt

diff --git 
a/Documentation/devicetree/bindings/video/backlight/sky81452-backlight.txt 
b/Documentation/devicetree/bindings/video/backlight/sky81452-backlight.txt
new file mode 100644
index 000..8daebf5
--- /dev/null
+++ b/Documentation/devicetree/bindings/video/backlight/sky81452-backlight.txt
@@ -0,0 +1,29 @@
+SKY81452-backlight bindings
+
+Required properties:
+- compatible   : Must be skyworks,sky81452-backlight
+
+Optional properties:
+- name : Name of backlight device. Default is 'lcd-backlight'.
+- gpios: GPIO to use to EN pin.
+   See Documentation/devicetree/bindings/gpio/gpio.txt
+- skyworks,en-channels : Enable mask for current sink channel 1 to 6.
+- skyworks,ignore-pwm  : Ignore both PWM input
+- skyworks,dpwm-mode   : Enable DPWM dimming mode, otherwise Analog dimming.
+- skyworks,phase-shift : Enable phase shift mode
+- skyworks,ovp-level   : Over-voltage protection level.
+   Should be between 14 or 28V.
+- skyworks,short-detection-threshold   : It should be one of 4, 5, 6 and 7V.
+- skyworks,current-limit   : It should be 2300mA or 2750mA.
+
+Example:
+
+   backlight {
+   compatible = skyworks,sky81452-backlight;
+   name = pwm-backlight;
+   skyworks,en-channels = 0x3f;
+   skyworks,ignore-pwm;
+   skyworks,phase-shift;
+   skyworks,ovp-level = 20;
+   skyworks,current-limit = 2300;
+   };
-- 
1.9.1

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


[PATCH v9 3/8] devicetree: mfd: Add new SKY81452 mfd binding

2014-12-02 Thread gyungoh
From: Gyungoh Yoo jack@skyworksinc.com

Signed-off-by: Gyungoh Yoo jack@skyworksinc.com
---
Changes v9:
Nothing

Changes v8:
Made up the example for backlight DT

Changes v7:
Nothing

Changes v6:
Nothing

Changes v5:
Changed DT for regulator : 'lout' node should be defined under 'regulator'
Removed compatible string from sky81452-regulator driver

Changes v4:
Nothing

Changes v3:
Nothing

Changes v2:
Added reg attribute for I2C slave address

 Documentation/devicetree/bindings/mfd/sky81452.txt | 36 ++
 1 file changed, 36 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mfd/sky81452.txt

diff --git a/Documentation/devicetree/bindings/mfd/sky81452.txt 
b/Documentation/devicetree/bindings/mfd/sky81452.txt
new file mode 100644
index 000..ab71473
--- /dev/null
+++ b/Documentation/devicetree/bindings/mfd/sky81452.txt
@@ -0,0 +1,36 @@
+SKY81452 bindings
+
+Required properties:
+- compatible   : Must be skyworks,sky81452
+- reg  : I2C slave address
+
+Required child nodes:
+- backlight: container node for backlight following the binding
+   in video/backlight/sky81452-backlight.txt
+- regulator: container node for regulators following the binding
+   in regulator/sky81452-regulator.txt
+
+Example:
+
+   sky81452@2c {
+   compatible = skyworks,sky81452;
+   reg = 0x2c;
+
+   backlight {
+   compatible = skyworks,sky81452-backlight;
+   name = pwm-backlight;
+   skyworks,en-channels = 0x3f;
+   skyworks,ignore-pwm;
+   skyworks,phase-shift;
+   skyworks,ovp-level = 20;
+   skyworks,current-limit = 2300;
+   };
+
+   regulator {
+   lout {
+   regulator-name = sky81452-lout;
+   regulator-min-microvolt = 450;
+   regulator-max-microvolt = 800;
+   };
+   };
+   };
-- 
1.9.1

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


[PATCH v9 7/8] regulator: sky81452: Modify Device Tree structure

2014-12-02 Thread gyungoh
From: Gyungoh Yoo jack@skyworksinc.com

Signed-off-by: Gyungoh Yoo jack@skyworksinc.com
---
Changes v9:
Removed the change to remove MODULE_VERSION()

Changes v8:
Changed the DT parsing of regulator using regulator_node and of_match

Changes v7:
Modified licensing text to GPLv2
Splitted Kconfig renaming from DT patch

Changes v6:
Added new line character at the end of line of dev_err()

Changes v5:
Changed DT for regulator : 'lout' node should be defined under 'regulator'
Removed compatible string
Modified to return EINVAL when of_node is NULL

Changes v4:
Removed MODULE_VERSION()
Modified license to GPLv2

Changes v3:
Modified to return ENODATA when of_node is NULL
Modified the messages in error cases

Changes v2:
Added 'compatible' attribute in the driver
Added message for exception or errors.

 drivers/regulator/sky81452-regulator.c | 45 +++---
 1 file changed, 9 insertions(+), 36 deletions(-)

diff --git a/drivers/regulator/sky81452-regulator.c 
b/drivers/regulator/sky81452-regulator.c
index 476b80a..6478606 100644
--- a/drivers/regulator/sky81452-regulator.c
+++ b/drivers/regulator/sky81452-regulator.c
@@ -5,9 +5,8 @@
  * Author : Gyungoh Yoo jack@skyworksinc.com
  *
  * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2, or (at your option) any
- * later version.
+ * under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation.
  *
  * This program is distributed in the hope that it will be useful, but
  * WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -52,6 +51,8 @@ static const struct regulator_linear_range 
sky81452_reg_ranges[] = {
 
 static const struct regulator_desc sky81452_reg = {
.name = LOUT,
+   .of_match = of_match_ptr(lout),
+   .regulators_node = of_match_ptr(regulator),
.ops = sky81452_reg_ops,
.type = REGULATOR_VOLTAGE,
.owner = THIS_MODULE,
@@ -64,30 +65,6 @@ static const struct regulator_desc sky81452_reg = {
.enable_mask = SKY81452_LEN,
 };
 
-#ifdef CONFIG_OF
-static struct regulator_init_data *sky81452_reg_parse_dt(struct device *dev)
-{
-   struct regulator_init_data *init_data;
-   struct device_node *np;
-
-   np = of_get_child_by_name(dev-parent-of_node, regulator);
-   if (unlikely(!np)) {
-   dev_err(dev, regulator node not found);
-   return NULL;
-   }
-
-   init_data = of_get_regulator_init_data(dev, np);
-
-   of_node_put(np);
-   return init_data;
-}
-#else
-static struct regulator_init_data *sky81452_reg_parse_dt(struct device *dev)
-{
-   return ERR_PTR(-EINVAL);
-}
-#endif
-
 static int sky81452_reg_probe(struct platform_device *pdev)
 {
struct device *dev = pdev-dev;
@@ -95,20 +72,16 @@ static int sky81452_reg_probe(struct platform_device *pdev)
struct regulator_config config = { };
struct regulator_dev *rdev;
 
-   if (!init_data) {
-   init_data = sky81452_reg_parse_dt(dev);
-   if (IS_ERR(init_data))
-   return PTR_ERR(init_data);
-   }
-
-   config.dev = dev;
+   config.dev = dev-parent;
config.init_data = init_data;
config.of_node = dev-of_node;
config.regmap = dev_get_drvdata(dev-parent);
 
rdev = devm_regulator_register(dev, sky81452_reg, config);
-   if (IS_ERR(rdev))
+   if (IS_ERR(rdev)) {
+   dev_err(dev, failed to register. err=%ld\n, PTR_ERR(rdev));
return PTR_ERR(rdev);
+   }
 
platform_set_drvdata(pdev, rdev);
 
@@ -126,4 +99,4 @@ module_platform_driver(sky81452_reg_driver);
 
 MODULE_DESCRIPTION(Skyworks SKY81452 Regulator driver);
 MODULE_AUTHOR(Gyungoh Yoo jack@skyworksinc.com);
-MODULE_LICENSE(GPL);
+MODULE_LICENSE(GPL v2);
-- 
1.9.1

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


[PATCH v9 5/8] devicetree: Add vendor prefix for Skyworks Solutions, Inc.

2014-12-02 Thread gyungoh
From: Gyungoh Yoo jack@skyworksinc.com

Signed-off-by: Gyungoh Yoo jack@skyworksinc.com
---
Changes v9:
Nothing

Changes v8:
Nothing

Changes v7:
Nothing

Changes v6:
Nothing

Changes v5:
Nothing

Changes v4:
Nothing

Changes v3:
Nothing

Changes v2:
Added vendor prefix for Skyworks Solutions, Inc.

 Documentation/devicetree/bindings/vendor-prefixes.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt 
b/Documentation/devicetree/bindings/vendor-prefixes.txt
index a344ec2..68143f0 100644
--- a/Documentation/devicetree/bindings/vendor-prefixes.txt
+++ b/Documentation/devicetree/bindings/vendor-prefixes.txt
@@ -140,6 +140,7 @@ sii Seiko Instruments, Inc.
 silergySilergy Corp.
 sirf   SiRF Technology, Inc.
 sitronix   Sitronix Technology Corporation
+skyworks   Skyworks Solutions, Inc.
 smsc   Standard Microsystems Corporation
 snps   Synopsys, Inc.
 solidrun   SolidRun
-- 
1.9.1

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


[PATCH v9 8/8] devicetree: regulator: sky81452: Modify Device Tree structure

2014-12-02 Thread gyungoh
From: Gyungoh Yoo jack@skyworksinc.com

Signed-off-by: Gyungoh Yoo jack@skyworksinc.com
---
Changes v9:
Nothing

Changes v8:
Nothing

Changes v7:
Nothing

Changes v6:
Nothing

Changes v5:
Changed DT for regulator : 'lout' node should be defined under 'regulator'
Removed compatible string from sky81452-regulator driver

Changes v4:
Nothing

Changes v3:
Nothing

Changes v2:
Added 'compatible' attribute in the driver

 .../devicetree/bindings/regulator/sky81452-regulator.txt   | 10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/Documentation/devicetree/bindings/regulator/sky81452-regulator.txt 
b/Documentation/devicetree/bindings/regulator/sky81452-regulator.txt
index 882455e..f9acbc1 100644
--- a/Documentation/devicetree/bindings/regulator/sky81452-regulator.txt
+++ b/Documentation/devicetree/bindings/regulator/sky81452-regulator.txt
@@ -1,6 +1,7 @@
 SKY81452 voltage regulator
 
 Required properties:
+- regulator node named lout.
 - any required generic properties defined in regulator.txt
 
 Optional properties:
@@ -9,8 +10,9 @@ Optional properties:
 Example:
 
regulator {
-   /* generic regulator properties */
-   regulator-name = touch_en;
-   regulator-min-microvolt = 450;
-   regulator-max-microvolt = 800;
+   lout {
+   regulator-name = sky81452-lout;
+   regulator-min-microvolt = 450;
+   regulator-max-microvolt = 800;
+   };
};
-- 
1.9.1

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


[PATCH v9 2/8] backlight: Add support Skyworks SKY81452 backlight driver

2014-12-02 Thread gyungoh
From: Gyungoh Yoo jack@skyworksinc.com

Signed-off-by: Gyungoh Yoo jack@skyworksinc.com
---
Changes v9:
Nothing

Changes v8:
Renamed property names for backlight with vendor prefix
Modified gpio-enable property to generic property for GPIO

Changes v7:
Modified licensing text to GPLv2

Changes v6:
Added new line character at the end of line of dev_err()

Changes v5:
Move sky81452-backlight.h to include/linux/platform_data

Changes v4:
Reordering header files for readability
Removed calling to backlight_device_unregister()
Removed MODULE_VERSION()
Modified license to GPLv2

Changes v3:
Modified DBG messages

Changes v2:
Added 'compatible' attribute in the driver
Added message for exception or errors

 drivers/video/backlight/Kconfig  |  10 +
 drivers/video/backlight/Makefile |   1 +
 drivers/video/backlight/sky81452-backlight.c | 340 +++
 include/linux/platform_data/sky81452-backlight.h |  46 +++
 4 files changed, 397 insertions(+)
 create mode 100644 drivers/video/backlight/sky81452-backlight.c
 create mode 100644 include/linux/platform_data/sky81452-backlight.h

diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig
index 8d03924..2586fdd 100644
--- a/drivers/video/backlight/Kconfig
+++ b/drivers/video/backlight/Kconfig
@@ -409,6 +409,16 @@ config BACKLIGHT_PANDORA
  If you have a Pandora console, say Y to enable the
  backlight driver.
 
+config BACKLIGHT_SKY81452
+   tristate Backlight driver for SKY81452
+   depends on BACKLIGHT_CLASS_DEVICE  MFD_SKY81452
+   help
+ If you have a Skyworks SKY81452, say Y to enable the
+ backlight driver.
+
+ To compile this driver as a module, choose M here: the module will
+ be called sky81452-backlight
+
 config BACKLIGHT_TPS65217
tristate TPS65217 Backlight
depends on BACKLIGHT_CLASS_DEVICE  MFD_TPS65217
diff --git a/drivers/video/backlight/Makefile b/drivers/video/backlight/Makefile
index fcd50b73..d67073f 100644
--- a/drivers/video/backlight/Makefile
+++ b/drivers/video/backlight/Makefile
@@ -50,6 +50,7 @@ obj-$(CONFIG_BACKLIGHT_PANDORA)   += pandora_bl.o
 obj-$(CONFIG_BACKLIGHT_PCF50633)   += pcf50633-backlight.o
 obj-$(CONFIG_BACKLIGHT_PWM)+= pwm_bl.o
 obj-$(CONFIG_BACKLIGHT_SAHARA) += kb3886_bl.o
+obj-$(CONFIG_BACKLIGHT_SKY81452)   += sky81452-backlight.o
 obj-$(CONFIG_BACKLIGHT_TOSA)   += tosa_bl.o
 obj-$(CONFIG_BACKLIGHT_TPS65217)   += tps65217_bl.o
 obj-$(CONFIG_BACKLIGHT_WM831X) += wm831x_bl.o
diff --git a/drivers/video/backlight/sky81452-backlight.c 
b/drivers/video/backlight/sky81452-backlight.c
new file mode 100644
index 000..45e575f
--- /dev/null
+++ b/drivers/video/backlight/sky81452-backlight.c
@@ -0,0 +1,340 @@
+/*
+ * sky81452-backlight.cSKY81452 backlight driver
+ *
+ * Copyright 2014 Skyworks Solutions Inc.
+ * Author : Gyungoh Yoo jack@skyworksinc.com
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, see http://www.gnu.org/licenses/.
+ */
+
+#include linux/backlight.h
+#include linux/err.h
+#include linux/gpio.h
+#include linux/init.h
+#include linux/kernel.h
+#include linux/module.h
+#include linux/of.h
+#include linux/of_gpio.h
+#include linux/platform_device.h
+#include linux/regmap.h
+#include linux/platform_data/sky81452-backlight.h
+#include linux/slab.h
+
+/* registers */
+#define SKY81452_REG0  0x00
+#define SKY81452_REG1  0x01
+#define SKY81452_REG2  0x02
+#define SKY81452_REG4  0x04
+#define SKY81452_REG5  0x05
+
+/* bit mask */
+#define SKY81452_CS0xFF
+#define SKY81452_EN0x3F
+#define SKY81452_IGPW  0x20
+#define SKY81452_PWMMD 0x10
+#define SKY81452_PHASE 0x08
+#define SKY81452_ILIM  0x04
+#define SKY81452_VSHRT 0x03
+#define SKY81452_OCP   0x80
+#define SKY81452_OTMP  0x40
+#define SKY81452_SHRT  0x3F
+#define SKY81452_OPN   0x3F
+
+#define SKY81452_DEFAULT_NAME lcd-backlight
+#define SKY81452_MAX_BRIGHTNESS(SKY81452_CS + 1)
+
+#define CTZ(b) __builtin_ctz(b)
+
+static int sky81452_bl_update_status(struct backlight_device *bd)
+{
+   const struct sky81452_bl_platform_data *pdata =
+   dev_get_platdata(bd-dev.parent);
+   const unsigned int brightness = (unsigned int)bd-props.brightness;
+   struct regmap *regmap = bl_get_data(bd);
+   int ret;
+
+   if (brightness  0) {
+   ret = regmap_write(regmap, SKY81452_REG0, brightness - 

Re: [PATCH RFC v4 net-next 0/5] virtio_net: enabling tx interrupts

2014-12-02 Thread Jason Wang



On Tue, Dec 2, 2014 at 11:15 AM, Jason Wang jasow...@redhat.com wrote:



On Mon, Dec 1, 2014 at 6:42 PM, Michael S. Tsirkin m...@redhat.com 
wrote:

On Mon, Dec 01, 2014 at 06:17:03PM +0800, Jason Wang wrote:

 Hello:
  We used to orphan packets before transmission for virtio-net. 
This breaks

 socket accounting and can lead serveral functions won't work, e.g:
  - Byte Queue Limit depends on tx completion nofication to work.
 - Packet Generator depends on tx completion nofication for the last
   transmitted packet to complete.
 - TCP Small Queue depends on proper accounting of sk_wmem_alloc to 
work.
  This series tries to solve the issue by enabling tx interrupts. 
To minize

 the performance impacts of this, several optimizations were used:
  - In guest side, virtqueue_enable_cb_delayed() was used to delay 
the tx

   interrupt untile 3/4 pending packets were sent.
 - In host side, interrupt coalescing were used to reduce tx 
interrupts.

  Performance test results[1] (tx-frames 16 tx-usecs 16) shows:
  - For guest receiving. No obvious regression on throughput were
   noticed. More cpu utilization were noticed in few cases.
 - For guest transmission. Very huge improvement on througput for 
small
   packet transmission were noticed. This is expected since TSQ and 
other
   optimization for small packet transmission work after tx 
interrupt. But

   will use more cpu for large packets.
 - For TCP_RR, regression (10% on transaction rate and cpu 
utilization) were
   found. Tx interrupt won't help but cause overhead in this case. 
Using
   more aggressive coalescing parameters may help to reduce the 
regression.


OK, you do have posted coalescing patches - does it help any?


Helps a lot.

For RX, it saves about 5% - 10% cpu. (reduce 60%-90% tx intrs)
For small packet TX, it increases 33% - 245% throughput. (reduce 
about 60% inters)
For TCP_RR, it increase the 3%-10% trans.rate. (reduce 40%-80% tx 
intrs)




I'm not sure the regression is due to interrupts.
It would make sense for CPU but why would it
hurt transaction rate?


Anyway guest need to take some cycles to handle tx interrupts.
And transaction rate does increase if we coalesces more tx 
interurpts. 



It's possible that we are deferring kicks too much due to BQL.

As an experiment: do we get any of it back if we do
-if (kick || netif_xmit_stopped(txq))
-virtqueue_kick(sq-vq);
+virtqueue_kick(sq-vq);
?



I will try, but during TCP_RR, at most 1 packets were pending,
I suspect if BQL can help in this case.


Looks like this helps a lot in multiple sessions of TCP_RR.

How about move the BQL patch out of this series?

Let's first converge tx interrupt and then introduce it?
(e.g with kicking after queuing X bytes?)






If yes, we can just kick e.g. periodically, e.g. after queueing each
X bytes.


Okay, let me try to see if this help.



 Changes from RFC V3:
 - Don't free tx packets in ndo_start_xmit()
 - Add interrupt coalescing support for virtio-net
 Changes from RFC v2:
 - clean up code, address issues raised by Jason
 Changes from RFC v1:
 - address comments by Jason Wang, use delayed cb everywhere
 - rebased Jason's patch on top of mine and include it (with some 
tweaks)

  Please reivew. Comments were more than welcomed.
  [1] Performance Test result:
  Environment:
 - Two Intel(R) Xeon(R) CPU E5620 @ 2.40GHz machines connected back 
to back

   with 82599ES cards.
 - Both host and guest were net-next.git plus the patch
 - Coalescing parameters for the card:
   Adaptive RX: off  TX: off
   rx-usecs: 1
   rx-frames: 0
   tx-usecs: 0
   tx-frames: 0
 - Vhost_net was enabled and zerocopy was disabled
 - Tests was done by netperf-2.6
 - Guest has 2 vcpus with single queue virtio-net
  Results:
 - Numbers of square brackets are whose significance is grater than 
95%

  Guest RX:
  size/sessions/+throughput/+cpu/+per_cpu_throughput/
 64/1/+2.0326/[+6.2807%]/-3.9970%/
 64/2/-0.2104%/[+3.2012%]/[-3.3058%]/
 64/4/+1.5956%/+2.2451%/-0.6353%/
 64/8/+1.1732%/+3.5123%/-2.2598%/
 256/1/+3.7619%/[+5.8117%]/-1.9372%/
 256/2/-0.0661%/[+3.2511%]/-3.2127%/
 256/4/+1.1435%/[-8.1842%]/[+10.1591%]/
 256/8/[+2.2447%]/[+6.2044%]/[-3.7283%]/
 1024/1/+9.1479%/[+12.0997%]/[-2.6332%]/
 1024/2/[-17.3341%]/[+0.%]/[-17.3341%]/
 1024/4/[-0.6284%]/-1.0376%/+0.4135%/
 1024/8/+1.1444%/-1.6069%/+2.7961%/
 4096/1/+0.0401%/-0.5993%/+0.6433%/
 4096/2/[-0.5894%]/-2.2071%/+1.6542%/
 4096/4/[-0.5560%]/-1.4969%/+0.9553%/
 4096/8/-0.3362%/+2.7086%/-2.9645%/
 16384/1/-0.0285%/+0.7247%/-0.7478%/
 16384/2/-0.5286%/+0.3287%/-0.8545%/
 16384/4/-0.3297%/-2.0543%/+1.7608%/
 16384/8/+1.0932%/+4.0253%/-2.8187%/
 65535/1/+0.0003%/-0.1502%/+0.1508%/
 65535/2/[-0.6065%]/+0.2309%/-0.8355%/
 65535/4/[-0.6861%]/[+3.9451%]/[-4.4554%]/
 65535/8/+1.8359%/+3.1590%/-1.2825%/
  Guest RX:
 size/sessions/+throughput/+cpu/+per_cpu_throughput/
 64/1/[+65.0961%]/[-8.6807%]/[+80.7900%]/
 64/2/[+6.0288%]/[-2.2823%]/[+8.5052%]/
 

[PATCH V6 0/9] Add new powerpc specific ELF core notes

2014-12-02 Thread Anshuman Khandual
This patch series adds five new ELF core note sections which can be
used with existing ptrace request PTRACE_GETREGSET-SETREGSET for accessing
various transactional memory and miscellaneous debug register sets on powerpc
platform.

Previous versions:
==
RFC: https://lkml.org/lkml/2014/4/1/292
V1:  https://lkml.org/lkml/2014/4/2/43
V2:  https://lkml.org/lkml/2014/5/5/88
V3:  https://lkml.org/lkml/2014/5/23/486
V4:  https://lkml.org/lkml/2014/11/11/6
V5:  https://lkml.org/lkml/2014/11/25/134

Changes in V6:
--
- Added two git ignore patches for powerpc selftests
- Re-formatted all in-code function definitions in kernel-doc format

Changes in V5:
--
- Changed flush_tmregs_to_thread, so not to take into account self tracing
- Dropped the 3rd patch in the series which had merged two functions
- Fixed one build problem for the misc debug register patch
- Accommodated almost all the review comments from Suka on the 6th patch
- Minor changes to the self test program
- Changed commit messages for some of the patches

Changes in V4:
--
- Added one test program into the powerpc selftest bucket in this regard
- Split the 2nd patch in the previous series into four different patches
- Accommodated most of the review comments on the previous patch series
- Added a patch to merge functions __switch_to_tm and tm_reclaim_task

Changes in V3:
--
- Added two new error paths in every TM related get/set functions when regset
  support is not present on the system (ENODEV) or when the process does not
  have any transaction active (ENODATA) in the context
- Installed the active hooks for all the newly added regset core note types

Changes in V2:
--
- Removed all the power specific ptrace requests corresponding to new NT_PPC_*
  elf core note types. Now all the register sets can be accessed from ptrace
  through PTRACE_GETREGSET/PTRACE_SETREGSET using the individual NT_PPC* core
  note type instead
- Fixed couple of attribute values for REGSET_TM_CGPR register set
- Renamed flush_tmreg_to_thread as flush_tmregs_to_thread
- Fixed 32 bit checkpointed GPR support
- Changed commit messages accordingly

Test Result
---
The patch series has been verified both in 32 bit and 64 bit compiled test
program. Test result for the selftest test (64 bit compiled) can be found here.

test: tm_ptrace
tags: git_version:v3.18-rc6-8-ge2aa4ce
===Testing TM based PTRACE Interface===
Testing TM specific SPR:
TFHAR: 10001098
TEXASR: de018c01
TFIAR: c0041858
TM ORIG_MSR: 8005f032
TM CH DSCR: a (PASSED)
TM CH TAR: 14 (PASSED)
TM CH PPR: 8 (PASSED)
Testing TM checkpointed GPR:
TM CH NIP: 10001098
TM CH LINK: 1ea0
TM CH CCR: 24000422
TM CH GPR[0]: 0 (PASSED)
TM CH GPR[1]: 1 (PASSED)
TM CH GPR[2]: 2 (PASSED)
TM CH GPR[3]: 3 (PASSED)
TM CH GPR[4]: 4 (PASSED)
TM CH GPR[5]: 5 (PASSED)
TM CH GPR[6]: 6 (PASSED)
TM CH GPR[7]: 7 (PASSED)
TM CH GPR[8]: 8 (PASSED)
TM CH GPR[9]: 9 (PASSED)
TM CH GPR[10]: a (PASSED)
TM CH GPR[11]: b (PASSED)
TM CH GPR[12]: c (PASSED)
TM CH GPR[13]: d (PASSED)
TM CH GPR[14]: e (PASSED)
TM CH GPR[15]: f (PASSED)
TM CH GPR[16]: 0 (PASSED)
TM CH GPR[17]: 1 (PASSED)
TM CH GPR[18]: 2 (PASSED)
TM CH GPR[19]: 3 (PASSED)
TM CH GPR[20]: 4 (PASSED)
TM CH GPR[21]: 5 (PASSED)
TM CH GPR[22]: 6 (PASSED)
TM CH GPR[23]: 7 (PASSED)
TM CH GPR[24]: 8 (PASSED)
TM CH GPR[25]: 9 (PASSED)
TM CH GPR[26]: a (PASSED)
TM CH GPR[27]: b (PASSED)
TM CH GPR[28]: c (PASSED)
TM CH GPR[29]: d (PASSED)
TM CH GPR[30]: e (PASSED)
TM CH GPR[31]: f (PASSED)
Testing TM checkpointed FPR:
TM CH FPSCR: 0
TM CH FPR[0]: 0 (PASSED)
TM CH FPR[1]: 1 (PASSED)
TM CH FPR[2]: 2 (PASSED)
TM CH FPR[3]: 3 (PASSED)
TM CH FPR[4]: 4 (PASSED)
TM CH FPR[5]: 5 (PASSED)
TM CH FPR[6]: 6 (PASSED)
TM CH FPR[7]: 7 (PASSED)
TM CH FPR[8]: 8 (PASSED)
TM CH FPR[9]: 9 (PASSED)
TM CH FPR[10]: a (PASSED)
TM CH FPR[11]: b (PASSED)
TM CH FPR[12]: c (PASSED)
TM CH FPR[13]: d (PASSED)
TM CH FPR[14]: e (PASSED)
TM CH FPR[15]: f (PASSED)
TM CH FPR[16]: 0 (PASSED)
TM CH FPR[17]: 1 (PASSED)
TM CH FPR[18]: 2 (PASSED)
TM CH FPR[19]: 3 (PASSED)
TM CH FPR[20]: 4 (PASSED)
TM CH FPR[21]: 5 (PASSED)
TM CH FPR[22]: 6 (PASSED)
TM CH FPR[23]: 7 (PASSED)
TM CH FPR[24]: 8 (PASSED)
TM CH FPR[25]: 9 (PASSED)
TM CH FPR[26]: a (PASSED)
TM CH FPR[27]: b (PASSED)
TM CH FPR[28]: c (PASSED)
TM CH FPR[29]: d (PASSED)
TM CH FPR[30]: e (PASSED)
TM CH FPR[31]: f (PASSED)
Testing TM running GPR:
TM RN NIP: 100011b0
TM RN LINK: 1ea0
TM RN CCR: 4000422
TM RN GPR[0]: f (PASSED)
TM RN GPR[1]: e (PASSED)
TM RN GPR[2]: d (PASSED)
TM RN GPR[3]: c (PASSED)
TM RN GPR[4]: b (PASSED)
TM RN GPR[5]: a (PASSED)
TM RN GPR[6]: 9 (PASSED)
TM RN GPR[7]: 8 (PASSED)
TM RN GPR[8]: 7 (PASSED)
TM RN GPR[9]: 6 (PASSED)
TM RN GPR[10]: 5 (PASSED)
TM RN GPR[11]: 4 (PASSED)
TM RN GPR[12]: 3 (PASSED)
TM RN GPR[13]: 2 (PASSED)
TM RN GPR[14]: 1 (PASSED)
TM RN GPR[15]: 0 (PASSED)
TM RN GPR[16]: f (PASSED)
TM RN GPR[17]: e (PASSED)
TM RN 

Re: [PATCH V2 RESEND] arm: dts: Exynos5: Use pmu_system_controller phandle for dp phy

2014-12-02 Thread Javier Martinez Canillas
Hello Kukjin,

On Mon, Nov 24, 2014 at 6:41 AM, Vivek Gautam gautam.vi...@samsung.com wrote:
 DP PHY now require pmu-system-controller to handle PMU register
 to control PHY's power isolation. Adding the same to dp-phy
 node.

 Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
 Reviewed-by: Jingoo Han jg1@samsung.com
 Tested-by: Javier Martinez Canillas javier.marti...@collabora.co.uk
 Cc: Kukjin Kim kg...@kernel.org

Any opinions about $subject?

This patch is -rc material since is needed after commit a5ec598 (phy:
exynos-dp-video: Use syscon
support to control pmu register) which landed in 3.18. That means
that display for Exynos is currently broken in 3.18.

I think it's too late for the 3.18 -rc cycle but at least it would be
great to have this merged for 3.19 and backport to stable kernels to
have display working again.

Thierry had concerns that this change breaks DT backward compability
but actually it was already been broken by a5ec598 which changed the
DT binding for the phy-exynos-dp-video driver so we should either
apply this patch now or revert a5ec598.

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


Re: Out-of-bounds access in nfnetlink_bind

2014-12-02 Thread Andrey Ryabinin
2014-12-02 10:53 GMT+03:00 Dmitry Vyukov dvyu...@google.com:
 Hi,

 I am working on Kernel AddressSanitizer, a fast memory error detector
 for kernel:
 https://code.google.com/p/address-sanitizer/wiki/AddressSanitizerForKernel

 Here is an error report that I got while running trinity:

 ==
 BUG: AddressSanitizer: out of bounds access in
 nfnetlink_bind+0xbf/0xe0 at addr 82eef710
 Read of size 4 by task trinity-main/2533
 Out-of-bounds access to the global variable 'nfnl_group2type'
 [82eef6e0-82eef704) defined at
 net/netfilter/nfnetlink.c:43:18
 CPU: 0 PID: 2533 Comm: trinity-main Not tainted 3.18.0-rc1+ #44
 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
  835173e8 8800b989fd18 82a3d66f 0007
  8800b989fdc0 8800b989fda8 813a3826 0012
   00010018 0296 8800b989fd88
 Call Trace:
  [813a39c1] __asan_report_load4_noabort+0x41/0x50
 mm/kasan/report.c:236
  [824769cf] nfnetlink_bind+0xbf/0xe0 net/netfilter/nfnetlink.c:467
  [82469b71] netlink_bind+0x221/0x7e0 net/netlink/af_netlink.c:1472
  [8238bf77] SYSC_bind+0x117/0x170 net/socket.c:1541
  [8238dc29] SyS_bind+0x9/0x10 net/socket.c:1527
  [82a522a9] system_call_fastpath+0x12/0x17
 arch/x86/kernel/entry_64.S:422
 Memory state around the buggy address:
  82eef480: 00 00 00 00 00 00 00 00 00 00 00 00 00 f8 f8 f8
  82eef500: f8 f8 f8 f8 00 00 00 00 f8 f8 f8 f8 00 00 00 01
  82eef580: f8 f8 f8 f8 00 00 00 00 05 f8 f8 f8 f8 f8 f8 f8
  82eef600: 00 00 04 f8 f8 f8 f8 f8 00 00 f8 f8 f8 f8 f8 f8
  82eef680: 00 00 00 00 07 f8 f8 f8 f8 f8 f8 f8 00 00 00 00
82eef700: 04 f8 f8 f8 f8 f8 f8 f8 00 06 f8 f8 f8 f8 f8 f8
  ^
  82eef780: 00 00 00 05 f8 f8 f8 f8 00 00 00 00 00 f8 f8 f8
  82eef800: f8 f8 f8 f8 00 00 00 00 02 f8 f8 f8 f8 f8 f8 f8
  82eef880: 00 00 00 00 06 f8 f8 f8 f8 f8 f8 f8 00 00 00 04
  82eef900: f8 f8 f8 f8 00 00 00 00 00 04 f8 f8 f8 f8 f8 f8
  82eef980: 00 00 00 07 f8 f8 f8 f8 00 00 00 06 f8 f8 f8 f8
 ==

 My source is on revision f114040e3ea6e07372334ade75d1ee0

 As far as I see netlink_bind just calls nfnetlink_bind with whatever
 groups user has requested; nfnetlink_bind in turn do not do any checks
 before indexing the global nfnl_group2type array with the group.

I've reported this few weeks ago: https://lkml.org/lkml/2014/11/13/65
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v6 0/3] mtd: nand: gpmi: add proper raw access support

2014-12-02 Thread Boris Brezillon
On Tue, 2 Dec 2014 08:47:43 +0800
Huang Shijie shijie.hu...@intel.com wrote:

 On Mon, Dec 01, 2014 at 09:58:58AM +0100, Boris Brezillon wrote:
  Hi Brian,
  
  On Mon, 1 Dec 2014 00:47:09 -0800
  Brian Norris computersforpe...@gmail.com wrote:
  
   On Sun, Nov 30, 2014 at 07:10:27PM +0100, Boris Brezillon wrote:
Hello,

This series provides an implementation for raw accesses taking care of
hidding the specific layout used by the GPMI controller.

Best Regards,

Boris

Changes since v5:
 - rename gpmi_move_bits into gpmi_copy_bits

Changes since v4:
 - fixed a few corner cases in gpmi_move_bits (tested it with:
   
https://github.com/bbrezillon/gpmi-move-bits-test/blob/master/gpmi-move-bits-test.c)
 - add documentation and comments for the new gpmi functions

Changes since v3:
 - add comments to the gpmi_move_bits function
 - extend raw read/write documentation
 - move last part of the raw_page_read function into a conditional block

Changes since v2:
 - fixed a bug in gpmi_move_bits
 - add a raw_buffer field to be used when using raw access methods
   (experienced memory corruptions when directly using page_buffer_virt
   buffer)
 - add raw OOB access functions
   
   Applied the series. Thanks!
   
   Out of curiosity, what tests does gpmi-nand.c now pass/fail?
  
  The oobtest is still failing. I started to debug it, but didn't have
  enough time to make it work.
  
  The nandbiterrs test is working, though I didn't manage to make the
  incremental test fail (writing the same pattern 1 times without
  erasing the block between each write does not generate any bit flips) on
  my SLC NAND: MT29F2G08ABAEAH4.
  Can someone with another SLC NAND chip try it ?
  
   
   Also, is it time to yank / fixup some of these comments from
   gpmi-nand.c?
  
  I was asking myself the same question...
  
   
...
* FIXME: The following paragraph is incorrect, now that there exist
* ecc.read_oob_raw and ecc.write_oob_raw functions.
*
* Since MTD assumes the OOB is not covered by ECC, there is no pair of
* ECC-based/raw functions for reading or or writing the OOB. The fact 
   that the
* caller wants an ECC-based or raw view of the page is not propagated 
   down to
* this driver.
*/
  
  I guess we can remove them.
  Huang can you confirm that the raw access functions introduced in this
  series are covering what's described here ?
 I think we can remove these comments now.

Brian, do you want me to send this patch or are you taking care of it ?


-- 
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] i8042: prevent the loading of the i8042 driver on Intel NUC D54250WYK

2014-12-02 Thread Todor Minchev
The Intel NUC D54250WYK has no PS/2 controller, however the DSDT declares
PS/2 devices which trigger the loading of the i8042 driver.

Signed-off-by: Todor Minchev todor.minc...@intel.com
---
 drivers/input/serio/i8042-x86ia64io.h | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/drivers/input/serio/i8042-x86ia64io.h 
b/drivers/input/serio/i8042-x86ia64io.h
index faeeb13..5182008 100644
--- a/drivers/input/serio/i8042-x86ia64io.h
+++ b/drivers/input/serio/i8042-x86ia64io.h
@@ -579,6 +579,13 @@ static const struct dmi_system_id __initconst 
i8042_dmi_nopnp_table[] = {
},
},
{
+   /* Intel NUC D54250WYK */
+   .matches = {
+   DMI_MATCH(DMI_BOARD_NAME, D54250WYK),
+   DMI_MATCH(DMI_BOARD_VENDOR, Intel Corporation),
+   },
+   },
+   {
/* MSI Wind U-100 */
.matches = {
DMI_MATCH(DMI_BOARD_NAME, U-100),
-- 
2.1.3

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


Re: [PATCH] mtd: gpmi: properly handle bitflips in erased pages

2014-12-02 Thread Boris Brezillon
On Mon, 1 Dec 2014 15:37:48 -0800
Brian Norris computersforpe...@gmail.com wrote:

 On Mon, Dec 01, 2014 at 09:18:18PM +0100, Boris Brezillon wrote:
  On Mon, 1 Dec 2014 11:41:39 -0800 Brian Norris 
  computersforpe...@gmail.com wrote:
   On Mon, Dec 01, 2014 at 08:12:39PM +0100, Boris Brezillon wrote:
Brian, I really like the idea of having a generic implementation for 
this
feature (using read_page_raw) as you suggested here [1], but this 
implies
having a temporary buffer to store the page read in raw mode and keep 
the page
read in normal (HW ECC engine eanbled) mode, and I'm not sure we want to
allocate more buffers than we already have.
   
   Why does this require an additional buffer? If we've already noticed an
   ECC error, we're expected to return raw data anyway, so what's the
   problem with clobbering the original data with a raw version of the
   data?
  
  Well in the GPMI particular case (and more generally all NAND
  controllers which do not support subpage write) this is true, but if you
  can do subpage write, then you might have a bit flip in a specific
  chunk which is still empty, while other chunks are written and are
  expecting standard ECC correction.
  In this case you want to keep the 3 chunks with  standard ECC correction
  and only one in raw mode with 'erased page bitflips' fixed.
 
 So the problem's not really with subpage write, exactly; the problem is
 for drivers that support subpage write, we don't have a way to perform a
 raw subpage read without touching the other subpages.

Yes, that's what I was trying to explain :-), and the only solution I
see to address that is to have 2 buffers and then pick the most
appropriate data for a given chunk.
Do you think we should focus on support for non subpage write
controllers first, and then find an alternative for these controllers
if someone really needs it ?

-- 
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 0/8] hugepage migration fixes (v5)

2014-12-02 Thread Naoya Horiguchi
Hi everyone,

This is ver.5 patchset for fixing hugepage migration's race problem.

In ver.4, Hugh enlighted me about the problem around pmd_huge(), where
pmd_huge() returned false for migration/hwpoison entry and we treated them
as normal pages. IOW, we didn't handle !pmd_present case properly.

So I added a new separate patch for this problem as patch 2/8, and I changed
patch mm/hugetlb: take page table lock in follow_huge_pmd() (3/8 in this
series) to handle non-present hugetlb case in follow_huge_pmd().

Other than that, changes in this version are minor ones like comment fix.

Can I beg your comments and reviews again?

Thanks,
Naoya Horiguchi
---
Tree: g...@github.com:Naoya-Horiguchi/linux.git
Branch: mmotm-2014-11-26-15-45/fix_hugetlbfs_follow_page.v5

v2: http://thread.gmane.org/gmane.linux.kernel/1761065
v3: http://thread.gmane.org/gmane.linux.kernel/1776585
v4: http://thread.gmane.org/gmane.linux.kernel/1788215
---
Summary:

Naoya Horiguchi (8):
  mm/hugetlb: reduce arch dependent code around follow_huge_*
  mm/hugetlb: pmd_huge() returns true for non-present hugepage
  mm/hugetlb: take page table lock in follow_huge_pmd()
  mm/hugetlb: fix getting refcount 0 page in hugetlb_fault()
  mm/hugetlb: add migration/hwpoisoned entry check in 
hugetlb_change_protection
  mm/hugetlb: add migration entry check in __unmap_hugepage_range
  mm/hugetlb: fix suboptimal migration/hwpoisoned entry check
  mm/hugetlb: cleanup and rename is_hugetlb_entry_(migration|hwpoisoned)()

 arch/arm/mm/hugetlbpage.c |   6 --
 arch/arm64/mm/hugetlbpage.c   |   6 --
 arch/ia64/mm/hugetlbpage.c|   6 --
 arch/metag/mm/hugetlbpage.c   |   6 --
 arch/mips/mm/hugetlbpage.c|  18 
 arch/powerpc/mm/hugetlbpage.c |   8 ++
 arch/s390/mm/hugetlbpage.c|  20 -
 arch/sh/mm/hugetlbpage.c  |  12 ---
 arch/sparc/mm/hugetlbpage.c   |  12 ---
 arch/tile/mm/hugetlbpage.c|  28 --
 arch/x86/mm/gup.c |   2 +-
 arch/x86/mm/hugetlbpage.c |  20 ++---
 include/linux/hugetlb.h   |   8 +-
 include/linux/swapops.h   |   4 +
 mm/gup.c  |  25 ++
 mm/hugetlb.c  | 196 ++
 mm/migrate.c  |   5 +-
 17 files changed, 156 insertions(+), 226 deletions(-)--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v5 8/8] mm/hugetlb: cleanup and rename is_hugetlb_entry_(migration|hwpoisoned)()

2014-12-02 Thread Naoya Horiguchi
non_swap_entry() returns true if a given swp_entry_t is a migration
entry or hwpoisoned entry. So non_swap_entry()  is_migration_entry() is
identical with just is_migration_entry(). So by removing non_swap_entry(),
we can write is_hugetlb_entry_(migration|hwpoisoned)() more simply.

And the name is_hugetlb_entry_(migration|hwpoisoned) is lengthy and
it's not predictable from naming convention around pte_* family.
Just pte_migration() looks better, but these function contains hugetlb
specific (so architecture dependent) huge_pte_none() check, so let's
rename them as huge_pte_(migration|hwpoisoned).

Signed-off-by: Naoya Horiguchi n-horigu...@ah.jp.nec.com
---
 mm/hugetlb.c | 38 +-
 1 file changed, 13 insertions(+), 25 deletions(-)

diff --git mmotm-2014-11-26-15-45.orig/mm/hugetlb.c 
mmotm-2014-11-26-15-45/mm/hugetlb.c
index 6c38f9ad3d56..bc9cbdb4f58f 100644
--- mmotm-2014-11-26-15-45.orig/mm/hugetlb.c
+++ mmotm-2014-11-26-15-45/mm/hugetlb.c
@@ -2516,30 +2516,18 @@ static void set_huge_ptep_writable(struct 
vm_area_struct *vma,
update_mmu_cache(vma, address, ptep);
 }
 
-static int is_hugetlb_entry_migration(pte_t pte)
+static inline int huge_pte_migration(pte_t pte)
 {
-   swp_entry_t swp;
-
if (huge_pte_none(pte) || pte_present(pte))
return 0;
-   swp = pte_to_swp_entry(pte);
-   if (non_swap_entry(swp)  is_migration_entry(swp))
-   return 1;
-   else
-   return 0;
+   return is_migration_entry(pte_to_swp_entry(pte));
 }
 
-static int is_hugetlb_entry_hwpoisoned(pte_t pte)
+static inline int huge_pte_hwpoisoned(pte_t pte)
 {
-   swp_entry_t swp;
-
if (huge_pte_none(pte) || pte_present(pte))
return 0;
-   swp = pte_to_swp_entry(pte);
-   if (non_swap_entry(swp)  is_hwpoison_entry(swp))
-   return 1;
-   else
-   return 0;
+   return is_hwpoison_entry(pte_to_swp_entry(pte));
 }
 
 int copy_hugetlb_page_range(struct mm_struct *dst, struct mm_struct *src,
@@ -2583,8 +2571,8 @@ int copy_hugetlb_page_range(struct mm_struct *dst, struct 
mm_struct *src,
entry = huge_ptep_get(src_pte);
if (huge_pte_none(entry)) { /* skip none entry */
;
-   } else if (unlikely(is_hugetlb_entry_migration(entry) ||
-   is_hugetlb_entry_hwpoisoned(entry))) {
+   } else if (unlikely(huge_pte_migration(entry) ||
+   huge_pte_hwpoisoned(entry))) {
swp_entry_t swp_entry = pte_to_swp_entry(entry);
 
if (is_write_migration_entry(swp_entry)  cow) {
@@ -3169,9 +3157,9 @@ int hugetlb_fault(struct mm_struct *mm, struct 
vm_area_struct *vma,
 * a active hugepage in pagecache.
 */
if (!pte_present(entry)) {
-   if (is_hugetlb_entry_migration(entry))
+   if (huge_pte_migration(entry))
need_wait_migration = 1;
-   else if (is_hugetlb_entry_hwpoisoned(entry))
+   else if (huge_pte_hwpoisoned(entry))
ret = VM_FAULT_HWPOISON_LARGE |
VM_FAULT_SET_HINDEX(hstate_index(h));
goto out_mutex;
@@ -3303,8 +3291,8 @@ long follow_hugetlb_page(struct mm_struct *mm, struct 
vm_area_struct *vma,
 * (in which case hugetlb_fault waits for the migration,) and
 * hwpoisoned hugepages (in which case we need to prevent the
 * caller from accessing to them.) In order to do this, we use
-* here is_swap_pte instead of is_hugetlb_entry_migration and
-* is_hugetlb_entry_hwpoisoned. This is because it simply covers
+* here is_swap_pte instead of huge_pte_migration and
+* huge_pte_hwpoisoned. This is because it simply covers
 * both cases, and because we can't follow correct pages
 * directly from any kind of swap entries.
 */
@@ -3382,11 +3370,11 @@ unsigned long hugetlb_change_protection(struct 
vm_area_struct *vma,
continue;
}
pte = huge_ptep_get(ptep);
-   if (unlikely(is_hugetlb_entry_hwpoisoned(pte))) {
+   if (unlikely(huge_pte_hwpoisoned(pte))) {
spin_unlock(ptl);
continue;
}
-   if (unlikely(is_hugetlb_entry_migration(pte))) {
+   if (unlikely(huge_pte_migration(pte))) {
swp_entry_t entry = pte_to_swp_entry(pte);
 
if (is_write_migration_entry(entry)) {
@@ -3730,7 +3718,7 @@ follow_huge_pmd(struct mm_struct *mm, unsigned long 
address,
if (flags  FOLL_GET)
get_page(page);
} else {
-   if 

[PATCH v5 5/8] mm/hugetlb: add migration/hwpoisoned entry check in hugetlb_change_protection

2014-12-02 Thread Naoya Horiguchi
There is a race condition between hugepage migration and change_protection(),
where hugetlb_change_protection() doesn't care about migration entries and
wrongly overwrites them. That causes unexpected results like kernel crash.
HWPoison entries also can cause the same problem.

This patch adds is_hugetlb_entry_(migration|hwpoisoned) check in this
function to do proper actions.

Fixes: 290408d4a2 (hugetlb: hugepage migration core)
Signed-off-by: Naoya Horiguchi n-horigu...@ah.jp.nec.com
Cc: sta...@vger.kernel.org # [2.6.36+]
---
ChangeLog v4:
- s/set_pte_at/set_huge_pte_at/

ChangeLog v3:
- handle migration entry correctly (instead of just skipping)
---
 mm/hugetlb.c | 21 -
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git mmotm-2014-11-26-15-45.orig/mm/hugetlb.c 
mmotm-2014-11-26-15-45/mm/hugetlb.c
index dfc1527e8f4e..2807be3f260d 100644
--- mmotm-2014-11-26-15-45.orig/mm/hugetlb.c
+++ mmotm-2014-11-26-15-45/mm/hugetlb.c
@@ -3384,7 +3384,26 @@ unsigned long hugetlb_change_protection(struct 
vm_area_struct *vma,
spin_unlock(ptl);
continue;
}
-   if (!huge_pte_none(huge_ptep_get(ptep))) {
+   pte = huge_ptep_get(ptep);
+   if (unlikely(is_hugetlb_entry_hwpoisoned(pte))) {
+   spin_unlock(ptl);
+   continue;
+   }
+   if (unlikely(is_hugetlb_entry_migration(pte))) {
+   swp_entry_t entry = pte_to_swp_entry(pte);
+
+   if (is_write_migration_entry(entry)) {
+   pte_t newpte;
+
+   make_migration_entry_read(entry);
+   newpte = swp_entry_to_pte(entry);
+   set_huge_pte_at(mm, address, ptep, newpte);
+   pages++;
+   }
+   spin_unlock(ptl);
+   continue;
+   }
+   if (!huge_pte_none(pte)) {
pte = huge_ptep_get_and_clear(mm, address, ptep);
pte = pte_mkhuge(huge_pte_modify(pte, newprot));
pte = arch_make_huge_pte(pte, vma, NULL, 0);
-- 
2.2.0.rc0.2.gf745acb
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v5 2/8] mm/hugetlb: pmd_huge() returns true for non-present hugepage

2014-12-02 Thread Naoya Horiguchi
Migrating hugepages and hwpoisoned hugepages are considered as
non-present hugepages, and they are referenced via migration entries
and hwpoison entries in their page table slots.

This behavior causes race condition because pmd_huge() doesn't tell
non-huge pages from migrating/hwpoisoned hugepages. follow_page_mask()
is one example where the kernel would call follow_page_pte() for such
hugepage while this function is supposed to handle only normal pages.

To avoid this, this patch makes pmd_huge() return true when pmd_none()
is true *and* pmd_present() is false. We don't have to worry about mixing
up non-present pmd entry with normal pmd (pointing to leaf level pte
entry) because pmd_present() is true in normal pmd.

The same race condition could happen in (x86-specific) gup_pmd_range(),
where this patch simply adds pmd_present() check instead of pmd_huge().
This is because gup_pmd_range() is fast path. If we have non-present
hugepage in this function, we will go into gup_huge_pmd(), then return
0 at flag mask check, and finally fall back to the slow path.

Fixes: 290408d4a2 (hugetlb: hugepage migration core)
Signed-off-by: Naoya Horiguchi n-horigu...@ah.jp.nec.com
Cc: sta...@vger.kernel.org # [2.6.36+]
---
 arch/x86/mm/gup.c | 2 +-
 arch/x86/mm/hugetlbpage.c | 8 +++-
 mm/hugetlb.c  | 2 ++
 3 files changed, 10 insertions(+), 2 deletions(-)

diff --git mmotm-2014-11-26-15-45.orig/arch/x86/mm/gup.c 
mmotm-2014-11-26-15-45/arch/x86/mm/gup.c
index 207d9aef662d..448ee8912d9b 100644
--- mmotm-2014-11-26-15-45.orig/arch/x86/mm/gup.c
+++ mmotm-2014-11-26-15-45/arch/x86/mm/gup.c
@@ -172,7 +172,7 @@ static int gup_pmd_range(pud_t pud, unsigned long addr, 
unsigned long end,
 */
if (pmd_none(pmd) || pmd_trans_splitting(pmd))
return 0;
-   if (unlikely(pmd_large(pmd))) {
+   if (unlikely(pmd_large(pmd) || !pmd_present(pmd))) {
/*
 * NUMA hinting faults need to be handled in the GUP
 * slowpath for accounting purposes and so that they
diff --git mmotm-2014-11-26-15-45.orig/arch/x86/mm/hugetlbpage.c 
mmotm-2014-11-26-15-45/arch/x86/mm/hugetlbpage.c
index 03b8a7c11817..9161f764121e 100644
--- mmotm-2014-11-26-15-45.orig/arch/x86/mm/hugetlbpage.c
+++ mmotm-2014-11-26-15-45/arch/x86/mm/hugetlbpage.c
@@ -54,9 +54,15 @@ int pud_huge(pud_t pud)
 
 #else
 
+/*
+ * pmd_huge() returns 1 if @pmd is hugetlb related entry, that is normal
+ * hugetlb entry or non-present (migration or hwpoisoned) hugetlb entry.
+ * Otherwise, returns 0.
+ */
 int pmd_huge(pmd_t pmd)
 {
-   return !!(pmd_val(pmd)  _PAGE_PSE);
+   return !pmd_none(pmd) 
+   (pmd_val(pmd)  (_PAGE_PRESENT|_PAGE_PSE)) != _PAGE_PRESENT;
 }
 
 int pud_huge(pud_t pud)
diff --git mmotm-2014-11-26-15-45.orig/mm/hugetlb.c 
mmotm-2014-11-26-15-45/mm/hugetlb.c
index 6be4a690e554..dd42878549d5 100644
--- mmotm-2014-11-26-15-45.orig/mm/hugetlb.c
+++ mmotm-2014-11-26-15-45/mm/hugetlb.c
@@ -3679,6 +3679,8 @@ follow_huge_pmd(struct mm_struct *mm, unsigned long 
address,
 {
struct page *page;
 
+   if (!pmd_present(*pmd))
+   return NULL;
page = pte_page(*(pte_t *)pmd);
if (page)
page += ((address  ~PMD_MASK)  PAGE_SHIFT);
-- 
2.2.0.rc0.2.gf745acb
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v5 7/8] mm/hugetlb: fix suboptimal migration/hwpoisoned entry check

2014-12-02 Thread Naoya Horiguchi
Currently hugetlb_fault() checks at first whether pte of the faulted address
is a migration or hwpoisoned entry, which means that we call huge_ptep_get()
twice in single hugetlb_fault(). This is not optimized. The reason of this
approach is that without checking at first, huge_pte_alloc() can trigger
BUG_ON() because pmd_huge() returned false for non-present hugetlb entry.

With a previous patch in this series, pmd_huge() becomes to return true
for non-present entry, so we no longer need this dirty workaround.
Let's move the checking code to the proper place.

Signed-off-by: Naoya Horiguchi n-horigu...@ah.jp.nec.com
---
 mm/hugetlb.c | 26 +++---
 1 file changed, 11 insertions(+), 15 deletions(-)

diff --git mmotm-2014-11-26-15-45.orig/mm/hugetlb.c 
mmotm-2014-11-26-15-45/mm/hugetlb.c
index a2bfd02e289f..6c38f9ad3d56 100644
--- mmotm-2014-11-26-15-45.orig/mm/hugetlb.c
+++ mmotm-2014-11-26-15-45/mm/hugetlb.c
@@ -3136,20 +3136,10 @@ int hugetlb_fault(struct mm_struct *mm, struct 
vm_area_struct *vma,
struct hstate *h = hstate_vma(vma);
struct address_space *mapping;
int need_wait_lock = 0;
+   int need_wait_migration = 0;
 
address = huge_page_mask(h);
 
-   ptep = huge_pte_offset(mm, address);
-   if (ptep) {
-   entry = huge_ptep_get(ptep);
-   if (unlikely(is_hugetlb_entry_migration(entry))) {
-   migration_entry_wait_huge(vma, mm, ptep);
-   return 0;
-   } else if (unlikely(is_hugetlb_entry_hwpoisoned(entry)))
-   return VM_FAULT_HWPOISON_LARGE |
-   VM_FAULT_SET_HINDEX(hstate_index(h));
-   }
-
ptep = huge_pte_alloc(mm, address, huge_page_size(h));
if (!ptep)
return VM_FAULT_OOM;
@@ -3176,12 +3166,16 @@ int hugetlb_fault(struct mm_struct *mm, struct 
vm_area_struct *vma,
/*
 * entry could be a migration/hwpoison entry at this point, so this
 * check prevents the kernel from going below assuming that we have
-* a active hugepage in pagecache. This goto expects the 2nd page fault,
-* and is_hugetlb_entry_(migration|hwpoisoned) check will properly
-* handle it.
+* a active hugepage in pagecache.
 */
-   if (!pte_present(entry))
+   if (!pte_present(entry)) {
+   if (is_hugetlb_entry_migration(entry))
+   need_wait_migration = 1;
+   else if (is_hugetlb_entry_hwpoisoned(entry))
+   ret = VM_FAULT_HWPOISON_LARGE |
+   VM_FAULT_SET_HINDEX(hstate_index(h));
goto out_mutex;
+   }
 
/*
 * If we are going to COW the mapping later, we examine the pending
@@ -3247,6 +3241,8 @@ int hugetlb_fault(struct mm_struct *mm, struct 
vm_area_struct *vma,
}
 out_mutex:
mutex_unlock(htlb_fault_mutex_table[hash]);
+   if (need_wait_migration)
+   migration_entry_wait_huge(vma, mm, ptep);
/*
 * Generally it's safe to hold refcount during waiting page lock. But
 * here we just wait to defer the next page fault to avoid busy loop and
-- 
2.2.0.rc0.2.gf745acb
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/2] fs: Wire up sendfd() syscall (all architectures)

2014-12-02 Thread Alex Dubov
On Tue, Dec 2, 2014 at 7:01 PM, Geert Uytterhoeven ge...@linux-m68k.org wrote:
 This really needs a CC to linux-arch (added).


 You forgot to update NR_syscalls in arch/m68k/include/asm/unistd.h.


Noted. I would assume that other architectures may have similar
problems (I only tested
my submission on x86_64).

Will try to fix those when/if there's progress toward accepting the
proposed feature.
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v5 6/8] mm/hugetlb: add migration entry check in __unmap_hugepage_range

2014-12-02 Thread Naoya Horiguchi
If __unmap_hugepage_range() tries to unmap the address range over which
hugepage migration is on the way, we get the wrong page because pte_page()
doesn't work for migration entries. This patch simply clears the pte for
migration entries as we do for hwpoison entries.

Fixes: 290408d4a2 (hugetlb: hugepage migration core)
Signed-off-by: Naoya Horiguchi n-horigu...@ah.jp.nec.com
Cc: sta...@vger.kernel.org  # [2.6.36+]
---
ChangeLog v4:
- check hwpoisoned hugepage and migrating hugepage with the same check
  instead of doing separately
---
 mm/hugetlb.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git mmotm-2014-11-26-15-45.orig/mm/hugetlb.c 
mmotm-2014-11-26-15-45/mm/hugetlb.c
index 2807be3f260d..a2bfd02e289f 100644
--- mmotm-2014-11-26-15-45.orig/mm/hugetlb.c
+++ mmotm-2014-11-26-15-45/mm/hugetlb.c
@@ -2657,9 +2657,10 @@ void __unmap_hugepage_range(struct mmu_gather *tlb, 
struct vm_area_struct *vma,
goto unlock;
 
/*
-* HWPoisoned hugepage is already unmapped and dropped reference
+* Migrating hugepage or HWPoisoned hugepage is already
+* unmapped and its refcount is dropped, so just clear pte here.
 */
-   if (unlikely(is_hugetlb_entry_hwpoisoned(pte))) {
+   if (unlikely(!pte_present(pte))) {
huge_pte_clear(mm, address, ptep);
goto unlock;
}
-- 
2.2.0.rc0.2.gf745acb
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v5 1/8] mm/hugetlb: reduce arch dependent code around follow_huge_*

2014-12-02 Thread Naoya Horiguchi
Currently we have many duplicates in definitions around follow_huge_addr(),
follow_huge_pmd(), and follow_huge_pud(), so this patch tries to remove them.
The basic idea is to put the default implementation for these functions in
mm/hugetlb.c as weak symbols (regardless of CONFIG_ARCH_WANT_GENERAL_HUGETLB),
and to implement arch-specific code only when the arch needs it.

For follow_huge_addr(), only powerpc and ia64 have their own implementation,
and in all other architectures this function just returns ERR_PTR(-EINVAL).
So this patch sets returning ERR_PTR(-EINVAL) as default.

As for follow_huge_(pmd|pud)(), if (pmd|pud)_huge() is implemented to always
return 0 in your architecture (like in ia64 or sparc,) it's never called
(the callsite is optimized away) no matter how implemented it is.
So in such architectures, we don't need arch-specific implementation.

In some architecture (like mips, s390 and tile,) their current arch-specific
follow_huge_(pmd|pud)() are effectively identical with the common code,
so this patch lets these architecture use the common code.

One exception is metag, where pmd_huge() could return non-zero but it expects
follow_huge_pmd() to always return NULL. This means that we need arch-specific
implementation which returns NULL. This behavior looks strange to me (because
non-zero pmd_huge() implies that the architecture supports PMD-based hugepage,
so follow_huge_pmd() can/should return some relevant value,) but that's beyond
this cleanup patch, so let's keep it.

Justification of non-trivial changes:
- in s390, follow_huge_pmd() checks !MACHINE_HAS_HPAGE at first, and this
  patch removes the check. This is OK because we can assume MACHINE_HAS_HPAGE
  is true when follow_huge_pmd() can be called (note that pmd_huge() has
  the same check and always returns 0 for !MACHINE_HAS_HPAGE.)
- in s390 and mips, we use HPAGE_MASK instead of PMD_MASK as done in common
  code. This patch forces these archs use PMD_MASK, but it's OK because
  they are identical in both archs.
  In s390, both of HPAGE_SHIFT and PMD_SHIFT are 20.
  In mips, HPAGE_SHIFT is defined as (PAGE_SHIFT + PAGE_SHIFT - 3) and
  PMD_SHIFT is define as (PAGE_SHIFT + PAGE_SHIFT + PTE_ORDER - 3), but
  PTE_ORDER is always 0, so these are identical.

Signed-off-by: Naoya Horiguchi n-horigu...@ah.jp.nec.com
Acked-by: Hugh Dickins hu...@google.com
Cc: James Hogan james.ho...@imgtec.com
---
 arch/arm/mm/hugetlbpage.c |  6 --
 arch/arm64/mm/hugetlbpage.c   |  6 --
 arch/ia64/mm/hugetlbpage.c|  6 --
 arch/metag/mm/hugetlbpage.c   |  6 --
 arch/mips/mm/hugetlbpage.c| 18 --
 arch/powerpc/mm/hugetlbpage.c |  8 
 arch/s390/mm/hugetlbpage.c| 20 
 arch/sh/mm/hugetlbpage.c  | 12 
 arch/sparc/mm/hugetlbpage.c   | 12 
 arch/tile/mm/hugetlbpage.c| 28 
 arch/x86/mm/hugetlbpage.c | 12 
 mm/hugetlb.c  | 30 +++---
 12 files changed, 23 insertions(+), 141 deletions(-)

diff --git mmotm-2014-11-26-15-45.orig/arch/arm/mm/hugetlbpage.c 
mmotm-2014-11-26-15-45/arch/arm/mm/hugetlbpage.c
index 66781bf34077..c72412415093 100644
--- mmotm-2014-11-26-15-45.orig/arch/arm/mm/hugetlbpage.c
+++ mmotm-2014-11-26-15-45/arch/arm/mm/hugetlbpage.c
@@ -36,12 +36,6 @@
  * of type casting from pmd_t * to pte_t *.
  */
 
-struct page *follow_huge_addr(struct mm_struct *mm, unsigned long address,
- int write)
-{
-   return ERR_PTR(-EINVAL);
-}
-
 int pud_huge(pud_t pud)
 {
return 0;
diff --git mmotm-2014-11-26-15-45.orig/arch/arm64/mm/hugetlbpage.c 
mmotm-2014-11-26-15-45/arch/arm64/mm/hugetlbpage.c
index 023747bf4dd7..2de9d2e59d96 100644
--- mmotm-2014-11-26-15-45.orig/arch/arm64/mm/hugetlbpage.c
+++ mmotm-2014-11-26-15-45/arch/arm64/mm/hugetlbpage.c
@@ -38,12 +38,6 @@ int huge_pmd_unshare(struct mm_struct *mm, unsigned long 
*addr, pte_t *ptep)
 }
 #endif
 
-struct page *follow_huge_addr(struct mm_struct *mm, unsigned long address,
- int write)
-{
-   return ERR_PTR(-EINVAL);
-}
-
 int pmd_huge(pmd_t pmd)
 {
return !(pmd_val(pmd)  PMD_TABLE_BIT);
diff --git mmotm-2014-11-26-15-45.orig/arch/ia64/mm/hugetlbpage.c 
mmotm-2014-11-26-15-45/arch/ia64/mm/hugetlbpage.c
index 76069c18ee42..52b7604b5215 100644
--- mmotm-2014-11-26-15-45.orig/arch/ia64/mm/hugetlbpage.c
+++ mmotm-2014-11-26-15-45/arch/ia64/mm/hugetlbpage.c
@@ -114,12 +114,6 @@ int pud_huge(pud_t pud)
return 0;
 }
 
-struct page *
-follow_huge_pmd(struct mm_struct *mm, unsigned long address, pmd_t *pmd, int 
write)
-{
-   return NULL;
-}
-
 void hugetlb_free_pgd_range(struct mmu_gather *tlb,
unsigned long addr, unsigned long end,
unsigned long floor, unsigned long ceiling)
diff --git mmotm-2014-11-26-15-45.orig/arch/metag/mm/hugetlbpage.c 

[PATCH v5 3/8] mm/hugetlb: take page table lock in follow_huge_pmd()

2014-12-02 Thread Naoya Horiguchi
We have a race condition between move_pages() and freeing hugepages,
where move_pages() calls follow_page(FOLL_GET) for hugepages internally
and tries to get its refcount without preventing concurrent freeing.
This race crashes the kernel, so this patch fixes it by moving FOLL_GET
code for hugepages into follow_huge_pmd() with taking the page table lock.

This patch intentionally removes page==NULL check after pte_page. This
is justified because pte_page() never returns NULL for any architectures
or configurations.

This patch changes the behavior of follow_huge_pmd() for tail pages and
then tail pages can be pinned/returned. So the caller must be changed to
properly handle the returned tail pages.

We could have a choice to add the similar locking to follow_huge_(addr|pud)
for consistency, but it's not necessary because currently these functions
don't support FOLL_GET flag, so let's leave it for future development.

Here is the reproducer:

  $ cat movepages.c
  #include stdio.h
  #include stdlib.h
  #include numaif.h

  #define ADDR_INPUT  0x7000UL
  #define HPS 0x20
  #define PS  0x1000

  int main(int argc, char *argv[]) {
  int i;
  int nr_hp = strtol(argv[1], NULL, 0);
  int nr_p  = nr_hp * HPS / PS;
  int ret;
  void **addrs;
  int *status;
  int *nodes;
  pid_t pid;

  pid = strtol(argv[2], NULL, 0);
  addrs  = malloc(sizeof(char *) * nr_p + 1);
  status = malloc(sizeof(char *) * nr_p + 1);
  nodes  = malloc(sizeof(char *) * nr_p + 1);

  while (1) {
  for (i = 0; i  nr_p; i++) {
  addrs[i] = (void *)ADDR_INPUT + i * PS;
  nodes[i] = 1;
  status[i] = 0;
  }
  ret = numa_move_pages(pid, nr_p, addrs, nodes, status,
MPOL_MF_MOVE_ALL);
  if (ret == -1)
  err(move_pages);

  for (i = 0; i  nr_p; i++) {
  addrs[i] = (void *)ADDR_INPUT + i * PS;
  nodes[i] = 0;
  status[i] = 0;
  }
  ret = numa_move_pages(pid, nr_p, addrs, nodes, status,
MPOL_MF_MOVE_ALL);
  if (ret == -1)
  err(move_pages);
  }
  return 0;
  }

  $ cat hugepage.c
  #include stdio.h
  #include sys/mman.h
  #include string.h

  #define ADDR_INPUT  0x7000UL
  #define HPS 0x20

  int main(int argc, char *argv[]) {
  int nr_hp = strtol(argv[1], NULL, 0);
  char *p;

  while (1) {
  p = mmap((void *)ADDR_INPUT, nr_hp * HPS, PROT_READ | 
PROT_WRITE,
   MAP_PRIVATE | MAP_ANONYMOUS | MAP_HUGETLB, -1, 0);
  if (p != (void *)ADDR_INPUT) {
  perror(mmap);
  break;
  }
  memset(p, 0, nr_hp * HPS);
  munmap(p, nr_hp * HPS);
  }
  }

  $ sysctl vm.nr_hugepages=40
  $ ./hugepage 10 
  $ ./movepages 10 $(pgrep -f hugepage)

Fixes: e632a938d914 (mm: migrate: add hugepage migration code to move_pages())
Reported-by: Hugh Dickins hu...@google.com
Signed-off-by: Naoya Horiguchi n-horigu...@ah.jp.nec.com
Cc: sta...@vger.kernel.org  # [3.12+]
---
ChangeLog v5:
- make follow_huge_pmd() wake and retry if pmd is migration entry,
  for that purpose __migration_entry_wait() is exported outside mm/migrate.c
- make follow_huge_pmd() return NULL if pmd is hwpoison entry
- return no_page_table() instead of NULL if follow_huge_pmd/pud returns NULL

ChangeLog v4:
- remove changes related to taking ptl from follow_huge_(addr|pud)(),
  which is not neccessary because these functions don't support FOLL_GET
  at least for now
- add justification of removing page==NULL check to patch description
- stop changing parameter mm to vma in follow_huge_(pud|pmd)()
- use pmd_lockptr() instead of huge_pte_lock() in follow_huge_pmd()
- use get_page() instead of get_page_unless_zero() in follow_huge_pmd()
- use Fixes: tag and move changelog under '---'

ChangeLog v3:
- remove unnecessary if (page) check
- check (pmd|pud)_huge again after holding ptl
- do the same change also on follow_huge_pud()
- take page table lock also in follow_huge_addr()

ChangeLog v2:
- introduce follow_huge_pmd_lock() to do locking in arch-independent code.
---
 include/linux/hugetlb.h |  8 
 include/linux/swapops.h |  4 
 mm/gup.c| 25 -
 mm/hugetlb.c| 48 ++--
 mm/migrate.c|  5 +++--
 5 files changed, 53 insertions(+), 37 deletions(-)

diff --git mmotm-2014-11-26-15-45.orig/include/linux/hugetlb.h 

[PATCH v5 4/8] mm/hugetlb: fix getting refcount 0 page in hugetlb_fault()

2014-12-02 Thread Naoya Horiguchi
When running the test which causes the race as shown in the previous patch,
we can hit the BUG get_page() on refcount 0 page in hugetlb_fault().

This race happens when pte turns into migration entry just after the first
check of is_hugetlb_entry_migration() in hugetlb_fault() passed with false.
To fix this, we need to check pte_present() again after huge_ptep_get().

This patch also reorders taking ptl and doing pte_page(), because pte_page()
should be done in ptl. Due to this reordering, we need use trylock_page()
in page != pagecache_page case to respect locking order.

Fixes: 66aebce747ea (hugetlb: fix race condition in hugetlb_fault())
Signed-off-by: Naoya Horiguchi n-horigu...@ah.jp.nec.com
Cc: sta...@vger.kernel.org  # [3.2+]
---
ChangeLog v5:
- add comment to justify calling wait_on_page_locked without taking refcount
- remove stale comment about lock order

ChangeLog v4:
- move !pte_present(entry) (i.e. migration/hwpoison) check before
  taking page table lock
- call wait_on_page_locked() if trylock_page() returns false
- remove unused label out_unlock_page
- fix the order of put_page() and unlock_page() after out_put_page label
- move changelog under '---'

Hugh advised me for ver.3 that we can call migration_entry_wait_huge()
when the !pte_present(entry) check returns true to avoid busy faulting.
But it seems that in that case only one additional page fault happens
instead of busy faulting, because is_hugetlb_entry_migration() in the
second call of hugetlb_fault() should return true and then
migration_entry_wait_huge() is called. We could avoid this additional
page fault by adding another migration_entry_wait_huge(), but then
we should separate pte_present() check into is_hugetlb_entry_migration()
path and is_hugetlb_entry_hwpoisoned() path, which makes code complicated.
So let me take the simpler approach for sending stable tree.
And it's also advised that we can clean up is_hugetlb_entry_migration()
and is_hugetlb_entry_hwpoisoned() things. This will be done in another
work, and the above migration_entry_wait_huge problem will be revisited
there.

ChangeLog v3:
- doing pte_page() and taking refcount under page table lock
- check pte_present after taking ptl, which makes it unnecessary to use
  get_page_unless_zero()
- use trylock_page in page != pagecache_page case
- fixed target stable version
---
 mm/hugetlb.c | 52 
 1 file changed, 36 insertions(+), 16 deletions(-)

diff --git mmotm-2014-11-26-15-45.orig/mm/hugetlb.c 
mmotm-2014-11-26-15-45/mm/hugetlb.c
index adafced1aa17..dfc1527e8f4e 100644
--- mmotm-2014-11-26-15-45.orig/mm/hugetlb.c
+++ mmotm-2014-11-26-15-45/mm/hugetlb.c
@@ -3134,6 +3134,7 @@ int hugetlb_fault(struct mm_struct *mm, struct 
vm_area_struct *vma,
struct page *pagecache_page = NULL;
struct hstate *h = hstate_vma(vma);
struct address_space *mapping;
+   int need_wait_lock = 0;
 
address = huge_page_mask(h);
 
@@ -3172,6 +3173,16 @@ int hugetlb_fault(struct mm_struct *mm, struct 
vm_area_struct *vma,
ret = 0;
 
/*
+* entry could be a migration/hwpoison entry at this point, so this
+* check prevents the kernel from going below assuming that we have
+* a active hugepage in pagecache. This goto expects the 2nd page fault,
+* and is_hugetlb_entry_(migration|hwpoisoned) check will properly
+* handle it.
+*/
+   if (!pte_present(entry))
+   goto out_mutex;
+
+   /*
 * If we are going to COW the mapping later, we examine the pending
 * reservations for this page now. This will ensure that any
 * allocations necessary to record that reservation occur outside the
@@ -3190,30 +3201,31 @@ int hugetlb_fault(struct mm_struct *mm, struct 
vm_area_struct *vma,
vma, address);
}
 
+   ptl = huge_pte_lock(h, mm, ptep);
+
+   /* Check for a racing update before calling hugetlb_cow */
+   if (unlikely(!pte_same(entry, huge_ptep_get(ptep
+   goto out_ptl;
+
/*
 * hugetlb_cow() requires page locks of pte_page(entry) and
 * pagecache_page, so here we need take the former one
 * when page != pagecache_page or !pagecache_page.
-* Note that locking order is always pagecache_page - page,
-* so no worry about deadlock.
 */
page = pte_page(entry);
-   get_page(page);
if (page != pagecache_page)
-   lock_page(page);
-
-   ptl = huge_pte_lockptr(h, mm, ptep);
-   spin_lock(ptl);
-   /* Check for a racing update before calling hugetlb_cow */
-   if (unlikely(!pte_same(entry, huge_ptep_get(ptep
-   goto out_ptl;
+   if (!trylock_page(page)) {
+   need_wait_lock = 1;
+   goto out_ptl;
+   }
 
+   get_page(page);
 
if (flags  

The DM_BUFIO_HASH_BITS is defined as 20, any plan to make it flexible?

2014-12-02 Thread zhangxiao

Hi NeilBrown,

See drivers/md/dm-bufio.c as below:
  50 /*
  51  * Buffer hash
  52  */
  53 #define DM_BUFIO_HASH_BITS  20
  54 #define DM_BUFIO_HASH(block) \
  55 block)  DM_BUFIO_HASH_BITS) ^ (block))  \
  56  ((1  DM_BUFIO_HASH_BITS) - 1))
drivers/md/dm-bufio.c 1854L, 45375C 



DM_BUFIO_HASH_BITS was defined as 20 and it maybe not fit for some
use case with limited resources. Do we have any plan to make it more
flexible? Like module parameter or something else?

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


Re: frequent lockups in 3.18rc4

2014-12-02 Thread Lai Jiangshan
On 12/02/2014 03:14 AM, Paul E. McKenney wrote:
 On Sun, Nov 30, 2014 at 11:02:43PM -0200, Dâniel Fraga wrote:
 On Sun, 30 Nov 2014 16:21:19 -0800
 Linus Torvalds torva...@linux-foundation.org wrote:

 Maybe you'll have to turn off RCU_CPU_STALL_VERBOSE first.

 Although I think you should be able to just edit the .config file,
 delete the like that says

 CONFIG_TREE_PREEMPT_RCU=y

 and then just do a make oldconfig, and then verify that
 TREE_PREEMPT_RCU hasn't been re-enabled by some dependency. But it
 shouldn't have, and that make oldconfig should get rid of anything
 that depends on TREE_PREEMPT_RCU.
  
  Ok, I did exactly that, but CONFIG_TREE_PREEMPT_RCU is
 re-enabled. I talked with Pranith Kumar and he suggested I could just
 disable preemption (No Forced Preemption (Server)) and that's the only
 way to disable CONFIG_TREE_PREEMPT_RCU.
 
 If it would help to have !CONFIG_TREE_PREEMPT_RCU with CONFIG_PREEMPT=y,

It is needed at lest for testing.

CONFIG_TREE_PREEMPT_RCU=y with CONFIG_PREEMPT=n is needed for testing too.

Please enable them (or enable them under CONFIG_RCU_TRACE=y)

 please let me know and I will create a patch that forces this.
 (Not mainline material, but if it helps with debug...)
 
   Thanx, Paul
 
  Now I'll try to make the system freeze, then I'll send
 you the Call trace.

  Thanks.

 -- 
 Linux 3.17.0: Shuffling Zombie Juror
 http://www.youtube.com/DanielFragaBR
 http://exchangewar.info
 Bitcoin: 12H6661yoLDUZaYPdah6urZS5WiXwTAUgL
 --
 To unsubscribe from this list: send the line unsubscribe linux-kernel in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html
 Please read the FAQ at  http://www.tux.org/lkml/
 
 --
 To unsubscribe from this list: send the line unsubscribe linux-kernel in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html
 Please read the FAQ at  http://www.tux.org/lkml/
 

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


Re: The DM_BUFIO_HASH_BITS is defined as 20, any plan to make it flexible?

2014-12-02 Thread NeilBrown
On Tue, 2 Dec 2014 16:32:14 +0800 zhangxiao xiao.zh...@windriver.com wrote:

 Hi NeilBrown,
 
 See drivers/md/dm-bufio.c as below:
50 /*
51  * Buffer hash
52  */
53 #define DM_BUFIO_HASH_BITS  20
54 #define DM_BUFIO_HASH(block) \
55 block)  DM_BUFIO_HASH_BITS) ^ (block))  \
56  ((1  DM_BUFIO_HASH_BITS) - 1))
 drivers/md/dm-bufio.c 1854L, 45375C 
 
 
 DM_BUFIO_HASH_BITS was defined as 20 and it maybe not fit for some
 use case with limited resources. Do we have any plan to make it more
 flexible? Like module parameter or something else?
 

Thanks, but this question should be address to:

DEVICE-MAPPER  (LVM)
M:  Alasdair Kergon a...@redhat.com
M:  Mike Snitzer snit...@redhat.com
M:  dm-de...@redhat.com
L:  dm-de...@redhat.com
W:  http://sources.redhat.com/dm
Q:  http://patchwork.kernel.org/project/dm-devel/list/
T:  git 
git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm.git
T:  quilt http://people.redhat.com/agk/patches/linux/editing/
S:  Maintained
F:  Documentation/device-mapper/
F:  drivers/md/dm*
F:  drivers/md/persistent-data/
F:  include/linux/device-mapper.h
F:  include/linux/dm-*.h
F:  include/uapi/linux/dm-*.h

NeilBrown


pgpNg9Um0jRVH.pgp
Description: OpenPGP digital signature


Re: [PATCH V2 RESEND] arm: dts: Exynos5: Use pmu_system_controller phandle for dp phy

2014-12-02 Thread Jingoo Han
On Tuesday, December 02, 2014 5:17 PM, Javier Martinez Canillas wrote:
 
 Hello Kukjin,
 
 On Mon, Nov 24, 2014 at 6:41 AM, Vivek Gautam gautam.vi...@samsung.com 
 wrote:
  DP PHY now require pmu-system-controller to handle PMU register
  to control PHY's power isolation. Adding the same to dp-phy
  node.
 
  Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
  Reviewed-by: Jingoo Han jg1@samsung.com
  Tested-by: Javier Martinez Canillas javier.marti...@collabora.co.uk
  Cc: Kukjin Kim kg...@kernel.org
 
 Any opinions about $subject?
 
 This patch is -rc material since is needed after commit a5ec598 (phy:
 exynos-dp-video: Use syscon
 support to control pmu register) which landed in 3.18. That means
 that display for Exynos is currently broken in 3.18.
 
 I think it's too late for the 3.18 -rc cycle but at least it would be
 great to have this merged for 3.19 and backport to stable kernels to
 have display working again.

I agree with this suggestion.

 
 Thierry had concerns that this change breaks DT backward compability
 but actually it was already been broken by a5ec598 which changed the
 DT binding for the phy-exynos-dp-video driver so we should either
 apply this patch now or revert a5ec598.

I think that very few people might use old properties for Exynos DP.
Actually, DT backward compatibility will not be the considerable problem
in my opinion.

But, in order to keep the DT backward compatibility, we should revert
a5ec598, and send another patch for keeping the DT backward compatibility.

Best regards,
Jingoo Han

 
 Thanks a lot and best regards,
 Javier

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


Re: The DM_BUFIO_HASH_BITS is defined as 20, any plan to make it flexible?

2014-12-02 Thread zhangxiao

On 2014年12月02日 16:36, NeilBrown wrote:

On Tue, 2 Dec 2014 16:32:14 +0800 zhangxiao xiao.zh...@windriver.com wrote:


Hi NeilBrown,

See drivers/md/dm-bufio.c as below:
50 /*
51  * Buffer hash
52  */
53 #define DM_BUFIO_HASH_BITS  20
54 #define DM_BUFIO_HASH(block) \
55 block)  DM_BUFIO_HASH_BITS) ^ (block))  \
56  ((1  DM_BUFIO_HASH_BITS) - 1))
drivers/md/dm-bufio.c 1854L, 45375C


DM_BUFIO_HASH_BITS was defined as 20 and it maybe not fit for some
use case with limited resources. Do we have any plan to make it more
flexible? Like module parameter or something else?



Thanks, but this question should be address to:


Thank you for your kindly remind. :-)

Regards
Xiao


DEVICE-MAPPER  (LVM)
M:  Alasdair Kergon a...@redhat.com
M:  Mike Snitzer snit...@redhat.com
M:  dm-de...@redhat.com
L:  dm-de...@redhat.com
W:  http://sources.redhat.com/dm
Q:  http://patchwork.kernel.org/project/dm-devel/list/
T:  git 
git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm.git
T:  quilt http://people.redhat.com/agk/patches/linux/editing/
S:  Maintained
F:  Documentation/device-mapper/
F:  drivers/md/dm*
F:  drivers/md/persistent-data/
F:  include/linux/device-mapper.h
F:  include/linux/dm-*.h
F:  include/uapi/linux/dm-*.h

NeilBrown


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


Re: [PATCH 0/3] Dell Airplane Mode Switch driver

2014-12-02 Thread Pali Rohár
On Wednesday 26 November 2014 00:05:28 Darren Hart wrote:
 On Sun, Nov 23, 2014 at 04:09:18PM +0100, Pali Rohár wrote:
  This patch series add new acpi Dell Airplane Mode Switch
  driver (DELLABCE and DELRBTN acpi devices). It provides
  radio HW switch events (together with current state of
  radio devices) and export them via rfkill interface. These
  events are also used in dell-laptop driver instead i8042
  filter hook function (when acpi device is available).
  
  Pali Rohár (3):
platform: x86: dell-rbtn: Dell Airplane Mode Switch driver
platform: x86: dell-rbtn: Export notifier for other kernel
modules platform: x86: dell-laptop: Use dell-rbtn instead
i8042 filter when

  possible
   
   drivers/platform/x86/Kconfig   |   14 ++
   drivers/platform/x86/Makefile  |1 +
   drivers/platform/x86/dell-laptop.c |   67 +-
   drivers/platform/x86/dell-rbtn.c   |  260
   
   drivers/platform/x86/dell-rbtn.h   |   35 +
   5 files changed, 372 insertions(+), 5 deletions(-)
   create mode 100644 drivers/platform/x86/dell-rbtn.c
   create mode 100644 drivers/platform/x86/dell-rbtn.h
 
 Alex, it is my understanding that this solution from Pali is a
 more complete solution to dealing with the variety of dell
 wireless buttons and rfkill mechanisms in the world today.
 
 I currently have:
 7c4d961 dell-wireless: new driver for dell wireless button for
 Windows 8 queued in for-next. If I have read your responses
 on this correctly, are we all in agreement that I should drop
 the above patch, and apply these?

Darren, it it truth that some laptops does not send keypress 
event when Fn+wifi key is pressed (but only send ACPI event), 
then really Alex's patch for input device is needed. But it could 
be integrated into my driver. Also Alex wrote something about 
ACPI events for laptops which have wifi key instead HW switch. So 
before including this patch into tree, I would like to hear what 
is problem with my patch for laptops which have wifi key...

-- 
Pali Rohár
pali.ro...@gmail.com


signature.asc
Description: This is a digitally signed message part.


The DM_BUFIO_HASH_BITS is defined as 20, any plan to make it flexible?

2014-12-02 Thread zhangxiao

Hi Experts,

See drivers/md/dm-bufio.c as below:
  50 /*
  51  * Buffer hash
  52  */
  53 #define DM_BUFIO_HASH_BITS  20
  54 #define DM_BUFIO_HASH(block) \
  55 block)  DM_BUFIO_HASH_BITS) ^ (block))  \
  56  ((1  DM_BUFIO_HASH_BITS) - 1))
drivers/md/dm-bufio.c 1854L, 45375C

DM_BUFIO_HASH_BITS was defined as 20 and it maybe not fit for some
use case with limited resources. Do we have any plan to make it more
flexible? Like module parameter or something else?

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


[PATCH v2] ARM: zynq: DT: Add USB to device tree

2014-12-02 Thread Soren Brinkmann
Add USB nodes to zc702, zc706 and zed device trees.

Signed-off-by: Soren Brinkmann soren.brinkm...@xilinx.com
---
v2:
 - remove '@0' from phy node name
 - don't add bogus space
---
 arch/arm/boot/dts/zynq-7000.dtsi | 20 
 arch/arm/boot/dts/zynq-zc702.dts | 11 +++
 arch/arm/boot/dts/zynq-zc706.dts | 10 ++
 arch/arm/boot/dts/zynq-zed.dts   | 10 ++
 4 files changed, 51 insertions(+)

diff --git a/arch/arm/boot/dts/zynq-7000.dtsi b/arch/arm/boot/dts/zynq-7000.dtsi
index ce2ef5bec4f2..68096bb027db 100644
--- a/arch/arm/boot/dts/zynq-7000.dtsi
+++ b/arch/arm/boot/dts/zynq-7000.dtsi
@@ -315,6 +315,26 @@
clocks = clkc 4;
};
 
+   usb0: usb@e0002000 {
+   compatible = xlnx,zynq-usb-2.20a, chipidea,usb2;
+   status = disabled;
+   clocks = clkc 28;
+   interrupt-parent = intc;
+   interrupts = 0 21 4;
+   reg = 0xe0002000 0x1000;
+   phy_type = ulpi;
+   };
+
+   usb1: usb@e0003000 {
+   compatible = xlnx,zynq-usb-2.20a, chipidea,usb2;
+   status = disabled;
+   clocks = clkc 29;
+   interrupt-parent = intc;
+   interrupts = 0 44 4;
+   reg = 0xe0003000 0x1000;
+   phy_type = ulpi;
+   };
+
watchdog0: watchdog@f8005000 {
clocks = clkc 45;
compatible = xlnx,zynq-wdt-r1p2;
diff --git a/arch/arm/boot/dts/zynq-zc702.dts b/arch/arm/boot/dts/zynq-zc702.dts
index 94e2cda6f9b6..f80c6e65f6e8 100644
--- a/arch/arm/boot/dts/zynq-zc702.dts
+++ b/arch/arm/boot/dts/zynq-zc702.dts
@@ -36,6 +36,11 @@
linux,default-trigger = heartbeat;
};
};
+
+   usb_phy0: usb-phy {
+   compatible = usb-nop-xceiv;
+   #phy-cells = 0;
+   };
 };
 
 can0 {
@@ -135,3 +140,9 @@
 uart1 {
status = okay;
 };
+
+usb0 {
+   status = okay;
+   dr_mode = host;
+   usb-phy = usb_phy0;
+};
diff --git a/arch/arm/boot/dts/zynq-zc706.dts b/arch/arm/boot/dts/zynq-zc706.dts
index a8bbdfbc7093..bece52e47cfe 100644
--- a/arch/arm/boot/dts/zynq-zc706.dts
+++ b/arch/arm/boot/dts/zynq-zc706.dts
@@ -27,6 +27,10 @@
bootargs = console=ttyPS0,115200 earlyprintk;
};
 
+   usb_phy0: usb-phy {
+   compatible = usb-nop-xceiv;
+   #phy-cells = 0;
+   };
 };
 
 gem0 {
@@ -114,3 +118,9 @@
 uart1 {
status = okay;
 };
+
+usb0 {
+   status = okay;
+   dr_mode = host;
+   usb-phy = usb_phy0;
+};
diff --git a/arch/arm/boot/dts/zynq-zed.dts b/arch/arm/boot/dts/zynq-zed.dts
index 697779a353ed..efecb2379832 100644
--- a/arch/arm/boot/dts/zynq-zed.dts
+++ b/arch/arm/boot/dts/zynq-zed.dts
@@ -27,6 +27,10 @@
bootargs = console=ttyPS0,115200 earlyprintk;
};
 
+   usb_phy0: usb-phy {
+   compatible = usb-nop-xceiv;
+   #phy-cells = 0;
+   };
 };
 
 gem0 {
@@ -46,3 +50,9 @@
 uart1 {
status = okay;
 };
+
+usb0 {
+   status = okay;
+   dr_mode = host;
+   usb-phy = usb_phy0;
+};
-- 
2.2.0.1.g9ee0458

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


[PATCH v4 05/11] memory: add Atmel EBI (External Bus Interface) driver

2014-12-02 Thread Boris Brezillon
The EBI (External Bus Interface) is used to access external peripherals
(NOR, SRAM, NAND, and other specific devices like ethernet controllers).
Each device is assigned a CS line and an address range and can have its
own configuration (timings, access mode, bus width, ...).
This driver provides a generic DT binding to configure a device according
to its requirements.
For specific device controllers (like the NAND one) the SMC timings
should be configured by the controller driver through the matrix and
smc syscon regmaps.

Signed-off-by: Jean-Jacques Hiblot jjhib...@traphandler.com
Signed-off-by: Boris Brezillon boris.brezil...@free-electrons.com
---

Changes since v3:
 - use syscon_regmap_lookup_by_phandle instead of of_parse_phandle +
   syscon_node_to_regmap
 - drop AT91_EBICSA_REGFIELD and AT91_MULTI_EBICSA_REGFIELD macros

 drivers/memory/Kconfig |  11 +
 drivers/memory/Makefile|   1 +
 drivers/memory/atmel-ebi.c | 618 +
 3 files changed, 630 insertions(+)
 create mode 100644 drivers/memory/atmel-ebi.c

diff --git a/drivers/memory/Kconfig b/drivers/memory/Kconfig
index 6d91c27..dfe24a2 100644
--- a/drivers/memory/Kconfig
+++ b/drivers/memory/Kconfig
@@ -17,6 +17,17 @@ config ATMEL_SDRAMC
  Starting with the at91sam9g45, this controller supports SDR, DDR and
  LP-DDR memories.
 
+config ATMEL_EBI
+   bool Atmel EBI driver
+   default y
+   depends on ARCH_AT91  OF
+   select MFD_SYSCON
+   help
+ Driver for Atmel EBI controller.
+ Used to configure the EBI (external bus interface) when the device-
+ tree is used. This bus supports NANDs, external ethernet controller,
+ SRAMs, ATA devices, etc.
+
 config TI_AEMIF
tristate Texas Instruments AEMIF driver
depends on (ARCH_DAVINCI || ARCH_KEYSTONE)  OF
diff --git a/drivers/memory/Makefile b/drivers/memory/Makefile
index c32d319..7ca2c19 100644
--- a/drivers/memory/Makefile
+++ b/drivers/memory/Makefile
@@ -6,6 +6,7 @@ ifeq ($(CONFIG_DDR),y)
 obj-$(CONFIG_OF)   += of_memory.o
 endif
 obj-$(CONFIG_ATMEL_SDRAMC) += atmel-sdramc.o
+obj-$(CONFIG_ATMEL_EBI)+= atmel-ebi.o
 obj-$(CONFIG_TI_AEMIF) += ti-aemif.o
 obj-$(CONFIG_TI_EMIF)  += emif.o
 obj-$(CONFIG_FSL_CORENET_CF)   += fsl-corenet-cf.o
diff --git a/drivers/memory/atmel-ebi.c b/drivers/memory/atmel-ebi.c
new file mode 100644
index 000..8702694
--- /dev/null
+++ b/drivers/memory/atmel-ebi.c
@@ -0,0 +1,618 @@
+/*
+ * EBI driver for Atmel SAM9 chips
+ * inspired by the fsl weim bus driver
+ *
+ * Copyright (C) 2013 JJ Hiblot.
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2. This program is licensed as is without any
+ * warranty of any kind, whether express or implied.
+ */
+
+#include linux/clk.h
+#include linux/io.h
+#include linux/mfd/syscon.h
+#include linux/mfd/syscon/atmel-matrix.h
+#include linux/mfd/syscon/atmel-smc.h
+#include linux/module.h
+#include linux/of_device.h
+#include linux/regmap.h
+
+struct at91sam9_smc_timings {
+   u32 ncs_rd_setup_ns;
+   u32 nrd_setup_ns;
+   u32 ncs_wr_setup_ns;
+   u32 nwe_setup_ns;
+   u32 ncs_rd_pulse_ns;
+   u32 nrd_pulse_ns;
+   u32 ncs_wr_pulse_ns;
+   u32 nwe_pulse_ns;
+   u32 nrd_cycle_ns;
+   u32 nwe_cycle_ns;
+   u32 tdf_ns;
+};
+
+struct at91sam9_smc_generic_fields {
+   struct regmap_field *setup;
+   struct regmap_field *pulse;
+   struct regmap_field *cycle;
+   struct regmap_field *mode;
+};
+
+struct at91sam9_ebi_dev_config {
+   struct at91sam9_smc_timings timings;
+   u32 mode;
+};
+
+struct at91_ebi;
+
+struct at91_ebi_dev {
+   struct device_node *np;
+   struct at91_smc_timings *timings;
+   struct at91_ebi *ebi;
+   u32 mode;
+   int cs;
+   void *config;
+};
+
+struct at91_ebi_caps {
+   unsigned int available_cs;
+   const struct reg_field *ebi_csa;
+   int (*xlate_config)(struct at91_ebi_dev *ebid);
+   int (*apply_config)(struct at91_ebi_dev *ebid);
+   int (*init)(struct at91_ebi *ebi);
+};
+
+struct at91_ebi {
+   struct clk *clk;
+   struct regmap *smc;
+   struct regmap *matrix;
+
+   struct regmap_field *ebi_csa;
+
+   struct device *dev;
+   const struct at91_ebi_caps *caps;
+   struct at91_ebi_dev *devs[AT91_MATRIX_EBI_NUM_CS];
+   void *priv;
+};
+
+static u32 at91sam9_smc_setup_ns_to_cycles(unsigned int clk_rate,
+  u32 timing_ns)
+{
+   u32 clk_period = DIV_ROUND_UP(NSEC_PER_SEC, clk_rate);
+   u32 coded_cycles = 0;
+   u32 cycles;
+
+   cycles = DIV_ROUND_UP(timing_ns, clk_period);
+   if (cycles / 32) {
+   coded_cycles |= 1  5;
+   if (cycles  128)
+   cycles = 0;
+   }
+
+   coded_cycles |= cycles % 32;
+
+   return coded_cycles;
+}
+
+static 

[PATCH net-next 0/2] r8169:change hardware setting

2014-12-02 Thread Chunhao Lin
This patch series contains two hardware setting modification to prevent
hardware become abnormal.

Chunhao Lin (2):
  r8169:prevent enable hardware tx/rx too early
  r8169:disable rtl8168ep cmac engine

 drivers/net/ethernet/realtek/r8169.c | 33 ++---
 1 file changed, 22 insertions(+), 11 deletions(-)

-- 
1.9.1

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


[PATCH net-next 1/2] r8169:prevent enable hardware tx/rx too early

2014-12-02 Thread Chunhao Lin
For RTL8168G/GU/H/EP and RTL8411B remove enable tx/rx from its own hw_start
function. This will prevent enable tx/rx before complete hardware tx/rx
setting.

Tx/Rx will be enabled in the end of function rtl_hw_start_8168.

Signed-off-by: Chunhao Lin h...@realtek.com
---
 drivers/net/ethernet/realtek/r8169.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/net/ethernet/realtek/r8169.c 
b/drivers/net/ethernet/realtek/r8169.c
index cf154f7..7f4515f 100644
--- a/drivers/net/ethernet/realtek/r8169.c
+++ b/drivers/net/ethernet/realtek/r8169.c
@@ -5934,7 +5934,6 @@ static void rtl_hw_start_8168g_1(struct rtl8169_private 
*tp)
rtl_w0w1_eri(tp, 0xdc, ERIAR_MASK_0001, 0x01, 0x00, ERIAR_EXGMAC);
rtl_eri_write(tp, 0x2f8, ERIAR_MASK_0011, 0x1d8f, ERIAR_EXGMAC);
 
-   RTL_W8(ChipCmd, CmdTxEnb | CmdRxEnb);
RTL_W32(MISC, RTL_R32(MISC)  ~RXDV_GATED_EN);
RTL_W8(MaxTxPacketSize, EarlySize);
 
@@ -6027,7 +6026,6 @@ static void rtl_hw_start_8168h_1(struct rtl8169_private 
*tp)
 
rtl_eri_write(tp, 0x5f0, ERIAR_MASK_0011, 0x4f87, ERIAR_EXGMAC);
 
-   RTL_W8(ChipCmd, CmdTxEnb | CmdRxEnb);
RTL_W32(MISC, RTL_R32(MISC)  ~RXDV_GATED_EN);
RTL_W8(MaxTxPacketSize, EarlySize);
 
@@ -6109,7 +6107,6 @@ static void rtl_hw_start_8168ep(struct rtl8169_private 
*tp)
 
rtl_eri_write(tp, 0x5f0, ERIAR_MASK_0011, 0x4f87, ERIAR_EXGMAC);
 
-   RTL_W8(ChipCmd, CmdTxEnb | CmdRxEnb);
RTL_W32(MISC, RTL_R32(MISC)  ~RXDV_GATED_EN);
RTL_W8(MaxTxPacketSize, EarlySize);
 
-- 
1.9.1

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


[PATCH net-next 2/2] r8169:disable rtl8168ep cmac engine

2014-12-02 Thread Chunhao Lin
Cmac engine is the bridge between driver and dash firmware.
Other os may not disable cmac when leave. And r8169 did not allocate any
resources for cmac engine. Disable it to prevent abnormal system behavior.

Signed-off-by: Chunhao Lin h...@realtek.com
---
 drivers/net/ethernet/realtek/r8169.c | 30 ++
 1 file changed, 22 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/realtek/r8169.c 
b/drivers/net/ethernet/realtek/r8169.c
index 7f4515f..56280c1 100644
--- a/drivers/net/ethernet/realtek/r8169.c
+++ b/drivers/net/ethernet/realtek/r8169.c
@@ -1377,6 +1377,16 @@ DECLARE_RTL_COND(rtl_ocp_tx_cond)
return RTL_R8(IBISR0)  0x02;
 }
 
+static void rtl8168ep_stop_cmac(struct rtl8169_private *tp)
+{
+   void __iomem *ioaddr = tp-mmio_addr;
+
+   RTL_W8(IBCR2, RTL_R8(IBCR2)  ~0x01);
+   rtl_msleep_loop_wait_low(tp, rtl_ocp_tx_cond, 50, 2000);
+   RTL_W8(IBISR0, RTL_R8(IBISR0) | 0x20);
+   RTL_W8(IBCR0, RTL_R8(IBCR0)  ~0x01);
+}
+
 static void rtl8168dp_driver_start(struct rtl8169_private *tp)
 {
rtl8168_oob_notify(tp, OOB_CMD_DRIVER_START);
@@ -1417,12 +1427,7 @@ static void rtl8168dp_driver_stop(struct rtl8169_private 
*tp)
 
 static void rtl8168ep_driver_stop(struct rtl8169_private *tp)
 {
-   void __iomem *ioaddr = tp-mmio_addr;
-
-   RTL_W8(IBCR2, RTL_R8(IBCR2)  ~0x01);
-   rtl_msleep_loop_wait_low(tp, rtl_ocp_tx_cond, 50, 2000);
-   RTL_W8(IBISR0, RTL_R8(IBISR0) | 0x20);
-   RTL_W8(IBCR0, RTL_R8(IBCR0)  ~0x01);
+   rtl8168ep_stop_cmac(tp);
ocp_write(tp, 0x01, 0x180, OOB_CMD_DRIVER_STOP);
ocp_write(tp, 0x01, 0x30, ocp_read(tp, 0x01, 0x30) | 0x01);
rtl_msleep_loop_wait_low(tp, rtl_ep_ocp_read_cond, 10, 10);
@@ -6089,6 +6094,8 @@ static void rtl_hw_start_8168ep(struct rtl8169_private 
*tp)
void __iomem *ioaddr = tp-mmio_addr;
struct pci_dev *pdev = tp-pci_dev;
 
+   rtl8168ep_stop_cmac(tp);
+
RTL_W32(TxConfig, RTL_R32(TxConfig) | TXCFG_AUTO_FIFO);
 
rtl_eri_write(tp, 0xc8, ERIAR_MASK_0101, 0x00080002, ERIAR_EXGMAC);
@@ -8002,6 +8009,12 @@ static void rtl_hw_init_8168g(struct rtl8169_private *tp)
return;
 }
 
+static void rtl_hw_init_8168ep(struct rtl8169_private *tp)
+{
+   rtl8168ep_stop_cmac(tp);
+   rtl_hw_init_8168g(tp);
+}
+
 static void rtl_hw_initialize(struct rtl8169_private *tp)
 {
switch (tp-mac_version) {
@@ -8014,12 +8027,13 @@ static void rtl_hw_initialize(struct rtl8169_private 
*tp)
case RTL_GIGA_MAC_VER_46:
case RTL_GIGA_MAC_VER_47:
case RTL_GIGA_MAC_VER_48:
+   rtl_hw_init_8168g(tp);
+   break;
case RTL_GIGA_MAC_VER_49:
case RTL_GIGA_MAC_VER_50:
case RTL_GIGA_MAC_VER_51:
-   rtl_hw_init_8168g(tp);
+   rtl_hw_init_8168ep(tp);
break;
-
default:
break;
}
-- 
1.9.1

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


Re: [PATCH] bcache: prevent crash on changing writeback_running

2014-12-02 Thread Stefan Bader
On 19.08.2014 20:03, Slava Pestov wrote:
 Thanks, this is now in our development branch.

It has been a while but I just went back there and checked linux and linux-next
but cannot find this change anywhere. I think it is a rather simple bugfix. So I
start to wonder where it went and when it would get pushed.

-Stefan

 
 On Tue, Aug 19, 2014 at 6:01 AM, Stefan Bader
 stefan.ba...@canonical.com wrote:
 commit a664d0f05a2ec02c8f042db536d84d15d6e19e81
 bcache: fix crash on shutdown in passthrough mode

 added a safeguard in the shutdown case. At least while not being
 attached it is also possible to trigger a kernel bug by writing into
 writeback_running. This change  adds the same check before trying to
 wake up the thread for that case.

 Signed-off-by: Stefan Bader stefan.ba...@canonical.com
 ---
  drivers/md/bcache/writeback.h | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)

 diff --git a/drivers/md/bcache/writeback.h b/drivers/md/bcache/writeback.h
 index 0a9dab1..073a042 100644
 --- a/drivers/md/bcache/writeback.h
 +++ b/drivers/md/bcache/writeback.h
 @@ -63,7 +63,8 @@ static inline bool should_writeback(struct cached_dev *dc, 
 struct bio *bio,

  static inline void bch_writeback_queue(struct cached_dev *dc)
  {
 -   wake_up_process(dc-writeback_thread);
 +   if (!IS_ERR_OR_NULL(dc-writeback_thread))
 +   wake_up_process(dc-writeback_thread);
  }

  static inline void bch_writeback_add(struct cached_dev *dc)
 --
 1.9.1

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




signature.asc
Description: OpenPGP digital signature


[PATCH 12/19] clk: samsung: exynos5433: Add clocks for CMU_GSCL domain

2014-12-02 Thread Chanwoo Choi
This patch adds the divider/gate of CMU_GSCL domain which contains gscaler
clocks.

Cc: Sylwester Nawrocki s.nawro...@samsung.com
Cc: Tomasz Figa tomasz.f...@gmail.com
Signed-off-by: Chanwoo Choi cw00.c...@samsung.com
Acked-by: Inki Dae inki@samsung.com
Acked-by: Geunsik Lim geunsik@samsung.com
---
 .../devicetree/bindings/clock/exynos5433-clock.txt |   8 ++
 drivers/clk/samsung/clk-exynos5433.c   | 144 +
 include/dt-bindings/clock/exynos5433.h |  37 +-
 3 files changed, 188 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/clock/exynos5433-clock.txt 
b/Documentation/devicetree/bindings/clock/exynos5433-clock.txt
index 589ed93..bf72817 100644
--- a/Documentation/devicetree/bindings/clock/exynos5433-clock.txt
+++ b/Documentation/devicetree/bindings/clock/exynos5433-clock.txt
@@ -30,6 +30,8 @@ Required Properties:
 which generates global data buses clock and global peripheral buses clock.
   - samsung,exynos5433-cmu-g3d  - clock controller compatible for CMU_G3D
 which generates clocks for 3D Graphics Engine IP.
+  - samsung,exynos5433-cmu-gscl  - clock controller compatible for CMU_GSCL
+which generates clocks for GSCALER IPs.
 
 - reg: physical base address of the controller and length of memory mapped
   region.
@@ -123,6 +125,12 @@ Example 1: Examples of clock controller nodes are listed 
below.
#clock-cells = 1;
};
 
+   cmu_gscl: clock-controller@0x13cf {
+   compatible = samsung,exynos5433-cmu-gscl;
+   reg = 0x13cf 0x0b10;
+   #clock-cells = 1;
+   };
+
 Example 2: UART controller node that consumes the clock generated by the clock
   controller.
 
diff --git a/drivers/clk/samsung/clk-exynos5433.c 
b/drivers/clk/samsung/clk-exynos5433.c
index a7f5feb..00dcac3 100644
--- a/drivers/clk/samsung/clk-exynos5433.c
+++ b/drivers/clk/samsung/clk-exynos5433.c
@@ -540,6 +540,10 @@ static struct samsung_gate_clock top_gate_clks[] 
__initdata = {
ENABLE_ACLK_TOP, 21, CLK_IGNORE_UNUSED, 0),
GATE(CLK_ACLK_FSYS_200, aclk_fsys_200, div_aclk_fsys_200,
ENABLE_ACLK_TOP, 18, CLK_IGNORE_UNUSED, 0),
+   GATE(CLK_ACLK_GSCL_111, aclk_gscl_111, div_aclk_gscl_111,
+   ENABLE_ACLK_TOP, 15, 0, 0),
+   GATE(CLK_ACLK_GSCL_333, aclk_gscl_333, div_aclk_gscl_333,
+   ENABLE_ACLK_TOP, 14, 0, 0),
GATE(CLK_ACLK_G2D_266, aclk_g2d_266, div_aclk_g2d_266,
ENABLE_ACLK_TOP, 2, CLK_IGNORE_UNUSED, 0),
GATE(CLK_ACLK_G2D_400, aclk_g2d_400, div_aclk_g2d_400,
@@ -3223,3 +3227,143 @@ static void __init exynos5433_cmu_g3d_init(struct 
device_node *np)
 }
 CLK_OF_DECLARE(exynos5433_cmu_g3d, samsung,exynos5433-cmu-g3d,
exynos5433_cmu_g3d_init);
+
+/*
+ * Register offset definitions for CMU_GSCL
+ */
+#define MUX_SEL_GSCL   0x0200
+#define MUX_ENABLE_GSCL0x0300
+#defineMUX_STAT_GSCL   0x0400
+#defineENABLE_ACLK_GSCL0x0800
+#defineENABLE_ACLK_GSCL_SECURE_SMMU_GSCL0  0x0804
+#defineENABLE_ACLK_GSCL_SECURE_SMMU_GSCL1  0x0808
+#defineENABLE_ACLK_GSCL_SECURE_SMMU_GSCL2  0x080c
+#defineENABLE_PCLK_GSCL0x0900
+#defineENABLE_PCLK_GSCL_SECURE_SMMU_GSCL0  0x0904
+#defineENABLE_PCLK_GSCL_SECURE_SMMU_GSCL1  0x0908
+#defineENABLE_PCLK_GSCL_SECURE_SMMU_GSCL2  0x090c
+#defineENABLE_IP_GSCL0 0x0b00
+#defineENABLE_IP_GSCL1 0x0b04
+#defineENABLE_IP_GSCL_SECURE_SMMU_GSCL00x0b08
+#defineENABLE_IP_GSCL_SECURE_SMMU_GSCL10x0b0c
+#defineENABLE_IP_GSCL_SECURE_SMMU_GSCL20x0b10
+
+static unsigned long gscl_clk_regs[] __initdata = {
+   MUX_SEL_GSCL,
+   MUX_ENABLE_GSCL,
+   MUX_STAT_GSCL,
+   ENABLE_ACLK_GSCL,
+   ENABLE_ACLK_GSCL_SECURE_SMMU_GSCL0,
+   ENABLE_ACLK_GSCL_SECURE_SMMU_GSCL1,
+   ENABLE_ACLK_GSCL_SECURE_SMMU_GSCL2,
+   ENABLE_PCLK_GSCL,
+   ENABLE_PCLK_GSCL_SECURE_SMMU_GSCL0,
+   ENABLE_PCLK_GSCL_SECURE_SMMU_GSCL1,
+   ENABLE_PCLK_GSCL_SECURE_SMMU_GSCL2,
+   ENABLE_IP_GSCL0,
+   ENABLE_IP_GSCL1,
+   ENABLE_IP_GSCL_SECURE_SMMU_GSCL0,
+   ENABLE_IP_GSCL_SECURE_SMMU_GSCL1,
+   ENABLE_IP_GSCL_SECURE_SMMU_GSCL2,
+};
+
+/* list of all parent clock list */
+PNAME(aclk_gscl_111_user_p)= { fin_pll, aclk_gscl_111, };
+PNAME(aclk_gscl_333_user_p)= { fin_pll, aclk_gscl_333, };
+
+static struct samsung_mux_clock gscl_mux_clks[] __initdata = {
+   /* MUX_SEL_GSCL */
+   MUX(CLK_MOUT_ACLK_GSCL_111_USER, mout_aclk_gscl_111_user,
+   aclk_gscl_111_user_p, MUX_SEL_GSCL, 4, 1),
+   MUX(CLK_MOUT_ACLK_GSCL_333_USER, 

[PATCH 18/19] clocksource: exynos_mct: Add the support for Exynos 64bit SoC

2014-12-02 Thread Chanwoo Choi
This patch adds the support for Exynos 64bit SoC. The delay_timer is only used
for Exynos 32bit SoC.

Cc: Daniel Lezcano daniel.lezc...@linaro.org
Cc: Thomas Gleixner t...@linutronix.de
Cc: Kukjin Kim kgene@samsung.com
Cc: Mark Rutland mark.rutl...@arm.com
Signed-off-by: Chanwoo Choi cw00.c...@samsung.com
---
 drivers/clocksource/Kconfig  | 1 -
 drivers/clocksource/exynos_mct.c | 4 
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig
index 9042060..27ef3fa 100644
--- a/drivers/clocksource/Kconfig
+++ b/drivers/clocksource/Kconfig
@@ -134,7 +134,6 @@ config CLKSRC_METAG_GENERIC
 
 config CLKSRC_EXYNOS_MCT
def_bool y if ARCH_EXYNOS
-   depends on !ARM64
help
  Support for Multi Core Timer controller on Exynos SoCs.
 
diff --git a/drivers/clocksource/exynos_mct.c b/drivers/clocksource/exynos_mct.c
index 9403061..b840ea1 100644
--- a/drivers/clocksource/exynos_mct.c
+++ b/drivers/clocksource/exynos_mct.c
@@ -223,6 +223,7 @@ static u64 notrace exynos4_read_sched_clock(void)
return exynos4_read_count_32();
 }
 
+#if defined(CONFIG_ARM)
 static struct delay_timer exynos4_delay_timer;
 
 static cycles_t exynos4_read_current_timer(void)
@@ -231,14 +232,17 @@ static cycles_t exynos4_read_current_timer(void)
 cycles_t needs to move to 32-bit for ARM64 usage);
return exynos4_read_count_32();
 }
+#endif
 
 static void __init exynos4_clocksource_init(void)
 {
exynos4_mct_frc_start();
 
+#if defined(CONFIG_ARM)
exynos4_delay_timer.read_current_timer = exynos4_read_current_timer;
exynos4_delay_timer.freq = clk_rate;
register_current_timer_delay(exynos4_delay_timer);
+#endif
 
if (clocksource_register_hz(mct_frc, clk_rate))
panic(%s: can't register clocksource\n, mct_frc.name);
-- 
1.8.5.5

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


[PATCH 19/19] arm64: Enable Exynos5433 SoC in the defconfig

2014-12-02 Thread Chanwoo Choi
This patch enable Exynos5433 SoC in the arm64 defconfig.

Cc: Catalin Marinas catalin.mari...@arm.com
Cc: Will Deacon will.dea...@arm.com
Signed-off-by: Chanwoo Choi cw00.c...@samsung.com
Acked-by: Inki Dae inki@samsung.com
Acked-by: Geunsik Lim geunsik@samsung.com
---
 arch/arm64/configs/defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig
index c7ae5ac..7551a50 100644
--- a/arch/arm64/configs/defconfig
+++ b/arch/arm64/configs/defconfig
@@ -33,6 +33,7 @@ CONFIG_MODULE_UNLOAD=y
 # CONFIG_BLK_DEV_BSG is not set
 # CONFIG_IOSCHED_DEADLINE is not set
 CONFIG_ARCH_EXYNOS=y
+CONFIG_ARCH_EXYNOS5433=y
 CONFIG_ARCH_EXYNOS7=y
 CONFIG_ARCH_THUNDER=y
 CONFIG_ARCH_VEXPRESS=y
-- 
1.8.5.5

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


[PATCH 08/19] clk: samsung: exynos5433: Add clocks for CMU_AUD domain

2014-12-02 Thread Chanwoo Choi
This patch adds the mux/divider/gate clocks for CMU_AUD domain which
includes the clocks of Cortex-A6/Bus/Audio clocks.

Cc: Sylwester Nawrocki s.nawro...@samsung.com
Cc: Tomasz Figa tomasz.f...@gmail.com
Signed-off-by: Chanwoo Choi cw00.c...@samsung.com
Acked-by: Inki Dae inki@samsung.com
Acked-by: Geunsik Lim geunsik@samsung.com
---
 .../devicetree/bindings/clock/exynos5433-clock.txt |   7 +
 drivers/clk/samsung/clk-exynos5433.c   | 173 +
 include/dt-bindings/clock/exynos5433.h |  53 +++
 3 files changed, 233 insertions(+)

diff --git a/Documentation/devicetree/bindings/clock/exynos5433-clock.txt 
b/Documentation/devicetree/bindings/clock/exynos5433-clock.txt
index 8d3dad4..9a6ae75 100644
--- a/Documentation/devicetree/bindings/clock/exynos5433-clock.txt
+++ b/Documentation/devicetree/bindings/clock/exynos5433-clock.txt
@@ -23,6 +23,8 @@ Required Properties:
 which generates clocks for G2D/MDMA IPs.
   - samsung,exynos5433-cmu-disp  - clock controller compatible for CMU_DISP
 which generates clocks for Display (DECON/HDMI/DSIM/MIXER) IPs.
+  - samsung,exynos5433-cmu-aud   - clock controller compatible for CMU_AUD
+which generates clocks for Cortex-A5/BUS/AUDIO clocks.
 
 - reg: physical base address of the controller and length of memory mapped
   region.
@@ -86,6 +88,11 @@ Example 1: Examples of clock controller nodes are listed 
below.
#clock-cells = 1;
};
 
+   cmu_aud: clock-controller@0x114c {
+   compatible = samsung,exynos5433-cmu-aud;
+   reg = 0x114c 0x0b04;
+   #clock-cells = 1;
+   };
 
 Example 2: UART controller node that consumes the clock generated by the clock
   controller.
diff --git a/drivers/clk/samsung/clk-exynos5433.c 
b/drivers/clk/samsung/clk-exynos5433.c
index ec23e97..99262e0 100644
--- a/drivers/clk/samsung/clk-exynos5433.c
+++ b/drivers/clk/samsung/clk-exynos5433.c
@@ -2454,3 +2454,176 @@ static void __init exynos5433_cmu_disp_init(struct 
device_node *np)
 
 CLK_OF_DECLARE(exynos5433_cmu_disp, samsung,exynos5433-cmu-disp,
exynos5433_cmu_disp_init);
+
+/*
+ * Register offset definitions for CMU_AUD
+ */
+#define MUX_SEL_AUD0   0x0200
+#define MUX_SEL_AUD1   0x0204
+#define MUX_ENABLE_AUD00x0300
+#define MUX_ENABLE_AUD10x0304
+#define MUX_STAT_AUD0  0x0400
+#define DIV_AUD0   0x0600
+#define DIV_AUD1   0x0604
+#define DIV_STAT_AUD0  0x0700
+#define DIV_STAT_AUD1  0x0704
+#define ENABLE_ACLK_AUD0x0800
+#define ENABLE_PCLK_AUD0x0900
+#define ENABLE_SCLK_AUD0   0x0a00
+#define ENABLE_SCLK_AUD1   0x0a04
+#define ENABLE_IP_AUD0 0x0b00
+#define ENABLE_IP_AUD1 0x0b04
+
+static unsigned long aud_clk_regs[] __initdata = {
+   MUX_SEL_AUD0,
+   MUX_SEL_AUD1,
+   MUX_ENABLE_AUD0,
+   MUX_ENABLE_AUD1,
+   MUX_STAT_AUD0,
+   DIV_AUD0,
+   DIV_AUD1,
+   DIV_STAT_AUD0,
+   DIV_STAT_AUD1,
+   ENABLE_ACLK_AUD,
+   ENABLE_PCLK_AUD,
+   ENABLE_SCLK_AUD0,
+   ENABLE_SCLK_AUD1,
+   ENABLE_IP_AUD0,
+   ENABLE_IP_AUD1,
+};
+
+/* list of all parent clock list */
+PNAME(mout_aud_pll_user_aud_p) = { fin_pll, fout_aud_pll, };
+PNAME(mout_sclk_aud_pcm_p) = { mout_aud_pll_user, ioclk_audiocdclk0,};
+PNAME(mout_sclk_aud_i2s_p) = { mout_aud_pll_user, ioclk_audiocdclk0,};
+
+static struct samsung_fixed_rate_clock aud_fixed_clks[] __initdata = {
+   FRATE(0, ioclk_jtag_tclk, NULL, CLK_IS_ROOT, 18800),
+   FRATE(0, ioclk_slimbus_clk, NULL, CLK_IS_ROOT, 18800),
+   FRATE(0, ioclk_i2s_bclk, NULL, CLK_IS_ROOT, 18800),
+};
+
+static struct samsung_mux_clock aud_mux_clks[] __initdata = {
+   /* MUX_SEL_AUD0 */
+   MUX(CLK_MOUT_AUD_PLL_USER, mout_aud_pll_user,
+   mout_aud_pll_user_aud_p, MUX_SEL_AUD0, 0, 1),
+
+   /* MUX_SEL_AUD1 */
+   MUX(CLK_MOUT_SCLK_AUD_PCM, mout_sclk_aud_pcm, mout_sclk_aud_pcm_p,
+   MUX_SEL_AUD1, 8, 1),
+   MUX(CLK_MOUT_SCLK_AUD_I2S, mout_sclk_aud_i2s, mout_sclk_aud_i2s_p,
+   MUX_SEL_AUD1, 0, 1),
+};
+
+static struct samsung_div_clock aud_div_clks[] __initdata = {
+   /* DIV_AUD0 */
+   DIV(CLK_DIV_ATCLK_AUD, div_atclk_aud, div_aud_ca5, DIV_AUD0,
+   12, 4),
+   DIV(CLK_DIV_PCLK_DBG_AUD, div_pclk_dbg_aud, div_aud_ca5, DIV_AUD0,
+   8, 4),
+   DIV(CLK_DIV_ACLK_AUD, div_aclk_aud, div_aud_ca5, DIV_AUD0,
+   4, 4),
+   DIV(CLK_DIV_AUD_CA5, div_aud_ca5, mout_aud_pll_user, DIV_AUD0,
+   0, 4),
+
+   /* DIV_AUD1 */
+   DIV(CLK_DIV_SCLK_AUD_SLIMBUS, div_sclk_aud_slimbus,
+ 

[PATCH 14/19] arm64: dts: exynos: Add dts files for 64-bit Exynos5433 SoC

2014-12-02 Thread Chanwoo Choi
This patch adds new Exynos5433 dtsi to support 64-bit Exynos5433 SoC based on
Octal core CPUs (quad Cortex-A57 and quad Cortex-A53). And Exynos5433 supports
PSCI (Power State Coordination Interface) v0.1.

Cc: Kukjin Kim kgene@samsung.com
Cc: Mark Rutland mark.rutl...@arm.com
Cc: Marc Zyngier marc.zyng...@arm.com
Cc: Arnd Bergmann a...@arndb.de
Cc: Olof Johansson o...@lixom.net
Cc: Catalin Marinas catalin.mari...@arm.com
Cc: Will Deacon will.dea...@arm.com
Signed-off-by: Chanwoo Choi cw00.c...@samsung.com
Acked-by: Inki Dae inki@samsung.com
Acked-by: Geunsik Lim geunsik@samsung.com
---
 arch/arm64/boot/dts/exynos/exynos5433-pinctrl.dtsi | 698 +
 arch/arm64/boot/dts/exynos/exynos5433.dtsi | 515 +++
 2 files changed, 1213 insertions(+)
 create mode 100644 arch/arm64/boot/dts/exynos/exynos5433-pinctrl.dtsi
 create mode 100644 arch/arm64/boot/dts/exynos/exynos5433.dtsi

diff --git a/arch/arm64/boot/dts/exynos/exynos5433-pinctrl.dtsi 
b/arch/arm64/boot/dts/exynos/exynos5433-pinctrl.dtsi
new file mode 100644
index 000..81fe925
--- /dev/null
+++ b/arch/arm64/boot/dts/exynos/exynos5433-pinctrl.dtsi
@@ -0,0 +1,698 @@
+/*
+ * Samsung's Exynos5433 SoC pin-mux and pin-config device tree source
+ *
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd.
+ * http://www.samsung.com
+ *
+ * Samsung's Exynos5433 SoC pin-mux and pin-config options are listed as device
+ * tree nodes are listed in this file.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+*/
+
+pinctrl_alive {
+   gpa0: gpa0 {
+   gpio-controller;
+   #gpio-cells = 2;
+
+   interrupt-controller;
+   interrupt-parent = gic;
+   interrupts = 0 0 0, 0 1 0, 0 2 0, 0 3 0,
+0 4 0, 0 5 0, 0 6 0, 0 7 0;
+   #interrupt-cells = 2;
+   };
+
+   gpa1: gpa1 {
+   gpio-controller;
+   #gpio-cells = 2;
+
+   interrupt-controller;
+   interrupt-parent = gic;
+   interrupts = 0 8 0, 0 9 0, 0 10 0, 0 11 0,
+0 12 0, 0 13 0, 0 14 0, 0 15 0;
+   #interrupt-cells = 2;
+   };
+
+   gpa2: gpa2 {
+   gpio-controller;
+   #gpio-cells = 2;
+
+   interrupt-controller;
+   #interrupt-cells = 2;
+   };
+
+   gpa3: gpa3 {
+   gpio-controller;
+   #gpio-cells = 2;
+
+   interrupt-controller;
+   #interrupt-cells = 2;
+   };
+};
+
+pinctrl_aud {
+   gpz0: gpz0 {
+   gpio-controller;
+   #gpio-cells = 2;
+
+   interrupt-controller;
+   #interrupt-cells = 2;
+   };
+
+   gpz1: gpz1 {
+   gpio-controller;
+   #gpio-cells = 2;
+
+   interrupt-controller;
+   #interrupt-cells = 2;
+   };
+
+   i2s0_bus: i2s0-bus {
+   samsung,pins = gpz0-0, gpz0-1, gpz0-2, gpz0-3,
+   gpz0-4, gpz0-5, gpz0-6;
+   samsung,pin-function = 2;
+   samsung,pin-pud = 1;
+   samsung,pin-drv = 0;
+   };
+
+   pcm0_bus: pcm0-bus {
+   samsung,pins = gpz1-0, gpz1-1, gpz1-2, gpz1-3;
+   samsung,pin-function = 3;
+   samsung,pin-pud = 1;
+   samsung,pin-drv = 0;
+   };
+};
+
+pinctrl_cpif {
+   gpv6: gpv6 {
+   gpio-controller;
+   #gpio-cells = 2;
+
+   interrupt-controller;
+   #interrupt-cells = 2;
+   };
+};
+
+pinctrl_ese {
+   gpj2: gpj2 {
+   gpio-controller;
+   #gpio-cells = 2;
+
+   interrupt-controller;
+   #interrupt-cells = 2;
+   };
+};
+
+pinctrl_finger {
+   gpd5: gpd5 {
+   gpio-controller;
+   #gpio-cells = 2;
+
+   interrupt-controller;
+   #interrupt-cells = 2;
+   };
+
+   spi2_bus: spi2-bus {
+   samsung,pins = gpd5-0, gpd5-2, gpd5-3;
+   samsung,pin-function = 2;
+   samsung,pin-pud = 3;
+   samsung,pin-drv = 0;
+   };
+
+   hs_i2c6_bus: hs-i2c6-bus {
+   samsung,pins = gpd5-3, gpd5-2;
+   samsung,pin-function = 4;
+   samsung,pin-pud = 3;
+   samsung,pin-drv = 0;
+   };
+
+};
+
+pinctrl_fsys {
+   gph1: gph1 {
+   gpio-controller;
+   #gpio-cells = 2;
+
+   interrupt-controller;
+   #interrupt-cells = 2;
+   };
+
+   gpr4: gpr4 {
+   gpio-controller;
+   #gpio-cells = 2;
+
+   interrupt-controller;
+   #interrupt-cells = 2;
+   };
+
+   

[PATCH 03/19] clk: samsung: exynos5433: Add clocks for CMU_PERIC domain

2014-12-02 Thread Chanwoo Choi
This patch adds missing divider/gate clocks of CMU_PERIC domain
which includes I2S/PCM/SPDIF/PWM/SLIMBUS IPs. The SPI/I2S may use
external input clock which has 'ioclk_*' prefix.

Cc: Sylwester Nawrocki s.nawro...@samsung.com
Cc: Tomasz Figa tomasz.f...@gmail.com
Signed-off-by: Chanwoo Choi cw00.c...@samsung.com
[ideal.song: Change clk flags of to pclk_gpio_* clk, pclk_gpio_* should be 
always on.]
Signed-off-by: Inha Song ideal.s...@samsung.com
Acked-by: Inki Dae inki@samsung.com
Acked-by: Geunsik Lim geunsik@samsung.com
---
 drivers/clk/samsung/clk-exynos5433.c   | 80 +-
 include/dt-bindings/clock/exynos5433.h | 34 ++-
 2 files changed, 112 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/samsung/clk-exynos5433.c 
b/drivers/clk/samsung/clk-exynos5433.c
index 88e8cac..a48b36c 100644
--- a/drivers/clk/samsung/clk-exynos5433.c
+++ b/drivers/clk/samsung/clk-exynos5433.c
@@ -256,6 +256,14 @@ static struct samsung_fixed_rate_clock top_fixed_clks[] 
__initdata = {
FRATE(0, ioclk_audiocdclk0, NULL, CLK_IS_ROOT, 1),
/* Xi2s1SDI input clock for SPDIF */
FRATE(0, ioclk_spdif_extclk, NULL, CLK_IS_ROOT, 1),
+   /* XspiCLK[4:0] input clock for SPI */
+   FRATE(0, ioclk_spi4_clk_in, NULL, CLK_IS_ROOT, 5000),
+   FRATE(0, ioclk_spi3_clk_in, NULL, CLK_IS_ROOT, 5000),
+   FRATE(0, ioclk_spi2_clk_in, NULL, CLK_IS_ROOT, 5000),
+   FRATE(0, ioclk_spi1_clk_in, NULL, CLK_IS_ROOT, 5000),
+   FRATE(0, ioclk_spi0_clk_in, NULL, CLK_IS_ROOT, 5000),
+   /* Xi2s1SCLK input clock for I2S1_BCLK */
+   FRATE(0, ioclk_i2s1_bclk_in, NULL, CLK_IS_ROOT, 12288000),
 };
 
 static struct samsung_mux_clock top_mux_clks[] __initdata = {
@@ -760,6 +768,7 @@ CLK_OF_DECLARE(exynos5433_cmu_mif, 
samsung,exynos5433-cmu-mif,
  * Register offset definitions for CMU_PERIC
  */
 #define DIV_PERIC  0x0600
+#define DIV_STAT_PERIC 0x0700
 #define ENABLE_ACLK_PERIC  0x0800
 #define ENABLE_PCLK_PERIC0 0x0900
 #define ENABLE_PCLK_PERIC1 0x0904
@@ -770,6 +779,7 @@ CLK_OF_DECLARE(exynos5433_cmu_mif, 
samsung,exynos5433-cmu-mif,
 
 static unsigned long peric_clk_regs[] __initdata = {
DIV_PERIC,
+   DIV_STAT_PERIC,
ENABLE_ACLK_PERIC,
ENABLE_PCLK_PERIC0,
ENABLE_PCLK_PERIC1,
@@ -779,14 +789,57 @@ static unsigned long peric_clk_regs[] __initdata = {
ENABLE_IP_PERIC2,
 };
 
+static struct samsung_div_clock peric_div_clks[] __initdata = {
+   /* DIV_PERIC */
+   DIV(CLK_DIV_SCLK_SCI, div_sclk_sci, fin_pll, DIV_PERIC, 4, 8),
+   DIV(CLK_DIV_SCLK_SC_IN, div_sclk_sc_in, fin_pll, DIV_PERIC, 0, 4),
+};
+
 static struct samsung_gate_clock peric_gate_clks[] __initdata = {
+   /* ENABLE_ACLK_PERIC */
+   GATE(CLK_ACLK_AHB2APB_PERIC2P, aclk_ahb2apb_peric2p, aclk_peric_66,
+   ENABLE_ACLK_PERIC, 3, CLK_IGNORE_UNUSED, 0),
+   GATE(CLK_ACLK_AHB2APB_PERIC1P, aclk_ahb2apb_peric1p, aclk_peric_66,
+   ENABLE_ACLK_PERIC, 2, CLK_IGNORE_UNUSED, 0),
+   GATE(CLK_ACLK_AHB2APB_PERIC0P, aclk_ahb2apb_peric0p, aclk_peric_66,
+   ENABLE_ACLK_PERIC, 1, CLK_IGNORE_UNUSED, 0),
+   GATE(CLK_ACLK_PERICNP_66, aclk_pericnp_66, aclk_peric_66,
+   ENABLE_ACLK_PERIC, 0, CLK_IGNORE_UNUSED, 0),
+
/* ENABLE_PCLK_PERIC0 */
+   GATE(CLK_PCLK_SCI, pclk_sci, aclk_peric_66, ENABLE_PCLK_PERIC0,
+   31, CLK_SET_RATE_PARENT, 0),
+   GATE(CLK_PCLK_GPIO_FINGER, pclk_gpio_finger, aclk_peric_66,
+   ENABLE_PCLK_PERIC0, 30, CLK_IGNORE_UNUSED, 0),
+   GATE(CLK_PCLK_GPIO_ESE, pclk_gpio_ese, aclk_peric_66,
+   ENABLE_PCLK_PERIC0, 29, CLK_IGNORE_UNUSED, 0),
+   GATE(CLK_PCLK_PWM, pclk_pwm, aclk_peric_66, ENABLE_PCLK_PERIC0,
+   28, CLK_SET_RATE_PARENT, 0),
+   GATE(CLK_PCLK_SPDIF, pclk_spdif, aclk_peric_66, ENABLE_PCLK_PERIC0,
+   26, CLK_SET_RATE_PARENT, 0),
+   GATE(CLK_PCLK_PCM1, pclk_pcm1, aclk_peric_66, ENABLE_PCLK_PERIC0,
+   25, CLK_SET_RATE_PARENT, 0),
+   GATE(CLK_PCLK_I2S1, pclk_i2s, aclk_peric_66, ENABLE_PCLK_PERIC0,
+   24, CLK_SET_RATE_PARENT, 0),
GATE(CLK_PCLK_SPI2, pclk_spi2, aclk_peric_66, ENABLE_PCLK_PERIC0,
23, CLK_SET_RATE_PARENT, 0),
GATE(CLK_PCLK_SPI1, pclk_spi1, aclk_peric_66, ENABLE_PCLK_PERIC0,
22, CLK_SET_RATE_PARENT, 0),
GATE(CLK_PCLK_SPI0, pclk_spi0, aclk_peric_66, ENABLE_PCLK_PERIC0,
21, CLK_SET_RATE_PARENT, 0),
+   GATE(CLK_PCLK_ADCIF, pclk_adcif, aclk_peric_66, ENABLE_PCLK_PERIC0,
+   20, CLK_SET_RATE_PARENT, 0),
+   GATE(CLK_PCLK_GPIO_TOUCH, pclk_gpio_touch, aclk_peric_66,
+   ENABLE_PCLK_PERIC0, 19, 

Re: [PATCH v2 2/2] kvm: vmx: enable intel xsaves for guest

2014-12-02 Thread Paolo Bonzini


On 02/12/2014 07:14, Wanpeng Li wrote:
 Expose intel xsaves feature to guest.
 
 Signed-off-by: Wanpeng Li wanpeng...@linux.intel.com
 ---
 v1 - v2:
  *auto switch msr ia32_xss if this msr is present
 
  arch/x86/include/asm/kvm_host.h |  1 +
  arch/x86/include/asm/vmx.h  |  3 +++
  arch/x86/include/uapi/asm/vmx.h |  6 +-
  arch/x86/kvm/vmx.c  | 35 ++-
  4 files changed, 43 insertions(+), 2 deletions(-)
 
 diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
 index 2896dbc..95dde42 100644
 --- a/arch/x86/include/asm/kvm_host.h
 +++ b/arch/x86/include/asm/kvm_host.h
 @@ -362,6 +362,7 @@ struct kvm_vcpu_arch {
   int mp_state;
   u64 ia32_misc_enable_msr;
   bool tpr_access_reporting;
 + u64 ia32_xss;

The patch is not getting/setting ia32_xss when the guest does
RDMSR/WRMSR.  You also need a QEMU patch to migrate XSS.

   /*
* Paging state of the vcpu
 diff --git a/arch/x86/include/asm/vmx.h b/arch/x86/include/asm/vmx.h
 index bcbfade..bdb79ef 100644
 --- a/arch/x86/include/asm/vmx.h
 +++ b/arch/x86/include/asm/vmx.h
 @@ -69,6 +69,7 @@
  #define SECONDARY_EXEC_PAUSE_LOOP_EXITING0x0400
  #define SECONDARY_EXEC_ENABLE_INVPCID0x1000
  #define SECONDARY_EXEC_SHADOW_VMCS  0x4000
 +#define SECONDARY_EXEC_XSAVES0x0010
  
  
  #define PIN_BASED_EXT_INTR_MASK 0x0001
 @@ -159,6 +160,8 @@ enum vmcs_field {
   EOI_EXIT_BITMAP3_HIGH   = 0x2023,
   VMREAD_BITMAP   = 0x2026,
   VMWRITE_BITMAP  = 0x2028,
 + XSS_EXIT_BIMTAP = 0x202C,
 + XSS_EXIT_BIMTAP_HIGH= 0x202D,

s/BIMTAP/BITMAP/

   GUEST_PHYSICAL_ADDRESS  = 0x2400,
   GUEST_PHYSICAL_ADDRESS_HIGH = 0x2401,
   VMCS_LINK_POINTER   = 0x2800,
 diff --git a/arch/x86/include/uapi/asm/vmx.h b/arch/x86/include/uapi/asm/vmx.h
 index 990a2fe..b813bf9 100644
 --- a/arch/x86/include/uapi/asm/vmx.h
 +++ b/arch/x86/include/uapi/asm/vmx.h
 @@ -72,6 +72,8 @@
  #define EXIT_REASON_XSETBV  55
  #define EXIT_REASON_APIC_WRITE  56
  #define EXIT_REASON_INVPCID 58
 +#define EXIT_REASON_XSAVES  63
 +#define EXIT_REASON_XRSTORS 64
  
  #define VMX_EXIT_REASONS \
   { EXIT_REASON_EXCEPTION_NMI, EXCEPTION_NMI }, \
 @@ -116,6 +118,8 @@
   { EXIT_REASON_INVALID_STATE, INVALID_STATE }, \
   { EXIT_REASON_INVD,  INVD }, \
   { EXIT_REASON_INVVPID,   INVVPID }, \
 - { EXIT_REASON_INVPCID,   INVPCID }
 + { EXIT_REASON_INVPCID,   INVPCID }, \
 + { EXIT_REASON_XSAVES,XSAVES }, \
 + { EXIT_REASON_XRSTORS,   XRSTORS }
  
  #endif /* _UAPIVMX_H */
 diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
 index 6a951d8..b87b5b8 100644
 --- a/arch/x86/kvm/vmx.c
 +++ b/arch/x86/kvm/vmx.c
 @@ -1045,6 +1045,12 @@ static inline bool cpu_has_vmx_invpcid(void)
   SECONDARY_EXEC_ENABLE_INVPCID;
  }
  
 +static inline bool cpu_has_xss_exit_bitmap(void)
 +{
 + return vmcs_config.cpu_based_2nd_exec_ctrl 
 + SECONDARY_EXEC_XSAVES;
 +}
 +
  static inline bool cpu_has_virtual_nmis(void)
  {
   return vmcs_config.pin_based_exec_ctrl  PIN_BASED_VIRTUAL_NMIS;
 @@ -1773,6 +1779,14 @@ static void vmx_save_host_state(struct kvm_vcpu *vcpu)
   kvm_set_shared_msr(vmx-guest_msrs[i].index,
  vmx-guest_msrs[i].data,
  vmx-guest_msrs[i].mask);
 +
 + if (cpu_has_xsaves) {
 + u64 host_xss;
 +
 + rdmsrl(MSR_IA32_XSS, host_xss);

Is this host value fixed?  If so, please load it just once in
setup_vmcs_config.

 + add_atomic_switch_msr(vmx, MSR_IA32_XSS,
 + vcpu-arch.ia32_xss, host_xss);

Also, if host_xss is fixed you can do this add_atomic_switch_msr at
WRMSR time rather than here, and only if vcpu-arch.ia32_xss !=
host_xss.  If the two XSS values match, do clear_atomic_switch_msr instead.

 + }
  }
  
  static void __vmx_load_host_state(struct vcpu_vmx *vmx)
 @@ -2895,7 +2909,8 @@ static __init int setup_vmcs_config(struct vmcs_config 
 *vmcs_conf)
   SECONDARY_EXEC_ENABLE_INVPCID |
   SECONDARY_EXEC_APIC_REGISTER_VIRT |
   SECONDARY_EXEC_VIRTUAL_INTR_DELIVERY |
 - SECONDARY_EXEC_SHADOW_VMCS;
 + SECONDARY_EXEC_SHADOW_VMCS |
 + SECONDARY_EXEC_XSAVES;
   if (adjust_vmx_controls(min2, opt2,
   MSR_IA32_VMX_PROCBASED_CTLS2,
   _cpu_based_2nd_exec_control)  0)
 @@ -4346,6 +4361,7 @@ static int vmx_vcpu_setup(struct vcpu_vmx *vmx)

[PATCHv2 00/19] arm64: Add the support for new 64-bit Exynos5433 SoC

2014-12-02 Thread Chanwoo Choi
This patchset adds new 64-bit Exynos5433 Samsung SoC which contains quad
Cortex-A57 and quad Cortex-A53. It is desigend with the 20nm low power process.

This patchset include some patches such as:
- Support booting of Exynos5433
- Support UART/MCT/GIC/HSI2C/SPI/PDMA/MSHC
- Support the clock control for Exynos5433 using common clk framework

This patchst is based on linux-samsung.git (branch: v3.19-next/dt-samsung-64)

This patchset has the dependency as following list:
: The Exynos7 patchset[1] specified dependent patchset for 64-bit SoC.
 So, this patchset used same dependent patchset of Exynos7 patchset and Exynos7
 patchset about pinctrl patch. Additionally, SPI/MMC/PDMA patch [2-5] is used
 for kernel booting and mounting rootfs.

1. [PATCH v7 0/7] Enable support for Samsung Exynos7 SoC
- [1] http://www.spinics.net/lists/linux-samsung-soc/msg38734.html
2. [PATCH] spi: s3c64xx: add support for exynos7 SPI controller
- [2] http://www.spinics.net/lists/linux-samsung-soc/msg38607.html
3. [PATCH V7] mmc: dw_mmc: Add IDMAC 64-bit address mode support
- [3] https://lkml.org/lkml/2014/10/20/58
4. [PATCH] mmc: dw_mmc: exynos: Add support for exynos7
- [4] http://www.spinics.net/lists/linux-mmc/msg28294.html
5. [PATCH] dmaengine: pl330: Correct device assignment
- [5] https://lkml.org/lkml/2014/11/6/207

Changes from v1:
- Merge two patches (patch2, patch3) to solve incomplete description [by Arnd]
- Exynos5433 Clock driver
 : Fix wrong register and code clean by using space instead of tab [Pankaj]
 : Add CLK_IGNORE_UNUSED flag to pclk_sysreg_* clock for accessing system 
control register
 : Remove duplicate definition on the patch for CMU_BUS{0|1|2} domain
- Exynos5433 SoC DTS
 : Remove un-supported properties of arch_timer [by Marc and Mark]
 : Remove 'clock-frequency' property from 'cpus' dt node
 : Fix interrupt type from edge rising triggering to level high triggering
   because Cortex-A53/A57 use level triggering.
 : Fix defult address-size/size-celss from 1 to 2 because Exynos5433 is 64-bit 
SoC
 : Modify 'fin_pll' dt node to remove un-needed and ugly code
 : Move 'chipid' dt node under 'soc'
 : Use lowercase on all case in exynos5433.dtsi
 : Add PSCI dt node for secondary cpu boot
 : Add 'samsung,exynos5433' compatible to MCT dt node
- Divide pinctrl patch from this patchset
- Add new following patches:
  : clocksource: exynos_mct: Add the support for Exynos 64bit SoC
  : arm64: Enable Exynos5433 SoC in the defconfig

Chanwoo Choi (18):
  clk: samsung: exynos5433: Add clocks using common clock framework
  clk: samsung: exynos5433: Add MUX clocks of CMU_TOP domain
  clk: samsung: exynos5433: Add clocks for CMU_PERIC domain
  clk: samsung: exynos5433: Add clocks for CMU_PERIS domain
  clk: samsung: exynos5433: Add clocks for CMU_G2D domain
  clk: samsung: exynos5433: Add clocks for CMU_MIF domain
  clk: samsung: exynos5433: Add clocks for CMU_DISP domain
  clk: samsung: exynos5433: Add clocks for CMU_AUD domain
  clk: samsung: exynos5433: Add clocks for CMU_BUS{0|1|2} domains
  clk: samsung: exynos5433: Add missing clocks for CMU_FSYS domain
  clk: samsung: exynos5433: Add clocks for CMU_G3D domain
  clk: samsung: exynos5433: Add clocks for CMU_GSCL domain
  arm64: exynos5433: Enable ARMv8-based Exynos5433 SoC support
  arm64: dts: exynos: Add dts files for 64-bit Exynos5433 SoC
  arm64: dts: exynos: Add SPI/PDMA dt node for Exynos5433
  serial: samsung: Add the support for Exynos5433 SoC
  clocksource: exynos_mct: Add the support for Exynos 64bit SoC
  arm64: Enable Exynos5433 SoC in the defconfig

Jaehoon Chung (1):
  arm64: dts: exynos: Add MSHC dt node for Exynos5433

 .../devicetree/bindings/clock/exynos5433-clock.txt |  167 +
 arch/arm64/Kconfig |   10 +
 arch/arm64/boot/dts/exynos/exynos5433-pinctrl.dtsi |  698 
 arch/arm64/boot/dts/exynos/exynos5433.dtsi |  675 
 arch/arm64/configs/defconfig   |1 +
 drivers/clk/samsung/Makefile   |1 +
 drivers/clk/samsung/clk-exynos5433.c   | 3369 
 drivers/clocksource/Kconfig|1 -
 drivers/clocksource/exynos_mct.c   |4 +
 drivers/tty/serial/samsung.c   |   56 +-
 include/dt-bindings/clock/exynos5433.h |  843 +
 11 files changed, 5804 insertions(+), 21 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/clock/exynos5433-clock.txt
 create mode 100644 arch/arm64/boot/dts/exynos/exynos5433-pinctrl.dtsi
 create mode 100644 arch/arm64/boot/dts/exynos/exynos5433.dtsi
 create mode 100644 drivers/clk/samsung/clk-exynos5433.c
 create mode 100644 include/dt-bindings/clock/exynos5433.h

-- 
1.8.5.5

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


[PATCH 02/19] clk: samsung: exynos5433: Add MUX clocks of CMU_TOP domain

2014-12-02 Thread Chanwoo Choi
This patch adds the MUX (multiplexer) clocks for CMU_TOP domain of Exynos5433.
CMU_TOP domain provides source clocks to other CMU domains.

Cc: Sylwester Nawrocki s.nawro...@samsung.com
Cc: Tomasz Figa tomasz.f...@gmail.com
Signed-off-by: Chanwoo Choi cw00.c...@samsung.com
Acked-by: Inki Dae inki@samsung.com
Acked-by: Geunsik Lim geunsik@samsung.com
---
 drivers/clk/samsung/clk-exynos5433.c   | 90 ++
 include/dt-bindings/clock/exynos5433.h | 31 +++-
 2 files changed, 119 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/samsung/clk-exynos5433.c 
b/drivers/clk/samsung/clk-exynos5433.c
index 0877663..88e8cac 100644
--- a/drivers/clk/samsung/clk-exynos5433.c
+++ b/drivers/clk/samsung/clk-exynos5433.c
@@ -208,6 +208,7 @@ PNAME(mout_mphy_pll_user_p) = { fin_pll, sclk_mphy_pll, 
};
 PNAME(mout_mfc_pll_user_p) = { fin_pll, sclk_mfc_pll, };
 PNAME(mout_bus_pll_user_p) = { fin_pll, sclk_bus_pll, };
 PNAME(mout_bus_pll_user_t_p)   = { fin_pll, mout_bus_pll_user, };
+PNAME(mout_mphy_pll_user_t_p)  = { fin_pll, mout_mphy_pll_user, };
 
 PNAME(mout_bus_mfc_pll_user_p) = { mout_bus_pll_user, mout_mfc_pll_user,};
 PNAME(mout_mfc_bus_pll_user_p) = { mout_mfc_pll_user, mout_bus_pll_user,};
@@ -215,6 +216,12 @@ PNAME(mout_aclk_cam1_552_b_p)  = { 
mout_aclk_cam1_552_a,
mout_mfc_pll_user, };
 PNAME(mout_aclk_cam1_552_a_p)  = { mout_isp_pll, mout_bus_pll_user, };
 
+PNAME(mout_aclk_mfc_400_c_p)   = { mout_aclk_mfc_400_b,
+   mout_mphy_pll_user, };
+PNAME(mout_aclk_mfc_400_b_p)   = { mout_aclk_mfc_400_a,
+   mout_bus_pll_user, };
+PNAME(mout_aclk_mfc_400_a_p)   = { mout_mfc_pll_user, mout_isp_pll, };
+
 PNAME(mout_bus_mphy_pll_user_p)= { mout_bus_pll_user,
mout_mphy_pll_user, };
 PNAME(mout_aclk_mscl_b_p)  = { mout_aclk_mscl_400_a,
@@ -231,11 +238,26 @@ PNAME(mout_sclk_mmc0_d_p) = { mout_sclk_mmc0_c, 
mout_isp_pll, };
 PNAME(mout_sclk_mmc0_c_p)  = { mout_sclk_mmc0_b, mout_mphy_pll_user,};
 PNAME(mout_sclk_mmc0_b_p)  = { mout_sclk_mmc0_a, mout_mfc_pll_user, };
 
+PNAME(mout_sclk_spdif_p)   = { sclk_audio0, sclk_audio1,
+   fin_pll, ioclk_spdif_extclk, };
+PNAME(mout_sclk_audio1_p)  = { ioclk_audiocdclk1, fin_pll,
+   mout_aud_pll_user_t,};
+PNAME(mout_sclk_audio0_p)  = { ioclk_audiocdclk0, fin_pll,
+   mout_aud_pll_user_t,};
+
 static struct samsung_fixed_factor_clock top_fixed_factor_clks[] __initdata = {
FFACTOR(0, sclk_bus_pll, fout_bus_pll, 1, 1, 0),
FFACTOR(0, sclk_mfc_pll, fout_mfc_pll, 1, 1, 0),
 };
 
+static struct samsung_fixed_rate_clock top_fixed_clks[] __initdata = {
+   /* Xi2s{0|1}CDCLK input clock for I2S/PCM */
+   FRATE(0, ioclk_audiocdclk1, NULL, CLK_IS_ROOT, 1),
+   FRATE(0, ioclk_audiocdclk0, NULL, CLK_IS_ROOT, 1),
+   /* Xi2s1SDI input clock for SPDIF */
+   FRATE(0, ioclk_spdif_extclk, NULL, CLK_IS_ROOT, 1),
+};
+
 static struct samsung_mux_clock top_mux_clks[] __initdata = {
/* MUX_SEL_TOP0 */
MUX(CLK_MOUT_AUD_PLL, mout_aud_pll, mout_aud_pll_p, MUX_SEL_TOP0,
@@ -281,6 +303,14 @@ static struct samsung_mux_clock top_mux_clks[] __initdata 
= {
MUX(CLK_MOUT_ACLK_G2D_400_A, mout_aclk_g2d_400_a,
mout_bus_mfc_pll_user_p, MUX_SEL_TOP3, 0, 1),
 
+   /* MUX_SEL_TOP4 */
+   MUX(CLK_MOUT_ACLK_MFC_400_C, mout_aclk_mfc_400_c,
+   mout_aclk_mfc_400_c_p, MUX_SEL_TOP4, 8, 1),
+   MUX(CLK_MOUT_ACLK_MFC_400_B, mout_aclk_mfc_400_b,
+   mout_aclk_mfc_400_b_p, MUX_SEL_TOP4, 4, 1),
+   MUX(CLK_MOUT_ACLK_MFC_400_A, mout_aclk_mfc_400_a,
+   mout_aclk_mfc_400_a_p, MUX_SEL_TOP4, 0, 1),
+
/* MUX_SEL_TOP_MSCL */
MUX(CLK_MOUT_SCLK_JPEG_C, mout_sclk_jpeg_c, mout_sclk_jpeg_c_p,
MUX_SEL_TOP_MSCL, 8, 1),
@@ -289,6 +319,20 @@ static struct samsung_mux_clock top_mux_clks[] __initdata 
= {
MUX(CLK_MOUT_SCLK_JPEG_A, mout_sclk_jpeg_a, mout_bus_pll_user_t_p,
MUX_SEL_TOP_MSCL, 0, 1),
 
+   /* MUX_SEL_TOP_CAM1 */
+   MUX(CLK_MOUT_SCLK_ISP_SENSOR2, mout_sclk_isp_sensor2,
+   mout_bus_pll_user_t_p, MUX_SEL_TOP_CAM1, 24, 1),
+   MUX(CLK_MOUT_SCLK_ISP_SENSOR1, mout_sclk_isp_sensor1,
+   mout_bus_pll_user_t_p, MUX_SEL_TOP_CAM1, 20, 1),
+   MUX(CLK_MOUT_SCLK_ISP_SENSOR0, mout_sclk_isp_sensor0,
+   mout_bus_pll_user_t_p, MUX_SEL_TOP_CAM1, 16, 1),
+   MUX(CLK_MOUT_SCLK_ISP_UART, mout_sclk_isp_uart,
+   mout_bus_pll_user_t_p, MUX_SEL_TOP_CAM1, 8, 1),
+   MUX(CLK_MOUT_SCLK_ISP_SPI1, mout_sclk_isp_spi1,
+   mout_bus_pll_user_t_p, MUX_SEL_TOP_CAM1, 4, 1),
+  

[PATCH 04/19] clk: samsung: exynos5433: Add clocks for CMU_PERIS domain

2014-12-02 Thread Chanwoo Choi
This patch adds missing gate clocks of CMU_PERIS domain
which includes TMU/TZPC/SECKEY/CHIPID/TOPRTC/EFUSE IPs.
The special clocks of CMU_PERIS use fin_pll source clock directly.

Cc: Sylwester Nawrocki s.nawro...@samsung.com
Cc: Tomasz Figa tomasz.f...@gmail.com
Signed-off-by: Chanwoo Choi cw00.c...@samsung.com
Acked-by: Inki Dae inki@samsung.com
Acked-by: Geunsik Lim geunsik@samsung.com
---
 drivers/clk/samsung/clk-exynos5433.c   | 146 -
 include/dt-bindings/clock/exynos5433.h |  33 +++-
 2 files changed, 176 insertions(+), 3 deletions(-)

diff --git a/drivers/clk/samsung/clk-exynos5433.c 
b/drivers/clk/samsung/clk-exynos5433.c
index a48b36c..7e4612f 100644
--- a/drivers/clk/samsung/clk-exynos5433.c
+++ b/drivers/clk/samsung/clk-exynos5433.c
@@ -248,6 +248,7 @@ PNAME(mout_sclk_audio0_p)   = { ioclk_audiocdclk0, 
fin_pll,
 static struct samsung_fixed_factor_clock top_fixed_factor_clks[] __initdata = {
FFACTOR(0, sclk_bus_pll, fout_bus_pll, 1, 1, 0),
FFACTOR(0, sclk_mfc_pll, fout_mfc_pll, 1, 1, 0),
+   FFACTOR(0, oscclk_efuse_common, fin_pll, 1, 1, 0),
 };
 
 static struct samsung_fixed_rate_clock top_fixed_clks[] __initdata = {
@@ -957,15 +958,69 @@ CLK_OF_DECLARE(exynos5433_cmu_peric, 
samsung,exynos5433-cmu-peric,
 /*
  * Register offset definitions for CMU_PERIS
  */
-#define ENABLE_ACLK_PERIS  0x0800
-#define ENABLE_PCLK_PERIS  0x0900
+#define ENABLE_ACLK_PERIS  0x0800
+#define ENABLE_PCLK_PERIS  0x0900
+#define ENABLE_PCLK_PERIS_SECURE_TZPC  0x0904
+#define ENABLE_PCLK_PERIS_SECURE_SECKEY_APBIF  0x0908
+#define ENABLE_PCLK_PERIS_SECURE_CHIPID_APBIF  0x090c
+#define ENABLE_PCLK_PERIS_SECURE_TOPRTC0x0910
+#define ENABLE_PCLK_PERIS_SECURE_CUSTOM_EFUSE_APBIF0x0914
+#define ENABLE_PCLK_PERIS_SECURE_ANTIRBK_CNT_APBIF 0x0918
+#define ENABLE_PCLK_PERIS_SECURE_OTP_CON_APBIF 0x091c
+#define ENABLE_SCLK_PERIS  0x0a00
+#define ENABLE_SCLK_PERIS_SECURE_SECKEY0x0a04
+#define ENABLE_SCLK_PERIS_SECURE_CHIPID0x0a08
+#define ENABLE_SCLK_PERIS_SECURE_TOPRTC0x0a0c
+#define ENABLE_SCLK_PERIS_SECURE_CUSTOM_EFUSE  0x0a10
+#define ENABLE_SCLK_PERIS_SECURE_ANTIRBK_CNT   0x0a14
+#define ENABLE_SCLK_PERIS_SECURE_OTP_CON   0x0a18
+#define ENABLE_IP_PERIS0   0x0b00
+#define ENABLE_IP_PERIS1   0x0b04
+#define ENABLE_IP_PERIS_SECURE_TZPC0x0b08
+#define ENABLE_IP_PERIS_SECURE_SECKEY  0x0b0c
+#define ENABLE_IP_PERIS_SECURE_CHIPID  0x0b10
+#define ENABLE_IP_PERIS_SECURE_TOPRTC  0x0b14
+#define ENABLE_IP_PERIS_SECURE_CUSTOM_EFUSE0x0b18
+#define ENABLE_IP_PERIS_SECURE_ANTIBRK_CNT 0x0b1c
+#define ENABLE_IP_PERIS_SECURE_OTP_CON 0x0b20
 
 static unsigned long peris_clk_regs[] __initdata = {
ENABLE_ACLK_PERIS,
ENABLE_PCLK_PERIS,
+   ENABLE_PCLK_PERIS_SECURE_TZPC,
+   ENABLE_PCLK_PERIS_SECURE_SECKEY_APBIF,
+   ENABLE_PCLK_PERIS_SECURE_CHIPID_APBIF,
+   ENABLE_PCLK_PERIS_SECURE_TOPRTC,
+   ENABLE_PCLK_PERIS_SECURE_CUSTOM_EFUSE_APBIF,
+   ENABLE_PCLK_PERIS_SECURE_ANTIRBK_CNT_APBIF,
+   ENABLE_PCLK_PERIS_SECURE_OTP_CON_APBIF,
+   ENABLE_SCLK_PERIS,
+   ENABLE_SCLK_PERIS_SECURE_SECKEY,
+   ENABLE_SCLK_PERIS_SECURE_CHIPID,
+   ENABLE_SCLK_PERIS_SECURE_TOPRTC,
+   ENABLE_SCLK_PERIS_SECURE_CUSTOM_EFUSE,
+   ENABLE_SCLK_PERIS_SECURE_ANTIRBK_CNT,
+   ENABLE_SCLK_PERIS_SECURE_OTP_CON,
+   ENABLE_IP_PERIS0,
+   ENABLE_IP_PERIS1,
+   ENABLE_IP_PERIS_SECURE_TZPC,
+   ENABLE_IP_PERIS_SECURE_SECKEY,
+   ENABLE_IP_PERIS_SECURE_CHIPID,
+   ENABLE_IP_PERIS_SECURE_TOPRTC,
+   ENABLE_IP_PERIS_SECURE_CUSTOM_EFUSE,
+   ENABLE_IP_PERIS_SECURE_ANTIBRK_CNT,
+   ENABLE_IP_PERIS_SECURE_OTP_CON,
 };
 
 static struct samsung_gate_clock peris_gate_clks[] __initdata = {
+   /* ENABLE_ACLK_PERIS */
+   GATE(CLK_ACLK_AHB2APB_PERIS1P, aclk_ahb2apb_peris1p, aclk_peris_66,
+   ENABLE_ACLK_PERIS, 2, CLK_IGNORE_UNUSED, 0),
+   GATE(CLK_ACLK_AHB2APB_PERIS0P, aclk_ahb2apb_peris0p, aclk_peris_66,
+   ENABLE_ACLK_PERIS, 1, CLK_IGNORE_UNUSED, 0),
+   GATE(CLK_ACLK_PERISNP_66, aclk_perisnp_66, aclk_peris_66,
+   ENABLE_ACLK_PERIS, 0, CLK_IGNORE_UNUSED, 0),
+
/* ENABLE_PCLK_PERIS */
GATE(CLK_PCLK_HPM_APBIF, pclk_hpm_apbif, aclk_peris_66,
ENABLE_PCLK_PERIS, 30, CLK_IGNORE_UNUSED, 0),
@@ -987,6 +1042,93 @@ static struct samsung_gate_clock peris_gate_clks[] 
__initdata = {
ENABLE_PCLK_PERIS, 15, CLK_IGNORE_UNUSED, 0),

[PATCH 15/19] arm64: dts: exynos: Add MSHC dt node for Exynos5433

2014-12-02 Thread Chanwoo Choi
From: Jaehoon Chung jh80.ch...@samsung.com

This patch adds MSHC (Mobile Storage Host Controller) dt node for Exynos5433
SoC. MSHC is an interface between the system the SD/MMC card.

Cc: Kukjin Kim kgene@samsung.com
Cc: Mark Rutland mark.rutl...@arm.com
Cc: Marc Zyngier marc.zyng...@arm.com
Cc: Arnd Bergmann a...@arndb.de
Cc: Olof Johansson o...@lixom.net
Cc: Catalin Marinas catalin.mari...@arm.com
Cc: Will Deacon will.dea...@arm.com
Signed-off-by: Jaehoon Chung jh80.ch...@samsung.com
Signed-off-by: Chanwoo Choi cw00.c...@samsung.com
Acked-by: Inki Dae inki@samsung.com
Acked-by: Geunsik Lim geunsik@samsung.com
---
 arch/arm64/boot/dts/exynos/exynos5433.dtsi | 42 ++
 1 file changed, 42 insertions(+)

diff --git a/arch/arm64/boot/dts/exynos/exynos5433.dtsi 
b/arch/arm64/boot/dts/exynos/exynos5433.dtsi
index 5637086..fef9bbc 100644
--- a/arch/arm64/boot/dts/exynos/exynos5433.dtsi
+++ b/arch/arm64/boot/dts/exynos/exynos5433.dtsi
@@ -52,6 +52,9 @@
i2c9 = hsi2c_9;
i2c10 = hsi2c_10;
i2c11 = hsi2c_11;
+   mshc0 = mshc_0;
+   mshc1 = mshc_1;
+   mshc2 = mshc_2;
};
 
cpus {
@@ -502,6 +505,45 @@
status = disabled;
};
 
+   mshc_0: mshc@1554 {
+   compatible = samsung,exynos7-dw-mshc-smu;
+   interrupts = 0 225 0;
+   #address-cells = 1;
+   #size-cells = 0;
+   reg = 0x1554 0x2000;
+   clocks = cmu_fsys CLK_ACLK_MMC0,
+cmu_fsys CLK_SCLK_MMC0;
+   clock-names = biu, ciu;
+   fifo-depth = 0x40;
+   status = disabled;
+   };
+
+   mshc_1: mshc@1555 {
+   compatible = samsung,exynos7-dw-mshc-smu;
+   interrupts = 0 226 0;
+   #address-cells = 1;
+   #size-cells = 0;
+   reg = 0x1555 0x2000;
+   clocks = cmu_fsys CLK_ACLK_MMC1,
+cmu_fsys CLK_SCLK_MMC1;
+   clock-names = biu, ciu;
+   fifo-depth = 0x40;
+   status = disabled;
+   };
+
+   mshc_2: mshc@1556 {
+   compatible = samsung,exynos7-dw-mshc-smu;
+   interrupts = 0 227 0;
+   #address-cells = 1;
+   #size-cells = 0;
+   reg = 0x1556 0x2000;
+   clocks = cmu_fsys CLK_ACLK_MMC2,
+cmu_fsys CLK_SCLK_MMC2;
+   clock-names = biu, ciu;
+   fifo-depth = 0x40;
+   status = disabled;
+   };
+
timer {
compatible = arm,armv8-timer;
interrupts = 4 13 0xff01,
-- 
1.8.5.5

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


[PATCH 16/19] arm64: dts: exynos: Add SPI/PDMA dt node for Exynos5433

2014-12-02 Thread Chanwoo Choi
This patch adds SPI (Serial Peripheral Interface) dt node for Exynos5433 SoC.
SPI transfers serial data by using various peripherals. SPI includes
8-bit/16-bit/32-bit shift registers to transmit and receive data. PDMA is used
for SPI communication.

Cc: Kukjin Kim kgene@samsung.com
Cc: Mark Rutland mark.rutl...@arm.com
Cc: Marc Zyngier marc.zyng...@arm.com
Cc: Arnd Bergmann a...@arndb.de
Cc: Olof Johansson o...@lixom.net
Cc: Catalin Marinas catalin.mari...@arm.com
Cc: Will Deacon will.dea...@arm.com
Signed-off-by: Chanwoo Choi cw00.c...@samsung.com
Acked-by: Inki Dae inki@samsung.com
Acked-by: Geunsik Lim geunsik@samsung.com
---
 arch/arm64/boot/dts/exynos/exynos5433.dtsi | 118 +
 1 file changed, 118 insertions(+)

diff --git a/arch/arm64/boot/dts/exynos/exynos5433.dtsi 
b/arch/arm64/boot/dts/exynos/exynos5433.dtsi
index fef9bbc..22f2df8 100644
--- a/arch/arm64/boot/dts/exynos/exynos5433.dtsi
+++ b/arch/arm64/boot/dts/exynos/exynos5433.dtsi
@@ -55,6 +55,11 @@
mshc0 = mshc_0;
mshc1 = mshc_1;
mshc2 = mshc_2;
+   spi0 = spi_0;
+   spi1 = spi_1;
+   spi2 = spi_2;
+   spi3 = spi_3;
+   spi4 = spi_4;
};
 
cpus {
@@ -249,6 +254,34 @@
interrupts = 1 9 0xf04;
};
 
+   amba {
+   compatible = arm,amba-bus;
+   #address-cells = 1;
+   #size-cells = 1;
+
+   pdma0: pdma@1561 {
+   compatible = arm,pl330, arm,primecell;
+   reg = 0x1561 0x1000;
+   interrupts = 0 228 0;
+   clocks = cmu_fsys CLK_PDMA0;
+   clock-names = apb_pclk;
+   #dma-cells = 1;
+   #dma-channels = 8;
+   #dma-requests = 32;
+   };
+
+   pdma1: pdma@1560 {
+   compatible = arm,pl330, arm,primecell;
+   reg = 0x1560 0x1000;
+   interrupts = 0 246 0;
+   clocks = cmu_fsys CLK_PDMA1;
+   clock-names = apb_pclk;
+   #dma-cells = 1;
+   #dma-channels = 8;
+   #dma-requests = 32;
+   };
+   };
+
serial_0: serial@14c1 {
compatible = samsung,exynos5433-uart;
reg = 0x14c1 0x100;
@@ -349,6 +382,91 @@
interrupts = 0 442 0;
};
 
+   spi_0: spi@14d2 {
+   compatible = samsung,exynos7-spi;
+   reg = 0x14d2 0x100;
+   interrupts = 0 432 0;
+   dmas = pdma0 9, pdma0 8;
+   dma-names = tx, rx;
+   #address-cells = 1;
+   #size-cells = 0;
+   clocks = cmu_peric CLK_PCLK_SPI0,
+cmu_top CLK_SCLK_SPI0_PERIC;
+   clock-names = spi, spi_busclk0;
+   samsung,spi-src-clk = 0;
+   pinctrl-names = default;
+   pinctrl-0 = spi0_bus;
+   status = disabled;
+   };
+
+   spi_1: spi@14d3 {
+   compatible = samsung,exynos7-spi;
+   reg = 0x14d3 0x100;
+   interrupts = 0 433 0;
+   dmas = pdma0 11, pdma0 10;
+   dma-names = tx, rx;
+   #address-cells = 1;
+   #size-cells = 0;
+   clocks = cmu_peric CLK_PCLK_SPI1,
+cmu_top CLK_SCLK_SPI1_PERIC;
+   clock-names = spi, spi_busclk0;
+   samsung,spi-src-clk = 0;
+   pinctrl-names = default;
+   pinctrl-0 = spi1_bus;
+   status = disabled;
+   };
+
+   spi_2: spi@14d4 {
+   compatible = samsung,exynos7-spi;
+   reg = 0x14d4 0x100;
+   interrupts = 0 434 0;
+   dmas = pdma0 13, pdma0 12;
+   dma-names = tx, rx;
+   #address-cells = 1;
+   #size-cells = 0;
+   clocks = cmu_peric CLK_PCLK_SPI2,
+cmu_top CLK_SCLK_SPI2_PERIC;
+   clock-names = spi, spi_busclk0;
+   samsung,spi-src-clk = 0;
+   pinctrl-names = 

[PATCH 17/19] serial: samsung: Add the support for Exynos5433 SoC

2014-12-02 Thread Chanwoo Choi
This patch adds new s3c24xx_serial_drv_data structure for Exynos5433 SoC
because Exynos5433 has different fifo size from existing Exynos4 SoC.

Cc: Greg Kroah-Hartman gre...@linuxfoundation.org
Cc: Jiri Slaby jsl...@suse.cz
Cc: linux-ser...@vger.kernel.org
Signed-off-by: Chanwoo Choi cw00.c...@samsung.com
Acked-by: Inki Dae inki@samsung.com
Acked-by: Geunsik Lim geunsik@samsung.com
---
 drivers/tty/serial/samsung.c | 56 
 1 file changed, 36 insertions(+), 20 deletions(-)

diff --git a/drivers/tty/serial/samsung.c b/drivers/tty/serial/samsung.c
index c78f43a..1747fdc 100644
--- a/drivers/tty/serial/samsung.c
+++ b/drivers/tty/serial/samsung.c
@@ -1771,32 +1771,43 @@ static struct s3c24xx_serial_drv_data 
s5pv210_serial_drv_data = {
 #endif
 
 #if defined(CONFIG_ARCH_EXYNOS)
+#define EXYNOS_COMMON_SERIAL_DRV_DATA  \
+   .info = (struct s3c24xx_uart_info) {   \
+   .name   = Samsung Exynos UART,\
+   .type   = PORT_S3C6400, \
+   .has_divslot= 1,\
+   .rx_fifomask= S5PV210_UFSTAT_RXMASK,\
+   .rx_fifoshift   = S5PV210_UFSTAT_RXSHIFT,   \
+   .rx_fifofull= S5PV210_UFSTAT_RXFULL,\
+   .tx_fifofull= S5PV210_UFSTAT_TXFULL,\
+   .tx_fifomask= S5PV210_UFSTAT_TXMASK,\
+   .tx_fifoshift   = S5PV210_UFSTAT_TXSHIFT,   \
+   .def_clk_sel= S3C2410_UCON_CLKSEL0, \
+   .num_clks   = 1,\
+   .clksel_mask= 0,\
+   .clksel_shift   = 0,\
+   },  \
+   .def_cfg = (struct s3c2410_uartcfg) {  \
+   .ucon   = S5PV210_UCON_DEFAULT, \
+   .ufcon  = S5PV210_UFCON_DEFAULT,\
+   .has_fracval= 1,\
+   }   \
+
 static struct s3c24xx_serial_drv_data exynos4210_serial_drv_data = {
-   .info = (struct s3c24xx_uart_info) {
-   .name   = Samsung Exynos4 UART,
-   .type   = PORT_S3C6400,
-   .has_divslot= 1,
-   .rx_fifomask= S5PV210_UFSTAT_RXMASK,
-   .rx_fifoshift   = S5PV210_UFSTAT_RXSHIFT,
-   .rx_fifofull= S5PV210_UFSTAT_RXFULL,
-   .tx_fifofull= S5PV210_UFSTAT_TXFULL,
-   .tx_fifomask= S5PV210_UFSTAT_TXMASK,
-   .tx_fifoshift   = S5PV210_UFSTAT_TXSHIFT,
-   .def_clk_sel= S3C2410_UCON_CLKSEL0,
-   .num_clks   = 1,
-   .clksel_mask= 0,
-   .clksel_shift   = 0,
-   },
-   .def_cfg = (struct s3c2410_uartcfg) {
-   .ucon   = S5PV210_UCON_DEFAULT,
-   .ufcon  = S5PV210_UFCON_DEFAULT,
-   .has_fracval= 1,
-   },
+   EXYNOS_COMMON_SERIAL_DRV_DATA,
.fifosize = { 256, 64, 16, 16 },
 };
+
+static struct s3c24xx_serial_drv_data exynos5433_serial_drv_data = {
+   EXYNOS_COMMON_SERIAL_DRV_DATA,
+   .fifosize = { 64, 256, 16, 256 },
+};
+
 #define EXYNOS4210_SERIAL_DRV_DATA 
((kernel_ulong_t)exynos4210_serial_drv_data)
+#define EXYNOS5433_SERIAL_DRV_DATA 
((kernel_ulong_t)exynos5433_serial_drv_data)
 #else
 #define EXYNOS4210_SERIAL_DRV_DATA (kernel_ulong_t)NULL
+#define EXYNOS5433_SERIAL_DRV_DATA (kernel_ulong_t)NULL
 #endif
 
 static struct platform_device_id s3c24xx_serial_driver_ids[] = {
@@ -1818,6 +1829,9 @@ static struct platform_device_id 
s3c24xx_serial_driver_ids[] = {
}, {
.name   = exynos4210-uart,
.driver_data= EXYNOS4210_SERIAL_DRV_DATA,
+   }, {
+   .name   = exynos5433-uart,
+   .driver_data= EXYNOS5433_SERIAL_DRV_DATA,
},
{ },
 };
@@ -1837,6 +1851,8 @@ static const struct of_device_id s3c24xx_uart_dt_match[] 
= {
.data = (void *)S5PV210_SERIAL_DRV_DATA },
{ .compatible = samsung,exynos4210-uart,
.data = (void *)EXYNOS4210_SERIAL_DRV_DATA },
+   { .compatible = samsung,exynos5433-uart,
+   .data = (void *)EXYNOS5433_SERIAL_DRV_DATA },
{},
 };
 MODULE_DEVICE_TABLE(of, s3c24xx_uart_dt_match);
-- 
1.8.5.5

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


[PATCH 01/19] clk: samsung: exynos5433: Add clocks using common clock framework

2014-12-02 Thread Chanwoo Choi
This patch adds the support for CMU (Clock Management Units) of Exynos5433
which is 64bit SoC and has Octa-cores. This patch supports necessary clocks
(PLL/MMC/UART/MCT/I2C/SPI) for kernel boot and includes binding documentation
for Exynos5433 clock controller.

Cc: Sylwester Nawrocki s.nawro...@samsung.com
Cc: Tomasz Figa tomasz.f...@gmail.com
Signed-off-by: Chanwoo Choi cw00.c...@samsung.com
Acked-by: Inki Dae inki@samsung.com
Acked-by: Geunsik Lim geunsik@samsung.com
---
 .../devicetree/bindings/clock/exynos5433-clock.txt | 106 +++
 drivers/clk/samsung/Makefile   |   1 +
 drivers/clk/samsung/clk-exynos5433.c   | 967 +
 include/dt-bindings/clock/exynos5433.h | 199 +
 4 files changed, 1273 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/exynos5433-clock.txt
 create mode 100644 drivers/clk/samsung/clk-exynos5433.c
 create mode 100644 include/dt-bindings/clock/exynos5433.h

diff --git a/Documentation/devicetree/bindings/clock/exynos5433-clock.txt 
b/Documentation/devicetree/bindings/clock/exynos5433-clock.txt
new file mode 100644
index 000..72cd0ba
--- /dev/null
+++ b/Documentation/devicetree/bindings/clock/exynos5433-clock.txt
@@ -0,0 +1,106 @@
+* Samsung Exynos5433 CMU (Clock Management Units)
+
+The Exynos5433 clock controller generates and supplies clock to various
+controllers within the Exynos5433 SoC.
+
+Required Properties:
+
+- compatible: should be one of the following.
+  - samsung,exynos5433-cmu-top   - clock controller compatible for CMU_TOP
+which generates clocks for IMEM/FSYS/G3D/GSCL/HEVC/MSCL/G2D/MFC/PERIC/PERIS
+domains and bus clocks.
+  - samsung,exynos5433-cmu-cpif  - clock controller compatible for CMU_CPIF
+which generates clocks for LLI (Low Latency Interface) IP.
+  - samsung,exynos5433-cmu-mif   - clock controller compatible for CMU_MIF
+which generates clocks for DRAM Memory Controller domain.
+  - samsung,exynos5433-cmu-peric - clock controller compatible for CMU_PERIC
+which generates clocks for UART/I2C/SPI/I2S/PCM/SPDIF/PWM/SLIMBUS IPs.
+  - samsung,exynos5433-cmu-peris - clock controller compatible for CMU_PERIS
+which generates clocks for PMU/TMU/MCT/WDT/RTC/SECKEY/TZPC IPs.
+  - samsung,exynos5433-cmu-fsys  - clock controller compatible for CMU_FSYS
+which generates clocks for USB/UFS/SDMMC/TSI/PDMA IPs.
+
+- reg: physical base address of the controller and length of memory mapped
+  region.
+
+- #clock-cells: should be 1.
+
+Each clock is assigned an identifier and client nodes can use this identifier
+to specify the clock which they consume.
+
+All available clocks are defined as preprocessor macros in
+dt-bindings/clock/exynos5433.h header and can be used in device
+tree sources.
+
+Example 1: Examples of clock controller nodes are listed below.
+
+   cmu_top: clock-controller@0x1003 {
+   compatible = samsung,exynos5433-cmu-top;
+   reg = 0x1003 0x0c04;
+   #clock-cells = 1;
+   };
+
+   cmu_cpif: clock-controller@0x10fc {
+   compatible = samsung,exynos5433-cmu-cpif;
+   reg = 0x10fc 0x0c04;
+   #clock-cells = 1;
+   };
+
+   cmu_mif: clock-controller@0x105b {
+   compatible = samsung,exynos5433-cmu-mif;
+   reg = 0x105b 0x100c;
+   #clock-cells = 1;
+   };
+
+   cmu_peric: clock-controller@0x14c8 {
+   compatible = samsung,exynos5433-cmu-peric;
+   reg = 0x14c8 0x0b08;
+   #clock-cells = 1;
+   };
+
+   cmu_peris: clock-controller@0x1004 {
+   compatible = samsung,exynos5433-cmu-peris;
+   reg = 0x1004 0x0b20;
+   #clock-cells = 1;
+   };
+
+   cmu_fsys: clock-controller@0x156e {
+   compatible = samsung,exynos5433-cmu-fsys;
+   reg = 0x156e 0x0b04;
+   #clock-cells = 1;
+   };
+
+Example 2: UART controller node that consumes the clock generated by the clock
+  controller.
+
+   serial_0: serial@14C1 {
+   compatible = samsung,exynos5433-uart;
+   reg = 0x14C1 0x100;
+   interrupts = 0 421 0;
+   clocks = cmu_peric CLK_PCLK_UART0,
+cmu_peric CLK_SCLK_UART0;
+   clock-names = uart, clk_uart_baud0;
+   pinctrl-names = default;
+   pinctrl-0 = uart0_bus;
+   status = disabled;
+   };
+
+Example 3: SPI controller node that consumes the clock generated by the clock
+  controller.
+
+   spi_0: spi@14d2 {
+   compatible = samsung,exynos7-spi;
+   reg = 0x14d2 0x100;
+   interrupts = 0 432 0;
+   dmas = pdma0 9, pdma0 8;
+   dma-names = tx, rx;
+   #address-cells = 1;
+   #size-cells = 0;
+

[PATCH 09/19] clk: samsung: exynos5433: Add clocks for CMU_BUS{0|1|2} domains

2014-12-02 Thread Chanwoo Choi
This patch adds the mux/divider/gate clocks for CMU_BUS{0|1|2} domains
which contain global data buses clocked at up the 400MHz. These blocks
transfer data between DRAM and various sub-blocks. These clock domains
also contain global peripheral buses clocked at 67/111/200/222/266/333/400
MHz and used for regiser accesses.

Cc: Sylwester Nawrocki s.nawro...@samsung.com
Cc: Tomasz Figa tomasz.f...@gmail.com
Cc: Arnd Bergmann a...@arndb.de
Signed-off-by: Chanwoo Choi cw00.c...@samsung.com
Acked-by: Inki Dae inki@samsung.com
Acked-by: Geunsik Lim geunsik@samsung.com
---
 .../devicetree/bindings/clock/exynos5433-clock.txt |  21 +++
 drivers/clk/samsung/clk-exynos5433.c   | 185 -
 include/dt-bindings/clock/exynos5433.h |  29 +++-
 3 files changed, 232 insertions(+), 3 deletions(-)

diff --git a/Documentation/devicetree/bindings/clock/exynos5433-clock.txt 
b/Documentation/devicetree/bindings/clock/exynos5433-clock.txt
index 9a6ae75..03ae40a 100644
--- a/Documentation/devicetree/bindings/clock/exynos5433-clock.txt
+++ b/Documentation/devicetree/bindings/clock/exynos5433-clock.txt
@@ -25,6 +25,9 @@ Required Properties:
 which generates clocks for Display (DECON/HDMI/DSIM/MIXER) IPs.
   - samsung,exynos5433-cmu-aud   - clock controller compatible for CMU_AUD
 which generates clocks for Cortex-A5/BUS/AUDIO clocks.
+  - samsung,exynos5433-cmu-bus0, samsung,exynos5433-cmu-bus1
+and samsung,exynos5433-cmu-bus2 - clock controller compatible for CMU_BUS
+which generates global data buses clock and global peripheral buses clock.
 
 - reg: physical base address of the controller and length of memory mapped
   region.
@@ -94,6 +97,24 @@ Example 1: Examples of clock controller nodes are listed 
below.
#clock-cells = 1;
};
 
+   cmu_bus0: clock-controller@0x1360 {
+   compatible = samsung,exynos5433-cmu-bus0;
+   reg = 0x1360 0x0b04;
+   #clock-cells = 1;
+   };
+
+   cmu_bus1: clock-controller@0x1480 {
+   compatible = samsung,exynos5433-cmu-bus1;
+   reg = 0x1480 0x0b04;
+   #clock-cells = 1;
+   };
+
+   cmu_bus2: clock-controller@0x1340 {
+   compatible = samsung,exynos5433-cmu-bus2;
+   reg = 0x1340 0x0b04;
+   #clock-cells = 1;
+   };
+
 Example 2: UART controller node that consumes the clock generated by the clock
   controller.
 
diff --git a/drivers/clk/samsung/clk-exynos5433.c 
b/drivers/clk/samsung/clk-exynos5433.c
index 99262e0..5b4ec83 100644
--- a/drivers/clk/samsung/clk-exynos5433.c
+++ b/drivers/clk/samsung/clk-exynos5433.c
@@ -425,7 +425,7 @@ static struct samsung_div_clock top_div_clks[] __initdata = 
{
DIV_TOP2, 0, 3),
 
/* DIV_TOP3 */
-   DIV(CLK_DIV_ACLK_IMEM_SSSX, div_aclk_imem_sssx,
+   DIV(CLK_DIV_ACLK_IMEM_SSSX_266, div_aclk_imem_sssx_266,
mout_bus_pll_user, DIV_TOP3, 24, 3),
DIV(CLK_DIV_ACLK_IMEM_200, div_aclk_imem_200,
mout_bus_pll_user, DIV_TOP3, 20, 3),
@@ -440,6 +440,14 @@ static struct samsung_div_clock top_div_clks[] __initdata 
= {
DIV(CLK_DIV_ACLK_PERIS_66_A, div_aclk_peris_66_a,
mout_bus_pll_user, DIV_TOP3, 0, 3),
 
+   /* DIV_TOP4 */
+   DIV(CLK_DIV_ACLK_G3D_400, div_aclk_g3d_400, mout_bus_pll_user,
+   DIV_TOP4, 8, 3),
+   DIV(CLK_DIV_ACLK_BUS0_400, div_aclk_bus0_400, mout_aclk_bus0_400,
+   DIV_TOP4, 4, 3),
+   DIV(CLK_DIV_ACLK_BUS1_400, div_aclk_bus1_400, mout_bus_pll_user,
+   DIV_TOP4, 0, 3),
+
/* DIV_TOP_FSYS0 */
DIV(CLK_DIV_SCLK_MMC1_B, div_sclk_mmc1_b, div_sclk_mmc1_a,
DIV_TOP_FSYS0, 16, 8),
@@ -503,6 +511,19 @@ static struct samsung_div_clock top_div_clks[] __initdata 
= {
 
 static struct samsung_gate_clock top_gate_clks[] __initdata = {
/* ENABLE_ACLK_TOP */
+   GATE(CLK_ACLK_G3D_400, aclk_g3d_400, div_aclk_g3d_400,
+   ENABLE_ACLK_TOP, 30, 0, 0),
+   GATE(CLK_ACLK_IMEM_SSX_266, aclk_imem_ssx_266,
+   div_aclk_imem_sssx_266, ENABLE_ACLK_TOP,
+   29, CLK_IGNORE_UNUSED, 0),
+   GATE(CLK_ACLK_BUS0_400, aclk_bus0_400, div_aclk_bus0_400,
+   ENABLE_ACLK_TOP, 26, CLK_IGNORE_UNUSED, 0),
+   GATE(CLK_ACLK_BUS1_400, aclk_bus1_400, div_aclk_bus1_400,
+   ENABLE_ACLK_TOP, 25, CLK_IGNORE_UNUSED, 0),
+   GATE(CLK_ACLK_IMEM_200, aclk_imem_200, div_aclk_imem_266,
+   ENABLE_ACLK_TOP, 24, CLK_IGNORE_UNUSED, 0),
+   GATE(CLK_ACLK_IMEM_266, aclk_imem_266, div_aclk_imem_200,
+   ENABLE_ACLK_TOP, 23, CLK_IGNORE_UNUSED, 0),
GATE(CLK_ACLK_PERIC_66, aclk_peric_66, div_aclk_peric_66_b,
ENABLE_ACLK_TOP, 22, 

[PATCH 13/19] arm64: exynos5433: Enable ARMv8-based Exynos5433 SoC support

2014-12-02 Thread Chanwoo Choi
This patch adds the necessary Kconfig entries to enable
support for the ARMv8 based Exynos5433 SoC.

Cc: Catalin Marinas catalin.mari...@arm.com
Cc: Will Deacon will.dea...@arm.com
Signed-off-by: Chanwoo Choi cw00.c...@samsung.com
Acked-by: Geunsik Lim geunsik@samsung.com
Acked-by: Inki Dae inki@samsung.com
---
 arch/arm64/Kconfig | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index fa708a0..3fa5d91 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -146,6 +146,16 @@ config ARCH_EXYNOS
help
  This enables support for Samsung Exynos SoC family
 
+config ARCH_EXYNOS5433
+   bool ARMv8 based Samsung Exynos5433
+   select ARCH_EXYNOS
+   select COMMON_CLK_SAMSUNG
+   select PINCTRL
+   select PINCTRL_EXYNOS
+
+   help
+ This enables support for Samsung Exynos5433 SoC family
+
 config ARCH_EXYNOS7
bool ARMv8 based Samsung Exynos7
select ARCH_EXYNOS
-- 
1.8.5.5

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


[PATCH 07/19] clk: samsung: exynos5433: Add clocks for CMU_DISP domain

2014-12-02 Thread Chanwoo Choi
This patch adds the the mux/divider/gate clocks for CMU_DISP domain which
includes the clocks of Display IPs (DECON/HDMI/DSIM/MIXER). The CMU_DISP clocks
is used to need the source clock of CMU_MIF domain so, the CMU_MIF's clocks
related to CMU_DISP should be always on state.

Also, CMU_DISP must need the source clock of 'sclk_hdmi_spdif_disp'
from CMU_TOP domain. This patch adds the clocks of CMU_TOP related to HDMI.

Cc: Sylwester Nawrocki s.nawro...@samsung.com
Cc: Tomasz Figa tomasz.f...@gmail.com
Signed-off-by: Chanwoo Choi cw00.c...@samsung.com
Acked-by: Inki Dae inki@samsung.com
Acked-by: Geunsik Lim geunsik@samsung.com
---
 .../devicetree/bindings/clock/exynos5433-clock.txt |   9 +
 drivers/clk/samsung/clk-exynos5433.c   | 465 -
 include/dt-bindings/clock/exynos5433.h | 114 -
 3 files changed, 577 insertions(+), 11 deletions(-)

diff --git a/Documentation/devicetree/bindings/clock/exynos5433-clock.txt 
b/Documentation/devicetree/bindings/clock/exynos5433-clock.txt
index 27dd77b..8d3dad4 100644
--- a/Documentation/devicetree/bindings/clock/exynos5433-clock.txt
+++ b/Documentation/devicetree/bindings/clock/exynos5433-clock.txt
@@ -21,6 +21,8 @@ Required Properties:
 which generates clocks for USB/UFS/SDMMC/TSI/PDMA IPs.
   - samsung,exynos5433-cmu-g2d   - clock controller compatible for CMU_G2D
 which generates clocks for G2D/MDMA IPs.
+  - samsung,exynos5433-cmu-disp  - clock controller compatible for CMU_DISP
+which generates clocks for Display (DECON/HDMI/DSIM/MIXER) IPs.
 
 - reg: physical base address of the controller and length of memory mapped
   region.
@@ -78,6 +80,13 @@ Example 1: Examples of clock controller nodes are listed 
below.
#clock-cells = 1;
};
 
+   cmu_disp: clock-controller@0x13b9 {
+   compatible = samsung,exynos5433-cmu-disp;
+   reg = 0x13b9 0x0c04;
+   #clock-cells = 1;
+   };
+
+
 Example 2: UART controller node that consumes the clock generated by the clock
   controller.
 
diff --git a/drivers/clk/samsung/clk-exynos5433.c 
b/drivers/clk/samsung/clk-exynos5433.c
index 10197a1..ec23e97 100644
--- a/drivers/clk/samsung/clk-exynos5433.c
+++ b/drivers/clk/samsung/clk-exynos5433.c
@@ -245,6 +245,8 @@ PNAME(mout_sclk_audio1_p)   = { ioclk_audiocdclk1, 
fin_pll,
 PNAME(mout_sclk_audio0_p)  = { ioclk_audiocdclk0, fin_pll,
mout_aud_pll_user_t,};
 
+PNAME(mout_sclk_hdmi_spdif_p)  = { sclk_audio1, ioclk_spdif_extclk, };
+
 static struct samsung_fixed_factor_clock top_fixed_factor_clks[] __initdata = {
FFACTOR(0, sclk_bus_pll, fout_bus_pll, 1, 1, 0),
FFACTOR(0, sclk_mfc_pll, fout_mfc_pll, 1, 1, 0),
@@ -397,6 +399,10 @@ static struct samsung_mux_clock top_mux_clks[] __initdata 
= {
MUX_SEL_TOP_PERIC1, 4, 2),
MUX(CLK_MOUT_SCLK_AUDIO0, mout_sclk_audio0, mout_sclk_audio0_p,
MUX_SEL_TOP_PERIC1, 0, 2),
+
+   /* MUX_SEL_TOP_DISP */
+   MUX(CLK_MOUT_SCLK_HDMI_SPDIF, mout_sclk_hdmi_spdif,
+   mout_sclk_hdmi_spdif_p, MUX_SEL_TOP_DISP, 0, 1),
 };
 
 static struct samsung_div_clock top_div_clks[] __initdata = {
@@ -1256,9 +1262,9 @@ static struct samsung_gate_clock mif_gate_clks[] 
__initdata = {
 
/* ENABLE_ACLK_MIF3 */
GATE(CLK_ACLK_BUS2_400, aclk_bus2_400, div_aclk_bus2_400,
-   ENABLE_ACLK_MIF3, 4, 0, 0),
+   ENABLE_ACLK_MIF3, 4, CLK_IGNORE_UNUSED, 0),
GATE(CLK_ACLK_DISP_333, aclk_disp_333, div_aclk_disp_333,
-   ENABLE_ACLK_MIF3, 1, 0, 0),
+   ENABLE_ACLK_MIF3, 1, CLK_IGNORE_UNUSED, 0),
GATE(CLK_ACLK_CPIF_200, aclk_cpif_200, div_aclk_cpif_200,
ENABLE_ACLK_MIF3, 0, CLK_IGNORE_UNUSED, 0),
 
@@ -1333,21 +1339,30 @@ static struct samsung_gate_clock mif_gate_clks[] 
__initdata = {
 
/* ENABLE_SCLK_MIF */
GATE(CLK_SCLK_DSIM1_DISP, sclk_dsim1_disp, div_sclk_dsim1,
-   ENABLE_SCLK_MIF, 15, 0, 0),
+   ENABLE_SCLK_MIF, 15, CLK_IGNORE_UNUSED, 0),
GATE(CLK_SCLK_DECON_TV_VCLK_DISP, sclk_decon_tv_vclk_disp,
-   div_sclk_decon_tv_vclk, ENABLE_SCLK_MIF, 14, 0, 0),
+   div_sclk_decon_tv_vclk, ENABLE_SCLK_MIF,
+   14, CLK_IGNORE_UNUSED, 0),
GATE(CLK_SCLK_DSIM0_DISP, sclk_dsim0_disp, div_sclk_dsim0,
-   ENABLE_SCLK_MIF, 9, 0, 0),
+   ENABLE_SCLK_MIF, 9, CLK_IGNORE_UNUSED, 0),
GATE(CLK_SCLK_DSD_DISP, sclk_dsd_disp, div_sclk_dsd,
-   ENABLE_SCLK_MIF, 8, 0, 0),
+   ENABLE_SCLK_MIF, 8, CLK_IGNORE_UNUSED, 0),
GATE(CLK_SCLK_DECON_TV_ECLK_DISP, sclk_decon_tv_eclk_disp,
-   div_sclk_decon_tv_eclk, ENABLE_SCLK_MIF, 7, 0, 0),
+   

Re: [PATCH v2 1/2] kvm: x86: revert mask out xsaves

2014-12-02 Thread Paolo Bonzini


On 02/12/2014 07:14, Wanpeng Li wrote:
 xsaves will be exported to guest in the next patch, so revert the
 mask out xsaves patch.
 
 Signed-off-by: Wanpeng Li wanpeng...@linux.intel.com
 ---
  arch/x86/kvm/cpuid.c | 10 +-
  1 file changed, 1 insertion(+), 9 deletions(-)
 
 diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c
 index a4f5ac4..7af07571 100644
 --- a/arch/x86/kvm/cpuid.c
 +++ b/arch/x86/kvm/cpuid.c
 @@ -320,10 +320,6 @@ static inline int __do_cpuid_ent(struct kvm_cpuid_entry2 
 *entry, u32 function,
   F(ADX) | F(SMAP) | F(AVX512F) | F(AVX512PF) | F(AVX512ER) |
   F(AVX512CD);
  
 - /* cpuid 0xD.1.eax */
 - const u32 kvm_supported_word10_x86_features =
 - F(XSAVEOPT) | F(XSAVEC) | F(XGETBV1);

Every single bit needs to be whitelisted independently of the others, so
a full revert is not possible.  We need to be careful about post-Skylake
processors introducing new bits in this cpuid leaf.

Also, you cannot just add F(XSAVES) here; you must only do it if XSAVES
is actually supported.  This makes sure that nested virtualization will
_not_ present XSAVES to the guests until specific support is introduced
for XSAVES and XRSTORS exits (including the XSS exit bitmap).

In order to do this, you have to introduce a new member in kvm_x86_ops,
modeling what was done for MPX.  The second patch can then implement
this new member.

Thanks,

Paolo

   /* all calls to cpuid_count() should be made on the same cpu */
   get_cpu();
  
 @@ -460,8 +456,6 @@ static inline int __do_cpuid_ent(struct kvm_cpuid_entry2 
 *entry, u32 function,
   entry-eax = supported;
   entry-edx = supported  32;
   entry-flags |= KVM_CPUID_FLAG_SIGNIFCANT_INDEX;
 - if (!supported)
 - break;
  
   for (idx = 1, i = 1; idx  64; ++idx) {
   u64 mask = ((u64)1  idx);
 @@ -469,9 +463,7 @@ static inline int __do_cpuid_ent(struct kvm_cpuid_entry2 
 *entry, u32 function,
   goto out;
  
   do_cpuid_1_ent(entry[i], function, idx);
 - if (idx == 1)
 - entry[i].eax = 
 kvm_supported_word10_x86_features;
 - else if (entry[i].eax == 0 || !(supported  mask))
 + if (entry[i].eax == 0 || !(supported  mask))
   continue;
   entry[i].flags |=
  KVM_CPUID_FLAG_SIGNIFCANT_INDEX;
 

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


[PATCH 11/19] clk: samsung: exynos5433: Add clocks for CMU_G3D domain

2014-12-02 Thread Chanwoo Choi
This patch adds the mux/divider/gate clocks for CMU_G3D domain which contains
the clocks for GPU(3D Graphics Engine).

Cc: Sylwester Nawrocki s.nawro...@samsung.com
Cc: Tomasz Figa tomasz.f...@gmail.com
Signed-off-by: Chanwoo Choi cw00.c...@samsung.com
Acked-by: Inki Dae inki@samsung.com
Acked-by: Geunsik Lim geunsik@samsung.com
---
 .../devicetree/bindings/clock/exynos5433-clock.txt |   8 ++
 drivers/clk/samsung/clk-exynos5433.c   | 127 +
 include/dt-bindings/clock/exynos5433.h |  25 
 3 files changed, 160 insertions(+)

diff --git a/Documentation/devicetree/bindings/clock/exynos5433-clock.txt 
b/Documentation/devicetree/bindings/clock/exynos5433-clock.txt
index 03ae40a..589ed93 100644
--- a/Documentation/devicetree/bindings/clock/exynos5433-clock.txt
+++ b/Documentation/devicetree/bindings/clock/exynos5433-clock.txt
@@ -28,6 +28,8 @@ Required Properties:
   - samsung,exynos5433-cmu-bus0, samsung,exynos5433-cmu-bus1
 and samsung,exynos5433-cmu-bus2 - clock controller compatible for CMU_BUS
 which generates global data buses clock and global peripheral buses clock.
+  - samsung,exynos5433-cmu-g3d  - clock controller compatible for CMU_G3D
+which generates clocks for 3D Graphics Engine IP.
 
 - reg: physical base address of the controller and length of memory mapped
   region.
@@ -115,6 +117,12 @@ Example 1: Examples of clock controller nodes are listed 
below.
#clock-cells = 1;
};
 
+   cmu_g3d: clock-controller@0x14aa {
+   compatible = samsung,exynos5433-cmu-g3d;
+   reg = 0x14aa 0x1000;
+   #clock-cells = 1;
+   };
+
 Example 2: UART controller node that consumes the clock generated by the clock
   controller.
 
diff --git a/drivers/clk/samsung/clk-exynos5433.c 
b/drivers/clk/samsung/clk-exynos5433.c
index e2b7ea6..a7f5feb 100644
--- a/drivers/clk/samsung/clk-exynos5433.c
+++ b/drivers/clk/samsung/clk-exynos5433.c
@@ -3096,3 +3096,130 @@ CLK_OF_DECLARE(exynos5433_cmu_bus##id,  
\
 exynos5433_cmu_bus_init(0);
 exynos5433_cmu_bus_init(1);
 exynos5433_cmu_bus_init(2);
+
+/*
+ * Register offset definitions for CMU_G3D
+ */
+#define G3D_PLL_LOCK   0x
+#define G3D_PLL_CON0   0x0100
+#define G3D_PLL_CON1   0x0104
+#define G3D_PLL_FREQ_DET   0x010c
+#define MUX_SEL_G3D0x0200
+#define MUX_ENABLE_G3D 0x0300
+#define MUX_STAT_G3D   0x0400
+#define DIV_G3D0x0600
+#define DIV_G3D_PLL_FREQ_DET   0x0604
+#define DIV_STAT_G3D   0x0700
+#define DIV_STAT_G3D_PLL_FREQ_DET  0x0704
+#define ENABLE_ACLK_G3D0x0800
+#define ENABLE_PCLK_G3D0x0900
+#define ENABLE_SCLK_G3D0x0a00
+#define ENABLE_IP_G3D0 0x0b00
+#define ENABLE_IP_G3D1 0x0b04
+#define CLKOUT_CMU_G3D 0x0c00
+#define CLKOUT_CMU_G3D_DIV_STAT0x0c04
+#define CLK_STOPCTRL   0x1000
+
+static unsigned long g3d_clk_regs[] __initdata = {
+   G3D_PLL_LOCK,
+   G3D_PLL_CON0,
+   G3D_PLL_CON1,
+   G3D_PLL_FREQ_DET,
+   MUX_SEL_G3D,
+   MUX_ENABLE_G3D,
+   MUX_STAT_G3D,
+   DIV_G3D,
+   DIV_G3D_PLL_FREQ_DET,
+   DIV_STAT_G3D,
+   DIV_STAT_G3D_PLL_FREQ_DET,
+   ENABLE_ACLK_G3D,
+   ENABLE_PCLK_G3D,
+   ENABLE_SCLK_G3D,
+   ENABLE_IP_G3D0,
+   ENABLE_IP_G3D1,
+   CLKOUT_CMU_G3D,
+   CLKOUT_CMU_G3D_DIV_STAT,
+   CLK_STOPCTRL,
+};
+
+/* list of all parent clock list */
+PNAME(mout_aclk_g3d_400_p) = { mout_g3d_pll, aclk_g3d_400, };
+PNAME(mout_g3d_pll_p)  = { fin_pll, fout_g3d_pll, };
+
+static struct samsung_pll_clock g3d_pll_clks[] __initdata = {
+   PLL(pll_35xx, CLK_FOUT_G3D_PLL, fout_g3d_pll, fin_pll,
+   G3D_PLL_LOCK, G3D_PLL_CON0, exynos5443_pll_rates),
+};
+
+static struct samsung_mux_clock g3d_mux_clks[] __initdata = {
+   /* MUX_SEL_G3D */
+   MUX(CLK_MOUT_ACLK_G3D_400, mout_aclk_g3d_400, mout_aclk_g3d_400_p,
+   MUX_SEL_G3D, 8, 1),
+   MUX(CLK_MOUT_G3D_PLL, mout_g3d_pll, mout_g3d_pll_p,
+   MUX_SEL_G3D, 0, 1),
+};
+
+static struct samsung_div_clock g3d_div_clks[] __initdata = {
+   /* DIV_G3D */
+   DIV(CLK_DIV_SCLK_HPM_G3D, div_sclk_hpm_g3d, mout_g3d_pll, DIV_G3D,
+   8, 2),
+   DIV(CLK_DIV_PCLK_G3D, div_pclk_g3d, div_aclk_g3d, DIV_G3D,
+   4, 3),
+   DIV(CLK_DIV_ACLK_G3D, div_aclk_g3d, mout_aclk_g3d_400, DIV_G3D,
+   0, 3),
+};
+
+static struct samsung_gate_clock g3d_gate_clks[] __initdata = {
+   /* ENABLE_ACLK_G3D */
+   GATE(CLK_ACLK_BTS_G3D1, aclk_bts_g3d1, div_aclk_g3d,
+   ENABLE_ACLK_G3D, 7, 0, 0),
+   

[PATCH 05/19] clk: samsung: exynos5433: Add clocks for CMU_G2D domain

2014-12-02 Thread Chanwoo Choi
This patch adds ths mux/divider/gate clocksof CMU_G2D domain which includes
G2D/MDMA IPs. The CMU_G2D must need the clocks related to G2D by providing
CMU_TOP domain. So, this patch add several clocks for G2D from CMU_TOP domain.

Cc: Sylwester Nawrocki s.nawro...@samsung.com
Cc: Tomasz Figa tomasz.f...@gmail.com
Signed-off-by: Chanwoo Choi cw00.c...@samsung.com
Acked-by: Inki Dae inki@samsung.com
Acked-by: Geunsik Lim geunsik@samsung.com
---
 .../devicetree/bindings/clock/exynos5433-clock.txt |   8 ++
 drivers/clk/samsung/clk-exynos5433.c   | 144 +
 include/dt-bindings/clock/exynos5433.h |  42 +-
 3 files changed, 193 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/clock/exynos5433-clock.txt 
b/Documentation/devicetree/bindings/clock/exynos5433-clock.txt
index 72cd0ba..27dd77b 100644
--- a/Documentation/devicetree/bindings/clock/exynos5433-clock.txt
+++ b/Documentation/devicetree/bindings/clock/exynos5433-clock.txt
@@ -19,6 +19,8 @@ Required Properties:
 which generates clocks for PMU/TMU/MCT/WDT/RTC/SECKEY/TZPC IPs.
   - samsung,exynos5433-cmu-fsys  - clock controller compatible for CMU_FSYS
 which generates clocks for USB/UFS/SDMMC/TSI/PDMA IPs.
+  - samsung,exynos5433-cmu-g2d   - clock controller compatible for CMU_G2D
+which generates clocks for G2D/MDMA IPs.
 
 - reg: physical base address of the controller and length of memory mapped
   region.
@@ -70,6 +72,12 @@ Example 1: Examples of clock controller nodes are listed 
below.
#clock-cells = 1;
};
 
+   cmu_g2d: clock-controller@0x1246 {
+   compatible = samsung,exynos5433-cmu-g2d;
+   reg = 0x1246 0x0b08;
+   #clock-cells = 1;
+   };
+
 Example 2: UART controller node that consumes the clock generated by the clock
   controller.
 
diff --git a/drivers/clk/samsung/clk-exynos5433.c 
b/drivers/clk/samsung/clk-exynos5433.c
index 7e4612f..4dec9fc 100644
--- a/drivers/clk/samsung/clk-exynos5433.c
+++ b/drivers/clk/samsung/clk-exynos5433.c
@@ -400,6 +400,20 @@ static struct samsung_mux_clock top_mux_clks[] __initdata 
= {
 };
 
 static struct samsung_div_clock top_div_clks[] __initdata = {
+   /* DIV_TOP1 */
+   DIV(CLK_DIV_ACLK_GSCL_111, div_aclk_gscl_111, mout_aclk_gscl_333,
+   DIV_TOP1, 28, 3),
+   DIV(CLK_DIV_ACLK_GSCL_333, div_aclk_gscl_333, mout_aclk_gscl_333,
+   DIV_TOP1, 24, 3),
+   DIV(CLK_DIV_ACLK_HEVC_400, div_aclk_hevc_400, mout_aclk_hevc_400,
+   DIV_TOP1, 20, 3),
+   DIV(CLK_DIV_ACLK_MFC_400, div_aclk_mfc_400, mout_aclk_mfc_400_c,
+   DIV_TOP1, 12, 3),
+   DIV(CLK_DIV_ACLK_G2D_266, div_aclk_g2d_266, mout_bus_pll_user,
+   DIV_TOP1, 8, 3),
+   DIV(CLK_DIV_ACLK_G2D_400, div_aclk_g2d_400, mout_aclk_g2d_400_b,
+   DIV_TOP1, 0, 3),
+
/* DIV_TOP2 */
DIV(CLK_DIV_ACLK_FSYS_200, div_aclk_fsys_200, mout_bus_pll_user,
DIV_TOP2, 0, 3),
@@ -489,6 +503,10 @@ static struct samsung_gate_clock top_gate_clks[] 
__initdata = {
ENABLE_ACLK_TOP, 21, CLK_IGNORE_UNUSED, 0),
GATE(CLK_ACLK_FSYS_200, aclk_fsys_200, div_aclk_fsys_200,
ENABLE_ACLK_TOP, 18, CLK_IGNORE_UNUSED, 0),
+   GATE(CLK_ACLK_G2D_266, aclk_g2d_266, div_aclk_g2d_266,
+   ENABLE_ACLK_TOP, 2, CLK_IGNORE_UNUSED, 0),
+   GATE(CLK_ACLK_G2D_400, aclk_g2d_400, div_aclk_g2d_400,
+   ENABLE_ACLK_TOP, 0, CLK_IGNORE_UNUSED, 0),
 
/* ENABLE_SCLK_TOP_FSYS */
GATE(CLK_SCLK_MMC2_FSYS, sclk_mmc2_fsys, div_sclk_mmc2_b,
@@ -1275,3 +1293,129 @@ static void __init exynos5433_cmu_fsys_init(struct 
device_node *np)
 
 CLK_OF_DECLARE(exynos5433_cmu_fsys, samsung,exynos5433-cmu-fsys,
exynos5433_cmu_fsys_init);
+
+/*
+ * Register offset definitions for CMU_G2D
+ */
+#define MUX_SEL_G2D0   0x0200
+#define MUX_SEL_ENABLE_G2D00x0300
+#define MUX_SEL_STAT_G2D0  0x0400
+#define DIV_G2D0x0600
+#define DIV_STAT_G2D   0x0700
+#define DIV_ENABLE_ACLK_G2D0x0800
+#define DIV_ENABLE_ACLK_G2D_SECURE_SMMU_G2D0x0804
+#define DIV_ENABLE_PCLK_G2D0x0900
+#define DIV_ENABLE_PCLK_G2D_SECURE_SMMU_G2D0x0904
+#define DIV_ENABLE_IP_G2D0 0x0b00
+#define DIV_ENABLE_IP_G2D1 0x0b04
+#define DIV_ENABLE_IP_G2D_SECURE_SMMU_G2D  0x0b08
+
+static unsigned long g2d_clk_regs[] __initdata = {
+   MUX_SEL_G2D0,
+   MUX_SEL_ENABLE_G2D0,
+   MUX_SEL_STAT_G2D0,
+   DIV_G2D,
+   DIV_STAT_G2D,
+   DIV_ENABLE_ACLK_G2D,
+   DIV_ENABLE_ACLK_G2D_SECURE_SMMU_G2D,
+   DIV_ENABLE_PCLK_G2D,
+   

[PATCH 06/19] clk: samsung: exynos5433: Add clocks for CMU_MIF domain

2014-12-02 Thread Chanwoo Choi
This patch adds the mux/divider/gate clock fo CMU_MIF domain which includes
the clocks for DMC(DRAM memory controller) and CCI(Cache Coherent Interconnect).
The CMU_MIF domain provides the source clocks for CMU_DISP/CMU_BUS2.

Cc: Sylwester Nawrocki s.nawro...@samsung.com
Cc: Tomasz Figa tomasz.f...@gmail.com
Signed-off-by: Chanwoo Choi cw00.c...@samsung.com
Acked-by: Inki Dae inki@samsung.com
Acked-by: Geunsik Lim geunsik@samsung.com
---
 drivers/clk/samsung/clk-exynos5433.c   | 590 +
 include/dt-bindings/clock/exynos5433.h | 190 ++-
 2 files changed, 779 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/samsung/clk-exynos5433.c 
b/drivers/clk/samsung/clk-exynos5433.c
index 4dec9fc..10197a1 100644
--- a/drivers/clk/samsung/clk-exynos5433.c
+++ b/drivers/clk/samsung/clk-exynos5433.c
@@ -737,6 +737,66 @@ CLK_OF_DECLARE(exynos5433_cmu_cpif, 
samsung,exynos5433-cmu-cpif,
 #define MFC_PLL_CON0   0x0130
 #define MFC_PLL_CON1   0x0134
 #define MFC_PLL_FREQ_DET   0x013c
+#define MUX_SEL_MIF0   0x0200
+#define MUX_SEL_MIF1   0x0204
+#define MUX_SEL_MIF2   0x0208
+#define MUX_SEL_MIF3   0x020c
+#define MUX_SEL_MIF4   0x0210
+#define MUX_SEL_MIF5   0x0214
+#define MUX_SEL_MIF6   0x0218
+#define MUX_SEL_MIF7   0x021c
+#define MUX_ENABLE_MIF00x0300
+#define MUX_ENABLE_MIF10x0304
+#define MUX_ENABLE_MIF20x0308
+#define MUX_ENABLE_MIF30x030c
+#define MUX_ENABLE_MIF40x0310
+#define MUX_ENABLE_MIF50x0314
+#define MUX_ENABLE_MIF60x0318
+#define MUX_ENABLE_MIF70x031c
+#define MUX_STAT_MIF0  0x0400
+#define MUX_STAT_MIF1  0x0404
+#define MUX_STAT_MIF2  0x0408
+#define MUX_STAT_MIF3  0x040c
+#define MUX_STAT_MIF4  0x0410
+#define MUX_STAT_MIF5  0x0414
+#define MUX_STAT_MIF6  0x0418
+#define MUX_STAT_MIF7  0x041c
+#define DIV_MIF1   0x0604
+#define DIV_MIF2   0x0608
+#define DIV_MIF3   0x060c
+#define DIV_MIF4   0x0610
+#define DIV_MIF5   0x0614
+#define DIV_MIF_PLL_FREQ_DET   0x0618
+#define DIV_STAT_MIF1  0x0704
+#define DIV_STAT_MIF2  0x0708
+#define DIV_STAT_MIF3  0x070c
+#define DIV_STAT_MIF4  0x0710
+#define DIV_STAT_MIF5  0x0714
+#define DIV_STAT_MIF_PLL_FREQ_DET  0x0718
+#define ENABLE_ACLK_MIF0   0x0800
+#define ENABLE_ACLK_MIF1   0x0804
+#define ENABLE_ACLK_MIF2   0x0808
+#define ENABLE_ACLK_MIF3   0x080c
+#define ENABLE_PCLK_MIF0x0900
+#define ENABLE_PCLK_MIF_SECURE_DREX0_TZ0x0904
+#define ENABLE_PCLK_MIF_SECURE_DREX1_TZ0x0908
+#define ENABLE_PCLK_MIF_SECURE_MONOTONIC_CNT   0x090c
+#define ENABLE_PCLK_MIF_SECURE_RTC 0x0910
+#define ENABLE_SCLK_MIF0x0a00
+#define ENABLE_IP_MIF0 0x0b00
+#define ENABLE_IP_MIF1 0x0b04
+#define ENABLE_IP_MIF2 0x0b08
+#define ENABLE_IP_MIF3 0x0b0c
+#define ENABLE_IP_MIF_SECURE_DREX0_TZ  0x0b10
+#define ENABLE_IP_MIF_SECURE_DREX1_TZ  0x0b14
+#define ENABLE_IP_MIF_SECURE_MONOTONIC_CNT 0x0b18
+#define ENABLE_IP_MIF_SECURE_RTC   0x0b1c
+#define CLKOUT_CMU_MIF 0x0c00
+#define CLKOUT_CMU_MIF_DIV_STAT0x0c04
+#define DREX_FREQ_CTRL00x1000
+#define DREX_FREQ_CTRL10x1004
+#define PAUSE  0x1008
+#define DDRPHY_LOCK_CTRL   0x100c
 
 static unsigned long mif_clk_regs[] __initdata = {
MEM0_PLL_LOCK,
@@ -755,6 +815,66 @@ static unsigned long mif_clk_regs[] __initdata = {
MFC_PLL_CON0,
MFC_PLL_CON1,
MFC_PLL_FREQ_DET,
+   MUX_SEL_MIF0,
+   MUX_SEL_MIF1,
+   MUX_SEL_MIF2,
+   MUX_SEL_MIF3,
+   MUX_SEL_MIF4,
+   MUX_SEL_MIF5,
+   MUX_SEL_MIF6,
+   MUX_SEL_MIF7,
+   MUX_ENABLE_MIF0,
+   MUX_ENABLE_MIF1,
+   MUX_ENABLE_MIF2,
+   MUX_ENABLE_MIF3,
+   MUX_ENABLE_MIF4,
+   MUX_ENABLE_MIF5,
+   MUX_ENABLE_MIF6,
+   MUX_ENABLE_MIF7,
+   MUX_STAT_MIF0,
+   MUX_STAT_MIF1,
+   MUX_STAT_MIF2,
+   MUX_STAT_MIF3,
+   MUX_STAT_MIF4,
+   MUX_STAT_MIF5,
+   MUX_STAT_MIF6,
+   MUX_STAT_MIF7,
+   DIV_MIF1,
+   DIV_MIF2,
+   DIV_MIF3,
+   DIV_MIF4,
+   DIV_MIF5,
+   DIV_MIF_PLL_FREQ_DET,
+   DIV_STAT_MIF1,
+   DIV_STAT_MIF2,
+   DIV_STAT_MIF3,

[PATCH 10/19] clk: samsung: exynos5433: Add missing clocks for CMU_FSYS domain

2014-12-02 Thread Chanwoo Choi
This patch adds the mux/divider/gate clocks for CMU_FSYS domain which
contains the clocks of USB/UFS/SDMMC/TSI/PDMA IPs.

Cc: Sylwester Nawrocki s.nawro...@samsung.com
Cc: Tomasz Figa tomasz.f...@gmail.com
Signed-off-by: Chanwoo Choi cw00.c...@samsung.com
Acked-by: Inki Dae inki@samsung.com
Acked-by: Geunsik Lim geunsik@samsung.com
---
 drivers/clk/samsung/clk-exynos5433.c   | 286 +
 include/dt-bindings/clock/exynos5433.h |  82 +-
 2 files changed, 365 insertions(+), 3 deletions(-)

diff --git a/drivers/clk/samsung/clk-exynos5433.c 
b/drivers/clk/samsung/clk-exynos5433.c
index 5b4ec83..e2b7ea6 100644
--- a/drivers/clk/samsung/clk-exynos5433.c
+++ b/drivers/clk/samsung/clk-exynos5433.c
@@ -464,6 +464,16 @@ static struct samsung_div_clock top_div_clks[] __initdata 
= {
DIV(CLK_DIV_SCLK_MMC2_A, div_sclk_mmc2_a, mout_sclk_mmc2_b,
DIV_TOP_FSYS1, 0, 4),
 
+   /* DIV_TOP_FSYS2 */
+   DIV(CLK_DIV_SCLK_PCIE_100, div_sclk_pcie_100, mout_sclk_pcie_100,
+   DIV_TOP_FSYS2, 12, 3),
+   DIV(CLK_DIV_SCLK_USBHOST30, div_sclk_usbhost30,
+   mout_sclk_usbhost30, DIV_TOP_FSYS2, 8, 4),
+   DIV(CLK_DIV_SCLK_UFSUNIPRO, div_sclk_ufsunipro,
+   mout_sclk_ufsunipro, DIV_TOP_FSYS2, 4, 4),
+   DIV(CLK_DIV_SCLK_USBDRD30, div_sclk_usbdrd30, mout_sclk_usbdrd30,
+   DIV_TOP_FSYS2, 0, 4),
+
/* DIV_TOP_PERIC0 */
DIV(CLK_DIV_SCLK_SPI1_B, div_sclk_spi1_b, div_sclk_spi1_a,
DIV_TOP_PERIC0, 16, 8),
@@ -536,12 +546,20 @@ static struct samsung_gate_clock top_gate_clks[] 
__initdata = {
ENABLE_ACLK_TOP, 0, CLK_IGNORE_UNUSED, 0),
 
/* ENABLE_SCLK_TOP_FSYS */
+   GATE(CLK_SCLK_PCIE_100_FSYS, sclk_pcie_100_fsys, div_sclk_pcie_100,
+   ENABLE_SCLK_TOP_FSYS, 7, 0, 0),
GATE(CLK_SCLK_MMC2_FSYS, sclk_mmc2_fsys, div_sclk_mmc2_b,
ENABLE_SCLK_TOP_FSYS, 6, 0, 0),
GATE(CLK_SCLK_MMC1_FSYS, sclk_mmc1_fsys, div_sclk_mmc1_b,
ENABLE_SCLK_TOP_FSYS, 5, 0, 0),
GATE(CLK_SCLK_MMC0_FSYS, sclk_mmc0_fsys, div_sclk_mmc0_b,
ENABLE_SCLK_TOP_FSYS, 4, 0, 0),
+   GATE(CLK_SCLK_UFSUNIPRO_FSYS, sclk_ufsunipro_fsys,
+   div_sclk_ufsunipro, ENABLE_SCLK_TOP_FSYS, 7, 0, 0),
+   GATE(CLK_SCLK_USBHOST30_FSYS, sclk_usbhost30_fsys,
+   div_sclk_usbhost30, ENABLE_SCLK_TOP_FSYS, 7, 0, 0),
+   GATE(CLK_SCLK_USBDRD30_FSYS, sclk_usbdrd30_fsys,
+   div_sclk_usbdrd30, ENABLE_SCLK_TOP_FSYS, 7, 0, 0),
 
/* ENABLE_SCLK_TOP_PERIC */
GATE(CLK_SCLK_SPI4_PERIC, sclk_spi4_peric, div_sclk_spi4_b,
@@ -1819,10 +1837,45 @@ CLK_OF_DECLARE(exynos5433_cmu_peris, 
samsung,exynos5433-cmu-peris,
 #define ENABLE_IP_FSYS10x0b04
 
 /* list of all parent clock list */
+PNAME(mout_sclk_ufs_mphy_user_p)   = { fin_pll, sclk_ufs_mphy, };
 PNAME(mout_aclk_fsys_200_user_p)   = { fin_pll, aclk_fsys_200, };
+PNAME(mout_sclk_pcie_100_user_p)   = { fin_pll, sclk_ufsunipro_fsys,};
+PNAME(mout_sclk_ufsunipro_user_p)  = { fin_pll, sclk_ufsunipro_fsys,};
 PNAME(mout_sclk_mmc2_user_p)   = { fin_pll, sclk_mmc2_fsys, };
 PNAME(mout_sclk_mmc1_user_p)   = { fin_pll, sclk_mmc1_fsys, };
 PNAME(mout_sclk_mmc0_user_p)   = { fin_pll, sclk_mmc0_fsys, };
+PNAME(mout_sclk_usbhost30_user_p)  = { fin_pll, sclk_usbhost30_fsys,};
+PNAME(mout_sclk_usbdrd30_user_p)   = { fin_pll, sclk_usbdrd30_fsys, };
+
+PNAME(mout_phyclk_usbhost30_uhost30_pipe_pclk_user_p)
+   = { fin_pll, phyclk_usbhost30_uhost30_pipe_pclk_phy, };
+PNAME(mout_phyclk_usbhost30_uhost30_phyclock_user_p)
+   = { fin_pll, phyclk_usbhost30_uhost30_phyclock_phy, };
+PNAME(mout_phyclk_usbhost20_phy_hsic1_p)
+   = { fin_pll, phyclk_usbhost20_phy_hsic1_phy, };
+PNAME(mout_phyclk_usbhost20_phy_clk48mohci_user_p)
+   = { fin_pll, phyclk_usbhost20_phy_clk48mohci_phy, };
+PNAME(mout_phyclk_usbhost20_phy_phyclock_user_p)
+   = { fin_pll, phyclk_usbhost20_phy_phyclock_phy, };
+PNAME(mout_phyclk_usbhost20_phy_freeclk_user_p)
+   = { fin_pll, phyclk_usbhost20_phy_freeclk_phy, };
+PNAME(mout_phyclk_usbdrd30_udrd30_pipe_pclk_p)
+   = { fin_pll, phyclk_usbhost30_uhost30_pipe_pclk_phy, };
+PNAME(mout_phyclk_usbdrd30_udrd30_phyclock_user_p)
+   = { fin_pll, phyclk_usbhost30_uhost30_phyclock_phy, };
+PNAME(mout_phyclk_ufs_rx1_symbol_user_p)
+   = { fin_pll, phyclk_ufs_rx1_symbol_phy, };
+PNAME(mout_phyclk_ufs_rx0_symbol_user_p)
+   = { fin_pll, phyclk_ufs_rx0_symbol_phy, };
+PNAME(mout_phyclk_ufs_tx1_symbol_user_p)
+   = { fin_pll, phyclk_ufs_tx1_symbol_phy, };
+PNAME(mout_phyclk_ufs_tx0_symbol_user_p)
+   = { fin_pll, 

Re: [patch 2/3] mm: memory: remove -vm_file check on shared writable vmas

2014-12-02 Thread Jan Kara
On Mon 01-12-14 17:58:01, Johannes Weiner wrote:
 The only way a VMA can have shared and writable semantics is with a
 backing file.
  OK, one always learns :) After some digging I found that MAP_SHARED |
MAP_ANONYMOUS mappings are in fact mappings of a temporary file in tmpfs.
It would be worth to mention this in the changelog I believe. Otherwise
feel free to add:
  Reviewed-by: Jan Kara j...@suse.cz

Honza
 
 Signed-off-by: Johannes Weiner han...@cmpxchg.org
 ---
  mm/memory.c | 7 ++-
  1 file changed, 2 insertions(+), 5 deletions(-)
 
 diff --git a/mm/memory.c b/mm/memory.c
 index 73220eb6e9e3..2a2e3648ed65 100644
 --- a/mm/memory.c
 +++ b/mm/memory.c
 @@ -2167,9 +2167,7 @@ reuse:
   balance_dirty_pages_ratelimited(mapping);
   }
  
 - /* file_update_time outside page_lock */
 - if (vma-vm_file)
 - file_update_time(vma-vm_file);
 + file_update_time(vma-vm_file);
   }
   put_page(dirty_page);
   if (page_mkwrite) {
 @@ -3025,8 +3023,7 @@ static int do_shared_fault(struct mm_struct *mm, struct 
 vm_area_struct *vma,
   balance_dirty_pages_ratelimited(mapping);
   }
  
 - /* file_update_time outside page_lock */
 - if (vma-vm_file  !vma-vm_ops-page_mkwrite)
 + if (!vma-vm_ops-page_mkwrite)
   file_update_time(vma-vm_file);
  
   return ret;
 -- 
 2.1.3
 
-- 
Jan Kara j...@suse.cz
SUSE Labs, CR
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2 2/2] kvm: vmx: enable intel xsaves for guest

2014-12-02 Thread Wanpeng Li
Hi Paolo,
On Tue, Dec 02, 2014 at 09:51:22AM +0100, Paolo Bonzini wrote:


On 02/12/2014 07:14, Wanpeng Li wrote:
 Expose intel xsaves feature to guest.
 
 Signed-off-by: Wanpeng Li wanpeng...@linux.intel.com
 ---
 v1 - v2:
  *auto switch msr ia32_xss if this msr is present
 
  arch/x86/include/asm/kvm_host.h |  1 +
  arch/x86/include/asm/vmx.h  |  3 +++
  arch/x86/include/uapi/asm/vmx.h |  6 +-
  arch/x86/kvm/vmx.c  | 35 ++-
  4 files changed, 43 insertions(+), 2 deletions(-)
 
 diff --git a/arch/x86/include/asm/kvm_host.h 
 b/arch/x86/include/asm/kvm_host.h
 index 2896dbc..95dde42 100644
 --- a/arch/x86/include/asm/kvm_host.h
 +++ b/arch/x86/include/asm/kvm_host.h
 @@ -362,6 +362,7 @@ struct kvm_vcpu_arch {
  int mp_state;
  u64 ia32_misc_enable_msr;
  bool tpr_access_reporting;
 +u64 ia32_xss;

The patch is not getting/setting ia32_xss when the guest does
RDMSR/WRMSR.  You also need a QEMU patch to migrate XSS.

Will do.


  /*
   * Paging state of the vcpu
 diff --git a/arch/x86/include/asm/vmx.h b/arch/x86/include/asm/vmx.h
 index bcbfade..bdb79ef 100644
 --- a/arch/x86/include/asm/vmx.h
 +++ b/arch/x86/include/asm/vmx.h
 @@ -69,6 +69,7 @@
  #define SECONDARY_EXEC_PAUSE_LOOP_EXITING   0x0400
  #define SECONDARY_EXEC_ENABLE_INVPCID   0x1000
  #define SECONDARY_EXEC_SHADOW_VMCS  0x4000
 +#define SECONDARY_EXEC_XSAVES   0x0010
  
  
  #define PIN_BASED_EXT_INTR_MASK 0x0001
 @@ -159,6 +160,8 @@ enum vmcs_field {
  EOI_EXIT_BITMAP3_HIGH   = 0x2023,
  VMREAD_BITMAP   = 0x2026,
  VMWRITE_BITMAP  = 0x2028,
 +XSS_EXIT_BIMTAP = 0x202C,
 +XSS_EXIT_BIMTAP_HIGH= 0x202D,

s/BIMTAP/BITMAP/

Ok.


  GUEST_PHYSICAL_ADDRESS  = 0x2400,
  GUEST_PHYSICAL_ADDRESS_HIGH = 0x2401,
  VMCS_LINK_POINTER   = 0x2800,
 diff --git a/arch/x86/include/uapi/asm/vmx.h 
 b/arch/x86/include/uapi/asm/vmx.h
 index 990a2fe..b813bf9 100644
 --- a/arch/x86/include/uapi/asm/vmx.h
 +++ b/arch/x86/include/uapi/asm/vmx.h
 @@ -72,6 +72,8 @@
  #define EXIT_REASON_XSETBV  55
  #define EXIT_REASON_APIC_WRITE  56
  #define EXIT_REASON_INVPCID 58
 +#define EXIT_REASON_XSAVES  63
 +#define EXIT_REASON_XRSTORS 64
  
  #define VMX_EXIT_REASONS \
  { EXIT_REASON_EXCEPTION_NMI, EXCEPTION_NMI }, \
 @@ -116,6 +118,8 @@
  { EXIT_REASON_INVALID_STATE, INVALID_STATE }, \
  { EXIT_REASON_INVD,  INVD }, \
  { EXIT_REASON_INVVPID,   INVVPID }, \
 -{ EXIT_REASON_INVPCID,   INVPCID }
 +{ EXIT_REASON_INVPCID,   INVPCID }, \
 +{ EXIT_REASON_XSAVES,XSAVES }, \
 +{ EXIT_REASON_XRSTORS,   XRSTORS }
  
  #endif /* _UAPIVMX_H */
 diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
 index 6a951d8..b87b5b8 100644
 --- a/arch/x86/kvm/vmx.c
 +++ b/arch/x86/kvm/vmx.c
 @@ -1045,6 +1045,12 @@ static inline bool cpu_has_vmx_invpcid(void)
  SECONDARY_EXEC_ENABLE_INVPCID;
  }
  
 +static inline bool cpu_has_xss_exit_bitmap(void)
 +{
 +return vmcs_config.cpu_based_2nd_exec_ctrl 
 +SECONDARY_EXEC_XSAVES;
 +}
 +
  static inline bool cpu_has_virtual_nmis(void)
  {
  return vmcs_config.pin_based_exec_ctrl  PIN_BASED_VIRTUAL_NMIS;
 @@ -1773,6 +1779,14 @@ static void vmx_save_host_state(struct kvm_vcpu *vcpu)
  kvm_set_shared_msr(vmx-guest_msrs[i].index,
 vmx-guest_msrs[i].data,
 vmx-guest_msrs[i].mask);
 +
 +if (cpu_has_xsaves) {
 +u64 host_xss;
 +
 +rdmsrl(MSR_IA32_XSS, host_xss);

Is this host value fixed?  If so, please load it just once in
setup_vmcs_config.

Will do.


 +add_atomic_switch_msr(vmx, MSR_IA32_XSS,
 +vcpu-arch.ia32_xss, host_xss);

Also, if host_xss is fixed you can do this add_atomic_switch_msr at
WRMSR time rather than here, and only if vcpu-arch.ia32_xss !=
host_xss.  If the two XSS values match, do clear_atomic_switch_msr instead.

Agreed.


 +}
  }
  
  static void __vmx_load_host_state(struct vcpu_vmx *vmx)
 @@ -2895,7 +2909,8 @@ static __init int setup_vmcs_config(struct vmcs_config 
 *vmcs_conf)
  SECONDARY_EXEC_ENABLE_INVPCID |
  SECONDARY_EXEC_APIC_REGISTER_VIRT |
  SECONDARY_EXEC_VIRTUAL_INTR_DELIVERY |
 -SECONDARY_EXEC_SHADOW_VMCS;
 +SECONDARY_EXEC_SHADOW_VMCS |
 +SECONDARY_EXEC_XSAVES;
  if (adjust_vmx_controls(min2, opt2,
  MSR_IA32_VMX_PROCBASED_CTLS2,
  _cpu_based_2nd_exec_control)  0)
 @@ 

Re: oom coredump

2014-12-02 Thread Michal Hocko
On Thu 27-11-14 18:47:47, Oleg Nesterov wrote:
 On 11/27, Michal Hocko wrote:
[...]
  Why is the ptrace check wrong?
 
 It was added in reply to exploit I sent. But:
 
 - It doesn't (and can't) really work, it can only detect this particular
   case and the same exploit still blocks oom-killer with the minimal
   modifications.
 
 - Once again, this has nothing to do with ptrace. That exploit used
   ptrace only to control (freeze) the coredumping process, the coredumping
   can hang because of other reasons.
 
 - It is no longer needed after this patch, the coredumping process will
   be killed.

OK, I guess I am seeing it now. Thanks for the clarification!

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


[patch] CodingStyle: add some more error handling guidelines

2014-12-02 Thread Dan Carpenter
I added a paragraph on choosing label names, and updated the example
code to use a better label name.  I also cleaned up the example code to
more modern style by moving the allocation out of the initializer and
changing the NULL check.

Perhaps the most common type of error handling bug in the kernel is one
err bugs.  CodingStyle already says that we should avoid nesting by
using error labels and one err style error handling tends to have
multiple indent levels, so this was already bad style.  But I've added a
new paragraph explaining how to avoid one err bugs by using multiple
error labels which is, hopefully, more clear.

Signed-off-by: Dan Carpenter dan.carpen...@oracle.com

diff --git a/Documentation/CodingStyle b/Documentation/CodingStyle
index 9f28b14..9c8a234 100644
--- a/Documentation/CodingStyle
+++ b/Documentation/CodingStyle
@@ -392,7 +392,12 @@ The goto statement comes in handy when a function exits 
from multiple
 locations and some common work such as cleanup has to be done.  If there is no
 cleanup needed then just return directly.
 
-The rationale is:
+Choose label names which say what the goto does or why the goto exists.  An
+example of a good name could be out_buffer: if the goto frees buffer.  
Avoid
+using GW-BASIC names like err1: and err2:.  Also don't name them after the
+goto location like err_kmalloc_failed:
+
+The rationale for using gotos is:
 
 - unconditional statements are easier to understand and follow
 - nesting is reduced
@@ -403,9 +408,10 @@ The rationale is:
 int fun(int a)
 {
int result = 0;
-   char *buffer = kmalloc(SIZE);
+   char *buffer;
 
-   if (buffer == NULL)
+   buffer = kmalloc(SIZE);
+   if (!buffer)
return -ENOMEM;
 
if (condition1) {
@@ -413,14 +419,25 @@ int fun(int a)
...
}
result = 1;
-   goto out;
+   goto out_buffer;
}
...
-out:
+out_buffer:
kfree(buffer);
return result;
 }
 
+A common type of bug to be aware of it one err bugs which look like this:
+
+err:
+   kfree(foo-bar);
+   kfree(foo);
+   return ret;
+
+The bug in this code is that on some exit paths foo is NULL.  Normally the
+fix for this is to split it up into two error labels err_bar: and err_foo:.
+
+
Chapter 8: Commenting
 
 Comments are good, but there is also a danger of over-commenting.  NEVER
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2 1/2] kvm: x86: revert mask out xsaves

2014-12-02 Thread Wanpeng Li
On Tue, Dec 02, 2014 at 09:55:09AM +0100, Paolo Bonzini wrote:


On 02/12/2014 07:14, Wanpeng Li wrote:
 xsaves will be exported to guest in the next patch, so revert the
 mask out xsaves patch.
 
 Signed-off-by: Wanpeng Li wanpeng...@linux.intel.com
 ---
  arch/x86/kvm/cpuid.c | 10 +-
  1 file changed, 1 insertion(+), 9 deletions(-)
 
 diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c
 index a4f5ac4..7af07571 100644
 --- a/arch/x86/kvm/cpuid.c
 +++ b/arch/x86/kvm/cpuid.c
 @@ -320,10 +320,6 @@ static inline int __do_cpuid_ent(struct 
 kvm_cpuid_entry2 *entry, u32 function,
  F(ADX) | F(SMAP) | F(AVX512F) | F(AVX512PF) | F(AVX512ER) |
  F(AVX512CD);
  
 -/* cpuid 0xD.1.eax */
 -const u32 kvm_supported_word10_x86_features =
 -F(XSAVEOPT) | F(XSAVEC) | F(XGETBV1);

Every single bit needs to be whitelisted independently of the others, so
a full revert is not possible.  We need to be careful about post-Skylake
processors introducing new bits in this cpuid leaf.

Also, you cannot just add F(XSAVES) here; you must only do it if XSAVES
is actually supported.  This makes sure that nested virtualization will
_not_ present XSAVES to the guests until specific support is introduced
for XSAVES and XRSTORS exits (including the XSS exit bitmap).

In order to do this, you have to introduce a new member in kvm_x86_ops,
modeling what was done for MPX.  The second patch can then implement
this new member.

Will do, thanks for your review.

Regards,
Wanpeng Li 


Thanks,

Paolo

  /* all calls to cpuid_count() should be made on the same cpu */
  get_cpu();
  
 @@ -460,8 +456,6 @@ static inline int __do_cpuid_ent(struct kvm_cpuid_entry2 
 *entry, u32 function,
  entry-eax = supported;
  entry-edx = supported  32;
  entry-flags |= KVM_CPUID_FLAG_SIGNIFCANT_INDEX;
 -if (!supported)
 -break;
  
  for (idx = 1, i = 1; idx  64; ++idx) {
  u64 mask = ((u64)1  idx);
 @@ -469,9 +463,7 @@ static inline int __do_cpuid_ent(struct kvm_cpuid_entry2 
 *entry, u32 function,
  goto out;
  
  do_cpuid_1_ent(entry[i], function, idx);
 -if (idx == 1)
 -entry[i].eax = 
 kvm_supported_word10_x86_features;
 -else if (entry[i].eax == 0 || !(supported  mask))
 +if (entry[i].eax == 0 || !(supported  mask))
  continue;
  entry[i].flags |=
 KVM_CPUID_FLAG_SIGNIFCANT_INDEX;
 
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] staging: unisys: remove duplicate header

2014-12-02 Thread Sudip Mukherjee
these header files were included two times

Signed-off-by: Sudip Mukherjee su...@vectorindia.org
---
 drivers/staging/unisys/include/timskmod.h | 1 -
 drivers/staging/unisys/uislib/uisutils.c  | 1 -
 2 files changed, 2 deletions(-)

diff --git a/drivers/staging/unisys/include/timskmod.h 
b/drivers/staging/unisys/include/timskmod.h
index de11f44..cff7983 100644
--- a/drivers/staging/unisys/include/timskmod.h
+++ b/drivers/staging/unisys/include/timskmod.h
@@ -31,7 +31,6 @@
 #include linux/slab.h
 #include linux/errno.h
 #include linux/interrupt.h
-#include linux/sched.h
 #include linux/wait.h
 #include linux/vmalloc.h
 #include linux/proc_fs.h
diff --git a/drivers/staging/unisys/uislib/uisutils.c 
b/drivers/staging/unisys/uislib/uisutils.c
index a8466e3..7149add 100644
--- a/drivers/staging/unisys/uislib/uisutils.c
+++ b/drivers/staging/unisys/uislib/uisutils.c
@@ -27,7 +27,6 @@
 #include vbushelper.h
 #include linux/uuid.h
 #include linux/skbuff.h
-#include linux/uuid.h
 #ifdef CONFIG_HIGHMEM
 #include linux/highmem.h
 #endif
-- 
1.8.1.2

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


[PATCH] ASoC: Kconfig: remove not used SND_AT91_SOC_AFEB9260 option

2014-12-02 Thread Nicolas Ferre
Now that the driver snd-soc-afeb9260.c is deleted, remove its Kconfig option.

Reported-by: Paul Bolle pebo...@tiscali.nl
Signed-off-by: Nicolas Ferre nicolas.fe...@atmel.com
---
Hi Paul,

Indeed, I forgot to include the Kconfig removal: sorry for the noise.

Mark,

I send another patch so that it is easier for you to stack it or squash it on
top of your branch. 

Thanks, bye.
 Nicolas

 sound/soc/atmel/Kconfig | 9 -
 1 file changed, 9 deletions(-)

diff --git a/sound/soc/atmel/Kconfig b/sound/soc/atmel/Kconfig
index 27e3fc4a536b..fb3878312bf8 100644
--- a/sound/soc/atmel/Kconfig
+++ b/sound/soc/atmel/Kconfig
@@ -52,12 +52,3 @@ config SND_AT91_SOC_SAM9X5_WM8731
help
  Say Y if you want to add support for audio SoC on an
  at91sam9x5 based board that is using WM8731 codec.
-
-config SND_AT91_SOC_AFEB9260
-   tristate SoC Audio support for AFEB9260 board
-   depends on ARCH_AT91  ATMEL_SSC  ARCH_AT91  MACH_AFEB9260  
SND_ATMEL_SOC
-   select SND_ATMEL_SOC_PDC
-   select SND_ATMEL_SOC_SSC
-   select SND_SOC_TLV320AIC23_I2C
-   help
- Say Y here to support sound on AFEB9260 board.
-- 
2.1.3

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


Re: [patch] CodingStyle: add some more error handling guidelines

2014-12-02 Thread Julia Lawall
 @@ -403,9 +408,10 @@ The rationale is:
  int fun(int a)
  {
   int result = 0;
 - char *buffer = kmalloc(SIZE);
 + char *buffer;

 - if (buffer == NULL)
 + buffer = kmalloc(SIZE);

kmalloc actually takes two arguments.  Perhaps it would be better to show
something that looks like a valid call.

Otherwise,

Acked-by: Julia Lawall julia.law...@lip6.fr

julia

 + if (!buffer)
   return -ENOMEM;

   if (condition1) {
 @@ -413,14 +419,25 @@ int fun(int a)
   ...
   }
   result = 1;
 - goto out;
 + goto out_buffer;
   }
   ...
 -out:
 +out_buffer:
   kfree(buffer);
   return result;
  }

 +A common type of bug to be aware of it one err bugs which look like this:
 +
 +err:
 + kfree(foo-bar);
 + kfree(foo);
 + return ret;
 +
 +The bug in this code is that on some exit paths foo is NULL.  Normally the
 +fix for this is to split it up into two error labels err_bar: and 
 err_foo:.
 +
 +
   Chapter 8: Commenting

  Comments are good, but there is also a danger of over-commenting.  NEVER
 --
 To unsubscribe from this list: send the line unsubscribe kernel-janitors in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html

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


Re: [patch 1/3] mm: protect set_page_dirty() from ongoing truncation

2014-12-02 Thread Jan Kara
On Mon 01-12-14 17:58:00, Johannes Weiner wrote:
 Tejun, while reviewing the code, spotted the following race condition
 between the dirtying and truncation of a page:
 
 __set_page_dirty_nobuffers()   __delete_from_page_cache()
   if (TestSetPageDirty(page))
  page-mapping = NULL
if (PageDirty())
  dec_zone_page_state(page, NR_FILE_DIRTY);
  dec_bdi_stat(mapping-backing_dev_info, 
 BDI_RECLAIMABLE);
 if (page-mapping)
   account_page_dirtied(page)
 __inc_zone_page_state(page, NR_FILE_DIRTY);
   __inc_bdi_stat(mapping-backing_dev_info, BDI_RECLAIMABLE);
 
 which results in an imbalance of NR_FILE_DIRTY and BDI_RECLAIMABLE.
 
 Dirtiers usually lock out truncation, either by holding the page lock
 directly, or in case of zap_pte_range(), by pinning the mapcount with
 the page table lock held.  The notable exception to this rule, though,
 is do_wp_page(), for which this race exists.  However, do_wp_page()
 already waits for a locked page to unlock before setting the dirty
 bit, in order to prevent a race where clear_page_dirty() misses the
 page bit in the presence of dirty ptes.  Upgrade that wait to a fully
 locked set_page_dirty() to also cover the situation explained above.
 
 Afterwards, the code in set_page_dirty() dealing with a truncation
 race is no longer needed.  Remove it.
 
 Reported-by: Tejun Heo t...@kernel.org
 Signed-off-by: Johannes Weiner han...@cmpxchg.org
 Cc: sta...@vger.kernel.org
 ---
  include/linux/writeback.h |  1 -
  mm/memory.c   | 26 --
  mm/page-writeback.c   | 43 ---
  3 files changed, 28 insertions(+), 42 deletions(-)
 
 diff --git a/include/linux/writeback.h b/include/linux/writeback.h
 index a219be961c0a..00048339c23e 100644
 --- a/include/linux/writeback.h
 +++ b/include/linux/writeback.h
 @@ -177,7 +177,6 @@ int write_cache_pages(struct address_space *mapping,
 struct writeback_control *wbc, writepage_t writepage,
 void *data);
  int do_writepages(struct address_space *mapping, struct writeback_control 
 *wbc);
 -void set_page_dirty_balance(struct page *page);
  void writeback_set_ratelimit(void);
  void tag_pages_for_writeback(struct address_space *mapping,
pgoff_t start, pgoff_t end);
 diff --git a/mm/memory.c b/mm/memory.c
 index 3e503831e042..73220eb6e9e3 100644
 --- a/mm/memory.c
 +++ b/mm/memory.c
 @@ -2150,17 +2150,23 @@ reuse:
   if (!dirty_page)
   return ret;
  
 - /*
 -  * Yes, Virginia, this is actually required to prevent a race
 -  * with clear_page_dirty_for_io() from clearing the page dirty
 -  * bit after it clear all dirty ptes, but before a racing
 -  * do_wp_page installs a dirty pte.
 -  *
 -  * do_shared_fault is protected similarly.
 -  */
   if (!page_mkwrite) {
 - wait_on_page_locked(dirty_page);
 - set_page_dirty_balance(dirty_page);
 + struct address_space *mapping;
 + int dirtied;
 +
 + lock_page(dirty_page);
 + dirtied = set_page_dirty(dirty_page);
 + mapping = dirty_page-mapping;
 + unlock_page(dirty_page);
 +
 + if (dirtied  mapping) {
 + /*
 +  * Some device drivers do not set page.mapping
 +  * but still dirty their pages
 +  */
  The comment doesn't make sense to me here. Is it meant to explain why we
check 'mapping' in the above condition? I always thought truncate is the
main reason.

Honza

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


Re: [PATCH] ARM: zynq: DT: Add USB to device tree

2014-12-02 Thread Arnd Bergmann
On Monday 01 December 2014 13:51:26 Sören Brinkmann wrote:
 Hi Arnd,
 
 On Mon, 2014-12-01 at 10:26PM +0100, Arnd Bergmann wrote:
  On Monday 01 December 2014 10:42:32 Soren Brinkmann wrote:
   +   usb_phy0: usb-phy@0 {
   +   compatible = usb-nop-xceiv;
   +   #phy-cells = 0;
   +   };
};
  
  As discussed in an unrelated thread today, please drop the @0 in the
  node name, since the device has no 'reg' property.
 
 What is the best practice for naming such nodes then? On these boards
 it's not the case, but Zynq has two USB cores. So, there may be DTs that
 will have two phys in there. Would we just do 'usb-phy-0'?
 
 

Grant recommended naming them phy0 and phy1 in this case.
The recommended node name for a phy is phy, not usb-phy (I didn't
notice that earlier, but it makes sense to change both), and
I would not use a dash for the number there.

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


[PATCH v15 0/3] Add drm driver for Rockchip Socs

2014-12-02 Thread Mark Yao
This a series of patches is a DRM Driver for Rockchip Socs, add support
for vop devices. Future patches will add additional encoders/connectors,
such as eDP, HDMI.

The basic crtc for rockchip is a VOP - Video Output Processor.
the vop devices found on Rockchip rk3288 Soc, rk3288 soc have two similar
Vop devices. Vop devices support iommu mapping, we use dma-mapping API with
ARM_DMA_USE_IOMMU.

Changes in v2:
- add DRM master device node to list all display nodes that comprise
  the graphics subsystem.
- use the component framework to defer main drm driver probe
  until all VOP devices have been probed.
- use dma-mapping API with ARM_DMA_USE_IOMMU, create dma mapping by
  master device and each vop device can shared the drm dma mapping.
- use drm_crtc_init_with_planes and drm_universal_plane_init.
- remove unnecessary middle layers.
- add cursor set, move funcs to rockchip drm crtc.
- add vop reset.

Changes in v3:
- change crtc-fb to crtc-primary-fb
Adviced by Daniel Vetter
- init cursor plane with universal api, remove unnecessary cursor set,move 

Changes in v4:
Adviced by David Herrmann
- remove drm_platform_*() usage, use register drm device directly.
Adviced by Rob Clark
- remove special mmap ioctl, do userspace mmap with normal mmap() or mmap offset

Changes in v5:
Adviced by Arnd Bergmann
- doing DMA start with a 32-bit masks with dma_mask and dma_coherent_mark
- fix some incorrect dependencies.
Adviced by Boris BREZILLON
- fix some mistake and bugs. 
Adviced by Daniel Vetter
- drop all special ioctl and use generic kms ioctl instead.
Adviced by Rob Clark
- use unlocked api for drm_fb_helper_restore_fbdev_mode.
- remove unused rockchip_gem_prime_import_sg_table.

Changes in v6:
- set gem buffer pitch 64 bytes align, needed by mali gpu.
Adviced by Daniel Kurtz
- fix some mistake, bugs, remove unused define, more better code style etc. 
- use clk_prepare()/unprepare() at probe()/remove() and clk_enable()/disable()
  at runtime instead of clk_prepare_enable().
- provide a help function from vop for encoder to do mode config, instead of
  using drm_diaplay_mode private method.
- change vop mode_set timing to make it more safely. 

Changes in v7:
- fix memory leakage problem.

Changes in v8:
- fix iommu crash when use dual crtc.
- use frame start interrupt for vsync instead of line flag interrupt,
  because the win config take affect at frame start time, if we use
  ling flag interrupt, the address check often failed.
Adviced by Daniel Kurtz
- fix some bugs, mistake, remove unused function
- keep clock and vop disabled when probe end
- use drm_plane_helper_check_update to check update_plane if vaild

Changes in v9:
- fix suspend and resume bug, make iommu attach and detach safely.
- fix mail info style.

Changes in v10:
Adviced by Andrzej Hajda
- check drm_dev if it's NULL at PM suspend/resume
Adviced by Sean Paul
- use drm_fb_helper_prepare to init fb_helper funcs
- Optimized code structure and remove some unnecessary Variables.

Changes in v11:
- fix mistake that use wrong variable at rockchip sys_resume/sys_suspend

Changes in v12:
- fix compile problem with drm-next
- Optimization framebuffer reference/unreference
- Optimization Code structure
- fix pm suspend/resume problem
- fix vblank irq can't close problem

Changes in v13:
- fix vop compile warning.
Adviced by Daniel Vetter
- directly call rockchip_drm_load before register instead of
  call -load at the middle of drm register.

Changes in v14:
- revert v13 directly call rockchip_drm_load at bind, connector,
  crtc _init should before dev-node kms object lookup idr and
  conector sysfs need below minor node register, I don't like 
  split the connector init and register, so just call -load at
  the midile of drm register.

Changes in v15:
- remove depends on ARM_DMA_USE_IOMMU  IOMMU_API which cause 
  recursive dependency problem
- fix compile problems when build as a module.

Mark yao (3):
  drm: rockchip: Add basic drm driver
  dt-bindings: video: Add for rockchip display subsytem
  dt-bindings: video: Add documentation for rockchip vop

 .../devicetree/bindings/video/rockchip-drm.txt |   19 +
 .../devicetree/bindings/video/rockchip-vop.txt |   58 +
 drivers/gpu/drm/Kconfig|2 +
 drivers/gpu/drm/Makefile   |1 +
 drivers/gpu/drm/rockchip/Kconfig   |   17 +
 drivers/gpu/drm/rockchip/Makefile  |8 +
 drivers/gpu/drm/rockchip/rockchip_drm_drv.c|  551 
 drivers/gpu/drm/rockchip/rockchip_drm_drv.h|   68 +
 drivers/gpu/drm/rockchip/rockchip_drm_fb.c |  201 +++
 drivers/gpu/drm/rockchip/rockchip_drm_fb.h |   28 +
 drivers/gpu/drm/rockchip/rockchip_drm_fbdev.c  |  210 +++
 drivers/gpu/drm/rockchip/rockchip_drm_fbdev.h  |   21 +
 drivers/gpu/drm/rockchip/rockchip_drm_gem.c|  294 
 drivers/gpu/drm/rockchip/rockchip_drm_gem.h|   54 +
 drivers/gpu/drm/rockchip/rockchip_drm_vop.c| 

Re: [PATCH v3 05/11] memory: add Atmel EBI (External Bus Interface) driver

2014-12-02 Thread Alexander Stein
On Monday 01 December 2014 17:17:30, Arnd Bergmann wrote:
 On Monday 01 December 2014 11:50:06 Boris Brezillon wrote:
  
  I don't have a strong opinion regarding where this driver should
  live (I even considered putting it in drivers/bus) :-).
  But note that there are other external memory interface drivers
  in drivers/memory too: TI AEMIF and Marvell DEVBUS  ;-).
  
  Does anyone else think this driver should go in drivers/bus ?
  
 
 I think drivers/memory is better.

I don't mind if it's drivers/bus or drivers/memory. But I'm wondering: When is 
a driver a bus driver when it is a memory driver? See imx-weim and atmel-ebi. 
Apparently both add support for devices attached on a bus which can be accessed 
through memory addresses :)

Best regards,
Alexander
-- 
Dipl.-Inf. Alexander Stein

SYS TEC electronic GmbH
Am Windrad 2
08468 Heinsdorfergrund
Tel.: 03765 38600-1156
Fax: 03765 38600-4100
Email: alexander.st...@systec-electronic.com
Website: www.systec-electronic.com
 
Managing Director: Dipl.-Phys. Siegmar Schmidt
Commercial registry: Amtsgericht Chemnitz, HRB 28082

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


[PATCH v15 1/3] drm: rockchip: Add basic drm driver

2014-12-02 Thread Mark Yao
This patch adds the basic structure of a DRM Driver for Rockchip Socs.

Signed-off-by: Mark Yao mark@rock-chips.com
Signed-off-by: Daniel Kurtz djku...@chromium.org
Acked-by: Daniel Vetter dan...@ffwll.ch
Reviewed-by: Rob Clark robdcl...@gmail.com
---
Changes in v2:
- use the component framework to defer main drm driver probe
  until all VOP devices have been probed.
- use dma-mapping API with ARM_DMA_USE_IOMMU, create dma mapping by
  master device and each vop device can shared the drm dma mapping.
- use drm_crtc_init_with_planes and drm_universal_plane_init.
- remove unnecessary middle layers.
- add cursor set, move funcs to rockchip drm crtc.
- use vop reset at first init
- reference framebuffer when used and unreference when swap out vop

Changes in v3:
- change crtc-fb to crtc-primary-fb
Adviced by Daniel Vetter
- init cursor plane with universal api, remove unnecessary cursor set,move 

Changes in v4:
Adviced by David Herrmann
- remove drm_platform_*() usage, use register drm device directly.
Adviced by Rob Clark
- remove special mmap ioctl, do userspace mmap with normal mmap() or mmap offset

Changes in v5:
Adviced by Arnd Bergmann
- doing DMA start with a 32-bit masks with dma_mask and dma_coherent_mark
- fix some incorrect dependencies.
Adviced by Boris BREZILLON
- fix some mistake and bugs. 
Adviced by Daniel Vetter
- drop all special ioctl and use generic kms ioctl instead.
Adviced by Rob Clark
- use unlocked api for drm_fb_helper_restore_fbdev_mode.
- remove unused rockchip_gem_prime_import_sg_table.

Changes in v6:
- set gem buffer pitch 64 bytes align, needed by mali gpu.
Adviced by Daniel Kurtz
- fix some mistake, bugs, remove unused define, more better code style etc. 
- use clk_prepare()/unprepare() at probe()/remove() and clk_enable()/disable()
  at runtime instead of clk_prepare_enable().
- provide a help function from vop for encoder to do mode config, instead of
  using drm_diaplay_mode private method.
- change vop mode_set timing to make it more safely. 

Changes in v7:
- fix memory leakage problem

Changes in v8:
- fix iommu crash when use dual crtc.
- use frame start interrupt for vsync instead of line flag interrupt,
because the win config take affect at frame start time, if we use ling flag
interrupt, the address check often failed.
Adviced by Daniel Kurtz
- fix some bugs, mistake, remove unused function
- keep clock and vop disabled when probe end
- use drm_plane_helper_check_update to check update_plane if vaild

Changes in v9:
- fix suspend and resume bug, make iommu attach and detach safely.

Changes in v10:
Adviced by Andrzej Hajda
- check drm_dev if it's NULL at PM suspend/resume
Adviced by Sean Paul
- use drm_fb_helper_prepare to init fb_helper funcs
- Optimized code structure and remove some unnecessary variables.

Changes in v11:
- fix mistake that use wrong variable at rockchip sys_resume/sys_suspend.

Changes in v12:
- fix compile problem with drm-next
Adviced by Daniel Kurtz
- Optimization framebuffer reference/unreference
- Optimization Code structure
- fix pm suspend/resume problem
- fix vblank irq can't close problem

Changes in v13:
- fix vop compile warning.
Adviced by Daniel Vetter
- directly call rockchip_drm_load before register instead of
call -load at the middle of drm register.

Changes in v14:
- revert v13 directly call rockchip_drm_load at bind, connector,
  crtc _init should before dev-node kms object lookup idr and
  conector sysfs need below minor node register, I don't like 
  split the connector init and register, so just call -load at
  the midile of drm register.

Changes in v15:
- remove depends on ARM_DMA_USE_IOMMU  IOMMU_API which cause 
  recursive dependency problem
- fix compile problems when build as a module.

 drivers/gpu/drm/Kconfig   |2 +
 drivers/gpu/drm/Makefile  |1 +
 drivers/gpu/drm/rockchip/Kconfig  |   17 +
 drivers/gpu/drm/rockchip/Makefile |8 +
 drivers/gpu/drm/rockchip/rockchip_drm_drv.c   |  551 ++
 drivers/gpu/drm/rockchip/rockchip_drm_drv.h   |   68 ++
 drivers/gpu/drm/rockchip/rockchip_drm_fb.c|  201 
 drivers/gpu/drm/rockchip/rockchip_drm_fb.h|   28 +
 drivers/gpu/drm/rockchip/rockchip_drm_fbdev.c |  210 
 drivers/gpu/drm/rockchip/rockchip_drm_fbdev.h |   21 +
 drivers/gpu/drm/rockchip/rockchip_drm_gem.c   |  294 +
 drivers/gpu/drm/rockchip/rockchip_drm_gem.h   |   54 +
 drivers/gpu/drm/rockchip/rockchip_drm_vop.c   | 1455 +
 drivers/gpu/drm/rockchip/rockchip_drm_vop.h   |  201 
 14 files changed, 3111 insertions(+)
 create mode 100644 drivers/gpu/drm/rockchip/Kconfig
 create mode 100644 drivers/gpu/drm/rockchip/Makefile
 create mode 100644 drivers/gpu/drm/rockchip/rockchip_drm_drv.c
 create mode 100644 drivers/gpu/drm/rockchip/rockchip_drm_drv.h
 create mode 100644 drivers/gpu/drm/rockchip/rockchip_drm_fb.c
 create mode 100644 drivers/gpu/drm/rockchip/rockchip_drm_fb.h
 create mode 100644 

[RFC] mm:add zero_page _mapcount when mapped into user space

2014-12-02 Thread Wang, Yalin
This patch add/dec zero_page's _mapcount to make sure
the mapcount is correct for zero_page,
so that when read from /proc/kpagecount, zero_page's
mapcount is also correct, userspace process like procrank can
calculate PSS correctly.

Signed-off-by: Yalin Wang yalin.w...@sonymobile.com
---
 mm/memory.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/mm/memory.c b/mm/memory.c
index 3e50383..a6309c1 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -2198,6 +2198,7 @@ gotten:
new_page = alloc_zeroed_user_highpage_movable(vma, address);
if (!new_page)
goto oom;
+   atomic_dec(pfn_to_page(pte_pfn(orig_pte))-_mapcount);
} else {
new_page = alloc_page_vma(GFP_HIGHUSER_MOVABLE, vma, address);
if (!new_page)
@@ -2647,6 +2648,7 @@ static int do_anonymous_page(struct mm_struct *mm, struct 
vm_area_struct *vma,
page_table = pte_offset_map_lock(mm, pmd, address, ptl);
if (!pte_none(*page_table))
goto unlock;
+   atomic_inc((pfn_to_page(my_zero_pfn(address)))-_mapcount);
goto setpte;
}
 
-- 
2.1.3

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


[PATCH v15 2/3] dt-bindings: video: Add for rockchip display subsytem

2014-12-02 Thread Mark Yao
This add a display subsystem comprise the all display interface nodes.

Signed-off-by: Mark Yao mark@rock-chips.com
---
Changes in v2:
- add DRM master device node to list all display nodes that comprise
  the graphics subsystem.

Changes in v3: None

Changes in v4: None

Changes in v5: None

Changes in v6: None

Changes in v7: None

Changes in v8: None

Changes in v9: None

Changes in v10: None

Changes in v11: None

Changes in v12: None

Changes in v13: None

Changes in v14: None

Changes in v15: None

 .../devicetree/bindings/video/rockchip-drm.txt |   19 +++
 1 file changed, 19 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/video/rockchip-drm.txt

diff --git a/Documentation/devicetree/bindings/video/rockchip-drm.txt 
b/Documentation/devicetree/bindings/video/rockchip-drm.txt
new file mode 100644
index 000..7fff582
--- /dev/null
+++ b/Documentation/devicetree/bindings/video/rockchip-drm.txt
@@ -0,0 +1,19 @@
+Rockchip DRM master device
+
+
+The Rockchip DRM master device is a virtual device needed to list all
+vop devices or other display interface nodes that comprise the
+graphics subsystem.
+
+Required properties:
+- compatible: Should be rockchip,display-subsystem
+- ports: Should contain a list of phandles pointing to display interface port
+  of vop devices. vop definitions as defined in
+  Documentation/devicetree/bindings/video/rockchip-vop.txt
+
+example:
+
+display-subsystem {
+   compatible = rockchip,display-subsystem;
+   ports = vopl_out, vopb_out;
+};
-- 
1.7.9.5


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


[PATCH v15 3/3] dt-bindings: video: Add documentation for rockchip vop

2014-12-02 Thread Mark Yao
This adds binding documentation for Rockchip SoC VOP driver.

Signed-off-by: Mark Yao mark@rock-chips.com
---
Changes in v2:
- rename lcdc to vop
- add vop reset
- add iommu node
- add port for display-subsystem

Changes in v3: None

Changes in v4: None

Changes in v5: None

Changes in v6: None

Changes in v7: None

Changes in v8: None

Changes in v9: None

Changes in v10: None

Changes in v11: None

Changes in v12: None

Changes in v13: None

Changes in v14: None

Changes in v15: None

 .../devicetree/bindings/video/rockchip-vop.txt |   58 
 1 file changed, 58 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/video/rockchip-vop.txt

diff --git a/Documentation/devicetree/bindings/video/rockchip-vop.txt 
b/Documentation/devicetree/bindings/video/rockchip-vop.txt
new file mode 100644
index 000..d15351f
--- /dev/null
+++ b/Documentation/devicetree/bindings/video/rockchip-vop.txt
@@ -0,0 +1,58 @@
+device-tree bindings for rockchip soc display controller (vop)
+
+VOP (Visual Output Processor) is the Display Controller for the Rockchip
+series of SoCs which transfers the image data from a video memory
+buffer to an external LCD interface.
+
+Required properties:
+- compatible: value should be one of the following
+   rockchip,rk3288-vop;
+
+- interrupts: should contain a list of all VOP IP block interrupts in the
+order: VSYNC, LCD_SYSTEM. The interrupt specifier
+format depends on the interrupt controller used.
+
+- clocks: must include clock specifiers corresponding to entries in the
+   clock-names property.
+
+- clock-names: Must contain
+   aclk_vop: for ddr buffer transfer.
+   hclk_vop: for ahb bus to R/W the phy regs.
+   dclk_vop: pixel clock.
+
+- resets: Must contain an entry for each entry in reset-names.
+  See ../reset/reset.txt for details.
+- reset-names: Must include the following entries:
+  - axi
+  - ahb
+  - dclk
+
+- iommus: required a iommu node
+
+- port: A port node with endpoint definitions as defined in
+  Documentation/devicetree/bindings/media/video-interfaces.txt.
+
+Example:
+SoC specific DT entry:
+   vopb: vopb@ff93 {
+   compatible = rockchip,rk3288-vop;
+   reg = 0xff93 0x19c;
+   interrupts = GIC_SPI 15 IRQ_TYPE_LEVEL_HIGH;
+   clocks = cru ACLK_VOP0, cru DCLK_VOP0, cru HCLK_VOP0;
+   clock-names = aclk_vop, dclk_vop, hclk_vop;
+   resets = cru SRST_LCDC1_AXI, cru SRST_LCDC1_AHB, cru 
SRST_LCDC1_DCLK;
+   reset-names = axi, ahb, dclk;
+   iommus = vopb_mmu;
+   vopb_out: port {
+   #address-cells = 1;
+   #size-cells = 0;
+   vopb_out_edp: endpoint@0 {
+   reg = 0;
+   remote-endpoint=edp_in_vopb;
+   };
+   vopb_out_hdmi: endpoint@1 {
+   reg = 1;
+   remote-endpoint=hdmi_in_vopb;
+   };
+   };
+   };
-- 
1.7.9.5


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


Re: [patch 3/3] mm: memory: merge shared-writable dirtying branches in do_wp_page()

2014-12-02 Thread Jan Kara
On Mon 01-12-14 17:58:02, Johannes Weiner wrote:
 Whether there is a vm_ops-page_mkwrite or not, the page dirtying is
 pretty much the same.  Make sure the page references are the same in
 both cases, then merge the two branches.
 
 It's tempting to go even further and page-lock the !page_mkwrite case,
 to get it in line with everybody else setting the page table and thus
 further simplify the model.  But that's not quite compelling enough to
 justify dropping the pte lock, then relocking and verifying the entry
 for filesystems without -page_mkwrite, which notably includes tmpfs.
 Leave it for now and lock the page late in the !page_mkwrite case.
 
 Signed-off-by: Johannes Weiner han...@cmpxchg.org
 ---
  mm/memory.c | 46 --
  1 file changed, 16 insertions(+), 30 deletions(-)
 
 diff --git a/mm/memory.c b/mm/memory.c
 index 2a2e3648ed65..ff92abfa5303 100644
 --- a/mm/memory.c
 +++ b/mm/memory.c
...
 @@ -2147,42 +2147,28 @@ reuse:
   pte_unmap_unlock(page_table, ptl);
   ret |= VM_FAULT_WRITE;
  
 - if (!dirty_page)
 - return ret;
 -
 - if (!page_mkwrite) {
 + if (dirty_shared) {
   struct address_space *mapping;
   int dirtied;
  
 - lock_page(dirty_page);
 - dirtied = set_page_dirty(dirty_page);
 - mapping = dirty_page-mapping;
 - unlock_page(dirty_page);
 + if (!page_mkwrite)
 + lock_page(old_page);
  
 - if (dirtied  mapping) {
 - /*
 -  * Some device drivers do not set page.mapping
 -  * but still dirty their pages
 -  */
 - balance_dirty_pages_ratelimited(mapping);
 - }
 + dirtied = set_page_dirty(old_page);
 + mapping = old_page-mapping;
 + unlock_page(old_page);
 + page_cache_release(old_page);
  
 - file_update_time(vma-vm_file);
 - }
 - put_page(dirty_page);
 - if (page_mkwrite) {
 - struct address_space *mapping = dirty_page-mapping;
 -
 - set_page_dirty(dirty_page);
 - unlock_page(dirty_page);
 - page_cache_release(dirty_page);
 - if (mapping){
 + if ((dirtied || page_mkwrite)  mapping) {
  Why do we actually call balance_dirty_pages_ratelimited() even if we
didn't dirty the page when -page_mkwrite() exists? Is it because
filesystem may dirty the page in -page_mkwrite() and we don't want it to
deal with calling balance_dirty_pages_ratelimited()?

Otherwise the patch looks good to me.

Honza

   /*
* Some device drivers do not set page.mapping
* but still dirty their pages
*/
   balance_dirty_pages_ratelimited(mapping);
   }
 +
 + if (!page_mkwrite)
 + file_update_time(vma-vm_file);
   }
  
   return ret;
 -- 
 2.1.3
 
-- 
Jan Kara j...@suse.cz
SUSE Labs, CR
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/2] oom: don't assume that a coredumping thread will exit soon

2014-12-02 Thread Michal Hocko
On Fri 28-11-14 00:04:05, Oleg Nesterov wrote:
 oom_kill.c assumes that PF_EXITING task should exit and free the memory
 soon. This is wrong in many ways and one important case is the coredump.
 A task can sleep in exit_mm() forever while the coredumping sub-thread
 can need more memory.
 
 Change the PF_EXITING checks to take SIGNAL_GROUP_COREDUMP into account,
 we add the new trivial helper for that.
 
 Note: this is only the first step, this patch doesn't try to solve other
 problems. For example it doesn't try to clear the wrongly set TIF_MEMDIE
 (SIGNAL_GROUP_COREDUMP check is obviously racy),

I am not sure I understand this. What do you mean by wrongly set
TIF_MEMDIE? That we give a process access to reserves even though it is
already done with the coredumping?

 fatal_signal_pending() can be false positive, etc.

When can this happen?

 Signed-off-by: Oleg Nesterov o...@redhat.com

I guess the patch as is makes sense and it is an improvement. We need
to call the helper in mem_cgroup_out_of_memory as well, though.

With that feel free to add
Acked-by: Michal Hocko mho...@suse.cz

Also the original fix for the coredumping (edd45544c6f0 oom: avoid
deferring oom killer if exiting task is being traced) doesn't work
really as per http://marc.info/?l=linux-kernelm=141711049013620 then
this and the follow up patch should be marked for stable I guess.

 ---
  mm/oom_kill.c |   12 +---
  1 files changed, 9 insertions(+), 3 deletions(-)
 
 diff --git a/mm/oom_kill.c b/mm/oom_kill.c
 index 5340f6b..7af33b5 100644
 --- a/mm/oom_kill.c
 +++ b/mm/oom_kill.c
 @@ -254,6 +254,12 @@ static enum oom_constraint constrained_alloc(struct 
 zonelist *zonelist,
  }
  #endif
  
 +static inline bool task_will_free_mem(struct task_struct *task)
 +{
 + return (task-flags  PF_EXITING) 
 + !(task-signal-flags  SIGNAL_GROUP_COREDUMP);
 +}
 +
  enum oom_scan_t oom_scan_process_thread(struct task_struct *task,
   unsigned long totalpages, const nodemask_t *nodemask,
   bool force_kill)
 @@ -281,7 +287,7 @@ enum oom_scan_t oom_scan_process_thread(struct 
 task_struct *task,
   if (oom_task_origin(task))
   return OOM_SCAN_SELECT;
  
 - if (task-flags  PF_EXITING  !force_kill) {
 + if (task_will_free_mem(task)  !force_kill) {
   /*
* If this task is not being ptraced on exit, then wait for it
* to finish before killing some other task unnecessarily.
 @@ -443,7 +449,7 @@ void oom_kill_process(struct task_struct *p, gfp_t 
 gfp_mask, int order,
* If the task is already exiting, don't alarm the sysadmin or kill
* its children or threads, just set TIF_MEMDIE so it can die quickly
*/
 - if (p-flags  PF_EXITING) {
 + if (task_will_free_mem(p)) {
   set_tsk_thread_flag(p, TIF_MEMDIE);
   put_task_struct(p);
   return;
 @@ -649,7 +655,7 @@ void out_of_memory(struct zonelist *zonelist, gfp_t 
 gfp_mask,
* select it.  The goal is to allow it to allocate so that it may
* quickly exit and free its memory.
*/
 - if (fatal_signal_pending(current) || current-flags  PF_EXITING) {
 + if (fatal_signal_pending(current) || task_will_free_mem(current)) {
   set_thread_flag(TIF_MEMDIE);
   return;
   }
 -- 
 1.5.5.1
 

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


[PATCH 5/5] clarification of _shipped files intent

2014-12-02 Thread Nicholas Mc Guire

clarification of _shipped files intent

The rational for using _shipped files should be clearly
indicated so that it does not look like it is encouraging
binary blobs.

This patch is against linux 3.18.0-rc6

Note that the original file uses leading tabs so for this
patch this was retained.

Signed-off-by: Nicholas Mc Guire der.h...@hofr.at
---
 Documentation/kbuild/modules.txt |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/Documentation/kbuild/modules.txt b/Documentation/kbuild/modules.txt
index 450af1f..eeca125 100644
--- a/Documentation/kbuild/modules.txt
+++ b/Documentation/kbuild/modules.txt
@@ -268,7 +268,10 @@ module 8123.ko, which is built from the following files:
 
 --- 3.3 Binary Blobs
 
-   Some external modules need to include an object file as a blob.
+   Some external modules need to include an object file as a
+   prebuilt binary if they depend on exotic tools or if the
+   build time penalty of generating such files might be seen
+   to be too high.
kbuild has support for this, but requires the blob file to be
named filename_shipped. When the kbuild rules kick in, a copy
of filename_shipped is created with _shipped stripped off,
-- 
1.7.10.4

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


[PATCH 0/5] documentation of _shipped and offset header files

2014-12-02 Thread Nicholas Mc Guire

This patchset cleanup includes documentation updates for _shipped files, 
offset header files as well as some directly related change proposals 
in Kbuild and CodingStyle.

This proposed patch set describes the intent and use of _shipped files
and offset header files as well as a minor update on the handling
of external module dependencies.

- an additional clause to Documentation/CodingStyle for _shipped files
- a description of _shipped in Documentation/kbuild/makefiles.txt
- documentation of offset header files
- change to scripts/Makefile.lib to restrict _shipped to .c .h and .S files
  and a special (historic) .incl_shipped case
- fix wording in Documentation/kbuild/modules.txt on _shipped files

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


[PATCH 4/5] limit _shipped to c h and S files

2014-12-02 Thread Nicholas Mc Guire

limit _shipped to c h and S files

_shipped targets are intended for generated source files which should
not permit .o binary blobs which is currently the case. This patch
simply restricts _shipped targets to .c, .h and .S files.

A special case for .inc_shipped is added to prevent breaking
drivers/net/wan/wanxlfw.inc_shipped which is a historic firmware
and can not be reasonably moved to a loadable firmware.

This patch is against linux 3.18.0-rc6

Signed-off-by: Nicholas Mc Guire der.h...@hofr.at
---
 scripts/Makefile.lib |   12 +++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 5117552..dd02bb9 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -216,7 +216,17 @@ endif
 quiet_cmd_shipped = SHIPPED $@
 cmd_shipped = cat $  $@
 
-$(obj)/%: $(src)/%_shipped
+$(obj)/%.c: $(src)/%.c_shipped
+   $(call cmd,shipped)
+
+$(obj)/%.h: $(src)/%.h_shipped
+   $(call cmd,shipped)
+
+$(obj)/%.S: $(src)/%.S_shipped
+   $(call cmd,shipped)
+
+$(obj)/%.inc: $(src)/%.inc_shipped
+   @echo '  INFO: use of .inc_shipped files is deprecated'
$(call cmd,shipped)
 
 # Commands useful for building a boot image
-- 
1.7.10.4

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


[PATCH 2/5] Description of _shipped files handling in kbuild

2014-12-02 Thread Nicholas Mc Guire

Description of _shipped files handling in kbuild

This adds a section on handling of _shipped files in Kbuild
Makefiles and the build process.

This patch is against linux 3.18.0-rc6

Signed-off-by: Nicholas Mc Guire der.h...@hofr.at
---
 Documentation/kbuild/makefiles.txt |   58 +++-
 1 file changed, 57 insertions(+), 1 deletion(-)

diff --git a/Documentation/kbuild/makefiles.txt 
b/Documentation/kbuild/makefiles.txt
index a311db8..df3a96a 100644
--- a/Documentation/kbuild/makefiles.txt
+++ b/Documentation/kbuild/makefiles.txt
@@ -19,6 +19,7 @@ This document describes the Linux kernel Makefiles.
   --- 3.10 Special Rules
   --- 3.11 $(CC) support functions
   --- 3.12 $(LD) support functions
+  --- 3.13 _shipped - generated files
 
=== 4 Host Program support
   --- 4.1 Simple Host Program
@@ -594,6 +595,61 @@ more details, with real examples.
#Makefile
LDFLAGS_vmlinux += $(call ld-option, -X)
 
+--- 3.13 _shipped - generated files
+
+   Some sources in the kernel are generated by tools or special
+   purpose scripts so that the build process dependencies can be kept
+   at a reasonable level. Also in cases where the translation is not
+   configuration dependent but might impact build time, _shipped files
+   may be added along with the actual sources to speed up the build
+   process.
+
+   For standard tools like lex and yacc the make process will actually
+   generate the _shipped files (see scripts/Makefile.lib) and retain
+   them by marking them .PRECIOUS so they are not removed by the clean
+   targets.
+
+   For non-standard tools the generation of the _shipped file itself
+   may be manually achieved by building and then renaming. A makefile
+   target to generate the actual target file should to be provided
+   though and can be conditioned on an environment variable.
+
+   Example:
+   ifdef GENERATE_KEYMAP
+
+   $(obj)/defkeymap.c: $(obj)/%.c: $(src)/%.map
+   loadkeys --mktable $  $@
+
+   endif
+
+   The _shipped file does not appear in the actual Makefile, this is
+   handled by the rules found in scripts/Makefile.lib.
+
+   snip
+   cmd_shipped = cat $  $@
+
+   $(obj)/%: $(src)/%_shipped
+   $(call cmd,shipped)
+   snip
+
+   which simply will copy the target_shipped to the target
+
+   If a file of a make target is found in the build directory with the
+   extension _shipped, make will use it rather than generating the
+   respective target file from source.
+
+   The build will indicate the use of the _shipped file by the SHIPPED
+   quiet command in the make output.
+
+   Example:
+   LD  drivers/scsi/aic7xxx/built-in.o
+   SHIPPED drivers/scsi/aic7xxx/aic79xx_seq.h
+   SHIPPED drivers/scsi/aic7xxx/aic79xx_reg.h
+   CC [M]  drivers/scsi/aic7xxx/aic79xx_core.o
+   CC [M]  drivers/scsi/aic7xxx/aic79xx_pci.o
+   SHIPPED drivers/scsi/aic7xxx/aic79xx_reg_print.c
+   CC [M]  drivers/scsi/aic7xxx/aic79xx_reg_print.o
+
 
 === 4 Host Program support
 
@@ -1399,10 +1455,10 @@ Original version made by Michael Elizabeth Chastain, 
mailto:m...@shout.net
 Updates by Kai Germaschewski k...@tp1.ruhr-uni-bochum.de
 Updates by Sam Ravnborg s...@ravnborg.org
 Language QA by Jan Engelhardt jeng...@gmx.de
+Kbuild support for shipped files Nicholas Mc Guire der.h...@hofr.at
 
 === 11 TODO
 
-- Describe how kbuild supports shipped files with _shipped.
 - Generating offset header files.
 - Add more variables to section 7?
 
-- 
1.7.10.4

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


[PATCH 1/5] mandate defined build cmd and source ref for _shipped files

2014-12-02 Thread Nicholas Mc Guire

mandate defined build cmd and source ref for _shipped files

Currently shipped files have more or less free style indications
of how to generate them respectively what the sources are, in
their header. Mandating defined tags and keywords would allow
for automated checking.

This patch is against 3.18.0-rc6

Signed-off-by: Nicholas Mc Guire der.h...@hofr.at
---
 Documentation/CodingStyle |   18 ++
 1 file changed, 18 insertions(+)

diff --git a/Documentation/CodingStyle b/Documentation/CodingStyle
index 9f28b14..3bcd4ce 100644
--- a/Documentation/CodingStyle
+++ b/Documentation/CodingStyle
@@ -844,6 +844,24 @@ next instruction in the assembly output:
 more_magic %reg2, %reg3
 : /* outputs */ : /* inputs */ : /* clobbers */);
 
+   Chapter 20:  Generated files
+
+For files generated by special purpose tools/scripts that
+justify providing _shipped files the header of the generated
+file needs indicate that it was generated, how to generate
+the file and its source location.
+
+/* Do not edit this file! It was automatically generated by   */
+/* generator: command options arguments   */
+/* sources: path/to/sources/filename   */
+
+Example:
+
+/* Do not edit this file! It was automatically generated by   */
+/* generator: loadkeys --mktable defkeymap.map  defkeymap.c  */
+/* sources: drivers/tty/vt/defkeymap.map  */
+
+
 
Chapter 20: Conditional Compilation
 
-- 
1.7.10.4

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


[PATCH 3/5] Description of offset header files handling

2014-12-02 Thread Nicholas Mc Guire

Description of offset header files handling

This adds a section on offset header files handling in Kbuild.

This patch is against linux 3.18.0-rc6

Signed-off-by: Nicholas Mc Guire der.h...@hofr.at
---
 Documentation/kbuild/makefiles.txt |  123 ++--
 1 file changed, 117 insertions(+), 6 deletions(-)

diff --git a/Documentation/kbuild/makefiles.txt 
b/Documentation/kbuild/makefiles.txt
index df3a96a..46ff185 100644
--- a/Documentation/kbuild/makefiles.txt
+++ b/Documentation/kbuild/makefiles.txt
@@ -51,8 +51,9 @@ This document describes the Linux kernel Makefiles.
 
=== 8 Kbuild Variables
=== 9 Makefile language
-   === 10 Credits
-   === 11 TODO
+   === 10 Generating offset header files
+   === 11 Credits
+   === 12 TODO
 
 === 1 Overview
 
@@ -1033,7 +1034,7 @@ When kbuild executes, the following steps are followed 
(roughly):
 
In this example, the file target maketools will be processed
before descending down in the subdirectories.
-   See also chapter XXX-TODO that describe how kbuild supports
+   See also chapter 10 that describe how kbuild supports
generating offset header files.
 
 
@@ -1449,17 +1450,127 @@ time the left-hand side is used.
 There are some cases where = is appropriate.  Usually, though, :=
 is the right choice.
 
-=== 10 Credits
+=== 10 Generating offset header files
+
+The problem: Given the following structure:
+
+   Example:
+   typedef struct
+   {
+int a;
+int b;
+   } some_thing;
+
+ If an asm function is receiving a pointer of a some_thing structure
+ then we have the problem, that the elements offset in the structure
+ are not accessible in the assembler code.
+
+ If the pointer were passed in through r0 then access to the elements
+ a and b would need to have the offsets hard coded like:
+
+   Example:
+  ldr  r1, [r0, #0] // read a
+  ldr  r2, [r0, #4] // read b
+
+ but you do not want to hard-code them in maintainable code so the
+ offsets need to be deduced from the C-code and made available for use
+ in the assembler code in some symbolic manner.
+
+   Example:
+  ldr  r1, [r0, #THING_A]
+  ldr  r2, [r0, #THING_B]
+
+ The Kbuild system provides methods to calculate the necessary offsets
+ from the C and stores them in a generated header file as preprocessor
+ constants which allows to write maintainable and readable assembler code.
+
+ The elements that are needed in assembler code are placed in a C-file
+ arch/$(SRCARCH)/kernel/asm-offsets_{32,64}.c which is then processed into 
+ a assembler file (by calling gcc -S) and from this Kbuild then extracts
+ the defines and places them into the generated asm-offsets.h
+
+   Example:
+   arch/x86/kernel/asm-offsets_64.c
+   snip
+   ...
+   #define ENTRY(entry) OFFSET(pt_regs_ ## entry, pt_regs, entry)
+   ENTRY(bx);
+   ...
+   snip
+
+ from this the pt_regs_bx offset is generated and stored in
+ the asm-offsets.s as verbose asm from the top level Kbuild file
+ (arch/$(SRCARCH)/kernel/asm-offsets.s: arch/$(SRCARCH)/kernel/asm-offsets.c)
+
+Example:
+   -pt_regs_bx $40 offsetof(struct pt_regs, bx)   #
+   # 0  2
+   # 51 arch/x86/kernel/asm-offsets_64.c 1
+
+ This intermediate assembler file is then processed by a somewhat brute-force
+ (or elegant - depending on how much you like sed) sed script in the top
+ level Kbuild file to generate the asm-offsets.h file
+
+ define sed-y
+   /^-/{s:-#\(.*\):/* \1 */:; \
+   s:^-\([^ ]*\) [\$$#]*\([-0-9]*\) \(.*\):#define \1 \2 /* \3 */:; \
+   s:^-\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; \
+   s:-::; p;}
+ endef
+
+ The generated files include a header generated by the Kbuild file indicating
+ that it is generated and should not be modified and then contains the
+ set of #define and as documentation the C-structure element e.g.
+
+ #define pt_regs_bx 40 /* offsetof(struct pt_regs, bx)   # */
+
+   Example: arch/x86/power/hibernate_asm_64.S
+   ...
+   #include asm/asm-offsets.h
+   #include asm/processor-flags.h
+
+   ENTRY(swsusp_arch_suspend)
+   movq$saved_context, %rax
+   movq%rsp, pt_regs_sp(%rax)
+   ...
+
+ To now add a generated offset one needs to edit the C-file in
+ arch/$(SRCARCH)/kernel/asm-offsets.c respectively if it is only
+ for the 32 or 64 bit build in the asm-offsets_32/64.c and include
+ the respective structure/element one needs access to.
+
+ The syntax for this is
+ OFFSET(MACRONAME, STRUCTURE, ELEMENT);
+
+ Example:
+   snip
+...
+   #include asm/thread_info.h
+...
+   void common(void) {
+   BLANK();
+

[PATCH] additional external module symbol dependecy handling options

2014-12-02 Thread Nicholas Mc Guire

additional external module symbol dependecy handling options

The use of KBUILD_EXTRA_SYMBOLS is clarified by an example and
the additional option of using  KBUILD_EXTMOD is added as
equivalent alternative.

This patch is against linux 3.18.0-rc6

Signed-off-by: Nicholas Mc Guire der.h...@hofr.at
---
 Documentation/kbuild/modules.txt |   12 
 1 file changed, 12 insertions(+)

diff --git a/Documentation/kbuild/modules.txt b/Documentation/kbuild/modules.txt
index 3fb39e0..450af1f 100644
--- a/Documentation/kbuild/modules.txt
+++ b/Documentation/kbuild/modules.txt
@@ -517,6 +517,18 @@ build.
These files will be loaded by modpost during the
initialization of its symbol tables.
 
+   Example:
+   $ make KBUILD_EXTRA_SYMBOLS=/PATH/TO/bar/Module.symvers 
\
+ -C $KDIR M=$PWD modules
+
+   Use make variable KBUILD_EXTMOD
+   Alternatively to passing the Module.symvers files explicitly
+   one can also pass the directory containing the external module
+   that will satisfy the dependecies with KBUILD_EXTMOD and
+   Kbuild will pick up the Module.symvers found there.
+
+   Example:
+   $ make -C $KDIR M=$PWD KBUILD_EXTMOD=/PATH/TO/bar/ 
modules
 
 === 7. Tips  Tricks
 
-- 
1.7.10.4

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


[RFC V2] mm:add zero_page _mapcount when mapped into user space

2014-12-02 Thread Wang, Yalin
This patch add/dec zero_page's _mapcount to make sure
the mapcount is correct for zero_page,
so that when read from /proc/kpagecount, zero_page's
mapcount is also correct, userspace process like procrank can
calculate PSS correctly.

Signed-off-by: Yalin Wang yalin.w...@sonymobile.com
---
 mm/memory.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/mm/memory.c b/mm/memory.c
index 3e50383..7215423 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -2198,6 +2198,7 @@ gotten:
new_page = alloc_zeroed_user_highpage_movable(vma, address);
if (!new_page)
goto oom;
+   atomic_dec(pfn_to_page(pte_pfn(orig_pte))-_mapcount);
} else {
new_page = alloc_page_vma(GFP_HIGHUSER_MOVABLE, vma, address);
if (!new_page)
@@ -2647,6 +2648,7 @@ static int do_anonymous_page(struct mm_struct *mm, struct 
vm_area_struct *vma,
page_table = pte_offset_map_lock(mm, pmd, address, ptl);
if (!pte_none(*page_table))
goto unlock;
+   atomic_inc(pfn_to_page(my_zero_pfn(address))-_mapcount);
goto setpte;
}
 
-- 
2.1.3
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v15 0/3] Add drm driver for Rockchip Socs

2014-12-02 Thread Heiko Stübner
Hi Mark,

Am Dienstag, 2. Dezember 2014, 17:13:20 schrieb Mark Yao:
 This a series of patches is a DRM Driver for Rockchip Socs, add support
 for vop devices. Future patches will add additional encoders/connectors,
 such as eDP, HDMI.
 
 The basic crtc for rockchip is a VOP - Video Output Processor.
 the vop devices found on Rockchip rk3288 Soc, rk3288 soc have two similar
 Vop devices. Vop devices support iommu mapping, we use dma-mapping API with
 ARM_DMA_USE_IOMMU.

[...]

 Changes in v15:
 - remove depends on ARM_DMA_USE_IOMMU  IOMMU_API which cause
   recursive dependency problem
 - fix compile problems when build as a module.

maybe you could also already create a new pull request for this version [like 
the last one based on the iommu branch], so that we save time and Dave can 
pull it in easily for testing if he likes.


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


Re: [PATCH v4 3/3] gpio: add support for Cypress CYUSBS234 USB-GPIO adapter

2014-12-02 Thread Lee Jones
On Mon, 01 Dec 2014, Linus Walleij wrote:

 On Fri, Nov 28, 2014 at 5:41 PM, Muthu Mani m...@cypress.com wrote:
 
  Adds support for USB-GPIO interface of Cypress Semiconductor
  CYUSBS234 USB-Serial Bridge controller.
 
  The GPIO get/set can be done through vendor command on control endpoint
  for the configured gpios.
 
  Details about the device can be found at:
  http://www.cypress.com/?rID=84126
 
  Signed-off-by: Muthu Mani m...@cypress.com
  Signed-off-by: Rajaram Regupathy r...@cypress.com
  ---
  Changes since v3:
 
 (..)
  +config GPIO_CYUSBS23X
  +   tristate CYUSBS23x GPIO support
  +   depends on MFD_CYUSBS23X  USB
 
 Doesn't MFD_CYUSV23X already depend on USB?

Yup.

  +#include linux/kernel.h
  +#include linux/errno.h
  +#include linux/module.h
  +#include linux/slab.h
  +#include linux/types.h
  +#include linux/mutex.h
  +#include linux/platform_device.h
  +
  +#include linux/usb.h
  +#include linux/gpio.h
  +
  +#include linux/mfd/cyusbs23x.h
 
 Why this arbitrary newlines? Add this
 
 #include linus/bitops.h

Narcissist. =;-)

[...]

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v1] lib/genalloc.c: Export devm_gen_pool_create for modules

2014-12-02 Thread Prabhakar Lad
Hi Michal,

Thanks for the patch.

On Mon, Dec 1, 2014 at 1:00 PM, Michal Simek michal.si...@xilinx.com wrote:
 Modules can use this function for creating pool.

 Signed-off-by: Michal Simek michal.si...@xilinx.com
 ---

 I am pushing Zynq OCMC driver which is using this function.

 ---
  lib/genalloc.c | 1 +
  1 file changed, 1 insertion(+)

don’t you need to add an entry in include/linux/genalloc.h ?

Thanks,
--Prabhakar Lad

 diff --git a/lib/genalloc.c b/lib/genalloc.c
 index cce4dd68c40d..2e65d206b01c 100644
 --- a/lib/genalloc.c
 +++ b/lib/genalloc.c
 @@ -598,6 +598,7 @@ struct gen_pool *devm_gen_pool_create(struct device *dev, 
 int min_alloc_order,

 return pool;
  }
 +EXPORT_SYMBOL(devm_gen_pool_create);

  /**
   * dev_get_gen_pool - Obtain the gen_pool (if any) for a device
 --
 1.8.2.3

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


Re: [PATCH] time: Fix sign bug in ntp mult overflow warning

2014-12-02 Thread Jeremiah Mahler
John,

On Mon, Nov 24, 2014 at 08:35:45PM -0800, John Stultz wrote:
 In commit 6067dc5a8c2b (time: Avoid possible NTP adjustment mult
 overflow) a new check was added to watch for adjustments that could
 cause a mult overflow.
 
 Unfortunately the check compares a signed with unsigned value and
 ignored the case where the adjustment was negative, which causes
 spurious warn-ons on some systems (and seems like it would result in
 problematic time adjustments there as well, due to the early
 return).
 
 Thus this patch adds a check to make sure the adjustment is positive
 before we check for an overflow, and resovles the issue in my
 testing.
 
 Cc: pang.xunlei pang.xun...@linaro.org
 Cc: Fengguang Wu fengguang...@intel.com
 Cc: Thomas Gleixner t...@linutronix.de
 Cc: Ingo Molnar mi...@kernel.org
 Reported-by: Fengguang Wu fengguang...@intel.com
 Debugged-by: pang.xunlei pang.xun...@linaro.org
 Signed-off-by: John Stultz john.stu...@linaro.org
 ---
  kernel/time/timekeeping.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
 index 29a7d67..2dc0646 100644
 --- a/kernel/time/timekeeping.c
 +++ b/kernel/time/timekeeping.c
 @@ -1330,7 +1330,7 @@ static __always_inline void 
 timekeeping_apply_adjustment(struct timekeeper *tk,
*
* XXX - TODO: Doc ntp_error calculation.
*/
 - if (tk-tkr.mult + mult_adj  mult_adj) {
 + if ((mult_adj  0)  (tk-tkr.mult + mult_adj  mult_adj)) {
   /* NTP adjustment caused clocksource mult overflow */
   WARN_ON_ONCE(1);
   return;

This change does quiet the warning but I think it does so for the wrong
reason.

mult_adj is a signed number and tk-tkr.mult is an unsigned number.
Adding the check that (mult_adj  0) limits the test to only positive
numbers.  A positive number plus a positive number will never be less
than either of the two positive numbers.  The test is always false.

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


Re: [PATCH] ARM: rockchip: Convert resume code to C

2014-12-02 Thread Arnd Bergmann
On Monday 01 December 2014 15:04:59 Doug Anderson wrote:
 Russel,
 
 On Mon, Dec 1, 2014 at 2:50 PM, Russell King - ARM Linux
 li...@arm.linux.org.uk wrote:
  What I see here is a load of complexity which achieves very little.
  The result doesn't get rid of much assembly, but it does make stuff
  more complicated.  And the diffstat speaks volumes about this:
 
   10 files changed, 275 insertions(+), 94 deletions(-)
 
  There's a lot of words in the description, but it's missing the most
  important bit: why do we want to take this approach - what benefits
  does it bring?
 
 Sure.  I guess the most important words in the description are:
 
  We convert the existing assembly resume code into C as proof that this
  works and to prepare for linking in SDRAM reinit code.
 
 I can't say that the SDRAM reinit code is ready for prime time yet,
 but you can get a preview of what it could look like at:
 
 https://chromium-review.googlesource.com/#/c/227366/25/arch/arm/mach-rockchip/embedded/rk3288_ddr_resume.c
 
 Adding that code in assembly seems like a very, very bad idea.
 Certainly my patch could wait until the DDR code is ready to be posted
 upstream if that made sense.  One advantage of waiting is that it's
 possible that the DDR code might end up moving elsewhere if it made
 sense to have it part of a memory controller driver or something like
 that.

I recently looked at another vendor tree (quantenna wifi access point,
based on arch/arc), which was putting arbitrary functions into SRAM
for performance reasons, in their case the entire hot path for network
switching. Having at least the infrastructure to do this seems like
a great idea, even though it's very hard to do in a general-purpose
kernel, as you'd have a hard time squeezing as much code as possible
into the available SRAM.

Unfortunately you already said that you're not that interested in
making it completely generic, and I also don't think I want to have
the infrastructure for it in mach-rockchip and would want to see that
at least shared across arch/arm if it's too hard to do
cross-architecture. If you were to include code from drivers/memory/
in the blob, you couldn't keep it in mach-rockchip anyway.

AFAICT, the quantenna implementation is similar to the itcm/dtcm
stuff we already have (but are not using upstream), so I wonder
why we can't use that here too, see Documentation/arm/tcm.txt

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


Re: [PATCH 2/2] oom: kill the insufficient and no longer needed PT_TRACE_EXIT check

2014-12-02 Thread Michal Hocko
On Fri 28-11-14 00:04:08, Oleg Nesterov wrote:
 After the previous patch we can remove the PT_TRACE_EXIT check in
 oom_scan_process_thread(), it was added to handle the case when the
 coredumping was frozen by ptrace, but it doesn't really work. If
 nothing else, we would need to check all threads which could share
 the same -mm to make it more or less correct.
 
 Signed-off-by: Oleg Nesterov o...@redhat.com

I still do not see why we do not need task-ptrace  PT_TRACE_EXIT check
here. I do understand that the check on group_leader doesn't make much
sense. ptrace_event would block until the tracer let the task run again
which may be never AFAICS.

It is really sad how subtle and racy are all these checks :/

 ---
  mm/oom_kill.c |   11 +++
  1 files changed, 3 insertions(+), 8 deletions(-)
 
 diff --git a/mm/oom_kill.c b/mm/oom_kill.c
 index 7af33b5..a2a4036 100644
 --- a/mm/oom_kill.c
 +++ b/mm/oom_kill.c
 @@ -287,14 +287,9 @@ enum oom_scan_t oom_scan_process_thread(struct 
 task_struct *task,
   if (oom_task_origin(task))
   return OOM_SCAN_SELECT;
  
 - if (task_will_free_mem(task)  !force_kill) {
 - /*
 -  * If this task is not being ptraced on exit, then wait for it
 -  * to finish before killing some other task unnecessarily.
 -  */
 - if (!(task-group_leader-ptrace  PT_TRACE_EXIT))
 - return OOM_SCAN_ABORT;
 - }
 + if (task_will_free_mem(task)  !force_kill)
 + return OOM_SCAN_ABORT;
 +
   return OOM_SCAN_OK;
  }
  
 -- 
 1.5.5.1
 

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


Re: [PATCH v1] lib/genalloc.c: Export devm_gen_pool_create for modules

2014-12-02 Thread Michal Simek
On 12/02/2014 10:31 AM, Prabhakar Lad wrote:
 Hi Michal,
 
 Thanks for the patch.
 
 On Mon, Dec 1, 2014 at 1:00 PM, Michal Simek michal.si...@xilinx.com wrote:
 Modules can use this function for creating pool.

 Signed-off-by: Michal Simek michal.si...@xilinx.com
 ---

 I am pushing Zynq OCMC driver which is using this function.

 ---
  lib/genalloc.c | 1 +
  1 file changed, 1 insertion(+)

 don’t you need to add an entry in include/linux/genalloc.h ?

Not sure what exactly you mean. declaration is there.
include/linux/genalloc.h:120:extern struct gen_pool 
*devm_gen_pool_create(struct device *dev,

And all EXPORT_SYMBOL() are out of headers directly below function
which you want to export.

Can you please clarify what you did mean by that?

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


  1   2   3   4   5   6   7   8   9   10   >