* [PATCH 1/4] powerpc: make POWER7 setup code generic name
From: Michael Neuling @ 2012-10-31 5:34 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: Michael Neuling, linuxppc-dev
We are going to reuse this in POWER8 so make the name generic.
Signed-off-by: Michael Neuling <mikey@neuling.org>
---
arch/powerpc/kernel/Makefile | 2 +-
.../{cpu_setup_power7.S => cpu_setup_power.S} | 0
2 files changed, 1 insertion(+), 1 deletion(-)
rename arch/powerpc/kernel/{cpu_setup_power7.S => cpu_setup_power.S} (100%)
diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile
index cde12f8..8f61934 100644
--- a/arch/powerpc/kernel/Makefile
+++ b/arch/powerpc/kernel/Makefile
@@ -38,7 +38,7 @@ obj-$(CONFIG_PPC64) += setup_64.o sys_ppc32.o \
paca.o nvram_64.o firmware.o
obj-$(CONFIG_HAVE_HW_BREAKPOINT) += hw_breakpoint.o
obj-$(CONFIG_PPC_BOOK3S_64) += cpu_setup_ppc970.o cpu_setup_pa6t.o
-obj-$(CONFIG_PPC_BOOK3S_64) += cpu_setup_power7.o
+obj-$(CONFIG_PPC_BOOK3S_64) += cpu_setup_power.o
obj64-$(CONFIG_RELOCATABLE) += reloc_64.o
obj-$(CONFIG_PPC_BOOK3E_64) += exceptions-64e.o idle_book3e.o
obj-$(CONFIG_PPC_A2) += cpu_setup_a2.o
diff --git a/arch/powerpc/kernel/cpu_setup_power7.S b/arch/powerpc/kernel/cpu_setup_power.S
similarity index 100%
rename from arch/powerpc/kernel/cpu_setup_power7.S
rename to arch/powerpc/kernel/cpu_setup_power.S
--
1.7.9.5
^ permalink raw reply related
* Re: [PATCH] powerpc/perf: Add missing L2 constraint handling in Power7 PMU
From: Paul Mackerras @ 2012-10-31 4:18 UTC (permalink / raw)
To: Michael Ellerman; +Cc: linuxppc-dev
In-Reply-To: <1351649396-31639-1-git-send-email-michael@ellerman.id.au>
On Wed, Oct 31, 2012 at 01:09:56PM +1100, Michael Ellerman wrote:
> If we have two cache events that require different settings of the L2SEL
> bits in MMCR1 then we can not schedule those events simultaneously. Add
> logic to the constraint handling to express that.
>
> Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Acked-by: Paul Mackerras <paulus@samba.org>
^ permalink raw reply
* [PATCH] i2c-cpm: Fix to takeback i2c bus master-ship after a collision
From: sachin surendran @ 2012-10-31 3:00 UTC (permalink / raw)
To: linuxppc-dev, jochen
[-- Attachment #1: Type: text/plain, Size: 1225 bytes --]
In case of collision on i2c bus the controller which lost bus mastership
stays as a slave
for all subsequent transfers. This results in the i2c controller never
writing to the bus
for future transactions, resulting in i2c transfer timeouts.
This fix checks for a collision on last I2C transaction and sets the
I2COM_MASTER
bit for the new transaction.
Signed-off-by: Sachin Surendran <sachin.surendran@alliedtelesis.co.nz>
---
drivers/i2c/busses/i2c-cpm.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/i2c/busses/i2c-cpm.c b/drivers/i2c/busses/i2c-cpm.c
index c1e1096..bb94c6d 100644
--- a/drivers/i2c/busses/i2c-cpm.c
+++ b/drivers/i2c/busses/i2c-cpm.c
@@ -338,6 +338,14 @@ static int cpm_i2c_xfer(struct i2c_adapter *adap,
struct i2c_msg *msgs, int num)
tptr = 0;
rptr = 0;
+ /*
+ * If there was a collision in the last i2c transaction,
+ * Set I2COM_MASTER as it was cleared during collision.
+ */
+ if (in_be16(&tbdf->cbd_sc) & BD_SC_CL) {
+ out_8(&cpm->i2c_reg->i2com, I2COM_MASTER);
+ }
+
while (tptr < num) {
pmsg = &msgs[tptr];
dev_dbg(&adap->dev, "R: %d T: %d\n", rptr, tptr);
[-- Attachment #2: Type: text/html, Size: 1736 bytes --]
^ permalink raw reply related
* [PATCH] powerpc/perf: Add missing L2 constraint handling in Power7 PMU
From: Michael Ellerman @ 2012-10-31 2:09 UTC (permalink / raw)
To: linuxppc-dev; +Cc: Paul Mackerras
If we have two cache events that require different settings of the L2SEL
bits in MMCR1 then we can not schedule those events simultaneously. Add
logic to the constraint handling to express that.
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
---
arch/powerpc/perf/power7-pmu.c | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/arch/powerpc/perf/power7-pmu.c b/arch/powerpc/perf/power7-pmu.c
index 441af08..2ee01e3 100644
--- a/arch/powerpc/perf/power7-pmu.c
+++ b/arch/powerpc/perf/power7-pmu.c
@@ -54,8 +54,10 @@
* Layout of constraint bits:
* 6666555555555544444444443333333333222222222211111111110000000000
* 3210987654321098765432109876543210987654321098765432109876543210
- * [ ><><><><><><>
- * NC P6P5P4P3P2P1
+ * < >< ><><><><><><>
+ * L2 NC P6P5P4P3P2P1
+ *
+ * L2 - 16-18 - Required L2SEL value (select field)
*
* NC - number of counters
* 15: NC error 0x8000
@@ -72,7 +74,7 @@
static int power7_get_constraint(u64 event, unsigned long *maskp,
unsigned long *valp)
{
- int pmc, sh;
+ int pmc, sh, unit;
unsigned long mask = 0, value = 0;
pmc = (event >> PM_PMC_SH) & PM_PMC_MSK;
@@ -90,6 +92,15 @@ static int power7_get_constraint(u64 event, unsigned long *maskp,
mask |= 0x8000;
value |= 0x1000;
}
+
+ unit = (event >> PM_UNIT_SH) & PM_UNIT_MSK;
+ if (unit == 6) {
+ /* L2SEL must be identical across events */
+ int l2sel = (event >> PM_L2SEL_SH) & PM_L2SEL_MSK;
+ mask |= 0x7 << 16;
+ value |= l2sel << 16;
+ }
+
*maskp = mask;
*valp = value;
return 0;
--
1.7.9.5
^ permalink raw reply related
* RE: [PATCH][V4] powerpc/fsl-pci: Add pci inbound/outbound PM support
From: Jia Hongtao-B38951 @ 2012-10-30 2:57 UTC (permalink / raw)
To: Jia Hongtao-B38951, Kumar Gala
Cc: Wood Scott-B07421, linuxppc-dev@lists.ozlabs.org, Li Yang-R58472
In-Reply-To: <412C8208B4A0464FA894C5F0C278CD5D01ADB25D@039-SN1MPN1-003.039d.mgd.msft.net>
Hi Kumar,
Since PCI controller PM support is inactive for a long while I'd
like to submit a new patch using re-setup atmu to restore PCI states.
Maybe the outbound IO issue during first bootup will be discussed
later when you have time.
- Hongtao.
> -----Original Message-----
> From: Jia Hongtao-B38951
> Sent: Wednesday, October 24, 2012 9:59 AM
> To: Jia Hongtao-B38951; Kumar Gala
> Cc: Wood Scott-B07421; linuxppc-dev@lists.ozlabs.org; Li Yang-R58472
> Subject: RE: [PATCH][V4] powerpc/fsl-pci: Add pci inbound/outbound PM
> support
>=20
> Hi Kumar,
>=20
> This PCI controller PM thing is pending for nearly a month without
> further discussion. Maybe it's time now to reach an agreement.
>=20
> - Hongtao.
>=20
>=20
>=20
> > -----Original Message-----
> > From: Jia Hongtao-B38951
> > Sent: Friday, October 19, 2012 12:15 PM
> > To: 'Kumar Gala'
> > Cc: Wood Scott-B07421; linuxppc-dev@lists.ozlabs.org; Li Yang-R58472
> > Subject: RE: [PATCH][V4] powerpc/fsl-pci: Add pci inbound/outbound PM
> > support
> >
> > > -----Original Message-----
> > > From: Kumar Gala [mailto:galak@kernel.crashing.org]
> > > Sent: Thursday, September 27, 2012 8:06 PM
> > > To: Jia Hongtao-B38951
> > > Cc: Wood Scott-B07421; linuxppc-dev@lists.ozlabs.org; Li Yang-R58472
> > > Subject: Re: [PATCH][V4] powerpc/fsl-pci: Add pci inbound/outbound
> > > PM support
> > >
> > > >>>>>>>>>>
> > > >>>>>>>>>> On Sep 17, 2012, at 9:10 PM, Jia Hongtao wrote:
> > > >>>>>>>>>>
> > > >>>>>>>>>>> Power supply for PCI inbound/outbound window registers
> > > >>>>>>>>>>> is off when system go to deep-sleep state. We save the
> > > >>>>>>>>>>> values of registers
> > > >>>>>>> before
> > > >>>>>>>>>>> suspend and restore to registers after resume.
> > > >>>>>>>>>>>
> > > >>>>>>>>>>> Signed-off-by: Jiang Yutang <b14898@freescale.com>
> > > >>>>>>>>>>> Signed-off-by: Jia Hongtao <B38951@freescale.com>
> > > >>>>>>>>>>> Signed-off-by: Li Yang <leoli@freescale.com>
> > > >>>>>>>>>>> ---
> > > >>>>>>>>>>> Changes for V4:
> > > >>>>>>>>>>> We just rebase the patch upon following patch:
> > > >>>>>>>>>>> powerpc/fsl-pci: Unify pci/pcie initialization code
> > > >>>>>>>>>>>
> > > >>>>>>>>>>> arch/powerpc/include/asm/pci-bridge.h | 2 +-
> > > >>>>>>>>>>> arch/powerpc/sysdev/fsl_pci.c | 121
> > > >>>>>>>>>> +++++++++++++++++++++++++++++++++
> > > >>>>>>>>>>> 2 files changed, 122 insertions(+), 1 deletions(-)
> > > >>>>>>>>>>
> > > >>>>>>>>>> Did you ever compare this to just re-parsing device tree
> > > method?
> > > >>>>>>>>>>
> > > >>>>>>>>>> - k
> > > >>>>>>>>>
> > > >>>>>>>>> I tested the re-parsing way by using setup_pci_atmu() when
> > > >> resume.
> > > >>>>>>>>> And I found out that re-parsing will *change* outbound IO
> > > >>>>>>>>> translation address regitster.
> > > >>>>>>>>>
> > > >>>>>>>>> It seems that in the first bootup, after setup_atmu()
> > > >>>>>>>>> pcibios_setup_phb_resources() may update
> > > >>>>>>>>> hose->io_resource, but atmu is not updated according to
> > > >>>>>>>>> the new
> > > >>>>>>>>> hose->io_resource
> > > value.
> > > >>>>>>>>> In resume from sleep setup_atmu() will reset atmu
> > > >>>>>>>>> according to the new hose->io_resource value. So the
> > > >>>>>>>>> setup_atmu() will cause different result on outbound IO
> > > >>>>>>>>> register between first bootup and resume from sleep.
> > > >>>>>>>>>
> > > >>>>>>>>> So... There's a possibility that in the first bootup atmu
> > > >>>>>>>>> is not setup properly.
> > > >>>>>>>>
> > > >>>>>>>> [Are you seeing this happen in your testing? If so its a
> > > >>>>>>>> bug we need
> > > >>>>>>> to look at fixing.]
> > > >>>>>>>>
> > > >>>>>>>> Yes, I see this in my testing.
> > > >>>>>>>> Also PCIe ethernet card works well after resuming from
> > > >>>>>>>> sleep in both
> > > >>>>>>> save/restore
> > > >>>>>>>> and re-parsing way. (Maybe PCIe ethernet card don't need
> > > >>>>>>>> outbound IO
> > > >>>>>>> resource)
> > > >>>>>>>> So, I guess the result of re-parsing (actually it's
> > > >>>>>>>> re-setup) is right
> > > >>>>>>> and ATMU is not setup
> > > >>>>>>>> properly at the first bootup.
> > > >>>>>>>
> > > >>>>>>> Are you seeing the following message - "PCI: I/O resource
> > > >>>>>>> not set for host bridge" ?
> > > >>>>>>
> > > >>>>>> No.
> > > >>>>>>
> > > >>>>>>>
> > > >>>>>>> Trying to understand why you'd hit the reassignment of
> > > io_resource.
> > > >>>>>>>
> > > >>>>>>> - k
> > > >>>>>>>
> > > >>>>>>
> > > >>>>>> I did some investigations and the conclusion is:
> > > >>>>>>
> > > >>>>>> io_resource.flags & IORESOURCE_IO are both positive but
> > > >>>>>> io_resource.start is 0 before pcibios_setup_phb_io_space() is
> > done.
> > > >>>>>>
> > > >>>>>> The sequence of related process listed below:
> > > >>>>>> fsl_add_bridge() -> setup_pci_atmu()
> > > >>>>>> pcibios_init() -> pcibios_scan_phb() ->
> > > >>>>>> pcibios_setup_phb_io_space()
> > > >>>>>>
> > > >>>>>> Because fsl_add_bridge() must be finished before
> > > >>>>>> pcibios_init() so ATMU is set when io_resource.start is 0.
> > > >>>>>> That means outbound IO regs are not set.
> > > >>>>>>
> > > >>>>>> If system re-setup ATMU the io_resource.start has already
> > > >>>>>> updated so outbound IO regs are set.
> > > >>>>>>
> > > >>>>>> My question is:
> > > >>>>>> Is there any problem if outbound IO regs are not set in first
> > > >> bootup?
> > > >>>
> > > >>> Yes, it means that IO transactions would not work.
> > > >>
> > > >> I agree.
> > > >>
> > > >>>
> > > >>>>> Please also provide the IO resource address range before and
> > > >>>>> after the pci scan. Then we can evaluate if the range is
> > > >>>>> needed to be mapped
> > > >>> via
> > > >>>>> ATMU.
> > > >>>>>
> > > >>>>> Leo
> > > >>>>
> > > >>>> Since potar is set by out_be32(&pci->pow[j].potar, (hose-
> > > >>>> io_resource.start >> 12); I provide the result of
> > > >>>> hose->io_resource.start >> 12 as follows:
> > > >>>>
> > > >>>> pcie@ffe09000:
> > > >>>> before pci scan: io_resource.start >> 12: 0 after pci scan :
> > > >>>> io_resource.start >> 12: ff7ed
> > > >>>>
> > > >>>> pcie@ffe0a000:
> > > >>>> before pci scan: io_resource.start >> 12: 0 after pci scan :
> > > >>>> io_resource.start >> 12: ff7db
> > > >>>>
> > > >>>> pcie@ffe0b000:
> > > >>>> before pci scan: io_resource.start >> 12: 0 after pci scan :
> > > >>>> io_resource.start >> 12: ff7c9
> > > >>>>
> > > >>>> Note that I tested on P1022DS.
> > > >>>>
> > > >>>> - Hongtao.
> > > >>>
> > > >>> 1. What's the device tree nodes for PCIe look like?
> > > >>> 2. Can you get the pr_debug() in setup_pci_atmu() to print and
> > > >>> report results (as well as full boot log)
> > > >>
> > > >> Please refer to the attached file.
> > > >> In the log file I also print the device tree.
> > > >>
> > > >> - Hongtao.
> > > >>
> > > >>>
> > > >>> However, I think the change of the io_resource.start is normal
> > > >>> and correct behavior.
> > > >>>
> > > >>> - k
> > > >>>
> > > >>
> > > >
> > > > Hi Kumar,
> > > > I have already sent the log.
> > > > Do you have any comment on it?
> > > >
> > > > Thanks.
> > > > - Hongtao.
> > > >
> > >
> > > Hongtao,
> > >
> > > You mentioned:
> > >
> > > > I tested the re-parsing way by using setup_pci_atmu() when resume.
> > > > And I found out that re-parsing will *change* outbound IO
> > > > translation address regitster.
> > >
> > > What do the values look like in both ATMU registers and io_resource
> > > if you reparse?
> > >
> > > - k
> >
> >
> > Hi Kumar,
> >
> > About this topic do you have any further comments?
> >
> > Thanks.
> > - Hongtao.
^ permalink raw reply
* Re: [PATCH v2 10/12] memory-hotplug: memory_hotplug: clear zone when removing the memory
From: Wen Congyang @ 2012-10-30 1:50 UTC (permalink / raw)
To: Jianguo Wu
Cc: linux-s390, linux-ia64, len.brown, linux-acpi, linux-sh, x86,
linux-kernel, cmetcalf, linux-mm, isimatu.yasuaki, paulus,
minchan.kim, kosaki.motohiro, rientjes, sparclinux, cl,
linuxppc-dev, akpm, liuj97
In-Reply-To: <508EA207.2060205@gmail.com>
At 10/29/2012 11:34 PM, Jianguo Wu Wrote:
> On 2012/10/23 18:30, wency@cn.fujitsu.com wrote:
>> From: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
>>
>> When a memory is added, we update zone's and pgdat's start_pfn and
>> spanned_pages in the function __add_zone(). So we should revert them
>> when the memory is removed.
>>
>> The patch adds a new function __remove_zone() to do this.
>>
>> CC: David Rientjes <rientjes@google.com>
>> CC: Jiang Liu <liuj97@gmail.com>
>> CC: Len Brown <len.brown@intel.com>
>> CC: Christoph Lameter <cl@linux.com>
>> Cc: Minchan Kim <minchan.kim@gmail.com>
>> CC: Andrew Morton <akpm@linux-foundation.org>
>> CC: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
>> Signed-off-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
>> Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
>> ---
>> mm/memory_hotplug.c | 207 +++++++++++++++++++++++++++++++++++++++++++++++++++
>> 1 files changed, 207 insertions(+), 0 deletions(-)
>>
>> diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
>> index 03153cf..55a228d 100644
>> --- a/mm/memory_hotplug.c
>> +++ b/mm/memory_hotplug.c
>> @@ -312,10 +312,213 @@ static int __meminit __add_section(int nid, struct zone *zone,
>> return register_new_memory(nid, __pfn_to_section(phys_start_pfn));
>> }
>>
>> +/* find the smallest valid pfn in the range [start_pfn, end_pfn) */
>> +static int find_smallest_section_pfn(int nid, struct zone *zone,
>> + unsigned long start_pfn,
>> + unsigned long end_pfn)
>> +{
>> + struct mem_section *ms;
>> +
>> + for (; start_pfn < end_pfn; start_pfn += PAGES_PER_SECTION) {
>> + ms = __pfn_to_section(start_pfn);
>> +
>> + if (unlikely(!valid_section(ms)))
>> + continue;
>> +
>> + if (unlikely(pfn_to_nid(start_pfn)) != nid)
>
> if (unlikely(pfn_to_nid(start_pfn) != nid))
Thanks for pointing it out. I will fix it soon.
Wen Congyang
>
>> + continue;
>> +
>> + if (zone && zone != page_zone(pfn_to_page(start_pfn)))
>> + continue;
>> +
>> + return start_pfn;
>> + }
>> +
>> + return 0;
>> +}
>> +
>> +/* find the biggest valid pfn in the range [start_pfn, end_pfn). */
>> +static int find_biggest_section_pfn(int nid, struct zone *zone,
>> + unsigned long start_pfn,
>> + unsigned long end_pfn)
>> +{
>> + struct mem_section *ms;
>> + unsigned long pfn;
>> +
>> + /* pfn is the end pfn of a memory section. */
>> + pfn = end_pfn - 1;
>> + for (; pfn >= start_pfn; pfn -= PAGES_PER_SECTION) {
>> + ms = __pfn_to_section(pfn);
>> +
>> + if (unlikely(!valid_section(ms)))
>> + continue;
>> +
>> + if (unlikely(pfn_to_nid(pfn)) != nid)
>
> if (unlikely(pfn_to_nid(pfn) != nid))
>
>> + continue;
>> +
>> + if (zone && zone != page_zone(pfn_to_page(pfn)))
>> + continue;
>> +
>> + return pfn;
>> + }
>> +
>> + return 0;
>> +}
>> +
>> +static void shrink_zone_span(struct zone *zone, unsigned long start_pfn,
>> + unsigned long end_pfn)
>> +{
>> + unsigned long zone_start_pfn = zone->zone_start_pfn;
>> + unsigned long zone_end_pfn = zone->zone_start_pfn + zone->spanned_pages;
>> + unsigned long pfn;
>> + struct mem_section *ms;
>> + int nid = zone_to_nid(zone);
>> +
>> + zone_span_writelock(zone);
>> + if (zone_start_pfn == start_pfn) {
>> + /*
>> + * If the section is smallest section in the zone, it need
>> + * shrink zone->zone_start_pfn and zone->zone_spanned_pages.
>> + * In this case, we find second smallest valid mem_section
>> + * for shrinking zone.
>> + */
>> + pfn = find_smallest_section_pfn(nid, zone, end_pfn,
>> + zone_end_pfn);
>> + if (pfn) {
>> + zone->zone_start_pfn = pfn;
>> + zone->spanned_pages = zone_end_pfn - pfn;
>> + }
>> + } else if (zone_end_pfn == end_pfn) {
>> + /*
>> + * If the section is biggest section in the zone, it need
>> + * shrink zone->spanned_pages.
>> + * In this case, we find second biggest valid mem_section for
>> + * shrinking zone.
>> + */
>> + pfn = find_biggest_section_pfn(nid, zone, zone_start_pfn,
>> + start_pfn);
>> + if (pfn)
>> + zone->spanned_pages = pfn - zone_start_pfn + 1;
>> + }
>> +
>> + /*
>> + * The section is not biggest or smallest mem_section in the zone, it
>> + * only creates a hole in the zone. So in this case, we need not
>> + * change the zone. But perhaps, the zone has only hole data. Thus
>> + * it check the zone has only hole or not.
>> + */
>> + pfn = zone_start_pfn;
>> + for (; pfn < zone_end_pfn; pfn += PAGES_PER_SECTION) {
>> + ms = __pfn_to_section(pfn);
>> +
>> + if (unlikely(!valid_section(ms)))
>> + continue;
>> +
>> + if (page_zone(pfn_to_page(pfn)) != zone)
>> + continue;
>> +
>> + /* If the section is current section, it continues the loop */
>> + if (start_pfn == pfn)
>> + continue;
>> +
>> + /* If we find valid section, we have nothing to do */
>> + zone_span_writeunlock(zone);
>> + return;
>> + }
>> +
>> + /* The zone has no valid section */
>> + zone->zone_start_pfn = 0;
>> + zone->spanned_pages = 0;
>> + zone_span_writeunlock(zone);
>> +}
>> +
>> +static void shrink_pgdat_span(struct pglist_data *pgdat,
>> + unsigned long start_pfn, unsigned long end_pfn)
>> +{
>> + unsigned long pgdat_start_pfn = pgdat->node_start_pfn;
>> + unsigned long pgdat_end_pfn =
>> + pgdat->node_start_pfn + pgdat->node_spanned_pages;
>> + unsigned long pfn;
>> + struct mem_section *ms;
>> + int nid = pgdat->node_id;
>> +
>> + if (pgdat_start_pfn == start_pfn) {
>> + /*
>> + * If the section is smallest section in the pgdat, it need
>> + * shrink pgdat->node_start_pfn and pgdat->node_spanned_pages.
>> + * In this case, we find second smallest valid mem_section
>> + * for shrinking zone.
>> + */
>> + pfn = find_smallest_section_pfn(nid, NULL, end_pfn,
>> + pgdat_end_pfn);
>> + if (pfn) {
>> + pgdat->node_start_pfn = pfn;
>> + pgdat->node_spanned_pages = pgdat_end_pfn - pfn;
>> + }
>> + } else if (pgdat_end_pfn == end_pfn) {
>> + /*
>> + * If the section is biggest section in the pgdat, it need
>> + * shrink pgdat->node_spanned_pages.
>> + * In this case, we find second biggest valid mem_section for
>> + * shrinking zone.
>> + */
>> + pfn = find_biggest_section_pfn(nid, NULL, pgdat_start_pfn,
>> + start_pfn);
>> + if (pfn)
>> + pgdat->node_spanned_pages = pfn - pgdat_start_pfn + 1;
>> + }
>> +
>> + /*
>> + * If the section is not biggest or smallest mem_section in the pgdat,
>> + * it only creates a hole in the pgdat. So in this case, we need not
>> + * change the pgdat.
>> + * But perhaps, the pgdat has only hole data. Thus it check the pgdat
>> + * has only hole or not.
>> + */
>> + pfn = pgdat_start_pfn;
>> + for (; pfn < pgdat_end_pfn; pfn += PAGES_PER_SECTION) {
>> + ms = __pfn_to_section(pfn);
>> +
>> + if (unlikely(!valid_section(ms)))
>> + continue;
>> +
>> + if (pfn_to_nid(pfn) != nid)
>> + continue;
>> +
>> + /* If the section is current section, it continues the loop */
>> + if (start_pfn == pfn)
>> + continue;
>> +
>> + /* If we find valid section, we have nothing to do */
>> + return;
>> + }
>> +
>> + /* The pgdat has no valid section */
>> + pgdat->node_start_pfn = 0;
>> + pgdat->node_spanned_pages = 0;
>> +}
>> +
>> +static void __remove_zone(struct zone *zone, unsigned long start_pfn)
>> +{
>> + struct pglist_data *pgdat = zone->zone_pgdat;
>> + int nr_pages = PAGES_PER_SECTION;
>> + int zone_type;
>> + unsigned long flags;
>> +
>> + zone_type = zone - pgdat->node_zones;
>> +
>> + pgdat_resize_lock(zone->zone_pgdat, &flags);
>> + shrink_zone_span(zone, start_pfn, start_pfn + nr_pages);
>> + shrink_pgdat_span(pgdat, start_pfn, start_pfn + nr_pages);
>> + pgdat_resize_unlock(zone->zone_pgdat, &flags);
>> +}
>> +
>> static int __remove_section(struct zone *zone, struct mem_section *ms)
>> {
>> unsigned long flags;
>> struct pglist_data *pgdat = zone->zone_pgdat;
>> + unsigned long start_pfn;
>> + int scn_nr;
>> int ret = -EINVAL;
>>
>> if (!valid_section(ms))
>> @@ -325,6 +528,10 @@ static int __remove_section(struct zone *zone, struct mem_section *ms)
>> if (ret)
>> return ret;
>>
>> + scn_nr = __section_nr(ms);
>> + start_pfn = section_nr_to_pfn(scn_nr);
>> + __remove_zone(zone, start_pfn);
>> +
>> pgdat_resize_lock(pgdat, &flags);
>> sparse_remove_one_section(zone, ms);
>> pgdat_resize_unlock(pgdat, &flags);
>>
>
>
^ permalink raw reply
* Re: [PATCH v2 10/12] memory-hotplug: memory_hotplug: clear zone when removing the memory
From: Jianguo Wu @ 2012-10-29 15:34 UTC (permalink / raw)
To: wency
Cc: linux-s390, linux-ia64, len.brown, linux-acpi, linux-sh, x86,
linux-kernel, cmetcalf, linux-mm, isimatu.yasuaki, paulus,
minchan.kim, kosaki.motohiro, rientjes, sparclinux, cl,
linuxppc-dev, akpm, liuj97
In-Reply-To: <1350988250-31294-11-git-send-email-wency@cn.fujitsu.com>
On 2012/10/23 18:30, wency@cn.fujitsu.com wrote:
> From: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
>
> When a memory is added, we update zone's and pgdat's start_pfn and
> spanned_pages in the function __add_zone(). So we should revert them
> when the memory is removed.
>
> The patch adds a new function __remove_zone() to do this.
>
> CC: David Rientjes <rientjes@google.com>
> CC: Jiang Liu <liuj97@gmail.com>
> CC: Len Brown <len.brown@intel.com>
> CC: Christoph Lameter <cl@linux.com>
> Cc: Minchan Kim <minchan.kim@gmail.com>
> CC: Andrew Morton <akpm@linux-foundation.org>
> CC: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
> Signed-off-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
> Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
> ---
> mm/memory_hotplug.c | 207 +++++++++++++++++++++++++++++++++++++++++++++++++++
> 1 files changed, 207 insertions(+), 0 deletions(-)
>
> diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
> index 03153cf..55a228d 100644
> --- a/mm/memory_hotplug.c
> +++ b/mm/memory_hotplug.c
> @@ -312,10 +312,213 @@ static int __meminit __add_section(int nid, struct zone *zone,
> return register_new_memory(nid, __pfn_to_section(phys_start_pfn));
> }
>
> +/* find the smallest valid pfn in the range [start_pfn, end_pfn) */
> +static int find_smallest_section_pfn(int nid, struct zone *zone,
> + unsigned long start_pfn,
> + unsigned long end_pfn)
> +{
> + struct mem_section *ms;
> +
> + for (; start_pfn < end_pfn; start_pfn += PAGES_PER_SECTION) {
> + ms = __pfn_to_section(start_pfn);
> +
> + if (unlikely(!valid_section(ms)))
> + continue;
> +
> + if (unlikely(pfn_to_nid(start_pfn)) != nid)
if (unlikely(pfn_to_nid(start_pfn) != nid))
> + continue;
> +
> + if (zone && zone != page_zone(pfn_to_page(start_pfn)))
> + continue;
> +
> + return start_pfn;
> + }
> +
> + return 0;
> +}
> +
> +/* find the biggest valid pfn in the range [start_pfn, end_pfn). */
> +static int find_biggest_section_pfn(int nid, struct zone *zone,
> + unsigned long start_pfn,
> + unsigned long end_pfn)
> +{
> + struct mem_section *ms;
> + unsigned long pfn;
> +
> + /* pfn is the end pfn of a memory section. */
> + pfn = end_pfn - 1;
> + for (; pfn >= start_pfn; pfn -= PAGES_PER_SECTION) {
> + ms = __pfn_to_section(pfn);
> +
> + if (unlikely(!valid_section(ms)))
> + continue;
> +
> + if (unlikely(pfn_to_nid(pfn)) != nid)
if (unlikely(pfn_to_nid(pfn) != nid))
> + continue;
> +
> + if (zone && zone != page_zone(pfn_to_page(pfn)))
> + continue;
> +
> + return pfn;
> + }
> +
> + return 0;
> +}
> +
> +static void shrink_zone_span(struct zone *zone, unsigned long start_pfn,
> + unsigned long end_pfn)
> +{
> + unsigned long zone_start_pfn = zone->zone_start_pfn;
> + unsigned long zone_end_pfn = zone->zone_start_pfn + zone->spanned_pages;
> + unsigned long pfn;
> + struct mem_section *ms;
> + int nid = zone_to_nid(zone);
> +
> + zone_span_writelock(zone);
> + if (zone_start_pfn == start_pfn) {
> + /*
> + * If the section is smallest section in the zone, it need
> + * shrink zone->zone_start_pfn and zone->zone_spanned_pages.
> + * In this case, we find second smallest valid mem_section
> + * for shrinking zone.
> + */
> + pfn = find_smallest_section_pfn(nid, zone, end_pfn,
> + zone_end_pfn);
> + if (pfn) {
> + zone->zone_start_pfn = pfn;
> + zone->spanned_pages = zone_end_pfn - pfn;
> + }
> + } else if (zone_end_pfn == end_pfn) {
> + /*
> + * If the section is biggest section in the zone, it need
> + * shrink zone->spanned_pages.
> + * In this case, we find second biggest valid mem_section for
> + * shrinking zone.
> + */
> + pfn = find_biggest_section_pfn(nid, zone, zone_start_pfn,
> + start_pfn);
> + if (pfn)
> + zone->spanned_pages = pfn - zone_start_pfn + 1;
> + }
> +
> + /*
> + * The section is not biggest or smallest mem_section in the zone, it
> + * only creates a hole in the zone. So in this case, we need not
> + * change the zone. But perhaps, the zone has only hole data. Thus
> + * it check the zone has only hole or not.
> + */
> + pfn = zone_start_pfn;
> + for (; pfn < zone_end_pfn; pfn += PAGES_PER_SECTION) {
> + ms = __pfn_to_section(pfn);
> +
> + if (unlikely(!valid_section(ms)))
> + continue;
> +
> + if (page_zone(pfn_to_page(pfn)) != zone)
> + continue;
> +
> + /* If the section is current section, it continues the loop */
> + if (start_pfn == pfn)
> + continue;
> +
> + /* If we find valid section, we have nothing to do */
> + zone_span_writeunlock(zone);
> + return;
> + }
> +
> + /* The zone has no valid section */
> + zone->zone_start_pfn = 0;
> + zone->spanned_pages = 0;
> + zone_span_writeunlock(zone);
> +}
> +
> +static void shrink_pgdat_span(struct pglist_data *pgdat,
> + unsigned long start_pfn, unsigned long end_pfn)
> +{
> + unsigned long pgdat_start_pfn = pgdat->node_start_pfn;
> + unsigned long pgdat_end_pfn =
> + pgdat->node_start_pfn + pgdat->node_spanned_pages;
> + unsigned long pfn;
> + struct mem_section *ms;
> + int nid = pgdat->node_id;
> +
> + if (pgdat_start_pfn == start_pfn) {
> + /*
> + * If the section is smallest section in the pgdat, it need
> + * shrink pgdat->node_start_pfn and pgdat->node_spanned_pages.
> + * In this case, we find second smallest valid mem_section
> + * for shrinking zone.
> + */
> + pfn = find_smallest_section_pfn(nid, NULL, end_pfn,
> + pgdat_end_pfn);
> + if (pfn) {
> + pgdat->node_start_pfn = pfn;
> + pgdat->node_spanned_pages = pgdat_end_pfn - pfn;
> + }
> + } else if (pgdat_end_pfn == end_pfn) {
> + /*
> + * If the section is biggest section in the pgdat, it need
> + * shrink pgdat->node_spanned_pages.
> + * In this case, we find second biggest valid mem_section for
> + * shrinking zone.
> + */
> + pfn = find_biggest_section_pfn(nid, NULL, pgdat_start_pfn,
> + start_pfn);
> + if (pfn)
> + pgdat->node_spanned_pages = pfn - pgdat_start_pfn + 1;
> + }
> +
> + /*
> + * If the section is not biggest or smallest mem_section in the pgdat,
> + * it only creates a hole in the pgdat. So in this case, we need not
> + * change the pgdat.
> + * But perhaps, the pgdat has only hole data. Thus it check the pgdat
> + * has only hole or not.
> + */
> + pfn = pgdat_start_pfn;
> + for (; pfn < pgdat_end_pfn; pfn += PAGES_PER_SECTION) {
> + ms = __pfn_to_section(pfn);
> +
> + if (unlikely(!valid_section(ms)))
> + continue;
> +
> + if (pfn_to_nid(pfn) != nid)
> + continue;
> +
> + /* If the section is current section, it continues the loop */
> + if (start_pfn == pfn)
> + continue;
> +
> + /* If we find valid section, we have nothing to do */
> + return;
> + }
> +
> + /* The pgdat has no valid section */
> + pgdat->node_start_pfn = 0;
> + pgdat->node_spanned_pages = 0;
> +}
> +
> +static void __remove_zone(struct zone *zone, unsigned long start_pfn)
> +{
> + struct pglist_data *pgdat = zone->zone_pgdat;
> + int nr_pages = PAGES_PER_SECTION;
> + int zone_type;
> + unsigned long flags;
> +
> + zone_type = zone - pgdat->node_zones;
> +
> + pgdat_resize_lock(zone->zone_pgdat, &flags);
> + shrink_zone_span(zone, start_pfn, start_pfn + nr_pages);
> + shrink_pgdat_span(pgdat, start_pfn, start_pfn + nr_pages);
> + pgdat_resize_unlock(zone->zone_pgdat, &flags);
> +}
> +
> static int __remove_section(struct zone *zone, struct mem_section *ms)
> {
> unsigned long flags;
> struct pglist_data *pgdat = zone->zone_pgdat;
> + unsigned long start_pfn;
> + int scn_nr;
> int ret = -EINVAL;
>
> if (!valid_section(ms))
> @@ -325,6 +528,10 @@ static int __remove_section(struct zone *zone, struct mem_section *ms)
> if (ret)
> return ret;
>
> + scn_nr = __section_nr(ms);
> + start_pfn = section_nr_to_pfn(scn_nr);
> + __remove_zone(zone, start_pfn);
> +
> pgdat_resize_lock(pgdat, &flags);
> sparse_remove_one_section(zone, ms);
> pgdat_resize_unlock(pgdat, &flags);
>
^ permalink raw reply
* [PATCH] powermac/cpufreq_32: set non-infinite transition time for 7447A driver
From: Andreas Schwab @ 2012-10-29 9:15 UTC (permalink / raw)
To: linuxppc-dev
The transition time for the 7447A is around 8ms which makes it possible
to use the ondemand governor. This has been tested on the iBook G4
(PowerBook6,7).
Signed-off-by: Andreas Schwab <schwab@linux-m68k.org>
---
arch/powerpc/platforms/powermac/cpufreq_32.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/platforms/powermac/cpufreq_32.c b/arch/powerpc/platforms/powermac/cpufreq_32.c
index 6417119..311b804 100644
--- a/arch/powerpc/platforms/powermac/cpufreq_32.c
+++ b/arch/powerpc/platforms/powermac/cpufreq_32.c
@@ -55,6 +55,7 @@ static unsigned int low_freq;
static unsigned int hi_freq;
static unsigned int cur_freq;
static unsigned int sleep_freq;
+static unsigned long transition_latency;
/*
* Different models uses different mechanisms to switch the frequency
@@ -403,7 +404,7 @@ static int pmac_cpufreq_cpu_init(struct cpufreq_policy *policy)
if (policy->cpu != 0)
return -ENODEV;
- policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL;
+ policy->cpuinfo.transition_latency = transition_latency;
policy->cur = cur_freq;
cpufreq_frequency_table_get_attr(pmac_cpu_freqs, policy->cpu);
@@ -658,12 +659,14 @@ static int __init pmac_cpufreq_setup(void)
if (!value)
goto out;
cur_freq = (*value) / 1000;
+ transition_latency = CPUFREQ_ETERNAL;
/* Check for 7447A based MacRISC3 */
if (of_machine_is_compatible("MacRISC3") &&
of_get_property(cpunode, "dynamic-power-step", NULL) &&
PVR_VER(mfspr(SPRN_PVR)) == 0x8003) {
pmac_cpufreq_init_7447A(cpunode);
+ transition_latency = 8000000;
/* Check for other MacRISC3 machines */
} else if (of_machine_is_compatible("PowerBook3,4") ||
of_machine_is_compatible("PowerBook3,5") ||
--
1.8.0
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply related
* RE: [PATCH] powerpc/esdhc: enable the card insert/remove interrupt
From: Huang Changming-R66093 @ 2012-10-29 1:40 UTC (permalink / raw)
To: Anton Vorontsov
Cc: linuxppc-dev@lists.ozlabs.org, Chris Ball,
linux-mmc@vger.kernel.org
In-Reply-To: <20121027011249.GB9152@lizard>
PiBIZWxsbyBIdWFuZywNCj4gDQo+IE9uIEZyaSwgT2N0IDI2LCAyMDEyIGF0IDAyOjQyOjM2QU0g
KzAwMDAsIEh1YW5nIENoYW5nbWluZy1SNjYwOTMgd3JvdGU6DQo+ID4gRm9yIHRoZSBjdXJyZW50
IHBvbGxpbmcgbW9kZSwgZHJpdmVyIHdpbGwgc2VuZCBDTUQxMyB0byBwb2xsIHRoZSBjYXJkDQo+
IHN0YXR1cyBwZXJpb2RpY2FsbHkgLCB3aGljaCB3aWxsIGNhdXNlIHRvbyBtYW55IGludGVycnVw
dHMuDQo+ID4gT25jZSBJIHNlbnQgcGF0Y2hlcyB0byBkZXRlY3QgdGhlIGNhcmQgd2hlbiB1c2lu
ZyBwb2xsaW5nIG1vZGUgbGFzdA0KPiB5ZWFyOiByZWFkIHRoZSBzdGF0ZSByZWdpc3RlciwgaW5z
dGVhZCBvZiBzZW5kIENNRDEzLiBCdXQsIHRoZXNlIHBhdGNoZXMNCj4gd2VyZSBub3QgYWNjZXB0
ZWQuIE5vdyBJIGF0dGFjaCB0aGVtIGZvciB5b3UuDQo+IA0KPiBXYXMgdGhlcmUgYW55IHNwZWNp
ZmljIHJlYXNvbiB3aHkgdGhlIHBhdGNoZXMgZGlkbid0IGdldCBhY2NlcHRlZD8NCj4gDQo+IEkg
dmVyeSBicmllZmx5IGxvb2tlZCBhdCB0aGVtLCBhbmQgdGhleSBzZWVtIHRvIGJlIE9LICh0aGVy
ZSBhcmUgYSBmZXcNCj4gY29zbWV0aWMgZGV0YWlscyBJJ2QgY29tbWVudCBvbiwgdGhvIC0tIGJ1
dCBwbGVhc2Ugc2VuZCB0aGVtIGluIGEgbm9ybWFsDQo+IHdheSAoaS5lLiBub3QgYXMgYXR0YWNo
bWVudHMpLg0KPiANCg0KVGhhbmtzLCBBbnRvbi4NCkkgZG9uJ3Qga25vdyB3aHkuDQpJIHdpbGwg
cmVzZW5kIHRoZXNlIHBhdGNoZXMgYmFzZWQgb24gbGF0ZXN0IGtlcm5lbC4NCg0K
^ permalink raw reply
* [PATCH 3/3] powerpc/ptrace: Remove unused addr parameter in ppc_del_hwdebug()
From: Michael Neuling @ 2012-10-29 1:13 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: Michael Neuling, linuxppc-dev, Naveen N . Rao
In-Reply-To: <1351473197-27426-1-git-send-email-mikey@neuling.org>
Signed-off-by: Michael Neuling <mikey@neuling.org>
---
arch/powerpc/kernel/ptrace.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/kernel/ptrace.c b/arch/powerpc/kernel/ptrace.c
index 7dd32d1..817b411 100644
--- a/arch/powerpc/kernel/ptrace.c
+++ b/arch/powerpc/kernel/ptrace.c
@@ -1451,7 +1451,7 @@ static long ppc_set_hwdebug(struct task_struct *child,
#endif /* !CONFIG_PPC_ADV_DEBUG_DVCS */
}
-static long ppc_del_hwdebug(struct task_struct *child, long addr, long data)
+static long ppc_del_hwdebug(struct task_struct *child, long data)
{
#ifdef CONFIG_HAVE_HW_BREAKPOINT
int ret = 0;
@@ -1633,7 +1633,7 @@ long arch_ptrace(struct task_struct *child, long request,
}
case PPC_PTRACE_DELHWDEBUG: {
- ret = ppc_del_hwdebug(child, addr, data);
+ ret = ppc_del_hwdebug(child, data);
break;
}
--
1.7.9.5
^ permalink raw reply related
* [PATCH 2/3] powerpc/ptrace: Fix spelling mistake
From: Michael Neuling @ 2012-10-29 1:13 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: Michael Neuling, linuxppc-dev, Naveen N . Rao
In-Reply-To: <1351473197-27426-1-git-send-email-mikey@neuling.org>
s/intruction/instruction/
Signed-off-by: Michael Neuling <mikey@neuling.org>
---
arch/powerpc/kernel/ptrace.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/kernel/ptrace.c b/arch/powerpc/kernel/ptrace.c
index 140238a..7dd32d1 100644
--- a/arch/powerpc/kernel/ptrace.c
+++ b/arch/powerpc/kernel/ptrace.c
@@ -1037,7 +1037,7 @@ void ptrace_disable(struct task_struct *child)
}
#ifdef CONFIG_PPC_ADV_DEBUG_REGS
-static long set_intruction_bp(struct task_struct *child,
+static long set_instruction_bp(struct task_struct *child,
struct ppc_hw_breakpoint *bp_info)
{
int slot;
@@ -1371,7 +1371,7 @@ static long ppc_set_hwdebug(struct task_struct *child,
if ((bp_info->trigger_type != PPC_BREAKPOINT_TRIGGER_EXECUTE) ||
(bp_info->condition_mode != PPC_BREAKPOINT_CONDITION_NONE))
return -EINVAL;
- return set_intruction_bp(child, bp_info);
+ return set_instruction_bp(child, bp_info);
}
if (bp_info->addr_mode == PPC_BREAKPOINT_MODE_EXACT)
return set_dac(child, bp_info);
--
1.7.9.5
^ permalink raw reply related
* [PATCH 1/3] powerpc/hw-breakpoint: Use generic hw-breakpoint interfaces for new PPC ptrace flags
From: Michael Neuling @ 2012-10-29 1:13 UTC (permalink / raw)
To: Benjamin Herrenschmidt
Cc: linuxppc-dev, Naveen N . Rao, K.Prasad, Michael Neuling
In-Reply-To: <1351473197-27426-1-git-send-email-mikey@neuling.org>
From: "K.Prasad" <prasad@linux.vnet.ibm.com>
PPC_PTRACE_GETHWDBGINFO, PPC_PTRACE_SETHWDEBUG and PPC_PTRACE_DELHWDEBUG are
PowerPC specific ptrace flags that use the watchpoint register. While they are
targeted primarily towards BookE users, user-space applications such as GDB
have started using them for BookS too. This patch enables the use of generic
hardware breakpoint interfaces for these new flags.
Apart from the usual benefits of using generic hw-breakpoint interfaces, these
changes allow debuggers (such as GDB) to use a common set of ptrace flags for
their watchpoint needs and allow more precise breakpoint specification (length
of the variable can be specified).
Mikey added: rebased and added dbginfo.features around #ifdef
CONFIG_HAVE_HW_BREAKPOINT
Signed-off-by: K.Prasad <prasad@linux.vnet.ibm.com>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Michael Neuling <mikey@neuling.org>
---
Documentation/powerpc/ptrace.txt | 16 ++++++++
arch/powerpc/kernel/ptrace.c | 78 ++++++++++++++++++++++++++++++++++++--
2 files changed, 90 insertions(+), 4 deletions(-)
diff --git a/Documentation/powerpc/ptrace.txt b/Documentation/powerpc/ptrace.txt
index f4a5499..f2a7a39 100644
--- a/Documentation/powerpc/ptrace.txt
+++ b/Documentation/powerpc/ptrace.txt
@@ -127,6 +127,22 @@ Some examples of using the structure to:
p.addr2 = (uint64_t) end_range;
p.condition_value = 0;
+- set a watchpoint in server processors (BookS)
+
+ p.version = 1;
+ p.trigger_type = PPC_BREAKPOINT_TRIGGER_RW;
+ p.addr_mode = PPC_BREAKPOINT_MODE_RANGE_INCLUSIVE;
+ or
+ p.addr_mode = PPC_BREAKPOINT_MODE_EXACT;
+
+ p.condition_mode = PPC_BREAKPOINT_CONDITION_NONE;
+ p.addr = (uint64_t) begin_range;
+ /* For PPC_BREAKPOINT_MODE_RANGE_INCLUSIVE addr2 needs to be specified, where
+ * addr2 - addr <= 8 Bytes.
+ */
+ p.addr2 = (uint64_t) end_range;
+ p.condition_value = 0;
+
3. PTRACE_DELHWDEBUG
Takes an integer which identifies an existing breakpoint or watchpoint
diff --git a/arch/powerpc/kernel/ptrace.c b/arch/powerpc/kernel/ptrace.c
index 79d8e56..140238a 100644
--- a/arch/powerpc/kernel/ptrace.c
+++ b/arch/powerpc/kernel/ptrace.c
@@ -1338,6 +1338,12 @@ static int set_dac_range(struct task_struct *child,
static long ppc_set_hwdebug(struct task_struct *child,
struct ppc_hw_breakpoint *bp_info)
{
+#ifdef CONFIG_HAVE_HW_BREAKPOINT
+ int len = 0;
+ struct thread_struct *thread = &(child->thread);
+ struct perf_event *bp;
+ struct perf_event_attr attr;
+#endif /* CONFIG_HAVE_HW_BREAKPOINT */
#ifndef CONFIG_PPC_ADV_DEBUG_REGS
unsigned long dabr;
#endif
@@ -1381,13 +1387,9 @@ static long ppc_set_hwdebug(struct task_struct *child,
*/
if ((bp_info->trigger_type & PPC_BREAKPOINT_TRIGGER_RW) == 0 ||
(bp_info->trigger_type & ~PPC_BREAKPOINT_TRIGGER_RW) != 0 ||
- bp_info->addr_mode != PPC_BREAKPOINT_MODE_EXACT ||
bp_info->condition_mode != PPC_BREAKPOINT_CONDITION_NONE)
return -EINVAL;
- if (child->thread.dabr)
- return -ENOSPC;
-
if ((unsigned long)bp_info->addr >= TASK_SIZE)
return -EIO;
@@ -1397,6 +1399,50 @@ static long ppc_set_hwdebug(struct task_struct *child,
dabr |= DABR_DATA_READ;
if (bp_info->trigger_type & PPC_BREAKPOINT_TRIGGER_WRITE)
dabr |= DABR_DATA_WRITE;
+#ifdef CONFIG_HAVE_HW_BREAKPOINT
+ if (ptrace_get_breakpoints(child) < 0)
+ return -ESRCH;
+
+ /*
+ * Check if the request is for 'range' breakpoints. We can
+ * support it if range < 8 bytes.
+ */
+ if (bp_info->addr_mode == PPC_BREAKPOINT_MODE_RANGE_INCLUSIVE) {
+ len = bp_info->addr2 - bp_info->addr;
+ } else if (bp_info->addr_mode != PPC_BREAKPOINT_MODE_EXACT) {
+ ptrace_put_breakpoints(child);
+ return -EINVAL;
+ }
+ bp = thread->ptrace_bps[0];
+ if (bp) {
+ ptrace_put_breakpoints(child);
+ return -ENOSPC;
+ }
+
+ /* Create a new breakpoint request if one doesn't exist already */
+ hw_breakpoint_init(&attr);
+ attr.bp_addr = (unsigned long)bp_info->addr & ~HW_BREAKPOINT_ALIGN;
+ attr.bp_len = len;
+ arch_bp_generic_fields(dabr & (DABR_DATA_WRITE | DABR_DATA_READ),
+ &attr.bp_type);
+
+ thread->ptrace_bps[0] = bp = register_user_hw_breakpoint(&attr,
+ ptrace_triggered, NULL, child);
+ if (IS_ERR(bp)) {
+ thread->ptrace_bps[0] = NULL;
+ ptrace_put_breakpoints(child);
+ return PTR_ERR(bp);
+ }
+
+ ptrace_put_breakpoints(child);
+ return 1;
+#endif /* CONFIG_HAVE_HW_BREAKPOINT */
+
+ if (bp_info->addr_mode != PPC_BREAKPOINT_MODE_EXACT)
+ return -EINVAL;
+
+ if (child->thread.dabr)
+ return -ENOSPC;
child->thread.dabr = dabr;
child->thread.dabrx = DABRX_ALL;
@@ -1407,6 +1453,11 @@ static long ppc_set_hwdebug(struct task_struct *child,
static long ppc_del_hwdebug(struct task_struct *child, long addr, long data)
{
+#ifdef CONFIG_HAVE_HW_BREAKPOINT
+ int ret = 0;
+ struct thread_struct *thread = &(child->thread);
+ struct perf_event *bp;
+#endif /* CONFIG_HAVE_HW_BREAKPOINT */
#ifdef CONFIG_PPC_ADV_DEBUG_REGS
int rc;
@@ -1426,10 +1477,25 @@ static long ppc_del_hwdebug(struct task_struct *child, long addr, long data)
#else
if (data != 1)
return -EINVAL;
+
+#ifdef CONFIG_HAVE_HW_BREAKPOINT
+ if (ptrace_get_breakpoints(child) < 0)
+ return -ESRCH;
+
+ bp = thread->ptrace_bps[0];
+ if (bp) {
+ unregister_hw_breakpoint(bp);
+ thread->ptrace_bps[0] = NULL;
+ } else
+ ret = -ENOENT;
+ ptrace_put_breakpoints(child);
+ return ret;
+#else /* CONFIG_HAVE_HW_BREAKPOINT */
if (child->thread.dabr == 0)
return -ENOENT;
child->thread.dabr = 0;
+#endif /* CONFIG_HAVE_HW_BREAKPOINT */
return 0;
#endif
@@ -1536,7 +1602,11 @@ long arch_ptrace(struct task_struct *child, long request,
dbginfo.data_bp_alignment = 4;
#endif
dbginfo.sizeof_condition = 0;
+#ifdef CONFIG_HAVE_HW_BREAKPOINT
+ dbginfo.features = PPC_DEBUG_FEATURE_DATA_BP_RANGE;
+#else
dbginfo.features = 0;
+#endif /* CONFIG_HAVE_HW_BREAKPOINT */
#endif /* CONFIG_PPC_ADV_DEBUG_REGS */
if (!access_ok(VERIFY_WRITE, datavp,
--
1.7.9.5
^ permalink raw reply related
* [PATCH 0/3] powerpc/ptrace: hw breakpoint book3s repost and cleanups
From: Michael Neuling @ 2012-10-29 1:13 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: Michael Neuling, linuxppc-dev, Naveen N . Rao
This is a repost of K.Prasad hw breakpoint support for book3s and some
other junk I found along the way.
K.Prasad (1):
powerpc/hw-breakpoint: Use generic hw-breakpoint interfaces for new
PPC ptrace flags
Michael Neuling (2):
powerpc/ptrace: Fix spelling mistake
powerpc/ptrace: Remove unused addr parameter in ppc_del_hwdebug()
Documentation/powerpc/ptrace.txt | 16 +++++++
arch/powerpc/kernel/ptrace.c | 86 ++++++++++++++++++++++++++++++++++----
2 files changed, 94 insertions(+), 8 deletions(-)
--
1.7.9.5
^ permalink raw reply
* Re: Power Management issues in MPC8313 processor
From: Srivatsan Canchivaram @ 2012-10-28 0:46 UTC (permalink / raw)
To: Scott Wood; +Cc: linuxppc-dev
In-Reply-To: <1351297672.23094.13@snotra>
[-- Attachment #1: Type: text/plain, Size: 3596 bytes --]
Hello Scott,
I am using 2.6.27 - I am trying to add Power Management support to an older
product.
Thanks,
Srivatsan
On Fri, Oct 26, 2012 at 8:27 PM, Scott Wood <scottwood@freescale.com> wrote:
> On 10/25/2012 05:07:01 PM, Srivatsan Canchivaram wrote:
>
>> Hi,
>>
>>
>> I have a modem with a Freescale MPC8313E processor. I am trying to enable
>> power savings in the processor by placing it in Standby mode and resume
>> normal operation with a Wake-On-LAN magic packet.
>>
>>
>> Following the directions in the Freescale Power Management app note, I
>> enabled Power Management Support in the Linux kernel and device tree
>> configurations.
>>
>>
>> I ran the following command on the board:
>>
>> echo standby > /sys/power/state
>>
>>
>> This caused the console to hang and there was no further response to
>> keyboard inputs. I enabled ‘no_console_suspend’ in the kernel and when I
>> loaded the new build and enabled standby mode, I observed an Oops trace:
>>
>>
>>
>> RASCOM_QCU.7.0.0013 $ echo standby > /sys/power/state
>>
>> <6>PM: Syncing fFreezing user space processes ... ilesystems ... <7>PM:
>> Entering standby sleep
>>
>> Unable to handle kernel paging request for instruction fetch
>>
>> Faulting instruction address: 0x616d6570
>>
>> Oops: Kernel access of bad area, sig: 11 [#1]
>>
>> MPC831x RDB
>>
>> Modules linked in: dsp rcspi modem i2c_mpc thermal_sys lm92 hwmon [last
>> unloaded: modem]
>>
>> NIP: 616d6570 LR: c0165224 CTR: 616d6573
>>
>> REGS: cd087d30 TRAP: 0400 Not tainted (2.6.27)
>>
>> MSR: 20001032 <ME,IR,DR> CR: 28002024 XER: 20000000
>>
>> TASK = cc312400[1196] 'echo' THREAD: cd086000
>>
>> GPR00: 00000002 cd087de0 cc312400 cf821800 cd087de8 00000002 c06e0000
>> c06da4a0
>>
>> GPR08: c06da948 616d6573 00003fff c06c6308 28002022 10091248 0fffc000
>> 100050b8
>>
>> GPR16: 1008a270 10068810 100687c8 10068814 00000000 1008c284 1008c294
>> c0246180
>>
>> GPR24: c02ab9e4 c02ab9dc c06cc4f4 00000006 cd087e08 00000002 c06c595c
>> cf821808
>>
>> NIP [616d6570] 0x616d6570
>>
>> LR [c0165224] platform_pm_suspend_noirq+**0x84/0x88
>>
>
> What kernel are you using? platform_pm_suspend_noirq was removed by this
> commit:
>
> commit 9b39e73d0c2b265a7f8748b0e9a9f0**9be84079a8
> Author: Rafael J. Wysocki <rjw@sisk.pl>
> Date: Sun Dec 18 00:34:24 2011 +0100
>
> PM / Sleep: Remove forward-only callbacks from platform bus type
>
> The forward-only PM callbacks provided by the platform bus type are
> not necessary any more, because the PM core executes driver callbacks
> when the corresponding subsystem callbacks are not present, so drop
> them.
>
> Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
>
> It seems that a driver's pm ops are getting corrupted -- maybe used after
> freeing? Have you tried enabling slab/slub debug?
>
> Can you instrument the code to see if there are any fields in the device
> struct that aren't corrupt, that could point out which device this is?
>
>
> I found another thread that dealt with Power Management issues on the
>> Freescale MPC8313 processor:
>>
>> https://lists.ozlabs.org/**pipermail/linuxppc-dev/2012-**
>> January/095240.html<https://lists.ozlabs.org/pipermail/linuxppc-dev/2012-January/095240.html>
>>
>> The resolution of this issue seems to be related to the JTAG TRST pin
>> being
>> disabled. This is not relevant in my case as the TRST on my board is
>> already inactive.
>>
>
> If you were seeing that, you'd see a hang rather than an oops.
>
> -Scott
>
[-- Attachment #2: Type: text/html, Size: 4590 bytes --]
^ permalink raw reply
* [PATCH] PPC: ePAPR: Convert header to uapi
From: Alexander Graf @ 2012-10-27 17:57 UTC (permalink / raw)
To: linuxppc-dev
Cc: kvm, Timur Tabi, linux-kernel@vger.kernel.org List, kvm-ppc,
David Howells
The new uapi framework splits kernel internal and user space exported
bits of header files more cleanly. Adjust the ePAPR header accordingly.
Signed-off-by: Alexander Graf <agraf@suse.de>
---
arch/powerpc/include/asm/Kbuild | 1 -
arch/powerpc/include/asm/epapr_hcalls.h | 56 +--------------
arch/powerpc/include/uapi/asm/Kbuild | 1 +
arch/powerpc/include/uapi/asm/epapr_hcalls.h | 98 ++++++++++++++++++++++++++
4 files changed, 100 insertions(+), 56 deletions(-)
create mode 100644 arch/powerpc/include/uapi/asm/epapr_hcalls.h
diff --git a/arch/powerpc/include/asm/Kbuild b/arch/powerpc/include/asm/Kbuild
index 13d6b7b..7e313f1 100644
--- a/arch/powerpc/include/asm/Kbuild
+++ b/arch/powerpc/include/asm/Kbuild
@@ -34,6 +34,5 @@ header-y += termios.h
header-y += types.h
header-y += ucontext.h
header-y += unistd.h
-header-y += epapr_hcalls.h
generic-y += rwsem.h
diff --git a/arch/powerpc/include/asm/epapr_hcalls.h b/arch/powerpc/include/asm/epapr_hcalls.h
index b8d9445..22defe7 100644
--- a/arch/powerpc/include/asm/epapr_hcalls.h
+++ b/arch/powerpc/include/asm/epapr_hcalls.h
@@ -50,65 +50,11 @@
#ifndef _EPAPR_HCALLS_H
#define _EPAPR_HCALLS_H
-#define EV_BYTE_CHANNEL_SEND 1
-#define EV_BYTE_CHANNEL_RECEIVE 2
-#define EV_BYTE_CHANNEL_POLL 3
-#define EV_INT_SET_CONFIG 4
-#define EV_INT_GET_CONFIG 5
-#define EV_INT_SET_MASK 6
-#define EV_INT_GET_MASK 7
-#define EV_INT_IACK 9
-#define EV_INT_EOI 10
-#define EV_INT_SEND_IPI 11
-#define EV_INT_SET_TASK_PRIORITY 12
-#define EV_INT_GET_TASK_PRIORITY 13
-#define EV_DOORBELL_SEND 14
-#define EV_MSGSND 15
-#define EV_IDLE 16
-
-/* vendor ID: epapr */
-#define EV_LOCAL_VENDOR_ID 0 /* for private use */
-#define EV_EPAPR_VENDOR_ID 1
-#define EV_FSL_VENDOR_ID 2 /* Freescale Semiconductor */
-#define EV_IBM_VENDOR_ID 3 /* IBM */
-#define EV_GHS_VENDOR_ID 4 /* Green Hills Software */
-#define EV_ENEA_VENDOR_ID 5 /* Enea */
-#define EV_WR_VENDOR_ID 6 /* Wind River Systems */
-#define EV_AMCC_VENDOR_ID 7 /* Applied Micro Circuits */
-#define EV_KVM_VENDOR_ID 42 /* KVM */
-
-/* The max number of bytes that a byte channel can send or receive per call */
-#define EV_BYTE_CHANNEL_MAX_BYTES 16
-
-
-#define _EV_HCALL_TOKEN(id, num) (((id) << 16) | (num))
-#define EV_HCALL_TOKEN(hcall_num) _EV_HCALL_TOKEN(EV_EPAPR_VENDOR_ID, hcall_num)
-
-/* epapr return codes */
-#define EV_SUCCESS 0
-#define EV_EPERM 1 /* Operation not permitted */
-#define EV_ENOENT 2 /* Entry Not Found */
-#define EV_EIO 3 /* I/O error occured */
-#define EV_EAGAIN 4 /* The operation had insufficient
- * resources to complete and should be
- * retried
- */
-#define EV_ENOMEM 5 /* There was insufficient memory to
- * complete the operation */
-#define EV_EFAULT 6 /* Bad guest address */
-#define EV_ENODEV 7 /* No such device */
-#define EV_EINVAL 8 /* An argument supplied to the hcall
- was out of range or invalid */
-#define EV_INTERNAL 9 /* An internal error occured */
-#define EV_CONFIG 10 /* A configuration error was detected */
-#define EV_INVALID_STATE 11 /* The object is in an invalid state */
-#define EV_UNIMPLEMENTED 12 /* Unimplemented hypercall */
-#define EV_BUFFER_OVERFLOW 13 /* Caller-supplied buffer too small */
-
#ifndef __ASSEMBLY__
#include <linux/types.h>
#include <linux/errno.h>
#include <asm/byteorder.h>
+#include <uapi/asm/epapr_hcalls.h>
/*
* Hypercall register clobber list
diff --git a/arch/powerpc/include/uapi/asm/Kbuild b/arch/powerpc/include/uapi/asm/Kbuild
index baebb3d..e6b5be8 100644
--- a/arch/powerpc/include/uapi/asm/Kbuild
+++ b/arch/powerpc/include/uapi/asm/Kbuild
@@ -1,3 +1,4 @@
# UAPI Header export list
include include/uapi/asm-generic/Kbuild.asm
+header-y += epapr_hcalls.h
diff --git a/arch/powerpc/include/uapi/asm/epapr_hcalls.h b/arch/powerpc/include/uapi/asm/epapr_hcalls.h
new file mode 100644
index 0000000..046c793
--- /dev/null
+++ b/arch/powerpc/include/uapi/asm/epapr_hcalls.h
@@ -0,0 +1,98 @@
+/*
+ * ePAPR hcall interface
+ *
+ * Copyright 2008-2011 Freescale Semiconductor, Inc.
+ *
+ * Author: Timur Tabi <timur@freescale.com>
+ *
+ * This file is provided under a dual BSD/GPL license. When using or
+ * redistributing this file, you may do so under either license.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Freescale Semiconductor nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ *
+ * ALTERNATIVELY, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") as published by the Free Software
+ * Foundation, either version 2 of that License or (at your option) any
+ * later version.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _UAPI__EPAPR_HCALLS_H
+#define _UAPI__EPAPR_HCALLS_H
+
+#define EV_BYTE_CHANNEL_SEND 1
+#define EV_BYTE_CHANNEL_RECEIVE 2
+#define EV_BYTE_CHANNEL_POLL 3
+#define EV_INT_SET_CONFIG 4
+#define EV_INT_GET_CONFIG 5
+#define EV_INT_SET_MASK 6
+#define EV_INT_GET_MASK 7
+#define EV_INT_IACK 9
+#define EV_INT_EOI 10
+#define EV_INT_SEND_IPI 11
+#define EV_INT_SET_TASK_PRIORITY 12
+#define EV_INT_GET_TASK_PRIORITY 13
+#define EV_DOORBELL_SEND 14
+#define EV_MSGSND 15
+#define EV_IDLE 16
+
+/* vendor ID: epapr */
+#define EV_LOCAL_VENDOR_ID 0 /* for private use */
+#define EV_EPAPR_VENDOR_ID 1
+#define EV_FSL_VENDOR_ID 2 /* Freescale Semiconductor */
+#define EV_IBM_VENDOR_ID 3 /* IBM */
+#define EV_GHS_VENDOR_ID 4 /* Green Hills Software */
+#define EV_ENEA_VENDOR_ID 5 /* Enea */
+#define EV_WR_VENDOR_ID 6 /* Wind River Systems */
+#define EV_AMCC_VENDOR_ID 7 /* Applied Micro Circuits */
+#define EV_KVM_VENDOR_ID 42 /* KVM */
+
+/* The max number of bytes that a byte channel can send or receive per call */
+#define EV_BYTE_CHANNEL_MAX_BYTES 16
+
+
+#define _EV_HCALL_TOKEN(id, num) (((id) << 16) | (num))
+#define EV_HCALL_TOKEN(hcall_num) _EV_HCALL_TOKEN(EV_EPAPR_VENDOR_ID, hcall_num)
+
+/* epapr return codes */
+#define EV_SUCCESS 0
+#define EV_EPERM 1 /* Operation not permitted */
+#define EV_ENOENT 2 /* Entry Not Found */
+#define EV_EIO 3 /* I/O error occured */
+#define EV_EAGAIN 4 /* The operation had insufficient
+ * resources to complete and should be
+ * retried
+ */
+#define EV_ENOMEM 5 /* There was insufficient memory to
+ * complete the operation */
+#define EV_EFAULT 6 /* Bad guest address */
+#define EV_ENODEV 7 /* No such device */
+#define EV_EINVAL 8 /* An argument supplied to the hcall
+ was out of range or invalid */
+#define EV_INTERNAL 9 /* An internal error occured */
+#define EV_CONFIG 10 /* A configuration error was detected */
+#define EV_INVALID_STATE 11 /* The object is in an invalid state */
+#define EV_UNIMPLEMENTED 12 /* Unimplemented hypercall */
+#define EV_BUFFER_OVERFLOW 13 /* Caller-supplied buffer too small */
+
+#endif /* _UAPI__EPAPR_HCALLS_H */
--
1.6.0.2
^ permalink raw reply related
* [PATCH 1/1] powerpc/book3e: store critical/machine/debug exception thread info
From: Tiejun Chen @ 2012-10-27 4:22 UTC (permalink / raw)
To: benh; +Cc: linuxppc-dev, linux-kernel, jason.wessel
We need to store thread info to these exception thread info like something
we already did for PPC32.
Signed-off-by: Tiejun Chen <tiejun.chen@windriver.com>
---
This patch is followed on my three patches I send recently:
[PATCH 1/3] powerpc/book3e: load critical/machine/debug exception stack
[PATCH 2/3] powerpc/book3e: support kgdb for kernel space
[PATCH 3/3] kgdb/kgdbts: support ppc64
Tiejun
arch/powerpc/kernel/exceptions-64e.S | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/arch/powerpc/kernel/exceptions-64e.S b/arch/powerpc/kernel/exceptions-64e.S
index c5564d4..4e7083e 100644
--- a/arch/powerpc/kernel/exceptions-64e.S
+++ b/arch/powerpc/kernel/exceptions-64e.S
@@ -91,10 +91,28 @@
#define SPRN_GDBELL_SRR0 SPRN_GSRR0
#define SPRN_GDBELL_SRR1 SPRN_GSRR1
+/* Store something to exception thread info */
+#define BOOK3E_STORE_EXC_LEVEL_THEAD_INFO(type) \
+ std r14,PACA_EX##type+EX_R14(r13); \
+ std r15,PACA_EX##type+EX_R15(r13); \
+ ld r14,PACA_EX##type+EX_R1(r13); \
+ clrrdi r14,r14,THREAD_SHIFT; \
+ clrrdi r15,r1,THREAD_SHIFT; \
+ ld r10,TI_FLAGS(r14); \
+ std r10,TI_FLAGS(r15); \
+ ld r10,TI_PREEMPT(r14); \
+ std r10,TI_PREEMPT(r1); \
+ ld r10,TI_TASK(r14); \
+ std r10,TI_TASK(r1); \
+ ld r14,PACA_EX##type+EX_R14(r13); \
+ ld r15,PACA_EX##type+EX_R15(r13); \
+1:
+
#define CRIT_SET_KSTACK \
BOOK3E_LOAD_EXC_LEVEL_STACK(CRIT); \
ld r1,PACA_CRIT_STACK(r13); \
subi r1,r1,SPECIAL_EXC_FRAME_SIZE;
+ BOOK3E_STORE_EXC_LEVEL_THEAD_INFO(CRIT);
#define SPRN_CRIT_SRR0 SPRN_CSRR0
#define SPRN_CRIT_SRR1 SPRN_CSRR1
@@ -102,6 +120,7 @@
BOOK3E_LOAD_EXC_LEVEL_STACK(DBG); \
ld r1,PACA_DBG_STACK(r13); \
subi r1,r1,SPECIAL_EXC_FRAME_SIZE;
+ BOOK3E_STORE_EXC_LEVEL_THEAD_INFO(DBG);
#define SPRN_DBG_SRR0 SPRN_DSRR0
#define SPRN_DBG_SRR1 SPRN_DSRR1
@@ -109,6 +128,7 @@
BOOK3E_LOAD_EXC_LEVEL_STACK(MC); \
ld r1,PACA_MC_STACK(r13); \
subi r1,r1,SPECIAL_EXC_FRAME_SIZE;
+ BOOK3E_STORE_EXC_LEVEL_THEAD_INFO(MC);
#define SPRN_MC_SRR0 SPRN_MCSRR0
#define SPRN_MC_SRR1 SPRN_MCSRR1
--
1.7.9.5
^ permalink raw reply related
* Re: [PATCH] powerpc/esdhc: enable the card insert/remove interrupt
From: Anton Vorontsov @ 2012-10-27 1:12 UTC (permalink / raw)
To: Huang Changming-R66093
Cc: linuxppc-dev@lists.ozlabs.org, Chris Ball,
linux-mmc@vger.kernel.org
In-Reply-To: <110EED8CC96DFC488B7E717A2027A27C1DFBFB@039-SN1MPN1-004.039d.mgd.msft.net>
Hello Huang,
On Fri, Oct 26, 2012 at 02:42:36AM +0000, Huang Changming-R66093 wrote:
> For the current polling mode, driver will send CMD13 to poll the card status periodically , which will cause too many interrupts.
> Once I sent patches to detect the card when using polling mode last year: read the state register, instead of send CMD13. But, these patches were not accepted. Now I attach them for you.
Was there any specific reason why the patches didn't get accepted?
I very briefly looked at them, and they seem to be OK (there are a few
cosmetic details I'd comment on, tho -- but please send them in a normal
way (i.e. not as attachments).
Thanks,
Anton.
^ permalink raw reply
* Re: Power Management issues in MPC8313 processor
From: Scott Wood @ 2012-10-27 0:27 UTC (permalink / raw)
To: Srivatsan Canchivaram; +Cc: linuxppc-dev
In-Reply-To: <CAO_L5k-D2jMZaoxpxk_tu_=nT5T0PSSp_PUesh9gm-rNq0Qhcg@mail.gmail.com>
On 10/25/2012 05:07:01 PM, Srivatsan Canchivaram wrote:
> Hi,
>=20
>=20
> I have a modem with a Freescale MPC8313E processor. I am trying to =20
> enable
> power savings in the processor by placing it in Standby mode and =20
> resume
> normal operation with a Wake-On-LAN magic packet.
>=20
>=20
> Following the directions in the Freescale Power Management app note, I
> enabled Power Management Support in the Linux kernel and device tree
> configurations.
>=20
>=20
> I ran the following command on the board:
>=20
> echo standby > /sys/power/state
>=20
>=20
> This caused the console to hang and there was no further response to
> keyboard inputs. I enabled =E2=80=98no_console_suspend=E2=80=99 in the ke=
rnel and =20
> when I
> loaded the new build and enabled standby mode, I observed an Oops =20
> trace:
>=20
>=20
>=20
> RASCOM_QCU.7.0.0013 $ echo standby > /sys/power/state
>=20
> <6>PM: Syncing fFreezing user space processes ... ilesystems ... =20
> <7>PM:
> Entering standby sleep
>=20
> Unable to handle kernel paging request for instruction fetch
>=20
> Faulting instruction address: 0x616d6570
>=20
> Oops: Kernel access of bad area, sig: 11 [#1]
>=20
> MPC831x RDB
>=20
> Modules linked in: dsp rcspi modem i2c_mpc thermal_sys lm92 hwmon =20
> [last
> unloaded: modem]
>=20
> NIP: 616d6570 LR: c0165224 CTR: 616d6573
>=20
> REGS: cd087d30 TRAP: 0400 Not tainted (2.6.27)
>=20
> MSR: 20001032 <ME,IR,DR> CR: 28002024 XER: 20000000
>=20
> TASK =3D cc312400[1196] 'echo' THREAD: cd086000
>=20
> GPR00: 00000002 cd087de0 cc312400 cf821800 cd087de8 00000002 c06e0000
> c06da4a0
>=20
> GPR08: c06da948 616d6573 00003fff c06c6308 28002022 10091248 0fffc000
> 100050b8
>=20
> GPR16: 1008a270 10068810 100687c8 10068814 00000000 1008c284 1008c294
> c0246180
>=20
> GPR24: c02ab9e4 c02ab9dc c06cc4f4 00000006 cd087e08 00000002 c06c595c
> cf821808
>=20
> NIP [616d6570] 0x616d6570
>=20
> LR [c0165224] platform_pm_suspend_noirq+0x84/0x88
What kernel are you using? platform_pm_suspend_noirq was removed by =20
this commit:
commit 9b39e73d0c2b265a7f8748b0e9a9f09be84079a8
Author: Rafael J. Wysocki <rjw@sisk.pl>
Date: Sun Dec 18 00:34:24 2011 +0100
PM / Sleep: Remove forward-only callbacks from platform bus type
The forward-only PM callbacks provided by the platform bus type are
not necessary any more, because the PM core executes driver =20
callbacks
when the corresponding subsystem callbacks are not present, so drop
them.
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
It seems that a driver's pm ops are getting corrupted -- maybe used =20
after freeing? Have you tried enabling slab/slub debug?
Can you instrument the code to see if there are any fields in the =20
device struct that aren't corrupt, that could point out which device =20
this is?
> I found another thread that dealt with Power Management issues on the
> Freescale MPC8313 processor:
>=20
> https://lists.ozlabs.org/pipermail/linuxppc-dev/2012-January/095240.html
>=20
> The resolution of this issue seems to be related to the JTAG TRST pin =20
> being
> disabled. This is not relevant in my case as the TRST on my board is
> already inactive.
If you were seeing that, you'd see a hang rather than an oops.
-Scott=
^ permalink raw reply
* Re: [PATCH v2] powerpc: book3e: WSP: Add Chroma as a new WSP/PowerEN platform.
From: Scott Wood @ 2012-10-26 17:26 UTC (permalink / raw)
To: Jimi Xenidis; +Cc: linuxppc-dev
In-Reply-To: <DD04A5E8-2850-4DDC-9E7A-B899B0EEEF11@pobox.com>
On Tue, Oct 11, 2011 at 09:47:36AM -0500, Jimi Xenidis wrote:
> On Tue Oct 4 05:02:41 EST 2011, Scott Wood wrote:
>
> Looking at your comments below, will the following be acceptable
>
> > On 09/29/2011 09:27 PM, Jimi Xenidis wrote:
> > > diff --git a/arch/powerpc/platforms/wsp/Kconfig b/arch/powerpc/platforms/wsp/Kconfig
> > > index ea2811c..a3eef8e 100644
> > > --- a/arch/powerpc/platforms/wsp/Kconfig
> > > +++ b/arch/powerpc/platforms/wsp/Kconfig
> > > @@ -1,6 +1,7 @@
> > > config PPC_WSP
> > > bool
> > > select PPC_A2
> > > + select GENERIC_TBSYNC
> > > select PPC_ICSWX
> > > select PPC_SCOM
> > > select PPC_XICS
> > > @@ -8,14 +9,20 @@ config PPC_WSP
> > > select PCI
> > > select PPC_IO_WORKAROUNDS if PCI
> > > select PPC_INDIRECT_PIO if PCI
> > > + select PPC_WSP_COPRO
> > > default n
> > >
> > > menu "WSP platform selection"
> > > depends on PPC_BOOK3E_64
>
> add "&& SMP"
>
> > >
> > > config PPC_PSR2
> > > - bool "PSR-2 platform"
> > > - select GENERIC_TBSYNC
> > > + bool "PowerEN System Reference Platform 2"
> > > + select EPAPR_BOOT
> > > + select PPC_WSP
> > > + default y
>
> Make these "default n"
>
> Will that address everything?
> -jx
Did a patch ever get submitted for this?
-Scott
^ permalink raw reply
* [PATCH RFT RESEND linux-next] powerpc: dma-mapping: support debug_dma_mapping_error
From: Shuah Khan @ 2012-10-26 16:08 UTC (permalink / raw)
To: benh, kyungmin.park, paulus, m.szyprowski, david, arnd, andrzej.p
Cc: linuxppc-dev, LKML, shuahkhan
In-Reply-To: <1351210584.6851.21.camel@lorien2>
Add support for debug_dma_mapping_error() call to avoid warning from
debug_dma_unmap() interface when it checks for mapping error checked
status. Without this patch, device driver failed to check map error
warning is generated.
Signed-off-by: Shuah Khan <shuah.khan@hp.com>
---
arch/powerpc/include/asm/dma-mapping.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/powerpc/include/asm/dma-mapping.h b/arch/powerpc/include/asm/dma-mapping.h
index 7816087..e27e9ad 100644
--- a/arch/powerpc/include/asm/dma-mapping.h
+++ b/arch/powerpc/include/asm/dma-mapping.h
@@ -172,6 +172,7 @@ static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
{
struct dma_map_ops *dma_ops = get_dma_ops(dev);
+ debug_dma_mapping_error(dev, dma_addr);
if (dma_ops->mapping_error)
return dma_ops->mapping_error(dev, dma_addr);
--
1.7.9.5
^ permalink raw reply related
* [PATCH] powerpc: mpc5200: Add a3m071 board support
From: Stefan Roese @ 2012-10-26 15:49 UTC (permalink / raw)
To: linuxppc-dev; +Cc: Anatolij Gustschin
This patch adds the MPC5200B based a3m071 board.
Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Anatolij Gustschin <agust@denx.de>
---
arch/powerpc/boot/dts/a3m071.dts | 153 +++++++++++++++++++++++++++
arch/powerpc/platforms/52xx/mpc5200_simple.c | 1 +
2 files changed, 154 insertions(+)
create mode 100644 arch/powerpc/boot/dts/a3m071.dts
diff --git a/arch/powerpc/boot/dts/a3m071.dts b/arch/powerpc/boot/dts/a3m071.dts
new file mode 100644
index 0000000..46b30f2
--- /dev/null
+++ b/arch/powerpc/boot/dts/a3m071.dts
@@ -0,0 +1,153 @@
+/*
+ * a3m071 board Device Tree Source
+ *
+ * Copyright 2012 Stefan Roese <sr@denx.de>
+ *
+ * Copyright (C) 2011 DENX Software Engineering GmbH
+ * Heiko Schocher <hs@denx.de>
+ *
+ * Copyright (C) 2007 Semihalf
+ * Marian Balakowicz <m8@semihalf.com>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ */
+
+/include/ "mpc5200b.dtsi"
+
+/ {
+ model = "anonymous,a3m071";
+ compatible = "anonymous,a3m071";
+
+ soc5200@f0000000 {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ compatible = "fsl,mpc5200b-immr";
+ ranges = <0 0xf0000000 0x0000c000>;
+ reg = <0xf0000000 0x00000100>;
+ bus-frequency = <0>; /* From boot loader */
+ system-frequency = <0>; /* From boot loader */
+
+ cdm@200 {
+ fsl,init-ext-48mhz-en = <0x0>;
+ fsl,init-fd-enable = <0x01>;
+ fsl,init-fd-counters = <0x3333>;
+ };
+
+ timer@600 {
+ fsl,has-wdt;
+ };
+
+ spi@f00 {
+ status = "disabled";
+ };
+
+ usb: usb@1000 {
+ status = "disabled";
+ };
+
+ psc@2000 {
+ compatible = "fsl,mpc5200b-psc-uart","fsl,mpc5200-psc-uart";
+ reg = <0x2000 0x100>;
+ interrupts = <2 1 0>;
+ };
+
+ psc@2200 {
+ status = "disabled";
+ };
+
+ psc@2400 {
+ status = "disabled";
+ };
+
+ psc@2600 {
+ status = "disabled";
+ };
+
+ psc@2800 {
+ status = "disabled";
+ };
+
+ psc@2c00 { // PSC6
+ compatible = "fsl,mpc5200b-psc-uart","fsl,mpc5200-psc-uart";
+ reg = <0x2c00 0x100>;
+ interrupts = <2 4 0>;
+ };
+
+ ethernet@3000 {
+ phy-handle = <&phy0>;
+ };
+
+ mdio@3000 {
+ phy0: ethernet-phy@3 {
+ reg = <0x03>;
+ };
+ };
+
+ ata@3a00 {
+ status = "disabled";
+ };
+
+ i2c@3d00 {
+ status = "disabled";
+ };
+
+ i2c@3d40 {
+ rtc@51 {
+ compatible = "epson,pcf8563";
+ reg = <0x51>;
+ };
+ };
+ };
+
+ localbus {
+ compatible = "fsl,mpc5200b-lpb","simple-bus";
+ #address-cells = <2>;
+ #size-cells = <1>;
+ ranges = <0 0 0xfc000000 0x02000000
+ 3 0 0xe9000000 0x00080000
+ 5 0 0xe8000000 0x00010000>;
+
+ flash@0,0 {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ reg = <0 0x0 0x02000000>;
+ compatible = "cfi-flash";
+ bank-width = <2>;
+ partition@0x0 {
+ label = "u-boot";
+ reg = <0x00000000 0x00040000>;
+ read-only;
+ };
+ partition@0x00040000 {
+ label = "env";
+ reg = <0x00040000 0x00020000>;
+ };
+ partition@0x00060000 {
+ label = "dtb";
+ reg = <0x00060000 0x00020000>;
+ };
+ partition@0x00080000 {
+ label = "kernel";
+ reg = <0x00080000 0x00500000>;
+ };
+ partition@0x00580000 {
+ label = "root";
+ reg = <0x00580000 0x00A80000>;
+ };
+ };
+
+ fpga@3,0 {
+ compatible = "anonymous,a3m071-fpga";
+ reg = <3 0x0 0x00080000
+ 5 0x0 0x00010000>;
+ interrupts = <0 0 3>; /* level low */
+ };
+ };
+
+ pci@f0000d00 {
+ status = "disabled";
+ };
+};
diff --git a/arch/powerpc/platforms/52xx/mpc5200_simple.c b/arch/powerpc/platforms/52xx/mpc5200_simple.c
index 9cf3602..792a301 100644
--- a/arch/powerpc/platforms/52xx/mpc5200_simple.c
+++ b/arch/powerpc/platforms/52xx/mpc5200_simple.c
@@ -50,6 +50,7 @@ static void __init mpc5200_simple_setup_arch(void)
/* list of the supported boards */
static const char *board[] __initdata = {
+ "anonymous,a3m071",
"anonymous,a4m072",
"anon,charon",
"ifm,o2d",
--
1.8.0
^ permalink raw reply related
* Re: [PATCH 1/1] usb: gadget: Don't attempt to dequeue requests for a disabled USB endpoint on Freescale hardware
From: Felipe Balbi @ 2012-10-26 8:14 UTC (permalink / raw)
To: Laurent Pinchart
Cc: Simon Haggett, Li Yang-R58472, Greg Kroah-Hartman,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, balbi,
linuxppc-dev@lists.ozlabs.org
In-Reply-To: <3862785.b8vaFMSbLQ@avalon>
[-- Attachment #1: Type: text/plain, Size: 1695 bytes --]
Hi,
On Thu, Oct 25, 2012 at 02:36:24AM +0200, Laurent Pinchart wrote:
> Hi Felipe,
>
> On Monday 22 October 2012 13:56:01 Felipe Balbi wrote:
> > On Mon, Oct 22, 2012 at 12:47:21PM +0200, Laurent Pinchart wrote:
> > > On Monday 22 October 2012 03:33:19 Li Yang-R58472 wrote:
> > > > On Saturday, October 20, 2012 1:37 AM Felipe Balbi wrote:
> > > > > On Fri, Oct 19, 2012 at 06:19:26PM +0100, Simon Haggett wrote:
> > > > > > Some gadget drivers may attempt to dequeue requests for an endpoint
> > > > > > that has already been disabled. For example, in the UVC gadget
> > > > > > driver, uvc_function_set_alt() will call usb_ep_disable() when alt
> > > > > > setting 0 is selected. When the userspace application subsequently
> > > > > > issues the VIDIOC_STREAMOFF ioctl, uvc_video_enable() invokes
> > > > > > usb_ep_dequeue() to ensure that all requests have been cancelled.
> > > > >
> > > > > bug is on uvc gadget, then. Laurent ?
> > >
> > > We've discussed this topic a couple of months before. I believe that's not
> > > a bug.
> > >
> > > http://68.183.106.108/lists/linux-usb/msg68869.html
> >
> > fair enough :-)
> >
> > That's a different case, however. At the link above we're discussing
> > dequeueing a request which is already being dequeued. $SUBJECT is trying
> > to fix dequeueing of a request for an endpoint which isn't even enabled.
>
> You've got a point there :-) That's a different case indeed, I'm open to (at
> least evaluating) a fix in the UVC gadget driver if you think that's better.
I _do_ think that's better. If the endpoint isn't even enabled, why are
you trying to dequeue a request ? :-)
cheers
--
balbi
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply
* AUTO: Michael Barry is out of the office (returning 30/10/2012)
From: Michael Barry @ 2012-10-26 3:01 UTC (permalink / raw)
To: linuxppc-dev
I am out of the office until 30/10/2012.
Note: This is an automated response to your message "Linuxppc-dev Digest,
Vol 98, Issue 83" sent on 26/10/2012 1:32:27.
This is the only notification you will receive while this person is away.
^ permalink raw reply
* RE: [PATCH] powerpc/esdhc: enable the card insert/remove interrupt
From: Huang Changming-R66093 @ 2012-10-26 2:42 UTC (permalink / raw)
To: Anton Vorontsov
Cc: linuxppc-dev@lists.ozlabs.org, Chris Ball,
linux-mmc@vger.kernel.org
In-Reply-To: <20121025103038.GA5107@lizard>
[-- Attachment #1: Type: text/plain, Size: 4836 bytes --]
Hi, Anton,
For the current polling mode, driver will send CMD13 to poll the card status periodically , which will cause too many interrupts.
Once I sent patches to detect the card when using polling mode last year: read the state register, instead of send CMD13. But, these patches were not accepted. Now I attach them for you.
Because these patches are not accepted, I think about the interrupt mode to detect card.
Of course, you are right, the p4080ds and mpc837xmds are still using polling mode, which just fix some boards.
The best way is for all.
Then, I will back to my previous patches, for FSL eSDHC, don't send CMD13, and just read state register to check it.
For all FSL silicones, the state bit is updated when card inserting or removing.
Now I have two ways to resolve this issue, I prefer to the polling mode (unfortunately, they are not accepted).
I will be greatly appreciated if you review these attachment patches again and give your comment.
If you think the attachment patches are OK, I will resend them to mail list.
If you don't, I will continue to work on the interrupt mode for FSL eSDHC.
Thanks.
> -----Original Message-----
> From: linux-mmc-owner@vger.kernel.org [mailto:linux-mmc-
> owner@vger.kernel.org] On Behalf Of Anton Vorontsov
> Sent: Thursday, October 25, 2012 6:31 PM
> To: Huang Changming-R66093
> Cc: linux-mmc@vger.kernel.org; Chris Ball; Kumar Gala; linuxppc-
> dev@lists.ozlabs.org
> Subject: Re: [PATCH] powerpc/esdhc: enable the card insert/remove
> interrupt
>
> On Thu, Oct 25, 2012 at 10:05:44AM +0000, Huang Changming-R66093 wrote:
> > Hi, Anton.
> > Could you have any comment about it?
> > If not, I will resend this patch with v2.
>
> Technically, the patch looks fine.
>
> But again, as far as I recall, the card detection logic was broken on the
> SOC level (it's actually very hard to break it on the board level -- it
> would either work or not, but in the eSDHC case it was just unreliable,
> again, if I recall everything correctly -- I might be wrong).
>
> Of course you know the hardware much better, so your words weight more,
> so you don't need my ack on the patch. :)
>
> Although there's a second issue: for P4080DS and mpc837x boards you still
> have the same problem with polling method, right? It is causing
> performance drops/freezes every like 100 ms, and that's why you want to
> avoid the polling.
>
> So, you've "fixed" some boards, but left others to suffer. Ideally, the
> best fix would be to also make the card polling cheap.
>
> Anyways, using (d) clause of the "Reviewer's statement of oversight", I
> can easily give this:
>
> Reviewed-by: Anton Vorontsov <cbouatmailru@gmail.com>
>
> :)
>
> Thanks!
>
> [...]
> > > > IIRC, the card detection is broken SOC-revision-wise, not board-
> wise.
> > > > So the change seems wrong.
> > > >
> > > > Also, take a look at this:
> > > >
> > > > http://lkml.org/lkml/2010/7/14/127
> > > >
> > > > I started the work but never finished, unfortunately it caused
> > > > some regressions for non-FSL hardware...
> > > >
> > > > > drivers/mmc/host/sdhci-of-esdhc.c | 7 ++++++-
> > > > > 1 file changed, 6 insertions(+), 1 deletion(-)
> > > > >
> > > > > diff --git a/drivers/mmc/host/sdhci-of-esdhc.c
> > > > > b/drivers/mmc/host/sdhci-of-esdhc.c
> > > > > index ffc1226..5dc362f 100644
> > > > > --- a/drivers/mmc/host/sdhci-of-esdhc.c
> > > > > +++ b/drivers/mmc/host/sdhci-of-esdhc.c
> > > > > @@ -196,6 +196,11 @@ static void
> > > > > esdhc_of_detect_limitation(struct
> > > > platform_device *pdev,
> > > > > if (vvn == VENDOR_V_22)
> > > > > pdata->quirks2 |= SDHCI_QUIRK2_HOST_NO_CMD23;
> > > > >
> > > > > + /* P4080DS and MPC837XMDS board don't support interrupt mode
> */
> > > > > + if (of_machine_is_compatible("fsl,mpc837xmds") ||
> > > > > + of_machine_is_compatible("fsl,P4080DS"))
> > > > > + pdata->quirks |= SDHCI_QUIRK_BROKEN_CARD_DETECTION;
> > > > > +
> > > > > iounmap(ioaddr);
> > > > > end:
> > > > > return;
> > > > > @@ -223,7 +228,7 @@ static struct sdhci_pltfm_data
> > > > > sdhci_esdhc_pdata =
> > > > {
> > > > > * card detection could be handled via GPIO
> > > > > * eSDHC cannot support End Attribute in NOP ADMA descriptor
> > > > > */
> > > > > - .quirks = ESDHC_DEFAULT_QUIRKS |
> SDHCI_QUIRK_BROKEN_CARD_DETECTION
> > > > > + .quirks = ESDHC_DEFAULT_QUIRKS
> > > > > | SDHCI_QUIRK_NO_CARD_NO_RESET
> > > > > | SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC,
> > > > > .ops = &sdhci_esdhc_ops,
> > > > > --
> > > > > 1.7.9.5
> --
> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
> the body of a message to majordomo@vger.kernel.org More majordomo info at
> http://vger.kernel.org/majordomo-info.html
[-- Attachment #2: 0002-MMC-SD-Add-callback-function-to-detect-card.patch --]
[-- Type: application/octet-stream, Size: 2094 bytes --]
From bd9be632c2ebf77ba067dbb52a8c4bd73be1697b Mon Sep 17 00:00:00 2001
From: Jerry Huang <Chang-Ming.Huang@freescale.com>
Date: Tue, 6 Dec 2011 17:22:27 +0800
Subject: [PATCH 2/4 v4] MMC/SD: Add callback function to detect card
In order to check whether the card has been removed, the function
mmc_send_status() will send command CMD13 to card and ask the card
to send its status register to sdhc driver, which will generate
many interrupts repeatedly and make the system performance bad.
Therefore, add callback function get_cd() to check whether
the card has been removed when the driver has this callback function.
If the card is present, 1 will return, if the card is absent, 0 will return.
If the controller will not support this feature, -ENOSYS will return.
Signed-off-by: Jerry Huang <Chang-Ming.Huang@freescale.com>
CC: Chris Ball <cjb@laptop.org>
---
changes for v2:
- when controller don't support get_cd, return -ENOSYS
- add the CC
changes for v3:
- enalbe the controller clock in platform, instead of core
changes for v4:
- move the detect code to core.c according to the new structure
drivers/mmc/core/core.c | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 6db6621..d570c72 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -2060,7 +2060,7 @@ static int mmc_rescan_try_freq(struct mmc_host *host, unsigned freq)
int _mmc_detect_card_removed(struct mmc_host *host)
{
- int ret;
+ int ret = -ENOSYS;
if ((host->caps & MMC_CAP_NONREMOVABLE) || !host->bus_ops->alive)
return 0;
@@ -2068,7 +2068,13 @@ int _mmc_detect_card_removed(struct mmc_host *host)
if (!host->card || mmc_card_removed(host->card))
return 1;
- ret = host->bus_ops->alive(host);
+ if (host->ops->get_cd) {
+ ret = host->ops->get_cd(host);
+ if (ret >= 0)
+ ret = !ret;
+ }
+ if (ret < 0)
+ ret = host->bus_ops->alive(host);
if (ret) {
mmc_card_set_removed(host->card);
pr_debug("%s: card remove detected\n", mmc_hostname(host));
--
1.7.5.4
[-- Attachment #3: 0003-SDHCI-add-sdhci_get_cd-callback-to-detect-the-card.patch --]
[-- Type: application/octet-stream, Size: 3102 bytes --]
From c029b98325733ea0225389612eb7b9f0f0b722cd Mon Sep 17 00:00:00 2001
From: Jerry Huang <Chang-Ming.Huang@freescale.com>
Date: Wed, 7 Dec 2011 10:41:49 +0800
Subject: [PATCH 3/4 v5] SDHCI: add sdhci_get_cd callback to detect the card
Add callback function sdhci_get_cd to detect the card.
And one new callback added to implement the card detect in sdhci struncture.
If special platform has the card detect callback, it will return the card
state, the value zero is for absent cardi and one is for present card.
If the controller don't support card detect, sdhci_get_cd will return -ENOSYS.
Signed-off-by: Jerry Huang <Chang-Ming.Huang@freescale.com>
CC: Chris Ball <cjb@laptop.org>
---
changes for v2:
- when controller don't support get_cd, return -ENOSYS
- add new callback for sdhci to detect the card
- add the CC
changes for v3:
- use pin_lock only when get_cd defined
changes for v4:
- enalbe the controller clock in platform, instead of core
changes for v5:
- remove the copyright
drivers/mmc/host/sdhci.c | 21 ++++++++++++++++++++++
drivers/mmc/host/sdhci.h | 2 ++
2 files changed, 23 insertions(+), 0 deletions(-)
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 6d8eea3..fbe2f46 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -1518,6 +1519,26 @@ static int sdhci_get_ro(struct mmc_host *mmc)
return ret;
}
+/* Return values for the sdjco_get_cd callback:
+ * 0 for a absent card
+ * 1 for a present card
+ * -ENOSYS when not supported (equal to NULL callback)
+ */
+static int sdhci_get_cd(struct mmc_host *mmc)
+{
+ struct sdhci_host *host = mmc_priv(mmc);
+ unsigned long flags;
+ int present = -ENOSYS;
+
+ if (host->ops->get_cd) {
+ spin_lock_irqsave(&host->lock, flags);
+ present = host->ops->get_cd(host);
+ spin_unlock_irqrestore(&host->lock, flags);
+ }
+
+ return present;
+}
+
static void sdhci_enable_sdio_irq_nolock(struct sdhci_host *host, int enable)
{
if (host->flags & SDHCI_DEVICE_DEAD)
@@ -1884,6 +1905,7 @@ static const struct mmc_host_ops sdhci_ops = {
.request = sdhci_request,
.set_ios = sdhci_set_ios,
.get_ro = sdhci_get_ro,
+ .get_cd = sdhci_get_cd,
.hw_reset = sdhci_hw_reset,
.enable_sdio_irq = sdhci_enable_sdio_irq,
.start_signal_voltage_switch = sdhci_start_signal_voltage_switch,
diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
index 0a5b654..82f4d27 100644
--- a/drivers/mmc/host/sdhci.h
+++ b/drivers/mmc/host/sdhci.h
@@ -69,6 +69,7 @@
#define SDHCI_SPACE_AVAILABLE 0x00000400
#define SDHCI_DATA_AVAILABLE 0x00000800
#define SDHCI_CARD_PRESENT 0x00010000
+#define SDHCI_CARD_CDPL 0x00040000
#define SDHCI_WRITE_PROTECT 0x00080000
#define SDHCI_DATA_LVL_MASK 0x00F00000
#define SDHCI_DATA_LVL_SHIFT 20
@@ -261,6 +262,7 @@ struct sdhci_ops {
void (*set_clock)(struct sdhci_host *host, unsigned int clock);
+ int (*get_cd)(struct sdhci_host *host);
int (*enable_dma)(struct sdhci_host *host);
unsigned int (*get_max_clock)(struct sdhci_host *host);
unsigned int (*get_min_clock)(struct sdhci_host *host);
--
1.7.5.4
[-- Attachment #4: 0004-ESDHC-add-callback-esdhc_of_get_cd-to-detect-card.patch --]
[-- Type: application/octet-stream, Size: 2480 bytes --]
From 99e41c1bacbad5e9a3418bcac2b5f778516efe6d Mon Sep 17 00:00:00 2001
From: Jerry Huang <Chang-Ming.Huang@freescale.com>
Date: Fri, 9 Dec 2011 11:06:58 +0800
Subject: [PATCH 4/4 v3] ESDHC: add callback esdhc_of_get_cd to detect card
In order to check if the card is present, we will read the PRESENT STATE
register and check the bit13(Card detect pin level) and bit15(CINS).
Signed-off-by: Jerry Huang <Chang-Ming.Huang@freescale.com>
CC: Chris Ball <cjb@laptop.org>
---
changes for v2:
- add new callback for esdhc to detect the card state
- add the CC
changes for v3:
- enable the controller clock when detect the card state, not core
drivers/mmc/host/sdhci-of-esdhc.c | 25 ++++++++++++++++++++++++-
1 files changed, 24 insertions(+), 1 deletions(-)
diff --git a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-of-esdhc.c
index 59e9d00..40da8f4 100644
--- a/drivers/mmc/host/sdhci-of-esdhc.c
+++ b/drivers/mmc/host/sdhci-of-esdhc.c
@@ -1,7 +1,7 @@
/*
* Freescale eSDHC controller driver.
*
- * Copyright (c) 2007, 2010 Freescale Semiconductor, Inc.
+ * Copyright (c) 2007, 2010-2011 Freescale Semiconductor, Inc.
* Copyright (c) 2009 MontaVista Software, Inc.
*
* Authors: Xiaobo Xie <X.Xie@freescale.com>
@@ -82,6 +82,28 @@ static unsigned int esdhc_of_get_min_clock(struct sdhci_host *host)
return pltfm_host->clock / 256 / 16;
}
+/* Return: none zero - the card is presetn; 0 - card is absent */
+static int esdhc_of_get_cd(struct sdhci_host *host)
+{
+ int present;
+
+ if (host->flags & SDHCI_DEVICE_DEAD)
+ present = 0;
+ else {
+ int sysctl = sdhci_be32bs_readl(host, SDHCI_CLOCK_CONTROL);
+ /* Enable the controller clock to update the present state */
+ sdhci_be32bs_writel(host, sysctl | SDHCI_CLOCK_INT_EN,
+ SDHCI_CLOCK_CONTROL);
+ /* Detect the card present or absent */
+ present = sdhci_be32bs_readl(host, SDHCI_PRESENT_STATE);
+ present &= (SDHCI_CARD_PRESENT | SDHCI_CARD_CDPL);
+ /* Resve the previous to System control register */
+ sdhci_be32bs_writel(host, sysctl, SDHCI_CLOCK_CONTROL);
+ }
+
+ return present;
+}
+
static struct sdhci_ops sdhci_esdhc_ops = {
.read_l = sdhci_be32bs_readl,
.read_w = esdhc_readw,
@@ -93,6 +115,7 @@ static struct sdhci_ops sdhci_esdhc_ops = {
.enable_dma = esdhc_of_enable_dma,
.get_max_clock = esdhc_of_get_max_clock,
.get_min_clock = esdhc_of_get_min_clock,
+ .get_cd = esdhc_of_get_cd,
};
static struct sdhci_pltfm_data sdhci_esdhc_pdata = {
--
1.7.5.4
[-- Attachment #5: 0001-MMC-core-Add-f_min-to-mmc_power_on.patch --]
[-- Type: application/octet-stream, Size: 1072 bytes --]
From 5abfc594fd26198df957a5710c026d8be6de4f5e Mon Sep 17 00:00:00 2001
From: Jerry Huang <Chang-Ming.Huang@freescale.com>
Date: Mon, 5 Dec 2011 14:28:31 +0800
Subject: [PATCH 1/4 v3] MMC/core: Add f_min to mmc_power_on()
When f_init is zero, the SDHC can't work correctly. So f_min will replace
f_init, when f_init is zero.
Signed-off-by: Jerry Huang <Chang-Ming.Huang@freescale.com>
CC: Chris Ball <cjb@laptop.org>
---
changes for v2:
- add the CC
changes for v3:
- enalbe the controller clock in platform, instead of core
drivers/mmc/core/core.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index a08e6b1..2d40c04 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -1253,7 +1253,10 @@ static void mmc_power_up(struct mmc_host *host)
*/
mmc_delay(10);
- host->ios.clock = host->f_init;
+ if (host->f_init)
+ host->ios.clock = host->f_init;
+ else
+ host->ios.clock = host->f_min;
host->ios.power_mode = MMC_POWER_ON;
mmc_set_ios(host);
--
1.7.5.4
^ permalink raw reply related
* [PATCH RFT] powerpc: dma-mapping: support debug_dma_mapping_error
From: Shuah Khan @ 2012-10-26 0:16 UTC (permalink / raw)
To: benh, paulus, kyungmin.park, m.szyprowski, david, arnd, andrzej.p
Cc: linuxppc-dev, LKML, shuahkhan
Add support for debug_dma_mapping_error() call to avoid warning from
debug_dma_unmap() interface when it checks for mapping error checked
status. Without this patch, device driver failed to check map error
warning is generated.
Signed-off-by: Shuah Khan <shuah.khan@hp.com>
---
arch/powerpc/include/asm/dma-mapping.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/powerpc/include/asm/dma-mapping.h b/arch/powerpc/include/asm/dma-mapping.h
index 7816087..e27e9ad 100644
--- a/arch/powerpc/include/asm/dma-mapping.h
+++ b/arch/powerpc/include/asm/dma-mapping.h
@@ -172,6 +172,7 @@ static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
{
struct dma_map_ops *dma_ops = get_dma_ops(dev);
+ debug_dma_mapping_error(dev, dma_addr);
if (dma_ops->mapping_error)
return dma_ops->mapping_error(dev, dma_addr);
--
1.7.9.5
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox