History

coresight: tmc: Fix TMC mode read in tmc_read_unprepare_etb()

Reading TMC mode register without proper coresight power management can lead to exceptions like the one in the call trace below in tmc_read_unprepare_etb() when the trace data is read after the sink is disabled. So fix this by having a check for coresight sysfs mode before reading TMC mode management register in tmc_read_unprepare_etb() similar to tmc_read_prepare_etb(). SError Interrupt on CPU6, code 0xbe000411 -- SError pstate: 80400089 (Nzcv daIf +PAN -UAO) pc : tmc_read_unprepare_etb+0x74/0x108 lr : tmc_read_unprepare_etb+0x54/0x108 sp : ffffff80d9507c30 x29: ffffff80d9507c30 x28: ffffff80b3569a0c x27: 0000000000000000 x26: 00000000000a0001 x25: ffffff80cbae9550 x24: 0000000000000010 x23: ffffffd07296b0f0 x22: ffffffd0109ee028 x21: 0000000000000000 x20: ffffff80d19e70e0 x19: ffffff80d19e7080 x18: 0000000000000000 x17: 0000000000000000 x16: 0000000000000000 x15: 0000000000000000 x14: 0000000000000000 x13: 0000000000000000 x12: 0000000000000000 x11: 0000000000000000 x10: dfffffd000000001 x9 : 0000000000000000 x8 : 0000000000000002 x7 : ffffffd071d0fe78 x6 : 0000000000000000 x5 : 0000000000000080 x4 : 0000000000000001 x3 : ffffffd071d0fe98 x2 : 0000000000000000 x1 : 0000000000000004 x0 : 0000000000000001 Kernel panic - not syncing: Asynchronous SError Interrupt

Sai Prakash Ranjan committed 6 years ago

Commit d021f5c1 parent 865d3071 file · +6 −7Browse files

Unified · Split

drivers/hwtracing/coresight/coresight-tmc-etf.c+6−7
@@ -639,15 +639,14 @@ int tmc_read_unprepare_etb(struct tmc_drvdata *drvdata) · 638 unmodified lines
639 639
640 spin_lock_irqsave(&drvdata->spinlock, flags);640 spin_lock_irqsave(&drvdata->spinlock, flags);
641 641
642 /* There is no point in reading a TMC in HW FIFO mode */
643 mode = readl_relaxed(drvdata->base + TMC_MODE);
644 if (mode != TMC_MODE_CIRCULAR_BUFFER) {
645 spin_unlock_irqrestore(&drvdata->spinlock, flags);
646 return -EINVAL;
647 }
648
649 /* Re-enable the TMC if need be */642 /* Re-enable the TMC if need be */
650 if (drvdata->mode == CS_MODE_SYSFS) {643 if (drvdata->mode == CS_MODE_SYSFS) {
644 /* There is no point in reading a TMC in HW FIFO mode */
645 mode = readl_relaxed(drvdata->base + TMC_MODE);
646 if (mode != TMC_MODE_CIRCULAR_BUFFER) {
647 spin_unlock_irqrestore(&drvdata->spinlock, flags);
648 return -EINVAL;
649 }
651 /*650 /*
652 * The trace run will continue with the same allocated trace651 * The trace run will continue with the same allocated trace
653 * buffer. As such zero-out the buffer so that we don't end652 * buffer. As such zero-out the buffer so that we don't end

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t