[PATCH] ASoC: fsl-esai: fix ESAI TDM slot setting

2014-02-09 Thread Xiubo Li
Cc: Nicolin Chen 
Signed-off-by: Xiubo Li 
---
 sound/soc/fsl/fsl_esai.c | 4 ++--
 sound/soc/fsl/fsl_esai.h | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/sound/soc/fsl/fsl_esai.c b/sound/soc/fsl/fsl_esai.c
index d0c72ed..c84026c 100644
--- a/sound/soc/fsl/fsl_esai.c
+++ b/sound/soc/fsl/fsl_esai.c
@@ -326,7 +326,7 @@ static int fsl_esai_set_dai_tdm_slot(struct snd_soc_dai 
*dai, u32 tx_mask,
regmap_update_bits(esai_priv->regmap, REG_ESAI_TSMA,
   ESAI_xSMA_xS_MASK, ESAI_xSMA_xS(tx_mask));
regmap_update_bits(esai_priv->regmap, REG_ESAI_TSMB,
-  ESAI_xSMA_xS_MASK, ESAI_xSMB_xS(tx_mask));
+  ESAI_xSMB_xS_MASK, ESAI_xSMB_xS(tx_mask));
 
regmap_update_bits(esai_priv->regmap, REG_ESAI_RCCR,
   ESAI_xCCR_xDC_MASK, ESAI_xCCR_xDC(slots));
@@ -334,7 +334,7 @@ static int fsl_esai_set_dai_tdm_slot(struct snd_soc_dai 
*dai, u32 tx_mask,
regmap_update_bits(esai_priv->regmap, REG_ESAI_RSMA,
   ESAI_xSMA_xS_MASK, ESAI_xSMA_xS(rx_mask));
regmap_update_bits(esai_priv->regmap, REG_ESAI_RSMB,
-  ESAI_xSMA_xS_MASK, ESAI_xSMB_xS(rx_mask));
+  ESAI_xSMB_xS_MASK, ESAI_xSMB_xS(rx_mask));
 
esai_priv->slot_width = slot_width;
 
diff --git a/sound/soc/fsl/fsl_esai.h b/sound/soc/fsl/fsl_esai.h
index 9c9f957..75e1403 100644
--- a/sound/soc/fsl/fsl_esai.h
+++ b/sound/soc/fsl/fsl_esai.h
@@ -322,7 +322,7 @@
 #define ESAI_xSMB_xS_SHIFT 0
 #define ESAI_xSMB_xS_WIDTH 16
 #define ESAI_xSMB_xS_MASK  (((1 << ESAI_xSMB_xS_WIDTH) - 1) << 
ESAI_xSMB_xS_SHIFT)
-#define ESAI_xSMB_xS(v)(((v) >> ESAI_xSMA_xS_WIDTH) & 
ESAI_xSMA_xS_MASK)
+#define ESAI_xSMB_xS(v)(((v) >> ESAI_xSMA_xS_WIDTH) & 
ESAI_xSMB_xS_MASK)
 
 /* Port C Direction Register -- REG_ESAI_PRRC 0xF8 */
 #define ESAI_PRRC_PDC_SHIFT0
-- 
1.8.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 v3 2/3] ACPI / processor_core: Rework _PDC related stuff to make it more arch-independent

2014-02-09 Thread Hanjun Guo
_PDC related stuff in processor_core.c is little bit X86/IA64 dependent,
rework the code to make it more arch-independent, no functional change
in this patch.

Signed-off-by: Hanjun Guo 
Signed-off-by: Graeme Gregory 
---
 arch/ia64/include/asm/acpi.h  |5 +
 arch/ia64/kernel/acpi.c   |   14 ++
 arch/x86/include/asm/acpi.h   |   19 +--
 arch/x86/kernel/acpi/cstate.c |   29 +
 drivers/acpi/processor_core.c |   19 +--
 5 files changed, 46 insertions(+), 40 deletions(-)

diff --git a/arch/ia64/include/asm/acpi.h b/arch/ia64/include/asm/acpi.h
index d651102..d2b8b9d 100644
--- a/arch/ia64/include/asm/acpi.h
+++ b/arch/ia64/include/asm/acpi.h
@@ -152,10 +152,7 @@ extern int __initdata nid_to_pxm_map[MAX_NUMNODES];
 #endif
 
 static inline bool arch_has_acpi_pdc(void) { return true; }
-static inline void arch_acpi_set_pdc_bits(u32 *buf)
-{
-   buf[2] |= ACPI_PDC_EST_CAPABILITY_SMP;
-}
+extern void arch_acpi_set_pdc_bits(u32 *buf);
 
 #define acpi_unlazy_tlb(x)
 
diff --git a/arch/ia64/kernel/acpi.c b/arch/ia64/kernel/acpi.c
index 07d209c..af9d9e4 100644
--- a/arch/ia64/kernel/acpi.c
+++ b/arch/ia64/kernel/acpi.c
@@ -1014,3 +1014,17 @@ EXPORT_SYMBOL(acpi_unregister_ioapic);
  * TBD when when IA64 starts to support suspend...
  */
 int acpi_suspend_lowlevel(void) { return 0; }
+
+void arch_acpi_set_pdc_bits(u32 *buf)
+{
+   /* Enable coordination with firmware's _TSD info */
+   buf[2] |= ACPI_PDC_SMP_T_SWCOORD | ACPI_PDC_EST_CAPABILITY_SMP;
+   if (boot_option_idle_override == IDLE_NOMWAIT) {
+   /*
+* If mwait is disabled for CPU C-states, the C2C3_FFH access
+* mode will be disabled in the parameter of _PDC object.
+* Of course C1_FFH access mode will also be disabled.
+*/
+   buf[2] &= ~(ACPI_PDC_C_C2C3_FFH | ACPI_PDC_C_C1_FFH);
+   }
+}
diff --git a/arch/x86/include/asm/acpi.h b/arch/x86/include/asm/acpi.h
index c8c1e70..e9f71bc 100644
--- a/arch/x86/include/asm/acpi.h
+++ b/arch/x86/include/asm/acpi.h
@@ -147,24 +147,7 @@ static inline bool arch_has_acpi_pdc(void)
c->x86_vendor == X86_VENDOR_CENTAUR);
 }
 
-static inline void arch_acpi_set_pdc_bits(u32 *buf)
-{
-   struct cpuinfo_x86 *c = _data(0);
-
-   buf[2] |= ACPI_PDC_C_CAPABILITY_SMP;
-
-   if (cpu_has(c, X86_FEATURE_EST))
-   buf[2] |= ACPI_PDC_EST_CAPABILITY_SWSMP;
-
-   if (cpu_has(c, X86_FEATURE_ACPI))
-   buf[2] |= ACPI_PDC_T_FFH;
-
-   /*
-* If mwait/monitor is unsupported, C2/C3_FFH will be disabled
-*/
-   if (!cpu_has(c, X86_FEATURE_MWAIT))
-   buf[2] &= ~(ACPI_PDC_C_C2C3_FFH);
-}
+extern void arch_acpi_set_pdc_bits(u32 *buf);
 
 #else /* !CONFIG_ACPI */
 
diff --git a/arch/x86/kernel/acpi/cstate.c b/arch/x86/kernel/acpi/cstate.c
index e69182f..740b4ae 100644
--- a/arch/x86/kernel/acpi/cstate.c
+++ b/arch/x86/kernel/acpi/cstate.c
@@ -16,6 +16,35 @@
 #include 
 #include 
 
+void arch_acpi_set_pdc_bits(u32 *buf)
+{
+   struct cpuinfo_x86 *c = _data(0);
+
+   /* Enable coordination with firmware's _TSD info */
+   buf[2] |= ACPI_PDC_SMP_T_SWCOORD | ACPI_PDC_C_CAPABILITY_SMP;
+   
+   if (cpu_has(c, X86_FEATURE_EST))
+   buf[2] |= ACPI_PDC_EST_CAPABILITY_SWSMP;
+
+   if (cpu_has(c, X86_FEATURE_ACPI))
+   buf[2] |= ACPI_PDC_T_FFH;
+
+   /*
+* If mwait/monitor is unsupported, C2/C3_FFH will be disabled
+*/
+   if (!cpu_has(c, X86_FEATURE_MWAIT))
+   buf[2] &= ~(ACPI_PDC_C_C2C3_FFH);
+   
+   if (boot_option_idle_override == IDLE_NOMWAIT) {
+   /*
+* If mwait is disabled for CPU C-states, the C2C3_FFH access
+* mode will be disabled in the parameter of _PDC object.
+* Of course C1_FFH access mode will also be disabled.
+*/
+   buf[2] &= ~(ACPI_PDC_C_C2C3_FFH | ACPI_PDC_C_C1_FFH);
+   }
+}
+
 /*
  * Initialize bm_flags based on the CPU cache properties
  * On SMP it depends on cache configuration
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c
index a79fd8ee..575c500 100644
--- a/drivers/acpi/processor_core.c
+++ b/drivers/acpi/processor_core.c
@@ -255,9 +255,6 @@ static void acpi_set_pdc_bits(u32 *buf)
buf[0] = ACPI_PDC_REVISION_ID;
buf[1] = 1;
 
-   /* Enable coordination with firmware's _TSD info */
-   buf[2] = ACPI_PDC_SMP_T_SWCOORD;
-
/* Twiddle arch-specific bits needed for _PDC */
arch_acpi_set_pdc_bits(buf);
 }
@@ -282,7 +279,7 @@ static struct acpi_object_list 
*acpi_processor_alloc_pdc(void)
return NULL;
}
 
-   buf = kmalloc(12, GFP_KERNEL);
+   buf = kzalloc(12, GFP_KERNEL);
if (!buf) {
printk(KERN_ERR "Memory allocation error\n");
kfree(obj);

[PATCH v3 3/3] ACPI / processor: Introduce map_gic_id() to get apic id from MADT or _MAT method

2014-02-09 Thread Hanjun Guo
Get apic id from MADT or _MAT method is not implemented on arm/arm64,
and ACPI 5.0 introduces GIC Structure for it, so this patch introduces
map_gic_id() to get apic id followed the ACPI 5.0 spec.

Signed-off-by: Hanjun Guo 
---
 drivers/acpi/processor_core.c |   26 ++
 1 file changed, 26 insertions(+)

diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c
index 575c500..eaaeebc 100644
--- a/drivers/acpi/processor_core.c
+++ b/drivers/acpi/processor_core.c
@@ -71,6 +71,27 @@ static int map_lsapic_id(struct acpi_subtable_header *entry,
return 0;
 }
 
+static int map_gic_id(struct acpi_subtable_header *entry,
+   int device_declaration, u32 acpi_id, int *apic_id)
+{
+   struct acpi_madt_generic_interrupt *gic =
+   (struct acpi_madt_generic_interrupt *)entry;
+
+   if (!(gic->flags & ACPI_MADT_ENABLED))
+   return -ENODEV;
+
+   /* In the GIC interrupt model, logical processors are
+* required to have a Processor Device object in the DSDT,
+* so we should check device_declaration here
+*/
+   if (device_declaration && (gic->uid == acpi_id)) {
+   *apic_id = gic->gic_id;
+   return 0;
+   }
+
+   return -EINVAL;
+}
+
 static int map_madt_entry(int type, u32 acpi_id)
 {
unsigned long madt_end, entry;
@@ -106,6 +127,9 @@ static int map_madt_entry(int type, u32 acpi_id)
} else if (header->type == ACPI_MADT_TYPE_LOCAL_SAPIC) {
if (!map_lsapic_id(header, type, acpi_id, _id))
break;
+   } else if (header->type == ACPI_MADT_TYPE_GENERIC_INTERRUPT) {
+   if (!map_gic_id(header, type, acpi_id, _id))
+   break;
}
entry += header->length;
}
@@ -136,6 +160,8 @@ static int map_mat_entry(acpi_handle handle, int type, u32 
acpi_id)
map_lapic_id(header, acpi_id, _id);
} else if (header->type == ACPI_MADT_TYPE_LOCAL_SAPIC) {
map_lsapic_id(header, type, acpi_id, _id);
+   } else if (header->type == ACPI_MADT_TYPE_GENERIC_INTERRUPT) {
+   map_gic_id(header, type, acpi_id, _id);
}
 
 exit:
-- 
1.7.9.5

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


[PATCH v3 1/3] ACPI / idle: Make idle_boot_override depend on x86 and ia64

2014-02-09 Thread Hanjun Guo
idle_boot_override depends on x86 and ia64 now, and we can not
foresee it will be used on ARM or ARM64,so move the code into
CONFIG_X86 and CONFIG_IA64 #ifdefs to make processor_core.c
can be compiled on ARM64.

Reviewed-by: Lan Tianyu 
Signed-off-by: Hanjun Guo 
---
 drivers/acpi/processor_core.c |   40 ++--
 1 file changed, 22 insertions(+), 18 deletions(-)

diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c
index 7c50a4c..a79fd8ee 100644
--- a/drivers/acpi/processor_core.c
+++ b/drivers/acpi/processor_core.c
@@ -19,24 +19,6 @@
 #define _COMPONENT ACPI_PROCESSOR_COMPONENT
 ACPI_MODULE_NAME("processor_core");
 
-static int __init set_no_mwait(const struct dmi_system_id *id)
-{
-   printk(KERN_NOTICE PREFIX "%s detected - "
-   "disabling mwait for CPU C-states\n", id->ident);
-   boot_option_idle_override = IDLE_NOMWAIT;
-   return 0;
-}
-
-static struct dmi_system_id processor_idle_dmi_table[] __initdata = {
-   {
-   set_no_mwait, "Extensa 5220", {
-   DMI_MATCH(DMI_BIOS_VENDOR, "Phoenix Technologies LTD"),
-   DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
-   DMI_MATCH(DMI_PRODUCT_VERSION, "0100"),
-   DMI_MATCH(DMI_BOARD_NAME, "Columbia") }, NULL},
-   {},
-};
-
 static int map_lapic_id(struct acpi_subtable_header *entry,
 u32 acpi_id, int *apic_id)
 {
@@ -379,13 +361,35 @@ early_init_pdc(acpi_handle handle, u32 lvl, void 
*context, void **rv)
return AE_OK;
 }
 
+#if defined(CONFIG_X86) || defined(CONFIG_IA64)
+static int __init set_no_mwait(const struct dmi_system_id *id)
+{
+   printk(KERN_NOTICE PREFIX "%s detected - "
+   "disabling mwait for CPU C-states\n", id->ident);
+   boot_option_idle_override = IDLE_NOMWAIT;
+   return 0;
+}
+
+static struct dmi_system_id processor_idle_dmi_table[] __initdata = {
+   {
+   set_no_mwait, "Extensa 5220", {
+   DMI_MATCH(DMI_BIOS_VENDOR, "Phoenix Technologies LTD"),
+   DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
+   DMI_MATCH(DMI_PRODUCT_VERSION, "0100"),
+   DMI_MATCH(DMI_BOARD_NAME, "Columbia") }, NULL},
+   {},
+};
+#endif
+
 void __init acpi_early_processor_set_pdc(void)
 {
+#if defined(CONFIG_X86) || defined(CONFIG_IA64)
/*
 * Check whether the system is DMI table. If yes, OSPM
 * should not use mwait for CPU-states.
 */
dmi_check_system(processor_idle_dmi_table);
+#endif
 
acpi_walk_namespace(ACPI_TYPE_PROCESSOR, ACPI_ROOT_OBJECT,
ACPI_UINT32_MAX,
-- 
1.7.9.5

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


[PATCH v3 0/3] Prepare for running ACPI on !x86 and !ia64

2014-02-09 Thread Hanjun Guo
Some of the ACPI code is arch-dependent and make the code can't be
compiled on !x86 or !ia64, the first two patches just do some rework
on the idle_boot_override and _PDC related stuff to make the ACPI
code more arch-independent.

The third patch just introduce map_gic_id() for ACPI processor core
followed the ACPI 5.0 spec.

I have compiled the kernel successfully after appling this patch set
on x86 and ia64.

Changes for v3:
Fix the issues pointed out by Lan Tianyu and and the Reviewed-by for
first patch.

Changes for v2:
a) add #if defined(CONFIG_X86) || defined(CONFIG_IA64) for
   idle_boot_override related code;
b) Rebased on 3.14-rc1.

Changes since the RFC version:
a) Remove the RFC tag;
b) Move idle_boot_override out of the arch directory suggested
   by Alan;
c) Make these 3 patches as a separate patch set since there are
   not not related to the ARM/ARM64 platform.

Hanjun Guo (3):
  ACPI / idle: Make idle_boot_override depend on x86 and ia64
  ACPI / processor_core: Rework _PDC related stuff to make it more
arch-independent
  ACPI: Introduce map_gic_id() to get apic id from MADT or _MAT method

 arch/ia64/include/asm/acpi.h  |5 +--
 arch/ia64/kernel/acpi.c   |   17 +
 arch/x86/include/asm/acpi.h   |   19 +
 arch/x86/kernel/acpi/cstate.c |   31 +++
 drivers/acpi/processor_core.c |   85 -
 5 files changed, 99 insertions(+), 58 deletions(-)

-- 
1.7.9.5

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


Re: [PATCH v2] mfd: MAX6650/6651 support

2014-02-09 Thread Laszlo Papp
>> + help
>> +   Say yes here to support for Maxim Semiconductor MAX6650/MAX6651. 
>> This is
>> +   a fan speed regulator and monitor IC. This driver provies common 
>> support
>
> s/provies/provides/

Good catch!

(Note to myself: I should have run my vim spellchecker... )

>> + max665x->map = regmap_init_i2c(i2c, _regmap_config);
>
> Use devm_regmap_init_i2c() (or add missing regmap_exit()).

Ah, okay, I was not aware of that, 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 v6 01/14] uprobes: allow ignoring of probe hits

2014-02-09 Thread David Long
From: "David A. Long" 

Allow arches to decided to ignore a probe hit.  ARM will use this to
only call handlers if the conditions to execute a conditionally executed
instruction are satisfied.

Signed-off-by: David A. Long 
Acked-by: Oleg Nesterov 
---
 include/linux/uprobes.h | 1 +
 kernel/events/uprobes.c | 9 +
 2 files changed, 10 insertions(+)

diff --git a/include/linux/uprobes.h b/include/linux/uprobes.h
index e32251e..edff2b9 100644
--- a/include/linux/uprobes.h
+++ b/include/linux/uprobes.h
@@ -126,6 +126,7 @@ extern bool arch_uprobe_xol_was_trapped(struct task_struct 
*tsk);
 extern int  arch_uprobe_exception_notify(struct notifier_block *self, unsigned 
long val, void *data);
 extern void arch_uprobe_abort_xol(struct arch_uprobe *aup, struct pt_regs 
*regs);
 extern unsigned long arch_uretprobe_hijack_return_addr(unsigned long 
trampoline_vaddr, struct pt_regs *regs);
+extern bool __weak arch_uprobe_ignore(struct arch_uprobe *aup, struct pt_regs 
*regs);
 #else /* !CONFIG_UPROBES */
 struct uprobes_state {
 };
diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c
index 307d87c..04709b6 100644
--- a/kernel/events/uprobes.c
+++ b/kernel/events/uprobes.c
@@ -1804,6 +1804,11 @@ static bool handle_trampoline(struct pt_regs *regs)
return true;
 }
 
+bool __weak arch_uprobe_ignore(struct arch_uprobe *aup, struct pt_regs *regs)
+{
+   return false;
+}
+
 /*
  * Run handler and ask thread to singlestep.
  * Ensure all non-fatal signals cannot interrupt thread while it singlesteps.
@@ -1858,7 +1863,11 @@ static void handle_swbp(struct pt_regs *regs)
if (!get_utask())
goto out;
 
+   if (arch_uprobe_ignore(>arch, regs))
+   goto out;
+
handler_chain(uprobe, regs);
+
if (can_skip_sstep(uprobe, regs))
goto out;
 
-- 
1.8.1.2

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


[PATCH v6 09/14] ARM: Change more ARM kprobes symbol names to something more

2014-02-09 Thread David Long
From: "David A. Long" 

Change kprobe_emulate_none, kprobe_simulate_nop, and arm_kprobe_decode_init
function names to something more appropriate for code being shared
outside of the kprobes subsystem. Also, move the new arm_probes_decode_init
declaration out of the kprobes.h include file and into the probes.h include 
file.

Signed-off-by: David A. Long 
Acked-by: Jon Medhurst 
---
 arch/arm/kernel/kprobes-arm.c   | 12 ++--
 arch/arm/kernel/kprobes-thumb.c | 10 +-
 arch/arm/kernel/kprobes.c   |  2 +-
 arch/arm/kernel/kprobes.h   |  2 --
 arch/arm/kernel/probes.c|  6 +++---
 arch/arm/kernel/probes.h|  6 --
 6 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/arch/arm/kernel/kprobes-arm.c b/arch/arm/kernel/kprobes-arm.c
index bbbdda5..52591e3 100644
--- a/arch/arm/kernel/kprobes-arm.c
+++ b/arch/arm/kernel/kprobes-arm.c
@@ -302,10 +302,10 @@ emulate_rdlo12rdhi16rn0rm8_rwflags_nopc(probes_opcode_t 
insn,
 }
 
 const union decode_action kprobes_arm_actions[NUM_PROBES_ARM_ACTIONS] = {
-   [PROBES_EMULATE_NONE] = {.handler = kprobe_emulate_none},
-   [PROBES_SIMULATE_NOP] = {.handler = kprobe_simulate_nop},
-   [PROBES_PRELOAD_IMM] = {.handler = kprobe_simulate_nop},
-   [PROBES_PRELOAD_REG] = {.handler = kprobe_simulate_nop},
+   [PROBES_EMULATE_NONE] = {.handler = probes_emulate_none},
+   [PROBES_SIMULATE_NOP] = {.handler = probes_simulate_nop},
+   [PROBES_PRELOAD_IMM] = {.handler = probes_simulate_nop},
+   [PROBES_PRELOAD_REG] = {.handler = probes_simulate_nop},
[PROBES_BRANCH_IMM] = {.handler = simulate_blx1},
[PROBES_MRS] = {.handler = simulate_mrs},
[PROBES_BRANCH_REG] = {.handler = simulate_blx2bx},
@@ -326,8 +326,8 @@ const union decode_action 
kprobes_arm_actions[NUM_PROBES_ARM_ACTIONS] = {
[PROBES_DATA_PROCESSING_IMM] = {
.handler = emulate_rd12rn16rm0rs8_rwflags},
[PROBES_MOV_HALFWORD] = {.handler = emulate_rd12rm0_noflags_nopc},
-   [PROBES_SEV] = {.handler = kprobe_emulate_none},
-   [PROBES_WFE] = {.handler = kprobe_simulate_nop},
+   [PROBES_SEV] = {.handler = probes_emulate_none},
+   [PROBES_WFE] = {.handler = probes_simulate_nop},
[PROBES_SATURATE] = {.handler = emulate_rd12rn16rm0_rwflags_nopc},
[PROBES_REV] = {.handler = emulate_rd12rm0_noflags_nopc},
[PROBES_MMI] = {.handler = emulate_rd12rn16rm0_rwflags_nopc},
diff --git a/arch/arm/kernel/kprobes-thumb.c b/arch/arm/kernel/kprobes-thumb.c
index 3e26fde..3cbaf14 100644
--- a/arch/arm/kernel/kprobes-thumb.c
+++ b/arch/arm/kernel/kprobes-thumb.c
@@ -612,8 +612,8 @@ const union decode_action 
kprobes_t16_actions[NUM_PROBES_T16_ACTIONS] = {
[PROBES_T16_SIGN_EXTEND] = {.handler = t16_emulate_loregs_rwflags},
[PROBES_T16_PUSH] = {.decoder = t16_decode_push},
[PROBES_T16_POP] = {.decoder = t16_decode_pop},
-   [PROBES_T16_SEV] = {.handler = kprobe_emulate_none},
-   [PROBES_T16_WFE] = {.handler = kprobe_simulate_nop},
+   [PROBES_T16_SEV] = {.handler = probes_emulate_none},
+   [PROBES_T16_WFE] = {.handler = probes_simulate_nop},
[PROBES_T16_IT] = {.decoder = t16_decode_it},
[PROBES_T16_CMP] = {.handler = t16_emulate_loregs_rwflags},
[PROBES_T16_ADDSUB] = {.handler = t16_emulate_loregs_noitrwflags},
@@ -643,12 +643,12 @@ const union decode_action 
kprobes_t32_actions[NUM_PROBES_T32_ACTIONS] = {
[PROBES_T32_MOVW] = {.handler = t32_emulate_rd8rn16_noflags},
[PROBES_T32_SAT] = {.handler = t32_emulate_rd8rn16rm0_rwflags},
[PROBES_T32_BITFIELD] = {.handler = t32_emulate_rd8rn16_noflags},
-   [PROBES_T32_SEV] = {.handler = kprobe_emulate_none},
-   [PROBES_T32_WFE] = {.handler = kprobe_simulate_nop},
+   [PROBES_T32_SEV] = {.handler = probes_emulate_none},
+   [PROBES_T32_WFE] = {.handler = probes_simulate_nop},
[PROBES_T32_MRS] = {.handler = t32_simulate_mrs},
[PROBES_T32_BRANCH_COND] = {.decoder = t32_decode_cond_branch},
[PROBES_T32_BRANCH] = {.handler = t32_simulate_branch},
-   [PROBES_T32_PLDI] = {.handler = kprobe_simulate_nop},
+   [PROBES_T32_PLDI] = {.handler = probes_simulate_nop},
[PROBES_T32_LDR_LIT] = {.handler = t32_simulate_ldr_literal},
[PROBES_T32_LDRSTR] = {.handler = t32_emulate_ldrstr},
[PROBES_T32_SIGN_EXTEND] = {.handler = t32_emulate_rd8rn16rm0_rwflags},
diff --git a/arch/arm/kernel/kprobes.c b/arch/arm/kernel/kprobes.c
index 0206ee9..3e3a3e0 100644
--- a/arch/arm/kernel/kprobes.c
+++ b/arch/arm/kernel/kprobes.c
@@ -612,7 +612,7 @@ static struct undef_hook kprobes_arm_break_hook = {
 
 int __init arch_init_kprobes()
 {
-   arm_kprobe_decode_init();
+   arm_probes_decode_init();
 #ifdef CONFIG_THUMB2_KERNEL
register_undef_hook(_thumb16_break_hook);
register_undef_hook(_thumb32_break_hook);
diff --git a/arch/arm/kernel/kprobes.h b/arch/arm/kernel/kprobes.h
index 

[PATCH v6 06/14] ARM: Disable jprobes test when built into thumb-mode kernel

2014-02-09 Thread David Long
From: "Jon Medhurst (Tixy)" 

For now the jprobes tests fail on ARM for when built into a kernel compiled
in thumb mode. They work fine for ARM kernels, and when built as a loadable
module.

Signed-off-by: "Jon Medhurst (Tixy)" 
Acked-by: Jon Medhurst 
Signed-off-by: David A. Long 
---
 arch/arm/kernel/kprobes-test.c | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/arch/arm/kernel/kprobes-test.c b/arch/arm/kernel/kprobes-test.c
index 0cd63d0..65230b2 100644
--- a/arch/arm/kernel/kprobes-test.c
+++ b/arch/arm/kernel/kprobes-test.c
@@ -221,6 +221,7 @@ static int pre_handler_called;
 static int post_handler_called;
 static int jprobe_func_called;
 static int kretprobe_handler_called;
+static int tests_failed;
 
 #define FUNC_ARG1 0x12345678
 #define FUNC_ARG2 0xabcdef
@@ -457,6 +458,13 @@ static int run_api_tests(long (*func)(long, long))
 
pr_info("jprobe\n");
ret = test_jprobe(func);
+#if defined(CONFIG_THUMB2_KERNEL) && !defined(MODULE)
+   if (ret == -EINVAL) {
+   pr_err("FAIL: Known longtime bug with jprobe on Thumb kernels");
+   tests_failed = ret;
+   ret = 0;
+   }
+#endif
if (ret < 0)
return ret;
 
@@ -1667,6 +1675,8 @@ static int __init run_all_tests(void)
 
 out:
if (ret == 0)
+   ret = tests_failed;
+   if (ret == 0)
pr_info("Finished kprobe tests OK\n");
else
pr_err("kprobe tests failed\n");
-- 
1.8.1.2

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


[PATCH v6 11/14] ARM: Change the remaining shared kprobes/uprobes symbols to something generic

2014-02-09 Thread David Long
From: "David A. Long" 

Any more ARM kprobes/uprobes symbols which have "kprobe" in the name must be
changed to the more generic "probes" or other non-kprobes specific symbol.

Signed-off-by: David A. Long 
Acked-by: Jon Medhurst 
---
 arch/arm/include/asm/probes.h| 13 ++---
 arch/arm/kernel/kprobes-common.c |  2 +-
 arch/arm/kernel/kprobes-test.c   |  8 +---
 arch/arm/kernel/kprobes.c| 10 ++
 arch/arm/kernel/kprobes.h| 21 
 arch/arm/kernel/probes-arm.c |  8 
 arch/arm/kernel/probes-arm.h |  6 ++
 arch/arm/kernel/probes-thumb.c   | 18 -
 arch/arm/kernel/probes-thumb.h   | 10 ++
 arch/arm/kernel/probes.c |  4 ++--
 arch/arm/kernel/probes.h | 42 
 11 files changed, 69 insertions(+), 73 deletions(-)

diff --git a/arch/arm/include/asm/probes.h b/arch/arm/include/asm/probes.h
index c4acf6c..c37252c 100644
--- a/arch/arm/include/asm/probes.h
+++ b/arch/arm/include/asm/probes.h
@@ -19,26 +19,25 @@
 #ifndef _ASM_PROBES_H
 #define _ASM_PROBES_H
 
-struct kprobe;
 typedef u32 probes_opcode_t;
 
 struct arch_specific_insn;
-typedef void (kprobe_insn_handler_t)(probes_opcode_t,
+typedef void (probes_insn_handler_t)(probes_opcode_t,
 struct arch_specific_insn *,
 struct pt_regs *);
 typedef unsigned long (probes_check_cc)(unsigned long);
-typedef void (kprobe_insn_singlestep_t)(probes_opcode_t,
+typedef void (probes_insn_singlestep_t)(probes_opcode_t,
struct arch_specific_insn *,
struct pt_regs *);
-typedef void (kprobe_insn_fn_t)(void);
+typedef void (probes_insn_fn_t)(void);
 
 /* Architecture specific copy of original instruction. */
 struct arch_specific_insn {
probes_opcode_t *insn;
-   kprobe_insn_handler_t   *insn_handler;
+   probes_insn_handler_t   *insn_handler;
probes_check_cc *insn_check_cc;
-   kprobe_insn_singlestep_t*insn_singlestep;
-   kprobe_insn_fn_t*insn_fn;
+   probes_insn_singlestep_t*insn_singlestep;
+   probes_insn_fn_t*insn_fn;
 };
 
 #endif
diff --git a/arch/arm/kernel/kprobes-common.c b/arch/arm/kernel/kprobes-common.c
index b921b60..adc6d70 100644
--- a/arch/arm/kernel/kprobes-common.c
+++ b/arch/arm/kernel/kprobes-common.c
@@ -128,7 +128,7 @@ enum probes_insn __kprobes
 kprobe_decode_ldmstm(probes_opcode_t insn, struct arch_specific_insn *asi,
const struct decode_header *h)
 {
-   kprobe_insn_handler_t *handler = 0;
+   probes_insn_handler_t *handler = 0;
unsigned reglist = insn & 0x;
int is_ldm = insn & 0x10;
int rn = (insn >> 16) & 0xf;
diff --git a/arch/arm/kernel/kprobes-test.c b/arch/arm/kernel/kprobes-test.c
index 65230b2..a1f155c 100644
--- a/arch/arm/kernel/kprobes-test.c
+++ b/arch/arm/kernel/kprobes-test.c
@@ -205,6 +205,8 @@
 #include 
 
 #include "kprobes.h"
+#include "probes-arm.h"
+#include "probes-thumb.h"
 #include "kprobes-test.h"
 
 
@@ -1616,7 +1618,7 @@ static int __init run_all_tests(void)
goto out;
 
pr_info("ARM instruction simulation\n");
-   ret = run_test_cases(kprobe_arm_test_cases, kprobe_decode_arm_table);
+   ret = run_test_cases(kprobe_arm_test_cases, probes_decode_arm_table);
if (ret)
goto out;
 
@@ -1639,13 +1641,13 @@ static int __init run_all_tests(void)
 
pr_info("16-bit Thumb instruction simulation\n");
ret = run_test_cases(kprobe_thumb16_test_cases,
-   kprobe_decode_thumb16_table);
+   probes_decode_thumb16_table);
if (ret)
goto out;
 
pr_info("32-bit Thumb instruction simulation\n");
ret = run_test_cases(kprobe_thumb32_test_cases,
-   kprobe_decode_thumb32_table);
+   probes_decode_thumb32_table);
if (ret)
goto out;
 #endif
diff --git a/arch/arm/kernel/kprobes.c b/arch/arm/kernel/kprobes.c
index 3e3a3e0..db040ad 100644
--- a/arch/arm/kernel/kprobes.c
+++ b/arch/arm/kernel/kprobes.c
@@ -29,6 +29,8 @@
 #include 
 
 #include "kprobes.h"
+#include "probes-arm.h"
+#include "probes-thumb.h"
 #include "patch.h"
 
 #define MIN_STACK_SIZE(addr)   \
@@ -67,10 +69,10 @@ int __kprobes arch_prepare_kprobe(struct kprobe *p)
if (is_wide_instruction(insn)) {
insn <<= 16;
insn |= ((u16 *)addr)[1];
-   decode_insn = thumb32_kprobe_decode_insn;
+   decode_insn = thumb32_probes_decode_insn;
actions = kprobes_t32_actions;
} else {
-   decode_insn = thumb16_kprobe_decode_insn;
+   decode_insn = 

[PATCH v6 10/14] ARM: Rename the shared kprobes/uprobe return value enum

2014-02-09 Thread David Long
From: "David A. Long" 

Change the name of kprobes_insn to probes_insn so it can be shared between
kprobes and uprobes without confusion.

Signed-off-by: David A. Long 
Acked-by: Jon Medhurst 
---
 arch/arm/kernel/kprobes-common.c |  2 +-
 arch/arm/kernel/kprobes-thumb.c  | 16 
 arch/arm/kernel/kprobes.h| 14 --
 arch/arm/kernel/probes-arm.c |  2 +-
 arch/arm/kernel/probes-thumb.c   |  4 ++--
 arch/arm/kernel/probes.h |  9 +++--
 6 files changed, 23 insertions(+), 24 deletions(-)

diff --git a/arch/arm/kernel/kprobes-common.c b/arch/arm/kernel/kprobes-common.c
index 93b03c8..b921b60 100644
--- a/arch/arm/kernel/kprobes-common.c
+++ b/arch/arm/kernel/kprobes-common.c
@@ -124,7 +124,7 @@ emulate_ldm_r3_15(probes_opcode_t insn,
load_write_pc(regs->ARM_pc, regs);
 }
 
-enum kprobe_insn __kprobes
+enum probes_insn __kprobes
 kprobe_decode_ldmstm(probes_opcode_t insn, struct arch_specific_insn *asi,
const struct decode_header *h)
 {
diff --git a/arch/arm/kernel/kprobes-thumb.c b/arch/arm/kernel/kprobes-thumb.c
index 3cbaf14..2a67903 100644
--- a/arch/arm/kernel/kprobes-thumb.c
+++ b/arch/arm/kernel/kprobes-thumb.c
@@ -65,7 +65,7 @@ t32_simulate_cond_branch(probes_opcode_t insn,
regs->ARM_pc = pc + (offset * 2);
 }
 
-static enum kprobe_insn __kprobes
+static enum probes_insn __kprobes
 t32_decode_cond_branch(probes_opcode_t insn, struct arch_specific_insn *asi,
const struct decode_header *d)
 {
@@ -141,11 +141,11 @@ t32_simulate_ldr_literal(probes_opcode_t insn,
regs->uregs[rt] = rtv;
 }
 
-static enum kprobe_insn __kprobes
+static enum probes_insn __kprobes
 t32_decode_ldmstm(probes_opcode_t insn, struct arch_specific_insn *asi,
const struct decode_header *d)
 {
-   enum kprobe_insn ret = kprobe_decode_ldmstm(insn, asi, d);
+   enum probes_insn ret = kprobe_decode_ldmstm(insn, asi, d);
 
/* Fixup modified instruction to have halfwords in correct order...*/
insn = asi->insn[0];
@@ -401,7 +401,7 @@ t16_singlestep_it(probes_opcode_t insn,
t16_simulate_it(insn, asi, regs);
 }
 
-static enum kprobe_insn __kprobes
+static enum probes_insn __kprobes
 t16_decode_it(probes_opcode_t insn, struct arch_specific_insn *asi,
const struct decode_header *d)
 {
@@ -419,7 +419,7 @@ t16_simulate_cond_branch(probes_opcode_t insn,
regs->ARM_pc = pc + (offset * 2);
 }
 
-static enum kprobe_insn __kprobes
+static enum probes_insn __kprobes
 t16_decode_cond_branch(probes_opcode_t insn, struct arch_specific_insn *asi,
const struct decode_header *d)
 {
@@ -509,7 +509,7 @@ t16_emulate_hiregs(probes_opcode_t insn,
regs->ARM_cpsr = (regs->ARM_cpsr & ~APSR_MASK) | (cpsr & APSR_MASK);
 }
 
-static enum kprobe_insn __kprobes
+static enum probes_insn __kprobes
 t16_decode_hiregs(probes_opcode_t insn, struct arch_specific_insn *asi,
const struct decode_header *d)
 {
@@ -537,7 +537,7 @@ t16_emulate_push(probes_opcode_t insn,
);
 }
 
-static enum kprobe_insn __kprobes
+static enum probes_insn __kprobes
 t16_decode_push(probes_opcode_t insn, struct arch_specific_insn *asi,
const struct decode_header *d)
 {
@@ -590,7 +590,7 @@ t16_emulate_pop_pc(probes_opcode_t insn,
bx_write_pc(pc, regs);
 }
 
-static enum kprobe_insn __kprobes
+static enum probes_insn __kprobes
 t16_decode_pop(probes_opcode_t insn, struct arch_specific_insn *asi,
const struct decode_header *d)
 {
diff --git a/arch/arm/kernel/kprobes.h b/arch/arm/kernel/kprobes.h
index e2ae4ed..3684fc9 100644
--- a/arch/arm/kernel/kprobes.h
+++ b/arch/arm/kernel/kprobes.h
@@ -30,28 +30,22 @@
 struct decode_header;
 union decode_action;
 
-enum kprobe_insn {
-   INSN_REJECTED,
-   INSN_GOOD,
-   INSN_GOOD_NO_SLOT
-};
-
-typedef enum kprobe_insn (kprobe_decode_insn_t)(probes_opcode_t,
+typedef enum probes_insn (kprobe_decode_insn_t)(probes_opcode_t,
struct arch_specific_insn *,
const union decode_action *);
 
 #ifdef CONFIG_THUMB2_KERNEL
 
-enum kprobe_insn thumb16_kprobe_decode_insn(probes_opcode_t,
+enum probes_insn thumb16_kprobe_decode_insn(probes_opcode_t,
struct arch_specific_insn *,
const union decode_action *);
-enum kprobe_insn thumb32_kprobe_decode_insn(probes_opcode_t,
+enum probes_insn thumb32_kprobe_decode_insn(probes_opcode_t,
struct arch_specific_insn *,
const union decode_action *);
 
 #else /* !CONFIG_THUMB2_KERNEL */
 
-enum kprobe_insn arm_kprobe_decode_insn(probes_opcode_t,
+enum probes_insn arm_kprobe_decode_insn(probes_opcode_t,
struct arch_specific_insn *,
  

[PATCH v6 08/14] ARM: Make the kprobes condition_check symbol names more generic

2014-02-09 Thread David Long
From: "David A. Long" 

In preparation for sharing the ARM kprobes instruction interpreting
code with uprobes, make the symbols names less kprobes-specific.

Signed-off-by: David A. Long 
Acked-by: Jon Medhurst 
---
 arch/arm/include/asm/probes.h| 11 +++---
 arch/arm/kernel/kprobes-arm.c| 16 -
 arch/arm/kernel/kprobes-common.c | 14 
 arch/arm/kernel/kprobes-thumb.c  | 76 
 arch/arm/kernel/kprobes.h|  8 ++---
 arch/arm/kernel/probes-arm.c | 16 -
 arch/arm/kernel/probes-arm.h | 10 +++---
 arch/arm/kernel/probes-thumb.c   | 10 +++---
 arch/arm/kernel/probes.c | 22 ++--
 arch/arm/kernel/probes.h | 12 +++
 10 files changed, 98 insertions(+), 97 deletions(-)

diff --git a/arch/arm/include/asm/probes.h b/arch/arm/include/asm/probes.h
index 4d014c4..c4acf6c 100644
--- a/arch/arm/include/asm/probes.h
+++ b/arch/arm/include/asm/probes.h
@@ -20,22 +20,23 @@
 #define _ASM_PROBES_H
 
 struct kprobe;
+typedef u32 probes_opcode_t;
 
 struct arch_specific_insn;
-typedef void (kprobe_insn_handler_t)(kprobe_opcode_t,
+typedef void (kprobe_insn_handler_t)(probes_opcode_t,
 struct arch_specific_insn *,
 struct pt_regs *);
-typedef unsigned long (kprobe_check_cc)(unsigned long);
-typedef void (kprobe_insn_singlestep_t)(kprobe_opcode_t,
+typedef unsigned long (probes_check_cc)(unsigned long);
+typedef void (kprobe_insn_singlestep_t)(probes_opcode_t,
struct arch_specific_insn *,
struct pt_regs *);
 typedef void (kprobe_insn_fn_t)(void);
 
 /* Architecture specific copy of original instruction. */
 struct arch_specific_insn {
-   kprobe_opcode_t *insn;
+   probes_opcode_t *insn;
kprobe_insn_handler_t   *insn_handler;
-   kprobe_check_cc *insn_check_cc;
+   probes_check_cc *insn_check_cc;
kprobe_insn_singlestep_t*insn_singlestep;
kprobe_insn_fn_t*insn_fn;
 };
diff --git a/arch/arm/kernel/kprobes-arm.c b/arch/arm/kernel/kprobes-arm.c
index d62bbdf..bbbdda5 100644
--- a/arch/arm/kernel/kprobes-arm.c
+++ b/arch/arm/kernel/kprobes-arm.c
@@ -73,7 +73,7 @@
 #endif
 
 static void __kprobes
-emulate_ldrdstrd(kprobe_opcode_t insn,
+emulate_ldrdstrd(probes_opcode_t insn,
struct arch_specific_insn *asi, struct pt_regs *regs)
 {
unsigned long pc = regs->ARM_pc + 4;
@@ -102,7 +102,7 @@ emulate_ldrdstrd(kprobe_opcode_t insn,
 }
 
 static void __kprobes
-emulate_ldr(kprobe_opcode_t insn,
+emulate_ldr(probes_opcode_t insn,
struct arch_specific_insn *asi, struct pt_regs *regs)
 {
unsigned long pc = regs->ARM_pc + 4;
@@ -132,7 +132,7 @@ emulate_ldr(kprobe_opcode_t insn,
 }
 
 static void __kprobes
-emulate_str(kprobe_opcode_t insn,
+emulate_str(probes_opcode_t insn,
struct arch_specific_insn *asi, struct pt_regs *regs)
 {
unsigned long rtpc = regs->ARM_pc - 4 + str_pc_offset;
@@ -159,7 +159,7 @@ emulate_str(kprobe_opcode_t insn,
 }
 
 static void __kprobes
-emulate_rd12rn16rm0rs8_rwflags(kprobe_opcode_t insn,
+emulate_rd12rn16rm0rs8_rwflags(probes_opcode_t insn,
struct arch_specific_insn *asi, struct pt_regs *regs)
 {
unsigned long pc = regs->ARM_pc + 4;
@@ -194,7 +194,7 @@ emulate_rd12rn16rm0rs8_rwflags(kprobe_opcode_t insn,
 }
 
 static void __kprobes
-emulate_rd12rn16rm0_rwflags_nopc(kprobe_opcode_t insn,
+emulate_rd12rn16rm0_rwflags_nopc(probes_opcode_t insn,
struct arch_specific_insn *asi, struct pt_regs *regs)
 {
int rd = (insn >> 12) & 0xf;
@@ -221,7 +221,7 @@ emulate_rd12rn16rm0_rwflags_nopc(kprobe_opcode_t insn,
 }
 
 static void __kprobes
-emulate_rd16rn12rm0rs8_rwflags_nopc(kprobe_opcode_t insn,
+emulate_rd16rn12rm0rs8_rwflags_nopc(probes_opcode_t insn,
struct arch_specific_insn *asi,
struct pt_regs *regs)
 {
@@ -251,7 +251,7 @@ emulate_rd16rn12rm0rs8_rwflags_nopc(kprobe_opcode_t insn,
 }
 
 static void __kprobes
-emulate_rd12rm0_noflags_nopc(kprobe_opcode_t insn,
+emulate_rd12rm0_noflags_nopc(probes_opcode_t insn,
struct arch_specific_insn *asi, struct pt_regs *regs)
 {
int rd = (insn >> 12) & 0xf;
@@ -271,7 +271,7 @@ emulate_rd12rm0_noflags_nopc(kprobe_opcode_t insn,
 }
 
 static void __kprobes
-emulate_rdlo12rdhi16rn0rm8_rwflags_nopc(kprobe_opcode_t insn,
+emulate_rdlo12rdhi16rn0rm8_rwflags_nopc(probes_opcode_t insn,
struct arch_specific_insn *asi,
struct pt_regs *regs)
 {
diff --git a/arch/arm/kernel/kprobes-common.c b/arch/arm/kernel/kprobes-common.c
index da65499..93b03c8 100644
--- a/arch/arm/kernel/kprobes-common.c
+++ b/arch/arm/kernel/kprobes-common.c
@@ -18,7 +18,7 @@
 #include "kprobes.h"
 
 
-static void __kprobes simulate_ldm1stm1(kprobe_opcode_t insn,
+static void __kprobes 

[PATCH v6 02/14] ARM: move shared uprobe/kprobe definitions into new include file

2014-02-09 Thread David Long
From: "David A. Long" 

Separate the kprobe-only definitions from the definitions needed by
both kprobes and uprobes.

Signed-off-by: David A. Long 
Acked-by: Jon Medhurst 
---
 arch/arm/include/asm/kprobes.h   | 15 +-
 arch/arm/include/asm/{kprobes.h => probes.h} | 44 +---
 2 files changed, 8 insertions(+), 51 deletions(-)
 copy arch/arm/include/asm/{kprobes.h => probes.h} (52%)

diff --git a/arch/arm/include/asm/kprobes.h b/arch/arm/include/asm/kprobes.h
index f82ec22..30fc11b 100644
--- a/arch/arm/include/asm/kprobes.h
+++ b/arch/arm/include/asm/kprobes.h
@@ -28,21 +28,8 @@
 #define kretprobe_blacklist_size   0
 
 typedef u32 kprobe_opcode_t;
-
 struct kprobe;
-typedef void (kprobe_insn_handler_t)(struct kprobe *, struct pt_regs *);
-typedef unsigned long (kprobe_check_cc)(unsigned long);
-typedef void (kprobe_insn_singlestep_t)(struct kprobe *, struct pt_regs *);
-typedef void (kprobe_insn_fn_t)(void);
-
-/* Architecture specific copy of original instruction. */
-struct arch_specific_insn {
-   kprobe_opcode_t *insn;
-   kprobe_insn_handler_t   *insn_handler;
-   kprobe_check_cc *insn_check_cc;
-   kprobe_insn_singlestep_t*insn_singlestep;
-   kprobe_insn_fn_t*insn_fn;
-};
+#include 
 
 struct prev_kprobe {
struct kprobe *kp;
diff --git a/arch/arm/include/asm/kprobes.h b/arch/arm/include/asm/probes.h
similarity index 52%
copy from arch/arm/include/asm/kprobes.h
copy to arch/arm/include/asm/probes.h
index f82ec22..90c5f54 100644
--- a/arch/arm/include/asm/kprobes.h
+++ b/arch/arm/include/asm/probes.h
@@ -1,5 +1,8 @@
 /*
- * arch/arm/include/asm/kprobes.h
+ * arch/arm/include/asm/probes.h
+ *
+ * Original contents copied from arch/arm/include/asm/kprobes.h
+ * which contains the following notice...
  *
  * Copyright (C) 2006, 2007 Motorola Inc.
  *
@@ -13,23 +16,9 @@
  * General Public License for more details.
  */
 
-#ifndef _ARM_KPROBES_H
-#define _ARM_KPROBES_H
-
-#include 
-#include 
-#include 
-
-#define __ARCH_WANT_KPROBES_INSN_SLOT
-#define MAX_INSN_SIZE  2
-#define MAX_STACK_SIZE 64  /* 32 would probably be OK */
+#ifndef _ASM_PROBES_H
+#define _ASM_PROBES_H
 
-#define flush_insn_slot(p) do { } while (0)
-#define kretprobe_blacklist_size   0
-
-typedef u32 kprobe_opcode_t;
-
-struct kprobe;
 typedef void (kprobe_insn_handler_t)(struct kprobe *, struct pt_regs *);
 typedef unsigned long (kprobe_check_cc)(unsigned long);
 typedef void (kprobe_insn_singlestep_t)(struct kprobe *, struct pt_regs *);
@@ -44,23 +33,4 @@ struct arch_specific_insn {
kprobe_insn_fn_t*insn_fn;
 };
 
-struct prev_kprobe {
-   struct kprobe *kp;
-   unsigned int status;
-};
-
-/* per-cpu kprobe control block */
-struct kprobe_ctlblk {
-   unsigned int kprobe_status;
-   struct prev_kprobe prev_kprobe;
-   struct pt_regs jprobe_saved_regs;
-   char jprobes_stack[MAX_STACK_SIZE];
-};
-
-void arch_remove_kprobe(struct kprobe *);
-int kprobe_fault_handler(struct pt_regs *regs, unsigned int fsr);
-int kprobe_exceptions_notify(struct notifier_block *self,
-unsigned long val, void *data);
-
-
-#endif /* _ARM_KPROBES_H */
+#endif
-- 
1.8.1.2

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


[PATCH v6 14/14] ARM: add uprobes support

2014-02-09 Thread David Long
From: "David A. Long" 

Using Rabin Vincent's ARM uprobes patches as a base, enable uprobes
support on ARM.

Caveats:

 - Thumb is not supported

Signed-off-by: Rabin Vincent 
Signed-off-by: David A. Long 
---
 arch/arm/Kconfig   |   3 +
 arch/arm/include/asm/ptrace.h  |   6 +
 arch/arm/include/asm/thread_info.h |   5 +-
 arch/arm/include/asm/uprobes.h |  45 +++
 arch/arm/kernel/Makefile   |   1 +
 arch/arm/kernel/signal.c   |   4 +
 arch/arm/kernel/uprobes-arm.c  | 232 +
 arch/arm/kernel/uprobes.c  | 208 +
 arch/arm/kernel/uprobes.h  |  35 ++
 9 files changed, 538 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/include/asm/uprobes.h
 create mode 100644 arch/arm/kernel/uprobes-arm.c
 create mode 100644 arch/arm/kernel/uprobes.c
 create mode 100644 arch/arm/kernel/uprobes.h

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index e254198..4d05bb9 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -207,6 +207,9 @@ config ZONE_DMA
 config NEED_DMA_MAP_STATE
def_bool y
 
+config ARCH_SUPPORTS_UPROBES
+   def_bool y
+
 config ARCH_HAS_DMA_SET_COHERENT_MASK
bool
 
diff --git a/arch/arm/include/asm/ptrace.h b/arch/arm/include/asm/ptrace.h
index 04c99f3..ee688b0a 100644
--- a/arch/arm/include/asm/ptrace.h
+++ b/arch/arm/include/asm/ptrace.h
@@ -80,6 +80,12 @@ static inline long regs_return_value(struct pt_regs *regs)
 
 #define instruction_pointer(regs)  (regs)->ARM_pc
 
+static inline void instruction_pointer_set(struct pt_regs *regs,
+  unsigned long val)
+{
+   instruction_pointer(regs) = val;
+}
+
 #ifdef CONFIG_SMP
 extern unsigned long profile_pc(struct pt_regs *regs);
 #else
diff --git a/arch/arm/include/asm/thread_info.h 
b/arch/arm/include/asm/thread_info.h
index 71a06b2..f989d7c 100644
--- a/arch/arm/include/asm/thread_info.h
+++ b/arch/arm/include/asm/thread_info.h
@@ -153,6 +153,7 @@ extern int vfp_restore_user_hwstate(struct user_vfp __user 
*,
 #define TIF_SIGPENDING 0
 #define TIF_NEED_RESCHED   1
 #define TIF_NOTIFY_RESUME  2   /* callback before returning to user */
+#define TIF_UPROBE 7
 #define TIF_SYSCALL_TRACE  8
 #define TIF_SYSCALL_AUDIT  9
 #define TIF_SYSCALL_TRACEPOINT 10
@@ -165,6 +166,7 @@ extern int vfp_restore_user_hwstate(struct user_vfp __user 
*,
 #define _TIF_SIGPENDING(1 << TIF_SIGPENDING)
 #define _TIF_NEED_RESCHED  (1 << TIF_NEED_RESCHED)
 #define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME)
+#define _TIF_UPROBE(1 << TIF_UPROBE)
 #define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE)
 #define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT)
 #define _TIF_SYSCALL_TRACEPOINT(1 << TIF_SYSCALL_TRACEPOINT)
@@ -178,7 +180,8 @@ extern int vfp_restore_user_hwstate(struct user_vfp __user 
*,
 /*
  * Change these and you break ASM code in entry-common.S
  */
-#define _TIF_WORK_MASK (_TIF_NEED_RESCHED | _TIF_SIGPENDING | 
_TIF_NOTIFY_RESUME)
+#define _TIF_WORK_MASK (_TIF_NEED_RESCHED | _TIF_SIGPENDING | \
+_TIF_NOTIFY_RESUME | _TIF_UPROBE)
 
 #endif /* __KERNEL__ */
 #endif /* __ASM_ARM_THREAD_INFO_H */
diff --git a/arch/arm/include/asm/uprobes.h b/arch/arm/include/asm/uprobes.h
new file mode 100644
index 000..9472c20
--- /dev/null
+++ b/arch/arm/include/asm/uprobes.h
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2012 Rabin Vincent 
+ *
+ * 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.
+ */
+
+#ifndef _ASM_UPROBES_H
+#define _ASM_UPROBES_H
+
+#include 
+#include 
+
+typedef u32 uprobe_opcode_t;
+
+#define MAX_UINSN_BYTES4
+#define UPROBE_XOL_SLOT_BYTES  64
+
+#define UPROBE_SWBP_ARM_INSN   0xe7f001f9
+#define UPROBE_SS_ARM_INSN 0xe7f001fa
+#define UPROBE_SWBP_INSN   __opcode_to_mem_arm(UPROBE_SWBP_ARM_INSN)
+#define UPROBE_SWBP_INSN_SIZE  4
+
+struct arch_uprobe_task {
+   u32 backup;
+   unsigned long   saved_trap_no;
+};
+
+struct arch_uprobe {
+   u8 insn[MAX_UINSN_BYTES];
+   unsigned long ixol[2];
+   uprobe_opcode_t bpinsn;
+   bool simulate;
+   u32 pcreg;
+   void (*prehandler)(struct arch_uprobe *auprobe,
+  struct arch_uprobe_task *autask,
+  struct pt_regs *regs);
+   void (*posthandler)(struct arch_uprobe *auprobe,
+   struct arch_uprobe_task *autask,
+   struct pt_regs *regs);
+   struct arch_probes_insn asi;
+};
+
+#endif
diff --git a/arch/arm/kernel/Makefile b/arch/arm/kernel/Makefile
index bb739f2..a766bcb 100644
--- a/arch/arm/kernel/Makefile
+++ b/arch/arm/kernel/Makefile
@@ -50,6 +50,7 @@ obj-$(CONFIG_DYNAMIC_FTRACE)  += ftrace.o 

[PATCH v6 12/14] ARM: Add an emulate flag to the kprobes/uprobes instruction decode functions

2014-02-09 Thread David Long
From: "David A. Long" 

Add an emulate flag into the instruction interpreter, primarily for uprobes
support.

Signed-off-by: David A. Long 
Acked-by: Jon Medhurst 
---
 arch/arm/kernel/kprobes.c  |  2 +-
 arch/arm/kernel/kprobes.h  |  1 +
 arch/arm/kernel/probes-arm.c   |  4 ++--
 arch/arm/kernel/probes-arm.h   |  2 +-
 arch/arm/kernel/probes-thumb.c |  8 
 arch/arm/kernel/probes-thumb.h |  4 ++--
 arch/arm/kernel/probes.c   | 18 +-
 arch/arm/kernel/probes.h   |  2 +-
 8 files changed, 25 insertions(+), 16 deletions(-)

diff --git a/arch/arm/kernel/kprobes.c b/arch/arm/kernel/kprobes.c
index db040ad..9421c0d 100644
--- a/arch/arm/kernel/kprobes.c
+++ b/arch/arm/kernel/kprobes.c
@@ -87,7 +87,7 @@ int __kprobes arch_prepare_kprobe(struct kprobe *p)
p->opcode = insn;
p->ainsn.insn = tmp_insn;
 
-   switch ((*decode_insn)(insn, >ainsn, actions)) {
+   switch ((*decode_insn)(insn, >ainsn, true, actions)) {
case INSN_REJECTED: /* not supported */
return -EINVAL;
 
diff --git a/arch/arm/kernel/kprobes.h b/arch/arm/kernel/kprobes.h
index eee8089..d0a24b7 100644
--- a/arch/arm/kernel/kprobes.h
+++ b/arch/arm/kernel/kprobes.h
@@ -35,6 +35,7 @@ kprobe_decode_ldmstm(kprobe_opcode_t insn, struct 
arch_specific_insn *asi,
 
 typedef enum probes_insn (kprobe_decode_insn_t)(probes_opcode_t,
struct arch_specific_insn *,
+   bool,
const union decode_action *);
 
 #ifdef CONFIG_THUMB2_KERNEL
diff --git a/arch/arm/kernel/probes-arm.c b/arch/arm/kernel/probes-arm.c
index 0faa4b2..a4f6914 100644
--- a/arch/arm/kernel/probes-arm.c
+++ b/arch/arm/kernel/probes-arm.c
@@ -723,10 +723,10 @@ static void __kprobes arm_singlestep(probes_opcode_t insn,
  */
 enum probes_insn __kprobes
 arm_probes_decode_insn(probes_opcode_t insn, struct arch_specific_insn *asi,
-  const union decode_action *actions)
+  bool emulate, const union decode_action *actions)
 {
asi->insn_singlestep = arm_singlestep;
asi->insn_check_cc = probes_condition_checks[insn>>28];
return probes_decode_insn(insn, asi, probes_decode_arm_table, false,
- actions);
+ emulate, actions);
 }
diff --git a/arch/arm/kernel/probes-arm.h b/arch/arm/kernel/probes-arm.h
index 7a5cce4..ea614dc 100644
--- a/arch/arm/kernel/probes-arm.h
+++ b/arch/arm/kernel/probes-arm.h
@@ -67,7 +67,7 @@ void __kprobes simulate_mov_ipsp(probes_opcode_t opcode,
 extern const union decode_item probes_decode_arm_table[];
 
 enum probes_insn arm_probes_decode_insn(probes_opcode_t,
-   struct arch_specific_insn *,
+   struct arch_specific_insn *, bool emulate,
const union decode_action *actions);
 
 #endif
diff --git a/arch/arm/kernel/probes-thumb.c b/arch/arm/kernel/probes-thumb.c
index 69d4de5..1a3ddf8 100644
--- a/arch/arm/kernel/probes-thumb.c
+++ b/arch/arm/kernel/probes-thumb.c
@@ -862,20 +862,20 @@ static void __kprobes thumb32_singlestep(probes_opcode_t 
opcode,
 
 enum probes_insn __kprobes
 thumb16_probes_decode_insn(probes_opcode_t insn, struct arch_specific_insn 
*asi,
-  const union decode_action *actions)
+  bool emulate, const union decode_action *actions)
 {
asi->insn_singlestep = thumb16_singlestep;
asi->insn_check_cc = thumb_check_cc;
return probes_decode_insn(insn, asi, probes_decode_thumb16_table, true,
- actions);
+ emulate, actions);
 }
 
 enum probes_insn __kprobes
 thumb32_probes_decode_insn(probes_opcode_t insn, struct arch_specific_insn 
*asi,
-  const union decode_action *actions)
+  bool emulate, const union decode_action *actions)
 {
asi->insn_singlestep = thumb32_singlestep;
asi->insn_check_cc = thumb_check_cc;
return probes_decode_insn(insn, asi, probes_decode_thumb32_table, true,
- actions);
+ emulate, actions);
 }
diff --git a/arch/arm/kernel/probes-thumb.h b/arch/arm/kernel/probes-thumb.h
index b26411e..dd95866 100644
--- a/arch/arm/kernel/probes-thumb.h
+++ b/arch/arm/kernel/probes-thumb.h
@@ -89,9 +89,9 @@ extern const union decode_item probes_decode_thumb16_table[];
 
 enum probes_insn __kprobes
 thumb16_probes_decode_insn(probes_opcode_t insn, struct arch_specific_insn 
*asi,
-   const union decode_action *actions);
+   bool emulate, const union decode_action *actions);
 enum probes_insn __kprobes
 thumb32_probes_decode_insn(probes_opcode_t insn, struct arch_specific_insn 
*asi,
-   const union decode_action *actions);
+   bool emulate, const union decode_action 

[PATCH v6 13/14] ARM: Make arch_specific_insn a define for new arch_probes_insn structure

2014-02-09 Thread David Long
From: "David A. Long" 

Because the common underlying code for ARM kprobes and uprobes needs
to share a common architecrure-specific context structure, and because
the generic kprobes include file insists on defining this to a dummy
structure when kprobes is not configured, a new common structure is
required which can exist when uprobes is configured without kprobes.
In this case kprobes will define a dummy structure, but without the
define aliasing the two structure tags it will not affect uprobes and
the shared probes code.

Signed-off-by: David A. Long 
Acked-by: Jon Medhurst 
---
 arch/arm/include/asm/kprobes.h   |  2 ++
 arch/arm/include/asm/probes.h|  8 ++---
 arch/arm/kernel/kprobes-arm.c| 16 -
 arch/arm/kernel/kprobes-common.c | 14 
 arch/arm/kernel/kprobes-thumb.c  | 70 
 arch/arm/kernel/kprobes.h|  4 +--
 arch/arm/kernel/probes-arm.c | 14 
 arch/arm/kernel/probes-arm.h | 12 +++
 arch/arm/kernel/probes-thumb.c   |  8 ++---
 arch/arm/kernel/probes-thumb.h   |  4 +--
 arch/arm/kernel/probes.c | 10 +++---
 arch/arm/kernel/probes.h |  4 +--
 12 files changed, 84 insertions(+), 82 deletions(-)

diff --git a/arch/arm/include/asm/kprobes.h b/arch/arm/include/asm/kprobes.h
index 30fc11b..87b8aa2 100644
--- a/arch/arm/include/asm/kprobes.h
+++ b/arch/arm/include/asm/kprobes.h
@@ -31,6 +31,8 @@ typedef u32 kprobe_opcode_t;
 struct kprobe;
 #include 
 
+#definearch_specific_insn  arch_probes_insn
+
 struct prev_kprobe {
struct kprobe *kp;
unsigned int status;
diff --git a/arch/arm/include/asm/probes.h b/arch/arm/include/asm/probes.h
index c37252c..806cfe6 100644
--- a/arch/arm/include/asm/probes.h
+++ b/arch/arm/include/asm/probes.h
@@ -21,18 +21,18 @@
 
 typedef u32 probes_opcode_t;
 
-struct arch_specific_insn;
+struct arch_probes_insn;
 typedef void (probes_insn_handler_t)(probes_opcode_t,
-struct arch_specific_insn *,
+struct arch_probes_insn *,
 struct pt_regs *);
 typedef unsigned long (probes_check_cc)(unsigned long);
 typedef void (probes_insn_singlestep_t)(probes_opcode_t,
-   struct arch_specific_insn *,
+   struct arch_probes_insn *,
struct pt_regs *);
 typedef void (probes_insn_fn_t)(void);
 
 /* Architecture specific copy of original instruction. */
-struct arch_specific_insn {
+struct arch_probes_insn {
probes_opcode_t *insn;
probes_insn_handler_t   *insn_handler;
probes_check_cc *insn_check_cc;
diff --git a/arch/arm/kernel/kprobes-arm.c b/arch/arm/kernel/kprobes-arm.c
index 52591e3..4169ad8 100644
--- a/arch/arm/kernel/kprobes-arm.c
+++ b/arch/arm/kernel/kprobes-arm.c
@@ -74,7 +74,7 @@
 
 static void __kprobes
 emulate_ldrdstrd(probes_opcode_t insn,
-   struct arch_specific_insn *asi, struct pt_regs *regs)
+   struct arch_probes_insn *asi, struct pt_regs *regs)
 {
unsigned long pc = regs->ARM_pc + 4;
int rt = (insn >> 12) & 0xf;
@@ -103,7 +103,7 @@ emulate_ldrdstrd(probes_opcode_t insn,
 
 static void __kprobes
 emulate_ldr(probes_opcode_t insn,
-   struct arch_specific_insn *asi, struct pt_regs *regs)
+   struct arch_probes_insn *asi, struct pt_regs *regs)
 {
unsigned long pc = regs->ARM_pc + 4;
int rt = (insn >> 12) & 0xf;
@@ -133,7 +133,7 @@ emulate_ldr(probes_opcode_t insn,
 
 static void __kprobes
 emulate_str(probes_opcode_t insn,
-   struct arch_specific_insn *asi, struct pt_regs *regs)
+   struct arch_probes_insn *asi, struct pt_regs *regs)
 {
unsigned long rtpc = regs->ARM_pc - 4 + str_pc_offset;
unsigned long rnpc = regs->ARM_pc + 4;
@@ -160,7 +160,7 @@ emulate_str(probes_opcode_t insn,
 
 static void __kprobes
 emulate_rd12rn16rm0rs8_rwflags(probes_opcode_t insn,
-   struct arch_specific_insn *asi, struct pt_regs *regs)
+   struct arch_probes_insn *asi, struct pt_regs *regs)
 {
unsigned long pc = regs->ARM_pc + 4;
int rd = (insn >> 12) & 0xf;
@@ -195,7 +195,7 @@ emulate_rd12rn16rm0rs8_rwflags(probes_opcode_t insn,
 
 static void __kprobes
 emulate_rd12rn16rm0_rwflags_nopc(probes_opcode_t insn,
-   struct arch_specific_insn *asi, struct pt_regs *regs)
+   struct arch_probes_insn *asi, struct pt_regs *regs)
 {
int rd = (insn >> 12) & 0xf;
int rn = (insn >> 16) & 0xf;
@@ -222,7 +222,7 @@ emulate_rd12rn16rm0_rwflags_nopc(probes_opcode_t insn,
 
 static void __kprobes
 emulate_rd16rn12rm0rs8_rwflags_nopc(probes_opcode_t insn,
-   struct arch_specific_insn *asi,
+   struct arch_probes_insn *asi,
struct pt_regs *regs)
 {
int rd = (insn >> 16) & 0xf;
@@ -252,7 +252,7 @@ emulate_rd16rn12rm0rs8_rwflags_nopc(probes_opcode_t insn,
 
 static 

[PATCH v6 07/14] ARM: Remove use of struct kprobe from generic probes code

2014-02-09 Thread David Long
From: "David A. Long" 

Change the generic ARM probes code to pass in the opcode and 
architecture-specific
structure separately instead of using struct kprobe, so we do not pollute
code being used only for uprobes or other non-kprobes instruction
interpretation.

Signed-off-by: David A. Long 
Acked-by: Jon Medhurst 
---
 arch/arm/include/asm/probes.h|   9 +-
 arch/arm/kernel/kprobes-arm.c|  61 +++---
 arch/arm/kernel/kprobes-common.c |  40 +
 arch/arm/kernel/kprobes-thumb.c  | 175 +++
 arch/arm/kernel/kprobes.c|   2 +-
 arch/arm/kernel/probes-arm.c |  33 
 arch/arm/kernel/probes-arm.h |  15 ++--
 arch/arm/kernel/probes-thumb.c   |  15 ++--
 arch/arm/kernel/probes.c |  14 ++--
 arch/arm/kernel/probes.h |   8 +-
 10 files changed, 201 insertions(+), 171 deletions(-)

diff --git a/arch/arm/include/asm/probes.h b/arch/arm/include/asm/probes.h
index 737a9b3..4d014c4 100644
--- a/arch/arm/include/asm/probes.h
+++ b/arch/arm/include/asm/probes.h
@@ -21,9 +21,14 @@
 
 struct kprobe;
 
-typedef void (kprobe_insn_handler_t)(struct kprobe *, struct pt_regs *);
+struct arch_specific_insn;
+typedef void (kprobe_insn_handler_t)(kprobe_opcode_t,
+struct arch_specific_insn *,
+struct pt_regs *);
 typedef unsigned long (kprobe_check_cc)(unsigned long);
-typedef void (kprobe_insn_singlestep_t)(struct kprobe *, struct pt_regs *);
+typedef void (kprobe_insn_singlestep_t)(kprobe_opcode_t,
+   struct arch_specific_insn *,
+   struct pt_regs *);
 typedef void (kprobe_insn_fn_t)(void);
 
 /* Architecture specific copy of original instruction. */
diff --git a/arch/arm/kernel/kprobes-arm.c b/arch/arm/kernel/kprobes-arm.c
index 72ee2a9..d62bbdf 100644
--- a/arch/arm/kernel/kprobes-arm.c
+++ b/arch/arm/kernel/kprobes-arm.c
@@ -72,12 +72,11 @@
"movpc, "reg"   \n\t"
 #endif
 
-
 static void __kprobes
-emulate_ldrdstrd(struct kprobe *p, struct pt_regs *regs)
+emulate_ldrdstrd(kprobe_opcode_t insn,
+   struct arch_specific_insn *asi, struct pt_regs *regs)
 {
-   kprobe_opcode_t insn = p->opcode;
-   unsigned long pc = (unsigned long)p->addr + 8;
+   unsigned long pc = regs->ARM_pc + 4;
int rt = (insn >> 12) & 0xf;
int rn = (insn >> 16) & 0xf;
int rm = insn & 0xf;
@@ -92,7 +91,7 @@ emulate_ldrdstrd(struct kprobe *p, struct pt_regs *regs)
BLX("%[fn]")
: "=r" (rtv), "=r" (rt2v), "=r" (rnv)
: "0" (rtv), "1" (rt2v), "2" (rnv), "r" (rmv),
- [fn] "r" (p->ainsn.insn_fn)
+ [fn] "r" (asi->insn_fn)
: "lr", "memory", "cc"
);
 
@@ -103,10 +102,10 @@ emulate_ldrdstrd(struct kprobe *p, struct pt_regs *regs)
 }
 
 static void __kprobes
-emulate_ldr(struct kprobe *p, struct pt_regs *regs)
+emulate_ldr(kprobe_opcode_t insn,
+   struct arch_specific_insn *asi, struct pt_regs *regs)
 {
-   kprobe_opcode_t insn = p->opcode;
-   unsigned long pc = (unsigned long)p->addr + 8;
+   unsigned long pc = regs->ARM_pc + 4;
int rt = (insn >> 12) & 0xf;
int rn = (insn >> 16) & 0xf;
int rm = insn & 0xf;
@@ -119,7 +118,7 @@ emulate_ldr(struct kprobe *p, struct pt_regs *regs)
__asm__ __volatile__ (
BLX("%[fn]")
: "=r" (rtv), "=r" (rnv)
-   : "1" (rnv), "r" (rmv), [fn] "r" (p->ainsn.insn_fn)
+   : "1" (rnv), "r" (rmv), [fn] "r" (asi->insn_fn)
: "lr", "memory", "cc"
);
 
@@ -133,11 +132,11 @@ emulate_ldr(struct kprobe *p, struct pt_regs *regs)
 }
 
 static void __kprobes
-emulate_str(struct kprobe *p, struct pt_regs *regs)
+emulate_str(kprobe_opcode_t insn,
+   struct arch_specific_insn *asi, struct pt_regs *regs)
 {
-   kprobe_opcode_t insn = p->opcode;
-   unsigned long rtpc = (unsigned long)p->addr + str_pc_offset;
-   unsigned long rnpc = (unsigned long)p->addr + 8;
+   unsigned long rtpc = regs->ARM_pc - 4 + str_pc_offset;
+   unsigned long rnpc = regs->ARM_pc + 4;
int rt = (insn >> 12) & 0xf;
int rn = (insn >> 16) & 0xf;
int rm = insn & 0xf;
@@ -151,7 +150,7 @@ emulate_str(struct kprobe *p, struct pt_regs *regs)
__asm__ __volatile__ (
BLX("%[fn]")
: "=r" (rnv)
-   : "r" (rtv), "0" (rnv), "r" (rmv), [fn] "r" (p->ainsn.insn_fn)
+   : "r" (rtv), "0" (rnv), "r" (rmv), [fn] "r" (asi->insn_fn)
: "lr", "memory", "cc"
);
 
@@ -160,10 +159,10 @@ emulate_str(struct kprobe *p, struct pt_regs *regs)
 }
 
 static void __kprobes
-emulate_rd12rn16rm0rs8_rwflags(struct kprobe *p, struct pt_regs *regs)
+emulate_rd12rn16rm0rs8_rwflags(kprobe_opcode_t insn,
+   struct arch_specific_insn *asi, struct pt_regs 

[PATCH v6 00/14] uprobes: Add uprobes support for ARM

2014-02-09 Thread David Long
From: "David A. Long" 

This patch series adds basic uprobes support to ARM. It is based on patches
developed earlier by Rabin Vincent. That approach of adding hooks into
the kprobes instruction parsing code was not well received. This approach
separates the ARM instruction parsing code in kprobes out into a separate set
of functions which can be used by both kprobes and uprobes. Both kprobes and
uprobes then provide their own semantic action tables to process the results of
the parsing.

The following are noteworthy changes made for v6:

1) Put back the "const" type modifier in decode table usage.
2) Made t16_decode_pop() static again.
3) Merged the last patch back into the previous patch, to avoid
   needlessly introducing a uprobes dependency on kprobes in Kconfig.
4) Added a signed-off From rabin, and ack's from Tixy.

David A. Long (13):
  uprobes: allow ignoring of probe hits
  ARM: move shared uprobe/kprobe definitions into new include file
  ARM: Move generic arm instruction parsing code to new files for
sharing between features
  ARM: move generic thumb instruction parsing code to new files for use
by other feature
  ARM: use a function table for determining instruction interpreter
action
  ARM: Remove use of struct kprobe from generic probes code
  ARM: Make the kprobes condition_check symbol names more generic
  ARM: Change more ARM kprobes symbol names to something more
  ARM: Rename the shared kprobes/uprobe return value enum
  ARM: Change the remaining shared kprobes/uprobes symbols to something
generic
  ARM: Add an emulate flag to the kprobes/uprobes instruction decode
functions
  ARM: Make arch_specific_insn a define for new arch_probes_insn
structure
  ARM: add uprobes support

Jon Medhurst (Tixy) (1):
  ARM: Disable jprobes test when built into thumb-mode kernel

 arch/arm/Kconfig   |3 +
 arch/arm/include/asm/kprobes.h |   15 +-
 arch/arm/include/asm/probes.h  |   43 +
 arch/arm/include/asm/ptrace.h  |6 +
 arch/arm/include/asm/thread_info.h |5 +-
 arch/arm/include/asm/uprobes.h |   45 +
 arch/arm/kernel/Makefile   |7 +-
 arch/arm/kernel/kprobes-arm.c  |  804 ++
 arch/arm/kernel/kprobes-common.c   |  468 +---
 arch/arm/kernel/kprobes-test.c |   18 +-
 arch/arm/kernel/kprobes-thumb.c| 1142 +++-
 arch/arm/kernel/kprobes.c  |   23 +-
 arch/arm/kernel/kprobes.h  |  400 +--
 arch/arm/kernel/{kprobes-arm.c => probes-arm.c}|  441 ++--
 arch/arm/kernel/probes-arm.h   |   73 ++
 .../arm/kernel/{kprobes-thumb.c => probes-thumb.c} |  770 ++---
 arch/arm/kernel/probes-thumb.h |   97 ++
 arch/arm/kernel/{kprobes-common.c => probes.c} |  205 +---
 arch/arm/kernel/{kprobes.h => probes.h}|  125 +--
 arch/arm/kernel/signal.c   |4 +
 arch/arm/kernel/uprobes-arm.c  |  232 
 arch/arm/kernel/uprobes.c  |  208 
 arch/arm/kernel/uprobes.h  |   35 +
 include/linux/uprobes.h|1 +
 kernel/events/uprobes.c|9 +
 25 files changed, 1341 insertions(+), 3838 deletions(-)
 create mode 100644 arch/arm/include/asm/probes.h
 create mode 100644 arch/arm/include/asm/uprobes.h
 copy arch/arm/kernel/{kprobes-arm.c => probes-arm.c} (64%)
 create mode 100644 arch/arm/kernel/probes-arm.h
 copy arch/arm/kernel/{kprobes-thumb.c => probes-thumb.c} (56%)
 create mode 100644 arch/arm/kernel/probes-thumb.h
 copy arch/arm/kernel/{kprobes-common.c => probes.c} (67%)
 copy arch/arm/kernel/{kprobes.h => probes.h} (80%)
 create mode 100644 arch/arm/kernel/uprobes-arm.c
 create mode 100644 arch/arm/kernel/uprobes.c
 create mode 100644 arch/arm/kernel/uprobes.h

-- 
1.8.1.2

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


Re: [PATCH v2] mfd: MAX6650/6651 support

2014-02-09 Thread Krzysztof Kozlowski
Hi,

On Sat, 2014-02-08 at 11:33 +, Laszlo Papp wrote:
> MAX6650/MAX6651 chip is a multi-function device with I2C busses. The
> chip includes fan-speed regulators and monitors, GPIO, and alarm.
> 
> This patch is an initial release of a MAX6650/6651 MFD driver that
> supports to enable the chip with its primary I2C bus that will connect
> the hwmon, and then the gpio devices for now.
> 
> Signed-off-by: Laszlo Papp 
> ---
>  drivers/mfd/Kconfig | 11 +
>  drivers/mfd/Makefile|  1 +
>  drivers/mfd/max665x.c   | 88 
> +
>  include/linux/mfd/max665x-private.h | 42 ++
>  4 files changed, 142 insertions(+)
>  create mode 100644 drivers/mfd/max665x.c
>  create mode 100644 include/linux/mfd/max665x-private.h
> 
> diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
> index 49bb445..e25be62 100644
> --- a/drivers/mfd/Kconfig
> +++ b/drivers/mfd/Kconfig
> @@ -368,6 +368,17 @@ config MFD_MAX8907
> accessing the device; additional drivers must be enabled in order
> to use the functionality of the device.
>  
> +config MFD_MAX665X
> + bool "Maxim Semiconductor MAX6650/MAX6651 Support"
> + select MFD_CORE
> + depends on I2C
> + select REGMAP_I2C
> + help
> +   Say yes here to support for Maxim Semiconductor MAX6650/MAX6651. This 
> is
> +   a fan speed regulator and monitor IC. This driver provies common 
> support

s/provies/provides/

(...)


> +const struct regmap_config max665x_regmap_config = {
> + .reg_bits = 5,
> +};
> +
> +static int max665x_probe(struct i2c_client *i2c,
> + const struct i2c_device_id *id)
> +{
> + struct max665x_dev *max665x;
> + int ret;
> +
> + max665x = devm_kzalloc(>dev, sizeof(*max665x), GFP_KERNEL);
> + if (!max665x)
> + return -ENOMEM;
> +
> + i2c_set_clientdata(i2c, max665x);
> + max665x->dev = >dev;
> + max665x->i2c = i2c;
> + max665x->map = regmap_init_i2c(i2c, _regmap_config);

Use devm_regmap_init_i2c() (or add missing regmap_exit()).


Best regards,
Krzysztof


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


[PATCH v5 07/11] drm/i915: Add 180 degree sprite rotation support

2014-02-09 Thread sagar . a . kamble
From: Ville Syrjälä 

The sprite planes (in fact all display planes starting from gen4)
support 180 degree rotation. Add the relevant low level bits to the
sprite code to make use of that feature.

The upper layers are not yet plugged in.

v2: HSW handles the rotated buffer offset automagically

Cc: Daniel Vetter 
Cc: Jani Nikula 
Cc: David Airlie 
Cc: dri-de...@lists.freedesktop.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ville Syrjälä 
---
 drivers/gpu/drm/i915/i915_reg.h |  3 +++
 drivers/gpu/drm/i915/intel_drv.h|  1 +
 drivers/gpu/drm/i915/intel_sprite.c | 37 +
 3 files changed, 41 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index abd18cd..57906c5 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -3637,6 +3637,7 @@
 #define   DVS_YUV_ORDER_UYVY   (1<<16)
 #define   DVS_YUV_ORDER_YVYU   (2<<16)
 #define   DVS_YUV_ORDER_VYUY   (3<<16)
+#define   DVS_ROTATE_180   (1<<15)
 #define   DVS_DEST_KEY (1<<2)
 #define   DVS_TRICKLE_FEED_DISABLE (1<<14)
 #define   DVS_TILED(1<<10)
@@ -3707,6 +3708,7 @@
 #define   SPRITE_YUV_ORDER_UYVY(1<<16)
 #define   SPRITE_YUV_ORDER_YVYU(2<<16)
 #define   SPRITE_YUV_ORDER_VYUY(3<<16)
+#define   SPRITE_ROTATE_180(1<<15)
 #define   SPRITE_TRICKLE_FEED_DISABLE  (1<<14)
 #define   SPRITE_INT_GAMMA_ENABLE  (1<<13)
 #define   SPRITE_TILED (1<<10)
@@ -3780,6 +3782,7 @@
 #define   SP_YUV_ORDER_UYVY(1<<16)
 #define   SP_YUV_ORDER_YVYU(2<<16)
 #define   SP_YUV_ORDER_VYUY(3<<16)
+#define   SP_ROTATE_180(1<<15)
 #define   SP_TILED (1<<10)
 #define _SPALINOFF (VLV_DISPLAY_BASE + 0x72184)
 #define _SPASTRIDE (VLV_DISPLAY_BASE + 0x72188)
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 44067bc..85864fc 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -397,6 +397,7 @@ struct intel_plane {
unsigned int crtc_w, crtc_h;
uint32_t src_x, src_y;
uint32_t src_w, src_h;
+   unsigned int rotation;
 
/* Since we need to change the watermarks before/after
 * enabling/disabling the planes, we need to store the parameters here
diff --git a/drivers/gpu/drm/i915/intel_sprite.c 
b/drivers/gpu/drm/i915/intel_sprite.c
index 336ae6c..477d4d7 100644
--- a/drivers/gpu/drm/i915/intel_sprite.c
+++ b/drivers/gpu/drm/i915/intel_sprite.c
@@ -60,6 +60,7 @@ vlv_update_plane(struct drm_plane *dplane, struct drm_crtc 
*crtc,
sprctl &= ~SP_PIXFORMAT_MASK;
sprctl &= ~SP_YUV_BYTE_ORDER_MASK;
sprctl &= ~SP_TILED;
+   sprctl &= ~SP_ROTATE_180;
 
switch (fb->pixel_format) {
case DRM_FORMAT_YUYV:
@@ -131,6 +132,14 @@ vlv_update_plane(struct drm_plane *dplane, struct drm_crtc 
*crtc,
fb->pitches[0]);
linear_offset -= sprsurf_offset;
 
+   if (intel_plane->rotation == BIT(DRM_ROTATE_180)) {
+   sprctl |= SP_ROTATE_180;
+
+   x += src_w;
+   y += src_h;
+   linear_offset += src_h * fb->pitches[0] + src_w * pixel_size;
+   }
+
I915_WRITE(SPSTRIDE(pipe, plane), fb->pitches[0]);
I915_WRITE(SPPOS(pipe, plane), (crtc_y << 16) | crtc_x);
 
@@ -238,6 +247,7 @@ ivb_update_plane(struct drm_plane *plane, struct drm_crtc 
*crtc,
sprctl &= ~SPRITE_RGB_ORDER_RGBX;
sprctl &= ~SPRITE_YUV_BYTE_ORDER_MASK;
sprctl &= ~SPRITE_TILED;
+   sprctl &= ~SPRITE_ROTATE_180;
 
switch (fb->pixel_format) {
case DRM_FORMAT_XBGR:
@@ -299,6 +309,17 @@ ivb_update_plane(struct drm_plane *plane, struct drm_crtc 
*crtc,
   pixel_size, fb->pitches[0]);
linear_offset -= sprsurf_offset;
 
+   if (intel_plane->rotation == BIT(DRM_ROTATE_180)) {
+   sprctl |= SPRITE_ROTATE_180;
+
+   /* HSW does this automagically in hardware */
+   if (!IS_HASWELL(dev)) {
+   x += src_w;
+   y += src_h;
+   linear_offset += src_h * fb->pitches[0] + src_w * 
pixel_size;
+   }
+   }
+
I915_WRITE(SPRSTRIDE(pipe), fb->pitches[0]);
I915_WRITE(SPRPOS(pipe), (crtc_y << 16) | crtc_x);
 
@@ -422,6 +443,7 @@ ilk_update_plane(struct drm_plane *plane, struct drm_crtc 
*crtc,
dvscntr &= ~DVS_RGB_ORDER_XBGR;
dvscntr &= ~DVS_YUV_BYTE_ORDER_MASK;
dvscntr &= ~DVS_TILED;
+   dvscntr &= ~DVS_ROTATE_180;
 
switch (fb->pixel_format) {
case DRM_FORMAT_XBGR:
@@ -478,6 +500,14 @@ ilk_update_plane(struct drm_plane *plane, struct drm_crtc 
*crtc,
   pixel_size, 

Re: [PATCH part1 v5 5/7] PCI: Add pci_dummy_ops to isolate pci device temporarily

2014-02-09 Thread Oliver Neukum
On Mon, 2014-02-10 at 12:04 +0800, Yijing Wang wrote:

> +static DEFINE_SPINLOCK(pci_freeze_lock);

The lock is used only here.

> +/**
> + * pci_bus_freeze_device - freeze pci bus to access pci device
> + * @bus: the pci bus to freeze
> + *
> + * Replace pci bus ops by pci_dummy_ops, protect system from
> + * accessing pci devices.
> + */
> +void pci_bus_freeze_device(struct pci_bus *bus)
> +{
> + struct pci_ops *ops;
> + unsigned long flags;
> +
> + spin_lock_irqsave(_freeze_lock, flags);
> + ops = pci_bus_set_ops(bus, _dummy_ops);
> + bus->save_ops = ops;
> + spin_unlock_irqrestore(_freeze_lock, flags);

Against what exactly are you locking here?

Regards
Oliver


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


[PATCH v5 10/11] drm/i915: Add 180 degree primary plane rotation support

2014-02-09 Thread sagar . a . kamble
From: Sagar Kamble 

Primary planes support 180 degree rotation. Expose the feature
through rotation drm property.

v2: Calculating linear/tiled offsets based on pipe source width and
height. Added 180 degree rotation support in ironlake_update_plane.

v3: Checking if CRTC is active before issueing update_plane. Added
wait for vblank to make sure we dont overtake page flips. Disabling
FBC since it does not work with rotated planes.

v4: Updated rotation checks for pending flips, fbc disable. Creating
rotation property only for Gen4 onwards. Property resetting as part
of lastclose.

Cc: Daniel Vetter 
Cc: Jani Nikula 
Cc: David Airlie 
Cc: dri-de...@lists.freedesktop.org
Cc: linux-kernel@vger.kernel.org
Cc: vijay.a.purushotha...@intel.com
Signed-off-by: Uma Shankar 
Signed-off-by: Sagar Kamble 
---
 drivers/gpu/drm/i915/i915_dma.c  | 12 +
 drivers/gpu/drm/i915/i915_reg.h  |  1 +
 drivers/gpu/drm/i915/intel_display.c | 86 ++--
 drivers/gpu/drm/i915/intel_drv.h |  2 +
 drivers/gpu/drm/i915/intel_pm.c  |  9 
 5 files changed, 106 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index 258b1be..fcd9e34 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -1836,6 +1836,8 @@ int i915_driver_open(struct drm_device *dev, struct 
drm_file *file)
 void i915_driver_lastclose(struct drm_device * dev)
 {
drm_i915_private_t *dev_priv = dev->dev_private;
+   struct drm_crtc *crtc;
+   struct drm_plane *plane;
 
/* On gen6+ we refuse to init without kms enabled, but then the drm core
 * goes right around and calls lastclose. Check for this and don't clean
@@ -1843,6 +1845,16 @@ void i915_driver_lastclose(struct drm_device * dev)
if (!dev_priv)
return;
 
+   if (dev_priv->rotation_property) {
+   list_for_each_entry(crtc, >mode_config.crtc_list, head)
+   drm_object_property_set_value(>base,
+   dev_priv->rotation_property, 0);
+
+   list_for_each_entry(plane, >mode_config.plane_list, head)
+   drm_object_property_set_value(>base,
+   dev_priv->rotation_property, 0);
+   }
+
if (drm_core_check_feature(dev, DRIVER_MODESET)) {
intel_fbdev_restore_mode(dev);
vga_switcheroo_process_delayed_switch();
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index 57906c5..d3000c4 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -3553,6 +3553,7 @@
 #define   DISPPLANE_NO_LINE_DOUBLE 0
 #define   DISPPLANE_STEREO_POLARITY_FIRST  0
 #define   DISPPLANE_STEREO_POLARITY_SECOND (1<<18)
+#define   DISPPLANE_ROTATE_180 (1<<15)
 #define   DISPPLANE_TRICKLE_FEED_DISABLE   (1<<14) /* Ironlake */
 #define   DISPPLANE_TILED  (1<<10)
 #define _DSPAADDR  (dev_priv->info->display_mmio_offset + 0x70184)
diff --git a/drivers/gpu/drm/i915/intel_display.c 
b/drivers/gpu/drm/i915/intel_display.c
index 4d4a0d9..4a4f650 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -2037,6 +2037,7 @@ static int i9xx_update_plane(struct drm_crtc *crtc, 
struct drm_framebuffer *fb,
unsigned long linear_offset;
u32 dspcntr;
u32 reg;
+   int pixel_size;
 
switch (plane) {
case 0:
@@ -2047,6 +2048,7 @@ static int i9xx_update_plane(struct drm_crtc *crtc, 
struct drm_framebuffer *fb,
return -EINVAL;
}
 
+   pixel_size = drm_format_plane_cpp(fb->pixel_format, 0);
intel_fb = to_intel_framebuffer(fb);
obj = intel_fb->obj;
 
@@ -2054,6 +2056,8 @@ static int i9xx_update_plane(struct drm_crtc *crtc, 
struct drm_framebuffer *fb,
dspcntr = I915_READ(reg);
/* Mask out pixel format bits in case we change it */
dspcntr &= ~DISPPLANE_PIXFORMAT_MASK;
+   dspcntr &= ~DISPPLANE_ROTATE_180;
+
switch (fb->pixel_format) {
case DRM_FORMAT_C8:
dspcntr |= DISPPLANE_8BPP;
@@ -2095,8 +2099,6 @@ static int i9xx_update_plane(struct drm_crtc *crtc, 
struct drm_framebuffer *fb,
if (IS_G4X(dev))
dspcntr |= DISPPLANE_TRICKLE_FEED_DISABLE;
 
-   I915_WRITE(reg, dspcntr);
-
linear_offset = y * fb->pitches[0] + x * (fb->bits_per_pixel / 8);
 
if (INTEL_INFO(dev)->gen >= 4) {
@@ -2109,6 +2111,17 @@ static int i9xx_update_plane(struct drm_crtc *crtc, 
struct drm_framebuffer *fb,
intel_crtc->dspaddr_offset = linear_offset;
}
 
+   if (intel_crtc->rotation == BIT(DRM_ROTATE_180)) {
+   dspcntr |= DISPPLANE_ROTATE_180;
+
+   x += (intel_crtc->config.pipe_src_w - 1);
+   y += 

[PATCH v5 06/11] drm: Add drm_rotation_simplify()

2014-02-09 Thread sagar . a . kamble
From: Ville Syrjälä 

drm_rotation_simplify() can be used to eliminate unsupported rotation
flags. It will check if any unsupported flags are present, and if so
it will modify the rotation to an alternate form by adding 180 degrees
to rotation angle, and flipping the reflect x and y bits. The hope is
that this identity transform will eliminate the unsupported flags.

Of course that might not result in any more supported rotation, so
the caller is still responsible for checking the result afterwards.

Cc: David Airlie 
Cc: dri-de...@lists.freedesktop.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ville Syrjälä 
---
 drivers/gpu/drm/drm_crtc.c | 30 ++
 include/drm/drm_crtc.h |  2 ++
 2 files changed, 32 insertions(+)

diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index e7bbbad..30e0008 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -4006,6 +4006,36 @@ int drm_format_vert_chroma_subsampling(uint32_t format)
 EXPORT_SYMBOL(drm_format_vert_chroma_subsampling);
 
 /**
+ * drm_rotation_simplify() - Try to simplify the rotation
+ * @rotation: Rotation to be simplified
+ * @supported_rotations: Supported rotations
+ *
+ * Attempt to simplify the rotation to a form that is supported.
+ * Eg. if the hardware supports everything except DRM_REFLECT_X
+ * one could call this function like this:
+ *
+ * drm_rotation_simplify(rotation, BIT(DRM_ROTATE_0) |
+ *   BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_180) |
+ *   BIT(DRM_ROTATE_270) | BIT(DRM_REFLECT_Y));
+ *
+ * to eliminate the DRM_ROTATE_X flag. Depending on what kind of
+ * transforms the hardware supports, this function may not
+ * be able to produce a supported transform, so the caller should
+ * check the result afterwards.
+ */
+unsigned int drm_rotation_simplify(unsigned int rotation,
+  unsigned int supported_rotations)
+{
+   if (rotation & ~supported_rotations) {
+   rotation ^= BIT(DRM_REFLECT_X) | BIT(DRM_REFLECT_Y);
+   rotation = (rotation & ~0xf) | BIT((ffs(rotation & 0xf) + 1) % 
4);
+   }
+
+   return rotation;
+}
+EXPORT_SYMBOL(drm_rotation_simplify);
+
+/**
  * drm_mode_config_init - initialize DRM mode_configuration structure
  * @dev: DRM device
  *
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index 4b3ac70..18f2eed 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -1185,6 +1185,8 @@ extern int drm_format_vert_chroma_subsampling(uint32_t 
format);
 extern const char *drm_get_format_name(uint32_t format);
 extern struct drm_property *drm_mode_create_rotation_property(struct 
drm_device *dev,
  unsigned int 
supported_rotations);
+extern unsigned int drm_rotation_simplify(unsigned int rotation,
+ unsigned int supported_rotations);
 
 /* Helpers */
 static inline struct drm_crtc *drm_crtc_find(struct drm_device *dev,
-- 
1.8.5

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


[PATCH v5 11/11] drm/i915: Calling rotate and inverse rotate transformations after clipping

2014-02-09 Thread sagar . a . kamble
From: Sagar Kamble 

With clipped sprites these transformations are not working. these
functions transform complete sprite irrespective of clipping present.
This leads to invisible portion of sprite show up when rotate 180 if
it was out of visible area before.

v4: Moved rotate transform for source rectangle after clipping.
Added rotate and inverse rotate transform for destination rect.

Cc: Daniel Vetter 
Cc: Jani Nikula 
Cc: David Airlie 
Cc: dri-de...@lists.freedesktop.org
Cc: linux-kernel@vger.kernel.org
Cc: vijay.a.purushotha...@intel.com
Signed-off-by: Sagar Kamble 
---
 drivers/gpu/drm/i915/intel_sprite.c | 16 
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_sprite.c 
b/drivers/gpu/drm/i915/intel_sprite.c
index 62b9f84..799f6a9 100644
--- a/drivers/gpu/drm/i915/intel_sprite.c
+++ b/drivers/gpu/drm/i915/intel_sprite.c
@@ -769,9 +769,6 @@ intel_update_plane(struct drm_plane *plane, struct drm_crtc 
*crtc,
max_scale = intel_plane->max_downscale << 16;
min_scale = intel_plane->can_scale ? 1 : (1 << 16);
 
-   drm_rect_rotate(, fb->width << 16, fb->height << 16,
-   intel_plane->rotation);
-
hscale = drm_rect_calc_hscale_relaxed(, , min_scale, max_scale);
BUG_ON(hscale < 0);
 
@@ -785,6 +782,13 @@ intel_update_plane(struct drm_plane *plane, struct 
drm_crtc *crtc,
crtc_w = drm_rect_width();
crtc_h = drm_rect_height();
 
+   drm_rect_rotate(, fb->width << 16, fb->height << 16,
+   intel_plane->rotation);
+
+   drm_rect_rotate(, intel_crtc->config.pipe_src_w,
+   intel_crtc->config.pipe_src_h,
+   intel_plane->rotation);
+
if (visible) {
/* check again in case clipping clamped the results */
hscale = drm_rect_calc_hscale(, , min_scale, max_scale);
@@ -811,7 +815,11 @@ intel_update_plane(struct drm_plane *plane, struct 
drm_crtc *crtc,
 drm_rect_height() * vscale - 
drm_rect_height());
 
drm_rect_rotate_inv(, fb->width << 16, fb->height << 16,
-   intel_plane->rotation);
+   intel_plane->rotation);
+
+   drm_rect_rotate_inv(, intel_crtc->config.pipe_src_w,
+   intel_crtc->config.pipe_src_h,
+   intel_plane->rotation);
 
/* sanity check to make sure the src viewport wasn't enlarged */
WARN_ON(src.x1 < (int) src_x ||
-- 
1.8.5

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


[PATCH v5 09/11] drm/i915: Add rotation property for sprites

2014-02-09 Thread sagar . a . kamble
From: Ville Syrjälä 

Sprite planes support 180 degree rotation. The lower layers are now in
place, so hook in the standard rotation property to expose the feature
to the users.

Cc: Daniel Vetter 
Cc: Jani Nikula 
Cc: David Airlie 
Cc: dri-de...@lists.freedesktop.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ville Syrjälä 
Reviewed-by: Sagar Kamble 
Tested-by: Sagar Kamble 
---
 drivers/gpu/drm/i915/i915_drv.h |  1 +
 drivers/gpu/drm/i915/intel_sprite.c | 42 -
 2 files changed, 42 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index fa37dfd..ea2efc3 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -1548,6 +1548,7 @@ typedef struct drm_i915_private {
 
struct drm_property *broadcast_rgb_property;
struct drm_property *force_audio_property;
+   struct drm_property *rotation_property;
 
uint32_t hw_context_size;
struct list_head context_list;
diff --git a/drivers/gpu/drm/i915/intel_sprite.c 
b/drivers/gpu/drm/i915/intel_sprite.c
index 511934c..62b9f84 100644
--- a/drivers/gpu/drm/i915/intel_sprite.c
+++ b/drivers/gpu/drm/i915/intel_sprite.c
@@ -1047,6 +1047,30 @@ out_unlock:
return ret;
 }
 
+static int intel_plane_set_property(struct drm_plane *plane,
+   struct drm_property *prop,
+   uint64_t val)
+{
+   struct drm_i915_private *dev_priv = plane->dev->dev_private;
+   struct intel_plane *intel_plane = to_intel_plane(plane);
+   uint64_t old_val;
+   int ret = -ENOENT;
+
+   if (prop == dev_priv->rotation_property) {
+   /* exactly one rotation angle please */
+   if (hweight32(val & 0xf) != 1)
+   return -EINVAL;
+
+   old_val = intel_plane->rotation;
+   intel_plane->rotation = val;
+   ret = intel_plane_restore(plane);
+   if (ret)
+   intel_plane->rotation = old_val;
+   }
+
+   return ret;
+}
+
 int intel_plane_restore(struct drm_plane *plane)
 {
struct intel_plane *intel_plane = to_intel_plane(plane);
@@ -1073,6 +1097,7 @@ static const struct drm_plane_funcs intel_plane_funcs = {
.update_plane = intel_update_plane,
.disable_plane = intel_disable_plane,
.destroy = intel_destroy_plane,
+   .set_property = intel_plane_set_property,
 };
 
 static uint32_t ilk_plane_formats[] = {
@@ -1109,6 +1134,7 @@ static uint32_t vlv_plane_formats[] = {
 int
 intel_plane_init(struct drm_device *dev, enum pipe pipe, int plane)
 {
+   struct drm_i915_private *dev_priv = dev->dev_private;
struct intel_plane *intel_plane;
unsigned long possible_crtcs;
const uint32_t *plane_formats;
@@ -1183,8 +1209,22 @@ intel_plane_init(struct drm_device *dev, enum pipe pipe, 
int plane)
 _plane_funcs,
 plane_formats, num_plane_formats,
 false);
-   if (ret)
+   if (ret) {
kfree(intel_plane);
+   goto out;
+   }
+
+   if (!dev_priv->rotation_property)
+   dev_priv->rotation_property =
+   drm_mode_create_rotation_property(dev,
+ BIT(DRM_ROTATE_0) |
+ BIT(DRM_ROTATE_180));
+
+   if (dev_priv->rotation_property)
+   drm_object_attach_property(_plane->base.base,
+  dev_priv->rotation_property,
+  intel_plane->rotation);
 
+ out:
return ret;
 }
-- 
1.8.5

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


[PATCH v5 08/11] drm/i915: Make intel_plane_restore() return an error

2014-02-09 Thread sagar . a . kamble
From: Ville Syrjälä 

Propagate the error from intel_update_plane() up through
intel_plane_restore() to the caller. This will be used for
rollback purposes when setting properties fails.

Cc: Daniel Vetter 
Cc: Jani Nikula 
Cc: David Airlie 
Cc: dri-de...@lists.freedesktop.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ville Syrjälä 
Reviewed-by: Sagar Kamble 
Tested-by: Sagar Kamble 
---
 drivers/gpu/drm/i915/intel_drv.h|  2 +-
 drivers/gpu/drm/i915/intel_sprite.c | 14 +++---
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 85864fc..7a79b8e 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -897,7 +897,7 @@ bool intel_sdvo_init(struct drm_device *dev, uint32_t 
sdvo_reg, bool is_sdvob);
 int intel_plane_init(struct drm_device *dev, enum pipe pipe, int plane);
 void intel_flush_primary_plane(struct drm_i915_private *dev_priv,
   enum plane plane);
-void intel_plane_restore(struct drm_plane *plane);
+int intel_plane_restore(struct drm_plane *plane);
 void intel_plane_disable(struct drm_plane *plane);
 int intel_sprite_set_colorkey(struct drm_device *dev, void *data,
  struct drm_file *file_priv);
diff --git a/drivers/gpu/drm/i915/intel_sprite.c 
b/drivers/gpu/drm/i915/intel_sprite.c
index 477d4d7..511934c 100644
--- a/drivers/gpu/drm/i915/intel_sprite.c
+++ b/drivers/gpu/drm/i915/intel_sprite.c
@@ -1047,18 +1047,18 @@ out_unlock:
return ret;
 }
 
-void intel_plane_restore(struct drm_plane *plane)
+int intel_plane_restore(struct drm_plane *plane)
 {
struct intel_plane *intel_plane = to_intel_plane(plane);
 
if (!plane->crtc || !plane->fb)
-   return;
+   return 0;
 
-   intel_update_plane(plane, plane->crtc, plane->fb,
-  intel_plane->crtc_x, intel_plane->crtc_y,
-  intel_plane->crtc_w, intel_plane->crtc_h,
-  intel_plane->src_x, intel_plane->src_y,
-  intel_plane->src_w, intel_plane->src_h);
+   return intel_update_plane(plane, plane->crtc, plane->fb,
+ intel_plane->crtc_x, intel_plane->crtc_y,
+ intel_plane->crtc_w, intel_plane->crtc_h,
+ intel_plane->src_x, intel_plane->src_y,
+ intel_plane->src_w, intel_plane->src_h);
 }
 
 void intel_plane_disable(struct drm_plane *plane)
-- 
1.8.5

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


[PATCH v5 05/11] drm: Add drm_rect rotation functions

2014-02-09 Thread sagar . a . kamble
From: Ville Syrjälä 

Add some helper functions to move drm_rects between different rotated
coordinate spaces. One function does the forward transform and
another does the inverse.

Cc: David Airlie 
Cc: dri-de...@lists.freedesktop.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ville Syrjälä 
Reviewed-by: Sagar Kamble 
Tested-by: Sagar Kamble 
---
 drivers/gpu/drm/drm_rect.c | 140 +
 include/drm/drm_rect.h |   6 ++
 2 files changed, 146 insertions(+)

diff --git a/drivers/gpu/drm/drm_rect.c b/drivers/gpu/drm/drm_rect.c
index 7047ca0..631f5af 100644
--- a/drivers/gpu/drm/drm_rect.c
+++ b/drivers/gpu/drm/drm_rect.c
@@ -293,3 +293,143 @@ void drm_rect_debug_print(const struct drm_rect *r, bool 
fixed_point)
DRM_DEBUG_KMS("%dx%d%+d%+d\n", w, h, r->x1, r->y1);
 }
 EXPORT_SYMBOL(drm_rect_debug_print);
+
+/**
+ * drm_rect_rotate - Rotate the rectangle
+ * @r: rectangle to be rotated
+ * @width: Width of the coordinate space
+ * @height: Height of the coordinate space
+ * @rotation: Transformation to be applied
+ *
+ * Apply @rotation to the coordinates of rectangle @r.
+ *
+ * @width and @height combined with @rotation define
+ * the location of the new origin.
+ *
+ * @width correcsponds to the horizontal and @height
+ * to the vertical axis of the untransformed coordinate
+ * space.
+ */
+void drm_rect_rotate(struct drm_rect *r,
+int width, int height,
+unsigned int rotation)
+{
+   struct drm_rect tmp;
+
+   if (rotation & (BIT(DRM_REFLECT_X) | BIT(DRM_REFLECT_Y))) {
+   tmp = *r;
+
+   if (rotation & BIT(DRM_REFLECT_X)) {
+   r->x1 = width - tmp.x2;
+   r->x2 = width - tmp.x1;
+   }
+
+   if (rotation & BIT(DRM_REFLECT_Y)) {
+   r->y1 = height - tmp.y2;
+   r->y2 = height - tmp.y1;
+   }
+   }
+
+   switch (rotation & 0xf) {
+   case BIT(DRM_ROTATE_0):
+   break;
+   case BIT(DRM_ROTATE_90):
+   tmp = *r;
+   r->x1 = tmp.y1;
+   r->x2 = tmp.y2;
+   r->y1 = width - tmp.x2;
+   r->y2 = width - tmp.x1;
+   break;
+   case BIT(DRM_ROTATE_180):
+   tmp = *r;
+   r->x1 = width - tmp.x2;
+   r->x2 = width - tmp.x1;
+   r->y1 = height - tmp.y2;
+   r->y2 = height - tmp.y1;
+   break;
+   case BIT(DRM_ROTATE_270):
+   tmp = *r;
+   r->x1 = height - tmp.y2;
+   r->x2 = height - tmp.y1;
+   r->y1 = tmp.x1;
+   r->y2 = tmp.x2;
+   break;
+   default:
+   break;
+   }
+}
+EXPORT_SYMBOL(drm_rect_rotate);
+
+/**
+ * drm_rect_rotate_inv - Inverse rotate the rectangle
+ * @r: rectangle to be rotated
+ * @width: Width of the coordinate space
+ * @height: Height of the coordinate space
+ * @rotation: Transformation whose inverse is to be applied
+ *
+ * Apply the inverse of @rotation to the coordinates
+ * of rectangle @r.
+ *
+ * @width and @height combined with @rotation define
+ * the location of the new origin.
+ *
+ * @width correcsponds to the horizontal and @height
+ * to the vertical axis of the original untransformed
+ * coordinate space, so that you never have to flip
+ * them when doing a rotatation and its inverse.
+ * That is, if you do:
+ *
+ * drm_rotate(, width, height, rotation);
+ * drm_rotate_inv(, width, height, rotation);
+ *
+ * you will always get back the original rectangle.
+ */
+void drm_rect_rotate_inv(struct drm_rect *r,
+int width, int height,
+unsigned int rotation)
+{
+   struct drm_rect tmp;
+
+   switch (rotation & 0xf) {
+   case BIT(DRM_ROTATE_0):
+   break;
+   case BIT(DRM_ROTATE_90):
+   tmp = *r;
+   r->x1 = width - tmp.y2;
+   r->x2 = width - tmp.y1;
+   r->y1 = tmp.x1;
+   r->y2 = tmp.x2;
+   break;
+   case BIT(DRM_ROTATE_180):
+   tmp = *r;
+   r->x1 = width - tmp.x2;
+   r->x2 = width - tmp.x1;
+   r->y1 = height - tmp.y2;
+   r->y2 = height - tmp.y1;
+   break;
+   case BIT(DRM_ROTATE_270):
+   tmp = *r;
+   r->x1 = tmp.y1;
+   r->x2 = tmp.y2;
+   r->y1 = height - tmp.x2;
+   r->y2 = height - tmp.x1;
+   break;
+   default:
+   break;
+   }
+
+   if (rotation & (BIT(DRM_REFLECT_X) | BIT(DRM_REFLECT_Y))) {
+   tmp = *r;
+
+   if (rotation & BIT(DRM_REFLECT_X)) {
+   r->x1 = width - tmp.x2;
+   r->x2 = width - tmp.x1;
+   }
+
+   if (rotation & 

[PATCH v5 04/11] drm/omap: Switch omapdrm over to drm_mode_create_rotation_property()

2014-02-09 Thread sagar . a . kamble
From: Ville Syrjälä 

Use the new drm_mode_create_rotation_property() in omapdrm.

v5: Fixed conflict due to change in the prior patch in call to
drm_property_create_bitmask()

Cc: David Airlie 
Cc: Rob Clark 
Cc: Sagar Kamble 
Cc: "Ville Syrjälä" 
Cc: Tomi Valkeinen 
Cc: Greg Kroah-Hartman 
Cc: dri-de...@lists.freedesktop.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ville Syrjälä 
Signed-off-by: Sagar Kamble 
Reviewed-by: Rob Clark 
---
 drivers/gpu/drm/omapdrm/omap_plane.c | 23 +++
 1 file changed, 7 insertions(+), 16 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/omap_plane.c 
b/drivers/gpu/drm/omapdrm/omap_plane.c
index b288f38..fee8f35 100644
--- a/drivers/gpu/drm/omapdrm/omap_plane.c
+++ b/drivers/gpu/drm/omapdrm/omap_plane.c
@@ -300,22 +300,13 @@ void omap_plane_install_properties(struct drm_plane 
*plane,
if (priv->has_dmm) {
prop = priv->rotation_prop;
if (!prop) {
-   const struct drm_prop_enum_list props[] = {
-   { DRM_ROTATE_0,   "rotate-0" },
-   { DRM_ROTATE_90,  "rotate-90" },
-   { DRM_ROTATE_180, "rotate-180" },
-   { DRM_ROTATE_270, "rotate-270" },
-   { DRM_REFLECT_X,  "reflect-x" },
-   { DRM_REFLECT_Y,  "reflect-y" },
-   };
-   prop = drm_property_create_bitmask(dev, 0, "rotation",
-   props, ARRAY_SIZE(props),
-   BIT(DRM_ROTATE_0) |
-   BIT(DRM_ROTATE_90) |
-   BIT(DRM_ROTATE_180) |
-   BIT(DRM_ROTATE_270) |
-   BIT(DRM_REFLECT_X) |
-   BIT(DRM_REFLECT_Y));
+   prop = drm_mode_create_rotation_property(dev,
+
BIT(DRM_ROTATE_0) |
+
BIT(DRM_ROTATE_90) |
+
BIT(DRM_ROTATE_180) |
+
BIT(DRM_ROTATE_270) |
+
BIT(DRM_REFLECT_X) |
+
BIT(DRM_REFLECT_Y));
if (prop == NULL)
return;
priv->rotation_prop = prop;
-- 
1.8.5

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


[PATCH v5 07/11] drm/i915: Add 180 degree sprite rotation support

2014-02-09 Thread sagar . a . kamble
From: Ville Syrjälä 

The sprite planes (in fact all display planes starting from gen4)
support 180 degree rotation. Add the relevant low level bits to the
sprite code to make use of that feature.

The upper layers are not yet plugged in.

v2: HSW handles the rotated buffer offset automagically

Cc: Daniel Vetter 
Cc: Jani Nikula 
Cc: David Airlie 
Cc: dri-de...@lists.freedesktop.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ville Syrjälä 
Signed-off-by: Sagar Kamble 
---
 drivers/gpu/drm/i915/i915_reg.h |  3 +++
 drivers/gpu/drm/i915/intel_drv.h|  1 +
 drivers/gpu/drm/i915/intel_sprite.c | 37 +
 3 files changed, 41 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index abd18cd..57906c5 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -3637,6 +3637,7 @@
 #define   DVS_YUV_ORDER_UYVY   (1<<16)
 #define   DVS_YUV_ORDER_YVYU   (2<<16)
 #define   DVS_YUV_ORDER_VYUY   (3<<16)
+#define   DVS_ROTATE_180   (1<<15)
 #define   DVS_DEST_KEY (1<<2)
 #define   DVS_TRICKLE_FEED_DISABLE (1<<14)
 #define   DVS_TILED(1<<10)
@@ -3707,6 +3708,7 @@
 #define   SPRITE_YUV_ORDER_UYVY(1<<16)
 #define   SPRITE_YUV_ORDER_YVYU(2<<16)
 #define   SPRITE_YUV_ORDER_VYUY(3<<16)
+#define   SPRITE_ROTATE_180(1<<15)
 #define   SPRITE_TRICKLE_FEED_DISABLE  (1<<14)
 #define   SPRITE_INT_GAMMA_ENABLE  (1<<13)
 #define   SPRITE_TILED (1<<10)
@@ -3780,6 +3782,7 @@
 #define   SP_YUV_ORDER_UYVY(1<<16)
 #define   SP_YUV_ORDER_YVYU(2<<16)
 #define   SP_YUV_ORDER_VYUY(3<<16)
+#define   SP_ROTATE_180(1<<15)
 #define   SP_TILED (1<<10)
 #define _SPALINOFF (VLV_DISPLAY_BASE + 0x72184)
 #define _SPASTRIDE (VLV_DISPLAY_BASE + 0x72188)
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 44067bc..85864fc 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -397,6 +397,7 @@ struct intel_plane {
unsigned int crtc_w, crtc_h;
uint32_t src_x, src_y;
uint32_t src_w, src_h;
+   unsigned int rotation;
 
/* Since we need to change the watermarks before/after
 * enabling/disabling the planes, we need to store the parameters here
diff --git a/drivers/gpu/drm/i915/intel_sprite.c 
b/drivers/gpu/drm/i915/intel_sprite.c
index 336ae6c..477d4d7 100644
--- a/drivers/gpu/drm/i915/intel_sprite.c
+++ b/drivers/gpu/drm/i915/intel_sprite.c
@@ -60,6 +60,7 @@ vlv_update_plane(struct drm_plane *dplane, struct drm_crtc 
*crtc,
sprctl &= ~SP_PIXFORMAT_MASK;
sprctl &= ~SP_YUV_BYTE_ORDER_MASK;
sprctl &= ~SP_TILED;
+   sprctl &= ~SP_ROTATE_180;
 
switch (fb->pixel_format) {
case DRM_FORMAT_YUYV:
@@ -131,6 +132,14 @@ vlv_update_plane(struct drm_plane *dplane, struct drm_crtc 
*crtc,
fb->pitches[0]);
linear_offset -= sprsurf_offset;
 
+   if (intel_plane->rotation == BIT(DRM_ROTATE_180)) {
+   sprctl |= SP_ROTATE_180;
+
+   x += src_w;
+   y += src_h;
+   linear_offset += src_h * fb->pitches[0] + src_w * pixel_size;
+   }
+
I915_WRITE(SPSTRIDE(pipe, plane), fb->pitches[0]);
I915_WRITE(SPPOS(pipe, plane), (crtc_y << 16) | crtc_x);
 
@@ -238,6 +247,7 @@ ivb_update_plane(struct drm_plane *plane, struct drm_crtc 
*crtc,
sprctl &= ~SPRITE_RGB_ORDER_RGBX;
sprctl &= ~SPRITE_YUV_BYTE_ORDER_MASK;
sprctl &= ~SPRITE_TILED;
+   sprctl &= ~SPRITE_ROTATE_180;
 
switch (fb->pixel_format) {
case DRM_FORMAT_XBGR:
@@ -299,6 +309,17 @@ ivb_update_plane(struct drm_plane *plane, struct drm_crtc 
*crtc,
   pixel_size, fb->pitches[0]);
linear_offset -= sprsurf_offset;
 
+   if (intel_plane->rotation == BIT(DRM_ROTATE_180)) {
+   sprctl |= SPRITE_ROTATE_180;
+
+   /* HSW does this automagically in hardware */
+   if (!IS_HASWELL(dev)) {
+   x += src_w;
+   y += src_h;
+   linear_offset += src_h * fb->pitches[0] + src_w * 
pixel_size;
+   }
+   }
+
I915_WRITE(SPRSTRIDE(pipe), fb->pitches[0]);
I915_WRITE(SPRPOS(pipe), (crtc_y << 16) | crtc_x);
 
@@ -422,6 +443,7 @@ ilk_update_plane(struct drm_plane *plane, struct drm_crtc 
*crtc,
dvscntr &= ~DVS_RGB_ORDER_XBGR;
dvscntr &= ~DVS_YUV_BYTE_ORDER_MASK;
dvscntr &= ~DVS_TILED;
+   dvscntr &= ~DVS_ROTATE_180;
 
switch (fb->pixel_format) {
case DRM_FORMAT_XBGR:
@@ -478,6 +500,14 @@ ilk_update_plane(struct drm_plane *plane, struct drm_crtc 
*crtc,
   

[PATCH v5 03/11] drm: Add drm_mode_create_rotation_property()

2014-02-09 Thread sagar . a . kamble
From: Ville Syrjälä 

Add a function to create a standards compliant rotation property.

v4: For creating rotation bitmask property send number of values
as only number of set rotations

Cc: David Airlie 
Cc: dri-de...@lists.freedesktop.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ville Syrjälä 
Signed-off-by: Sagar Kamble 
---
 drivers/gpu/drm/drm_crtc.c | 33 +
 include/drm/drm_crtc.h |  2 ++
 2 files changed, 35 insertions(+)

diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index 628d3d3..e7bbbad 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -4118,3 +4118,36 @@ void drm_mode_config_cleanup(struct drm_device *dev)
idr_destroy(>mode_config.crtc_idr);
 }
 EXPORT_SYMBOL(drm_mode_config_cleanup);
+
+/*
+* Function to get number of bits set in bitmask
+* using Brian Kernighan's Algorithm
+*/
+unsigned int bits_set(unsigned int n)
+{
+   unsigned int count = 0;
+
+   while (n) {
+   n &= (n-1);
+   count ++;
+   }
+   return count;
+}
+
+struct drm_property *drm_mode_create_rotation_property(struct drm_device *dev,
+  unsigned int 
supported_rotations)
+{
+   static const struct drm_prop_enum_list props[] = {
+   { DRM_ROTATE_0,   "rotate-0" },
+   { DRM_ROTATE_90,  "rotate-90" },
+   { DRM_ROTATE_180, "rotate-180" },
+   { DRM_ROTATE_270, "rotate-270" },
+   { DRM_REFLECT_X,  "reflect-x" },
+   { DRM_REFLECT_Y,  "reflect-y" },
+   };
+
+   return drm_property_create_bitmask(dev, 0, "rotation",
+  props, bits_set(supported_rotations),
+  supported_rotations);
+}
+EXPORT_SYMBOL(drm_mode_create_rotation_property);
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index 41b86d2..4b3ac70 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -1183,6 +1183,8 @@ extern int drm_format_plane_cpp(uint32_t format, int 
plane);
 extern int drm_format_horz_chroma_subsampling(uint32_t format);
 extern int drm_format_vert_chroma_subsampling(uint32_t format);
 extern const char *drm_get_format_name(uint32_t format);
+extern struct drm_property *drm_mode_create_rotation_property(struct 
drm_device *dev,
+ unsigned int 
supported_rotations);
 
 /* Helpers */
 static inline struct drm_crtc *drm_crtc_find(struct drm_device *dev,
-- 
1.8.5

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


[PATCH v5 02/11] drm: Add support_bits parameter to drm_property_create_bitmask()

2014-02-09 Thread sagar . a . kamble
From: Ville Syrjälä 

Make drm_property_create_bitmask() a bit more generic by allowing the
caller to specify which bits are in fact supported. This allows multiple
callers to use the same enum list, but still create different versions
of the same property with different list of supported bits.

v5: Fixed the caller of this function in omapdrm to comply with supported
bitmask definition.

Cc: David Airlie 
Cc: Tomi Valkeinen 
Cc: Rob Clark 
Cc: Sagar Kamble 
Cc: "Ville Syrjälä" 
Cc: Greg Kroah-Hartman 
Cc: dri-de...@lists.freedesktop.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ville Syrjälä 
Signed-off-by: Sagar Kamble 
Reviewed-by: Rob Clark 
---
 drivers/gpu/drm/drm_crtc.c   | 6 +-
 drivers/gpu/drm/omapdrm/omap_plane.c | 8 +++-
 include/drm/drm_crtc.h   | 3 ++-
 3 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index 3b7d32d..628d3d3 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -2906,7 +2906,8 @@ EXPORT_SYMBOL(drm_property_create_enum);
 struct drm_property *drm_property_create_bitmask(struct drm_device *dev,
 int flags, const char *name,
 const struct drm_prop_enum_list *props,
-int num_values)
+int num_values,
+unsigned int supported_bits)
 {
struct drm_property *property;
int i, ret;
@@ -2918,6 +2919,9 @@ struct drm_property *drm_property_create_bitmask(struct 
drm_device *dev,
return NULL;
 
for (i = 0; i < num_values; i++) {
+   if (!(supported_bits & (1 << i)))
+   continue;
+
ret = drm_property_add_enum(property, i,
  props[i].type,
  props[i].name);
diff --git a/drivers/gpu/drm/omapdrm/omap_plane.c 
b/drivers/gpu/drm/omapdrm/omap_plane.c
index 046d5e6..b288f38 100644
--- a/drivers/gpu/drm/omapdrm/omap_plane.c
+++ b/drivers/gpu/drm/omapdrm/omap_plane.c
@@ -309,7 +309,13 @@ void omap_plane_install_properties(struct drm_plane *plane,
{ DRM_REFLECT_Y,  "reflect-y" },
};
prop = drm_property_create_bitmask(dev, 0, "rotation",
-   props, ARRAY_SIZE(props));
+   props, ARRAY_SIZE(props),
+   BIT(DRM_ROTATE_0) |
+   BIT(DRM_ROTATE_90) |
+   BIT(DRM_ROTATE_180) |
+   BIT(DRM_ROTATE_270) |
+   BIT(DRM_REFLECT_X) |
+   BIT(DRM_REFLECT_Y));
if (prop == NULL)
return;
priv->rotation_prop = prop;
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index d5c46c1..41b86d2 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -1070,7 +1070,8 @@ extern struct drm_property 
*drm_property_create_enum(struct drm_device *dev, int
 struct drm_property *drm_property_create_bitmask(struct drm_device *dev,
 int flags, const char *name,
 const struct drm_prop_enum_list *props,
-int num_values);
+int num_values,
+unsigned int supported_bits);
 struct drm_property *drm_property_create_range(struct drm_device *dev, int 
flags,
 const char *name,
 uint64_t min, uint64_t max);
-- 
1.8.5

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


[PATCH v5 01/11] drm: Move DRM_ROTATE bits out of omapdrm into drm_crtc.h

2014-02-09 Thread sagar . a . kamble
From: Ville Syrjälä 

The rotation property stuff should be standardized among all drivers.
Move the bits to drm_crtc.h from omap_drv.h.

Cc: David Airlie 
Cc: Tomi Valkeinen 
Cc: Dave Airlie 
Cc: Rob Clark 
Cc: Daniel Vetter 
Cc: Archit Taneja 
Cc: dri-de...@lists.freedesktop.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ville Syrjälä 
Reviewed-by: Sagar Kamble 
Tested-by: Sagar Kamble 
---
 drivers/gpu/drm/omapdrm/omap_drv.h | 7 ---
 include/drm/drm_crtc.h | 8 
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/omap_drv.h 
b/drivers/gpu/drm/omapdrm/omap_drv.h
index 428b2981..aac8e10 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.h
+++ b/drivers/gpu/drm/omapdrm/omap_drv.h
@@ -119,13 +119,6 @@ struct omap_drm_private {
struct omap_drm_irq error_handler;
 };
 
-/* this should probably be in drm-core to standardize amongst drivers */
-#define DRM_ROTATE_0   0
-#define DRM_ROTATE_90  1
-#define DRM_ROTATE_180 2
-#define DRM_ROTATE_270 3
-#define DRM_REFLECT_X  4
-#define DRM_REFLECT_Y  5
 
 #ifdef CONFIG_DEBUG_FS
 int omap_debugfs_init(struct drm_minor *minor);
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index 71727b6..d5c46c1 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -65,6 +65,14 @@ struct drm_object_properties {
uint64_t values[DRM_OBJECT_MAX_PROPERTY];
 };
 
+/* rotation property bits */
+#define DRM_ROTATE_0   0
+#define DRM_ROTATE_90  1
+#define DRM_ROTATE_180 2
+#define DRM_ROTATE_270 3
+#define DRM_REFLECT_X  4
+#define DRM_REFLECT_Y  5
+
 /*
  * Note on terminology:  here, for brevity and convenience, we refer to 
connector
  * control chips as 'CRTCs'.  They can control any type of connector, VGA, 
LVDS,
-- 
1.8.5

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


[BUG] can't boot up: unable to handle kernel paging request at ffffffffff340003

2014-02-09 Thread Madper Xie
Howdy,

With old kernel (from 3.10 to 3.14-rc1), my hp box shows following
outputs:
~~~
[0.009166] Freeing SMP alternatives memory: 20K (82234000 - 
82239000)
[0.010302] ioremap: invalid physical address 1376e0180001
[0.010303] [ cut here ]
[0.010308] WARNING: CPU: 0 PID: 0 at arch/x86/mm/ioremap.c:83 
__ioremap_caller+0x357/0x380()
[0.010309] Modules linked in:
[0.010312] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 3.14.0-rc1 #8
[0.010313] Hardware name: Hewlett-Packard HP Compaq Elite 8300 SFF/3397, 
BIOS K01 v02.05 05/07/2012
[0.010314]  0009 819dde58 816b5eb9 

[0.010317]  819dde90 8107793d  
1376e0180006
[0.010319]   81e0e2c0 0006 
819ddea0
[0.010322] Call Trace:
[0.010327]  [] dump_stack+0x4d/0x66
[0.010331]  [] warn_slowpath_common+0x7d/0xa0
[0.010333]  [] warn_slowpath_null+0x1a/0x20
[0.010335]  [] __ioremap_caller+0x357/0x380
[0.010339]  [] ? efi_bgrt_init+0x8b/0x12b
[0.010341]  [] ioremap_nocache+0x17/0x20
[0.010343]  [] efi_bgrt_init+0x8b/0x12b
[0.010345]  [] efi_late_init+0x9/0xb
[0.010349]  [] start_kernel+0x436/0x450
[0.010351]  [] ? repair_env_string+0x5c/0x5c
[0.010353]  [] ? early_idt_handlers+0x120/0x120
[0.010355]  [] x86_64_start_reservations+0x2a/0x2c
[0.010356]  [] x86_64_start_kernel+0x13e/0x14d
[0.010368] ---[ end trace b6511b740249fba3 ]---
~~~
However the box can boot up and works well.
After I update kernel to 3.14-rc2, it panic when booting. Here is
console output:
~~~
[0.010366] BUG: unable to handle kernel paging request at ff340003
[0.017376] IP: [] efi_bgrt_init+0x9d/0x133
[0.023153] PGD 159eb067 PUD 159ed067 PMD 16240067 PTE 9376e0180163
[0.029842] Oops: 0009 [#1] SMP 
[0.033108] Modules linked in:
[0.036184] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 3.14.0-rc2+ #7
[0.042540] Hardware name: Hewlett-Packard HP Compaq Elite 8300 SFF/3397, 
BIOS K01 v02.05 05/07/2012
[0.051679] task: 819ef4c0 ti: 819dc000 task.ti: 
819dc000
[0.059167] RIP: 0010:[]  [] 
efi_bgrt_init+0x9d/0x133
[0.067368] RSP: :819ddf20  EFLAGS: 00010202
[0.072684] RAX: ff340001 RBX: ff340001 RCX: 0abf
[0.079825] RDX: 8163 RSI: 9376e0180163 RDI: ff34
[0.086967] RBP: 819ddf38 R08: 8163 R09: 8163
[0.094109] R10: 0001 R11:  R12: 0001
[0.101249] R13: 88021ecc5640 R14: 81e0e2c0 R15: 819ddfb0
[0.108391] FS:  () GS:880215c0() 
knlGS:
[0.116489] CS:  0010 DS:  ES:  CR0: 80050033
[0.122239] CR2: ff340003 CR3: 159e8000 CR4: 001406f0
[0.129381] Stack:
[0.131396]   81e04940 88021ecc5640 
819ddf48
[0.138867]  81d8525d 819ddf88 81d68f59 
81d6892c
[0.146338]  81e0e2c0 81d6  
0020
[0.153809] Call Trace:
[0.156261]  [] efi_late_init+0x9/0xb
[0.161499]  [] start_kernel+0x436/0x450
[0.166987]  [] ? repair_env_string+0x5c/0x5c
[0.172913]  [] ? early_idt_handlers+0x120/0x120
[0.179098]  [] x86_64_start_reservations+0x2a/0x2c
[0.185547]  [] x86_64_start_kernel+0x13e/0x14d
[0.191646] Code: 89 c3 75 24 48 8b 05 34 37 53 00 be 06 00 00 00 48 8b 78 
28 e8 93 d0 ff ff 48 85 c0 48 89 c 
[0.211644] RIP  [] efi_bgrt_init+0x9d/0x133
[0.217501]  RSP 
[0.220994] CR2: ff340003
[0.224320] ---[ end trace 4f8e0a3f5b9ff6b1 ]---
[0.228946] Kernel panic - not syncing: Attempted to kill the idle task!
[0.235655] Rebooting in 3 seconds..
[0.239146] ACPI MEMORY or I/O RESET_REG.

BTW: 3.14-rc2 works well on my DELL desktop.

I paste the dmidecode output of my HP desktop here:
# dmidecode 2.12
# SMBIOS entry point at 0xd943d918
SMBIOS 2.7 present.
58 structures occupying 2472 bytes.
Table at 0x000E92EB.

Handle 0x, DMI type 0, 24 bytes
BIOS Information
Vendor: Hewlett-Packard
Version: K01 v02.05
Release Date: 05/07/2012
Address: 0xF
Runtime Size: 64 kB
ROM Size: 16384 kB
Characteristics:
PCI is supported
PNP is supported
BIOS is upgradeable
BIOS shadowing is allowed
Boot from CD is supported
Selectable boot is supported
EDD is supported
Print screen service is supported (int 5h)
8042 keyboard services are supported (int 9h)
Serial services are supported (int 14h)
Printer services are supported (int 17h)
 

Re: [PATCH 1/2] regulator: anatop: Add power gating support to digital LDOs

2014-02-09 Thread Shawn Guo
On Thu, Feb 06, 2014 at 03:43:32PM +0100, Philipp Zabel wrote:
> The ARM, PU, and SOC LDOs in the i.MX6 PMU can completely gate
> their power output. Since power gating is configured by writing
> zero to the voltage target bitfield,, store a copy of the
> voltage selector to be restored when reenabling the regulator.
> 
> Signed-off-by: Philipp Zabel 

Nice way to get disabling and bypass supported!  For both patches,

Acked-by: Shawn Guo 

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


Re: [PATCH v2 2/3] ACPI / processor_core: Rework _PDC related stuff to make it more arch-independent

2014-02-09 Thread Hanjun Guo

Hi Tianyu,

On 2014年02月10日 10:21, Lan Tianyu wrote:

2014-02-08 21:10 GMT+08:00 Hanjun Guo :

_PDC related stuff in processor_core.c is little bit X86/IA64 dependent,
rework the code to make it more arch-independent, no functional change
in this patch.

Signed-off-by: Hanjun Guo 
Signed-off-by: Graeme Gregory 
---
  arch/ia64/include/asm/acpi.h  |5 +
  arch/ia64/kernel/acpi.c   |   17 +
  arch/x86/include/asm/acpi.h   |   19 +--
  arch/x86/kernel/acpi/cstate.c |   31 +++
  drivers/acpi/processor_core.c |   19 +--
  5 files changed, 51 insertions(+), 40 deletions(-)

diff --git a/arch/ia64/include/asm/acpi.h b/arch/ia64/include/asm/acpi.h
index d651102..d2b8b9d 100644
--- a/arch/ia64/include/asm/acpi.h
+++ b/arch/ia64/include/asm/acpi.h
@@ -152,10 +152,7 @@ extern int __initdata nid_to_pxm_map[MAX_NUMNODES];
  #endif

  static inline bool arch_has_acpi_pdc(void) { return true; }
-static inline void arch_acpi_set_pdc_bits(u32 *buf)
-{
-   buf[2] |= ACPI_PDC_EST_CAPABILITY_SMP;
-}
+extern void arch_acpi_set_pdc_bits(u32 *buf);

  #define acpi_unlazy_tlb(x)

diff --git a/arch/ia64/kernel/acpi.c b/arch/ia64/kernel/acpi.c
index 07d209c..d71f64a 100644
--- a/arch/ia64/kernel/acpi.c
+++ b/arch/ia64/kernel/acpi.c
@@ -1014,3 +1014,20 @@ EXPORT_SYMBOL(acpi_unregister_ioapic);
   * TBD when when IA64 starts to support suspend...
   */
  int acpi_suspend_lowlevel(void) { return 0; }
+
+void arch_acpi_set_pdc_bits(u32 *buf)
+{
+   /* Enable coordination with firmware's _TSD info */
+   buf[2] |= ACPI_PDC_SMP_T_SWCOORD;

Hi Hanjun:
 You can write like this.
 buf[2] |= ACPI_PDC_SMP_T_SWCOORD | ACPI_PDC_EST_CAPABILITY_SMP;


Thanks for the suggestion, will update it.




+   if (boot_option_idle_override == IDLE_NOMWAIT) {
+   /*
+* If mwait is disabled for CPU C-states, the C2C3_FFH access
+* mode will be disabled in the parameter of _PDC object.
+* Of course C1_FFH access mode will also be disabled.
+*/
+   buf[2] &= ~(ACPI_PDC_C_C2C3_FFH | ACPI_PDC_C_C1_FFH);
+
+   }
+
+   buf[2] |= ACPI_PDC_EST_CAPABILITY_SMP;
+}
diff --git a/arch/x86/include/asm/acpi.h b/arch/x86/include/asm/acpi.h
index c8c1e70..e9f71bc 100644
--- a/arch/x86/include/asm/acpi.h
+++ b/arch/x86/include/asm/acpi.h
@@ -147,24 +147,7 @@ static inline bool arch_has_acpi_pdc(void)
 c->x86_vendor == X86_VENDOR_CENTAUR);
  }

-static inline void arch_acpi_set_pdc_bits(u32 *buf)
-{
-   struct cpuinfo_x86 *c = _data(0);
-
-   buf[2] |= ACPI_PDC_C_CAPABILITY_SMP;
-
-   if (cpu_has(c, X86_FEATURE_EST))
-   buf[2] |= ACPI_PDC_EST_CAPABILITY_SWSMP;
-
-   if (cpu_has(c, X86_FEATURE_ACPI))
-   buf[2] |= ACPI_PDC_T_FFH;
-
-   /*
-* If mwait/monitor is unsupported, C2/C3_FFH will be disabled
-*/
-   if (!cpu_has(c, X86_FEATURE_MWAIT))
-   buf[2] &= ~(ACPI_PDC_C_C2C3_FFH);
-}
+extern void arch_acpi_set_pdc_bits(u32 *buf);

  #else /* !CONFIG_ACPI */

diff --git a/arch/x86/kernel/acpi/cstate.c b/arch/x86/kernel/acpi/cstate.c
index e69182f..aa9aed9 100644
--- a/arch/x86/kernel/acpi/cstate.c
+++ b/arch/x86/kernel/acpi/cstate.c
@@ -16,6 +16,37 @@
  #include 
  #include 

+void arch_acpi_set_pdc_bits(u32 *buf)
+{
+   struct cpuinfo_x86 *c = _data(0);
+
+   /* Enable coordination with firmware's _TSD info */
+   buf[2] |= ACPI_PDC_SMP_T_SWCOORD;
+   if (boot_option_idle_override == IDLE_NOMWAIT) {
+   /*
+* If mwait is disabled for CPU C-states, the C2C3_FFH access
+* mode will be disabled in the parameter of _PDC object.
+* Of course C1_FFH access mode will also be disabled.
+*/
+   buf[2] &= ~(ACPI_PDC_C_C2C3_FFH | ACPI_PDC_C_C1_FFH);
+
+   }
+
+   buf[2] |= ACPI_PDC_C_CAPABILITY_SMP;

This is not right. ACPI_PDC_C_CAPABILITY_SMP contians ACPI_PDC_C_C1_FFH and
ACPI_PDC_C_C2C3_FFH. boot_option_idle_override is meaningless here.

You should keep original order and put the check at last.


Good catch! I will update this patch, thanks for your review :)

Best regards
Hanjun
--
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 10/10] watchdog: xilinx: Enable this driver for Zynq

2014-02-09 Thread Michal Simek
On 02/10/2014 01:51 AM, Guenter Roeck wrote:
> On 01/31/2014 06:18 AM, Michal Simek wrote:
>> Enable this driver for Zynq.
>> Move it to architecture independent Kconfig part.
>>
>> Signed-off-by: Michal Simek 
>> ---
>>
>> Build tested by zero day testing system.
>> ---
> 
> Hi Michal,
> 
> I tried myself, and I don't see any build failures on any platform.
> So let's assume this works as-is.
> 
> Reviewed-by: Guenter Roeck 
> 

Thanks for your review. I have fixed comments from Rob and
also add one more patch which was suggested by Rob.
I will wait for your reactions for 1/10 and then will send
v2.

Thanks,
Michal


-- 
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/
Maintainer of Linux kernel - Xilinx Zynq ARM architecture
Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform




signature.asc
Description: OpenPGP digital signature


Re: [PATCH 01/10] watchdog: xilinx: Convert driver to the watchdog framework

2014-02-09 Thread Michal Simek
On 02/09/2014 09:03 PM, Guenter Roeck wrote:
> On 01/31/2014 06:18 AM, Michal Simek wrote:
>> - Remove uneeded headers, fops functions
>> - Use xilinx_wdt prefix in start/stop/keepalive functions
>>and in new structures
>>
>> Signed-off-by: Michal Simek 
> 
> Hi Michal,
> 
>>   static int xwdt_probe(struct platform_device *pdev)
>>   {
>>   int rc;
>> @@ -314,7 +184,7 @@ static int xwdt_probe(struct platform_device *pdev)
>>   "xlnx,wdt-enable-once", NULL);
>>   if (tmptr == NULL) {
>>   pr_warn("Parameter \"xlnx,wdt-enable-once\" not found in device 
>> tree!\n");
>> -xdev.nowayout = WATCHDOG_NOWAYOUT;
>> +watchdog_set_nowayout(_wdt_wdd, true);
> 
> Sure you want to set this to always true instead of using WATCHDOG_NOWAYOUT ?

I have checked it and
option CONFIG_WATCHDOG_NOWAYOUT - Disable watchdog shutdown on close

with this part in the header

100 #ifdef CONFIG_WATCHDOG_NOWAYOUT
101 #define WATCHDOG_NOWAYOUT   1
102 #define WATCHDOG_NOWAYOUT_INIT_STATUS   (1 << WDOG_NO_WAY_OUT)
103 #else
104 #define WATCHDOG_NOWAYOUT   0
105 #define WATCHDOG_NOWAYOUT_INIT_STATUS   0
106 #endif

enable once is hardware option and it means when this option is setup in
hw you can't stop watchdog. That's why I think that setting up true
instead of WATCHDOG_NOWAYOUT is correct.

Thanks,
Michal

-- 
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/
Maintainer of Linux kernel - Xilinx Zynq ARM architecture
Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform




signature.asc
Description: OpenPGP digital signature


Re: [PATCH] staging : android : sync : fix a checkpatch warning

2014-02-09 Thread DaeSeok Youn
CC+ Joe Perches.

2014-02-10 14:58 GMT+09:00 Daeseok Youn :
> From 16140b1ec1b1e1060f74707e4a6661aface81a14 Mon Sep 17 00:00:00 2001
> From: Daeseok Youn 
> Date: Mon, 10 Feb 2014 14:36:48 +0900
> Subject: [PATCH] staging : android : sync : fix a checkpatch warning
>
> - WARNING: missing space after return type
>
> Signed-off-by: Daeseok Youn 
> ---
>  drivers/staging/android/sync.h |2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/android/sync.h b/drivers/staging/android/sync.h
> index 62e2255b..6ee8d69 100644
> --- a/drivers/staging/android/sync.h
> +++ b/drivers/staging/android/sync.h
> @@ -53,7 +53,7 @@ struct sync_timeline_ops {
> const char *driver_name;
>
> /* required */
> -   struct sync_pt *(*dup)(struct sync_pt *pt);
> +   struct sync_pt * (*dup)(struct sync_pt *pt);
>
> /* required */
> int (*has_signaled)(struct sync_pt *pt);
> --
> 1.7.9.5
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/2 v2] usbnet: fix bad header length bug

2014-02-09 Thread Oliver Neukum
On Mon, 2014-02-10 at 00:06 +0100, Emil Goode wrote:
> The AX88772B occasionally send rx packets that cross urb boundaries
> and the remaining partial packet is sent with no hardware header.
> When the buffer with a partial packet is of less number of octets
> than the value of hard_header_len the buffer is discarded by the
> usbnet module. This is causing dropped packages and error messages
> in dmesg.
> 
> This can be reproduced by using ping with a packet size
> between 1965-1976.

Well, then how about simply removing the check?
It seems to have outlived its usefulness.

Regards
Oliver


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


Re: [PATCH] staging : ion : Fix some checkpatch warnings and an error

2014-02-09 Thread DaeSeok Youn
I think It looks better than reported by checkpatch.pl.

But I have a qeustion, if your patch is applied to checkpatch.pl file,
a return type of "void *" line will be changed.
for example,
void * (*map_kernel)(struct ion_heap *heap, struct ion_buffer *buffer);
=> void *(*map_kernel)(struct ion_heap *heap, struct ion_buffer
*buffer); in same file.
right?

If you confirm my question, I re-send my patch after fixing that line.

And I have a patch which is same fix. (driver/staging/android/sync.h)

diff --git a/drivers/staging/android/sync.h b/drivers/staging/android/sync.h
index 62e2255b..6ee8d69 100644
--- a/drivers/staging/android/sync.h
+++ b/drivers/staging/android/sync.h
@@ -53,7 +53,7 @@ struct sync_timeline_ops {
const char *driver_name;

/* required */
-   struct sync_pt *(*dup)(struct sync_pt *pt);
+   struct sync_pt * (*dup)(struct sync_pt *pt);

/* required */
int (*has_signaled)(struct sync_pt *pt);

2014-02-10 15:07 GMT+09:00 Joe Perches :
> On Mon, 2014-02-10 at 14:56 +0900, Daeseok Youn wrote:
>>
>
> Hello.
>
>> diff --git a/drivers/staging/android/ion/ion_priv.h 
>> b/drivers/staging/android/ion/ion_priv.h
> []
>> - struct sg_table *(*map_dma) (struct ion_heap *heap,
>> + struct sg_table * (*map_dma)(struct ion_heap *heap,
>
> The message about space required after "struct sg_table *"
> is a checkpatch defect.  This is better as:
>
> struct sg_table *(*map_dma)(struct ion_heap *heap, etc...)
>
> I'll fix checkpatch in a little bit.
>
>
--
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] USB2NET : SR9800 : One chip USB2.0 USB2NET SR9800 Device Driver Support

2014-02-09 Thread liujunliang_ljl
From: Liu Junliang 


Signed-off-by: Liu Junliang 
---
 drivers/net/usb/Kconfig  |   16 +
 drivers/net/usb/Makefile |1 +
 drivers/net/usb/sr9800.c |  870 ++
 drivers/net/usb/sr9800.h |  202 +++
 4 files changed, 1089 insertions(+), 0 deletions(-)
 create mode 100644 drivers/net/usb/sr9800.c
 create mode 100644 drivers/net/usb/sr9800.h

diff --git a/drivers/net/usb/Kconfig b/drivers/net/usb/Kconfig
index 47b0f73..2551bf6 100644
--- a/drivers/net/usb/Kconfig
+++ b/drivers/net/usb/Kconfig
@@ -291,6 +291,22 @@ config USB_NET_SR9700
  This option adds support for CoreChip-sz SR9700 based USB 1.1
  10/100 Ethernet adapters.
 
+config USB_NET_SR9800
+   tristate "CoreChip-sz SR9800 based USB 2.0 10/100 ethernet devices"
+   depends on USB_USBNET
+   select CRC32
+   default y
+   ---help---
+ Say Y if you want to use one of the following 100Mbps USB Ethernet
+ device based on the CoreChip-sz SR9800 chip.
+
+ This driver makes the adapter appear as a normal Ethernet interface,
+ typically on eth0, if it is the only ethernet device, or perhaps on
+ eth1, if you have a PCI or ISA ethernet card installed.
+
+ To compile this driver as a module, choose M here: the
+ module will be called sr9800.
+
 config USB_NET_SMSC75XX
tristate "SMSC LAN75XX based USB 2.0 gigabit ethernet devices"
depends on USB_USBNET
diff --git a/drivers/net/usb/Makefile b/drivers/net/usb/Makefile
index b17b5e8..433f0a0 100644
--- a/drivers/net/usb/Makefile
+++ b/drivers/net/usb/Makefile
@@ -15,6 +15,7 @@ obj-$(CONFIG_USB_NET_CDCETHER)+= cdc_ether.o r815x.o
 obj-$(CONFIG_USB_NET_CDC_EEM)  += cdc_eem.o
 obj-$(CONFIG_USB_NET_DM9601)   += dm9601.o
 obj-$(CONFIG_USB_NET_SR9700)   += sr9700.o
+obj-$(CONFIG_USB_NET_SR9800)   += sr9800.o
 obj-$(CONFIG_USB_NET_SMSC75XX) += smsc75xx.o
 obj-$(CONFIG_USB_NET_SMSC95XX) += smsc95xx.o
 obj-$(CONFIG_USB_NET_GL620A)   += gl620a.o
diff --git a/drivers/net/usb/sr9800.c b/drivers/net/usb/sr9800.c
new file mode 100644
index 000..4175eb9
--- /dev/null
+++ b/drivers/net/usb/sr9800.c
@@ -0,0 +1,870 @@
+/* CoreChip-sz SR9800 one chip USB 2.0 Ethernet Devices
+ *
+ * Author : Liu Junliang 
+ *
+ * Based on asix_common.c, asix_devices.c
+ *
+ * This file is licensed under the terms of the GNU General Public License
+ * version 2.  This program is licensed "as is" without any warranty of any
+ * kind, whether express or implied.*
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "sr9800.h"
+
+static int sr_read_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index,
+   u16 size, void *data)
+{
+   int err;
+
+   err = usbnet_read_cmd(dev, cmd, SR_REQ_RD_REG, value, index,
+ data, size);
+   if ((err != size) && (err >= 0))
+   err = -EINVAL;
+
+   return err;
+}
+
+static int sr_write_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index,
+u16 size, void *data)
+{
+   int err;
+
+   err = usbnet_write_cmd(dev, cmd, SR_REQ_WR_REG, value, index,
+ data, size);
+   if ((err != size) && (err >= 0))
+   err = -EINVAL;
+
+   return err;
+}
+
+static void
+sr_write_cmd_async(struct usbnet *dev, u8 cmd, u16 value, u16 index,
+  u16 size, void *data)
+{
+   usbnet_write_cmd_async(dev, cmd, SR_REQ_WR_REG, value, index, data,
+  size);
+}
+
+static int sr_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
+{
+   int offset = 0;
+
+   while (offset + sizeof(u32) < skb->len) {
+   struct sk_buff *sr_skb;
+   u16 size;
+   u32 header = get_unaligned_le32(skb->data + offset);
+
+   offset += sizeof(u32);
+   /* get the packet length */
+   size = (u16) (header & 0x7ff);
+   if (size != ((~header >> 16) & 0x07ff)) {
+   netdev_err(dev->net, "%s : Bad Header Length\n",
+  __func__);
+   return 0;
+   }
+
+   if ((size > dev->net->mtu + ETH_HLEN + VLAN_HLEN) ||
+   (size + offset > skb->len)) {
+   netdev_err(dev->net, "%s : Bad RX Length %d\n",
+  __func__, size);
+   return 0;
+   }
+   sr_skb = netdev_alloc_skb_ip_align(dev->net, size);
+   if (!sr_skb)
+   return 0;
+
+   skb_put(sr_skb, size);
+   memcpy(sr_skb->data, skb->data + offset, size);
+   usbnet_skb_return(dev, sr_skb);
+
+   offset += (size + 1) & 0xfffe;
+   }
+
+   if (skb->len != offset) {
+ 

Re: Re: [PATCH] USB2NET : SR9800 : One chip USB2.0 USB2NET SR9800Device Driver Support

2014-02-09 Thread liujunliang_ljl
Dear Joe :

Thanks a lot for your detail checking.


2014-02-10 



liujunliang_ljl 



发件人: Joe Perches 
发送时间: 2014-02-10  13:47:08 
收件人: liujunliang_ljl 
抄送: davem; horms; romieu; gregkh; netdev; linux-usb; linux-kernel; sunhecheng 
主题: Re: [PATCH] USB2NET : SR9800 : One chip USB2.0 USB2NET SR9800Device Driver 
Support 
 
On Mon, 2014-02-10 at 13:33 +0800, liujunliang_...@163.com wrote:
> diff --git a/drivers/net/usb/sr9800.c b/drivers/net/usb/sr9800.c
[]
> + netdev_dbg(dev->net, "mac addr : 0x%x:0x%x:0x%x:0x%x:0x%x:0x%x\n",
> +dev->net->dev_addr[0], dev->net->dev_addr[1],
> +dev->net->dev_addr[2], dev->net->dev_addr[3],
> +dev->net->dev_addr[4], dev->net->dev_addr[5]);
mac addresses are assumed to be hex and don't need 0x prefixes.
Also, there's a kernel vsprintf extension "%pM" for mac addresses.
netdev_dbg(dev->net, "mac addr: %pM\n", dev->net->dev_addr);
.


Re: [PATCH v1 08/10] perf/x86/uncore: add SNB/IVB/HSW client uncore memory controller support

2014-02-09 Thread Yan, Zheng
On 02/03/2014 08:55 PM, Stephane Eranian wrote:
> This patch adds a new uncore PMU for Intel SNB/IVB/HSW client
> CPUs. It adds the Integrated Memory Controller (IMC) PMU. This
> new PMU provides a set of events to measure memory bandwidth utilization.
> 
> The IMC on those processor is PCI-space based. This patch
> exposes a new uncore PMU on those processor: uncore_imc
> 
> Two new events are defined:
>   - name: data_reads
>   - code: 0x1
>   - unit: 64 bytes
>   - number of full cacheline read requests to the IMC
> 
>   - name: data_writes
>   - code: 0x2
>   - unit: 64 bytes
>   - number of full cacheline write requests to the IMC
> 
> Documentation available at:
> http://software.intel.com/en-us/articles/monitoring-integrated-memory-controller-requests-in-the-2nd-3rd-and-4th-generation-intel
> 
> Signed-off-by: Stephane Eranian 
> ---
>  arch/x86/kernel/cpu/perf_event_intel_uncore.c |  370 
> +
>  arch/x86/kernel/cpu/perf_event_intel_uncore.h |1 +
>  2 files changed, 371 insertions(+)
> 
> diff --git a/arch/x86/kernel/cpu/perf_event_intel_uncore.c 
> b/arch/x86/kernel/cpu/perf_event_intel_uncore.c
> index 69a4ad0..8b1f81f 100644
> --- a/arch/x86/kernel/cpu/perf_event_intel_uncore.c
> +++ b/arch/x86/kernel/cpu/perf_event_intel_uncore.c
> @@ -66,6 +66,12 @@ DEFINE_UNCORE_FORMAT_ATTR(mask_vnw, mask_vnw, 
> "config2:3-4");
>  DEFINE_UNCORE_FORMAT_ATTR(mask0, mask0, "config2:0-31");
>  DEFINE_UNCORE_FORMAT_ATTR(mask1, mask1, "config2:32-63");
>  
> +static void uncore_pmu_start_hrtimer(struct intel_uncore_box *box);
> +static void uncore_pmu_cancel_hrtimer(struct intel_uncore_box *box);
> +static void uncore_perf_event_update(struct intel_uncore_box *box,
> +  struct perf_event *event);
> +static void uncore_pmu_event_read(struct perf_event *event);
> +
>  static struct intel_uncore_pmu *uncore_event_to_pmu(struct perf_event *event)
>  {
>   return container_of(event->pmu, struct intel_uncore_pmu, pmu);
> @@ -1668,6 +1674,348 @@ static struct intel_uncore_type *snb_msr_uncores[] = {
>   _uncore_cbox,
>   NULL,
>  };
> +
> +enum {
> + SNB_PCI_UNCORE_IMC,
> +};
> +
> +static struct uncore_event_desc snb_uncore_imc_events[] = {
> + INTEL_UNCORE_EVENT_DESC(data_reads,  "event=0x01"),
> + INTEL_UNCORE_EVENT_DESC(data_reads.scale, "64"),
> + INTEL_UNCORE_EVENT_DESC(data_reads.unit, "bytes"),
> +
> + INTEL_UNCORE_EVENT_DESC(data_writes, "event=0x02"),
> + INTEL_UNCORE_EVENT_DESC(data_writes.scale, "64"),
> + INTEL_UNCORE_EVENT_DESC(data_writes.unit, "bytes"),
> +
> + { /* end: all zeroes */ },
> +};
> +
> +#define SNB_UNCORE_PCI_IMC_EVENT_MASK0xff
> +#define SNB_UNCORE_PCI_IMC_BAR_OFFSET0x48
> +
> +/* page size multiple covering all config regs */
> +#define SNB_UNCORE_PCI_IMC_MAP_SIZE  0x6000
> +
> +#define SNB_UNCORE_PCI_IMC_DATA_READS0x1
> +#define SNB_UNCORE_PCI_IMC_DATA_READS_BASE   0x5050
> +#define SNB_UNCORE_PCI_IMC_DATA_WRITES   0x2
> +#define SNB_UNCORE_PCI_IMC_DATA_WRITES_BASE  0x5054
> +#define SNB_UNCORE_PCI_IMC_CTR_BASE  0x5050
> +
> +static struct attribute *snb_uncore_imc_formats_attr[] = {
> + _attr_event.attr,
> + NULL,
> +};
> +
> +static struct attribute_group snb_uncore_imc_format_group = {
> + .name = "format",
> + .attrs = snb_uncore_imc_formats_attr,
> +};
> +
> +static void snb_uncore_imc_init_box(struct intel_uncore_box *box)
> +{
> + struct pci_dev *pdev = box->pci_dev;
> + u32 addr_lo, addr_hi;
> + resource_size_t addr;
> +
> + pci_read_config_dword(pdev, SNB_UNCORE_PCI_IMC_BAR_OFFSET, _lo);
> + addr = addr_lo;
> +
> +#ifdef CONFIG_PHYS_ADDR_T_64BIT
> + pci_read_config_dword(pdev, SNB_UNCORE_PCI_IMC_BAR_OFFSET+4, _hi);
> + addr = ((resource_size_t)addr_hi << 32) | addr_lo;
> +#endif
> +
> + addr &= ~(PAGE_SIZE - 1);
> +
> + box->io_addr = ioremap(addr, SNB_UNCORE_PCI_IMC_MAP_SIZE);
> +}
> +
> +static void snb_uncore_imc_enable_box(struct intel_uncore_box *box)
> +{}
> +
> +static void snb_uncore_imc_disable_box(struct intel_uncore_box *box)
> +{}
> +
> +static void snb_uncore_imc_enable_event(struct intel_uncore_box *box,
> + struct perf_event *event)
> +{}
> +
> +static void snb_uncore_imc_disable_event(struct intel_uncore_box *box,
> +  struct perf_event *event)
> +{}
> +
> +static u64 snb_uncore_imc_read_counter(struct intel_uncore_box *box,
> +struct perf_event *event)
> +{
> + struct hw_perf_event *hwc = >hw;
> +
> + return (u64)*(unsigned int *)(box->io_addr + hwc->event_base);
> +}
> +
> +/*
> + * custom event_init() function because we define our own fixed, free
> + * running counters, so we do not want to conflict with generic uncore
> + * logic. Also simplifies processing
> + */
> +static int snb_uncore_imc_event_init(struct 

[PATCH v3 0/2] ASoC: atmel_ssc_dai: add option to choose clock

2014-02-09 Thread Bo Shen
When SSC work in slave mode, the clock can come from TK pin and also
can come from RK pin, this is hardware design decided. So, make it
available to choose where the clock from.

Changes in v3:
  - Move the property from card to ssc device
Series-changes: 2
  - using "-" replace "_" in binding document

Bo Shen (2):
  ASoC: atmel_ssc_dai: make option to choose clock
  Binding: atmel-ssc: add option to choose clock

 Documentation/devicetree/bindings/misc/atmel-ssc.txt |  8 
 drivers/misc/atmel-ssc.c |  6 ++
 include/linux/atmel-ssc.h|  1 +
 sound/soc/atmel/atmel_ssc_dai.c  | 13 +
 4 files changed, 24 insertions(+), 4 deletions(-)

-- 
1.8.5.2

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


[PATCH v3 1/2] ASoC: atmel_ssc_dai: make option to choose clock

2014-02-09 Thread Bo Shen
When SSC works in slave mode, according to the hardware design, the
clock can get from TK pin, also can get from RK pin. So, add one
parameter to choose where the clock from.

Signed-off-by: Bo Shen 
---
Changes in v3:
  - New, move clk-from-rk-pin property from card to ssc device

 drivers/misc/atmel-ssc.c|  6 ++
 include/linux/atmel-ssc.h   |  1 +
 sound/soc/atmel/atmel_ssc_dai.c | 13 +
 3 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/drivers/misc/atmel-ssc.c b/drivers/misc/atmel-ssc.c
index 5be80840..22de137 100644
--- a/drivers/misc/atmel-ssc.c
+++ b/drivers/misc/atmel-ssc.c
@@ -150,6 +150,12 @@ static int ssc_probe(struct platform_device *pdev)
return -ENODEV;
ssc->pdata = (struct atmel_ssc_platform_data *)plat_dat;
 
+   if (pdev->dev.of_node) {
+   struct device_node *np = pdev->dev.of_node;
+   ssc->clk_from_rk_pin =
+   of_property_read_bool(np, "atmel,clk-from-rk-pin");
+   }
+
regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
ssc->regs = devm_ioremap_resource(>dev, regs);
if (IS_ERR(ssc->regs))
diff --git a/include/linux/atmel-ssc.h b/include/linux/atmel-ssc.h
index 66a0e53..571a12e 100644
--- a/include/linux/atmel-ssc.h
+++ b/include/linux/atmel-ssc.h
@@ -18,6 +18,7 @@ struct ssc_device {
struct clk  *clk;
int user;
int irq;
+   boolclk_from_rk_pin;
 };
 
 struct ssc_device * __must_check ssc_request(unsigned int ssc_num);
diff --git a/sound/soc/atmel/atmel_ssc_dai.c b/sound/soc/atmel/atmel_ssc_dai.c
index 8697ced..ca1d8a3 100644
--- a/sound/soc/atmel/atmel_ssc_dai.c
+++ b/sound/soc/atmel/atmel_ssc_dai.c
@@ -341,6 +341,7 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream 
*substream,
 {
int id = dai->id;
struct atmel_ssc_info *ssc_p = _info[id];
+   struct ssc_device *ssc = ssc_p->ssc;
struct atmel_pcm_dma_params *dma_params;
int dir, channels, bits;
u32 tfmr, rfmr, tcmr, rcmr;
@@ -466,7 +467,8 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream 
*substream,
| SSC_BF(RCMR_START, start_event)
| SSC_BF(RCMR_CKI, SSC_CKI_RISING)
| SSC_BF(RCMR_CKO, SSC_CKO_NONE)
-   | SSC_BF(RCMR_CKS, SSC_CKS_CLOCK);
+   | SSC_BF(RCMR_CKS, ssc->clk_from_rk_pin ?
+  SSC_CKS_PIN : SSC_CKS_CLOCK);
 
rfmr =SSC_BF(RFMR_FSEDGE, SSC_FSEDGE_POSITIVE)
| SSC_BF(RFMR_FSOS, SSC_FSOS_NONE)
@@ -481,7 +483,8 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream 
*substream,
| SSC_BF(TCMR_START, start_event)
| SSC_BF(TCMR_CKI, SSC_CKI_FALLING)
| SSC_BF(TCMR_CKO, SSC_CKO_NONE)
-   | SSC_BF(TCMR_CKS, SSC_CKS_PIN);
+   | SSC_BF(TCMR_CKS, ssc->clk_from_rk_pin ?
+  SSC_CKS_CLOCK : SSC_CKS_PIN);
 
tfmr =SSC_BF(TFMR_FSEDGE, SSC_FSEDGE_POSITIVE)
| SSC_BF(TFMR_FSDEN, 0)
@@ -550,7 +553,8 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream 
*substream,
| SSC_BF(RCMR_START, SSC_START_RISING_RF)
| SSC_BF(RCMR_CKI, SSC_CKI_RISING)
| SSC_BF(RCMR_CKO, SSC_CKO_NONE)
-   | SSC_BF(RCMR_CKS, SSC_CKS_PIN);
+   | SSC_BF(RCMR_CKS, ssc->clk_from_rk_pin ?
+  SSC_CKS_PIN : SSC_CKS_CLOCK);
 
rfmr =SSC_BF(RFMR_FSEDGE, SSC_FSEDGE_POSITIVE)
| SSC_BF(RFMR_FSOS, SSC_FSOS_NONE)
@@ -565,7 +569,8 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream 
*substream,
| SSC_BF(TCMR_START, SSC_START_RISING_RF)
| SSC_BF(TCMR_CKI, SSC_CKI_FALLING)
| SSC_BF(TCMR_CKO, SSC_CKO_NONE)
-   | SSC_BF(TCMR_CKS, SSC_CKS_PIN);
+   | SSC_BF(RCMR_CKS, ssc->clk_from_rk_pin ?
+  SSC_CKS_CLOCK : SSC_CKS_PIN);
 
tfmr =SSC_BF(TFMR_FSEDGE, SSC_FSEDGE_POSITIVE)
| SSC_BF(TFMR_FSDEN, 0)
-- 
1.8.5.2

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


[PATCH v3 2/2] Binding: atmel-ssc: add option to choose clock

2014-02-09 Thread Bo Shen
Add the option to choose clock on which pin input to SSC (as slave).
Default is on TK pin to SSC, add "atmel,clk-from-rk-pin" option to
specify the clock is on RK pin to SSC.

Signed-off-by: Bo Shen 
---
Changes in v3:
  - None
Series-changes: 2
  - using "-" replace "_" in binding document

 Documentation/devicetree/bindings/misc/atmel-ssc.txt | 8 
 1 file changed, 8 insertions(+)

diff --git a/Documentation/devicetree/bindings/misc/atmel-ssc.txt 
b/Documentation/devicetree/bindings/misc/atmel-ssc.txt
index a45ae08..5c1e14e 100644
--- a/Documentation/devicetree/bindings/misc/atmel-ssc.txt
+++ b/Documentation/devicetree/bindings/misc/atmel-ssc.txt
@@ -14,6 +14,14 @@ Required properties for devices compatible with 
"atmel,at91sam9g45-ssc":
   See Documentation/devicetree/bindings/dma/atmel-dma.txt for details.
 - dma-names: Must be "tx", "rx".
 
+Optional properties:
+  - atmel,clk-from-rk-pin: bool property.
+ - When SSC works in slave mode, according to the hardware design, the
+   clock can get from TK pin, and also can get from RK pin. So, add
+   this parameter to choose where the clock from.
+ - By default the clock is from TK pin, if the clock from RK pin, this
+   property is needed.
+
 Examples:
 - PDC transfer:
 ssc0: ssc@fffbc000 {
-- 
1.8.5.2

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


Re: [PATCH] staging : ion : Fix some checkpatch warnings and an error

2014-02-09 Thread Joe Perches
On Mon, 2014-02-10 at 14:56 +0900, Daeseok Youn wrote:
>

Hello.

> diff --git a/drivers/staging/android/ion/ion_priv.h 
> b/drivers/staging/android/ion/ion_priv.h
[]
> - struct sg_table *(*map_dma) (struct ion_heap *heap,
> + struct sg_table * (*map_dma)(struct ion_heap *heap,

The message about space required after "struct sg_table *"
is a checkpatch defect.  This is better as:

struct sg_table *(*map_dma)(struct ion_heap *heap, etc...)

I'll fix checkpatch in a little bit.


--
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 09/10] perf/x86/uncore: add hrtimer to SNB uncore IMC PMU

2014-02-09 Thread Yan, Zheng
On 02/03/2014 08:55 PM, Stephane Eranian wrote:
> This patch is needed because that PMU uses 32-bit free
> running counters with no interrupt capabilities.
> 
> On SNB/IVB/HSW, we used 20GB/s theoretical peak to calculate
> the hrtimer timeout necessary to avoid missing an overflow.
> That delay is set to 5s to be on the cautious side.
> 
> The SNB IMC uses free running counters, which are handled
> via pseudo fixed counters. The SNB IMC PMU implementation
> supports an arbitrary number of events, because the counters
> are read-only. Therefore it is not possible to track active
> counters. Instead we put active events on a linked list which
> is then used by the hrtimer handler to update the SW counts.
> 
> Signed-off-by: Stephane Eranian 
> ---
>  arch/x86/kernel/cpu/perf_event_intel_uncore.c |   12 
>  arch/x86/kernel/cpu/perf_event_intel_uncore.h |2 ++
>  2 files changed, 14 insertions(+)
> 
> diff --git a/arch/x86/kernel/cpu/perf_event_intel_uncore.c 
> b/arch/x86/kernel/cpu/perf_event_intel_uncore.c
> index 8b1f81f..f76937e 100644
> --- a/arch/x86/kernel/cpu/perf_event_intel_uncore.c
> +++ b/arch/x86/kernel/cpu/perf_event_intel_uncore.c
> @@ -1730,6 +1730,7 @@ static void snb_uncore_imc_init_box(struct 
> intel_uncore_box *box)
>   addr &= ~(PAGE_SIZE - 1);
>  
>   box->io_addr = ioremap(addr, SNB_UNCORE_PCI_IMC_MAP_SIZE);
> + box->hrtimer_duration = UNCORE_SNB_IMC_HRTIMER_INTERVAL;
>  }
>  
>  static void snb_uncore_imc_enable_box(struct intel_uncore_box *box)
> @@ -3166,6 +3167,7 @@ static void uncore_perf_event_update(struct 
> intel_uncore_box *box, struct perf_e
>  static enum hrtimer_restart uncore_pmu_hrtimer(struct hrtimer *hrtimer)
>  {
>   struct intel_uncore_box *box;
> + struct perf_event *event;
>   unsigned long flags;
>   int bit;
>  
> @@ -3178,6 +3180,14 @@ static enum hrtimer_restart uncore_pmu_hrtimer(struct 
> hrtimer *hrtimer)
>*/
>   local_irq_save(flags);
>  
> + /*
> +  * handle boxes with an active event list as opposed to active
> +  * counters
> +  */
> + list_for_each_entry(event, >active_list, active_entry) {
> + uncore_perf_event_update(box, event);
> + }
> +
>   for_each_set_bit(bit, box->active_mask, UNCORE_PMC_IDX_MAX)
>   uncore_perf_event_update(box, box->events[bit]);
>  
> @@ -3227,6 +3237,8 @@ static struct intel_uncore_box *uncore_alloc_box(struct 
> intel_uncore_type *type,
>   /* set default hrtimer timeout */
>   box->hrtimer_duration = UNCORE_PMU_HRTIMER_INTERVAL;
>  
> + INIT_LIST_HEAD(>active_list);
> +
>   return box;
>  }
>  
> diff --git a/arch/x86/kernel/cpu/perf_event_intel_uncore.h 
> b/arch/x86/kernel/cpu/perf_event_intel_uncore.h
> index 0770da2..634de93 100644
> --- a/arch/x86/kernel/cpu/perf_event_intel_uncore.h
> +++ b/arch/x86/kernel/cpu/perf_event_intel_uncore.h
> @@ -6,6 +6,7 @@
>  
>  #define UNCORE_PMU_NAME_LEN  32
>  #define UNCORE_PMU_HRTIMER_INTERVAL  (60LL * NSEC_PER_SEC)
> +#define UNCORE_SNB_IMC_HRTIMER_INTERVAL (5ULL * NSEC_PER_SEC)
>  
>  #define UNCORE_FIXED_EVENT   0xff
>  #define UNCORE_PMC_IDX_MAX_GENERIC   8
> @@ -492,6 +493,7 @@ struct intel_uncore_box {
>   u64 hrtimer_duration; /* hrtimer timeout for this box */
>   struct hrtimer hrtimer;
>   struct list_head list;
> + struct list_head active_list;

I think patch 8 and patch 9 are disordered

Regards
Yan, Zheng

>   void *io_addr;
>   struct intel_uncore_extra_reg shared_regs[0];
>  };
> 

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


[PATCH] staging: android: timed_output: fix a checkpatch warning

2014-02-09 Thread Daeseok Youn
>From 866c5eb6cb88b59702802876a724dfd0144c447e Mon Sep 17 00:00:00 2001
From: Daeseok Youn 
Date: Mon, 10 Feb 2014 14:38:05 +0900
Subject: [PATCH] staging: android: timed_output: fix a checkpatch warning

- WARNING: Multiple spaces after return type

Signed-off-by: Daeseok Youn 
---
 drivers/staging/android/timed_output.h |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/android/timed_output.h 
b/drivers/staging/android/timed_output.h
index 905c7cc..13d2ca5 100644
--- a/drivers/staging/android/timed_output.h
+++ b/drivers/staging/android/timed_output.h
@@ -20,10 +20,10 @@ struct timed_output_dev {
const char  *name;
 
/* enable the output and set the timer */
-   void(*enable)(struct timed_output_dev *sdev, int timeout);
+   void (*enable)(struct timed_output_dev *sdev, int timeout);
 
/* returns the current number of milliseconds remaining on the timer */
-   int (*get_time)(struct timed_output_dev *sdev);
+   int (*get_time)(struct timed_output_dev *sdev);
 
/* private data */
struct device   *dev;
-- 
1.7.9.5
---
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] drm/nouveau: handle -EACCES runtime PM return code

2014-02-09 Thread Alexandre Courbot
pm_runtime_get*() may return -EACCESS to indicate a device does not have
runtime PM enabled. This is the case when the nouveau.runpm parameter is
set to 0, and is not an error in that context. Handle this case without
failure.

Signed-off-by: Alexandre Courbot 
---
 drivers/gpu/drm/nouveau/dispnv04/crtc.c | 2 +-
 drivers/gpu/drm/nouveau/nouveau_connector.c | 2 +-
 drivers/gpu/drm/nouveau/nouveau_drm.c   | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/dispnv04/crtc.c 
b/drivers/gpu/drm/nouveau/dispnv04/crtc.c
index 0e3270c3ffd2..1caef1fd139e 100644
--- a/drivers/gpu/drm/nouveau/dispnv04/crtc.c
+++ b/drivers/gpu/drm/nouveau/dispnv04/crtc.c
@@ -1048,7 +1048,7 @@ nouveau_crtc_set_config(struct drm_mode_set *set)
 
/* get a pm reference here */
ret = pm_runtime_get_sync(dev->dev);
-   if (ret < 0)
+   if (ret < 0 && ret != -EACCES)
return ret;
 
ret = drm_crtc_helper_set_config(set);
diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.c 
b/drivers/gpu/drm/nouveau/nouveau_connector.c
index 1674882d60d5..cddef546d9b0 100644
--- a/drivers/gpu/drm/nouveau/nouveau_connector.c
+++ b/drivers/gpu/drm/nouveau/nouveau_connector.c
@@ -255,7 +255,7 @@ nouveau_connector_detect(struct drm_connector *connector, 
bool force)
}
 
ret = pm_runtime_get_sync(connector->dev->dev);
-   if (ret < 0)
+   if (ret < 0 && ret != -EACCES)
return conn_status;
 
i2c = nouveau_connector_ddc_detect(connector, _encoder);
diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c 
b/drivers/gpu/drm/nouveau/nouveau_drm.c
index 8a4630a1fc45..2617168af244 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_drm.c
@@ -696,7 +696,7 @@ nouveau_drm_open(struct drm_device *dev, struct drm_file 
*fpriv)
 
/* need to bring up power immediately if opening device */
ret = pm_runtime_get_sync(dev->dev);
-   if (ret < 0)
+   if (ret < 0 && ret != -EACCES)
return ret;
 
get_task_comm(tmpname, current);
@@ -781,7 +781,7 @@ long nouveau_drm_ioctl(struct file *filp,
dev = file_priv->minor->dev;
 
ret = pm_runtime_get_sync(dev->dev);
-   if (ret < 0)
+   if (ret < 0 && ret != -EACCES)
return ret;
 
ret = drm_ioctl(filp, cmd, arg);
-- 
1.8.5.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] staging : android : sync : fix a checkpatch warning

2014-02-09 Thread Daeseok Youn
>From 16140b1ec1b1e1060f74707e4a6661aface81a14 Mon Sep 17 00:00:00 2001
From: Daeseok Youn 
Date: Mon, 10 Feb 2014 14:36:48 +0900
Subject: [PATCH] staging : android : sync : fix a checkpatch warning

- WARNING: missing space after return type

Signed-off-by: Daeseok Youn 
---
 drivers/staging/android/sync.h |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/android/sync.h b/drivers/staging/android/sync.h
index 62e2255b..6ee8d69 100644
--- a/drivers/staging/android/sync.h
+++ b/drivers/staging/android/sync.h
@@ -53,7 +53,7 @@ struct sync_timeline_ops {
const char *driver_name;
 
/* required */
-   struct sync_pt *(*dup)(struct sync_pt *pt);
+   struct sync_pt * (*dup)(struct sync_pt *pt);
 
/* required */
int (*has_signaled)(struct sync_pt *pt);
-- 
1.7.9.5


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


[PATCH] drm/nouveau/fifo: allocate usermem as needed

2014-02-09 Thread Alexandre Courbot
Memory was always allocated for 4096 channels. Change this to allocate
what we actually need according to the number of channels we use.

Signed-off-by: Alexandre Courbot 
---
 drivers/gpu/drm/nouveau/core/engine/fifo/nve0.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/core/engine/fifo/nve0.c 
b/drivers/gpu/drm/nouveau/core/engine/fifo/nve0.c
index 9a850fe19515..99c9deea248f 100644
--- a/drivers/gpu/drm/nouveau/core/engine/fifo/nve0.c
+++ b/drivers/gpu/drm/nouveau/core/engine/fifo/nve0.c
@@ -852,8 +852,8 @@ nve0_fifo_ctor(struct nouveau_object *parent, struct 
nouveau_object *engine,
return ret;
}
 
-   ret = nouveau_gpuobj_new(nv_object(priv), NULL, 4096 * 0x200, 0x1000,
-NVOBJ_FLAG_ZERO_ALLOC, >user.mem);
+   ret = nouveau_gpuobj_new(nv_object(priv), NULL, impl->channels * 0x200,
+   0x1000, NVOBJ_FLAG_ZERO_ALLOC, >user.mem);
if (ret)
return ret;
 
-- 
1.8.5.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] staging : ion : Fix some checkpatch warnings and an error

2014-02-09 Thread Daeseok Youn
>From aa06cc53c7214a044fbc220872aa6210c09608d3 Mon Sep 17 00:00:00 2001
From: Daeseok Youn 
Date: Mon, 10 Feb 2014 14:27:40 +0900
Subject: [PATCH] staging : ion : Fix some checkpatch warnings and an error

Warning:
- Unnecessary space after function pointer name
- Prefer seq_puts to seq_printf
- quoted string split across lines

Error:
- return is not a function, parentheses are not required

Signed-off-by: Daeseok Youn 
---
 drivers/staging/android/ion/ion.c  |   19 +--
 drivers/staging/android/ion/ion_priv.h |   16 
 2 files changed, 17 insertions(+), 18 deletions(-)

diff --git a/drivers/staging/android/ion/ion.c 
b/drivers/staging/android/ion/ion.c
index 574066f..d81f231 100644
--- a/drivers/staging/android/ion/ion.c
+++ b/drivers/staging/android/ion/ion.c
@@ -55,7 +55,7 @@ struct ion_device {
struct mutex buffer_lock;
struct rw_semaphore lock;
struct plist_head heaps;
-   long (*custom_ioctl) (struct ion_client *client, unsigned int cmd,
+   long (*custom_ioctl)(struct ion_client *client, unsigned int cmd,
  unsigned long arg);
struct rb_root clients;
struct dentry *debug_root;
@@ -429,7 +429,7 @@ static bool ion_handle_validate(struct ion_client *client,
struct ion_handle *handle)
 {
WARN_ON(!mutex_is_locked(>lock));
-   return (idr_find(>idr, handle->id) == handle);
+   return idr_find(>idr, handle->id) == handle;
 }
 
 static int ion_handle_add(struct ion_client *client, struct ion_handle *handle)
@@ -1338,7 +1338,7 @@ static int ion_debug_heap_show(struct seq_file *s, void 
*unused)
size_t total_orphaned_size = 0;
 
seq_printf(s, "%16.s %16.s %16.s\n", "client", "pid", "size");
-   seq_printf(s, "\n");
+   seq_puts(s, "\n");
 
for (n = rb_first(>clients); n; n = rb_next(n)) {
struct ion_client *client = rb_entry(n, struct ion_client,
@@ -1357,9 +1357,9 @@ static int ion_debug_heap_show(struct seq_file *s, void 
*unused)
   client->pid, size);
}
}
-   seq_printf(s, "\n");
-   seq_printf(s, "orphaned allocations (info is from last known client):"
-  "\n");
+   seq_puts(s, "\n");
+   seq_puts(s, "orphaned allocations (info is from last known client):\n");
+
mutex_lock(>buffer_lock);
for (n = rb_first(>buffers); n; n = rb_next(n)) {
struct ion_buffer *buffer = rb_entry(n, struct ion_buffer,
@@ -1376,14 +1376,14 @@ static int ion_debug_heap_show(struct seq_file *s, void 
*unused)
}
}
mutex_unlock(>buffer_lock);
-   seq_printf(s, "\n");
+   seq_puts(s, "\n");
seq_printf(s, "%16.s %16zu\n", "total orphaned",
   total_orphaned_size);
seq_printf(s, "%16.s %16zu\n", "total ", total_size);
if (heap->flags & ION_HEAP_FLAG_DEFER_FREE)
seq_printf(s, "%16.s %16zu\n", "deferred free",
heap->free_list_size);
-   seq_printf(s, "\n");
+   seq_puts(s, "\n");
 
if (heap->debug_show)
heap->debug_show(heap, s, unused);
@@ -1527,8 +1527,7 @@ void __init ion_reserve(struct ion_platform_data *data)
data->heaps[i].align,
MEMBLOCK_ALLOC_ANYWHERE);
if (!paddr) {
-   pr_err("%s: error allocating memblock for "
-  "heap %d\n",
+   pr_err("%s: error allocating memblock for heap 
%d\n",
__func__, i);
continue;
}
diff --git a/drivers/staging/android/ion/ion_priv.h 
b/drivers/staging/android/ion/ion_priv.h
index d986739..10f315a 100644
--- a/drivers/staging/android/ion/ion_priv.h
+++ b/drivers/staging/android/ion/ion_priv.h
@@ -100,18 +100,18 @@ void ion_buffer_destroy(struct ion_buffer *buffer);
  * map_dma and map_kernel return pointer on success, ERR_PTR on error.
  */
 struct ion_heap_ops {
-   int (*allocate) (struct ion_heap *heap,
+   int (*allocate)(struct ion_heap *heap,
 struct ion_buffer *buffer, unsigned long len,
 unsigned long align, unsigned long flags);
-   void (*free) (struct ion_buffer *buffer);
-   int (*phys) (struct ion_heap *heap, struct ion_buffer 

[PATCH] drm/nouveau: support for platform devices

2014-02-09 Thread Alexandre Courbot
Upcoming mobile Kepler GPUs (such as GK20A) use the platform bus instead
of PCI to which Nouveau is tightly dependent. This patch allows Nouveau
to handle platform devices by:

- abstracting PCI-dependent functions that were typically used for
  resource querying and page mapping,
- introducing a nv_device_is_pci() function that allows to make
  PCI-dependent code conditional,
- providing a nouveau_drm_platform_probe() function that takes a GPU
  platform device to be probed.

Core code as well as engine/subdev drivers are updated wherever possible
to make use of these functions. Some older drivers are too dependent on
PCI to be properly updated, but all newer code on which future chips may
depend should now at least be runnable with platform devices.

Signed-off-by: Alexandre Courbot 
---
Sending this ahead since this has received no objections in the RFC and
should be a no-op for PCI devices anyway. My hope is to get it merged
quickly since many subsystems are touched and this makes maintainance
difficult.

Squashed everything into one patch for convenience - most of the code is
simple replacements, and it is one single logical change really. This
version is more aggressive than the RFC in making code PCI-independent,
since we ran into issues when code we didn't expect to be executed
happened to be and was complaining about the absence of device->pdev.

 drivers/gpu/drm/nouveau/core/engine/device/base.c  | 104 -
 drivers/gpu/drm/nouveau/core/engine/falcon.c   |   6 +-
 drivers/gpu/drm/nouveau/core/engine/fifo/base.c|   2 +-
 drivers/gpu/drm/nouveau/core/engine/graph/nv20.c   |   2 +-
 drivers/gpu/drm/nouveau/core/engine/graph/nv40.c   |   2 +-
 drivers/gpu/drm/nouveau/core/engine/graph/nvc0.c   |   4 +-
 drivers/gpu/drm/nouveau/core/engine/xtensa.c   |   2 +-
 drivers/gpu/drm/nouveau/core/include/core/device.h |  30 ++
 .../gpu/drm/nouveau/core/include/engine/device.h   |  10 ++
 drivers/gpu/drm/nouveau/core/include/subdev/mc.h   |   1 +
 drivers/gpu/drm/nouveau/core/os.h  |   1 +
 drivers/gpu/drm/nouveau/core/subdev/bar/base.c |   4 +-
 drivers/gpu/drm/nouveau/core/subdev/bar/nv50.c |   4 +-
 drivers/gpu/drm/nouveau/core/subdev/bar/nvc0.c |  15 ++-
 .../gpu/drm/nouveau/core/subdev/devinit/fbmem.h|   8 +-
 drivers/gpu/drm/nouveau/core/subdev/devinit/nv04.c |   2 +-
 drivers/gpu/drm/nouveau/core/subdev/devinit/nv05.c |   2 +-
 drivers/gpu/drm/nouveau/core/subdev/devinit/nv10.c |   2 +-
 drivers/gpu/drm/nouveau/core/subdev/devinit/nv20.c |   2 +-
 drivers/gpu/drm/nouveau/core/subdev/fb/nv50.c  |   9 +-
 drivers/gpu/drm/nouveau/core/subdev/fb/nvc0.c  |   9 +-
 drivers/gpu/drm/nouveau/core/subdev/i2c/base.c |   2 +-
 drivers/gpu/drm/nouveau/core/subdev/instmem/nv40.c |   7 +-
 drivers/gpu/drm/nouveau/core/subdev/mc/base.c  |  39 +---
 drivers/gpu/drm/nouveau/core/subdev/mxm/base.c |   2 +-
 drivers/gpu/drm/nouveau/nouveau_abi16.c|  13 ++-
 drivers/gpu/drm/nouveau/nouveau_bo.c   |  22 +++--
 drivers/gpu/drm/nouveau/nouveau_chan.c |   2 +-
 drivers/gpu/drm/nouveau/nouveau_display.c  |   3 +-
 drivers/gpu/drm/nouveau/nouveau_drm.c  |  75 ---
 drivers/gpu/drm/nouveau/nouveau_sysfs.c|   8 +-
 drivers/gpu/drm/nouveau/nouveau_ttm.c  |  31 +++---
 32 files changed, 318 insertions(+), 107 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/core/engine/device/base.c 
b/drivers/gpu/drm/nouveau/core/engine/device/base.c
index dd01c6c435d6..b9f4873dcb23 100644
--- a/drivers/gpu/drm/nouveau/core/engine/device/base.c
+++ b/drivers/gpu/drm/nouveau/core/engine/device/base.c
@@ -131,8 +131,8 @@ nouveau_devobj_ctor(struct nouveau_object *parent,
if (ret)
return ret;
 
-   mmio_base = pci_resource_start(device->pdev, 0);
-   mmio_size = pci_resource_len(device->pdev, 0);
+   mmio_base = nv_device_resource_start(device, 0);
+   mmio_size = nv_device_resource_len(device, 0);
 
/* translate api disable mask into internal mapping */
disable = args->debug0;
@@ -446,6 +446,72 @@ nouveau_device_dtor(struct nouveau_object *object)
nouveau_engine_destroy(>base);
 }
 
+resource_size_t
+nv_device_resource_start(struct nouveau_device *device, unsigned int bar)
+{
+   if (nv_device_is_pci(device)) {
+   return pci_resource_start(device->pdev, bar);
+   } else {
+   struct resource *res;
+   res = platform_get_resource(device->platformdev,
+   IORESOURCE_MEM, bar);
+   if (!res)
+   return 0;
+   return res->start;
+   }
+}
+
+resource_size_t
+nv_device_resource_len(struct nouveau_device *device, unsigned int bar)
+{
+   if (nv_device_is_pci(device)) {
+   return pci_resource_len(device->pdev, bar);
+   } else {
+   struct resource *res;

Re: [PATCH] USB2NET : SR9800 : One chip USB2.0 USB2NET SR9800 Device Driver Support

2014-02-09 Thread Joe Perches
On Mon, 2014-02-10 at 13:33 +0800, liujunliang_...@163.com wrote:
> diff --git a/drivers/net/usb/sr9800.c b/drivers/net/usb/sr9800.c
[]
> + netdev_dbg(dev->net, "mac addr : 0x%x:0x%x:0x%x:0x%x:0x%x:0x%x\n",
> +dev->net->dev_addr[0], dev->net->dev_addr[1],
> +dev->net->dev_addr[2], dev->net->dev_addr[3],
> +dev->net->dev_addr[4], dev->net->dev_addr[5]);

mac addresses are assumed to be hex and don't need 0x prefixes.
Also, there's a kernel vsprintf extension "%pM" for mac addresses.

netdev_dbg(dev->net, "mac addr: %pM\n", dev->net->dev_addr);


--
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] USB2NET : SR9800 : One chip USB2.0 USB2NET SR9800 Device Driver Support

2014-02-09 Thread liujunliang_ljl
From: Liu Junliang 


Signed-off-by: Liu Junliang 
---
 drivers/net/usb/Kconfig  |   16 +
 drivers/net/usb/Makefile |1 +
 drivers/net/usb/sr9800.c |  873 ++
 drivers/net/usb/sr9800.h |  202 +++
 4 files changed, 1092 insertions(+), 0 deletions(-)
 create mode 100644 drivers/net/usb/sr9800.c
 create mode 100644 drivers/net/usb/sr9800.h

diff --git a/drivers/net/usb/Kconfig b/drivers/net/usb/Kconfig
index 47b0f73..2551bf6 100644
--- a/drivers/net/usb/Kconfig
+++ b/drivers/net/usb/Kconfig
@@ -291,6 +291,22 @@ config USB_NET_SR9700
  This option adds support for CoreChip-sz SR9700 based USB 1.1
  10/100 Ethernet adapters.
 
+config USB_NET_SR9800
+   tristate "CoreChip-sz SR9800 based USB 2.0 10/100 ethernet devices"
+   depends on USB_USBNET
+   select CRC32
+   default y
+   ---help---
+ Say Y if you want to use one of the following 100Mbps USB Ethernet
+ device based on the CoreChip-sz SR9800 chip.
+
+ This driver makes the adapter appear as a normal Ethernet interface,
+ typically on eth0, if it is the only ethernet device, or perhaps on
+ eth1, if you have a PCI or ISA ethernet card installed.
+
+ To compile this driver as a module, choose M here: the
+ module will be called sr9800.
+
 config USB_NET_SMSC75XX
tristate "SMSC LAN75XX based USB 2.0 gigabit ethernet devices"
depends on USB_USBNET
diff --git a/drivers/net/usb/Makefile b/drivers/net/usb/Makefile
index b17b5e8..433f0a0 100644
--- a/drivers/net/usb/Makefile
+++ b/drivers/net/usb/Makefile
@@ -15,6 +15,7 @@ obj-$(CONFIG_USB_NET_CDCETHER)+= cdc_ether.o r815x.o
 obj-$(CONFIG_USB_NET_CDC_EEM)  += cdc_eem.o
 obj-$(CONFIG_USB_NET_DM9601)   += dm9601.o
 obj-$(CONFIG_USB_NET_SR9700)   += sr9700.o
+obj-$(CONFIG_USB_NET_SR9800)   += sr9800.o
 obj-$(CONFIG_USB_NET_SMSC75XX) += smsc75xx.o
 obj-$(CONFIG_USB_NET_SMSC95XX) += smsc95xx.o
 obj-$(CONFIG_USB_NET_GL620A)   += gl620a.o
diff --git a/drivers/net/usb/sr9800.c b/drivers/net/usb/sr9800.c
new file mode 100644
index 000..51da04f
--- /dev/null
+++ b/drivers/net/usb/sr9800.c
@@ -0,0 +1,873 @@
+/* CoreChip-sz SR9800 one chip USB 2.0 Ethernet Devices
+ *
+ * Author : Liu Junliang 
+ *
+ * Based on asix_common.c, asix_devices.c
+ *
+ * This file is licensed under the terms of the GNU General Public License
+ * version 2.  This program is licensed "as is" without any warranty of any
+ * kind, whether express or implied.*
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "sr9800.h"
+
+static int sr_read_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index,
+   u16 size, void *data)
+{
+   int err;
+
+   err = usbnet_read_cmd(dev, cmd, SR_REQ_RD_REG, value, index,
+ data, size);
+   if ((err != size) && (err >= 0))
+   err = -EINVAL;
+
+   return err;
+}
+
+static int sr_write_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index,
+u16 size, void *data)
+{
+   int err;
+
+   err = usbnet_write_cmd(dev, cmd, SR_REQ_WR_REG, value, index,
+ data, size);
+   if ((err != size) && (err >= 0))
+   err = -EINVAL;
+
+   return err;
+}
+
+static void
+sr_write_cmd_async(struct usbnet *dev, u8 cmd, u16 value, u16 index,
+  u16 size, void *data)
+{
+   usbnet_write_cmd_async(dev, cmd, SR_REQ_WR_REG, value, index, data,
+  size);
+}
+
+static int sr_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
+{
+   int offset = 0;
+
+   while (offset + sizeof(u32) < skb->len) {
+   struct sk_buff *sr_skb;
+   u16 size;
+   u32 header = get_unaligned_le32(skb->data + offset);
+
+   offset += sizeof(u32);
+   /* get the packet length */
+   size = (u16) (header & 0x7ff);
+   if (size != ((~header >> 16) & 0x07ff)) {
+   netdev_err(dev->net, "%s : Bad Header Length\n",
+  __func__);
+   return 0;
+   }
+
+   if ((size > dev->net->mtu + ETH_HLEN + VLAN_HLEN) ||
+   (size + offset > skb->len)) {
+   netdev_err(dev->net, "%s : Bad RX Length %d\n",
+  __func__, size);
+   return 0;
+   }
+   sr_skb = netdev_alloc_skb_ip_align(dev->net, size);
+   if (!sr_skb)
+   return 0;
+
+   skb_put(sr_skb, size);
+   memcpy(sr_skb->data, skb->data + offset, size);
+   usbnet_skb_return(dev, sr_skb);
+
+   offset += (size + 1) & 0xfffe;
+   }
+
+   if (skb->len != offset) {
+ 

Re: linux-next: manual merge of the akpm-current tree with the rcu tree

2014-02-09 Thread Paul E. McKenney
On Mon, Feb 10, 2014 at 03:00:47PM +1100, Stephen Rothwell wrote:
> Hi Andrew,
> 
> Today's linux-next merge of the akpm-current tree got a conflict in
> mm/slub.c between commit f4e40a71719d ("slub: Fix add_full() lockdep
> checks") from the rcu tree and commit aee03fe7a7c8 ("mm/slub.c: list_lock
> may not be held in some circumstances") from the akpm-current tree.
> 
> These patches try to achieve the same thing, so I arbitrarily chose the
> version from the akpm-current tree.

My bad -- I forgot to remove my version.

Thanx, Paul

--
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-next: Tree for Feb 10

2014-02-09 Thread Stephen Rothwell
Hi all,

This tree fails (more than usual) the powerpc allyesconfig build.

Changes since 20140207:

The powerpc tree still had its build failure.

The drm-intel tree gained a conflict against the drm-intel-fixes tree.

The staging tree gained a build failure for which I disabled a driver.

The akpm-current tree gained a conflict against the rcu tree.

Non-merge commits (relative to Linus' tree): 1601
 1740 files changed, 58046 insertions(+), 26789 deletions(-)



I have created today's linux-next tree at
git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
(patches at http://www.kernel.org/pub/linux/kernel/next/ ).  If you
are tracking the linux-next tree using git, you should not use "git pull"
to do so as that will try to merge the new linux-next release with the
old one.  You should use "git fetch" as mentioned in the FAQ on the wiki
(see below).

You can see which trees have been included by looking in the Next/Trees
file in the source.  There are also quilt-import.log and merge.log files
in the Next directory.  Between each merge, the tree was built with
a ppc64_defconfig for powerpc and an allmodconfig for x86_64 and a
multi_v7_defconfig for arm. After the final fixups (if any), it is also
built with powerpc allnoconfig (32 and 64 bit), ppc44x_defconfig and
allyesconfig (minus CONFIG_PROFILE_ALL_BRANCHES - this fails its final
link) and i386, sparc, sparc64 and arm defconfig. These builds also have
CONFIG_ENABLE_WARN_DEPRECATED, CONFIG_ENABLE_MUST_CHECK and
CONFIG_DEBUG_INFO disabled when necessary.

Below is a summary of the state of the merge.

I am currently merging 208 trees (counting Linus' and 28 trees of patches
pending for Linus' tree).

Stats about the size of the tree over time can be seen at
http://neuling.org/linux-next-size.html .

Status of my local build tests will be at
http://kisskb.ellerman.id.au/linux-next .  If maintainers want to give
advice about cross compilers/configs that work, we are always open to add
more builds.

Thanks to Randy Dunlap for doing many randconfig builds.  And to Paul
Gortmaker for triage and bug fixes.

There is a wiki covering stuff to do with linux-next at
http://linux.f-seidel.de/linux-next/pmwiki/ .  Thanks to Frank Seidel.

-- 
Cheers,
Stephen Rothwells...@canb.auug.org.au

$ git checkout master
$ git reset --hard stable
Merging origin/master (9c1db7798141 Merge branch 'for-linus' of 
git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs)
Merging fixes/master (b0031f227e47 Merge tag 's2mps11-build' of 
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator)
Merging kbuild-current/rc-fixes (38dbfb59d117 Linus 3.14-rc1)
Merging arc-current/for-curr (7e22e91102c6 Linux 3.13-rc8)
Merging arm-current/fixes (87f9260bf1fb ARM: dts: fix spdif pinmux 
configuration)
Merging m68k-current/for-linus (56931d73697c m68k/mac: Make SCC reset work more 
reliably)
Merging metag-fixes/fixes (3b2f64d00c46 Linux 3.11-rc2)
Merging powerpc-merge/merge (b3084f4db3ae powerpc/thp: Fix crash on mremap)
Merging sparc/master (9b0cd304f26b Merge branch 'drm-next' of 
git://people.freedesktop.org/~airlied/linux)
Merging net/master (872c7e6fd214 Merge branch 'for-davem' of 
git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless)
Merging ipsec/master (965cdea82569 dccp: catch failed request_module call in 
dccp_probe init)
Merging sound-current/for-linus (f88abaa0d0dc ALSA: hda - Fix mic capture on 
Sony VAIO Pro 11)
Merging pci-current/for-linus (38dbfb59d117 Linus 3.14-rc1)
Merging wireless/master (348f7d4adee9 rtl8180: Add error check for 
pci_map_single return value in TX path)
Merging driver-core.current/driver-core-linus (9e1ccb4a7700 drivers/base: fix 
devres handling for master device)
Merging tty.current/tty-linus (d8a5dc3033af tty: Set correct tty name in 
'active' sysfs attribute)
Merging usb.current/usb-linus (03b56329f9bb Modpost: fixed USB alias generation 
for ranges including 0x9 and 0xA)
Merging staging.current/staging-linus (a0f452520211 Merge tag 
'iio-fixes-for-3.14b' of 
git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-linus)
Merging char-misc.current/char-misc-linus (3b1cc9b9622a misc: mic: fix possible 
signed underflow (undefined behavior) in userspace API)
Merging input-current/for-linus (55df811f2066 Merge branch 'next' into 
for-linus)
Merging md-current/for-linus (d47648fcf061 raid5: avoid finding "discard" 
stripe)
Merging crypto-current/master (ee97dc7db4cb crypto: s390 - fix des and des3_ede 
ctr concurrency issue)
Merging ide/master (9b0cd304f26b Merge branch 'drm-next' of 
git://people.freedesktop.org/~airlied/linux)
Merging dwmw2/master (5950f0803ca9 pcmcia: remove RPX board stuff)
Merging devicetree-current/devicetree/merge (6f041e99fc7b of: Fix NULL 
dereference in unflatten_and_copy())
Merging rr-fixes/fixes (7122c3e9154b scripts/link-vmlinux.sh: only filter 
kernel symbols for arm)
Merging 

Re: make oldfonfig broken.

2014-02-09 Thread Randy Dunlap
On 02/09/2014 08:32 PM, Gene Heskett wrote:
> On Sunday 09 February 2014, Randy Dunlap wrote:
>> On 02/09/2014 08:14 PM, Gene Heskett wrote:
>>> On Sunday 09 February 2014, Randy Dunlap wrote:
 On 02/09/2014 07:46 PM, Gene Heskett wrote:
> On Sunday 09 February 2014, Randy Dunlap wrote:
>> On 02/09/2014 07:07 PM, Ken Moffat wrote:
>>> On Sun, Feb 09, 2014 at 06:05:41PM -0500, Gene Heskett wrote:
 On Sunday 09 February 2014, Paul Bolle wrote:
> Feel free to open a new thread, with the relevant details, and
> involve the relevant people and lists. I have no idea what you're
> going on about and could not care less (in the context of this
> thread).
>
>
> Paul Bolle

 Been tried, got zero response.  Frankly, posting just to lkml,
 hoping the revalent people see it, is beginning to act like
 posting to a black hole.

>>>  I saw one response to you, from Randy Dunlap, asking for more
>>>
>>> information : https://lkml.org/lkml/2014/2/8/153
>>
>> wow, I don't know how I saw this message (thanks, Ken),
>> but replying to this patch was NOT the right thing to do, Gene.
>>
>> Just reply to my request and I'll be glad to look into it.
>>
>>>  After your posts a few days ago, I'm tempted to suggest you check
>>>
>>> your spam filters, and also any mail files your virus scanner might
>>> have quarantined.  But it is also possible that you just haven't
>>> received it - email is like that.
>>>
>>> ط¤آ¸en
>
> Spam and viri filters watched carefully.  I also use mailfilter, and
> watch its logs full time for FP's.

 Still -- this ATSC problem should not be part of a reply to the Remove
 DEPRECATED patch.
>>>
>>> True.  But I got some attention.
>>>
> And I didn't reply because the question seemed way too broad, almost
> as if

 what question seemed to broad?
>>>
>>> You wanted to see "a" config, but I wanted to show the diffs. Also
>>> yesterday I hadn't gone thru what I have yet to see where it falls
>>> apart.
>>>
> my lament wasn't read.  That and the mail server doesn't like big

 what mail server?  yours?  wdtv?  vger.kernel.org certainly has no
 problem with them.
>>>
>>> I have gotten bounced from lkml because a screen shot pix of a failed
>>> boot was too big.  Perhaps 18 months or so.  It was big, from a 10
>>> megapixel camera.
>>>
> attachments. So rather than reply to the list, I'll excise some of
> the addresses that bounce from a reply_all or don't like me, and
> send the .config from a 3.019 build which seems ok, but by the time
> that config is run thru a make oldconfig at 3.8.2, most all the
> media, ATSC and DVB stuff is gone.  So I'll attach that one too. 
> The later file grew 22kb, but wholesale parts of the first one are
> missing from the 2nd.

 Gene, I want to make sure where you are saying the problem is.
 Is it going directly from 3.019 to 3.8.2, with no intervening kernel
 versions?
>>>
>>> No, one intermediate step in this case.
>>>
>>> I started with 3.0.19, which was fine, took that one to 3.2.40, and
>>> that one to 3.8.2 because I don't have anything between those here. 
>>> Not exactly a step by step.
>>
>> and when you go from one kernel version to the next, do you use
>>
>> $ make oldconfig
>> and answer all of its questions, or do you use
> 
> I generally answer all its questions, or take the default by hitting enter, 
> but I do read all its questions.
> 
>> $ yes '' | make oldconfig
> 
> Never done that in all these years.
> 
>> or some other variant?  (I guess in your super build script.)
> 
> This is long before my "super script" gets fired off.
> 
> And that part is actually working well, run it as root, do a grub-update 
> and reboot.
> 
> Cheers, Gene
> 

You need to have a Kconfig symbol named DVB_CORE enabled.

In 3.8.2 (and likely previously, but not in 3.2.40),
DVB_CORE depends on having both MEDIA_SUPPORT and MEDIA_DIGITAL_TV_SUPPORT
enabled.  Your .confile file  has MEDIA_SUPPORT enabled but not
MEDIA_DIGITAL_TV_SUPPORT.

In your 3.2.40 kernel source tree, just edit your .config file and delete the 
line
that says:
# CONFIG_MEDIA_DIGITAL_TV_SUPPORT is not set

then run [1]
$ make oldconfig
and it will ask you how to set the Kconfig symbol.  Tell it 'y'.

and if you can find this line in your .config file:
CONFIG_MEDIA_SUBDRV_AUTOSELECT=y

delete it. Run 'make oldconfig' again if you did so at [1] above.
For this Kconfig question:
  Autoselect tuners and i2c modules to build (MEDIA_SUBDRV_AUTOSELECT),
answer N.
Then you can select all of the tuners and frontends that you want.
There are LOTS of them to choose from.

IIRC, this all happened because someone decided that they could make the 
AUTOSELECT
driver feature Better!  ugh.

Good luck. Let me know if you need more guidance.


-- 
~Randy
--

Re: linux-next: build failure after merge of the final tree (staging tree related)

2014-02-09 Thread Greg KH
On Mon, Feb 10, 2014 at 03:54:12PM +1100, Stephen Rothwell wrote:
> Hi all,
> 
> After merging the final tree, today's linux-next build (powerpc
> allyesconfig) failed like this:
> 
> drivers/staging/rtl8188eu/core/rtw_mlme.c: In function '_rtw_init_mlme_priv':
> drivers/staging/rtl8188eu/core/rtw_mlme.c:65:2: error: implicit declaration 
> of function 'vzalloc' [-Werror=implicit-function-declaration]
>   pbuf = vzalloc(MAX_BSS_CNT * (sizeof(struct wlan_network)));
>   ^



Sorry about that.  Larry sent me a patch for this Friday evening and I
haven't had the chance to add it to my tree just yet.  Sorry for the
noise.

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


linux-next: build failure after merge of the final tree (staging tree related)

2014-02-09 Thread Stephen Rothwell
Hi all,

After merging the final tree, today's linux-next build (powerpc
allyesconfig) failed like this:

drivers/staging/rtl8188eu/core/rtw_mlme.c: In function '_rtw_init_mlme_priv':
drivers/staging/rtl8188eu/core/rtw_mlme.c:65:2: error: implicit declaration of 
function 'vzalloc' [-Werror=implicit-function-declaration]
  pbuf = vzalloc(MAX_BSS_CNT * (sizeof(struct wlan_network)));
  ^
drivers/staging/rtl8188eu/core/rtw_mlme.c:65:7: warning: assignment makes 
pointer from integer without a cast [enabled by default]
  pbuf = vzalloc(MAX_BSS_CNT * (sizeof(struct wlan_network)));
   ^
drivers/staging/rtl8188eu/core/rtw_mlme.c: In function '_rtw_free_mlme_priv':
drivers/staging/rtl8188eu/core/rtw_mlme.c:133:4: error: implicit declaration of 
function 'vfree' [-Werror=implicit-function-declaration]
vfree(pmlmepriv->free_bss_buf);
^
drivers/staging/rtl8188eu/core/rtw_mp.c: In function '_rtw_mp_xmit_priv':
drivers/staging/rtl8188eu/core/rtw_mp.c:946:3: error: implicit declaration of 
function 'vfree' [-Werror=implicit-function-declaration]
   vfree(pxmitpriv->pallocated_xmit_extbuf);
   ^
drivers/staging/rtl8188eu/core/rtw_mp.c:959:2: error: implicit declaration of 
function 'vzalloc' [-Werror=implicit-function-declaration]
  pxmitpriv->pallocated_xmit_extbuf = vzalloc(num_xmit_extbuf * sizeof(struct 
xmit_buf) + 4);
  ^
drivers/staging/rtl8188eu/core/rtw_mp.c:959:36: warning: assignment makes 
pointer from integer without a cast [enabled by default]
  pxmitpriv->pallocated_xmit_extbuf = vzalloc(num_xmit_extbuf * sizeof(struct 
xmit_buf) + 4);
^
drivers/staging/rtl8188eu/core/rtw_recv.c: In function '_rtw_init_recv_priv':
drivers/staging/rtl8188eu/core/rtw_recv.c:80:2: error: implicit declaration of 
function 'vzalloc' [-Werror=implicit-function-declaration]
  precvpriv->pallocated_frame_buf = vzalloc(NR_RECVFRAME * sizeof(union 
recv_frame) + RXFRAME_ALIGN_SZ);
  ^
drivers/staging/rtl8188eu/core/rtw_recv.c:80:34: warning: assignment makes 
pointer from integer without a cast [enabled by default]
  precvpriv->pallocated_frame_buf = vzalloc(NR_RECVFRAME * sizeof(union 
recv_frame) + RXFRAME_ALIGN_SZ);
  ^
drivers/staging/rtl8188eu/core/rtw_recv.c: In function '_rtw_free_recv_priv':
drivers/staging/rtl8188eu/core/rtw_recv.c:132:3: error: implicit declaration of 
function 'vfree' [-Werror=implicit-function-declaration]
   vfree(precvpriv->pallocated_frame_buf);
   ^
drivers/staging/rtl8188eu/core/rtw_sta_mgt.c: In function '_rtw_init_sta_priv':
drivers/staging/rtl8188eu/core/rtw_sta_mgt.c:82:2: error: implicit declaration 
of function 'vzalloc' [-Werror=implicit-function-declaration]
  pstapriv->pallocated_stainfo_buf = vzalloc(sizeof(struct sta_info) * NUM_STA 
+ 4);
  ^
drivers/staging/rtl8188eu/core/rtw_sta_mgt.c:82:35: warning: assignment makes 
pointer from integer without a cast [enabled by default]
  pstapriv->pallocated_stainfo_buf = vzalloc(sizeof(struct sta_info) * NUM_STA 
+ 4);
   ^
drivers/staging/rtl8188eu/core/rtw_sta_mgt.c: In function '_rtw_free_sta_priv':
drivers/staging/rtl8188eu/core/rtw_sta_mgt.c:211:4: error: implicit declaration 
of function 'vfree' [-Werror=implicit-function-declaration]
vfree(pstapriv->pallocated_stainfo_buf);
^
drivers/staging/rtl8188eu/core/rtw_xmit.c: In function '_rtw_init_xmit_priv':
drivers/staging/rtl8188eu/core/rtw_xmit.c:94:2: error: implicit declaration of 
function 'vzalloc' [-Werror=implicit-function-declaration]
  pxmitpriv->pallocated_frame_buf = vzalloc(NR_XMITFRAME * sizeof(struct 
xmit_frame) + 4);
  ^
drivers/staging/rtl8188eu/core/rtw_xmit.c:94:34: warning: assignment makes 
pointer from integer without a cast [enabled by default]
  pxmitpriv->pallocated_frame_buf = vzalloc(NR_XMITFRAME * sizeof(struct 
xmit_frame) + 4);
  ^
drivers/staging/rtl8188eu/core/rtw_xmit.c:132:32: warning: assignment makes 
pointer from integer without a cast [enabled by default]
  pxmitpriv->pallocated_xmitbuf = vzalloc(NR_XMITBUFF * sizeof(struct xmit_buf) 
+ 4);
^
drivers/staging/rtl8188eu/core/rtw_xmit.c:174:36: warning: assignment makes 
pointer from integer without a cast [enabled by default]
  pxmitpriv->pallocated_xmit_extbuf = vzalloc(num_xmit_extbuf * sizeof(struct 
xmit_buf) + 4);
^
drivers/staging/rtl8188eu/core/rtw_xmit.c: In function '_rtw_free_xmit_priv':
drivers/staging/rtl8188eu/core/rtw_xmit.c:262:3: error: implicit declaration of 
function 'vfree' [-Werror=implicit-function-declaration]
   vfree(pxmitpriv->pallocated_frame_buf);
   ^
drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c: In function 
'rtw_IOL_cmd_tx_pkt_buf_dump':
drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c:368:2: error: implicit 
declaration of function 'vzalloc' [-Werror=implicit-function-declaration]
  u8 *pbuf = vzalloc(data_len+10);
  ^

Re: [PATCH] staging : android : fix checkpatch issues

2014-02-09 Thread DaeSeok Youn
2014-02-10 13:26 GMT+09:00 Greg KH :
> On Mon, Feb 10, 2014 at 10:59:14AM +0900, Daeseok Youn wrote:
>> >From 1348300b03697d0499eddba6035a851d1278abd1 Mon Sep 17 00:00:00 2001
>> From: Daeseok Youn 
>> Date: Mon, 10 Feb 2014 10:45:30 +0900
>> Subject: [PATCH] staging : android : fix checkpatch issues
>>
>> drivers/staging/android/
>> ion/ion.c :
>>  - WARNNING: Unnecessary space after function pointer name
>>  - ERROR: return is not a function, parentheses are not required
>>  - WARNNING: Prefer seq_puts to seq_printf
>>  - WARNING: quoted string split across lines
>>
>> ion/ion_priv.h :
>>  - WARNING: Unnecessary space after function pointer name
>>
>> sync.h :
>>  - WARNING: missing space after return type
>>
>> timed_output.h :
>>  - WARNING: Multiple spaces after return type
>
> You are doing multiple things in different files, please break this up
> into smaller patches...
>
> thanks,
>
> greg k-h

Yes, I will break this into smaller patches and re-send.
Thanks.

Daeseok Youn
--
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 27/28] Remove ARC_HAS_COH_RTSC

2014-02-09 Thread Vineet Gupta
Hi Paul,

On Monday 10 February 2014 01:16 AM, Paul Bolle wrote:
>> The symbol is an orphan, get rid of it.
>> > 
>> > Signed-off-by: Richard Weinberger 
> Acked-by: Paul Bolle 
> 
> This Kconfig symbol was removed in commit 7d087a54aed ("ARC: [SMP]
> Disallow RTSC"), merged in v3.13.
> 

I've applied you ACK, with the fixed commit-id 7d0857a54aed

Thx,
-Vineet
--
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: make oldfonfig broken.

2014-02-09 Thread Gene Heskett
On Sunday 09 February 2014, Randy Dunlap wrote:
>On 02/09/2014 08:14 PM, Gene Heskett wrote:
>> On Sunday 09 February 2014, Randy Dunlap wrote:
>>> On 02/09/2014 07:46 PM, Gene Heskett wrote:
 On Sunday 09 February 2014, Randy Dunlap wrote:
> On 02/09/2014 07:07 PM, Ken Moffat wrote:
>> On Sun, Feb 09, 2014 at 06:05:41PM -0500, Gene Heskett wrote:
>>> On Sunday 09 February 2014, Paul Bolle wrote:
 Feel free to open a new thread, with the relevant details, and
 involve the relevant people and lists. I have no idea what you're
 going on about and could not care less (in the context of this
 thread).
 
 
 Paul Bolle
>>> 
>>> Been tried, got zero response.  Frankly, posting just to lkml,
>>> hoping the revalent people see it, is beginning to act like
>>> posting to a black hole.
>>> 
>>  I saw one response to you, from Randy Dunlap, asking for more
>> 
>> information : https://lkml.org/lkml/2014/2/8/153
> 
> wow, I don't know how I saw this message (thanks, Ken),
> but replying to this patch was NOT the right thing to do, Gene.
> 
> Just reply to my request and I'll be glad to look into it.
> 
>>  After your posts a few days ago, I'm tempted to suggest you check
>> 
>> your spam filters, and also any mail files your virus scanner might
>> have quarantined.  But it is also possible that you just haven't
>> received it - email is like that.
>> 
>> ط¤آ¸en
 
 Spam and viri filters watched carefully.  I also use mailfilter, and
 watch its logs full time for FP's.
>>> 
>>> Still -- this ATSC problem should not be part of a reply to the Remove
>>> DEPRECATED patch.
>> 
>> True.  But I got some attention.
>> 
 And I didn't reply because the question seemed way too broad, almost
 as if
>>> 
>>> what question seemed to broad?
>> 
>> You wanted to see "a" config, but I wanted to show the diffs. Also
>> yesterday I hadn't gone thru what I have yet to see where it falls
>> apart.
>> 
 my lament wasn't read.  That and the mail server doesn't like big
>>> 
>>> what mail server?  yours?  wdtv?  vger.kernel.org certainly has no
>>> problem with them.
>> 
>> I have gotten bounced from lkml because a screen shot pix of a failed
>> boot was too big.  Perhaps 18 months or so.  It was big, from a 10
>> megapixel camera.
>> 
 attachments. So rather than reply to the list, I'll excise some of
 the addresses that bounce from a reply_all or don't like me, and
 send the .config from a 3.019 build which seems ok, but by the time
 that config is run thru a make oldconfig at 3.8.2, most all the
 media, ATSC and DVB stuff is gone.  So I'll attach that one too. 
 The later file grew 22kb, but wholesale parts of the first one are
 missing from the 2nd.
>>> 
>>> Gene, I want to make sure where you are saying the problem is.
>>> Is it going directly from 3.019 to 3.8.2, with no intervening kernel
>>> versions?
>> 
>> No, one intermediate step in this case.
>> 
>> I started with 3.0.19, which was fine, took that one to 3.2.40, and
>> that one to 3.8.2 because I don't have anything between those here. 
>> Not exactly a step by step.
>
>and when you go from one kernel version to the next, do you use
>
>$ make oldconfig
>and answer all of its questions, or do you use

I generally answer all its questions, or take the default by hitting enter, 
but I do read all its questions.

>$ yes '' | make oldconfig

Never done that in all these years.

>or some other variant?  (I guess in your super build script.)

This is long before my "super script" gets fired off.

And that part is actually working well, run it as root, do a grub-update 
and reboot.

Cheers, Gene
-- 
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
Genes Web page 

NOTICE: Will pay 100 USD for an HP-4815A defective but
complete probe assembly.

--
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 04/28] Remove EXYNOS_DEV_SYSMMU

2014-02-09 Thread Sachin Kamat
+cc linux-samsung-soc list

On 10 February 2014 01:38, Paul Bolle  wrote:
> On Sun, 2014-02-09 at 19:47 +0100, Richard Weinberger wrote:
>> The symbol is an orphan, get rid of it.
>>
>> Signed-off-by: Richard Weinberger 
>> ---
>>  drivers/iommu/Kconfig | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig
>> index 79bbc21..20d062d 100644
>> --- a/drivers/iommu/Kconfig
>> +++ b/drivers/iommu/Kconfig
>> @@ -178,7 +178,7 @@ config TEGRA_IOMMU_SMMU
>>
>>  config EXYNOS_IOMMU
>>   bool "Exynos IOMMU Support"
>> - depends on ARCH_EXYNOS && EXYNOS_DEV_SYSMMU
>> + depends on ARCH_EXYNOS
>>   select IOMMU_API
>>   help
>> Support for the IOMMU(System MMU) of Samsung Exynos application
>
> I noted this one about a year ago (see
> https://lkml.org/lkml/2013/3/5/401 ). By now I wonder whether
> EXYNOS_IOMMU (and everything depending on it) shouldn't be removed. That
> code has been unbuildable for at least a year now  (I have not checked
> how much code is involved).


Please refer to some on-going discussion about it at [1].

[1] http://thread.gmane.org/gmane.linux.kernel.samsung-soc/26842

-- 
With warm regards,
Sachin
--
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 27/28] Remove ARC_HAS_COH_RTSC

2014-02-09 Thread Vineet Gupta
Hi Richard,

On Monday 10 February 2014 12:18 AM, Richard Weinberger wrote:
> The symbol is an orphan, get rid of it.
>
> Signed-off-by: Richard Weinberger 

Thanks for the cleanup. Applied to ARC for-next.

-Vineet

> ---
>  arch/arc/plat-arcfpga/Kconfig | 1 -
>  1 file changed, 1 deletion(-)
>
> diff --git a/arch/arc/plat-arcfpga/Kconfig b/arch/arc/plat-arcfpga/Kconfig
> index 295cefe..33058aa 100644
> --- a/arch/arc/plat-arcfpga/Kconfig
> +++ b/arch/arc/plat-arcfpga/Kconfig
> @@ -33,7 +33,6 @@ config ISS_SMP_EXTN
>   bool "ARC SMP Extensions (ISS Models only)"
>   default n
>   depends on SMP
> - select ARC_HAS_COH_RTSC
>   help
> SMP Extensions to ARC700, in a "simulation only" Model, supported in
> ARC ISS (Instruction Set Simulator).

--
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 v6 1/2] iio:as3935: Add DT binding docs for AS3935 driver

2014-02-09 Thread Matt Ranostay
Document compatible string, required and optional DT properties for
AS3935 chipset driver.

Signed-off-by: Matt Ranostay 
---
 .../devicetree/bindings/iio/proximity/as3935.txt   | 27 ++
 .../devicetree/bindings/vendor-prefixes.txt|  1 +
 2 files changed, 28 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/iio/proximity/as3935.txt

diff --git a/Documentation/devicetree/bindings/iio/proximity/as3935.txt 
b/Documentation/devicetree/bindings/iio/proximity/as3935.txt
new file mode 100644
index 000..0453254
--- /dev/null
+++ b/Documentation/devicetree/bindings/iio/proximity/as3935.txt
@@ -0,0 +1,27 @@
+Austrian Microsystems AS3935 Franklin lightning sensor device driver
+
+Required properties:
+   - compatible: must be "ams,as3935"
+   - reg: SPI chip select number for the device
+   - spi-cpha: SPI Mode 1. Refer to spi/spi-bus.txt for generic SPI
+   slave node bindings.
+   - interrupt-parent : should be the phandle for the interrupt controller
+   - interrupts : interrupt mapping
+
+   Refer to interrupt-controller/interrupts.txt for generic
+   interrupt client node bindings.
+
+Optional properties:
+   - ams,tune-cap: Calibration tuning capacitor stepping value 0 - 120pF.
+ This will require using the calibration data from the manufacturer.
+
+Example:
+
+as3935@0 {
+   compatible = "ams,as3935";
+   reg = <0>;
+   spi-cpha;
+   interrupt-parent = <>;
+   interrupts = <16 1>;
+   ams,tune-cap = <80>;
+};
diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt 
b/Documentation/devicetree/bindings/vendor-prefixes.txt
index e9d19e2..03e50ff 100644
--- a/Documentation/devicetree/bindings/vendor-prefixes.txt
+++ b/Documentation/devicetree/bindings/vendor-prefixes.txt
@@ -11,6 +11,7 @@ akAsahi Kasei Corp.
 allwinner  Allwinner Technology Co., Ltd.
 altr   Altera Corp.
 amcc   Applied Micro Circuits Corporation (APM, formally AMCC)
+amsAMS AG
 amstaosAMS-Taos Inc.
 apmApplied Micro Circuits Corporation (APM)
 armARM Ltd.
-- 
1.8.3.2

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


[PATCH v6 0/2] AS3935 lightning sensor support

2014-02-09 Thread Matt Ranostay
This series adds support for the AMS AS3935 lightning sensor that allows
reporting back estimated storm distance and strike events.

Changes from v5

* SPI write cache-aligned issues fixed 
* Fixed mutex_unlock's being missed
* Reports distance in meters instead of kilometers (1km steps)
* tune_cap is now in picofarads and not a register value

Matt Ranostay (2):
  iio:as3935: Add DT binding docs for AS3935 driver
  iio: Add AS3935 lightning sensor support

 .../ABI/testing/sysfs-bus-iio-proximity-as3935 |  18 +
 .../devicetree/bindings/iio/proximity/as3935.txt   |  27 ++
 .../devicetree/bindings/vendor-prefixes.txt|   1 +
 drivers/iio/Kconfig|   1 +
 drivers/iio/Makefile   |   1 +
 drivers/iio/proximity/Kconfig  |  19 +
 drivers/iio/proximity/Makefile |   6 +
 drivers/iio/proximity/as3935.c | 443 +
 8 files changed, 516 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-bus-iio-proximity-as3935
 create mode 100644 Documentation/devicetree/bindings/iio/proximity/as3935.txt
 create mode 100644 drivers/iio/proximity/Kconfig
 create mode 100644 drivers/iio/proximity/Makefile
 create mode 100644 drivers/iio/proximity/as3935.c

-- 
1.8.3.2

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


[PATCH v6 2/2] iio: Add AS3935 lightning sensor support

2014-02-09 Thread Matt Ranostay
AS3935 chipset can detect lightning strikes and reports those back as
events and the estimated distance to the storm.

Signed-off-by: Matt Ranostay 
---
 .../ABI/testing/sysfs-bus-iio-proximity-as3935 |  18 +
 drivers/iio/Kconfig|   1 +
 drivers/iio/Makefile   |   1 +
 drivers/iio/proximity/Kconfig  |  19 +
 drivers/iio/proximity/Makefile |   6 +
 drivers/iio/proximity/as3935.c | 443 +
 6 files changed, 488 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-bus-iio-proximity-as3935
 create mode 100644 drivers/iio/proximity/Kconfig
 create mode 100644 drivers/iio/proximity/Makefile
 create mode 100644 drivers/iio/proximity/as3935.c

diff --git a/Documentation/ABI/testing/sysfs-bus-iio-proximity-as3935 
b/Documentation/ABI/testing/sysfs-bus-iio-proximity-as3935
new file mode 100644
index 000..fc92bce
--- /dev/null
+++ b/Documentation/ABI/testing/sysfs-bus-iio-proximity-as3935
@@ -0,0 +1,18 @@
+What   /sys/bus/iio/devices/iio:deviceX/in_proximity_raw
+Date:  January 2014
+KernelVersion: 3.15
+Contact:   Matt Ranostay 
+Description:
+   Get the current distance in meters of storm (1km steps)
+   1000   = storm overhead
+   1000-4 = distance in meters
+   63000  = out of range
+
+What   /sys/bus/iio/devices/iio:deviceX/gain_boost
+Date:  January 2014
+KernelVersion: 3.15
+Contact:   Matt Ranostay 
+Description:
+   Show or set the gain boost of the amp, from 0-31 range.
+   18 = indoors (default)
+   14 = outdoors
diff --git a/drivers/iio/Kconfig b/drivers/iio/Kconfig
index 5dd0e12..743485e 100644
--- a/drivers/iio/Kconfig
+++ b/drivers/iio/Kconfig
@@ -74,6 +74,7 @@ if IIO_TRIGGER
source "drivers/iio/trigger/Kconfig"
 endif #IIO_TRIGGER
 source "drivers/iio/pressure/Kconfig"
+source "drivers/iio/proximity/Kconfig"
 source "drivers/iio/temperature/Kconfig"
 
 endif # IIO
diff --git a/drivers/iio/Makefile b/drivers/iio/Makefile
index 887d390..698afc2 100644
--- a/drivers/iio/Makefile
+++ b/drivers/iio/Makefile
@@ -24,5 +24,6 @@ obj-y += light/
 obj-y += magnetometer/
 obj-y += orientation/
 obj-y += pressure/
+obj-y += proximity/
 obj-y += temperature/
 obj-y += trigger/
diff --git a/drivers/iio/proximity/Kconfig b/drivers/iio/proximity/Kconfig
new file mode 100644
index 000..0c8cdf5
--- /dev/null
+++ b/drivers/iio/proximity/Kconfig
@@ -0,0 +1,19 @@
+#
+# Proximity sensors
+#
+
+menu "Lightning sensors"
+
+config AS3935
+   tristate "AS3935 Franklin lightning sensor"
+   select IIO_BUFFER
+   select IIO_TRIGGERED_BUFFER
+   depends on SPI
+   help
+ Say Y here to build SPI interface support for the Austrian
+ Microsystems AS3935 lightning detection sensor.
+
+ To compile this driver as a module, choose M here: the
+ module will be called as3935
+
+endmenu
diff --git a/drivers/iio/proximity/Makefile b/drivers/iio/proximity/Makefile
new file mode 100644
index 000..743adee
--- /dev/null
+++ b/drivers/iio/proximity/Makefile
@@ -0,0 +1,6 @@
+#
+# Makefile for IIO proximity sensors
+#
+
+# When adding new entries keep the list in alphabetical order
+obj-$(CONFIG_AS3935)   += as3935.o
diff --git a/drivers/iio/proximity/as3935.c b/drivers/iio/proximity/as3935.c
new file mode 100644
index 000..34e8f61
--- /dev/null
+++ b/drivers/iio/proximity/as3935.c
@@ -0,0 +1,443 @@
+/*
+ * as3935.c - Support for AS3935 Franklin lightning sensor
+ *
+ * Copyright (C) 2014 Matt Ranostay 
+ *
+ * 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 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+
+#define AS3935_AFE_GAIN0x00
+#define AS3935_AFE_MASK0x3F
+#define AS3935_AFE_GAIN_MAX0x1F
+#define AS3935_AFE_PWR_BIT BIT(0)
+
+#define AS3935_INT 0x03
+#define AS3935_INT_MASK0x07
+#define AS3935_EVENT_INT   BIT(3)
+#define AS3935_NOISE_INT   BIT(1)
+
+#define AS3935_DATA0x07
+#define AS3935_DATA_MASK   0x3F
+
+#define AS3935_TUNE_CAP0x08
+#define AS3935_CALIBRATE   0x3D
+
+#define AS3935_WRITE_DATA  BIT(15)
+#define AS3935_READ_DATA   BIT(14)
+#define 

[PATCH] perf tools: Fix the logic of thread__fork

2014-02-09 Thread Tony Lu
Revert the logic of checking the return value of thread__set_comm().

If thread__set_comm() returns zero without errors, we should not return
immediately, instead we should finish the rest of the clone work.
Otherwise, perf report would fail to resolve symbols sampled in forked
threads.

Signed-off-by: Zhigang Lu 
---
 tools/perf/util/thread.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/tools/perf/util/thread.c b/tools/perf/util/thread.c
index 49eaf1d..e394861 100644
--- a/tools/perf/util/thread.c
+++ b/tools/perf/util/thread.c
@@ -126,7 +126,7 @@ int thread__fork(struct thread *thread, struct thread 
*parent, u64 timestamp)
if (!comm)
return -ENOMEM;
err = thread__set_comm(thread, comm, timestamp);
-   if (!err)
+   if (err)
return err;
thread->comm_set = true;
}
-- 
1.7.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] nouveau/drm/fifo: fix ENG_RUNLIST register address

2014-02-09 Thread Ben Skeggs
On Fri, Feb 7, 2014 at 11:22 PM, Alexandre Courbot  wrote:
> Address of the ENG_RUNLIST register should be 0x002284 + (engine * 8),
> not 0x002284 + (engine * 4).
>
> Signed-off-by: Alexandre Courbot 
> ---
> Stumbled upon this one and I'm quite certain the offset was not correct.
> This is inconsequential for GK20A which only features one runlist, but
> other GPUs might run into troubles because of this. Not tested, just
> reported for your consideration.
I noticed this also while doing some other work I haven't committed
yet.  I'll push this patch ahead of that other work though.

Thanks,
Ben.

>
> FWIW, the Android GK20A driver uses the same offset calculation.
>
>  drivers/gpu/drm/nouveau/core/engine/fifo/nve0.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/nouveau/core/engine/fifo/nve0.c 
> b/drivers/gpu/drm/nouveau/core/engine/fifo/nve0.c
> index 99c9dee..dbc3ff6 100644
> --- a/drivers/gpu/drm/nouveau/core/engine/fifo/nve0.c
> +++ b/drivers/gpu/drm/nouveau/core/engine/fifo/nve0.c
> @@ -112,7 +112,7 @@ nve0_fifo_runlist_update(struct nve0_fifo_priv *priv, u32 
> engine)
>
> nv_wr32(priv, 0x002270, cur->addr >> 12);
> nv_wr32(priv, 0x002274, (engine << 20) | (p >> 3));
> -   if (!nv_wait(priv, 0x002284 + (engine * 4), 0x0010, 0x))
> +   if (!nv_wait(priv, 0x002284 + (engine * 8), 0x0010, 0x))
> nv_error(priv, "runlist %d update timeout\n", engine);
> mutex_unlock(_subdev(priv)->mutex);
>  }
> --
> 1.8.5.3
>
> ___
> dri-devel mailing list
> dri-de...@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] staging : android : fix checkpatch issues

2014-02-09 Thread Greg KH
On Mon, Feb 10, 2014 at 10:59:14AM +0900, Daeseok Youn wrote:
> >From 1348300b03697d0499eddba6035a851d1278abd1 Mon Sep 17 00:00:00 2001
> From: Daeseok Youn 
> Date: Mon, 10 Feb 2014 10:45:30 +0900
> Subject: [PATCH] staging : android : fix checkpatch issues
> 
> drivers/staging/android/
> ion/ion.c :
>  - WARNNING: Unnecessary space after function pointer name
>  - ERROR: return is not a function, parentheses are not required
>  - WARNNING: Prefer seq_puts to seq_printf
>  - WARNING: quoted string split across lines
> 
> ion/ion_priv.h :
>  - WARNING: Unnecessary space after function pointer name
> 
> sync.h :
>  - WARNING: missing space after return type
> 
> timed_output.h :
>  - WARNING: Multiple spaces after return type

You are doing multiple things in different files, please break this up
into smaller patches...

thanks,

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


Re: make oldfonfig broken.

2014-02-09 Thread Randy Dunlap
On 02/09/2014 08:14 PM, Gene Heskett wrote:
> On Sunday 09 February 2014, Randy Dunlap wrote:
>> On 02/09/2014 07:46 PM, Gene Heskett wrote:
>>> On Sunday 09 February 2014, Randy Dunlap wrote:
 On 02/09/2014 07:07 PM, Ken Moffat wrote:
> On Sun, Feb 09, 2014 at 06:05:41PM -0500, Gene Heskett wrote:
>> On Sunday 09 February 2014, Paul Bolle wrote:
>>> Feel free to open a new thread, with the relevant details, and
>>> involve the relevant people and lists. I have no idea what you're
>>> going on about and could not care less (in the context of this
>>> thread).
>>>
>>>
>>> Paul Bolle
>>
>> Been tried, got zero response.  Frankly, posting just to lkml,
>> hoping the revalent people see it, is beginning to act like posting
>> to a black hole.
>>
>  I saw one response to you, from Randy Dunlap, asking for more
>
> information : https://lkml.org/lkml/2014/2/8/153

 wow, I don't know how I saw this message (thanks, Ken),
 but replying to this patch was NOT the right thing to do, Gene.

 Just reply to my request and I'll be glad to look into it.

>  After your posts a few days ago, I'm tempted to suggest you check
>
> your spam filters, and also any mail files your virus scanner might
> have quarantined.  But it is also possible that you just haven't
> received it - email is like that.
>
> ط¤آ¸en
>>>
>>> Spam and viri filters watched carefully.  I also use mailfilter, and
>>> watch its logs full time for FP's.
>>
>> Still -- this ATSC problem should not be part of a reply to the Remove
>> DEPRECATED patch.
> 
> True.  But I got some attention.
> 
>>> And I didn't reply because the question seemed way too broad, almost as
>>> if
>>
>> what question seemed to broad?
> 
> You wanted to see "a" config, but I wanted to show the diffs. Also 
> yesterday I hadn't gone thru what I have yet to see where it falls apart.
>>
>>> my lament wasn't read.  That and the mail server doesn't like big
>>
>> what mail server?  yours?  wdtv?  vger.kernel.org certainly has no
>> problem with them.
> 
> I have gotten bounced from lkml because a screen shot pix of a failed boot 
> was too big.  Perhaps 18 months or so.  It was big, from a 10 megapixel 
> camera.
> 
>>> attachments. So rather than reply to the list, I'll excise some of the
>>> addresses that bounce from a reply_all or don't like me, and send the
>>> .config from a 3.019 build which seems ok, but by the time that config
>>> is run thru a make oldconfig at 3.8.2, most all the media, ATSC and
>>> DVB stuff is gone.  So I'll attach that one too.  The later file grew
>>> 22kb, but wholesale parts of the first one are missing from the 2nd.
>>
>> Gene, I want to make sure where you are saying the problem is.
>> Is it going directly from 3.019 to 3.8.2, with no intervening kernel
>> versions?
> 
> No, one intermediate step in this case.
> 
> I started with 3.0.19, which was fine, took that one to 3.2.40, and that 
> one to 3.8.2 because I don't have anything between those here.  Not exactly 
> a step by step.

and when you go from one kernel version to the next, do you use

$ make oldconfig
and answer all of its questions, or do you use

$ yes '' | make oldconfig

or some other variant?  (I guess in your super build script.)

>> I don't know what kernel version 3.019 is.  Do you mean 3.0.19?
> 
> Yes, Joanne Dow would call that a typu for sure.
> 
> Thanks Randy.
> 
> Cheers, Gene
> 

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


make oldfonfig broken.

2014-02-09 Thread Gene Heskett
On Sunday 09 February 2014, Randy Dunlap wrote:
>On 02/09/2014 07:46 PM, Gene Heskett wrote:
>> On Sunday 09 February 2014, Randy Dunlap wrote:
>>> On 02/09/2014 07:07 PM, Ken Moffat wrote:
 On Sun, Feb 09, 2014 at 06:05:41PM -0500, Gene Heskett wrote:
> On Sunday 09 February 2014, Paul Bolle wrote:
>> Feel free to open a new thread, with the relevant details, and
>> involve the relevant people and lists. I have no idea what you're
>> going on about and could not care less (in the context of this
>> thread).
>> 
>> 
>> Paul Bolle
> 
> Been tried, got zero response.  Frankly, posting just to lkml,
> hoping the revalent people see it, is beginning to act like posting
> to a black hole.
> 
  I saw one response to you, from Randy Dunlap, asking for more
 
 information : https://lkml.org/lkml/2014/2/8/153
>>> 
>>> wow, I don't know how I saw this message (thanks, Ken),
>>> but replying to this patch was NOT the right thing to do, Gene.
>>> 
>>> Just reply to my request and I'll be glad to look into it.
>>> 
  After your posts a few days ago, I'm tempted to suggest you check
 
 your spam filters, and also any mail files your virus scanner might
 have quarantined.  But it is also possible that you just haven't
 received it - email is like that.
 
 ط¤آ¸en
>> 
>> Spam and viri filters watched carefully.  I also use mailfilter, and
>> watch its logs full time for FP's.
>
>Still -- this ATSC problem should not be part of a reply to the Remove
>DEPRECATED patch.

True.  But I got some attention.

>> And I didn't reply because the question seemed way too broad, almost as
>> if
>
>what question seemed to broad?

You wanted to see "a" config, but I wanted to show the diffs. Also 
yesterday I hadn't gone thru what I have yet to see where it falls apart.
>
>> my lament wasn't read.  That and the mail server doesn't like big
>
>what mail server?  yours?  wdtv?  vger.kernel.org certainly has no
>problem with them.

I have gotten bounced from lkml because a screen shot pix of a failed boot 
was too big.  Perhaps 18 months or so.  It was big, from a 10 megapixel 
camera.

>> attachments. So rather than reply to the list, I'll excise some of the
>> addresses that bounce from a reply_all or don't like me, and send the
>> .config from a 3.019 build which seems ok, but by the time that config
>> is run thru a make oldconfig at 3.8.2, most all the media, ATSC and
>> DVB stuff is gone.  So I'll attach that one too.  The later file grew
>> 22kb, but wholesale parts of the first one are missing from the 2nd.
>
>Gene, I want to make sure where you are saying the problem is.
>Is it going directly from 3.019 to 3.8.2, with no intervening kernel
>versions?

No, one intermediate step in this case.

I started with 3.0.19, which was fine, took that one to 3.2.40, and that 
one to 3.8.2 because I don't have anything between those here.  Not exactly 
a step by step.

>I don't know what kernel version 3.019 is.  Do you mean 3.0.19?

Yes, Joanne Dow would call that a typu for sure.

Thanks Randy.

Cheers, Gene
-- 
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
Genes Web page 

NOTICE: Will pay 100 USD for an HP-4815A defective but
complete probe assembly.

--
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/8] ASoC: fsl: Add VF610 soc audio card Kconfig

2014-02-09 Thread li.xi...@freescale.com

> Subject: Re: [PATCH 1/8] ASoC: fsl: Add VF610 soc audio card Kconfig
> 
> On Sun, Jan 26, 2014 at 05:15:05AM +, li.xi...@freescale.com wrote:
> 
> > > ...for simple card since the whole idea is to support any CODEC with the
> > > same driver we should probably just make sure that all the individual
> > > drivers can be enabled in Kconfig, that way we don't have to have
> > > specific Kconfig entries for boards and loose some of the benefit of the
> > > generic card.  I sent a patch earlier exposing the OF supporting CODEC
> > > drivers, one for at least some of the Freescale CPU drivers was sent to
> > > the list recently too but there were some review comments.
> 
> > I hadn't found the patches, could you tell me the titles of them please?
> 
> My patch was "ASoC: codecs: Make OF supported CODECs visible in
> Kconfig".  I can't remember offhand what the patch for i.MX was called.

Yes, found it.

If so, shouldn't the CPU DAIs(such as I2S) also be invisible in Kconfig like
CODECs ?


Thanks very much.
--
Best Regards,
Xiubo

--
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 part1 v5 0/7] Introduce PCIe Device Serial Number capability support

2014-02-09 Thread Yijing Wang
This series is based on Bjorn's pci-next branch.
Currently, more and more PCIe devices support PCIe DSN(Device Serial Number)
capability, we can use this cap to identify device. In some platform,
when we hotplug PCIe device, no interrupts will be received in system.
So we can not identify the device whether is changed during suspend.
PCIe DSN can help to identify this. 

Legacy PCI device can achieve it by PCI Vital Product Data capability.
We can use its SN keyword to report the unique number.
But in my platform, PCI devices which support VPD SN cap report the
meaningless same string "0123456789". 
Rework PCI VPD code to support device identification is not an easy work.
Plan to do it in part2.

Yijing Wang (7):
  PCI: rework pci_find_next_ext_capability()
  PCI: introduce pci_bus_find_ext_capability()
  PCI: Add support for Device Serial Number capability
  PCI: Introduce pci_serial_number_changed()
  PCI: Add pci_dummy_ops to isolate pci device temporarily
  PCI: Check pci device serial number when scan device
  PCI: pciehp: Don't enable/disable slot on resume unless status
changed

 drivers/pci/hotplug/pciehp_core.c |   10 ++-
 drivers/pci/pci.c |  160 +++--
 drivers/pci/pci.h |2 +-
 drivers/pci/probe.c   |   15 +++-
 include/linux/pci.h   |9 ++-
 5 files changed, 182 insertions(+), 14 deletions(-)


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


[PATCH part1 v5 1/7] PCI: rework pci_find_next_ext_capability()

2014-02-09 Thread Yijing Wang
Rework pci_find_next_ext_capability(), use
pci_bus_read_config_xxx() instead of
pci_read_config_xxx(). So we can use this
function before pci_dev setup.

Signed-off-by: Yijing Wang 
---
 drivers/pci/pci.c   |   17 +
 include/linux/pci.h |2 +-
 2 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 1febe90..a263c0a 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -256,7 +256,8 @@ int pci_bus_find_capability(struct pci_bus *bus, unsigned 
int devfn, int cap)
 
 /**
  * pci_find_next_ext_capability - Find an extended capability
- * @dev: PCI device to query
+ * @bus: the PCI bus to query
+ * @devfn: PCI device to query
  * @start: address at which to start looking (0 to start at beginning of list)
  * @cap: capability code
  *
@@ -265,7 +266,7 @@ int pci_bus_find_capability(struct pci_bus *bus, unsigned 
int devfn, int cap)
  * not support it.  Some capabilities can occur several times, e.g., the
  * vendor-specific capability, and this provides a way to find them all.
  */
-int pci_find_next_ext_capability(struct pci_dev *dev, int start, int cap)
+int pci_find_next_ext_capability(struct pci_bus *bus, int devfn, int start, 
int cap)
 {
u32 header;
int ttl;
@@ -274,13 +275,10 @@ int pci_find_next_ext_capability(struct pci_dev *dev, int 
start, int cap)
/* minimum 8 bytes per capability */
ttl = (PCI_CFG_SPACE_EXP_SIZE - PCI_CFG_SPACE_SIZE) / 8;
 
-   if (dev->cfg_size <= PCI_CFG_SPACE_SIZE)
-   return 0;
-
if (start)
pos = start;
 
-   if (pci_read_config_dword(dev, pos, ) != PCIBIOS_SUCCESSFUL)
+   if (pci_bus_read_config_dword(bus, devfn, pos, ) != 
PCIBIOS_SUCCESSFUL)
return 0;
 
/*
@@ -298,7 +296,7 @@ int pci_find_next_ext_capability(struct pci_dev *dev, int 
start, int cap)
if (pos < PCI_CFG_SPACE_SIZE)
break;
 
-   if (pci_read_config_dword(dev, pos, ) != 
PCIBIOS_SUCCESSFUL)
+   if (pci_bus_read_config_dword(bus, devfn, pos, ) != 
PCIBIOS_SUCCESSFUL)
break;
}
 
@@ -322,7 +320,10 @@ EXPORT_SYMBOL_GPL(pci_find_next_ext_capability);
  */
 int pci_find_ext_capability(struct pci_dev *dev, int cap)
 {
-   return pci_find_next_ext_capability(dev, 0, cap);
+   if (dev->cfg_size <= PCI_CFG_SPACE_SIZE)
+   return 0;
+
+   return pci_find_next_ext_capability(dev->bus, dev->devfn, 0, cap);
 }
 EXPORT_SYMBOL_GPL(pci_find_ext_capability);
 
diff --git a/include/linux/pci.h b/include/linux/pci.h
index fb57c89..df495e9 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -796,7 +796,7 @@ enum pci_lost_interrupt_reason pci_lost_interrupt(struct 
pci_dev *dev);
 int pci_find_capability(struct pci_dev *dev, int cap);
 int pci_find_next_capability(struct pci_dev *dev, u8 pos, int cap);
 int pci_find_ext_capability(struct pci_dev *dev, int cap);
-int pci_find_next_ext_capability(struct pci_dev *dev, int pos, int cap);
+int pci_find_next_ext_capability(struct pci_bus *bus, int devfn, int pos, int 
cap);
 int pci_find_ht_capability(struct pci_dev *dev, int ht_cap);
 int pci_find_next_ht_capability(struct pci_dev *dev, int pos, int ht_cap);
 struct pci_bus *pci_find_next_bus(const struct pci_bus *from);
-- 
1.7.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 part1 v5 6/7] PCI: Check pci device serial number when scan device

2014-02-09 Thread Yijing Wang
Sometimes pci device will be removed and reinsert
while suspended. In this case system can not identify
the device has been changed. Now PCIe support Device
Serial Number Capability which has the unique number.
So make system check pci device DSN during scanning
device if support.

Signed-off-by: Yijing Wang 
---
 drivers/pci/probe.c |   13 -
 1 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 27d3e6f..370b25c 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -1383,11 +1383,22 @@ void pci_device_add(struct pci_dev *dev, struct pci_bus 
*bus)
 struct pci_dev *__ref pci_scan_single_device(struct pci_bus *bus, int devfn)
 {
struct pci_dev *dev;
+   int rescan = 0;
 
dev = pci_get_slot(bus, devfn);
if (dev) {
+   /* only check func 0 device */
+   if (PCI_FUNC(devfn) == 0) {
+   if (pci_serial_number_changed(dev)) {
+   pci_bus_freeze_device(bus);
+   pci_stop_and_remove_bus_device(dev);
+   pci_bus_unfreeze_device(bus);
+   rescan = 1;
+   }
+   }
pci_dev_put(dev);
-   return dev;
+   if (!rescan)
+   return dev;
}
 
dev = pci_scan_device(bus, devfn);
-- 
1.7.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 part1 v5 5/7] PCI: Add pci_dummy_ops to isolate pci device temporarily

2014-02-09 Thread Yijing Wang
Pci_dummy_ops does nothing when we use it to read/write
pci_device. So we can isolate pci device by replace its
bus pci_ops by pci_dummy_ops. This is preparation for
the later patch.

Signed-off-by: Yijing Wang 
---
 drivers/pci/pci.c   |   54 +++
 include/linux/pci.h |3 ++
 2 files changed, 57 insertions(+), 0 deletions(-)

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 8f31ab3..bbef95e 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -2225,6 +2225,60 @@ bool pci_serial_number_changed(struct pci_dev *pdev)
 }
 EXPORT_SYMBOL(pci_serial_number_changed);
 
+static int pci_dummy_read(struct pci_bus *bus, unsigned int devfn, 
+   int where, int size, u32 *val)
+{
+   return PCIBIOS_DEVICE_NOT_FOUND;
+}
+
+static int pci_dummy_write(struct pci_bus *bus, unsigned int devfn,
+   int reg, int size, u32 val)
+{
+   return PCIBIOS_DEVICE_NOT_FOUND;
+}
+
+static struct pci_ops pci_dummy_ops = {
+   .read = pci_dummy_read,
+   .write = pci_dummy_write,
+};
+
+static DEFINE_SPINLOCK(pci_freeze_lock);
+/**
+ * pci_bus_freeze_device - freeze pci bus to access pci device
+ * @bus: the pci bus to freeze
+ *
+ * Replace pci bus ops by pci_dummy_ops, protect system from
+ * accessing pci devices.
+ */
+void pci_bus_freeze_device(struct pci_bus *bus)
+{
+   struct pci_ops *ops;
+   unsigned long flags;
+
+   spin_lock_irqsave(_freeze_lock, flags);
+   ops = pci_bus_set_ops(bus, _dummy_ops);
+   bus->save_ops = ops;
+   spin_unlock_irqrestore(_freeze_lock, flags);
+}
+
+/**
+ * pci_bus_unfreeze_device - unfreeze pci bus to acess pci devices
+ * @bus: the pci bus to unfreeze
+ *
+ * Restore pci bus original ops, so pci bus can access
+ * pci devices normally.
+ */
+void pci_bus_unfreeze_device(struct pci_bus *bus)
+{
+   unsigned long flags;
+
+   BUG_ON(!bus->save_ops);
+   spin_lock_irqsave(_freeze_lock, flags);
+   pci_bus_set_ops(bus, bus->save_ops);
+   bus->save_ops = NULL;
+   spin_unlock_irqrestore(_freeze_lock, flags);
+}
+
 /**
  * pci_configure_ari - enable or disable ARI forwarding
  * @dev: the PCI device
diff --git a/include/linux/pci.h b/include/linux/pci.h
index d60c0b6..74dd968 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -442,6 +442,7 @@ struct pci_bus {
struct resource busn_res;   /* bus numbers routed to this bus */
 
struct pci_ops  *ops;   /* configuration access functions */
+   struct pci_ops  *save_ops;  /* save configuration access 
functions */
struct msi_chip *msi;   /* MSI controller */
void*sysdata;   /* hook for sys-specific extension */
struct proc_dir_entry *procdir; /* directory entry in /proc/bus/pci */
@@ -1026,6 +1027,8 @@ ssize_t pci_read_vpd(struct pci_dev *dev, loff_t pos, 
size_t count, void *buf);
 ssize_t pci_write_vpd(struct pci_dev *dev, loff_t pos, size_t count, const 
void *buf);
 
 bool pci_serial_number_changed(struct pci_dev *pdev);
+void pci_bus_freeze_device(struct pci_bus *bus);
+void pci_bus_unfreeze_device(struct pci_bus *bus);
 
 /* Helper functions for low-level code (drivers/pci/setup-[bus,res].c) */
 resource_size_t pcibios_retrieve_fw_addr(struct pci_dev *dev, int idx);
-- 
1.7.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 part1 v5 2/7] PCI: introduce pci_bus_find_ext_capability()

2014-02-09 Thread Yijing Wang
Sometimes we need to find PCI EXT CAP before
pci_dev set up. So introduce pci_bus_find_ext_capability(),
it will be used to get PCI EXT DSN before pci_dev set up.

Signed-off-by: Yijing Wang 
---
 drivers/pci/pci.c   |   31 +++
 include/linux/pci.h |1 +
 2 files changed, 32 insertions(+), 0 deletions(-)

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index a263c0a..432ac86 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -327,6 +327,37 @@ int pci_find_ext_capability(struct pci_dev *dev, int cap)
 }
 EXPORT_SYMBOL_GPL(pci_find_ext_capability);
 
+/**
+ * pci_bus_find_ext_capability - Find an extended capability
+ * @bus: the PCI bus to query
+ * @devfn: PCI device to query
+ * @cap: capability code
+ *
+ * Like pci_find_ext_capability() but works for pci devices that do not have a
+ * pci_dev structure set up yet.
+ *
+ * Returns the address of the requested capability structure within the
+ * device's PCI configuration space or 0 in case the device does not
+ * support it.
+ *
+ * */
+int pci_bus_find_ext_capability(struct pci_bus *bus, int devfn, int cap)
+{
+   int pos;
+   u32 status;
+
+   pos = pci_bus_find_capability(bus, devfn, PCI_CAP_ID_EXP);
+   if (!pos)
+   return 0;
+   
+   if (pci_bus_read_config_dword(bus, devfn, PCI_CFG_SPACE_SIZE, ) 
!= 
+   PCIBIOS_SUCCESSFUL || status == 0x)
+   return 0;
+   
+   return pci_find_next_ext_capability(bus, devfn, 0, cap);
+}
+
+
 static int __pci_find_next_ht_cap(struct pci_dev *dev, int pos, int ht_cap)
 {
int rc, ttl = PCI_FIND_CAP_TTL;
diff --git a/include/linux/pci.h b/include/linux/pci.h
index df495e9..470de02 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -797,6 +797,7 @@ int pci_find_capability(struct pci_dev *dev, int cap);
 int pci_find_next_capability(struct pci_dev *dev, u8 pos, int cap);
 int pci_find_ext_capability(struct pci_dev *dev, int cap);
 int pci_find_next_ext_capability(struct pci_bus *bus, int devfn, int pos, int 
cap);
+int pci_bus_find_ext_capability(struct pci_bus *bus, int devfn, int cap);
 int pci_find_ht_capability(struct pci_dev *dev, int ht_cap);
 int pci_find_next_ht_capability(struct pci_dev *dev, int pos, int ht_cap);
 struct pci_bus *pci_find_next_bus(const struct pci_bus *from);
-- 
1.7.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 part1 v5 7/7] PCI: pciehp: Don't enable/disable slot on resume unless status changed

2014-02-09 Thread Yijing Wang
Currently pciehp_resume() always enables the slot if it is occupied.  But
often the slot was already occupied before the suspend, so we complain like
this:

pciehp :00:1c.1:pcie04: Device :03:00.0 already exists at 
:03:00, cannot hot-add
pciehp :00:1c.1:pcie04: Cannot add device at :03:00

This patch only enables the slot if it was empty before the suspend and is
now occupied, i.e., a card was inserted while suspended.

Similarly, we only disable the slot if a card was removed while suspended.
If it was already empty before the suspend, we don't need to do anything.

[bhelgaas: changelog]
Tested-by: Paul Bolle 
Signed-off-by: Yijing Wang 
Signed-off-by: Bjorn Helgaas 
Cc: "Rafael J. Wysocki" 
Cc: Oliver Neukum 
Cc: Gu Zheng 
---
 drivers/pci/hotplug/pciehp_core.c |   10 +++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/pci/hotplug/pciehp_core.c 
b/drivers/pci/hotplug/pciehp_core.c
index 53b58de..551137f 100644
--- a/drivers/pci/hotplug/pciehp_core.c
+++ b/drivers/pci/hotplug/pciehp_core.c
@@ -317,6 +317,7 @@ static int pciehp_resume (struct pcie_device *dev)
 {
struct controller *ctrl;
struct slot *slot;
+   struct pci_bus *pbus = dev->port->subordinate;
u8 status;
 
ctrl = get_service_data(dev);
@@ -328,10 +329,13 @@ static int pciehp_resume (struct pcie_device *dev)
 
/* Check if slot is occupied */
pciehp_get_adapter_status(slot, );
-   if (status)
-   pciehp_enable_slot(slot);
-   else
+   if (status) {
+   if (list_empty(>devices))
+   pciehp_enable_slot(slot);
+   } else if (!list_empty(>devices)) {
pciehp_disable_slot(slot);
+   }
+
return 0;
 }
 #endif /* PM */
-- 
1.7.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 part1 v5 3/7] PCI: Add support for Device Serial Number capability

2014-02-09 Thread Yijing Wang
Add support for the Device Serial Number capability, so we can use the
unique device serial number to identify the physical device.  This helps
determine whether a device was replaced while the system was suspended.

[bhelgaas: changelog, drop pci_dsn_init(), spell out "serial_number"]
Reviewed-by: Gu Zheng 
Signed-off-by: Yijing Wang 
Signed-off-by: Bjorn Helgaas 
Cc: Paul Bolle 
Cc: "Rafael J. Wysocki" 
Cc: Oliver Neukum 
Cc: Gu Zheng 
---
 drivers/pci/pci.c   |   30 ++
 drivers/pci/pci.h   |2 +-
 drivers/pci/probe.c |2 ++
 include/linux/pci.h |1 +
 4 files changed, 34 insertions(+), 1 deletions(-)

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 432ac86..af06064 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -2168,6 +2168,36 @@ void pci_free_cap_save_buffers(struct pci_dev *dev)
 }
 
 /**
+ * pci_device_serial_number - get device serial number
+ * @bus: PCI bus the device on
+ * @devfn: the PCI device
+ *
+ * return the device serial number if device support,
+ * otherwise return 0.
+ */
+static u64 pci_device_serial_number(struct pci_bus *bus, int devfn)
+{
+   int pos;
+   u32 lo, hi;
+
+   if (!pci_bus_find_capability(bus, devfn, PCI_CAP_ID_EXP))
+   return 0;
+
+   pos = pci_bus_find_ext_capability(bus, devfn, PCI_EXT_CAP_ID_DSN);
+   if (!pos)
+   return 0;
+
+   pci_bus_read_config_dword(bus, devfn, pos + 4, );
+   pci_bus_read_config_dword(bus, devfn, pos + 8, );
+   return ((u64)hi << 32) | lo;
+}
+
+void pci_dsn_init(struct pci_dev *dev)
+{
+   dev->sn = pci_device_serial_number(dev->bus, dev->devfn);
+}
+
+/**
  * pci_configure_ari - enable or disable ARI forwarding
  * @dev: the PCI device
  *
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index 4df38df..685301a 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -208,7 +208,7 @@ void __ref __pci_bus_size_bridges(struct pci_bus *bus,
 void __ref __pci_bus_assign_resources(const struct pci_bus *bus,
  struct list_head *realloc_head,
  struct list_head *fail_head);
-
+void pci_dsn_init(struct pci_dev *dev);
 /**
  * pci_ari_enabled - query ARI forwarding status
  * @bus: the PCI bus
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 6e34498..27d3e6f 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -1324,6 +1324,8 @@ static void pci_init_capabilities(struct pci_dev *dev)
/* Vital Product Data */
pci_vpd_pci22_init(dev);
 
+   pci_dsn_init(dev);
+
/* Alternative Routing-ID Forwarding */
pci_configure_ari(dev);
 
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 470de02..3631859 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -354,6 +354,7 @@ struct pci_dev {
struct list_head msi_list;
const struct attribute_group **msi_irq_groups;
 #endif
+   u64 sn; /* device serial number, 0 if not support */
struct pci_vpd *vpd;
 #ifdef CONFIG_PCI_ATS
union {
-- 
1.7.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 part1 v5 4/7] PCI: Introduce pci_serial_number_changed()

2014-02-09 Thread Yijing Wang
Sometimes OS do not know the physical device swap,
for instance, some device hotplug during system suspend.
Interrupt can not deliver to OS in some platform.
So we can use pci serial number capability to detect this
issue if device supports serial number.

Signed-off-by: Yijing Wang 
Cc: Paul Bolle 
Cc: "Rafael J. Wysocki" 
Cc: Oliver Neukum 
Cc: Gu Zheng 
Cc: linux-...@vger.kernel.org
---
 drivers/pci/pci.c   |   28 
 include/linux/pci.h |2 ++
 2 files changed, 30 insertions(+), 0 deletions(-)

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index af06064..8f31ab3 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -2198,6 +2198,34 @@ void pci_dsn_init(struct pci_dev *dev)
 }
 
 /**
+ * pci_serial_number_changed - check the device SN is changed
+ * @pdev: the PCI device
+ *
+ * check the device serial number is changed.
+ * if device does not support device serial number,
+ * return false.
+ */
+bool pci_serial_number_changed(struct pci_dev *pdev)
+{
+   u64 old, new;
+   old = pdev->sn;
+
+   if (!pci_is_pcie(pdev))
+   return false;
+
+   new = pci_device_serial_number(pdev->bus,
+   pdev->devfn);
+
+   if (old != new) {
+   pr_info("%s: Device Serial Number Changed!\n",
+   pci_name(pdev));
+   return true;
+   } else
+   return false;
+}
+EXPORT_SYMBOL(pci_serial_number_changed);
+
+/**
  * pci_configure_ari - enable or disable ARI forwarding
  * @dev: the PCI device
  *
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 3631859..d60c0b6 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1025,6 +1025,8 @@ void pci_unlock_rescan_remove(void);
 ssize_t pci_read_vpd(struct pci_dev *dev, loff_t pos, size_t count, void *buf);
 ssize_t pci_write_vpd(struct pci_dev *dev, loff_t pos, size_t count, const 
void *buf);
 
+bool pci_serial_number_changed(struct pci_dev *pdev);
+
 /* Helper functions for low-level code (drivers/pci/setup-[bus,res].c) */
 resource_size_t pcibios_retrieve_fw_addr(struct pci_dev *dev, int idx);
 void pci_bus_assign_resources(const struct pci_bus *bus);
-- 
1.7.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/


Linux, UEFI, and Chromebooks (was RE: [PATCH 0/4] EFI 1:1 mapping)

2014-02-09 Thread Yuhong Bao
> On Mon, Jun 03, 2013 at 09:35:07AM -0700, James Bottomley wrote:
>> On Mon, 2013-06-03 at 17:24 +0100, Matthew Garrett wrote:
>>> That seems optimistic. Windows never calls QueryVariableInfo() during
>>> boot services, so what makes you think doing so has ever been tested?
>>
>> It's used by the UEFI shell package ... every system which boots to the
>> shell automatically tests this. I know no locked down UEFI system ships
>> with a shell but almost every system in test has a Shell in some form,
>> so I think its fairly safe to call it from boot services.
>
> Why do you persist in this belief that all system vendors are going to
> have run a shell, let alone any kind of test suite? That runs counter to
> everything we've learned about x86 firmware. People verify that it runs
> Windows and then ship it.
What is frustrating here is that Google decided that x86 Chromebooks should use 
different firmware, otherwise it would be easier to convince vendor to fix 
these firmware bugs.

Yuhong Bao--
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 -tip v6 00/22] kprobes: introduce NOKPROBE_SYMBOL(), cleanup and fixes crash bugs

2014-02-09 Thread Masami Hiramatsu
(2014/02/09 23:37), Ingo Molnar wrote:
> 
> * Masami Hiramatsu  wrote:
> 
>> I guess the second reason is why the stap takes so long time to set 
>> probes. stap tries to register kprobes without disabled flag, that 
>> means we enables thousands of probes (overheads).
>>
>> So the similar thing happens when we enables events as below;
>>
>>   # for i in /sys/kernel/debug/tracing/events/kprobes/* ; do date; echo 1 > 
>> $i; done
>>   Wed Jan 29 10:44:50 UTC 2014
>>   ...
>>
>> I tried it and canceled after 4 min passed. It enabled about 17k 
>> events and slowed down my system very much(I almost got hang check 
>> timer).
> 
> Ok, I guess that's the slowdown bug that Frank reported.
> 
>> I think we should have some performance statistics (hit count?) and 
>> if it goes over a threshold, we should stop enabling other events.
> 
> That really feels like a hack. How about fixing the root cause? Does 
> the enabling of all probes have to be so slow?

When I tried to use perf top, most of the time was consumed in
kprobe_ftrace_handler and optimized_callback, both of them
are the handler of kprobes. Since I just tried on a VM guest and it
didn't support NMI nor PMU, thus I have to use a bare metal machine
for deeper investigation (and I'll do).
And yes, it seems that the performance problem comes from probing
and tracing itself.

Thank you,

-- 
Masami HIRAMATSU
IT Management Research Dept. Linux Technology Center
Hitachi, Ltd., Yokohama Research Laboratory
E-mail: masami.hiramatsu...@hitachi.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/


Re: [PATCH 19/21] fs: Add prototype declaration to header file include/linux/syscalls.h

2014-02-09 Thread Josh Triplett
On Sun, Feb 09, 2014 at 06:58:34PM +0530, Rashika Kheria wrote:
> Add prototype declaration to header file include/linux/syscalls.h
> because it is used by more than one file.
> 
> This eliminates the following warning in quota/compat.c:
> fs/quota/compat.c:43:17: warning: no previous prototype for ‘sys32_quotactl’ 
> [-Wmissing-prototypes]
> 
> Signed-off-by: Rashika Kheria 

Reviewed-by: Josh Triplett 

>  include/linux/syscalls.h |5 +
>  1 file changed, 5 insertions(+)
> 
> diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
> index 40ed9e9..1f109ea 100644
> --- a/include/linux/syscalls.h
> +++ b/include/linux/syscalls.h
> @@ -198,6 +198,11 @@ extern struct trace_event_functions 
> exit_syscall_print_funcs;
>   }   \
>   static inline long SYSC##name(__MAP(x,__SC_DECL,__VA_ARGS__))
>  
> +#ifdef CONFIG_QUOTACTL_COMPAT
> +asmlinkage long sys32_quotactl(unsigned int cmd, const char __user *special,
> +qid_t id, void __user *addr);
> +#endif
> +
>  asmlinkage long sys_time(time_t __user *tloc);
>  asmlinkage long sys_stime(time_t __user *tptr);
>  asmlinkage long sys_gettimeofday(struct timeval __user *tv,
> -- 
> 1.7.9.5
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


linux-next: manual merge of the akpm-current tree with the rcu tree

2014-02-09 Thread Stephen Rothwell
Hi Andrew,

Today's linux-next merge of the akpm-current tree got a conflict in
mm/slub.c between commit f4e40a71719d ("slub: Fix add_full() lockdep
checks") from the rcu tree and commit aee03fe7a7c8 ("mm/slub.c: list_lock
may not be held in some circumstances") from the akpm-current tree.

These patches try to achieve the same thing, so I arbitrarily chose the
version from the akpm-current tree.

-- 
Cheers,
Stephen Rothwells...@canb.auug.org.au


pgpVbPvU_KMJ8.pgp
Description: PGP signature


Re: [PATCH 24/28] Remove DEPRECATED

2014-02-09 Thread Randy Dunlap
On 02/09/2014 07:46 PM, Gene Heskett wrote:
> On Sunday 09 February 2014, Randy Dunlap wrote:
>> On 02/09/2014 07:07 PM, Ken Moffat wrote:
>>> On Sun, Feb 09, 2014 at 06:05:41PM -0500, Gene Heskett wrote:
 On Sunday 09 February 2014, Paul Bolle wrote:
> Feel free to open a new thread, with the relevant details, and
> involve the relevant people and lists. I have no idea what you're
> going on about and could not care less (in the context of this
> thread).
>
>
> Paul Bolle

 Been tried, got zero response.  Frankly, posting just to lkml, hoping
 the revalent people see it, is beginning to act like posting to a
 black hole.

>>>  I saw one response to you, from Randy Dunlap, asking for more
>>>
>>> information : https://lkml.org/lkml/2014/2/8/153
>>
>> wow, I don't know how I saw this message (thanks, Ken),
>> but replying to this patch was NOT the right thing to do, Gene.
>>
>> Just reply to my request and I'll be glad to look into it.
>>
>>>  After your posts a few days ago, I'm tempted to suggest you check
>>>
>>> your spam filters, and also any mail files your virus scanner might
>>> have quarantined.  But it is also possible that you just haven't
>>> received it - email is like that.
>>>
>>> ؤ¸en
> 
> Spam and viri filters watched carefully.  I also use mailfilter, and watch 
> its logs full time for FP's.

Still -- this ATSC problem should not be part of a reply to the Remove 
DEPRECATED patch.


> And I didn't reply because the question seemed way too broad, almost as if 

what question seemed to broad?

> my lament wasn't read.  That and the mail server doesn't like big 

what mail server?  yours?  wdtv?  vger.kernel.org certainly has no problem with 
them.

> attachments. So rather than reply to the list, I'll excise some of the 
> addresses that bounce from a reply_all or don't like me, and send the 
> .config from a 3.019 build which seems ok, but by the time that config is 
> run thru a make oldconfig at 3.8.2, most all the media, ATSC and DVB stuff 
> is gone.  So I'll attach that one too.  The later file grew 22kb, but 
> wholesale parts of the first one are missing from the 2nd.

Gene, I want to make sure where you are saying the problem is.
Is it going directly from 3.019 to 3.8.2, with no intervening kernel versions?

I don't know what kernel version 3.019 is.  Do you mean 3.0.19?
or is that some distro numbering?

> 
> I've look at Makefile, but most Makefiles are swahili to me so I could be 
> looking at it and not recognizing it.
> 
> Thank you all.
> 
> Cheers, Gene
> 


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


Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-09 Thread Paul E. McKenney
On Mon, Feb 10, 2014 at 01:06:48AM +0100, Torvald Riegel wrote:
> On Thu, 2014-02-06 at 20:20 -0800, Paul E. McKenney wrote:
> > On Fri, Feb 07, 2014 at 12:44:48AM +0100, Torvald Riegel wrote:
> > > On Thu, 2014-02-06 at 14:11 -0800, Paul E. McKenney wrote:
> > > > On Thu, Feb 06, 2014 at 10:17:03PM +0100, Torvald Riegel wrote:
> > > > > On Thu, 2014-02-06 at 11:27 -0800, Paul E. McKenney wrote:
> > > > > > On Thu, Feb 06, 2014 at 06:59:10PM +, Will Deacon wrote:
> > > > > > > There are also so many ways to blow your head off it's untrue. 
> > > > > > > For example,
> > > > > > > cmpxchg takes a separate memory model parameter for failure and 
> > > > > > > success, but
> > > > > > > then there are restrictions on the sets you can use for each. 
> > > > > > > It's not hard
> > > > > > > to find well-known memory-ordering experts shouting "Just use
> > > > > > > memory_model_seq_cst for everything, it's too hard otherwise". 
> > > > > > > Then there's
> > > > > > > the fun of load-consume vs load-acquire (arm64 GCC completely 
> > > > > > > ignores consume
> > > > > > > atm and optimises all of the data dependencies away) as well as 
> > > > > > > the definition
> > > > > > > of "data races", which seem to be used as an excuse to miscompile 
> > > > > > > a program
> > > > > > > at the earliest opportunity.
> > > > > > 
> > > > > > Trust me, rcu_dereference() is not going to be defined in terms of
> > > > > > memory_order_consume until the compilers implement it both 
> > > > > > correctly and
> > > > > > efficiently.  They are not there yet, and there is currently no 
> > > > > > shortage
> > > > > > of compiler writers who would prefer to ignore memory_order_consume.
> > > > > 
> > > > > Do you have any input on
> > > > > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59448?  In particular, the
> > > > > language standard's definition of dependencies?
> > > > 
> > > > Let's see...  1.10p9 says that a dependency must be carried unless:
> > > > 
> > > > — B is an invocation of any specialization of std::kill_dependency 
> > > > (29.3), or
> > > > — A is the left operand of a built-in logical AND (&&, see 5.14) or 
> > > > logical OR (||, see 5.15) operator,
> > > > or
> > > > — A is the left operand of a conditional (?:, see 5.16) operator, or
> > > > — A is the left operand of the built-in comma (,) operator (5.18);
> > > > 
> > > > So the use of "flag" before the "?" is ignored.  But the "flag - flag"
> > > > after the "?" will carry a dependency, so the code fragment in 59448
> > > > needs to do the ordering rather than just optimizing "flag - flag" out
> > > > of existence.  One way to do that on both ARM and Power is to actually
> > > > emit code for "flag - flag", but there are a number of other ways to
> > > > make that work.
> > > 
> > > And that's what would concern me, considering that these requirements
> > > seem to be able to creep out easily.  Also, whereas the other atomics
> > > just constrain compilers wrt. reordering across atomic accesses or
> > > changes to the atomic accesses themselves, the dependencies are new
> > > requirements on pieces of otherwise non-synchronizing code.  The latter
> > > seems far more involved to me.
> > 
> > Well, the wording of 1.10p9 is pretty explicit on this point.
> > There are only a few exceptions to the rule that dependencies from
> > memory_order_consume loads must be tracked.  And to your point about
> > requirements being placed on pieces of otherwise non-synchronizing code,
> > we already have that with plain old load acquire and store release --
> > both of these put ordering constraints that affect the surrounding
> > non-synchronizing code.
> 
> I think there's a significant difference.  With acquire/release or more
> general memory orders, it's true that we can't order _across_ the atomic
> access.  However, we can reorder and optimize without additional
> constraints if we do not reorder.  This is not the case with consume
> memory order, as the (p + flag - flag) example shows.

Agreed, memory_order_consume does introduce additional restrictions.

> > This issue got a lot of discussion, and the compromise is that
> > dependencies cannot leak into or out of functions unless the relevant
> > parameters or return values are annotated with [[carries_dependency]].
> > This means that the compiler can see all the places where dependencies
> > must be tracked.  This is described in 7.6.4.
> 
> I wasn't aware of 7.6.4 (but it isn't referred to as an additional
> constraint--what it is--in 1.10, so I guess at least that should be
> fixed).
> Also, AFAIU, 7.6.4p3 is wrong in that the attribute does make a semantic
> difference, at least if one is assuming that normal optimization of
> sequential code is the default, and that maintaining things such as
> (flag-flag) is not; if optimizing away (flag-flag) would require the
> insertion of fences unless there is the carries_dependency attribute,
> then this would be bad I think.

No, the attribute does not 

Re: [PATCH 1/2] PPC: powernv: remove redundant cpuidle_idle_call()

2014-02-09 Thread Preeti U Murthy
Hi Peter,

On 02/07/2014 06:11 PM, Peter Zijlstra wrote:
> On Fri, Feb 07, 2014 at 05:11:26PM +0530, Preeti U Murthy wrote:
>> But observe the idle state "snooze" on powerpc. The power that this idle
>> state saves is through the lowering of the thread priority of the CPU.
>> After it lowers the thread priority, it is done. It cannot
>> "wait_for_interrupts". It will exit my_idle(). It is now upto the
>> generic idle loop to increase the thread priority if the need_resched
>> flag is set. Only an interrupt routine can increase the thread priority.
>> Else we will need to do it explicitly. And in such states which have a
>> polling nature, the cpu will not receive a reschedule IPI.
>>
>> That is why in the snooze_loop() we poll on need_resched. If it is set
>> we up the priority of the thread using HMT_MEDIUM() and then exit the
>> my_idle() loop. In case of interrupts, the priority gets automatically
>> increased.
> 
> You can poll without setting TS_POLLING/TIF_POLLING_NRFLAGS just fine
> and get the IPI if that is what you want.
> 
> Depending on how horribly unprovisioned the thread gets at the lowest
> priority, that might actually be faster than polling and raising the
> prio whenever it does get ran.

So I am assuming you mean something like the below:

my_idle()
{
   local_irq_enable();
   /* Remove the setting of the polling flag */
   HMT_low();
   return index;
}

And then exit into the generic idle loop. But the issue I see here is
that the TS_POLLING/TIF_POLLING_NRFLAGS gets set immediately. So, if on
testing need_resched() immediately after this returns that the
TIF_NEED_RESCHED flag is set, the thread will exit at low priority right?
 We could raise the priority of the thread in arch_cpu_idle_exit() soon
after setting the polling flag but that would mean for cases where the
TIF_NEED_RESCHED flag is not set we unnecessarily raise the priority of
the thread.

Thanks

Regards
Preeti U Murthy

> 

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


Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-09 Thread Paul E. McKenney
On Mon, Feb 10, 2014 at 01:27:51AM +0100, Torvald Riegel wrote:
> On Fri, 2014-02-07 at 10:02 -0800, Paul E. McKenney wrote:
> > On Fri, Feb 07, 2014 at 04:55:48PM +, Will Deacon wrote:

[ . . . ]

> > And then it is a short and uncontroversial step to the following:
> > 
> > Initial state: x == y == 0
> > 
> > T1: atomic_store_explicit(42, y, memory_order_relaxed);
> > r1 = atomic_load_explicit(x, memory_order_relaxed);
> > if (r1 != 42)
> > atomic_store_explicit(r1, y, memory_order_relaxed);
> > 
> > T2: r2 = atomic_load_explicit(y, memory_order_relaxed);
> > atomic_store_explicit(r2, x, memory_order_relaxed);
> > 
> > This can of course result in r1 == r2 == 42, even though the constant
> > 42 never appeared in the original code.  This is one way to generate
> > an out-of-thin-air value.
> > 
> > As near as I can tell, compiler writers hate the idea of prohibiting
> > speculative-store optimizations because it requires them to introduce
> > both control and data dependency tracking into their compilers.
> 
> I wouldn't characterize the situation like this (although I can't speak
> for others, obviously).  IMHO, it's perfectly fine on sequential /
> non-synchronizing code, because we know the difference isn't observable
> by a correct program.  For synchronizing code, compilers just shouldn't
> do it, or they would have to truly prove that speculation is harmless.
> That will be hard, so I think it should just be avoided.
> 
> Synchronization code will likely have been tuned anyway (especially if
> it uses relaxed MO), so I don't see a large need for trying to optimize
> using speculative atomic stores.
> 
> Thus, I think there's an easy and practical solution.

I like this approach, but there has been resistance to it in the past.
Definitely worth a good try, though!

> > Many of
> > them seem to hate dependency tracking with a purple passion.  At least,
> > such a hatred would go a long way towards explaining the incomplete
> > and high-overhead implementations of memory_order_consume, the long
> > and successful use of idioms based on the memory_order_consume pattern
> > notwithstanding [*].  ;-)
> 
> I still think that's different because it blurs the difference between
> sequential code and synchronizing code (ie, atomic accesses).  With
> consume MO, the simple solution above doesn't work anymore, because
> suddenly synchronizing code does affect optimizations in sequential
> code, even if that wouldn't reorder across the synchronizing code (which
> would be clearly "visible" to the implementation of the optimization).

I understand that memory_order_consume is a bit harder on compiler
writers than the other memory orders, but it is also pretty valuable.

Thanx, Paul

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


WARNING: CPU: 1 PID: 0 at kernel/time/tick-broadcast.c:668 tick_broadcast_oneshot_control+0x17d/0x190()

2014-02-09 Thread poma

Let's have one last round of Champions!


[   83.558497] [ cut here ]
[   83.558503] WARNING: CPU: 1 PID: 0 at
kernel/time/tick-broadcast.c:668
tick_broadcast_oneshot_control+0x17d/0x190()
[   83.558527] Modules linked in: ipt_MASQUERADE iptable_nat nf_nat_ipv4
nf_nat nf_conntrack_ipv4 nf_defrag_ipv4 xt_conntrack nf_conntrack
xt_CHECKSUM iptable_mangle fuse ip6table_filter ip6_tables ebtable_nat
ebtables kvm_amd kvm ppdev microcode serio_raw nouveau mxm_wmi video
i2c_algo_bit ttm edac_core edac_mce_amd drm_kms_helper k10temp drm
parport_serial parport_pc parport wmi shpchp i2c_nforce2 i2c_core
acpi_cpufreq nfsd auth_rpcgss nfs_acl lockd sunrpc binfmt_misc
ata_generic pata_acpi pata_amd 8021q garp mrp tun bridge stp llc bonding
[   83.558530] CPU: 1 PID: 0 Comm: swapper/1 Tainted: GW
3.14.0-0.rc1.git5.1.fc21.1.x86_64 #1
[   83.558530] Hardware name: Gigabyte Technology Co., Ltd.
M720-US3/M720-US3, BIOS F7n 09/07/2010
[   83.558533]   184f2fadf588e594 880128bb9dd0
817cf05d
[   83.558535]   880128bb9e08 810966cd
0001
[   83.558536]  0001 88012a80df00 0092
81c28940
[   83.558537] Call Trace:
[   83.558541]  [] dump_stack+0x4d/0x66
[   83.558544]  [] warn_slowpath_common+0x7d/0xa0
[   83.558545]  [] warn_slowpath_null+0x1a/0x20
[   83.558547]  []
tick_broadcast_oneshot_control+0x17d/0x190
[   83.558549]  [] clockevents_notify+0x178/0x1a0
[   83.558551]  [] amd_e400_idle+0x87/0x130
[   83.558553]  [] arch_cpu_idle+0x2e/0x40
[   83.558555]  [] cpu_startup_entry+0xf5/0x420
[   83.558558]  [] start_secondary+0x240/0x300
[   83.558559] ---[ end trace d6d150ba17d5207c ]---


https://bugzilla.redhat.com/attachment.cgi?id=861203
https://bugzilla.redhat.com/show_bug.cgi?id=1063108
Also,
https://bugzilla.redhat.com/show_bug.cgi?id=1033310
https://bugzilla.redhat.com/show_bug.cgi?id=1031296
https://bugzilla.redhat.com/show_bug.cgi?id=996973
https://bugzilla.redhat.com/show_bug.cgi?id=989718

>From kernel-3.10 to 3.14,
http://thread.gmane.org/gmane.linux.kernel/1529924
http://thread.gmane.org/gmane.linux.power-management.general/37437


poma


At 600km above planet Earth the temperature
fluctuates between +125 and -100 degrees Celsius

There is nothing to carry sound
No air pressure
No oxygen

Life in space is impossible

LINUX KERNEL LIST


--
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 3.14-rc2

2014-02-09 Thread Stephen Rothwell
Hi Linus,

> Anyway, what little there was looks normal: roughly two thirds drivers
> (gpu, block, media, misc), with almost half the remaining patches
> being architecture updates (x86, s390 and arm64). With the rest being
> filesystems (vfs, nfs, ocfs, btrfs and some kernfs fixes), some mm
> noise, and tooling (perf).

Any reason that "tree-wide: clean up no longer required #include
" from Paul Gortmaker did not make the cut?  Google ate the
pull request?  Or just waiting a bit?
-- 
Cheers,
Stephen Rothwells...@canb.auug.org.au


pgpdAVZNnfZh5.pgp
Description: PGP signature


Linux 3.14-rc2

2014-02-09 Thread Linus Torvalds
It's been pretty quiet, actually, which should make me happy. But I
have a suspicious nature, and I'm going to wait to see if the other
shoe drops, and people are just lulling me into a false sense of
security. Because I know kernel developers, and they are sneaky.  I
suspect Davem (to pick somebody not at random) is giggling to himself,
waiting for this release message, planning to send me some big-ass
pull request tomorrow.

Because that's the kind of people you guys are.

Anyway, what little there was looks normal: roughly two thirds drivers
(gpu, block, media, misc), with almost half the remaining patches
being architecture updates (x86, s390 and arm64). With the rest being
filesystems (vfs, nfs, ocfs, btrfs and some kernfs fixes), some mm
noise, and tooling (perf).

Shortlog appended, which doesn't always happen for rc2.

 Linus

---

Aaro Koskinen (1):
  MIPS: fpu.h: Fix build when CONFIG_BUG is not set

Adam Thomson (1):
  hwmon: (da9055) Remove use of regmap_irq_get_virq()

Adrian Hunter (9):
  perf symbols: Fix symbol annotation for relocated kernel
  perf tools: Add kallsyms__get_function_start()
  perf machine: Add machine__get_kallsyms_filename()
  perf machine: Set up ref_reloc_sym in machine__create_kernel_maps()
  perf record: Get ref_reloc_sym from kernel map
  perf symbols: Prevent the use of kcore if the kernel has moved
  perf tests: No need to set up ref_reloc_sym
  perf tools: Adjust kallsyms for relocated kernel
  perf buildid-cache: Check relocation when checking for existing kcore

Al Viro (2):
  fix O_SYNC|O_APPEND syncing the wrong range on write()
  fix a kmap leak in virtio_console

Alan (1):
  x86, doc, kconfig: Fix dud URL for Microcode data

Alexey Khoroshilov (1):
  [media] go7007-loader: fix usb_dev leak

Andi Shyti (2):
  [media] cx24117: remove dead code in always 'false' if statement
  [media] cx24117: use a valid dev pointer for dev_err printout

Andrzej Hajda (1):
  [media] s5k5baf: allow to handle arbitrary long i2c sequences

Antti Palosaari (1):
  [media] af9035: add ID [2040:f900] Hauppauge WinTV-MiniStick 2

Aravind Gopalakrishnan (1):
  x86/quirks: Add workaround for AMD F16h Erratum792

Avi Kivity (1):
  perf tools: Demangle kernel and kernel module symbols too

Baruch Siach (1):
  perf/doc: Remove mention of non-existent
set_perf_event_pending() from design.txt

Borislav Petkov (1):
  x86, microcode, AMD: Unify valid container checks

Catalin Marinas (2):
  arm64: Invalidate the TLB when replacing pmd entries during boot
  arm64: compat: Wire up new AArch32 syscalls

Chris Ruehl (2):
  pinctrl: imx27: fix wrong offset to ICONFB
  pinctrl: imx27: fix offset calculation in imx_read_2bit

Colin Cross (1):
  security: select correct default LSM_MMAP_MIN_ADDR on arm on arm64

Dan Carpenter (3):
  x86/AMD/NB: Fix amd_set_subcaches() parameter type
  ACPI / utils: remove a pointless NULL check
  ACPI / proc: remove unneeded NULL check

Daniel Tang (1):
  irqchip: Add support for TI-NSPIRE irqchip

Dave Airlie (3):
  drm/mgag200: fix typo causing bw limits to be ignored on some chips
  drm/mgag200,ast,cirrus: fix regression with drm_can_sleep conversion
  drm/radeon: allow geom rings to be setup on r600/r700 (v2)

Dave Jones (3):
  [media] mxl111sf: Fix unintentional garbage stack read
  [media] mxl111sf: Fix compile when CONFIG_DVB_USB_MXL111SF is unset
  vmwgfx: Fix unitialized stack read in vmw_setup_otable_base

Dave Kleikamp (1):
  jfs: fix generic posix ACL regression

David Cohen (1):
  x86/intel/mid: Fix X86_INTEL_MID dependencies

David Sterba (1):
  btrfs: reserve no transaction units in btrfs_ioctl_set_features

Dirk Brandewie (1):
  intel_pstate: Take core C0 time into account for core busy calculation

Filipe David Borba Manana (3):
  Btrfs: use btrfs_crc32c everywhere instead of libcrc32c
  Btrfs: use late_initcall instead of module_init
  Btrfs: fix data corruption when reading/updating compressed extents

Florian Vaussard (1):
  pinctrl: do not init debugfs entries for unimplemented functionalities

Francesco Fusco (1):
  perf tools: Fix include for non x86 architectures

Guenter Roeck (1):
  hwmon: (pmbus) Support per-page exponent in linear mode

Haiyan Hu (1):
  NVMe: Avoid shift operation when writing cq head doorbell

Hans Verkuil (1):
  [media] Revert "[media] videobuf_vm_{open,close} race fixes"

Harald Freudenberger (3):
  crypto: s390 - fix concurrency issue in aes-ctr mode
  crypto: s390 - fix des and des3_ede cbc concurrency issue
  crypto: s390 - fix des and des3_ede ctr concurrency issue

Ilya Dryomov (4):
  libceph: fix error handling in ceph_osdc_init()
  libceph: factor out logic from ceph_osdc_start_request()
  libceph: take map_sem for read in handle_reply()
  libceph: do not dereference a 

Re: [PATCHv2 2/2] arm: Get rid of meminfo

2014-02-09 Thread Laura Abbott

On 2/6/2014 6:09 PM, Courtney Cavin wrote:

On Wed, Feb 05, 2014 at 01:02:31AM +0100, Laura Abbott wrote:

memblock is now fully integrated into the kernel and is the prefered
method for tracking memory. Rather than reinvent the wheel with
meminfo, migrate to using memblock directly instead of meminfo as
an intermediate.

Signed-off-by: Laura Abbott 

[...]

diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c
index 0b11c1a..51d814e 100644
--- a/arch/arm/mach-pxa/spitz.c
+++ b/arch/arm/mach-pxa/spitz.c
@@ -32,6 +32,7 @@
  #include 
  #include 
  #include 
+#include 

  #include 
  #include 
@@ -971,13 +972,9 @@ static void __init spitz_init(void)
 spitz_i2c_init();
  }

-static void __init spitz_fixup(struct tag *tags, char **cmdline,
-  struct meminfo *mi)
+static void __init spitz_fixup(struct tag *tags, char **cmdline)
  {
-   sharpsl_save_param();
-   mi->nr_banks = 1;
-   mi->bank[0].start = 0xa000;
-   mi->bank[0].size = (64*1024*1024);
+   memblock_addr(0xa000, SZ_64M);


memblock_add() ?

Yes, that was a typo on my part. I'll send out a v3 with collected acks.



-Courtney




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


Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-09 Thread Paul E. McKenney
On Mon, Feb 10, 2014 at 01:27:51AM +0100, Torvald Riegel wrote:
> On Fri, 2014-02-07 at 10:02 -0800, Paul E. McKenney wrote:
> > On Fri, Feb 07, 2014 at 04:55:48PM +, Will Deacon wrote:
> > > Hi Paul,
> > > 
> > > On Fri, Feb 07, 2014 at 04:50:28PM +, Paul E. McKenney wrote:
> > > > On Fri, Feb 07, 2014 at 08:44:05AM +0100, Peter Zijlstra wrote:
> > > > > On Thu, Feb 06, 2014 at 08:20:51PM -0800, Paul E. McKenney wrote:
> > > > > > Hopefully some discussion of out-of-thin-air values as well.
> > > > > 
> > > > > Yes, absolutely shoot store speculation in the head already. Then 
> > > > > drive
> > > > > a wooden stake through its hart.
> > > > > 
> > > > > C11/C++11 should not be allowed to claim itself a memory model until 
> > > > > that
> > > > > is sorted.
> > > > 
> > > > There actually is a proposal being put forward, but it might not make 
> > > > ARM
> > > > and Power people happy because it involves adding a compare, a branch,
> > > > and an ISB/isync after every relaxed load...  Me, I agree with you,
> > > > much preferring the no-store-speculation approach.
> > > 
> > > Can you elaborate a bit on this please? We don't permit speculative stores
> > > in the ARM architecture, so it seems counter-intuitive that GCC needs to
> > > emit any additional instructions to prevent that from happening.
> > 
> > Requiring a compare/branch/ISB after each relaxed load enables a simple(r)
> > proof that out-of-thin-air values cannot be observed in the face of any
> > compiler optimization that refrains from reordering a prior relaxed load
> > with a subsequent relaxed store.
> > 
> > > Stores can, of course, be observed out-of-order but that's a lot more
> > > reasonable :)
> > 
> > So let me try an example.  I am sure that Torvald Riegel will jump in
> > with any needed corrections or amplifications:
> > 
> > Initial state: x == y == 0
> > 
> > T1: r1 = atomic_load_explicit(x, memory_order_relaxed);
> > atomic_store_explicit(r1, y, memory_order_relaxed);
> > 
> > T2: r2 = atomic_load_explicit(y, memory_order_relaxed);
> > atomic_store_explicit(r2, x, memory_order_relaxed);
> > 
> > One would intuitively expect r1 == r2 == 0 as the only possible outcome.
> > But suppose that the compiler used specialization optimizations, as it
> > would if there was a function that has a very lightweight implementation
> > for some values and a very heavyweight one for other.  In particular,
> > suppose that the lightweight implementation was for the value 42.
> > Then the compiler might do something like the following:
> > 
> > Initial state: x == y == 0
> > 
> > T1: r1 = atomic_load_explicit(x, memory_order_relaxed);
> > if (r1 == 42)
> > atomic_store_explicit(42, y, memory_order_relaxed);
> > else
> > atomic_store_explicit(r1, y, memory_order_relaxed);
> > 
> > T2: r2 = atomic_load_explicit(y, memory_order_relaxed);
> > atomic_store_explicit(r2, x, memory_order_relaxed);
> > 
> > Suddenly we have an explicit constant 42 showing up.  Of course, if
> > the compiler carefully avoided speculative stores (as both Peter and
> > I believe that it should if its code generation is to be regarded as
> > anything other than an act of vandalism, the words in the standard
> > notwithstanding), there would be no problem.  But currently, a number
> > of compiler writers see absolutely nothing wrong with transforming
> > the optimized-for-42 version above with something like this:
> > 
> > Initial state: x == y == 0
> > 
> > T1: r1 = atomic_load_explicit(x, memory_order_relaxed);
> > atomic_store_explicit(42, y, memory_order_relaxed);
> > if (r1 != 42)
> > atomic_store_explicit(r1, y, memory_order_relaxed);
> > 
> > T2: r2 = atomic_load_explicit(y, memory_order_relaxed);
> > atomic_store_explicit(r2, x, memory_order_relaxed);
> 
> Intuitively, this is wrong because this let's the program take a step
> the abstract machine wouldn't do.  This is different to the sequential
> code that Peter posted because it uses atomics, and thus one can't
> easily assume that the difference is not observable.
> 
> For this to be correct, the compiler would actually have to prove that
> the speculative store is "as-if correct", which in turn would mean that
> it needs to be aware of all potential observers, and check whether those
> observers aren't actually affected by the speculative store.
> 
> I would guess that the compilers you have in mind don't really do that.
> If they do, then I don't see why this should be okay, unless you think
> out-of-thin-air values are something good (which I wouldn't agree with).

OK, we agree that pulling the atomic store to y out of its "if" statement
is a bad thing.  Very good!  Now we just have to convince others on
the committee.  ;-)

Thanx, Paul

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More 

Re: [PATCH v1 07/10] perf/x86/uncore: allow more than one fixed counter per box

2014-02-09 Thread Yan, Zheng
On 02/03/2014 08:55 PM, Stephane Eranian wrote:
> This patch modifies some of the helper functions to support
> more than one fixed counter per uncore PCI PMU box.
> 
> Signed-off-by: Stephane Eranian 
> ---
>  arch/x86/kernel/cpu/perf_event_intel_uncore.c |4 ++--
>  arch/x86/kernel/cpu/perf_event_intel_uncore.h |   22 +-
>  2 files changed, 15 insertions(+), 11 deletions(-)
> 
> diff --git a/arch/x86/kernel/cpu/perf_event_intel_uncore.c 
> b/arch/x86/kernel/cpu/perf_event_intel_uncore.c
> index 2980994c..69a4ad0 100644
> --- a/arch/x86/kernel/cpu/perf_event_intel_uncore.c
> +++ b/arch/x86/kernel/cpu/perf_event_intel_uncore.c
> @@ -2777,8 +2777,8 @@ static void uncore_assign_hw_event(struct 
> intel_uncore_box *box, struct perf_eve
>   hwc->idx = idx;
>   hwc->last_tag = ++box->tags[idx];
>  
> - if (hwc->idx == UNCORE_PMC_IDX_FIXED) {
> - hwc->event_base = uncore_fixed_ctr(box);
> + if (hwc->idx >= UNCORE_PMC_IDX_FIXED) {
> + hwc->event_base = uncore_fixed_ctr(box, idx);
>   hwc->config_base = uncore_fixed_ctl(box);
>   return;
>   }
> diff --git a/arch/x86/kernel/cpu/perf_event_intel_uncore.h 
> b/arch/x86/kernel/cpu/perf_event_intel_uncore.h
> index 433c180..c63a3ff 100644
> --- a/arch/x86/kernel/cpu/perf_event_intel_uncore.h
> +++ b/arch/x86/kernel/cpu/perf_event_intel_uncore.h
> @@ -538,9 +538,18 @@ static inline unsigned uncore_pci_fixed_ctl(struct 
> intel_uncore_box *box)
>   return box->pmu->type->fixed_ctl;
>  }
>  
> -static inline unsigned uncore_pci_fixed_ctr(struct intel_uncore_box *box)
> +static inline int uncore_fixed_ctr_bits(struct intel_uncore_box *box)
> +{
> + return box->pmu->type->fixed_ctr_bits;
> +}
> +
> +static inline unsigned uncore_pci_fixed_ctr(struct intel_uncore_box *box,
> + int idx)
>  {
> - return box->pmu->type->fixed_ctr;
> + int bits = uncore_fixed_ctr_bits(box);
> + int bytes = round_up(bits, 8);
> +
> + return idx * bytes + box->pmu->type->fixed_ctr;
>  }

should this be:
int bytes = round_up(bits, 32) / 8;
return (idx - UNCORE_PMC_IDX_FIXED) * bytes + box->pmu->type->fixed_ctr;
?

Regards
Yan, Zheng

>  
>  static inline
> @@ -554,11 +563,6 @@ static inline int uncore_perf_ctr_bits(struct 
> intel_uncore_box *box)
>   return box->pmu->type->perf_ctr_bits;
>  }
>  
> -static inline int uncore_fixed_ctr_bits(struct intel_uncore_box *box)
> -{
> - return box->pmu->type->fixed_ctr_bits;
> -}
> -
>  static inline
>  unsigned uncore_pci_perf_ctr(struct intel_uncore_box *box, int idx)
>  {
> @@ -627,10 +631,10 @@ unsigned uncore_fixed_ctl(struct intel_uncore_box *box)
>  }
>  
>  static inline
> -unsigned uncore_fixed_ctr(struct intel_uncore_box *box)
> +unsigned uncore_fixed_ctr(struct intel_uncore_box *box, int idx)
>  {
>   if (box->pci_dev)
> - return uncore_pci_fixed_ctr(box);
> + return uncore_pci_fixed_ctr(box, idx);
>   else
>   return uncore_msr_fixed_ctr(box);
>  }
> 

--
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 7/7] perf tools: Show absolute percentage by default

2014-02-09 Thread Namhyung Kim
Oops, please ignore this.  This was a leftover from last change.. sorry 
:(  (actually, it's same as patch 8/8).


Thanks,
Namhyung


2014-02-10 오전 11:47, Namhyung Kim 쓴 글:

Now perf report will show absolute percentage on filter entries by
default.

Suggested-by: Jiri Olsa 
Signed-off-by: Namhyung Kim 
---
  tools/perf/util/symbol.c | 1 -
  1 file changed, 1 deletion(-)

diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index b888cb241164..a9d758a3b371 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -33,7 +33,6 @@ struct symbol_conf symbol_conf = {
.try_vmlinux_path = true,
.annotate_src = true,
.demangle = true,
-   .filter_relative  = true,
.symfs= "",
  };



--
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][Trivial] tcp: correct code comment stating 3 min timeout for FIN_WAIT2, we only do 1 min

2014-02-09 Thread David Miller
From: Jesper Juhl 
Date: Sun, 9 Feb 2014 23:30:32 +0100 (CET)

> As far as I can tell we have used a default of 60 seconds for
> FIN_WAIT2 timeout for ages (since 2.x times??).
> 
> In any case, the timeout these days is 60 seconds, so the 3 min
> comment is wrong (and cost me a few minutes of my life when I was
> debugging a FIN_WAIT2 related problem in a userspace application and
> checked the kernel source for details).
> 
> Signed-off-by: Jesper Juhl 

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/


Re: [PATCH 24/28] Remove DEPRECATED

2014-02-09 Thread Randy Dunlap
On 02/09/2014 07:07 PM, Ken Moffat wrote:
> On Sun, Feb 09, 2014 at 06:05:41PM -0500, Gene Heskett wrote:
>> On Sunday 09 February 2014, Paul Bolle wrote:
>>>
>>> Feel free to open a new thread, with the relevant details, and involve
>>> the relevant people and lists. I have no idea what you're going on about
>>> and could not care less (in the context of this thread).
>>>
>>>
>>> Paul Bolle
>>
>> Been tried, got zero response.  Frankly, posting just to lkml, hoping the 
>> revalent people see it, is beginning to act like posting to a black hole.
>>
>  I saw one response to you, from Randy Dunlap, asking for more
> information : https://lkml.org/lkml/2014/2/8/153

wow, I don't know how I saw this message (thanks, Ken),
but replying to this patch was NOT the right thing to do, Gene.

Just reply to my request and I'll be glad to look into it.

>  After your posts a few days ago, I'm tempted to suggest you check
> your spam filters, and also any mail files your virus scanner might
> have quarantined.  But it is also possible that you just haven't
> received it - email is like that.
> 
> ĸen


-- 
~Randy
--
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   >