Message ID | 20190618042732.5582-4-ravi.bangoria@linux.ibm.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | Powerpc/hw-breakpoint: Fixes plus Code refactor | expand |
Context | Check | Description |
---|---|---|
snowpatch_ozlabs/apply_patch | success | Successfully applied on branch next (e610a466d16a086e321f0bd421e2fc75cff28605) |
snowpatch_ozlabs/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 23 lines checked |
This is going to collide with this patch https://patchwork.ozlabs.org/patch/1109594/ Mikey On Tue, 2019-06-18 at 09:57 +0530, Ravi Bangoria wrote: > Remove unnecessary comments. Code itself is self explanatory. > And, ISA already talks about MRD field. I Don't think we need > to re-describe it. > > Signed-off-by: Ravi Bangoria <ravi.bangoria@linux.ibm.com> > --- > arch/powerpc/kernel/process.c | 17 +++++------------ > 1 file changed, 5 insertions(+), 12 deletions(-) > > diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c > index f0fbbf6a6a1f..f002d2ffff86 100644 > --- a/arch/powerpc/kernel/process.c > +++ b/arch/powerpc/kernel/process.c > @@ -799,18 +799,11 @@ int set_dawr(struct arch_hw_breakpoint *brk) > > dawr = brk->address; > > - dawrx = (brk->type & (HW_BRK_TYPE_READ | HW_BRK_TYPE_WRITE)) \ > - << (63 - 58); //* read/write bits */ > - dawrx |= ((brk->type & (HW_BRK_TYPE_TRANSLATE)) >> 2) \ > - << (63 - 59); //* translate */ > - dawrx |= (brk->type & (HW_BRK_TYPE_PRIV_ALL)) \ > - >> 3; //* PRIM bits */ > - /* dawr length is stored in field MDR bits 48:53. Matches range in > - doublewords (64 bits) baised by -1 eg. 0b000000=1DW and > - 0b111111=64DW. > - brk->len is in bytes. > - This aligns up to double word size, shifts and does the bias. > - */ > + dawrx = (brk->type & HW_BRK_TYPE_RDWR) << (63 - 58); > + dawrx |= ((brk->type & HW_BRK_TYPE_TRANSLATE) >> 2) << (63 - 59); > + dawrx |= (brk->type & HW_BRK_TYPE_PRIV_ALL) >> 3; > + > + /* brk->len is in bytes. */ > mrd = ((brk->len + 7) >> 3) - 1; > dawrx |= (mrd & 0x3f) << (63 - 53); >
Le 18/06/2019 à 06:27, Ravi Bangoria a écrit : > Remove unnecessary comments. Code itself is self explanatory. > And, ISA already talks about MRD field. I Don't think we need > to re-describe it. In an RFC patch you may "don't think". But in the final patch you need to make a decision and write it as such. Ie, you should write: "We don't need to re-describe it." > > Signed-off-by: Ravi Bangoria <ravi.bangoria@linux.ibm.com> > --- > arch/powerpc/kernel/process.c | 17 +++++------------ > 1 file changed, 5 insertions(+), 12 deletions(-) > > diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c > index f0fbbf6a6a1f..f002d2ffff86 100644 > --- a/arch/powerpc/kernel/process.c > +++ b/arch/powerpc/kernel/process.c > @@ -799,18 +799,11 @@ int set_dawr(struct arch_hw_breakpoint *brk) > > dawr = brk->address; > > - dawrx = (brk->type & (HW_BRK_TYPE_READ | HW_BRK_TYPE_WRITE)) \ > - << (63 - 58); //* read/write bits */ > - dawrx |= ((brk->type & (HW_BRK_TYPE_TRANSLATE)) >> 2) \ > - << (63 - 59); //* translate */ > - dawrx |= (brk->type & (HW_BRK_TYPE_PRIV_ALL)) \ > - >> 3; //* PRIM bits */ > - /* dawr length is stored in field MDR bits 48:53. Matches range in > - doublewords (64 bits) baised by -1 eg. 0b000000=1DW and > - 0b111111=64DW. > - brk->len is in bytes. > - This aligns up to double word size, shifts and does the bias. > - */ > + dawrx = (brk->type & HW_BRK_TYPE_RDWR) << (63 - 58); > + dawrx |= ((brk->type & HW_BRK_TYPE_TRANSLATE) >> 2) << (63 - 59); > + dawrx |= (brk->type & HW_BRK_TYPE_PRIV_ALL) >> 3; > + > + /* brk->len is in bytes. */ > mrd = ((brk->len + 7) >> 3) - 1; > dawrx |= (mrd & 0x3f) << (63 - 53); > >
On 6/18/19 11:41 AM, Michael Neuling wrote: > This is going to collide with this patch > https://patchwork.ozlabs.org/patch/1109594/ Yeah, I'm aware of the patch. I just developed this on powerpc/next. I'll rebase my patches accordingly once mpe picks up that patche.
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c index f0fbbf6a6a1f..f002d2ffff86 100644 --- a/arch/powerpc/kernel/process.c +++ b/arch/powerpc/kernel/process.c @@ -799,18 +799,11 @@ int set_dawr(struct arch_hw_breakpoint *brk) dawr = brk->address; - dawrx = (brk->type & (HW_BRK_TYPE_READ | HW_BRK_TYPE_WRITE)) \ - << (63 - 58); //* read/write bits */ - dawrx |= ((brk->type & (HW_BRK_TYPE_TRANSLATE)) >> 2) \ - << (63 - 59); //* translate */ - dawrx |= (brk->type & (HW_BRK_TYPE_PRIV_ALL)) \ - >> 3; //* PRIM bits */ - /* dawr length is stored in field MDR bits 48:53. Matches range in - doublewords (64 bits) baised by -1 eg. 0b000000=1DW and - 0b111111=64DW. - brk->len is in bytes. - This aligns up to double word size, shifts and does the bias. - */ + dawrx = (brk->type & HW_BRK_TYPE_RDWR) << (63 - 58); + dawrx |= ((brk->type & HW_BRK_TYPE_TRANSLATE) >> 2) << (63 - 59); + dawrx |= (brk->type & HW_BRK_TYPE_PRIV_ALL) >> 3; + + /* brk->len is in bytes. */ mrd = ((brk->len + 7) >> 3) - 1; dawrx |= (mrd & 0x3f) << (63 - 53);
Remove unnecessary comments. Code itself is self explanatory. And, ISA already talks about MRD field. I Don't think we need to re-describe it. Signed-off-by: Ravi Bangoria <ravi.bangoria@linux.ibm.com> --- arch/powerpc/kernel/process.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-)