Re: [RFC v7 26/41] richacl: Apply the file masks to a richacl

2015-09-24 Thread Andreas Gruenbacher
2015-09-24 17:28 GMT+02:00 J. Bruce Fields :
> I guess Samba's only choice on reading an ACL will be to split OWNER@
> ACEs into inheritable and effective parts and then replace the "who" on
> the latter by the current owner.

Right, that's when translating from richacls to Windows ACLs.

> On writing do you think it should try to translate ACEs for users
> matching the current owner to OWNER@ ACEs, or are you assuming it should
> leave those untouched?

In the other direction, from Windows ACLs to richacls, Samba at least
shouldn't have to do that mapping. There may still be cases where it
wants to do that mapping though.

Thanks,
Andreas
--
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 1/3] x86, mce: MCE log size not enough for high core parts

2015-09-24 Thread Borislav Petkov
On Thu, Sep 24, 2015 at 01:48:38AM -0400, Ashok Raj wrote:
> MCE_LOG_LEN appears to be short for high core count parts. Especially when
> handling fatal errors, we don't clear MCE banks. Socket level MC banks
> are visible to all CPUs that share banks.
> 
> Assuming 18 core part, 2 threads per core 2 banks per thread and couple uncore
> MSRs. Rounding to 128 with some fudge to grow in future.
> 
> Signed-off-by: Ashok Raj 
> Suggested-by: Tony Luck 
> ---
>  arch/x86/include/asm/mce.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/x86/include/asm/mce.h b/arch/x86/include/asm/mce.h
> index 2dbc0bf..4293ae7 100644
> --- a/arch/x86/include/asm/mce.h
> +++ b/arch/x86/include/asm/mce.h
> @@ -88,7 +88,7 @@
>  #define MCE_EXTENDED_BANK128
>  #define MCE_THERMAL_BANK (MCE_EXTENDED_BANK + 0)
>  
> -#define MCE_LOG_LEN 32
> +#define MCE_LOG_LEN  128
>  #define MCE_LOG_SIGNATURE"MACHINECHECK"

Hmm, I don't think this is what I meant when we talked about it
previously. So let me try again:

Now that we have this shiny 2-pages sized lockless gen_pool, why are we
still dealing with struct mce_log mcelog? Why can't we rip it out and
kill it finally? And switch to the gen_pool?

All code that reads from mcelog - /dev/mcelog chrdev - should switch to
the lockless buffer and will iterate through the logged MCEs there.

I think this way we're much better prepared for future machine sizes.
We can even use memblock to allocate appropriate memory at boot for the
gen_pool if the 2 pages are not enough.

Hmmm?

-- 
Regards/Gruss,
Boris.

ECO tip #101: Trim your mails when you reply.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH RFC v2] pidns: introduce syscall getvpid

2015-09-24 Thread Konstantin Khlebnikov
On Thu, Sep 24, 2015 at 5:56 PM, Oleg Nesterov  wrote:
> On 09/24, Konstantin Khlebnikov wrote:
>>
>> +SYSCALL_DEFINE3(getvpid, pid_t, pid, int, source, int, target)
>> +{
>> + struct file *source_file = NULL, *target_file = NULL;
>> + struct pid_namespace *source_ns, *target_ns;
>> + struct pid *struct_pid;
>> + struct ns_common *ns;
>> + pid_t result;
>> +
>> + if (source >= 0) {
>> + source_file = proc_ns_fget(source);
>> + result = PTR_ERR(source_file);
>> + if (IS_ERR(source_file))
>> + goto out;
>> + ns = get_proc_ns(file_inode(source_file));
>> + result = -EINVAL;
>> + if (ns->ops->type != CLONE_NEWPID)
>> + goto out;
>> + source_ns = container_of(ns, struct pid_namespace, ns);
>> + } else
>> + source_ns = task_active_pid_ns(current);
>> +
>> + if (target >= 0) {
>> + target_file = proc_ns_fget(target);
>> + result = PTR_ERR(target_file);
>> + if (IS_ERR(target_file))
>> + goto out;
>> + ns = get_proc_ns(file_inode(target_file));
>> + result = -EINVAL;
>> + if (ns->ops->type != CLONE_NEWPID)
>> + goto out;
>> + target_ns = container_of(ns, struct pid_namespace, ns);
>> + } else
>> + target_ns = task_active_pid_ns(current);
>> +
>
> Hmm. Eric, Konstantin, how about (uncompiled/untested) patch below
> in a preparation? The code above doesn't look very readable.

I've tried to do something like that but that comes too far so send patch as is.
Actually we can go deeper and replace struct file* with struct fd: this saves
couple atomic ops for singlethreaded task.

>
> In fact I think another helper
>
> #define proc_ns_xxx(file, type) \
> container_of(get_proc_ns(file_inode(file)), \
> struct type, ns)
>
> makes sense too.
>
> Oleg.
> ---
>
> diff --git a/fs/nsfs.c b/fs/nsfs.c
> index 99521e7..0877dd6 100644
> --- a/fs/nsfs.c
> +++ b/fs/nsfs.c
> @@ -118,9 +118,10 @@ int ns_get_name(char *buf, size_t size, struct 
> task_struct *task,
> return res;
>  }
>
> -struct file *proc_ns_fget(int fd)
> +struct file *proc_ns_fget(int fd, int nstype)
>  {
> struct file *file;
> +   struct ns_common *ns;
>
> file = fget(fd);
> if (!file)
> @@ -129,6 +130,10 @@ struct file *proc_ns_fget(int fd)
> if (file->f_op != _file_operations)
> goto out_invalid;
>
> +   ns = get_proc_ns(file_inode(file));
> +   if (nstype && (ns->ops->type != nstype))
> +   goto out_invalid;
> +
> return file;
>
>  out_invalid:
> diff --git a/include/linux/proc_ns.h b/include/linux/proc_ns.h
> index 42dfc61..84c9770 100644
> --- a/include/linux/proc_ns.h
> +++ b/include/linux/proc_ns.h
> @@ -65,7 +65,7 @@ static inline int ns_alloc_inum(struct ns_common *ns)
>
>  #define ns_free_inum(ns) proc_free_inum((ns)->inum)
>
> -extern struct file *proc_ns_fget(int fd);
> +extern struct file *proc_ns_fget(int fd, int nstype);
>  #define get_proc_ns(inode) ((struct ns_common *)(inode)->i_private)
>  extern void *ns_get_path(struct path *path, struct task_struct *task,
> const struct proc_ns_operations *ns_ops);
> diff --git a/kernel/nsproxy.c b/kernel/nsproxy.c
> index 49746c8..fee18ba 100644
> --- a/kernel/nsproxy.c
> +++ b/kernel/nsproxy.c
> @@ -226,21 +226,17 @@ SYSCALL_DEFINE2(setns, int, fd, int, nstype)
> struct ns_common *ns;
> int err;
>
> -   file = proc_ns_fget(fd);
> +   file = proc_ns_fget(fd, nstype);
> if (IS_ERR(file))
> return PTR_ERR(file);
>
> -   err = -EINVAL;
> -   ns = get_proc_ns(file_inode(file));
> -   if (nstype && (ns->ops->type != nstype))
> -   goto out;
> -
> new_nsproxy = create_new_namespaces(0, tsk, current_user_ns(), 
> tsk->fs);
> if (IS_ERR(new_nsproxy)) {
> err = PTR_ERR(new_nsproxy);
> goto out;
> }
>
> +   ns = get_proc_ns(file_inode(file));
> err = ns->ops->install(new_nsproxy, ns);
> if (err) {
> free_nsproxy(new_nsproxy);
> diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c
> index 572af00..9dfbe68 100644
> --- a/net/core/net_namespace.c
> +++ b/net/core/net_namespace.c
> @@ -424,15 +424,12 @@ struct net *get_net_ns_by_fd(int fd)
> struct ns_common *ns;
> struct net *net;
>
> -   file = proc_ns_fget(fd);
> +   file = proc_ns_fget(fd, CLONE_NEWNET);
> if (IS_ERR(file))
> return ERR_CAST(file);
>
> ns = get_proc_ns(file_inode(file));
> -   if (ns->ops == _operations)
> -   net = get_net(container_of(ns, struct net, ns));
> -   else
> -   net = ERR_PTR(-EINVAL);

Re: [PATCH v3 0/5] Add SMP bringup support for mt65xx socs

2015-09-24 Thread Yingjoe Chen
On Fri, 2015-08-07 at 18:50 +0800, Yingjoe Chen wrote:
> On Wed, 2015-08-05 at 23:31 +0100, Russell King - ARM Linux wrote:
> > The problem is that this patch series uses memblock_reserve() way after
> > the memory has been transitioned out of memblock's control, so actually
> > this has no effect.
> > 
> > I've seen a number of patches doing this.  I'm not sure what's soo friggin
> > hard for people to understand: memblock is about the EARLY stages of
> > getting the system up and running.  Once the memory has been handed
> > over to the kernel's memory management, memblock MUST NOT BE USED to
> > reserve memory.
> > 
> > There is one place, and one place only in the ARM kernel where
> > memblock_reserve() is possible, and that's in the ->reserve machine
> > callback.  NOWHERE ELSE is permissible.
> 
> 
> It seems we can write memory-reserve node in device tree to do this as
> well. Do you prefer us to reserve memblock in reserve callback or using
> device tree?

After consideration, I decide to reserve this memory in device tree. The
memory is already used by trustzone, we should reserved them even when
we don't run SMP. I just sent out a new series, please help to review
them.
Thanks

Joe.C


--
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] KVM: nVMX: emulate the INVVPID instruction

2015-09-24 Thread Bandan Das
Paolo Bonzini  writes:
...
>> @@ -7189,7 +7189,28 @@ static int handle_invept(struct kvm_vcpu *vcpu)
>>  
>>  static int handle_invvpid(struct kvm_vcpu *vcpu)
>>  {
>> -kvm_queue_exception(vcpu, UD_VECTOR);
>> +u32 vmx_instruction_info;
>> +unsigned long type;
>> +
>> +if (!nested_vmx_check_permission(vcpu))
>> +return 1;
>> +
>> +vmx_instruction_info = vmcs_read32(VMX_INSTRUCTION_INFO);
>> +type = kvm_register_readl(vcpu, (vmx_instruction_info >> 28) & 0xf);
>> +
>> +switch (type) {
>> +case VMX_VPID_EXTENT_INDIVIDUAL_ADDR:
>> +case VMX_VPID_EXTENT_SINGLE_CONTEXT:
>> +case VMX_VPID_EXTENT_ALL_CONTEXT:
>> +vmx_flush_tlb(vcpu);
>> +nested_vmx_succeed(vcpu);
>> +break;
>> +default:
>> +nested_vmx_failInvalid(vcpu);
>> +break;
>> +}
>> +
>> +skip_emulated_instruction(vcpu);
>>  return 1;
>>  }
>>  
>> 
>
> This is not enough.  You need to add a VPID argument to
> vpid_sync_vcpu_single, and inline vmx_flush_tlb in handle_invvpid so
> that it can use the new VPID argument of vpid_sync_vcpu_single.
>
> Note that the "all context" variant can be mapped to
> vpid_sync_vcpu_single with vpid02 as the argument (a nice side effect of
> your vpid02 design).
>
> However, I have applied the patch to kvm/queue.  Please send the changes
> separately, and I will squash them in the existing VPID patch.

Please don't do this. It's making it really difficult to review these
patches individually :( Why not let them get some review time before
applying them all together ?


> Paolo
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" 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: [PATCHv2 2/2] power_supply: Add support for tps65217-charger.

2015-09-24 Thread Sebastian Reichel
Hi,

On Thu, Sep 24, 2015 at 09:23:25AM +0200, Enric Balletbo i Serra wrote:
> This patch adds support for the tps65217 charger driver. This driver is
> responsible for controlling the charger aspect of the tps65217 mfd.
> Currently, this mainly consists of turning on and off the charger, but
> some other features of the charger can be supported through this driver.
>
> [...]
>
> +static int tps65217_ac_get_property(struct power_supply *psy,
> + enum power_supply_property psp,
> + union power_supply_propval *val)
> +{
> + struct tps65217_charger *charger = power_supply_get_drvdata(psy);
> +
> + if (psp == POWER_SUPPLY_PROP_ONLINE) {
> + val->intval = charger->ac_online;
> + charger->prev_ac_online = charger->ac_online;

I think this is no longer needed at this place.

> + return 0;
> + }
> + return -EINVAL;
> +}
> 
> [...]
>
> +static int tps65217_charger_remove(struct platform_device *pdev)
> +{
> + struct tps65217_charger *charger = platform_get_drvdata(pdev);
> +
> + kthread_stop(charger->poll_task);
> +
> + power_supply_unregister(charger->ac);

This is not needed with devm_power_supply_register() and actually
it's wrong, since it would be called again by managed resources
infrastructure.

> + return 0;
> +}

-- Sebastian


signature.asc
Description: Digital signature


Re: [PATCH] drm/nouveau: remove unused function

2015-09-24 Thread Sudip Mukherjee
On Wed, Sep 02, 2015 at 12:08:08PM +0530, Sudip Mukherjee wrote:
> coverity.com reported that memset was using a buffer of size 0, on
> checking the code it turned out that the function was not being used. So
> remove it.
> 
> Signed-off-by: Sudip Mukherjee 
> ---
Hi Ben,
A gentle ping.

regards
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/


Re: [PATCH 3/5] drm: omapdrm: tiler: Fix module autoload for OF platform driver

2015-09-24 Thread Tomi Valkeinen

On 24/09/15 18:36, Luis de Bethencourt wrote:

> I am a bit confused.

Yes, it's an interesting mess due to legacy reasons. Maybe we manage to
fix it some day...

> So how the OMAP DRM auto loading is supposed to work when using Device Trees?

omapdrm isn't a real HW device driver at the moment. There's another
driver, omapdss, which is the HW driver, and omapdrm uses omapdss.
omapdrm platform device is created by omap platform code at boot time,
the same way for both DT and non-DT boots.

> As far as I can tell, the main omap drm driver does not have a OF device ID
> table and a .of_match it only has a MODULE_ALIAS("platform:" DRIVER_NAME),
> but the tiler driver (that is built-in the omap drm driver) does have a a
> OF device ID table and I see in DTS that are device nodes using those 
> compatible
> strings
> 
> $ git grep omap4-dmm arch/arm/boot/dts/omap*
> arch/arm/boot/dts/omap4.dtsi:   compatible = "ti,omap4-dmm";
> 
> Does that mean there is no need for MODULE_ALIAS("platform:" DMM_DRIVER_NAME)?

No, I think that's the thing that makes omapdrm load.

 Tomi



signature.asc
Description: OpenPGP digital signature


[PATCH v4 5/5] ARM: dts: mt8127: enable basic SMP bringup for mt8127

2015-09-24 Thread Yingjoe Chen
Add arch timer node to enable arch-timer support. MT8127 firmware
doesn't correctly setup arch-timer frequency and CNTVOFF, add
properties to workaround this.

This also set cpu enable-method to enable SMP.

Signed-off-by: Yingjoe Chen 
---
 arch/arm/boot/dts/mt8127.dtsi | 27 +++
 1 file changed, 27 insertions(+)

diff --git a/arch/arm/boot/dts/mt8127.dtsi b/arch/arm/boot/dts/mt8127.dtsi
index ca3402e..50652fd 100644
--- a/arch/arm/boot/dts/mt8127.dtsi
+++ b/arch/arm/boot/dts/mt8127.dtsi
@@ -23,6 +23,7 @@
cpus {
#address-cells = <1>;
#size-cells = <0>;
+   enable-method = "mediatek,mt81xx-tz-smp";
 
cpu@0 {
device_type = "cpu";
@@ -47,6 +48,17 @@
 
};
 
+   reserved-memory {
+   #address-cells = <2>;
+   #size-cells = <2>;
+   ranges;
+
+   trustzone-bootinfo: trustzone-bootinfo@80002000 {
+   compatible = "mediatek,trustzone-bootinfo";
+   reg = <0 0x80002000 0 0x1000>;
+   };
+   };
+
clocks {
#address-cells = <2>;
#size-cells = <2>;
@@ -72,6 +84,21 @@
 };
};
 
+   timer {
+   compatible = "arm,armv7-timer";
+   interrupt-parent = <>;
+   interrupts = ,
+,
+,
+;
+   clock-frequency = <1300>;
+   arm,cpu-registers-not-fw-configured;
+   };
+
soc {
#address-cells = <2>;
#size-cells = <2>;
-- 
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 v4 2/5] devicetree: bindings: add new SMP enable method Mediatek SoC

2015-09-24 Thread Yingjoe Chen
This commit add new cpu enable method "mediatek,mt65xx-smp" and
"mediatek,mt81xx-tz-smp".

Signed-off-by: Yingjoe Chen 
---
 Documentation/devicetree/bindings/arm/cpus.txt | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Documentation/devicetree/bindings/arm/cpus.txt 
b/Documentation/devicetree/bindings/arm/cpus.txt
index 91e6e5c..3a07a87 100644
--- a/Documentation/devicetree/bindings/arm/cpus.txt
+++ b/Documentation/devicetree/bindings/arm/cpus.txt
@@ -195,6 +195,8 @@ nodes to be present and contain the properties described 
below.
"marvell,armada-380-smp"
"marvell,armada-390-smp"
"marvell,armada-xp-smp"
+   "mediatek,mt6589-smp"
+   "mediatek,mt81xx-tz-smp"
"qcom,gcc-msm8660"
"qcom,kpss-acc-v1"
"qcom,kpss-acc-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 v4 4/5] ARM: dts: mt8135: enable basic SMP bringup for mt8135

2015-09-24 Thread Yingjoe Chen
Add arch timer node to enable arch-timer support. MT8135 firmware
doesn't correctly setup arch-timer frequency and CNTVOFF, add
properties to workaround this.

This also set cpu enable-method to enable SMP.

Signed-off-by: Yingjoe Chen 
---
 arch/arm/boot/dts/mt8135.dtsi | 27 +++
 1 file changed, 27 insertions(+)

diff --git a/arch/arm/boot/dts/mt8135.dtsi b/arch/arm/boot/dts/mt8135.dtsi
index 08371db..c3c90f2 100644
--- a/arch/arm/boot/dts/mt8135.dtsi
+++ b/arch/arm/boot/dts/mt8135.dtsi
@@ -46,6 +46,7 @@
cpus {
#address-cells = <1>;
#size-cells = <0>;
+   enable-method = "mediatek,mt81xx-tz-smp";
 
cpu0: cpu@0 {
device_type = "cpu";
@@ -72,6 +73,17 @@
};
};
 
+   reserved-memory {
+   #address-cells = <2>;
+   #size-cells = <2>;
+   ranges;
+
+   trustzone-bootinfo: trustzone-bootinfo@80002000 {
+   compatible = "mediatek,trustzone-bootinfo";
+   reg = <0 0x80002000 0 0x1000>;
+   };
+   };
+
clocks {
#address-cells = <2>;
#size-cells = <2>;
@@ -97,6 +109,21 @@
};
};
 
+   timer {
+   compatible = "arm,armv7-timer";
+   interrupt-parent = <>;
+   interrupts = ,
+,
+,
+;
+   clock-frequency = <1300>;
+   arm,cpu-registers-not-fw-configured;
+   };
+
soc {
#address-cells = <2>;
#size-cells = <2>;
-- 
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 v4 3/5] ARM: mediatek: add smp bringup code

2015-09-24 Thread Yingjoe Chen
Add support for booting secondary CPUs on mt6589, mt8127
and mt8135.

Signed-off-by: Yingjoe Chen 
---
 arch/arm/mach-mediatek/Makefile  |   3 +
 arch/arm/mach-mediatek/platsmp.c | 141 +++
 2 files changed, 144 insertions(+)
 create mode 100644 arch/arm/mach-mediatek/platsmp.c

diff --git a/arch/arm/mach-mediatek/Makefile b/arch/arm/mach-mediatek/Makefile
index 43e619f..2116460 100644
--- a/arch/arm/mach-mediatek/Makefile
+++ b/arch/arm/mach-mediatek/Makefile
@@ -1 +1,4 @@
+ifeq ($(CONFIG_SMP),y)
+obj-$(CONFIG_ARCH_MEDIATEK) += platsmp.o
+endif
 obj-$(CONFIG_ARCH_MEDIATEK) += mediatek.o
diff --git a/arch/arm/mach-mediatek/platsmp.c b/arch/arm/mach-mediatek/platsmp.c
new file mode 100644
index 000..8141f3f
--- /dev/null
+++ b/arch/arm/mach-mediatek/platsmp.c
@@ -0,0 +1,141 @@
+/*
+ * arch/arm/mach-mediatek/platsmp.c
+ *
+ * Copyright (c) 2014 Mediatek Inc.
+ * Author: Shunli Wang 
+ * Yingjoe Chen 
+ *
+ * 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.
+ *
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define MTK_MAX_CPU8
+#define MTK_SMP_REG_SIZE   0x1000
+
+struct mtk_smp_boot_info {
+   unsigned long smp_base;
+   unsigned int jump_reg;
+   unsigned int core_keys[MTK_MAX_CPU - 1];
+   unsigned int core_regs[MTK_MAX_CPU - 1];
+};
+
+static const struct mtk_smp_boot_info mtk_mt8135_tz_boot = {
+   0x80002000, 0x3fc,
+   { 0x534c4131, 0x4c415332, 0x41534c33 },
+   { 0x3f8, 0x3f8, 0x3f8 },
+};
+
+static const struct mtk_smp_boot_info mtk_mt6589_boot = {
+   0x10002000, 0x34,
+   { 0x534c4131, 0x4c415332, 0x41534c33 },
+   { 0x38, 0x3c, 0x40 },
+};
+
+static const struct of_device_id mtk_tz_smp_boot_infos[] __initconst = {
+   { .compatible   = "mediatek,mt8135", .data = _mt8135_tz_boot },
+   { .compatible   = "mediatek,mt8127", .data = _mt8135_tz_boot },
+};
+
+static const struct of_device_id mtk_smp_boot_infos[] __initconst = {
+   { .compatible   = "mediatek,mt6589", .data = _mt6589_boot },
+};
+
+static void __iomem *mtk_smp_base;
+static const struct mtk_smp_boot_info *mtk_smp_info;
+
+static int mtk_boot_secondary(unsigned int cpu, struct task_struct *idle)
+{
+   if (!mtk_smp_base)
+   return -EINVAL;
+
+   if (!mtk_smp_info->core_keys[cpu-1])
+   return -EINVAL;
+
+   writel_relaxed(mtk_smp_info->core_keys[cpu-1],
+   mtk_smp_base + mtk_smp_info->core_regs[cpu-1]);
+
+   arch_send_wakeup_ipi_mask(cpumask_of(cpu));
+
+   return 0;
+}
+
+static void __init __mtk_smp_prepare_cpus(unsigned int max_cpus, int trustzone)
+{
+   int i, num;
+   const struct of_device_id *infos;
+
+   if (trustzone) {
+   num = ARRAY_SIZE(mtk_tz_smp_boot_infos);
+   infos = mtk_tz_smp_boot_infos;
+   } else {
+   num = ARRAY_SIZE(mtk_smp_boot_infos);
+   infos = mtk_smp_boot_infos;
+   }
+
+   /* Find smp boot info for this SoC */
+   for (i = 0; i < num; i++) {
+   if (of_machine_is_compatible(infos[i].compatible)) {
+   mtk_smp_info = infos[i].data;
+   break;
+   }
+   }
+
+   if (!mtk_smp_info) {
+   pr_err("%s: Device is not supported\n", __func__);
+   return;
+   }
+
+   if (trustzone) {
+   /* smp_base(trustzone-bootinfo) is reserved by device tree */
+   mtk_smp_base = phys_to_virt(mtk_smp_info->smp_base);
+   } else {
+   mtk_smp_base = ioremap(mtk_smp_info->smp_base, 
MTK_SMP_REG_SIZE);
+   if (!mtk_smp_base) {
+   pr_err("%s: Can't remap %lx\n", __func__,
+   mtk_smp_info->smp_base);
+   return;
+   }
+   }
+
+   /*
+* write the address of slave startup address into the system-wide
+* jump register
+*/
+   writel_relaxed(virt_to_phys(secondary_startup_arm),
+   mtk_smp_base + mtk_smp_info->jump_reg);
+}
+
+static void __init mtk_tz_smp_prepare_cpus(unsigned int max_cpus)
+{
+   __mtk_smp_prepare_cpus(max_cpus, 1);
+}
+
+static void __init mtk_smp_prepare_cpus(unsigned int max_cpus)
+{
+   __mtk_smp_prepare_cpus(max_cpus, 0);
+}
+
+static struct smp_operations mt81xx_tz_smp_ops __initdata = {
+   .smp_prepare_cpus = mtk_tz_smp_prepare_cpus,
+   .smp_boot_secondary = mtk_boot_secondary,
+};
+CPU_METHOD_OF_DECLARE(mt81xx_tz_smp, "mediatek,mt81xx-tz-smp", 

[PATCH v4 1/5] ARM: mediatek: enable gpt6 on boot up to make arch timer working

2015-09-24 Thread Yingjoe Chen
From: Matthias Brugger 

We enable GTP6 which ungates the arch timer clock.
In the future this should be done in the bootloader.

Signed-off-by: Matthias Brugger 
Signed-off-by: Yingjoe Chen 
---
 arch/arm/mach-mediatek/mediatek.c | 27 +++
 1 file changed, 27 insertions(+)

diff --git a/arch/arm/mach-mediatek/mediatek.c 
b/arch/arm/mach-mediatek/mediatek.c
index a954900..19dc738 100644
--- a/arch/arm/mach-mediatek/mediatek.c
+++ b/arch/arm/mach-mediatek/mediatek.c
@@ -16,6 +16,32 @@
  */
 #include 
 #include 
+#include 
+#include 
+#include 
+
+
+#define GPT6_CON_MT65xx 0x10008060
+#define GPT_ENABLE  0x31
+
+static void __init mediatek_timer_init(void)
+{
+   void __iomem *gpt_base;
+
+   if (of_machine_is_compatible("mediatek,mt6589") ||
+   of_machine_is_compatible("mediatek,mt8135") ||
+   of_machine_is_compatible("mediatek,mt8127")) {
+   /* turn on GPT6 which ungates arch timer clocks */
+   gpt_base = ioremap(GPT6_CON_MT65xx, 0x04);
+
+   /* enable clock and set to free-run */
+   writel(GPT_ENABLE, gpt_base);
+   iounmap(gpt_base);
+   }
+
+   of_clk_init(NULL);
+   clocksource_of_init();
+};
 
 static const char * const mediatek_board_dt_compat[] = {
"mediatek,mt6589",
@@ -27,4 +53,5 @@ static const char * const mediatek_board_dt_compat[] = {
 
 DT_MACHINE_START(MEDIATEK_DT, "Mediatek Cortex-A7 (Device Tree)")
.dt_compat  = mediatek_board_dt_compat,
+   .init_time  = mediatek_timer_init,
 MACHINE_END
-- 
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 v4 0/5] Add SMP bringup support for mt65xx socs

2015-09-24 Thread Yingjoe Chen
This series add SMP brinup support for MediaTek SoCs. This is v4 and
is based on v4.3-rc1.

There are similar but different SMP bringup up methods on MediaTek
mt65xx and mt81xx. On MT8135 & MT8127, system boots with a trustzone
firmware. Others, like MT6589, doesn't have trustzone, and run kernel
directly in secure world.

Patch 1 enable arch timer support.
Patch 2,3 add support for cpu enable-method "mediatek,mt6589-smp" and
"mediatek,mt81xx-tz-smp", which support Mediatek SMP bringup for non-TZ
and TZ platform.
Patch 4,5 finally enable SMP bringup for mt8135 and mt8127.

Changes in v4:
- rebase to v4.3-rc1
- Reserve trustzone bootinfo memory area in device tree.

Changes in v3:
- v3 in [1]
- The first 2 patches in v2 are merged in v4.2-rc1.
- Patch 3~4 in v2 are moved to another series [2]
- platsmp.c changes based on Stephen's suggestion
- Change cpu enable-method name to "mediatek,mt6589-smp"

Changes in v2:
- Fix boot issue for THUMB2 kernel.
- Not enable GPT_CLK_EVT when setup to fix GPT spurious interrupt issue
- Change platsmp.c according to Matthias' suggestion
http://lists.infradead.org/pipermail/linux-mediatek/2015-May/000714.html

v1:
http://lists.infradead.org/pipermail/linux-mediatek/2015-May/000528.html

[1]
http://lists.infradead.org/pipermail/linux-mediatek/2015-July/001570.html

[2]
http://lists.infradead.org/pipermail/linux-mediatek/2015-July/001544.html

Matthias Brugger (1):
  ARM: mediatek: enable gpt6 on boot up to make arch timer working

Yingjoe Chen (4):
  devicetree: bindings: add new SMP enable method Mediatek SoC
  ARM: mediatek: add smp bringup code
  ARM: dts: mt8135: enable basic SMP bringup for mt8135
  ARM: dts: mt8127: enable basic SMP bringup for mt8127

 Documentation/devicetree/bindings/arm/cpus.txt |   2 +
 arch/arm/boot/dts/mt8127.dtsi  |  27 +
 arch/arm/boot/dts/mt8135.dtsi  |  27 +
 arch/arm/mach-mediatek/Makefile|   3 +
 arch/arm/mach-mediatek/mediatek.c  |  27 +
 arch/arm/mach-mediatek/platsmp.c   | 141 +
 6 files changed, 227 insertions(+)
 create mode 100644 arch/arm/mach-mediatek/platsmp.c

-- 
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: No more new fbdev drivers, please

2015-09-24 Thread Alex Deucher
On Thu, Sep 24, 2015 at 11:21 AM, Austin S Hemmelgarn
 wrote:
> On 2015-09-24 08:46, Thomas Petazzoni wrote:
>>
>> Hello,
>>
>> On Thu, 24 Sep 2015 15:27:01 +0300, Tomi Valkeinen wrote:
>>
>>> fbdev is (more or less) maintained, but it's a deprecated framework. All
>>> new Linux display drivers should be done on DRM.
>>>
>>> So let's not add any more new fbdev drivers.
>>>
>>> I will continue to maintain the current fbdev drivers, and I don't mind
>>> adding some new features to those current drivers, as long as the amount
>>> of code required to add the features stays sensible.
>>>
>>> I see we have three fbdev drivers in staging: xgifb, fbtft and sm750fb,
>>> and the question is what to do with those.
>>>
>>> xgifb was added in 2010, and is still in staging.
>>>
>>> fbtft looks like maybe some kind of framework on top of fbdev, with
>>> fbtft specific subdrivers... I didn't look at it in detail, but my gut
>>> says "never".
>>
>>
>> fbtft mainly drives some very simple I2C-based or SPI-based displays,
>> and DRM is I believe overkill for such displays. Last time I talked
>> with Laurent Pinchart about such drivers, I believe he said that such
>> simple drivers could probably continue to use the fbdev subsystem.
>
> I have to agree, using DRM _really_ doesn't make sense for these, the
> devices in question are (AFAIK) simple I2C or SPI connected frame-buffer
> chips that are hooked up to equally simple TFT displays.  There's no 3d
> acceleration at all from what I can tell, there's _very_ limited 2d
> acceleration, and most of the stuff that the DRM framework provides
> call-backs for would have to be done on the CPU anyway.

Just about all of the acceleration stuff is vendor specific so there's
really nothing you need to provide.  As Daniel noted there are several
drm drivers for simple devices that do not support any kind of 2D or
3D acceleration.  There are no requirements to provide any sort of
acceleration.

Alex
--
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/5] drm: omapdrm: tiler: Fix module autoload for OF platform driver

2015-09-24 Thread Luis de Bethencourt
On Thu, Sep 24, 2015 at 01:41:56PM +0300, Tomi Valkeinen wrote:
> 
> On 17/09/15 17:21, Luis de Bethencourt wrote:
> > This platform driver has a OF device ID table but the OF module
> > alias information is not created so module autoloading won't work.
> > 
> > Signed-off-by: Luis de Bethencourt 
> > ---
> >  drivers/gpu/drm/omapdrm/omap_dmm_tiler.c | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c 
> > b/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c
> > index 7841970..ecbc9e5 100644
> > --- a/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c
> > +++ b/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c
> > @@ -1014,6 +1014,7 @@ static const struct of_device_id dmm_of_match[] = {
> > },
> > {},
> >  };
> > +MODULE_DEVICE_TABLE(of, dmm_of_match);
> >  #endif
> >  
> >  struct platform_driver omap_dmm_driver = {
> 
> I think this one is not needed.
> 
> Tiler cannot be compiled as a module. Or, to be more exact, the tiler
> driver is included in the omapdrm module, along with the main omapdrm
> driver, which can be a module.
> 
> The autoloading should happen via omapdrm, and when that happens, tiler
> driver comes along.
> 
>  Tomi
> 

Hi Tomi,

I am a bit confused.

So how the OMAP DRM auto loading is supposed to work when using Device Trees?
As far as I can tell, the main omap drm driver does not have a OF device ID
table and a .of_match it only has a MODULE_ALIAS("platform:" DRIVER_NAME),
but the tiler driver (that is built-in the omap drm driver) does have a a
OF device ID table and I see in DTS that are device nodes using those compatible
strings

$ git grep omap4-dmm arch/arm/boot/dts/omap*
arch/arm/boot/dts/omap4.dtsi:   compatible = "ti,omap4-dmm";

Does that mean there is no need for MODULE_ALIAS("platform:" DMM_DRIVER_NAME)?

Because right now omapdrm.ko is exporting the alias for legacy / platform
device registration but not for OF.

Thanks,
Luis
--
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] acpi-dma: Add support for "dma-names" device property

2015-09-24 Thread Vinod Koul
On Mon, Sep 14, 2015 at 05:37:36PM +0300, Mika Westerberg wrote:
> The current implementation hard codes the two supported channels so that
> "tx" is always 0 and "rx" is always 1. This is because there has been no
> suitable way in ACPI to name resources.
> 
> With _DSD device properties we can finally do this:
> 
>   Device (SPI1) {
>   Name (_CRS, ResourceTemplate () {
>   ...
>   FixedDMA (0x, 0x, Width32bit)
>   FixedDMA (0x0001, 0x0001, Width32bit)
>   })
> 
>   Name (_DSD, Package () {
>   ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
>   Package () {
>   Package () {"dma-names", Package () {"tx", "rx"}}
>   },
>   })
>   }
> 
> The names "tx" and "rx" now provide index of the FixedDMA resource in
> question.
> 
> Modify acpi_dma_request_slave_chan_by_name() so that it looks for
> "dma-names" property first and only then fall back using hardcoded indices.
> 
> The DT "dma-names" binding that we reuse for ACPI is documented in
> Documentation/devicetree/bindings/dma/dma.txt.

Acked-by: Vinod Koul 

This is actually good and will help a lot. Btw would like to see some
tested-by tags, perhaps on dw dma or idma...

-- 
~Vinod
--
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] perf record: Limit --intr-regs to platforms supporting PERF_REGS

2015-09-24 Thread Stephane Eranian
On Thu, Sep 24, 2015 at 5:57 AM, Jiri Olsa  wrote:
>
> On Thu, Sep 24, 2015 at 05:41:58PM +0530, Naveen N. Rao wrote:
> > perf build currently fails on powerpc:
> >
> >   LINK perf
> > libperf.a(libperf-in.o):(.toc+0x120): undefined reference to
> > `sample_reg_masks'
> > libperf.a(libperf-in.o):(.toc+0x130): undefined reference to
> > `sample_reg_masks'
> > collect2: error: ld returned 1 exit status
> > make[1]: *** [perf] Error 1
> > make: *** [all] Error 2
> >
> > This is due to parse-regs-options.c using sample_reg_masks, which is
> > defined only with CONFIG_PERF_REGS.
> >
> > In addition, perf record -I is only useful if the arch supports
> > PERF_REGS. Hence, let's expose -I conditionally.
> >
> > Signed-off-by: Naveen N. Rao 
>
> hum, I wonder why we have sample_reg_masks defined as weak in util/perf_regs.c
> which is also built only via CONFIG_PERF_REGS
>
> I wonder we could get rid of the weak definition via attached patch, Stephane?
>
But the whole point of having it weak is to avoid this error scenario
on any arch without support
and avoid ugly #ifdef HAVE_ in generic files.

if perf_regs.c is compiled on PPC, then why do we get the undefined?

>
>
> anyway this looks ok
>
> Acked-by: Jiri Olsa 
>
> thanks,
> jirka
>
>
> ---
> diff --git a/tools/perf/arch/x86/util/Build b/tools/perf/arch/x86/util/Build
> index ff63649fa9ac..e5627b3d1bb8 100644
> --- a/tools/perf/arch/x86/util/Build
> +++ b/tools/perf/arch/x86/util/Build
> @@ -2,7 +2,7 @@ libperf-y += header.o
>  libperf-y += tsc.o
>  libperf-y += pmu.o
>  libperf-y += kvm-stat.o
> -libperf-y += perf_regs.o
> +libperf-$(CONFIG_PERF_REGS) += perf_regs.o
>
>  libperf-$(CONFIG_DWARF) += dwarf-regs.o
>
> diff --git a/tools/perf/util/perf_regs.c b/tools/perf/util/perf_regs.c
> index 885e8ac83997..43168fb0d9a2 100644
> --- a/tools/perf/util/perf_regs.c
> +++ b/tools/perf/util/perf_regs.c
> @@ -2,10 +2,6 @@
>  #include "perf_regs.h"
>  #include "event.h"
>
> -const struct sample_reg __weak sample_reg_masks[] = {
> -   SMPL_REG_END
> -};
> -
>  int perf_reg_value(u64 *valp, struct regs_dump *regs, int id)
>  {
> int i, idx = 0;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] linux-firmware: Add qmss accumulator pdsp firmware for keystone SoCs

2015-09-24 Thread Kyle McMartin
On Tue, Sep 15, 2015 at 02:54:37PM -0400, Murali Karicheri wrote:
> This patch adds firmware for Keystone QMSS Accumulator PDSP. This is required
> to support Accumulator queues. Accumulator queues are one of the queue types
> supported in drivers/soc/ti/knav_qmss_acc.c. This queue can be part of a
> channel that supports one queue or multiple queue per channel and are managed
> by the Accumulator PDSP. For more details on hardware, please refer
> http://www.ti.com/lit/ug/sprugr9h/sprugr9h.pdf and DT documentation below in
> linux kernel source tree
> 
> Documentation/devicetree/bindings/soc/ti/keystone-navigator-qmss.txt
> 
> Signed-off-by: Murali Karicheri 

applied.
--
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] tcp: Use absolute system clock for TCP timestamps

2015-09-24 Thread Florian Westphal
Eric Dumazet  wrote:
> On Thu, Sep 24, 2015 at 7:14 AM, Jovi Zhangwei  wrote:
> > From f455dc3958593250909627474100f6cc5c158a5c Mon Sep 17 00:00:00 2001
> > From: Marek Majkowski 
> > Date: Fri, 11 Sep 2015 06:05:07 -0700
> > Subject: [PATCH] tcp: Use absolute system clock for TCP timestamps
> >
> > Using TCP timestamps is beneficial due for to its purpose in PAWS and when
> > its role when SYN cookies are enabled. In practice though TCP timestamps are
> > often disabled due to being a perceived security issue - they leak Linux
> > system uptime.
> >
> > This patch introduces a kernel option that makes TCP timestamp always return
> > an absolute value derived from a system clock as opposed to jiffies from
> > boot.
> >
> > This patch is based on the approach taken by grsecurity:
> > https://grsecurity.net/~spender/random_timestamp.diff
> >

I did not see the proposed patch because it didn't make this list,
but I do not like the patch linked to above.

With HZ=1000 the clock wraps every 49 days anyway.
If thats is still deemed a problem, then the proposed solution doesn't
help since all this does is add some 'random uptime' when the machine
is booted so remote monitoring will easily give a good approximation of
real uptime.

Really, where is the problem...?

> TCP stack uses tcp_time_stamp internally, we do not want to add
> overhead adding an offset on all places.
> 
> tp->lsndtime is an example, but we have others.
> 
> Therefore, I suggest you add a new function and use it only where needed.

Agreed, the mangling should only be performed when writing ts stamp
into tcp header, and undone when reading ts echo from network.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC v7 26/41] richacl: Apply the file masks to a richacl

2015-09-24 Thread J. Bruce Fields
On Thu, Sep 24, 2015 at 12:14:40AM +0200, Andreas Gruenbacher wrote:
> 2015-09-23 23:05 GMT+02:00 J. Bruce Fields :
> > On Wed, Sep 23, 2015 at 10:40:18PM +0200, Andreas Gruenbacher wrote:
> >> 2015-09-23 22:33 GMT+02:00 J. Bruce Fields :
> >> > The same could be said if there's a group-i-belong-to:rwx::allow entry,
> >> > do we make that exception too?
> >>
> >> We cannot because that would be incorrect for all other group members.
> >
> > OK.  So people have to learn how the group mask works anyway, and now
> > they have to learn a special exception to that rule.
> >
> > I don't like having this exception.  Or making the richacl->v4acl
> > translation dependent on the owner.
> >
> > But I admit it's surprising to that an 0700 mask with
> > "bfields:rwx::allow" ACL denies access to a bfields-owned file.
> 
> I fully understand your point. This kind of acl is one of the the
> first things people will try, and nobody is going to accept when
> access is denied in this case though.
> 
> Things are made worse by the fact that Windows has the concept of
> owner@ or group@ entries for inheritable permissions but not for
> effective ones; it will always produce and expect "bfields:rwx::allow"
> type entries instead of "owner@:rwx::allow" type entries. I'm not sure
> if Samba could bridge that gap.

I guess Samba's only choice on reading an ACL will be to split OWNER@
ACEs into inheritable and effective parts and then replace the "who" on
the latter by the current owner.


On writing do you think it should try to translate ACEs for users
matching the current owner to OWNER@ ACEs, or are you assuming it should
leave those untouched?

Sambas needs here seem most likely to be the determining factor, so I
just want to make sure I understand.

--b.

> The fact that we cannot handle entries for groups the owner is in in a
> similar way is not a big deal; it's not surprising that changing the
> group file mode permission bits affects group entries.
> 
> Thanks,
> Andreas
--
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] page-flags: rectify forward declaration

2015-09-24 Thread Sudip Mukherjee
> > 
> > Also, I'm finding that the patch series introduces a pretty large
> > bisection hole:
> > 
> > include/linux/page-flags.h: In function 'PageYoung':
> > include/linux/page-flags.h:327: error: implicit declaration of function 
> > 'PF_ANY'
> > include/linux/page-flags.h:327: error: invalid type argument of '->' (have 
> > 'int')
> > include/linux/page-flags.h:327: error: invalid type argument of '->' (have 
> > 'int')
> > 
> > which later gets fixed up by
> > page-flags-rectify-forward-declaration.patch.
> How to test this? Should I apply them on top of v4.2 and bisect? And I
> don't see any relation between the first two patches and this patch of
> the series, then how does it fail in bisect? Am I missing something?
> Confused.. :(
> > 
> > Maybe it's time to do a wholesale refactoring of the patchset?
> If this patch is the first in the series will that help?
> And besides I got the auto mail from you that the patch is applied.
> Now totally confused.. :(
Ohhh ..all the time you were talking about Kirill's patch set and I kept
thinking you are mentioning about this patchset. :)

regards
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/


Re: [PATCH 08/15] block, dax, pmem: reference counting infrastructure

2015-09-24 Thread Christoph Hellwig
On Wed, Sep 23, 2015 at 12:41:55AM -0400, Dan Williams wrote:
> Enable DAX to use a reference count for keeping the virtual address
> returned by ->direct_access() valid for the duration of its usage in
> fs/dax.c, or otherwise hold off blk_cleanup_queue() while
> pmem_make_request is active.  The blk-mq code is already in a position
> to need low overhead referece counting for races against request_queue
> destruction (blk_cleanup_queue()).  Given DAX-enabled block drivers do
> not enable blk-mq, share the storage in 'struct request_queue' between
> the two implementations.

Can we just move the refcounting to common code with the same field
name, and even initialize it for non-mq, non-dax queues but just never
tage a reference there (for now)?
--
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: at91/dt: pullup dbgu rx instead of tx

2015-09-24 Thread Peter Rosin
On 2015-09-24 16:47, Alexandre Belloni wrote:
> Hi Peter,
> 
> Thanks for the patch but you actually got beaten by Sylvain:
> http://lists.infradead.org/pipermail/linux-arm-kernel/2015-September/368426.html

Ok, great!

I just noticed that other ports have the same problem in sama5d3.dtsi. E.g.

uart1 {
pinctrl_uart1: uart1-0 {
atmel,pins =
;  /* conflicts with TWCK0, ISI_HSYNC */
};
};

Given that the original bug I found spread all over the map, it seems
like someone was confused when the pull-ups were originally added.
Someone (else?) at Atmel needs to audit this so that pull-ups are
added on the rx-pins instead of the tx-pins.

Cheers,
Peter

> On 24/09/2015 at 16:44:15 +0200, Peter Rosin wrote :
>> From: Peter Rosin 
>>
>> It seems pointless to pullup the tx line, but there is value in pulling
>> up the rx line.
>>
>> Cc: sta...@vger.kernel.org
>> Signed-off-by: Peter Rosin 
>> ---
>>  arch/arm/boot/dts/sama5d3.dtsi |4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/arch/arm/boot/dts/sama5d3.dtsi b/arch/arm/boot/dts/sama5d3.dtsi
>> index 9e2444b07bce..304a40c5552a 100644
>> --- a/arch/arm/boot/dts/sama5d3.dtsi
>> +++ b/arch/arm/boot/dts/sama5d3.dtsi
>> @@ -545,8 +545,8 @@
>>  dbgu {
>>  pinctrl_dbgu: dbgu-0 {
>>  atmel,pins =
>> -> AT91_PERIPH_A AT91_PINCTRL_NONE   /* PB30 periph A */
>> - AT91_PIOB 31 
>> AT91_PERIPH_A AT91_PINCTRL_PULL_UP>;  /* PB31 periph A with pullup */
>> +> AT91_PERIPH_A AT91_PINCTRL_PULL_UP/* PB30 periph A with pullup */
>> + AT91_PIOB 31 
>> AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PB31 periph A */
>>  };
>>  };
>>  
>> -- 
>> 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 v2] usb: gadget: f_sourcesink: fix function params handling

2015-09-24 Thread Robert Baldyga
Move function parameters to struct f_sourcesink to make them per instance
instead of having them as global variables. Since we can have multiple
instances of USB function we also want to have separate set of parameters
for each instance.

Cc:  # 3.10+
Signed-off-by: Robert Baldyga 
---
 drivers/usb/gadget/function/f_sourcesink.c | 120 +++--
 1 file changed, 62 insertions(+), 58 deletions(-)

diff --git a/drivers/usb/gadget/function/f_sourcesink.c 
b/drivers/usb/gadget/function/f_sourcesink.c
index 1353465..128abfb 100644
--- a/drivers/usb/gadget/function/f_sourcesink.c
+++ b/drivers/usb/gadget/function/f_sourcesink.c
@@ -50,6 +50,13 @@ struct f_sourcesink {
struct usb_ep   *iso_in_ep;
struct usb_ep   *iso_out_ep;
int cur_alt;
+
+   unsigned pattern;
+   unsigned isoc_interval;
+   unsigned isoc_maxpacket;
+   unsigned isoc_mult;
+   unsigned isoc_maxburst;
+   unsigned buflen;
 };
 
 static inline struct f_sourcesink *func_to_ss(struct usb_function *f)
@@ -57,13 +64,6 @@ static inline struct f_sourcesink *func_to_ss(struct 
usb_function *f)
return container_of(f, struct f_sourcesink, function);
 }
 
-static unsigned pattern;
-static unsigned isoc_interval;
-static unsigned isoc_maxpacket;
-static unsigned isoc_mult;
-static unsigned isoc_maxburst;
-static unsigned buflen;
-
 /*-*/
 
 static struct usb_interface_descriptor source_sink_intf_alt0 = {
@@ -298,7 +298,9 @@ static struct usb_gadget_strings *sourcesink_strings[] = {
 
 static inline struct usb_request *ss_alloc_ep_req(struct usb_ep *ep, int len)
 {
-   return alloc_ep_req(ep, len, buflen);
+   struct f_sourcesink *ss = ep->driver_data;
+
+   return alloc_ep_req(ep, len, ss->buflen);
 }
 
 void free_ep_req(struct usb_ep *ep, struct usb_request *req)
@@ -357,22 +359,22 @@ autoconf_fail:
goto autoconf_fail;
 
/* sanity check the isoc module parameters */
-   if (isoc_interval < 1)
-   isoc_interval = 1;
-   if (isoc_interval > 16)
-   isoc_interval = 16;
-   if (isoc_mult > 2)
-   isoc_mult = 2;
-   if (isoc_maxburst > 15)
-   isoc_maxburst = 15;
+   if (ss->isoc_interval < 1)
+   ss->isoc_interval = 1;
+   if (ss->isoc_interval > 16)
+   ss->isoc_interval = 16;
+   if (ss->isoc_mult > 2)
+   ss->isoc_mult = 2;
+   if (ss->isoc_maxburst > 15)
+   ss->isoc_maxburst = 15;
 
/* fill in the FS isoc descriptors from the module parameters */
-   fs_iso_source_desc.wMaxPacketSize = isoc_maxpacket > 1023 ?
-   1023 : isoc_maxpacket;
-   fs_iso_source_desc.bInterval = isoc_interval;
-   fs_iso_sink_desc.wMaxPacketSize = isoc_maxpacket > 1023 ?
-   1023 : isoc_maxpacket;
-   fs_iso_sink_desc.bInterval = isoc_interval;
+   fs_iso_source_desc.wMaxPacketSize = ss->isoc_maxpacket > 1023 ?
+   1023 : ss->isoc_maxpacket;
+   fs_iso_source_desc.bInterval = ss->isoc_interval;
+   fs_iso_sink_desc.wMaxPacketSize = ss->isoc_maxpacket > 1023 ?
+   1023 : ss->isoc_maxpacket;
+   fs_iso_sink_desc.bInterval = ss->isoc_interval;
 
/* allocate iso endpoints */
ss->iso_in_ep = usb_ep_autoconfig(cdev->gadget, _iso_source_desc);
@@ -394,8 +396,8 @@ no_iso:
ss_source_sink_descs[SS_ALT_IFC_1_OFFSET] = NULL;
}
 
-   if (isoc_maxpacket > 1024)
-   isoc_maxpacket = 1024;
+   if (ss->isoc_maxpacket > 1024)
+   ss->isoc_maxpacket = 1024;
 
/* support high speed hardware */
hs_source_desc.bEndpointAddress = fs_source_desc.bEndpointAddress;
@@ -406,15 +408,15 @@ no_iso:
 * We assume that the user knows what they are doing and won't
 * give parameters that their UDC doesn't support.
 */
-   hs_iso_source_desc.wMaxPacketSize = isoc_maxpacket;
-   hs_iso_source_desc.wMaxPacketSize |= isoc_mult << 11;
-   hs_iso_source_desc.bInterval = isoc_interval;
+   hs_iso_source_desc.wMaxPacketSize = ss->isoc_maxpacket;
+   hs_iso_source_desc.wMaxPacketSize |= ss->isoc_mult << 11;
+   hs_iso_source_desc.bInterval = ss->isoc_interval;
hs_iso_source_desc.bEndpointAddress =
fs_iso_source_desc.bEndpointAddress;
 
-   hs_iso_sink_desc.wMaxPacketSize = isoc_maxpacket;
-   hs_iso_sink_desc.wMaxPacketSize |= isoc_mult << 11;
-   hs_iso_sink_desc.bInterval = isoc_interval;
+   hs_iso_sink_desc.wMaxPacketSize = ss->isoc_maxpacket;
+   hs_iso_sink_desc.wMaxPacketSize |= ss->isoc_mult << 11;
+   hs_iso_sink_desc.bInterval = ss->isoc_interval;

Re: No more new fbdev drivers, please

2015-09-24 Thread Austin S Hemmelgarn

On 2015-09-24 08:46, Thomas Petazzoni wrote:

Hello,

On Thu, 24 Sep 2015 15:27:01 +0300, Tomi Valkeinen wrote:


fbdev is (more or less) maintained, but it's a deprecated framework. All
new Linux display drivers should be done on DRM.

So let's not add any more new fbdev drivers.

I will continue to maintain the current fbdev drivers, and I don't mind
adding some new features to those current drivers, as long as the amount
of code required to add the features stays sensible.

I see we have three fbdev drivers in staging: xgifb, fbtft and sm750fb,
and the question is what to do with those.

xgifb was added in 2010, and is still in staging.

fbtft looks like maybe some kind of framework on top of fbdev, with
fbtft specific subdrivers... I didn't look at it in detail, but my gut
says "never".


fbtft mainly drives some very simple I2C-based or SPI-based displays,
and DRM is I believe overkill for such displays. Last time I talked
with Laurent Pinchart about such drivers, I believe he said that such
simple drivers could probably continue to use the fbdev subsystem.
I have to agree, using DRM _really_ doesn't make sense for these, the 
devices in question are (AFAIK) simple I2C or SPI connected frame-buffer 
chips that are hooked up to equally simple TFT displays.  There's no 3d 
acceleration at all from what I can tell, there's _very_ limited 2d 
acceleration, and most of the stuff that the DRM framework provides 
call-backs for would have to be done on the CPU anyway.  On top of that, 
it's targeted at small embedded systems with limited memory, and the DRM 
framework is by no-means lightweight (TBH, fbdev isn't really either, 
but it's much more light weight than DRM).





smime.p7s
Description: S/MIME Cryptographic Signature


Re: No more new fbdev drivers, please

2015-09-24 Thread Daniel Vetter
On Thu, Sep 24, 2015 at 02:46:21PM +0200, Thomas Petazzoni wrote:
> Hello,
> 
> On Thu, 24 Sep 2015 15:27:01 +0300, Tomi Valkeinen wrote:
> 
> > fbdev is (more or less) maintained, but it's a deprecated framework. All
> > new Linux display drivers should be done on DRM.
> > 
> > So let's not add any more new fbdev drivers.
> > 
> > I will continue to maintain the current fbdev drivers, and I don't mind
> > adding some new features to those current drivers, as long as the amount
> > of code required to add the features stays sensible.
> > 
> > I see we have three fbdev drivers in staging: xgifb, fbtft and sm750fb,
> > and the question is what to do with those.
> > 
> > xgifb was added in 2010, and is still in staging.
> > 
> > fbtft looks like maybe some kind of framework on top of fbdev, with
> > fbtft specific subdrivers... I didn't look at it in detail, but my gut
> > says "never".
> 
> fbtft mainly drives some very simple I2C-based or SPI-based displays,
> and DRM is I believe overkill for such displays. Last time I talked
> with Laurent Pinchart about such drivers, I believe he said that such
> simple drivers could probably continue to use the fbdev subsystem.
> 
> Or are there some plans to make the writing of DRM drivers for very
> simple/trivial devices a bit simpler?

Since years I'm trying to sell someone on implementing support for
drm_simple_outputs which would collapse the crtc->encoder->connector
chain into 1 entity. Would be trivial to implement and then trivial to
write simple drivers on top of that. And besides that drm already has
piles of reallly simple drivers with just one output and one framebuffer.

There's no reason not to use drm for gfx drivers at all.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
--
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/


[v3 3/8] dpaa_eth: add support for S/G frames

2015-09-24 Thread Madalin Bucur
Add support for Scater/Gather (S/G) frames. The FMan can place
the frame content into multiple buffers and provide a S/G Table
(SGT) into one first buffer with references to the others.

Signed-off-by: Madalin Bucur 
---
 drivers/net/ethernet/freescale/dpaa/dpaa_eth.c |   6 +
 .../net/ethernet/freescale/dpaa/dpaa_eth_common.c  |  47 ++-
 .../net/ethernet/freescale/dpaa/dpaa_eth_common.h  |   2 +
 drivers/net/ethernet/freescale/dpaa/dpaa_eth_sg.c  | 335 +++--
 4 files changed, 370 insertions(+), 20 deletions(-)

diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c 
b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
index 2a886d6..85e2bdf 100644
--- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
+++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
@@ -466,6 +466,12 @@ static int dpa_private_netdev_init(struct net_device 
*net_dev)
net_dev->hw_features |= (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
NETIF_F_LLTX);
 
+   /* Advertise S/G and HIGHDMA support for private interfaces */
+   net_dev->hw_features |= NETIF_F_SG | NETIF_F_HIGHDMA;
+   /* Recent kernels enable GSO automatically, if
+* we declare NETIF_F_SG. For conformity, we'll
+* still declare GSO explicitly.
+*/
net_dev->features |= NETIF_F_GSO;
 
return dpa_netdev_init(net_dev, mac_addr, tx_timeout);
diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth_common.c 
b/drivers/net/ethernet/freescale/dpaa/dpaa_eth_common.c
index 3ab228f..b36cbca 100644
--- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth_common.c
+++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth_common.c
@@ -1177,6 +1177,35 @@ void dpaa_eth_init_ports(struct mac_device *mac_dev,
  port_fqs->rx_defq, _layout[RX]);
 }
 
+void dpa_release_sgt(struct qm_sg_entry *sgt)
+{
+   struct dpa_bp *dpa_bp;
+   struct bm_buffer bmb[DPA_BUFF_RELEASE_MAX];
+   u8 i = 0, j;
+
+   memset(bmb, 0, sizeof(bmb));
+
+   do {
+   dpa_bp = dpa_bpid2pool(sgt[i].bpid);
+   DPA_ERR_ON(!dpa_bp);
+
+   j = 0;
+   do {
+   DPA_ERR_ON(sgt[i].extension);
+
+   bmb[j].hi = sgt[i].addr_hi;
+   bmb[j].lo = be32_to_cpu(sgt[i].addr_lo);
+
+   j++; i++;
+   } while (j < ARRAY_SIZE(bmb) &&
+   !sgt[i - 1].final &&
+   sgt[i - 1].bpid == sgt[i].bpid);
+
+   while (bman_release(dpa_bp->pool, bmb, j, 0))
+   cpu_relax();
+   } while (!sgt[i - 1].final);
+}
+
 void dpa_fd_release(const struct net_device *net_dev, const struct qm_fd *fd)
 {
struct qm_sg_entry *sgt;
@@ -1191,7 +1220,23 @@ void dpa_fd_release(const struct net_device *net_dev, 
const struct qm_fd *fd)
dpa_bp = dpa_bpid2pool(fd->bpid);
DPA_ERR_ON(!dpa_bp);
 
-   DPA_ERR_ON(fd->format == qm_fd_sg);
+   if (fd->format == qm_fd_sg) {
+   vaddr = phys_to_virt(fd->addr);
+   sgt = vaddr + dpa_fd_offset(fd);
+
+   dma_unmap_single(dpa_bp->dev, qm_fd_addr(fd), dpa_bp->size,
+DMA_BIDIRECTIONAL);
+
+   dpa_release_sgt(sgt);
+
+   addr = dma_map_single(dpa_bp->dev, vaddr, dpa_bp->size,
+ DMA_BIDIRECTIONAL);
+   if (dma_mapping_error(dpa_bp->dev, addr)) {
+   dev_err(dpa_bp->dev, "DMA mapping failed");
+   return;
+   }
+   bm_buffer_set64(, addr);
+   }
 
while (bman_release(dpa_bp->pool, , 1, 0))
cpu_relax();
diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth_common.h 
b/drivers/net/ethernet/freescale/dpaa/dpaa_eth_common.h
index 68843c0..9df8f14 100644
--- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth_common.h
+++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth_common.h
@@ -37,6 +37,7 @@
 
 #include "dpaa_eth.h"
 
+#define DPA_SGT_MAX_ENTRIES 16 /* maximum number of entries in SG Table */
 #define DPA_BUFF_RELEASE_MAX 8 /* maximum number of buffers released at once */
 
 /* used in napi related functions */
@@ -90,6 +91,7 @@ void dpaa_eth_init_ports(struct mac_device *mac_dev,
 struct fm_port_fqs *port_fqs,
 struct dpa_buffer_layout_s *buf_layout,
 struct device *dev);
+void dpa_release_sgt(struct qm_sg_entry *sgt);
 void dpa_fd_release(const struct net_device *net_dev, const struct qm_fd *fd);
 int dpa_enable_tx_csum(struct dpa_priv_s *priv,
   struct sk_buff *skb,
diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth_sg.c 
b/drivers/net/ethernet/freescale/dpaa/dpaa_eth_sg.c
index 115798b..fd32691 100644
--- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth_sg.c
+++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth_sg.c
@@ -53,6 +53,31 @@
 

Re: [PATCH 2/2] usb: gadget: f_loopfack: fix function params handling

2015-09-24 Thread Robert Baldyga
Hi Felipe,

I see that Krzysztof Opasiak made the same change in patch
https://lkml.org/lkml/2015/9/22/578, so please just ignore my patch.

My first patch is still needed - I will resend it with CC: stable.

Thanks,
Robert Baldyga

On 09/24/2015 05:02 PM, Robert Baldyga wrote:
> Move function parameters to struct f_loopback to make them per instance
> instead of having them as global variables. Since we can have multiple
> instances of USB function we also want to have separate set of parameters
> for each instance.
> 
> Signed-off-by: Robert Baldyga 
> ---
>  drivers/usb/gadget/function/f_loopback.c | 22 --
>  1 file changed, 12 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/usb/gadget/function/f_loopback.c 
> b/drivers/usb/gadget/function/f_loopback.c
> index 300e601..8d2dac8 100644
> --- a/drivers/usb/gadget/function/f_loopback.c
> +++ b/drivers/usb/gadget/function/f_loopback.c
> @@ -34,6 +34,9 @@ struct f_loopback {
>  
>   struct usb_ep   *in_ep;
>   struct usb_ep   *out_ep;
> +
> + unsigned qlen;
> + unsigned buflen;
>  };
>  
>  static inline struct f_loopback *func_to_loop(struct usb_function *f)
> @@ -41,9 +44,6 @@ static inline struct f_loopback *func_to_loop(struct 
> usb_function *f)
>   return container_of(f, struct f_loopback, function);
>  }
>  
> -static unsigned qlen;
> -static unsigned buflen;
> -
>  /*-*/
>  
>  static struct usb_interface_descriptor loopback_intf = {
> @@ -251,7 +251,7 @@ static void loopback_complete(struct usb_ep *ep, struct 
> usb_request *req)
>   }
>  
>   /* queue the buffer for some later OUT packet */
> - req->length = buflen;
> + req->length = loop->buflen;
>   status = usb_ep_queue(ep, req, GFP_ATOMIC);
>   if (status == 0)
>   return;
> @@ -288,7 +288,9 @@ static void disable_loopback(struct f_loopback *loop)
>  
>  static inline struct usb_request *lb_alloc_ep_req(struct usb_ep *ep, int len)
>  {
> - return alloc_ep_req(ep, len, buflen);
> + struct f_loopback   *loop = ep->driver_data;
> +
> + return alloc_ep_req(ep, len, loop->buflen);
>  }
>  
>  static int enable_endpoint(struct usb_composite_dev *cdev, struct f_loopback 
> *loop,
> @@ -315,7 +317,7 @@ static int enable_endpoint(struct usb_composite_dev 
> *cdev, struct f_loopback *lo
>* we buffer at most 'qlen' transfers; fewer if any need more
>* than 'buflen' bytes each.
>*/
> - for (i = 0; i < qlen && result == 0; i++) {
> + for (i = 0; i < loop->qlen && result == 0; i++) {
>   req = lb_alloc_ep_req(ep, 0);
>   if (!req)
>   goto fail1;
> @@ -388,10 +390,10 @@ static struct usb_function *loopback_alloc(struct 
> usb_function_instance *fi)
>   lb_opts->refcnt++;
>   mutex_unlock(_opts->lock);
>  
> - buflen = lb_opts->bulk_buflen;
> - qlen = lb_opts->qlen;
> - if (!qlen)
> - qlen = 32;
> + loop->buflen = lb_opts->bulk_buflen;
> + loop->qlen = lb_opts->qlen;
> + if (!loop->qlen)
> + loop->qlen = 32;
>  
>   loop->function.name = "loopback";
>   loop->function.bind = loopback_bind;
> 

--
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/


[v3 0/8] dpaa_eth: Add the Freescale DPAA Ethernet driver

2015-09-24 Thread Madalin Bucur
This patch series adds the Ethernet driver for the Freescale
QorIQ Data Path Acceleration Architecture (DPAA).

This version includes changes following the feedback received
on previous versions from Eric Dumazet, Bob Cochran, Joe Perches,
Paul Bolle, Joakim Tjernlund, Scott Wood - thank you for your support.

Together with the driver a managed version of alloc_percpu
is provided that simplifies the release of per-CPU memory.

The Freescale DPAA architecture consists in a series of hardware
blocks that support the Ethernet connectivity. The Ethernet driver
depends upon the following drivers that are currently in the Linux
kernel or in review:
 - Peripheral Access Memory Unit (PAMU)
drivers/iommu/fsl_*
 - Frame Manager (FMan)
drivers/net/ethernet/freescale/fman
 - Queue Manager (QMan), Buffer Manager (BMan)
drivers/soc/fsl/qbman

dpaa_eth interfaces mapping to FMan MACs:

  dpaa_eth   /eth0\ ...   /ethN\
  driver|  | |  |
  -      ---      -
   -Ports  / Tx  Rx \.../ Tx  Rx \
  FMan|  | |  |
   -MACs  |   MAC0   | |   MACN   |
 /   dtsec0   \  ...  /   dtsecN   \ (or tgec)
/  \ /  \(or memac)
  -  --  ---  --  -
  FMan, FMan Port, FMan SP, FMan MURAM drivers
  -
  FMan HW blocks: MURAM, MACs, Ports, SP
  -

dpaa_eth relation to QMan, FMan:
  
  dpaa_eth   /eth0\
  driver/  \
  -   -^-   -^-   -^-   ----
  QMan driver / \   / \   / \  \   /  | BMan|
 |Rx | |Rx | |Tx | |Tx |  | driver  |
  -  |Dfl| |Err| |Cnf| |FQs|  | |
  QMan HW|FQ | |FQ | |FQ | |   |  | |
 /   \ /   \ /   \  \ /   | |
  -   ---   ---   ---   -v--
|FMan QMI | |
| FMan HW   FMan BMI  | BMan HW |
  ---   

where the acronyms used above (and in the code) are:
DPAA = Data Path Acceleration Architecture
FMan = DPAA Frame Manager
QMan = DPAA Queue Manager
BMan = DPAA Buffers Manager
QMI = QMan interface in FMan
BMI = BMan interface in FMan
FMan SP = FMan Storage Profiles
MURAM = Multi-user RAM in FMan
FQ = QMan Frame Queue
Rx Dfl FQ = default reception FQ
Rx Err FQ = Rx error frames FQ
Tx Cnf FQ = Tx confirmation FQ
Tx FQs = transmission frame queues
dtsec = datapath three speed Ethernet controller (10/100/1000 Mbps)
tgec = ten gigabit Ethernet controller (10 Gbps)
memac = multirate Ethernet MAC (10/100/1000/1)

The latest FMan driver patches were submitted by Igal Liberman:
https://patchwork.ozlabs.org/project/netdev/list/?submitter=64715=*=[v5,

The latest Q/BMan drivers were submitted by Roy Pledge:
https://patchwork.ozlabs.org/project/linuxppc-dev/list/?submitter=66331=*

Changes from v2:
 - removed debugfs, moved exports to ethtool statistics
 - removed congestion groups Kconfig params

Changes from v1:
 - bpool level Kconfig options removed
 - print format using pr_fmt, cleaned up prints
 - __hot/__cold removed
 - gratuitous unlikely() removed
 - code style aligned, consistent spacing for declarations
 - comment formatting

The complete patch set based on the latest net-next/master kernel
can be found in the public git at:
http://git.freescale.com/git/cgit.cgi/ppc/upstream/linux.git
under the tag ldup_public_git_20150924:
http://git.freescale.com/git/cgit.cgi/ppc/upstream/linux.git/log/?h=ldup_public_git_20150924

There is one patch that needs to be applied to u-boot to align it
to the latest device tree binding document specification used by
the FMan driver. Please make sure your u-boot includes this patch.
The patch is marked as accepted in u-boot patchwork:
https://patchwork.ozlabs.org/patch/508374/
Alternatively you can find it in the Freescale public git under the
ldup_public_git_20150410 tag at:
http://git.freescale.com/git/cgit.cgi/ppc/upstream/u-boot.git/log/?h=ldup_public_git_20150410

Madalin Bucur (8):
  devres: add devm_alloc_percpu()
  dpaa_eth: add support for DPAA Ethernet
  dpaa_eth: add support for S/G frames
  dpaa_eth: add driver's Tx queue selection mechanism
  dpaa_eth: add ethtool functionality
  dpaa_eth: add ethtool statistics
  dpaa_eth: add sysfs exports
  dpaa_eth: add trace points

 Documentation/driver-model/devres.txt  |4 +
 drivers/base/devres.c  |   64 +
 drivers/net/ethernet/freescale/Kconfig |2 +
 drivers/net/ethernet/freescale/Makefile|1 +
 drivers/net/ethernet/freescale/dpaa/Kconfig|   32 +
 drivers/net/ethernet/freescale/dpaa/Makefile   |   12 +
 

[v3 4/8] dpaa_eth: add driver's Tx queue selection mechanism

2015-09-24 Thread Madalin Bucur
Allow the selection of the transmission queue based on the CPU id.

Signed-off-by: Madalin Bucur 
---
 drivers/net/ethernet/freescale/dpaa/Kconfig   | 10 ++
 drivers/net/ethernet/freescale/dpaa/dpaa_eth.c|  3 +++
 drivers/net/ethernet/freescale/dpaa/dpaa_eth.h|  6 ++
 drivers/net/ethernet/freescale/dpaa/dpaa_eth_common.c |  8 
 drivers/net/ethernet/freescale/dpaa/dpaa_eth_common.h |  4 
 5 files changed, 31 insertions(+)

diff --git a/drivers/net/ethernet/freescale/dpaa/Kconfig 
b/drivers/net/ethernet/freescale/dpaa/Kconfig
index 022d5aa..2577aac 100644
--- a/drivers/net/ethernet/freescale/dpaa/Kconfig
+++ b/drivers/net/ethernet/freescale/dpaa/Kconfig
@@ -11,6 +11,16 @@ menuconfig FSL_DPAA_ETH
 
 if FSL_DPAA_ETH
 
+config FSL_DPAA_ETH_USE_NDO_SELECT_QUEUE
+   bool "Use driver's Tx queue selection mechanism"
+   default y
+   ---help---
+ The DPAA Ethernet driver defines a ndo_select_queue() callback for 
optimal selection
+ of the egress FQ. That will override the XPS support for this 
netdevice.
+ If for whatever reason you want to be in control of the egress 
FQ-to-CPU selection and mapping,
+ or simply don't want to use the driver's ndo_select_queue() callback, 
then unselect this
+ and use the standard XPS support instead.
+
 config FSL_DPAA_ETH_FRIENDLY_IF_NAME
bool "Use fmX-macY names for the DPAA interfaces"
default y
diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c 
b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
index 85e2bdf..a04c0aa 100644
--- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
+++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
@@ -393,6 +393,9 @@ static const struct net_device_ops dpa_private_ops = {
.ndo_get_stats64 = dpa_get_stats64,
.ndo_set_mac_address = dpa_set_mac_address,
.ndo_validate_addr = eth_validate_addr,
+#ifdef CONFIG_FSL_DPAA_ETH_USE_NDO_SELECT_QUEUE
+   .ndo_select_queue = dpa_select_queue,
+#endif
.ndo_change_mtu = dpa_change_mtu,
.ndo_set_rx_mode = dpa_set_rx_mode,
.ndo_init = dpa_ndo_init,
diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.h 
b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.h
index 96553fd..349e052 100644
--- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.h
+++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.h
@@ -419,9 +419,15 @@ static inline void _dpa_assign_wq(struct dpa_fq *fq)
}
 }
 
+#ifdef CONFIG_FSL_DPAA_ETH_USE_NDO_SELECT_QUEUE
+/* Use in lieu of skb_get_queue_mapping() */
+#define dpa_get_queue_mapping(skb) \
+   raw_smp_processor_id()
+#else
 /* Use the queue selected by XPS */
 #define dpa_get_queue_mapping(skb) \
skb_get_queue_mapping(skb)
+#endif
 
 static inline void _dpa_bp_free_pf(void *addr)
 {
diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth_common.c 
b/drivers/net/ethernet/freescale/dpaa/dpaa_eth_common.c
index b36cbca..89f3b1f 100644
--- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth_common.c
+++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth_common.c
@@ -593,6 +593,14 @@ bool dpa_bpid2pool_use(int bpid)
return false;
 }
 
+#ifdef CONFIG_FSL_DPAA_ETH_USE_NDO_SELECT_QUEUE
+u16 dpa_select_queue(struct net_device *net_dev, struct sk_buff *skb,
+void *accel_priv, select_queue_fallback_t fallback)
+{
+   return dpa_get_queue_mapping(skb);
+}
+#endif
+
 struct dpa_fq *dpa_fq_alloc(struct device *dev,
const struct fqid_cell *fqids,
struct list_head *list,
diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth_common.h 
b/drivers/net/ethernet/freescale/dpaa/dpaa_eth_common.h
index 9df8f14..2e9471d 100644
--- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth_common.h
+++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth_common.h
@@ -70,6 +70,10 @@ struct dpa_bp *dpa_bpid2pool(int bpid);
 void dpa_bpid2pool_map(int bpid, struct dpa_bp *dpa_bp);
 bool dpa_bpid2pool_use(int bpid);
 void dpa_bp_drain(struct dpa_bp *bp);
+#ifdef CONFIG_FSL_DPAA_ETH_USE_NDO_SELECT_QUEUE
+u16 dpa_select_queue(struct net_device *net_dev, struct sk_buff *skb,
+void *accel_priv, select_queue_fallback_t fallback);
+#endif
 struct dpa_fq *dpa_fq_alloc(struct device *dev,
const struct fqid_cell *fqids,
struct list_head *list,
-- 
1.7.11.7

--
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/


[v3 7/8] dpaa_eth: add sysfs exports

2015-09-24 Thread Madalin Bucur
Export Frame Queue and Buffer Pool IDs through sysfs.

Signed-off-by: Madalin Bucur 
---
 drivers/net/ethernet/freescale/dpaa/Makefile   |   2 +-
 drivers/net/ethernet/freescale/dpaa/dpaa_eth.c |   2 +
 drivers/net/ethernet/freescale/dpaa/dpaa_eth.h |   3 +
 .../net/ethernet/freescale/dpaa/dpaa_eth_common.c  |   2 +
 .../net/ethernet/freescale/dpaa/dpaa_eth_sysfs.c   | 167 +
 5 files changed, 175 insertions(+), 1 deletion(-)
 create mode 100644 drivers/net/ethernet/freescale/dpaa/dpaa_eth_sysfs.c

diff --git a/drivers/net/ethernet/freescale/dpaa/Makefile 
b/drivers/net/ethernet/freescale/dpaa/Makefile
index 9b75d52..141ade4 100644
--- a/drivers/net/ethernet/freescale/dpaa/Makefile
+++ b/drivers/net/ethernet/freescale/dpaa/Makefile
@@ -8,4 +8,4 @@ ccflags-y += -I$(FMAN)
 
 obj-$(CONFIG_FSL_DPAA_ETH) += fsl_dpa.o
 
-fsl_dpa-objs += dpaa_eth.o dpaa_eth_sg.o dpaa_eth_common.o dpaa_ethtool.o
+fsl_dpa-objs += dpaa_eth.o dpaa_eth_sg.o dpaa_eth_common.o dpaa_ethtool.o 
dpaa_eth_sysfs.o
diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c 
b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
index d0d3d80..6d241a3 100644
--- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
+++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
@@ -759,6 +759,8 @@ dpaa_eth_priv_probe(struct platform_device *pdev)
if (err < 0)
goto netdev_init_failed;
 
+   dpaa_eth_sysfs_init(_dev->dev);
+
pr_info("Probed interface %s\n", net_dev->name);
 
return 0;
diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.h 
b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.h
index 629ccb8..a16119e 100644
--- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.h
+++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.h
@@ -370,6 +370,9 @@ static inline u16 dpa_get_headroom(struct 
dpa_buffer_layout_s *bl)
return bl->data_align ? ALIGN(headroom, bl->data_align) : headroom;
 }
 
+void dpaa_eth_sysfs_remove(struct device *dev);
+void dpaa_eth_sysfs_init(struct device *dev);
+
 void dpa_private_napi_del(struct net_device *net_dev);
 
 static inline void clear_fd(struct qm_fd *fd)
diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth_common.c 
b/drivers/net/ethernet/freescale/dpaa/dpaa_eth_common.c
index 4947cb9..2cf4565 100644
--- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth_common.c
+++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth_common.c
@@ -299,6 +299,8 @@ int dpa_remove(struct platform_device *pdev)
 
priv = netdev_priv(net_dev);
 
+   dpaa_eth_sysfs_remove(dev);
+
dev_set_drvdata(dev, NULL);
unregister_netdev(net_dev);
 
diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth_sysfs.c 
b/drivers/net/ethernet/freescale/dpaa/dpaa_eth_sysfs.c
new file mode 100644
index 000..a6c71b1
--- /dev/null
+++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth_sysfs.c
@@ -0,0 +1,167 @@
+/* Copyright 2008-2015 Freescale Semiconductor Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ *  notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ * * Neither the name of Freescale Semiconductor nor the
+ *  names of its contributors may be used to endorse or promote products
+ *  derived from this software without specific prior written permission.
+ *
+ *
+ * ALTERNATIVELY, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") as published by the Free Software
+ * Foundation, either version 2 of that License or (at your option) any
+ * later version.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 
THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include "dpaa_eth.h"
+#include "mac.h"
+
+static ssize_t dpaa_eth_show_addr(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+   struct dpa_priv_s *priv = 

[RFC] futex: prevent endless loop on s390x with emulated hugepages

2015-09-24 Thread Vlastimil Babka
Yong Sun has reported the LTP futex_wake04 test to hang a s390x with our
kernel based on 3.12. This is reproducible on upstream 4.1.8 as well. 4.2+
is OK thanks to removal of emulated hugepages, but we should do something
about the stable kernels here.

The LTP test is a regression test for commit 13d60f4b6a ("futex: Take
hugepages into account when generating futex_key"), but it turns out that it's
sufficient to just attempt to wait for a single futex on a tail page of a
hugetlbfs page:

 BEGIN REPRODUCER 

static struct timespec to = {.tv_sec = 1, .tv_nsec = 0};

int main(int argc, char *argv[])
{
void *addr;
int hpsz = 1024*1024;
int pgsz = 4096;
int * futex1;

addr = mmap(NULL, hpsz, PROT_WRITE | PROT_READ,
MAP_SHARED | MAP_ANONYMOUS | MAP_HUGETLB, -1, 0);

if (addr == MAP_FAILED) {
perror("mmap()");
return 1;
}

futex1 = (int *)((char *)addr + pgsz);
*futex1 = 0;

syscall(SYS_futex, futex1, FUTEX_WAIT, *futex1, , 0, 0);

return 0;
}

 END REPRODUCER ===

The problem is an endless loop in get_futex_key() when
CONFIG_TRANSPARENT_HUGEPAGE is enabled and the s390x machine has emulated
hugepages. The code tries to serialize against __split_huge_page_splitting(),
but __get_user_pages_fast() fails on the hugetlbfs tail page. This happens
because pmd_large() is false for emulated hugepages, so the code will proceed
into gup_pte_range() and fail page_cache_get_speculative() through failing
get_page_unless_zero() as the tail page count is zero. Failing __gup_fast is
supposed to be temporary due to a race, so get_futex_key() will try again
endlessly.

This attempt for a fix is a bandaid solution and probably incomplete.
Hopefully something better will emerge from the discussion. Fully fixing
emulated hugepages just for stable backports is unlikely due to them being
removed. Also THP refcounting redesign should soon remove the trickery from
get_futex_key().

This patch relies on the fact that s390x with emulated hugepages returns false
in has_transparent_hugepage(), so we don't need to do the serialization
trickery and just use the code for !CONFIG_TRANSPARENT_HUGEPAGE. We just need
an extra variable to cache the result of has_transparent_hugepage(), which is
__init and potentially expensive on some architectures.

However, __get_user_pages_fast() is still broken. The get_user_pages_fast()
wrapper will hide this in the common case. The other user of the __ variant
is kvm, which is mentioned as the reason for removal of emulated hugepages.
The call of page_cache_get_speculative() looks also broken in this scenario
on debug builds because of VM_BUG_ON_PAGE(PageTail(page), page). With
CONFIG_TINY_RCU enabled, there's plain atomic_inc(>_count) which also
probably shouldn't happen for a tail page...

Not-yet-signed-off-by: Vlastimil Babka 
Reported-by: Yong Sun 
Cc: Zhang Yi 
Cc: Mel Gorman 
Cc: Andrea Arcangeli 
Cc: Kirill A. Shutemov 
Cc: Hugh Dickins 
Cc: Dominik Dingel 
Cc: Martin Schwidefsky 
Cc: Heiko Carstens 
Cc: Christian Borntraeger 
---
 include/linux/huge_mm.h |  1 +
 kernel/futex.c  | 10 --
 mm/huge_memory.c|  4 
 3 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h
index f10b20f..5dbaca3 100644
--- a/include/linux/huge_mm.h
+++ b/include/linux/huge_mm.h
@@ -92,6 +92,7 @@ extern bool is_vma_temporary_stack(struct vm_area_struct 
*vma);
 #define transparent_hugepage_debug_cow() 0
 #endif /* CONFIG_DEBUG_VM */
 
+extern bool transparent_hugepage_available;
 extern unsigned long transparent_hugepage_flags;
 extern int split_huge_page_to_list(struct page *page, struct list_head *list);
 static inline int split_huge_page(struct page *page)
diff --git a/kernel/futex.c b/kernel/futex.c
index c4a182f..be9cd1c 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -443,6 +443,9 @@ get_futex_key(u32 __user *uaddr, int fshared, union 
futex_key *key, int rw)
err = 0;
 
 #ifdef CONFIG_TRANSPARENT_HUGEPAGE
+   if (!transparent_hugepage_available)
+   goto no_thp;
+
page_head = page;
if (unlikely(PageTail(page))) {
put_page(page);
@@ -470,14 +473,17 @@ get_futex_key(u32 __user *uaddr, int fshared, union 
futex_key *key, int rw)
goto again;
}
}
-#else
+   goto lockpage;
+#endif
+
+no_thp:
page_head = compound_head(page);
if (page != page_head) {
get_page(page_head);
put_page(page);
}
-#endif
 
+lockpage:
lock_page(page_head);
 
/*
diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index 097c7a4..6aea047 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -36,6 +36,7 @@
  * Defrag is invoked by khugepaged hugepage allocations and by page faults
  * for all hugepage allocations.
  */
+bool 

Re: [PATCH] drm: drm_atomic_crtc_get_property should be static

2015-09-24 Thread Daniel Vetter
On Thu, Sep 24, 2015 at 03:01:03AM -0700, Geliang Tang wrote:
> Fixes the following sparse warning:
>  drivers/gpu/drm/drm_atomic.c:442:5: warning: symbol
>  'drm_atomic_crtc_get_property' was not declared. Should it be static?
> 
> Signed-off-by: Geliang Tang 

Applied to drm-misc, thansk.
-Daniel

> ---
>  drivers/gpu/drm/drm_atomic.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
> index 940f80b..7bb3845 100644
> --- a/drivers/gpu/drm/drm_atomic.c
> +++ b/drivers/gpu/drm/drm_atomic.c
> @@ -438,7 +438,8 @@ EXPORT_SYMBOL(drm_atomic_crtc_set_property);
>   * consistent behavior you must call this function rather than the
>   * driver hook directly.
>   */
> -int drm_atomic_crtc_get_property(struct drm_crtc *crtc,
> +static int
> +drm_atomic_crtc_get_property(struct drm_crtc *crtc,
>   const struct drm_crtc_state *state,
>   struct drm_property *property, uint64_t *val)
>  {
> -- 
> 1.9.1
> 
> 
> ___
> dri-devel mailing list
> dri-de...@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
--
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 07/15] devm_memremap: convert to return ERR_PTR

2015-09-24 Thread Christoph Hellwig
On Wed, Sep 23, 2015 at 12:41:50AM -0400, Dan Williams wrote:
> Make devm_memremap consistent with the error return scheme of
> devm_memremap_pages to remove special casing in the pmem driver.

Looks good,

Reviewed-by: Christoph Hellwig 
--
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 06/15] devm_memunmap: use devres_release()

2015-09-24 Thread Christoph Hellwig
Looks good,

Reviewed-by: Christoph Hellwig 
--
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] regmap: Add HCI support

2015-09-24 Thread Loic Poulain
Add HCI support to the regmap API.
Some HCI/BT devices provide register access via their HCI interface.
(e.g. FM registers access for Intel BT/FM combo chip)

Read/Write operations are performed via a HCI transaction composed of
a HCI command (host->controller) followed by a HCI command complete
event (controller->host). Read/Write Command opcodes can be specified
to the regmap init function.
We define data formats which are vendor specific. However, regmap-hci
can be extended with any other implementation.

Register Read/Write HCI command payload (Host):
Field: | REG ADDR | MODE | DATA_LEN | DATA... |
size:  |   32b|  8b  |8b|  8b*|

Register Read HCI command complete event payload (Controller):
Field: | CMD STATUS | REG ADDR | DATA... |
size:  | 8b |   32b|  8b*|

Register Write HCI command complete event payload (Controller):
Field: | CMD_STATUS |
size:  | 8b |

Since this payload is HCI encapsulated, Little Endian byte order
is used.

Example:

If we want to write 0x32001122 in the register 0x1142,
with opcode_write 0xfc58, the resulting HCI transaction will be:
   ___ __ __ ___
> 58 fc 0a 42 11 00 00 02 04 22 11 00 32
   CMD HDR   REG ADDR  MD SZDATA
  __ __
< 0E 04 01 58 fc 00
CC EVT HDR   ST

If we want to read the 32bit value stored in same register with
opcode_read 0xfc59:
   ___ __ __
> 59 fc 06 42 11 00 00 02 04
  CMD HDRREG ADDR  MD SZ
  __ __ ___ ___
< 0E 0c 01 59 fc 00 04 8c 00 00 22 11 00 32
CC EVT HDR   ST   REG ADDR DATA

Signed-off-by: Loic Poulain 
---
 drivers/base/regmap/Kconfig  |   6 +-
 drivers/base/regmap/Makefile |   1 +
 drivers/base/regmap/regmap-hci.c | 282 +++
 include/linux/regmap.h   |   7 +
 4 files changed, 295 insertions(+), 1 deletion(-)
 create mode 100644 drivers/base/regmap/regmap-hci.c

diff --git a/drivers/base/regmap/Kconfig b/drivers/base/regmap/Kconfig
index db9d00c3..b692b96 100644
--- a/drivers/base/regmap/Kconfig
+++ b/drivers/base/regmap/Kconfig
@@ -3,7 +3,7 @@
 # subsystems should select the appropriate symbols.
 
 config REGMAP
-   default y if (REGMAP_I2C || REGMAP_SPI || REGMAP_SPMI || REGMAP_AC97 || 
REGMAP_MMIO || REGMAP_IRQ)
+   default y if (REGMAP_I2C || REGMAP_SPI || REGMAP_SPMI || REGMAP_AC97 || 
REGMAP_MMIO || REGMAP_IRQ || REGMAP_HCI)
select LZO_COMPRESS
select LZO_DECOMPRESS
select IRQ_DOMAIN if REGMAP_IRQ
@@ -29,3 +29,7 @@ config REGMAP_MMIO
 
 config REGMAP_IRQ
bool
+
+config REGMAP_HCI
+   tristate
+   depends on BT
\ No newline at end of file
diff --git a/drivers/base/regmap/Makefile b/drivers/base/regmap/Makefile
index 609e4c8..8cf31ea 100644
--- a/drivers/base/regmap/Makefile
+++ b/drivers/base/regmap/Makefile
@@ -10,3 +10,4 @@ obj-$(CONFIG_REGMAP_SPI) += regmap-spi.o
 obj-$(CONFIG_REGMAP_SPMI) += regmap-spmi.o
 obj-$(CONFIG_REGMAP_MMIO) += regmap-mmio.o
 obj-$(CONFIG_REGMAP_IRQ) += regmap-irq.o
+obj-$(CONFIG_REGMAP_HCI) += regmap-hci.o
diff --git a/drivers/base/regmap/regmap-hci.c b/drivers/base/regmap/regmap-hci.c
new file mode 100644
index 000..bcb91a8
--- /dev/null
+++ b/drivers/base/regmap/regmap-hci.c
@@ -0,0 +1,282 @@
+/*
+ * Register map access API - HCI support
+ *
+ * Copyright 2015 Intel Corporation
+ *
+ * Author: Loic Poulain 
+ *
+ * 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.
+ */
+
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include "internal.h"
+
+#define DEFAULT_OP_WRITE 0xfc58
+#define DEFAULT_OP_READ  0xfc59
+
+#define HCI_REG_MODE_8BIT  0x00
+#define HCI_REG_MODE_16BIT 0x01
+#define HCI_REG_MODE_32BIT 0x02
+
+struct regmap_hci_context {
+   struct hci_dev *hdev;
+   __u16 op_write;
+   __u16 op_read;
+};
+
+/**
+ * HCI Command payload for register read/write
+ *
+ * @reg: Register address (32bit only)
+ * @mode: Value access mode (8bit, 16bit, 32bit)
+ * @data_len: data len to read/write
+ * @data: data to write
+ */
+struct hci_command_reg_hdr {
+   __le32  reg;
+   __u8mode;
+   __u8data_len;
+   __u8data[0];
+} __packed;
+
+/**
+ * HCI Command Complete Event payload for register read
+ *
+ * @reg: cmd read status
+ * @mode: Register address (32bit only)
+ * @data: Register value
+ */
+struct hci_cc_reg_hdr {
+   __u8status;
+   __le32  reg;
+   __u8data[0];
+} __packed;
+
+static int regmap_hci_read(void *context, const void *reg, size_t reg_size,
+  void *val, size_t val_size)
+{
+   struct regmap_hci_context *ctx = context;
+   struct hci_dev *hdev = ctx->hdev;
+   struct sk_buff *skb;
+   struct hci_command_reg_hdr hdr;
+   struct hci_cc_reg_hdr *cc;
+
+   if (reg_size != sizeof(__le32))
+   

Re: [PATCH 05/15] pmem: kill memremap_pmem()

2015-09-24 Thread Christoph Hellwig
Yes, please!

Reviewed-by: Christoph Hellwig 
--
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 01/15] avr32: convert to asm-generic/memory_model.h

2015-09-24 Thread Christoph Hellwig
On Wed, Sep 23, 2015 at 12:41:18AM -0400, Dan Williams wrote:
> Switch avr32/include/asm/page.h to use the common defintions for
> pfn_to_page(), page_to_pfn(), and ARCH_PFN_OFFSET.

This was the last architecture not using asm-generic/memory_model.h,
so it might be time to move it to linux/ or even fold it into an
existing header.
--
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] powercap / RAPL : remove dependency on iosf_mbi

2015-09-24 Thread Austin S Hemmelgarn

On 2015-09-24 06:03, Pengyu Ma wrote:



On 09/23/2015 01:01 AM, Jacob Pan wrote:

On Tue, 22 Sep 2015 11:11:36 +0800
Pengyu Ma  wrote:



On 09/22/2015 05:36 AM, Jacob Pan wrote:

On Mon, 21 Sep 2015 11:48:14 +0800
Pengyu Ma  wrote:


On 09/18/2015 11:43 PM, Jacob Pan wrote:

On Fri, 18 Sep 2015 02:09:55 +0200
"Rafael J. Wysocki"  wrote:


On Thursday, September 17, 2015 03:31:41 PM Pengyu Ma wrote:

iosf_mbi is supported on Quark, Braswell, Baytrail and some Atom
SoC, but RAPL is not limited to these SoC, it supports almost
Intel CPUs. Remove this dependece to make RAPL support more
Intel CPUs.

Please select IOSF_MBI on Atom SoCs.


Unlike Quark, I don't think we want to or do differentiate Atom
from other x86 at compile time. IOSF driver can be compiled as a
module also, therefore RAPL driver needs this explicit dependency
at compile time.

As commit had exported iosf_mbi to let user use it.

commit aa8e4f22ab7773352ba3895597189b8097f2c307
Author: David E. Box 
Date:   Wed Aug 27 14:40:39 2014 -0700

   x86/iosf: Add Kconfig prompt for IOSF_MBI selection


While selecting IOSF_MBI is preferred, it does mean carrying extra
code on non-SoC architectures.

We can NOT force user to build in iosf_mbi if they want use RAPL on
haswell/broadwell/skylake.
And RAPL can be compiled and worked well on
haswell/broadwell/skylake without IOSF_MBI.
RAPL is really NOT depended on IOSF_MBI.


True for haswell/broadwell/skylake platforms. But if we want binary
compatibility for Atom and Core, I can' see how simply removing the
dependency would work, unless we have runtime detection of IOSF.

If you want use iosf_mbi on atom, please select it on generic x86
config. But not force it depend on another feature that not related
on it with other boards.
I don't care how iosf_mbi is added to kernel config, but why should I
be forced to add it if I want use RAPL?
It doesn't make any sense.


I understand your concern about wasting code. But let's look at all the
cases of config options here. (without Kconfig dependency as you
suggested)

RAPL\IOSFYMN
___
  YOK  DC* Warn on Atom**
  MOKOKWarn on Atom
  NOKOKOK
___

Notes:
* DC: don't compile
** Warn on Atom is runtime if I add the following code to RAPL driver,
but this case is ok.

--- a/drivers/powercap/intel_rapl.c
+++ b/drivers/powercap/intel_rapl.c
@@ -982,6 +982,11 @@ static void set_floor_freq_atom(struct rapl_domain
*rd, bool enable) static u32 power_ctrl_orig_val;
 u32 mdata;
+   if (!iosf_mbi_available()) {
+   pr_warn("No IOSF MBI access to set floor frequency\n");
+   return;
+   }
+

So the problematic case is when RAPL=Y IOSF=M
Since real IOSF functions are available when
#if IS_ENABLED(CONFIG_IOSF_MBI)
There will be no dummy functions for RAPL to reference in this case.

iosf_mbi_write/read will warn itself.

Since IOSF is a driver, making it a module is a reasonable requirement.
As I mentioned before, I don't think we want to have a CONFIG_ATOM
option for X86.

Actually there is a CONFIG_MATOM already in Kconfig.cpu
That's for code optimization (it changes compiler flags), not 
determining what system we're actually building for, and on top of that 
it's for older atom processors, not the new ones.  It's fully possible 
to build a kernel for an Atom processor without selecting this.


Pengyu


+David, HPA

Jacob


Pengyu


Pengyu

Signed-off-by: Pengyu Ma 

Jacob?


---
drivers/powercap/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/powercap/Kconfig b/drivers/powercap/Kconfig
index 85727ef..a7c81b5 100644
--- a/drivers/powercap/Kconfig
+++ b/drivers/powercap/Kconfig
@@ -17,7 +17,7 @@ if POWERCAP
# Client driver configurations go here.
config INTEL_RAPL
tristate "Intel RAPL Support"
-depends on X86 && IOSF_MBI
+depends on X86
default n
---help---
  This enables support for the Intel Running Average
Power Limit (RAPL)


[Jacob Pan]

[Jacob Pan]

[Jacob Pan]


--
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/





smime.p7s
Description: S/MIME Cryptographic Signature


Re: [PATCH 04/15] x86, mm: quiet arch_add_memory()

2015-09-24 Thread Christoph Hellwig
Looks fine,

Reviewed-by: Christoph Hellwig 
--
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: [tip:perf/core] tools lib api fs: Remove debugfs, tracefs and findfs objects

2015-09-24 Thread Michael Petlan
On Wed, 2015-09-23 at 11:08 +0100, Matt Fleming wrote:

[SNIP]

> > The RedHat QE has some more perf tool tests. There was some movement
> > to make those public, but not sure how it ended up.. ccing Michael Petlan
> > for news on this ;-)
> 
> Cool! I'd definitely be interested in knowing the details.
> 

Hi!

Yes, we have some tests, but they really need some refactoring and then
extending.

There are many "regression" tests that cover some extreme situations
that failed with some kernel/perf version on some hardware. They are
probably not very useful for the purpose mentioned here.

Then there are some tests that should cover basic functionality and
check for the correctness of perf's behaviour. Since it became being
pretty messy, I have got an idea to rewrite that in a more structured
and robust way and make it public.

So I started with some skeleton and tests for perf stat builtin sub
command [1]. My idea is to port there all the meaningful tests that
we have at Red Hat. Then I will be happy if someone else is interested
in contributing some more coverage, ideas or whatever...

I am on a PTO for two weeks from now, so I will respond after it, if you
have any questions, suggestions or ideas.


Regards,
Michael



[1] https://github.com/rfmvh/perftool-testsuite


--
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/


[v3 8/8] dpaa_eth: add trace points

2015-09-24 Thread Madalin Bucur
Add trace points on the hot processing path.

Signed-off-by: Ruxandra Ioana Radulescu 
---
 drivers/net/ethernet/freescale/dpaa/Makefile   |   1 +
 drivers/net/ethernet/freescale/dpaa/dpaa_eth.c |  12 ++
 drivers/net/ethernet/freescale/dpaa/dpaa_eth.h |   4 +
 .../net/ethernet/freescale/dpaa/dpaa_eth_trace.h   | 141 +
 4 files changed, 158 insertions(+)
 create mode 100644 drivers/net/ethernet/freescale/dpaa/dpaa_eth_trace.h

diff --git a/drivers/net/ethernet/freescale/dpaa/Makefile 
b/drivers/net/ethernet/freescale/dpaa/Makefile
index 141ade4..15ed1c4 100644
--- a/drivers/net/ethernet/freescale/dpaa/Makefile
+++ b/drivers/net/ethernet/freescale/dpaa/Makefile
@@ -9,3 +9,4 @@ ccflags-y += -I$(FMAN)
 obj-$(CONFIG_FSL_DPAA_ETH) += fsl_dpa.o
 
 fsl_dpa-objs += dpaa_eth.o dpaa_eth_sg.o dpaa_eth_common.o dpaa_ethtool.o 
dpaa_eth_sysfs.o
+CFLAGS_dpaa_eth.o := -I$(src)
diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c 
b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
index 6d241a3..2b99428 100644
--- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
+++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
@@ -57,6 +57,12 @@
 #include "dpaa_eth.h"
 #include "dpaa_eth_common.h"
 
+/* CREATE_TRACE_POINTS only needs to be defined once. Other dpa files
+ * using trace events only need to #include 
+ */
+#define CREATE_TRACE_POINTS
+#include "dpaa_eth_trace.h"
+
 #define DPA_NAPI_WEIGHT64
 
 /* Valid checksum indication */
@@ -229,6 +235,9 @@ priv_rx_default_dqrr(struct qman_portal *portal,
priv = netdev_priv(net_dev);
dpa_bp = priv->dpa_bp;
 
+   /* Trace the Rx fd */
+   trace_dpa_rx_fd(net_dev, fq, >fd);
+
/* IRQ handler, non-migratable; safe to use raw_cpu_ptr here */
percpu_priv = raw_cpu_ptr(priv->percpu_priv);
count_ptr = raw_cpu_ptr(dpa_bp->percpu_count);
@@ -285,6 +294,9 @@ priv_tx_conf_default_dqrr(struct qman_portal *portal,
net_dev = ((struct dpa_fq *)fq)->net_dev;
priv = netdev_priv(net_dev);
 
+   /* Trace the fd */
+   trace_dpa_tx_conf_fd(net_dev, fq, >fd);
+
/* Non-migratable context, safe to use raw_cpu_ptr */
percpu_priv = raw_cpu_ptr(priv->percpu_priv);
 
diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.h 
b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.h
index a16119e..44368c8 100644
--- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.h
+++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.h
@@ -36,6 +36,7 @@
 
 #include "fman.h"
 #include "mac.h"
+#include "dpaa_eth_trace.h"
 
 extern int dpa_rx_extra_headroom;
 extern int dpa_max_frm;
@@ -406,6 +407,9 @@ static inline int dpa_xmit(struct dpa_priv_s *priv,
if (fd->bpid == 0xff)
fd->cmd |= qman_fq_fqid(priv->conf_fqs[queue]);
 
+   /* Trace this Tx fd */
+   trace_dpa_tx_fd(priv->net_dev, egress_fq, fd);
+
for (i = 0; i < 10; i++) {
err = qman_enqueue(egress_fq, fd, 0);
if (err != -EBUSY)
diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth_trace.h 
b/drivers/net/ethernet/freescale/dpaa/dpaa_eth_trace.h
new file mode 100644
index 000..3b67477
--- /dev/null
+++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth_trace.h
@@ -0,0 +1,141 @@
+/* Copyright 2013-2015 Freescale Semiconductor Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ *  notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ * * Neither the name of Freescale Semiconductor nor the
+ *  names of its contributors may be used to endorse or promote products
+ *  derived from this software without specific prior written permission.
+ *
+ *
+ * ALTERNATIVELY, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") as published by the Free Software
+ * Foundation, either version 2 of that License or (at your option) any
+ * later version.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 

[PATCH 1/2] usb: gadget: f_sourcesink: fix function params handling

2015-09-24 Thread Robert Baldyga
Move function parameters to struct f_sourcesink to make them per instance
instead of having them as global variables. Since we can have multiple
instances of USB function we also want to have separate set of parameters
for each instance.

Signed-off-by: Robert Baldyga 
---
 drivers/usb/gadget/function/f_sourcesink.c | 120 +++--
 1 file changed, 62 insertions(+), 58 deletions(-)

diff --git a/drivers/usb/gadget/function/f_sourcesink.c 
b/drivers/usb/gadget/function/f_sourcesink.c
index 1353465..128abfb 100644
--- a/drivers/usb/gadget/function/f_sourcesink.c
+++ b/drivers/usb/gadget/function/f_sourcesink.c
@@ -50,6 +50,13 @@ struct f_sourcesink {
struct usb_ep   *iso_in_ep;
struct usb_ep   *iso_out_ep;
int cur_alt;
+
+   unsigned pattern;
+   unsigned isoc_interval;
+   unsigned isoc_maxpacket;
+   unsigned isoc_mult;
+   unsigned isoc_maxburst;
+   unsigned buflen;
 };
 
 static inline struct f_sourcesink *func_to_ss(struct usb_function *f)
@@ -57,13 +64,6 @@ static inline struct f_sourcesink *func_to_ss(struct 
usb_function *f)
return container_of(f, struct f_sourcesink, function);
 }
 
-static unsigned pattern;
-static unsigned isoc_interval;
-static unsigned isoc_maxpacket;
-static unsigned isoc_mult;
-static unsigned isoc_maxburst;
-static unsigned buflen;
-
 /*-*/
 
 static struct usb_interface_descriptor source_sink_intf_alt0 = {
@@ -298,7 +298,9 @@ static struct usb_gadget_strings *sourcesink_strings[] = {
 
 static inline struct usb_request *ss_alloc_ep_req(struct usb_ep *ep, int len)
 {
-   return alloc_ep_req(ep, len, buflen);
+   struct f_sourcesink *ss = ep->driver_data;
+
+   return alloc_ep_req(ep, len, ss->buflen);
 }
 
 void free_ep_req(struct usb_ep *ep, struct usb_request *req)
@@ -357,22 +359,22 @@ autoconf_fail:
goto autoconf_fail;
 
/* sanity check the isoc module parameters */
-   if (isoc_interval < 1)
-   isoc_interval = 1;
-   if (isoc_interval > 16)
-   isoc_interval = 16;
-   if (isoc_mult > 2)
-   isoc_mult = 2;
-   if (isoc_maxburst > 15)
-   isoc_maxburst = 15;
+   if (ss->isoc_interval < 1)
+   ss->isoc_interval = 1;
+   if (ss->isoc_interval > 16)
+   ss->isoc_interval = 16;
+   if (ss->isoc_mult > 2)
+   ss->isoc_mult = 2;
+   if (ss->isoc_maxburst > 15)
+   ss->isoc_maxburst = 15;
 
/* fill in the FS isoc descriptors from the module parameters */
-   fs_iso_source_desc.wMaxPacketSize = isoc_maxpacket > 1023 ?
-   1023 : isoc_maxpacket;
-   fs_iso_source_desc.bInterval = isoc_interval;
-   fs_iso_sink_desc.wMaxPacketSize = isoc_maxpacket > 1023 ?
-   1023 : isoc_maxpacket;
-   fs_iso_sink_desc.bInterval = isoc_interval;
+   fs_iso_source_desc.wMaxPacketSize = ss->isoc_maxpacket > 1023 ?
+   1023 : ss->isoc_maxpacket;
+   fs_iso_source_desc.bInterval = ss->isoc_interval;
+   fs_iso_sink_desc.wMaxPacketSize = ss->isoc_maxpacket > 1023 ?
+   1023 : ss->isoc_maxpacket;
+   fs_iso_sink_desc.bInterval = ss->isoc_interval;
 
/* allocate iso endpoints */
ss->iso_in_ep = usb_ep_autoconfig(cdev->gadget, _iso_source_desc);
@@ -394,8 +396,8 @@ no_iso:
ss_source_sink_descs[SS_ALT_IFC_1_OFFSET] = NULL;
}
 
-   if (isoc_maxpacket > 1024)
-   isoc_maxpacket = 1024;
+   if (ss->isoc_maxpacket > 1024)
+   ss->isoc_maxpacket = 1024;
 
/* support high speed hardware */
hs_source_desc.bEndpointAddress = fs_source_desc.bEndpointAddress;
@@ -406,15 +408,15 @@ no_iso:
 * We assume that the user knows what they are doing and won't
 * give parameters that their UDC doesn't support.
 */
-   hs_iso_source_desc.wMaxPacketSize = isoc_maxpacket;
-   hs_iso_source_desc.wMaxPacketSize |= isoc_mult << 11;
-   hs_iso_source_desc.bInterval = isoc_interval;
+   hs_iso_source_desc.wMaxPacketSize = ss->isoc_maxpacket;
+   hs_iso_source_desc.wMaxPacketSize |= ss->isoc_mult << 11;
+   hs_iso_source_desc.bInterval = ss->isoc_interval;
hs_iso_source_desc.bEndpointAddress =
fs_iso_source_desc.bEndpointAddress;
 
-   hs_iso_sink_desc.wMaxPacketSize = isoc_maxpacket;
-   hs_iso_sink_desc.wMaxPacketSize |= isoc_mult << 11;
-   hs_iso_sink_desc.bInterval = isoc_interval;
+   hs_iso_sink_desc.wMaxPacketSize = ss->isoc_maxpacket;
+   hs_iso_sink_desc.wMaxPacketSize |= ss->isoc_mult << 11;
+   hs_iso_sink_desc.bInterval = ss->isoc_interval;

[PATCH 2/2] usb: gadget: f_loopfack: fix function params handling

2015-09-24 Thread Robert Baldyga
Move function parameters to struct f_loopback to make them per instance
instead of having them as global variables. Since we can have multiple
instances of USB function we also want to have separate set of parameters
for each instance.

Signed-off-by: Robert Baldyga 
---
 drivers/usb/gadget/function/f_loopback.c | 22 --
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/drivers/usb/gadget/function/f_loopback.c 
b/drivers/usb/gadget/function/f_loopback.c
index 300e601..8d2dac8 100644
--- a/drivers/usb/gadget/function/f_loopback.c
+++ b/drivers/usb/gadget/function/f_loopback.c
@@ -34,6 +34,9 @@ struct f_loopback {
 
struct usb_ep   *in_ep;
struct usb_ep   *out_ep;
+
+   unsigned qlen;
+   unsigned buflen;
 };
 
 static inline struct f_loopback *func_to_loop(struct usb_function *f)
@@ -41,9 +44,6 @@ static inline struct f_loopback *func_to_loop(struct 
usb_function *f)
return container_of(f, struct f_loopback, function);
 }
 
-static unsigned qlen;
-static unsigned buflen;
-
 /*-*/
 
 static struct usb_interface_descriptor loopback_intf = {
@@ -251,7 +251,7 @@ static void loopback_complete(struct usb_ep *ep, struct 
usb_request *req)
}
 
/* queue the buffer for some later OUT packet */
-   req->length = buflen;
+   req->length = loop->buflen;
status = usb_ep_queue(ep, req, GFP_ATOMIC);
if (status == 0)
return;
@@ -288,7 +288,9 @@ static void disable_loopback(struct f_loopback *loop)
 
 static inline struct usb_request *lb_alloc_ep_req(struct usb_ep *ep, int len)
 {
-   return alloc_ep_req(ep, len, buflen);
+   struct f_loopback   *loop = ep->driver_data;
+
+   return alloc_ep_req(ep, len, loop->buflen);
 }
 
 static int enable_endpoint(struct usb_composite_dev *cdev, struct f_loopback 
*loop,
@@ -315,7 +317,7 @@ static int enable_endpoint(struct usb_composite_dev *cdev, 
struct f_loopback *lo
 * we buffer at most 'qlen' transfers; fewer if any need more
 * than 'buflen' bytes each.
 */
-   for (i = 0; i < qlen && result == 0; i++) {
+   for (i = 0; i < loop->qlen && result == 0; i++) {
req = lb_alloc_ep_req(ep, 0);
if (!req)
goto fail1;
@@ -388,10 +390,10 @@ static struct usb_function *loopback_alloc(struct 
usb_function_instance *fi)
lb_opts->refcnt++;
mutex_unlock(_opts->lock);
 
-   buflen = lb_opts->bulk_buflen;
-   qlen = lb_opts->qlen;
-   if (!qlen)
-   qlen = 32;
+   loop->buflen = lb_opts->bulk_buflen;
+   loop->qlen = lb_opts->qlen;
+   if (!loop->qlen)
+   loop->qlen = 32;
 
loop->function.name = "loopback";
loop->function.bind = loopback_bind;
-- 
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 06/19] staging: media: omap4iss: fix handling platform_get_irq result

2015-09-24 Thread Dan Carpenter
On Thu, Sep 24, 2015 at 04:00:14PM +0200, Andrzej Hajda wrote:
> Hi,
> 
> To avoid problems with too many mail recipients I have sent whole
> patchset only to LKML. Anyway patches have no dependencies.
> 

I'm pretty sure mailman or whatever counts CCs as recipients as well.

regards,
dan carpenter

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


Re: [PATCH/RFC] perf buildid: Cache kernel DSO created when reading buildid header table

2015-09-24 Thread Namhyung Kim
Hi Arnaldo,

On Thu, Sep 24, 2015 at 10:42:28AM -0300, Arnaldo Carvalho de Melo wrote:
> Namhyung,
> 
>   Can you take a look and perhaps give me your Acked-by?

The dso->kernel and event->cpumode is always confusing for modules..
In this case, it seems that mmap events set kernel cpumode but
build-id events don't.  So kernel cpumode in a bulid-id event
indicates that it is a kernel (vmlinux) dso, right?

I'll test this tomorrow..

Thanks,
Namhyung


> 
> From: Arnaldo Carvalho de Melo 
> 
> No need to traverse it all again using the filename extension to
> disambiguate kernel from kernel modules, just cache it when
> reading the buildid table.
> 
> This also fixes a refcount bug in the error path, i.e. in the error path
> for the __machine__create_kernel_maps() call we do a dso__put(), which
> is ok and expected if that dso came from machine__findnew_dso(), but
> wasn't when we found it by traversing the machine dso list without
> grabbing a dso refcount (dso__get()) before dropping the list lock.
> 
> Fixes: b837a8bdc489 ("perf tools: Fix build-id matching on vmlinux")
> Link: http://lkml.kernel.org/n/tip-48fh3cf6pvs4zs2fj4nhc...@git.kernel.org
> Signed-off-by: Arnaldo Carvalho de Melo 
> ---
>  tools/perf/util/header.c  |  7 +++
>  tools/perf/util/machine.c | 34 +++---
>  tools/perf/util/machine.h |  1 +
>  3 files changed, 11 insertions(+), 31 deletions(-)
> 
> diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
> index 43838003c1a1..6bc92ae1e99a 100644
> --- a/tools/perf/util/header.c
> +++ b/tools/perf/util/header.c
> @@ -1260,6 +1260,13 @@ static int __event_process_build_id(struct 
> build_id_event *bev,
>  
>   if (!is_kernel_module(filename, cpumode))
>   dso->kernel = dso_type;
> + /*
> +  * We don't need to grab a reference as long as
> +  * the kernel dso is in the machine dso list.
> +  */
> + if (cpumode == PERF_RECORD_MISC_KERNEL ||
> + cpumode == PERF_RECORD_MISC_GUEST_KERNEL)
> + machine->kernel_dso = dso;
>  
>   build_id__sprintf(dso->build_id, sizeof(dso->build_id),
> sbuild_id);
> diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
> index d07a38678e14..f6e689b2c83c 100644
> --- a/tools/perf/util/machine.c
> +++ b/tools/perf/util/machine.c
> @@ -62,6 +62,7 @@ int machine__init(struct machine *machine, const char 
> *root_dir, pid_t pid)
>   }
>  
>   machine->current_tid = NULL;
> + machine->kernel_dso = NULL;
>  
>   return 0;
>  }
> @@ -1180,39 +1181,10 @@ static int machine__process_kernel_mmap_event(struct 
> machine *machine,
>* Should be there already, from the build-id table in
>* the header.
>*/
> - struct dso *kernel = NULL;
> - struct dso *dso;
> + struct dso *kernel;
>  
>   pthread_rwlock_rdlock(>dsos.lock);
> -
> - list_for_each_entry(dso, >dsos.head, node) {
> -
> - /*
> -  * The cpumode passed to is_kernel_module is not the
> -  * cpumode of *this* event. If we insist on passing
> -  * correct cpumode to is_kernel_module, we should
> -  * record the cpumode when we adding this dso to the
> -  * linked list.
> -  *
> -  * However we don't really need passing correct
> -  * cpumode.  We know the correct cpumode must be kernel
> -  * mode (if not, we should not link it onto kernel_dsos
> -  * list).
> -  *
> -  * Therefore, we pass PERF_RECORD_MISC_CPUMODE_UNKNOWN.
> -  * is_kernel_module() treats it as a kernel cpumode.
> -  */
> -
> - if (!dso->kernel ||
> - is_kernel_module(dso->long_name,
> -  PERF_RECORD_MISC_CPUMODE_UNKNOWN))
> - continue;
> -
> -
> - kernel = dso;
> - break;
> - }
> -
> + kernel = dso__get(machine->kernel_dso);
>   pthread_rwlock_unlock(>dsos.lock);
>  
>   if (kernel == NULL)
> diff --git a/tools/perf/util/machine.h b/tools/perf/util/machine.h
> index 9dfc4281f940..d7b044a1046f 100644
> --- a/tools/perf/util/machine.h
> +++ b/tools/perf/util/machine.h
> @@ -38,6 +38,7 @@ struct machine {
>   struct dsos   dsos;
>   struct map_groups kmaps;
>   struct map*vmlinux_maps[MAP__NR_TYPES];
> + struct dso*kernel_dso;
>   u64   kernel_start;
>   symbol_filter_t   symbol_filter;
>   pid_t *current_tid;
> -- 
> 2.1.0
> 
--
To unsubscribe from 

[v3 2/8] dpaa_eth: add support for DPAA Ethernet

2015-09-24 Thread Madalin Bucur
This introduces the Freescale Data Path Acceleration Architecture
(DPAA) Ethernet driver (dpaa_eth) that builds upon the DPAA QMan,
BMan, PAMU and FMan drivers to deliver Ethernet connectivity on
the Freescale DPAA QorIQ platforms.

Signed-off-by: Madalin Bucur 
---
 drivers/net/ethernet/freescale/Kconfig |2 +
 drivers/net/ethernet/freescale/Makefile|1 +
 drivers/net/ethernet/freescale/dpaa/Kconfig|   22 +
 drivers/net/ethernet/freescale/dpaa/Makefile   |   11 +
 drivers/net/ethernet/freescale/dpaa/dpaa_eth.c |  822 
 drivers/net/ethernet/freescale/dpaa/dpaa_eth.h |  431 +++
 .../net/ethernet/freescale/dpaa/dpaa_eth_common.c  | 1302 
 .../net/ethernet/freescale/dpaa/dpaa_eth_common.h  |   98 ++
 drivers/net/ethernet/freescale/dpaa/dpaa_eth_sg.c  |  408 ++
 9 files changed, 3097 insertions(+)
 create mode 100644 drivers/net/ethernet/freescale/dpaa/Kconfig
 create mode 100644 drivers/net/ethernet/freescale/dpaa/Makefile
 create mode 100644 drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
 create mode 100644 drivers/net/ethernet/freescale/dpaa/dpaa_eth.h
 create mode 100644 drivers/net/ethernet/freescale/dpaa/dpaa_eth_common.c
 create mode 100644 drivers/net/ethernet/freescale/dpaa/dpaa_eth_common.h
 create mode 100644 drivers/net/ethernet/freescale/dpaa/dpaa_eth_sg.c

diff --git a/drivers/net/ethernet/freescale/Kconfig 
b/drivers/net/ethernet/freescale/Kconfig
index f3f89cc..92198be 100644
--- a/drivers/net/ethernet/freescale/Kconfig
+++ b/drivers/net/ethernet/freescale/Kconfig
@@ -92,4 +92,6 @@ config GIANFAR
  and MPC86xx family of chips, the eTSEC on LS1021A and the FEC
  on the 8540.
 
+source "drivers/net/ethernet/freescale/dpaa/Kconfig"
+
 endif # NET_VENDOR_FREESCALE
diff --git a/drivers/net/ethernet/freescale/Makefile 
b/drivers/net/ethernet/freescale/Makefile
index 4097c58..ae13dc5 100644
--- a/drivers/net/ethernet/freescale/Makefile
+++ b/drivers/net/ethernet/freescale/Makefile
@@ -12,6 +12,7 @@ obj-$(CONFIG_FS_ENET) += fs_enet/
 obj-$(CONFIG_FSL_PQ_MDIO) += fsl_pq_mdio.o
 obj-$(CONFIG_FSL_XGMAC_MDIO) += xgmac_mdio.o
 obj-$(CONFIG_GIANFAR) += gianfar_driver.o
+obj-$(CONFIG_FSL_DPAA_ETH) += dpaa/
 obj-$(CONFIG_PTP_1588_CLOCK_GIANFAR) += gianfar_ptp.o
 gianfar_driver-objs := gianfar.o \
gianfar_ethtool.o
diff --git a/drivers/net/ethernet/freescale/dpaa/Kconfig 
b/drivers/net/ethernet/freescale/dpaa/Kconfig
new file mode 100644
index 000..022d5aa
--- /dev/null
+++ b/drivers/net/ethernet/freescale/dpaa/Kconfig
@@ -0,0 +1,22 @@
+menuconfig FSL_DPAA_ETH
+   tristate "DPAA Ethernet"
+   depends on FSL_SOC && FSL_BMAN && FSL_QMAN && FSL_FMAN
+   select PHYLIB
+   select FSL_FMAN_MAC
+   ---help---
+ Data Path Acceleration Architecture Ethernet driver,
+ supporting the Freescale QorIQ chips.
+ Depends on Freescale Buffer Manager and Queue Manager
+ driver and Frame Manager Driver.
+
+if FSL_DPAA_ETH
+
+config FSL_DPAA_ETH_FRIENDLY_IF_NAME
+   bool "Use fmX-macY names for the DPAA interfaces"
+   default y
+   ---help---
+ The DPAA Ethernet netdevices are created for each FMan port available
+ on a certain board. Enable this to get interface names derived from
+ the underlying FMan hardware for a simple identification.
+
+endif # FSL_DPAA_ETH
diff --git a/drivers/net/ethernet/freescale/dpaa/Makefile 
b/drivers/net/ethernet/freescale/dpaa/Makefile
new file mode 100644
index 000..3847ec7
--- /dev/null
+++ b/drivers/net/ethernet/freescale/dpaa/Makefile
@@ -0,0 +1,11 @@
+#
+# Makefile for the Freescale DPAA Ethernet controllers
+#
+
+# Include FMan headers
+FMAN= $(srctree)/drivers/net/ethernet/freescale/fman
+ccflags-y += -I$(FMAN)
+
+obj-$(CONFIG_FSL_DPAA_ETH) += fsl_dpa.o
+
+fsl_dpa-objs += dpaa_eth.o dpaa_eth_sg.o dpaa_eth_common.o
diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c 
b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
new file mode 100644
index 000..2a886d6
--- /dev/null
+++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
@@ -0,0 +1,822 @@
+/* Copyright 2008 - 2015 Freescale Semiconductor Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ *  notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ * * Neither the name of Freescale Semiconductor nor the
+ *  names of its contributors may be used to endorse or promote products
+ *  derived from this software without specific prior written permission.
+ *
+ * ALTERNATIVELY, this 

[v3 5/8] dpaa_eth: add ethtool functionality

2015-09-24 Thread Madalin Bucur
Add support for basic ethtool operations.

Signed-off-by: Madalin Bucur 
---
 drivers/net/ethernet/freescale/dpaa/Makefile   |   2 +-
 .../net/ethernet/freescale/dpaa/dpaa_eth_common.c  |   2 +
 .../net/ethernet/freescale/dpaa/dpaa_eth_common.h  |   3 +
 drivers/net/ethernet/freescale/dpaa/dpaa_ethtool.c | 230 +
 4 files changed, 236 insertions(+), 1 deletion(-)
 create mode 100644 drivers/net/ethernet/freescale/dpaa/dpaa_ethtool.c

diff --git a/drivers/net/ethernet/freescale/dpaa/Makefile 
b/drivers/net/ethernet/freescale/dpaa/Makefile
index 3847ec7..9b75d52 100644
--- a/drivers/net/ethernet/freescale/dpaa/Makefile
+++ b/drivers/net/ethernet/freescale/dpaa/Makefile
@@ -8,4 +8,4 @@ ccflags-y += -I$(FMAN)
 
 obj-$(CONFIG_FSL_DPAA_ETH) += fsl_dpa.o
 
-fsl_dpa-objs += dpaa_eth.o dpaa_eth_sg.o dpaa_eth_common.o
+fsl_dpa-objs += dpaa_eth.o dpaa_eth_sg.o dpaa_eth_common.o dpaa_ethtool.o
diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth_common.c 
b/drivers/net/ethernet/freescale/dpaa/dpaa_eth_common.c
index 89f3b1f..2b95696 100644
--- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth_common.c
+++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth_common.c
@@ -102,6 +102,8 @@ int dpa_netdev_init(struct net_device *net_dev,
memcpy(net_dev->perm_addr, mac_addr, net_dev->addr_len);
memcpy(net_dev->dev_addr, mac_addr, net_dev->addr_len);
 
+   net_dev->ethtool_ops = _ethtool_ops;
+
net_dev->needed_headroom = priv->tx_headroom;
net_dev->watchdog_timeo = msecs_to_jiffies(tx_timeout);
 
diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth_common.h 
b/drivers/net/ethernet/freescale/dpaa/dpaa_eth_common.h
index 2e9471d..160a018 100644
--- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth_common.h
+++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth_common.h
@@ -43,6 +43,9 @@
 /* used in napi related functions */
 extern u16 qman_portal_max;
 
+/* from dpa_ethtool.c */
+extern const struct ethtool_ops dpa_ethtool_ops;
+
 int dpa_netdev_init(struct net_device *net_dev,
const u8 *mac_addr,
u16 tx_timeout);
diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_ethtool.c 
b/drivers/net/ethernet/freescale/dpaa/dpaa_ethtool.c
new file mode 100644
index 000..fa8ba69
--- /dev/null
+++ b/drivers/net/ethernet/freescale/dpaa/dpaa_ethtool.c
@@ -0,0 +1,230 @@
+/* Copyright 2008-2015 Freescale Semiconductor, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ *  notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ * * Neither the name of Freescale Semiconductor nor the
+ *  names of its contributors may be used to endorse or promote products
+ *  derived from this software without specific prior written permission.
+ *
+ *
+ * ALTERNATIVELY, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") as published by the Free Software
+ * Foundation, either version 2 of that License or (at your option) any
+ * later version.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 
THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
+#include 
+
+#include "dpaa_eth.h"
+#include "mac.h"
+#include "dpaa_eth_common.h"
+
+static int dpa_get_settings(struct net_device *net_dev,
+   struct ethtool_cmd *et_cmd)
+{
+   int err;
+   struct dpa_priv_s *priv;
+
+   priv = netdev_priv(net_dev);
+
+   if (!priv->mac_dev->phy_dev) {
+   netdev_dbg(net_dev, "phy device not initialized\n");
+   return 0;
+   }
+
+   err = phy_ethtool_gset(priv->mac_dev->phy_dev, et_cmd);
+
+   return err;
+}
+
+static int dpa_set_settings(struct net_device *net_dev,
+   struct ethtool_cmd *et_cmd)
+{
+   int err;
+   struct dpa_priv_s *priv;
+
+   priv = netdev_priv(net_dev);
+
+   

[v3 1/8] devres: add devm_alloc_percpu()

2015-09-24 Thread Madalin Bucur
Introduce managed counterparts for alloc_percpu() and free_percpu().
Add devm_alloc_percpu() and devm_free_percpu() into the managed
interfaces list.

Signed-off-by: Madalin Bucur 
Tested-by: Madalin-Cristian Bucur 
---
 Documentation/driver-model/devres.txt |  4 +++
 drivers/base/devres.c | 64 +++
 include/linux/device.h| 19 +++
 3 files changed, 87 insertions(+)

diff --git a/Documentation/driver-model/devres.txt 
b/Documentation/driver-model/devres.txt
index 831a536..595fd1b 100644
--- a/Documentation/driver-model/devres.txt
+++ b/Documentation/driver-model/devres.txt
@@ -312,6 +312,10 @@ MEM
   devm_kvasprintf()
   devm_kzalloc()
 
+PER-CPU MEM
+  devm_alloc_percpu()
+  devm_free_percpu()
+
 PCI
   pcim_enable_device() : after success, all PCI ops become managed
   pcim_pin_device(): keep PCI device enabled after release
diff --git a/drivers/base/devres.c b/drivers/base/devres.c
index 8754646..6c314cc 100644
--- a/drivers/base/devres.c
+++ b/drivers/base/devres.c
@@ -10,6 +10,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "base.h"
 
@@ -984,3 +985,66 @@ void devm_free_pages(struct device *dev, unsigned long 
addr)
   ));
 }
 EXPORT_SYMBOL_GPL(devm_free_pages);
+
+static void devm_percpu_release(struct device *dev, void *pdata)
+{
+   void __percpu *p;
+
+   p = *(void __percpu **)pdata;
+   free_percpu(p);
+}
+
+static int devm_percpu_match(struct device *dev, void *data, void *p)
+{
+   struct devres *devr = container_of(data, struct devres, data);
+
+   return *(void **)devr->data == p;
+}
+
+/**
+ * __devm_alloc_percpu - Resource-managed alloc_percpu
+ * @dev: Device to allocate per-cpu memory for
+ * @size: Size of per-cpu memory to allocate
+ * @align: Alignement of per-cpu memory to allocate
+ *
+ * Managed alloc_percpu. Per-cpu memory allocated with this function is
+ * automatically freed on driver detach.
+ *
+ * RETURNS:
+ * Pointer to allocated memory on success, NULL on failure.
+ */
+void __percpu *__devm_alloc_percpu(struct device *dev, size_t size,
+   size_t align)
+{
+   void *p;
+   void __percpu *pcpu;
+
+   pcpu = __alloc_percpu(size, align);
+   if (!pcpu)
+   return NULL;
+
+   p = devres_alloc(devm_percpu_release, sizeof(void *), GFP_KERNEL);
+   if (!p)
+   return NULL;
+
+   *(void __percpu **)p = pcpu;
+
+   devres_add(dev, p);
+
+   return pcpu;
+}
+EXPORT_SYMBOL_GPL(__devm_alloc_percpu);
+
+/**
+ * devm_free_percpu - Resource-managed free_percpu
+ * @dev: Device this memory belongs to
+ * @pdata: Per-cpu memory to free
+ *
+ * Free memory allocated with devm_alloc_percpu().
+ */
+void devm_free_percpu(struct device *dev, void __percpu *pdata)
+{
+   WARN_ON(devres_destroy(dev, devm_percpu_release, devm_percpu_match,
+  (void *)pdata));
+}
+EXPORT_SYMBOL_GPL(devm_free_percpu);
diff --git a/include/linux/device.h b/include/linux/device.h
index 5d7bc63..b563cc5 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -673,6 +673,25 @@ void __iomem *devm_ioremap_resource(struct device *dev, 
struct resource *res);
 int devm_add_action(struct device *dev, void (*action)(void *), void *data);
 void devm_remove_action(struct device *dev, void (*action)(void *), void 
*data);
 
+/**
+ * devm_alloc_percpu - Resource-managed alloc_percpu
+ * @dev: Device to allocate per-cpu memory for
+ * @type: Type to allocate per-cpu memory for
+ *
+ * Managed alloc_percpu. Per-cpu memory allocated with this function is
+ * automatically freed on driver detach.
+ *
+ * RETURNS:
+ * Pointer to allocated memory on success, NULL on failure.
+ */
+#define devm_alloc_percpu(dev, type)  \
+   (typeof(type) __percpu *)__devm_alloc_percpu(dev, sizeof(type), \
+__alignof__(type))
+
+void __percpu *__devm_alloc_percpu(struct device *dev, size_t size,
+  size_t align);
+void devm_free_percpu(struct device *dev, void __percpu *pdata);
+
 struct device_dma_parameters {
/*
 * a low level driver may set these to teach IOMMU code about
-- 
1.7.11.7

--
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/


[v3 6/8] dpaa_eth: add ethtool statistics

2015-09-24 Thread Madalin Bucur
Add a series of counters to be exported through ethtool:
- add detailed counters for reception errors;
- add detailed counters for QMan enqueue reject events;
- count the number of fragmented skbs received from the stack;
- count all frames received on the Tx confirmation path;
- add congestion group statistics;
- count the number of interrupts for each CPU.

Signed-off-by: Ioana Ciornei 
Signed-off-by: Madalin Bucur 
---
 drivers/net/ethernet/freescale/dpaa/dpaa_eth.c |  12 ++
 drivers/net/ethernet/freescale/dpaa/dpaa_eth.h |  34 
 .../net/ethernet/freescale/dpaa/dpaa_eth_common.c  |  40 -
 .../net/ethernet/freescale/dpaa/dpaa_eth_common.h  |   2 +
 drivers/net/ethernet/freescale/dpaa/dpaa_eth_sg.c  |   1 +
 drivers/net/ethernet/freescale/dpaa/dpaa_ethtool.c | 183 +
 6 files changed, 270 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c 
b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
index a04c0aa..d0d3d80 100644
--- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
+++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
@@ -104,6 +104,15 @@ static void _dpa_rx_error(struct net_device *net_dev,
 
percpu_priv->stats.rx_errors++;
 
+   if (fd->status & FM_FD_ERR_DMA)
+   percpu_priv->rx_errors.dme++;
+   if (fd->status & FM_FD_ERR_PHYSICAL)
+   percpu_priv->rx_errors.fpe++;
+   if (fd->status & FM_FD_ERR_SIZE)
+   percpu_priv->rx_errors.fse++;
+   if (fd->status & FM_FD_ERR_PRS_HDR_ERR)
+   percpu_priv->rx_errors.phe++;
+
dpa_fd_release(net_dev, fd);
 }
 
@@ -167,6 +176,8 @@ static void _dpa_tx_conf(struct net_device *net_dev,
percpu_priv->stats.tx_errors++;
}
 
+   percpu_priv->tx_confirm++;
+
skb = _dpa_cleanup_tx_fd(priv, fd);
 
dev_kfree_skb(skb);
@@ -302,6 +313,7 @@ static void priv_ern(struct qman_portal *portal,
 
percpu_priv->stats.tx_dropped++;
percpu_priv->stats.tx_fifo_errors++;
+   count_ern(percpu_priv, msg);
 
/* If we intended this buffer to go into the pool
 * when the FM was done, we need to put it in
diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.h 
b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.h
index 349e052..629ccb8 100644
--- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.h
+++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.h
@@ -192,6 +192,25 @@ struct dpa_bp {
void (*free_buf_cb)(void *addr);
 };
 
+struct dpa_rx_errors {
+   u64 dme;/* DMA Error */
+   u64 fpe;/* Frame Physical Error */
+   u64 fse;/* Frame Size Error */
+   u64 phe;/* Header Error */
+};
+
+/* Counters for QMan ERN frames - one counter per rejection code */
+struct dpa_ern_cnt {
+   u64 cg_tdrop;   /* Congestion group taildrop */
+   u64 wred;   /* WRED congestion */
+   u64 err_cond;   /* Error condition */
+   u64 early_window;   /* Order restoration, frame too early */
+   u64 late_window;/* Order restoration, frame too late */
+   u64 fq_tdrop;   /* FQ taildrop */
+   u64 fq_retired; /* FQ is retired */
+   u64 orp_zero;   /* ORP disabled */
+};
+
 struct dpa_napi_portal {
struct napi_struct napi;
struct qman_portal *p;
@@ -200,7 +219,13 @@ struct dpa_napi_portal {
 struct dpa_percpu_priv_s {
struct net_device *net_dev;
struct dpa_napi_portal *np;
+   u64 in_interrupt;
+   u64 tx_confirm;
+   /* fragmented (non-linear) skbuffs received from the stack */
+   u64 tx_frag_skbuffs;
struct rtnl_link_stats64 stats;
+   struct dpa_rx_errors rx_errors;
+   struct dpa_ern_cnt ern_cnt;
 };
 
 struct dpa_priv_s {
@@ -227,6 +252,14 @@ struct dpa_priv_s {
 * (and the same) congestion group.
 */
struct qman_cgr cgr;
+   /* If congested, when it began. Used for performance stats. */
+   u32 congestion_start_jiffies;
+   /* Number of jiffies the Tx port was congested. */
+   u32 congested_jiffies;
+   /* Counter for the number of times the CGR
+* entered congestion state
+*/
+   u32 cgr_congested_count;
} cgr_data;
/* Use a per-port CGR for ingress traffic. */
bool use_ingress_cgr;
@@ -288,6 +321,7 @@ static inline int dpaa_eth_napi_schedule(struct 
dpa_percpu_priv_s *percpu_priv,
 
np->p = portal;
napi_schedule(>napi);
+   percpu_priv->in_interrupt++;
return 1;
}
}
diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth_common.c 
b/drivers/net/ethernet/freescale/dpaa/dpaa_eth_common.c
index 2b95696..4947cb9 100644
--- 

[PATCH 0/2] usb: gadget: fixes for f_sourcesink and f_loopback

2015-09-24 Thread Robert Baldyga
Hi Felipe,

There are two bugfix patches. The problem was that function parameters
in f_sourcesink and f_loopback were stored in global variables, and in
result setting parameters in one function instance caused overwriting
them in all other instances. This patchset fixes this problem by replacing
global variables with per instance parameters.

Best regards,
Robert Baldyga

Robert Baldyga (2):
  usb: gadget: f_sourcesink: fix function params handling
  usb: gadget: f_loopfack: fix function params handling

 drivers/usb/gadget/function/f_loopback.c   |  22 +++---
 drivers/usb/gadget/function/f_sourcesink.c | 120 +++--
 2 files changed, 74 insertions(+), 68 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/


Re: [linux-sunxi][alsa-devel][PATCH 2/3] dt-binding: Add sunxi SPDIF machine driver

2015-09-24 Thread Chen-Yu Tsai
On Thu, Sep 24, 2015 at 2:04 AM,   wrote:
> From: Marcus Cooper 
>
> Add device tree bindings for the SPDIF machine driver for Allwinner SoC
> devices.

Is there a particular reason for having 2 separate bindings for one piece of
hardware?

Also, both this binding and the driver bits look almost like imx-audio-spdif.
This seems like unneeded duplication. Can we generalize that and use it? Or
just use simple-card?


Regards
ChenYu

> Signed-off-by: Marcus Cooper 
> ---
>  .../bindings/sound/sunxi-audio-spdif.txt   | 36 
> ++
>  1 file changed, 36 insertions(+)
>  create mode 100644 
> Documentation/devicetree/bindings/sound/sunxi-audio-spdif.txt
>
> diff --git a/Documentation/devicetree/bindings/sound/sunxi-audio-spdif.txt 
> b/Documentation/devicetree/bindings/sound/sunxi-audio-spdif.txt
> new file mode 100644
> index 000..b9e8152
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/sound/sunxi-audio-spdif.txt
> @@ -0,0 +1,36 @@
> +Allwinner audio complex with S/PDIF transceiver
> +
> +Required properties:
> +
> +  - compatible : "Allwinner,sunxi-audio-spdif"
> +
> +  - model  : The user-visible name of this sound complex
> +
> +  - spdif-controller   : The phandle of the Allwinner S/PDIF controller
> +
> +
> +Optional properties:
> +
> +  - spdif-out  : This is a boolean property. If present, the
> + transmitting function of S/PDIF will be enabled,
> + indicating there's a physical S/PDIF out connector
> + or jack on the board or it's connecting to some
> + other IP block, such as an HDMI encoder or
> + display-controller.
> +
> +  - spdif-in   : This is a boolean property. If present, the 
> receiving
> + function of S/PDIF will be enabled, indicating there
> + is a physical S/PDIF in connector/jack on the board.
> +
> +* Note: At least one of these two properties should be set in the DT binding.
> +
> +
> +Example:
> +
> +sound-spdif {
> +   compatible = "allwinner,sunxi-audio-spdif";
> +   model = "sunxi-spdif";
> +   spdif-controller = <>;
> +   spdif-out;
> +   spdif-in;
> +};
> --
> 2.5.3
>
> --
> You received this message because you are subscribed to the Google Groups 
> "linux-sunxi" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to linux-sunxi+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
--
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/16] page-flags: define PG_swapcache behavior on compound pages

2015-09-24 Thread Kirill A. Shutemov
Swap cannot handle compound pages so far. Transparent huge pages are
split on the way to swap.

Signed-off-by: Kirill A. Shutemov 
---
 include/linux/page-flags.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index a31d682caeb2..c933416b2f92 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -306,7 +306,7 @@ PAGEFLAG_FALSE(HighMem)
 #endif
 
 #ifdef CONFIG_SWAP
-PAGEFLAG(SwapCache, swapcache, PF_ANY)
+PAGEFLAG(SwapCache, swapcache, PF_NO_COMPOUND)
 #else
 PAGEFLAG_FALSE(SwapCache)
 #endif
-- 
2.5.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 RFC v2] pidns: introduce syscall getvpid

2015-09-24 Thread Oleg Nesterov
On 09/24, Konstantin Khlebnikov wrote:
>
> +SYSCALL_DEFINE3(getvpid, pid_t, pid, int, source, int, target)
> +{
> + struct file *source_file = NULL, *target_file = NULL;
> + struct pid_namespace *source_ns, *target_ns;
> + struct pid *struct_pid;
> + struct ns_common *ns;
> + pid_t result;
> +
> + if (source >= 0) {
> + source_file = proc_ns_fget(source);
> + result = PTR_ERR(source_file);
> + if (IS_ERR(source_file))
> + goto out;
> + ns = get_proc_ns(file_inode(source_file));
> + result = -EINVAL;
> + if (ns->ops->type != CLONE_NEWPID)
> + goto out;
> + source_ns = container_of(ns, struct pid_namespace, ns);
> + } else
> + source_ns = task_active_pid_ns(current);
> +
> + if (target >= 0) {
> + target_file = proc_ns_fget(target);
> + result = PTR_ERR(target_file);
> + if (IS_ERR(target_file))
> + goto out;
> + ns = get_proc_ns(file_inode(target_file));
> + result = -EINVAL;
> + if (ns->ops->type != CLONE_NEWPID)
> + goto out;
> + target_ns = container_of(ns, struct pid_namespace, ns);
> + } else
> + target_ns = task_active_pid_ns(current);
> +

Hmm. Eric, Konstantin, how about (uncompiled/untested) patch below
in a preparation? The code above doesn't look very readable.

In fact I think another helper

#define proc_ns_xxx(file, type) \
container_of(get_proc_ns(file_inode(file)), \
struct type, ns)

makes sense too.

Oleg.
---

diff --git a/fs/nsfs.c b/fs/nsfs.c
index 99521e7..0877dd6 100644
--- a/fs/nsfs.c
+++ b/fs/nsfs.c
@@ -118,9 +118,10 @@ int ns_get_name(char *buf, size_t size, struct task_struct 
*task,
return res;
 }
 
-struct file *proc_ns_fget(int fd)
+struct file *proc_ns_fget(int fd, int nstype)
 {
struct file *file;
+   struct ns_common *ns;
 
file = fget(fd);
if (!file)
@@ -129,6 +130,10 @@ struct file *proc_ns_fget(int fd)
if (file->f_op != _file_operations)
goto out_invalid;
 
+   ns = get_proc_ns(file_inode(file));
+   if (nstype && (ns->ops->type != nstype))
+   goto out_invalid;
+
return file;
 
 out_invalid:
diff --git a/include/linux/proc_ns.h b/include/linux/proc_ns.h
index 42dfc61..84c9770 100644
--- a/include/linux/proc_ns.h
+++ b/include/linux/proc_ns.h
@@ -65,7 +65,7 @@ static inline int ns_alloc_inum(struct ns_common *ns)
 
 #define ns_free_inum(ns) proc_free_inum((ns)->inum)
 
-extern struct file *proc_ns_fget(int fd);
+extern struct file *proc_ns_fget(int fd, int nstype);
 #define get_proc_ns(inode) ((struct ns_common *)(inode)->i_private)
 extern void *ns_get_path(struct path *path, struct task_struct *task,
const struct proc_ns_operations *ns_ops);
diff --git a/kernel/nsproxy.c b/kernel/nsproxy.c
index 49746c8..fee18ba 100644
--- a/kernel/nsproxy.c
+++ b/kernel/nsproxy.c
@@ -226,21 +226,17 @@ SYSCALL_DEFINE2(setns, int, fd, int, nstype)
struct ns_common *ns;
int err;
 
-   file = proc_ns_fget(fd);
+   file = proc_ns_fget(fd, nstype);
if (IS_ERR(file))
return PTR_ERR(file);
 
-   err = -EINVAL;
-   ns = get_proc_ns(file_inode(file));
-   if (nstype && (ns->ops->type != nstype))
-   goto out;
-
new_nsproxy = create_new_namespaces(0, tsk, current_user_ns(), tsk->fs);
if (IS_ERR(new_nsproxy)) {
err = PTR_ERR(new_nsproxy);
goto out;
}
 
+   ns = get_proc_ns(file_inode(file));
err = ns->ops->install(new_nsproxy, ns);
if (err) {
free_nsproxy(new_nsproxy);
diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c
index 572af00..9dfbe68 100644
--- a/net/core/net_namespace.c
+++ b/net/core/net_namespace.c
@@ -424,15 +424,12 @@ struct net *get_net_ns_by_fd(int fd)
struct ns_common *ns;
struct net *net;
 
-   file = proc_ns_fget(fd);
+   file = proc_ns_fget(fd, CLONE_NEWNET);
if (IS_ERR(file))
return ERR_CAST(file);
 
ns = get_proc_ns(file_inode(file));
-   if (ns->ops == _operations)
-   net = get_net(container_of(ns, struct net, ns));
-   else
-   net = ERR_PTR(-EINVAL);
+   net = get_net(container_of(ns, struct net, ns));
 
fput(file);
return net;

--
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/16] page-flags: define behavior SL*B-related flags on compound pages

2015-09-24 Thread Kirill A. Shutemov
SL*B uses compound pages and marks head pages with PG_slab.
__SetPageSlab() and __ClearPageSlab() are never called for tail pages.

The same situation with PG_slob_free in SLOB allocator.

PF_NO_TAIL is appropriate for these flags.

Signed-off-by: Kirill A. Shutemov 
---
 include/linux/page-flags.h | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 10b75615ddf2..c9cd82310e2d 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -254,7 +254,8 @@ PAGEFLAG(Dirty, dirty, PF_HEAD) TESTSCFLAG(Dirty, dirty, 
PF_HEAD)
 PAGEFLAG(LRU, lru, PF_HEAD) __CLEARPAGEFLAG(LRU, lru, PF_HEAD)
 PAGEFLAG(Active, active, PF_HEAD) __CLEARPAGEFLAG(Active, active, PF_HEAD)
TESTCLEARFLAG(Active, active, PF_HEAD)
-__PAGEFLAG(Slab, slab, PF_ANY)
+__PAGEFLAG(Slab, slab, PF_NO_TAIL)
+__PAGEFLAG(SlobFree, slob_free, PF_NO_TAIL)
 PAGEFLAG(Checked, checked, PF_NO_COMPOUND)/* Used by some filesystems 
*/
 PAGEFLAG(Pinned, pinned, PF_ANY) TESTSCFLAG(Pinned, pinned, PF_ANY)/* Xen 
*/
 PAGEFLAG(SavePinned, savepinned, PF_ANY);  /* Xen */
@@ -264,8 +265,6 @@ PAGEFLAG(SwapBacked, swapbacked, PF_ANY)
__CLEARPAGEFLAG(SwapBacked, swapbacked, PF_ANY)
__SETPAGEFLAG(SwapBacked, swapbacked, PF_ANY)
 
-__PAGEFLAG(SlobFree, slob_free, PF_ANY)
-
 /*
  * Private page markings that may be used by the filesystem that owns the page
  * for its own purposes.
-- 
2.5.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 12/16] page-flags: define PG_mlocked behavior on compound pages

2015-09-24 Thread Kirill A. Shutemov
Transparent huge pages can be mlocked -- whole compund page at once.
Something went wrong if we're trying to mlock() tail page.
Let's use PF_NO_TAIL.

Signed-off-by: Kirill A. Shutemov 
---
 include/linux/page-flags.h | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index c933416b2f92..31e68a8c2777 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -316,8 +316,10 @@ PAGEFLAG(Unevictable, unevictable, PF_HEAD)
TESTCLEARFLAG(Unevictable, unevictable, PF_HEAD)
 
 #ifdef CONFIG_MMU
-PAGEFLAG(Mlocked, mlocked, PF_ANY) __CLEARPAGEFLAG(Mlocked, mlocked, PF_ANY)
-   TESTSCFLAG(Mlocked, mlocked, PF_ANY) __TESTCLEARFLAG(Mlocked, mlocked, 
PF_ANY)
+PAGEFLAG(Mlocked, mlocked, PF_NO_TAIL)
+   __CLEARPAGEFLAG(Mlocked, mlocked, PF_NO_TAIL)
+   TESTSCFLAG(Mlocked, mlocked, PF_NO_TAIL)
+   __TESTCLEARFLAG(Mlocked, mlocked, PF_NO_TAIL)
 #else
 PAGEFLAG_FALSE(Mlocked) __CLEARPAGEFLAG_NOOP(Mlocked)
TESTSCFLAG_FALSE(Mlocked) __TESTCLEARFLAG_FALSE(Mlocked)
-- 
2.5.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 01/16] page-flags: trivial cleanup for PageTrans* helpers

2015-09-24 Thread Kirill A. Shutemov
Use TESTPAGEFLAG_FALSE() to get it a bit cleaner.

Signed-off-by: Kirill A. Shutemov 
---
 include/linux/page-flags.h | 18 +++---
 1 file changed, 3 insertions(+), 15 deletions(-)

diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 4fdfb5ed4b43..815246a80e2d 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -485,21 +485,9 @@ static inline int PageTransTail(struct page *page)
 }
 
 #else
-
-static inline int PageTransHuge(struct page *page)
-{
-   return 0;
-}
-
-static inline int PageTransCompound(struct page *page)
-{
-   return 0;
-}
-
-static inline int PageTransTail(struct page *page)
-{
-   return 0;
-}
+TESTPAGEFLAG_FALSE(TransHuge)
+TESTPAGEFLAG_FALSE(TransCompound)
+TESTPAGEFLAG_FALSE(TransTail)
 #endif
 
 /*
-- 
2.5.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 16/16] mm: sanitize page->mapping for tail pages

2015-09-24 Thread Kirill A. Shutemov
We don't define meaning of page->mapping for tail pages.  Currently it's
always NULL, which can be inconsistent with head page and potentially lead
to problems.

Let's poison the pointer to catch all illigal uses.

page_rmapping(), page_mapping() and page_anon_vma() are changed to look on
head page.

The only illegal use I've caught so far is __GPF_COMP pages from sound
subsystem, mapped with PTEs.  do_shared_fault() is changed to use
page_rmapping() instead of direct access to fault_page->mapping.

Signed-off-by: Kirill A. Shutemov 
---
 include/linux/poison.h |  4 
 mm/huge_memory.c   |  2 +-
 mm/memory.c|  2 +-
 mm/page_alloc.c|  6 ++
 mm/util.c  | 10 ++
 5 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/include/linux/poison.h b/include/linux/poison.h
index 317e16de09e5..76c3b6c38c16 100644
--- a/include/linux/poison.h
+++ b/include/linux/poison.h
@@ -32,6 +32,10 @@
 /** mm/debug-pagealloc.c **/
 #define PAGE_POISON 0xaa
 
+/** mm/page_alloc.c /
+
+#define TAIL_MAPPING   ((void *) 0x01014A11 + POISON_POINTER_DELTA)
+
 /** mm/slab.c **/
 /*
  * Magic nums for obj red zoning.
diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index 244c852d565c..65ab7858bbcc 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -1836,7 +1836,7 @@ static void __split_huge_page_refcount(struct page *page,
*/
page_tail->_mapcount = page->_mapcount;
 
-   BUG_ON(page_tail->mapping);
+   BUG_ON(page_tail->mapping != TAIL_MAPPING);
page_tail->mapping = page->mapping;
 
page_tail->index = page->index + i;
diff --git a/mm/memory.c b/mm/memory.c
index caecc64301e9..3bd465a6fa0d 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -3087,7 +3087,7 @@ static int do_shared_fault(struct mm_struct *mm, struct 
vm_area_struct *vma,
 * pinned by vma->vm_file's reference.  We rely on unlock_page()'s
 * release semantics to prevent the compiler from undoing this copying.
 */
-   mapping = fault_page->mapping;
+   mapping = page_rmapping(fault_page);
unlock_page(fault_page);
if ((dirtied || vma->vm_ops->page_mkwrite) && mapping) {
/*
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 321a91747949..9bcfd70b1eb8 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -473,6 +473,7 @@ void prep_compound_page(struct page *page, unsigned int 
order)
for (i = 1; i < nr_pages; i++) {
struct page *p = page + i;
set_page_count(p, 0);
+   p->mapping = TAIL_MAPPING;
set_compound_head(p, page);
}
 }
@@ -864,6 +865,10 @@ static int free_tail_pages_check(struct page *head_page, 
struct page *page)
ret = 0;
goto out;
}
+   if (page->mapping != TAIL_MAPPING) {
+   bad_page(page, "corrupted mapping in tail page", 0);
+   goto out;
+   }
if (unlikely(!PageTail(page))) {
bad_page(page, "PageTail not set", 0);
goto out;
@@ -874,6 +879,7 @@ static int free_tail_pages_check(struct page *head_page, 
struct page *page)
}
ret = 0;
 out:
+   page->mapping = NULL;
clear_compound_head(page);
return ret;
 }
diff --git a/mm/util.c b/mm/util.c
index 9af1c12b310c..902b65a43899 100644
--- a/mm/util.c
+++ b/mm/util.c
@@ -355,7 +355,9 @@ struct anon_vma *page_anon_vma(struct page *page)
 
 struct address_space *page_mapping(struct page *page)
 {
-   unsigned long mapping;
+   struct address_space *mapping;
+
+   page = compound_head(page);
 
/* This happens if someone calls flush_dcache_page on slab page */
if (unlikely(PageSlab(page)))
@@ -368,10 +370,10 @@ struct address_space *page_mapping(struct page *page)
return swap_address_space(entry);
}
 
-   mapping = (unsigned long)page->mapping;
-   if (mapping & PAGE_MAPPING_FLAGS)
+   mapping = page->mapping;
+   if ((unsigned long)mapping & PAGE_MAPPING_FLAGS)
return NULL;
-   return page->mapping;
+   return mapping;
 }
 
 int overcommit_ratio_handler(struct ctl_table *table, int write,
-- 
2.5.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] iwlwifi: Deinline iwl_write8/write32/read32()

2015-09-24 Thread Denys Vlasenko
With this .config: http://busybox.net/~vda/kernel_config_ALLYES_Os,
after deinlining these functions have sizes and callsite counts
as follows:

iwl_write8: 315 bytes, 3 calls
iwl_write32: 296 bytes, 90 calls
iwl_read32: 278 bytes, 51 calls

Total size reduction is about 40 kbytes.

Signed-off-by: Denys Vlasenko 
CC: Johannes Berg 
CC: Emmanuel Grumbach 
CC: Intel Linux Wireless 
CC: Gregory Greenman 
CC: John Linville 
CC: linux-wirel...@vger.kernel.org
CC: linux-kernel@vger.kernel.org
---
 drivers/net/wireless/iwlwifi/iwl-io.c | 22 ++
 drivers/net/wireless/iwlwifi/iwl-io.h | 21 +++--
 2 files changed, 25 insertions(+), 18 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-io.c 
b/drivers/net/wireless/iwlwifi/iwl-io.c
index 27c66e4..782e7e9 100644
--- a/drivers/net/wireless/iwlwifi/iwl-io.c
+++ b/drivers/net/wireless/iwlwifi/iwl-io.c
@@ -38,6 +38,28 @@
 
 #define IWL_POLL_INTERVAL 10   /* microseconds */
 
+void iwl_write8(struct iwl_trans *trans, u32 ofs, u8 val)
+{
+   trace_iwlwifi_dev_iowrite8(trans->dev, ofs, val);
+   iwl_trans_write8(trans, ofs, val);
+}
+IWL_EXPORT_SYMBOL(iwl_write8);
+
+void iwl_write32(struct iwl_trans *trans, u32 ofs, u32 val)
+{
+   trace_iwlwifi_dev_iowrite32(trans->dev, ofs, val);
+   iwl_trans_write32(trans, ofs, val);
+}
+IWL_EXPORT_SYMBOL(iwl_write32);
+
+u32 iwl_read32(struct iwl_trans *trans, u32 ofs)
+{
+   u32 val = iwl_trans_read32(trans, ofs);
+   trace_iwlwifi_dev_ioread32(trans->dev, ofs, val);
+   return val;
+}
+IWL_EXPORT_SYMBOL(iwl_read32);
+
 int iwl_poll_bit(struct iwl_trans *trans, u32 addr,
 u32 bits, u32 mask, int timeout)
 {
diff --git a/drivers/net/wireless/iwlwifi/iwl-io.h 
b/drivers/net/wireless/iwlwifi/iwl-io.h
index 705d12c..501d056 100644
--- a/drivers/net/wireless/iwlwifi/iwl-io.h
+++ b/drivers/net/wireless/iwlwifi/iwl-io.h
@@ -32,24 +32,9 @@
 #include "iwl-devtrace.h"
 #include "iwl-trans.h"
 
-static inline void iwl_write8(struct iwl_trans *trans, u32 ofs, u8 val)
-{
-   trace_iwlwifi_dev_iowrite8(trans->dev, ofs, val);
-   iwl_trans_write8(trans, ofs, val);
-}
-
-static inline void iwl_write32(struct iwl_trans *trans, u32 ofs, u32 val)
-{
-   trace_iwlwifi_dev_iowrite32(trans->dev, ofs, val);
-   iwl_trans_write32(trans, ofs, val);
-}
-
-static inline u32 iwl_read32(struct iwl_trans *trans, u32 ofs)
-{
-   u32 val = iwl_trans_read32(trans, ofs);
-   trace_iwlwifi_dev_ioread32(trans->dev, ofs, val);
-   return val;
-}
+void iwl_write8(struct iwl_trans *trans, u32 ofs, u8 val);
+void iwl_write32(struct iwl_trans *trans, u32 ofs, u32 val);
+u32 iwl_read32(struct iwl_trans *trans, u32 ofs);
 
 static inline void iwl_set_bit(struct iwl_trans *trans, u32 reg, u32 mask)
 {
-- 
1.8.1.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/


Re: [PATCH] tcp: Use absolute system clock for TCP timestamps

2015-09-24 Thread Eric Dumazet
On Thu, Sep 24, 2015 at 7:14 AM, Jovi Zhangwei  wrote:
> From f455dc3958593250909627474100f6cc5c158a5c Mon Sep 17 00:00:00 2001
> From: Marek Majkowski 
> Date: Fri, 11 Sep 2015 06:05:07 -0700
> Subject: [PATCH] tcp: Use absolute system clock for TCP timestamps
>
> Using TCP timestamps is beneficial due for to its purpose in PAWS and when
> its role when SYN cookies are enabled. In practice though TCP timestamps are
> often disabled due to being a perceived security issue - they leak Linux
> system uptime.
>
> This patch introduces a kernel option that makes TCP timestamp always return
> an absolute value derived from a system clock as opposed to jiffies from
> boot.
>
> This patch is based on the approach taken by grsecurity:
> https://grsecurity.net/~spender/random_timestamp.diff
>

Please do not send html messages, they wont reach lists.

May I ask how this patch was really tested ?

It cannot possibly work on current kernels, as TCP Timestamps are
generated from clock samples taken from skb_mstamp_get(),
and you did not change it.

static inline void skb_mstamp_get(struct skb_mstamp *cl)
{
u64 val = local_clock();

do_div(val, NSEC_PER_USEC);
cl->stamp_us = (u32)val;
cl->stamp_jiffies = (u32)jiffies;
}

TCP stack uses tcp_time_stamp internally, we do not want to add
overhead adding an offset on all places.

tp->lsndtime is an example, but we have others.

Therefore, I suggest you add a new function and use it only where needed.

static inline u32 secure_tcp_time_stamp(void)
{
   returns (u32)(tcp_time_stamp + rtc_timestamp_base);
}
--
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] iommu/amd: Fix amd_iommu_detect() (does not fix any issues).

2015-09-24 Thread Joerg Roedel
On Mon, Aug 31, 2015 at 06:13:03PM -0400, j.gli...@gmail.com wrote:
> From: Jérôme Glisse 
> 
> Fix amd_iommu_detect() to return positive value on success, like
> intended, and not zero. This will not change anything in the end
> as AMD IOMMU disable swiotlb and properly associate itself with
> devices even if detect() doesn't return a positive value.
> 
> Signed-off-by: Jérôme Glisse 
> Cc: Joerg Roedel 
> Cc: io...@lists.linux-foundation.org

Applied, thanks.
--
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 v3 4/5] regulators: tps65912: Add regulator driver for the TPS65912 PMIC

2015-09-24 Thread Andrew F. Davis
This patch adds support for TPS65912 PMIC regulators.

The regulators set consists of 4 DCDCs and 10 LDOs. The output
voltages are configurable and are meant to supply power to the
main processor and other components.

Signed-off-by: Andrew F. Davis 
---
 drivers/regulator/Kconfig  |   6 +
 drivers/regulator/Makefile |   1 +
 drivers/regulator/tps65912-regulator.c | 240 +
 3 files changed, 247 insertions(+)
 create mode 100644 drivers/regulator/tps65912-regulator.c

diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig
index 3cb2de9..1dec96a 100644
--- a/drivers/regulator/Kconfig
+++ b/drivers/regulator/Kconfig
@@ -727,6 +727,12 @@ config REGULATOR_TPS65910
help
  This driver supports TPS65910/TPS65911 voltage regulator chips.
 
+config REGULATOR_TPS65912
+   tristate "TI TPS65912 Power regulator"
+   depends on MFD_TPS65912
+   help
+   This driver supports TPS65912 voltage regulator chip.
+
 config REGULATOR_TPS80031
tristate "TI TPS80031/TPS80032 power regualtor driver"
depends on MFD_TPS80031
diff --git a/drivers/regulator/Makefile b/drivers/regulator/Makefile
index 222ff5f..0f81749 100644
--- a/drivers/regulator/Makefile
+++ b/drivers/regulator/Makefile
@@ -91,6 +91,7 @@ obj-$(CONFIG_REGULATOR_TPS65218) += tps65218-regulator.o
 obj-$(CONFIG_REGULATOR_TPS6524X) += tps6524x-regulator.o
 obj-$(CONFIG_REGULATOR_TPS6586X) += tps6586x-regulator.o
 obj-$(CONFIG_REGULATOR_TPS65910) += tps65910-regulator.o
+obj-$(CONFIG_REGULATOR_TPS65912) += tps65912-regulator.o
 obj-$(CONFIG_REGULATOR_TPS80031) += tps80031-regulator.o
 obj-$(CONFIG_REGULATOR_TWL4030) += twl-regulator.o
 obj-$(CONFIG_REGULATOR_VEXPRESS) += vexpress.o
diff --git a/drivers/regulator/tps65912-regulator.c 
b/drivers/regulator/tps65912-regulator.c
new file mode 100644
index 000..343dae1
--- /dev/null
+++ b/drivers/regulator/tps65912-regulator.c
@@ -0,0 +1,240 @@
+/*
+ * Regulator driver for TPS65912x PMIC
+ *
+ * Copyright (C) 2015 Texas Instruments Incorporated - http://www.ti.com/
+ *
+ * Author: Andrew F. Davis 
+ *
+ * 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 "as is" WITHOUT ANY WARRANTY of any
+ * kind, whether expressed or implied; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License version 2 for more details.
+ *
+ * Based on the TPS65218 driver and the previous TPS65912 driver by
+ * Margarita Olaya Cabrera 
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+enum tps65912_regulators { DCDC1, DCDC2, DCDC3, DCDC4, LDO1, LDO2, LDO3,
+   LDO4, LDO5, LDO6, LDO7, LDO8, LDO9, LDO10 };
+
+#define TPS65912_REGULATOR(_name, _id, _ops, _vr, _er, _lr, _nlr)  \
+   {   \
+   .name   = _name,\
+   .id = _id,  \
+   .ops= &_ops,\
+   .n_voltages = 64,   \
+   .type   = REGULATOR_VOLTAGE,\
+   .owner  = THIS_MODULE,  \
+   .vsel_reg   = _vr,  \
+   .vsel_mask  = 0x3f, \
+   .enable_reg = _er,  \
+   .enable_mask= BIT(7),   \
+   .volt_table = NULL, \
+   .linear_ranges  = _lr,  \
+   .n_linear_ranges= _nlr, \
+   }   \
+
+#define TPS65912_INFO(_id, _nm, _min, _max)\
+   [_id] = {   \
+   .id = _id,  \
+   .name   = _nm,  \
+   .min_uV = _min, \
+   .max_uV = _max, \
+   }
+
+static const struct regulator_linear_range tps65912_dcdc_ranges[] = {
+   REGULATOR_LINEAR_RANGE(50, 0x0, 0x3f, 5),
+};
+
+static const struct regulator_linear_range tps65912_ldo_ranges[] = {
+   REGULATOR_LINEAR_RANGE(80, 0x0, 0x20, 25000),
+   REGULATOR_LINEAR_RANGE(165, 0x21, 0x3c, 5),
+   REGULATOR_LINEAR_RANGE(310, 0x3d, 0x3f, 10),
+};
+
+static struct tps_info tps65912_pmic_regs[] = {
+   TPS65912_INFO(DCDC1, "DCDC1", 50, 380),
+   TPS65912_INFO(DCDC2, "DCDC2", 50, 380),
+   TPS65912_INFO(DCDC3, "DCDC3", 

[PATCH v3 2/5] mfd: tps65912: Remove old driver in preparation for new driver

2015-09-24 Thread Andrew F. Davis
The old tps65912 driver is being replaced, delete old driver.

Signed-off-by: Andrew F. Davis 
---
 drivers/gpio/Kconfig   |   6 -
 drivers/gpio/Makefile  |   1 -
 drivers/gpio/gpio-tps65912.c   | 153 --
 drivers/mfd/Kconfig|  26 --
 drivers/mfd/Makefile   |   4 -
 drivers/mfd/tps65912-core.c| 175 ---
 drivers/mfd/tps65912-i2c.c | 139 -
 drivers/mfd/tps65912-irq.c | 217 -
 drivers/mfd/tps65912-spi.c | 141 -
 drivers/regulator/Kconfig  |   6 -
 drivers/regulator/Makefile |   1 -
 drivers/regulator/tps65912-regulator.c | 541 -
 include/linux/mfd/tps65912.h   | 328 
 13 files changed, 1738 deletions(-)
 delete mode 100644 drivers/gpio/gpio-tps65912.c
 delete mode 100644 drivers/mfd/tps65912-core.c
 delete mode 100644 drivers/mfd/tps65912-i2c.c
 delete mode 100644 drivers/mfd/tps65912-irq.c
 delete mode 100644 drivers/mfd/tps65912-spi.c
 delete mode 100644 drivers/regulator/tps65912-regulator.c
 delete mode 100644 include/linux/mfd/tps65912.h

diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index b4fc9e4..fb28483 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -838,12 +838,6 @@ config GPIO_TPS65910
  Select this option to enable GPIO driver for the TPS65910
  chip family.
 
-config GPIO_TPS65912
-   tristate "TI TPS65912 GPIO"
-   depends on (MFD_TPS65912_I2C || MFD_TPS65912_SPI)
-   help
- This driver supports TPS65912 gpio chip
-
 config GPIO_TWL4030
tristate "TWL4030, TWL5030, and TPS659x0 GPIOs"
depends on TWL4030_CORE
diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile
index f79a7c4..605bf89 100644
--- a/drivers/gpio/Makefile
+++ b/drivers/gpio/Makefile
@@ -96,7 +96,6 @@ obj-$(CONFIG_GPIO_TIMBERDALE) += gpio-timberdale.o
 obj-$(CONFIG_GPIO_PALMAS)  += gpio-palmas.o
 obj-$(CONFIG_GPIO_TPS6586X)+= gpio-tps6586x.o
 obj-$(CONFIG_GPIO_TPS65910)+= gpio-tps65910.o
-obj-$(CONFIG_GPIO_TPS65912)+= gpio-tps65912.o
 obj-$(CONFIG_GPIO_TS5500)  += gpio-ts5500.o
 obj-$(CONFIG_GPIO_TWL4030) += gpio-twl4030.o
 obj-$(CONFIG_GPIO_TWL6040) += gpio-twl6040.o
diff --git a/drivers/gpio/gpio-tps65912.c b/drivers/gpio/gpio-tps65912.c
deleted file mode 100644
index 9cdbc0c..000
--- a/drivers/gpio/gpio-tps65912.c
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * Copyright 2011 Texas Instruments Inc.
- *
- * Author: Margarita Olaya 
- *
- *  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 of the License, or (at your
- *  option) any later version.
- *
- * This driver is based on wm8350 implementation.
- */
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-struct tps65912_gpio_data {
-   struct tps65912 *tps65912;
-   struct gpio_chip gpio_chip;
-};
-
-#define to_tgd(gc) container_of(gc, struct tps65912_gpio_data, gpio_chip)
-
-static int tps65912_gpio_get(struct gpio_chip *gc, unsigned offset)
-{
-   struct tps65912_gpio_data *tps65912_gpio = to_tgd(gc);
-   struct tps65912 *tps65912 = tps65912_gpio->tps65912;
-   int val;
-
-   val = tps65912_reg_read(tps65912, TPS65912_GPIO1 + offset);
-
-   if (val & GPIO_STS_MASK)
-   return 1;
-
-   return 0;
-}
-
-static void tps65912_gpio_set(struct gpio_chip *gc, unsigned offset,
- int value)
-{
-   struct tps65912_gpio_data *tps65912_gpio = to_tgd(gc);
-   struct tps65912 *tps65912 = tps65912_gpio->tps65912;
-
-   if (value)
-   tps65912_set_bits(tps65912, TPS65912_GPIO1 + offset,
-   GPIO_SET_MASK);
-   else
-   tps65912_clear_bits(tps65912, TPS65912_GPIO1 + offset,
-   GPIO_SET_MASK);
-}
-
-static int tps65912_gpio_output(struct gpio_chip *gc, unsigned offset,
-   int value)
-{
-   struct tps65912_gpio_data *tps65912_gpio = to_tgd(gc);
-   struct tps65912 *tps65912 = tps65912_gpio->tps65912;
-
-   /* Set the initial value */
-   tps65912_gpio_set(gc, offset, value);
-
-   return tps65912_set_bits(tps65912, TPS65912_GPIO1 + offset,
-   GPIO_CFG_MASK);
-}
-
-static int tps65912_gpio_input(struct gpio_chip *gc, unsigned offset)
-{
-   struct tps65912_gpio_data *tps65912_gpio = to_tgd(gc);
-   struct tps65912 *tps65912 = tps65912_gpio->tps65912;
-
-   return tps65912_clear_bits(tps65912, TPS65912_GPIO1 + offset,
-   GPIO_CFG_MASK);
-}
-
-static 

[PATCH v3 3/5] mfd: tps65912: Add driver for the TPS65912 PMIC

2015-09-24 Thread Andrew F. Davis
This patch adds support for TPS65912 mfd device. It provides
communication through the I2C and SPI interfaces. It contains
the following components:

 - Regulators
 - GPIO controller

Signed-off-by: Andrew F. Davis 
---
 drivers/mfd/Kconfig  |  24 +++
 drivers/mfd/Makefile |   3 +
 drivers/mfd/tps65912-core.c  | 114 +
 drivers/mfd/tps65912-i2c.c   |  86 ++
 drivers/mfd/tps65912-spi.c   |  85 ++
 include/linux/mfd/tps65912.h | 393 +++
 6 files changed, 705 insertions(+)
 create mode 100644 drivers/mfd/tps65912-core.c
 create mode 100644 drivers/mfd/tps65912-i2c.c
 create mode 100644 drivers/mfd/tps65912-spi.c
 create mode 100644 include/linux/mfd/tps65912.h

diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index 9a8df8e..4663658 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -1167,6 +1167,30 @@ config MFD_TPS65910
  if you say yes here you get support for the TPS65910 series of
  Power Management chips.
 
+config MFD_TPS65912
+   tristate
+   select REGMAP
+   select REGMAP_IRQ
+   select MFD_CORE
+
+config MFD_TPS65912_I2C
+   tristate "TI TPS65912 Power Management chip with I2C"
+   select MFD_TPS65912
+   select REGMAP_I2C
+   depends on I2C
+   help
+ If you say yes here you get support for the TPS65912 series of
+ PM chips with I2C interface.
+
+config MFD_TPS65912_SPI
+   tristate "TI TPS65912 Power Management chip with SPI"
+   select MFD_TPS65912
+   select REGMAP_SPI
+   depends on SPI_MASTER
+   help
+ If you say yes here you get support for the TPS65912 series of
+ PM chips with SPI interface.
+
 config MFD_TPS80031
bool "TI TPS80031/TPS80032 Power Management chips"
depends on I2C=y
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
index 004aa76..49c3530 100644
--- a/drivers/mfd/Makefile
+++ b/drivers/mfd/Makefile
@@ -69,6 +69,9 @@ obj-$(CONFIG_TPS6507X)+= tps6507x.o
 obj-$(CONFIG_MFD_TPS65217) += tps65217.o
 obj-$(CONFIG_MFD_TPS65218) += tps65218.o
 obj-$(CONFIG_MFD_TPS65910) += tps65910.o
+obj-$(CONFIG_MFD_TPS65912) += tps65912-core.o
+obj-$(CONFIG_MFD_TPS65912_I2C) += tps65912-i2c.o
+obj-$(CONFIG_MFD_TPS65912_SPI)  += tps65912-spi.o
 obj-$(CONFIG_MFD_TPS80031) += tps80031.o
 obj-$(CONFIG_MENELAUS) += menelaus.o
 
diff --git a/drivers/mfd/tps65912-core.c b/drivers/mfd/tps65912-core.c
new file mode 100644
index 000..8dd1aac
--- /dev/null
+++ b/drivers/mfd/tps65912-core.c
@@ -0,0 +1,114 @@
+/*
+ * Core functions for TI TPS65912x PMIC
+ *
+ * Copyright (C) 2015 Texas Instruments Incorporated - http://www.ti.com/
+ *
+ * Author: Andrew F. Davis 
+ *
+ * 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 "as is" WITHOUT ANY WARRANTY of any
+ * kind, whether expressed or implied; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License version 2 for more details.
+ *
+ * Based on the TPS65218 driver and the previous TPS65912 driver by
+ * Margarita Olaya Cabrera 
+ */
+
+#include 
+#include 
+#include 
+
+#include 
+
+#define TPS65912_IRQ(_name, _reg, _offset) \
+   [TPS65912_IRQ_ ## _name] = {\
+   .mask = TPS65912_ ## _reg ## _ ## _name,\
+   .reg_offset = _offset,  \
+   }
+
+static const struct regmap_irq tps65912_irqs[] = {
+   /* INT_STS IRQs */
+   TPS65912_IRQ(PWRHOLD_F, INT_STS, 0),
+   TPS65912_IRQ(VMON, INT_STS, 0),
+   TPS65912_IRQ(PWRON, INT_STS, 0),
+   TPS65912_IRQ(PWRON_LP, INT_STS, 0),
+   TPS65912_IRQ(PWRHOLD_R, INT_STS, 0),
+   TPS65912_IRQ(HOTDIE, INT_STS, 0),
+   TPS65912_IRQ(GPIO1_R, INT_STS, 0),
+   TPS65912_IRQ(GPIO1_F, INT_STS, 0),
+   /* INT_STS2 IRQs */
+   TPS65912_IRQ(GPIO2_R, INT_STS2, 1),
+   TPS65912_IRQ(GPIO2_F, INT_STS2, 1),
+   TPS65912_IRQ(GPIO3_R, INT_STS2, 1),
+   TPS65912_IRQ(GPIO3_F, INT_STS2, 1),
+   TPS65912_IRQ(GPIO4_R, INT_STS2, 1),
+   TPS65912_IRQ(GPIO4_F, INT_STS2, 1),
+   TPS65912_IRQ(GPIO5_R, INT_STS2, 1),
+   TPS65912_IRQ(GPIO5_F, INT_STS2, 1),
+   /* INT_STS3 IRQs */
+   TPS65912_IRQ(PGOOD_DCDC1, INT_STS3, 2),
+   TPS65912_IRQ(PGOOD_DCDC2, INT_STS3, 2),
+   TPS65912_IRQ(PGOOD_DCDC3, INT_STS3, 2),
+   TPS65912_IRQ(PGOOD_DCDC4, INT_STS3, 2),
+   TPS65912_IRQ(PGOOD_LDO1, INT_STS3, 2),
+   TPS65912_IRQ(PGOOD_LDO2, INT_STS3, 2),
+   TPS65912_IRQ(PGOOD_LDO3, INT_STS3, 2),
+   TPS65912_IRQ(PGOOD_LDO4, INT_STS3, 2),
+   /* INT_STS4 IRQs */
+   TPS65912_IRQ(PGOOD_LDO5, INT_STS4, 3),
+   TPS65912_IRQ(PGOOD_LDO6, 

[PATCH 08/16] page-flags: define behavior of Xen-related flags on compound pages

2015-09-24 Thread Kirill A. Shutemov
PG_pinned and PG_savepinned are about page table's pages which are never
compound.

I'm not so sure about PG_foreign, but it seems we shouldn't see compound
pages there too.

Let's use PF_NO_COMPOUND for all of them.

Signed-off-by: Kirill A. Shutemov 
---
 include/linux/page-flags.h | 10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index c9cd82310e2d..adaa2b39f471 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -257,9 +257,13 @@ PAGEFLAG(Active, active, PF_HEAD) __CLEARPAGEFLAG(Active, 
active, PF_HEAD)
 __PAGEFLAG(Slab, slab, PF_NO_TAIL)
 __PAGEFLAG(SlobFree, slob_free, PF_NO_TAIL)
 PAGEFLAG(Checked, checked, PF_NO_COMPOUND)/* Used by some filesystems 
*/
-PAGEFLAG(Pinned, pinned, PF_ANY) TESTSCFLAG(Pinned, pinned, PF_ANY)/* Xen 
*/
-PAGEFLAG(SavePinned, savepinned, PF_ANY);  /* Xen */
-PAGEFLAG(Foreign, foreign, PF_ANY);/* Xen */
+
+/* Xen */
+PAGEFLAG(Pinned, pinned, PF_NO_COMPOUND)
+   TESTSCFLAG(Pinned, pinned, PF_NO_COMPOUND)
+PAGEFLAG(SavePinned, savepinned, PF_NO_COMPOUND);
+PAGEFLAG(Foreign, foreign, PF_NO_COMPOUND);
+
 PAGEFLAG(Reserved, reserved, PF_ANY) __CLEARPAGEFLAG(Reserved, reserved, 
PF_ANY)
 PAGEFLAG(SwapBacked, swapbacked, PF_ANY)
__CLEARPAGEFLAG(SwapBacked, swapbacked, PF_ANY)
-- 
2.5.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 15/16] page-flags: look at head page if the flag is encoded in page->mapping

2015-09-24 Thread Kirill A. Shutemov
PageAnon() and PageKsm() look at lower bits of page->mapping to check if
the page is Anon or KSM.  page->mapping can be overloaded in tail pages.

Let's always look at head page to avoid false-positives.

Signed-off-by: Kirill A. Shutemov 
---
 include/linux/page-flags.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index e3ccd95de660..6f5df65d1038 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -369,6 +369,7 @@ PAGEFLAG(Idle, idle, PF_ANY)
 
 static inline int PageAnon(struct page *page)
 {
+   page = compound_head(page);
return ((unsigned long)page->mapping & PAGE_MAPPING_ANON) != 0;
 }
 
@@ -381,6 +382,7 @@ static inline int PageAnon(struct page *page)
  */
 static inline int PageKsm(struct page *page)
 {
+   page = compound_head(page);
return ((unsigned long)page->mapping & PAGE_MAPPING_FLAGS) ==
(PAGE_MAPPING_ANON | PAGE_MAPPING_KSM);
 }
-- 
2.5.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 3/3] sched: add_nr_running(): drop tick_nohz_full_cpu() check

2015-09-24 Thread Luiz Capitulino
On Thu, 24 Sep 2015 16:44:18 +0200
Frederic Weisbecker  wrote:

> On Thu, Sep 10, 2015 at 03:58:27PM -0400, Luiz Capitulino wrote:
> > tick_nohz_full_kick_cpu() performs the same check.
> > 
> > Signed-off-by: Luiz Capitulino 
> > ---
> >  kernel/sched/sched.h | 20 +---
> >  1 file changed, 9 insertions(+), 11 deletions(-)
> > 
> > diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
> > index 68cda11..102eb18 100644
> > --- a/kernel/sched/sched.h
> > +++ b/kernel/sched/sched.h
> > @@ -1323,17 +1323,15 @@ static inline void add_nr_running(struct rq *rq, 
> > unsigned count)
> >  #endif
> >  
> >  #ifdef CONFIG_NO_HZ_FULL
> > -   if (tick_nohz_full_cpu(rq->cpu)) {
> > -   /*
> > -* Tick is needed if more than one task runs on a CPU.
> > -* Send the target an IPI to kick it out of nohz mode.
> > -*
> > -* We assume that IPI implies full memory barrier and 
> > the
> > -* new value of rq->nr_running is visible on reception
> > -* from the target.
> > -*/
> > -   tick_nohz_full_kick_cpu(rq->cpu);
> > -   }
> > +   /*
> > +* Tick is needed if more than one task runs on a CPU.
> > +* Send the target an IPI to kick it out of nohz mode.
> > +*
> > +* We assume that IPI implies full memory barrier and the
> > +* new value of rq->nr_running is visible on reception
> > +* from the target.
> > +*/
> > +   tick_nohz_full_kick_cpu(rq->cpu);
> 
> Nope, we want to keep this because tick_nohz_full_cpu() does a static key 
> check.
> Most users don't care about nohz_full and I really want to keep nohz full off 
> case
> overhead to the bare minimum.

Makes sense.

> 
> Thanks.
> 
> >  #endif
> > }
> >  }
> > -- 
> > 2.1.0
> > 
> 

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


Re: [PATCH v2] scsi: Export SCSI Inquiry data to sysfs

2015-09-24 Thread Johannes Thumshirn

Ping?
-- 
Johannes Thumshirn  Storage
jthumsh...@suse.de+49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
--
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 v3 1/5] Documentation: tps65912: Add DT bindings for the TPS65912 PMIC

2015-09-24 Thread Andrew F. Davis
The TPS65912 PMIC contains several regulators and a GPIO controller.
Add bindings for the TPS65912 PMIC.

Signed-off-by: Andrew F. Davis 
---
 .../devicetree/bindings/gpio/gpio-tps65912.txt | 16 +
 Documentation/devicetree/bindings/mfd/tps65912.txt | 42 ++
 .../bindings/regulator/tps65912-regulator.txt  | 32 +
 3 files changed, 90 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/gpio/gpio-tps65912.txt
 create mode 100644 Documentation/devicetree/bindings/mfd/tps65912.txt
 create mode 100644 
Documentation/devicetree/bindings/regulator/tps65912-regulator.txt

diff --git a/Documentation/devicetree/bindings/gpio/gpio-tps65912.txt 
b/Documentation/devicetree/bindings/gpio/gpio-tps65912.txt
new file mode 100644
index 000..0c5c05c4
--- /dev/null
+++ b/Documentation/devicetree/bindings/gpio/gpio-tps65912.txt
@@ -0,0 +1,16 @@
+* TPS65912 GPIO Controller bindings
+
+Required properties:
+ - compatible : Should be "ti,tps65912-gpio".
+ - gpio-controller : Marks the device node as a GPIO Controller.
+ - #gpio-cells : Should be two.  The first cell is the pin number and
+ the second cell is used to specify flags.
+ See include/dt-bindings/gpio/gpio.h for possible values.
+
+Example:
+
+   gpio4: tps65912_gpio {
+   compatible = "ti,tps65912-gpio";
+   gpio-controller;
+   #gpio-cells = <2>;
+   };
diff --git a/Documentation/devicetree/bindings/mfd/tps65912.txt 
b/Documentation/devicetree/bindings/mfd/tps65912.txt
new file mode 100644
index 000..a2c94b2
--- /dev/null
+++ b/Documentation/devicetree/bindings/mfd/tps65912.txt
@@ -0,0 +1,42 @@
+* TPS65912 Power Management Integrated Circuit bindings
+
+Required properties:
+ - compatible : Should be "ti,tps65912".
+ - reg : Slave address or chip select number (I2C / SPI).
+ - interrupt-parent : The parent interrupt controller.
+ - interrupts : The interrupt line the device is connected to.
+ - interrupt-controller : Marks the device node as an interrupt controller.
+ - #interrupt-cells: The number of cells to describe an IRQ, this should be 2.
+ The first cell is the IRQ number.
+ The second cell is the flags, encoded as the trigger masks from
+ ../interrupt-controller/interrupts.txt
+
+Additional nodes defined in:
+ - Regulators: ../regulator/tps65912-regulator.txt
+ - GPIO: ../gpio/gpio-tps65912.txt.
+
+Example:
+
+   pmic: tps65912@2d {
+   compatible = "ti,tps65912";
+   reg = <0x2d>;
+   interrupt-parent = <>;
+   interrupts = <28 IRQ_TYPE_LEVEL_LOW>;
+   interrupt-controller;
+   #interrupt-cells = <2>;
+
+   dcdc1: regulator-dcdc1 {
+   compatible = "ti,tps65912-dcdc1";
+   regulator-name = "vdd_core";
+   regulator-min-microvolt = <912000>;
+   regulator-max-microvolt = <1144000>;
+   regulator-boot-on;
+   regulator-always-on;
+   };
+
+   gpio4: tps65912_gpio {
+   compatible = "ti,tps65912-gpio";
+   gpio-controller;
+   #gpio-cells = <2>;
+   };
+   };
diff --git a/Documentation/devicetree/bindings/regulator/tps65912-regulator.txt 
b/Documentation/devicetree/bindings/regulator/tps65912-regulator.txt
new file mode 100644
index 000..e8c21f3
--- /dev/null
+++ b/Documentation/devicetree/bindings/regulator/tps65912-regulator.txt
@@ -0,0 +1,32 @@
+* TPS65912 regulator bindings
+
+Required properties:
+ - compatible: Should be:
+   - "ti,tps65912-dcdc1" for DCDC1
+   - "ti,tps65912-dcdc2" for DCDC2
+   - "ti,tps65912-dcdc3" for DCDC3
+   - "ti,tps65912-dcdc4" for DCDC4
+   - "ti,tps65912-ldo1" for LDO1
+   - "ti,tps65912-ldo2" for LDO2
+   - "ti,tps65912-ldo3" for LDO3
+   - "ti,tps65912-ldo4" for LDO4
+   - "ti,tps65912-ldo5" for LDO5
+   - "ti,tps65912-ldo6" for LDO6
+   - "ti,tps65912-ldo7" for LDO7
+   - "ti,tps65912-ldo8" for LDO8
+   - "ti,tps65912-ldo9" for LDO9
+   - "ti,tps65912-ldo10" for LDO10
+
+Optional properties:
+ - Any optional property defined in ../regulator/regulator.txt
+
+Example:
+
+   xyz: regulator@0 {
+   compatible = "ti,tps65912-dcdc1";
+   regulator-name = "vdd_core";
+   regulator-min-microvolt = <912000>;
+   regulator-max-microvolt = <1144000>;
+   regulator-boot-on;
+   regulator-always-on;
+   };
-- 
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 v3 5/5] gpio: tps65912: Add GPIO driver for the TPS65912 PMIC

2015-09-24 Thread Andrew F. Davis
This patch adds support for the TPS65912 PMIC GPIOs.

TPS65912 has five configurable GPIOs that can be used for several
purposes.

Signed-off-by: Andrew F. Davis 
---
 drivers/gpio/Kconfig |   6 ++
 drivers/gpio/Makefile|   1 +
 drivers/gpio/gpio-tps65912.c | 138 +++
 3 files changed, 145 insertions(+)
 create mode 100644 drivers/gpio/gpio-tps65912.c

diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index fb28483..82218fa 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -838,6 +838,12 @@ config GPIO_TPS65910
  Select this option to enable GPIO driver for the TPS65910
  chip family.
 
+config GPIO_TPS65912
+   tristate "TI TPS65912 GPIO"
+   depends on MFD_TPS65912
+   help
+ This driver supports TPS65912 gpio chip
+
 config GPIO_TWL4030
tristate "TWL4030, TWL5030, and TPS659x0 GPIOs"
depends on TWL4030_CORE
diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile
index 605bf89..f79a7c4 100644
--- a/drivers/gpio/Makefile
+++ b/drivers/gpio/Makefile
@@ -96,6 +96,7 @@ obj-$(CONFIG_GPIO_TIMBERDALE) += gpio-timberdale.o
 obj-$(CONFIG_GPIO_PALMAS)  += gpio-palmas.o
 obj-$(CONFIG_GPIO_TPS6586X)+= gpio-tps6586x.o
 obj-$(CONFIG_GPIO_TPS65910)+= gpio-tps65910.o
+obj-$(CONFIG_GPIO_TPS65912)+= gpio-tps65912.o
 obj-$(CONFIG_GPIO_TS5500)  += gpio-ts5500.o
 obj-$(CONFIG_GPIO_TWL4030) += gpio-twl4030.o
 obj-$(CONFIG_GPIO_TWL6040) += gpio-twl6040.o
diff --git a/drivers/gpio/gpio-tps65912.c b/drivers/gpio/gpio-tps65912.c
new file mode 100644
index 000..4707e62
--- /dev/null
+++ b/drivers/gpio/gpio-tps65912.c
@@ -0,0 +1,138 @@
+/*
+ * TI TPS65912x GPIO Driver
+ *
+ * Copyright (C) 2015 Texas Instruments Incorporated - http://www.ti.com/
+ *
+ * Author: Andrew F. Davis 
+ *
+ * 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 "as is" WITHOUT ANY WARRANTY of any
+ * kind, whether expressed or implied; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License version 2 for more details.
+ *
+ * Based on the Arizona GPIO driver and the previous TPS65912 driver by
+ * Margarita Olaya Cabrera 
+ */
+
+#include 
+#include 
+#include 
+
+#include 
+
+struct tps65912_gpio {
+   struct tps65912 *tps;
+   struct gpio_chip gpio_chip;
+};
+
+#define to_gpio(gc) container_of(gc, struct tps65912_gpio, gpio_chip)
+
+static int tps65912_gpio_get(struct gpio_chip *gc, unsigned offset)
+{
+   struct tps65912_gpio *gpio = to_gpio(gc);
+   int ret, val;
+
+   ret = regmap_read(gpio->tps->regmap, TPS65912_GPIO1 + offset, );
+   if (ret < 0)
+   return ret;
+
+   return val & GPIO_STS_MASK;
+}
+
+static void tps65912_gpio_set(struct gpio_chip *gc, unsigned offset,
+ int value)
+{
+   struct tps65912_gpio *gpio = to_gpio(gc);
+
+   regmap_update_bits(gpio->tps->regmap, TPS65912_GPIO1 + offset,
+  GPIO_SET_MASK, value ? GPIO_SET_MASK : 0);
+}
+
+static int tps65912_gpio_output(struct gpio_chip *gc, unsigned offset,
+   int value)
+{
+   struct tps65912_gpio *gpio = to_gpio(gc);
+
+   /* Set the initial value */
+   tps65912_gpio_set(gc, offset, value);
+
+   return regmap_update_bits(gpio->tps->regmap, TPS65912_GPIO1 + offset,
+ GPIO_CFG_MASK, GPIO_CFG_MASK);
+}
+
+static int tps65912_gpio_input(struct gpio_chip *gc, unsigned offset)
+{
+   struct tps65912_gpio *gpio = to_gpio(gc);
+
+   return regmap_update_bits(gpio->tps->regmap, TPS65912_GPIO1 + offset,
+ GPIO_CFG_MASK, 0);
+}
+
+static const struct of_device_id tps65912_gpio_of_match_table[] = {
+   { .compatible = "ti,tps65912-gpio", },
+   { /* sentinel */ },
+};
+MODULE_DEVICE_TABLE(of, tps65912_gpio_of_match_table);
+
+static struct gpio_chip template_chip = {
+   .label  = "tps65912-gpio",
+   .owner  = THIS_MODULE,
+   .direction_input= tps65912_gpio_input,
+   .direction_output   = tps65912_gpio_output,
+   .get= tps65912_gpio_get,
+   .set= tps65912_gpio_set,
+   .can_sleep  = true,
+   .ngpio  = 5,
+   .base   = -1,
+};
+
+static int tps65912_gpio_probe(struct platform_device *pdev)
+{
+   struct tps65912_gpio *gpio;
+   int ret;
+
+   gpio = devm_kzalloc(>dev, sizeof(*gpio), GFP_KERNEL);
+   if (!gpio)
+   return -ENOMEM;
+
+   gpio->tps = dev_get_drvdata(pdev->dev.parent);
+   gpio->gpio_chip = template_chip;
+   ret = gpiochip_add(>gpio_chip);
+   if 

[PATCH v3 0/5] mfd: tps65912: Driver rewrite with DT support

2015-09-24 Thread Andrew F. Davis
In an effort to cleanup this driver and add Device Tree support
the driver has been rewritten based on new driver styles and
modern kernel driver helpers. This has nearly halved the lines
of code while keeping all previous functionality.

Platform file based initialization has been dropped as there is
no examples of this use in the kernel.

v1 can be found here: [1] v2: [2]

Changes from v2:
 - Split the series further into subsystems

Changes from v1:
 - Split the rewrite into delete/create patches
 - several small fixes as discussed in v1 thread

[1] http://www.spinics.net/lists/devicetree/msg93863.html
[2] http://www.spinics.net/lists/devicetree/msg95003.html

Andrew F. Davis (5):
  Documentation: tps65912: Add DT bindings for the TPS65912 PMIC
  mfd: tps65912: Remove old driver in preparation for new driver
  mfd: tps65912: Add driver for the TPS65912 PMIC
  regulators: tps65912: Add regulator driver for the TPS65912 PMIC
  gpio: tps65912: Add GPIO driver for the TPS65912 PMIC

 .../devicetree/bindings/gpio/gpio-tps65912.txt |  16 +
 Documentation/devicetree/bindings/mfd/tps65912.txt |  42 ++
 .../bindings/regulator/tps65912-regulator.txt  |  32 +
 drivers/gpio/Kconfig   |   2 +-
 drivers/gpio/gpio-tps65912.c   | 291 
 drivers/mfd/Kconfig|  20 +-
 drivers/mfd/Makefile   |   3 +-
 drivers/mfd/tps65912-core.c| 289 +++-
 drivers/mfd/tps65912-i2c.c | 225 +++---
 drivers/mfd/tps65912-irq.c | 217 --
 drivers/mfd/tps65912-spi.c | 226 +++---
 drivers/regulator/Kconfig  |   2 +-
 drivers/regulator/tps65912-regulator.c | 781 +++--
 include/linux/mfd/tps65912.h   | 255 ---
 14 files changed, 925 insertions(+), 1476 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/gpio/gpio-tps65912.txt
 create mode 100644 Documentation/devicetree/bindings/mfd/tps65912.txt
 create mode 100644 
Documentation/devicetree/bindings/regulator/tps65912-regulator.txt
 rewrite drivers/gpio/gpio-tps65912.c (68%)
 rewrite drivers/mfd/tps65912-core.c (96%)
 rewrite drivers/mfd/tps65912-i2c.c (93%)
 delete mode 100644 drivers/mfd/tps65912-irq.c
 rewrite drivers/mfd/tps65912-spi.c (92%)
 rewrite drivers/regulator/tps65912-regulator.c (94%)

-- 
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 06/16] page-flags: define behavior of LRU-related flags on compound pages

2015-09-24 Thread Kirill A. Shutemov
Only head pages are ever on LRU. Let's use PF_HEAD policy to avoid any
confusion for all LRU-related flags.

Signed-off-by: Kirill A. Shutemov 
---
 include/linux/page-flags.h | 17 +
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 63db7483c264..10b75615ddf2 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -246,13 +246,14 @@ static inline int __TestClearPage##uname(struct page 
*page) { return 0; }
 
 __PAGEFLAG(Locked, locked, PF_NO_TAIL)
 PAGEFLAG(Error, error, PF_NO_COMPOUND) TESTCLEARFLAG(Error, error, 
PF_NO_COMPOUND)
-PAGEFLAG(Referenced, referenced, PF_ANY) TESTCLEARFLAG(Referenced, referenced, 
PF_ANY)
-   __SETPAGEFLAG(Referenced, referenced, PF_ANY)
+PAGEFLAG(Referenced, referenced, PF_HEAD)
+   TESTCLEARFLAG(Referenced, referenced, PF_HEAD)
+   __SETPAGEFLAG(Referenced, referenced, PF_HEAD)
 PAGEFLAG(Dirty, dirty, PF_HEAD) TESTSCFLAG(Dirty, dirty, PF_HEAD)
__CLEARPAGEFLAG(Dirty, dirty, PF_HEAD)
-PAGEFLAG(LRU, lru, PF_ANY) __CLEARPAGEFLAG(LRU, lru, PF_ANY)
-PAGEFLAG(Active, active, PF_ANY) __CLEARPAGEFLAG(Active, active, PF_ANY)
-   TESTCLEARFLAG(Active, active, PF_ANY)
+PAGEFLAG(LRU, lru, PF_HEAD) __CLEARPAGEFLAG(LRU, lru, PF_HEAD)
+PAGEFLAG(Active, active, PF_HEAD) __CLEARPAGEFLAG(Active, active, PF_HEAD)
+   TESTCLEARFLAG(Active, active, PF_HEAD)
 __PAGEFLAG(Slab, slab, PF_ANY)
 PAGEFLAG(Checked, checked, PF_NO_COMPOUND)/* Used by some filesystems 
*/
 PAGEFLAG(Pinned, pinned, PF_ANY) TESTSCFLAG(Pinned, pinned, PF_ANY)/* Xen 
*/
@@ -306,9 +307,9 @@ PAGEFLAG(SwapCache, swapcache, PF_ANY)
 PAGEFLAG_FALSE(SwapCache)
 #endif
 
-PAGEFLAG(Unevictable, unevictable, PF_ANY)
-   __CLEARPAGEFLAG(Unevictable, unevictable, PF_ANY)
-   TESTCLEARFLAG(Unevictable, unevictable, PF_ANY)
+PAGEFLAG(Unevictable, unevictable, PF_HEAD)
+   __CLEARPAGEFLAG(Unevictable, unevictable, PF_HEAD)
+   TESTCLEARFLAG(Unevictable, unevictable, PF_HEAD)
 
 #ifdef CONFIG_MMU
 PAGEFLAG(Mlocked, mlocked, PF_ANY) __CLEARPAGEFLAG(Mlocked, mlocked, PF_ANY)
-- 
2.5.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 03/19] libata: samsung_cf: fix handling platform_get_irq result

2015-09-24 Thread Tejun Heo
On Thu, Sep 24, 2015 at 04:00:11PM +0200, Andrzej Hajda wrote:
> The function can return negative value.
> 
> The problem has been detected using proposed semantic patch
> scripts/coccinelle/tests/assign_signed_to_unsigned.cocci [1].
> 
> [1]: http://permalink.gmane.org/gmane.linux.kernel/2046107
> 
> Signed-off-by: Andrzej Hajda 
> ---
> Hi,
> 
> To avoid problems with too many mail recipients I have sent whole
> patchset only to LKML. Anyway patches have no dependencies.

Can we just change s3c_ide_info->irq to int instead?

Thanks.

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


Re: [PATCH] ARM: at91/dt: pullup dbgu rx instead of tx

2015-09-24 Thread Alexandre Belloni
Hi Peter,

Thanks for the patch but you actually got beaten by Sylvain:
http://lists.infradead.org/pipermail/linux-arm-kernel/2015-September/368426.html

On 24/09/2015 at 16:44:15 +0200, Peter Rosin wrote :
> From: Peter Rosin 
> 
> It seems pointless to pullup the tx line, but there is value in pulling
> up the rx line.
> 
> Cc: sta...@vger.kernel.org
> Signed-off-by: Peter Rosin 
> ---
>  arch/arm/boot/dts/sama5d3.dtsi |4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm/boot/dts/sama5d3.dtsi b/arch/arm/boot/dts/sama5d3.dtsi
> index 9e2444b07bce..304a40c5552a 100644
> --- a/arch/arm/boot/dts/sama5d3.dtsi
> +++ b/arch/arm/boot/dts/sama5d3.dtsi
> @@ -545,8 +545,8 @@
>   dbgu {
>   pinctrl_dbgu: dbgu-0 {
>   atmel,pins =
> -  AT91_PERIPH_A AT91_PINCTRL_NONE   /* PB30 periph A */
> -  AT91_PIOB 31 
> AT91_PERIPH_A AT91_PINCTRL_PULL_UP>;  /* PB31 periph A with pullup */
> +  AT91_PERIPH_A AT91_PINCTRL_PULL_UP/* PB30 periph A with pullup */
> +  AT91_PIOB 31 
> AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PB31 periph A */
>   };
>   };
>  
> -- 
> 1.7.10.4
> 

-- 
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android 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 04/16] page-flags: define PG_locked behavior on compound pages

2015-09-24 Thread Kirill A. Shutemov
lock_page() must operate on the whole compound page.  It doesn't make much
sense to lock part of compound page.  Change code to use head page's
PG_locked, if tail page is passed.

This patch also gets rid of custom helper functions -- __set_page_locked()
and __clear_page_locked().  They are replaced with helpers generated by
__SETPAGEFLAG/__CLEARPAGEFLAG.  Tail pages to these helper would trigger
VM_BUG_ON().

SLUB uses PG_locked as a bit spin locked.  IIUC, tail pages should never
appear there.  VM_BUG_ON() is added to make sure that this assumption is
correct.

Signed-off-by: Kirill A. Shutemov 
---
 fs/cifs/file.c |  8 
 include/linux/page-flags.h |  2 +-
 include/linux/pagemap.h| 25 -
 mm/filemap.c   | 15 +--
 mm/ksm.c   |  2 +-
 mm/memory-failure.c|  2 +-
 mm/migrate.c   |  2 +-
 mm/shmem.c |  4 ++--
 mm/slub.c  |  2 ++
 mm/swap_state.c|  4 ++--
 mm/vmscan.c|  2 +-
 11 files changed, 32 insertions(+), 36 deletions(-)

diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index e2a6af1508af..94f81962368c 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -3390,13 +3390,13 @@ readpages_get_pages(struct address_space *mapping, 
struct list_head *page_list,
 * should have access to this page, we're safe to simply set
 * PG_locked without checking it first.
 */
-   __set_page_locked(page);
+   __SetPageLocked(page);
rc = add_to_page_cache_locked(page, mapping,
  page->index, GFP_KERNEL);
 
/* give up if we can't stick it in the cache */
if (rc) {
-   __clear_page_locked(page);
+   __ClearPageLocked(page);
return rc;
}
 
@@ -3417,10 +3417,10 @@ readpages_get_pages(struct address_space *mapping, 
struct list_head *page_list,
if (*bytes + PAGE_CACHE_SIZE > rsize)
break;
 
-   __set_page_locked(page);
+   __SetPageLocked(page);
if (add_to_page_cache_locked(page, mapping, page->index,
GFP_KERNEL)) {
-   __clear_page_locked(page);
+   __ClearPageLocked(page);
break;
}
list_move_tail(>lru, tmplist);
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 1b3babe5ff69..26102813f0ac 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -244,7 +244,7 @@ static inline int __TestClearPage##uname(struct page *page) 
{ return 0; }
 #define TESTSCFLAG_FALSE(uname)
\
TESTSETFLAG_FALSE(uname) TESTCLEARFLAG_FALSE(uname)
 
-TESTPAGEFLAG(Locked, locked, PF_ANY)
+__PAGEFLAG(Locked, locked, PF_NO_TAIL)
 PAGEFLAG(Error, error, PF_ANY) TESTCLEARFLAG(Error, error, PF_ANY)
 PAGEFLAG(Referenced, referenced, PF_ANY) TESTCLEARFLAG(Referenced, referenced, 
PF_ANY)
__SETPAGEFLAG(Referenced, referenced, PF_ANY)
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index a6c78e00ea96..3e95fb6a77af 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -426,18 +426,9 @@ extern int __lock_page_or_retry(struct page *page, struct 
mm_struct *mm,
unsigned int flags);
 extern void unlock_page(struct page *page);
 
-static inline void __set_page_locked(struct page *page)
-{
-   __set_bit(PG_locked, >flags);
-}
-
-static inline void __clear_page_locked(struct page *page)
-{
-   __clear_bit(PG_locked, >flags);
-}
-
 static inline int trylock_page(struct page *page)
 {
+   page = compound_head(page);
return (likely(!test_and_set_bit_lock(PG_locked, >flags)));
 }
 
@@ -490,9 +481,9 @@ extern int wait_on_page_bit_killable_timeout(struct page 
*page,
 
 static inline int wait_on_page_locked_killable(struct page *page)
 {
-   if (PageLocked(page))
-   return wait_on_page_bit_killable(page, PG_locked);
-   return 0;
+   if (!PageLocked(page))
+   return 0;
+   return wait_on_page_bit_killable(compound_head(page), PG_locked);
 }
 
 extern wait_queue_head_t *page_waitqueue(struct page *page);
@@ -511,7 +502,7 @@ static inline void wake_up_page(struct page *page, int bit)
 static inline void wait_on_page_locked(struct page *page)
 {
if (PageLocked(page))
-   wait_on_page_bit(page, PG_locked);
+   wait_on_page_bit(compound_head(page), PG_locked);
 }
 
 /* 
@@ -657,17 +648,17 @@ int replace_page_cache_page(struct page *old, struct page 
*new, gfp_t gfp_mask);
 
 /*
  * Like add_to_page_cache_locked, but used to add newly allocated pages:
- * the page is new, so we can just run __set_page_locked() against it.
+ * the page is new, so we can just run __SetPageLocked() against it.
  

[PATCH 14/16] page-flags: define PG_uptodate behavior on compound pages

2015-09-24 Thread Kirill A. Shutemov
We use PG_uptodate on head pages on transparent huge page.
Let's use PF_NO_TAIL.

Signed-off-by: Kirill A. Shutemov 
---
 include/linux/page-flags.h | 9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 5e52cc6a27c3..e3ccd95de660 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -392,8 +392,9 @@ u64 stable_page_flags(struct page *page);
 
 static inline int PageUptodate(struct page *page)
 {
-   int ret = test_bit(PG_uptodate, &(page)->flags);
-
+   int ret;
+   page = compound_head(page);
+   ret = test_bit(PG_uptodate, &(page)->flags);
/*
 * Must ensure that the data we read out of the page is loaded
 * _after_ we've loaded page->flags to check for PageUptodate.
@@ -410,12 +411,14 @@ static inline int PageUptodate(struct page *page)
 
 static inline void __SetPageUptodate(struct page *page)
 {
+   VM_BUG_ON_PAGE(PageTail(page), page);
smp_wmb();
__set_bit(PG_uptodate, >flags);
 }
 
 static inline void SetPageUptodate(struct page *page)
 {
+   VM_BUG_ON_PAGE(PageTail(page), page);
/*
 * Memory barrier must be issued before setting the PG_uptodate bit,
 * so that all previous stores issued in order to bring the page
@@ -425,7 +428,7 @@ static inline void SetPageUptodate(struct page *page)
set_bit(PG_uptodate, >flags);
 }
 
-CLEARPAGEFLAG(Uptodate, uptodate, PF_ANY)
+CLEARPAGEFLAG(Uptodate, uptodate, PF_NO_TAIL)
 
 int test_clear_page_writeback(struct page *page);
 int __test_set_page_writeback(struct page *page, bool keep_write);
-- 
2.5.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 10/16] page-flags: define PG_swapbacked behavior on compound pages

2015-09-24 Thread Kirill A. Shutemov
PG_swapbacked is used for transparent huge pages. For head pages only.
Let's use PF_NO_TAIL policy.

Signed-off-by: Kirill A. Shutemov 
---
 include/linux/page-flags.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 5ba8130fffb5..a31d682caeb2 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -266,9 +266,9 @@ PAGEFLAG(Foreign, foreign, PF_NO_COMPOUND);
 
 PAGEFLAG(Reserved, reserved, PF_NO_COMPOUND)
__CLEARPAGEFLAG(Reserved, reserved, PF_NO_COMPOUND)
-PAGEFLAG(SwapBacked, swapbacked, PF_ANY)
-   __CLEARPAGEFLAG(SwapBacked, swapbacked, PF_ANY)
-   __SETPAGEFLAG(SwapBacked, swapbacked, PF_ANY)
+PAGEFLAG(SwapBacked, swapbacked, PF_NO_TAIL)
+   __CLEARPAGEFLAG(SwapBacked, swapbacked, PF_NO_TAIL)
+   __SETPAGEFLAG(SwapBacked, swapbacked, PF_NO_TAIL)
 
 /*
  * Private page markings that may be used by the filesystem that owns the page
-- 
2.5.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 03/16] page-flags: introduce page flags policies wrt compound pages

2015-09-24 Thread Kirill A. Shutemov
This patch adds a third argument to macros which create function
definitions for page flags.  This argument defines how page-flags helpers
behave on compound functions.

For now we define four policies:

- PF_ANY: the helper function operates on the page it gets, regardless
  if it's non-compound, head or tail.

- PF_HEAD: the helper function operates on the head page of the compound
  page if it gets tail page.

- PF_NO_TAIL: only head and non-compond pages are acceptable for this
  helper function.

- PF_NO_COMPOUND: only non-compound pages are acceptable for this helper
  function.

For now we use policy PF_ANY for all helpers, which matches current
behaviour.

We do not enforce the policy for TESTPAGEFLAG, because we have flags
checked for random pages all over the kernel.  Noticeable exception to
this is PageTransHuge() which triggers VM_BUG_ON() for tail page.

Signed-off-by: Kirill A. Shutemov 
---
 include/linux/page-flags.h | 154 ++---
 1 file changed, 90 insertions(+), 64 deletions(-)

diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 713d3f2c2468..1b3babe5ff69 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -154,49 +154,68 @@ static inline int PageCompound(struct page *page)
return test_bit(PG_head, >flags) || PageTail(page);
 }
 
+/* Page flags policies wrt compound pages */
+#define PF_ANY(page, enforce)  page
+#define PF_HEAD(page, enforce) compound_head(page)
+#define PF_NO_TAIL(page, enforce) ({   \
+   if (enforce)\
+   VM_BUG_ON_PAGE(PageTail(page), page);   \
+   else\
+   page = compound_head(page); \
+   page;})
+#define PF_NO_COMPOUND(page, enforce) ({   
\
+   if (enforce)\
+   VM_BUG_ON_PAGE(PageCompound(page), page);   \
+   page;})
+
 /*
  * Macros to create function definitions for page flags
  */
-#define TESTPAGEFLAG(uname, lname) \
-static inline int Page##uname(const struct page *page) \
-   { return test_bit(PG_##lname, >flags); }
+#define TESTPAGEFLAG(uname, lname, policy) \
+static inline int Page##uname(struct page *page)   \
+   { return test_bit(PG_##lname, (page, 0)->flags); }
 
-#define SETPAGEFLAG(uname, lname)  \
+#define SETPAGEFLAG(uname, lname, policy)  \
 static inline void SetPage##uname(struct page *page)   \
-   { set_bit(PG_##lname, >flags); }
+   { set_bit(PG_##lname, (page, 1)->flags); }
 
-#define CLEARPAGEFLAG(uname, lname)\
+#define CLEARPAGEFLAG(uname, lname, policy)\
 static inline void ClearPage##uname(struct page *page) \
-   { clear_bit(PG_##lname, >flags); }
+   { clear_bit(PG_##lname, (page, 1)->flags); }
 
-#define __SETPAGEFLAG(uname, lname)\
+#define __SETPAGEFLAG(uname, lname, policy)\
 static inline void __SetPage##uname(struct page *page) \
-   { __set_bit(PG_##lname, >flags); }
+   { __set_bit(PG_##lname, (page, 1)->flags); }
 
-#define __CLEARPAGEFLAG(uname, lname)  \
+#define __CLEARPAGEFLAG(uname, lname, policy)  \
 static inline void __ClearPage##uname(struct page *page)   \
-   { __clear_bit(PG_##lname, >flags); }
+   { __clear_bit(PG_##lname, (page, 1)->flags); }
 
-#define TESTSETFLAG(uname, lname)  \
+#define TESTSETFLAG(uname, lname, policy)  \
 static inline int TestSetPage##uname(struct page *page)
\
-   { return test_and_set_bit(PG_##lname, >flags); }
+   { return test_and_set_bit(PG_##lname, (page, 1)->flags); }
 
-#define TESTCLEARFLAG(uname, lname)\
+#define TESTCLEARFLAG(uname, lname, policy)\
 static inline int TestClearPage##uname(struct page *page)  \
-   { return test_and_clear_bit(PG_##lname, >flags); }
+   { return test_and_clear_bit(PG_##lname, (page, 1)->flags); }
 
-#define __TESTCLEARFLAG(uname, lname)  \
+#define __TESTCLEARFLAG(uname, lname, policy)  \
 static inline int __TestClearPage##uname(struct page *page)\
-   { return __test_and_clear_bit(PG_##lname, >flags); }
+ 

[PATCH 05/16] page-flags: define behavior of FS/IO-related flags on compound pages

2015-09-24 Thread Kirill A. Shutemov
It seems we don't have compound page on FS/IO path currently.
Use PF_NO_COMPOUND to catch if we have.

The odd exception is PG_dirty: sound uses compound pages and maps them
with PTEs. PF_NO_COMPOUND triggers VM_BUG_ON() in set_page_dirty() on
handling shared fault.  Let's use PF_HEAD for PG_dirty.

Signed-off-by: Kirill A. Shutemov 
---
 include/linux/page-flags.h | 23 +--
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 26102813f0ac..63db7483c264 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -245,16 +245,16 @@ static inline int __TestClearPage##uname(struct page 
*page) { return 0; }
TESTSETFLAG_FALSE(uname) TESTCLEARFLAG_FALSE(uname)
 
 __PAGEFLAG(Locked, locked, PF_NO_TAIL)
-PAGEFLAG(Error, error, PF_ANY) TESTCLEARFLAG(Error, error, PF_ANY)
+PAGEFLAG(Error, error, PF_NO_COMPOUND) TESTCLEARFLAG(Error, error, 
PF_NO_COMPOUND)
 PAGEFLAG(Referenced, referenced, PF_ANY) TESTCLEARFLAG(Referenced, referenced, 
PF_ANY)
__SETPAGEFLAG(Referenced, referenced, PF_ANY)
-PAGEFLAG(Dirty, dirty, PF_ANY) TESTSCFLAG(Dirty, dirty, PF_ANY)
-   __CLEARPAGEFLAG(Dirty, dirty, PF_ANY)
+PAGEFLAG(Dirty, dirty, PF_HEAD) TESTSCFLAG(Dirty, dirty, PF_HEAD)
+   __CLEARPAGEFLAG(Dirty, dirty, PF_HEAD)
 PAGEFLAG(LRU, lru, PF_ANY) __CLEARPAGEFLAG(LRU, lru, PF_ANY)
 PAGEFLAG(Active, active, PF_ANY) __CLEARPAGEFLAG(Active, active, PF_ANY)
TESTCLEARFLAG(Active, active, PF_ANY)
 __PAGEFLAG(Slab, slab, PF_ANY)
-PAGEFLAG(Checked, checked, PF_ANY) /* Used by some filesystems */
+PAGEFLAG(Checked, checked, PF_NO_COMPOUND)/* Used by some filesystems 
*/
 PAGEFLAG(Pinned, pinned, PF_ANY) TESTSCFLAG(Pinned, pinned, PF_ANY)/* Xen 
*/
 PAGEFLAG(SavePinned, savepinned, PF_ANY);  /* Xen */
 PAGEFLAG(Foreign, foreign, PF_ANY);/* Xen */
@@ -280,12 +280,15 @@ PAGEFLAG(OwnerPriv1, owner_priv_1, PF_ANY)
  * Only test-and-set exist for PG_writeback.  The unconditional operators are
  * risky: they bypass page accounting.
  */
-TESTPAGEFLAG(Writeback, writeback, PF_ANY) TESTSCFLAG(Writeback, writeback, 
PF_ANY)
-PAGEFLAG(MappedToDisk, mappedtodisk, PF_ANY)
+TESTPAGEFLAG(Writeback, writeback, PF_NO_COMPOUND)
+   TESTSCFLAG(Writeback, writeback, PF_NO_COMPOUND)
+PAGEFLAG(MappedToDisk, mappedtodisk, PF_NO_COMPOUND)
 
 /* PG_readahead is only used for reads; PG_reclaim is only for writes */
-PAGEFLAG(Reclaim, reclaim, PF_ANY) TESTCLEARFLAG(Reclaim, reclaim, PF_ANY)
-PAGEFLAG(Readahead, reclaim, PF_ANY) TESTCLEARFLAG(Readahead, reclaim, PF_ANY)
+PAGEFLAG(Reclaim, reclaim, PF_NO_COMPOUND)
+   TESTCLEARFLAG(Reclaim, reclaim, PF_NO_COMPOUND)
+PAGEFLAG(Readahead, reclaim, PF_NO_COMPOUND)
+   TESTCLEARFLAG(Readahead, reclaim, PF_NO_COMPOUND)
 
 #ifdef CONFIG_HIGHMEM
 /*
@@ -401,7 +404,7 @@ static inline int PageUptodate(struct page *page)
 static inline void __SetPageUptodate(struct page *page)
 {
smp_wmb();
-   __set_bit(PG_uptodate, &(page)->flags);
+   __set_bit(PG_uptodate, >flags);
 }
 
 static inline void SetPageUptodate(struct page *page)
@@ -412,7 +415,7 @@ static inline void SetPageUptodate(struct page *page)
 * uptodate are actually visible before PageUptodate becomes true.
 */
smp_wmb();
-   set_bit(PG_uptodate, &(page)->flags);
+   set_bit(PG_uptodate, >flags);
 }
 
 CLEARPAGEFLAG(Uptodate, uptodate, PF_ANY)
-- 
2.5.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 02/16] page-flags: move code around

2015-09-24 Thread Kirill A. Shutemov
The preparation patch: we are going to use compound_head(), PageTail()
and PageCompound() to define page-flags helpers.

Let's define them before macros.

We cannot user PageHead() helper in PageCompound() as it's not yet
defined -- use test_bit(PG_head, >flags) instead.

Signed-off-by: Kirill A. Shutemov 
---
 include/linux/page-flags.h | 41 +
 1 file changed, 21 insertions(+), 20 deletions(-)

diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 815246a80e2d..713d3f2c2468 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -133,6 +133,27 @@ enum pageflags {
 
 #ifndef __GENERATING_BOUNDS_H
 
+struct page;   /* forward declaration */
+
+static inline struct page *compound_head(struct page *page)
+{
+   unsigned long head = READ_ONCE(page->compound_head);
+
+   if (unlikely(head & 1))
+   return (struct page *) (head - 1);
+   return page;
+}
+
+static inline int PageTail(struct page *page)
+{
+   return READ_ONCE(page->compound_head) & 1;
+}
+
+static inline int PageCompound(struct page *page)
+{
+   return test_bit(PG_head, >flags) || PageTail(page);
+}
+
 /*
  * Macros to create function definitions for page flags
  */
@@ -204,7 +225,6 @@ static inline int __TestClearPage##uname(struct page *page) 
{ return 0; }
 #define TESTSCFLAG_FALSE(uname)
\
TESTSETFLAG_FALSE(uname) TESTCLEARFLAG_FALSE(uname)
 
-struct page;   /* forward declaration */
 
 TESTPAGEFLAG(Locked, locked)
 PAGEFLAG(Error, error) TESTCLEARFLAG(Error, error)
@@ -395,11 +415,6 @@ static inline void set_page_writeback_keepwrite(struct 
page *page)
 
 __PAGEFLAG(Head, head) CLEARPAGEFLAG(Head, head)
 
-static inline int PageTail(struct page *page)
-{
-   return READ_ONCE(page->compound_head) & 1;
-}
-
 static inline void set_compound_head(struct page *page, struct page *head)
 {
WRITE_ONCE(page->compound_head, (unsigned long)head + 1);
@@ -410,20 +425,6 @@ static inline void clear_compound_head(struct page *page)
WRITE_ONCE(page->compound_head, 0);
 }
 
-static inline struct page *compound_head(struct page *page)
-{
-   unsigned long head = READ_ONCE(page->compound_head);
-
-   if (unlikely(head & 1))
-   return (struct page *) (head - 1);
-   return page;
-}
-
-static inline int PageCompound(struct page *page)
-{
-   return PageHead(page) || PageTail(page);
-
-}
 #ifdef CONFIG_TRANSPARENT_HUGEPAGE
 static inline void ClearPageCompound(struct page *page)
 {
-- 
2.5.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: [LTP] LTP and commit e1d7ba8735551ed7 ("time: Always make sure wall_to_monotonic isn't positive")

2015-09-24 Thread Cyril Hrubis
Hi!
> Thanks for the report, we allready have patch for the first testcase on
> the mailing list that initializes the the timeval value to current time
> + small amount. I will have a look at the second test as well.
> 
> > [1] 
> > https://github.com/linux-test-project/ltp/blob/20150903/testcases/kernel/syscalls/settimeofday/settimeofday01.c
> > [2] 
> > https://github.com/linux-test-project/ltp/blob/20150903/testcases/kernel/timers/clock_settime/clock_settime02.c

Both should be fixed in latest git.

-- 
Cyril Hrubis
chru...@suse.cz
--
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 00/16] Refreshed page-flags patchset

2015-09-24 Thread Kirill A. Shutemov
As requested, here's reworked version of page-flags patchset.
Updated version should fit more naturally into current code base.

Kirill A. Shutemov (16):
  page-flags: trivial cleanup for PageTrans* helpers
  page-flags: move code around
  page-flags: introduce page flags policies wrt compound pages
  page-flags: define PG_locked behavior on compound pages
  page-flags: define behavior of FS/IO-related flags on compound pages
  page-flags: define behavior of LRU-related flags on compound pages
  page-flags: define behavior SL*B-related flags on compound pages
  page-flags: define behavior of Xen-related flags on compound pages
  page-flags: define PG_reserved behavior on compound pages
  page-flags: define PG_swapbacked behavior on compound pages
  page-flags: define PG_swapcache behavior on compound pages
  page-flags: define PG_mlocked behavior on compound pages
  page-flags: define PG_uncached behavior on compound pages
  page-flags: define PG_uptodate behavior on compound pages
  page-flags: look at head page if the flag is encoded in page->mapping
  mm: sanitize page->mapping for tail pages

 fs/cifs/file.c |   8 +-
 include/linux/page-flags.h | 236 +
 include/linux/pagemap.h|  25 ++---
 include/linux/poison.h |   4 +
 mm/filemap.c   |  15 +--
 mm/huge_memory.c   |   2 +-
 mm/ksm.c   |   2 +-
 mm/memory-failure.c|   2 +-
 mm/memory.c|   2 +-
 mm/migrate.c   |   2 +-
 mm/page_alloc.c|   6 ++
 mm/shmem.c |   4 +-
 mm/slub.c  |   2 +
 mm/swap_state.c|   4 +-
 mm/util.c  |  10 +-
 mm/vmscan.c|   2 +-
 16 files changed, 182 insertions(+), 144 deletions(-)

-- 
2.5.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 09/16] page-flags: define PG_reserved behavior on compound pages

2015-09-24 Thread Kirill A. Shutemov
As far as I can see there's no users of PG_reserved on compound pages.
Let's use PF_NO_COMPOUND here.

Signed-off-by: Kirill A. Shutemov 
---
 include/linux/page-flags.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index adaa2b39f471..5ba8130fffb5 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -264,7 +264,8 @@ PAGEFLAG(Pinned, pinned, PF_NO_COMPOUND)
 PAGEFLAG(SavePinned, savepinned, PF_NO_COMPOUND);
 PAGEFLAG(Foreign, foreign, PF_NO_COMPOUND);
 
-PAGEFLAG(Reserved, reserved, PF_ANY) __CLEARPAGEFLAG(Reserved, reserved, 
PF_ANY)
+PAGEFLAG(Reserved, reserved, PF_NO_COMPOUND)
+   __CLEARPAGEFLAG(Reserved, reserved, PF_NO_COMPOUND)
 PAGEFLAG(SwapBacked, swapbacked, PF_ANY)
__CLEARPAGEFLAG(SwapBacked, swapbacked, PF_ANY)
__SETPAGEFLAG(SwapBacked, swapbacked, PF_ANY)
-- 
2.5.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 13/16] page-flags: define PG_uncached behavior on compound pages

2015-09-24 Thread Kirill A. Shutemov
So far, only IA64 uses PG_uncached and only on non-compound pages.

Signed-off-by: Kirill A. Shutemov 
---
 include/linux/page-flags.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 31e68a8c2777..5e52cc6a27c3 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -326,7 +326,7 @@ PAGEFLAG_FALSE(Mlocked) __CLEARPAGEFLAG_NOOP(Mlocked)
 #endif
 
 #ifdef CONFIG_ARCH_USES_PG_UNCACHED
-PAGEFLAG(Uncached, uncached, PF_ANY)
+PAGEFLAG(Uncached, uncached, PF_NO_COMPOUND)
 #else
 PAGEFLAG_FALSE(Uncached)
 #endif
-- 
2.5.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] ARM: at91/dt: pullup dbgu rx instead of tx

2015-09-24 Thread Peter Rosin
From: Peter Rosin 

It seems pointless to pullup the tx line, but there is value in pulling
up the rx line.

Cc: sta...@vger.kernel.org
Signed-off-by: Peter Rosin 
---
 arch/arm/boot/dts/sama5d3.dtsi |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boot/dts/sama5d3.dtsi b/arch/arm/boot/dts/sama5d3.dtsi
index 9e2444b07bce..304a40c5552a 100644
--- a/arch/arm/boot/dts/sama5d3.dtsi
+++ b/arch/arm/boot/dts/sama5d3.dtsi
@@ -545,8 +545,8 @@
dbgu {
pinctrl_dbgu: dbgu-0 {
atmel,pins =
-   ;  /* PB31 periph A with pullup */
+   ; /* PB31 periph A */
};
};
 
-- 
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/


Re: [PATCH 3/3] sched: add_nr_running(): drop tick_nohz_full_cpu() check

2015-09-24 Thread Frederic Weisbecker
On Thu, Sep 10, 2015 at 03:58:27PM -0400, Luiz Capitulino wrote:
> tick_nohz_full_kick_cpu() performs the same check.
> 
> Signed-off-by: Luiz Capitulino 
> ---
>  kernel/sched/sched.h | 20 +---
>  1 file changed, 9 insertions(+), 11 deletions(-)
> 
> diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
> index 68cda11..102eb18 100644
> --- a/kernel/sched/sched.h
> +++ b/kernel/sched/sched.h
> @@ -1323,17 +1323,15 @@ static inline void add_nr_running(struct rq *rq, 
> unsigned count)
>  #endif
>  
>  #ifdef CONFIG_NO_HZ_FULL
> - if (tick_nohz_full_cpu(rq->cpu)) {
> - /*
> -  * Tick is needed if more than one task runs on a CPU.
> -  * Send the target an IPI to kick it out of nohz mode.
> -  *
> -  * We assume that IPI implies full memory barrier and 
> the
> -  * new value of rq->nr_running is visible on reception
> -  * from the target.
> -  */
> - tick_nohz_full_kick_cpu(rq->cpu);
> - }
> + /*
> +  * Tick is needed if more than one task runs on a CPU.
> +  * Send the target an IPI to kick it out of nohz mode.
> +  *
> +  * We assume that IPI implies full memory barrier and the
> +  * new value of rq->nr_running is visible on reception
> +  * from the target.
> +  */
> + tick_nohz_full_kick_cpu(rq->cpu);

Nope, we want to keep this because tick_nohz_full_cpu() does a static key check.
Most users don't care about nohz_full and I really want to keep nohz full off 
case
overhead to the bare minimum.

Thanks.

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


Re: [PATCH 2/3] nohz: mark tick_nohz_init_all() as __init

2015-09-24 Thread Frederic Weisbecker
On Thu, Sep 10, 2015 at 03:58:26PM -0400, Luiz Capitulino wrote:
> It's only called by tick_nohz_init().
> 
> Signed-off-by: Luiz Capitulino 
> ---
>  kernel/time/tick-sched.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
> index 8d45638..4cc6df03 100644
> --- a/kernel/time/tick-sched.c
> +++ b/kernel/time/tick-sched.c
> @@ -308,7 +308,7 @@ static int tick_nohz_cpu_down_callback(struct 
> notifier_block *nfb,
>   return NOTIFY_OK;
>  }
>  
> -static int tick_nohz_init_all(void)
> +static int __init tick_nohz_init_all(void)
>  {
>   int err = -1;

For some reasons I thought sections don't apply to static functions. Well I 
still don't know
but I guess it works as long as the function doesn't get inlined. Or likely it 
prevents it from
being inlined.

Anyway, I think we can take the patch.

Thanks.


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


Re: [linux-sunxi][alsa-devel][PATCH 0/3]Add SPDIF support for Allwinner SoCs

2015-09-24 Thread Code Kipper
On 23 September 2015 at 20:41, Code Kipper  wrote:
> Hi All,
> I'm getting a "fatal: 'send-email'" response with the last patch(even
> though the dry run of the patch series worked) and I've not been able
> to work around it. I'll post it as soon as I can work out what the
> issue is,
DONE
> BR,
> CK
>
> On 23 September 2015 at 20:04,   wrote:
>> From: Marcus Cooper 
>>
>> This patch set adds support for the Allwinner SPDIF transceiver as present
>> on the A10, A20 and A31 SoC boards.
>>
>> For now just the SPDIF transmitter has been tested on a Mele A2000.
>>
>> In order for this patch set to be functional we require audio clock patches
>> which will be delivered separately. For those that are interested I've pushed
>> the patches here with all the required changes to get SPDIF audio out of the
>> device.
>>
>> https://github.com/codekipper/linux-sunxi/commits/spdif_delivery
>>
>> Thanks in advance,
>> CK
>>
>> Marcus Cooper (3):
>>   dt-bindings: add sunxi SPDIF transceiver bindings
>>   dt-binding: Add sunxi SPDIF machine driver
>>   ASOC: sunxi: Add support for the spdif block
>>
>>  .../devicetree/bindings/sound/sunxi,spdif.txt  |  49 ++
>>  .../bindings/sound/sunxi-audio-spdif.txt   |  36 +
>>  sound/soc/sunxi/Kconfig|  10 +
>>  sound/soc/sunxi/Makefile   |   4 +
>>  sound/soc/sunxi/sunxi-machine-spdif.c  | 110 +++
>>  sound/soc/sunxi/sunxi-spdif.c  | 801 
>> +
>>  6 files changed, 1010 insertions(+)
>>  create mode 100644 Documentation/devicetree/bindings/sound/sunxi,spdif.txt
>>  create mode 100644 
>> Documentation/devicetree/bindings/sound/sunxi-audio-spdif.txt
>>  create mode 100644 sound/soc/sunxi/sunxi-machine-spdif.c
>>  create mode 100644 sound/soc/sunxi/sunxi-spdif.c
>>
>> --
>> 2.5.3
>>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[linux-sunxi][alsa-devel][PATCH 3/3] ASOC: sunxi: Add support for the spdif block

2015-09-24 Thread codekipper
From: Marcus Cooper 

The sun4i, sun6i and sun7i SoC families have an SPDIF
block which is capable of playback and capture.

This patch enables the playback of this block for
the sun4i and sun7i families.

Signed-off-by: Marcus Cooper 
---
 sound/soc/sunxi/Kconfig   |  10 +
 sound/soc/sunxi/Makefile  |   4 +
 sound/soc/sunxi/sunxi-machine-spdif.c | 110 +
 sound/soc/sunxi/sunxi-spdif.c | 801 ++
 4 files changed, 925 insertions(+)
 create mode 100644 sound/soc/sunxi/sunxi-machine-spdif.c
 create mode 100644 sound/soc/sunxi/sunxi-spdif.c

diff --git a/sound/soc/sunxi/Kconfig b/sound/soc/sunxi/Kconfig
index 84c72ec..053db02 100644
--- a/sound/soc/sunxi/Kconfig
+++ b/sound/soc/sunxi/Kconfig
@@ -8,4 +8,14 @@ config SND_SUN4I_CODEC
  Select Y or M to add support for the Codec embedded in the Allwinner
  A10 and affiliated SoCs.
 
+config SND_SOC_SUNXI_DAI_SPDIF
+tristate
+select SND_SOC_GENERIC_DMAENGINE_PCM
+select REGMAP_MMIO
+
+config SND_SOC_SUNXI_MACHINE_SPDIF
+tristate "APB on-chip sun4i/sun5i/sun7i SPDIF"
+select SND_SOC_SUNXI_DAI_SPDIF
+help
+  Say Y if you want to add support for SoC S/PDIF audio as simple 
audio card.
 endmenu
diff --git a/sound/soc/sunxi/Makefile b/sound/soc/sunxi/Makefile
index ea8a08c..7849a75 100644
--- a/sound/soc/sunxi/Makefile
+++ b/sound/soc/sunxi/Makefile
@@ -1,2 +1,6 @@
 obj-$(CONFIG_SND_SUN4I_CODEC) += sun4i-codec.o
 
+snd-soc-sunxi-dai-spdif-objs := sunxi-spdif.o
+obj-$(CONFIG_SND_SOC_SUNXI_DAI_SPDIF) += snd-soc-sunxi-dai-spdif.o
+snd-soc-sunxi-machine-spdif-objs := sunxi-machine-spdif.o
+obj-$(CONFIG_SND_SOC_SUNXI_MACHINE_SPDIF) += snd-soc-sunxi-machine-spdif.o
diff --git a/sound/soc/sunxi/sunxi-machine-spdif.c 
b/sound/soc/sunxi/sunxi-machine-spdif.c
new file mode 100644
index 000..f8f6bd8
--- /dev/null
+++ b/sound/soc/sunxi/sunxi-machine-spdif.c
@@ -0,0 +1,110 @@
+/*
+ * Copyright (C) 2015 Andrea Venturi 
+ * From code by (C) 2013 Freescale Semiconductor, Inc.
+ * (sound/soc/fsl/imx-spdif.c)
+ *
+ * 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 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include 
+#include 
+#include 
+
+struct sunxi_machine_spdif_data {
+   struct snd_soc_dai_link dai;
+   struct snd_soc_card card;
+};
+
+static int sunxi_machine_spdif_audio_probe(struct platform_device *pdev)
+{
+   struct device_node *spdif_np, *np = pdev->dev.of_node;
+   struct sunxi_machine_spdif_data *data;
+   int ret = 0;
+
+   dev_dbg(>dev, "%s: Looking for spdif-controller\n", __func__);
+   spdif_np = of_parse_phandle(np, "spdif-controller", 0);
+   if (!spdif_np) {
+   dev_err(>dev, "failed to find spdif-controller\n");
+   ret = -EINVAL;
+   goto end;
+   }
+
+   data = devm_kzalloc(>dev, sizeof(*data), GFP_KERNEL);
+   if (!data) {
+   ret = -ENOMEM;
+   goto end;
+   }
+
+   data->dai.name = "S/PDIF PCM";
+   data->dai.stream_name = "S/PDIF PCM";
+   data->dai.codec_dai_name = "snd-soc-dummy-dai";
+   data->dai.codec_name = "snd-soc-dummy";
+   data->dai.cpu_of_node = spdif_np;
+   data->dai.platform_of_node = spdif_np;
+   data->dai.playback_only = true;
+   data->dai.capture_only = true;
+
+   if (of_property_read_bool(np, "spdif-out"))
+   data->dai.capture_only = false;
+
+   if (of_property_read_bool(np, "spdif-in"))
+   data->dai.playback_only = false;
+
+   if (data->dai.playback_only && data->dai.capture_only) {
+   dev_err(>dev, "no enabled S/PDIF DAI link\n");
+   goto end;
+   }
+
+   data->card.dev = >dev;
+   data->card.dai_link = >dai;
+   data->card.num_links = 1;
+   data->card.owner = THIS_MODULE;
+
+   ret = snd_soc_of_parse_card_name(>card, "model");
+   if (ret)
+   goto end;
+
+   ret = devm_snd_soc_register_card(>dev, >card);
+   if (ret) {
+   dev_err(>dev, "snd_soc_register_card failed: %d\n", ret);
+   goto end;
+   }
+
+   platform_set_drvdata(pdev, data);
+
+end:
+   of_node_put(spdif_np);
+
+   return ret;
+}
+
+#ifdef CONFIG_OF
+static const struct of_device_id sunxi_machine_spdif_dt_ids[] = {
+   { .compatible = "allwinner,sunxi-audio-spdif", },
+   { /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(of, sunxi_machine_spdif_dt_ids);
+#endif
+
+static struct platform_driver sunxi_machine_spdif_driver = 

Re: [tip:perf/core] tools lib api fs: Remove debugfs, tracefs and findfs objects

2015-09-24 Thread Arnaldo Carvalho de Melo
Em Thu, Sep 24, 2015 at 01:15:51PM +0100, Matt Fleming escreveu:
> On Wed, 23 Sep, at 10:44:56AM, Arnaldo Carvalho de Melo wrote:
> > Of course, in these days of CI, I'd love if someone would hook 'make -C
> > tools/perf build-test' and 'perf test' somewhere to be run for every
> > changeset.
>   
> Yes please!

But then even this one would have not been caught, because the test in
place don't include trying to build tools/vm/, i.e. from time to time
something will pass and will be caught by people like Vinson, reported
and fixed :-)

> > BTW, tools/vm/ was reported yesterday and a fix is already in
> > tip/perf/core/:
> > 
> > https://git.kernel.org/cgit/linux/kernel/git/tip/tip.git/commit/tools/vm?id=f6489bc2d402c0db84aa64f13b864d17f7eecb07
> > 
> > Age   Commit message (Expand)   
> > Author   Files Lines
> > 12 hours  tools vm: Fix build due to removal of tools/lib/api/fs/debugfs.h  
> > Arnaldo Carvalho de Melo1  -3/+3
 
> It's not that this wasn't fixed quickly (kudos for that, btw), rather
> it's that the breakage should have been avoided altogether.
 
> But if this is an isolated incident, then fair enough, I'll stop
> whining.

Expressing concern is not a problem, its an opportunity for us to try
and get them addressed and improve so that others don't get afraid of
the processes in place.

- Arnaldo
--
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] Documentation: dt: keystone: provide SoC specific compatible flags

2015-09-24 Thread Nishanth Menon
On 09/24/2015 09:05 AM, Murali Karicheri wrote:
> On 09/23/2015 02:19 PM, santosh shilimkar wrote:
>> Nishant,
>>
>> On 9/22/2015 9:08 AM, Nishanth Menon wrote:
>>> Keystone2 devices are used on more platforms than just Texas
>>> Instruments reference evaluation platforms called EVMs. Providing a
>>> generic compatible "ti,keystone" is not sufficient to differentiate
>>> various SoC definitions possible on various platforms. So, provide
>>> compatible matches for each SoC family by itself.
>>>
>>> This allows SoC specific logic to be run time handled based on
>>> of_machine_is_compatible("ti,k2hk") or as needed for the dependent
>>> processor instead of needing to use board dependent compatibles that
>>> are needed now.
>>>
>>> Signed-off-by: Nishanth Menon 
>>> ---
>> You need to expand that 'not sufficient' for me. Unless there is
>> genuine case to support this, I would want to avoid this churn.
>>
> 
> I agree. If there are run time check required in code to treat the 
> variants of Keystone SoC differently, then this change is needed. At 
> this time, SoC DTS captures these differences. IMHO, If a future 
> Keystone SoC support required SoC specific compatibility string to 
> customize SoC specific initialization code, then it can be introduced at 
> that time. I am not sure why this is introduced with out an example usage.

a) See
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/usage-model.txt#n116
-> all we have today is board, soc generic family. The generic
compatible flag of ti,keystone to mark that this is a keystone2 device
does not identify that what kind of soc it is. which is what this
series introduces.

b) there is no realistic way for user space applications such as a
test framework or other SoC based applications in a generic distro to
detect the right SoC this platform is running on - imagine writing SoC
specific code that depends on board compatible flags - there is never
an end to that story as the number of boards expand.

c) Ideally we will try never to introduce code that will have to
depend on SoC compatible flag based match in kernel - but that is not
a reason not to follow guidelines provided by devicetree documentation
to provide SoC specific compatible flags.

-- 
Regards,
Nishanth Menon
--
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: + kernelh-make-abs-work-with-64-bit-types.patch added to -mm tree

2015-09-24 Thread Alexey Dobriyan
On Thu, Sep 24, 2015 at 4:32 PM, Michal Nazarewicz  wrote:
> On Wed, Sep 23 2015, Alexey Dobriyan wrote:
>> I've sent kabs() before which didn't go in because it didn't work for
>> INT_MAX et al
>> (don't worry, this abs() doens't as well) but it is nicer that this
>> version in other aspects
>> (hopefully).
>>
>> [PATCH v2] Add kabs()
>> http://marc.info/?l=linux-kernel=133518745522740=4
>
> Perhaps:
>
> +   (void)(_x)));   \
>
> instead of:
>
> +   _x));   \
>
> at the end.  Since kabs makes no sense for unsigned types it’s best to
> fail with compile-time error than to let user think that the call is
> actually doing something.

I thought so, but the amount of uses like

  unsigned int = abs(unsigned int - unsigned int)

is non trivial. With a few exceptions it is about 170 on
x86_64 allmodconfig. Most of them are correct because abs()
casts to signed first. So if you want to expose such uses,
then you are forced to write

  unsigned int = kabs((int)(unsigned int - unsigned int));

Don't know if it's a good thing.

> Also, you don’t need ({ … }) around the ‘_x < 0 ? -_x : _x’ expression,
> do you?

Seems so, thank you for noticing.
--
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] irqchip/GICv2m: Fix GICv2m build warning on 32 bits

2015-09-24 Thread Marc Zyngier
On Thu, 24 Sep 2015 11:19:33 +0300
Pavel Fedin  wrote:

>  Hello!
> 
> > From: Pavel Fedin 
> > 
> > After GICv2m was enabled for 32-bit ARM kernel, a warning popped up:
> 
>  Thank you for the cooperation, i'm now back from my vacation.
>  What about the first patch in the series, which actually enables
> GICv2m on 32 bits? I don't see it anywhere, neither there are reviews.

This is a patch that touches arch/arm, so this is Russell that you have
to convince, not me.

Thanks,

M.
-- 
Jazz is not dead. It just smells funny.
--
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 18/19] mac80211: make ieee80211_new_mesh_header return unsigned

2015-09-24 Thread Johannes Berg
On Thu, 2015-09-24 at 16:00 +0200, Andrzej Hajda wrote:
> The function returns always non-negative values.
> 
> The problem has been detected using proposed semantic patch
> scripts/coccinelle/tests/assign_signed_to_unsigned.cocci [1].
> 
You should at least compile your patches.

johannes
--
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 12/19] extcon: rt8973a: fix handling regmap_irq_get_virq result

2015-09-24 Thread Andrzej Hajda
The function can return negative value.

The problem has been detected using proposed semantic patch
scripts/coccinelle/tests/assign_signed_to_unsigned.cocci [1].

[1]: http://permalink.gmane.org/gmane.linux.kernel/2046107

Signed-off-by: Andrzej Hajda 
---
Hi,

To avoid problems with too many mail recipients I have sent whole
patchset only to LKML. Anyway patches have no dependencies.

Regards
Andrzej
---
 drivers/extcon/extcon-rt8973a.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/extcon/extcon-rt8973a.c b/drivers/extcon/extcon-rt8973a.c
index 3428b6a..1bc3737 100644
--- a/drivers/extcon/extcon-rt8973a.c
+++ b/drivers/extcon/extcon-rt8973a.c
@@ -594,7 +594,7 @@ static int rt8973a_muic_i2c_probe(struct i2c_client *i2c,
 
for (i = 0; i < info->num_muic_irqs; i++) {
struct muic_irq *muic_irq = >muic_irqs[i];
-   unsigned int virq = 0;
+   int virq = 0;
 
virq = regmap_irq_get_virq(info->irq_data, muic_irq->irq);
if (virq <= 0)
-- 
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 02/19] spi: davinci: fix handling platform_get_irq result

2015-09-24 Thread Andrzej Hajda
The function can return negative value.

The problem has been detected using proposed semantic patch
scripts/coccinelle/tests/assign_signed_to_unsigned.cocci [1].

[1]: http://permalink.gmane.org/gmane.linux.kernel/2046107

Signed-off-by: Andrzej Hajda 
---
Hi,

To avoid problems with too many mail recipients I have sent whole
patchset only to LKML. Anyway patches have no dependencies.

Regards
Andrzej
---
 drivers/spi/spi-davinci.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/spi/spi-davinci.c b/drivers/spi/spi-davinci.c
index 3cf9faa..a85d863 100644
--- a/drivers/spi/spi-davinci.c
+++ b/drivers/spi/spi-davinci.c
@@ -992,11 +992,12 @@ static int davinci_spi_probe(struct platform_device *pdev)
goto free_master;
}
 
-   dspi->irq = platform_get_irq(pdev, 0);
-   if (dspi->irq <= 0) {
+   ret = platform_get_irq(pdev, 0);
+   if (ret == 0)
ret = -EINVAL;
+   if (ret < 0)
goto free_master;
-   }
+   dspi->irq = ret;
 
ret = devm_request_threaded_irq(>dev, dspi->irq, davinci_spi_irq,
dummy_thread_fn, 0, dev_name(>dev), dspi);
-- 
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 05/19] media: am437x-vpfe: fix handling platform_get_irq result

2015-09-24 Thread Andrzej Hajda
The function can return negative value.

The problem has been detected using proposed semantic patch
scripts/coccinelle/tests/assign_signed_to_unsigned.cocci [1].

[1]: http://permalink.gmane.org/gmane.linux.kernel/2046107

Signed-off-by: Andrzej Hajda 
---
Hi,

To avoid problems with too many mail recipients I have sent whole
patchset only to LKML. Anyway patches have no dependencies.

Regards
Andrzej
---
 drivers/media/platform/am437x/am437x-vpfe.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/am437x/am437x-vpfe.c 
b/drivers/media/platform/am437x/am437x-vpfe.c
index c8447fa..c9cbb60 100644
--- a/drivers/media/platform/am437x/am437x-vpfe.c
+++ b/drivers/media/platform/am437x/am437x-vpfe.c
@@ -2546,11 +2546,12 @@ static int vpfe_probe(struct platform_device *pdev)
if (IS_ERR(ccdc->ccdc_cfg.base_addr))
return PTR_ERR(ccdc->ccdc_cfg.base_addr);
 
-   vpfe->irq = platform_get_irq(pdev, 0);
-   if (vpfe->irq <= 0) {
+   ret = platform_get_irq(pdev, 0);
+   if (ret <= 0) {
dev_err(>dev, "No IRQ resource\n");
return -ENODEV;
}
+   vpfe->irq = ret;
 
ret = devm_request_irq(vpfe->pdev, vpfe->irq, vpfe_isr, 0,
   "vpfe_capture0", vpfe);
-- 
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 04/19] v4l: omap3isp: fix handling platform_get_irq result

2015-09-24 Thread Andrzej Hajda
The function can return negative value.

The problem has been detected using proposed semantic patch
scripts/coccinelle/tests/assign_signed_to_unsigned.cocci [1].

[1]: http://permalink.gmane.org/gmane.linux.kernel/2046107

Signed-off-by: Andrzej Hajda 
---
Hi,

To avoid problems with too many mail recipients I have sent whole
patchset only to LKML. Anyway patches have no dependencies.

Regards
Andrzej
---
 drivers/media/platform/omap3isp/isp.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/omap3isp/isp.c 
b/drivers/media/platform/omap3isp/isp.c
index 56e683b..df9d2c2 100644
--- a/drivers/media/platform/omap3isp/isp.c
+++ b/drivers/media/platform/omap3isp/isp.c
@@ -2442,12 +2442,13 @@ static int isp_probe(struct platform_device *pdev)
}
 
/* Interrupt */
-   isp->irq_num = platform_get_irq(pdev, 0);
-   if (isp->irq_num <= 0) {
+   ret = platform_get_irq(pdev, 0);
+   if (ret <= 0) {
dev_err(isp->dev, "No IRQ resource\n");
ret = -ENODEV;
goto error_iommu;
}
+   isp->irq_num = ret;
 
if (devm_request_irq(isp->dev, isp->irq_num, isp_isr, IRQF_SHARED,
 "OMAP3 ISP", isp)) {
-- 
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 07/19] net: hisilicon: fix handling platform_get_irq result

2015-09-24 Thread Andrzej Hajda
The function can return negative value.

The problem has been detected using proposed semantic patch
scripts/coccinelle/tests/assign_signed_to_unsigned.cocci [1].

[1]: http://permalink.gmane.org/gmane.linux.kernel/2046107

Signed-off-by: Andrzej Hajda 
---
Hi,

To avoid problems with too many mail recipients I have sent whole
patchset only to LKML. Anyway patches have no dependencies.

Regards
Andrzej
---
 drivers/net/ethernet/hisilicon/hip04_eth.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/hisilicon/hip04_eth.c 
b/drivers/net/ethernet/hisilicon/hip04_eth.c
index cc2d8b4..253f8ed 100644
--- a/drivers/net/ethernet/hisilicon/hip04_eth.c
+++ b/drivers/net/ethernet/hisilicon/hip04_eth.c
@@ -816,7 +816,7 @@ static int hip04_mac_probe(struct platform_device *pdev)
struct net_device *ndev;
struct hip04_priv *priv;
struct resource *res;
-   unsigned int irq;
+   int irq;
int ret;
 
ndev = alloc_etherdev(sizeof(struct hip04_priv));
-- 
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/


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