diff -Nru ivsc-driver-0~git202212210258.94ecb88b/backport-include/drivers/misc/mei/hw.h ivsc-driver-0~git202311021215.73a044d9/backport-include/drivers/misc/mei/hw.h --- ivsc-driver-0~git202212210258.94ecb88b/backport-include/drivers/misc/mei/hw.h 2023-01-06 11:59:51.000000000 +0800 +++ ivsc-driver-0~git202311021215.73a044d9/backport-include/drivers/misc/mei/hw.h 2023-11-09 13:09:25.000000000 +0800 @@ -95,6 +95,14 @@ #define HBM_MINOR_VERSION_VT 2 #define HBM_MAJOR_VERSION_VT 2 +#if LINUX_VERSION_CODE > KERNEL_VERSION(6, 2, 0) +/* + * MEI version with GSC support + */ +#define HBM_MINOR_VERSION_GSC 2 +#define HBM_MAJOR_VERSION_GSC 2 +#endif + /* * MEI version with capabilities message support */ @@ -236,6 +244,7 @@ enum mei_ext_hdr_type { MEI_EXT_HDR_NONE = 0, MEI_EXT_HDR_VTAG = 1, + MEI_EXT_HDR_GSC = 2, }; /** @@ -331,6 +340,62 @@ return (u8 *)ext >= (u8 *)meta + sizeof(*meta) + (meta->size * 4); } +#if LINUX_VERSION_CODE > KERNEL_VERSION(6, 2, 0) +struct mei_gsc_sgl { + u32 low; + u32 high; + u32 length; +} __packed; + +#define GSC_HECI_MSG_KERNEL 0 +#define GSC_HECI_MSG_USER 1 + +#define GSC_ADDRESS_TYPE_GTT 0 +#define GSC_ADDRESS_TYPE_PPGTT 1 +#define GSC_ADDRESS_TYPE_PHYSICAL_CONTINUOUS 2 /* max of 64K */ +#define GSC_ADDRESS_TYPE_PHYSICAL_SGL 3 + +/** + * struct mei_ext_hdr_gsc_h2f - extended header: gsc host to firmware interface + * + * @hdr: extended header + * @client_id: GSC_HECI_MSG_KERNEL or GSC_HECI_MSG_USER + * @addr_type: GSC_ADDRESS_TYPE_{GTT, PPGTT, PHYSICAL_CONTINUOUS, PHYSICAL_SGL} + * @fence_id: synchronization marker + * @input_address_count: number of input sgl buffers + * @output_address_count: number of output sgl buffers + * @reserved: reserved + * @sgl: sg list + */ +struct mei_ext_hdr_gsc_h2f { + struct mei_ext_hdr hdr; + u8 client_id; + u8 addr_type; + u32 fence_id; + u8 input_address_count; + u8 output_address_count; + u8 reserved[2]; + struct mei_gsc_sgl sgl[]; +} __packed; + +/** + * struct mei_ext_hdr_gsc_f2h - gsc firmware to host interface + * + * @hdr: extended header + * @client_id: GSC_HECI_MSG_KERNEL or GSC_HECI_MSG_USER + * @reserved: reserved + * @fence_id: synchronization marker + * @written: number of bytes written to firmware + */ +struct mei_ext_hdr_gsc_f2h { + struct mei_ext_hdr hdr; + u8 client_id; + u8 reserved; + u32 fence_id; + u32 written; +} __packed; +#endif + /** * mei_ext_next - following extended header on the TLV list * @@ -350,6 +415,23 @@ #endif } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 2, 0) +/** + * mei_ext_hdr_len - get ext header length in bytes + * + * @ext: extend header + * + * Return: extend header length in bytes + */ +static inline u32 mei_ext_hdr_len(const struct mei_ext_hdr *ext) +{ + if (!ext) + return 0; + + return ext->length * sizeof(u32); +} +#endif + /** * struct mei_msg_hdr - MEI BUS Interface Section * @@ -712,6 +794,8 @@ /* virtual tag supported */ #define HBM_CAP_VT BIT(0) +/* gsc extended header support */ +#define HBM_CAP_GSC BIT(1) /* client dma supported */ #define HBM_CAP_CD BIT(2) diff -Nru ivsc-driver-0~git202212210258.94ecb88b/backport-include/drivers/misc/mei/mei_dev.h ivsc-driver-0~git202311021215.73a044d9/backport-include/drivers/misc/mei/mei_dev.h --- ivsc-driver-0~git202212210258.94ecb88b/backport-include/drivers/misc/mei/mei_dev.h 2023-01-06 11:59:51.000000000 +0800 +++ ivsc-driver-0~git202311021215.73a044d9/backport-include/drivers/misc/mei/mei_dev.h 2023-11-09 13:09:25.000000000 +0800 @@ -14,6 +14,13 @@ #include #include +#if LINUX_VERSION_CODE > KERNEL_VERSION(6, 3, 0) +static inline int uuid_le_cmp(const uuid_le u1, const uuid_le u2) +{ + return memcmp(&u1, &u2, sizeof(uuid_le)); +} +#endif + #include "hw.h" #include "hbm.h" @@ -123,6 +130,8 @@ MEI_CL_IO_TX_INTERNAL = BIT(1), MEI_CL_IO_RX_NONBLOCK = BIT(2), + + MEI_CL_IO_SGL = BIT(3), }; /* @@ -219,6 +228,9 @@ int status; u32 internal:1; u32 blocking:1; +#if LINUX_VERSION_CODE > KERNEL_VERSION(6, 2, 0) + struct mei_ext_hdr *ext_hdr; +#endif }; /** @@ -380,6 +392,10 @@ ssize_t __mei_cl_send(struct mei_cl *cl, const u8 *buf, size_t length, u8 vtag, unsigned int mode); #endif +#if LINUX_VERSION_CODE > KERNEL_VERSION(6, 2, 0) +ssize_t __mei_cl_send_timeout(struct mei_cl *cl, const u8 *buf, size_t length, u8 vtag, + unsigned int mode, unsigned long timeout); +#endif ssize_t __mei_cl_recv(struct mei_cl *cl, u8 *buf, size_t length, u8 *vtag, unsigned int mode, unsigned long timeout); bool mei_cl_bus_rx_event(struct mei_cl *cl); @@ -598,6 +614,7 @@ unsigned int hbm_f_vt_supported:1; unsigned int hbm_f_cap_supported:1; unsigned int hbm_f_cd_supported:1; + unsigned int hbm_f_gsc_supported:1; struct mei_fw_version fw_ver[MEI_MAX_FW_VER_BLOCKS]; diff -Nru ivsc-driver-0~git202212210258.94ecb88b/debian/changelog ivsc-driver-0~git202311021215.73a044d9/debian/changelog --- ivsc-driver-0~git202212210258.94ecb88b/debian/changelog 2023-08-23 00:11:46.000000000 +0800 +++ ivsc-driver-0~git202311021215.73a044d9/debian/changelog 2023-12-01 00:13:52.000000000 +0800 @@ -1,3 +1,12 @@ +ivsc-driver (0~git202311021215.73a044d9-0ubuntu1~exp.1) noble; urgency=low + + [ You-Sheng Yang ] + * Intel IPU6 camera support for Dell MayaBay MLK (LP: #2044991) + - new upstream Release_20231127 release + - debian: drop patches already included in the upstream release + + -- You-Sheng Yang Fri, 01 Dec 2023 00:13:52 +0800 + ivsc-driver (0~git202212210258.94ecb88b-0ubuntu0.24.04.1) noble; urgency=low [ You-Sheng Yang ] diff -Nru ivsc-driver-0~git202212210258.94ecb88b/debian/patches/0002-add-support-for-MTL-board.patch ivsc-driver-0~git202311021215.73a044d9/debian/patches/0002-add-support-for-MTL-board.patch --- ivsc-driver-0~git202212210258.94ecb88b/debian/patches/0002-add-support-for-MTL-board.patch 2023-05-01 22:12:57.000000000 +0800 +++ ivsc-driver-0~git202311021215.73a044d9/debian/patches/0002-add-support-for-MTL-board.patch 1970-01-01 08:00:00.000000000 +0800 @@ -1,90 +0,0 @@ -From: Ye Xiang -Date: Fri, 10 Mar 2023 01:59:08 +0800 -Subject: add support for MTL board - -Add MTL device ID to LJCA and MEI drivers. - -Signed-off-by: Ye Xiang -(cherry picked from commit c8db12b907e2e455d4d5586e5812d1ae0eebd571 https://github.com/intel/ivsc-driver) -Signed-off-by: You-Sheng Yang ---- - drivers/mfd/ljca.c | 3 +++ - drivers/misc/mei/spi-vsc.c | 19 ++++++++++--------- - 2 files changed, 13 insertions(+), 9 deletions(-) - -diff --git a/drivers/mfd/ljca.c b/drivers/mfd/ljca.c -index fabec0f..f4d1448 100644 ---- a/drivers/mfd/ljca.c -+++ b/drivers/mfd/ljca.c -@@ -29,6 +29,7 @@ static char *gpio_hids[] = { - "INTC1074", /* TGL */ - "INTC1096", /* ADL */ - "INTC100B", /* RPL */ -+ "INTC10D1", /* MTL */ - }; - static struct mfd_cell_acpi_match ljca_acpi_match_gpio; - -@@ -36,6 +37,7 @@ static char *i2c_hids[] = { - "INTC1075", /* TGL */ - "INTC1097", /* ADL */ - "INTC100C", /* RPL */ -+ "INTC10D2", /* MTL */ - }; - static struct mfd_cell_acpi_match ljca_acpi_match_i2cs[2]; - -@@ -43,6 +45,7 @@ static char *spi_hids[] = { - "INTC1091", /* TGL */ - "INTC1098", /* ADL */ - "INTC100D", /* RPL */ -+ "INTC10D3", /* MTL */ - }; - static struct mfd_cell_acpi_match ljca_acpi_match_spis[1]; - -diff --git a/drivers/misc/mei/spi-vsc.c b/drivers/misc/mei/spi-vsc.c -index 5b16d64..e97664e 100644 ---- a/drivers/misc/mei/spi-vsc.c -+++ b/drivers/misc/mei/spi-vsc.c -@@ -16,9 +16,6 @@ - - #include "hw-vsc.h" - --#define CVFD_ACPI_ID_TGL "INTC1059" --#define CVFD_ACPI_ID_ADL "INTC1095" --#define CVFD_ACPI_ID_RPL "INTC100A" - #define LINK_NUMBER (1) - #define METHOD_NAME_SID "SID" - -@@ -37,13 +34,16 @@ static const struct acpi_gpio_mapping mei_vsc_acpi_gpios[] = { - - static struct acpi_device_id cvfd_ids[] = { - { -- .id = CVFD_ACPI_ID_TGL, -+ .id = "INTC1059", - }, - { -- .id = CVFD_ACPI_ID_ADL, -+ .id = "INTC1095", - }, - { -- .id = CVFD_ACPI_ID_RPL, -+ .id = "INTC100A", -+ }, -+ { -+ .id = "INTC10CF", - }, - }; - -@@ -329,9 +329,10 @@ static const struct dev_pm_ops mei_vsc_pm_ops = { - }; - - static const struct acpi_device_id mei_vsc_acpi_ids[] = { -- { "INTC1058", 1 }, -- { "INTC1094", 1 }, -- { "INTC1009", 1 }, /* RPL */ -+ { "INTC1058"}, -+ { "INTC1094"}, -+ { "INTC1009"}, /* RPL */ -+ { "INTC10D0"}, /* MTL */ - {}, - }; - MODULE_DEVICE_TABLE(acpi, mei_vsc_acpi_ids); diff -Nru ivsc-driver-0~git202212210258.94ecb88b/debian/patches/0004-ljca-try-to-find-acpi-device-from-hub-device.patch ivsc-driver-0~git202311021215.73a044d9/debian/patches/0004-ljca-try-to-find-acpi-device-from-hub-device.patch --- ivsc-driver-0~git202212210258.94ecb88b/debian/patches/0004-ljca-try-to-find-acpi-device-from-hub-device.patch 2023-08-23 00:11:46.000000000 +0800 +++ ivsc-driver-0~git202311021215.73a044d9/debian/patches/0004-ljca-try-to-find-acpi-device-from-hub-device.patch 1970-01-01 08:00:00.000000000 +0800 @@ -1,192 +0,0 @@ -From: Ye Xiang -Date: Wed, 22 Mar 2023 02:24:26 +0800 -Subject: ljca: try to find acpi device from hub device - -BugLink: https://bugs.launchpad.net/bugs/2031412 - -On MTL platforms, the parent for LJCA sub-devices changes from the USB -device to it's parent (RHUB). This patch makes the acpi binding of LJCA -sub-devices compatible on MTL platforms. - -Signed-off-by: Ye Xiang -(cherry picked from commit e1bb9fc0b4777265ab65ece21a8c634d1478666f) -Signed-off-by: You-Sheng Yang ---- - drivers/mfd/ljca.c | 96 ++++++++++++++++++++++++++++++++++++++---------------- - 1 file changed, 68 insertions(+), 28 deletions(-) - -diff --git a/drivers/mfd/ljca.c b/drivers/mfd/ljca.c -index f4d1448..e47be7c 100644 ---- a/drivers/mfd/ljca.c -+++ b/drivers/mfd/ljca.c -@@ -211,55 +211,94 @@ struct ljca_dev { - struct mutex mutex; - }; - --static int try_match_acpi_hid(struct acpi_device *child, -- struct mfd_cell_acpi_match *match, char **hids, -- int hids_num) -+/* parent of sub-devices */ -+struct device *sub_dev_parent; -+struct device *cur_dev; -+ -+static int try_match_acpi_hid(struct acpi_device *child, char **hids, int hids_num) - { - struct acpi_device_id ids[2] = {}; - int i; - - for (i = 0; i < hids_num; i++) { - strlcpy(ids[0].id, hids[i], sizeof(ids[0].id)); -- if (!acpi_match_device_ids(child, ids)) { -- match->pnpid = hids[i]; -- break; -- } -+ if (!acpi_match_device_ids(child, ids)) -+ return i; - } - -- return 0; -+ return -ENODEV; - } - - static int match_device_ids(struct acpi_device *adev, void *data) - { -- (void)data; -- try_match_acpi_hid(adev, &ljca_acpi_match_gpio, gpio_hids, -- ARRAY_SIZE(gpio_hids)); -- try_match_acpi_hid(adev, &ljca_acpi_match_i2cs[0], i2c_hids, -- ARRAY_SIZE(i2c_hids)); -- try_match_acpi_hid(adev, &ljca_acpi_match_i2cs[1], i2c_hids, -- ARRAY_SIZE(i2c_hids)); -- try_match_acpi_hid(adev, &ljca_acpi_match_spis[0], spi_hids, -- ARRAY_SIZE(spi_hids)); -+ int ret; -+ int *child_count = data; -+ -+ dev_dbg(&adev->dev, "adev->dep_unmet %d %d\n", adev->dep_unmet, *child_count); -+ -+ /* dependency not ready */ -+ if (adev->dep_unmet) -+ return -ENODEV; -+ -+ ret = try_match_acpi_hid(adev, gpio_hids, ARRAY_SIZE(gpio_hids)); -+ if (ret > 0) { -+ ljca_acpi_match_gpio.pnpid = gpio_hids[ret]; -+ (*child_count)++; -+ } -+ -+ ret = try_match_acpi_hid(adev, i2c_hids, ARRAY_SIZE(i2c_hids)); -+ if (ret > 0) { -+ ljca_acpi_match_i2cs[0].pnpid = i2c_hids[ret]; -+ ljca_acpi_match_i2cs[1].pnpid = i2c_hids[ret]; -+ (*child_count)++; -+ } -+ -+ ret = try_match_acpi_hid(adev, spi_hids, ARRAY_SIZE(spi_hids)); -+ if (ret > 0) { -+ ljca_acpi_match_spis[0].pnpid = spi_hids[ret]; -+ (*child_count)++; -+ } - - return 0; - } - - static int precheck_acpi_hid(struct usb_interface *intf) - { -- struct acpi_device *parent; -+ struct device *parents[2]; -+ int i; -+ int child_count; - #if LINUX_VERSION_CODE < KERNEL_VERSION(6, 0, 0) - struct acpi_device *child; - #endif - -- parent = ACPI_COMPANION(&intf->dev); -- if (!parent) -+ parents[0] = &intf->dev; -+ parents[1] = intf->dev.parent->parent; -+ if (!parents[0] || !parents[1]) - return -ENODEV; - -+ acpi_dev_clear_dependencies(ACPI_COMPANION(parents[0])); -+ sub_dev_parent = parents[0]; -+ - #if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 0, 0) -- acpi_dev_for_each_child(parent, match_device_ids, NULL); -+ for (i = 0; i < ARRAY_SIZE(parents); i++) { -+ child_count = 0; -+ acpi_dev_for_each_child(ACPI_COMPANION(parents[i]), match_device_ids, &child_count); -+ if (child_count > 0) { -+ sub_dev_parent = parents[i]; -+ break; -+ } -+ } - #else -- list_for_each_entry (child, &parent->children, node) { -- match_device_ids(child, NULL); -+ for (i = 0; i < ARRAY_SIZE(parents); i++) { -+ child_count = 0; -+ list_for_each_entry(child, &(ACPI_COMPANION(parents[i])->children), node) { -+ match_device_ids(child, &child_count); -+ } -+ -+ if (child_count > 0) { -+ sub_dev_parent = parents[i]; -+ break; -+ } - } - #endif - -@@ -443,7 +482,7 @@ static int ljca_transfer_internal(struct platform_device *pdev, u8 cmd, - if (!pdev) - return -EINVAL; - -- ljca = dev_get_drvdata(pdev->dev.parent); -+ ljca = dev_get_drvdata(cur_dev); - ljca_pdata = dev_get_platdata(&pdev->dev); - stub = ljca_stub_find(ljca, ljca_pdata->type); - if (IS_ERR(stub)) -@@ -480,7 +519,7 @@ int ljca_register_event_cb(struct platform_device *pdev, - if (!pdev) - return -EINVAL; - -- ljca = dev_get_drvdata(pdev->dev.parent); -+ ljca = dev_get_drvdata(cur_dev); - ljca_pdata = dev_get_platdata(&pdev->dev); - stub = ljca_stub_find(ljca, ljca_pdata->type); - if (IS_ERR(stub)) -@@ -502,7 +541,7 @@ void ljca_unregister_event_cb(struct platform_device *pdev) - struct ljca_stub *stub; - unsigned long flags; - -- ljca = dev_get_drvdata(pdev->dev.parent); -+ ljca = dev_get_drvdata(cur_dev); - ljca_pdata = dev_get_platdata(&pdev->dev); - stub = ljca_stub_find(ljca, ljca_pdata->type); - if (IS_ERR(stub)) -@@ -1068,6 +1107,7 @@ static int ljca_probe(struct usb_interface *intf, - struct usb_endpoint_descriptor *bulk_in, *bulk_out; - int ret; - -+ cur_dev = &intf->dev; - ret = precheck_acpi_hid(intf); - if (ret) - return ret; -@@ -1128,7 +1168,7 @@ static int ljca_probe(struct usb_interface *intf, - goto error_stop; - } - -- ret = mfd_add_hotplug_devices(&intf->dev, ljca->cells, -+ ret = mfd_add_hotplug_devices(sub_dev_parent, ljca->cells, - ljca->cell_count); - if (ret) { - dev_err(&intf->dev, "failed to add mfd devices to core %d\n", -@@ -1157,7 +1197,7 @@ static void ljca_disconnect(struct usb_interface *intf) - - ljca_stop(ljca); - ljca->state = LJCA_STOPPED; -- mfd_remove_devices(&intf->dev); -+ mfd_remove_devices(sub_dev_parent); - ljca_stub_cleanup(ljca); - usb_set_intfdata(intf, NULL); - ljca_delete(ljca); diff -Nru ivsc-driver-0~git202212210258.94ecb88b/debian/patches/0005-mei-vsc-port-mei-api-change-in-v6.2.patch ivsc-driver-0~git202311021215.73a044d9/debian/patches/0005-mei-vsc-port-mei-api-change-in-v6.2.patch --- ivsc-driver-0~git202212210258.94ecb88b/debian/patches/0005-mei-vsc-port-mei-api-change-in-v6.2.patch 2023-08-23 00:11:46.000000000 +0800 +++ ivsc-driver-0~git202311021215.73a044d9/debian/patches/0005-mei-vsc-port-mei-api-change-in-v6.2.patch 1970-01-01 08:00:00.000000000 +0800 @@ -1,199 +0,0 @@ -From: Ye Xiang -Date: Tue, 28 Mar 2023 21:38:40 +0800 -Subject: mei-vsc: port mei api change in v6.2 - -BugLink: https://bugs.launchpad.net/bugs/2031412 - -Since MEI API has been changed in mainline kernel in v6.2, -this patch port the API change in two mainline patchs. - -1. mei: add support to GSC extended header -2. mei: Move uuid_le_cmp() to its only user - -Signed-off-by: Ye Xiang -(cherry picked from commit cce4377f1539f3e7e8d8b45fbe23e87828ed1deb) -Signed-off-by: You-Sheng Yang ---- - backport-include/drivers/misc/mei/hw.h | 84 +++++++++++++++++++++++++++++ - backport-include/drivers/misc/mei/mei_dev.h | 17 ++++++ - 2 files changed, 101 insertions(+) - -diff --git a/backport-include/drivers/misc/mei/hw.h b/backport-include/drivers/misc/mei/hw.h -index 377cf47..59f23b8 100644 ---- a/backport-include/drivers/misc/mei/hw.h -+++ b/backport-include/drivers/misc/mei/hw.h -@@ -95,6 +95,14 @@ - #define HBM_MINOR_VERSION_VT 2 - #define HBM_MAJOR_VERSION_VT 2 - -+#if LINUX_VERSION_CODE > KERNEL_VERSION(6, 2, 0) -+/* -+ * MEI version with GSC support -+ */ -+#define HBM_MINOR_VERSION_GSC 2 -+#define HBM_MAJOR_VERSION_GSC 2 -+#endif -+ - /* - * MEI version with capabilities message support - */ -@@ -236,6 +244,7 @@ enum mei_cl_disconnect_status { - enum mei_ext_hdr_type { - MEI_EXT_HDR_NONE = 0, - MEI_EXT_HDR_VTAG = 1, -+ MEI_EXT_HDR_GSC = 2, - }; - - /** -@@ -331,6 +340,62 @@ static inline bool mei_ext_last(struct mei_ext_meta_hdr *meta, - return (u8 *)ext >= (u8 *)meta + sizeof(*meta) + (meta->size * 4); - } - -+#if LINUX_VERSION_CODE > KERNEL_VERSION(6, 2, 0) -+struct mei_gsc_sgl { -+ u32 low; -+ u32 high; -+ u32 length; -+} __packed; -+ -+#define GSC_HECI_MSG_KERNEL 0 -+#define GSC_HECI_MSG_USER 1 -+ -+#define GSC_ADDRESS_TYPE_GTT 0 -+#define GSC_ADDRESS_TYPE_PPGTT 1 -+#define GSC_ADDRESS_TYPE_PHYSICAL_CONTINUOUS 2 /* max of 64K */ -+#define GSC_ADDRESS_TYPE_PHYSICAL_SGL 3 -+ -+/** -+ * struct mei_ext_hdr_gsc_h2f - extended header: gsc host to firmware interface -+ * -+ * @hdr: extended header -+ * @client_id: GSC_HECI_MSG_KERNEL or GSC_HECI_MSG_USER -+ * @addr_type: GSC_ADDRESS_TYPE_{GTT, PPGTT, PHYSICAL_CONTINUOUS, PHYSICAL_SGL} -+ * @fence_id: synchronization marker -+ * @input_address_count: number of input sgl buffers -+ * @output_address_count: number of output sgl buffers -+ * @reserved: reserved -+ * @sgl: sg list -+ */ -+struct mei_ext_hdr_gsc_h2f { -+ struct mei_ext_hdr hdr; -+ u8 client_id; -+ u8 addr_type; -+ u32 fence_id; -+ u8 input_address_count; -+ u8 output_address_count; -+ u8 reserved[2]; -+ struct mei_gsc_sgl sgl[]; -+} __packed; -+ -+/** -+ * struct mei_ext_hdr_gsc_f2h - gsc firmware to host interface -+ * -+ * @hdr: extended header -+ * @client_id: GSC_HECI_MSG_KERNEL or GSC_HECI_MSG_USER -+ * @reserved: reserved -+ * @fence_id: synchronization marker -+ * @written: number of bytes written to firmware -+ */ -+struct mei_ext_hdr_gsc_f2h { -+ struct mei_ext_hdr hdr; -+ u8 client_id; -+ u8 reserved; -+ u32 fence_id; -+ u32 written; -+} __packed; -+#endif -+ - /** - * mei_ext_next - following extended header on the TLV list - * -@@ -350,6 +415,23 @@ static inline struct mei_ext_hdr *mei_ext_next(struct mei_ext_hdr *ext) - #endif - } - -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 2, 0) -+/** -+ * mei_ext_hdr_len - get ext header length in bytes -+ * -+ * @ext: extend header -+ * -+ * Return: extend header length in bytes -+ */ -+static inline u32 mei_ext_hdr_len(const struct mei_ext_hdr *ext) -+{ -+ if (!ext) -+ return 0; -+ -+ return ext->length * sizeof(u32); -+} -+#endif -+ - /** - * struct mei_msg_hdr - MEI BUS Interface Section - * -@@ -712,6 +794,8 @@ struct hbm_dma_ring_ctrl { - - /* virtual tag supported */ - #define HBM_CAP_VT BIT(0) -+/* gsc extended header support */ -+#define HBM_CAP_GSC BIT(1) - /* client dma supported */ - #define HBM_CAP_CD BIT(2) - -diff --git a/backport-include/drivers/misc/mei/mei_dev.h b/backport-include/drivers/misc/mei/mei_dev.h -index 6031ad4..3a90404 100644 ---- a/backport-include/drivers/misc/mei/mei_dev.h -+++ b/backport-include/drivers/misc/mei/mei_dev.h -@@ -14,6 +14,13 @@ - #include - #include - -+#if LINUX_VERSION_CODE > KERNEL_VERSION(6, 3, 0) -+static inline int uuid_le_cmp(const uuid_le u1, const uuid_le u2) -+{ -+ return memcmp(&u1, &u2, sizeof(uuid_le)); -+} -+#endif -+ - #include "hw.h" - #include "hbm.h" - -@@ -123,6 +130,8 @@ enum mei_cl_io_mode { - MEI_CL_IO_TX_INTERNAL = BIT(1), - - MEI_CL_IO_RX_NONBLOCK = BIT(2), -+ -+ MEI_CL_IO_SGL = BIT(3), - }; - - /* -@@ -219,6 +228,9 @@ struct mei_cl_cb { - int status; - u32 internal:1; - u32 blocking:1; -+#if LINUX_VERSION_CODE > KERNEL_VERSION(6, 2, 0) -+ struct mei_ext_hdr *ext_hdr; -+#endif - }; - - /** -@@ -380,6 +392,10 @@ ssize_t __mei_cl_send(struct mei_cl *cl, u8 *buf, size_t length, u8 vtag, - ssize_t __mei_cl_send(struct mei_cl *cl, const u8 *buf, size_t length, u8 vtag, - unsigned int mode); - #endif -+#if LINUX_VERSION_CODE > KERNEL_VERSION(6, 2, 0) -+ssize_t __mei_cl_send_timeout(struct mei_cl *cl, const u8 *buf, size_t length, u8 vtag, -+ unsigned int mode, unsigned long timeout); -+#endif - ssize_t __mei_cl_recv(struct mei_cl *cl, u8 *buf, size_t length, u8 *vtag, - unsigned int mode, unsigned long timeout); - bool mei_cl_bus_rx_event(struct mei_cl *cl); -@@ -598,6 +614,7 @@ struct mei_device { - unsigned int hbm_f_vt_supported:1; - unsigned int hbm_f_cap_supported:1; - unsigned int hbm_f_cd_supported:1; -+ unsigned int hbm_f_gsc_supported:1; - - struct mei_fw_version fw_ver[MEI_MAX_FW_VER_BLOCKS]; - diff -Nru ivsc-driver-0~git202212210258.94ecb88b/debian/patches/0006-mfd-ljca-Fix-try_match_acpi_hid-return-value-checkin.patch ivsc-driver-0~git202311021215.73a044d9/debian/patches/0006-mfd-ljca-Fix-try_match_acpi_hid-return-value-checkin.patch --- ivsc-driver-0~git202212210258.94ecb88b/debian/patches/0006-mfd-ljca-Fix-try_match_acpi_hid-return-value-checkin.patch 2023-08-23 00:11:46.000000000 +0800 +++ ivsc-driver-0~git202311021215.73a044d9/debian/patches/0006-mfd-ljca-Fix-try_match_acpi_hid-return-value-checkin.patch 1970-01-01 08:00:00.000000000 +0800 @@ -1,44 +0,0 @@ -From: Hao Yao -Date: Sat, 7 Oct 2023 17:18:48 +0800 -Subject: mfd: ljca: Fix try_match_acpi_hid return value checking - -Signed-off-by: Hao Yao -(cherry picked from commit 73343516ac36f98d3334f4a1f3ad940a1d7bb537) -Signed-off-by: You-Sheng Yang ---- - drivers/mfd/ljca.c | 9 ++++++--- - 1 file changed, 6 insertions(+), 3 deletions(-) - -diff --git a/drivers/mfd/ljca.c b/drivers/mfd/ljca.c -index e47be7c..f9ec6f6 100644 ---- a/drivers/mfd/ljca.c -+++ b/drivers/mfd/ljca.c -@@ -241,22 +241,25 @@ static int match_device_ids(struct acpi_device *adev, void *data) - return -ENODEV; - - ret = try_match_acpi_hid(adev, gpio_hids, ARRAY_SIZE(gpio_hids)); -- if (ret > 0) { -+ if (ret >= 0 && ret < ARRAY_SIZE(gpio_hids)) { - ljca_acpi_match_gpio.pnpid = gpio_hids[ret]; - (*child_count)++; -+ return 0; - } - - ret = try_match_acpi_hid(adev, i2c_hids, ARRAY_SIZE(i2c_hids)); -- if (ret > 0) { -+ if (ret >= 0 && ret < ARRAY_SIZE(i2c_hids)) { - ljca_acpi_match_i2cs[0].pnpid = i2c_hids[ret]; - ljca_acpi_match_i2cs[1].pnpid = i2c_hids[ret]; - (*child_count)++; -+ return 0; - } - - ret = try_match_acpi_hid(adev, spi_hids, ARRAY_SIZE(spi_hids)); -- if (ret > 0) { -+ if (ret >= 0 && ret < ARRAY_SIZE(spi_hids)) { - ljca_acpi_match_spis[0].pnpid = spi_hids[ret]; - (*child_count)++; -+ return 0; - } - - return 0; diff -Nru ivsc-driver-0~git202212210258.94ecb88b/debian/patches/0007-misc-spi-vsc-Fix-cvfd_ids-array-with-terminator.patch ivsc-driver-0~git202311021215.73a044d9/debian/patches/0007-misc-spi-vsc-Fix-cvfd_ids-array-with-terminator.patch --- ivsc-driver-0~git202212210258.94ecb88b/debian/patches/0007-misc-spi-vsc-Fix-cvfd_ids-array-with-terminator.patch 2023-08-23 00:11:46.000000000 +0800 +++ ivsc-driver-0~git202311021215.73a044d9/debian/patches/0007-misc-spi-vsc-Fix-cvfd_ids-array-with-terminator.patch 1970-01-01 08:00:00.000000000 +0800 @@ -1,41 +0,0 @@ -From: Hao Yao -Date: Sun, 8 Oct 2023 14:26:34 +0800 -Subject: misc: spi-vsc: Fix cvfd_ids array with terminator - -Signed-off-by: Hao Yao -(cherry picked from commit e8ea8b825217091fa91c9b3cb68cee4101d416e2) -Signed-off-by: You-Sheng Yang ---- - drivers/misc/mei/spi-vsc.c | 19 ++++++------------- - 1 file changed, 6 insertions(+), 13 deletions(-) - -diff --git a/drivers/misc/mei/spi-vsc.c b/drivers/misc/mei/spi-vsc.c -index e97664e..fb2c310 100644 ---- a/drivers/misc/mei/spi-vsc.c -+++ b/drivers/misc/mei/spi-vsc.c -@@ -32,19 +32,12 @@ static const struct acpi_gpio_mapping mei_vsc_acpi_gpios[] = { - {} - }; - --static struct acpi_device_id cvfd_ids[] = { -- { -- .id = "INTC1059", -- }, -- { -- .id = "INTC1095", -- }, -- { -- .id = "INTC100A", -- }, -- { -- .id = "INTC10CF", -- }, -+static const struct acpi_device_id cvfd_ids[] = { -+ { "INTC1059", 0 }, -+ { "INTC1095", 0 }, -+ { "INTC100A", 0 }, -+ { "INTC10CF", 0 }, -+ {} - }; - - struct match_ids_walk_data { diff -Nru ivsc-driver-0~git202212210258.94ecb88b/debian/patches/series ivsc-driver-0~git202311021215.73a044d9/debian/patches/series --- ivsc-driver-0~git202212210258.94ecb88b/debian/patches/series 2023-08-23 00:11:46.000000000 +0800 +++ ivsc-driver-0~git202311021215.73a044d9/debian/patches/series 2023-12-01 00:13:52.000000000 +0800 @@ -1,7 +1,2 @@ 0001-dkms-use-debian-package-version-as-PACKAGE_VERSION.patch -0002-add-support-for-MTL-board.patch 0003-Add-build-exclusive-rule.patch -0004-ljca-try-to-find-acpi-device-from-hub-device.patch -0005-mei-vsc-port-mei-api-change-in-v6.2.patch -0006-mfd-ljca-Fix-try_match_acpi_hid-return-value-checkin.patch -0007-misc-spi-vsc-Fix-cvfd_ids-array-with-terminator.patch diff -Nru ivsc-driver-0~git202212210258.94ecb88b/drivers/mfd/ljca.c ivsc-driver-0~git202311021215.73a044d9/drivers/mfd/ljca.c --- ivsc-driver-0~git202212210258.94ecb88b/drivers/mfd/ljca.c 2023-01-06 11:59:51.000000000 +0800 +++ ivsc-driver-0~git202311021215.73a044d9/drivers/mfd/ljca.c 2023-11-09 13:09:25.000000000 +0800 @@ -29,6 +29,7 @@ "INTC1074", /* TGL */ "INTC1096", /* ADL */ "INTC100B", /* RPL */ + "INTC10D1", /* MTL */ }; static struct mfd_cell_acpi_match ljca_acpi_match_gpio; @@ -36,6 +37,7 @@ "INTC1075", /* TGL */ "INTC1097", /* ADL */ "INTC100C", /* RPL */ + "INTC10D2", /* MTL */ }; static struct mfd_cell_acpi_match ljca_acpi_match_i2cs[2]; @@ -43,6 +45,7 @@ "INTC1091", /* TGL */ "INTC1098", /* ADL */ "INTC100D", /* RPL */ + "INTC10D3", /* MTL */ }; static struct mfd_cell_acpi_match ljca_acpi_match_spis[1]; @@ -208,55 +211,102 @@ struct mutex mutex; }; -static int try_match_acpi_hid(struct acpi_device *child, - struct mfd_cell_acpi_match *match, char **hids, - int hids_num) +/* parent of sub-devices */ +struct device *sub_dev_parent; +struct device *cur_dev; + +static int try_match_acpi_hid(struct acpi_device *child, char **hids, int hids_num) { struct acpi_device_id ids[2] = {}; int i; for (i = 0; i < hids_num; i++) { strlcpy(ids[0].id, hids[i], sizeof(ids[0].id)); - if (!acpi_match_device_ids(child, ids)) { - match->pnpid = hids[i]; - break; - } + if (!acpi_match_device_ids(child, ids)) + return i; } - return 0; + return -ENODEV; } static int match_device_ids(struct acpi_device *adev, void *data) { - (void)data; - try_match_acpi_hid(adev, &ljca_acpi_match_gpio, gpio_hids, - ARRAY_SIZE(gpio_hids)); - try_match_acpi_hid(adev, &ljca_acpi_match_i2cs[0], i2c_hids, - ARRAY_SIZE(i2c_hids)); - try_match_acpi_hid(adev, &ljca_acpi_match_i2cs[1], i2c_hids, - ARRAY_SIZE(i2c_hids)); - try_match_acpi_hid(adev, &ljca_acpi_match_spis[0], spi_hids, - ARRAY_SIZE(spi_hids)); + int ret; + int *child_count = data; + + dev_dbg(&adev->dev, "adev->dep_unmet %d %d\n", adev->dep_unmet, *child_count); + + /* dependency not ready */ + if (adev->dep_unmet) + return -ENODEV; + + ret = try_match_acpi_hid(adev, gpio_hids, ARRAY_SIZE(gpio_hids)); + if (ret >= 0 && ret < ARRAY_SIZE(gpio_hids)) { + ljca_acpi_match_gpio.pnpid = gpio_hids[ret]; + (*child_count)++; + return 0; + } + + ret = try_match_acpi_hid(adev, i2c_hids, ARRAY_SIZE(i2c_hids)); + if (ret >= 0 && ret < ARRAY_SIZE(i2c_hids)) { + ljca_acpi_match_i2cs[0].pnpid = i2c_hids[ret]; + ljca_acpi_match_i2cs[1].pnpid = i2c_hids[ret]; + (*child_count)++; + return 0; + } + + ret = try_match_acpi_hid(adev, spi_hids, ARRAY_SIZE(spi_hids)); + if (ret >= 0 && ret < ARRAY_SIZE(spi_hids)) { + ljca_acpi_match_spis[0].pnpid = spi_hids[ret]; + (*child_count)++; + return 0; + } return 0; } static int precheck_acpi_hid(struct usb_interface *intf) { - struct acpi_device *parent; + struct device *parents[2]; + struct acpi_device *adev; + int i; + int child_count; #if LINUX_VERSION_CODE < KERNEL_VERSION(6, 0, 0) struct acpi_device *child; #endif - parent = ACPI_COMPANION(&intf->dev); - if (!parent) + parents[0] = &intf->dev; + parents[1] = intf->dev.parent->parent; + if (!parents[0] || !parents[1]) return -ENODEV; + adev = ACPI_COMPANION(parents[0]); + if (!adev) + return -ENODEV; + + acpi_dev_clear_dependencies(adev); + sub_dev_parent = parents[0]; + #if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 0, 0) - acpi_dev_for_each_child(parent, match_device_ids, NULL); + for (i = 0; i < ARRAY_SIZE(parents); i++) { + child_count = 0; + acpi_dev_for_each_child(ACPI_COMPANION(parents[i]), match_device_ids, &child_count); + if (child_count > 0) { + sub_dev_parent = parents[i]; + break; + } + } #else - list_for_each_entry (child, &parent->children, node) { - match_device_ids(child, NULL); + for (i = 0; i < ARRAY_SIZE(parents); i++) { + child_count = 0; + list_for_each_entry(child, &(ACPI_COMPANION(parents[i])->children), node) { + match_device_ids(child, &child_count); + } + + if (child_count > 0) { + sub_dev_parent = parents[i]; + break; + } } #endif @@ -440,7 +490,7 @@ if (!pdev) return -EINVAL; - ljca = dev_get_drvdata(pdev->dev.parent); + ljca = dev_get_drvdata(cur_dev); ljca_pdata = dev_get_platdata(&pdev->dev); stub = ljca_stub_find(ljca, ljca_pdata->type); if (IS_ERR(stub)) @@ -477,7 +527,7 @@ if (!pdev) return -EINVAL; - ljca = dev_get_drvdata(pdev->dev.parent); + ljca = dev_get_drvdata(cur_dev); ljca_pdata = dev_get_platdata(&pdev->dev); stub = ljca_stub_find(ljca, ljca_pdata->type); if (IS_ERR(stub)) @@ -499,7 +549,7 @@ struct ljca_stub *stub; unsigned long flags; - ljca = dev_get_drvdata(pdev->dev.parent); + ljca = dev_get_drvdata(cur_dev); ljca_pdata = dev_get_platdata(&pdev->dev); stub = ljca_stub_find(ljca, ljca_pdata->type); if (IS_ERR(stub)) @@ -1065,6 +1115,7 @@ struct usb_endpoint_descriptor *bulk_in, *bulk_out; int ret; + cur_dev = &intf->dev; ret = precheck_acpi_hid(intf); if (ret) return ret; @@ -1125,7 +1176,7 @@ goto error_stop; } - ret = mfd_add_hotplug_devices(&intf->dev, ljca->cells, + ret = mfd_add_hotplug_devices(sub_dev_parent, ljca->cells, ljca->cell_count); if (ret) { dev_err(&intf->dev, "failed to add mfd devices to core %d\n", @@ -1154,7 +1205,7 @@ ljca_stop(ljca); ljca->state = LJCA_STOPPED; - mfd_remove_devices(&intf->dev); + mfd_remove_devices(sub_dev_parent); ljca_stub_cleanup(ljca); usb_set_intfdata(intf, NULL); ljca_delete(ljca); diff -Nru ivsc-driver-0~git202212210258.94ecb88b/drivers/misc/ivsc/mei_ace.c ivsc-driver-0~git202311021215.73a044d9/drivers/misc/ivsc/mei_ace.c --- ivsc-driver-0~git202212210258.94ecb88b/drivers/misc/ivsc/mei_ace.c 2023-01-06 11:59:51.000000000 +0800 +++ ivsc-driver-0~git202311021215.73a044d9/drivers/misc/ivsc/mei_ace.c 2023-11-09 13:09:25.000000000 +0800 @@ -548,7 +548,7 @@ 0x9B, 0x78, 0x03, 0x61, 0x63, 0x5E, 0x24, 0x47) static const struct mei_cl_device_id mei_ace_tbl[] = { - { MEI_ACE_DRIVER_NAME, MEI_UUID_ACE, MEI_CL_VERSION_ANY }, + { .uuid = MEI_UUID_ACE, .version = MEI_CL_VERSION_ANY }, /* required last entry */ { } diff -Nru ivsc-driver-0~git202212210258.94ecb88b/drivers/misc/ivsc/mei_csi.c ivsc-driver-0~git202311021215.73a044d9/drivers/misc/ivsc/mei_csi.c --- ivsc-driver-0~git202212210258.94ecb88b/drivers/misc/ivsc/mei_csi.c 2023-01-06 11:59:51.000000000 +0800 +++ ivsc-driver-0~git202311021215.73a044d9/drivers/misc/ivsc/mei_csi.c 2023-11-09 13:09:25.000000000 +0800 @@ -415,7 +415,7 @@ 0xAF, 0x93, 0x7b, 0x44, 0x53, 0xAC, 0x29, 0xDA) static const struct mei_cl_device_id mei_csi_tbl[] = { - { MEI_CSI_DRIVER_NAME, MEI_UUID_CSI, MEI_CL_VERSION_ANY }, + { .uuid = MEI_UUID_CSI, .version = MEI_CL_VERSION_ANY }, /* required last entry */ { } diff -Nru ivsc-driver-0~git202212210258.94ecb88b/drivers/misc/mei/spi-vsc.c ivsc-driver-0~git202311021215.73a044d9/drivers/misc/mei/spi-vsc.c --- ivsc-driver-0~git202212210258.94ecb88b/drivers/misc/mei/spi-vsc.c 2023-01-06 11:59:51.000000000 +0800 +++ ivsc-driver-0~git202311021215.73a044d9/drivers/misc/mei/spi-vsc.c 2023-11-09 13:09:25.000000000 +0800 @@ -16,9 +16,6 @@ #include "hw-vsc.h" -#define CVFD_ACPI_ID_TGL "INTC1059" -#define CVFD_ACPI_ID_ADL "INTC1095" -#define CVFD_ACPI_ID_RPL "INTC100A" #define LINK_NUMBER (1) #define METHOD_NAME_SID "SID" @@ -35,16 +32,12 @@ {} }; -static struct acpi_device_id cvfd_ids[] = { - { - .id = CVFD_ACPI_ID_TGL, - }, - { - .id = CVFD_ACPI_ID_ADL, - }, - { - .id = CVFD_ACPI_ID_RPL, - }, +static const struct acpi_device_id cvfd_ids[] = { + { "INTC1059", 0 }, + { "INTC1095", 0 }, + { "INTC100A", 0 }, + { "INTC10CF", 0 }, + {} }; struct match_ids_walk_data { @@ -130,6 +123,11 @@ *c = tolower(*c); ACPI_FREE(buffer.pointer); + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 17, 0) + acpi_dev_clear_dependencies(adev); +#endif + return 0; } @@ -329,9 +327,10 @@ }; static const struct acpi_device_id mei_vsc_acpi_ids[] = { - { "INTC1058", 1 }, - { "INTC1094", 1 }, - { "INTC1009", 1 }, /* RPL */ + { "INTC1058"}, + { "INTC1094"}, + { "INTC1009"}, /* RPL */ + { "INTC10D0"}, /* MTL */ {}, }; MODULE_DEVICE_TABLE(acpi, mei_vsc_acpi_ids);