[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2892a62b-eec3-802d-df52-960f3f1e246d@linux.ibm.com>
Date: Fri, 24 Apr 2020 08:54:14 +0530
From: Ravi Bangoria <ravi.bangoria@...ux.ibm.com>
To: Christophe Leroy <christophe.leroy@....fr>
Cc: mpe@...erman.id.au, mikey@...ling.org, apopple@...ux.ibm.com,
paulus@...ba.org, npiggin@...il.com,
naveen.n.rao@...ux.vnet.ibm.com, peterz@...radead.org,
jolsa@...nel.org, oleg@...hat.com, fweisbec@...il.com,
mingo@...nel.org, linuxppc-dev@...ts.ozlabs.org,
linux-kernel@...r.kernel.org,
Ravi Bangoria <ravi.bangoria@...ux.ibm.com>
Subject: Re: [PATCH v3 12/16] powerpc/watchpoint: Use builtin ALIGN*() macros
Hi Christophe,
>> max_len = DAWR_MAX_LEN;
>> /* DAWR region can't cross 512 bytes boundary */
>> - if ((start_addr >> 9) != (end_addr >> 9))
>> + if ((start_addr >> 9) != ((end_addr - 1) >> 9))
>
> What about:
> if (ALIGN(start_addr, SZ_512M) != ALIGN(end - 1, SZ_512M))
ok.
>
>> return -EINVAL;
>> } else if (IS_ENABLED(CONFIG_PPC_8xx)) {
>> /* 8xx can setup a range without limitation */
>> diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
>> index aab82ab80dfa..06679adac447 100644
>> --- a/arch/powerpc/kernel/process.c
>> +++ b/arch/powerpc/kernel/process.c
>> @@ -800,12 +800,12 @@ static inline int set_breakpoint_8xx(struct arch_hw_breakpoint *brk)
>> unsigned long lctrl1 = LCTRL1_CTE_GT | LCTRL1_CTF_LT | LCTRL1_CRWE_RW |
>> LCTRL1_CRWF_RW;
>> unsigned long lctrl2 = LCTRL2_LW0EN | LCTRL2_LW0LADC | LCTRL2_SLW0EN;
>> - unsigned long start_addr = brk->address & ~HW_BREAKPOINT_ALIGN;
>> - unsigned long end_addr = (brk->address + brk->len - 1) | HW_BREAKPOINT_ALIGN;
>> + unsigned long start_addr = ALIGN_DOWN(brk->address, HW_BREAKPOINT_SIZE);
>> + unsigned long end_addr = ALIGN(brk->address + brk->len, HW_BREAKPOINT_SIZE);
>> if (start_addr == 0)
>> lctrl2 |= LCTRL2_LW0LA_F;
>> - else if (end_addr == ~0U)
>> + else if (end_addr - 1 == ~0U)
>
> What about:
> else if (end_addr == 0)
That's better.
Thanks,
Ravi
Powered by blists - more mailing lists