Skip to content

Commit

Permalink
drm/dkms: add pcie_bandwidth_available to autoconf
Browse files Browse the repository at this point in the history
Add pcie_bandwidth_available() into autoconf test whether it's available
in the kernel.

Change-Id: Ib8626a5a93453214db5045775fca29b341f8891e
Signed-off-by: Amber Lin <[email protected]>
Reviewed-by: Slava Grigorev <[email protected]>
  • Loading branch information
ascollard committed Jul 26, 2019
1 parent 2ed23bb commit fed2943
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 8 deletions.
4 changes: 1 addition & 3 deletions drivers/gpu/drm/amd/amdkcl/kcl_pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,7 @@ void amdkcl_pci_init(void)
_kcl_pcie_link_speed = (const unsigned char *) amdkcl_fp_setup("pcie_link_speed",_kcl_pcie_link_speed_stub);
}

#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 17, 0) && \
!defined(OS_NAME_SUSE_15_1) && \
!defined(OS_NAME_UBUNTU_OEM)
#if !defined(HAVE_PCIE_BANDWIDTH_AVAILABLE)
/**
* pcie_bandwidth_available - determine minimum link settings of a PCIe
* device and its bandwidth limitation
Expand Down
1 change: 1 addition & 0 deletions drivers/gpu/drm/amd/dkms/configure.ac
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
AC_INIT(amdgpu-dkms, 19.40)

m4_include([m4/kernel.m4])
m4_include([m4/pcie-bandwidth-available.m4])
m4_include([m4/config.m4])

AC_LANG(C)
Expand Down
1 change: 1 addition & 0 deletions drivers/gpu/drm/amd/dkms/m4/kernel.m4
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ dnl # Default kernel configuration
dnl #
AC_DEFUN([AC_CONFIG_KERNEL], [
AC_KERNEL
AC_AMDGPU_PCIE_BANDWIDTH_AVAILABLE
AS_IF([test "$LINUX_OBJ" != "$LINUX"], [
KERNEL_MAKE="$KERNEL_MAKE O=$LINUX_OBJ"
Expand Down
17 changes: 17 additions & 0 deletions drivers/gpu/drm/amd/dkms/m4/pcie-bandwidth-available.m4
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
dnl #
dnl # commit 6db79a88c67e4679d9c1e4a3f05c6385e21f6e9a
dnl # PCI: Add pcie_bandwidth_available() to compute bandwidth available to device
dnl #
AC_DEFUN([AC_AMDGPU_PCIE_BANDWIDTH_AVAILABLE],
[AC_MSG_CHECKING([whether pcie_bandwidth_available() is available])
AC_KERNEL_TRY_COMPILE_SYMBOL([
#include <linux/pci.h>
], [
pcie_bandwidth_available(NULL, NULL, NULL, NULL);
], [pcie_bandwidth_available], [drivers/pci/pci.c], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_PCIE_BANDWIDTH_AVAILABLE, 1, [pcie_bandwidth_available() is available])
], [
AC_MSG_RESULT(no)
])
])
8 changes: 3 additions & 5 deletions include/kcl/kcl_pci.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,10 @@ extern enum pci_bus_speed (*_kcl_pcie_get_speed_cap)(struct pci_dev *dev);
extern enum pcie_link_width (*_kcl_pcie_get_width_cap)(struct pci_dev *dev);
#endif

#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 17, 0) && \
!defined(OS_NAME_SUSE_15_1) && \
!defined(OS_NAME_UBUNTU_OEM)
#if !defined(HAVE_PCIE_BANDWIDTH_AVAILABLE)
u32 pcie_bandwidth_available(struct pci_dev *dev, struct pci_dev **limiting_dev,
enum pci_bus_speed *speed,
enum pcie_link_width *width);
enum pci_bus_speed *speed,
enum pcie_link_width *width);
#endif

static inline enum pci_bus_speed kcl_pcie_get_speed_cap(struct pci_dev *dev)
Expand Down

0 comments on commit fed2943

Please sign in to comment.