Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wip: amdgpu-pro update #29698

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 14 additions & 2 deletions nixos/modules/hardware/video/amdgpu-pro.nix
Expand Up @@ -15,14 +15,18 @@ let

opengl = config.hardware.opengl;

kernel = pkgs.linux_4_10.override {
extraConfig = ''
KALLSYMS_ALL y
'';
};

in

{

config = mkIf enabled {

nixpkgs.config.xorg.abiCompat = "1.18";

services.xserver.drivers = singleton
{ name = "amdgpu"; modules = [ package ]; libPath = [ package ]; };

Expand All @@ -31,17 +35,25 @@ in

boot.extraModulePackages = [ package ];

boot.kernelPackages =
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vcunat What do you think of this? It feels wrong, but this kernel module requires linux 4.10 w/ KALLSYMS_ALL=y, and I couldn't find a precedent for influencing the kernel config.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First of all, 4.10 branch was killed upstream, and we already deleted it in nixpkgs as well. Second, just the fact of users having to build their own kernel would be quite a nuisance. Perhaps it would be good to look into the suitability of having the option in default kernels (say those > 4.9).

Copy link
Member

@vcunat vcunat Oct 5, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

4.13 is the only maintained branch newer than 4.9 ATM (4.9 is the latest longterm branch).

pkgs.recurseIntoAttrs (pkgs.linuxPackagesFor kernel);

boot.blacklistedKernelModules = [ "radeon" ];

hardware.firmware = [ package ];

system.activationScripts.setup-amdgpu-pro = ''
mkdir -p /run/lib
ln -sfn ${package}/lib ${package.libCompatDir}
ln -sfn ${package} /run/amdgpu-pro
'' + optionalString opengl.driSupport32Bit ''
ln -sfn ${package32}/lib ${package32.libCompatDir}
'';

system.requiredKernelConfig = with config.lib.kernelConfig; [
(isYes "KALLSYMS_ALL")
];

environment.etc = {
"amd/amdrc".source = package + "/etc/amd/amdrc";
"amd/amdapfxx.blb".source = package + "/etc/amd/amdapfxx.blb";
Expand Down
24 changes: 13 additions & 11 deletions pkgs/os-specific/linux/amdgpu-pro/default.nix
Expand Up @@ -30,9 +30,9 @@ let

in stdenv.mkDerivation rec {

version = "17.10";
version = "17.30";
pname = "amdgpu-pro";
build = "${version}-401251";
build = "${version}-465504";

libCompatDir = "/run/lib/${libArch}";

Expand All @@ -41,7 +41,7 @@ in stdenv.mkDerivation rec {
src = fetchurl {
url =
"https://www2.ati.com/drivers/linux/ubuntu/amdgpu-pro-${build}.tar.xz";
sha256 = "004n0df8acjpjz72z3bjxb2a0b7qwln13jlknfn7xxqvhhwwy40a";
sha256 = "1xga5fc5yv1abznw3c4y7nm8ixqmaf2fv2rfb2sn88al8b8r8i5p";
curlOpts = "--referer http://support.amd.com/en-us/kb-articles/Pages/AMD-Radeon-GPU-PRO-Linux-Beta-Driver%e2%80%93Release-Notes.aspx";
};

Expand All @@ -57,12 +57,10 @@ in stdenv.mkDerivation rec {
sourceRoot=.
'';

modulePatches = [
modulePatches = optionals (!libsOnly) ([
./patches/0001-disable-firmware-copy.patch
./patches/0002-linux-4.9-fixes.patch
./patches/0003-Change-seq_printf-format-for-64-bit-context.patch
./patches/0004-fix-warnings-for-Werror.patch
];
./patches/0002-fix-warnings-for-Werror.patch
]);

patchPhase = optionalString (!libsOnly) ''
pushd usr/src/amdgpu-pro-${build}
Expand Down Expand Up @@ -116,10 +114,11 @@ in stdenv.mkDerivation rec {
popd

pushd opt/amdgpu-pro
'' + optionalString (!stdenv.is64bit) ''
'' + optionalString (!libsOnly && stdenv.is64bit) ''
cp -r bin $out/bin
'' + ''
cp -r include $out/include
cp -r share/* $out/share
cp -r lib/${libArch}/* $out/lib
'' + optionalString (!libsOnly) ''
mv lib/xorg $out/lib/xorg
Expand All @@ -133,7 +132,7 @@ in stdenv.mkDerivation rec {
mv $out/etc/vulkan $out/share
interpreter="$(cat $NIX_CC/nix-support/dynamic-linker)"
libPath="$out/lib:$out/lib/gbm:$depLibPath"
'' + optionalString (!stdenv.is64bit) ''
'' + optionalString (!libsOnly && stdenv.is64bit) ''
for prog in clinfo modetest vbltest kms-universal-planes kms-steal-crtc modeprint amdgpu_test kmstest proptest; do
patchelf --interpreter "$interpreter" --set-rpath "$libPath" "$out/bin/$prog"
done
Expand All @@ -147,9 +146,12 @@ in stdenv.mkDerivation rec {
for lib in `find "$out/lib/" -name '*.so*' -type f`; do
patchelf --set-rpath "$libPath" "$lib"
done
for lib in libEGL.so.1 libGL.so.1.2 ${optionalString (!libsOnly) "xorg/modules/extensions/libglx.so"} dri/amdgpu_dri.so; do
for lib in libEGL.so.1 libGL.so.1.2 ${optionalString (!libsOnly) "xorg/modules/extensions/libglx.so"} dri/amdgpu_dri.so libamdocl${bitness}.so; do
perl -pi -e 's:${libReplaceDir}:${libCompatDir}:g' "$out/lib/$lib"
done
for lib in dri/amdgpu_dri.so libdrm_amdgpu.so.1.0.0 libgbm_amdgpu.so.1.0.0 libkms_amdgpu.so.1.0.0 libamdocl${bitness}.so; do
perl -pi -e 's:/opt/amdgpu-pro/:/run/amdgpu-pro/:g' "$out/lib/$lib"
done
substituteInPlace "$out/share/vulkan/icd.d/amd_icd${bitness}.json" --replace "/opt/amdgpu-pro/lib/${libArch}" "$out/lib"
'';

Expand Down
@@ -1,25 +1,25 @@
From 704cef8638ffbdd8de9e57f28b43ea42c685ea87 Mon Sep 17 00:00:00 2001
From 36b4ba44048aefb2a4d0096bc0ea1c4cc6fc5ef4 Mon Sep 17 00:00:00 2001
From: David McFarland <corngood@gmail.com>
Date: Sat, 28 Jan 2017 16:57:26 -0400
Subject: [PATCH 1/4] disable firmware copy
Subject: [PATCH] disable firmware copy

---
pre-build.sh | 5 -----
1 file changed, 5 deletions(-)

diff --git a/pre-build.sh b/pre-build.sh
index 622ff13..e3cd009 100755
index 35d53e5..3c9d7d1 100755
--- a/pre-build.sh
+++ b/pre-build.sh
@@ -35,8 +35,3 @@ find ttm -name '*.c' -exec grep EXPORT_SYMBOL {} + \
@@ -38,8 +38,3 @@ find ttm -name '*.c' -exec grep EXPORT_SYMBOL {} + \
| sort -u \
| awk -F'[()]' '{print "#define "$2" amd"$2" //"$0}'\
> include/rename_symbol.h
>> include/rename_symbol.h
-
-FW_DIR="/lib/firmware/$KERNELVER"
-mkdir -p $FW_DIR
-cp -ar /usr/src/amdgpu-pro-17.10-401251/firmware/radeon $FW_DIR
-cp -ar /usr/src/amdgpu-pro-17.10-401251/firmware/amdgpu $FW_DIR
-cp -ar /usr/src/amdgpu-pro-17.30-465504/firmware/radeon $FW_DIR
-cp -ar /usr/src/amdgpu-pro-17.30-465504/firmware/amdgpu $FW_DIR
--
2.12.2
2.14.1

@@ -0,0 +1,130 @@
From f40ffb49ef0f8579c313ed895f9798c3e0e8b2a2 Mon Sep 17 00:00:00 2001
From: David McFarland <corngood@gmail.com>
Date: Mon, 6 Feb 2017 22:13:49 -0400
Subject: [PATCH 2/2] fix warnings for Werror

---
amd/amdgpu/amdgpu_amdkfd_gfx_v9.c | 1 -
amd/amdgpu/amdgpu_sa.c | 2 +-
amd/amdgpu/dce_v10_0.c | 2 +-
amd/amdgpu/dce_v11_0.c | 2 +-
amd/amdgpu/dce_v6_0.c | 2 +-
amd/amdgpu/dce_v8_0.c | 2 +-
amd/amdkfd/kfd_chardev.c | 1 +
amd/display/dc/bios/bios_parser2.c | 8 ++++----
8 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c b/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c
index 0ff5027..c286100 100644
--- a/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c
+++ b/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c
@@ -966,7 +966,6 @@ static int invalidate_tlbs_with_kiq(struct amdgpu_device *adev, uint16_t pasid)
signed long r;
struct fence *f;
struct amdgpu_ring *ring = &adev->gfx.kiq.ring;
- struct amdgpu_kiq *kiq = &adev->gfx.kiq;

mutex_lock(&adev->gfx.kiq.ring_mutex);
amdgpu_ring_alloc(ring, 12); /* fence + invalidate_tlbs package*/
diff --git a/amd/amdgpu/amdgpu_sa.c b/amd/amdgpu/amdgpu_sa.c
index 401a20f..facadf3 100644
--- a/amd/amdgpu/amdgpu_sa.c
+++ b/amd/amdgpu/amdgpu_sa.c
@@ -430,7 +430,7 @@ void amdgpu_sa_bo_dump_debug_info(struct amdgpu_sa_manager *sa_manager,
if (i->fence)
#if defined(BUILD_AS_DKMS)
seq_printf(m, " protected by 0x%08x on context %d",
- i->fence->seqno, i->fence->context);
+ i->fence->seqno, (int)i->fence->context);
#else
seq_printf(m, " protected by 0x%08x on context %llu",
i->fence->seqno, i->fence->context);
diff --git a/amd/amdgpu/dce_v10_0.c b/amd/amdgpu/dce_v10_0.c
index b41811d..89268d0 100644
--- a/amd/amdgpu/dce_v10_0.c
+++ b/amd/amdgpu/dce_v10_0.c
@@ -2131,7 +2131,7 @@ static int dce_v10_0_crtc_do_set_base(struct drm_crtc *crtc,
bypass_lut = true;
break;
default:
- format_name = kcl_drm_get_format_name(target_fb->pixel_format);
+ format_name = (char*)kcl_drm_get_format_name(target_fb->pixel_format);
DRM_ERROR("Unsupported screen format %s\n", format_name);
kfree(format_name);
return -EINVAL;
diff --git a/amd/amdgpu/dce_v11_0.c b/amd/amdgpu/dce_v11_0.c
index 82c8eba..24daa85 100644
--- a/amd/amdgpu/dce_v11_0.c
+++ b/amd/amdgpu/dce_v11_0.c
@@ -2115,7 +2115,7 @@ static int dce_v11_0_crtc_do_set_base(struct drm_crtc *crtc,
bypass_lut = true;
break;
default:
- format_name = kcl_drm_get_format_name(target_fb->pixel_format);
+ format_name = (char*)kcl_drm_get_format_name(target_fb->pixel_format);
DRM_ERROR("Unsupported screen format %s\n", format_name);
kfree(format_name);
return -EINVAL;
diff --git a/amd/amdgpu/dce_v6_0.c b/amd/amdgpu/dce_v6_0.c
index 2d06b39..b0da814 100644
--- a/amd/amdgpu/dce_v6_0.c
+++ b/amd/amdgpu/dce_v6_0.c
@@ -2064,7 +2064,7 @@ static int dce_v6_0_crtc_do_set_base(struct drm_crtc *crtc,
bypass_lut = true;
break;
default:
- format_name = kcl_drm_get_format_name(target_fb->pixel_format);
+ format_name = (char*)kcl_drm_get_format_name(target_fb->pixel_format);
DRM_ERROR("Unsupported screen format %s\n", format_name);
kfree(format_name);
return -EINVAL;
diff --git a/amd/amdgpu/dce_v8_0.c b/amd/amdgpu/dce_v8_0.c
index e32222c..f984040 100644
--- a/amd/amdgpu/dce_v8_0.c
+++ b/amd/amdgpu/dce_v8_0.c
@@ -2002,7 +2002,7 @@ static int dce_v8_0_crtc_do_set_base(struct drm_crtc *crtc,
bypass_lut = true;
break;
default:
- format_name = kcl_drm_get_format_name(target_fb->pixel_format);
+ format_name = (char*)kcl_drm_get_format_name(target_fb->pixel_format);
DRM_ERROR("Unsupported screen format %s\n", format_name);
kfree(format_name);
return -EINVAL;
diff --git a/amd/amdkfd/kfd_chardev.c b/amd/amdkfd/kfd_chardev.c
index b01875e..a15cebc 100644
--- a/amd/amdkfd/kfd_chardev.c
+++ b/amd/amdkfd/kfd_chardev.c
@@ -1755,6 +1755,7 @@ static int kfd_ioctl_get_tile_config(struct file *filep,
static int kfd_ioctl_cross_memory_copy(struct file *filep,
struct kfd_process *local_p, void *data)
{
+ return 0;
}
#else
static int kfd_ioctl_cross_memory_copy(struct file *filep,
diff --git a/amd/display/dc/bios/bios_parser2.c b/amd/display/dc/bios/bios_parser2.c
index 682fc9b..6257220 100644
--- a/amd/display/dc/bios/bios_parser2.c
+++ b/amd/display/dc/bios/bios_parser2.c
@@ -1317,13 +1317,13 @@ static enum bp_result get_embedded_panel_info_v2_1(
info->lcd_timing.misc_info.VERTICAL_CUT_OFF = 0;

info->lcd_timing.misc_info.H_REPLICATION_BY2 =
- lvds->lcd_timing.miscinfo & ATOM_H_REPLICATIONBY2;
+ (lvds->lcd_timing.miscinfo & ATOM_H_REPLICATIONBY2) != 0;
info->lcd_timing.misc_info.V_REPLICATION_BY2 =
- lvds->lcd_timing.miscinfo & ATOM_V_REPLICATIONBY2;
+ (lvds->lcd_timing.miscinfo & ATOM_V_REPLICATIONBY2) != 0;
info->lcd_timing.misc_info.COMPOSITE_SYNC =
- lvds->lcd_timing.miscinfo & ATOM_COMPOSITESYNC;
+ (lvds->lcd_timing.miscinfo & ATOM_COMPOSITESYNC) != 0;
info->lcd_timing.misc_info.INTERLACE =
- lvds->lcd_timing.miscinfo & ATOM_INTERLACE;
+ (lvds->lcd_timing.miscinfo & ATOM_INTERLACE) != 0;

/* not provided by VBIOS*/
info->lcd_timing.misc_info.DOUBLE_CLOCK = 0;
--
2.14.1

This file was deleted.

This file was deleted.