Commit 0eae01be authored by Boris Brezillon's avatar Boris Brezillon

drm/panfrost: Stay in the threaded MMU IRQ handler until we've handled all IRQs

Doing a hw-irq -> threaded-irq round-trip is counter-productive, stay
in the threaded irq handler as long as we can.

v2:
* Rework the loop to avoid a goto
Signed-off-by: default avatarBoris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: default avatarSteven Price <steven.price@arm.com>
Reviewed-by: default avatarRob Herring <robh@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20210205111757.585248-4-boris.brezillon@collabora.com
parent f45da820
...@@ -578,22 +578,20 @@ static irqreturn_t panfrost_mmu_irq_handler_thread(int irq, void *data) ...@@ -578,22 +578,20 @@ static irqreturn_t panfrost_mmu_irq_handler_thread(int irq, void *data)
{ {
struct panfrost_device *pfdev = data; struct panfrost_device *pfdev = data;
u32 status = mmu_read(pfdev, MMU_INT_RAWSTAT); u32 status = mmu_read(pfdev, MMU_INT_RAWSTAT);
int i, ret; int ret;
for (i = 0; status; i++) { while (status) {
u32 mask = BIT(i) | BIT(i + 16); u32 as = ffs(status | (status >> 16)) - 1;
u32 mask = BIT(as) | BIT(as + 16);
u64 addr; u64 addr;
u32 fault_status; u32 fault_status;
u32 exception_type; u32 exception_type;
u32 access_type; u32 access_type;
u32 source_id; u32 source_id;
if (!(status & mask)) fault_status = mmu_read(pfdev, AS_FAULTSTATUS(as));
continue; addr = mmu_read(pfdev, AS_FAULTADDRESS_LO(as));
addr |= (u64)mmu_read(pfdev, AS_FAULTADDRESS_HI(as)) << 32;
fault_status = mmu_read(pfdev, AS_FAULTSTATUS(i));
addr = mmu_read(pfdev, AS_FAULTADDRESS_LO(i));
addr |= (u64)mmu_read(pfdev, AS_FAULTADDRESS_HI(i)) << 32;
/* decode the fault status */ /* decode the fault status */
exception_type = fault_status & 0xFF; exception_type = fault_status & 0xFF;
...@@ -604,8 +602,8 @@ static irqreturn_t panfrost_mmu_irq_handler_thread(int irq, void *data) ...@@ -604,8 +602,8 @@ static irqreturn_t panfrost_mmu_irq_handler_thread(int irq, void *data)
/* Page fault only */ /* Page fault only */
ret = -1; ret = -1;
if ((status & mask) == BIT(i) && (exception_type & 0xF8) == 0xC0) if ((status & mask) == BIT(as) && (exception_type & 0xF8) == 0xC0)
ret = panfrost_mmu_map_fault_addr(pfdev, i, addr); ret = panfrost_mmu_map_fault_addr(pfdev, as, addr);
if (ret) if (ret)
/* terminal fault, print info about the fault */ /* terminal fault, print info about the fault */
...@@ -617,7 +615,7 @@ static irqreturn_t panfrost_mmu_irq_handler_thread(int irq, void *data) ...@@ -617,7 +615,7 @@ static irqreturn_t panfrost_mmu_irq_handler_thread(int irq, void *data)
"exception type 0x%X: %s\n" "exception type 0x%X: %s\n"
"access type 0x%X: %s\n" "access type 0x%X: %s\n"
"source id 0x%X\n", "source id 0x%X\n",
i, addr, as, addr,
"TODO", "TODO",
fault_status, fault_status,
(fault_status & (1 << 10) ? "DECODER FAULT" : "SLAVE FAULT"), (fault_status & (1 << 10) ? "DECODER FAULT" : "SLAVE FAULT"),
...@@ -626,6 +624,10 @@ static irqreturn_t panfrost_mmu_irq_handler_thread(int irq, void *data) ...@@ -626,6 +624,10 @@ static irqreturn_t panfrost_mmu_irq_handler_thread(int irq, void *data)
source_id); source_id);
status &= ~mask; status &= ~mask;
/* If we received new MMU interrupts, process them before returning. */
if (!status)
status = mmu_read(pfdev, MMU_INT_RAWSTAT);
} }
mmu_write(pfdev, MMU_INT_MASK, ~0); mmu_write(pfdev, MMU_INT_MASK, ~0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment