From: Wei Huang <wei.huang2@amd.com>
To: <dmaengine@vger.kernel.org>
Cc: <vkoul@kernel.org>, <Frank.Li@kernel.org>, <shuah@kernel.org>,
<nathan.lynch@amd.com>, <wei.huang2@amd.com>,
<mario.limonciello@amd.com>, <Stephen.Bates@amd.com>,
<tycho@kernel.org>, <suravee.suthikulpanit@amd.com>,
<rientjes@google.com>, <John.Kariuki@amd.com>, <jic23@kernel.org>,
<weixugc@google.com>, <bhelgaas@google.com>,
<Shyam.Iyer@dell.com>, <linux-kernel@vger.kernel.org>,
<linux-kselftest@vger.kernel.org>, <linux-pci@vger.kernel.org>
Subject: [PATCH v1 16/44] dmaengine: sdxi: register core character devices
Date: Thu, 19 Nov 2026 14:22:52 -0600 [thread overview]
Message-ID: <20261119202321.1734355-17-wei.huang2@amd.com> (raw)
In-Reply-To: <20261119202321.1734355-1-wei.huang2@amd.com>
Create one core-owned SDXI character device per registered function and
bind each open file to process state. Preserve the existing core/PCI
split; functional ioctls and context mappings remain disabled until
their handlers are added later.
Signed-off-by: Wei Huang <wei.huang2@amd.com>
---
drivers/dma/sdxi/Makefile | 1 +
drivers/dma/sdxi/context.c | 70 ++++++++++++-----
drivers/dma/sdxi/context.h | 1 +
drivers/dma/sdxi/device.c | 121 +++++++++++++++++++++++++----
drivers/dma/sdxi/ioctl.c | 155 +++++++++++++++++++++++++++++++++++++
drivers/dma/sdxi/keys.c | 11 ---
drivers/dma/sdxi/pci.c | 1 +
drivers/dma/sdxi/process.c | 12 ++-
drivers/dma/sdxi/sdxi.h | 16 ++++
9 files changed, 340 insertions(+), 48 deletions(-)
create mode 100644 drivers/dma/sdxi/ioctl.c
diff --git a/drivers/dma/sdxi/Makefile b/drivers/dma/sdxi/Makefile
index a915982e76a7..a9eaf01df4aa 100644
--- a/drivers/dma/sdxi/Makefile
+++ b/drivers/dma/sdxi/Makefile
@@ -9,6 +9,7 @@ sdxi-core-y := \
dma.o \
error.o \
intr.o \
+ ioctl.o \
keys.o \
process.o \
ring.o
diff --git a/drivers/dma/sdxi/context.c b/drivers/dma/sdxi/context.c
index 2c3b6f5df4b5..a4976f2b5e53 100644
--- a/drivers/dma/sdxi/context.c
+++ b/drivers/dma/sdxi/context.c
@@ -75,6 +75,7 @@ static void sdxi_free_cxt(struct sdxi_cxt *cxt)
mutex_destroy(&cxt->cleanup_lock);
kfree(cxt->ring_state);
kfree(cxt);
+ put_device(&sdxi->chardev);
}
DEFINE_FREE(sdxi_cxt, struct sdxi_cxt *, if (_T) sdxi_free_cxt(_T))
@@ -89,6 +90,7 @@ static struct sdxi_cxt *sdxi_alloc_cxt(struct sdxi_dev *sdxi)
return NULL;
cxt->sdxi = sdxi;
+ get_device(&sdxi->chardev);
refcount_set(&cxt->refs, 1);
mutex_init(&cxt->cleanup_lock);
mutex_init(&cxt->akey_lock);
@@ -647,10 +649,9 @@ static int sdxi_cxt_quiesce_locked(struct sdxi_cxt *cxt,
return 0;
}
-static void sdxi_cxt_cleanup_workfn(struct work_struct *work)
+static bool sdxi_cxt_cleanup(struct sdxi_cxt *cxt,
+ struct sdxi_process **process_out)
{
- struct sdxi_cxt *cxt = container_of(to_delayed_work(work),
- struct sdxi_cxt, cleanup_work);
struct sdxi_process *process = NULL;
bool force_release = false;
bool destroy = false;
@@ -697,6 +698,25 @@ static void sdxi_cxt_cleanup_workfn(struct work_struct *work)
out_unlock:
mutex_unlock(&cxt->cleanup_lock);
+ if (!destroy)
+ return false;
+
+ *process_out = process;
+ return true;
+}
+
+static void sdxi_cxt_cleanup_workfn(struct work_struct *work)
+{
+ struct sdxi_cxt *cxt = container_of(to_delayed_work(work),
+ struct sdxi_cxt, cleanup_work);
+ struct sdxi_process *process = NULL;
+ struct sdxi_dev *sdxi = cxt->sdxi;
+ bool destroy = false;
+
+ down_read(&sdxi->state_lock);
+ if (sdxi->online)
+ destroy = sdxi_cxt_cleanup(cxt, &process);
+ up_read(&sdxi->state_lock);
if (destroy)
sdxi_cxt_finish_release(cxt, process);
@@ -734,13 +754,6 @@ static void sdxi_cxt_force_exit(struct sdxi_cxt *cxt)
sdxi_cxt_put(cxt);
}
-static void free_admin_cxt(void *ptr)
-{
- struct sdxi_dev *sdxi = ptr;
-
- sdxi_cxt_force_exit(sdxi->admin_cxt);
-}
-
static int sdxi_cxt_doorbell_offset(const struct sdxi_cxt *cxt,
size_t *offset);
static int sdxi_cxt_set_kernel_doorbell(struct sdxi_cxt *cxt);
@@ -782,7 +795,18 @@ int sdxi_admin_cxt_init(struct sdxi_dev *sdxi)
cxt->started = true;
sdxi->admin_cxt = no_free_ptr(cxt);
- return devm_add_action_or_reset(sdxi->dev, free_admin_cxt, sdxi);
+ return 0;
+}
+
+void sdxi_admin_cxt_exit(struct sdxi_dev *sdxi)
+{
+ struct sdxi_cxt *cxt = sdxi->admin_cxt;
+
+ if (!cxt)
+ return;
+
+ sdxi->admin_cxt = NULL;
+ sdxi_cxt_force_exit(cxt);
}
/*
@@ -1154,27 +1178,33 @@ void sdxi_cxt_release_user_handle(struct sdxi_cxt *cxt)
int sdxi_cxt_notify_mm_release(struct sdxi_cxt *cxt)
{
+ struct sdxi_dev *sdxi;
int ret = 0;
if (!cxt)
return -EINVAL;
+ sdxi = cxt->sdxi;
+ down_read(&sdxi->state_lock);
mutex_lock(&cxt->cleanup_lock);
cxt->mm_dead = true;
if (!cxt->resources_released) {
- ret = sdxi_cxt_quiesce_locked(cxt, 0, NULL, false);
- if (ret) {
- dev_err(cxt->sdxi->dev,
- "failed to quiesce context %u during mm release: %d; quiescing function\n",
- cxt->id, ret);
- sdxi_dev_fail(cxt->sdxi);
- cxt->started = false;
- cxt->quiesced = true;
- cxt->quiesce_cst_flags = 0;
+ if (sdxi->online) {
+ ret = sdxi_cxt_quiesce_locked(cxt, 0, NULL, false);
+ if (ret) {
+ dev_err(cxt->sdxi->dev,
+ "failed to quiesce context %u during mm release: %d; quiescing function\n",
+ cxt->id, ret);
+ sdxi_dev_fail(cxt->sdxi);
+ cxt->started = false;
+ cxt->quiesced = true;
+ cxt->quiesce_cst_flags = 0;
+ }
}
sdxi_cxt_queue_cleanup_locked(cxt, 0);
}
mutex_unlock(&cxt->cleanup_lock);
+ up_read(&sdxi->state_lock);
return ret;
}
diff --git a/drivers/dma/sdxi/context.h b/drivers/dma/sdxi/context.h
index bbe83e54b827..03cb5634fa09 100644
--- a/drivers/dma/sdxi/context.h
+++ b/drivers/dma/sdxi/context.h
@@ -89,6 +89,7 @@ struct sdxi_cxt {
};
int sdxi_admin_cxt_init(struct sdxi_dev *sdxi);
+void sdxi_admin_cxt_exit(struct sdxi_dev *sdxi);
struct sdxi_cxt *sdxi_cxt_new(struct sdxi_dev *sdxi);
struct sdxi_cxt *sdxi_ucxt_new(struct sdxi_dev *sdxi, u32 ring_entries,
u64 ds_ring, u64 write_index, u64 cxt_sts,
diff --git a/drivers/dma/sdxi/device.c b/drivers/dma/sdxi/device.c
index 1587795c0a16..ff5b5d932bc9 100644
--- a/drivers/dma/sdxi/device.c
+++ b/drivers/dma/sdxi/device.c
@@ -414,8 +414,10 @@ static int sdxi_fn_activate(struct sdxi_dev *sdxi)
sdxi->L2_table = dmam_alloc_coherent(sdxi->dev,
sizeof(*sdxi->L2_table),
&sdxi->L2_dma, GFP_KERNEL);
- if (!sdxi->L2_table)
- return -ENOMEM;
+ if (!sdxi->L2_table) {
+ err = -ENOMEM;
+ goto exit_keys;
+ }
memset(sdxi->L2_table, 0, sizeof(*sdxi->L2_table));
cxt_l2 = FIELD_PREP(SDXI_MMIO_CXT_L2_PTR, sdxi->L2_dma >> ilog2(SZ_4K));
@@ -429,11 +431,11 @@ static int sdxi_fn_activate(struct sdxi_dev *sdxi)
*/
err = sdxi_admin_cxt_init(sdxi);
if (err)
- return err;
+ goto exit_keys;
err = sdxi_error_init(sdxi);
if (err)
- return err;
+ goto exit_admin;
/*
* SDXI 1.0 4.1.8.9: Set MMIO_CTL0.fn_gsr to GSRV_ACTIVE and
@@ -449,8 +451,15 @@ static int sdxi_fn_activate(struct sdxi_dev *sdxi)
sdxi_error_exit(sdxi);
if (sdxi_dev_stop(sdxi))
sdxi_dev_force_quiesce(sdxi);
+ goto exit_admin;
}
+ return 0;
+
+exit_admin:
+ sdxi_admin_cxt_exit(sdxi);
+exit_keys:
+ sdxi_keys_exit(sdxi);
return err;
}
@@ -469,38 +478,100 @@ static int sdxi_device_init(struct sdxi_dev *sdxi)
if (err)
return err;
- sdxi_dma_register(sdxi);
+ err = sdxi_dma_register(sdxi);
+ if (err) {
+ sdxi_error_exit(sdxi);
+ if (sdxi_dev_stop(sdxi))
+ sdxi_dev_force_quiesce(sdxi);
+ sdxi_admin_cxt_exit(sdxi);
+ sdxi_keys_exit(sdxi);
+ return err;
+ }
+
return 0;
}
+static void sdxi_device_quiesce(struct sdxi_dev *sdxi)
+{
+ sdxi_error_exit(sdxi);
+ if (sdxi_dev_stop(sdxi))
+ sdxi_dev_force_quiesce(sdxi);
+}
+
+/* Hardware must already be quiesced before this releases DMA-visible state. */
+static void sdxi_device_exit(struct sdxi_dev *sdxi)
+{
+ sdxi_client_cxts_exit(sdxi);
+ sdxi_admin_cxt_exit(sdxi);
+ sdxi_keys_exit(sdxi);
+ xa_destroy(&sdxi->client_cxts);
+ ida_destroy(&sdxi->vectors);
+}
+
+static void sdxi_dev_release(struct device *chardev)
+{
+ struct sdxi_dev *sdxi = container_of(chardev, struct sdxi_dev,
+ chardev);
+
+ put_device(sdxi->dev);
+ kfree(sdxi);
+}
+
int sdxi_register(struct device *dev, const struct sdxi_bus_ops *ops)
{
struct sdxi_dev *sdxi;
int err;
- sdxi = devm_kzalloc(dev, sizeof(*sdxi), GFP_KERNEL);
+ sdxi = kzalloc_obj(*sdxi, GFP_KERNEL);
if (!sdxi)
return -ENOMEM;
- sdxi->dev = dev;
+ sdxi->dev = get_device(dev);
sdxi->bus_ops = ops;
+ device_initialize(&sdxi->chardev);
+ sdxi->chardev.release = sdxi_dev_release;
+ init_rwsem(&sdxi->state_lock);
ida_init(&sdxi->vectors);
xa_init_flags(&sdxi->client_cxts, XA_FLAGS_ALLOC1);
mutex_init(&sdxi->cxt_lock);
mutex_init(&sdxi->admin_lock);
mutex_init(&sdxi->rkey_lock);
sdxi->error_irq = -1;
+ sdxi->minor = -1;
dev_set_drvdata(dev, sdxi);
err = sdxi->bus_ops->init(sdxi);
if (err)
- return err;
+ goto destroy_allocators;
err = sdxi_fn_prepare(sdxi);
if (err)
- return err;
+ goto destroy_allocators;
+
+ err = sdxi_device_init(sdxi);
+ if (err)
+ goto destroy_allocators;
+
+ down_write(&sdxi->state_lock);
+ err = sdxi_chardev_register(sdxi);
+ if (!err)
+ sdxi->online = true;
+ up_write(&sdxi->state_lock);
+ if (err) {
+ sdxi_device_quiesce(sdxi);
+ sdxi_device_exit(sdxi);
+ goto put_chardev;
+ }
+
+ return 0;
- return sdxi_device_init(sdxi);
+destroy_allocators:
+ xa_destroy(&sdxi->client_cxts);
+ ida_destroy(&sdxi->vectors);
+put_chardev:
+ dev_set_drvdata(dev, NULL);
+ put_device(&sdxi->chardev);
+ return err;
}
EXPORT_SYMBOL_NS_GPL(sdxi_register, "SDXI");
@@ -508,16 +579,34 @@ void sdxi_unregister(struct device *dev)
{
struct sdxi_dev *sdxi = dev_get_drvdata(dev);
- sdxi_error_exit(sdxi);
- if (sdxi_dev_stop(sdxi))
- sdxi_dev_force_quiesce(sdxi);
- sdxi_client_cxts_exit(sdxi);
- sdxi_keys_exit(sdxi);
- ida_destroy(&sdxi->vectors);
+ if (!sdxi)
+ return;
+
+ down_write(&sdxi->state_lock);
+ sdxi_chardev_unregister(sdxi);
+ sdxi_device_quiesce(sdxi);
+ sdxi->online = false;
+ up_write(&sdxi->state_lock);
+
+ sdxi_device_exit(sdxi);
+ dev_set_drvdata(dev, NULL);
+ put_device(&sdxi->chardev);
}
EXPORT_SYMBOL_NS_GPL(sdxi_unregister, "SDXI");
+static int __init sdxi_core_init(void)
+{
+ return sdxi_chardev_init();
+}
+
+static void __exit sdxi_core_exit(void)
+{
+ sdxi_chardev_exit();
+}
+
MODULE_AUTHOR("Wei Huang");
MODULE_AUTHOR("Nathan Lynch");
MODULE_DESCRIPTION("SDXI core");
MODULE_LICENSE("GPL");
+module_init(sdxi_core_init);
+module_exit(sdxi_core_exit);
diff --git a/drivers/dma/sdxi/ioctl.c b/drivers/dma/sdxi/ioctl.c
new file mode 100644
index 000000000000..17661fca54a7
--- /dev/null
+++ b/drivers/dma/sdxi/ioctl.c
@@ -0,0 +1,155 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * SDXI character device support.
+ *
+ * Copyright Advanced Micro Devices, Inc.
+ */
+
+#include <linux/cdev.h>
+#include <linux/device.h>
+#include <linux/fs.h>
+#include <linux/idr.h>
+#include <linux/module.h>
+#include <linux/slab.h>
+
+#include "ioctl.h"
+#include "process.h"
+#include "sdxi.h"
+
+#define SDXI_MAX_MINORS 256
+
+static dev_t sdxi_devt;
+static struct class *sdxi_class;
+static DEFINE_IDA(sdxi_minor_ida);
+
+static long sdxi_ioctl_unsupported(struct file *file, unsigned int cmd,
+ unsigned long arg)
+{
+ return -ENOTTY;
+}
+
+static int sdxi_open(struct inode *inode, struct file *file)
+{
+ struct sdxi_dev *sdxi;
+ struct sdxi_process *process;
+ struct sdxi_file *sf;
+
+ if (!inode->i_cdev)
+ return -ENODEV;
+
+ sdxi = container_of(inode->i_cdev, struct sdxi_dev, cdev);
+ down_read(&sdxi->state_lock);
+ if (!sdxi->online) {
+ up_read(&sdxi->state_lock);
+ return -ENODEV;
+ }
+ process = sdxi_process_create(sdxi);
+ up_read(&sdxi->state_lock);
+ if (IS_ERR(process))
+ return PTR_ERR(process);
+
+ sf = kzalloc_obj(*sf, GFP_KERNEL);
+ if (!sf) {
+ sdxi_process_put(process);
+ return -ENOMEM;
+ }
+
+ sf->type = SDXI_FILE_DEVICE;
+ sf->process = process;
+ file->private_data = sf;
+ return 0;
+}
+
+static int sdxi_release(struct inode *inode, struct file *file)
+{
+ struct sdxi_file *sf = file->private_data;
+
+ if (!sf)
+ return 0;
+
+ sdxi_process_put(sf->process);
+ kfree(sf);
+ file->private_data = NULL;
+ return 0;
+}
+
+static const struct file_operations sdxi_fops = {
+ .owner = THIS_MODULE,
+ .open = sdxi_open,
+ .release = sdxi_release,
+ .unlocked_ioctl = sdxi_ioctl_unsupported,
+ .compat_ioctl = sdxi_ioctl_unsupported,
+};
+
+int sdxi_chardev_init(void)
+{
+ int ret;
+
+ ret = alloc_chrdev_region(&sdxi_devt, 0, SDXI_MAX_MINORS, "sdxi");
+ if (ret)
+ return ret;
+
+ sdxi_class = class_create("sdxi");
+ if (IS_ERR(sdxi_class)) {
+ ret = PTR_ERR(sdxi_class);
+ sdxi_class = NULL;
+ unregister_chrdev_region(sdxi_devt, SDXI_MAX_MINORS);
+ return ret;
+ }
+
+ return 0;
+}
+
+void sdxi_chardev_exit(void)
+{
+ class_destroy(sdxi_class);
+ sdxi_class = NULL;
+ unregister_chrdev_region(sdxi_devt, SDXI_MAX_MINORS);
+ ida_destroy(&sdxi_minor_ida);
+}
+
+int sdxi_chardev_register(struct sdxi_dev *sdxi)
+{
+ dev_t devt;
+ int minor;
+ int ret;
+
+ minor = ida_alloc_max(&sdxi_minor_ida, SDXI_MAX_MINORS - 1,
+ GFP_KERNEL);
+ if (minor < 0)
+ return minor;
+
+ sdxi->minor = minor;
+ devt = MKDEV(MAJOR(sdxi_devt), minor);
+ sdxi->chardev.devt = devt;
+ sdxi->chardev.class = sdxi_class;
+ sdxi->chardev.parent = sdxi->dev;
+ dev_set_drvdata(&sdxi->chardev, sdxi);
+ ret = dev_set_name(&sdxi->chardev, "sdxi%d", minor);
+ if (ret)
+ goto free_minor;
+
+ cdev_init(&sdxi->cdev, &sdxi_fops);
+ sdxi->cdev.owner = THIS_MODULE;
+
+ ret = cdev_device_add(&sdxi->cdev, &sdxi->chardev);
+ if (ret)
+ goto free_minor;
+
+ return 0;
+
+free_minor:
+ sdxi->minor = -1;
+ ida_free(&sdxi_minor_ida, minor);
+ return ret;
+}
+
+void sdxi_chardev_unregister(struct sdxi_dev *sdxi)
+{
+ if (sdxi->minor < 0)
+ return;
+
+ cdev_device_del(&sdxi->cdev, &sdxi->chardev);
+ ida_free(&sdxi_minor_ida, sdxi->minor);
+ sdxi->minor = -1;
+}
diff --git a/drivers/dma/sdxi/keys.c b/drivers/dma/sdxi/keys.c
index 2e25a9b806e6..c2f1db0d1594 100644
--- a/drivers/dma/sdxi/keys.c
+++ b/drivers/dma/sdxi/keys.c
@@ -6,7 +6,6 @@
*/
#include <linux/bitfield.h>
-#include <linux/device/devres.h>
#include <linux/dma-mapping.h>
#include <linux/log2.h>
#include <linux/sizes.h>
@@ -17,16 +16,10 @@
#include "mmio.h"
#include "sdxi.h"
-static void sdxi_keys_release(void *data)
-{
- sdxi_keys_exit(data);
-}
-
int sdxi_keys_init(struct sdxi_dev *sdxi, u64 cap1)
{
size_t table_size;
u64 reg;
- int ret;
sdxi->rkey_cap = FIELD_GET(SDXI_MMIO_CAP1_RKEY_CAP, cap1);
if (!sdxi->rkey_cap)
@@ -49,10 +42,6 @@ int sdxi_keys_init(struct sdxi_dev *sdxi, u64 cap1)
SDXI_MMIO_RKEY_EN;
sdxi_write64(sdxi, SDXI_MMIO_RKEY, reg);
- ret = devm_add_action_or_reset(sdxi->dev, sdxi_keys_release, sdxi);
- if (ret)
- return ret;
-
return 0;
}
diff --git a/drivers/dma/sdxi/pci.c b/drivers/dma/sdxi/pci.c
index 7b477b7bec55..eca55c8d65f8 100644
--- a/drivers/dma/sdxi/pci.c
+++ b/drivers/dma/sdxi/pci.c
@@ -130,6 +130,7 @@ static void sdxi_pci_force_quiesce(struct sdxi_dev *sdxi)
}
static const struct sdxi_bus_ops sdxi_pci_ops = {
+ .owner = THIS_MODULE,
.init = sdxi_pci_init,
.reset = sdxi_pci_reset,
.get_irq = sdxi_pci_get_irq,
diff --git a/drivers/dma/sdxi/process.c b/drivers/dma/sdxi/process.c
index bc0552b554ba..b64f2307e4e3 100644
--- a/drivers/dma/sdxi/process.c
+++ b/drivers/dma/sdxi/process.c
@@ -6,6 +6,7 @@
*/
#include <linux/iommu.h>
+#include <linux/module.h>
#include <linux/sched/mm.h>
#include <linux/sched/task.h>
#include <linux/slab.h>
@@ -100,6 +101,7 @@ void sdxi_process_unbind_sva(struct sdxi_process *process,
static void sdxi_process_free(struct sdxi_process *process)
{
+ struct sdxi_dev *sdxi = process->sdxi;
struct iommu_sva *sva;
u32 pasid;
@@ -111,6 +113,8 @@ static void sdxi_process_free(struct sdxi_process *process)
put_task_struct(process->lead_thread);
mmdrop(process->mm);
kfree(process);
+ module_put(sdxi->bus_ops->owner);
+ put_device(&sdxi->chardev);
}
void sdxi_process_get(struct sdxi_process *process)
@@ -167,10 +171,16 @@ struct sdxi_process *sdxi_process_create(struct sdxi_dev *sdxi)
if (!task->mm)
return ERR_PTR(-EINVAL);
+ if (!try_module_get(sdxi->bus_ops->owner))
+ return ERR_PTR(-ENODEV);
+ get_device(&sdxi->chardev);
process = kzalloc_obj(*process, GFP_KERNEL);
- if (!process)
+ if (!process) {
+ put_device(&sdxi->chardev);
+ module_put(sdxi->bus_ops->owner);
return ERR_PTR(-ENOMEM);
+ }
refcount_set(&process->refs, 1);
mutex_init(&process->mutex);
diff --git a/drivers/dma/sdxi/sdxi.h b/drivers/dma/sdxi/sdxi.h
index fa34aaa36c16..98d2baffbbdf 100644
--- a/drivers/dma/sdxi/sdxi.h
+++ b/drivers/dma/sdxi/sdxi.h
@@ -9,11 +9,14 @@
#define DMA_SDXI_H
#include <linux/bug.h>
+#include <linux/cdev.h>
#include <linux/compiler_types.h>
+#include <linux/device.h>
#include <linux/dev_printk.h>
#include <linux/idr.h>
#include <linux/io.h>
#include <linux/mutex.h>
+#include <linux/rwsem.h>
#include <linux/types.h>
#include <linux/xarray.h>
@@ -44,11 +47,14 @@ enum {
};
struct sdxi_dev;
+struct module;
/**
* struct sdxi_bus_ops - Bus-specific methods for SDXI devices.
*/
struct sdxi_bus_ops {
+ /** @owner: Module providing these operations, or NULL if built in. */
+ struct module *owner;
/**
* @init: Map control registers and doorbell region, allocate
* IRQ ranges. Invoked before bus-agnostic SDXI
@@ -117,6 +123,12 @@ struct sdxi_dev {
bool has_mailbox;
+ struct cdev cdev;
+ struct device chardev;
+ int minor;
+ bool online;
+ struct rw_semaphore state_lock; /* online state and user operations */
+
const struct sdxi_bus_ops *bus_ops;
};
@@ -163,6 +175,10 @@ void sdxi_unregister(struct device *dev);
bool sdxi_dev_in_error(const struct sdxi_dev *sdxi);
void sdxi_dev_force_quiesce(struct sdxi_dev *sdxi);
void sdxi_dev_fail(struct sdxi_dev *sdxi);
+int sdxi_chardev_init(void);
+void sdxi_chardev_exit(void);
+int sdxi_chardev_register(struct sdxi_dev *sdxi);
+void sdxi_chardev_unregister(struct sdxi_dev *sdxi);
static inline u64 sdxi_read64(const struct sdxi_dev *sdxi, enum sdxi_reg reg)
{
--
2.56.1
next prev parent reply other threads:[~2026-11-19 20:26 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-19 20:22 [PATCH v1 00/44] dmaengine: sdxi: add userspace control and management support Wei Huang
2026-11-19 20:22 ` [PATCH v1 01/44] dmaengine: sdxi: cache hardware version for feature gating Wei Huang
2026-11-19 20:22 ` [PATCH v1 02/44] dmaengine: sdxi: define key and error MMIO registers Wei Huang
2026-11-19 20:22 ` [PATCH v1 03/44] dmaengine: sdxi: define SDXI hardware layouts Wei Huang
2026-11-19 20:22 ` [PATCH v1 04/44] dmaengine: sdxi: encode admin descriptors Wei Huang
2026-11-19 20:22 ` [PATCH v1 05/44] dmaengine: sdxi: support timeout-aware completion waits Wei Huang
2026-11-19 20:22 ` [PATCH v1 06/44] dmaengine: sdxi: support the full context table hierarchy Wei Huang
2026-11-19 20:22 ` [PATCH v1 07/44] dmaengine: sdxi: implement synchronous admin operations Wei Huang
2026-11-19 20:22 ` [PATCH v1 08/44] dmaengine: sdxi: add core RKey table management Wei Huang
2026-11-19 20:22 ` [PATCH v1 09/44] dmaengine: sdxi: handle hardware error logs Wei Huang
2026-11-19 20:22 ` [PATCH v1 10/44] dmaengine: sdxi: separate context and submission resources Wei Huang
2026-11-19 20:22 ` [PATCH v1 11/44] dmaengine: sdxi: support userspace context lifetimes Wei Huang
2026-11-19 20:22 ` [PATCH v1 12/44] dmaengine: sdxi: route context interrupts to eventfd Wei Huang
2026-11-19 20:22 ` [PATCH v1 13/44] dmaengine: sdxi: kill user contexts on fatal errors Wei Huang
2026-11-19 20:22 ` [PATCH v1 14/44] dmaengine: sdxi: define the ioctl UAPI surface Wei Huang
2026-11-19 20:22 ` [PATCH v1 15/44] dmaengine: sdxi: add internal ioctl definitions Wei Huang
2026-11-19 20:22 ` Wei Huang [this message]
2026-11-19 20:22 ` [PATCH v1 17/44] dmaengine: sdxi: implement fixed-size ioctl dispatch Wei Huang
2026-11-19 20:22 ` [PATCH v1 18/44] dmaengine: sdxi: implement userspace context file operations Wei Huang
2026-11-19 20:22 ` [PATCH v1 19/44] dmaengine: sdxi: validate and copy key ioctl payloads Wei Huang
2026-11-19 20:22 ` [PATCH v1 20/44] dmaengine: sdxi: implement RKey management ioctls Wei Huang
2026-11-19 20:22 ` [PATCH v1 21/44] dmaengine: sdxi: implement AKey " Wei Huang
2026-11-19 20:22 ` [PATCH v1 22/44] dmaengine: sdxi: expose operation-group discovery Wei Huang
2026-11-19 20:22 ` [PATCH v1 23/44] dmaengine: sdxi: implement typed vendor admin transport Wei Huang
2026-11-19 20:23 ` [PATCH v1 24/44] dmaengine: sdxi: expose character device attributes Wei Huang
2026-11-19 20:23 ` [PATCH v1 25/44] dmaengine: sdxi: add PF and VF device naming Wei Huang
2026-11-19 20:23 ` [PATCH v1 26/44] dmaengine: sdxi: add SDXI trace events Wei Huang
2026-11-19 20:23 ` [PATCH v1 27/44] dmaengine: sdxi: support suspend and resume Wei Huang
2026-11-19 20:23 ` [PATCH v1 28/44] dmaengine: sdxi: amd: define QoS request formats Wei Huang
2026-11-19 20:23 ` [PATCH v1 29/44] dmaengine: sdxi: amd: add QoS validation scaffolding Wei Huang
2026-11-19 20:23 ` [PATCH v1 30/44] dmaengine: sdxi: amd: build QoS admin descriptors Wei Huang
2026-11-19 20:23 ` [PATCH v1 31/44] dmaengine: sdxi: amd: prevalidate QoS operations Wei Huang
2026-11-19 20:23 ` [PATCH v1 32/44] dmaengine: sdxi: amd: execute QoS vendor operations Wei Huang
2026-11-19 20:23 ` [PATCH v1 33/44] dmaengine: sdxi: amd: register QoS vendor handler Wei Huang
2026-11-19 20:23 ` [PATCH v1 34/44] dmaengine: sdxi: amd: test QoS validation with KUnit Wei Huang
2026-11-19 20:23 ` [PATCH v1 35/44] selftests: sdxi: add build scaffold Wei Huang
2026-11-19 20:23 ` [PATCH v1 36/44] selftests: sdxi: add shared descriptor and context helpers Wei Huang
2026-11-19 20:23 ` [PATCH v1 37/44] selftests: sdxi: test context creation Wei Huang
2026-11-19 20:23 ` [PATCH v1 38/44] selftests: sdxi: test NOP descriptor submission Wei Huang
2026-11-19 20:23 ` [PATCH v1 39/44] selftests: sdxi: test copy submission and ring wrap Wei Huang
2026-11-19 20:23 ` [PATCH v1 40/44] selftests: sdxi: exercise dataplane error paths Wei Huang
2026-11-19 20:23 ` [PATCH v1 41/44] selftests: sdxi: test device ioctls Wei Huang
2026-11-19 20:23 ` [PATCH v1 42/44] selftests: sdxi: test vendor admin ioctls Wei Huang
2026-11-19 20:23 ` [PATCH v1 43/44] selftests: sdxi: test RKey ioctls Wei Huang
2026-11-19 20:23 ` [PATCH v1 44/44] MAINTAINERS: cover SDXI UAPI, vendor files, and selftests Wei Huang
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=20261119202321.1734355-17-wei.huang2@amd.com \
--to=wei.huang2@amd.com \
--cc=Frank.Li@kernel.org \
--cc=John.Kariuki@amd.com \
--cc=Shyam.Iyer@dell.com \
--cc=Stephen.Bates@amd.com \
--cc=bhelgaas@google.com \
--cc=dmaengine@vger.kernel.org \
--cc=jic23@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=mario.limonciello@amd.com \
--cc=nathan.lynch@amd.com \
--cc=rientjes@google.com \
--cc=shuah@kernel.org \
--cc=suravee.suthikulpanit@amd.com \
--cc=tycho@kernel.org \
--cc=vkoul@kernel.org \
--cc=weixugc@google.com \
/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
all inboxes | Powered by JetHome®