LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH] watchdog: mpc8xxx_wdt: MPC8xx is HW enabled
From: Guenter Roeck @ 2013-12-02 16:04 UTC (permalink / raw)
  To: Christophe Leroy
  Cc: scottwood, Wim Van Sebroeck, linuxppc-dev, linux-kernel,
	linux-watchdog
In-Reply-To: <20131130154540.E83D743E15@localhost.localdomain>

On Sat, Nov 30, 2013 at 04:45:40PM +0100, Christophe Leroy wrote:
> MPC8xx watchdog is enabled at startup by HW.
> If the bootloader disables it, it cannot be reenabled.
> 
> Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
> 
Reviewed-by: Guenter Roeck <linux@roeck-us.net>

> diff -ur a/drivers/watchdog/mpc8xxx_wdt.c b/drivers/watchdog/mpc8xxx_wdt.c
> --- a/drivers/watchdog/mpc8xxx_wdt.c	2013-05-11 22:57:46.000000000 +0200
> +++ b/drivers/watchdog/mpc8xxx_wdt.c	2013-08-08 02:12:15.000000000 +0200
> @@ -273,6 +310,7 @@
>  		.compatible = "fsl,mpc823-wdt",
>  		.data = &(struct mpc8xxx_wdt_type) {
>  			.prescaler = 0x800,
> +			.hw_enabled = true,
>  		},
>  	},
>  	{},
> 
> ---
> Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce que la protection avast! Antivirus est active.
> http://www.avast.com
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-watchdog" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

^ permalink raw reply

* [PATCH v3] ASoC: fsl_ssi: Add monaural audio support for non-ac97 interface
From: Nicolin Chen @ 2013-12-02 15:29 UTC (permalink / raw)
  To: broonie, timur; +Cc: alsa-devel, linuxppc-dev

The normal mode of SSI allows it to send/receive data to/from the first
slot of each period. So we can use this normal mode to trick I2S signal
by puting/getting data to/from the first slot only (the left channel)
so as to support monaural audio playback and recording.

Signed-off-by: Nicolin Chen <b42378@freescale.com>
---
Changelog
v3:
 * Fixed conflict for git apply.
v2:
 * Moved i2s_mode to ssi_private so that we can save and retore it as needed
 * And dropped the horrible static thing.


 sound/soc/fsl/fsl_ssi.c | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
index fb8f52a..83e4ed8 100644
--- a/sound/soc/fsl/fsl_ssi.c
+++ b/sound/soc/fsl/fsl_ssi.c
@@ -143,6 +143,7 @@ struct fsl_ssi_private {
 	bool ssi_on_imx;
 	bool imx_ac97;
 	bool use_dma;
+	u8 i2s_mode;
 	struct clk *clk;
 	struct snd_dmaengine_dai_dma_data dma_params_tx;
 	struct snd_dmaengine_dai_dma_data dma_params_rx;
@@ -354,14 +355,13 @@ static void fsl_ssi_setup_ac97(struct fsl_ssi_private *ssi_private)
 static int fsl_ssi_setup(struct fsl_ssi_private *ssi_private)
 {
 	struct ccsr_ssi __iomem *ssi = ssi_private->ssi;
-	u8 i2s_mode;
 	u8 wm;
 	int synchronous = ssi_private->cpu_dai_drv.symmetric_rates;
 
 	if (ssi_private->imx_ac97)
-		i2s_mode = CCSR_SSI_SCR_I2S_MODE_NORMAL | CCSR_SSI_SCR_NET;
+		ssi_private->i2s_mode = CCSR_SSI_SCR_I2S_MODE_NORMAL | CCSR_SSI_SCR_NET;
 	else
-		i2s_mode = CCSR_SSI_SCR_I2S_MODE_SLAVE;
+		ssi_private->i2s_mode = CCSR_SSI_SCR_I2S_MODE_SLAVE;
 
 	/*
 	 * Section 16.5 of the MPC8610 reference manual says that the SSI needs
@@ -378,7 +378,7 @@ static int fsl_ssi_setup(struct fsl_ssi_private *ssi_private)
 	write_ssi_mask(&ssi->scr,
 		CCSR_SSI_SCR_I2S_MODE_MASK | CCSR_SSI_SCR_SYN,
 		CCSR_SSI_SCR_TFR_CLK_DIS |
-		i2s_mode |
+		ssi_private->i2s_mode |
 		(synchronous ? CCSR_SSI_SCR_SYN : 0));
 
 	write_ssi(CCSR_SSI_STCR_TXBIT0 | CCSR_SSI_STCR_TFEN0 |
@@ -508,6 +508,7 @@ static int fsl_ssi_hw_params(struct snd_pcm_substream *substream,
 {
 	struct fsl_ssi_private *ssi_private = snd_soc_dai_get_drvdata(cpu_dai);
 	struct ccsr_ssi __iomem *ssi = ssi_private->ssi;
+	unsigned int channels = params_channels(hw_params);
 	unsigned int sample_size =
 		snd_pcm_format_width(params_format(hw_params));
 	u32 wl = CCSR_SSI_SxCCR_WL(sample_size);
@@ -537,6 +538,11 @@ static int fsl_ssi_hw_params(struct snd_pcm_substream *substream,
 	else
 		write_ssi_mask(&ssi->srccr, CCSR_SSI_SxCCR_WL_MASK, wl);
 
+	if (!ssi_private->imx_ac97)
+		write_ssi_mask(&ssi->scr,
+				CCSR_SSI_SCR_NET | CCSR_SSI_SCR_I2S_MODE_MASK,
+				channels == 1 ? 0 : ssi_private->i2s_mode);
+
 	return 0;
 }
 
@@ -649,14 +655,13 @@ static const struct snd_soc_dai_ops fsl_ssi_dai_ops = {
 static struct snd_soc_dai_driver fsl_ssi_dai_template = {
 	.probe = fsl_ssi_dai_probe,
 	.playback = {
-		/* The SSI does not support monaural audio. */
-		.channels_min = 2,
+		.channels_min = 1,
 		.channels_max = 2,
 		.rates = FSLSSI_I2S_RATES,
 		.formats = FSLSSI_I2S_FORMATS,
 	},
 	.capture = {
-		.channels_min = 2,
+		.channels_min = 1,
 		.channels_max = 2,
 		.rates = FSLSSI_I2S_RATES,
 		.formats = FSLSSI_I2S_FORMATS,
-- 
1.8.4

^ permalink raw reply related

* Re: [PATCH v2] ASoC: fsl_ssi: Add monaural audio support for non-ac97 interface
From: Nicolin Chen @ 2013-12-02 15:21 UTC (permalink / raw)
  To: Mark Brown
  Cc: alsa-devel, linux, linux-kernel, lgirdwood, timur, linuxppc-dev
In-Reply-To: <20131202115617.GV27568@sirena.org.uk>

On Mon, Dec 02, 2013 at 11:56:17AM +0000, Mark Brown wrote:
> On Sat, Nov 16, 2013 at 12:25:29AM +0800, Nicolin Chen wrote:
> > The normal mode of SSI allows it to send/receive data to/from the first
> > slot of each period. So we can use this normal mode to trick I2S signal
> > by puting/getting data to/from the first slot only (the left channel)
> > so as to support monaural audio playback and recording.
> 
> This looks OK but doesn't apply against current code, can you please
> check and resend?

Ah, I rebased it on the dual-fifo set. Sorry I didn't make it clean.
I will resend it. Thank you.

^ permalink raw reply

* Re: [PATCH v6 08/17] spi: mpc512x: adjust to OF based clock lookup
From: Gerhard Sittig @ 2013-12-02 15:10 UTC (permalink / raw)
  To: Mark Rutland
  Cc: Mike Turquette, Detlev Zundel, linux-spi@vger.kernel.org,
	Mark Brown, Scott Wood, Anatolij Gustschin,
	linuxppc-dev@lists.ozlabs.org,
	linux-arm-kernel@lists.infradead.org
In-Reply-To: <20131202095034.GB12952@e106331-lin.cambridge.arm.com>

On Mon, Dec 02, 2013 at 09:50 +0000, Mark Rutland wrote:
> 
> On Sat, Nov 30, 2013 at 10:51:28PM +0000, Gerhard Sittig wrote:
> > after device tree based clock lookup became available, the peripheral
> > driver need no longer construct clock names which include the PSC index,
> > remove the "psc%d_mclk" template and unconditionally use 'mclk'
> > 
> > acquire and release the 'ipg' clock item for register access as well
> 
> For this and the other peripheral updates, it would be nice to have the
> expected clock-names entries added to the respective binding documents.
> Otherwise this looks fine to me.

I will look into adding these 'clock-names' to binding documents
for the peripherals, too (not just SPI but the others as well).
Thank you for the feedback!

It appears that not all of those peripherals have existing
binding docs, so introducing these docs in the first place may
exceed the scope of the CCF support introduction series, and I
may have to create another series for the doc updates.  I assume
that it's OK to address the issue of missing documentation in a
separate action.


virtually yours
Gerhard Sittig
-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr. 5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office@denx.de

^ permalink raw reply

* Re: [PATCH V4 7/9] cpuidle/powernv: Add "Fast-Sleep" CPU idle state
From: Preeti U Murthy @ 2013-12-02 15:07 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: michael, r58472, shangw, arnd, linux-pm, geoff, fweisbec,
	linux-kernel, rostedt, deepthi, rjw, paul.gortmaker, paulus,
	srivatsa.bhat, schwidefsky, john.stultz, paulmck, linuxppc-dev,
	chenhui.zhao
In-Reply-To: <alpine.DEB.2.02.1311291301300.30673@ionos.tec.linutronix.de>

Hi Thomas,

On 11/29/2013 08:09 PM, Thomas Gleixner wrote:
> On Fri, 29 Nov 2013, Preeti U Murthy wrote:
>> +static enum hrtimer_restart handle_broadcast(struct hrtimer *hrtimer)
>> +{
>> +	struct clock_event_device *bc_evt = &bc_timer;
>> +	ktime_t interval, next_bc_tick, now;
>> +
>> +	now = ktime_get();
>> +
>> +	if (!restart_broadcast(bc_evt))
>> +		return HRTIMER_NORESTART;
>> +
>> +	interval = ktime_sub(bc_evt->next_event, now);
>> +	next_bc_tick = get_next_bc_tick();
> 
> So you're seriously using a hrtimer to poll in HZ frequency for
> updates of bc->next_event?
> 
> To be honest, this design sucks.
> 
> First of all, why is this a PPC specific feature? There are probably
> other architectures which could make use of this. So this should be
> implemented in the core code to begin with.
> 
> And a lot of the things you need for this are already available in the
> core in one form or the other.
> 
> For a start you can stick the broadcast hrtimer to the cpu which does
> the timekeeping. The handover in the hotplug case is handled there as
> well as is the handover for the NOHZ case.
> 
> This needs to be extended for this hrtimer broadcast thingy to work,
> but it shouldn't be that hard to do so.
> 
> Now for the polling. That's a complete trainwreck.
> 
> This can be solved via the broadcast IPI as well. When a CPU which
> goes down into deep idle sets the broadcast to expire earlier than the
> active value it can denote that and send the timer broadcast IPI over
> to the CPU which has the honour of dealing with this.
> 
> This supports HIGHRES and NO_HZ if done right, without polling at
> all. So you can even let the last CPU which handles the broadcast
> hrtimer go for a long sleep, just not in the deepest idle state.

Thank you for the review. The above points are all valid. I will rework
the design to:

1. Eliminate the concept of a broadcast CPU and integrate its
functionality in the timekeeping CPU.

2. Avoid polling by using IPIs to communicate the next wakeup of the
CPUs in deep idle state so as to reprogram the broadcast hrtimer.

3. Make this feature generic and not arch-specific.

Regards
Preeti U Murthy
> 
> Thanks,
> 
> 	tglx
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev
> 

^ permalink raw reply

* Re: [PATCH v6 02/17] dts: mpc512x: introduce dt-bindings/clock/ header
From: Gerhard Sittig @ 2013-12-02 14:25 UTC (permalink / raw)
  To: Mark Rutland
  Cc: devicetree@vger.kernel.org, Mike Turquette, Pawel Moll,
	Detlev Zundel, Stephen Warren, rob.herring@calxeda.com,
	Scott Wood, Anatolij Gustschin, linuxppc-dev@lists.ozlabs.org,
	linux-arm-kernel@lists.infradead.org, Ian Campbell
In-Reply-To: <20131202094656.GA12952@e106331-lin.cambridge.arm.com>

On Mon, Dec 02, 2013 at 09:46 +0000, Mark Rutland wrote:
> 
> On Sat, Nov 30, 2013 at 10:51:22PM +0000, Gerhard Sittig wrote:
> > introduce a dt-bindings/ header file for MPC512x clocks,
> > providing symbolic identifiers for those SoC clocks which
> > clients will reference from their device tree nodes
> 
> There should be a binding document update to go with this, pointing out
> that this include file defines the set of clock IDs for the MPC512x
> clocks.

It turns out the Freescale MPC512x did not have a separate clocks
binding document, but "just did the usual" and followed the
common bindings.

I've sent a separate doc update patch which becomes applicable
after the CCF implementation got accepted.

> Otherwise, this looks fine to me.

So I take this as a "reviewed by" of yours for this dt-bindings
header file patch, shall I have to re-submit the series.  Thanks!


virtually yours
Gerhard Sittig
-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr. 5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office@denx.de

^ permalink raw reply

* Re: [PATCH] powerpc: fix xmon disassembler for little-endian
From: Tom Musta @ 2013-12-02 14:05 UTC (permalink / raw)
  To: linuxppc-dev
In-Reply-To: <1385975412-25869-1-git-send-email-felix@linux.vnet.ibm.com>

On 12/2/2013 3:10 AM, Philippe Bergheaud wrote:
> This patch fixes the disassembler of the powerpc kernel debugger xmon,
> for little-endian.
> 
> Signed-off-by: Philippe Bergheaud <felix@linux.vnet.ibm.com>
> ---
>  arch/powerpc/xmon/xmon.c |    4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
> index af9d346..6c27804 100644
> --- a/arch/powerpc/xmon/xmon.c
> +++ b/arch/powerpc/xmon/xmon.c
> @@ -171,7 +171,11 @@ extern void xmon_leave(void);
>  #define REG		"%.8lx"
>  #endif
>  
> +#ifdef __LITTLE_ENDIAN__
> +#define GETWORD(v)	(((v)[3] << 24) + ((v)[2] << 16) + ((v)[1] << 8) + (v)[0])
> +#else
>  #define GETWORD(v)	(((v)[0] << 24) + ((v)[1] << 16) + ((v)[2] << 8) + (v)[3])
> +#endif
>  
>  #define isxdigit(c)	(('0' <= (c) && (c) <= '9') \
>  			 || ('a' <= (c) && (c) <= 'f') \
> 

Philippe:  Wouldn't it be better to just do a 32-bit load and let the endianness be worked out
by the hardware?  i.e.

#define GETWORD(v) (*(u32 *)v)


Tom

^ permalink raw reply

* Re: [PATCH v2] ASoC: fsl_ssi: Add monaural audio support for non-ac97 interface
From: Mark Brown @ 2013-12-02 11:56 UTC (permalink / raw)
  To: Nicolin Chen
  Cc: alsa-devel, linux, linux-kernel, lgirdwood, timur, linuxppc-dev
In-Reply-To: <1384532729-6588-1-git-send-email-b42378@freescale.com>

[-- Attachment #1: Type: text/plain, Size: 428 bytes --]

On Sat, Nov 16, 2013 at 12:25:29AM +0800, Nicolin Chen wrote:
> The normal mode of SSI allows it to send/receive data to/from the first
> slot of each period. So we can use this normal mode to trick I2S signal
> by puting/getting data to/from the first slot only (the left channel)
> so as to support monaural audio playback and recording.

This looks OK but doesn't apply against current code, can you please
check and resend?

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply

* Re: [PATCH v6 08/17] spi: mpc512x: adjust to OF based clock lookup
From: Mark Brown @ 2013-12-02 11:32 UTC (permalink / raw)
  To: Gerhard Sittig
  Cc: Mike Turquette, Detlev Zundel, linux-spi, Scott Wood,
	Anatolij Gustschin, linuxppc-dev, linux-arm-kernel
In-Reply-To: <1385851897-23475-9-git-send-email-gsi@denx.de>

[-- Attachment #1: Type: text/plain, Size: 402 bytes --]

On Sat, Nov 30, 2013 at 11:51:28PM +0100, Gerhard Sittig wrote:
> after device tree based clock lookup became available, the peripheral
> driver need no longer construct clock names which include the PSC index,
> remove the "psc%d_mclk" template and unconditionally use 'mclk'
> 
> acquire and release the 'ipg' clock item for register access as well

Acked-by: Mark Brown <broonie@linaro.org.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply

* Re: [PATCH] watchdog: mpc8xxx_wdt convert to watchdog core
From: leroy christophe @ 2013-12-02 10:31 UTC (permalink / raw)
  To: Guenter Roeck, Wim Van Sebroeck, scottwood
  Cc: linuxppc-dev, linux-kernel, linux-watchdog
In-Reply-To: <529B9019.9090404@roeck-us.net>


Le 01/12/2013 20:38, Guenter Roeck a écrit :
> On 11/30/2013 07:33 AM, Christophe Leroy wrote:
>> Convert mpc8xxx_wdt.c to the new watchdog API.
>>
>> Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
>>
>> diff -ur a/drivers/watchdog/mpc8xxx_wdt.c 
>> b/drivers/watchdog/mpc8xxx_wdt.c
>> --- a/drivers/watchdog/mpc8xxx_wdt.c    2013-05-11 22:57:46.000000000 
>> +0200
>> +++ b/drivers/watchdog/mpc8xxx_wdt.c    2013-11-30 16:14:53.803495472 
>> +0100
>> @@ -72,28 +72,31 @@
>>    * to 0
>>    */
>>   static int prescale = 1;
>> -static unsigned int timeout_sec;
>>
>> -static unsigned long wdt_is_open;
>>   static DEFINE_SPINLOCK(wdt_spinlock);
>>
>> -static void mpc8xxx_wdt_keepalive(void)
>> +static int mpc8xxx_wdt_ping(struct watchdog_device *w)
>>   {
>>       /* Ping the WDT */
>>       spin_lock(&wdt_spinlock);
>>       out_be16(&wd_base->swsrr, 0x556c);
>>       out_be16(&wd_base->swsrr, 0xaa39);
>>       spin_unlock(&wdt_spinlock);
>> +    return 0;
>
> The return code is never checked, so you can make this function void.
watchdog .h expects an int function.
Wouldn't it be an error to make it void, if for instance in the future 
the return code is checked by the core ?
>
>>   }
>>
>> +static struct watchdog_device mpc8xxx_wdt_dev;
>>   static void mpc8xxx_wdt_timer_ping(unsigned long arg);
>> -static DEFINE_TIMER(wdt_timer, mpc8xxx_wdt_timer_ping, 0, 0);
>> +static DEFINE_TIMER(wdt_timer, mpc8xxx_wdt_timer_ping, 0,
>> +        (unsigned long)&mpc8xxx_wdt_dev);
>>
>>   static void mpc8xxx_wdt_timer_ping(unsigned long arg)
>>   {
>> -    mpc8xxx_wdt_keepalive();
>> +    struct watchdog_device *w = (struct watchdog_device *)arg;
>> +
>> +    mpc8xxx_wdt_ping(w);
>>       /* We're pinging it twice faster than needed, just to be sure. */
>> -    mod_timer(&wdt_timer, jiffies + HZ * timeout_sec / 2);
>> +    mod_timer(&wdt_timer, jiffies + HZ * w->timeout / 2);
>>   }
>>
>>   static void mpc8xxx_wdt_pr_warn(const char *msg)
>> @@ -102,19 +105,9 @@
>>           reset ? "reset" : "machine check exception");
>>   }
>>
>> -static ssize_t mpc8xxx_wdt_write(struct file *file, const char 
>> __user *buf,
>> -                 size_t count, loff_t *ppos)
>> -{
>> -    if (count)
>> -        mpc8xxx_wdt_keepalive();
>> -    return count;
>> -}
>> -
>> -static int mpc8xxx_wdt_open(struct inode *inode, struct file *file)
>> +static int mpc8xxx_wdt_start(struct watchdog_device *w)
>>   {
>>       u32 tmp = SWCRR_SWEN;
>> -    if (test_and_set_bit(0, &wdt_is_open))
>> -        return -EBUSY;
>>
>>       /* Once we start the watchdog we can't stop it */
>>       if (nowayout)
>
> This code and the subsequent module_get can be removed; it is handled 
> by the infrastructure.
>
>
>> @@ -132,59 +125,30 @@
>>
>>       del_timer_sync(&wdt_timer);
>>
>> -    return nonseekable_open(inode, file);
>> +    return 0;
>>   }
>>
>> -static int mpc8xxx_wdt_release(struct inode *inode, struct file *file)
>> +static int mpc8xxx_wdt_stop(struct watchdog_device *w)
>>   {
>> -    if (!nowayout)
>> -        mpc8xxx_wdt_timer_ping(0);
>> -    else
>> -        mpc8xxx_wdt_pr_warn("watchdog closed");
>> -    clear_bit(0, &wdt_is_open);
>> +    mpc8xxx_wdt_timer_ping((unsigned long)w);
>
> I really dislike this typecasting back and forth.
>
> I think it would be better to move the mod_timer() call from 
> mpc8xxx_wdt_timer_ping
> into mpc8xxx_wdt_ping and call mpc8xxx_wdt_ping directly whenever 
> possible.
> From mpc8xxx_wdt_timer_ping you can then just call mpc8xxx_wdt_ping 
> with the
> typecasted parameter.
I'm not sure I understand what you mean.
mpc8xxx_wdt_ping() is called by the core when the user app writes into 
/dev/watchdog.
We don't want the set the timer in that case.
The timer is only used for when no user app has opened /dev/watchdog yet.

>
>>       return 0;
>>   }
>>
>> -static long mpc8xxx_wdt_ioctl(struct file *file, unsigned int cmd,
>> -                            unsigned long arg)
>> -{
>> -    void __user *argp = (void __user *)arg;
>> -    int __user *p = argp;
>> -    static const struct watchdog_info ident = {
>> -        .options = WDIOF_KEEPALIVEPING,
>> -        .firmware_version = 1,
>> -        .identity = "MPC8xxx",
>> -    };
>> -
>> -    switch (cmd) {
>> -    case WDIOC_GETSUPPORT:
>> -        return copy_to_user(argp, &ident, sizeof(ident)) ? -EFAULT : 0;
>> -    case WDIOC_GETSTATUS:
>> -    case WDIOC_GETBOOTSTATUS:
>> -        return put_user(0, p);
>> -    case WDIOC_KEEPALIVE:
>> -        mpc8xxx_wdt_keepalive();
>> -        return 0;
>> -    case WDIOC_GETTIMEOUT:
>> -        return put_user(timeout_sec, p);
>> -    default:
>> -        return -ENOTTY;
>> -    }
>> -}
>> +static struct watchdog_info mpc8xxx_wdt_info = {
>> +    .options = WDIOF_KEEPALIVEPING,
>> +    .firmware_version = 1,
>> +    .identity = "MPC8xxx",
>> +};
>>
>> -static const struct file_operations mpc8xxx_wdt_fops = {
>> -    .owner        = THIS_MODULE,
>> -    .llseek        = no_llseek,
>> -    .write        = mpc8xxx_wdt_write,
>> -    .unlocked_ioctl    = mpc8xxx_wdt_ioctl,
>> -    .open        = mpc8xxx_wdt_open,
>> -    .release    = mpc8xxx_wdt_release,
>> +static struct watchdog_ops mpc8xxx_wdt_ops = {
>> +    .owner = THIS_MODULE,
>> +    .start = mpc8xxx_wdt_start,
>> +    .stop = mpc8xxx_wdt_stop,
>>   };
>>
>> -static struct miscdevice mpc8xxx_wdt_miscdev = {
>> -    .minor    = WATCHDOG_MINOR,
>> -    .name    = "watchdog",
>> -    .fops    = &mpc8xxx_wdt_fops,
>> +static struct watchdog_device mpc8xxx_wdt_dev = {
>> +    .info = &mpc8xxx_wdt_info,
>> +    .ops = &mpc8xxx_wdt_ops,
>>   };
>>
>>   static const struct of_device_id mpc8xxx_wdt_match[];
>> @@ -196,6 +160,7 @@
>>       const struct mpc8xxx_wdt_type *wdt_type;
>>       u32 freq = fsl_get_sys_freq();
>>       bool enabled;
>> +    unsigned int timeout_sec;
>>
>>       match = of_match_device(mpc8xxx_wdt_match, &ofdev->dev);
>>       if (!match)
>> @@ -222,6 +187,7 @@
>>       else
>>           timeout_sec = timeout / freq;
>>
>> +    mpc8xxx_wdt_dev.timeout = timeout_sec;
>>   #ifdef MODULE
>>       ret = mpc8xxx_wdt_init_late();
>>       if (ret)
>> @@ -237,7 +203,7 @@
>>        * userspace handles it.
>>        */
>>       if (enabled)
>> -        mpc8xxx_wdt_timer_ping(0);
>> +        mpc8xxx_wdt_timer_ping((unsigned long)&mpc8xxx_wdt_dev);
>>       return 0;
>>   err_unmap:
>>       iounmap(wd_base);
>> @@ -249,7 +215,7 @@
>>   {
>>       mpc8xxx_wdt_pr_warn("watchdog removed");
>
> The mpc8xxx_wdt_pr_warn function is now rather unnecessary since
> it is called only once. Might as well merge it into this function.
>
>>       del_timer_sync(&wdt_timer);
>> -    misc_deregister(&mpc8xxx_wdt_miscdev);
>> +    watchdog_unregister_device(&mpc8xxx_wdt_dev);
>>       iounmap(wd_base);
>>
>>       return 0;
>> @@ -301,10 +267,11 @@
>>       if (!wd_base)
>>           return -ENODEV;
>>
>> -    ret = misc_register(&mpc8xxx_wdt_miscdev);
>> +    watchdog_set_nowayout(&mpc8xxx_wdt_dev, nowayout);
>> +
>> +    ret = watchdog_register_device(&mpc8xxx_wdt_dev);
>>       if (ret) {
>> -        pr_err("cannot register miscdev on minor=%d (err=%d)\n",
>> -               WATCHDOG_MINOR, ret);
>> +        pr_err("cannot register watchdog device (err=%d)\n", ret);
>>           return ret;
>>       }
>>       return 0;
>> diff -ur a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
>> --- a/drivers/watchdog/Kconfig
>> +++ b/drivers/watchdog/Kconfig
>> @@ -1146,6 +1146,7 @@
>>   config 8xxx_WDT
>>       tristate "MPC8xxx Platform Watchdog Timer"
>>       depends on PPC_8xx || PPC_83xx || PPC_86xx
>> +    select WATCHDOG_CORE
>>       help
>>         This driver is for a SoC level watchdog that exists on some
>>         Freescale PowerPC processors. So far this driver supports:
>>
>> ---
>> Ce courrier électronique ne contient aucun virus ou logiciel 
>> malveillant parce que la protection avast! Antivirus est active.
>> http://www.avast.com
>>
>> -- 
>> To unsubscribe from this list: send the line "unsubscribe 
>> linux-watchdog" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>>
>>
>

^ permalink raw reply

* Re: 3.13 Oops on ppc64_cpu --smt=off
From: Preeti U Murthy @ 2013-12-02 11:20 UTC (permalink / raw)
  To: Alexander Graf; +Cc: Paul Mackerras, linuxppc-dev
In-Reply-To: <6466B80A-5F19-4D1B-968F-AE19B28EF8DB@suse.de>

Hi,

On 12/02/2013 03:27 PM, Alexander Graf wrote:
> 
> On 02.12.2013, at 05:01, Preeti U Murthy <preeti@linux.vnet.ibm.com> wrote:
> 
>> Hi,
>>
>> On 11/30/2013 11:15 PM, Alexander Graf wrote:
>>> Hi Ben,
>>>
>>> With current linus master (3.13-rc2+) I'm facing an interesting issue with
>>
>> SMT disabling on p7. When I trigger the cpu offlining it works as expected,
>> but after a few seconds the machine goes into an oops as you can see below.
>>>
>>> It looks like a null pointer dereference.
>>
>> tip/sched/urgent has the below fix. Can you please apply the following it and
>> check if the issue gets resolved?  A similar issue was reported earlier as
> 
> I've disabled NO_HZ now on that machine which also "fixed" it for me. Unfortunately I can't reboot that box for at least the next week now to test whether the patch does fix the issue.

The commit 37dc6b50cee9 that has caused this regression is around NO_HZ.
It decides when to kick nohz idle balancing.

Regards
Preeti U Murthy
> 
> 
> Alex
> 

^ permalink raw reply

* Re: 3.13 Oops on ppc64_cpu --smt=off
From: Alexander Graf @ 2013-12-02  9:57 UTC (permalink / raw)
  To: Preeti U Murthy; +Cc: Paul Mackerras, linuxppc-dev
In-Reply-To: <529C0614.6070708@linux.vnet.ibm.com>


On 02.12.2013, at 05:01, Preeti U Murthy <preeti@linux.vnet.ibm.com> =
wrote:

> Hi,
>=20
> On 11/30/2013 11:15 PM, Alexander Graf wrote:
>> Hi Ben,
>>=20
>> With current linus master (3.13-rc2+) I'm facing an interesting issue =
with
>=20
> SMT disabling on p7. When I trigger the cpu offlining it works as =
expected,
> but after a few seconds the machine goes into an oops as you can see =
below.
>>=20
>> It looks like a null pointer dereference.
>=20
> tip/sched/urgent has the below fix. Can you please apply the following =
it and
> check if the issue gets resolved?  A similar issue was reported =
earlier as

I've disabled NO_HZ now on that machine which also "fixed" it for me. =
Unfortunately I can't reboot that box for at least the next week now to =
test whether the patch does fix the issue.


Alex

^ permalink raw reply

* Re: ping: re: [PATCH 1/1] kernel code that do not handle NULL return of kmem_cache_zalloc
From: Alexander Graf @ 2013-12-02  9:54 UTC (permalink / raw)
  To: Zhouyi Zhou
  Cc: kvm@vger.kernel.org mailing list, Zhouyi Zhou, Joerg Roedel,
	linuxppc-dev, kvm-ppc, linux-kernel@vger.kernel.org list,
	Paul Mackerras, David Woodhouse
In-Reply-To: <e9c283.a967.142b14600da.Coremail.yizhouzhou@ict.ac.cn>


On 02.12.2013, at 04:07, Zhouyi Zhou <yizhouzhou@ict.ac.cn> wrote:

> ping
>>  I do a grep for kmem_cache_zalloc and kmem_cache_alloc
>>  in kernel tree, and find some code do not handle NULL
>>  return of kmem_cache_zalloc correctly
>> =20
>> =20
>>  Signed-off-by: Zhouyi Zhou <yizhouzhou@ict.ac.cn>

Thanks a lot for the patch. I'd assume we want something slightly more =
clever even, similar to Paul's d78bca729.

Please beware that it's usually not a good idea to post patches that =
span multiple subtrees. I don't want to apply a patch to my kvm tree =
that touches jffs2 for example, as that's out of my scope. It usually =
makes a maintainer's life easier if you split up a patch like this =
according to tree responsibilities.


Alex

^ permalink raw reply

* Re: [PATCH v6 08/17] spi: mpc512x: adjust to OF based clock lookup
From: Mark Rutland @ 2013-12-02  9:50 UTC (permalink / raw)
  To: Gerhard Sittig
  Cc: Mike Turquette, Detlev Zundel, linux-spi@vger.kernel.org,
	Mark Brown, Scott Wood, Anatolij Gustschin,
	linuxppc-dev@lists.ozlabs.org,
	linux-arm-kernel@lists.infradead.org
In-Reply-To: <1385851897-23475-9-git-send-email-gsi@denx.de>

On Sat, Nov 30, 2013 at 10:51:28PM +0000, Gerhard Sittig wrote:
> after device tree based clock lookup became available, the peripheral
> driver need no longer construct clock names which include the PSC index,
> remove the "psc%d_mclk" template and unconditionally use 'mclk'
> 
> acquire and release the 'ipg' clock item for register access as well

For this and the other peripheral updates, it would be nice to have the
expected clock-names entries added to the respective binding documents.
Otherwise this looks fine to me.

Thanks,
Mark.

> 
> Cc: Mark Brown <broonie@kernel.org>
> Cc: linux-spi@vger.kernel.org
> Signed-off-by: Gerhard Sittig <gsi@denx.de>
> ---
>  drivers/spi/spi-mpc512x-psc.c |   26 ++++++++++++++++++--------
>  1 file changed, 18 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/spi/spi-mpc512x-psc.c b/drivers/spi/spi-mpc512x-psc.c
> index 9602bbd8d7ea..de66c676c248 100644
> --- a/drivers/spi/spi-mpc512x-psc.c
> +++ b/drivers/spi/spi-mpc512x-psc.c
> @@ -40,6 +40,7 @@ struct mpc512x_psc_spi {
>  	unsigned int irq;
>  	u8 bits_per_word;
>  	struct clk *clk_mclk;
> +	struct clk *clk_ipg;
>  	u32 mclk_rate;
>  
>  	struct completion txisrdone;
> @@ -475,8 +476,6 @@ static int mpc512x_psc_spi_do_probe(struct device *dev, u32 regaddr,
>  	struct spi_master *master;
>  	int ret;
>  	void *tempp;
> -	int psc_num;
> -	char clk_name[16];
>  	struct clk *clk;
>  
>  	master = spi_alloc_master(dev, sizeof *mps);
> @@ -520,9 +519,7 @@ static int mpc512x_psc_spi_do_probe(struct device *dev, u32 regaddr,
>  		goto free_master;
>  	init_completion(&mps->txisrdone);
>  
> -	psc_num = master->bus_num;
> -	snprintf(clk_name, sizeof(clk_name), "psc%d_mclk", psc_num);
> -	clk = devm_clk_get(dev, clk_name);
> +	clk = devm_clk_get(dev, "mclk");
>  	if (IS_ERR(clk)) {
>  		ret = PTR_ERR(clk);
>  		goto free_irq;
> @@ -533,17 +530,29 @@ static int mpc512x_psc_spi_do_probe(struct device *dev, u32 regaddr,
>  	mps->clk_mclk = clk;
>  	mps->mclk_rate = clk_get_rate(clk);
>  
> +	clk = devm_clk_get(dev, "ipg");
> +	if (IS_ERR(clk)) {
> +		ret = PTR_ERR(clk);
> +		goto free_mclk_clock;
> +	}
> +	ret = clk_prepare_enable(clk);
> +	if (ret)
> +		goto free_mclk_clock;
> +	mps->clk_ipg = clk;
> +
>  	ret = mpc512x_psc_spi_port_config(master, mps);
>  	if (ret < 0)
> -		goto free_clock;
> +		goto free_ipg_clock;
>  
>  	ret = devm_spi_register_master(dev, master);
>  	if (ret < 0)
> -		goto free_clock;
> +		goto free_ipg_clock;
>  
>  	return ret;
>  
> -free_clock:
> +free_ipg_clock:
> +	clk_disable_unprepare(mps->clk_ipg);
> +free_mclk_clock:
>  	clk_disable_unprepare(mps->clk_mclk);
>  free_irq:
>  	free_irq(mps->irq, mps);
> @@ -561,6 +570,7 @@ static int mpc512x_psc_spi_do_remove(struct device *dev)
>  	struct mpc512x_psc_spi *mps = spi_master_get_devdata(master);
>  
>  	clk_disable_unprepare(mps->clk_mclk);
> +	clk_disable_unprepare(mps->clk_ipg);
>  	free_irq(mps->irq, mps);
>  	if (mps->psc)
>  		iounmap(mps->psc);
> -- 
> 1.7.10.4
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
> 

^ permalink raw reply

* Re: [PATCH v6 02/17] dts: mpc512x: introduce dt-bindings/clock/ header
From: Mark Rutland @ 2013-12-02  9:46 UTC (permalink / raw)
  To: Gerhard Sittig
  Cc: devicetree@vger.kernel.org, Mike Turquette, Pawel Moll,
	Detlev Zundel, Stephen Warren, rob.herring@calxeda.com,
	Scott Wood, Anatolij Gustschin, linuxppc-dev@lists.ozlabs.org,
	linux-arm-kernel@lists.infradead.org, Ian Campbell
In-Reply-To: <1385851897-23475-3-git-send-email-gsi@denx.de>

On Sat, Nov 30, 2013 at 10:51:22PM +0000, Gerhard Sittig wrote:
> introduce a dt-bindings/ header file for MPC512x clocks,
> providing symbolic identifiers for those SoC clocks which
> clients will reference from their device tree nodes

There should be a binding document update to go with this, pointing out
that this include file defines the set of clock IDs for the MPC512x
clocks.

Otherwise, this looks fine to me.

Mark.

> 
> Cc: Rob Herring <rob.herring@calxeda.com>
> Cc: Pawel Moll <pawel.moll@arm.com>
> Cc: Mark Rutland <mark.rutland@arm.com>
> Cc: Stephen Warren <swarren@wwwdotorg.org>
> Cc: Ian Campbell <ian.campbell@citrix.com>
> Cc: devicetree@vger.kernel.org
> Reviewed-by: Mike Turquette <mturquette@linaro.org>	# for v3: w/o bdlc, PSC ipg
> Signed-off-by: Gerhard Sittig <gsi@denx.de>
> ---
>  include/dt-bindings/clock/mpc512x-clock.h |   69 +++++++++++++++++++++++++++++
>  1 file changed, 69 insertions(+)
>  create mode 100644 include/dt-bindings/clock/mpc512x-clock.h
> 
> diff --git a/include/dt-bindings/clock/mpc512x-clock.h b/include/dt-bindings/clock/mpc512x-clock.h
> new file mode 100644
> index 000000000000..9e81b3b99a32
> --- /dev/null
> +++ b/include/dt-bindings/clock/mpc512x-clock.h
> @@ -0,0 +1,69 @@
> +/*
> + * This header provides constants for MPC512x clock specs in DT bindings.
> + */
> +
> +#ifndef _DT_BINDINGS_CLOCK_MPC512x_CLOCK_H
> +#define _DT_BINDINGS_CLOCK_MPC512x_CLOCK_H
> +
> +#define MPC512x_CLK_DUMMY		0
> +#define MPC512x_CLK_REF			1
> +#define MPC512x_CLK_SYS			2
> +#define MPC512x_CLK_DIU			3
> +#define MPC512x_CLK_VIU			4
> +#define MPC512x_CLK_CSB			5
> +#define MPC512x_CLK_E300		6
> +#define MPC512x_CLK_IPS			7
> +#define MPC512x_CLK_FEC			8
> +#define MPC512x_CLK_SATA		9
> +#define MPC512x_CLK_PATA		10
> +#define MPC512x_CLK_NFC			11
> +#define MPC512x_CLK_LPC			12
> +#define MPC512x_CLK_MBX_BUS		13
> +#define MPC512x_CLK_MBX			14
> +#define MPC512x_CLK_MBX_3D		15
> +#define MPC512x_CLK_AXE			16
> +#define MPC512x_CLK_USB1		17
> +#define MPC512x_CLK_USB2		18
> +#define MPC512x_CLK_I2C			19
> +#define MPC512x_CLK_MSCAN0_MCLK		20
> +#define MPC512x_CLK_MSCAN1_MCLK		21
> +#define MPC512x_CLK_MSCAN2_MCLK		22
> +#define MPC512x_CLK_MSCAN3_MCLK		23
> +#define MPC512x_CLK_BDLC		24
> +#define MPC512x_CLK_SDHC		25
> +#define MPC512x_CLK_PCI			26
> +#define MPC512x_CLK_PSC_MCLK_IN		27
> +#define MPC512x_CLK_SPDIF_TX		28
> +#define MPC512x_CLK_SPDIF_RX		29
> +#define MPC512x_CLK_SPDIF_MCLK		30
> +#define MPC512x_CLK_SPDIF		31
> +#define MPC512x_CLK_AC97		32
> +#define MPC512x_CLK_PSC0_MCLK		33
> +#define MPC512x_CLK_PSC1_MCLK		34
> +#define MPC512x_CLK_PSC2_MCLK		35
> +#define MPC512x_CLK_PSC3_MCLK		36
> +#define MPC512x_CLK_PSC4_MCLK		37
> +#define MPC512x_CLK_PSC5_MCLK		38
> +#define MPC512x_CLK_PSC6_MCLK		39
> +#define MPC512x_CLK_PSC7_MCLK		40
> +#define MPC512x_CLK_PSC8_MCLK		41
> +#define MPC512x_CLK_PSC9_MCLK		42
> +#define MPC512x_CLK_PSC10_MCLK		43
> +#define MPC512x_CLK_PSC11_MCLK		44
> +#define MPC512x_CLK_PSC_FIFO		45
> +#define MPC512x_CLK_PSC0		46
> +#define MPC512x_CLK_PSC1		47
> +#define MPC512x_CLK_PSC2		48
> +#define MPC512x_CLK_PSC3		49
> +#define MPC512x_CLK_PSC4		50
> +#define MPC512x_CLK_PSC5		51
> +#define MPC512x_CLK_PSC6		52
> +#define MPC512x_CLK_PSC7		53
> +#define MPC512x_CLK_PSC8		54
> +#define MPC512x_CLK_PSC9		55
> +#define MPC512x_CLK_PSC10		56
> +#define MPC512x_CLK_PSC11		57
> +
> +#define MPC512x_CLK_LAST_PUBLIC		57
> +
> +#endif
> -- 
> 1.7.10.4
> 
> 

^ permalink raw reply

* [PATCH] powerpc: fix xmon disassembler for little-endian
From: Philippe Bergheaud @ 2013-12-02  9:10 UTC (permalink / raw)
  To: Linuxppc-dev; +Cc: Philippe Bergheaud

This patch fixes the disassembler of the powerpc kernel debugger xmon,
for little-endian.

Signed-off-by: Philippe Bergheaud <felix@linux.vnet.ibm.com>
---
 arch/powerpc/xmon/xmon.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index af9d346..6c27804 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -171,7 +171,11 @@ extern void xmon_leave(void);
 #define REG		"%.8lx"
 #endif
 
+#ifdef __LITTLE_ENDIAN__
+#define GETWORD(v)	(((v)[3] << 24) + ((v)[2] << 16) + ((v)[1] << 8) + (v)[0])
+#else
 #define GETWORD(v)	(((v)[0] << 24) + ((v)[1] << 16) + ((v)[2] << 8) + (v)[3])
+#endif
 
 #define isxdigit(c)	(('0' <= (c) && (c) <= '9') \
 			 || ('a' <= (c) && (c) <= 'f') \
-- 
1.7.10.4

^ permalink raw reply related

* [RFC PATCH powerpc 2/2] adjust the variable type and name in __pte_free_tlb()
From: Li Zhong @ 2013-12-03  8:33 UTC (permalink / raw)
  To: PowerPC email list; +Cc: Paul Mackerras
In-Reply-To: <1386059435.2578.13.camel@ThinkPad-T5421>

The patch adjusts the variable type and name for page in
__pte_free_tlb(), which now seems a little confusing. 

Signed-off-by: Li Zhong <zhong@linux.vnet.ibm.com>
---
 arch/powerpc/include/asm/pgalloc-64.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/include/asm/pgalloc-64.h b/arch/powerpc/include/asm/pgalloc-64.h
index d7543c2..1580f9e 100644
--- a/arch/powerpc/include/asm/pgalloc-64.h
+++ b/arch/powerpc/include/asm/pgalloc-64.h
@@ -148,11 +148,11 @@ static inline void pgtable_free_tlb(struct mmu_gather *tlb,
 static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t table,
 				  unsigned long address)
 {
-	struct page *page = page_address(table);
+	void *page_addr = page_address(table);
 
 	tlb_flush_pgtable(tlb, address);
 	pgtable_page_dtor(table);
-	pgtable_free_tlb(tlb, page, 0);
+	pgtable_free_tlb(tlb, page_addr, 0);
 }
 
 #else /* if CONFIG_PPC_64K_PAGES */

^ permalink raw reply related

* [RFC PATCH powerpc 1/2] fix using page adddress as the page stucture pointer in __pte_free_tlb()
From: Li Zhong @ 2013-12-03  8:30 UTC (permalink / raw)
  To: PowerPC email list; +Cc: Paul Mackerras

It seems that in __pte_free_tlb (non 64K page code path), we wrongly
pass the page address as the page structure pointer to
pgtable_page_dtor(), which needs the page structure pointer as the
argument.

The change also fixes following bug on next-1128:

[    0.563113] Unable to handle kernel paging request for data at address 0x00000000
[    0.563121] Faulting instruction address: 0xc0000000001d8e30
[    0.563128] Oops: Kernel access of bad area, sig: 11 [#1]
[    0.563132] PREEMPT SMP NR_CPUS=16 NUMA pSeries
[    0.563143] Modules linked in:
[    0.563150] CPU: 9 PID: 1 Comm: init Not tainted 3.13.0-rc1-next-20131128-dirty #1
[    0.563157] task: c0000001fed40000 ti: c0000001fed3c000 task.ti: c0000001fed3c000
[    0.563163] NIP: c0000000001d8e30 LR: c0000000001da4e8 CTR: c00000000018ed28
[    0.563171] REGS: c0000001fed3f060 TRAP: 0300   Not tainted  (3.13.0-rc1-next-20131128-dirty)
[    0.563177] MSR: 8000000000009032 <SF,EE,ME,IR,DR,RI>  CR: 24222982  XER: 20000001
[    0.563197] CFAR: c0000000001d8e0c DAR: 0000000000000000 DSISR: 42000000 SOFTE: 1 
GPR00: 0000000000000000 c0000001fed3f2e0 c000000000d4ce98 c0000001fe01f500 
GPR04: f000000000000000 0000000000000000 c0000000001a9980 0000000000000000 
GPR08: 0000000000b69000 0000000000040000 c0000001fc550108 0000000000000000 
GPR12: 0000000044779982 c00000000f33eb00 0000002000000000 1000000000000000 
GPR16: c000000000000000 0000000000000001 c0000001fcbd8000 c0000001fa4b83f8 
GPR20: 00000000ffffffff 00003fffffe00000 c0000001fa0a8ff8 0000000000000000 
GPR24: 0000000000000029 c0000001fed3c000 0000000000210d00 0000000000000001 
GPR28: 0000000000000000 0000000000000000 c0000001fe01f500 f000000000000000 
[    0.563299] NIP [c0000000001d8e30] .__slab_free+0xc8/0x42c
[    0.563306] LR [c0000000001da4e8] .kmem_cache_free+0x1d4/0x364
[    0.563311] Call Trace:
[    0.563316] [c0000001fed3f2e0] [6db6db6db6db6db7] 0x6db6db6db6db6db7 (unreliable)
[    0.563325] [c0000001fed3f410] [c0000000001da4e8] .kmem_cache_free+0x1d4/0x364
[    0.563334] [c0000001fed3f4d0] [c0000000001a9980] .ptlock_free+0x2c/0x44
[    0.563342] [c0000001fed3f550] [c0000000001aec98] .free_pgd_range+0x340/0x3d8
[    0.563350] [c0000001fed3f680] [c0000000001ee6b8] .shift_arg_pages+0x130/0x1a0
[    0.563358] [c0000001fed3f7c0] [c0000000001ee888] .setup_arg_pages+0x160/0x214
[    0.563366] [c0000001fed3f870] [c000000000257664] .load_elf_binary+0x540/0x168c
[    0.563374] [c0000001fed3f9d0] [c0000000001ecf28] .search_binary_handler+0xcc/0x238
[    0.563382] [c0000001fed3fa80] [c0000000002551e8] .load_script+0x26c/0x290
[    0.563390] [c0000001fed3fb90] [c0000000001ecf28] .search_binary_handler+0xcc/0x238
[    0.563397] [c0000001fed3fc40] [c0000000001ef1f4] .do_execve_common+0x6b4/0xa0c
[    0.563406] [c0000001fed3fd20] [c0000000001ef634] .do_execve+0x40/0x58
[    0.563414] [c0000001fed3fdb0] [c00000000000bdb4] .kernel_init+0x74/0x158
[    0.563422] [c0000001fed3fe30] [c00000000000a0ec] .ret_from_kernel_thread+0x5c/0x70
[    0.563429] Instruction dump:
[    0.563433] 635a0d00 3b600001 2fbc0000 41fe0014 e8810070 7f83e378 486543c1 60000000 
[    0.563450] e81e0022 829f0018 92810090 eaff0010 <7efd012a> a1210090 8aa10093 3809ffff 
[    0.563469] ---[ end trace 3be1fd3d950f1716 ]---

Signed-off-by: Li Zhong <zhong@linux.vnet.ibm.com>
---
 arch/powerpc/include/asm/pgalloc-64.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/include/asm/pgalloc-64.h b/arch/powerpc/include/asm/pgalloc-64.h
index 6940128..d7543c2 100644
--- a/arch/powerpc/include/asm/pgalloc-64.h
+++ b/arch/powerpc/include/asm/pgalloc-64.h
@@ -151,7 +151,7 @@ static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t table,
 	struct page *page = page_address(table);
 
 	tlb_flush_pgtable(tlb, address);
-	pgtable_page_dtor(page);
+	pgtable_page_dtor(table);
 	pgtable_free_tlb(tlb, page, 0);
 }
 

^ permalink raw reply related

* re: ping: re:[PATCH 1/1] kernel code that do not handle NULL return of kmem_cache_zalloc
From: zhouzhouyi @ 2013-12-02  7:19 UTC (permalink / raw)
  To: linux-kernel, linuxppc-dev, kvm-ppc, kvm, dwmw2, joro, benh; +Cc: Zhouyi Zhou

From: Zhouyi Zhou <zhouzhouyi@gmail.com>

the text of previous ping message maybe garbled sorry for the trouble

> I do a grep for kmem_cache_zalloc and kmem_cache_alloc
> in kernel tree, and find some code do not handle NULL
> return of kmem_cache_zalloc correctly


> Signed-off-by: Zhouyi Zhou <yizhouzhou@ict.ac.cn>
---
 arch/powerpc/kvm/book3s_32_mmu_host.c |    5 +++++
 drivers/iommu/omap-iommu.c            |    3 ++-
 fs/jffs2/malloc.c                     |    4 ++++
 3 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/kvm/book3s_32_mmu_host.c b/arch/powerpc/kvm/book3s_32_mmu_host.c
index 3a0abd2..5fac89d 100644
--- a/arch/powerpc/kvm/book3s_32_mmu_host.c
+++ b/arch/powerpc/kvm/book3s_32_mmu_host.c
@@ -243,6 +243,11 @@ next_pteg:
 	/* Now tell our Shadow PTE code about the new page */
 
 	pte = kvmppc_mmu_hpte_cache_next(vcpu);
+	if (!pte) {
+		kvm_release_pfn_clean(hpaddr >> PAGE_SHIFT);
+		r = -EAGAIN;
+		goto out;
+	}
 
 	dprintk_mmu("KVM: %c%c Map 0x%llx: [%lx] 0x%llx (0x%llx) -> %lx\n",
 		    orig_pte->may_write ? 'w' : '-',
diff --git a/drivers/iommu/omap-iommu.c b/drivers/iommu/omap-iommu.c
index bcd78a7..5155714 100644
--- a/drivers/iommu/omap-iommu.c
+++ b/drivers/iommu/omap-iommu.c
@@ -551,7 +551,8 @@ static u32 *iopte_alloc(struct omap_iommu *obj, u32 *iopgd, u32 da)
 		dev_vdbg(obj->dev, "%s: a new pte:%p\n", __func__, iopte);
 	} else {
 		/* We raced, free the reduniovant table */
-		iopte_free(iopte);
+		if (iopte)
+			iopte_free(iopte);
 	}
 
 pte_ready:
diff --git a/fs/jffs2/malloc.c b/fs/jffs2/malloc.c
index 4f47aa2..58e2336 100644
--- a/fs/jffs2/malloc.c
+++ b/fs/jffs2/malloc.c
@@ -287,6 +287,8 @@ struct jffs2_xattr_datum *jffs2_alloc_xattr_datum(void)
 {
 	struct jffs2_xattr_datum *xd;
 	xd = kmem_cache_zalloc(xattr_datum_cache, GFP_KERNEL);
+	if (!xd)
+		return NULL;
 	dbg_memalloc("%p\n", xd);
 
 	xd->class = RAWNODE_CLASS_XATTR_DATUM;
@@ -305,6 +307,8 @@ struct jffs2_xattr_ref *jffs2_alloc_xattr_ref(void)
 {
 	struct jffs2_xattr_ref *ref;
 	ref = kmem_cache_zalloc(xattr_ref_cache, GFP_KERNEL);
+	if (!ref)
+		return NULL;
 	dbg_memalloc("%p\n", ref);
 
 	ref->class = RAWNODE_CLASS_XATTR_REF;
-- 
1.7.10.4

^ permalink raw reply related

* Re: [PATCH] watchdog: mpc8xxx_wdt: MPC8xx is HW enabled
From: Wolfgang Denk @ 2013-12-02  6:14 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: linux-watchdog, linux-kernel, Wim Van Sebroeck, scottwood,
	linuxppc-dev
In-Reply-To: <529B9152.9090106@roeck-us.net>

Dear Guenter,

In message <529B9152.9090106@roeck-us.net> you wrote:
> On 11/30/2013 07:45 AM, Christophe Leroy wrote:
> > MPC8xx watchdog is enabled at startup by HW.
> > If the bootloader disables it, it cannot be reenabled.
> 
> Is that true for all variants of 8xx, especially for 823 ? I am a bit concerned
> about breaking compatibility with some chips ... assuming there was a reason
> for not setting this flag originally.

This is correct, and applies for all variants of the MPC8xx, including
the MPC823 / MPC823E.  From the UM:

	"The software watchdog timer can be disabled or its timeout
	period can be changed in the SYPCR. Once the SYPCR is written,
	it cannot be written again until a system reset."

Actually this is the only correct behaviour.  Any watchdog that can be
disabled by software is not worth it's name, and unsuitable for any
kind of aplications where security / reliability are required.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@denx.de
Ninety-Ninety Rule of Project Schedules:
        The first ninety percent of the task takes ninety percent of
the time, and the last ten percent takes the other ninety percent.

^ permalink raw reply

* Re: 3.13 Oops on ppc64_cpu --smt=off
From: Preeti U Murthy @ 2013-12-02  4:01 UTC (permalink / raw)
  To: Alexander Graf; +Cc: Paul Mackerras, linuxppc-dev
In-Reply-To: <9C236EE3-BB04-4BF9-ACE0-870A9E97EA0F@suse.de>

Hi,

On 11/30/2013 11:15 PM, Alexander Graf wrote:
> Hi Ben,
> 
> With current linus master (3.13-rc2+) I'm facing an interesting issue with

SMT disabling on p7. When I trigger the cpu offlining it works as expected,
but after a few seconds the machine goes into an oops as you can see below.
> 
> It looks like a null pointer dereference.

tip/sched/urgent has the below fix. Can you please apply the following it and
check if the issue gets resolved?  A similar issue was reported earlier as
well and it pointed to the commit id 37dc65. I believe the problem that you report
is also pointing to the regression caused by the same commit id.

Thanks

Regards
Preeti U Murthy

---
commit 42eb088ed246a5a817bb45a8b32fe234cf1c0f8b
Author: Peter Zijlstra <peterz@infradead.org>
Date:   Tue Nov 19 16:41:49 2013 +0100

    sched: Avoid NULL dereference on sd_busy
    
    Commit 37dc6b50cee9 ("sched: Remove unnecessary iteration over sched
    domains to update nr_busy_cpus") forgot to clear 'sd_busy' under some
    conditions leading to a possible NULL deref in set_cpu_sd_state_idle().
    
    Reported-by: Anton Blanchard <anton@samba.org>
    Cc: Preeti U Murthy <preeti@linux.vnet.ibm.com>
    Signed-off-by: Peter Zijlstra <peterz@infradead.org>
    Link: http://lkml.kernel.org/r/20131118113701.GF3866@twins.programming.kicks-ass.net
    Signed-off-by: Ingo Molnar <mingo@kernel.org>

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index c1808606ee5f..a1591ca7eb5a 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -4910,8 +4910,9 @@ static void update_top_cache_domain(int cpu)
 	if (sd) {
 		id = cpumask_first(sched_domain_span(sd));
 		size = cpumask_weight(sched_domain_span(sd));
-		rcu_assign_pointer(per_cpu(sd_busy, cpu), sd->parent);
+		sd = sd->parent; /* sd_busy */
 	}
+	rcu_assign_pointer(per_cpu(sd_busy, cpu), sd);

 	rcu_assign_pointer(per_cpu(sd_llc, cpu), sd);
 	per_cpu(sd_llc_size, cpu) = size;


> 
> 
> Alex
> 
> ($ ppc64_cpu --smt=off)
> kvm: disabling virtualization on CPU1
> kvm: disabling virtualization on CPU2
> kvm: disabling virtualization on CPU3
> kvm: disabling virtualization on CPU5
> kvm: disabling virtualization on CPU6
> kvm: disabling virtualization on CPU7
> kvm: disabling virtualization on CPU9
> kvm: disabling virtualization on CPU10
> kvm: disabling virtualization on CPU11
> kvm: disabling virtualization on CPU13
> kvm: disabling virtualization on CPU14
> kvm: disabling virtualization on CPU15
> kvm: disabling virtualization on CPU17
> kvm: disabling virtualization on CPU18
> kvm: disabling virtualization on CPU19
> kvm: disabling virtualization on CPU21
> kvm: disabling virtualization on CPU22
> kvm: disabling virtualization on CPU23
> kvm: disabling virtualization on CPU25
> kvm: disabling virtualization on CPU26
> kvm: disabling virtualization on CPU27
> kvm: disabling virtualization on CPU29
> kvm: disabling virtualization on CPU30
> kvm: disabling virtualization on CPU31
> kvm: disabling virtualization on CPU33
> kvm: disabling virtualization on CPU34
> kvm: disabling virtualization on CPU35
> kvm: disabling virtualization on CPU37
> kvm: disabling virtualization on CPU38
> kvm: disabling virtualization on CPU39
> kvm: disabling virtualization on CPU41
> kvm: disabling virtualization on CPU42
> kvm: disabling virtualization on CPU43
> kvm: disabling virtualization on CPU45
> kvm: disabling virtualization on CPU46
> kvm: disabling virtualization on CPU47
> kvm: disabling virtualization on CPU49
> kvm: disabling virtualization on CPU50
> kvm: disabling virtualization on CPU51
> kvm: disabling virtualization on CPU53
> kvm: disabling virtualization on CPU54
> kvm: disabling virtualization on CPU55
> kvm: disabling virtualization on CPU57
> kvm: disabling virtualization on CPU58
> kvm: disabling virtualization on CPU59
> kvm: disabling virtualization on CPU61
> kvm: disabling virtualization on CPU62
> kvm: disabling virtualization on CPU63
> Unable to handle kernel paging request for data at address 0x00000010
> Faulting instruction address: 0xc000000000124188
> Oops: Kernel access of bad area, sig: 11 [#1]
> SMP NR_CPUS=1024 NUMA PowerNV
> Modules linked in: iptable_filter ip_tables x_tables nfsv3 nfs_acl nfs fscache lockd sunrpc autofs4 binfmt_misc af_packet fuse loop dm_mod ohci_pci ohci_hcd ehci_pci ehci_hcd e1000e usbcore sr_mod cdrom ses enclosure rtc_generic usb_common ptp sg pps_core sd_mod crc_t10dif crct10dif_common scsi_dh_hp_sw scsi_dh_alua scsi_dh_emc scsi_dh_rdac scsi_dh virtio_pci virtio_console virtio_blk virtio virtio_ring ipr libata scsi_mod
> CPU: 56 PID: 0 Comm: swapper/56 Not tainted 3.13.0-rc2-0.g01695c8-default+ #1
> task: c0000007f28b5180 ti: c0000007f28c8000 task.ti: c0000007f28c8000
> NIP: c000000000124188 LR: c000000000124144 CTR: c00000000011e650
> REGS: c0000007f28cb1e0 TRAP: 0300   Not tainted  (3.13.0-rc2-0.g01695c8-default+)
> MSR: 9000000000009032 <SF,HV,EE,ME,IR,DR,RI>  CR: 24000028  XER: 00000000
> CFAR: c00000000000908c DAR: 0000000000000010 DSISR: 40000000 SOFTE: 0
> GPR00: 00000000ef4546c9 c0000007f28cb460 c0000000013c7690 0000000000000000
> GPR04: 0000000000000038 0000000000000010 c000000003314ea0 c000000000c72878
> GPR08: c000000000c83448 c0000007ef454600 0000000002690000 0000000000000000
> GPR12: 000000000000c345 c00000000ff0e000 c0000007f28cb8b0 0000000000000001
> GPR16: 7fffffffffffffff c0000007f28cb8c0 0000000002690000 000000219729878b
> GPR20: 0000000000000000 c000000000c72698 c0000000033027d0 c00000000142ca58
> GPR24: c000000000c84e80 c000000003314e80 c00000000142ca58 00000000ffffc32c
> GPR28: 0000000000000038 c0000007f28b5180 c0000000012f8cd0 c000000001422180
> NIP [c000000000124188] .trigger_load_balance+0xc8/0x2e0
> LR [c000000000124144] .trigger_load_balance+0x84/0x2e0
> Call Trace:
> [c0000007f28cb460] [c000000000124134] .trigger_load_balance+0x74/0x2e0 (unreliable)
> [c0000007f28cb510] [c00000000011ca50] .scheduler_tick+0x100/0x160
> [c0000007f28cb5d0] [c0000000000e9074] .update_process_times+0x64/0x90
> [c0000007f28cb660] [c0000000001628f4] .tick_sched_handle+0x34/0xc0
> [c0000007f28cb6f0] [c000000000162c60] .tick_sched_timer+0x70/0xc0
> [c0000007f28cb790] [c000000000109000] .__run_hrtimer+0x180/0x280
> [c0000007f28cb840] [c000000000109738] .hrtimer_interrupt+0x158/0x340
> [c0000007f28cb960] [c00000000001ec74] .timer_interrupt+0x174/0x2d0
> [c0000007f28cba10] [c000000000002824] decrementer_common+0x124/0x180
> --- Exception: 901 at .arch_local_irq_restore+0x84/0xa0
>     LR = .arch_local_irq_restore+0x84/0xa0
> [c0000007f28cbd00] [c000000000010c34] .arch_local_irq_restore+0x54/0xa0 (unreliable)
> [c0000007f28cbd70] [c0000000000174f8] .arch_cpu_idle+0xc8/0x170
> [c0000007f28cbe00] [c00000000014597c] .cpu_idle_loop+0x9c/0x2c0
> [c0000007f28cbed0] [c00000000003f800] .start_secondary+0x2a0/0x2d0
> [c0000007f28cbf90] [c0000000000097fc] .start_secondary_prolog+0x10/0x14
> Instruction dump:
> 78001f24 e8fe8040 7d7a002a 7ce93b78 7d29582a 2fa90000 419e0030 8009004c
> 2f800000 419e0024 9069004c e9690010 <e92b0010> 3929001c 7c004828 30000001
> ---[ end trace 5d5f06c369432fa1 ]---
> 
> Kernel panic - not syncing: Fatal exception in interrupt
> Rebooting in 100 seconds..
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev
> 

^ permalink raw reply related

* ping: re: [PATCH 1/1] kernel code that do not handle NULL return of kmem_cache_zalloc
From: Zhouyi Zhou @ 2013-12-02  3:07 UTC (permalink / raw)
  To: Zhouyi Zhou
  Cc: kvm, linuxppc-dev, Joerg Roedel, linux-kernel, kvm-ppc,
	David Woodhouse
In-Reply-To: <1385549465-15945-1-git-send-email-yizhouzhou@ict.ac.cn>

ping
>=C2=A0I=C2=A0do=C2=A0a=C2=A0grep=C2=A0for=C2=A0kmem_cache_zalloc=C2=A0and=
=C2=A0kmem_cache_alloc
>=C2=A0in=C2=A0kernel=C2=A0tree,=C2=A0and=C2=A0find=C2=A0some=C2=A0code=C2=
=A0do=C2=A0not=C2=A0handle=C2=A0NULL
>=C2=A0return=C2=A0of=C2=A0kmem_cache_zalloc=C2=A0correctly
>=C2=A0
>=C2=A0
>=C2=A0Signed-off-by:=C2=A0Zhouyi=C2=A0Zhou=C2=A0<yizhouzhou@ict.ac.cn>
>=C2=A0---
>=C2=A0=C2=A0arch/powerpc/kvm/book3s_32_mmu_host.c=C2=A0|=C2=A0=C2=A0=C2=A0=
=C2=A05=C2=A0+++++
>=C2=A0=C2=A0drivers/iommu/omap-iommu.c=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0|=C2=A0=C2=A0=C2=A0=C2=A03=C2=A0++-
>=C2=A0=C2=A0fs/jffs2/malloc.c=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0|=C2=A0=C2=A0=C2=A0=C2=A04=C2=A0++++
>=C2=A0=C2=A03=C2=A0files=C2=A0changed,=C2=A011=C2=A0insertions(+),=C2=A01=
=C2=A0deletion(-)
>=C2=A0
>=C2=A0diff=C2=A0--git=C2=A0a/arch/powerpc/kvm/book3s_32_mmu_host.c=C2=A0b/=
arch/powerpc/kvm/book3s_32_mmu_host.c
>=C2=A0index=C2=A03a0abd2..5fac89d=C2=A0100644
>=C2=A0---=C2=A0a/arch/powerpc/kvm/book3s_32_mmu_host.c
>=C2=A0+++=C2=A0b/arch/powerpc/kvm/book3s_32_mmu_host.c
>=C2=A0@@=C2=A0-243,6=C2=A0+243,11=C2=A0@@=C2=A0next_pteg:
>=C2=A0=C2=A0=09/*=C2=A0Now=C2=A0tell=C2=A0our=C2=A0Shadow=C2=A0PTE=C2=A0co=
de=C2=A0about=C2=A0the=C2=A0new=C2=A0page=C2=A0*/
>=C2=A0=C2=A0
>=C2=A0=C2=A0=09pte=C2=A0=3D=C2=A0kvmppc_mmu_hpte_cache_next(vcpu);
>=C2=A0+=09if=C2=A0(!pte)=C2=A0{
>=C2=A0+=09=09kvm_release_pfn_clean(hpaddr=C2=A0>>=C2=A0PAGE_SHIFT);
>=C2=A0+=09=09r=C2=A0=3D=C2=A0-EAGAIN;
>=C2=A0+=09=09goto=C2=A0out;
>=C2=A0+=09}
>=C2=A0=C2=A0
>=C2=A0=C2=A0=09dprintk_mmu("KVM:=C2=A0%c%c=C2=A0Map=C2=A00x%llx:=C2=A0[%lx=
]=C2=A00x%llx=C2=A0(0x%llx)=C2=A0->=C2=A0%lx\n",
>=C2=A0=C2=A0=09=09=C2=A0=C2=A0=C2=A0=C2=A0orig_pte->may_write=C2=A0?=C2=A0=
'w'=C2=A0:=C2=A0'-',
>=C2=A0diff=C2=A0--git=C2=A0a/drivers/iommu/omap-iommu.c=C2=A0b/drivers/iom=
mu/omap-iommu.c
>=C2=A0index=C2=A0bcd78a7..5155714=C2=A0100644
>=C2=A0---=C2=A0a/drivers/iommu/omap-iommu.c
>=C2=A0+++=C2=A0b/drivers/iommu/omap-iommu.c
>=C2=A0@@=C2=A0-551,7=C2=A0+551,8=C2=A0@@=C2=A0static=C2=A0u32=C2=A0*iopte_=
alloc(struct=C2=A0omap_iommu=C2=A0*obj,=C2=A0u32=C2=A0*iopgd,=C2=A0u32=C2=
=A0da)
>=C2=A0=C2=A0=09=09dev_vdbg(obj->dev,=C2=A0"%s:=C2=A0a=C2=A0new=C2=A0pte:%p=
\n",=C2=A0__func__,=C2=A0iopte);
>=C2=A0=C2=A0=09}=C2=A0else=C2=A0{
>=C2=A0=C2=A0=09=09/*=C2=A0We=C2=A0raced,=C2=A0free=C2=A0the=C2=A0reduniova=
nt=C2=A0table=C2=A0*/
>=C2=A0-=09=09iopte_free(iopte);
>=C2=A0+=09=09if=C2=A0(iopte)
>=C2=A0+=09=09=09iopte_free(iopte);
>=C2=A0=C2=A0=09}
>=C2=A0=C2=A0
>=C2=A0=C2=A0pte_ready:
>=C2=A0diff=C2=A0--git=C2=A0a/fs/jffs2/malloc.c=C2=A0b/fs/jffs2/malloc.c
>=C2=A0index=C2=A04f47aa2..58e2336=C2=A0100644
>=C2=A0---=C2=A0a/fs/jffs2/malloc.c
>=C2=A0+++=C2=A0b/fs/jffs2/malloc.c
>=C2=A0@@=C2=A0-287,6=C2=A0+287,8=C2=A0@@=C2=A0struct=C2=A0jffs2_xattr_datu=
m=C2=A0*jffs2_alloc_xattr_datum(void)
>=C2=A0=C2=A0{
>=C2=A0=C2=A0=09struct=C2=A0jffs2_xattr_datum=C2=A0*xd;
>=C2=A0=C2=A0=09xd=C2=A0=3D=C2=A0kmem_cache_zalloc(xattr_datum_cache,=C2=A0=
GFP_KERNEL);
>=C2=A0+=09if=C2=A0(!xd)
>=C2=A0+=09=09return=C2=A0NULL;
>=C2=A0=C2=A0=09dbg_memalloc("%p\n",=C2=A0xd);
>=C2=A0=C2=A0
>=C2=A0=C2=A0=09xd->class=C2=A0=3D=C2=A0RAWNODE_CLASS_XATTR_DATUM;
>=C2=A0@@=C2=A0-305,6=C2=A0+307,8=C2=A0@@=C2=A0struct=C2=A0jffs2_xattr_ref=
=C2=A0*jffs2_alloc_xattr_ref(void)
>=C2=A0=C2=A0{
>=C2=A0=C2=A0=09struct=C2=A0jffs2_xattr_ref=C2=A0*ref;
>=C2=A0=C2=A0=09ref=C2=A0=3D=C2=A0kmem_cache_zalloc(xattr_ref_cache,=C2=A0G=
FP_KERNEL);
>=C2=A0+=09if=C2=A0(!ref)
>=C2=A0+=09=09return=C2=A0NULL;
>=C2=A0=C2=A0=09dbg_memalloc("%p\n",=C2=A0ref);
>=C2=A0=C2=A0
>=C2=A0=C2=A0=09ref->class=C2=A0=3D=C2=A0RAWNODE_CLASS_XATTR_REF;
>=C2=A0--=C2=A0
>=C2=A01.7.10.4
>=C2=A0

^ permalink raw reply

* Re: [PATCH] watchdog: mpc8xxx_wdt convert to watchdog core
From: Guenter Roeck @ 2013-12-01 19:38 UTC (permalink / raw)
  To: Christophe Leroy, Wim Van Sebroeck, scottwood
  Cc: linuxppc-dev, linux-kernel, linux-watchdog
In-Reply-To: <20131130153345.3070443E15@localhost.localdomain>

On 11/30/2013 07:33 AM, Christophe Leroy wrote:
> Convert mpc8xxx_wdt.c to the new watchdog API.
>
> Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
>
> diff -ur a/drivers/watchdog/mpc8xxx_wdt.c b/drivers/watchdog/mpc8xxx_wdt.c
> --- a/drivers/watchdog/mpc8xxx_wdt.c	2013-05-11 22:57:46.000000000 +0200
> +++ b/drivers/watchdog/mpc8xxx_wdt.c	2013-11-30 16:14:53.803495472 +0100
> @@ -72,28 +72,31 @@
>    * to 0
>    */
>   static int prescale = 1;
> -static unsigned int timeout_sec;
>
> -static unsigned long wdt_is_open;
>   static DEFINE_SPINLOCK(wdt_spinlock);
>
> -static void mpc8xxx_wdt_keepalive(void)
> +static int mpc8xxx_wdt_ping(struct watchdog_device *w)
>   {
>   	/* Ping the WDT */
>   	spin_lock(&wdt_spinlock);
>   	out_be16(&wd_base->swsrr, 0x556c);
>   	out_be16(&wd_base->swsrr, 0xaa39);
>   	spin_unlock(&wdt_spinlock);
> +	return 0;

The return code is never checked, so you can make this function void.

>   }
>
> +static struct watchdog_device mpc8xxx_wdt_dev;
>   static void mpc8xxx_wdt_timer_ping(unsigned long arg);
> -static DEFINE_TIMER(wdt_timer, mpc8xxx_wdt_timer_ping, 0, 0);
> +static DEFINE_TIMER(wdt_timer, mpc8xxx_wdt_timer_ping, 0,
> +		(unsigned long)&mpc8xxx_wdt_dev);
>
>   static void mpc8xxx_wdt_timer_ping(unsigned long arg)
>   {
> -	mpc8xxx_wdt_keepalive();
> +	struct watchdog_device *w = (struct watchdog_device *)arg;
> +
> +	mpc8xxx_wdt_ping(w);
>   	/* We're pinging it twice faster than needed, just to be sure. */
> -	mod_timer(&wdt_timer, jiffies + HZ * timeout_sec / 2);
> +	mod_timer(&wdt_timer, jiffies + HZ * w->timeout / 2);
>   }
>
>   static void mpc8xxx_wdt_pr_warn(const char *msg)
> @@ -102,19 +105,9 @@
>   		reset ? "reset" : "machine check exception");
>   }
>
> -static ssize_t mpc8xxx_wdt_write(struct file *file, const char __user *buf,
> -				 size_t count, loff_t *ppos)
> -{
> -	if (count)
> -		mpc8xxx_wdt_keepalive();
> -	return count;
> -}
> -
> -static int mpc8xxx_wdt_open(struct inode *inode, struct file *file)
> +static int mpc8xxx_wdt_start(struct watchdog_device *w)
>   {
>   	u32 tmp = SWCRR_SWEN;
> -	if (test_and_set_bit(0, &wdt_is_open))
> -		return -EBUSY;
>
>   	/* Once we start the watchdog we can't stop it */
>   	if (nowayout)

This code and the subsequent module_get can be removed; it is handled by the infrastructure.


> @@ -132,59 +125,30 @@
>
>   	del_timer_sync(&wdt_timer);
>
> -	return nonseekable_open(inode, file);
> +	return 0;
>   }
>
> -static int mpc8xxx_wdt_release(struct inode *inode, struct file *file)
> +static int mpc8xxx_wdt_stop(struct watchdog_device *w)
>   {
> -	if (!nowayout)
> -		mpc8xxx_wdt_timer_ping(0);
> -	else
> -		mpc8xxx_wdt_pr_warn("watchdog closed");
> -	clear_bit(0, &wdt_is_open);
> +	mpc8xxx_wdt_timer_ping((unsigned long)w);

I really dislike this typecasting back and forth.

I think it would be better to move the mod_timer() call from mpc8xxx_wdt_timer_ping
into mpc8xxx_wdt_ping and call mpc8xxx_wdt_ping directly whenever possible.
 From mpc8xxx_wdt_timer_ping you can then just call mpc8xxx_wdt_ping with the
typecasted parameter.

>   	return 0;
>   }
>
> -static long mpc8xxx_wdt_ioctl(struct file *file, unsigned int cmd,
> -							unsigned long arg)
> -{
> -	void __user *argp = (void __user *)arg;
> -	int __user *p = argp;
> -	static const struct watchdog_info ident = {
> -		.options = WDIOF_KEEPALIVEPING,
> -		.firmware_version = 1,
> -		.identity = "MPC8xxx",
> -	};
> -
> -	switch (cmd) {
> -	case WDIOC_GETSUPPORT:
> -		return copy_to_user(argp, &ident, sizeof(ident)) ? -EFAULT : 0;
> -	case WDIOC_GETSTATUS:
> -	case WDIOC_GETBOOTSTATUS:
> -		return put_user(0, p);
> -	case WDIOC_KEEPALIVE:
> -		mpc8xxx_wdt_keepalive();
> -		return 0;
> -	case WDIOC_GETTIMEOUT:
> -		return put_user(timeout_sec, p);
> -	default:
> -		return -ENOTTY;
> -	}
> -}
> +static struct watchdog_info mpc8xxx_wdt_info = {
> +	.options = WDIOF_KEEPALIVEPING,
> +	.firmware_version = 1,
> +	.identity = "MPC8xxx",
> +};
>
> -static const struct file_operations mpc8xxx_wdt_fops = {
> -	.owner		= THIS_MODULE,
> -	.llseek		= no_llseek,
> -	.write		= mpc8xxx_wdt_write,
> -	.unlocked_ioctl	= mpc8xxx_wdt_ioctl,
> -	.open		= mpc8xxx_wdt_open,
> -	.release	= mpc8xxx_wdt_release,
> +static struct watchdog_ops mpc8xxx_wdt_ops = {
> +	.owner = THIS_MODULE,
> +	.start = mpc8xxx_wdt_start,
> +	.stop = mpc8xxx_wdt_stop,
>   };
>
> -static struct miscdevice mpc8xxx_wdt_miscdev = {
> -	.minor	= WATCHDOG_MINOR,
> -	.name	= "watchdog",
> -	.fops	= &mpc8xxx_wdt_fops,
> +static struct watchdog_device mpc8xxx_wdt_dev = {
> +	.info = &mpc8xxx_wdt_info,
> +	.ops = &mpc8xxx_wdt_ops,
>   };
>
>   static const struct of_device_id mpc8xxx_wdt_match[];
> @@ -196,6 +160,7 @@
>   	const struct mpc8xxx_wdt_type *wdt_type;
>   	u32 freq = fsl_get_sys_freq();
>   	bool enabled;
> +	unsigned int timeout_sec;
>
>   	match = of_match_device(mpc8xxx_wdt_match, &ofdev->dev);
>   	if (!match)
> @@ -222,6 +187,7 @@
>   	else
>   		timeout_sec = timeout / freq;
>
> +	mpc8xxx_wdt_dev.timeout = timeout_sec;
>   #ifdef MODULE
>   	ret = mpc8xxx_wdt_init_late();
>   	if (ret)
> @@ -237,7 +203,7 @@
>   	 * userspace handles it.
>   	 */
>   	if (enabled)
> -		mpc8xxx_wdt_timer_ping(0);
> +		mpc8xxx_wdt_timer_ping((unsigned long)&mpc8xxx_wdt_dev);
>   	return 0;
>   err_unmap:
>   	iounmap(wd_base);
> @@ -249,7 +215,7 @@
>   {
>   	mpc8xxx_wdt_pr_warn("watchdog removed");

The mpc8xxx_wdt_pr_warn function is now rather unnecessary since
it is called only once. Might as well merge it into this function.

>   	del_timer_sync(&wdt_timer);
> -	misc_deregister(&mpc8xxx_wdt_miscdev);
> +	watchdog_unregister_device(&mpc8xxx_wdt_dev);
>   	iounmap(wd_base);
>
>   	return 0;
> @@ -301,10 +267,11 @@
>   	if (!wd_base)
>   		return -ENODEV;
>
> -	ret = misc_register(&mpc8xxx_wdt_miscdev);
> +	watchdog_set_nowayout(&mpc8xxx_wdt_dev, nowayout);
> +
> +	ret = watchdog_register_device(&mpc8xxx_wdt_dev);
>   	if (ret) {
> -		pr_err("cannot register miscdev on minor=%d (err=%d)\n",
> -		       WATCHDOG_MINOR, ret);
> +		pr_err("cannot register watchdog device (err=%d)\n", ret);
>   		return ret;
>   	}
>   	return 0;
> diff -ur a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
> --- a/drivers/watchdog/Kconfig
> +++ b/drivers/watchdog/Kconfig
> @@ -1146,6 +1146,7 @@
>   config 8xxx_WDT
>   	tristate "MPC8xxx Platform Watchdog Timer"
>   	depends on PPC_8xx || PPC_83xx || PPC_86xx
> +	select WATCHDOG_CORE
>   	help
>   	  This driver is for a SoC level watchdog that exists on some
>   	  Freescale PowerPC processors. So far this driver supports:
>
> ---
> Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce que la protection avast! Antivirus est active.
> http://www.avast.com
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-watchdog" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
>

^ permalink raw reply

* Re: [PATCH] watchdog: mpc8xxx_wdt: MPC8xx is HW enabled
From: Guenter Roeck @ 2013-12-01 19:43 UTC (permalink / raw)
  To: Christophe Leroy, Wim Van Sebroeck, scottwood
  Cc: linuxppc-dev, linux-kernel, linux-watchdog
In-Reply-To: <20131130154540.E83D743E15@localhost.localdomain>

On 11/30/2013 07:45 AM, Christophe Leroy wrote:
> MPC8xx watchdog is enabled at startup by HW.
> If the bootloader disables it, it cannot be reenabled.
>

Is that true for all variants of 8xx, especially for 823 ? I am a bit concerned
about breaking compatibility with some chips ... assuming there was a reason
for not setting this flag originally.

Thanks,
Guenter

> Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
>
> diff -ur a/drivers/watchdog/mpc8xxx_wdt.c b/drivers/watchdog/mpc8xxx_wdt.c
> --- a/drivers/watchdog/mpc8xxx_wdt.c	2013-05-11 22:57:46.000000000 +0200
> +++ b/drivers/watchdog/mpc8xxx_wdt.c	2013-08-08 02:12:15.000000000 +0200
> @@ -273,6 +310,7 @@
>   		.compatible = "fsl,mpc823-wdt",
>   		.data = &(struct mpc8xxx_wdt_type) {
>   			.prescaler = 0x800,
> +			.hw_enabled = true,
>   		},
>   	},
>   	{},
>
> ---
> Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce que la protection avast! Antivirus est active.
> http://www.avast.com
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-watchdog" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
>

^ permalink raw reply

* Re: [PATCH 3/9] powerpc: Add TIF_ELF2ABI flag.
From: Rusty Russell @ 2013-12-01 10:30 UTC (permalink / raw)
  To: Michael Ellerman, Anton Blanchard
  Cc: alistair, paulus, linuxppc-dev, Ulrich.Weigand
In-Reply-To: <20131121115503.GD15913@concordia>

Michael Ellerman <mpe@ellerman.id.au> writes:
> On Wed, Nov 20, 2013 at 10:15:00PM +1100, Anton Blanchard wrote:
>> From: Rusty Russell <rusty@rustcorp.com.au>
>> 
>> Little endian ppc64 is getting an exciting new ABI.  This is reflected
>> by the bottom two bits of e_flags in the ELF header:
>> 
>> 	0 == legacy binaries (v1 ABI)
>> 	1 == binaries using the old ABI (compiled with a new toolchain)
>> 	2 == binaries using the new ABI.
>
> Just to be ridiculously clear for stupid people like me, you refer here
> to the "v1 ABI" and "the old ABI" - they are the same thing - right?

Sorry for delay, was off for a week.

Yes, same thing.

>> diff --git a/arch/powerpc/include/asm/thread_info.h b/arch/powerpc/include/asm/thread_info.h
>> index ba7b197..05a3030 100644
>> --- a/arch/powerpc/include/asm/thread_info.h
>> +++ b/arch/powerpc/include/asm/thread_info.h
>> @@ -107,6 +107,9 @@ static inline struct thread_info *current_thread_info(void)
>>  #define TIF_EMULATE_STACK_STORE	16	/* Is an instruction emulation
>>  						for stack store? */
>>  #define TIF_MEMDIE		17	/* is terminating due to OOM killer */
>> +#if defined(CONFIG_PPC64)
>> +#define TIF_ELF2ABI		18	/* function descriptors must die! */
>> +#endif
>
> This is the first TIF flag we #ifdef for 32 vs 64, is that just because
> we don't want to waste a flag on 32 bit?

No, it's because I wanted to make damn sure that there wasn't anyone
testing this in 32-bit code, since ELF2 is currently a 64-bit only
option.

Cheers,
Rusty.

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox