From patchwork Mon Jul 10 19:06:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Zanussi X-Patchwork-Id: 118035 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a6b2:0:b0:3e4:2afc:c1 with SMTP id c18csp25610vqm; Mon, 10 Jul 2023 12:26:51 -0700 (PDT) X-Google-Smtp-Source: APBJJlGOlywmEniLq7/ossvyHyMv7rn6LcHpyJ/sOtSDza1jt1StXFKQfyPfgm/e63wFfpNulnem X-Received: by 2002:a2e:6a04:0:b0:2b7:14d4:ce6d with SMTP id f4-20020a2e6a04000000b002b714d4ce6dmr5886995ljc.48.1689017211567; Mon, 10 Jul 2023 12:26:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689017211; cv=none; d=google.com; s=arc-20160816; b=rtTBw8aH3A/UlAudj07MTrND/x5oL9/aG12fhOnXv1VnVsWiyedEm1yZpu1WbTvwX8 0IY/ipr/JuDfHWrBPetVWjSujRQOnrc99RKxEQkwb7tdsYPNX9LKvjSI7M/xCJsgBe8Z W+u0cNbEpaqD+tszls0F9xRBiyQUDmBR/rgpxg45VmjQ/EZ4UtMEBpUG2HuAIXsaeFFL QGfFzsMXp7o/w2PyEa0jkiQls1Rl29COwsZeeyMFvY9VG24DCQN7g0C7PrpF/eVMkiRv cewnQEZGxkz+4OYh8+4zSSL3/nOVswJxxcP24NYgEglq6J/dZsrQSkiG4YlG/LTdjaHK mEDA== 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=; fh=KKYX96Dyn269sAN9Nbt8IfOk86mWVdLVST7Tbph7224=; b=go0dxseofXmW7XA0VMzOR/gE0nmcUbwACMZxHqT8iEXkoVu5ibkQ827/9ZeW850ZNn mhMwC15OziiEZj316VmA0TkTTLGLuvly6a5ysRT6bmtP9PYpbsfOKaOiPwXx78U3EHJu 1JgmSqOE4VrfbW3NkeVr3lx5NzBq2ZsTYLd/BwQ53CzJlonDog8+PngJSqimK+k/bT5K ACq3JHWcT3WAmiWOuhZW4iqkX4T1MocR+CusWE5sRbBzpj6kyDaoABdZzkimarygYcPl IT/nFVoX5ZxvxQkPb8B3VbEY7fYsJqvlKu1h+0qk/c2UnNqbt0XSOv1NBPoLVg9EtZ2o rdUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="i3Q/OxkV"; 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 qq5-20020a17090720c500b0098283e90548si223968ejb.570.2023.07.10.12.26.28; Mon, 10 Jul 2023 12:26:51 -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="i3Q/OxkV"; 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 S230494AbjGJTHM (ORCPT + 99 others); Mon, 10 Jul 2023 15:07:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59246 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229987AbjGJTHD (ORCPT ); Mon, 10 Jul 2023 15:07:03 -0400 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3968BFB; Mon, 10 Jul 2023 12:07:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1689016023; x=1720552023; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=lbQolgcAlS0UEuGw8aWww3sQPK4nsrdYvipioZ0YH2E=; b=i3Q/OxkVdZi8gwfYf8Wa8uRmYuYGOwFLV/PJKQ2FvrcSKEYIDtERYzUI qSsn90bYUjr39xvqgmKtqOp5dbLOcI+fxpks+R8oY7kVNqQUMysum1hga 0bWGDtJl0FbkejlWEsZ4dItbCqwnx2gwUQ5MtnTC6TjVzwJpzdw4b8AQ0 1JoM66sUTrxPYlbxbNU0myPaCtfprDifUR0ekJDeQNkJBNXP4xR58kIbg VhH5D3mv3e4bcMEgIEmZLbTk1EqqlbB9sEIpBf5oubgxRPf+Lw6IDtnWc 9/aoMuK9X9NdKaLnUbseNX2MA/z39RSkJdTDGFSKbF7AOOg9hK3n/id9p A==; X-IronPort-AV: E=McAfee;i="6600,9927,10767"; a="354290742" X-IronPort-AV: E=Sophos;i="6.01,195,1684825200"; d="scan'208";a="354290742" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Jul 2023 12:07:02 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10767"; a="844991004" X-IronPort-AV: E=Sophos;i="6.01,195,1684825200"; d="scan'208";a="844991004" Received: from jdmillsx-mobl1.amr.corp.intel.com (HELO tzanussi-mobl1.intel.com) ([10.212.107.12]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Jul 2023 12:07:01 -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 v7 02/14] dmaengine: idxd: add external module driver support for dsa_bus_type Date: Mon, 10 Jul 2023 14:06:42 -0500 Message-Id: <20230710190654.299639-3-tom.zanussi@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230710190654.299639-1-tom.zanussi@linux.intel.com> References: <20230710190654.299639-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-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771062911953282763 X-GMAIL-MSGID: 1771062911953282763 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 --- 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) \