From patchwork Wed Feb 1 12:42:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Curtin X-Patchwork-Id: 13124225 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 15034C636CD for ; Wed, 1 Feb 2023 12:47:02 +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=exUr3s7nP49ekuyyEnDzURhjXAEl0ilOVjiSsmuAbl8=; b=z7xdtjpttXYlFP O7aj/slbguOtVufWGUmjE1lpl7dsfi69aB4PbuwnLnZEKom8Eem1E2Rutq6x+UEejRF9Y3Jcfpg6Q xm5XtOM+/7HYpjbTocM9DAtqyVwNN3vcEZj8cGgZTqp4Y3Q4+8VYa8ofVKahOuuP8eQ/xP+f72EYk AbJbCVGEY1adNAdJ1XdsHH0bfpRk9WotsKsZs1ha22TrNxCpOLnI2tIPI9X8O23S7diknhKs2z0u4 slPtP3B7QKpdJtbMHjHZZ8cfDVMGVfznxfZFpf1rgH7v2M9UYRet7xvTVsH2gi9CvX0NINtq/+XM0 h63E1RqY54ruLUGoCJAQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pNCUu-00BlKg-1Y; Wed, 01 Feb 2023 12:45:56 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pNCUq-00BlJb-61 for linux-arm-kernel@lists.infradead.org; Wed, 01 Feb 2023 12:45:53 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1675255547; 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=P5+/TE6LzKC07Kx1pXnv9JC6SnXItOhhp/p3/pfSlio=; b=V1fBEf6rR/I7cHMYqTiBKKul+L4Q1cVin6/w9LYtSRjtYAP803LMBVCy4zDYRQ77ZaW07e PrI/X7MAPJc+W0hvQlkUkRbtQTDueL0Hii+vYcTydyJ6us1qq34KxoTVY2QlAsT7rGo+P/ 4jaBs/opRLqG+NMvkiTzs7jtkVu7Dt8= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-613-IZ3Nm_g6Pr-wSwyW14vT1A-1; Wed, 01 Feb 2023 07:45:45 -0500 X-MC-Unique: IZ3Nm_g6Pr-wSwyW14vT1A-1 Received: by mail-wm1-f71.google.com with SMTP id l31-20020a05600c1d1f00b003deab30bb8bso803117wms.2 for ; Wed, 01 Feb 2023 04:45:45 -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=P5+/TE6LzKC07Kx1pXnv9JC6SnXItOhhp/p3/pfSlio=; b=7nrg709U3mB5l/9ruDmu+s551CS3zcmH39qOcoPTghreZ/NszK5b6RV8irljBZ5ad0 4/2DY6YWYQ8CVwMGWnetO8g3LTIGDc6nqmiKvhmMRKoaXyJQ6ZJ8YlhCTnW4kjaZpiUU xngEG5GRiHuc0MgcCgMpsEvjFahPI9qn1mQsx0PacR0zZa/sKfkXog9291C4qrJ99fbl ACiJvfW4t6YrRj4vpkBoLufCyCQSKl62oPAq6+IY7QRoXsU/8Ki8X8qK4LnGDPmhy3l/ OZnIY2pXNAe3aB+ZN/vTNjQzlkXXbX6d4zgOtySmaFRxkzW9yK/NDY+qKEjsYZesWnm3 TQ4Q== X-Gm-Message-State: AO0yUKW3jJaYL5ghMxTqQwkp4DHbYdnzNKvrwO/yHDI4oc5E9JWtS6GG +8/PgAdxbKo6m5lWQCNbFXfx5vwwNjqinimLS3wbzmKA5EvN86PwRQDAUjTc96YfSOsfs2RXXaS wGW4X0//CewoFyXTT1HIGIwmHWNlyIwEeXas= X-Received: by 2002:a05:600c:314d:b0:3dc:5bd7:62ec with SMTP id h13-20020a05600c314d00b003dc5bd762ecmr1867366wmo.32.1675255544924; Wed, 01 Feb 2023 04:45:44 -0800 (PST) X-Google-Smtp-Source: AK7set8X93HL3Pr+6m4ySC12znD+8GoeAtT14ExdjxV3jscGlmPBNCPHqUqxLTGT8qb1RFXrdrgjLw== X-Received: by 2002:a05:600c:314d:b0:3dc:5bd7:62ec with SMTP id h13-20020a05600c314d00b003dc5bd762ecmr1867352wmo.32.1675255544695; Wed, 01 Feb 2023 04:45:44 -0800 (PST) Received: from localhost.localdomain ([2001:bb6:963d:9e00:7585:fe90:1658:512f]) by smtp.gmail.com with ESMTPSA id k27-20020a05600c081b00b003de77597f16sm1626333wmp.21.2023.02.01.04.45.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Feb 2023 04:45:44 -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 v2] iommu: dart: DART_T8110_ERROR range should be 0 to 5 Date: Wed, 1 Feb 2023 12:42:58 +0000 Message-Id: <20230201124257.7801-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-20230201_044552_338125_FF15A33E X-CRM114-Status: GOOD ( 11.95 ) 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 --- Changes in v2: Remove DART_T8110_ERROR_ADDR_HI change --- drivers/iommu/apple-dart.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iommu/apple-dart.c b/drivers/iommu/apple-dart.c index 42666617803d..fd09abe8d29e 100644 --- a/drivers/iommu/apple-dart.c +++ b/drivers/iommu/apple-dart.c @@ -111,8 +111,8 @@ #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)