Need guidance to apply ACS patch to my kernel

I have an AM5 motherboard with X670E chipset. Although their performance is great, the way AMD has implemented the chipset, results in big IOMMU groups, making device pass-through really tricky.

I am using Fedora 42 with kernel-6.17.5-200.fc42.x86_64

I googled for info how to install the ACS patch, and found this:

sudo dnf copr enable jlay/kernel-acspatch
sudo dnf install kernel-acspatch kernel-acspatch-devel

But when I run the first command I am getting this message:

https://copr.fedorainfracloud.org/api_3/rpmrepo/jlay/kernel-acspatch/fedora-42/
Chroot not found in the given Copr project (fedora-42-x86_64).
You can choose one of the available chroots explicitly:
epel-7-x86_64
epel-8-x86_64

I found out that these are older versions and there isn’t available for my version.
So, next step was to try and recompile myself.

I followed these steps:

koji download-build --arch=src kernel-6.17.5-200.fc42.x86_64
rpm -ivh kernel-6.17.5-*.src.rpm
cd ~/rpmbuild/SPECS
sudo dnf builddep kernel.spec

curl -o ~/rpmbuild/SOURCES/add-acs-override.patch
https://raw.githubusercontent.com/some-natalie/fedora-acs-override/main/acs/add-acs-override.patch

Edit ~/rpmbuild/SPECS/kernel.spec and add near the top:

#ACS override patch
Patch1000: add-acs-override.patch

Install the built RPMs from ~/rpmbuild/RPMS/x86_64/
rpmbuild -bb --without debug --without debuginfo kernel.spec

However this resulted in tens of errors, mostly file/directory not found.

Anybody has any reliable guide that I can follow to make it work?
Or any other solution?

Bump in case someone has info.

After my search, I found out that the most recent guide is this one:

So, I followed this to get it patched, and I spent over 4 hours trying to get it work.
As soon as I add this to kernel.spec file, everything breaks.

%define buildid .acs

For some reason it does not work if I want to distinct the build from the default name.
If I build without debug options “rpmbuild -bb kernel.spec 2>&1 | tee ~/kernel-build.log” I am getting this error:

error: mixing -Zsanitizer will cause an ABI mismatch in crate build_error
 --> rust/build_error.rs:3:1
  |
3 | //! Build-time error.
  | ^
  |
  = help: the -Zsanitizer flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely
  = note: unset -Zsanitizer in this crate is incompatible with -Zsanitizer=kernel-address in dependency core
  = help: set -Zsanitizer=kernel-address in this crate or unset -Zsanitizer in core
  = help: if you are sure this will not cause problems, you may use -Cunsafe-allow-abi-mismatch=sanitizer to silence this error
error: mixing -Zsanitizer will cause an ABI mismatch in crate build_error
 --> rust/build_error.rs:3:1
  |
3 | //! Build-time error.
  | ^
  |
  = help: the -Zsanitizer flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely
  = note: unset -Zsanitizer in this crate is incompatible with -Zsanitizer=kernel-address in dependency compiler_builtins
  = help: set -Zsanitizer=kernel-address in this crate or unset -Zsanitizer in compiler_builtins
  = help: if you are sure this will not cause problems, you may use -Cunsafe-allow-abi-mismatch=sanitizer to silence this error
error: aborting due to 2 previous errors

With debug options, I was getting another error, about “BLT” (?) … Tried to look online, made few changes to my files, but couldn’t make it work.

What has changed recently in the build process that makes it fail when changing the buildid ?

The actual build error you are hitting is because you are using an old kernel, and the newer rust build. The patches to build with the latest rust are included in 6.17.8 kernels.

As for building with a patch, we actually make it really easy. There is an empty patch called linux-kernel-test.patch and if you cat your.patch > linux-kernel-test.patch it will just build with your patch. No spec changes required. If you are building a series of patches, that works too, just drop them all into that file (in order).

2 Likes

Haven’t tried patching before, so I am completely new to this.
I just wanted the ACS patch for better IOMMU grouping, and looked for guides on how to.

So, if I use 6.17.8, it will work, even though I use the buildid parameter?