Skip to content

Commit 960be6e

Browse files
Georgi Djakovwilldeacon
authored andcommitted
iommu/arm-smmu: Allow using a threaded handler for context interrupts
Threaded IRQ handlers run in a less critical context compared to normal IRQs, so they can perform more complex and time-consuming operations without causing significant delays in other parts of the kernel. During a context fault, it might be needed to do more processing and gather debug information from TBUs in the handler. These operations may sleep, so add an option to use a threaded IRQ handler in these cases. Signed-off-by: Georgi Djakov <quic_c_gdjako@quicinc.com> Link: https://lore.kernel.org/r/20240417133731.2055383-4-quic_c_gdjako@quicinc.com Signed-off-by: Will Deacon <will@kernel.org>
1 parent 414ecb0 commit 960be6e

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

drivers/iommu/arm/arm-smmu/arm-smmu.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -806,8 +806,16 @@ static int arm_smmu_init_domain_context(struct arm_smmu_domain *smmu_domain,
806806
else
807807
context_fault = arm_smmu_context_fault;
808808

809-
ret = devm_request_irq(smmu->dev, irq, context_fault, IRQF_SHARED,
810-
"arm-smmu-context-fault", smmu_domain);
809+
if (smmu->impl && smmu->impl->context_fault_needs_threaded_irq)
810+
ret = devm_request_threaded_irq(smmu->dev, irq, NULL,
811+
context_fault,
812+
IRQF_ONESHOT | IRQF_SHARED,
813+
"arm-smmu-context-fault",
814+
smmu_domain);
815+
else
816+
ret = devm_request_irq(smmu->dev, irq, context_fault, IRQF_SHARED,
817+
"arm-smmu-context-fault", smmu_domain);
818+
811819
if (ret < 0) {
812820
dev_err(smmu->dev, "failed to request context IRQ %d (%u)\n",
813821
cfg->irptndx, irq);

drivers/iommu/arm/arm-smmu/arm-smmu.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,7 @@ struct arm_smmu_impl {
438438
int (*def_domain_type)(struct device *dev);
439439
irqreturn_t (*global_fault)(int irq, void *dev);
440440
irqreturn_t (*context_fault)(int irq, void *dev);
441+
bool context_fault_needs_threaded_irq;
441442
int (*alloc_context_bank)(struct arm_smmu_domain *smmu_domain,
442443
struct arm_smmu_device *smmu,
443444
struct device *dev, int start);

0 commit comments

Comments
 (0)