mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-22 17:25:35 +03:00
pci: Use conftest to find if pci_epc_event_ops struct has core_deinit
Use the conftest to find if the struct pci_epc_event_ops has core_deinit as callback function. This callback is added by Nvidia in core kernel. Bug 4346767 Change-Id: I399197917ac7746ca367f55b9dc4e3a5bd79f073 Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3028740 Reviewed-by: Shardar Mohammed <smohammed@nvidia.com> GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
committed by
mobile promotions
parent
a757343f2e
commit
1e9fc00bc2
3
Makefile
3
Makefile
@@ -55,9 +55,6 @@ subdir-ccflags-y += -DNV_DROP_PCIE_ERROR_REPORTING
|
|||||||
# Drop the API for pcie_disable_pcie_error_reporting
|
# Drop the API for pcie_disable_pcie_error_reporting
|
||||||
subdir-ccflags-y += -DNV_PCIE_DIABLE_PCIE_ERROR_REPORTING_DROP
|
subdir-ccflags-y += -DNV_PCIE_DIABLE_PCIE_ERROR_REPORTING_DROP
|
||||||
|
|
||||||
# PCIE DMA EPF core deinit not implemented in core kernel
|
|
||||||
subdir-ccflags-y += -DNV_PCIE_DMA_EPF_CORE_DEINIT_NOT_AVAILABLE
|
|
||||||
|
|
||||||
# PCIE EPF driver probe has additional argument as ID
|
# PCIE EPF driver probe has additional argument as ID
|
||||||
subdir-ccflags-y += -DNV_PCIE_EFP_DRIVER_PROBE_HAS_ID_ARG
|
subdir-ccflags-y += -DNV_PCIE_EFP_DRIVER_PROBE_HAS_ID_ARG
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
// SPDX-License-Identifier: GPL-2.0-only
|
// SPDX-License-Identifier: GPL-2.0-only
|
||||||
// Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
// Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
||||||
|
|
||||||
|
#include <nvidia/conftest.h>
|
||||||
|
|
||||||
#define pr_fmt(fmt) "nvscic2c-pcie: epf: " fmt
|
#define pr_fmt(fmt) "nvscic2c-pcie: epf: " fmt
|
||||||
|
|
||||||
#include <linux/init.h>
|
#include <linux/init.h>
|
||||||
@@ -169,7 +171,7 @@ allocate_outbound_area(struct pci_epf *epf, size_t win_size,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(NV_PCIE_DMA_EPF_CORE_DEINIT_NOT_AVAILABLE)
|
#if defined(NV_PCI_EPC_EVENT_OPS_STRUCT_HAS_CORE_DEINIT) /* Nvidia Internal */
|
||||||
static void
|
static void
|
||||||
clear_inbound_translation(struct pci_epf *epf)
|
clear_inbound_translation(struct pci_epf *epf)
|
||||||
{
|
{
|
||||||
@@ -492,7 +494,7 @@ deinit_work(struct work_struct *work)
|
|||||||
* @DRV_MODE_EPC would have already gone then by the time
|
* @DRV_MODE_EPC would have already gone then by the time
|
||||||
* struct pci_epc_event_ops.core_deinit is called.
|
* struct pci_epc_event_ops.core_deinit is called.
|
||||||
*/
|
*/
|
||||||
#if !defined(NV_PCIE_DMA_EPF_CORE_DEINIT_NOT_AVAILABLE)
|
#if defined(NV_PCI_EPC_EVENT_OPS_STRUCT_HAS_CORE_DEINIT) /* Nvidia Internal */
|
||||||
static int
|
static int
|
||||||
nvscic2c_pcie_epf_core_deinit(struct pci_epf *epf)
|
nvscic2c_pcie_epf_core_deinit(struct pci_epf *epf)
|
||||||
{
|
{
|
||||||
@@ -733,7 +735,7 @@ get_driverdata(const struct pci_epf_device_id *id,
|
|||||||
|
|
||||||
static const struct pci_epc_event_ops nvscic2c_event_ops = {
|
static const struct pci_epc_event_ops nvscic2c_event_ops = {
|
||||||
.core_init = nvscic2c_pcie_epf_core_init,
|
.core_init = nvscic2c_pcie_epf_core_init,
|
||||||
#if !defined(NV_PCIE_DMA_EPF_CORE_DEINIT_NOT_AVAILABLE)
|
#if defined(NV_PCI_EPC_EVENT_OPS_STRUCT_HAS_CORE_DEINIT) /* Nvidia Internal */
|
||||||
.core_deinit = nvscic2c_pcie_epf_core_deinit,
|
.core_deinit = nvscic2c_pcie_epf_core_deinit,
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -5,6 +5,8 @@
|
|||||||
* Copyright (C) 2021-2023 NVIDIA Corporation. All rights reserved.
|
* Copyright (C) 2021-2023 NVIDIA Corporation. All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <nvidia/conftest.h>
|
||||||
|
|
||||||
#include <linux/crc32.h>
|
#include <linux/crc32.h>
|
||||||
#include <linux/debugfs.h>
|
#include <linux/debugfs.h>
|
||||||
#include <linux/delay.h>
|
#include <linux/delay.h>
|
||||||
@@ -164,7 +166,7 @@ static int pcie_dma_epf_core_init(struct pci_epf *epf)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(NV_PCIE_DMA_EPF_CORE_DEINIT_NOT_AVAILABLE)
|
#if defined(NV_PCI_EPC_EVENT_OPS_STRUCT_HAS_CORE_DEINIT) /* Nvidia Internal */
|
||||||
static int pcie_dma_epf_core_deinit(struct pci_epf *epf)
|
static int pcie_dma_epf_core_deinit(struct pci_epf *epf)
|
||||||
{
|
{
|
||||||
struct pcie_epf_dma *epfnv = epf_get_drvdata(epf);
|
struct pcie_epf_dma *epfnv = epf_get_drvdata(epf);
|
||||||
@@ -265,7 +267,7 @@ static const struct pci_epf_device_id pcie_dma_epf_ids[] = {
|
|||||||
|
|
||||||
static const struct pci_epc_event_ops pci_epf_dma_test_event_ops = {
|
static const struct pci_epc_event_ops pci_epf_dma_test_event_ops = {
|
||||||
.core_init = pcie_dma_epf_core_init,
|
.core_init = pcie_dma_epf_core_init,
|
||||||
#if !defined(NV_PCIE_DMA_EPF_CORE_DEINIT_NOT_AVAILABLE)
|
#if defined(NV_PCI_EPC_EVENT_OPS_STRUCT_HAS_CORE_DEINIT) /* Nvidia Internal */
|
||||||
.core_deinit = pcie_dma_epf_core_deinit,
|
.core_deinit = pcie_dma_epf_core_deinit,
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -126,6 +126,7 @@ 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
|
||||||
NV_CONFTEST_FUNCTION_COMPILE_TESTS += pde_data
|
NV_CONFTEST_FUNCTION_COMPILE_TESTS += pde_data
|
||||||
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 += pci_epc_event_ops_struct_has_core_deinit
|
||||||
NV_CONFTEST_FUNCTION_COMPILE_TESTS += register_shrinker_has_fmt_arg
|
NV_CONFTEST_FUNCTION_COMPILE_TESTS += register_shrinker_has_fmt_arg
|
||||||
NV_CONFTEST_FUNCTION_COMPILE_TESTS += shrinker_alloc
|
NV_CONFTEST_FUNCTION_COMPILE_TESTS += shrinker_alloc
|
||||||
NV_CONFTEST_FUNCTION_COMPILE_TESTS += snd_soc_card_jack_new_has_no_snd_soc_jack_pins
|
NV_CONFTEST_FUNCTION_COMPILE_TESTS += snd_soc_card_jack_new_has_no_snd_soc_jack_pins
|
||||||
|
|||||||
@@ -7017,6 +7017,22 @@ compile_test() {
|
|||||||
compile_check_conftest "$CODE" "NV_PWM_OPS_STRUCT_HAS_OWNER" "" "types"
|
compile_check_conftest "$CODE" "NV_PWM_OPS_STRUCT_HAS_OWNER" "" "types"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
pci_epc_event_ops_struct_has_core_deinit)
|
||||||
|
#
|
||||||
|
# Determine if the pci_epc_event_ops struct has the core_deinit function.
|
||||||
|
#
|
||||||
|
# Added by commit 3d99b5acdd3191c ("NVIDIA: SAUCE: PCI: endpoint: Add core_deinit()
|
||||||
|
# callback support") from Nvidia PCI improvement.
|
||||||
|
#
|
||||||
|
CODE="
|
||||||
|
#include <linux/pci-epf.h>
|
||||||
|
int conftest_pci_epc_event_ops_struct_has_core_deinit(void) {
|
||||||
|
return offsetof(struct pci_epc_event_ops, core_deinit);
|
||||||
|
}"
|
||||||
|
|
||||||
|
compile_check_conftest "$CODE" "NV_PCI_EPC_EVENT_OPS_STRUCT_HAS_CORE_DEINIT" "" "types"
|
||||||
|
;;
|
||||||
|
|
||||||
register_shrinker_has_fmt_arg)
|
register_shrinker_has_fmt_arg)
|
||||||
#
|
#
|
||||||
# Determine if the 'register_shrinker' function
|
# Determine if the 'register_shrinker' function
|
||||||
|
|||||||
Reference in New Issue
Block a user