<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/arch/powerpc/kernel/hw_breakpoint.c, branch linux-5.13.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.13.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.13.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2020-12-10T13:09:10Z</updated>
<entry>
<title>powerpc/watchpoint: Workaround P10 DD1 issue with VSX-32 byte instructions</title>
<updated>2020-12-10T13:09:10Z</updated>
<author>
<name>Ravi Bangoria</name>
</author>
<published>2020-11-06T04:56:50Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=3d2ffcdd2a982e8bbe65fa0f94fb21bf304c281e'/>
<id>urn:sha1:3d2ffcdd2a982e8bbe65fa0f94fb21bf304c281e</id>
<content type='text'>
POWER10 DD1 has an issue where it generates watchpoint exceptions when
it shouldn't. The conditions where this occur are:

 - octword op
 - ending address of DAWR range is less than starting address of op
 - those addresses need to be in the same or in two consecutive 512B
   blocks
 - 'op address + 64B' generates an address that has a carry into bit
   52 (crosses 2K boundary)

Handle such spurious exception by considering them as extraneous and
emulating/single-steeping instruction without generating an event.

[ravi: Fixed build warning reported by lkp@intel.com]
Signed-off-by: Ravi Bangoria &lt;ravi.bangoria@linux.ibm.com&gt;
Signed-off-by: Michael Ellerman &lt;mpe@ellerman.id.au&gt;
Link: https://lore.kernel.org/r/20201106045650.278987-1-ravi.bangoria@linux.ibm.com
</content>
</entry>
<entry>
<title>powerpc/watchpoint: Move DAWR detection logic outside of hw_breakpoint.c</title>
<updated>2020-09-15T12:13:19Z</updated>
<author>
<name>Ravi Bangoria</name>
</author>
<published>2020-09-02T04:29:41Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=edc8dd99b29e4d705c45e2a3a6c01b096ee056db'/>
<id>urn:sha1:edc8dd99b29e4d705c45e2a3a6c01b096ee056db</id>
<content type='text'>
Power10 hw has multiple DAWRs but hw doesn't tell which DAWR caused
the exception. So we have a sw logic to detect that in hw_breakpoint.c.
But hw_breakpoint.c gets compiled only with CONFIG_HAVE_HW_BREAKPOINT=Y.
Move DAWR detection logic outside of hw_breakpoint.c so that it can be
reused when CONFIG_HAVE_HW_BREAKPOINT is not set.

Signed-off-by: Ravi Bangoria &lt;ravi.bangoria@linux.ibm.com&gt;
Signed-off-by: Michael Ellerman &lt;mpe@ellerman.id.au&gt;
Link: https://lore.kernel.org/r/20200902042945.129369-5-ravi.bangoria@linux.ibm.com
</content>
</entry>
<entry>
<title>powerpc/watchpoint: Fix handling of vector instructions</title>
<updated>2020-09-15T12:13:18Z</updated>
<author>
<name>Ravi Bangoria</name>
</author>
<published>2020-09-02T04:29:39Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=4441eb02333a9b46a0d919aa7a6d3b137b5f2562'/>
<id>urn:sha1:4441eb02333a9b46a0d919aa7a6d3b137b5f2562</id>
<content type='text'>
Vector load/store instructions are special because they are always
aligned. Thus unaligned EA needs to be aligned down before comparing
it with watch ranges. Otherwise we might consider valid event as
invalid.

Fixes: 74c6881019b7 ("powerpc/watchpoint: Prepare handler to handle more than one watchpoint")
Signed-off-by: Ravi Bangoria &lt;ravi.bangoria@linux.ibm.com&gt;
Signed-off-by: Michael Ellerman &lt;mpe@ellerman.id.au&gt;
Link: https://lore.kernel.org/r/20200902042945.129369-3-ravi.bangoria@linux.ibm.com
</content>
</entry>
<entry>
<title>powerpc/watchpoint: Fix quadword instruction handling on p10 predecessors</title>
<updated>2020-09-15T12:12:25Z</updated>
<author>
<name>Ravi Bangoria</name>
</author>
<published>2020-09-02T04:29:38Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=4759c11ed20454b7b36db4ec15f7d5aa1519af4a'/>
<id>urn:sha1:4759c11ed20454b7b36db4ec15f7d5aa1519af4a</id>
<content type='text'>
On p10 predecessors, watchpoint with quadword access is compared at
quadword length. If the watch range is doubleword or less than that
in a first half of quadword aligned 16 bytes, and if there is any
unaligned quadword access which will access only the 2nd half, the
handler should consider it as extraneous and emulate/single-step it
before continuing.

Fixes: 74c6881019b7 ("powerpc/watchpoint: Prepare handler to handle more than one watchpoint")
Reported-by: Pedro Miraglia Franco de Carvalho &lt;pedromfc@linux.ibm.com&gt;
Signed-off-by: Ravi Bangoria &lt;ravi.bangoria@linux.ibm.com&gt;
Signed-off-by: Michael Ellerman &lt;mpe@ellerman.id.au&gt;
Link: https://lore.kernel.org/r/20200902042945.129369-2-ravi.bangoria@linux.ibm.com
</content>
</entry>
<entry>
<title>powerpc/watchpoint: Remove 512 byte boundary</title>
<updated>2020-07-26T13:34:19Z</updated>
<author>
<name>Ravi Bangoria</name>
</author>
<published>2020-07-23T09:08:13Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=3f31e49dc4588d396023028791e36c23235e1334'/>
<id>urn:sha1:3f31e49dc4588d396023028791e36c23235e1334</id>
<content type='text'>
Power10 has removed 512 bytes boundary from match criteria i.e. the watch
range can cross 512 bytes boundary.

Note: ISA 3.1 Book III 9.4 match criteria includes 512 byte limit but that
is a documentation mistake and hopefully will be fixed in the next version
of ISA. Though, ISA 3.1 change log mentions about removal of 512B boundary:

  Multiple DEAW:
  Added a second Data Address Watchpoint. [H]DAR is
  set to the first byte of overlap. 512B boundary is
  removed.

Signed-off-by: Ravi Bangoria &lt;ravi.bangoria@linux.ibm.com&gt;
Signed-off-by: Michael Ellerman &lt;mpe@ellerman.id.au&gt;
Link: https://lore.kernel.org/r/20200723090813.303838-11-ravi.bangoria@linux.ibm.com
</content>
</entry>
<entry>
<title>powerpc/watchpoint: Fix DAWR exception for CACHEOP</title>
<updated>2020-07-26T13:34:18Z</updated>
<author>
<name>Ravi Bangoria</name>
</author>
<published>2020-07-23T09:08:06Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=f3c832f1350bcf1e6906113ee3168066f4235dbe'/>
<id>urn:sha1:f3c832f1350bcf1e6906113ee3168066f4235dbe</id>
<content type='text'>
'ea' returned by analyse_instr() needs to be aligned down to cache
block size for CACHEOP instructions. analyse_instr() does not set
size for CACHEOP, thus size also needs to be calculated manually.

Fixes: 27985b2a640e ("powerpc/watchpoint: Don't ignore extraneous exceptions blindly")
Fixes: 74c6881019b7 ("powerpc/watchpoint: Prepare handler to handle more than one watchpoint")
Signed-off-by: Ravi Bangoria &lt;ravi.bangoria@linux.ibm.com&gt;
Signed-off-by: Michael Ellerman &lt;mpe@ellerman.id.au&gt;
Link: https://lore.kernel.org/r/20200723090813.303838-4-ravi.bangoria@linux.ibm.com
</content>
</entry>
<entry>
<title>powerpc/watchpoint: Fix DAWR exception constraint</title>
<updated>2020-07-26T13:34:18Z</updated>
<author>
<name>Ravi Bangoria</name>
</author>
<published>2020-07-23T09:08:05Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=f6780ce619f8daa285760302d56e95892087bd1f'/>
<id>urn:sha1:f6780ce619f8daa285760302d56e95892087bd1f</id>
<content type='text'>
Pedro Miraglia Franco de Carvalho noticed that on p8/p9, DAR value is
inconsistent with different type of load/store. Like for byte,word
etc. load/stores, DAR is set to the address of the first byte of
overlap between watch range and real access. But for quadword load/
store it's sometime set to the address of the first byte of real
access whereas sometime set to the address of the first byte of
overlap. This issue has been fixed in p10. In p10(ISA 3.1), DAR is
always set to the address of the first byte of overlap. Commit 27985b2a640e
("powerpc/watchpoint: Don't ignore extraneous exceptions blindly")
wrongly assumes that DAR is set to the address of the first byte of
overlap for all load/stores on p8/p9 as well. Fix that. With the fix,
we now rely on 'ea' provided by analyse_instr(). If analyse_instr()
fails, generate event unconditionally on p8/p9, and on p10 generate
event only if DAR is within a DAWR range.

Note: 8xx is not affected.

Fixes: 27985b2a640e ("powerpc/watchpoint: Don't ignore extraneous exceptions blindly")
Fixes: 74c6881019b7 ("powerpc/watchpoint: Prepare handler to handle more than one watchpoint")
Reported-by: Pedro Miraglia Franco de Carvalho &lt;pedromfc@br.ibm.com&gt;
Signed-off-by: Ravi Bangoria &lt;ravi.bangoria@linux.ibm.com&gt;
Signed-off-by: Michael Ellerman &lt;mpe@ellerman.id.au&gt;
Link: https://lore.kernel.org/r/20200723090813.303838-3-ravi.bangoria@linux.ibm.com
</content>
</entry>
<entry>
<title>powerpc/watchpoint: Fix 512 byte boundary limit</title>
<updated>2020-07-26T13:34:18Z</updated>
<author>
<name>Ravi Bangoria</name>
</author>
<published>2020-07-23T09:08:04Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=3190ecbfeeb2ab17778887ce3fa964615d6460fd'/>
<id>urn:sha1:3190ecbfeeb2ab17778887ce3fa964615d6460fd</id>
<content type='text'>
Milton Miller reported that we are aligning start and end address to
wrong size SZ_512M. It should be SZ_512. Fix that.

While doing this change I also found a case where ALIGN() comparison
fails. Within a given aligned range, ALIGN() of two addresses does not
match when start address is pointing to the first byte and end address
is pointing to any other byte except the first one. But that's not true
for ALIGN_DOWN(). ALIGN_DOWN() of any two addresses within that range
will always point to the first byte. So use ALIGN_DOWN() instead of
ALIGN().

Fixes: e68ef121c1f4 ("powerpc/watchpoint: Use builtin ALIGN*() macros")
Reported-by: Milton Miller &lt;miltonm@us.ibm.com&gt;
Signed-off-by: Ravi Bangoria &lt;ravi.bangoria@linux.ibm.com&gt;
Tested-by: Jordan Niethe &lt;jniethe5@gmail.com&gt;
Signed-off-by: Michael Ellerman &lt;mpe@ellerman.id.au&gt;
Link: https://lore.kernel.org/r/20200723090813.303838-2-ravi.bangoria@linux.ibm.com
</content>
</entry>
<entry>
<title>powerpc/watchpoint: Don't allow concurrent perf and ptrace events</title>
<updated>2020-05-18T14:14:45Z</updated>
<author>
<name>Ravi Bangoria</name>
</author>
<published>2020-05-14T11:17:39Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=29da4f91c0c1fbda12b8a31be0d564930208c92e'/>
<id>urn:sha1:29da4f91c0c1fbda12b8a31be0d564930208c92e</id>
<content type='text'>
With Book3s DAWR, ptrace and perf watchpoints on powerpc behaves
differently. Ptrace watchpoint works in one-shot mode and generates
signal before executing instruction. It's ptrace user's job to
single-step the instruction and re-enable the watchpoint. OTOH, in
case of perf watchpoint, kernel emulates/single-steps the instruction
and then generates event. If perf and ptrace creates two events with
same or overlapping address ranges, it's ambiguous to decide who
should single-step the instruction. Because of this issue, don't
allow perf and ptrace watchpoint at the same time if their address
range overlaps.

Signed-off-by: Ravi Bangoria &lt;ravi.bangoria@linux.ibm.com&gt;
Signed-off-by: Michael Ellerman &lt;mpe@ellerman.id.au&gt;
Reviewed-by: Michael Neuling &lt;mikey@neuling.org&gt;
Link: https://lore.kernel.org/r/20200514111741.97993-15-ravi.bangoria@linux.ibm.com
</content>
</entry>
<entry>
<title>powerpc/watchpoint: Prepare handler to handle more than one watchpoint</title>
<updated>2020-05-18T14:14:37Z</updated>
<author>
<name>Ravi Bangoria</name>
</author>
<published>2020-05-14T11:17:38Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=74c6881019b7d56c327fffc268d97adb5eb1b4f9'/>
<id>urn:sha1:74c6881019b7d56c327fffc268d97adb5eb1b4f9</id>
<content type='text'>
Currently we assume that we have only one watchpoint supported by hw.
Get rid of that assumption and use dynamic loop instead. This should
make supporting more watchpoints very easy.

With more than one watchpoint, exception handler needs to know which
DAWR caused the exception, and hw currently does not provide it. So
we need sw logic for the same. To figure out which DAWR caused the
exception, check all different combinations of user specified range,
DAWR address range, actual access range and DAWRX constrains. For ex,
if user specified range and actual access range overlaps but DAWRX is
configured for readonly watchpoint and the instruction is store, this
DAWR must not have caused exception.

Signed-off-by: Ravi Bangoria &lt;ravi.bangoria@linux.ibm.com&gt;
Reviewed-by: Michael Neuling &lt;mikey@neuling.org&gt;
[mpe: Unsplit multi-line printk() strings, fix some sparse warnings]
Signed-off-by: Michael Ellerman &lt;mpe@ellerman.id.au&gt;
Link: https://lore.kernel.org/r/20200514111741.97993-14-ravi.bangoria@linux.ibm.com
</content>
</entry>
</feed>
