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

kernel: enable PHY_ROCKCHIP_PCIE and PCIE_ROCKCHIP_HOST #126615

Closed
wants to merge 1 commit into from

Conversation

jakubgs
Copy link
Contributor

@jakubgs jakubgs commented Jun 11, 2021

Motivation for this change

Fixes failure to detect NVMe SSD in Rockchip devices like NanoPC-T4.

More details can be seen in:
NixOS/nixos-hardware#259
#111034

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • 21.11 Release Notes
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Fixes failure to detect NVMe SSD in Rockchip devices like NanoPC-T4.

More details can be seen in:
NixOS/nixos-hardware#259
NixOS#111034

Signed-off-by: Jakub Sokołowski <[email protected]>
@github-actions github-actions bot added the 6.topic: kernel The Linux kernel label Jun 11, 2021
@jakubgs jakubgs requested a review from samueldr June 11, 2021 17:21
@ofborg ofborg bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux labels Jun 11, 2021
Copy link
Member

@samueldr samueldr left a comment

Choose a reason for hiding this comment

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

Enabling it outright to yes for all users is not a solution. Especially if there are issues that this is working around; maybe that will cause more issues elsewhere on probe. (Though unlikely)

@samueldr
Copy link
Member

samueldr commented Jun 11, 2021

I was made aware of this recently:

Try applying this patch and still use the modules. It's unclear to me whether it would help the specific issue you are facing or not.

@jakubgs
Copy link
Contributor Author

jakubgs commented Jun 11, 2021

Wow, I have not seen that. That's VERY fresh. It would fit with the timeout errors I was getting when I tried putting them initrd:

[    3.677351] rockchip-pcie f8000000.pcie: PCIe link training gen1 timeout!

It targets the same module, but it's not exactly the same part of the code that causes the timeout:
https://github.com/torvalds/linux/blob/v5.11/drivers/pci/controller/pcie-rockchip-host.c#L332-L339

I will try to use the patch with modules added to the initrd image and report back. Thanks for pointing it out!

@samueldr
Copy link
Member

Yes, apparently it was a "known issue" for RK3399 and PCIe.

I lament the fact there is no centralized location for listing known issues.

@samueldr samueldr marked this pull request as draft June 11, 2021 20:39
@samueldr
Copy link
Member

(Converted to draft to ensure no accidental merges happen... Let's see where this goes!)

@jakubgs
Copy link
Contributor Author

jakubgs commented Jun 12, 2021

Nope, I tired the following configuration:

{
  boot.kernelPackages = pkgs.linuxPackages_5_11;
  boot.kernelPatches = [{
    name = "v2-PCI-rockchip-Avoid-accessing-PCIe-registers-with-clocks-gated.diff";
    patch = pkgs.fetchurl {
      url = "https://patchwork.kernel.org/project/linux-rockchip/patch/[email protected]/raw/";
      sha256 = "0057gmjj5glbkabyi5jgnd8r9dhnsb7mkc6nbyxnv6a0rh69yx4n";
    };
  }];
  boot.initrd.kernelModules = [ "pcie-rockchip-host" "phy-rockchip-pcie" ];
}

And it fails to boot, and I see the same error in kernel logs:

[    3.694422] rockchip-pcie f8000000.pcie: PCIe link training gen1 timeout!

So no, it doesn't seem like that patch fixes it.

@jakubgs
Copy link
Contributor Author

jakubgs commented Jul 5, 2021

I've also tried the following patch:
https://patchwork.ozlabs.org/project/linux-pci/patch/[email protected]/

{
  boot.kernelPackages = pkgs.linuxPackages_5_11;
  boot.kernelPatches = [{
    name = "PCI-rockchip-Fix-timeout-in-rockchip_pcie_host_init_port.diff";
    patch = pkgs.fetchurl {
      url = "https://patchwork.ozlabs.org/project/linux-pci/patch/[email protected]/raw/";
      sha256 = "0qhggf4ikdcx36lrnlri46gmhj7rvx6j88c7jzii1pb2daxg77cy";
    };
  }];
  boot.initrd.kernelModules = [ "pcie-rockchip-host" "phy-rockchip-pcie" ];
}

Which actually touches the exact timeout for which kernel log message I've seen, but it doesn't help, which is quite confusing.

@stale
Copy link

stale bot commented Jan 3, 2022

I marked this as stale due to inactivity. → More info

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jan 3, 2022
@jakubgs
Copy link
Contributor Author

jakubgs commented Jan 10, 2022

Yeah, I don't think enabling that globally makes sense. If I ever find a patch that fixes this I'll open a new PR.

@jakubgs jakubgs closed this Jan 10, 2022
@jakubgs jakubgs deleted the pcie-rockchip branch July 23, 2022 19:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md 6.topic: kernel The Linux kernel 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants