From patchwork Fri Nov 3 16:45:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 13444771 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 DCE55C4167B for ; Fri, 3 Nov 2023 16:46:00 +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:References:In-Reply-To: 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: List-Owner; bh=H23S/yg+xpgpo5zMrT1NOl3Yje5FpjQyw7We4h70qo0=; b=ie50jOox5Axtym UotKHPc8aL+kHzv5Mro2op5wXbnXf7VaQBfoTvx0g/xXsWMuewbPCp+IMv+NCh/mJTEsmcxsYMo28 xKaKJzxmggXfZuqeZIQmp6M4npeimbJn+QshpUV/Cs2iWXU5N/4jm3eVJmi4h+zQbJ8su6lsPsENT dAMQHWfAgxASj1xa6pCmZVKT2A0mQkdv9nDB3lOG6KGaEsHN/wORNijdbJ87el+e2VzWHgz4+XEU4 jZFC4YesQ6xNOL64iT4j6iMMapMg6sHe4rC61/dLaJyZc4KnBIjWsCFjOPM8sBx31TeQRHJrrnwar SFX6vBI6t6gJQvgQHuGw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qyxIV-00BoFl-0L; Fri, 03 Nov 2023 16:45:27 +0000 Received: from mail-bn8nam04on20610.outbound.protection.outlook.com ([2a01:111:f400:7e8d::610] helo=NAM04-BN8-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qyxIJ-00Bo7c-33; Fri, 03 Nov 2023 16:45:23 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=P9ULb+ku7ImqzOFp2PzIGljiz33SlmRicB8x6K/tUqe3CJeyswG5e3D5gMnpk18bQCfdI5xh3M4F7zzK1rzRpasgTrWp5YqBiWiyV1Tw7WA/CCxjQKZOggV6r9S4N2iJphXtK6yqAbHoAGefMybX36yTca0lghaliBHOnZvlRPZQvpPEDy0SqRMpObaGiQjq1+sCAkGwPz1diqHIFqr/uPUspBgvtgccgQOQSl6tFRHHmBUoQ18lWgXrjuXCUwmU1fmkrD6DS5QvYoZfpRtg5eulEmMk8+67OIf5wtx4s79XpfoJDaJh+yN8xoXTmBdKIIfvQDG//DztxcH73Q/MCQ== 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=AFCQA2aCUVPOXSacJ+ppYoNm3z3qGXA89zxgX94rYZg=; b=a7wL7voG82WYcPi8gCMliwxp4iHcmF5hBhhDyR1oLa6zWJo4y+Spag1LjytHg52f0AZsJpamQJuo43gDvnHqHOYKBXM9TXQHyn8E5imw4c6tgg5NBlVaipHPLsoEdC5BmHIJ8SiAoPO+6DXbPLUQKwxuAEcz3setCdKbIZOV/Tn2fiJN0qFHcxMhuil6TLT8Ch65nekcRdcilekScssSVRiuWRG0F6Pgmsis4r9FtY+YVhFHcXA74plG/k91BLMRNY13QZstP2JA54VJvart+VTGmAV9XlcnmkXCAcggpQ29Qe85U/fuJPFv9kPZFU4+J0i5yDArOB+ckmLq5wX8/Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; 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=AFCQA2aCUVPOXSacJ+ppYoNm3z3qGXA89zxgX94rYZg=; b=g/ZvgNTNtn7x/dAwhVs0ZtUh0PUKcIP1joqfhvkZCQ603ZOyFUczsQmgbY4cBVMmk6QjPj5Kz/DcpeoBZ5On3sMP1F27C6sg7Im1IMsw7X5PLvSlmxhTsvxZtc5AW4pBQBbI9m5RUx5seyeaAdd31GqZJrmKNhUKPIBCLL6gsTesU3sbW+2G/xn7gmWWBaRe6Uap2jgG4mgrtBEfUbnI1W7VhrVksXEmtR7C5spvbCSTDbnXusE6buGqWpOONM7z3S8aASiyEvTJdooDZ5XGuD7QmwkaOISTCoH1kLt2+qfrO11fLSsJpxzA95kVYmDmcDw729XrSZE0KdXHYAArPw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from LV2PR12MB5869.namprd12.prod.outlook.com (2603:10b6:408:176::16) by CH3PR12MB9394.namprd12.prod.outlook.com (2603:10b6:610:1cf::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6954.21; Fri, 3 Nov 2023 16:45:06 +0000 Received: from LV2PR12MB5869.namprd12.prod.outlook.com ([fe80::b53a:1092:9be2:cfb9]) by LV2PR12MB5869.namprd12.prod.outlook.com ([fe80::b53a:1092:9be2:cfb9%4]) with mapi id 15.20.6933.027; Fri, 3 Nov 2023 16:45:06 +0000 From: Jason Gunthorpe To: acpica-devel@lists.linuxfoundation.org, Alyssa Rosenzweig , Albert Ou , asahi@lists.linux.dev, Lu Baolu , Catalin Marinas , Dexuan Cui , devicetree@vger.kernel.org, David Woodhouse , Frank Rowand , Hanjun Guo , Haiyang Zhang , Christoph Hellwig , iommu@lists.linux.dev, Jean-Philippe Brucker , Jonathan Hunter , Joerg Roedel , "K. Y. Srinivasan" , Len Brown , linux-acpi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-hyperv@vger.kernel.org, linux-mips@vger.kernel.org, linux-riscv@lists.infradead.org, linux-snps-arc@lists.infradead.org, linux-tegra@vger.kernel.org, Russell King , Lorenzo Pieralisi , Marek Szyprowski , Hector Martin , Palmer Dabbelt , Paul Walmsley , "Rafael J. Wysocki" , Robert Moore , Rob Herring , Robin Murphy , Sudeep Holla , Suravee Suthikulpanit , Sven Peter , Thierry Reding , Thomas Bogendoerfer , Krishna Reddy , Vineet Gupta , virtualization@lists.linux-foundation.org, Wei Liu , Will Deacon Cc: Zhenhua Huang Subject: [PATCH RFC 16/17] iommu: Mark dev_iommu_get() with lockdep Date: Fri, 3 Nov 2023 13:45:01 -0300 Message-ID: <16-v1-5f734af130a3+34f-iommu_fwspec_jgg@nvidia.com> In-Reply-To: <0-v1-5f734af130a3+34f-iommu_fwspec_jgg@nvidia.com> References: X-ClientProxiedBy: BL1PR13CA0190.namprd13.prod.outlook.com (2603:10b6:208:2be::15) To LV2PR12MB5869.namprd12.prod.outlook.com (2603:10b6:408:176::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: LV2PR12MB5869:EE_|CH3PR12MB9394:EE_ X-MS-Office365-Filtering-Correlation-Id: aa015ef1-b4fb-47fb-3348-08dbdc8c3ad7 X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: BAuq3hHBSebQd4sHu3u21zuDYSR8IIrRMZlJ2slH+tKkDanxgFKeh9lw5dnpQXWSQm3lO2qD/5tc1bxemjMgueppa+ZGKlaKs2k3I6LgxL3Uok40O3vBB+aVjW2GW6E7Izr8N3eYOpul4foErSS21KODJzOxgoOFnO71uPVhCkv0Ft6U/wj1JWsg2r93FYr9snAzt6oIyVoMLfu7O+L9w96cMOAXj/g+xRpbaWoHZpYH+Qlyh9UzbMO8LN3lHSIgF3LeuOCeb9GiFzCQaRal/e2Qs0e/ZT1GDPyMwISIqwdmEZKx7rZ1UFkfr+EifgG5haNIc1oo4xy3CGc/4aawBNX+duOaELnSKSWq/8NSEF51c4pFh10B46bZsjj8rqDZXKP1l2sEagtWlmEMVbQM6sSKjyivt6gskKHa7IIgu2kKZa0uWVNNvNAMFTtd6twGLOIpM2jdO+d/fMxJg42kvZOT5zTG3mT72Zkjn0Osk9fBuId0X++RsDybP7XaKjsFY6l8gE0p+X9kRHSziT4rpupxoi1mozZOfKTRulDW97UXBxA3TFZzzVL9Gctu6dk7R/pZidjfUEhJ9//yWrBNONK4glrkwIsXujKNCQfZaFc= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:LV2PR12MB5869.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(346002)(136003)(366004)(39860400002)(396003)(376002)(230922051799003)(64100799003)(186009)(1800799009)(451199024)(6506007)(38100700002)(2616005)(36756003)(86362001)(26005)(41300700001)(7406005)(2906002)(4744005)(7416002)(83380400001)(8676002)(8936002)(4326008)(66556008)(66476007)(316002)(5660300002)(110136005)(478600001)(66946007)(6486002)(921008)(6512007)(6666004);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: mAUvRpCz/LbLbbHcYS0EcEpqxfZQA0QnbogeN8wCQ1oCKgUnpzRbIOo2aSrJUHg9S13cVPiSSp8w024Mkb0f7TIki2fe35ar79henM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rZl3EACL50E9g3qRKEC5DN364m/z4NVcr+4Ej+rOVJpVoWnJbqlpzmWDLD7RYGOhRmpKr7hIHkrIqlSvYUKn6X+SgkIJAa09nqByquZGlXUhn4wj77Yrq9gcduh5QQG7lcMEy/lwg332gnJnZ/94Uin/JJHZLiF2goDAHn9YYIA5CtkD+OkElD9ww8nUS+ONBrBMQIb18q3G4DyC6PG2TYE5IQ20vTvDzkvCB6O0bxUWfl1oG7er60gszKN3Y7aCnd9IGvZ0oPd7kEeO04aXMysEtqD3Y67/bcV6eeZuIv7lMPmI3GendXp2HdOaxXKwd4Kp16JAfczYmIuwuViT2gQFLh000u+Z0mi0AJlhYSHPXAXOXnQo/r4QumGUGSdKNh+ddXd5WaWaQv1yNJlkt8voXcmzsV X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: aa015ef1-b4fb-47fb-3348-08dbdc8c3ad7 X-MS-Exchange-CrossTenant-AuthSource: LV2PR12MB5869.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Nov 2023 16:45:04.5408 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 7i3aojKgXsgtfjYNndrYLQ9wQIQMDAej/Rui7rGMG+di5SfulWwCylKniyQ0tAsA X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB9394 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231103_094516_007746_E48B6D63 X-CRM114-Status: UNSURE ( 9.24 ) 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 Allocation of dev->iommu must be done under the iommu_probe_device_lock. Mark this with lockdep to discourage future mistakes. Signed-off-by: Jason Gunthorpe Reviewed-by: Jerry Snitselaar --- drivers/iommu/iommu.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index 9f23e113f46bc7..1cf9f62c047c7d 100644 --- a/drivers/iommu/iommu.c +++ b/drivers/iommu/iommu.c @@ -345,6 +345,8 @@ static struct dev_iommu *dev_iommu_get(struct device *dev) { struct dev_iommu *param = dev->iommu; + lockdep_assert_held(&iommu_probe_device_lock); + if (param) return param;