From patchwork Mon Jan 30 16:53:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Curtin X-Patchwork-Id: 13121445 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 2B2ECC54EED for ; Mon, 30 Jan 2023 16:56:49 +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=azQm0ENHuH6qQ+tSdGpRjcclt036oPyOQH984s8fFfU=; b=mgsS65yQI5sVKY UrOiRTE5/3XA+HzRjtNaX3/w3XPEks/wkw7XdXsseFcQ+7S03NLsPFiVALPWUFVlWDHhwfdpO/kde ElNbRCQ1LxDMvKewgf1sLkHnoWafALm6owt7snThlnyVnLQPFGsYbWgXJZKCsuWZlPefOW+DZvhtP XjdBlKtV91dXH5fd3ef90BFp5zMbDZI3PUeI8rPdCFsS/mv9sTr66/Ss5Sf1WrsT7pN2kutgekmWX GS+RlNaAs2WS5zKsvHp4XRa3lxwgdZgwxu8wtAvRDRh7+dQLgNKOCzYYJP7OP8sIBMQ4QsV6hNZbD RMYtOHcyC3rowtvUgCrQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pMXQb-004K2H-9A; Mon, 30 Jan 2023 16:54:45 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pMXPr-004JwP-SD for linux-arm-kernel@lists.infradead.org; Mon, 30 Jan 2023 16:54:08 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1675097636; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=kkgm+GawpEMj0/b8bomXaQOPdUfNkg30jmt/yNSamL8=; b=Gvd8XoG6FAAlaYOG+dTrpjYwsPxmM4kByQ0Z7KtvK51v5bd7vZhjrHkkOvXewkhtS9HgkZ jQ+HdG89RueS+aWkynDVjmHkhApHhYnRfDXFyHywKK+YBniiy3owPQfjSOumy3hqmxyRd8 Ba6OwK6CQ2ew4GbHw2V+CeKA81fAb1o= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-66-C3G2XhOfN0mjJlqXkJLi8A-1; Mon, 30 Jan 2023 11:53:55 -0500 X-MC-Unique: C3G2XhOfN0mjJlqXkJLi8A-1 Received: by mail-wm1-f72.google.com with SMTP id j24-20020a05600c1c1800b003dc4480f7bdso4800424wms.5 for ; Mon, 30 Jan 2023 08:53:55 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=kkgm+GawpEMj0/b8bomXaQOPdUfNkg30jmt/yNSamL8=; b=3dm5ValiTkobhVpwpvdWwVHvRkbbATdqeCBP1BNk0g6pIUTKphAuvJC2iFcTLi77pS sizRPImrE/vI3ikxiNCMb2upgidFv6d7g1tIejcLYIrWAlXYSQZeqF7aI6yhM8uzpWY1 No4yXFRE7h85bCnkmdbHh0mQXkgU9mx42RQ7+FVJP/SngbfyqWujpzz461DSxnTYXmgJ gWuv5J4/EcP8S97Ihht+wGiwVju2giIsC3jbWw1JKcBtBIAL9lBlV24QtG4iaXLu37qq jTFKGdSZZ70R4cd1suQCBzBIBoeWQK4gMVcJ94grpVBhjdgdtj2n75aLhbVxO4ItOD5i Rx/g== X-Gm-Message-State: AFqh2kqTl/H6cnCh0sY3F9wafc9pLmDSRauJ0Nu3Ap2H9QwHS59vg1eS cz5dJ6fjWw/dQh2wV/NPh/RrUazLJzLHXm982kjHb1YRer4X8e46tHTqH3j2ZE+1agZzBRE1vjE D2oaeeRF+dGMV/fnuoWcorIdh3J1nVKD/pac= X-Received: by 2002:a05:600c:3586:b0:3da:fb3c:c1ab with SMTP id p6-20020a05600c358600b003dafb3cc1abmr48909704wmq.0.1675097634459; Mon, 30 Jan 2023 08:53:54 -0800 (PST) X-Google-Smtp-Source: AMrXdXtAfoRcm7NT4ZYC0o5cofJixnO/hgW2tQbP0lBvYL7zDDtE7psgWTMQUvqDIedKwjr+ouHdog== X-Received: by 2002:a05:600c:3586:b0:3da:fb3c:c1ab with SMTP id p6-20020a05600c358600b003dafb3cc1abmr48909693wmq.0.1675097634291; Mon, 30 Jan 2023 08:53:54 -0800 (PST) Received: from p1.. ([77.75.244.146]) by smtp.gmail.com with ESMTPSA id n20-20020a05600c465400b003dc43a10fa5sm8677422wmo.13.2023.01.30.08.53.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Jan 2023 08:53:53 -0800 (PST) From: Eric Curtin To: asahi@lists.linux.dev Cc: Eric Curtin , Dan Carpenter , Hector Martin , Sven Peter , Alyssa Rosenzweig , Joerg Roedel , Will Deacon , Robin Murphy , linux-arm-kernel@lists.infradead.org (moderated list:ARM/APPLE MACHINE SUPPORT), iommu@lists.linux.dev (open list:IOMMU SUBSYSTEM), linux-kernel@vger.kernel.org (open list) Subject: [PATCH] iommu: dart: DART_T8110_ERROR range should be 0 to 5 Date: Mon, 30 Jan 2023 16:53:50 +0000 Message-Id: <20230130165350.58533-1-ecurtin@redhat.com> X-Mailer: git-send-email 2.39.1 MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230130_085400_031118_875A8CF0 X-CRM114-Status: UNSURE ( 9.99 ) X-CRM114-Notice: Please train this message. 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 This was detected by smatch as one "else if" statement could never be reached. Confirmed bit order by comparing with python implementation [1]. drivers/iommu/apple-dart.c:991 apple_dart_t8110_irq() warn: duplicate check 'error_code == ((((1))) << (3))' (previous on line 989) Link: https://github.com/AsahiLinux/m1n1/commit/96b2d584feec1e3f7bfa [1] Fixes: d8bcc870d99d ("iommu: dart: Add t8110 DART support") Reported-by: Dan Carpenter Signed-off-by: Eric Curtin --- drivers/iommu/apple-dart.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/iommu/apple-dart.c b/drivers/iommu/apple-dart.c index efe877842f72..3adacf4094d7 100644 --- a/drivers/iommu/apple-dart.c +++ b/drivers/iommu/apple-dart.c @@ -112,15 +112,15 @@ #define DART_T8110_ERROR_MASK 0x104 -#define DART_T8110_ERROR_READ_FAULT BIT(4) -#define DART_T8110_ERROR_WRITE_FAULT BIT(3) +#define DART_T8110_ERROR_READ_FAULT BIT(5) +#define DART_T8110_ERROR_WRITE_FAULT BIT(4) #define DART_T8110_ERROR_NO_PTE BIT(3) #define DART_T8110_ERROR_NO_PMD BIT(2) #define DART_T8110_ERROR_NO_PGD BIT(1) #define DART_T8110_ERROR_NO_TTBR BIT(0) #define DART_T8110_ERROR_ADDR_LO 0x170 -#define DART_T8110_ERROR_ADDR_HI 0x174 +#define DART_T8110_ERROR_ADDR_HI 0x175 #define DART_T8110_PROTECT 0x200 #define DART_T8110_UNPROTECT 0x204