From 9647ab83867d5ad9fd9143c3fb0b89c242faa243 Mon Sep 17 00:00:00 2001 From: Laxman Dewangan Date: Wed, 8 Nov 2023 15:10:11 +0000 Subject: [PATCH] tegra_hv: Update driver to support Linux 6.2 and above The IO sys map helpers are used for the IVC communication on Linux 6.2 and above. Update drivers to have compatible with IVC APIs of Linux 6.2 and above. Bug 4370594 Change-Id: I0528248efa9edc3d4962f7b62d8ebfe2ac0a027e Signed-off-by: Laxman Dewangan Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3013108 GVS: Gerrit_Virtual_Submit --- drivers/virt/tegra/tegra_hv.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/drivers/virt/tegra/tegra_hv.c b/drivers/virt/tegra/tegra_hv.c index 87f87a4e..2b2e6954 100644 --- a/drivers/virt/tegra/tegra_hv.c +++ b/drivers/virt/tegra/tegra_hv.c @@ -812,7 +812,11 @@ int tegra_hv_ivc_tx_empty(struct tegra_hv_ivc_cookie *ivck) { struct hv_ivc *ivc = cookie_to_ivc_dev(ivck); +#if defined(NV_TEGRA_IVC_STRUCT_HAS_IOSYS_MAP) + return tegra_ivc_empty(&ivc->ivc, &ivc->ivc.tx.map); +#else return tegra_ivc_empty(&ivc->ivc, ivc->ivc.tx.channel); +#endif } EXPORT_SYMBOL(tegra_hv_ivc_tx_empty); @@ -820,7 +824,11 @@ uint32_t tegra_hv_ivc_tx_frames_available(struct tegra_hv_ivc_cookie *ivck) { struct hv_ivc *ivc = cookie_to_ivc_dev(ivck); +#if defined(NV_TEGRA_IVC_STRUCT_HAS_IOSYS_MAP) + return tegra_ivc_frames_available(&ivc->ivc, &ivc->ivc.tx.map); +#else return tegra_ivc_frames_available(&ivc->ivc, ivc->ivc.tx.channel); +#endif } EXPORT_SYMBOL(tegra_hv_ivc_tx_frames_available); @@ -834,16 +842,35 @@ EXPORT_SYMBOL(tegra_hv_ivc_dump); void *tegra_hv_ivc_read_get_next_frame(struct tegra_hv_ivc_cookie *ivck) { struct hv_ivc *ivc = cookie_to_ivc_dev(ivck); +#if defined(NV_TEGRA_IVC_STRUCT_HAS_IOSYS_MAP) + struct iosys_map map; + int err; + err = tegra_ivc_read_get_next_frame(&ivc->ivc, &map); + if (err) + return ERR_PTR(err); + return map.vaddr; +#else return tegra_ivc_read_get_next_frame(&ivc->ivc); +#endif } EXPORT_SYMBOL(tegra_hv_ivc_read_get_next_frame); void *tegra_hv_ivc_write_get_next_frame(struct tegra_hv_ivc_cookie *ivck) { struct hv_ivc *ivc = cookie_to_ivc_dev(ivck); +#if defined(NV_TEGRA_IVC_STRUCT_HAS_IOSYS_MAP) + struct iosys_map map; + int err; + err = tegra_ivc_write_get_next_frame(&ivc->ivc, &map); + if (err) + return ERR_PTR(err); + + return map.vaddr; +#else return tegra_ivc_write_get_next_frame(&ivc->ivc); +#endif } EXPORT_SYMBOL(tegra_hv_ivc_write_get_next_frame);