diff mbox series

[3/6] io: Add io_complete() helper

Message ID 20171206173928.25628-3-benh@kernel.crashing.org
State Superseded
Headers show
Series [1/6] xive: Mark a freed IRQ's IVE as valid and masked | expand

Commit Message

Benjamin Herrenschmidt Dec. 6, 2017, 5:39 p.m. UTC
This uses the standard form twi/isync pair to ensure a load
is consumed by the core before continuing.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
 include/io.h | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Michael Neuling Dec. 7, 2017, 3:11 a.m. UTC | #1
On Wed, 2017-12-06 at 11:39 -0600, Benjamin Herrenschmidt wrote:
> This uses the standard form twi/isync pair to ensure a load
> is consumed by the core before continuing.
> 
> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> ---
>  include/io.h | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/include/io.h b/include/io.h
> index 45a385ed..93a65e70 100644
> --- a/include/io.h
> +++ b/include/io.h
> @@ -170,6 +170,12 @@ static inline void out_le64(volatile uint64_t *addr,
> uint64_t val)
>  #define in_le8	in_8
>  #define out_le8	out_8
>  
> +/* Ensure completion of a load */
> +static inline void in_complete(uint64_t data)

io_complete() not in_complete().

I don't really like either name though.. 

mikey

> +{
> +	asm volatile("twi 0,%0,0;isync" : : "r" (data) : "memory");
> +}
> +
>  #endif /* __ASSEMBLY__ */
>  
>  #endif /* __IO_H */
Benjamin Herrenschmidt Dec. 7, 2017, 5:50 p.m. UTC | #2
On Thu, 2017-12-07 at 14:11 +1100, Michael Neuling wrote:
> io_complete() not in_complete().

Well, it's really only for in_* accessors (ie, loads).

> I don't really like either name though.. 

Then pick a new one but hurry, there's a hot bug so that series is
rather urgent :)

Ben.
Michael Neuling Dec. 7, 2017, 9:37 p.m. UTC | #3
On Thu, 2017-12-07 at 11:50 -0600, Benjamin Herrenschmidt wrote:
> On Thu, 2017-12-07 at 14:11 +1100, Michael Neuling wrote:
> > io_complete() not in_complete().
> 
> Well, it's really only for in_* accessors (ie, loads).

OK can you make it match the subject then... 

> > I don't really like either name though.. 
> 
> Then pick a new one but hurry, there's a hot bug so that series is
> rather urgent :)

OK, just pick one.. we can fix it later.

Mikey
Benjamin Herrenschmidt Dec. 7, 2017, 10:01 p.m. UTC | #4
On Fri, 2017-12-08 at 08:37 +1100, Michael Neuling wrote:
> On Thu, 2017-12-07 at 11:50 -0600, Benjamin Herrenschmidt wrote:
> > On Thu, 2017-12-07 at 14:11 +1100, Michael Neuling wrote:
> > > io_complete() not in_complete().
> > 
> > Well, it's really only for in_* accessors (ie, loads).
> 
> OK can you make it match the subject then... 

Yup. I only just noticed I had it wrong in there :)

> > > I don't really like either name though.. 
> > 
> > Then pick a new one but hurry, there's a hot bug so that series is
> > rather urgent :)
> 
> OK, just pick one.. we can fix it later.

Cheers,
Ben.
diff mbox series

Patch

diff --git a/include/io.h b/include/io.h
index 45a385ed..93a65e70 100644
--- a/include/io.h
+++ b/include/io.h
@@ -170,6 +170,12 @@  static inline void out_le64(volatile uint64_t *addr, uint64_t val)
 #define in_le8	in_8
 #define out_le8	out_8
 
+/* Ensure completion of a load */
+static inline void in_complete(uint64_t data)
+{
+	asm volatile("twi 0,%0,0;isync" : : "r" (data) : "memory");
+}
+
 #endif /* __ASSEMBLY__ */
 
 #endif /* __IO_H */