[Skiboot] [PATCH] nvlink: Enable NPU device BAR before triggering freeze

Russell Currey ruscur at russell.cc
Mon Jun 20 16:40:48 AEST 2016

NPU freeze injection works by performing an invalid MMIO read on the NPU
device BAR.  If the BAR isn't enabled, which is the case when the
appropriate driver isn't loaded, this checkstops the machine.

Work around this by making sure the BAR is enabled before performing the
read.  The idea of an error inject doing anything other than an error
inject isn't great, but it's better than unintentionally crashing your

Also, fix the comment incorrectly stating the operation was a write
instead of a read.

Signed-off-by: Russell Currey <ruscur at russell.cc>
 hw/npu.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/hw/npu.c b/hw/npu.c
index e444b96..834b3e3 100644
--- a/hw/npu.c
+++ b/hw/npu.c
@@ -1118,7 +1118,10 @@ static int64_t npu_err_inject(struct phb *phb, uint32_t pe_num,
 		/* Emulate fence mode. */
 		p->fenced = true;
 	} else {
-		/* Cause a freeze with an invalid MMIO write. */
+		/* Cause a freeze with an invalid MMIO read.  If the BAR is not
+		 * enabled, this will checkstop the machine.
+		 */
+		npu_dev_bar_update(p->chip_id, &dev->bar, true);
 		in_be64((void *)dev->bar.base);

More information about the Skiboot mailing list