From patchwork Mon May 8 20:07:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Zanussi X-Patchwork-Id: 91264 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2401796vqo; Mon, 8 May 2023 13:09:44 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7gHd+wOLNui/bh2n2KeyxI05vKfapUJKsvB1cYcVSdXSRxpzRAqMUXJGVtws50x6PiRrwe X-Received: by 2002:a05:6a20:9e91:b0:ee:ac3c:d2de with SMTP id mq17-20020a056a209e9100b000eeac3cd2demr12169822pzb.28.1683576583755; Mon, 08 May 2023 13:09:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683576583; cv=none; d=google.com; s=arc-20160816; b=xJkzxVgqYergZPSgl3VsEUk0Y1BFToenDobqGg6bbkYR1pT1/y38MBnIALNkmZ+1TQ Az5V9ur0F4sGw58XdEX8AhxBq7tf/mbF9XL4LySqmBjDA4TH0PPTWDhBUwv8UnoMouYR 6PnrRcndkagY9XTaZwB0Ou3gz1FKGyNPaEKFRhPcXqljL05QmtlQj8TeCG948EVg4Zva wJVoByAK3HdrUxydIFEGMD/OzKAlfwNQa+6aYboaHLqf6we2lppciazA6SM2pXx85xCK 5uUwHPNUsvLshRDUiUG3bdeMHuBZZ5HkCH3VGzMfCI9QQnCmWJYmMTTbr1EZKQBOPf0U 1gIA== 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=2MwmPGxpWXmDdlVngvzzFa2ScVrybEEmK6HVvn0dRP4=; b=AYkxiHTiya2wExkcAaGox7jiTVllHPy4XXcZtNRBNpYZcAk01+zHuumayY3Na8NPO5 JYtM+8tx3+Dzh4FxkRcA7fdD4bQK/O6SrivaYCxtLfItWRfR0fXSWL3OFbQg/0QqvsK3 XMB0c+W/Lx4gIUABgrq+4cFs48i+LJy91uSwlCW07E2OmkHtycjCgtzvtQaqFFmzUiZG kTfQFRCa2VzcTzByUUc0/hKg2ScSv0UrOfVGYbJxsG5ibKQZLr+jCNg5UNVc3PGaE5jw wYf5mJyFVTnaoE8a/wCcCFhTdSpbzMDUA78vHmmQuoRYjuV5bPdYqHs4GtsiVnLd91+U +gJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=b4Zc32sz; 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 z126-20020a633384000000b0052881efbda0si9117726pgz.53.2023.05.08.13.09.31; Mon, 08 May 2023 13:09:43 -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=b4Zc32sz; 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 S233520AbjEHUH5 (ORCPT + 99 others); Mon, 8 May 2023 16:07:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50666 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233401AbjEHUHq (ORCPT ); Mon, 8 May 2023 16:07:46 -0400 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6DEEB559B; Mon, 8 May 2023 13:07:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1683576465; x=1715112465; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=eqtH9QJadtpRCN96NHklw3EbhVbQBfowJXO3N8XcXZc=; b=b4Zc32szSNkVpU6sISUq5N/MQe/Am9wTVzdMfm/Febtn3Hg1f/kQUnkQ H/TIYA8NOZO3hV44qV2DolxwYJ4z3xnTnC77lmDZTYEvkBdOaKUSXkknx PN8M+COJAGSsnNc1XEXOATRC7K3G5rn0iI/S1vOmCAR7GgxsZrUt0JsFH /T7vhN65PynEJRtC/pWjceU2jL16OqcwRYPTR8hZO5CITe+js4ACHz4W+ snfVqL8lhkFu4EUMtu049kbJfti6jTpYPg3LX5OQIZrPRi9ZGuvVKZLuN TcT+x9yny12Giz7eny51XxE3gf1C5OMMyatqSkEJbER5G9V5/dpnpiz3n w==; X-IronPort-AV: E=McAfee;i="6600,9927,10704"; a="348573616" X-IronPort-AV: E=Sophos;i="5.99,259,1677571200"; d="scan'208";a="348573616" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 May 2023 13:07:45 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10704"; a="788241620" X-IronPort-AV: E=Sophos;i="5.99,259,1677571200"; d="scan'208";a="788241620" Received: from sajmal-mobl1.amr.corp.intel.com (HELO tzanussi-mobl1.intel.com) ([10.212.74.4]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 May 2023 13:07:44 -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, giovanni.cabiddu@intel.com, linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, dmaengine@vger.kernel.org Subject: [PATCH v4 02/15] dmaengine: idxd: add external module driver support for dsa_bus_type Date: Mon, 8 May 2023 15:07:24 -0500 Message-Id: <034196c4edbc78b367c72eca1dece0d7201df13d.1683573703.git.zanussi@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: 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?1765357999818825703?= X-GMAIL-MSGID: =?utf-8?q?1765357999818825703?= 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 a83aecf11a01..193552dea224 100644 --- a/drivers/dma/idxd/idxd.h +++ b/drivers/dma/idxd/idxd.h @@ -589,6 +589,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) \