From patchwork Wed Jul 17 10:06:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ashish Mhetre X-Patchwork-Id: 1961503 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=Nvidia.com header.i=@Nvidia.com header.a=rsa-sha256 header.s=selector2 header.b=s0/Eq+qo; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=147.75.199.223; helo=ny.mirrors.kernel.org; envelope-from=linux-tegra+bounces-3029-incoming=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WPBS22vvGz20B2 for ; Wed, 17 Jul 2024 20:06:58 +1000 (AEST) Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 941D71C210EB for ; Wed, 17 Jul 2024 10:06:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F09D717F39B; Wed, 17 Jul 2024 10:06:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="s0/Eq+qo" X-Original-To: linux-tegra@vger.kernel.org Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2074.outbound.protection.outlook.com [40.107.220.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0DC7C17F37B; Wed, 17 Jul 2024 10:06:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.220.74 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721210815; cv=fail; b=bOQLUy0gulLVf8LbFIPtoinj/wwEbVgEMdlltgEgjuZe87dFEHls0VjqlySMl4HsN8E2rUldwnw4SThx3nvV5nwNFgAeRl5aYlsjC6eX9ysJndsbu2bifcRasI4EfNxYKAyC/JbskYpMGj7BnWQ+xbzAy0eVv/hnzhi4/kKbFJE= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721210815; c=relaxed/simple; bh=jDNmRwOTHblC5WHvyK1XQ9RCaX4kSnUSOsckzwPD9c0=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=bxIL6N3sEyErrIzO4+VqgxE3H9L4/vS5na3tbMoatnX7CPNWvlvXAC4KV+OpFHUNewapjTRdgpc9PexQEVEjU28e9uCdZLcFoYaZu4o5jp7w0oLYkCHh96fmae9GfzYpCv9w1d5Ex/et6oQUqnIM0Jwq0Qpvgw86clQYW7bO0aA= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=s0/Eq+qo; arc=fail smtp.client-ip=40.107.220.74 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=nKLvfcyfjEnn+VPuG8QX6ybwAxW2uQ+fBeQRDlkQE8NJo/YnUMxwWByEO7CYmmPAgdV5ZXWzvsbO56Qxwc8xiLKZnRr/RD9BRfnEOIDI+pJsQKNExevuvRPAh1XKPSQm4WbfbXNuBnZaar3vFukcUXVY+ydFZ6/xQnjar8E8jJy6tRmhdM4PyUJdB3vlosukB8u/okd88gLhOiyXZccuqzZhF5R0z/61M0bAsGH5M6K58p2+4hQ/k7nnjXiG35Ukdoy1ZJJcmgtjJKrdxwtqmjcbsZ4kZnC+HfgIxDrH9oZT17WMD/Z2w2Sxsy0xHUupAF85Nc3XrmuSrZUf55Mzlw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=Z/JYYuNywcOlvbc7IRcLncHn6vGzXZYzbS9x8PuOD4Y=; b=UfZyc5uWsNHyjvJI7CkPBpZaHuoiNYAkVjPbxrDxZjxyfU/ij/ppxIs13WVWQ39JjuaYgzxavN752bK2NKWj9VlSGIAE68cDWU//qQbbdgS9U9UapCOj+a1cgiGmpn+hvoYCa0aB2Ndj3rVmhhIXXjfs5qbOOF/ReTQPTZ7JrSRzDMdLEcRwxuSMxbAXbEJwH6oUq5l42MtjCyaE4uZILc3IA7tTaFcrj6halypxuq+RcRZf0A0lUyFT0KS864iOobtBLh82De1uTYsnTWSyouwgCChutVKDpJqdzM7heAMpl9Bf1BYG3pj7LbrzdXM0cwAKU4RiyPLtBux/8uAJzQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=kernel.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 (0) 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=Z/JYYuNywcOlvbc7IRcLncHn6vGzXZYzbS9x8PuOD4Y=; b=s0/Eq+qoOnVD6Z83hjENNxUIa7rl1OVAlNDNDbEXD88kzRn0F1L6a37hsJxoXExgn10JNFkhU5LM3HI64vuXEIGLnIMdqAQ+1DEsZRg+leOpSGKrnRPOAlMhE0qDz8R7/GW/+JCm+CDApHbhVM8AWV/iv/4Jbuf411VY1u4q8eciXaI7PsdyitG5y9Wnu3zGWWICSItBqsosCxudkCYsJ9vrlRqMiJLq4d7PghmZxo0jbJwLQAsP0YJYrvHc3+z4pLTTwCxB303rr5tEPJfRFQYPFCSQo0JfYyKyb2Crl/h4h/uwFbRgcNJjb2YDDtKuM/Z9qt+ESA1alZW/wgAfZQ== Received: from CH5P222CA0024.NAMP222.PROD.OUTLOOK.COM (2603:10b6:610:1ee::9) by PH7PR12MB6417.namprd12.prod.outlook.com (2603:10b6:510:1ff::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.27; Wed, 17 Jul 2024 10:06:49 +0000 Received: from CH1PEPF0000AD74.namprd04.prod.outlook.com (2603:10b6:610:1ee:cafe::22) by CH5P222CA0024.outlook.office365.com (2603:10b6:610:1ee::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7784.16 via Frontend Transport; Wed, 17 Jul 2024 10:06:49 +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 CH1PEPF0000AD74.mail.protection.outlook.com (10.167.244.52) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7784.11 via Frontend Transport; Wed, 17 Jul 2024 10:06:49 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) 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.1544.4; Wed, 17 Jul 2024 03:06:35 -0700 Received: from rnnvmail203.nvidia.com (10.129.68.9) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Wed, 17 Jul 2024 03:06:35 -0700 Received: from build-amhetre-20240716T042216611.internal (10.127.8.10) by mail.nvidia.com (10.129.68.9) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Wed, 17 Jul 2024 03:06:35 -0700 From: Ashish Mhetre To: , , CC: , , , , Ashish Mhetre Subject: [PATCH 2/2] include: linux: Update gather only if it's not NULL Date: Wed, 17 Jul 2024 10:06:19 +0000 Message-ID: <20240717100619.108250-2-amhetre@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240717100619.108250-1-amhetre@nvidia.com> References: <20240717100619.108250-1-amhetre@nvidia.com> Precedence: bulk X-Mailing-List: linux-tegra@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-NVConfidentiality: public X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH1PEPF0000AD74:EE_|PH7PR12MB6417:EE_ X-MS-Office365-Filtering-Correlation-Id: 42bb99e1-c5c1-4af5-ebf9-08dca6482c9c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|1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PjNmk4Zasq9vwz5QBzfo92kdZoc40pcGo+ZPsLB1vwmy+4G7j3SIE3sLLgnberT4NPIFbqbKh00dNoixVXT3I+wOuHSUzvez9mrNXlOsaweMJ+ZwFZOkZY+t935V2HFYu5ONa9yQsrqgi3qBWuo1sKWzukhdU/9pFWGiCy+JnHHCol0c0BiaYQCK0oIcnkUKxQPGY2MnXwPAsk8ygsD8CkONU9wE3x7Eoo9n2zKkrsGFoBeC+kf4VFVafLbdblbNBGB7MAOqCVZ3EG7FB5ZhQ7I8Qmw5tDO/Ahdoo5o/EMOTs32wM/yB2TIYDCHRnAHd1IkFP7eRfRtJn1sw5rSFOVjLTWs68aDx1Qpl+gevAv0Dx1i+XEAtbVHmlrwM+/WWnaoz8ZoZnPmfCku7/9OsUknCgTaeeWu9n 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:(13230040)(82310400026)(1800799024)(376014)(36860700013);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jul 2024 10:06:49.4230 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 42bb99e1-c5c1-4af5-ebf9-08dca6482c9c 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: CH1PEPF0000AD74.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB6417 Gather can be NULL when unmap is called for freeing old table while mapping. If it's NULL then there is no need to add page for syncing the TLB. Signed-off-by: Ashish Mhetre --- include/linux/iommu.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/linux/iommu.h b/include/linux/iommu.h index 4d47f2c33311..2a28c1ef8517 100644 --- a/include/linux/iommu.h +++ b/include/linux/iommu.h @@ -928,6 +928,9 @@ static inline void iommu_iotlb_gather_add_page(struct iommu_domain *domain, struct iommu_iotlb_gather *gather, unsigned long iova, size_t size) { + if (!gather) + return; + /* * If the new page is disjoint from the current range or is mapped at * a different granularity, then sync the TLB so that the gather