From 51d4ae99d97481375c58925b25b1930d3424832d Mon Sep 17 00:00:00 2001 From: Chris Dragan Date: Mon, 9 Oct 2023 03:44:24 -0700 Subject: [PATCH] misc: mods: update from Perforce to 4.22 Bug 4119327 Change-Id: I7704293f7fce103e9fba6b088da8081987da36c5 Signed-off-by: Chris Dragan Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2993627 GVS: Gerrit_Virtual_Submit Reviewed-by: Sachin Nikam --- drivers/misc/mods/mods_acpi.c | 42 +++++++++---------------------- drivers/misc/mods/mods_config.h | 10 ++++++-- drivers/misc/mods/mods_internal.h | 2 ++ drivers/misc/mods/mods_krnl.c | 2 +- drivers/misc/mods/mods_mem.c | 6 ++--- include/uapi/misc/mods.h | 2 +- 6 files changed, 27 insertions(+), 37 deletions(-) diff --git a/drivers/misc/mods/mods_acpi.c b/drivers/misc/mods/mods_acpi.c index caee6879..e19f84fc 100644 --- a/drivers/misc/mods/mods_acpi.c +++ b/drivers/misc/mods/mods_acpi.c @@ -76,17 +76,19 @@ struct acpi_dev_check_context { void *out_data; }; -static int acpi_dev_check_one(struct acpi_device *adev, void *data) +static int acpi_dev_check_one(struct device *dev, void *data) { - int err = OK; - unsigned long long device_id = 0; - acpi_status status; - struct acpi_dev_check_context *adwc = data; + struct acpi_dev_check_context *adwc = data; + struct acpi_device *adev = to_acpi_device(dev); + int err = OK; + unsigned long long device_id = 0; + acpi_status status; - status = acpi_evaluate_integer(adev->handle, - "_ADR", - NULL, - &device_id); + if (!adev) + /* No ACPI device corresponding to this device */ + return OK; + + status = acpi_evaluate_integer(adev->handle, "_ADR", NULL, &device_id); if (ACPI_FAILURE(status)) /* Couldnt query device_id for this device */ return OK; @@ -95,26 +97,6 @@ static int acpi_dev_check_one(struct acpi_device *adev, void *data) return ((err == -EALREADY) ? OK : err); } -#if KERNEL_VERSION(6, 0, 0) > MODS_KERNEL_VERSION -static int acpi_dev_each_child_node(struct acpi_device *adev, - int (*fptr)(struct acpi_device *, void *), - void *data) -{ - struct list_head *node = NULL; - struct list_head *next = NULL; - - list_for_each_safe(node, next, &adev->children) { - struct acpi_device *dev = - list_entry(node, struct acpi_device, node); - - fptr(dev, data); - } - return OK; -} -#else -#define acpi_dev_each_child_node acpi_dev_for_each_child -#endif - static int acpi_get_dev_children(struct mods_client *client, dev_children_fptr fptr, acpi_handle dev_handle, @@ -139,7 +121,7 @@ static int acpi_get_dev_children(struct mods_client *client, if (unlikely(err)) cl_error("ACPI: device for fetching device children not found\n"); else - err = acpi_dev_each_child_node(device, acpi_dev_check_one, &adcc); + err = device_for_each_child(&device->dev, &adcc, acpi_dev_check_one); LOG_EXT(); return err; diff --git a/drivers/misc/mods/mods_config.h b/drivers/misc/mods/mods_config.h index 3c32ea97..42f65a22 100644 --- a/drivers/misc/mods/mods_config.h +++ b/drivers/misc/mods/mods_config.h @@ -104,8 +104,14 @@ # define IS_BUILTIN(c) 0 #endif -#if (defined(CONFIG_ARM_FFA_TRANSPORT) && defined(ALLOW_ARM_FFA_TRANSPORT_AS_MODULE)) || \ - IS_BUILTIN(CONFIG_ARM_FFA_TRANSPORT) +#ifndef IS_MODULE +# define IS_MODULE(c) 0 +#endif + +#if ((defined(CONFIG_ARM_FFA_TRANSPORT) || \ + IS_MODULE(CONFIG_ARM_FFA_TRANSPORT)) && \ + defined(ALLOW_ARM_FFA_TRANSPORT_AS_MODULE)) || \ + IS_BUILTIN(CONFIG_ARM_FFA_TRANSPORT) # define MODS_HAS_ARM_FFA #endif diff --git a/drivers/misc/mods/mods_internal.h b/drivers/misc/mods/mods_internal.h index 63e839a5..910e8378 100644 --- a/drivers/misc/mods/mods_internal.h +++ b/drivers/misc/mods/mods_internal.h @@ -355,8 +355,10 @@ struct mods_priv { #if KERNEL_VERSION(5, 11, 0) <= MODS_KERNEL_VERSION # define MODS_KMAP kmap_local_page +# define MODS_KUNMAP kunmap_local #else # define MODS_KMAP kmap +# define MODS_KUNMAP kunmap #endif /* ************************************************************************* */ diff --git a/drivers/misc/mods/mods_krnl.c b/drivers/misc/mods/mods_krnl.c index a4405c76..5a29597f 100644 --- a/drivers/misc/mods/mods_krnl.c +++ b/drivers/misc/mods/mods_krnl.c @@ -1012,7 +1012,7 @@ static int mods_krnl_vma_access(struct vm_area_struct *vma, else memcpy(buf, bptr, len); - kunmap(ptr); + MODS_KUNMAP(ptr); err = len; } else diff --git a/drivers/misc/mods/mods_mem.c b/drivers/misc/mods/mods_mem.c index 66e02f3d..1e281b09 100644 --- a/drivers/misc/mods/mods_mem.c +++ b/drivers/misc/mods/mods_mem.c @@ -428,7 +428,7 @@ static int setup_cache_attr(struct mods_client *client, else err = MODS_SET_MEMORY_UC((unsigned long)ptr, 1); #endif - kunmap(ptr); + MODS_KUNMAP(ptr); if (unlikely(err)) { cl_error("set cache type failed\n"); return err; @@ -547,7 +547,7 @@ static int restore_cache_one_chunk(struct page *p_page, u8 order) if (likely(ptr)) err = MODS_SET_MEMORY_WB((unsigned long)ptr, 1); - kunmap(ptr); + MODS_KUNMAP(ptr); if (likely(!final_err)) final_err = err; @@ -2461,7 +2461,7 @@ static void clear_contiguous_cache(struct mods_client *client, static u32 d_line_shift; if (!d_line_shift) { -#if KERNEL_VERSION(6, 0, 0) <= MODS_KERNEL_VERSION +#ifdef CTR_EL0_DminLine_SHIFT const u64 ctr_el0 = read_sanitised_ftr_reg(SYS_CTR_EL0); d_line_shift = diff --git a/include/uapi/misc/mods.h b/include/uapi/misc/mods.h index f5a5dc6b..72cd04a0 100644 --- a/include/uapi/misc/mods.h +++ b/include/uapi/misc/mods.h @@ -8,7 +8,7 @@ /* Driver version */ #define MODS_DRIVER_VERSION_MAJOR 4 -#define MODS_DRIVER_VERSION_MINOR 21 +#define MODS_DRIVER_VERSION_MINOR 22 #define MODS_DRIVER_VERSION ((MODS_DRIVER_VERSION_MAJOR << 8) | \ ((MODS_DRIVER_VERSION_MINOR / 10) << 4) | \ (MODS_DRIVER_VERSION_MINOR % 10))