Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp499573pxb; Wed, 13 Apr 2022 06:43:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzgQ6IW1jbBfDJdryCe+v+aKNY19js8xGzN5HhCMAbdP4sRbsdW0PrEV0nm/KLiVeZsxuzc X-Received: by 2002:a05:6402:1941:b0:413:2822:9c8 with SMTP id f1-20020a056402194100b00413282209c8mr43506651edz.13.1649857422270; Wed, 13 Apr 2022 06:43:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649857422; cv=none; d=google.com; s=arc-20160816; b=FDTsgQSuKSpg9pVwd13Vl7W3CjE5Hcxp9LgOG2nKf0TZ8nyhnqik/exeeU6KGM+1N9 uLIEkDWIcvfb+2f9RClaVUYvNExk9rii4aZLqIFvP3ytc4uSHVxR8VFoXNqekH0ZJC1a l4SgzNfQIlLD10TOGPi13aKOYQaTvH2aEG3InxGfHQjHIOlQk5jZuFOPk2mOBBBYaSpN Ym/iOz6L3HKiWwPnUL74zjW9KQ9j1wrvHwo18bNMRzLPWUfW/jgUjkskikH4FzbhYJvs tXvjvTaS4CfHXfaMMmzc9O0lzd2ncCHfnzCjhJhUFJ3j9fI2FMpKomYZxZim9eYGBObL c9NQ== 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 :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject:dkim-signature; bh=F6pE6HlpQaMPOBPKirgzT2N7sIOCLmdXYt6zxIGirdM=; b=RBPlnofojBWdsGOwte4s6OhgQTVDN6U9Bij5JQDxpey0jtdW76+NX8w9yDuoSI29xX ikXwxyRPneVXl+rX0V8OdHeecgA/bEWdjunRzyRJIxv8VzoUeaq0BEMmTy//jatODV/T YfHEoWdd2Vluj1kj/4wMVYsNHqt6xvTgNszK3z1CZKKEtF9HARuWoln89lmmVC6PRjpv KS7UkRqYbyo8sEsba2hamU2b87LmS0BH+XyaHtLP8gisao+E8DVV7W2KWs8S7aYP7uoH VBx9SWGsPAQmms8fjlxdQlD2Mhrg7wr9ZewMaugvxvkYmRa6eY4baGPQBrceKyVkukdW DVLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Um1qom6e; 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=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w12-20020a056402268c00b0041d789bf34dsi1835984edd.321.2022.04.13.06.43.16; Wed, 13 Apr 2022 06:43:42 -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=@intel.com header.s=Intel header.b=Um1qom6e; 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=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232793AbiDMGEg (ORCPT + 99 others); Wed, 13 Apr 2022 02:04:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36128 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231396AbiDMGE0 (ORCPT ); Wed, 13 Apr 2022 02:04:26 -0400 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 28094515B4; Tue, 12 Apr 2022 23:02:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1649829726; x=1681365726; h=subject:from:to:cc:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=77GSFBA3SxqE/U83sHJwXKlAMeIpvS0DlqeYvtg365o=; b=Um1qom6eEpsQbdqB85Nv2d8DdoLy5LIdte31OSVJEWrEaZCdPv48/em0 OK627o4/GtiJ0BR1H1VVwsGm7K2mv8hIGdjuAwWwTuQoqTKxV9lYO7ySy Mkz4WEe062Qlm7ILnFPYAXwiNkl/r44VKZlqgp8dUcw+IPjY5lgLDWFfo Mig+eZB11HPLbPfts567TrgjPHyxTr0glF/s4ypaiHt6kVVf/1oRKlADe VacbxSwRDhLcSIEC4rYIvuaL535KUIcD5hphNDzV4oo1eAnDUiv5wo31L QaJhOGT31hXf08v/z6XOkeUcZy5cGNyCH6I+MTO51oaaTdUxYh7/nS3a0 w==; X-IronPort-AV: E=McAfee;i="6400,9594,10315"; a="244469597" X-IronPort-AV: E=Sophos;i="5.90,256,1643702400"; d="scan'208";a="244469597" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Apr 2022 23:02:05 -0700 X-IronPort-AV: E=Sophos;i="5.90,256,1643702400"; d="scan'208";a="660799955" Received: from dwillia2-desk3.jf.intel.com (HELO dwillia2-desk3.amr.corp.intel.com) ([10.54.39.25]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Apr 2022 23:02:05 -0700 Subject: [PATCH v2 07/12] cxl/acpi: Add a device_lock() lock class for the root platform device From: Dan Williams To: linux-cxl@vger.kernel.org Cc: Alison Schofield , Vishal Verma , Ira Weiny , Ben Widawsky , Dave Jiang , Kevin Tian , peterz@infradead.org, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, nvdimm@lists.linux.dev Date: Tue, 12 Apr 2022 23:02:05 -0700 Message-ID: <164982972569.684294.15140338434944364472.stgit@dwillia2-desk3.amr.corp.intel.com> In-Reply-To: <164982968798.684294.15817853329823976469.stgit@dwillia2-desk3.amr.corp.intel.com> References: <164982968798.684294.15817853329823976469.stgit@dwillia2-desk3.amr.corp.intel.com> User-Agent: StGit/0.18-3-g996c MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE 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 Now that the device-core can start validating lockdep usage after the device has been added, use that capability to validate usage of device_lock() against the ACPI0017 device relative to other subsystem locks. The 'enum cxl_lock_class' definition moves outside of the ifdef guard to support device_set_lock_class() called from cxl_acpi_probe(). Cc: Alison Schofield Cc: Vishal Verma Cc: Ira Weiny Cc: Ben Widawsky Reviewed-by: Dave Jiang Reviewed-by: Kevin Tian Signed-off-by: Dan Williams --- drivers/cxl/acpi.c | 1 + drivers/cxl/cxl.h | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/cxl/acpi.c b/drivers/cxl/acpi.c index d15a6aec0331..ef5c3252bdb2 100644 --- a/drivers/cxl/acpi.c +++ b/drivers/cxl/acpi.c @@ -283,6 +283,7 @@ static int cxl_acpi_probe(struct platform_device *pdev) struct acpi_device *adev = ACPI_COMPANION(host); struct cxl_cfmws_context ctx; + device_set_lock_class(&pdev->dev, CXL_ROOT_LOCK); root_port = devm_cxl_add_port(host, host, CXL_RESOURCE_NONE, NULL); if (IS_ERR(root_port)) return PTR_ERR(root_port); diff --git a/drivers/cxl/cxl.h b/drivers/cxl/cxl.h index fddbcb380e84..05dc4c081ad2 100644 --- a/drivers/cxl/cxl.h +++ b/drivers/cxl/cxl.h @@ -405,9 +405,9 @@ struct cxl_nvdimm_bridge *cxl_find_nvdimm_bridge(struct cxl_nvdimm *cxl_nvd); #define __mock static #endif -#ifdef CONFIG_PROVE_CXL_LOCKING enum cxl_lock_class { CXL_ANON_LOCK, + CXL_ROOT_LOCK, CXL_NVDIMM_LOCK, CXL_NVDIMM_BRIDGE_LOCK, /* @@ -423,6 +423,7 @@ enum cxl_lock_class { */ }; +#ifdef CONFIG_PROVE_CXL_LOCKING static inline int clamp_lock_class(struct device *dev, int lock_class) { if (lock_class >= MAX_LOCKDEP_SUBCLASSES) {