Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp5161130rwi; Mon, 17 Oct 2022 16:42:44 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5fw4eKSTeRqw4hEdhI5T1Q8cBvS/iMEO7Sii07OwzuL/9o6WP0FvUeHIsmVEVlqZprmRNd X-Received: by 2002:a17:907:8a24:b0:78d:cd60:1022 with SMTP id sc36-20020a1709078a2400b0078dcd601022mr150023ejc.384.1666050163916; Mon, 17 Oct 2022 16:42:43 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1666050163; cv=pass; d=google.com; s=arc-20160816; b=tAcoX1q3AHYLkrDySXup89n2cnLt7dLNgcXF5Uquxl/KiGIQFdfXCpS7uc9xC7hwb7 nLyduTdNNHG/cEJ2tox4z1+gfD5Pc4zb1Rd4tRRx1D4bqBV7BKHwOHU/TaaXo6+zBwOq a/rPvNdcLYW8lHfZArpC2lrMmWIXHRpiaoZh3b5+CEJKsOVNdnb0ecoIoXC3u9FsXq2d DtYvX2UXmwNdUaUrl/MuyQxODnuFfWOwfD6ZhHsJN43n+lmZE/ec3c5ou9/76tCPuKsl 8IoIPhc7O8E2g5cBbEtESOCv1fIuLgnkGP4NlI22gFvkuNEb0OVysxsdc8wLwo672MRl XLDA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=bkfNKy7kBz07Xahm5eQ7Vb3aISDZT2P21keDziNvtKk=; b=LTuYsgoteIxDUqzTSYFqkEZAw8Q3SJOxozzRQ4cOrLmGZ3nP3UxkbwG5QQYFeXkhqz wazkO7aQQ8/YJgbHBF6cEsq3ZRFL0qtNImL39vYDDjV4XqtCuuczBeSJt2ClMzaT1txX /01xpFWT+VvJIwpwqRyetqxDpR9JXVYSCbY5LtyFeANR+2pPSpSkxoCxxJfilzvo99No IowuWw9dEetsIkYvEU0yjMnLTHD/haDriwKfFjUPqVUK0aiFHS4UoUWyMyVkQjNtIBv8 K2OZEmhvJ/VTZoMiERwtZhnQQ7i2porFJVv86yWLxK/8WuOZk8ny6Ywct9AZFFGzTufZ +Grw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b="WYCkB/WE"; arc=pass (i=1 spf=pass spfdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z19-20020a05640235d300b00457e293e3easi11628958edc.573.2022.10.17.16.42.18; Mon, 17 Oct 2022 16:42:43 -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=pass header.i=@Nvidia.com header.s=selector2 header.b="WYCkB/WE"; arc=pass (i=1 spf=pass spfdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231231AbiJQXHO (ORCPT + 99 others); Mon, 17 Oct 2022 19:07:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57430 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231444AbiJQXGu (ORCPT ); Mon, 17 Oct 2022 19:06:50 -0400 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on20626.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe5a::626]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E10DB84E5A for ; Mon, 17 Oct 2022 16:06:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ajhyn/NnBBjR5jNcM50fI90VkbEEN2NdCwBivyqRqVGIdrGhkTFhVcCwqXoR4s3f1hpLigPQY36A5q7HRTvua5RikMCcJIehTzcKsNuw3Oj2lPcuewd5Uorq95aGtgt+mW7gLUp12tX4Eix4clLZyJ5HR37lqpnoJI4k7i9H77zKvO86T/Fs4hTstDLT79C3+V54+o5/pHKYIdI7MKNCqVvj/Z+ILTQ5OqqZzcLWmfAQCXcsRAk7oSFJWhY1Lle2o8N1J4SmFhGzRcGbdWfCp4fCosNBsoSvyqpOFXCvxAwWU/5is3aYpxaxrmWxvpaUOiireQEVKI0UiWxun2QKpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=bkfNKy7kBz07Xahm5eQ7Vb3aISDZT2P21keDziNvtKk=; b=IpbK7Ycpr3ZLhAKSLsw0IMzOrgbvbEsYeyuRsZ0/JJeHpJha1hVLdM2hYGzEy45+WhdR1sREokKl1BNEdsDo3+WlT9hrPv/IEXwM/8PmcE9cX5bZJ6wWoCK6C6DygQTkldKZre2R61BC4XLBj+mP6Olj3ziwBRlqgka0M7jPhvpbrVLFGHSNsW7JGCr8GJeSiP8o/NEIsgIcP0Mm83WSSSOGwAfkJU23vwh4HDFFTnHeNdsISIvBz9Y7sIBkdAsrUETNF4KjFhhOwOLfdtDFDq3ltN7wMo2Q5SwUEhEo3ntGdTdX3SBgCyOOCZMpemLaF0jWLFPqc3Y4uNg/Z2xnjA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=8bytes.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=bkfNKy7kBz07Xahm5eQ7Vb3aISDZT2P21keDziNvtKk=; b=WYCkB/WEGSoFA9etL9jfO3gYDY2zfodmuSajFlo3JlT6lVPzppTjr78pUnMfu/cm4ScHPVYYVBa3j9bR46rYeEyQo8ZUlsYytqN5fkHCnUGd1dQ2s5SO5FYvt2ti869uHTH4EIvnjQSrvbaBVH7Df7eC3+lMK+FFEV+e2S/RHUDtLYILi7Ps8joiCGz0V7sOpb538WrC2Um0Icm1y3DoUEjHIsEqrvrMgQiduVkhPB8Qj/mvlfYKseK4XgBQ1xxiHYSQFASzIDvoD1dS6gxH7ctdj8HxQnOonkHYng4XvlemYc61BDHoAuaH7YorBigkj3vsSBXD5fiT9/cmH6cvcQ== Received: from MW4PR04CA0068.namprd04.prod.outlook.com (2603:10b6:303:6b::13) by PH7PR12MB6659.namprd12.prod.outlook.com (2603:10b6:510:210::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.32; Mon, 17 Oct 2022 23:02:46 +0000 Received: from CO1NAM11FT029.eop-nam11.prod.protection.outlook.com (2603:10b6:303:6b:cafe::87) by MW4PR04CA0068.outlook.office365.com (2603:10b6:303:6b::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.32 via Frontend Transport; Mon, 17 Oct 2022 23:02:46 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by CO1NAM11FT029.mail.protection.outlook.com (10.13.174.214) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.20 via Frontend Transport; Mon, 17 Oct 2022 23:02:46 +0000 Received: from rnnvmail203.nvidia.com (10.129.68.9) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.26; Mon, 17 Oct 2022 16:02:39 -0700 Received: from rnnvmail204.nvidia.com (10.129.68.6) by rnnvmail203.nvidia.com (10.129.68.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.29; Mon, 17 Oct 2022 16:02:38 -0700 Received: from Asurada-Nvidia.nvidia.com (10.127.8.14) by mail.nvidia.com (10.129.68.6) with Microsoft SMTP Server id 15.2.986.29 via Frontend Transport; Mon, 17 Oct 2022 16:02:37 -0700 From: Nicolin Chen To: , , CC: , , , , , , , , , Subject: [PATCH v7 5/5] iommu: Propagate return value in ->attach_dev callback functions Date: Mon, 17 Oct 2022 16:02:36 -0700 Message-ID: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT029:EE_|PH7PR12MB6659:EE_ X-MS-Office365-Filtering-Correlation-Id: 92a8ffc0-564a-4070-4368-08dab093b488 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vregawATSCx03eZMk9lgOypWNxewB8KbG0coHOMXIAqWbztO3WEz5xYv2Bo329LOVq9hA0P8t0LYzYRSEIAni81n8TLQtffl75RuLtu5q7dozsAgO1Nyv8pudGBhtmVGDb7Bf75b3jDoEny+aNOMrOIEHsZStMTBfOQRABgf4Gu7XrbUxReMwFYlAVBgeTl+EXJJ8d5JFPIFh1IxY94GjAb9dPUQni9sLGrTUpEFfP7fipIbO777HspG+d/451zBTXIFIdPTpY+YcW9GB2gf9pmddmKKngZzpd4kxb8OxDlL9OFG4dlRWXFxVgMCnZlx+txQjoBTgy1ynWAjjZBlF8wyqxwaelPVASKp08kivDwGOZ1oaTIkJOPfhg+oZ04t6Kdakzgmes6zt0GoIKfwYDWYRf7KpXoqsd7/ocBOq6TRUg3Rp0cBiM5T7xREWEZghuc/PmT+Dx6XcrVLGKADU6wKpZvBfkm6FhWfGVBY52ADEZUjU+D4h71btXHqsOA2G/4qSPRqKwkC391hM3NM5dnVeOe6LI9Cpb/DJ9oH/81gpv1yvCocmZyFt6WWceu+HbcCWzgiKrxgvgctLDaj0skjEqTuk4atmn9u/wDOmHWyc9byWAUd47SypFmVLOJWffR+rivBgMkqDk4xr4knMUbwv2wfnWc+ZJ3b/eIMlQ1/YkT4LLEGPNiRRYTaiOmTx+NU51xKVQmC4JnbYIONOUJOYVvulYE6fILg3nJ453zdRb+S6VWVUky37Pm77kYGWveQWf5FW503W8ayPMKFhQ== X-Forefront-Antispam-Report: CIP:216.228.117.160;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge1.nvidia.com;CAT:NONE;SFS:(13230022)(4636009)(39860400002)(376002)(136003)(346002)(396003)(451199015)(40470700004)(46966006)(36840700001)(36756003)(82740400003)(40460700003)(356005)(7636003)(8936002)(83380400001)(5660300002)(7416002)(41300700001)(2906002)(70206006)(70586007)(4326008)(8676002)(86362001)(36860700001)(316002)(110136005)(40480700001)(336012)(54906003)(82310400005)(47076005)(426003)(186003)(7696005)(2616005)(26005)(478600001);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Oct 2022 23:02:46.0919 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 92a8ffc0-564a-4070-4368-08dab093b488 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.160];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT029.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB6659 X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, SPF_HELO_PASS,SPF_NONE autolearn=no 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 The mtk_iommu and virtio drivers have places in the ->attach_dev callback functions that return hardcode errnos instead of the returned values, but callers of these ->attach_dv callback functions may care. Propagate them directly without the extra conversions. Reviewed-by: Kevin Tian Reviewed-by: Jean-Philippe Brucker Reviewed-by: Jason Gunthorpe Reviewed-by: Yong Wu Signed-off-by: Nicolin Chen --- drivers/iommu/mtk_iommu.c | 2 +- drivers/iommu/virtio-iommu.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c index f3dc2aba188e..660c5296f338 100644 --- a/drivers/iommu/mtk_iommu.c +++ b/drivers/iommu/mtk_iommu.c @@ -668,7 +668,7 @@ static int mtk_iommu_attach_device(struct iommu_domain *domain, ret = mtk_iommu_domain_finalise(dom, frstdata, region_id); if (ret) { mutex_unlock(&dom->mutex); - return -ENODEV; + return ret; } dom->bank = &data->bank[bankid]; } diff --git a/drivers/iommu/virtio-iommu.c b/drivers/iommu/virtio-iommu.c index 9e0ca757fa42..a204942f28fe 100644 --- a/drivers/iommu/virtio-iommu.c +++ b/drivers/iommu/virtio-iommu.c @@ -695,7 +695,7 @@ static int viommu_domain_finalise(struct viommu_endpoint *vdev, if (ret) { ida_free(&viommu->domain_ids, vdomain->id); vdomain->viommu = NULL; - return -EOPNOTSUPP; + return ret; } } -- 2.17.1