From patchwork Mon Jun 5 20:15:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Zanussi X-Patchwork-Id: 103486 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp2936497vqr; Mon, 5 Jun 2023 13:30:37 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7mu0o25XmZPuU23v/wi8kEWnqUPlCBoH458MlNf/JNyERgIPFSeQVV6Gid9TtqmbQqkk/S X-Received: by 2002:a17:902:6bcb:b0:1b1:b50c:e330 with SMTP id m11-20020a1709026bcb00b001b1b50ce330mr98335plt.2.1685997037303; Mon, 05 Jun 2023 13:30:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685997037; cv=none; d=google.com; s=arc-20160816; b=hfCP8LC15HYsKaossoSk1gNMut+x3RlgsJejGfNlEWF2BBL31vU3pmufTizpVSFFLl blMmXDU70+GvOa1O0kgwzP3hXepxjyz5KyeeUeUVXi0VrRdE7/rUq2l4sG88rPV8Fe2X MvO4JWq4ISaMD7DNz3HxE7NOfPKgQEINW5IOTagi3JRXGeC1MDAPnjKGCjqent5YrVNT Cz/YoVVNBYDXyUtyRfLXR5PUGMD5RgvRwMeG/0fbuV0nIRPbGgWsNGyoUwFyV8dEkPOC k95AcSmLP569lbB/6R/mAAeNPF/t+cln3dWXD2yInN3bONdS+qqpKWM/jEGMXFHsXdsc cyCQ== 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=64oq9S7J8mnE/mOwMiYJKB3x/C/SjImWDIxpPK81ix0=; b=LBTzbFFpnbvLg5yTJNnylcAODOki9NxCrIwG7LHEodStrdKzKEBVfWPFqFR3QE9Sef jC/3BWD5iShWCVOPilBiUt/9N04wZ/suAWwg2VkyPPYHAztMpgTOWz+OAYVDp2oEAzBV 81CvPGePJEAPRYUE6BEje6quaaLmwmND6aul2wPyBM0nTCh0Dp90Z2zzgf+DIgw7ogGG qcC7ozLWaMh+/TExKnwWZlxaF0Yu61pdNicQLvHiJcmwhvOBQieqBZe6tjSAKYF+4yBm P8dnzk6YuS6ymngmBv3dJhEUR9Yh/dT0QIbFc7Z/ZwCxD7bGlOu0QV7GD39OacIx5dD/ eprw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="eBfs/bqq"; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n4-20020a170902e54400b0019acbf1dc4asi6065960plf.181.2023.06.05.13.30.24; Mon, 05 Jun 2023 13:30:37 -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="eBfs/bqq"; 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 S232120AbjFEUP7 (ORCPT + 99 others); Mon, 5 Jun 2023 16:15:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232013AbjFEUPt (ORCPT ); Mon, 5 Jun 2023 16:15:49 -0400 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 20582B0; Mon, 5 Jun 2023 13:15:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1685996148; x=1717532148; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=lbQolgcAlS0UEuGw8aWww3sQPK4nsrdYvipioZ0YH2E=; b=eBfs/bqqAcxzvkjpDvqU30OCdCrUeLW58IwACXxW+LziRhijd+VTjAHN VLQ03GQllihdJjcx+Iwr+Cth63Du/8Drs7szWa8lqiZag0jGsEnK40oFR PBI3w6pBq5vX1RtQoXO5WLQpL/YOFcaXmXDMJbryXg6SL24yUUVNPqLi1 4SpJqkXkKHuou0ttcGB6AtN1F1/3g+lQVcwXndoJaqe9CgwRRrum1FFQJ LSlPmyRbXzltnb4Os43aS8dnbpBacoEqMu2ougRIsZ2+84im9PRmJPrEC Wm5QH3RD2GZLHQZFqpPyBBy3ACPim2AD/Im9rKnYXU2i0Bl25cvXeUMHW A==; X-IronPort-AV: E=McAfee;i="6600,9927,10732"; a="356480236" X-IronPort-AV: E=Sophos;i="6.00,218,1681196400"; d="scan'208";a="356480236" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jun 2023 13:15:44 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10732"; a="711934338" X-IronPort-AV: E=Sophos;i="6.00,218,1681196400"; d="scan'208";a="711934338" Received: from rkbrewer-mobl1.amr.corp.intel.com (HELO tzanussi-mobl1.intel.com) ([10.212.33.16]) by fmsmga007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jun 2023 13:15:42 -0700 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, linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, dmaengine@vger.kernel.org Subject: [PATCH v6 02/15] dmaengine: idxd: add external module driver support for dsa_bus_type Date: Mon, 5 Jun 2023 15:15:23 -0500 Message-Id: <20230605201536.738396-3-tom.zanussi@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230605201536.738396-1-tom.zanussi@linux.intel.com> References: <20230605201536.738396-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,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-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767896029361256180?= X-GMAIL-MSGID: =?utf-8?q?1767896029361256180?= 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 --- 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 c62c78e1c9fa..276b5f9cf967 100644 --- a/drivers/dma/idxd/idxd.h +++ b/drivers/dma/idxd/idxd.h @@ -646,6 +646,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) \