Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp2110478rwl; Thu, 13 Apr 2023 01:36:35 -0700 (PDT) X-Google-Smtp-Source: AKy350YpjtZAM8ivk7ZZoMYzBt8MO7zCf0UGuTX/TQiB9ZtsYebsPxnHbeomxIKGh407/OOfg8wo X-Received: by 2002:a17:903:247:b0:1a1:adb0:ed72 with SMTP id j7-20020a170903024700b001a1adb0ed72mr1713105plh.4.1681374995179; Thu, 13 Apr 2023 01:36:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681374995; cv=none; d=google.com; s=arc-20160816; b=OUJ5/wfhVfOQBo8KCm0Rv1PFx47GZr7Ji6xi9jEYjxsBEcFArM3fkl3849miiYVB+N r0EJL0WNA2rQiSJfxxazOm96/MtQsAcusUFs8sKeMud/GokEixDsO6qYRqDFAtndXOo6 j5+KIhPBDuhBaJbpvNzwTr2v938hHxWmxwMSTfXFN79R5ZJCyN6B7f4tnz2UjPxfSqfR vu4Bw18GLLDYq0KbWEAiosyRrOOa8oqQCSB00mgFu2KdAdA5cil1Jx6XgIltzIOEbR/u cddL04SnY4GXVFveRf3XorJsuXfxS4ZfjCHUEDdPYxu20wnw9pUdr/01Ze8U2Sc/sYU3 CwKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=DdPYvmnlhKSi2/t2MM9rvNpqpdHa3YjdMYZD1FWaIEs=; b=bXaBFuE9rYO5+I33vDkA+rjF4Aqbrl0lbdifHF6Gi5LfB5OTwZLKGSqp6o3GDKsWp+ 8gdWcvM4cs9eYyWbT4yzydEmDUMs5mtdm5mwWEiUQd3oPhtMoQlvZ0JsEfpaO5AjEf7N HOpdVO1wnL6jHu+MApaJ3fOYtYhoY0VvnkICTVNOenQt7xS/+yX47I4TNteMBugkBKIj w7rsMiIbAXdMkDHgkw+if2QUIoc1fNeL2FuMXRum05Rg5MojkTOLLTZXBhy30p+O7l35 KJmWG4y6ImpaKt9MAOh8DFmDLu4luoSEYkj1DZZd+wYbPrZmo/MY42LhjQmKauLUFzH4 4tHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@kapsi.fi header.s=20161220 header.b=gqJizhtT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kapsi.fi Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i8-20020a1709026ac800b001a1abc9198asi1491463plt.175.2023.04.13.01.36.23; Thu, 13 Apr 2023 01:36:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail header.i=@kapsi.fi header.s=20161220 header.b=gqJizhtT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kapsi.fi Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230387AbjDMIWX (ORCPT + 99 others); Thu, 13 Apr 2023 04:22:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59394 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230393AbjDMIWT (ORCPT ); Thu, 13 Apr 2023 04:22:19 -0400 Received: from mail.kapsi.fi (mail.kapsi.fi [IPv6:2001:67c:1be8::25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3CDDE5FD4; Thu, 13 Apr 2023 01:22:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=kapsi.fi; s=20161220; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=DdPYvmnlhKSi2/t2MM9rvNpqpdHa3YjdMYZD1FWaIEs=; b=gqJizhtTRdr8hkff58lekZDHZf 7w+fg8oyG3h96eTYQeDG4opBNJQ2hLaadNwAQv7PgeTg+xB2dnVoO+KBOKQ2gDguV2khSTVbX1Xx9 fGcQNIcgPeYxO1zMibGgSEFXs/ZTDdSEJJU0PGtAYZJXLIdu5JM62PRaYcy4vXiuzSW332e07moCZ FjMLgDPw2949+DMOSzL0dYDuYezRyfMP/NB6FBbhHPrpB09lqjy5D+MyIk2GNS7WpncNHQE+Vj8x/ FVObCbWTq9uu2E0de0vmsYatPIfMV2SZoYXFy05AHCRJUlU3m0xxo455eA3YTH8v7kPCIAiTloO1X xkalSz4A==; Received: from 91-158-25-70.elisa-laajakaista.fi ([91.158.25.70] helo=toshino.localdomain) by mail.kapsi.fi with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1pmsDc-008oPu-AT; Thu, 13 Apr 2023 11:22:12 +0300 From: Mikko Perttunen To: Thierry Reding Cc: Mikko Perttunen , Dan Carpenter , dri-devel@lists.freedesktop.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/2] gpu: host1x: Return error when context device not attached to IOMMU Date: Thu, 13 Apr 2023 11:22:02 +0300 Message-Id: <20230413082202.114721-2-cyndis@kapsi.fi> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230413082202.114721-1-cyndis@kapsi.fi> References: <20230413082202.114721-1-cyndis@kapsi.fi> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SA-Exim-Connect-IP: 91.158.25.70 X-SA-Exim-Mail-From: cyndis@kapsi.fi X-SA-Exim-Scanned: No (on mail.kapsi.fi); SAEximRunCond expanded to false X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mikko Perttunen If a context device was not attached to IOMMU, we kept the old success err value causing context devices to be unregistered but success to be returned. This would mean that things would go on but with context isolation disabled. To decide on an explicit behavior, let's return an error code here instead. If someone wants to go without IOMMU on a platform modern enough to support context isolation, they can remove the context devices from device tree. Reported-by: Dan Carpenter Signed-off-by: Mikko Perttunen --- drivers/gpu/host1x/context.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/gpu/host1x/context.c b/drivers/gpu/host1x/context.c index 9ad89d22c0ca..c45c4d4e6c1a 100644 --- a/drivers/gpu/host1x/context.c +++ b/drivers/gpu/host1x/context.c @@ -79,6 +79,14 @@ int host1x_memory_context_list_init(struct host1x *host1x) !device_iommu_mapped(&ctx->dev)) { dev_err(host1x->dev, "Context device %d has no IOMMU!\n", i); device_unregister(&ctx->dev); + + /* + * This means that if IOMMU is disabled but context devices + * are defined in the device tree, Host1x will fail to probe. + * That's probably OK in this time and age. + */ + err = -EINVAL; + goto unreg_devices; } } -- 2.39.2