From patchwork Thu Oct 13 18:12:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Jernej_=C5=A0krabec?= X-Patchwork-Id: 13006271 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 C6731C43217 for ; Thu, 13 Oct 2022 18:14:22 +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:References:In-Reply-To: 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: List-Owner; bh=wa37Xrlh4VbGNb1v4SregQANdyv3UjMzCaUYRF5UPyo=; b=eIVdQqEHhsOsTV xrB1QOOCe5kZZ6VThX2Gn49N8yy4ut+LBLqiykXbG8psRaXylbZdTvg6BrKo76CMXjMTN3B8qyCJb 4udsS/vp19PVo0LYCQ1ESkbLG9gVnx2uqxdH+dQmF2LRDj3xUN9uIiV3+4Q9eX6yAOuVmPrLnhrBr 0H+hs1sLWR8v/qAjvDsTC8tWIF70w277I5re6L64pIR7T/9YOJrr1DbNrWwIptjGX/DAI/397xpiP N2vaFJJM2l5No7VuI0LcbGGWsmLK1GM+wdq4l9lLE1VHSNYmeQ878CtNLjA/IehLIFIREaHq8FA54 SVyhI9IGEL5+rB/wgDNw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oj2hn-00CdOX-IG; Thu, 13 Oct 2022 18:13:15 +0000 Received: from mail-ed1-x52d.google.com ([2a00:1450:4864:20::52d]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oj2hT-00CdEp-7E for linux-arm-kernel@lists.infradead.org; Thu, 13 Oct 2022 18:12:57 +0000 Received: by mail-ed1-x52d.google.com with SMTP id u21so3734325edi.9 for ; Thu, 13 Oct 2022 11:12:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=wy++TP4MEmK9+IncYVXW5dpqxIdw3c9kXrFdre+ha14=; b=CQ9TnzAPgu0twXcz51eJtm0MYyiV+U12yy5ia/sBn3YqCfoEQNZbJox/YeWnpaIBoE TYEM9Hw0EGjn2tXKlAWjrkaORyfaKwcar28Ec7NSFIeLYAllGCqNh2pU2PYx3LxsqxFG 6z6XuuKosJtWm6yPV0CdYsnYS7GdnBmUj7R82Ws3yOFTwaIxD32pVpcKhNvW/hq4azh/ pyxMhT+TJGWjw77Bz/d7ZlNR59kXaW9mCpfOPX3rRypwf8LOMd1e3Oc7h8YH1pyz08E5 rppEhw2WHhCkDKW3evmIBSWV1bQ5vA0vM4LjoFtItLlNwt+gYHNoOtSigZItkYpjUT00 NUTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wy++TP4MEmK9+IncYVXW5dpqxIdw3c9kXrFdre+ha14=; b=mLmFayfkznVc5skwBMKt72eHAIAkd5iaUTcrwos5pikxao9s5NjKzFgTrukfrj6FhI 0vogGS/U+ie2Y9Q3rn1XWFktZUWkNY7vg/3X/9j1PdVY5N47iQCfNGY21JaPdspdiqa1 UVXDMf3Hs3kKMSsTBXQudC3x2WcLuEnVV0OaH8J2k9ILOIubgBZ2i3zQTcgbc0vP1k9E LjAVpey3XSXdHYIkYyAFj4sM/TdjM93/d8VPPZyuNo2XjPVn5DxdA67rgFsrqgs/ykSP gQ/E4oSpo9t1tCxPJ4LEEsj3Qt2WWE5O6Jhetjfn2EhUsyv3ZOe+eU9Qxfjs1CTQB++d ZGkQ== X-Gm-Message-State: ACrzQf0mve7SGhsFBMK3/Z7bQ1zEXZWTeZxJ92Z3foKxm8LIZ3Q3DeAj oK2JNYRX64kaSXX5kj0Hxa0= X-Google-Smtp-Source: AMsMyM4ICzUCjoigsNUFgWVeKqBHqBJ1tuJkf0WbPLqftDEHH2D+3WKsfapHPDp486t6zWZt35VE2A== X-Received: by 2002:a05:6402:1944:b0:457:fed7:5c30 with SMTP id f4-20020a056402194400b00457fed75c30mr873109edz.278.1665684766034; Thu, 13 Oct 2022 11:12:46 -0700 (PDT) Received: from kista.localdomain (82-149-19-102.dynamic.telemach.net. [82.149.19.102]) by smtp.gmail.com with ESMTPSA id ku15-20020a170907788f00b0078b551d2fa3sm211109ejc.103.2022.10.13.11.12.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Oct 2022 11:12:45 -0700 (PDT) From: Jernej Skrabec To: maxime@cerno.tech, joro@8bytes.org, will@kernel.org, robin.murphy@arm.com, wens@csie.org, samuel@sholland.org Cc: iommu@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org, Jernej Skrabec Subject: [PATCH 1/5] iommu/sun50i: Fix reset release Date: Thu, 13 Oct 2022 20:12:16 +0200 Message-Id: <20221013181221.3247429-2-jernej.skrabec@gmail.com> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221013181221.3247429-1-jernej.skrabec@gmail.com> References: <20221013181221.3247429-1-jernej.skrabec@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221013_111255_314795_F4C686FE X-CRM114-Status: GOOD ( 13.08 ) 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 Reset signal is asserted by writing 0 to the corresponding locations of masters we want to reset. So in order to deassert all reset signals, we should write 1's to all locations. Current code writes 1's to locations of masters which were just reset which is good. However, at the same time it also writes 0's to other locations and thus asserts reset signals of remaining masters. Fix code by writing all 1's when we want to deassert all reset signals. This bug was discovered when working with Cedrus (video decoder). When it faulted, display went blank due to reset signal assertion. Fixes: 4100b8c229b3 ("iommu: Add Allwinner H6 IOMMU driver") Signed-off-by: Jernej Skrabec --- drivers/iommu/sun50i-iommu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/iommu/sun50i-iommu.c b/drivers/iommu/sun50i-iommu.c index a84c63518773..c777882d0ec2 100644 --- a/drivers/iommu/sun50i-iommu.c +++ b/drivers/iommu/sun50i-iommu.c @@ -27,6 +27,7 @@ #include #define IOMMU_RESET_REG 0x010 +#define IOMMU_RESET_RELEASE_ALL 0xffffffff #define IOMMU_ENABLE_REG 0x020 #define IOMMU_ENABLE_ENABLE BIT(0) @@ -893,7 +894,7 @@ static irqreturn_t sun50i_iommu_irq(int irq, void *dev_id) iommu_write(iommu, IOMMU_INT_CLR_REG, status); iommu_write(iommu, IOMMU_RESET_REG, ~status); - iommu_write(iommu, IOMMU_RESET_REG, status); + iommu_write(iommu, IOMMU_RESET_REG, IOMMU_RESET_RELEASE_ALL); spin_unlock(&iommu->iommu_lock);