From patchwork Tue Dec 5 21:25:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Zanussi X-Patchwork-Id: 174201 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp3719132vqy; Tue, 5 Dec 2023 13:31:45 -0800 (PST) X-Google-Smtp-Source: AGHT+IHLrBd8cudHS0pPuiPG5Djkr8dNsS2/5JUfPMt/jlCK6BIBhQbGF8QulSrvV/06y8i4ESbY X-Received: by 2002:a17:903:2348:b0:1c9:cc88:502c with SMTP id c8-20020a170903234800b001c9cc88502cmr7858037plh.69.1701811905641; Tue, 05 Dec 2023 13:31:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701811905; cv=none; d=google.com; s=arc-20160816; b=zej8OSaN2K7zQMH8g50S9obENKap+vhuwbnVyGs1l6D2HR3Bp8x1zaoqQPl9hNVP8i DdA/jICzk3c2kTROSzIzjLfirclM43dIjiE5TabJogETo08D/faDf9zdIo5wav37z64R gzvVQ0/6HwdFN6Wre0UdTRCOt+f2uMJz6G6FyVM0jprUMfG5cYj+7nqTWiW6nynX5ur7 z3igxJupbeM3oG2ac85op8wFN/HXx3gCLN9SD41HC8HT1ha9fkjRtzherq6/tE3Pal77 ulTib5g4qubGUJdnx1plfu+eWFAo3NdVsFq09sYedl5jw3XQQRQjrMlSAOD9TNVdXdhf NZOg== 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=+ZkouoOXFIToCAPJcKkfDzX1W3mk8932RW726ZUQpBg=; fh=CKy338m5MbqOKLCytkQoYDn9hkoAEvElo6dffmo/qoM=; b=E8Yh7l7OndFsss+mg3a2CERi5K5+a3Maxjeyf+rITvCzMWPFrxbp/NHF6/SOcZgmoI DbQX1gvm0OiNr1vvdQtW1Q826VpS8Q+QCAbHEh2xDm8PpGyhy4g/CkAbvb1ecWCrgBdK 0UI7/L4mAJM1oMWDRGWjtOXrOJMqyVEEFJmQMln67XOGD7HwynnXnzg1NOiHs+z1CrvL Ebew7TkQRRmfuLEVCXx/mDM/bZ7D5KnzJpq+m9QGYh9vU60ww//T7JWIWUlv5XyRwnJm fMf2SMwPvmEYJrpFauMZee1m8vsNcGcUHLppRcfcVEgr6CvBuMosBui5Bon3ToAx1/5P dpXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=GUQ2bYSo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id u18-20020a17090341d200b001d0a8b8e210si3829945ple.526.2023.12.05.13.31.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Dec 2023 13:31:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=GUQ2bYSo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 12E82806AFF9; Tue, 5 Dec 2023 13:31:06 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345798AbjLEVap (ORCPT + 99 others); Tue, 5 Dec 2023 16:30:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35056 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346356AbjLEVZp (ORCPT ); Tue, 5 Dec 2023 16:25:45 -0500 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3F39A1B6; Tue, 5 Dec 2023 13:25:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1701811549; x=1733347549; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=buoGPdrkkKx4hhUIceeTcYHbzYQ9xgtGVojseC0ReWs=; b=GUQ2bYSo6LNnkcZpwdfzCl2Js7mnNOUWleXnvoADAlk57s4v+s0ZeHa8 D60TFUOEocwM7vp0gkokT/nkaezGVaz377ktwLsQX7Kd7eiFbPeI7v8n3 YVjE3qhoE6YJ19AvlzzHYmIracYwPTP2Qdlg2G7mIX7HOw7WN0mtEq8l5 xluSXrI3OQFi730hKrAbFK5YhblQ7lYbjhD+cJQgQBI3fCVncatMhdEg1 oULg0Fris1+ZvXk0EX/QyYae3z2w1xAQEiSVI462lnlAffvYmfySQ/KQq BUrqwfzjHK1iqmkNcDUyJfMd5MFe3ecQ2mpHdk6mxaeGAKj2k/KOAns/u w==; X-IronPort-AV: E=McAfee;i="6600,9927,10915"; a="396751581" X-IronPort-AV: E=Sophos;i="6.04,253,1695711600"; d="scan'208";a="396751581" Received: from orviesa001.jf.intel.com ([10.64.159.141]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Dec 2023 13:25:44 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.04,253,1695711600"; d="scan'208";a="19102554" Received: from jsamonte-mobl.amr.corp.intel.com (HELO tzanussi-mobl1.amr.corp.intel.com) ([10.212.71.180]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Dec 2023 13:25:42 -0800 From: Tom Zanussi To: herbert@gondor.apana.org.au, davem@davemloft.net, fenghua.yu@intel.com, vkoul@kernel.org Cc: dave.jiang@intel.com, tony.luck@intel.com, wajdi.k.feghali@intel.com, james.guilford@intel.com, kanchana.p.sridhar@intel.com, vinodh.gopal@intel.com, giovanni.cabiddu@intel.com, pavel@ucw.cz, linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, dmaengine@vger.kernel.org Subject: [PATCH v12 01/14] dmaengine: idxd: add external module driver support for dsa_bus_type Date: Tue, 5 Dec 2023 15:25:17 -0600 Message-Id: <20231205212530.285671-2-tom.zanussi@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231205212530.285671-1-tom.zanussi@linux.intel.com> References: <20231205212530.285671-1-tom.zanussi@linux.intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 05 Dec 2023 13:31:06 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784479121109576788 X-GMAIL-MSGID: 1784479121109576788 From: Dave Jiang Add support to allow an external driver to be registered to the dsa_bus_type and also auto-loaded. Signed-off-by: Dave Jiang Signed-off-by: Tom Zanussi Reviewed-by: Fenghua Yu Acked-by: Vinod Koul --- drivers/dma/idxd/bus.c | 6 ++++++ drivers/dma/idxd/idxd.h | 3 +++ 2 files changed, 9 insertions(+) diff --git a/drivers/dma/idxd/bus.c b/drivers/dma/idxd/bus.c index 6f84621053c6..0c9e689a2e77 100644 --- a/drivers/dma/idxd/bus.c +++ b/drivers/dma/idxd/bus.c @@ -67,11 +67,17 @@ static void idxd_config_bus_remove(struct device *dev) idxd_drv->remove(idxd_dev); } +static int idxd_bus_uevent(const struct device *dev, struct kobj_uevent_env *env) +{ + return add_uevent_var(env, "MODALIAS=" IDXD_DEVICES_MODALIAS_FMT, 0); +} + struct bus_type dsa_bus_type = { .name = "dsa", .match = idxd_config_bus_match, .probe = idxd_config_bus_probe, .remove = idxd_config_bus_remove, + .uevent = idxd_bus_uevent, }; EXPORT_SYMBOL_GPL(dsa_bus_type); diff --git a/drivers/dma/idxd/idxd.h b/drivers/dma/idxd/idxd.h index 1e89c80a07fc..e541d19f14d0 100644 --- a/drivers/dma/idxd/idxd.h +++ b/drivers/dma/idxd/idxd.h @@ -655,6 +655,9 @@ static inline int idxd_wq_driver_name_match(struct idxd_wq *wq, struct device *d return (strncmp(wq->driver_name, dev->driver->name, strlen(dev->driver->name)) == 0); } +#define MODULE_ALIAS_IDXD_DEVICE(type) MODULE_ALIAS("idxd:t" __stringify(type) "*") +#define IDXD_DEVICES_MODALIAS_FMT "idxd:t%d" + int __must_check __idxd_driver_register(struct idxd_device_driver *idxd_drv, struct module *module, const char *mod_name); #define idxd_driver_register(driver) \