kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
* Replace two ioread32 with ioread64_lo_hi non_atomic
@ 2022-04-25 20:32 Philipp Hortmann
  2022-04-25 20:36 ` Abu Rasheda
  2022-04-25 20:38 ` Ozgur Karatas
  0 siblings, 2 replies; 3+ messages in thread
From: Philipp Hortmann @ 2022-04-25 20:32 UTC (permalink / raw)
  To: kernelnewbies

Hi,

in this patch:
[PATCH 4/5] staging: vt6655: Replace two VNSvInPortD with ioread64_lo_hi

I tried to combine two reads in one.

  	if (ww == W_MAX_TIMEOUT)
  		return false;
-	VNSvInPortD(iobase + MAC_REG_TSFCNTR, (u32 *)pqwCurrTSF);
-	VNSvInPortD(iobase + MAC_REG_TSFCNTR + 4, (u32 *)pqwCurrTSF + 1);
+	*pqwCurrTSF = ioread64_lo_hi(iobase + MAC_REG_TSFCNTR);

  	return true;
  }

works fine on 64 bit machines but fails on 32 bit machines.

Which of the following ways is the preferred one:

Adding
#include <linux/io-64-nonatomic-lo-hi.h>
before #include "asm/io.h"
But it seems that this has never been used in a driver before?

Switch back to two reads with ioread32?

Or another proposal?

Thanks for your support.

Bye Philipp

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Replace two ioread32 with ioread64_lo_hi non_atomic
  2022-04-25 20:32 Replace two ioread32 with ioread64_lo_hi non_atomic Philipp Hortmann
@ 2022-04-25 20:36 ` Abu Rasheda
  2022-04-25 20:38 ` Ozgur Karatas
  1 sibling, 0 replies; 3+ messages in thread
From: Abu Rasheda @ 2022-04-25 20:36 UTC (permalink / raw)
  To: Philipp Hortmann; +Cc: Linux Kernel List


[-- Attachment #1.1: Type: text/plain, Size: 1142 bytes --]

On Mon, Apr 25, 2022 at 1:32 PM Philipp Hortmann <
philipp.g.hortmann@gmail.com> wrote:

> Hi,
>
> in this patch:
> [PATCH 4/5] staging: vt6655: Replace two VNSvInPortD with ioread64_lo_hi
>
> I tried to combine two reads in one.
>
>         if (ww == W_MAX_TIMEOUT)
>                 return false;
> -       VNSvInPortD(iobase + MAC_REG_TSFCNTR, (u32 *)pqwCurrTSF);
> -       VNSvInPortD(iobase + MAC_REG_TSFCNTR + 4, (u32 *)pqwCurrTSF + 1);
> +       *pqwCurrTSF = ioread64_lo_hi(iobase + MAC_REG_TSFCNTR);
>
>         return true;
>   }
>
> works fine on 64 bit machines but fails on 32 bit machines.
>
> Which of the following ways is the preferred one:
>
>
How about #ifdef for 32/64 bit CPU.


> Adding
> #include <linux/io-64-nonatomic-lo-hi.h>
> before #include "asm/io.h"
> But it seems that this has never been used in a driver before?
>
> Switch back to two reads with ioread32?
>
> Or another proposal?
>
> Thanks for your support.
>
> Bye Philipp
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies@kernelnewbies.org
> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>

[-- Attachment #1.2: Type: text/html, Size: 1970 bytes --]

[-- Attachment #2: Type: text/plain, Size: 170 bytes --]

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Replace two ioread32 with ioread64_lo_hi non_atomic
  2022-04-25 20:32 Replace two ioread32 with ioread64_lo_hi non_atomic Philipp Hortmann
  2022-04-25 20:36 ` Abu Rasheda
@ 2022-04-25 20:38 ` Ozgur Karatas
  1 sibling, 0 replies; 3+ messages in thread
From: Ozgur Karatas @ 2022-04-25 20:38 UTC (permalink / raw)
  To: Philipp Hortmann; +Cc: kernelnewbies


[-- Attachment #1.1: Type: text/plain, Size: 1332 bytes --]

Hello,

since you called ioread64_lo_hi, you may have a problem with 32-bit, but
have you looked at 32-bit arch calls for ioread in the kernel?
VNSvIPortD is macro right?

On Tue, Apr 26, 2022 at 12:32 AM Philipp Hortmann <
philipp.g.hortmann@gmail.com> wrote:

> Hi,
>
> in this patch:
> [PATCH 4/5] staging: vt6655: Replace two VNSvInPortD with ioread64_lo_hi
>
> I tried to combine two reads in one.
>
>         if (ww == W_MAX_TIMEOUT)
>                 return false;
> -       VNSvInPortD(iobase + MAC_REG_TSFCNTR, (u32 *)pqwCurrTSF);
> -       VNSvInPortD(iobase + MAC_REG_TSFCNTR + 4, (u32 *)pqwCurrTSF + 1);
> +       *pqwCurrTSF = ioread64_lo_hi(iobase + MAC_REG_TSFCNTR);
>
>         return true;
>   }
>
> works fine on 64 bit machines but fails on 32 bit machines.
>
> Which of the following ways is the preferred one:
>
> Adding
> #include <linux/io-64-nonatomic-lo-hi.h>
> before #include "asm/io.h"
> But it seems that this has never been used in a driver before?
>
> Switch back to two reads with ioread32?
>
> Or another proposal?
>
> Thanks for your support.
>
> Bye Philipp
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies@kernelnewbies.org
> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>


-- 
Ozgur Kara
Linux Kernel Developer

ozgurk@ieee.org

[-- Attachment #1.2: Type: text/html, Size: 2201 bytes --]

[-- Attachment #2: Type: text/plain, Size: 170 bytes --]

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-04-25 20:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-25 20:32 Replace two ioread32 with ioread64_lo_hi non_atomic Philipp Hortmann
2022-04-25 20:36 ` Abu Rasheda
2022-04-25 20:38 ` Ozgur Karatas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).