From patchwork Wed Mar 8 09:20:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Krcka, Tomas" X-Patchwork-Id: 13165506 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6AB68C64EC4 for ; Wed, 8 Mar 2023 09:22:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:CC :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=/W9Gb+RrMNFdvDILfWy77djhq/Omtha2bgmB/VXpPUc=; b=mygAfLSJr3ku3K aRl7Aw1znHT9aY9y6FSpHpIM5WcYZIYsOrJTWuQgPrCH6lN4TEVo01PHiUieGiCaKN7iVW25qYhqh UyBUZe4y79XT3IIX5BvIXM/QGVaDKwUVQwrCivA13l4/byxUQaa6KzO2UMnLEUhMiFsyyRrWcj9uS haUQqkZm8enPfGZ0vh2Sj/su/c7CGRB/cyRLNlaoumWkmuuXs7s53pFj/ytegclWWUIlBtHqH7sgr zfQQmhEbqhm9nANZamv6ApqCXRI0LYR60KP7y+IgDOWvGqorLDDnp8ctKlGVm8/42qMi8VnE/wwAb 0Pzw/ZjjqeBBMOJPCokw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pZpyz-004AHD-8C; Wed, 08 Mar 2023 09:21:13 +0000 Received: from smtp-fw-2101.amazon.com ([72.21.196.25]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pZpyt-004AES-DJ for linux-arm-kernel@lists.infradead.org; Wed, 08 Mar 2023 09:21:11 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.de; i=@amazon.de; q=dns/txt; s=amazon201209; t=1678267267; x=1709803267; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=y+qjIHWzcca+yd9j/kP72fFl8+TP5V5KFgYwtZbFabI=; b=NvkesYgtMRMciIm4RovUK9wdNe1PVk94FfMBP3cgJPY1vga9p6Fq1FI6 l2qVZhsfiN1n4JX/HtBzC6cSq3Jbq7qCDDRPnrsmgVe+p/CTRd197MNAs y08V6lpQeSN2eyov/6BRMfpZzIAGWZgnKGLmBPLjQb85bJENyL5hHR372 A=; X-IronPort-AV: E=Sophos;i="5.98,243,1673913600"; d="scan'208";a="300733479" Received: from iad12-co-svc-p1-lb1-vlan3.amazon.com (HELO email-inbound-relay-pdx-2b-m6i4x-32fb4f1a.us-west-2.amazon.com) ([10.43.8.6]) by smtp-border-fw-2101.iad2.amazon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Mar 2023 09:20:55 +0000 Received: from EX19D020EUA002.ant.amazon.com (pdx1-ws-svc-p6-lb9-vlan2.pdx.amazon.com [10.236.137.194]) by email-inbound-relay-pdx-2b-m6i4x-32fb4f1a.us-west-2.amazon.com (Postfix) with ESMTPS id D51B0C185B; Wed, 8 Mar 2023 09:20:53 +0000 (UTC) Received: from EX19D030EUC001.ant.amazon.com (10.252.61.228) by EX19D020EUA002.ant.amazon.com (10.252.50.89) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.21; Wed, 8 Mar 2023 09:20:52 +0000 Received: from EX13MTAUWA001.ant.amazon.com (10.43.160.58) by EX19D030EUC001.ant.amazon.com (10.252.61.228) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.1118.24; Wed, 8 Mar 2023 09:20:51 +0000 Received: from dev-dsk-krckatom-1b-7b393aa4.eu-west-1.amazon.com (10.13.225.85) by mail-relay.amazon.com (10.43.160.118) with Microsoft SMTP Server (TLS) id 15.0.1497.45 via Frontend Transport; Wed, 8 Mar 2023 09:20:49 +0000 From: Tomas Krcka To: CC: Tomas Krcka , Will Deacon , "Robin Murphy" , Joerg Roedel , Lu Baolu , Shameer Kolothum , , Subject: [PATCH] iommu/arm-smmu-v3: Fix event queue overflow acknowledgment Date: Wed, 8 Mar 2023 09:20:47 +0000 Message-ID: <20230308092048.71390-1-krckatom@amazon.de> X-Mailer: git-send-email 2.39.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230308_012107_665601_91EF40AC X-CRM114-Status: GOOD ( 14.46 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org When an overflow occurs in the event queue, the SMMU toggles overflow flag OVFLG in the PROD register. The evtq thread is supposed to acknowledge the overflow flag by toggling flag OVACKFLG in the CONS register, otherwise the overflow condition is still active (OVFLG != OVACKFLG). Currently the acknowledge register is toggled after clearing the event queue but is never propagated to the hardware. It would be done next time when executing evtq thread. The SMMU still adds elements to the queue when the overflow condition is active but any subsequent overflow information after clearing the event queue will be lost. This change keeps the SMMU in sync as it's expected by design. Signed-off-by: Tomas Krcka Suggested-by: KarimAllah Ahmed --- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c index f2425b0f0cd6..acc1ff5ff69b 100644 --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c @@ -1579,6 +1579,7 @@ static irqreturn_t arm_smmu_evtq_thread(int irq, void *dev) /* Sync our overflow flag, as we believe we're up to speed */ llq->cons = Q_OVF(llq->prod) | Q_WRP(llq, llq->cons) | Q_IDX(llq, llq->cons); + queue_sync_cons_out(q); return IRQ_HANDLED; }