All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ralf Baechle <ralf@linux-mips.org>
To: Markos Chandras <markos.chandras@imgtec.com>
Cc: linux-mips@linux-mips.org, sibyte-users@bitmover.com,
	Wim Van Sebroeck <wim@iguana.be>
Subject: Re: [PATCH 5/7] drivers: watchdog: sb_wdog: Fix 32bit linking problems
Date: Mon, 17 Jun 2013 19:03:04 +0200	[thread overview]
Message-ID: <20130617170304.GF10408@linux-mips.org> (raw)
In-Reply-To: <1371477641-7989-6-git-send-email-markos.chandras@imgtec.com>

On Mon, Jun 17, 2013 at 03:00:39PM +0100, Markos Chandras wrote:

> Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
> Acked-by: Steven J. Hill <Steven.Hill@imgtec.com>
> Cc: sibyte-users@bitmover.com
> Cc: Wim Van Sebroeck <wim@iguana.be>
> ---
>  drivers/watchdog/sb_wdog.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/watchdog/sb_wdog.c b/drivers/watchdog/sb_wdog.c
> index 25c7a3f..2ea0427 100644
> --- a/drivers/watchdog/sb_wdog.c
> +++ b/drivers/watchdog/sb_wdog.c
> @@ -170,6 +170,7 @@ static long sbwdog_ioctl(struct file *file, unsigned int cmd,
>  						unsigned long arg)
>  {
>  	int ret = -ENOTTY;
> +	u64 tmp_user_dog;
>  	unsigned long time;
>  	void __user *argp = (void __user *)arg;
>  	int __user *p = argp;
> @@ -208,7 +209,9 @@ static long sbwdog_ioctl(struct file *file, unsigned int cmd,
>  		 * get the remaining count from the ... count register
>  		 * which is 1*8 before the config register
>  		 */
> -		ret = put_user(__raw_readq(user_dog - 8) / 1000000, p);
> +		tmp_user_dog = __raw_readq(user_dog - 8);
> +		tmp_user_dog = do_div(tmp_user_dog, 1000000);
> +		ret = put_user(tmp_user_dog, p);

In effect the code with your change now does:

		ret = put_user(__raw_readq(user_dog - 8) % 1000000, p);

No good.

		tmp_user_dog = __raw_readq(user_dog - 8);
		do_div(tmp_user_dog, 1000000);
		ret = put_user(tmp_user_dog, p);

Should to the right thing.

I'm not surprised you're finding bugs in 32 bit Sibyte kernel.  At heart,
the Sibyte SOCs are 64 bit and their architecture limits them to support
256MB memory with a 32 bit kernel without highmem.  Highmem though
supported is stupid and leaves as the only sane option 64 bit kernels
and virtually every user has done that, not last to get full fp performance
which is only available with the N32 / N64 ABIs.  Oh, and of course many
registers need to be accessed 64 bit wide, which on a 32 bit kernel
requires a local_irq_disable ...  local_irq_enable around the actual
access.

In short, nobody but a few diehard backward folks have ever been using
32 bit kernels on Sibyte hardware, so finding such an issue is not really
a surprise.

  Ralf

  reply	other threads:[~2013-06-17 17:03 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-17 14:00 [PATCH 0/7] MIPS: sibyte build fixes Markos Chandras
2013-06-17 14:00 ` Markos Chandras
2013-06-17 14:00 ` [PATCH 1/7] MIPS: sibyte: Fix build for SIBYTE_BW_TRACE Markos Chandras
2013-06-17 14:00   ` Markos Chandras
2013-06-19 17:32   ` Ralf Baechle
2013-06-17 14:00 ` [PATCH 2/7] MIPS: sibyte: Declare the cfe_write() buffer as constant Markos Chandras
2013-06-17 14:00   ` Markos Chandras
2013-06-17 14:00 ` [PATCH 3/7] MIPS: sibyte: Add missing sched.h header Markos Chandras
2013-06-17 14:00   ` Markos Chandras
2013-06-17 16:44   ` Ralf Baechle
2013-06-17 18:33     ` Peter Zijlstra
2013-06-17 14:00 ` [PATCH 4/7] MIPS: sibyte: Amend dependencies for SIBYTE_BUS_WATCHER Markos Chandras
2013-06-17 14:00   ` Markos Chandras
2013-06-19 18:27   ` Ralf Baechle
2013-06-17 14:00 ` [PATCH 5/7] drivers: watchdog: sb_wdog: Fix 32bit linking problems Markos Chandras
2013-06-17 14:00   ` Markos Chandras
2013-06-17 17:03   ` Ralf Baechle [this message]
2013-06-18 13:17     ` Markos Chandras
2013-06-17 14:00 ` [PATCH 6/7] drivers: ssb: Kconfig: Amend SSB_EMBEDDED dependencies Markos Chandras
2013-06-17 14:00   ` Markos Chandras
2013-06-27 11:30   ` Ralf Baechle
2013-06-17 14:00 ` [PATCH 7/7] MIPS: sibyte: Remove unused variable Markos Chandras
2013-06-17 14:00   ` Markos Chandras

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130617170304.GF10408@linux-mips.org \
    --to=ralf@linux-mips.org \
    --cc=linux-mips@linux-mips.org \
    --cc=markos.chandras@imgtec.com \
    --cc=sibyte-users@bitmover.com \
    --cc=wim@iguana.be \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.