Re: [PATCH] ARC: atomic64: fix atomic64_add_unless function

2018-08-14 Thread Vineet Gupta
On 08/11/2018 09:09 AM, Eugeniy Paltsev wrote:
> Current implementation of 'atomic64_add_unless' function
> (and hence 'atomic64_inc_not_zero') return incorrect value
> if lover 32 bits of compared 64-bit number are equal and
> higher 32 bits aren't.
>
> For in following example atomic64_add_unless must return '1'
> but it actually returns '0':
> ->8-
> atomic64_t val = ATOMIC64_INIT(0xLL);
> int ret = atomic64_add_unless(&val, 1LL, 0LL)
> ->8-
>
> This happens because we write '0' to returned variable regardless
> of higher 32 bits comparison result.
>
> So fix it.
>
> NOTE:
>  this change was tested with atomic64_test.
>
> Signed-off-by: Eugeniy Paltsev 

LGTM. Curious, was this from code review or did u actually run into this ?

Thx,
-Vineet

> ---
>  arch/arc/include/asm/atomic.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/arc/include/asm/atomic.h b/arch/arc/include/asm/atomic.h
> index 11859287c52a..e840cb1763b2 100644
> --- a/arch/arc/include/asm/atomic.h
> +++ b/arch/arc/include/asm/atomic.h
> @@ -578,11 +578,11 @@ static inline int atomic64_add_unless(atomic64_t *v, 
> long long a, long long u)
>  
>   __asm__ __volatile__(
>   "1: llockd  %0, [%2]\n"
> - "   mov %1, 1   \n"
>   "   brne%L0, %L4, 2f# continue to add since v != u \n"
>   "   breq.d  %H0, %H4, 3f# return since v == u \n"
>   "   mov %1, 0   \n"
>   "2: \n"
> + "   mov %1, 1   \n"
>   "   add.f   %L0, %L0, %L3   \n"
>   "   adc %H0, %H0, %H3   \n"
>   "   scondd  %0, [%2]\n"


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[RFC] etnaviv: missing dma_mask

2018-08-14 Thread Eugeniy Paltsev
Hi Lucas, Christoph,

After switching ARC to generic dma_noncoherent cache ops 
etnaviv driver start failing on dma maping functions because of
dma_mask lack.

So I'm wondering is it valid case to have device which is
DMA capable and doesn't have dma_mask set?

If not, then I guess something like that should work
(at least it works for ARC):

Signed-off-by: Eugeniy Paltsev 
---
 drivers/gpu/drm/etnaviv/etnaviv_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/etnaviv/etnaviv_drv.c 
b/drivers/gpu/drm/etnaviv/etnaviv_drv.c
index 540b59fb4103..69d80937e021 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_drv.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_drv.c
@@ -593,7 +593,7 @@ static int etnaviv_pdev_probe(struct platform_device *pdev)
struct device *dev = &pdev->dev;
struct component_match *match = NULL;
 
-   dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
+   dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
 
if (!dev->platform_data) {
struct device_node *core_node;
-- 
2.14.4


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


Re: [PATCH] ARC: atomic64: fix atomic64_add_unless function

2018-08-14 Thread Eugeniy Paltsev
On Tue, 2018-08-14 at 13:42 +, Vineet Gupta wrote:
> On 08/11/2018 09:09 AM, Eugeniy Paltsev wrote:
> > Current implementation of 'atomic64_add_unless' function
> > (and hence 'atomic64_inc_not_zero') return incorrect value
> > if lover 32 bits of compared 64-bit number are equal and
> > higher 32 bits aren't.
> > 
> > For in following example atomic64_add_unless must return '1'
> > but it actually returns '0':
> > ->8-
> > atomic64_t val = ATOMIC64_INIT(0xLL);
> > int ret = atomic64_add_unless(&val, 1LL, 0LL)
> > ->8-
> > 
> > This happens because we write '0' to returned variable regardless
> > of higher 32 bits comparison result.
> > 
> > So fix it.
> > 
> > NOTE:
> >  this change was tested with atomic64_test.
> > 
> > Signed-off-by: Eugeniy Paltsev 
> 
> LGTM. Curious, was this from code review or did u actually run into this ?

I've accidentally run into this when I played with atomic64_* functions
trying to implement hack to automatically align LL64/SC64 data for atomic 64-bit
operations on ARC to avoid problems like:
https://www.mail-archive.com/linux-snps-arc@lists.infradead.org/msg03791.html

> Thx,
> -Vineet
> 
> > ---
> >  arch/arc/include/asm/atomic.h | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/arch/arc/include/asm/atomic.h b/arch/arc/include/asm/atomic.h
> > index 11859287c52a..e840cb1763b2 100644
> > --- a/arch/arc/include/asm/atomic.h
> > +++ b/arch/arc/include/asm/atomic.h
> > @@ -578,11 +578,11 @@ static inline int atomic64_add_unless(atomic64_t *v, 
> > long long a, long long u)
> >  
> > __asm__ __volatile__(
> > "1: llockd  %0, [%2]\n"
> > -   "   mov %1, 1   \n"
> > "   brne%L0, %L4, 2f# continue to add since v != u \n"
> > "   breq.d  %H0, %H4, 3f# return since v == u \n"
> > "   mov %1, 0   \n"
> > "2: \n"
> > +   "   mov %1, 1   \n"
> > "   add.f   %L0, %L0, %L3   \n"
> > "   adc %H0, %H0, %H3   \n"
> > "   scondd  %0, [%2]\n"
> 
> 
-- 
 Eugeniy Paltsev
___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


kisskb: FAILED linus/axs101_defconfig/arcompact Wed Aug 15, 04:12

2018-08-14 Thread noreply
FAILED linus/axs101_defconfig/arcompact Wed Aug 15, 04:12

http://kisskb.ellerman.id.au/kisskb/buildresult/13466202/

Commit:   Merge branch 'l1tf-final' of 
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
  958f338e96f874a0d29442396d6adf9c1e17aa2d
Compiler: arc-buildroot-linux-uclibc-gcc (Buildroot 2015.08.1) 4.8.4

Possible errors
---

kernel/cpu.c:2275:28: error: 'struct cpuhp_cpu_state' has no member named 
'booted_once'
kernel/cpu.c:2275:28: error: 'struct cpuhp_cpu_state' has no member named 
'booted_once'
kernel/cpu.c:2275:28: error: 'struct cpuhp_cpu_state' has no member named 
'booted_once'
kernel/cpu.c:2275:28: error: 'struct cpuhp_cpu_state' has no member named 
'booted_once'
kernel/cpu.c:2275:28: error: 'struct cpuhp_cpu_state' has no member named 
'booted_once'
kernel/cpu.c:2275:28: error: 'struct cpuhp_cpu_state' has no member named 
'booted_once'
kernel/cpu.c:2275:28: error: 'struct cpuhp_cpu_state' has no member named 
'booted_once'
kernel/cpu.c:2275:28: error: 'struct cpuhp_cpu_state' has no member named 
'booted_once'
kernel/cpu.c:2275:28: error: 'struct cpuhp_cpu_state' has no member named 
'booted_once'
kernel/cpu.c:2275:28: error: 'struct cpuhp_cpu_state' has no member named 
'booted_once'
kernel/cpu.c:2275:28: error: 'struct cpuhp_cpu_state' has no member named 
'booted_once'
kernel/cpu.c:2275:28: error: 'struct cpuhp_cpu_state' has no member named 
'booted_once'
kernel/cpu.c:2275:28: error: 'struct cpuhp_cpu_state' has no member named 
'booted_once'
kernel/cpu.c:2275:28: error: 'struct cpuhp_cpu_state' has no member named 
'booted_once'
make[2]: *** [kernel/cpu.o] Error 1
make[1]: *** [kernel] Error 2
make: *** [sub-make] Error 2

Possible warnings (3)
--

:1335:2: warning: #warning syscall rseq not implemented [-Wcpp]
include/linux/kernel.h:812:29: warning: comparison of distinct pointer types 
lacks a cast [enabled by default]
net/ipv4/tcp_input.c:4313:49: warning: array subscript is above array bounds 
[-Warray-bounds]


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


kisskb: OK linus/axs101_defconfig/arcompact Wed Aug 15, 15:44

2018-08-14 Thread noreply
OK linus/axs101_defconfig/arcompact Wed Aug 15, 15:44

http://kisskb.ellerman.id.au/kisskb/buildresult/13466874/

Commit:   Merge tag 'for-linus-4.19-rc1-tag' of 
git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip
  31130a16d459de809cd1c03eabc9567d094aae6a
Compiler: arc-buildroot-linux-uclibc-gcc (Buildroot 2015.08.1) 4.8.4

No errors found in log

Possible warnings (2)
--

include/linux/kernel.h:812:29: warning: comparison of distinct pointer types 
lacks a cast [enabled by default]
net/ipv4/tcp_input.c:4313:49: warning: array subscript is above array bounds 
[-Warray-bounds]


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc