mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-22 09:11:26 +03:00
PCI: tegra264: Fix build issues using conftest
The Tegra264 PCIe drivers don't build for kernels that don't have: 1. The structure mrq_pcie_request_req defined 2. The function pci_epc_deinit_notify() present This is currently being handling by building a dummy driver for kernels that don't have these. To simplify this, use conftest to detect if the above are present and modify the Tegra264 PCIe driver accordingly if they are not present. By using conftest we can remove the Makefile variable 'NV_OOT_PCIE_T264_SOC_SKIP_BUILD' and ccflag 'DNV_CONFIG_PCIE_TEGRA_DMA_DISABLE'. Finally, the PCIe drivers are always built as modules so simplify the Makefile and remove the usage of 'CONFIG_TEGRA_OOT_MODULE'. Bug 4911768 Change-Id: Id282497b8607a732b5e6c90e1e7c1436589a0b5f Signed-off-by: Jon Hunter <jonathanh@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3245592 GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
@@ -1,7 +0,0 @@
|
|||||||
# SPDX-License-Identifier: GPL-2.0-only
|
|
||||||
# SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
|
||||||
|
|
||||||
# Kernel jammy-src specific environment variables to configure the OOT modules
|
|
||||||
|
|
||||||
export NV_OOT_PCIE_T264_SOC_SKIP_BUILD=y
|
|
||||||
subdir-ccflags-y += -DNV_CONFIG_PCIE_TEGRA_DMA_DISABLE
|
|
||||||
@@ -1,12 +1,10 @@
|
|||||||
# SPDX-License-Identifier: GPL-2.0-only
|
# SPDX-License-Identifier: GPL-2.0-only
|
||||||
# SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
# SPDX-FileCopyrightText: Copyright (c) 2024-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
||||||
|
|
||||||
# Kernel RHIVOS-1 specific environment variables to configure the OOT modules
|
# Kernel RHIVOS-1 specific environment variables to configure the OOT modules
|
||||||
|
|
||||||
export NV_OOT_REALTEK_R8126_SKIP_BUILD=y
|
export NV_OOT_REALTEK_R8126_SKIP_BUILD=y
|
||||||
export NV_OOT_REALTEK_R8168_SKIP_BUILD=y
|
export NV_OOT_REALTEK_R8168_SKIP_BUILD=y
|
||||||
export NV_OOT_REALTEK_RTL8822CE_SKIP_BUILD=y
|
export NV_OOT_REALTEK_RTL8822CE_SKIP_BUILD=y
|
||||||
export NV_OOT_PCIE_T264_SOC_SKIP_BUILD=y
|
|
||||||
export NV_OOT_REALTEK_RTL8852CE_SKIP_BUILD=y
|
export NV_OOT_REALTEK_RTL8852CE_SKIP_BUILD=y
|
||||||
export NV_OOT_REALTEK_BTUSB_SKIP_BUILD=y
|
export NV_OOT_REALTEK_BTUSB_SKIP_BUILD=y
|
||||||
subdir-ccflags-y += -DNV_CONFIG_PCIE_TEGRA_DMA_DISABLE
|
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
# SPDX-License-Identifier: GPL-2.0-only
|
|
||||||
# SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
|
||||||
|
|
||||||
# Kernel stable specific environment variables to configure the OOT modules
|
|
||||||
|
|
||||||
export NV_OOT_PCIE_T264_SOC_SKIP_BUILD=y
|
|
||||||
subdir-ccflags-y += -DNV_CONFIG_PCIE_TEGRA_DMA_DISABLE
|
|
||||||
@@ -1,23 +1,10 @@
|
|||||||
# SPDX-License-Identifier: GPL-2.0
|
# SPDX-License-Identifier: GPL-2.0-only
|
||||||
|
# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
||||||
|
|
||||||
# Set config when build as OOT module.
|
obj-m += pcie-tegra264.o
|
||||||
ifneq ($(NV_OOT_PCIE_T264_SOC_SKIP_BUILD),y)
|
obj-m += pcie-tegra264-ep.o
|
||||||
ifeq ($(CONFIG_TEGRA_OOT_MODULE),m)
|
|
||||||
CONFIG_PCIE_TEGRA264 := m
|
|
||||||
CONFIG_PCIE_TEGRA264_EP := m
|
|
||||||
endif
|
|
||||||
|
|
||||||
obj-$(CONFIG_PCIE_TEGRA264) += pcie-tegra264.o
|
|
||||||
obj-$(CONFIG_PCIE_TEGRA264_EP) += pcie-tegra264-ep.o
|
|
||||||
|
|
||||||
ifeq ($(CONFIG_TEGRA_OOT_MODULE),m)
|
|
||||||
obj-m += tegra-pcie-dma-lib.o
|
obj-m += tegra-pcie-dma-lib.o
|
||||||
|
|
||||||
tegra-pcie-dma-lib-objs:= tegra-pcie-dma.o \
|
tegra-pcie-dma-lib-objs:= tegra-pcie-dma.o \
|
||||||
tegra234-pcie-edma.o \
|
tegra234-pcie-edma.o \
|
||||||
tegra264-pcie-xdma.o
|
tegra264-pcie-xdma.o
|
||||||
endif
|
|
||||||
else
|
|
||||||
obj-m += pcie-tegra264.o
|
|
||||||
pcie-tegra264-objs := pcie-tegra-soc-dummy.o
|
|
||||||
endif
|
|
||||||
|
|||||||
@@ -1,15 +0,0 @@
|
|||||||
// SPDX-License-Identifier: GPL-2.0-only
|
|
||||||
// SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
|
||||||
|
|
||||||
#include <linux/module.h>
|
|
||||||
|
|
||||||
/* Dummy implementation for module */
|
|
||||||
static int __init pcie_tegra_soc_dummy_init(void)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
device_initcall(pcie_tegra_soc_dummy_init);
|
|
||||||
|
|
||||||
MODULE_AUTHOR("Laxman Dewangan <ldewangan@nvidia.com>");
|
|
||||||
MODULE_DESCRIPTION("PCIE tegra dummy driver");
|
|
||||||
MODULE_LICENSE("GPL");
|
|
||||||
@@ -138,6 +138,7 @@ struct tegra264_pcie_ep {
|
|||||||
|
|
||||||
static int tegra264_pcie_bpmp_set_ep_state(struct tegra264_pcie_ep *pcie, bool enable)
|
static int tegra264_pcie_bpmp_set_ep_state(struct tegra264_pcie_ep *pcie, bool enable)
|
||||||
{
|
{
|
||||||
|
#if defined(NV_MRQ_PCIE_REQUEST_STRUCT_PRESENT)
|
||||||
struct tegra_bpmp_message msg;
|
struct tegra_bpmp_message msg;
|
||||||
struct mrq_pcie_request req;
|
struct mrq_pcie_request req;
|
||||||
int err;
|
int err;
|
||||||
@@ -169,6 +170,9 @@ static int tegra264_pcie_bpmp_set_ep_state(struct tegra264_pcie_ep *pcie, bool e
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
#else
|
||||||
|
return -EOPNOTSUPP;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void tegra264_pcie_ep_rst_assert(struct tegra264_pcie_ep *pcie)
|
static void tegra264_pcie_ep_rst_assert(struct tegra264_pcie_ep *pcie)
|
||||||
@@ -183,7 +187,11 @@ static void tegra264_pcie_ep_rst_assert(struct tegra264_pcie_ep *pcie)
|
|||||||
if (pcie->pex_prsnt_gpiod)
|
if (pcie->pex_prsnt_gpiod)
|
||||||
gpiod_set_value_cansleep(pcie->pex_prsnt_gpiod, 0);
|
gpiod_set_value_cansleep(pcie->pex_prsnt_gpiod, 0);
|
||||||
|
|
||||||
|
#if defined(NV_PCI_EPC_DEINIT_NOTIFY_PRESENT) /* Linux v6.11 */
|
||||||
pci_epc_deinit_notify(pcie->epc);
|
pci_epc_deinit_notify(pcie->epc);
|
||||||
|
#else
|
||||||
|
dev_WARN(pcie->dev, "kernel does not support pci_epc_deinit_notify!\n");
|
||||||
|
#endif
|
||||||
|
|
||||||
ret = readl_poll_timeout(pcie->xal_base + XAL_RC_DEBUG_HB_REG_2, val,
|
ret = readl_poll_timeout(pcie->xal_base + XAL_RC_DEBUG_HB_REG_2, val,
|
||||||
val & XAL_RC_DEBUG_HB_REG_2_HB_HIER_IDLE,
|
val & XAL_RC_DEBUG_HB_REG_2_HB_HIER_IDLE,
|
||||||
|
|||||||
@@ -95,6 +95,7 @@ static int tegra264_pcie_parse_dt(struct tegra264_pcie *pcie)
|
|||||||
|
|
||||||
static void tegra264_pcie_bpmp_set_rp_state(struct tegra264_pcie *pcie)
|
static void tegra264_pcie_bpmp_set_rp_state(struct tegra264_pcie *pcie)
|
||||||
{
|
{
|
||||||
|
#if defined(NV_MRQ_PCIE_REQUEST_STRUCT_PRESENT) && defined(CMD_PCIE_RP_CONTROLLER_OFF)
|
||||||
struct tegra_bpmp_message msg;
|
struct tegra_bpmp_message msg;
|
||||||
struct mrq_pcie_request req;
|
struct mrq_pcie_request req;
|
||||||
int err;
|
int err;
|
||||||
@@ -117,6 +118,9 @@ static void tegra264_pcie_bpmp_set_rp_state(struct tegra264_pcie *pcie)
|
|||||||
if (msg.rx.ret)
|
if (msg.rx.ret)
|
||||||
dev_info(pcie->dev, "PCIe Controller-%d failed to turn off via BPMP with error message %d\r\n",
|
dev_info(pcie->dev, "PCIe Controller-%d failed to turn off via BPMP with error message %d\r\n",
|
||||||
pcie->ctl_id, msg.rx.ret);
|
pcie->ctl_id, msg.rx.ret);
|
||||||
|
#else
|
||||||
|
dev_err(pcie->dev, "%s not supported!\n", __func__);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void tegra264_pcie_init(struct tegra264_pcie *pcie)
|
static void tegra264_pcie_init(struct tegra264_pcie *pcie)
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ struct tegra_pcie_dma_priv {
|
|||||||
nvpcie_dma_soc_t soc;
|
nvpcie_dma_soc_t soc;
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef CONFIG_PCIE_TEGRA_DMA
|
|
||||||
irqreturn_t tegra_pcie_dma_irq(int irq, void *cookie)
|
irqreturn_t tegra_pcie_dma_irq(int irq, void *cookie)
|
||||||
{
|
{
|
||||||
struct tegra_pcie_dma_priv *prv = (struct tegra_pcie_dma_priv *)cookie;
|
struct tegra_pcie_dma_priv *prv = (struct tegra_pcie_dma_priv *)cookie;
|
||||||
@@ -176,6 +175,5 @@ tegra_pcie_dma_status_t tegra_pcie_dma_deinit(void **cookie)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(tegra_pcie_dma_deinit);
|
EXPORT_SYMBOL_GPL(tegra_pcie_dma_deinit);
|
||||||
#endif
|
|
||||||
|
|
||||||
MODULE_LICENSE("GPL v2");
|
MODULE_LICENSE("GPL v2");
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||||
/*
|
/* SPDX-FileCopyrightText: Copyright (c) 2022-2025, NVIDIA CORPORATION. All rights reserved. */
|
||||||
* Copyright (c) 2024-2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef TEGRA_PCIE_DMA_H
|
#ifndef TEGRA_PCIE_DMA_H
|
||||||
#define TEGRA_PCIE_DMA_H
|
#define TEGRA_PCIE_DMA_H
|
||||||
@@ -33,11 +31,6 @@
|
|||||||
#define TEGRA264_PCIE_DMA_MSI_REMOTE_VEC 5
|
#define TEGRA264_PCIE_DMA_MSI_REMOTE_VEC 5
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef NV_CONFIG_PCIE_TEGRA_DMA_DISABLE
|
|
||||||
/** Enable generic PCIe DMA driver */
|
|
||||||
#define CONFIG_PCIE_TEGRA_DMA 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief typedef to define various values for xfer status passed for dma_complete_t or
|
* @brief typedef to define various values for xfer status passed for dma_complete_t or
|
||||||
* <a href="#tegra-pcie-dma-submit-xfer">(tegra_pcie_dma_submit_xfer())</a>
|
* <a href="#tegra-pcie-dma-submit-xfer">(tegra_pcie_dma_submit_xfer())</a>
|
||||||
@@ -222,7 +215,6 @@ struct tegra_pcie_dma_xfer_info {
|
|||||||
void *priv;
|
void *priv;
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef CONFIG_PCIE_TEGRA_DMA
|
|
||||||
#ifdef DOXYGEN_ICD
|
#ifdef DOXYGEN_ICD
|
||||||
/**
|
/**
|
||||||
* @dir
|
* @dir
|
||||||
@@ -403,31 +395,5 @@ bool tegra_pcie_dma_stop(void *cookie);
|
|||||||
* - DMA HW is stopped.
|
* - DMA HW is stopped.
|
||||||
*/
|
*/
|
||||||
tegra_pcie_dma_status_t tegra_pcie_dma_deinit(void **cookie);
|
tegra_pcie_dma_status_t tegra_pcie_dma_deinit(void **cookie);
|
||||||
#else
|
|
||||||
static inline tegra_pcie_dma_status_t
|
|
||||||
tegra_pcie_dma_initialize(struct tegra_pcie_dma_init_info *info, void **cookie) {
|
|
||||||
return -EOPNOTSUPP;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline tegra_pcie_dma_status_t tegra_pcie_dma_set_msi(void *cookie, u64 msi_addr,
|
|
||||||
u32 msi_data) {
|
|
||||||
return -EOPNOTSUPP;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline tegra_pcie_dma_status_t
|
|
||||||
tegra_pcie_dma_submit_xfer(void *cookie, struct tegra_pcie_dma_xfer_info *tx_info) {
|
|
||||||
return -EOPNOTSUPP;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline bool tegra_pcie_dma_stop(void *cookie)
|
|
||||||
{
|
|
||||||
return -EOPNOTSUPP;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline tegra_pcie_dma_status_t tegra_pcie_dma_deinit(void **cookie)
|
|
||||||
{
|
|
||||||
return -EOPNOTSUPP;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif //TEGRA_PCIE_DMA_H
|
#endif //TEGRA_PCIE_DMA_H
|
||||||
|
|||||||
@@ -158,6 +158,7 @@ NV_CONFTEST_FUNCTION_COMPILE_TESTS += mii_bus_struct_has_read_c45
|
|||||||
NV_CONFTEST_FUNCTION_COMPILE_TESTS += mii_bus_struct_has_write_c45
|
NV_CONFTEST_FUNCTION_COMPILE_TESTS += mii_bus_struct_has_write_c45
|
||||||
NV_CONFTEST_FUNCTION_COMPILE_TESTS += media_entity_remote_pad
|
NV_CONFTEST_FUNCTION_COMPILE_TESTS += media_entity_remote_pad
|
||||||
NV_CONFTEST_FUNCTION_COMPILE_TESTS += module_import_ns_calls_stringify
|
NV_CONFTEST_FUNCTION_COMPILE_TESTS += module_import_ns_calls_stringify
|
||||||
|
NV_CONFTEST_FUNCTION_COMPILE_TESTS += mrq_pcie_request_struct_present
|
||||||
NV_CONFTEST_FUNCTION_COMPILE_TESTS += msi_get_virq
|
NV_CONFTEST_FUNCTION_COMPILE_TESTS += msi_get_virq
|
||||||
NV_CONFTEST_FUNCTION_COMPILE_TESTS += netif_set_tso_max_size
|
NV_CONFTEST_FUNCTION_COMPILE_TESTS += netif_set_tso_max_size
|
||||||
NV_CONFTEST_FUNCTION_COMPILE_TESTS += netif_napi_add_weight
|
NV_CONFTEST_FUNCTION_COMPILE_TESTS += netif_napi_add_weight
|
||||||
@@ -174,6 +175,7 @@ NV_CONFTEST_FUNCTION_COMPILE_TESTS += pwm_chip_struct_has_base_arg
|
|||||||
NV_CONFTEST_FUNCTION_COMPILE_TESTS += pwm_chip_struct_has_struct_device
|
NV_CONFTEST_FUNCTION_COMPILE_TESTS += pwm_chip_struct_has_struct_device
|
||||||
NV_CONFTEST_FUNCTION_COMPILE_TESTS += pwm_ops_struct_has_owner
|
NV_CONFTEST_FUNCTION_COMPILE_TESTS += pwm_ops_struct_has_owner
|
||||||
NV_CONFTEST_FUNCTION_COMPILE_TESTS += pwm_ops_struct_has_config
|
NV_CONFTEST_FUNCTION_COMPILE_TESTS += pwm_ops_struct_has_config
|
||||||
|
NV_CONFTEST_FUNCTION_COMPILE_TESTS += pci_epc_deinit_notify
|
||||||
NV_CONFTEST_FUNCTION_COMPILE_TESTS += pci_epc_event_ops_struct_has_core_deinit
|
NV_CONFTEST_FUNCTION_COMPILE_TESTS += pci_epc_event_ops_struct_has_core_deinit
|
||||||
NV_CONFTEST_FUNCTION_COMPILE_TESTS += pci_epc_event_ops_struct_has_epc_deinit
|
NV_CONFTEST_FUNCTION_COMPILE_TESTS += pci_epc_event_ops_struct_has_epc_deinit
|
||||||
NV_CONFTEST_FUNCTION_COMPILE_TESTS += pci_epc_event_ops_struct_has_epc_init
|
NV_CONFTEST_FUNCTION_COMPILE_TESTS += pci_epc_event_ops_struct_has_epc_init
|
||||||
|
|||||||
@@ -7796,6 +7796,22 @@ compile_test() {
|
|||||||
compile_check_conftest "$CODE" "NV_MODULE_IMPORT_NS_CALLS_STRINGIFY" "" "types"
|
compile_check_conftest "$CODE" "NV_MODULE_IMPORT_NS_CALLS_STRINGIFY" "" "types"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
mrq_pcie_request_struct_present)
|
||||||
|
#
|
||||||
|
# Determine if the 'struct mrq_pcie_request_req' is present. This
|
||||||
|
# structure is not available in current upstream Linux kernels and
|
||||||
|
# so add a test to see if the necessary downstream change is
|
||||||
|
# present.
|
||||||
|
#
|
||||||
|
CODE="
|
||||||
|
#include <linux/types.h>
|
||||||
|
#include <soc/tegra/bpmp-abi.h>
|
||||||
|
|
||||||
|
static struct mrq_pcie_request req;"
|
||||||
|
|
||||||
|
compile_check_conftest "$CODE" "NV_MRQ_PCIE_REQUEST_STRUCT_PRESENT" "" "symbols"
|
||||||
|
;;
|
||||||
|
|
||||||
no_llseek)
|
no_llseek)
|
||||||
#
|
#
|
||||||
# Determine if the function no_llseek() is present.
|
# Determine if the function no_llseek() is present.
|
||||||
@@ -7919,6 +7935,22 @@ compile_test() {
|
|||||||
compile_check_conftest "$CODE" "NV_PWM_OPS_STRUCT_HAS_CONFIG" "" "types"
|
compile_check_conftest "$CODE" "NV_PWM_OPS_STRUCT_HAS_CONFIG" "" "types"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
pci_epc_deinit_notify)
|
||||||
|
#
|
||||||
|
# Determine if the function pci_epc_deinit_notify() is present.
|
||||||
|
#
|
||||||
|
# In Linux v6.11, commit 473b2cf9c4d1 ("PCI: endpoint: Introduce 'epc_deinit'
|
||||||
|
# event and notify the EPF drivers") added the function pci_epc_deinit_notify().
|
||||||
|
#
|
||||||
|
CODE="
|
||||||
|
#include <linux/pci-epc.h>
|
||||||
|
void conftest_pci_epc_deinit_notify(void) {
|
||||||
|
pci_epc_deinit_notify();
|
||||||
|
}"
|
||||||
|
|
||||||
|
compile_check_conftest "$CODE" "NV_PCI_EPC_DEINIT_NOTIFY_PRESENT" "" "functions"
|
||||||
|
;;
|
||||||
|
|
||||||
pci_epc_event_ops_struct_has_core_deinit)
|
pci_epc_event_ops_struct_has_core_deinit)
|
||||||
#
|
#
|
||||||
# Determine if the pci_epc_event_ops struct has the core_deinit function.
|
# Determine if the pci_epc_event_ops struct has the core_deinit function.
|
||||||
|
|||||||
Reference in New Issue
Block a user