From patchwork Mon Aug 7 20:37:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Zanussi X-Patchwork-Id: 132398 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c44e:0:b0:3f2:4152:657d with SMTP id w14csp1724045vqr; Mon, 7 Aug 2023 14:36:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFbMDHCuAheaa/PkzEhTCY09ADgahcvAndjmv3VQmVUNHAIZAQypX+KaICR9/Ic2WY0mBeI X-Received: by 2002:a05:6a20:748e:b0:133:d1b:a880 with SMTP id p14-20020a056a20748e00b001330d1ba880mr13967977pzd.23.1691444181677; Mon, 07 Aug 2023 14:36:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691444181; cv=none; d=google.com; s=arc-20160816; b=sXZlU1j2L4q5yBvU/SDtn/hYoVlMo5vE5vlH++v2W2C3ZNwTLGqu6IbQrnjgdTqcku A5rLOBW2Ws/3s/Rmzu4sPbM9HR8Fyc3Rrveb7gm/1UoMxgOLVzVfb0VG5LairoChU/RW dqdh4De2r4NRTatNUXkl0am452muGaGyH7sucjWZAe8zCVzRhLPiC3Uir9SCdzXRqhqS 50hahOnqQeU97eMv5/XFX1s6GF//EGtJK9+w6ivQ+aVD5HcNseomsX68asZK4HjgY5EE lw07gLq/q5FF+GC1QlrUsJ1ZOrK8f0zdMomizzx9h/GDrv7h97TpcZEd3DhU/8mma4Xj JBlg== 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=l6YsPAKD89THdJxBltedoY/raAp6VB7qrXuihPUh42Q=; fh=KKYX96Dyn269sAN9Nbt8IfOk86mWVdLVST7Tbph7224=; b=desDiUvt2CioMpSWLVUs7l4A0YwBeCWq6JggsreeOqZLfTLlMQZ03YuuRzJ+rkSi0P tOJM9kgXpOcYD1AZEcd4Q4v56bGmAJuA7rjfcaH4914qde3PtjB0YYSlOckj/0oOddNj m3Hlr9BR1w6l2Ooj4TvNqJN4PFiGMabQGyTu937pKrnXCM0tiV0nySDJdMfVaEVfiPn1 87Nq2eUGc7P/V8yGcUbY2xuBoayoSMGr4lsSbJnqvXPUwpRFKpROehNu69F4a+PwJBju msZ36vaj7KszlkTVy6OmJua90s33aPcxV3qONCD8EAV1NARzsSLvpUwDi/VoKoTEDEm5 kmjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=kfz5kU3j; 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 l14-20020a654c4e000000b00564acb691e0si5905244pgr.643.2023.08.07.14.36.07; Mon, 07 Aug 2023 14:36:21 -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=kfz5kU3j; 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 S231311AbjHGUiS (ORCPT + 99 others); Mon, 7 Aug 2023 16:38:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35052 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230395AbjHGUiI (ORCPT ); Mon, 7 Aug 2023 16:38:08 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 68544E7A; Mon, 7 Aug 2023 13:38:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1691440687; x=1722976687; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=z2Ee/au8QTZJrpemLSJmymfqflOOGYMy23k4xh/W3QA=; b=kfz5kU3jt0hNojNhrqmxm4O7X7U1TsbSI0hy0tG+NctNYBJFn0wNXuFv wm0oOl3fkRhX1r27i0WPpWW28ySpbkGvH4lA169dHyzNqAYJ//9tRMT0x y6jaqmbLXSzmULGQeM8so0+hK3hsrzeZhA9AEnunbRVGAZ1IvoH5tENnC ZwcZToE4h/1VfYwOgOBiBHQ4qIuThgyFSL0iOBZ52WLeBtKNF+d6WUn/f ffC6+hvWp3KrvJUmSshv9wBRpgw9iUzol4k6bSb9ItotmCQEcOXeVAGQJ Ri4t2CgJPe30naUehrruNPVoTRpeP/c2ak3AZg+ZJrNvuWiC5+KEVSt1Y g==; X-IronPort-AV: E=McAfee;i="6600,9927,10795"; a="374319653" X-IronPort-AV: E=Sophos;i="6.01,263,1684825200"; d="scan'208";a="374319653" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Aug 2023 13:37:38 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10795"; a="766123331" X-IronPort-AV: E=Sophos;i="6.01,263,1684825200"; d="scan'208";a="766123331" Received: from eeroesle-mobl.amr.corp.intel.com (HELO tzanussi-mobl1.intel.com) ([10.212.81.193]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Aug 2023 13:37:36 -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 v9 02/14] dmaengine: idxd: add external module driver support for dsa_bus_type Date: Mon, 7 Aug 2023 15:37:14 -0500 Message-Id: <20230807203726.1682123-3-tom.zanussi@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230807203726.1682123-1-tom.zanussi@linux.intel.com> References: <20230807203726.1682123-1-tom.zanussi@linux.intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_NONE 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: 1773607774325393166 X-GMAIL-MSGID: 1773607774325393166 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 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) \