mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-22 09:11:26 +03:00
platform: tegra: dce: Use conftest
Instead of relying on kernel version to determine if the 'tegra_ivc' structure has a member that is of type 'struct iosys_map', add a compile time test to the conftest.sh script to determine this at compile time for the kernel being used. This is beneficial for working with 3rd party Linux kernels that may have back-ported upstream changes into their kernel and so the kernel version checks do not work. Bug 4119327 Change-Id: Ia993ca9df7694347252a795c7dee1e95f2f9fa2f Signed-off-by: Jon Hunter <jonathanh@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2985743 Tested-by: mobile promotions <svcmobile_promotions@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
committed by
mobile promotions
parent
02d724565b
commit
19fb93666d
@@ -3,7 +3,7 @@
|
||||
* Copyright (c) 2019-2023, NVIDIA CORPORATION. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <linux/version.h>
|
||||
#include <nvidia/conftest.h>
|
||||
|
||||
#include <dce.h>
|
||||
#include <dce-ipc.h>
|
||||
@@ -281,7 +281,7 @@ int dce_ipc_channel_init(struct tegra_dce *d, u32 ch_type)
|
||||
struct dce_ipc_region *r;
|
||||
struct dce_ipc_channel *ch;
|
||||
struct dce_ipc_queue_info *q_info;
|
||||
#if (KERNEL_VERSION(6, 2, 0) <= LINUX_VERSION_CODE)
|
||||
#if defined(NV_TEGRA_IVC_STRUCT_HAS_IOSYS_MAP) /* Linux v6.2 */
|
||||
struct iosys_map rx, tx;
|
||||
#endif
|
||||
|
||||
@@ -333,7 +333,7 @@ int dce_ipc_channel_init(struct tegra_dce *d, u32 ch_type)
|
||||
|
||||
dev = dev_from_dce(d);
|
||||
|
||||
#if (KERNEL_VERSION(6, 2, 0) <= LINUX_VERSION_CODE)
|
||||
#if defined(NV_TEGRA_IVC_STRUCT_HAS_IOSYS_MAP) /* Linux v6.2 */
|
||||
iosys_map_set_vaddr(&rx, r->base + r->s_offset);
|
||||
iosys_map_set_vaddr(&tx, r->base + r->s_offset + q_sz);
|
||||
|
||||
@@ -516,7 +516,7 @@ void dce_ipc_channel_reset(struct tegra_dce *d, u32 ch_type)
|
||||
*/
|
||||
static int _dce_ipc_get_next_write_buff(struct dce_ipc_channel *ch)
|
||||
{
|
||||
#if (KERNEL_VERSION(6, 2, 0) <= LINUX_VERSION_CODE)
|
||||
#if defined(NV_TEGRA_IVC_STRUCT_HAS_IOSYS_MAP) /* Linux v6.2 */
|
||||
int err;
|
||||
|
||||
err = tegra_ivc_write_get_next_frame(&ch->d_ivc, &ch->obuff);
|
||||
@@ -558,7 +558,7 @@ static int _dce_ipc_write_channel(struct dce_ipc_channel *ch,
|
||||
* of the IVC frame
|
||||
*/
|
||||
|
||||
#if (KERNEL_VERSION(6, 2, 0) <= LINUX_VERSION_CODE)
|
||||
#if defined(NV_TEGRA_IVC_STRUCT_HAS_IOSYS_MAP) /* Linux v6.2 */
|
||||
if ((ch->flags & DCE_IPC_CHANNEL_MSG_HEADER) != 0U) {
|
||||
iosys_map_wr_field(&ch->obuff, 0, struct dce_ipc_header, length,
|
||||
size);
|
||||
@@ -633,7 +633,7 @@ out:
|
||||
*/
|
||||
static int _dce_ipc_get_next_read_buff(struct dce_ipc_channel *ch)
|
||||
{
|
||||
#if (KERNEL_VERSION(6, 2, 0) <= LINUX_VERSION_CODE)
|
||||
#if defined(NV_TEGRA_IVC_STRUCT_HAS_IOSYS_MAP) /* Linux v6.2 */
|
||||
int err;
|
||||
|
||||
err = tegra_ivc_read_get_next_frame(&ch->d_ivc, &ch->ibuff);
|
||||
@@ -674,7 +674,7 @@ static int _dce_ipc_read_channel(struct dce_ipc_channel *ch,
|
||||
* Get actual length information from the top
|
||||
* of the IVC frame
|
||||
*/
|
||||
#if (KERNEL_VERSION(6, 2, 0) <= LINUX_VERSION_CODE)
|
||||
#if defined(NV_TEGRA_IVC_STRUCT_HAS_IOSYS_MAP) /* Linux v6.2 */
|
||||
if ((ch->flags & DCE_IPC_CHANNEL_MSG_HEADER) != 0U) {
|
||||
iosys_map_wr_field(&ch->ibuff, 0, struct dce_ipc_header, length,
|
||||
size);
|
||||
@@ -837,7 +837,7 @@ int dce_ipc_get_region_iova_info(struct tegra_dce *d, u64 *iova, u32 *size)
|
||||
bool dce_ipc_is_data_available(struct tegra_dce *d, u32 ch_type)
|
||||
{
|
||||
bool ret = false;
|
||||
#if (KERNEL_VERSION(6, 2, 0) <= LINUX_VERSION_CODE)
|
||||
#if defined(NV_TEGRA_IVC_STRUCT_HAS_IOSYS_MAP) /* Linux v6.2 */
|
||||
struct iosys_map map;
|
||||
#else
|
||||
void *frame;
|
||||
@@ -846,7 +846,7 @@ bool dce_ipc_is_data_available(struct tegra_dce *d, u32 ch_type)
|
||||
|
||||
dce_mutex_lock(&ch->lock);
|
||||
|
||||
#if (KERNEL_VERSION(6, 2, 0) <= LINUX_VERSION_CODE)
|
||||
#if defined(NV_TEGRA_IVC_STRUCT_HAS_IOSYS_MAP) /* Linux v6.2 */
|
||||
if (!tegra_ivc_read_get_next_frame(&ch->d_ivc, &map))
|
||||
ret = true;
|
||||
#else
|
||||
|
||||
@@ -6,7 +6,8 @@
|
||||
#ifndef DCE_IPC_H
|
||||
#define DCE_IPC_H
|
||||
|
||||
#include <linux/version.h>
|
||||
#include <nvidia/conftest.h>
|
||||
|
||||
#include <dce-lock.h>
|
||||
#include <soc/tegra/ivc.h>
|
||||
#include <interface/dce-admin-cmds.h>
|
||||
@@ -121,7 +122,7 @@ struct dce_ipc_channel {
|
||||
u32 w_type;
|
||||
u32 ch_type;
|
||||
u32 ipc_type;
|
||||
#if (KERNEL_VERSION(6, 2, 0) <= LINUX_VERSION_CODE)
|
||||
#if defined(NV_TEGRA_IVC_STRUCT_HAS_IOSYS_MAP)
|
||||
struct iosys_map ibuff;
|
||||
struct iosys_map obuff;
|
||||
#else
|
||||
|
||||
@@ -101,6 +101,7 @@ NV_CONFTEST_FUNCTION_COMPILE_TESTS += drm_mode_config_struct_has_fb_base_arg
|
||||
NV_CONFTEST_FUNCTION_COMPILE_TESTS += iio_dev_opaque_has_mlock
|
||||
NV_CONFTEST_FUNCTION_COMPILE_TESTS += iommu_map_has_gfp_arg
|
||||
NV_CONFTEST_FUNCTION_COMPILE_TESTS += register_shrinker_has_fmt_arg
|
||||
NV_CONFTEST_FUNCTION_COMPILE_TESTS += tegra_ivc_struct_has_iosys_map
|
||||
NV_CONFTEST_GENERIC_COMPILE_TESTS ?=
|
||||
NV_CONFTEST_MACRO_COMPILE_TESTS ?=
|
||||
NV_CONFTEST_SYMBOL_COMPILE_TESTS ?=
|
||||
|
||||
@@ -6544,6 +6544,25 @@ compile_test() {
|
||||
compile_check_conftest "$CODE" "NV_REGISTER_SHRINKER_HAS_FMT_ARG" "" "types"
|
||||
;;
|
||||
|
||||
tegra_ivc_struct_has_iosys_map)
|
||||
#
|
||||
# Determine if the 'tegra_ivc' structure has the 'map' argument.
|
||||
#
|
||||
# Commit 4c1e0a97351a ("firmware: tegra: bpmp: Use iosys-map
|
||||
# helpers") update the Tegra IVC driver to use iosys-map in Linux v6.2.
|
||||
#
|
||||
CODE="
|
||||
#if defined(NV_LINUX_IOSYS_MAP_H_PRESENT)
|
||||
#include <linux/iosys-map.h>
|
||||
#endif
|
||||
#include <soc/tegra/ivc.h>
|
||||
struct iosys_map *conftest_tegra_ivc_struct_has_iosys_map(struct tegra_ivc *ivc) {
|
||||
return &ivc->rx.map;
|
||||
}"
|
||||
|
||||
compile_check_conftest "$CODE" "NV_TEGRA_IVC_STRUCT_HAS_IOSYS_MAP" "" "types"
|
||||
;;
|
||||
|
||||
# When adding a new conftest entry, please use the correct format for
|
||||
# specifying the relevant upstream Linux kernel commit.
|
||||
#
|
||||
|
||||
Reference in New Issue
Block a user