mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-24 10:11:26 +03:00
misc: mods: update MODS kernel driver to 3.93
Change-Id: I6bc81407edbd448867c0b6d979d2eb3920c0e95c Signed-off-by: Chris Dragan <kdragan@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/2156158 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Sachin Nikam <snikam@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
committed by
Laxman Dewangan
parent
9ca6957981
commit
003f79282f
@@ -25,7 +25,7 @@
|
||||
|
||||
/* Driver version */
|
||||
#define MODS_DRIVER_VERSION_MAJOR 3
|
||||
#define MODS_DRIVER_VERSION_MINOR 91
|
||||
#define MODS_DRIVER_VERSION_MINOR 93
|
||||
#define MODS_DRIVER_VERSION ((MODS_DRIVER_VERSION_MAJOR << 8) | \
|
||||
((MODS_DRIVER_VERSION_MINOR/10) << 4) | \
|
||||
(MODS_DRIVER_VERSION_MINOR%10))
|
||||
@@ -49,6 +49,40 @@ struct mods_pci_dev {
|
||||
__u8 function;
|
||||
};
|
||||
|
||||
/* MODS_ESC_ALLOC_PAGES_2 */
|
||||
struct MODS_ALLOC_PAGES_2 {
|
||||
/* IN */
|
||||
__u64 num_bytes;
|
||||
__u32 flags; /* MODS_ALLOC_* */
|
||||
__s32 numa_node;
|
||||
struct mods_pci_dev_2 pci_device;
|
||||
|
||||
/* OUT */
|
||||
__u64 memory_handle;
|
||||
};
|
||||
|
||||
/* numa_node */
|
||||
#define MODS_ANY_NUMA_NODE (-1)
|
||||
|
||||
/* flags */
|
||||
#define MODS_ALLOC_CACHED 0 /* Default WB cache attr */
|
||||
#define MODS_ALLOC_UNCACHED 1 /* UC cache attr */
|
||||
#define MODS_ALLOC_WRITECOMBINE 2 /* WC cache attr */
|
||||
#define MODS_ALLOC_CACHE_MASK 7U /* The first three bits are cache attr */
|
||||
|
||||
#define MODS_ALLOC_DMA32 8 /* Force 32-bit PA, else any PA */
|
||||
#define MODS_ALLOC_CONTIGUOUS 16 /* Force contiguous, else any PA */
|
||||
#define MODS_ALLOC_USE_NUMA 32 /* Use numa_node instead of PCI dev for
|
||||
* NUMA node hint
|
||||
*/
|
||||
#define MODS_ALLOC_FORCE_NUMA 64 /* Force memory to be from a given NUMA
|
||||
* node (same as PCI dev or numa_node).
|
||||
* Otherwise use PCI dev/numa_node as
|
||||
* a hint and if that is not possible,
|
||||
* allocate from any NUMA node
|
||||
*/
|
||||
#define MODS_ALLOC_MAP_DEV 128 /* DMA map to PCI device */
|
||||
|
||||
/* MODS_ESC_ALLOC_PAGES */
|
||||
struct MODS_ALLOC_PAGES {
|
||||
/* IN */
|
||||
@@ -317,6 +351,12 @@ struct MODS_PCI_HOT_RESET {
|
||||
struct mods_pci_dev_2 pci_device;
|
||||
};
|
||||
|
||||
/* MODS_ESC_PCI_BUS_REMOVE_DEV */
|
||||
struct MODS_PCI_BUS_REMOVE_DEV {
|
||||
/* IN */
|
||||
struct mods_pci_dev_2 pci_device;
|
||||
};
|
||||
|
||||
/* MODS_ESC_SET_PPC_TCE_BYPASS */
|
||||
#define MODS_PPC_TCE_BYPASS_DEFAULT 0
|
||||
#define MODS_PPC_TCE_BYPASS_ON 1
|
||||
@@ -1128,22 +1168,29 @@ struct MODS_MSR {
|
||||
_IOWR(MODS_IOC_MAGIC, 9, struct MODS_PIO_READ)
|
||||
#define MODS_ESC_PIO_WRITE \
|
||||
_IOWR(MODS_IOC_MAGIC, 10, struct MODS_PIO_WRITE)
|
||||
/* Deprecated */
|
||||
#define MODS_ESC_IRQ_REGISTER \
|
||||
_IOWR(MODS_IOC_MAGIC, 11, struct MODS_IRQ)
|
||||
/* Deprecated */
|
||||
#define MODS_ESC_IRQ_FREE \
|
||||
_IOWR(MODS_IOC_MAGIC, 12, struct MODS_IRQ)
|
||||
/* Deprecated */
|
||||
#define MODS_ESC_IRQ_INQUIRY \
|
||||
_IOWR(MODS_IOC_MAGIC, 13, struct MODS_IRQ)
|
||||
#define MODS_ESC_EVAL_ACPI_METHOD \
|
||||
_IOWR_BAD(MODS_IOC_MAGIC, 16, struct MODS_EVAL_ACPI_METHOD)
|
||||
#define MODS_ESC_GET_API_VERSION \
|
||||
_IOWR(MODS_IOC_MAGIC, 17, struct MODS_GET_VERSION)
|
||||
/* Deprecated */
|
||||
#define MODS_ESC_GET_KERNEL_VERSION \
|
||||
_IOWR(MODS_IOC_MAGIC, 18, struct MODS_GET_VERSION)
|
||||
/* Deprecated */
|
||||
#define MODS_ESC_SET_DRIVER_PARA \
|
||||
_IOWR(MODS_IOC_MAGIC, 19, struct MODS_SET_PARA)
|
||||
/* Deprecated */
|
||||
#define MODS_ESC_MSI_REGISTER \
|
||||
_IOWR(MODS_IOC_MAGIC, 20, struct MODS_IRQ)
|
||||
/* Deprecated */
|
||||
#define MODS_ESC_REARM_MSI \
|
||||
_IOWR(MODS_IOC_MAGIC, 21, struct MODS_IRQ)
|
||||
#define MODS_ESC_SET_MEMORY_TYPE \
|
||||
@@ -1180,6 +1227,7 @@ struct MODS_MSR {
|
||||
_IOW(MODS_IOC_MAGIC, 37, struct MODS_CLOCK_HANDLE)
|
||||
#define MODS_ESC_CLOCK_RESET_DEASSERT \
|
||||
_IOW(MODS_IOC_MAGIC, 38, struct MODS_CLOCK_HANDLE)
|
||||
/* Deprecated */
|
||||
#define MODS_ESC_SET_IRQ_MASK \
|
||||
_IOW(MODS_IOC_MAGIC, 39, struct MODS_SET_IRQ_MASK)
|
||||
#define MODS_ESC_MEMORY_BARRIER \
|
||||
@@ -1216,6 +1264,7 @@ struct MODS_MSR {
|
||||
_IOWR(MODS_IOC_MAGIC, 54, struct MODS_PCI_GET_BAR_INFO)
|
||||
#define MODS_ESC_PCI_GET_IRQ \
|
||||
_IOWR(MODS_IOC_MAGIC, 55, struct MODS_PCI_GET_IRQ)
|
||||
/* Deprecated */
|
||||
#define MODS_ESC_GET_MAPPED_PHYSICAL_ADDRESS \
|
||||
_IOWR(MODS_IOC_MAGIC, 56, \
|
||||
struct MODS_GET_PHYSICAL_ADDRESS)
|
||||
@@ -1242,6 +1291,7 @@ struct MODS_MSR {
|
||||
_IOW(MODS_IOC_MAGIC, 66, struct MODS_REGISTER_IRQ_2)
|
||||
#define MODS_ESC_QUERY_IRQ_2 \
|
||||
_IOR(MODS_IOC_MAGIC, 67, struct MODS_QUERY_IRQ_2)
|
||||
/* Deprecated */
|
||||
#define MODS_ESC_SET_IRQ_MASK_2 \
|
||||
_IOW(MODS_IOC_MAGIC, 68, struct MODS_SET_IRQ_MASK_2)
|
||||
#define MODS_ESC_EVAL_DEV_ACPI_METHOD_2 \
|
||||
@@ -1261,11 +1311,14 @@ struct MODS_MSR {
|
||||
_IOW(MODS_IOC_MAGIC, 75, struct MODS_DMA_MAP_MEMORY)
|
||||
#define MODS_ESC_DMA_UNMAP_MEMORY \
|
||||
_IOW(MODS_IOC_MAGIC, 76, struct MODS_DMA_MAP_MEMORY)
|
||||
/* Deprecated */
|
||||
#define MODS_ESC_GET_MAPPED_PHYSICAL_ADDRESS_2 \
|
||||
_IOWR(MODS_IOC_MAGIC, 77, \
|
||||
struct MODS_GET_PHYSICAL_ADDRESS_2)
|
||||
/* Deprecated */
|
||||
#define MODS_ESC_PCI_MAP_RESOURCE \
|
||||
_IOWR(MODS_IOC_MAGIC, 78, struct MODS_PCI_MAP_RESOURCE)
|
||||
/* Deprecated */
|
||||
#define MODS_ESC_PCI_UNMAP_RESOURCE \
|
||||
_IOW(MODS_IOC_MAGIC, 79, struct MODS_PCI_UNMAP_RESOURCE)
|
||||
#define MODS_ESC_DMA_REQUEST_HANDLE \
|
||||
@@ -1280,6 +1333,7 @@ struct MODS_MSR {
|
||||
_IOWR(MODS_IOC_MAGIC, 84, struct MODS_DMA_WAIT_DESC)
|
||||
#define MODS_ESC_DMA_ISSUE_PENDING \
|
||||
_IOW(MODS_IOC_MAGIC, 85, struct MODS_DMA_HANDLE)
|
||||
/* Deprecated */
|
||||
#define MODS_ESC_SET_IRQ_MULTIMASK \
|
||||
_IOW(MODS_IOC_MAGIC, 86, struct MODS_SET_IRQ_MULTIMASK)
|
||||
#define MODS_ESC_NET_FORCE_LINK \
|
||||
@@ -1370,5 +1424,9 @@ struct MODS_MSR {
|
||||
#define MODS_ESC_EVAL_DEV_ACPI_METHOD_3 \
|
||||
_IOWR_BAD(MODS_IOC_MAGIC, 122,\
|
||||
struct MODS_EVAL_DEV_ACPI_METHOD_3)
|
||||
#define MODS_ESC_PCI_BUS_REMOVE_DEV\
|
||||
_IOW(MODS_IOC_MAGIC, 123, struct MODS_PCI_BUS_REMOVE_DEV)
|
||||
#define MODS_ESC_ALLOC_PAGES_2 \
|
||||
_IOWR(MODS_IOC_MAGIC, 124, struct MODS_ALLOC_PAGES_2)
|
||||
|
||||
#endif /* _MODS_H_ */
|
||||
|
||||
@@ -155,10 +155,10 @@ static int mods_extract_acpi_object(
|
||||
return err;
|
||||
}
|
||||
|
||||
static int mods_eval_acpi_method(struct file *pfile,
|
||||
static int mods_eval_acpi_method(struct mods_client *client,
|
||||
struct MODS_EVAL_ACPI_METHOD *p,
|
||||
struct mods_pci_dev_2 *pdevice,
|
||||
u32 acpi_id)
|
||||
struct mods_pci_dev_2 *pdevice,
|
||||
u32 acpi_id)
|
||||
{
|
||||
int err = OK;
|
||||
int i;
|
||||
@@ -190,7 +190,7 @@ static int mods_eval_acpi_method(struct file *pfile,
|
||||
pdevice->device,
|
||||
pdevice->function);
|
||||
|
||||
err = mods_find_pci_dev(pfile, pdevice, &dev);
|
||||
err = mods_find_pci_dev(client, pdevice, &dev);
|
||||
if (unlikely(err)) {
|
||||
if (err == -ENODEV)
|
||||
mods_error_printk("ACPI: PCI device %04x:%02x:%02x.%x not found\n",
|
||||
@@ -219,12 +219,7 @@ static int mods_eval_acpi_method(struct file *pfile,
|
||||
acpi_method_handler = NULL;
|
||||
|
||||
list_for_each_safe(node, next, &acpi_dev->children) {
|
||||
#ifdef MODS_ACPI_DEVID_64
|
||||
unsigned long long
|
||||
#else
|
||||
unsigned long
|
||||
#endif
|
||||
device_id = 0;
|
||||
unsigned long long device_id = 0;
|
||||
|
||||
struct acpi_device *acpi_dev =
|
||||
list_entry(node, struct acpi_device, node);
|
||||
@@ -240,11 +235,7 @@ static int mods_eval_acpi_method(struct file *pfile,
|
||||
/* Couldn't query device_id for this device */
|
||||
continue;
|
||||
|
||||
#ifdef MODS_ACPI_DEVID_64
|
||||
if (device_id == acpi_id) {
|
||||
#else
|
||||
if ((device_id & 0xffff) == (acpi_id & 0xffff)) {
|
||||
#endif
|
||||
acpi_method_handler = acpi_dev->handle;
|
||||
mods_debug_printk(DEBUG_ACPI,
|
||||
"ACPI: Found %s (id = 0x%x) on device %04x:%02x:%02x.%x\n",
|
||||
@@ -328,9 +319,9 @@ static int mods_eval_acpi_method(struct file *pfile,
|
||||
return err;
|
||||
}
|
||||
|
||||
static int mods_acpi_get_ddc(struct file *pfile,
|
||||
static int mods_acpi_get_ddc(struct mods_client *client,
|
||||
struct MODS_ACPI_GET_DDC_2 *p,
|
||||
struct mods_pci_dev_2 *pci_device)
|
||||
struct mods_pci_dev_2 *pci_device)
|
||||
{
|
||||
int err;
|
||||
acpi_status status;
|
||||
@@ -355,7 +346,7 @@ static int mods_acpi_get_ddc(struct file *pfile,
|
||||
pci_device->device,
|
||||
pci_device->function);
|
||||
|
||||
err = mods_find_pci_dev(pfile, pci_device, &dev);
|
||||
err = mods_find_pci_dev(client, pci_device, &dev);
|
||||
if (unlikely(err)) {
|
||||
if (err == -ENODEV)
|
||||
mods_error_printk("ACPI: PCI device %04x:%02x:%02x.%x not found\n",
|
||||
@@ -385,12 +376,7 @@ static int mods_acpi_get_ddc(struct file *pfile,
|
||||
}
|
||||
|
||||
list_for_each_safe(node, next, &device->children) {
|
||||
#ifdef MODS_ACPI_DEVID_64
|
||||
unsigned long long
|
||||
#else
|
||||
unsigned long
|
||||
#endif
|
||||
device_id = 0;
|
||||
unsigned long long device_id = 0;
|
||||
|
||||
struct acpi_device *dev =
|
||||
list_entry(node, struct acpi_device, node);
|
||||
@@ -489,26 +475,31 @@ static int mods_acpi_get_ddc(struct file *pfile,
|
||||
* ESCAPE CALL FUNCTIONS *
|
||||
*************************/
|
||||
|
||||
int esc_mods_eval_acpi_method(struct file *pfile,
|
||||
int esc_mods_eval_acpi_method(struct mods_client *client,
|
||||
struct MODS_EVAL_ACPI_METHOD *p)
|
||||
{
|
||||
return mods_eval_acpi_method(pfile, p, 0, ACPI_MODS_IGNORE_ACPI_ID);
|
||||
return mods_eval_acpi_method(client, p, 0, ACPI_MODS_IGNORE_ACPI_ID);
|
||||
}
|
||||
|
||||
int esc_mods_eval_dev_acpi_method_3(struct file *pfile,
|
||||
int esc_mods_eval_dev_acpi_method_3(struct mods_client *client,
|
||||
struct MODS_EVAL_DEV_ACPI_METHOD_3 *p)
|
||||
{
|
||||
return mods_eval_acpi_method(pfile, &p->method, &p->device, p->acpi_id);
|
||||
return mods_eval_acpi_method(client,
|
||||
&p->method,
|
||||
&p->device,
|
||||
p->acpi_id);
|
||||
}
|
||||
|
||||
int esc_mods_eval_dev_acpi_method_2(struct file *pfile,
|
||||
int esc_mods_eval_dev_acpi_method_2(struct mods_client *client,
|
||||
struct MODS_EVAL_DEV_ACPI_METHOD_2 *p)
|
||||
{
|
||||
return mods_eval_acpi_method(pfile, &p->method, &p->device,
|
||||
return mods_eval_acpi_method(client,
|
||||
&p->method,
|
||||
&p->device,
|
||||
ACPI_MODS_IGNORE_ACPI_ID);
|
||||
}
|
||||
|
||||
int esc_mods_eval_dev_acpi_method(struct file *pfile,
|
||||
int esc_mods_eval_dev_acpi_method(struct mods_client *client,
|
||||
struct MODS_EVAL_DEV_ACPI_METHOD *p)
|
||||
{
|
||||
struct mods_pci_dev_2 device = {0};
|
||||
@@ -517,17 +508,18 @@ int esc_mods_eval_dev_acpi_method(struct file *pfile,
|
||||
device.bus = p->device.bus;
|
||||
device.device = p->device.device;
|
||||
device.function = p->device.function;
|
||||
return mods_eval_acpi_method(pfile, &p->method, &device,
|
||||
return mods_eval_acpi_method(client, &p->method, &device,
|
||||
ACPI_MODS_IGNORE_ACPI_ID);
|
||||
}
|
||||
|
||||
int esc_mods_acpi_get_ddc_2(struct file *pfile,
|
||||
int esc_mods_acpi_get_ddc_2(struct mods_client *client,
|
||||
struct MODS_ACPI_GET_DDC_2 *p)
|
||||
{
|
||||
return mods_acpi_get_ddc(pfile, p, &p->device);
|
||||
return mods_acpi_get_ddc(client, p, &p->device);
|
||||
}
|
||||
|
||||
int esc_mods_acpi_get_ddc(struct file *pfile, struct MODS_ACPI_GET_DDC *p)
|
||||
int esc_mods_acpi_get_ddc(struct mods_client *client,
|
||||
struct MODS_ACPI_GET_DDC *p)
|
||||
{
|
||||
struct MODS_ACPI_GET_DDC_2 *pp = (struct MODS_ACPI_GET_DDC_2 *) p;
|
||||
struct mods_pci_dev_2 device = {0};
|
||||
@@ -537,5 +529,5 @@ int esc_mods_acpi_get_ddc(struct file *pfile, struct MODS_ACPI_GET_DDC *p)
|
||||
device.device = p->device.device;
|
||||
device.function = p->device.function;
|
||||
|
||||
return mods_acpi_get_ddc(pfile, pp, &device);
|
||||
return mods_acpi_get_ddc(client, pp, &device);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* mods_adsp.c - This file is part of NVIDIA MODS kernel driver.
|
||||
*
|
||||
* Copyright (c) 2014-2018, NVIDIA CORPORATION. All rights reserved.
|
||||
* Copyright (c) 2014-2019, NVIDIA CORPORATION. All rights reserved.
|
||||
*
|
||||
* NVIDIA MODS kernel driver is free software: you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License,
|
||||
@@ -21,22 +21,23 @@
|
||||
#include "mods_internal.h"
|
||||
#include <linux/tegra_nvadsp.h>
|
||||
|
||||
int esc_mods_adsp_load(struct file *pfile)
|
||||
int esc_mods_adsp_load(struct mods_client *client)
|
||||
{
|
||||
return nvadsp_os_load();
|
||||
}
|
||||
|
||||
int esc_mods_adsp_start(struct file *pfile)
|
||||
int esc_mods_adsp_start(struct mods_client *client)
|
||||
{
|
||||
return nvadsp_os_start();
|
||||
}
|
||||
|
||||
int esc_mods_adsp_stop(struct file *pfile)
|
||||
int esc_mods_adsp_stop(struct mods_client *client)
|
||||
{
|
||||
return nvadsp_os_suspend();
|
||||
}
|
||||
|
||||
int esc_mods_adsp_run_app(struct file *pfile, struct MODS_ADSP_RUN_APP_INFO *p)
|
||||
int esc_mods_adsp_run_app(struct mods_client *client,
|
||||
struct MODS_ADSP_RUN_APP_INFO *p)
|
||||
{
|
||||
int rc = -1;
|
||||
int max_retry = 3;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* mods_clock.c - This file is part of NVIDIA MODS kernel driver.
|
||||
*
|
||||
* Copyright (c) 2011-2017, NVIDIA CORPORATION. All rights reserved.
|
||||
* Copyright (c) 2011-2019, NVIDIA CORPORATION. All rights reserved.
|
||||
*
|
||||
* NVIDIA MODS kernel driver is free software: you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License,
|
||||
@@ -163,7 +163,7 @@ static struct clk *mods_get_clock(u32 handle)
|
||||
return pclk;
|
||||
}
|
||||
|
||||
int esc_mods_get_clock_handle(struct file *pfile,
|
||||
int esc_mods_get_clock_handle(struct mods_client *client,
|
||||
struct MODS_GET_CLOCK_HANDLE *p)
|
||||
{
|
||||
struct clk *pclk = 0;
|
||||
@@ -201,7 +201,8 @@ err:
|
||||
return ret;
|
||||
}
|
||||
|
||||
int esc_mods_set_clock_rate(struct file *pfile, struct MODS_CLOCK_RATE *p)
|
||||
int esc_mods_set_clock_rate(struct mods_client *client,
|
||||
struct MODS_CLOCK_RATE *p)
|
||||
{
|
||||
struct clk *pclk = 0;
|
||||
int ret = -EINVAL;
|
||||
@@ -230,7 +231,8 @@ int esc_mods_set_clock_rate(struct file *pfile, struct MODS_CLOCK_RATE *p)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int esc_mods_get_clock_rate(struct file *pfile, struct MODS_CLOCK_RATE *p)
|
||||
int esc_mods_get_clock_rate(struct mods_client *client,
|
||||
struct MODS_CLOCK_RATE *p)
|
||||
{
|
||||
struct clk *pclk = 0;
|
||||
int ret = -EINVAL;
|
||||
@@ -253,7 +255,8 @@ int esc_mods_get_clock_rate(struct file *pfile, struct MODS_CLOCK_RATE *p)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int esc_mods_get_clock_max_rate(struct file *pfile, struct MODS_CLOCK_RATE *p)
|
||||
int esc_mods_get_clock_max_rate(struct mods_client *client,
|
||||
struct MODS_CLOCK_RATE *p)
|
||||
{
|
||||
struct clk *pclk = 0;
|
||||
int ret = -EINVAL;
|
||||
@@ -279,7 +282,8 @@ int esc_mods_get_clock_max_rate(struct file *pfile, struct MODS_CLOCK_RATE *p)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int esc_mods_set_clock_max_rate(struct file *pfile, struct MODS_CLOCK_RATE *p)
|
||||
int esc_mods_set_clock_max_rate(struct mods_client *client,
|
||||
struct MODS_CLOCK_RATE *p)
|
||||
{
|
||||
struct clk *pclk = 0;
|
||||
int ret = -EINVAL;
|
||||
@@ -315,7 +319,8 @@ int esc_mods_set_clock_max_rate(struct file *pfile, struct MODS_CLOCK_RATE *p)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int esc_mods_set_clock_parent(struct file *pfile, struct MODS_CLOCK_PARENT *p)
|
||||
int esc_mods_set_clock_parent(struct mods_client *client,
|
||||
struct MODS_CLOCK_PARENT *p)
|
||||
{
|
||||
struct clk *pclk = 0;
|
||||
struct clk *pparent = 0;
|
||||
@@ -349,7 +354,8 @@ int esc_mods_set_clock_parent(struct file *pfile, struct MODS_CLOCK_PARENT *p)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int esc_mods_get_clock_parent(struct file *pfile, struct MODS_CLOCK_PARENT *p)
|
||||
int esc_mods_get_clock_parent(struct mods_client *client,
|
||||
struct MODS_CLOCK_PARENT *p)
|
||||
{
|
||||
struct clk *pclk = 0;
|
||||
int ret = -EINVAL;
|
||||
@@ -375,7 +381,8 @@ int esc_mods_get_clock_parent(struct file *pfile, struct MODS_CLOCK_PARENT *p)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int esc_mods_enable_clock(struct file *pfile, struct MODS_CLOCK_HANDLE *p)
|
||||
int esc_mods_enable_clock(struct mods_client *client,
|
||||
struct MODS_CLOCK_HANDLE *p)
|
||||
{
|
||||
struct clk *pclk = 0;
|
||||
int ret = -EINVAL;
|
||||
@@ -408,7 +415,8 @@ int esc_mods_enable_clock(struct file *pfile, struct MODS_CLOCK_HANDLE *p)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int esc_mods_disable_clock(struct file *pfile, struct MODS_CLOCK_HANDLE *p)
|
||||
int esc_mods_disable_clock(struct mods_client *client,
|
||||
struct MODS_CLOCK_HANDLE *p)
|
||||
{
|
||||
struct clk *pclk = 0;
|
||||
int ret = -EINVAL;
|
||||
@@ -432,7 +440,8 @@ int esc_mods_disable_clock(struct file *pfile, struct MODS_CLOCK_HANDLE *p)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int esc_mods_is_clock_enabled(struct file *pfile, struct MODS_CLOCK_ENABLED *p)
|
||||
int esc_mods_is_clock_enabled(struct mods_client *client,
|
||||
struct MODS_CLOCK_ENABLED *p)
|
||||
{
|
||||
struct clk *pclk = 0;
|
||||
int ret = -EINVAL;
|
||||
@@ -455,7 +464,7 @@ int esc_mods_is_clock_enabled(struct file *pfile, struct MODS_CLOCK_ENABLED *p)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int esc_mods_clock_reset_assert(struct file *pfile,
|
||||
int esc_mods_clock_reset_assert(struct mods_client *client,
|
||||
struct MODS_CLOCK_HANDLE *p)
|
||||
{
|
||||
struct clk *pclk = 0;
|
||||
@@ -511,7 +520,7 @@ err:
|
||||
return ret;
|
||||
}
|
||||
|
||||
int esc_mods_clock_reset_deassert(struct file *pfile,
|
||||
int esc_mods_clock_reset_deassert(struct mods_client *client,
|
||||
struct MODS_CLOCK_HANDLE *p)
|
||||
{
|
||||
struct clk *pclk = 0;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
* mods_debugfs.c - This file is part of NVIDIA MODS kernel driver.
|
||||
*
|
||||
* Copyright (c) 2014-2018, NVIDIA CORPORATION. All rights reserved.
|
||||
* Copyright (c) 2014-2019, NVIDIA CORPORATION. All rights reserved.
|
||||
*
|
||||
* NVIDIA MODS kernel driver is free software: you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License,
|
||||
@@ -20,8 +20,6 @@
|
||||
|
||||
#include "mods_internal.h"
|
||||
|
||||
#ifdef MODS_HAS_DEBUGFS
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/debugfs.h>
|
||||
#include <linux/seq_file.h>
|
||||
@@ -477,19 +475,15 @@ static int mods_mi_set(void *data, u64 val)
|
||||
return 0;
|
||||
}
|
||||
DEFINE_SIMPLE_ATTRIBUTE(mods_mi_fops, mods_mi_get, mods_mi_set, "%llu\n");
|
||||
#endif /* MODS_HAS_DEBUGFS */
|
||||
|
||||
void mods_remove_debugfs(void)
|
||||
{
|
||||
#ifdef MODS_HAS_DEBUGFS
|
||||
debugfs_remove_recursive(mods_debugfs_dir);
|
||||
mods_debugfs_dir = NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
int mods_create_debugfs(struct miscdevice *modsdev)
|
||||
{
|
||||
#ifdef MODS_HAS_DEBUGFS
|
||||
struct dentry *retval;
|
||||
int err = 0;
|
||||
#ifdef CONFIG_TEGRA_DC
|
||||
@@ -699,8 +693,5 @@ remove_out:
|
||||
dev_err(modsdev->this_device, "could not create debugfs\n");
|
||||
mods_remove_debugfs();
|
||||
return err;
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* mods_dma.c - This file is part of NVIDIA MODS kernel driver.
|
||||
*
|
||||
* Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved.
|
||||
* Copyright (c) 2017-2019, NVIDIA CORPORATION. All rights reserved.
|
||||
*
|
||||
* NVIDIA MODS kernel driver is free software: you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License,
|
||||
@@ -198,7 +198,7 @@ int mods_dma_async_is_tx_complete(struct MODS_DMA_HANDLE *p_handle,
|
||||
return ret;
|
||||
}
|
||||
|
||||
int esc_mods_dma_request_channel(struct file *pfile,
|
||||
int esc_mods_dma_request_channel(struct mods_client *client,
|
||||
struct MODS_DMA_HANDLE *p_handle)
|
||||
{
|
||||
struct dma_chan *chan;
|
||||
@@ -251,14 +251,14 @@ int esc_mods_dma_request_channel(struct file *pfile,
|
||||
return 0;
|
||||
}
|
||||
|
||||
int esc_mods_dma_release_channel(struct file *pfile,
|
||||
int esc_mods_dma_release_channel(struct mods_client *client,
|
||||
struct MODS_DMA_HANDLE *p_handle)
|
||||
{
|
||||
mods_release_channel(p_handle->dma_id);
|
||||
return OK;
|
||||
}
|
||||
|
||||
int esc_mods_dma_set_config(struct file *pfile,
|
||||
int esc_mods_dma_set_config(struct mods_client *client,
|
||||
struct MODS_DMA_CHANNEL_CONFIG *p_config)
|
||||
|
||||
{
|
||||
@@ -302,7 +302,7 @@ int esc_mods_dma_set_config(struct file *pfile,
|
||||
}
|
||||
|
||||
|
||||
int esc_mods_dma_submit_request(struct file *pfile,
|
||||
int esc_mods_dma_submit_request(struct mods_client *client,
|
||||
struct MODS_DMA_TX_DESC *p_mods_desc)
|
||||
{
|
||||
int ret = OK;
|
||||
@@ -373,7 +373,7 @@ failed:
|
||||
return ret;
|
||||
}
|
||||
|
||||
int esc_mods_dma_async_issue_pending(struct file *pfile,
|
||||
int esc_mods_dma_async_issue_pending(struct mods_client *client,
|
||||
struct MODS_DMA_HANDLE *p_handle)
|
||||
{
|
||||
int ret = OK;
|
||||
@@ -394,7 +394,7 @@ int esc_mods_dma_async_issue_pending(struct file *pfile,
|
||||
return ret;
|
||||
}
|
||||
|
||||
int esc_mods_dma_wait(struct file *pfile,
|
||||
int esc_mods_dma_wait(struct mods_client *client,
|
||||
struct MODS_DMA_WAIT_DESC *p_wait_desc)
|
||||
{
|
||||
int ret;
|
||||
@@ -414,7 +414,7 @@ int esc_mods_dma_wait(struct file *pfile,
|
||||
return ret;
|
||||
}
|
||||
|
||||
int esc_mods_dma_alloc_coherent(struct file *fp,
|
||||
int esc_mods_dma_alloc_coherent(struct mods_client *client,
|
||||
struct MODS_DMA_COHERENT_MEM_HANDLE *p)
|
||||
{
|
||||
dma_addr_t p_phys_addr;
|
||||
@@ -454,8 +454,8 @@ int esc_mods_dma_alloc_coherent(struct file *fp,
|
||||
return 0;
|
||||
}
|
||||
|
||||
int esc_mods_dma_free_coherent(struct file *fp,
|
||||
struct MODS_DMA_COHERENT_MEM_HANDLE *p)
|
||||
int esc_mods_dma_free_coherent(struct mods_client *client,
|
||||
struct MODS_DMA_COHERENT_MEM_HANDLE *p)
|
||||
{
|
||||
LOG_ENT();
|
||||
|
||||
@@ -478,8 +478,8 @@ int esc_mods_dma_free_coherent(struct file *fp,
|
||||
return 0;
|
||||
}
|
||||
|
||||
int esc_mods_dma_copy_to_user(struct file *fp,
|
||||
struct MODS_DMA_COPY_TO_USER *p)
|
||||
int esc_mods_dma_copy_to_user(struct mods_client *client,
|
||||
struct MODS_DMA_COPY_TO_USER *p)
|
||||
{
|
||||
int retval;
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ static struct device *dummy_device;
|
||||
|
||||
static bool dummy_device_registered;
|
||||
|
||||
int esc_mods_dmabuf_get_phys_addr(struct file *filp,
|
||||
int esc_mods_dmabuf_get_phys_addr(struct mods_client *client,
|
||||
struct MODS_DMABUF_GET_PHYSICAL_ADDRESS *op)
|
||||
{
|
||||
int err = 0;
|
||||
|
||||
@@ -65,7 +65,7 @@ struct en_dev_entry {
|
||||
struct mem_type {
|
||||
u64 dma_addr;
|
||||
u64 size;
|
||||
u32 type;
|
||||
u8 type;
|
||||
};
|
||||
|
||||
struct irq_q_data {
|
||||
@@ -88,6 +88,7 @@ struct mods_client {
|
||||
struct list_head irq_list;
|
||||
struct list_head mem_alloc_list;
|
||||
struct list_head mem_map_list;
|
||||
struct list_head free_mem_list; /* list of unused UC/WC chunks */
|
||||
#if defined(CONFIG_PPC64)
|
||||
struct list_head ppc_tce_bypass_list;
|
||||
struct list_head nvlink_sysmem_trained_list;
|
||||
@@ -103,13 +104,15 @@ struct mods_client {
|
||||
struct mutex mtx;
|
||||
int mods_fb_suspended[FB_MAX];
|
||||
u32 access_token;
|
||||
atomic_t num_allocs;
|
||||
atomic_t num_pages;
|
||||
u8 client_id;
|
||||
};
|
||||
|
||||
/* VM private data */
|
||||
struct mods_vm_private_data {
|
||||
struct file *fp;
|
||||
atomic_t usage_count;
|
||||
struct mods_client *client;
|
||||
atomic_t usage_count;
|
||||
};
|
||||
|
||||
/* PCI Resource mapping private data*/
|
||||
@@ -120,14 +123,26 @@ struct MODS_PCI_RES_MAP_INFO {
|
||||
struct list_head list;
|
||||
};
|
||||
|
||||
#define DMA_BITS 57
|
||||
|
||||
struct MODS_PHYS_CHUNK {
|
||||
u64 dma_addr:58; /* phys addr (or machine addr on XEN) */
|
||||
u32 order:5; /* 1<<order = number of contig pages */
|
||||
int mapped:1;
|
||||
u64 dev_addr; /* DMA map addr for default device */
|
||||
u64 dma_addr:DMA_BITS; /* phys addr (or machine addr on XEN) */
|
||||
u8 order:5; /* 1<<order = number of contig pages */
|
||||
u8 wc:1; /* 1=cache is wc or uc, 0=cache is wb */
|
||||
u8 mapped:1; /* dev_addr is valid */
|
||||
u64 dev_addr; /* DMA map addr for default device */
|
||||
struct page *p_page;
|
||||
};
|
||||
|
||||
struct MODS_FREE_PHYS_CHUNK {
|
||||
struct list_head list;
|
||||
struct page *p_page;
|
||||
int numa_node;
|
||||
u8 order;
|
||||
u8 cache_type:2;
|
||||
u8 dma32:1;
|
||||
};
|
||||
|
||||
struct MODS_DMA_MAP {
|
||||
struct list_head list;
|
||||
struct pci_dev *dev; /* pci_dev these mappings are for */
|
||||
@@ -139,13 +154,14 @@ struct MODS_DMA_MAP {
|
||||
/* system memory allocation tracking */
|
||||
struct MODS_MEM_INFO {
|
||||
u64 logical_addr; /* kernel logical address */
|
||||
u64 length; /* actual number of bytes allocated */
|
||||
u32 num_pages; /* number of allocated pages */
|
||||
u8 alloc_type : 1; /* MODS_ALLOC_TYPE_* */
|
||||
u8 cache_type : 3; /* MODS_MEMORY_* */
|
||||
u8 addr_bits : 7; /* phys addr size requested */
|
||||
u32 length; /* actual number of bytes allocated */
|
||||
u32 num_chunks; /* max number of contig chunks */
|
||||
int numa_node; /* numa node for the allocation */
|
||||
u8 cache_type : 2; /* MODS_ALLOC_* */
|
||||
u8 contig : 1; /* true/false */
|
||||
u8 dma32 : 1; /* true/false */
|
||||
u8 force_numa : 1; /* true/false */
|
||||
struct pci_dev *dev; /* (optional) pci_dev this allocation
|
||||
* is for.
|
||||
*/
|
||||
@@ -161,9 +177,6 @@ struct MODS_MEM_INFO {
|
||||
struct MODS_PHYS_CHUNK pages[1];
|
||||
};
|
||||
|
||||
#define MODS_ALLOC_TYPE_NON_CONTIG 0
|
||||
#define MODS_ALLOC_TYPE_CONTIG 1
|
||||
|
||||
/* map memory tracking */
|
||||
struct SYS_MAP_MEMORY {
|
||||
/* used for offset lookup, NULL for device memory */
|
||||
@@ -199,8 +212,8 @@ struct PPC_TCE_BYPASS {
|
||||
|
||||
int has_npu_dev(struct pci_dev *dev, int index);
|
||||
|
||||
int mods_is_nvlink_sysmem_trained(struct file *fp,
|
||||
struct pci_dev *dev);
|
||||
int mods_is_nvlink_sysmem_trained(struct mods_client *client,
|
||||
struct pci_dev *dev);
|
||||
|
||||
/* NvLink Trained tracking */
|
||||
struct NVL_TRAINED {
|
||||
@@ -283,41 +296,24 @@ struct mods_priv {
|
||||
struct mutex mtx;
|
||||
};
|
||||
|
||||
#ifndef MODS_HAS_SET_MEMORY
|
||||
# define MODS_SET_MEMORY_UC(addr, pages) \
|
||||
change_page_attr(virt_to_page(addr), pages, PAGE_KERNEL_NOCACHE)
|
||||
# define MODS_SET_MEMORY_WC MODS_SET_MEMORY_UC
|
||||
# define MODS_SET_MEMORY_WB(addr, pages) \
|
||||
change_page_attr(virt_to_page(addr), pages, PAGE_KERNEL)
|
||||
#elif ((defined(CONFIG_ARM) || defined(CONFIG_ARM64)) && \
|
||||
#if ((defined(CONFIG_ARM) || defined(CONFIG_ARM64)) && \
|
||||
!defined(CONFIG_CPA)) || defined(CONFIG_PPC64)
|
||||
# define MODS_SET_MEMORY_UC(addr, pages) 0
|
||||
# define MODS_SET_MEMORY_WC(addr, pages) 0
|
||||
# define MODS_SET_MEMORY_WB(addr, pages) 0
|
||||
#else
|
||||
# define MODS_SET_MEMORY_UC(addr, pages) set_memory_uc(addr, pages)
|
||||
# ifdef MODS_HAS_WC
|
||||
# define MODS_SET_MEMORY_WC(addr, pages)\
|
||||
set_memory_wc(addr, pages)
|
||||
# else
|
||||
# define MODS_SET_MEMORY_WC(addr, pages)\
|
||||
MODS_SET_MEMORY_UC(addr, pages)
|
||||
# endif
|
||||
# define MODS_SET_MEMORY_WC(addr, pages) set_memory_wc(addr, pages)
|
||||
# define MODS_SET_MEMORY_WB(addr, pages) set_memory_wb(addr, pages)
|
||||
#endif
|
||||
|
||||
#define MODS_PGPROT_UC pgprot_noncached
|
||||
#ifdef MODS_HAS_WC
|
||||
# define MODS_PGPROT_WC pgprot_writecombine
|
||||
#else
|
||||
# define MODS_PGPROT_WC pgprot_noncached
|
||||
#endif
|
||||
#define MODS_PGPROT_WC pgprot_writecombine
|
||||
|
||||
/* VMA */
|
||||
#define MODS_VMA_PGOFF(vma) ((vma)->vm_pgoff)
|
||||
#define MODS_VMA_SIZE(vma) ((vma)->vm_end - (vma)->vm_start)
|
||||
#define MODS_VMA_OFFSET(vma) (((u64)(vma)->vm_pgoff) << PAGE_SHIFT)
|
||||
#define MODS_VMA_PRIVATE(vma) ((vma)->vm_private_data)
|
||||
#define MODS_VMA_FILE(vma) ((vma)->vm_file)
|
||||
|
||||
/* Xen adds a translation layer between the physical address
|
||||
@@ -355,22 +351,6 @@ struct mods_priv {
|
||||
#define MODS_ACPI_HANDLE(dev) DEVICE_ACPI_HANDLE(dev)
|
||||
#endif
|
||||
|
||||
#ifdef MODS_HAS_OLD_PCI_DMA_MAPPING_ERROR
|
||||
#define MODS_PCI_DMA_MAPPING_ERROR(dev, addr) pci_dma_mapping_error(addr)
|
||||
#else
|
||||
#define MODS_PCI_DMA_MAPPING_ERROR(dev, addr) pci_dma_mapping_error(dev, addr)
|
||||
#endif
|
||||
|
||||
static inline u8 get_client_id(struct file *fp)
|
||||
{
|
||||
return ((struct mods_client *)(fp->private_data))->client_id;
|
||||
}
|
||||
|
||||
static inline int is_client_id_valid(u8 client_id)
|
||||
{
|
||||
return client_id > 0 && client_id <= MODS_MAX_CLIENTS;
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
/* ** MODULE WIDE FUNCTIONS */
|
||||
/* ************************************************************************* */
|
||||
@@ -385,28 +365,30 @@ void mods_free_client(u8 client_id);
|
||||
int mods_irq_event_check(u8 client_id);
|
||||
|
||||
/* mem */
|
||||
const char *mods_get_prot_str(u32 mem_type);
|
||||
int mods_unregister_all_alloc(struct file *fp);
|
||||
struct MODS_MEM_INFO *mods_find_alloc(struct file *fp, u64 phys_addr);
|
||||
const char *mods_get_prot_str(u8 mem_type);
|
||||
int mods_unregister_all_alloc(struct mods_client *client);
|
||||
struct MODS_MEM_INFO *mods_find_alloc(struct mods_client *client,
|
||||
u64 phys_addr);
|
||||
|
||||
#if defined(CONFIG_PPC64)
|
||||
/* ppc64 */
|
||||
int mods_unregister_all_ppc_tce_bypass(struct file *fp);
|
||||
int mods_unregister_all_ppc_tce_bypass(struct mods_client *client);
|
||||
|
||||
int mods_unregister_all_nvlink_sysmem_trained(struct file *fp);
|
||||
int mods_unregister_all_nvlink_sysmem_trained(struct mods_client *client);
|
||||
#endif
|
||||
|
||||
/* pci */
|
||||
#ifdef CONFIG_PCI
|
||||
struct en_dev_entry *mods_enable_device(struct mods_client *client,
|
||||
struct pci_dev *dev);
|
||||
int mods_enable_device(struct mods_client *client,
|
||||
struct pci_dev *dev,
|
||||
struct en_dev_entry **dev_entry);
|
||||
void mods_disable_device(struct pci_dev *pdev);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_PCI
|
||||
int mods_is_pci_dev(struct pci_dev *dev,
|
||||
struct mods_pci_dev_2 *pcidev);
|
||||
int mods_find_pci_dev(struct file *fp,
|
||||
int mods_find_pci_dev(struct mods_client *client,
|
||||
struct mods_pci_dev_2 *pcidev,
|
||||
struct pci_dev **retdev);
|
||||
#else
|
||||
@@ -423,193 +405,224 @@ void mods_shutdown_clock_api(void);
|
||||
/* ioctl hanndlers */
|
||||
|
||||
/* mem */
|
||||
int esc_mods_alloc_pages(struct file *fp, struct MODS_ALLOC_PAGES *p);
|
||||
int esc_mods_device_alloc_pages(struct file *fp,
|
||||
int esc_mods_alloc_pages(struct mods_client *client,
|
||||
struct MODS_ALLOC_PAGES *p);
|
||||
int esc_mods_device_alloc_pages(struct mods_client *client,
|
||||
struct MODS_DEVICE_ALLOC_PAGES *p);
|
||||
int esc_mods_device_alloc_pages_2(struct file *fp,
|
||||
int esc_mods_device_alloc_pages_2(struct mods_client *client,
|
||||
struct MODS_DEVICE_ALLOC_PAGES_2 *p);
|
||||
int esc_mods_free_pages(struct file *fp, struct MODS_FREE_PAGES *p);
|
||||
int esc_mods_set_mem_type(struct file *fp, struct MODS_MEMORY_TYPE *p);
|
||||
int esc_mods_get_phys_addr(struct file *fp,
|
||||
int esc_mods_alloc_pages_2(struct mods_client *client,
|
||||
struct MODS_ALLOC_PAGES_2 *p);
|
||||
int esc_mods_free_pages(struct mods_client *client,
|
||||
struct MODS_FREE_PAGES *p);
|
||||
int esc_mods_set_mem_type(struct mods_client *client,
|
||||
struct MODS_MEMORY_TYPE *p);
|
||||
int esc_mods_get_phys_addr(struct mods_client *client,
|
||||
struct MODS_GET_PHYSICAL_ADDRESS *p);
|
||||
int esc_mods_get_phys_addr_2(struct file *fp,
|
||||
int esc_mods_get_phys_addr_2(struct mods_client *client,
|
||||
struct MODS_GET_PHYSICAL_ADDRESS_3 *p);
|
||||
int esc_mods_get_mapped_phys_addr(struct file *fp,
|
||||
int esc_mods_get_mapped_phys_addr(struct mods_client *client,
|
||||
struct MODS_GET_PHYSICAL_ADDRESS *p);
|
||||
int esc_mods_get_mapped_phys_addr_2(struct file *fp,
|
||||
int esc_mods_get_mapped_phys_addr_2(struct mods_client *client,
|
||||
struct MODS_GET_PHYSICAL_ADDRESS_2 *p);
|
||||
int esc_mods_get_mapped_phys_addr_3(struct file *fp,
|
||||
int esc_mods_get_mapped_phys_addr_3(struct mods_client *client,
|
||||
struct MODS_GET_PHYSICAL_ADDRESS_3 *p);
|
||||
int esc_mods_virtual_to_phys(struct file *fp,
|
||||
int esc_mods_virtual_to_phys(struct mods_client *client,
|
||||
struct MODS_VIRTUAL_TO_PHYSICAL *p);
|
||||
int esc_mods_phys_to_virtual(struct file *fp,
|
||||
int esc_mods_phys_to_virtual(struct mods_client *client,
|
||||
struct MODS_PHYSICAL_TO_VIRTUAL *p);
|
||||
int esc_mods_memory_barrier(struct file *fp);
|
||||
int esc_mods_dma_map_memory(struct file *fp,
|
||||
int esc_mods_memory_barrier(struct mods_client *client);
|
||||
int esc_mods_dma_map_memory(struct mods_client *client,
|
||||
struct MODS_DMA_MAP_MEMORY *p);
|
||||
int esc_mods_dma_unmap_memory(struct file *fp,
|
||||
int esc_mods_dma_unmap_memory(struct mods_client *client,
|
||||
struct MODS_DMA_MAP_MEMORY *p);
|
||||
|
||||
#if defined(CONFIG_PPC64)
|
||||
/* ppc64 */
|
||||
int esc_mods_set_ppc_tce_bypass(struct file *fp,
|
||||
int esc_mods_set_ppc_tce_bypass(struct mods_client *client,
|
||||
struct MODS_SET_PPC_TCE_BYPASS *p);
|
||||
int esc_mods_get_ats_address_range(struct file *fp,
|
||||
int esc_mods_get_ats_address_range(struct mods_client *client,
|
||||
struct MODS_GET_ATS_ADDRESS_RANGE *p);
|
||||
int esc_mods_set_nvlink_sysmem_trained(struct file *fp,
|
||||
int esc_mods_set_nvlink_sysmem_trained(struct mods_client *client,
|
||||
struct MODS_SET_NVLINK_SYSMEM_TRAINED *p);
|
||||
int esc_mods_get_nvlink_line_rate(struct file *fp,
|
||||
int esc_mods_get_nvlink_line_rate(struct mods_client *client,
|
||||
struct MODS_GET_NVLINK_LINE_RATE *p);
|
||||
#endif
|
||||
|
||||
/* acpi */
|
||||
#ifdef CONFIG_ACPI
|
||||
int esc_mods_eval_acpi_method(struct file *fp,
|
||||
int esc_mods_eval_acpi_method(struct mods_client *client,
|
||||
struct MODS_EVAL_ACPI_METHOD *p);
|
||||
int esc_mods_eval_dev_acpi_method(struct file *fp,
|
||||
int esc_mods_eval_dev_acpi_method(struct mods_client *client,
|
||||
struct MODS_EVAL_DEV_ACPI_METHOD *p);
|
||||
int esc_mods_eval_dev_acpi_method_2(struct file *fp,
|
||||
int esc_mods_eval_dev_acpi_method_2(struct mods_client *client,
|
||||
struct MODS_EVAL_DEV_ACPI_METHOD_2 *p);
|
||||
int esc_mods_eval_dev_acpi_method_3(struct file *fp,
|
||||
int esc_mods_eval_dev_acpi_method_3(struct mods_client *client,
|
||||
struct MODS_EVAL_DEV_ACPI_METHOD_3 *p);
|
||||
int esc_mods_acpi_get_ddc(struct file *fp, struct MODS_ACPI_GET_DDC *p);
|
||||
int esc_mods_acpi_get_ddc_2(struct file *fp, struct MODS_ACPI_GET_DDC_2 *p);
|
||||
int esc_mods_acpi_get_ddc(struct mods_client *client,
|
||||
struct MODS_ACPI_GET_DDC *p);
|
||||
int esc_mods_acpi_get_ddc_2(struct mods_client *client,
|
||||
struct MODS_ACPI_GET_DDC_2 *p);
|
||||
#endif
|
||||
/* pci */
|
||||
#ifdef CONFIG_PCI
|
||||
int esc_mods_find_pci_dev(struct file *fp, struct MODS_FIND_PCI_DEVICE *p);
|
||||
int esc_mods_find_pci_dev_2(struct file *fp,
|
||||
int esc_mods_find_pci_dev(struct mods_client *client,
|
||||
struct MODS_FIND_PCI_DEVICE *p);
|
||||
int esc_mods_find_pci_dev_2(struct mods_client *client,
|
||||
struct MODS_FIND_PCI_DEVICE_2 *p);
|
||||
int esc_mods_find_pci_class_code(struct file *fp,
|
||||
int esc_mods_find_pci_class_code(struct mods_client *client,
|
||||
struct MODS_FIND_PCI_CLASS_CODE *p);
|
||||
int esc_mods_find_pci_class_code_2(struct file *fp,
|
||||
int esc_mods_find_pci_class_code_2(struct mods_client *client,
|
||||
struct MODS_FIND_PCI_CLASS_CODE_2 *p);
|
||||
int esc_mods_pci_get_bar_info(struct file *fp, struct MODS_PCI_GET_BAR_INFO *p);
|
||||
int esc_mods_pci_get_bar_info_2(struct file *fp,
|
||||
int esc_mods_pci_get_bar_info(struct mods_client *client,
|
||||
struct MODS_PCI_GET_BAR_INFO *p);
|
||||
int esc_mods_pci_get_bar_info_2(struct mods_client *client,
|
||||
struct MODS_PCI_GET_BAR_INFO_2 *p);
|
||||
int esc_mods_pci_get_irq(struct file *fp, struct MODS_PCI_GET_IRQ *p);
|
||||
int esc_mods_pci_get_irq_2(struct file *fp,
|
||||
int esc_mods_pci_get_irq(struct mods_client *client,
|
||||
struct MODS_PCI_GET_IRQ *p);
|
||||
int esc_mods_pci_get_irq_2(struct mods_client *client,
|
||||
struct MODS_PCI_GET_IRQ_2 *p);
|
||||
int esc_mods_pci_read(struct file *fp, struct MODS_PCI_READ *p);
|
||||
int esc_mods_pci_read_2(struct file *fp, struct MODS_PCI_READ_2 *p);
|
||||
int esc_mods_pci_write(struct file *fp, struct MODS_PCI_WRITE *p);
|
||||
int esc_mods_pci_write_2(struct file *fp, struct MODS_PCI_WRITE_2 *p);
|
||||
int esc_mods_pci_bus_add_dev(struct file *fp,
|
||||
int esc_mods_pci_read(struct mods_client *client, struct MODS_PCI_READ *p);
|
||||
int esc_mods_pci_read_2(struct mods_client *client, struct MODS_PCI_READ_2 *p);
|
||||
int esc_mods_pci_write(struct mods_client *client, struct MODS_PCI_WRITE *p);
|
||||
int esc_mods_pci_write_2(struct mods_client *client,
|
||||
struct MODS_PCI_WRITE_2 *p);
|
||||
int esc_mods_pci_bus_add_dev(struct mods_client *client,
|
||||
struct MODS_PCI_BUS_ADD_DEVICES *p);
|
||||
int esc_mods_pci_hot_reset(struct file *fp,
|
||||
int esc_mods_pci_bus_remove_dev(struct mods_client *client,
|
||||
struct MODS_PCI_BUS_REMOVE_DEV *p);
|
||||
int esc_mods_pci_hot_reset(struct mods_client *client,
|
||||
struct MODS_PCI_HOT_RESET *p);
|
||||
int esc_mods_pio_read(struct file *fp, struct MODS_PIO_READ *p);
|
||||
int esc_mods_pio_write(struct file *fp, struct MODS_PIO_WRITE *p);
|
||||
int esc_mods_device_numa_info(struct file *fp,
|
||||
int esc_mods_pio_read(struct mods_client *client, struct MODS_PIO_READ *p);
|
||||
int esc_mods_pio_write(struct mods_client *client, struct MODS_PIO_WRITE *p);
|
||||
int esc_mods_device_numa_info(struct mods_client *client,
|
||||
struct MODS_DEVICE_NUMA_INFO *p);
|
||||
int esc_mods_device_numa_info_2(struct file *fp,
|
||||
int esc_mods_device_numa_info_2(struct mods_client *client,
|
||||
struct MODS_DEVICE_NUMA_INFO_2 *p);
|
||||
int esc_mods_get_iommu_state(struct file *pfile,
|
||||
int esc_mods_get_iommu_state(struct mods_client *client,
|
||||
struct MODS_GET_IOMMU_STATE *state);
|
||||
int esc_mods_get_iommu_state_2(struct file *pfile,
|
||||
int esc_mods_get_iommu_state_2(struct mods_client *client,
|
||||
struct MODS_GET_IOMMU_STATE *state);
|
||||
int esc_mods_pci_set_dma_mask(struct file *pfile,
|
||||
int esc_mods_pci_set_dma_mask(struct mods_client *client,
|
||||
struct MODS_PCI_DMA_MASK *dma_mask);
|
||||
#endif
|
||||
/* irq */
|
||||
#if defined(MODS_TEGRA) && defined(CONFIG_OF_IRQ) && defined(CONFIG_OF)
|
||||
int esc_mods_map_irq(struct file *fp, struct MODS_DT_INFO *p);
|
||||
int esc_mods_map_irq(struct mods_client *client, struct MODS_DT_INFO *p);
|
||||
#endif
|
||||
int esc_mods_register_irq(struct file *fp, struct MODS_REGISTER_IRQ *p);
|
||||
int esc_mods_register_irq_2(struct file *fp,
|
||||
int esc_mods_register_irq(struct mods_client *client,
|
||||
struct MODS_REGISTER_IRQ *p);
|
||||
int esc_mods_register_irq_2(struct mods_client *client,
|
||||
struct MODS_REGISTER_IRQ_2 *p);
|
||||
int esc_mods_register_irq_3(struct file *fp,
|
||||
int esc_mods_register_irq_3(struct mods_client *client,
|
||||
struct MODS_REGISTER_IRQ_3 *p);
|
||||
int esc_mods_unregister_irq(struct file *fp, struct MODS_REGISTER_IRQ *p);
|
||||
int esc_mods_unregister_irq_2(struct file *fp,
|
||||
int esc_mods_unregister_irq(struct mods_client *client,
|
||||
struct MODS_REGISTER_IRQ *p);
|
||||
int esc_mods_unregister_irq_2(struct mods_client *client,
|
||||
struct MODS_REGISTER_IRQ_2 *p);
|
||||
int esc_mods_query_irq(struct file *fp, struct MODS_QUERY_IRQ *p);
|
||||
int esc_mods_query_irq_2(struct file *fp, struct MODS_QUERY_IRQ_2 *p);
|
||||
int esc_mods_irq_handled(struct file *fp, struct MODS_REGISTER_IRQ *p);
|
||||
int esc_mods_irq_handled_2(struct file *fp,
|
||||
int esc_mods_query_irq(struct mods_client *client, struct MODS_QUERY_IRQ *p);
|
||||
int esc_mods_query_irq_2(struct mods_client *client,
|
||||
struct MODS_QUERY_IRQ_2 *p);
|
||||
int esc_mods_irq_handled(struct mods_client *client,
|
||||
struct MODS_REGISTER_IRQ *p);
|
||||
int esc_mods_irq_handled_2(struct mods_client *client,
|
||||
struct MODS_REGISTER_IRQ_2 *p);
|
||||
|
||||
int esc_mods_register_irq_4(struct file *fp,
|
||||
int esc_mods_register_irq_4(struct mods_client *client,
|
||||
struct MODS_REGISTER_IRQ_4 *p);
|
||||
int esc_mods_query_irq_3(struct file *fp, struct MODS_QUERY_IRQ_3 *p);
|
||||
int esc_mods_query_irq_3(struct mods_client *client,
|
||||
struct MODS_QUERY_IRQ_3 *p);
|
||||
|
||||
#ifdef MODS_TEGRA
|
||||
|
||||
/* clock */
|
||||
int esc_mods_get_clock_handle(struct file *fp,
|
||||
int esc_mods_get_clock_handle(struct mods_client *client,
|
||||
struct MODS_GET_CLOCK_HANDLE *p);
|
||||
int esc_mods_set_clock_rate(struct file *fp, struct MODS_CLOCK_RATE *p);
|
||||
int esc_mods_get_clock_rate(struct file *fp, struct MODS_CLOCK_RATE *p);
|
||||
int esc_mods_get_clock_max_rate(struct file *fp, struct MODS_CLOCK_RATE *p);
|
||||
int esc_mods_set_clock_max_rate(struct file *fp, struct MODS_CLOCK_RATE *p);
|
||||
int esc_mods_set_clock_parent(struct file *fp, struct MODS_CLOCK_PARENT *p);
|
||||
int esc_mods_get_clock_parent(struct file *fp, struct MODS_CLOCK_PARENT *p);
|
||||
int esc_mods_enable_clock(struct file *fp, struct MODS_CLOCK_HANDLE *p);
|
||||
int esc_mods_disable_clock(struct file *fp, struct MODS_CLOCK_HANDLE *p);
|
||||
int esc_mods_is_clock_enabled(struct file *fp,
|
||||
int esc_mods_set_clock_rate(struct mods_client *client,
|
||||
struct MODS_CLOCK_RATE *p);
|
||||
int esc_mods_get_clock_rate(struct mods_client *client,
|
||||
struct MODS_CLOCK_RATE *p);
|
||||
int esc_mods_get_clock_max_rate(struct mods_client *client,
|
||||
struct MODS_CLOCK_RATE *p);
|
||||
int esc_mods_set_clock_max_rate(struct mods_client *client,
|
||||
struct MODS_CLOCK_RATE *p);
|
||||
int esc_mods_set_clock_parent(struct mods_client *client,
|
||||
struct MODS_CLOCK_PARENT *p);
|
||||
int esc_mods_get_clock_parent(struct mods_client *client,
|
||||
struct MODS_CLOCK_PARENT *p);
|
||||
int esc_mods_enable_clock(struct mods_client *client,
|
||||
struct MODS_CLOCK_HANDLE *p);
|
||||
int esc_mods_disable_clock(struct mods_client *client,
|
||||
struct MODS_CLOCK_HANDLE *p);
|
||||
int esc_mods_is_clock_enabled(struct mods_client *client,
|
||||
struct MODS_CLOCK_ENABLED *p);
|
||||
int esc_mods_clock_reset_assert(struct file *fp,
|
||||
int esc_mods_clock_reset_assert(struct mods_client *client,
|
||||
struct MODS_CLOCK_HANDLE *p);
|
||||
int esc_mods_clock_reset_deassert(struct file *fp,
|
||||
int esc_mods_clock_reset_deassert(struct mods_client *client,
|
||||
struct MODS_CLOCK_HANDLE *p);
|
||||
int esc_mods_flush_cpu_cache_range(struct file *fp,
|
||||
int esc_mods_flush_cpu_cache_range(struct mods_client *client,
|
||||
struct MODS_FLUSH_CPU_CACHE_RANGE *p);
|
||||
int esc_mods_dma_alloc_coherent(struct file *fp,
|
||||
int esc_mods_dma_alloc_coherent(struct mods_client *client,
|
||||
struct MODS_DMA_COHERENT_MEM_HANDLE *p);
|
||||
int esc_mods_dma_free_coherent(struct file *fp,
|
||||
int esc_mods_dma_free_coherent(struct mods_client *client,
|
||||
struct MODS_DMA_COHERENT_MEM_HANDLE *p);
|
||||
int esc_mods_dma_copy_to_user(struct file *fp,
|
||||
int esc_mods_dma_copy_to_user(struct mods_client *client,
|
||||
struct MODS_DMA_COPY_TO_USER *p);
|
||||
|
||||
#ifdef CONFIG_DMA_ENGINE
|
||||
int esc_mods_dma_request_channel(struct file *fp, struct MODS_DMA_HANDLE *p);
|
||||
int esc_mods_dma_release_channel(struct file *fp, struct MODS_DMA_HANDLE *p);
|
||||
int esc_mods_dma_set_config(struct file *fp, struct MODS_DMA_CHANNEL_CONFIG *p);
|
||||
int esc_mods_dma_wait(struct file *fp, struct MODS_DMA_WAIT_DESC *p);
|
||||
int esc_mods_dma_submit_request(struct file *fp,
|
||||
int esc_mods_dma_request_channel(struct mods_client *client,
|
||||
struct MODS_DMA_HANDLE *p);
|
||||
int esc_mods_dma_release_channel(struct mods_client *client,
|
||||
struct MODS_DMA_HANDLE *p);
|
||||
int esc_mods_dma_set_config(struct mods_client *client,
|
||||
struct MODS_DMA_CHANNEL_CONFIG *p);
|
||||
int esc_mods_dma_wait(struct mods_client *client, struct MODS_DMA_WAIT_DESC *p);
|
||||
int esc_mods_dma_submit_request(struct mods_client *client,
|
||||
struct MODS_DMA_TX_DESC *p);
|
||||
int esc_mods_dma_async_issue_pending(struct file *fp,
|
||||
struct MODS_DMA_HANDLE *p);
|
||||
int esc_mods_dma_async_issue_pending(struct mods_client *client,
|
||||
struct MODS_DMA_HANDLE *p);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_TEGRA_DC
|
||||
int esc_mods_tegra_dc_config_possible(struct file *fp,
|
||||
struct MODS_TEGRA_DC_CONFIG_POSSIBLE *p);
|
||||
int esc_mods_tegra_dc_config_possible(struct mods_client *client,
|
||||
struct MODS_TEGRA_DC_CONFIG_POSSIBLE *p);
|
||||
#endif
|
||||
|
||||
#ifdef MODS_HAS_NET
|
||||
int esc_mods_net_force_link(struct file *fp, struct MODS_NET_DEVICE_NAME *p);
|
||||
int esc_mods_net_force_link(struct mods_client *client,
|
||||
struct MODS_NET_DEVICE_NAME *p);
|
||||
#endif
|
||||
|
||||
#ifdef MODS_HAS_DMABUF
|
||||
int esc_mods_dmabuf_get_phys_addr(struct file *fp,
|
||||
int esc_mods_dmabuf_get_phys_addr(struct mods_client *client,
|
||||
struct MODS_DMABUF_GET_PHYSICAL_ADDRESS *p);
|
||||
#else
|
||||
static inline int esc_mods_dmabuf_get_phys_addr(struct file *fp,
|
||||
static inline int esc_mods_dmabuf_get_phys_addr(struct mods_client *client,
|
||||
struct MODS_DMABUF_GET_PHYSICAL_ADDRESS *p)
|
||||
{ return -EINVAL; }
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_TEGRA_NVADSP
|
||||
int esc_mods_adsp_load(struct file *fp);
|
||||
int esc_mods_adsp_start(struct file *fp);
|
||||
int esc_mods_adsp_stop(struct file *fp);
|
||||
int esc_mods_adsp_run_app(struct file *fp, struct MODS_ADSP_RUN_APP_INFO *p);
|
||||
int esc_mods_adsp_load(struct mods_client *client);
|
||||
int esc_mods_adsp_start(struct mods_client *client);
|
||||
int esc_mods_adsp_stop(struct mods_client *client);
|
||||
int esc_mods_adsp_run_app(struct mods_client *client,
|
||||
struct MODS_ADSP_RUN_APP_INFO *p);
|
||||
#endif
|
||||
|
||||
/* prod */
|
||||
int mods_tegra_prod_init(const struct miscdevice *misc_dev);
|
||||
int esc_mods_tegra_prod_iterate_dt(struct file *fp,
|
||||
int esc_mods_tegra_prod_iterate_dt(struct mods_client *client,
|
||||
struct MODS_TEGRA_PROD_ITERATOR *iterator);
|
||||
int esc_mods_tegra_prod_is_supported(struct file *fp,
|
||||
int esc_mods_tegra_prod_is_supported(struct mods_client *client,
|
||||
struct MODS_TEGRA_PROD_IS_SUPPORTED *tuple);
|
||||
int esc_mods_tegra_prod_set_prod_all(struct file *fp,
|
||||
int esc_mods_tegra_prod_set_prod_all(struct mods_client *client,
|
||||
struct MODS_TEGRA_PROD_SET_TUPLE *tuple);
|
||||
int esc_mods_tegra_prod_set_prod_boot(struct file *fp,
|
||||
int esc_mods_tegra_prod_set_prod_boot(struct mods_client *client,
|
||||
struct MODS_TEGRA_PROD_SET_TUPLE *tuple);
|
||||
int esc_mods_tegra_prod_set_prod_by_name(struct file *fp,
|
||||
int esc_mods_tegra_prod_set_prod_by_name(struct mods_client *client,
|
||||
struct MODS_TEGRA_PROD_SET_TUPLE *tuple);
|
||||
int esc_mods_tegra_prod_set_prod_exact(struct file *fp,
|
||||
int esc_mods_tegra_prod_set_prod_exact(struct mods_client *client,
|
||||
struct MODS_TEGRA_PROD_SET_TUPLE *tuple);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
* mods_irq.c - This file is part of NVIDIA MODS kernel driver.
|
||||
*
|
||||
* Copyright (c) 2008-2018, NVIDIA CORPORATION. All rights reserved.
|
||||
* Copyright (c) 2008-2019, NVIDIA CORPORATION. All rights reserved.
|
||||
*
|
||||
* NVIDIA MODS kernel driver is free software: you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License,
|
||||
@@ -56,8 +56,9 @@ struct mutex *mods_get_irq_mutex(void)
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PCI
|
||||
struct en_dev_entry *mods_enable_device(struct mods_client *client,
|
||||
struct pci_dev *dev)
|
||||
int mods_enable_device(struct mods_client *client,
|
||||
struct pci_dev *dev,
|
||||
struct en_dev_entry **dev_entry)
|
||||
{
|
||||
int err = OK;
|
||||
struct en_dev_entry *dpriv = client->enabled_devices;
|
||||
@@ -66,8 +67,11 @@ struct en_dev_entry *mods_enable_device(struct mods_client *client,
|
||||
|
||||
dpriv = pci_get_drvdata(dev);
|
||||
if (unlikely(dpriv)) {
|
||||
if (dpriv->client_id == client->client_id)
|
||||
return dpriv;
|
||||
if (dpriv->client_id == client->client_id) {
|
||||
if (dev_entry)
|
||||
*dev_entry = dpriv;
|
||||
return OK;
|
||||
}
|
||||
|
||||
mods_error_printk("invalid client %u for device %04x:%02x:%02x.%x\n",
|
||||
client->client_id,
|
||||
@@ -75,12 +79,13 @@ struct en_dev_entry *mods_enable_device(struct mods_client *client,
|
||||
dev->bus->number,
|
||||
PCI_SLOT(dev->devfn),
|
||||
PCI_FUNC(dev->devfn));
|
||||
return 0;
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
dpriv = kzalloc(sizeof(*dpriv), GFP_KERNEL | __GFP_NORETRY);
|
||||
if (unlikely(!dpriv))
|
||||
return 0;
|
||||
return -ENOMEM;
|
||||
atomic_inc(&client->num_allocs);
|
||||
|
||||
err = pci_enable_device(dev);
|
||||
if (unlikely(err)) {
|
||||
@@ -90,7 +95,8 @@ struct en_dev_entry *mods_enable_device(struct mods_client *client,
|
||||
PCI_SLOT(dev->devfn),
|
||||
PCI_FUNC(dev->devfn));
|
||||
kfree(dpriv);
|
||||
return 0;
|
||||
atomic_dec(&client->num_allocs);
|
||||
return err;
|
||||
}
|
||||
|
||||
dpriv->client_id = client->client_id;
|
||||
@@ -99,7 +105,9 @@ struct en_dev_entry *mods_enable_device(struct mods_client *client,
|
||||
client->enabled_devices = dpriv;
|
||||
pci_set_drvdata(dev, dpriv);
|
||||
|
||||
return dpriv;
|
||||
if (dev_entry)
|
||||
*dev_entry = dpriv;
|
||||
return OK;
|
||||
}
|
||||
|
||||
void mods_disable_device(struct pci_dev *dev)
|
||||
@@ -200,21 +208,26 @@ static const char *mods_irq_type_name(u8 irq_type)
|
||||
}
|
||||
#endif
|
||||
|
||||
static struct mods_client *client_from_id(u8 client_id)
|
||||
{
|
||||
return &mp.clients[client_id - 1];
|
||||
}
|
||||
|
||||
static void wake_up_client(struct dev_irq_map *t)
|
||||
{
|
||||
struct mods_client *client = &mp.clients[t->client_id - 1];
|
||||
struct mods_client *client = client_from_id(t->client_id);
|
||||
|
||||
if (client)
|
||||
wake_up_interruptible(&client->interrupt_event);
|
||||
}
|
||||
|
||||
static int rec_irq_done(struct dev_irq_map *t,
|
||||
unsigned int irq_time)
|
||||
unsigned int irq_time)
|
||||
{
|
||||
struct irq_q_info *q;
|
||||
|
||||
/* Get interrupt queue */
|
||||
q = &mp.clients[t->client_id - 1].irq_queue;
|
||||
q = &client_from_id(t->client_id)->irq_queue;
|
||||
|
||||
/* Don't do anything if the IRQ has already been recorded */
|
||||
if (q->head != q->tail) {
|
||||
@@ -266,11 +279,7 @@ static int rec_irq_done(struct dev_irq_map *t,
|
||||
}
|
||||
|
||||
/* mods_irq_handle - interrupt function */
|
||||
static irqreturn_t mods_irq_handle(int irq, void *data
|
||||
#ifndef MODS_IRQ_HANDLE_NO_REGS
|
||||
, struct pt_regs *regs
|
||||
#endif
|
||||
)
|
||||
static irqreturn_t mods_irq_handle(int irq, void *data)
|
||||
{
|
||||
struct dev_irq_map *t = (struct dev_irq_map *)data;
|
||||
int serviced = false;
|
||||
@@ -285,7 +294,7 @@ static irqreturn_t mods_irq_handle(int irq, void *data
|
||||
unsigned long flags = 0;
|
||||
int recorded = false;
|
||||
unsigned int irq_time = get_cur_time();
|
||||
struct mods_client *client = &mp.clients[t->client_id - 1];
|
||||
struct mods_client *client = client_from_id(t->client_id);
|
||||
|
||||
spin_lock_irqsave(&client->irq_lock, flags);
|
||||
|
||||
@@ -319,25 +328,25 @@ static int mods_lookup_cpu_irq(u8 client_id, unsigned int irq)
|
||||
|
||||
LOG_ENT();
|
||||
|
||||
for (client_idx = 0; client_idx < MODS_MAX_CLIENTS; client_idx++) {
|
||||
for (client_idx = 1; client_idx <= MODS_MAX_CLIENTS; client_idx++) {
|
||||
struct dev_irq_map *t = NULL;
|
||||
struct dev_irq_map *next = NULL;
|
||||
|
||||
list_for_each_entry_safe(t,
|
||||
next,
|
||||
&mp.clients[client_idx].irq_list,
|
||||
&client_from_id(client_idx)->irq_list,
|
||||
list) {
|
||||
|
||||
if (t->apic_irq == irq) {
|
||||
if (client_id == 0) {
|
||||
ret = IRQ_FOUND;
|
||||
} else {
|
||||
ret = (client_id == client_idx + 1)
|
||||
? IRQ_FOUND : IRQ_NOT_FOUND;
|
||||
ret = (client_id == client_idx)
|
||||
? IRQ_FOUND : IRQ_NOT_FOUND;
|
||||
}
|
||||
|
||||
/* Break out of the outer loop */
|
||||
client_idx = MODS_MAX_CLIENTS;
|
||||
client_idx = MODS_MAX_CLIENTS - 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -396,7 +405,7 @@ static void setup_mask_info(struct dev_irq_map *newmap,
|
||||
}
|
||||
#endif
|
||||
|
||||
static int add_irq_map(u8 client_id,
|
||||
static int add_irq_map(struct mods_client *client,
|
||||
struct pci_dev *dev,
|
||||
struct MODS_REGISTER_IRQ_4 *p,
|
||||
u32 irq,
|
||||
@@ -413,11 +422,12 @@ static int add_irq_map(u8 client_id,
|
||||
LOG_EXT();
|
||||
return -ENOMEM;
|
||||
}
|
||||
atomic_inc(&client->num_allocs);
|
||||
|
||||
/* Fill out the new entry */
|
||||
newmap->apic_irq = irq;
|
||||
newmap->dev = dev;
|
||||
newmap->client_id = client_id;
|
||||
newmap->client_id = client->client_id;
|
||||
newmap->dev_irq_aperture = 0;
|
||||
newmap->mask_info_cnt = 0;
|
||||
newmap->type = irq_type;
|
||||
@@ -432,12 +442,13 @@ static int add_irq_map(u8 client_id,
|
||||
newmap)) {
|
||||
mods_error_printk("unable to enable IRQ 0x%x\n", irq);
|
||||
kfree(newmap);
|
||||
atomic_dec(&client->num_allocs);
|
||||
LOG_EXT();
|
||||
return -EPERM;
|
||||
}
|
||||
|
||||
/* Add the new entry to the list of all registered interrupts */
|
||||
list_add(&newmap->list, &mp.clients[client_id - 1].irq_list);
|
||||
list_add(&newmap->list, &client->irq_list);
|
||||
|
||||
#ifdef CONFIG_PCI
|
||||
/* Map BAR0 to be able to disable interrupts */
|
||||
@@ -520,7 +531,7 @@ static int add_irq_map(u8 client_id,
|
||||
static void mods_free_map(struct dev_irq_map *del)
|
||||
{
|
||||
unsigned long flags = 0;
|
||||
struct mods_client *client = &mp.clients[del->client_id - 1];
|
||||
struct mods_client *client = client_from_id(del->client_id);
|
||||
|
||||
LOG_ENT();
|
||||
|
||||
@@ -542,6 +553,7 @@ static void mods_free_map(struct dev_irq_map *del)
|
||||
|
||||
/* Free memory */
|
||||
kfree(del);
|
||||
atomic_dec(&client->num_allocs);
|
||||
|
||||
LOG_EXT();
|
||||
}
|
||||
@@ -563,7 +575,7 @@ void mods_cleanup_irq(void)
|
||||
|
||||
LOG_ENT();
|
||||
for (i = 0; i < MODS_MAX_CLIENTS; i++) {
|
||||
if (mp.client_flags && (1 << i))
|
||||
if (mp.client_flags & (1 << i))
|
||||
mods_free_client(i + 1);
|
||||
}
|
||||
LOG_EXT();
|
||||
@@ -571,7 +583,7 @@ void mods_cleanup_irq(void)
|
||||
|
||||
int mods_irq_event_check(u8 client_id)
|
||||
{
|
||||
struct irq_q_info *q = &mp.clients[client_id - 1].irq_queue;
|
||||
struct irq_q_info *q = &client_from_id(client_id)->irq_queue;
|
||||
unsigned int pos = (1 << (client_id - 1));
|
||||
|
||||
if (!(mp.client_flags & pos))
|
||||
@@ -585,7 +597,7 @@ int mods_irq_event_check(u8 client_id)
|
||||
|
||||
struct mods_client *mods_alloc_client(void)
|
||||
{
|
||||
u8 idx = 0;
|
||||
u8 idx;
|
||||
u8 max_clients = 1;
|
||||
|
||||
LOG_ENT();
|
||||
@@ -594,17 +606,17 @@ struct mods_client *mods_alloc_client(void)
|
||||
(mods_get_access_token() != MODS_ACCESS_TOKEN_NONE))
|
||||
max_clients = MODS_MAX_CLIENTS;
|
||||
|
||||
for (idx = 0; idx < max_clients; idx++) {
|
||||
if (!test_and_set_bit(idx, &mp.client_flags)) {
|
||||
struct mods_client *client = &mp.clients[idx];
|
||||
for (idx = 1; idx <= max_clients; idx++) {
|
||||
if (!test_and_set_bit(idx - 1, &mp.client_flags)) {
|
||||
struct mods_client *client = client_from_id(idx);
|
||||
|
||||
mods_debug_printk(DEBUG_IOCTL,
|
||||
"open client %u (bit mask 0x%lx)\n",
|
||||
(unsigned int)(idx + 1),
|
||||
(unsigned int)idx,
|
||||
mp.client_flags);
|
||||
|
||||
memset(client, 0, sizeof(*client));
|
||||
client->client_id = idx + 1;
|
||||
client->client_id = idx;
|
||||
client->access_token = MODS_ACCESS_TOKEN_NONE;
|
||||
mutex_init(&client->mtx);
|
||||
spin_lock_init(&client->irq_lock);
|
||||
@@ -612,6 +624,7 @@ struct mods_client *mods_alloc_client(void)
|
||||
INIT_LIST_HEAD(&client->irq_list);
|
||||
INIT_LIST_HEAD(&client->mem_alloc_list);
|
||||
INIT_LIST_HEAD(&client->mem_map_list);
|
||||
INIT_LIST_HEAD(&client->free_mem_list);
|
||||
#if defined(CONFIG_PPC64)
|
||||
INIT_LIST_HEAD(&client->ppc_tce_bypass_list);
|
||||
INIT_LIST_HEAD(&client->nvlink_sysmem_trained_list);
|
||||
@@ -629,7 +642,7 @@ struct mods_client *mods_alloc_client(void)
|
||||
static int mods_free_irqs(u8 client_id, struct pci_dev *dev)
|
||||
{
|
||||
#ifdef CONFIG_PCI
|
||||
struct mods_client *client = &mp.clients[client_id - 1];
|
||||
struct mods_client *client = client_from_id(client_id);
|
||||
struct dev_irq_map *del = NULL;
|
||||
struct dev_irq_map *next;
|
||||
struct en_dev_entry *dpriv;
|
||||
@@ -650,9 +663,9 @@ static int mods_free_irqs(u8 client_id, struct pci_dev *dev)
|
||||
return OK;
|
||||
}
|
||||
|
||||
if (dpriv->client_id != client_id) {
|
||||
if (dpriv->client_id != client->client_id) {
|
||||
mods_error_printk("invalid client %u for device %04x:%02x:%02x.%x\n",
|
||||
client_id,
|
||||
client->client_id,
|
||||
pci_domain_nr(dev->bus),
|
||||
dev->bus->number,
|
||||
PCI_SLOT(dev->devfn),
|
||||
@@ -701,6 +714,8 @@ static int mods_free_irqs(u8 client_id, struct pci_dev *dev)
|
||||
if (irq_type == MODS_IRQ_TYPE_MSIX) {
|
||||
pci_disable_msix(dev);
|
||||
kfree(dpriv->msix_entries);
|
||||
if (dpriv->msix_entries)
|
||||
atomic_dec(&client->num_allocs);
|
||||
dpriv->msix_entries = 0;
|
||||
} else if (irq_type == MODS_IRQ_TYPE_MSI) {
|
||||
pci_disable_msi(dev);
|
||||
@@ -733,7 +748,7 @@ void mods_free_client_interrupts(struct mods_client *client)
|
||||
|
||||
void mods_free_client(u8 client_id)
|
||||
{
|
||||
struct mods_client *client = &mp.clients[client_id - 1];
|
||||
struct mods_client *client = client_from_id(client_id);
|
||||
|
||||
LOG_ENT();
|
||||
|
||||
@@ -748,12 +763,14 @@ void mods_free_client(u8 client_id)
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PCI
|
||||
static int mods_allocate_irqs(u8 client_id, struct file *pfile,
|
||||
struct pci_dev *dev, u32 nvecs, u32 flags)
|
||||
static int mods_allocate_irqs(struct mods_client *client,
|
||||
struct pci_dev *dev,
|
||||
u32 nvecs,
|
||||
u32 flags)
|
||||
{
|
||||
struct mods_client *client = pfile->private_data;
|
||||
struct en_dev_entry *dpriv;
|
||||
unsigned int irq_type = MODS_IRQ_TYPE_FROM_FLAGS(flags);
|
||||
int err = OK;
|
||||
|
||||
LOG_ENT();
|
||||
|
||||
@@ -776,10 +793,11 @@ static int mods_allocate_irqs(u8 client_id, struct file *pfile,
|
||||
PCI_SLOT(dev->devfn),
|
||||
PCI_FUNC(dev->devfn));
|
||||
LOG_EXT();
|
||||
return -EINVAL;
|
||||
return -ENOENT;
|
||||
}
|
||||
#else
|
||||
mods_error_printk("the kernel does not support MSI!\n");
|
||||
LOG_EXT();
|
||||
return -EINVAL;
|
||||
#endif
|
||||
} else if (irq_type == MODS_IRQ_TYPE_MSIX) {
|
||||
@@ -791,25 +809,26 @@ static int mods_allocate_irqs(u8 client_id, struct file *pfile,
|
||||
PCI_SLOT(dev->devfn),
|
||||
PCI_FUNC(dev->devfn));
|
||||
LOG_EXT();
|
||||
return -EINVAL;
|
||||
return -ENOENT;
|
||||
}
|
||||
#else
|
||||
mods_error_printk("the kernel does not support MSI-X!\n");
|
||||
LOG_EXT();
|
||||
return -EINVAL;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Enable device on the PCI bus */
|
||||
dpriv = mods_enable_device(client, dev);
|
||||
if (!dpriv) {
|
||||
err = mods_enable_device(client, dev, &dpriv);
|
||||
if (err) {
|
||||
LOG_EXT();
|
||||
return -EINVAL;
|
||||
return err;
|
||||
}
|
||||
|
||||
if (irq_type == MODS_IRQ_TYPE_INT) {
|
||||
/* use legacy irq */
|
||||
if (nvecs != 1) {
|
||||
mods_error_printk("INTA: only 1 INTA vector supported requested %d!\n",
|
||||
mods_error_printk("INTA: only 1 INTA vector supported, requested %u!\n",
|
||||
nvecs);
|
||||
LOG_EXT();
|
||||
return -EINVAL;
|
||||
@@ -820,19 +839,20 @@ static int mods_allocate_irqs(u8 client_id, struct file *pfile,
|
||||
#ifdef CONFIG_PCI_MSI
|
||||
else if (irq_type == MODS_IRQ_TYPE_MSI) {
|
||||
if (nvecs != 1) {
|
||||
mods_error_printk("MSI: only 1 MSI vector supported requested %d!\n",
|
||||
mods_error_printk("MSI: only 1 MSI vector supported, requested %u!\n",
|
||||
nvecs);
|
||||
LOG_EXT();
|
||||
return -EINVAL;
|
||||
}
|
||||
if (pci_enable_msi(dev) != 0) {
|
||||
err = pci_enable_msi(dev);
|
||||
if (err) {
|
||||
mods_error_printk("unable to enable MSI on dev %04x:%02x:%02x.%x\n",
|
||||
pci_domain_nr(dev->bus),
|
||||
dev->bus->number,
|
||||
PCI_SLOT(dev->devfn),
|
||||
PCI_FUNC(dev->devfn));
|
||||
LOG_EXT();
|
||||
return -EINVAL;
|
||||
return err;
|
||||
}
|
||||
dpriv->nvecs = 1;
|
||||
} else if (irq_type == MODS_IRQ_TYPE_MSIX) {
|
||||
@@ -848,6 +868,7 @@ static int mods_allocate_irqs(u8 client_id, struct file *pfile,
|
||||
LOG_EXT();
|
||||
return -ENOMEM;
|
||||
}
|
||||
atomic_inc(&client->num_allocs);
|
||||
|
||||
for (i = 0; i < nvecs; i++)
|
||||
entries[i].entry = (uint16_t)i;
|
||||
@@ -863,6 +884,7 @@ static int mods_allocate_irqs(u8 client_id, struct file *pfile,
|
||||
"could not allocate the requested number of MSI-X vectors=%d return=%d!\n",
|
||||
nvecs, cnt);
|
||||
kfree(entries);
|
||||
atomic_dec(&client->num_allocs);
|
||||
LOG_EXT();
|
||||
return cnt;
|
||||
}
|
||||
@@ -879,6 +901,7 @@ static int mods_allocate_irqs(u8 client_id, struct file *pfile,
|
||||
"could not allocate the requested number of MSI-X vectors=%d return=%d!\n",
|
||||
nvecs, cnt);
|
||||
kfree(entries);
|
||||
atomic_dec(&client->num_allocs);
|
||||
LOG_EXT();
|
||||
if (cnt > 0)
|
||||
cnt = -ENOSPC;
|
||||
@@ -909,32 +932,23 @@ static int mods_allocate_irqs(u8 client_id, struct file *pfile,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
dpriv->client_id = client_id;
|
||||
dpriv->client_id = client->client_id;
|
||||
dpriv->irq_flags = flags;
|
||||
LOG_EXT();
|
||||
return OK;
|
||||
}
|
||||
|
||||
static int mods_register_pci_irq(struct file *pfile,
|
||||
static int mods_register_pci_irq(struct mods_client *client,
|
||||
struct MODS_REGISTER_IRQ_4 *p)
|
||||
{
|
||||
int err = OK;
|
||||
unsigned int irq_type = MODS_IRQ_TYPE_FROM_FLAGS(p->irq_flags);
|
||||
struct pci_dev *dev;
|
||||
struct en_dev_entry *dpriv;
|
||||
u8 client_id;
|
||||
int i;
|
||||
|
||||
LOG_ENT();
|
||||
|
||||
/* Identify the caller */
|
||||
client_id = get_client_id(pfile);
|
||||
if (unlikely(!is_client_id_valid(client_id))) {
|
||||
WARN_ON(!is_client_id_valid(client_id));
|
||||
LOG_EXT();
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (unlikely(!p->irq_count)) {
|
||||
mods_error_printk("no irq's requested!\n");
|
||||
LOG_EXT();
|
||||
@@ -942,7 +956,7 @@ static int mods_register_pci_irq(struct file *pfile,
|
||||
}
|
||||
|
||||
/* Get the PCI device structure for the specified device from kernel */
|
||||
err = mods_find_pci_dev(pfile, &p->dev, &dev);
|
||||
err = mods_find_pci_dev(client, &p->dev, &dev);
|
||||
if (unlikely(err)) {
|
||||
if (err == -ENODEV)
|
||||
mods_error_printk("PCI device %04x:%02x:%02x.%x not found\n",
|
||||
@@ -962,7 +976,7 @@ static int mods_register_pci_irq(struct file *pfile,
|
||||
|
||||
dpriv = pci_get_drvdata(dev);
|
||||
if (dpriv) {
|
||||
if (dpriv->client_id != client_id) {
|
||||
if (dpriv->client_id != client->client_id) {
|
||||
mods_error_printk("dev %04x:%02x:%02x.%x already owned by client %u\n",
|
||||
p->dev.domain,
|
||||
p->dev.bus,
|
||||
@@ -972,7 +986,7 @@ static int mods_register_pci_irq(struct file *pfile,
|
||||
mutex_unlock(&mp.mtx);
|
||||
pci_dev_put(dev);
|
||||
LOG_EXT();
|
||||
return -EINVAL;
|
||||
return -EBUSY;
|
||||
}
|
||||
if (dpriv->nvecs) {
|
||||
mods_error_printk("interrupt for dev %04x:%02x:%02x.%x already registered\n",
|
||||
@@ -987,14 +1001,15 @@ static int mods_register_pci_irq(struct file *pfile,
|
||||
}
|
||||
}
|
||||
|
||||
if (mods_allocate_irqs(client_id, pfile, dev, p->irq_count,
|
||||
p->irq_flags)) {
|
||||
err = mods_allocate_irqs(client, dev, p->irq_count,
|
||||
p->irq_flags);
|
||||
if (err) {
|
||||
mods_error_printk("could not allocate irqs for irq_type %d\n",
|
||||
irq_type);
|
||||
mutex_unlock(&mp.mtx);
|
||||
pci_dev_put(dev);
|
||||
LOG_EXT();
|
||||
return -EINVAL;
|
||||
return err;
|
||||
}
|
||||
|
||||
dpriv = pci_get_drvdata(dev);
|
||||
@@ -1004,7 +1019,7 @@ static int mods_register_pci_irq(struct file *pfile,
|
||||
(irq_type == MODS_IRQ_TYPE_MSI)) ? dev->irq :
|
||||
dpriv->msix_entries[i].vector;
|
||||
|
||||
err = add_irq_map(client_id, dev, p, irq, i);
|
||||
err = add_irq_map(client, dev, p, irq, i);
|
||||
if (unlikely(err)) {
|
||||
#ifdef CONFIG_PCI_MSI
|
||||
if (irq_type == MODS_IRQ_TYPE_MSI)
|
||||
@@ -1023,23 +1038,14 @@ static int mods_register_pci_irq(struct file *pfile,
|
||||
}
|
||||
#endif /* CONFIG_PCI */
|
||||
|
||||
static int mods_register_cpu_irq(struct file *pfile,
|
||||
static int mods_register_cpu_irq(struct mods_client *client,
|
||||
struct MODS_REGISTER_IRQ_4 *p)
|
||||
{
|
||||
u8 client_id;
|
||||
u32 irq = p->dev.bus;
|
||||
int err;
|
||||
|
||||
LOG_ENT();
|
||||
|
||||
/* Identify the caller */
|
||||
client_id = get_client_id(pfile);
|
||||
if (unlikely(!is_client_id_valid(client_id))) {
|
||||
WARN_ON(!is_client_id_valid(client_id));
|
||||
LOG_EXT();
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (unlikely(mutex_lock_interruptible(&mp.mtx))) {
|
||||
LOG_EXT();
|
||||
return -EINTR;
|
||||
@@ -1055,7 +1061,7 @@ static int mods_register_cpu_irq(struct file *pfile,
|
||||
}
|
||||
|
||||
/* Register interrupt */
|
||||
err = add_irq_map(client_id, 0, p, irq, 0);
|
||||
err = add_irq_map(client, 0, p, irq, 0);
|
||||
|
||||
mutex_unlock(&mp.mtx);
|
||||
LOG_EXT();
|
||||
@@ -1063,31 +1069,22 @@ static int mods_register_cpu_irq(struct file *pfile,
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PCI
|
||||
static int mods_unregister_pci_irq(struct file *pfile,
|
||||
static int mods_unregister_pci_irq(struct mods_client *client,
|
||||
struct MODS_REGISTER_IRQ_2 *p)
|
||||
{
|
||||
struct pci_dev *dev;
|
||||
u8 client_id;
|
||||
int err = OK;
|
||||
|
||||
LOG_ENT();
|
||||
|
||||
/* Identify the caller */
|
||||
client_id = get_client_id(pfile);
|
||||
if (unlikely(!is_client_id_valid(client_id))) {
|
||||
WARN_ON(!is_client_id_valid(client_id));
|
||||
LOG_EXT();
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* Get the PCI device structure for the specified device from kernel */
|
||||
err = mods_find_pci_dev(pfile, &p->dev, &dev);
|
||||
err = mods_find_pci_dev(client, &p->dev, &dev);
|
||||
if (unlikely(err)) {
|
||||
LOG_EXT();
|
||||
return err;
|
||||
}
|
||||
|
||||
err = mods_free_irqs(client_id, dev);
|
||||
err = mods_free_irqs(client->client_id, dev);
|
||||
|
||||
pci_dev_put(dev);
|
||||
LOG_EXT();
|
||||
@@ -1095,35 +1092,24 @@ static int mods_unregister_pci_irq(struct file *pfile,
|
||||
}
|
||||
#endif
|
||||
|
||||
static int mods_unregister_cpu_irq(struct file *pfile,
|
||||
static int mods_unregister_cpu_irq(struct mods_client *client,
|
||||
struct MODS_REGISTER_IRQ_2 *p)
|
||||
{
|
||||
struct dev_irq_map *del = NULL;
|
||||
struct dev_irq_map *next;
|
||||
unsigned int irq;
|
||||
u8 client_id;
|
||||
struct mods_client *client;
|
||||
|
||||
LOG_ENT();
|
||||
|
||||
irq = p->dev.bus;
|
||||
|
||||
/* Identify the caller */
|
||||
client_id = get_client_id(pfile);
|
||||
if (unlikely(!is_client_id_valid(client_id))) {
|
||||
WARN_ON(!is_client_id_valid(client_id));
|
||||
LOG_EXT();
|
||||
return -EINVAL;
|
||||
}
|
||||
client = &mp.clients[client_id = 1];
|
||||
|
||||
if (unlikely(mutex_lock_interruptible(&mp.mtx))) {
|
||||
LOG_EXT();
|
||||
return -EINTR;
|
||||
}
|
||||
|
||||
/* Determine if the interrupt is already hooked by this client */
|
||||
if (mods_lookup_cpu_irq(client_id, irq) == IRQ_NOT_FOUND) {
|
||||
if (mods_lookup_cpu_irq(client->client_id, irq) == IRQ_NOT_FOUND) {
|
||||
mods_error_printk(
|
||||
"IRQ 0x%x not hooked, can't unhook\n",
|
||||
irq);
|
||||
@@ -1159,22 +1145,22 @@ static int mods_unregister_cpu_irq(struct file *pfile,
|
||||
* ESCAPE CALL FUNCTIONS *
|
||||
*************************/
|
||||
|
||||
int esc_mods_register_irq_4(struct file *pfile,
|
||||
int esc_mods_register_irq_4(struct mods_client *client,
|
||||
struct MODS_REGISTER_IRQ_4 *p)
|
||||
{
|
||||
u32 irq_type = MODS_IRQ_TYPE_FROM_FLAGS(p->irq_flags);
|
||||
|
||||
if (irq_type == MODS_IRQ_TYPE_CPU)
|
||||
return mods_register_cpu_irq(pfile, p);
|
||||
return mods_register_cpu_irq(client, p);
|
||||
#ifdef CONFIG_PCI
|
||||
return mods_register_pci_irq(pfile, p);
|
||||
return mods_register_pci_irq(client, p);
|
||||
#else
|
||||
mods_error_printk("PCI not available\n");
|
||||
return -EINVAL;
|
||||
#endif
|
||||
}
|
||||
|
||||
int esc_mods_register_irq_3(struct file *pfile,
|
||||
int esc_mods_register_irq_3(struct mods_client *client,
|
||||
struct MODS_REGISTER_IRQ_3 *p)
|
||||
{
|
||||
struct MODS_REGISTER_IRQ_4 irq_data = { {0} };
|
||||
@@ -1202,10 +1188,10 @@ int esc_mods_register_irq_3(struct file *pfile,
|
||||
irq_data.irq_count = 1;
|
||||
irq_data.irq_flags = p->irq_type;
|
||||
|
||||
return esc_mods_register_irq_4(pfile, &irq_data);
|
||||
return esc_mods_register_irq_4(client, &irq_data);
|
||||
}
|
||||
|
||||
int esc_mods_register_irq_2(struct file *pfile,
|
||||
int esc_mods_register_irq_2(struct mods_client *client,
|
||||
struct MODS_REGISTER_IRQ_2 *p)
|
||||
{
|
||||
struct MODS_REGISTER_IRQ_4 irq_data = { {0} };
|
||||
@@ -1220,7 +1206,7 @@ int esc_mods_register_irq_2(struct file *pfile,
|
||||
struct pci_dev *dev;
|
||||
int err;
|
||||
|
||||
err = mods_find_pci_dev(pfile, &p->dev, &dev);
|
||||
err = mods_find_pci_dev(client, &p->dev, &dev);
|
||||
if (unlikely(err))
|
||||
return err;
|
||||
|
||||
@@ -1231,10 +1217,10 @@ int esc_mods_register_irq_2(struct file *pfile,
|
||||
}
|
||||
#endif
|
||||
|
||||
return esc_mods_register_irq_4(pfile, &irq_data);
|
||||
return esc_mods_register_irq_4(client, &irq_data);
|
||||
}
|
||||
|
||||
int esc_mods_register_irq(struct file *pfile,
|
||||
int esc_mods_register_irq(struct mods_client *client,
|
||||
struct MODS_REGISTER_IRQ *p)
|
||||
{
|
||||
struct MODS_REGISTER_IRQ_2 register_irq = { {0} };
|
||||
@@ -1245,39 +1231,38 @@ int esc_mods_register_irq(struct file *pfile,
|
||||
register_irq.dev.function = p->dev.function;
|
||||
register_irq.type = p->type;
|
||||
|
||||
return esc_mods_register_irq_2(pfile, ®ister_irq);
|
||||
return esc_mods_register_irq_2(client, ®ister_irq);
|
||||
}
|
||||
|
||||
int esc_mods_unregister_irq_2(struct file *pfile,
|
||||
int esc_mods_unregister_irq_2(struct mods_client *client,
|
||||
struct MODS_REGISTER_IRQ_2 *p)
|
||||
{
|
||||
if (p->type == MODS_IRQ_TYPE_CPU)
|
||||
return mods_unregister_cpu_irq(pfile, p);
|
||||
return mods_unregister_cpu_irq(client, p);
|
||||
#ifdef CONFIG_PCI
|
||||
return mods_unregister_pci_irq(pfile, p);
|
||||
return mods_unregister_pci_irq(client, p);
|
||||
#else
|
||||
return -EINVAL;
|
||||
#endif
|
||||
}
|
||||
|
||||
int esc_mods_unregister_irq(struct file *pfile,
|
||||
int esc_mods_unregister_irq(struct mods_client *client,
|
||||
struct MODS_REGISTER_IRQ *p)
|
||||
{
|
||||
struct MODS_REGISTER_IRQ_2 register_irq = { {0} };
|
||||
|
||||
register_irq.dev.domain = 0;
|
||||
register_irq.dev.bus = p->dev.bus;
|
||||
register_irq.dev.device = p->dev.device;
|
||||
register_irq.dev.function = p->dev.function;
|
||||
register_irq.type = p->type;
|
||||
register_irq.dev.domain = 0;
|
||||
register_irq.dev.bus = p->dev.bus;
|
||||
register_irq.dev.device = p->dev.device;
|
||||
register_irq.dev.function = p->dev.function;
|
||||
register_irq.type = p->type;
|
||||
|
||||
return esc_mods_unregister_irq_2(pfile, ®ister_irq);
|
||||
return esc_mods_unregister_irq_2(client, ®ister_irq);
|
||||
}
|
||||
|
||||
int esc_mods_query_irq_3(struct file *pfile, struct MODS_QUERY_IRQ_3 *p)
|
||||
int esc_mods_query_irq_3(struct mods_client *client,
|
||||
struct MODS_QUERY_IRQ_3 *p)
|
||||
{
|
||||
u8 client_id;
|
||||
struct mods_client *client;
|
||||
struct irq_q_info *q = NULL;
|
||||
unsigned int i = 0;
|
||||
unsigned long flags = 0;
|
||||
@@ -1285,15 +1270,6 @@ int esc_mods_query_irq_3(struct file *pfile, struct MODS_QUERY_IRQ_3 *p)
|
||||
|
||||
LOG_ENT();
|
||||
|
||||
/* Identify the caller */
|
||||
client_id = get_client_id(pfile);
|
||||
if (unlikely(!is_client_id_valid(client_id))) {
|
||||
WARN_ON(!is_client_id_valid(client_id));
|
||||
LOG_EXT();
|
||||
return -EINVAL;
|
||||
}
|
||||
client = &mp.clients[client_id - 1];
|
||||
|
||||
/* Clear return array */
|
||||
memset(p->irq_list, 0xFF, sizeof(p->irq_list));
|
||||
|
||||
@@ -1354,12 +1330,13 @@ int esc_mods_query_irq_3(struct file *pfile, struct MODS_QUERY_IRQ_3 *p)
|
||||
return OK;
|
||||
}
|
||||
|
||||
int esc_mods_query_irq_2(struct file *pfile, struct MODS_QUERY_IRQ_2 *p)
|
||||
int esc_mods_query_irq_2(struct mods_client *client,
|
||||
struct MODS_QUERY_IRQ_2 *p)
|
||||
{
|
||||
int retval, i;
|
||||
struct MODS_QUERY_IRQ_3 query_irq = { { { { 0 } } } };
|
||||
|
||||
retval = esc_mods_query_irq_3(pfile, &query_irq);
|
||||
retval = esc_mods_query_irq_3(client, &query_irq);
|
||||
if (retval)
|
||||
return retval;
|
||||
|
||||
@@ -1371,13 +1348,13 @@ int esc_mods_query_irq_2(struct file *pfile, struct MODS_QUERY_IRQ_2 *p)
|
||||
return OK;
|
||||
}
|
||||
|
||||
int esc_mods_query_irq(struct file *pfile,
|
||||
int esc_mods_query_irq(struct mods_client *client,
|
||||
struct MODS_QUERY_IRQ *p)
|
||||
{
|
||||
int retval, i;
|
||||
struct MODS_QUERY_IRQ_3 query_irq = { { { { 0 } } } };
|
||||
|
||||
retval = esc_mods_query_irq_3(pfile, &query_irq);
|
||||
retval = esc_mods_query_irq_3(client, &query_irq);
|
||||
if (retval)
|
||||
return retval;
|
||||
|
||||
@@ -1392,11 +1369,9 @@ int esc_mods_query_irq(struct file *pfile,
|
||||
return OK;
|
||||
}
|
||||
|
||||
int esc_mods_irq_handled_2(struct file *pfile,
|
||||
int esc_mods_irq_handled_2(struct mods_client *client,
|
||||
struct MODS_REGISTER_IRQ_2 *p)
|
||||
{
|
||||
u8 client_id;
|
||||
struct mods_client *client;
|
||||
unsigned long flags = 0;
|
||||
u32 irq = p->dev.bus;
|
||||
struct dev_irq_map *t = NULL;
|
||||
@@ -1408,15 +1383,6 @@ int esc_mods_irq_handled_2(struct file *pfile,
|
||||
|
||||
LOG_ENT();
|
||||
|
||||
/* Identify the caller */
|
||||
client_id = get_client_id(pfile);
|
||||
if (unlikely(!is_client_id_valid(client_id))) {
|
||||
WARN_ON(!is_client_id_valid(client_id));
|
||||
LOG_EXT();
|
||||
return -EINVAL;
|
||||
}
|
||||
client = &mp.clients[client_id - 1];
|
||||
|
||||
/* Print info */
|
||||
mods_debug_printk(DEBUG_ISR_DETAILED,
|
||||
"mark CPU IRQ 0x%x handled\n", irq);
|
||||
@@ -1444,22 +1410,22 @@ int esc_mods_irq_handled_2(struct file *pfile,
|
||||
return err;
|
||||
}
|
||||
|
||||
int esc_mods_irq_handled(struct file *pfile,
|
||||
int esc_mods_irq_handled(struct mods_client *client,
|
||||
struct MODS_REGISTER_IRQ *p)
|
||||
{
|
||||
struct MODS_REGISTER_IRQ_2 register_irq = { {0} };
|
||||
|
||||
register_irq.dev.domain = 0;
|
||||
register_irq.dev.bus = p->dev.bus;
|
||||
register_irq.dev.device = p->dev.device;
|
||||
register_irq.dev.function = p->dev.function;
|
||||
register_irq.type = p->type;
|
||||
register_irq.dev.domain = 0;
|
||||
register_irq.dev.bus = p->dev.bus;
|
||||
register_irq.dev.device = p->dev.device;
|
||||
register_irq.dev.function = p->dev.function;
|
||||
register_irq.type = p->type;
|
||||
|
||||
return esc_mods_irq_handled_2(pfile, ®ister_irq);
|
||||
return esc_mods_irq_handled_2(client, ®ister_irq);
|
||||
}
|
||||
|
||||
#if defined(MODS_TEGRA) && defined(CONFIG_OF_IRQ) && defined(CONFIG_OF)
|
||||
int esc_mods_map_irq(struct file *pfile,
|
||||
int esc_mods_map_irq(struct mods_client *client,
|
||||
struct MODS_DT_INFO *p)
|
||||
{
|
||||
int err;
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
# include <linux/console_struct.h>
|
||||
# include <linux/vt_kern.h>
|
||||
#endif
|
||||
#ifdef MODS_HAS_MSR
|
||||
#ifdef CONFIG_X86
|
||||
# include <asm/msr.h>
|
||||
#endif
|
||||
|
||||
@@ -55,14 +55,14 @@ static int mods_pci_sriov_configure(struct pci_dev *dev, int numvfs);
|
||||
|
||||
/* character driver entry points */
|
||||
static const struct file_operations mods_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = mods_krnl_open,
|
||||
.release = mods_krnl_close,
|
||||
.poll = mods_krnl_poll,
|
||||
.mmap = mods_krnl_mmap,
|
||||
.owner = THIS_MODULE,
|
||||
.open = mods_krnl_open,
|
||||
.release = mods_krnl_close,
|
||||
.poll = mods_krnl_poll,
|
||||
.mmap = mods_krnl_mmap,
|
||||
.unlocked_ioctl = mods_krnl_ioctl,
|
||||
#if defined(HAVE_COMPAT_IOCTL)
|
||||
.compat_ioctl = mods_krnl_ioctl,
|
||||
.compat_ioctl = mods_krnl_ioctl,
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -70,11 +70,11 @@ static const struct file_operations mods_fops = {
|
||||
|
||||
struct miscdevice mods_dev = {
|
||||
.minor = MISC_DYNAMIC_MINOR,
|
||||
.name = DEVICE_NAME,
|
||||
.fops = &mods_fops
|
||||
.name = DEVICE_NAME,
|
||||
.fops = &mods_fops
|
||||
};
|
||||
|
||||
#if defined(MODS_CAN_REGISTER_PCI_DEV)
|
||||
#if defined(CONFIG_PCI)
|
||||
static pci_ers_result_t mods_pci_error_detected(struct pci_dev *,
|
||||
enum pci_channel_state);
|
||||
static pci_ers_result_t mods_pci_mmio_enabled(struct pci_dev *);
|
||||
@@ -162,7 +162,8 @@ static int mods_pci_sriov_configure(struct pci_dev *dev, int numvfs)
|
||||
return numvfs;
|
||||
}
|
||||
|
||||
static int esc_mods_set_num_vf(struct file *pfile, struct MODS_SET_NUM_VF *p)
|
||||
static int esc_mods_set_num_vf(struct mods_client *client,
|
||||
struct MODS_SET_NUM_VF *p)
|
||||
{
|
||||
int err;
|
||||
struct pci_dev *dev = NULL;
|
||||
@@ -170,7 +171,7 @@ static int esc_mods_set_num_vf(struct file *pfile, struct MODS_SET_NUM_VF *p)
|
||||
LOG_ENT();
|
||||
|
||||
/* Get the PCI device structure for the specified device from kernel */
|
||||
err = mods_find_pci_dev(pfile, &p->dev, &dev);
|
||||
err = mods_find_pci_dev(client, &p->dev, &dev);
|
||||
if (unlikely(err)) {
|
||||
if (err == -ENODEV)
|
||||
mods_error_printk("PCI device %04x:%02x:%02x.%x not found\n",
|
||||
@@ -189,7 +190,8 @@ static int esc_mods_set_num_vf(struct file *pfile, struct MODS_SET_NUM_VF *p)
|
||||
return err;
|
||||
}
|
||||
|
||||
static int esc_mods_set_total_vf(struct file *pfile, struct MODS_SET_NUM_VF *p)
|
||||
static int esc_mods_set_total_vf(struct mods_client *client,
|
||||
struct MODS_SET_NUM_VF *p)
|
||||
{
|
||||
int err;
|
||||
struct pci_dev *dev = NULL;
|
||||
@@ -200,7 +202,7 @@ static int esc_mods_set_total_vf(struct file *pfile, struct MODS_SET_NUM_VF *p)
|
||||
"pci_sriov_set_totalvfs(totalvfs=%d)\n", p->numvfs);
|
||||
|
||||
/* Get the PCI device structure for the specified device from kernel */
|
||||
err = mods_find_pci_dev(pfile, &p->dev, &dev);
|
||||
err = mods_find_pci_dev(client, &p->dev, &dev);
|
||||
if (unlikely(err)) {
|
||||
if (err == -ENODEV)
|
||||
mods_error_printk("PCI device %04x:%02x:%02x.%x not found\n",
|
||||
@@ -267,6 +269,21 @@ u32 mods_get_access_token(void)
|
||||
return access_token;
|
||||
}
|
||||
|
||||
static int validate_client(struct mods_client *client)
|
||||
{
|
||||
if (!client) {
|
||||
mods_error_printk("invalid client\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (client->client_id < 1 || client->client_id > MODS_MAX_CLIENTS) {
|
||||
mods_error_printk("invalid client id %u\n", client->client_id);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static int mods_set_access_token(u32 tok)
|
||||
{
|
||||
/* When setting a null token, the existing token must match the
|
||||
@@ -282,10 +299,8 @@ static int mods_set_access_token(u32 tok)
|
||||
return OK;
|
||||
}
|
||||
|
||||
static int mods_check_access_token(struct file *fp)
|
||||
static int mods_check_access_token(struct mods_client *client)
|
||||
{
|
||||
struct mods_client *client = fp->private_data;
|
||||
|
||||
if (client->access_token != mods_get_access_token())
|
||||
return -EFAULT;
|
||||
|
||||
@@ -307,7 +322,7 @@ static int __init mods_init_module(void)
|
||||
if (rc < 0)
|
||||
return -EBUSY;
|
||||
|
||||
#if defined(MODS_CAN_REGISTER_PCI_DEV)
|
||||
#if defined(CONFIG_PCI)
|
||||
rc = pci_register_driver(&mods_pci_driver);
|
||||
if (rc < 0)
|
||||
return -EBUSY;
|
||||
@@ -352,7 +367,7 @@ static void __exit mods_exit_module(void)
|
||||
|
||||
mods_cleanup_irq();
|
||||
|
||||
#if defined(MODS_CAN_REGISTER_PCI_DEV)
|
||||
#if defined(CONFIG_PCI)
|
||||
pci_unregister_driver(&mods_pci_driver);
|
||||
#endif
|
||||
|
||||
@@ -408,6 +423,7 @@ static void mods_disable_all_devices(struct mods_client *client)
|
||||
mods_disable_device(old->dev);
|
||||
client->enabled_devices = old->next;
|
||||
kfree(old);
|
||||
atomic_dec(&client->num_allocs);
|
||||
}
|
||||
|
||||
mutex_unlock(mods_get_irq_mutex());
|
||||
@@ -421,20 +437,19 @@ static void mods_disable_all_devices(struct mods_client *client)
|
||||
#endif
|
||||
}
|
||||
|
||||
static int mods_resume_console(struct file *pfile);
|
||||
static int mods_resume_console(struct mods_client *client);
|
||||
|
||||
/*********************
|
||||
* MAPPING FUNCTIONS *
|
||||
*********************/
|
||||
static int mods_register_mapping(
|
||||
struct file *fp,
|
||||
struct mods_client *client,
|
||||
struct MODS_MEM_INFO *p_mem_info,
|
||||
u64 dma_addr,
|
||||
u64 virtual_address,
|
||||
u64 mapping_length)
|
||||
{
|
||||
struct SYS_MAP_MEMORY *p_map_mem;
|
||||
struct mods_client *client = fp->private_data;
|
||||
|
||||
LOG_ENT();
|
||||
|
||||
@@ -443,6 +458,7 @@ static int mods_register_mapping(
|
||||
LOG_EXT();
|
||||
return -ENOMEM;
|
||||
}
|
||||
atomic_inc(&client->num_allocs);
|
||||
|
||||
p_map_mem->dma_addr = dma_addr;
|
||||
p_map_mem->virtual_addr = virtual_address;
|
||||
@@ -459,10 +475,10 @@ static int mods_register_mapping(
|
||||
return OK;
|
||||
}
|
||||
|
||||
static void mods_unregister_mapping(struct file *fp, u64 virtual_address)
|
||||
static void mods_unregister_mapping(struct mods_client *client,
|
||||
u64 virtual_address)
|
||||
{
|
||||
struct SYS_MAP_MEMORY *p_map_mem;
|
||||
struct mods_client *client = fp->private_data;
|
||||
struct list_head *head = &client->mem_map_list;
|
||||
struct list_head *iter;
|
||||
|
||||
@@ -477,6 +493,7 @@ static void mods_unregister_mapping(struct file *fp, u64 virtual_address)
|
||||
|
||||
/* free our data struct which keeps track of mapping */
|
||||
kfree(p_map_mem);
|
||||
atomic_dec(&client->num_allocs);
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -484,10 +501,9 @@ static void mods_unregister_mapping(struct file *fp, u64 virtual_address)
|
||||
LOG_EXT();
|
||||
}
|
||||
|
||||
static void mods_unregister_all_mappings(struct file *fp)
|
||||
static void mods_unregister_all_mappings(struct mods_client *client)
|
||||
{
|
||||
struct SYS_MAP_MEMORY *p_map_mem;
|
||||
struct mods_client *client = fp->private_data;
|
||||
struct list_head *head = &client->mem_map_list;
|
||||
struct list_head *iter;
|
||||
struct list_head *tmp;
|
||||
@@ -496,22 +512,22 @@ static void mods_unregister_all_mappings(struct file *fp)
|
||||
|
||||
list_for_each_safe(iter, tmp, head) {
|
||||
p_map_mem = list_entry(iter, struct SYS_MAP_MEMORY, list);
|
||||
mods_unregister_mapping(fp, p_map_mem->virtual_addr);
|
||||
mods_unregister_mapping(client, p_map_mem->virtual_addr);
|
||||
}
|
||||
|
||||
LOG_EXT();
|
||||
}
|
||||
|
||||
static pgprot_t mods_get_prot(u32 mem_type, pgprot_t prot)
|
||||
static pgprot_t mods_get_prot(u8 mem_type, pgprot_t prot)
|
||||
{
|
||||
switch (mem_type) {
|
||||
case MODS_MEMORY_CACHED:
|
||||
case MODS_ALLOC_CACHED:
|
||||
return prot;
|
||||
|
||||
case MODS_MEMORY_UNCACHED:
|
||||
case MODS_ALLOC_UNCACHED:
|
||||
return MODS_PGPROT_UC(prot);
|
||||
|
||||
case MODS_MEMORY_WRITECOMBINE:
|
||||
case MODS_ALLOC_WRITECOMBINE:
|
||||
return MODS_PGPROT_WC(prot);
|
||||
|
||||
default:
|
||||
@@ -521,11 +537,11 @@ static pgprot_t mods_get_prot(u32 mem_type, pgprot_t prot)
|
||||
}
|
||||
}
|
||||
|
||||
static pgprot_t mods_get_prot_for_range(struct file *fp, u64 dma_addr,
|
||||
u64 size, pgprot_t prot)
|
||||
static pgprot_t mods_get_prot_for_range(struct mods_client *client,
|
||||
u64 dma_addr,
|
||||
u64 size,
|
||||
pgprot_t prot)
|
||||
{
|
||||
struct mods_client *client = fp->private_data;
|
||||
|
||||
if ((dma_addr == client->mem_type.dma_addr) &&
|
||||
(size == client->mem_type.size)) {
|
||||
|
||||
@@ -534,16 +550,16 @@ static pgprot_t mods_get_prot_for_range(struct file *fp, u64 dma_addr,
|
||||
return prot;
|
||||
}
|
||||
|
||||
const char *mods_get_prot_str(u32 mem_type)
|
||||
const char *mods_get_prot_str(u8 mem_type)
|
||||
{
|
||||
switch (mem_type) {
|
||||
case MODS_MEMORY_CACHED:
|
||||
case MODS_ALLOC_CACHED:
|
||||
return "WB";
|
||||
|
||||
case MODS_MEMORY_UNCACHED:
|
||||
case MODS_ALLOC_UNCACHED:
|
||||
return "UC";
|
||||
|
||||
case MODS_MEMORY_WRITECOMBINE:
|
||||
case MODS_ALLOC_WRITECOMBINE:
|
||||
return "WC";
|
||||
|
||||
default:
|
||||
@@ -551,12 +567,10 @@ const char *mods_get_prot_str(u32 mem_type)
|
||||
}
|
||||
}
|
||||
|
||||
static const char *mods_get_prot_str_for_range(struct file *fp,
|
||||
u64 dma_addr,
|
||||
u64 size)
|
||||
static const char *mods_get_prot_str_for_range(struct mods_client *client,
|
||||
u64 dma_addr,
|
||||
u64 size)
|
||||
{
|
||||
struct mods_client *client = fp->private_data;
|
||||
|
||||
if ((dma_addr == client->mem_type.dma_addr) &&
|
||||
(size == client->mem_type.size)) {
|
||||
|
||||
@@ -567,7 +581,7 @@ static const char *mods_get_prot_str_for_range(struct file *fp,
|
||||
/********************
|
||||
* PCI ERROR FUNCTIONS *
|
||||
********************/
|
||||
#if defined(MODS_CAN_REGISTER_PCI_DEV)
|
||||
#if defined(CONFIG_PCI)
|
||||
static pci_ers_result_t mods_pci_error_detected(struct pci_dev *dev,
|
||||
enum pci_channel_state state)
|
||||
{
|
||||
@@ -609,7 +623,7 @@ static void mods_pci_resume(struct pci_dev *dev)
|
||||
********************/
|
||||
static void mods_krnl_vma_open(struct vm_area_struct *vma)
|
||||
{
|
||||
struct mods_vm_private_data *vma_private_data;
|
||||
struct mods_vm_private_data *priv;
|
||||
|
||||
LOG_ENT();
|
||||
mods_debug_printk(DEBUG_MEM_DETAILED,
|
||||
@@ -617,42 +631,41 @@ static void mods_krnl_vma_open(struct vm_area_struct *vma)
|
||||
vma->vm_start,
|
||||
(u64)(MODS_VMA_PGOFF(vma) << PAGE_SHIFT));
|
||||
|
||||
if (MODS_VMA_PRIVATE(vma)) {
|
||||
vma_private_data = MODS_VMA_PRIVATE(vma);
|
||||
atomic_inc(&vma_private_data->usage_count);
|
||||
}
|
||||
priv = vma->vm_private_data;
|
||||
if (priv)
|
||||
atomic_inc(&priv->usage_count);
|
||||
|
||||
LOG_EXT();
|
||||
}
|
||||
|
||||
static void mods_krnl_vma_close(struct vm_area_struct *vma)
|
||||
{
|
||||
struct mods_vm_private_data *priv;
|
||||
|
||||
LOG_ENT();
|
||||
|
||||
if (MODS_VMA_PRIVATE(vma)) {
|
||||
struct mods_vm_private_data *vma_private_data
|
||||
= MODS_VMA_PRIVATE(vma);
|
||||
if (atomic_dec_and_test(&vma_private_data->usage_count)) {
|
||||
struct mods_client *client =
|
||||
vma_private_data->fp->private_data;
|
||||
priv = vma->vm_private_data;
|
||||
if (priv && atomic_dec_and_test(&priv->usage_count)) {
|
||||
struct mods_client *client = priv->client;
|
||||
|
||||
if (unlikely(mutex_lock_interruptible(
|
||||
&client->mtx))) {
|
||||
LOG_EXT();
|
||||
return;
|
||||
}
|
||||
|
||||
/* we need to unregister the mapping */
|
||||
mods_unregister_mapping(vma_private_data->fp,
|
||||
vma->vm_start);
|
||||
mods_debug_printk(DEBUG_MEM_DETAILED,
|
||||
"closed vma, virt 0x%lx\n",
|
||||
vma->vm_start);
|
||||
MODS_VMA_PRIVATE(vma) = NULL;
|
||||
kfree(vma_private_data);
|
||||
|
||||
mutex_unlock(&client->mtx);
|
||||
if (unlikely(mutex_lock_interruptible(
|
||||
&client->mtx))) {
|
||||
LOG_EXT();
|
||||
return;
|
||||
}
|
||||
|
||||
/* we need to unregister the mapping */
|
||||
mods_unregister_mapping(client, vma->vm_start);
|
||||
mods_debug_printk(DEBUG_MEM_DETAILED,
|
||||
"closed vma, virt 0x%lx\n",
|
||||
vma->vm_start);
|
||||
vma->vm_private_data = NULL;
|
||||
kfree(priv);
|
||||
atomic_dec(&client->num_allocs);
|
||||
|
||||
mutex_unlock(&client->mtx);
|
||||
}
|
||||
|
||||
LOG_EXT();
|
||||
}
|
||||
|
||||
@@ -684,78 +697,102 @@ static int mods_krnl_open(struct inode *ip, struct file *fp)
|
||||
static int mods_krnl_close(struct inode *ip, struct file *fp)
|
||||
{
|
||||
struct mods_client *client = fp->private_data;
|
||||
u8 client_id = client->client_id;
|
||||
int err = OK;
|
||||
int final_err = OK;
|
||||
int err = OK;
|
||||
|
||||
LOG_ENT();
|
||||
|
||||
WARN_ON(!is_client_id_valid(client_id));
|
||||
if (!is_client_id_valid(client_id)) {
|
||||
if (!validate_client(client)) {
|
||||
LOG_EXT();
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
mods_free_client_interrupts(client);
|
||||
|
||||
mods_resume_console(fp);
|
||||
mods_resume_console(client);
|
||||
|
||||
mods_unregister_all_mappings(fp);
|
||||
err = mods_unregister_all_alloc(fp);
|
||||
mods_unregister_all_mappings(client);
|
||||
err = mods_unregister_all_alloc(client);
|
||||
if (err)
|
||||
mods_error_printk("failed to free all memory\n");
|
||||
final_err = err;
|
||||
|
||||
#if defined(CONFIG_PPC64)
|
||||
err = mods_unregister_all_ppc_tce_bypass(fp);
|
||||
err = mods_unregister_all_ppc_tce_bypass(client);
|
||||
if (err)
|
||||
mods_error_printk("failed to restore dma bypass\n");
|
||||
if (!final_err)
|
||||
final_err = err;
|
||||
|
||||
err = mods_unregister_all_nvlink_sysmem_trained(fp);
|
||||
err = mods_unregister_all_nvlink_sysmem_trained(client);
|
||||
if (err)
|
||||
mods_error_printk("failed to free nvlink trained\n");
|
||||
if (!final_err)
|
||||
final_err = err;
|
||||
#endif
|
||||
|
||||
mods_disable_all_devices(client);
|
||||
|
||||
mods_free_client(client_id);
|
||||
if (atomic_read(&client->num_allocs) ||
|
||||
atomic_read(&client->num_pages)) {
|
||||
|
||||
mods_error_printk("not all allocations have been freed, allocs=%u, pages=%u\n",
|
||||
(unsigned int)atomic_read(&client->num_allocs),
|
||||
(unsigned int)atomic_read(&client->num_pages));
|
||||
if (!final_err)
|
||||
final_err = -ENOMEM;
|
||||
}
|
||||
|
||||
mods_free_client(client->client_id);
|
||||
|
||||
mods_info_printk("driver closed\n");
|
||||
LOG_EXT();
|
||||
return err;
|
||||
return final_err;
|
||||
}
|
||||
|
||||
static unsigned int mods_krnl_poll(struct file *fp, poll_table *wait)
|
||||
{
|
||||
unsigned int mask = 0;
|
||||
struct mods_client *client = fp->private_data;
|
||||
u8 client_id = get_client_id(fp);
|
||||
int access_tok_ret = mods_check_access_token(fp);
|
||||
int err;
|
||||
|
||||
if (access_tok_ret < 0)
|
||||
return access_tok_ret;
|
||||
if (!validate_client(client))
|
||||
return -EINVAL;
|
||||
|
||||
err = mods_check_access_token(client);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
if (!(fp->f_flags & O_NONBLOCK)) {
|
||||
mods_debug_printk(DEBUG_ISR_DETAILED, "poll wait\n");
|
||||
poll_wait(fp, &client->interrupt_event, wait);
|
||||
}
|
||||
/* if any interrupts pending then check intr, POLLIN on irq */
|
||||
mask |= mods_irq_event_check(client_id);
|
||||
mask |= mods_irq_event_check(client->client_id);
|
||||
mods_debug_printk(DEBUG_ISR_DETAILED, "poll mask 0x%x\n", mask);
|
||||
return mask;
|
||||
}
|
||||
|
||||
static int mods_krnl_map_inner(struct file *fp, struct vm_area_struct *vma);
|
||||
static int mods_krnl_map_inner(struct mods_client *client,
|
||||
struct vm_area_struct *vma);
|
||||
|
||||
static int mods_krnl_mmap(struct file *fp, struct vm_area_struct *vma)
|
||||
{
|
||||
struct mods_vm_private_data *vma_private_data;
|
||||
int access_tok_ret;
|
||||
struct mods_client *client = fp->private_data;
|
||||
int err;
|
||||
|
||||
LOG_ENT();
|
||||
|
||||
access_tok_ret = mods_check_access_token(fp);
|
||||
if (access_tok_ret < 0) {
|
||||
if (!validate_client(client)) {
|
||||
LOG_EXT();
|
||||
return access_tok_ret;
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
err = mods_check_access_token(client);
|
||||
if (err < 0) {
|
||||
LOG_EXT();
|
||||
return err;
|
||||
}
|
||||
|
||||
vma->vm_ops = &mods_krnl_vm_ops;
|
||||
@@ -766,23 +803,23 @@ static int mods_krnl_mmap(struct file *fp, struct vm_area_struct *vma)
|
||||
LOG_EXT();
|
||||
return -ENOMEM;
|
||||
}
|
||||
atomic_inc(&client->num_allocs);
|
||||
|
||||
/* set private data for vm_area_struct */
|
||||
atomic_set(&vma_private_data->usage_count, 0);
|
||||
vma_private_data->fp = fp;
|
||||
MODS_VMA_PRIVATE(vma) = vma_private_data;
|
||||
vma_private_data->client = client;
|
||||
vma->vm_private_data = vma_private_data;
|
||||
|
||||
/* call for the first time open function */
|
||||
mods_krnl_vma_open(vma);
|
||||
|
||||
{
|
||||
int err = OK;
|
||||
struct mods_client *client = fp->private_data;
|
||||
|
||||
if (unlikely(mutex_lock_interruptible(&client->mtx)))
|
||||
err = -EINTR;
|
||||
else {
|
||||
err = mods_krnl_map_inner(fp, vma);
|
||||
err = mods_krnl_map_inner(client, vma);
|
||||
mutex_unlock(&client->mtx);
|
||||
}
|
||||
LOG_EXT();
|
||||
@@ -790,10 +827,11 @@ static int mods_krnl_mmap(struct file *fp, struct vm_area_struct *vma)
|
||||
}
|
||||
}
|
||||
|
||||
static int mods_krnl_map_inner(struct file *fp, struct vm_area_struct *vma)
|
||||
static int mods_krnl_map_inner(struct mods_client *client,
|
||||
struct vm_area_struct *vma)
|
||||
{
|
||||
u64 req_pa = MODS_VMA_OFFSET(vma);
|
||||
struct MODS_MEM_INFO *p_mem_info = mods_find_alloc(fp, req_pa);
|
||||
struct MODS_MEM_INFO *p_mem_info = mods_find_alloc(client, req_pa);
|
||||
u32 req_pages = MODS_VMA_SIZE(vma) >> PAGE_SHIFT;
|
||||
|
||||
if ((req_pa & ~PAGE_MASK) != 0 ||
|
||||
@@ -885,7 +923,7 @@ static int mods_krnl_map_inner(struct file *fp, struct vm_area_struct *vma)
|
||||
/* MODS_VMA_OFFSET(vma) can change so it can't be used
|
||||
* to register the mapping
|
||||
*/
|
||||
mods_register_mapping(fp,
|
||||
mods_register_mapping(client,
|
||||
p_mem_info,
|
||||
chunks[first].dma_addr,
|
||||
vma->vm_start,
|
||||
@@ -899,7 +937,7 @@ static int mods_krnl_map_inner(struct file *fp, struct vm_area_struct *vma)
|
||||
req_pa,
|
||||
(unsigned long)vma->vm_start,
|
||||
(unsigned long)MODS_VMA_SIZE(vma),
|
||||
mods_get_prot_str_for_range(fp, req_pa,
|
||||
mods_get_prot_str_for_range(client, req_pa,
|
||||
MODS_VMA_SIZE(vma)));
|
||||
|
||||
if (io_remap_pfn_range(
|
||||
@@ -908,7 +946,7 @@ static int mods_krnl_map_inner(struct file *fp, struct vm_area_struct *vma)
|
||||
req_pa>>PAGE_SHIFT,
|
||||
MODS_VMA_SIZE(vma),
|
||||
mods_get_prot_for_range(
|
||||
fp,
|
||||
client,
|
||||
req_pa,
|
||||
MODS_VMA_SIZE(vma),
|
||||
vma->vm_page_prot))) {
|
||||
@@ -916,7 +954,7 @@ static int mods_krnl_map_inner(struct file *fp, struct vm_area_struct *vma)
|
||||
return -EAGAIN;
|
||||
}
|
||||
|
||||
mods_register_mapping(fp,
|
||||
mods_register_mapping(client,
|
||||
NULL,
|
||||
req_pa,
|
||||
vma->vm_start,
|
||||
@@ -944,28 +982,21 @@ static int mods_get_screen_info(struct MODS_SCREEN_INFO *p)
|
||||
* ESCAPE CALL FUNCTIONS *
|
||||
*************************/
|
||||
|
||||
static int esc_mods_get_api_version(struct file *pfile,
|
||||
static int esc_mods_get_api_version(struct mods_client *client,
|
||||
struct MODS_GET_VERSION *p)
|
||||
{
|
||||
p->version = MODS_DRIVER_VERSION;
|
||||
return OK;
|
||||
}
|
||||
|
||||
static int esc_mods_get_kernel_version(struct file *pfile,
|
||||
static int esc_mods_get_kernel_version(struct mods_client *client,
|
||||
struct MODS_GET_VERSION *p)
|
||||
{
|
||||
p->version = MODS_KERNEL_VERSION;
|
||||
return OK;
|
||||
}
|
||||
|
||||
static int esc_mods_set_driver_para(struct file *pfile,
|
||||
struct MODS_SET_PARA *p)
|
||||
{
|
||||
int rc = OK;
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int esc_mods_get_screen_info(struct file *pfile,
|
||||
static int esc_mods_get_screen_info(struct mods_client *client,
|
||||
struct MODS_SCREEN_INFO *p)
|
||||
{
|
||||
#if defined(CONFIG_ARM) || defined(CONFIG_ARM64) || defined(CONFIG_PPC64)
|
||||
@@ -982,7 +1013,7 @@ static int esc_mods_get_screen_info(struct file *pfile,
|
||||
#endif
|
||||
}
|
||||
|
||||
static int esc_mods_get_screen_info_2(struct file *pfile,
|
||||
static int esc_mods_get_screen_info_2(struct mods_client *client,
|
||||
struct MODS_SCREEN_INFO_2 *p)
|
||||
{
|
||||
#if defined(CONFIG_ARM) || defined(CONFIG_ARM64) || defined(CONFIG_PPC64)
|
||||
@@ -1000,7 +1031,7 @@ static int esc_mods_get_screen_info_2(struct file *pfile,
|
||||
#endif
|
||||
}
|
||||
|
||||
static int esc_mods_lock_console(struct file *pfile)
|
||||
static int esc_mods_lock_console(struct mods_client *client)
|
||||
{
|
||||
#if defined(MODS_HAS_CONSOLE_LOCK)
|
||||
console_lock();
|
||||
@@ -1010,7 +1041,7 @@ static int esc_mods_lock_console(struct file *pfile)
|
||||
#endif
|
||||
}
|
||||
|
||||
static int esc_mods_unlock_console(struct file *pfile)
|
||||
static int esc_mods_unlock_console(struct mods_client *client)
|
||||
{
|
||||
#if defined(MODS_HAS_CONSOLE_LOCK)
|
||||
console_unlock();
|
||||
@@ -1020,7 +1051,7 @@ static int esc_mods_unlock_console(struct file *pfile)
|
||||
#endif
|
||||
}
|
||||
|
||||
static int esc_mods_suspend_console(struct file *pfile)
|
||||
static int esc_mods_suspend_console(struct mods_client *client)
|
||||
{
|
||||
int err = -EINVAL;
|
||||
|
||||
@@ -1029,7 +1060,6 @@ static int esc_mods_suspend_console(struct file *pfile)
|
||||
#if defined(CONFIG_FB) && defined(MODS_HAS_CONSOLE_LOCK)
|
||||
if (num_registered_fb) {
|
||||
/* tell the os to block fb accesses */
|
||||
struct mods_client *client = pfile->private_data;
|
||||
int i = 0;
|
||||
|
||||
for (i = 0; i < num_registered_fb; i++) {
|
||||
@@ -1061,12 +1091,12 @@ static int esc_mods_suspend_console(struct file *pfile)
|
||||
return err;
|
||||
}
|
||||
|
||||
static int esc_mods_resume_console(struct file *pfile)
|
||||
static int esc_mods_resume_console(struct mods_client *client)
|
||||
{
|
||||
return mods_resume_console(pfile);
|
||||
return mods_resume_console(client);
|
||||
}
|
||||
|
||||
static int mods_resume_console(struct file *pfile)
|
||||
static int mods_resume_console(struct mods_client *client)
|
||||
{
|
||||
int err = -EINVAL;
|
||||
|
||||
@@ -1074,7 +1104,6 @@ static int mods_resume_console(struct file *pfile)
|
||||
|
||||
#if defined(CONFIG_FB) && defined(MODS_HAS_CONSOLE_LOCK)
|
||||
if (num_registered_fb) {
|
||||
struct mods_client *client = pfile->private_data;
|
||||
int i = 0;
|
||||
|
||||
for (i = 0; i < num_registered_fb; i++) {
|
||||
@@ -1106,7 +1135,7 @@ static int mods_resume_console(struct file *pfile)
|
||||
return err;
|
||||
}
|
||||
|
||||
static int esc_mods_acquire_access_token(struct file *pfile,
|
||||
static int esc_mods_acquire_access_token(struct mods_client *client,
|
||||
struct MODS_ACCESS_TOKEN *ptoken)
|
||||
{
|
||||
int err = -EINVAL;
|
||||
@@ -1124,18 +1153,15 @@ static int esc_mods_acquire_access_token(struct file *pfile,
|
||||
err = mods_set_access_token(ptoken->token);
|
||||
if (err)
|
||||
mods_error_printk("unable to set access token!\n");
|
||||
else {
|
||||
struct mods_client *client = pfile->private_data;
|
||||
|
||||
else
|
||||
client->access_token = ptoken->token;
|
||||
}
|
||||
|
||||
LOG_EXT();
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
static int esc_mods_release_access_token(struct file *pfile,
|
||||
static int esc_mods_release_access_token(struct mods_client *client,
|
||||
struct MODS_ACCESS_TOKEN *ptoken)
|
||||
{
|
||||
int err = -EINVAL;
|
||||
@@ -1152,18 +1178,15 @@ static int esc_mods_release_access_token(struct file *pfile,
|
||||
err = mods_set_access_token(MODS_ACCESS_TOKEN_NONE);
|
||||
if (err)
|
||||
mods_error_printk("unable to clear access token!\n");
|
||||
else {
|
||||
struct mods_client *client = pfile->private_data;
|
||||
|
||||
else
|
||||
client->access_token = MODS_ACCESS_TOKEN_NONE;
|
||||
}
|
||||
|
||||
LOG_EXT();
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
static int esc_mods_verify_access_token(struct file *pfile,
|
||||
static int esc_mods_verify_access_token(struct mods_client *client,
|
||||
struct MODS_ACCESS_TOKEN *ptoken)
|
||||
{
|
||||
int err = -EINVAL;
|
||||
@@ -1171,8 +1194,6 @@ static int esc_mods_verify_access_token(struct file *pfile,
|
||||
LOG_ENT();
|
||||
|
||||
if (ptoken->token == mods_get_access_token()) {
|
||||
struct mods_client *client = pfile->private_data;
|
||||
|
||||
client->access_token = ptoken->token;
|
||||
err = OK;
|
||||
} else
|
||||
@@ -1189,11 +1210,7 @@ struct mods_sysfs_work {
|
||||
int err;
|
||||
};
|
||||
|
||||
#ifdef MODS_OLD_INIT_WORK
|
||||
static void sysfs_write_task(void *w)
|
||||
#else
|
||||
static void sysfs_write_task(struct work_struct *w)
|
||||
#endif
|
||||
{
|
||||
struct mods_sysfs_work *task = container_of(w,
|
||||
struct mods_sysfs_work,
|
||||
@@ -1226,7 +1243,7 @@ static void sysfs_write_task(struct work_struct *w)
|
||||
LOG_EXT();
|
||||
}
|
||||
|
||||
static int esc_mods_write_sysfs_node(struct file *pfile,
|
||||
static int esc_mods_write_sysfs_node(struct mods_client *client,
|
||||
struct MODS_SYSFS_NODE *pdata)
|
||||
{
|
||||
int err = -EINVAL;
|
||||
@@ -1247,11 +1264,7 @@ static int esc_mods_write_sysfs_node(struct file *pfile,
|
||||
return err;
|
||||
}
|
||||
|
||||
#ifdef MODS_OLD_INIT_WORK
|
||||
INIT_WORK(&task.work, sysfs_write_task, &task);
|
||||
#else
|
||||
INIT_WORK(&task.work, sysfs_write_task);
|
||||
#endif
|
||||
queue_work(wq, &task.work);
|
||||
flush_workqueue(wq);
|
||||
destroy_workqueue(wq);
|
||||
@@ -1264,8 +1277,8 @@ static int esc_mods_write_sysfs_node(struct file *pfile,
|
||||
return err;
|
||||
}
|
||||
|
||||
#ifdef MODS_HAS_MSR
|
||||
static int esc_mods_read_msr(struct file *pfile, struct MODS_MSR *p)
|
||||
#ifdef CONFIG_X86
|
||||
static int esc_mods_read_msr(struct mods_client *client, struct MODS_MSR *p)
|
||||
{
|
||||
int err = -EINVAL;
|
||||
|
||||
@@ -1279,7 +1292,7 @@ static int esc_mods_read_msr(struct file *pfile, struct MODS_MSR *p)
|
||||
return err;
|
||||
}
|
||||
|
||||
static int esc_mods_write_msr(struct file *pfile, struct MODS_MSR *p)
|
||||
static int esc_mods_write_msr(struct mods_client *client, struct MODS_MSR *p)
|
||||
{
|
||||
int err = -EINVAL;
|
||||
|
||||
@@ -1302,17 +1315,23 @@ static long mods_krnl_ioctl(struct file *fp,
|
||||
unsigned int cmd,
|
||||
unsigned long i_arg)
|
||||
{
|
||||
int err = 0;
|
||||
void *arg_copy = 0;
|
||||
void *arg = (void *) i_arg;
|
||||
int arg_size;
|
||||
char buf[64];
|
||||
int err = 0;
|
||||
void *arg_copy = NULL;
|
||||
void *arg = (void *)i_arg;
|
||||
struct mods_client *client = fp->private_data;
|
||||
int arg_size;
|
||||
char buf[64];
|
||||
|
||||
LOG_ENT();
|
||||
|
||||
if (!validate_client(client)) {
|
||||
LOG_EXT();
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if ((cmd != MODS_ESC_VERIFY_ACCESS_TOKEN) &&
|
||||
(cmd != MODS_ESC_GET_API_VERSION)) {
|
||||
err = mods_check_access_token(fp);
|
||||
err = mods_check_access_token(client);
|
||||
if (err) {
|
||||
LOG_EXT();
|
||||
return err;
|
||||
@@ -1327,12 +1346,16 @@ static long mods_krnl_ioctl(struct file *fp,
|
||||
LOG_EXT();
|
||||
return -ENOMEM;
|
||||
}
|
||||
atomic_inc(&client->num_allocs);
|
||||
} else if (arg_size > 0)
|
||||
arg_copy = buf;
|
||||
|
||||
if ((arg_size > 0) && copy_from_user(arg_copy, arg, arg_size)) {
|
||||
mods_error_printk("failed to copy ioctl data\n");
|
||||
kfree(arg_copy);
|
||||
if (arg_size > (int)sizeof(buf)) {
|
||||
kfree(arg_copy);
|
||||
atomic_dec(&client->num_allocs);
|
||||
}
|
||||
LOG_EXT();
|
||||
return -EFAULT;
|
||||
}
|
||||
@@ -1347,7 +1370,7 @@ static long mods_krnl_ioctl(struct file *fp,
|
||||
"invalid parameter passed to ioctl " #code \
|
||||
"\n");\
|
||||
} else {\
|
||||
err = function(fp, (struct argtype *)arg_copy);\
|
||||
err = function(client, (struct argtype *)arg_copy);\
|
||||
if ((err == OK) && \
|
||||
copy_to_user(arg, arg_copy, arg_size)) {\
|
||||
err = -EFAULT;\
|
||||
@@ -1369,7 +1392,7 @@ static long mods_krnl_ioctl(struct file *fp,
|
||||
"invalid parameter passed to ioctl " #code \
|
||||
"\n");\
|
||||
} else {\
|
||||
err = function(fp, (struct argtype *)arg_copy);\
|
||||
err = function(client, (struct argtype *)arg_copy);\
|
||||
} \
|
||||
} while (0);\
|
||||
})
|
||||
@@ -1384,7 +1407,7 @@ static long mods_krnl_ioctl(struct file *fp,
|
||||
"invalid parameter passed to ioctl " #code \
|
||||
"\n");\
|
||||
} else {\
|
||||
err = function(fp);\
|
||||
err = function(client);\
|
||||
} \
|
||||
} while (0);\
|
||||
})
|
||||
@@ -1471,6 +1494,12 @@ static long mods_krnl_ioctl(struct file *fp,
|
||||
MODS_PCI_HOT_RESET);
|
||||
break;
|
||||
|
||||
case MODS_ESC_PCI_BUS_REMOVE_DEV:
|
||||
MODS_IOCTL_NORETVAL(MODS_ESC_PCI_BUS_REMOVE_DEV,
|
||||
esc_mods_pci_bus_remove_dev,
|
||||
MODS_PCI_BUS_REMOVE_DEV);
|
||||
break;
|
||||
|
||||
case MODS_ESC_PIO_READ:
|
||||
MODS_IOCTL(MODS_ESC_PIO_READ,
|
||||
esc_mods_pio_read, MODS_PIO_READ);
|
||||
@@ -1529,6 +1558,12 @@ static long mods_krnl_ioctl(struct file *fp,
|
||||
MODS_DEVICE_ALLOC_PAGES_2);
|
||||
break;
|
||||
|
||||
case MODS_ESC_ALLOC_PAGES_2:
|
||||
MODS_IOCTL(MODS_ESC_ALLOC_PAGES_2,
|
||||
esc_mods_alloc_pages_2,
|
||||
MODS_ALLOC_PAGES_2);
|
||||
break;
|
||||
|
||||
case MODS_ESC_FREE_PAGES:
|
||||
MODS_IOCTL(MODS_ESC_FREE_PAGES,
|
||||
esc_mods_free_pages, MODS_FREE_PAGES);
|
||||
@@ -1738,11 +1773,6 @@ static long mods_krnl_ioctl(struct file *fp,
|
||||
esc_mods_get_kernel_version, MODS_GET_VERSION);
|
||||
break;
|
||||
|
||||
case MODS_ESC_SET_DRIVER_PARA:
|
||||
MODS_IOCTL_NORETVAL(MODS_ESC_SET_DRIVER_PARA,
|
||||
esc_mods_set_driver_para, MODS_SET_PARA);
|
||||
break;
|
||||
|
||||
#if defined(MODS_HAS_CLOCK)
|
||||
case MODS_ESC_GET_CLOCK_HANDLE:
|
||||
MODS_IOCTL(MODS_ESC_GET_CLOCK_HANDLE,
|
||||
@@ -2018,7 +2048,7 @@ static long mods_krnl_ioctl(struct file *fp,
|
||||
break;
|
||||
#endif
|
||||
|
||||
#ifdef MODS_HAS_MSR
|
||||
#ifdef CONFIG_X86
|
||||
case MODS_ESC_READ_MSR:
|
||||
MODS_IOCTL(MODS_ESC_READ_MSR,
|
||||
esc_mods_read_msr, MODS_MSR);
|
||||
@@ -2038,8 +2068,10 @@ static long mods_krnl_ioctl(struct file *fp,
|
||||
break;
|
||||
}
|
||||
|
||||
if (arg_size > (int)sizeof(buf))
|
||||
if (arg_size > (int)sizeof(buf)) {
|
||||
kfree(arg_copy);
|
||||
atomic_dec(&client->num_allocs);
|
||||
}
|
||||
|
||||
LOG_EXT();
|
||||
return err;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* mods_net.c - This file is part of NVIDIA MODS kernel driver.
|
||||
*
|
||||
* Copyright (c) 2015-2017, NVIDIA CORPORATION. All rights reserved.
|
||||
* Copyright (c) 2015-2019, NVIDIA CORPORATION. All rights reserved.
|
||||
*
|
||||
* NVIDIA MODS kernel driver is free software: you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License,
|
||||
@@ -21,7 +21,8 @@
|
||||
#include "mods_internal.h"
|
||||
#include <linux/netdevice.h>
|
||||
|
||||
int esc_mods_net_force_link(struct file *pfile, struct MODS_NET_DEVICE_NAME *p)
|
||||
int esc_mods_net_force_link(struct mods_client *client,
|
||||
struct MODS_NET_DEVICE_NAME *p)
|
||||
{
|
||||
struct net_device *ndev;
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
* mods_pci.c - This file is part of NVIDIA MODS kernel driver.
|
||||
*
|
||||
* Copyright (c) 2008-2018, NVIDIA CORPORATION. All rights reserved.
|
||||
* Copyright (c) 2008-2019, NVIDIA CORPORATION. All rights reserved.
|
||||
*
|
||||
* NVIDIA MODS kernel driver is free software: you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License,
|
||||
@@ -37,13 +37,12 @@ int mods_is_pci_dev(struct pci_dev *dev,
|
||||
dev->devfn == devfn;
|
||||
}
|
||||
|
||||
int mods_find_pci_dev(struct file *fp,
|
||||
int mods_find_pci_dev(struct mods_client *client,
|
||||
struct mods_pci_dev_2 *pcidev,
|
||||
struct pci_dev **retdev)
|
||||
{
|
||||
struct mods_client *client = fp->private_data;
|
||||
struct pci_dev *dev;
|
||||
int err;
|
||||
struct pci_dev *dev;
|
||||
int err;
|
||||
|
||||
if (unlikely(mutex_lock_interruptible(&client->mtx)))
|
||||
return -EINTR;
|
||||
@@ -92,7 +91,7 @@ int mods_find_pci_dev(struct file *fp,
|
||||
return err;
|
||||
}
|
||||
|
||||
static int find_pci_dev_impl(struct file *pfile,
|
||||
static int find_pci_dev_impl(struct mods_client *client,
|
||||
struct MODS_FIND_PCI_DEVICE_2 *p,
|
||||
int enum_non_zero_dom)
|
||||
{
|
||||
@@ -128,13 +127,13 @@ static int find_pci_dev_impl(struct file *pfile,
|
||||
return OK;
|
||||
}
|
||||
|
||||
int esc_mods_find_pci_dev_2(struct file *pfile,
|
||||
int esc_mods_find_pci_dev_2(struct mods_client *client,
|
||||
struct MODS_FIND_PCI_DEVICE_2 *p)
|
||||
{
|
||||
return find_pci_dev_impl(pfile, p, 1);
|
||||
return find_pci_dev_impl(client, p, 1);
|
||||
}
|
||||
|
||||
int esc_mods_find_pci_dev(struct file *pfile,
|
||||
int esc_mods_find_pci_dev(struct mods_client *client,
|
||||
struct MODS_FIND_PCI_DEVICE *p)
|
||||
{
|
||||
struct MODS_FIND_PCI_DEVICE_2 p2;
|
||||
@@ -144,7 +143,7 @@ int esc_mods_find_pci_dev(struct file *pfile,
|
||||
p2.vendor_id = p->vendor_id;
|
||||
p2.index = p->index;
|
||||
|
||||
err = find_pci_dev_impl(pfile, &p2, 0);
|
||||
err = find_pci_dev_impl(client, &p2, 0);
|
||||
|
||||
if (!err) {
|
||||
p->bus_number = p2.pci_device.bus;
|
||||
@@ -155,7 +154,7 @@ int esc_mods_find_pci_dev(struct file *pfile,
|
||||
return err;
|
||||
}
|
||||
|
||||
static int mods_find_pci_class_code(struct file *pfile,
|
||||
static int mods_find_pci_class_code(struct mods_client *client,
|
||||
struct MODS_FIND_PCI_CLASS_CODE_2 *p,
|
||||
int enum_non_zero_dom)
|
||||
{
|
||||
@@ -188,13 +187,13 @@ static int mods_find_pci_class_code(struct file *pfile,
|
||||
return OK;
|
||||
}
|
||||
|
||||
int esc_mods_find_pci_class_code_2(struct file *pfile,
|
||||
int esc_mods_find_pci_class_code_2(struct mods_client *client,
|
||||
struct MODS_FIND_PCI_CLASS_CODE_2 *p)
|
||||
{
|
||||
return mods_find_pci_class_code(pfile, p, 1);
|
||||
return mods_find_pci_class_code(client, p, 1);
|
||||
}
|
||||
|
||||
int esc_mods_find_pci_class_code(struct file *pfile,
|
||||
int esc_mods_find_pci_class_code(struct mods_client *client,
|
||||
struct MODS_FIND_PCI_CLASS_CODE *p)
|
||||
{
|
||||
struct MODS_FIND_PCI_CLASS_CODE_2 p2;
|
||||
@@ -203,7 +202,7 @@ int esc_mods_find_pci_class_code(struct file *pfile,
|
||||
p2.class_code = p->class_code;
|
||||
p2.index = p->index;
|
||||
|
||||
err = mods_find_pci_class_code(pfile, &p2, 0);
|
||||
err = mods_find_pci_class_code(client, &p2, 0);
|
||||
|
||||
if (!err) {
|
||||
p->bus_number = p2.pci_device.bus;
|
||||
@@ -214,7 +213,7 @@ int esc_mods_find_pci_class_code(struct file *pfile,
|
||||
return err;
|
||||
}
|
||||
|
||||
int esc_mods_pci_get_bar_info_2(struct file *pfile,
|
||||
int esc_mods_pci_get_bar_info_2(struct mods_client *client,
|
||||
struct MODS_PCI_GET_BAR_INFO_2 *p)
|
||||
{
|
||||
struct pci_dev *dev;
|
||||
@@ -227,7 +226,7 @@ int esc_mods_pci_get_bar_info_2(struct file *pfile,
|
||||
|
||||
LOG_ENT();
|
||||
|
||||
err = mods_find_pci_dev(pfile, &p->pci_device, &dev);
|
||||
err = mods_find_pci_dev(client, &p->pci_device, &dev);
|
||||
if (unlikely(err)) {
|
||||
LOG_EXT();
|
||||
return err;
|
||||
@@ -249,7 +248,8 @@ int esc_mods_pci_get_bar_info_2(struct file *pfile,
|
||||
}
|
||||
|
||||
/* Enable device on the PCI bus */
|
||||
if (mods_enable_device(pfile->private_data, dev) == 0) {
|
||||
err = mods_enable_device(client, dev, NULL);
|
||||
if (err) {
|
||||
mods_error_printk("unable to enable dev %04x:%02x:%02x.%x\n",
|
||||
p->pci_device.domain,
|
||||
p->pci_device.bus,
|
||||
@@ -258,7 +258,7 @@ int esc_mods_pci_get_bar_info_2(struct file *pfile,
|
||||
mutex_unlock(mods_get_irq_mutex());
|
||||
pci_dev_put(dev);
|
||||
LOG_EXT();
|
||||
return -EINVAL;
|
||||
return err;
|
||||
}
|
||||
|
||||
mutex_unlock(mods_get_irq_mutex());
|
||||
@@ -289,7 +289,7 @@ int esc_mods_pci_get_bar_info_2(struct file *pfile,
|
||||
return OK;
|
||||
}
|
||||
|
||||
int esc_mods_pci_get_bar_info(struct file *pfile,
|
||||
int esc_mods_pci_get_bar_info(struct mods_client *client,
|
||||
struct MODS_PCI_GET_BAR_INFO *p)
|
||||
{
|
||||
int err;
|
||||
@@ -301,7 +301,7 @@ int esc_mods_pci_get_bar_info(struct file *pfile,
|
||||
get_bar_info.pci_device.function = p->pci_device.function;
|
||||
get_bar_info.bar_index = p->bar_index;
|
||||
|
||||
err = esc_mods_pci_get_bar_info_2(pfile, &get_bar_info);
|
||||
err = esc_mods_pci_get_bar_info_2(client, &get_bar_info);
|
||||
|
||||
if (likely(!err)) {
|
||||
p->base_address = get_bar_info.base_address;
|
||||
@@ -311,7 +311,7 @@ int esc_mods_pci_get_bar_info(struct file *pfile,
|
||||
return err;
|
||||
}
|
||||
|
||||
int esc_mods_pci_get_irq_2(struct file *pfile,
|
||||
int esc_mods_pci_get_irq_2(struct mods_client *client,
|
||||
struct MODS_PCI_GET_IRQ_2 *p)
|
||||
{
|
||||
struct pci_dev *dev;
|
||||
@@ -319,7 +319,7 @@ int esc_mods_pci_get_irq_2(struct file *pfile,
|
||||
|
||||
LOG_ENT();
|
||||
|
||||
err = mods_find_pci_dev(pfile, &p->pci_device, &dev);
|
||||
err = mods_find_pci_dev(client, &p->pci_device, &dev);
|
||||
if (unlikely(err)) {
|
||||
LOG_EXT();
|
||||
return err;
|
||||
@@ -340,7 +340,7 @@ int esc_mods_pci_get_irq_2(struct file *pfile,
|
||||
return OK;
|
||||
}
|
||||
|
||||
int esc_mods_pci_get_irq(struct file *pfile,
|
||||
int esc_mods_pci_get_irq(struct mods_client *client,
|
||||
struct MODS_PCI_GET_IRQ *p)
|
||||
{
|
||||
int err;
|
||||
@@ -351,7 +351,7 @@ int esc_mods_pci_get_irq(struct file *pfile,
|
||||
get_irq.pci_device.device = p->pci_device.device;
|
||||
get_irq.pci_device.function = p->pci_device.function;
|
||||
|
||||
err = esc_mods_pci_get_irq_2(pfile, &get_irq);
|
||||
err = esc_mods_pci_get_irq_2(client, &get_irq);
|
||||
|
||||
if (likely(!err))
|
||||
p->irq = get_irq.irq;
|
||||
@@ -359,14 +359,14 @@ int esc_mods_pci_get_irq(struct file *pfile,
|
||||
return err;
|
||||
}
|
||||
|
||||
int esc_mods_pci_read_2(struct file *pfile, struct MODS_PCI_READ_2 *p)
|
||||
int esc_mods_pci_read_2(struct mods_client *client, struct MODS_PCI_READ_2 *p)
|
||||
{
|
||||
struct pci_dev *dev;
|
||||
int err;
|
||||
|
||||
LOG_ENT();
|
||||
|
||||
err = mods_find_pci_dev(pfile, &p->pci_device, &dev);
|
||||
err = mods_find_pci_dev(client, &p->pci_device, &dev);
|
||||
if (unlikely(err)) {
|
||||
LOG_EXT();
|
||||
return err;
|
||||
@@ -410,7 +410,7 @@ int esc_mods_pci_read_2(struct file *pfile, struct MODS_PCI_READ_2 *p)
|
||||
return err;
|
||||
}
|
||||
|
||||
int esc_mods_pci_read(struct file *pfile, struct MODS_PCI_READ *p)
|
||||
int esc_mods_pci_read(struct mods_client *client, struct MODS_PCI_READ *p)
|
||||
{
|
||||
int err;
|
||||
struct MODS_PCI_READ_2 pci_read = { {0} };
|
||||
@@ -422,7 +422,7 @@ int esc_mods_pci_read(struct file *pfile, struct MODS_PCI_READ *p)
|
||||
pci_read.address = p->address;
|
||||
pci_read.data_size = p->data_size;
|
||||
|
||||
err = esc_mods_pci_read_2(pfile, &pci_read);
|
||||
err = esc_mods_pci_read_2(client, &pci_read);
|
||||
|
||||
if (likely(!err))
|
||||
p->data = pci_read.data;
|
||||
@@ -430,7 +430,7 @@ int esc_mods_pci_read(struct file *pfile, struct MODS_PCI_READ *p)
|
||||
return err;
|
||||
}
|
||||
|
||||
int esc_mods_pci_write_2(struct file *pfile, struct MODS_PCI_WRITE_2 *p)
|
||||
int esc_mods_pci_write_2(struct mods_client *client, struct MODS_PCI_WRITE_2 *p)
|
||||
{
|
||||
struct pci_dev *dev;
|
||||
int err;
|
||||
@@ -447,7 +447,7 @@ int esc_mods_pci_write_2(struct file *pfile, struct MODS_PCI_WRITE_2 *p)
|
||||
p->data_size,
|
||||
p->data);
|
||||
|
||||
err = mods_find_pci_dev(pfile, &p->pci_device, &dev);
|
||||
err = mods_find_pci_dev(client, &p->pci_device, &dev);
|
||||
if (unlikely(err)) {
|
||||
if (err == -ENODEV)
|
||||
mods_error_printk("PCI device %04x:%02x:%02x.%x not found\n",
|
||||
@@ -479,7 +479,7 @@ int esc_mods_pci_write_2(struct file *pfile, struct MODS_PCI_WRITE_2 *p)
|
||||
return err;
|
||||
}
|
||||
|
||||
int esc_mods_pci_write(struct file *pfile,
|
||||
int esc_mods_pci_write(struct mods_client *client,
|
||||
struct MODS_PCI_WRITE *p)
|
||||
{
|
||||
struct MODS_PCI_WRITE_2 pci_write = { {0} };
|
||||
@@ -492,10 +492,10 @@ int esc_mods_pci_write(struct file *pfile,
|
||||
pci_write.data = p->data;
|
||||
pci_write.data_size = p->data_size;
|
||||
|
||||
return esc_mods_pci_write_2(pfile, &pci_write);
|
||||
return esc_mods_pci_write_2(client, &pci_write);
|
||||
}
|
||||
|
||||
int esc_mods_pci_bus_add_dev(struct file *pfile,
|
||||
int esc_mods_pci_bus_add_dev(struct mods_client *client,
|
||||
struct MODS_PCI_BUS_ADD_DEVICES *scan)
|
||||
{
|
||||
struct pci_bus *bus;
|
||||
@@ -526,7 +526,7 @@ int esc_mods_pci_bus_add_dev(struct file *pfile,
|
||||
return err;
|
||||
}
|
||||
|
||||
int esc_mods_pci_hot_reset(struct file *pfile,
|
||||
int esc_mods_pci_hot_reset(struct mods_client *client,
|
||||
struct MODS_PCI_HOT_RESET *p)
|
||||
{
|
||||
#if defined(CONFIG_PPC64)
|
||||
@@ -542,7 +542,7 @@ int esc_mods_pci_hot_reset(struct file *pfile,
|
||||
p->pci_device.device,
|
||||
p->pci_device.function);
|
||||
|
||||
err = mods_find_pci_dev(pfile, &p->pci_device, &dev);
|
||||
err = mods_find_pci_dev(client, &p->pci_device, &dev);
|
||||
if (unlikely(err)) {
|
||||
if (err == -ENODEV)
|
||||
mods_error_printk("pci_hot_reset cannot find pci device %04x:%02x:%02x.%x\n",
|
||||
@@ -580,11 +580,47 @@ int esc_mods_pci_hot_reset(struct file *pfile,
|
||||
#endif
|
||||
}
|
||||
|
||||
int esc_mods_pci_bus_remove_dev(struct mods_client *client,
|
||||
struct MODS_PCI_BUS_REMOVE_DEV *p)
|
||||
{
|
||||
#if !defined(MODS_HASNT_PCI_BUS_REMOVE_DEV)
|
||||
struct pci_dev *dev;
|
||||
int err;
|
||||
|
||||
LOG_ENT();
|
||||
|
||||
err = mods_find_pci_dev(client, &p->pci_device, &dev);
|
||||
if (unlikely(err)) {
|
||||
if (err == -ENODEV)
|
||||
mods_error_printk("pci_remove cannot find pci device %04x:%02x:%02x.%x\n",
|
||||
p->pci_device.domain,
|
||||
p->pci_device.bus,
|
||||
p->pci_device.device,
|
||||
p->pci_device.function);
|
||||
LOG_EXT();
|
||||
return err;
|
||||
}
|
||||
|
||||
mods_debug_printk(DEBUG_PCI,
|
||||
"pci remove on %04x:%02x:%02x.%x\n",
|
||||
p->pci_device.domain,
|
||||
p->pci_device.bus,
|
||||
p->pci_device.device,
|
||||
p->pci_device.function);
|
||||
|
||||
pci_stop_and_remove_bus_device(dev);
|
||||
LOG_EXT();
|
||||
return err;
|
||||
#else
|
||||
return -EINVAL;
|
||||
#endif
|
||||
}
|
||||
|
||||
/************************
|
||||
* PIO ESCAPE FUNCTIONS *
|
||||
************************/
|
||||
|
||||
int esc_mods_pio_read(struct file *pfile, struct MODS_PIO_READ *p)
|
||||
int esc_mods_pio_read(struct mods_client *client, struct MODS_PIO_READ *p)
|
||||
{
|
||||
LOG_ENT();
|
||||
switch (p->data_size) {
|
||||
@@ -604,7 +640,7 @@ int esc_mods_pio_read(struct file *pfile, struct MODS_PIO_READ *p)
|
||||
return OK;
|
||||
}
|
||||
|
||||
int esc_mods_pio_write(struct file *pfile, struct MODS_PIO_WRITE *p)
|
||||
int esc_mods_pio_write(struct mods_client *client, struct MODS_PIO_WRITE *p)
|
||||
{
|
||||
LOG_ENT();
|
||||
switch (p->data_size) {
|
||||
@@ -624,16 +660,15 @@ int esc_mods_pio_write(struct file *pfile, struct MODS_PIO_WRITE *p)
|
||||
return OK;
|
||||
}
|
||||
|
||||
int esc_mods_device_numa_info_2(struct file *fp,
|
||||
int esc_mods_device_numa_info_2(struct mods_client *client,
|
||||
struct MODS_DEVICE_NUMA_INFO_2 *p)
|
||||
{
|
||||
#ifdef MODS_HAS_DEV_TO_NUMA_NODE
|
||||
struct pci_dev *dev;
|
||||
int err;
|
||||
|
||||
LOG_ENT();
|
||||
|
||||
err = mods_find_pci_dev(fp, &p->pci_device, &dev);
|
||||
err = mods_find_pci_dev(client, &p->pci_device, &dev);
|
||||
if (unlikely(err)) {
|
||||
if (err == -ENODEV)
|
||||
mods_error_printk("PCI device %04x:%02x:%02x.%x not found\n",
|
||||
@@ -674,24 +709,21 @@ int esc_mods_device_numa_info_2(struct file *fp,
|
||||
pci_dev_put(dev);
|
||||
LOG_EXT();
|
||||
return OK;
|
||||
#else
|
||||
return -EINVAL;
|
||||
#endif
|
||||
}
|
||||
|
||||
int esc_mods_device_numa_info(struct file *fp,
|
||||
int esc_mods_device_numa_info(struct mods_client *client,
|
||||
struct MODS_DEVICE_NUMA_INFO *p)
|
||||
{
|
||||
int err;
|
||||
int i;
|
||||
struct MODS_DEVICE_NUMA_INFO_2 numa_info = { {0} };
|
||||
|
||||
numa_info.pci_device.domain = 0;
|
||||
numa_info.pci_device.bus = p->pci_device.bus;
|
||||
numa_info.pci_device.device = p->pci_device.device;
|
||||
numa_info.pci_device.function = p->pci_device.function;
|
||||
numa_info.pci_device.domain = 0;
|
||||
numa_info.pci_device.bus = p->pci_device.bus;
|
||||
numa_info.pci_device.device = p->pci_device.device;
|
||||
numa_info.pci_device.function = p->pci_device.function;
|
||||
|
||||
err = esc_mods_device_numa_info_2(fp, &numa_info);
|
||||
err = esc_mods_device_numa_info_2(client, &numa_info);
|
||||
|
||||
if (likely(!err)) {
|
||||
p->node = numa_info.node;
|
||||
@@ -704,10 +736,10 @@ int esc_mods_device_numa_info(struct file *fp,
|
||||
return err;
|
||||
}
|
||||
|
||||
int esc_mods_get_iommu_state(struct file *pfile,
|
||||
int esc_mods_get_iommu_state(struct mods_client *client,
|
||||
struct MODS_GET_IOMMU_STATE *state)
|
||||
{
|
||||
int err = esc_mods_get_iommu_state_2(pfile, state);
|
||||
int err = esc_mods_get_iommu_state_2(client, state);
|
||||
|
||||
if (!err)
|
||||
state->state = (state->state == MODS_SWIOTLB_DISABLED) ? 1 : 0;
|
||||
@@ -715,7 +747,7 @@ int esc_mods_get_iommu_state(struct file *pfile,
|
||||
return err;
|
||||
}
|
||||
|
||||
int esc_mods_get_iommu_state_2(struct file *pfile,
|
||||
int esc_mods_get_iommu_state_2(struct mods_client *client,
|
||||
struct MODS_GET_IOMMU_STATE *state)
|
||||
{
|
||||
#if !defined(CONFIG_SWIOTLB)
|
||||
@@ -729,7 +761,7 @@ int esc_mods_get_iommu_state_2(struct file *pfile,
|
||||
|
||||
LOG_ENT();
|
||||
|
||||
err = mods_find_pci_dev(pfile, &state->pci_device, &dev);
|
||||
err = mods_find_pci_dev(client, &state->pci_device, &dev);
|
||||
if (unlikely(err)) {
|
||||
LOG_EXT();
|
||||
return err;
|
||||
@@ -758,7 +790,7 @@ int esc_mods_get_iommu_state_2(struct file *pfile,
|
||||
return OK;
|
||||
}
|
||||
|
||||
int esc_mods_pci_set_dma_mask(struct file *file,
|
||||
int esc_mods_pci_set_dma_mask(struct mods_client *client,
|
||||
struct MODS_PCI_DMA_MASK *dma_mask)
|
||||
{
|
||||
int err;
|
||||
@@ -774,7 +806,7 @@ int esc_mods_pci_set_dma_mask(struct file *file,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
err = mods_find_pci_dev(file, &dma_mask->pci_device, &dev);
|
||||
err = mods_find_pci_dev(client, &dma_mask->pci_device, &dev);
|
||||
if (unlikely(err)) {
|
||||
if (err == -ENODEV)
|
||||
mods_error_printk("PCI device %04x:%02x:%02x.%x not found\n",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* mods_tegradc.c - This file is part of NVIDIA MODS kernel driver.
|
||||
*
|
||||
* Copyright (c) 2014-2018, NVIDIA CORPORATION. All rights reserved.
|
||||
* Copyright (c) 2014-2019, NVIDIA CORPORATION. All rights reserved.
|
||||
*
|
||||
* NVIDIA MODS kernel driver is free software: you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License,
|
||||
@@ -60,7 +60,7 @@ static void mods_tegra_dc_set_windowattr_basic(struct tegra_dc_win *win,
|
||||
win->out_h);
|
||||
}
|
||||
|
||||
int esc_mods_tegra_dc_config_possible(struct file *fp,
|
||||
int esc_mods_tegra_dc_config_possible(struct mods_client *client,
|
||||
struct MODS_TEGRA_DC_CONFIG_POSSIBLE *args)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* mods_tegraprod.c - This file is part of NVIDIA MODS kernel driver.
|
||||
*
|
||||
* Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved.
|
||||
* Copyright (c) 2017-2019, NVIDIA CORPORATION. All rights reserved.
|
||||
*
|
||||
* NVIDIA MODS kernel driver is free software: you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License,
|
||||
@@ -66,7 +66,7 @@ int mods_tegra_prod_init(const struct miscdevice *misc_dev)
|
||||
* Returns 0 on success, others for error or no matching node found.
|
||||
*/
|
||||
int esc_mods_tegra_prod_iterate_dt(
|
||||
struct file *fp,
|
||||
struct mods_client *client,
|
||||
struct MODS_TEGRA_PROD_ITERATOR *iterator
|
||||
)
|
||||
{
|
||||
@@ -432,7 +432,7 @@ static int mods_tegra_get_prod_info(
|
||||
*
|
||||
*/
|
||||
int esc_mods_tegra_prod_is_supported(
|
||||
struct file *fp,
|
||||
struct mods_client *client,
|
||||
struct MODS_TEGRA_PROD_IS_SUPPORTED *tuple
|
||||
)
|
||||
{
|
||||
@@ -476,7 +476,7 @@ int esc_mods_tegra_prod_is_supported(
|
||||
*
|
||||
*/
|
||||
int esc_mods_tegra_prod_set_prod_all(
|
||||
struct file *fp,
|
||||
struct mods_client *client,
|
||||
struct MODS_TEGRA_PROD_SET_TUPLE *tuple
|
||||
)
|
||||
{
|
||||
@@ -515,7 +515,7 @@ int esc_mods_tegra_prod_set_prod_all(
|
||||
*
|
||||
*/
|
||||
int esc_mods_tegra_prod_set_prod_boot(
|
||||
struct file *fp,
|
||||
struct mods_client *client,
|
||||
struct MODS_TEGRA_PROD_SET_TUPLE *tuple
|
||||
)
|
||||
{
|
||||
@@ -555,7 +555,7 @@ int esc_mods_tegra_prod_set_prod_boot(
|
||||
*
|
||||
*/
|
||||
int esc_mods_tegra_prod_set_prod_by_name(
|
||||
struct file *fp,
|
||||
struct mods_client *client,
|
||||
struct MODS_TEGRA_PROD_SET_TUPLE *tuple
|
||||
)
|
||||
{
|
||||
@@ -601,7 +601,7 @@ int esc_mods_tegra_prod_set_prod_by_name(
|
||||
*
|
||||
*/
|
||||
int esc_mods_tegra_prod_set_prod_exact(
|
||||
struct file *fp,
|
||||
struct mods_client *client,
|
||||
struct MODS_TEGRA_PROD_SET_TUPLE *tuple
|
||||
)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user