From patchwork Fri Apr 28 20:55:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Zanussi X-Patchwork-Id: 88753 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1213324vqo; Fri, 28 Apr 2023 14:09:19 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ531AYhK6ZYtAbYVEoRQHngnA47sN07VD46BM5gAuJoGTWx10Ll1dgW4foH0eTb86t+PWro X-Received: by 2002:a17:902:ef45:b0:1a6:5fa2:3293 with SMTP id e5-20020a170902ef4500b001a65fa23293mr6051738plx.56.1682716158897; Fri, 28 Apr 2023 14:09:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682716158; cv=none; d=google.com; s=arc-20160816; b=JLExWNhpNL5MCG8hzpKdKMxw3n6vsD3Aqp2NfboPX1yb3lhwSQXuhStS2Jx/1dBEz4 FjKWkp+2kBIEjfhj/WhZf7Dd7ulURR7uKq7YPW7IUjaGcn0+dNuLYMzXIwC0SR8+bX1w N1jaDPSvk4rrtrwRJE7e0ezqAeGK8ojGseEkCOu2qEjTEzJLUIKstRArAxG2L+S6B8qB 1o5EmgTFgg9Yw0QkcOR5aAsDM+vOubWGCPh3VG+yMGmEhxwr7omSFfAOPSPcLgMqxiUk OO3qvILPvwXh8DGCRGS8qxLwY1CI1KnrzVt5DyAfs2VL0zSMpcyq+zk8W1NkRPl+m6He MQaQ== 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=EIVP1ZmNYGjAKT/9hLWJcUFkj7zr1dSvcBY/B+ThRrU=; b=smtroG6U86j6lsBh1Lhh35P1rwu1V4H0oX7D1VciC+mxv0IUN38L1UdRySii91J7YP vXnt8bb87oKYhGZ/odb4v+tLtgZhuRITSlSS0+MrRL0mssw0TkwKq17DwWowfQW4dDuB e/X1/GgPnG90Ij86yM0EJJ09MmeKMABWq/WqeLCqXU5Hr82ONhLwLCVpYQjKnJq2qr+R K2VOpdn4znYl0zdvhhgYyTQrhkbqpK0HZs2VdjkTNPZwzSQ3sx+5DjNDwv+tyqMiZA4c W41VO0yVs7Zzi+wsqAR35/p2PRtiJkMLGivi7+oF7lBfmNxWluEg9IGf/TdnRNcqButm dZeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=AfPGbGCI; 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 f15-20020a170902684f00b001a5824e78d0si22291349pln.94.2023.04.28.14.09.05; Fri, 28 Apr 2023 14:09:18 -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=AfPGbGCI; 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 S1346796AbjD1U4L (ORCPT + 99 others); Fri, 28 Apr 2023 16:56:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346404AbjD1Uzz (ORCPT ); Fri, 28 Apr 2023 16:55:55 -0400 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CEBE51BF1; Fri, 28 Apr 2023 13:55:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1682715354; x=1714251354; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=kO38bfPMogxI1tGFhan6UK8YLGWBnl59qm86GfdzocM=; b=AfPGbGCIvUfrGLbG34DRmh6SX62EAPNlx2rEupxRgbVO0VoomWW1U7rN 8KbTERdnWPSCegkdrv9IsYEwIEFk/7ntPwPNLurDd9AayzkDjGDMhNAvd MDMttPTXqYzAXiDONL9kQK4p12sGKk6RU4n60Blzg3lV1iX5vwZg2cb0I cLoZrJjAVbNRR9Irqvm8WkegHNPAbgIlC7tsXQDRnYtmJ8fUnUmWcTahR h8a9N/UXMEqMLnAeFsbj9fkV+1PhfY92JbKejC15N2LtYypye3dsjkk4L I/VxwyggbaM5NruDiYHDTePHae6IbiUTBMyeU+ajwVIqrbxmfwuKiQ0nz Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10694"; a="336937637" X-IronPort-AV: E=Sophos;i="5.99,235,1677571200"; d="scan'208";a="336937637" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Apr 2023 13:55:49 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10694"; a="838980356" X-IronPort-AV: E=Sophos;i="5.99,235,1677571200"; d="scan'208";a="838980356" Received: from ykaur1-mobl2.amr.corp.intel.com (HELO tzanussi-mobl1.intel.com) ([10.209.181.29]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Apr 2023 13:55:48 -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, hdanton@sina.com, linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, dmaengine@vger.kernel.org Subject: [PATCH v3 02/15] dmaengine: idxd: add external module driver support for dsa_bus_type Date: Fri, 28 Apr 2023 15:55:26 -0500 Message-Id: <20230428205539.113902-3-tom.zanussi@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230428205539.113902-1-tom.zanussi@linux.intel.com> References: <20230428205539.113902-1-tom.zanussi@linux.intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.5 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,URIBL_BLOCKED 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?1764455779059105477?= X-GMAIL-MSGID: =?utf-8?q?1764455779059105477?= 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 505118fc19de..719f9f1662ad 100644 --- a/drivers/dma/idxd/idxd.h +++ b/drivers/dma/idxd/idxd.h @@ -587,6 +587,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) \