linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeffrey Hugo <jhugo@codeaurora.org>
To: arnd@arndb.de, gregkh@linuxfoundation.org
Cc: manivannan.sadhasivam@linaro.org, bjorn.andersson@linaro.org,
	wufan@codeaurora.org, pratanan@codeaurora.org,
	linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org,
	Jeffrey Hugo <jhugo@codeaurora.org>
Subject: [RFC v2 PATCH 1/8] qaic: Add skeleton driver
Date: Tue, 19 May 2020 08:13:58 -0600	[thread overview]
Message-ID: <1589897645-17088-2-git-send-email-jhugo@codeaurora.org> (raw)
In-Reply-To: <1589897645-17088-1-git-send-email-jhugo@codeaurora.org>

Add the Qualcomm Cloud AI 100 skeleton driver that does nothing but
registers a pci driver, probes on the proper device, and supports removal
of the module.

Signed-off-by: Jeffrey Hugo <jhugo@codeaurora.org>
---
 drivers/misc/Kconfig         |  1 +
 drivers/misc/Makefile        |  1 +
 drivers/misc/qaic/Kconfig    | 20 ++++++++++++++
 drivers/misc/qaic/Makefile   |  9 +++++++
 drivers/misc/qaic/qaic_drv.c | 62 ++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 93 insertions(+)
 create mode 100644 drivers/misc/qaic/Kconfig
 create mode 100644 drivers/misc/qaic/Makefile
 create mode 100644 drivers/misc/qaic/qaic_drv.c

diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
index 99e1514..ef91d062 100644
--- a/drivers/misc/Kconfig
+++ b/drivers/misc/Kconfig
@@ -481,4 +481,5 @@ source "drivers/misc/ocxl/Kconfig"
 source "drivers/misc/cardreader/Kconfig"
 source "drivers/misc/habanalabs/Kconfig"
 source "drivers/misc/uacce/Kconfig"
+source "drivers/misc/qaic/Kconfig"
 endmenu
diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
index 9abf292..64f0770 100644
--- a/drivers/misc/Makefile
+++ b/drivers/misc/Makefile
@@ -58,3 +58,4 @@ obj-$(CONFIG_PVPANIC)   	+= pvpanic.o
 obj-$(CONFIG_HABANA_AI)		+= habanalabs/
 obj-$(CONFIG_UACCE)		+= uacce/
 obj-$(CONFIG_XILINX_SDFEC)	+= xilinx_sdfec.o
+obj-$(CONFIG_QAIC)		+= qaic/
diff --git a/drivers/misc/qaic/Kconfig b/drivers/misc/qaic/Kconfig
new file mode 100644
index 0000000..502d176
--- /dev/null
+++ b/drivers/misc/qaic/Kconfig
@@ -0,0 +1,20 @@
+# SPDX-License-Identifier: GPL-2.0-only
+#
+# Qualcomm Cloud AI 100 accelerators driver
+#
+
+config QAIC
+	tristate "Qualcomm Cloud AI 100 accelerators"
+	depends on PCI && HAS_IOMEM
+	depends on MHI_BUS
+	help
+	  Enables driver for Qualcomm's Cloud AI 100 accelerator PCIe cards
+	  that are designed to accelerate Deep Learning inference workloads.
+
+	  The driver manages the PCIe devices and provides an IOCTL interface
+	  for users to submit workloads to the devices.
+
+	  If unsure, say N.
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called qaic.
diff --git a/drivers/misc/qaic/Makefile b/drivers/misc/qaic/Makefile
new file mode 100644
index 0000000..9db6417
--- /dev/null
+++ b/drivers/misc/qaic/Makefile
@@ -0,0 +1,9 @@
+# SPDX-License-Identifier: GPL-2.0-only
+#
+# Makefile for Qualcomm Cloud AI 100 accelerators driver
+#
+
+obj-$(CONFIG_QAIC)	:= qaic.o
+
+qaic-y := \
+	qaic_drv.o
diff --git a/drivers/misc/qaic/qaic_drv.c b/drivers/misc/qaic/qaic_drv.c
new file mode 100644
index 0000000..942dbf6
--- /dev/null
+++ b/drivers/misc/qaic/qaic_drv.c
@@ -0,0 +1,62 @@
+// SPDX-License-Identifier: GPL-2.0-only
+
+/* Copyright (c) 2019-2020, The Linux Foundation. All rights reserved. */
+
+#include <linux/module.h>
+#include <linux/pci.h>
+#include <linux/pci_ids.h>
+
+#define PCI_DEV_AIC100			0xa100
+
+static int qaic_pci_probe(struct pci_dev *pdev,
+			  const struct pci_device_id *id)
+{
+	pci_dbg(pdev, "%s\n", __func__);
+	pci_dbg(pdev, "%s: successful init\n", __func__);
+	return 0;
+}
+
+static void qaic_pci_remove(struct pci_dev *pdev)
+{
+	pci_dbg(pdev, "%s\n", __func__);
+}
+
+static const struct pci_device_id ids[] = {
+	{ PCI_DEVICE(PCI_VENDOR_ID_QCOM, PCI_DEV_AIC100), },
+	{ 0, }
+};
+MODULE_DEVICE_TABLE(pci, ids);
+
+static struct pci_driver qaic_pci_driver = {
+	.name = KBUILD_MODNAME,
+	.id_table = ids,
+	.probe = qaic_pci_probe,
+	.remove = qaic_pci_remove,
+};
+
+static int __init qaic_init(void)
+{
+	int ret;
+
+	pr_debug("qaic: init\n");
+
+	ret = pci_register_driver(&qaic_pci_driver);
+
+	pr_debug("qaic: init success\n");
+
+	return ret;
+}
+
+static void __exit qaic_exit(void)
+{
+	pr_debug("qaic: exit\n");
+	pci_unregister_driver(&qaic_pci_driver);
+}
+
+module_init(qaic_init);
+module_exit(qaic_exit);
+
+MODULE_AUTHOR("Qualcomm Cloud AI 100 Accelerator Kernel Driver Team");
+MODULE_DESCRIPTION("Qualcomm Cloud AI 100 Accelerators Driver");
+MODULE_LICENSE("GPL v2");
+MODULE_VERSION("0.0.0"); /* MAJOR.MINOR.PATCH */
-- 
Qualcomm Technologies, Inc. is a member of the
Code Aurora Forum, a Linux Foundation Collaborative Project.

  reply	other threads:[~2020-05-19 14:14 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-19 14:13 [RFC v2 PATCH 0/8] Qualcomm Cloud AI 100 driver Jeffrey Hugo
2020-05-19 14:13 ` Jeffrey Hugo [this message]
2020-05-19 14:13 ` [RFC v2 PATCH 2/8] qaic: Add and init a basic mhi controller Jeffrey Hugo
2020-05-19 14:14 ` [RFC v2 PATCH 3/8] qaic: Create misc dev Jeffrey Hugo
2020-05-19 14:14 ` [RFC v2 PATCH 4/8] qaic: Implement control path Jeffrey Hugo
2020-05-19 14:14 ` [RFC v2 PATCH 5/8] qaic: Implement data path Jeffrey Hugo
2020-05-19 14:14 ` [RFC v2 PATCH 6/8] qaic: Implement PCI link status error handlers Jeffrey Hugo
2020-05-19 14:14 ` [RFC v2 PATCH 7/8] qaic: Implement MHI error status handler Jeffrey Hugo
2020-05-19 14:14 ` [RFC v2 PATCH 8/8] MAINTAINERS: Add entry for QAIC driver Jeffrey Hugo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1589897645-17088-2-git-send-email-jhugo@codeaurora.org \
    --to=jhugo@codeaurora.org \
    --cc=arnd@arndb.de \
    --cc=bjorn.andersson@linaro.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=manivannan.sadhasivam@linaro.org \
    --cc=pratanan@codeaurora.org \
    --cc=wufan@codeaurora.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).