Bug 205227

Summary: A five seconds boot delay due to ccp (Ryzen 3000 crypto co-processor)
Product: Platform Specific/Hardware Reporter: Artem S. Tashkinov (aros)
Component: x86-64Assignee: platform_x86_64 (platform_x86_64)
Status: RESOLVED CODE_FIX    
Severity: high CC: bp
Priority: P1    
Hardware: x86-64   
OS: Linux   
Kernel Version: 5.3.6 Subsystem:
Regression: No Bisected commit-id:
Attachments: /proc/cpuinfo
dmesg

Description Artem S. Tashkinov 2019-10-17 14:39:30 UTC
On boot while trying to initialize the CCP the system freezes for up to five seconds. At the end of this delay I see:

Oct 17 13:05:08 localhost kernel: ccp 0000:09:00.1: enabling device (0000 -> 0002)
Oct 17 13:05:08 localhost kernel: ccp 0000:09:00.1: ccp enabled
Oct 17 13:05:08 localhost kernel: ccp 0000:09:00.1: psp enabled
Oct 17 19:05:13 localhost kernel: ccp 0000:09:00.1: sev command 0x4 timed out, disabling PSP 
Oct 17 13:05:13 localhost kernel: ccp 0000:09:00.1: SEV: failed to get status. Error: 0x0

Please remove the delay.
Comment 1 Borislav Petkov 2019-10-17 17:44:49 UTC
See if there's a new BIOS for your box and if so, update it.

Also, pls upload dmesg and /proc/cpuinfo from the box.

Thx.
Comment 2 Artem S. Tashkinov 2019-10-17 18:48:53 UTC
Created attachment 285523 [details]
/proc/cpuinfo
Comment 3 Artem S. Tashkinov 2019-10-17 18:51:02 UTC
Created attachment 285525 [details]
dmesg

I have the latest BIOS version installed: https://bato.life/?l=ce4bf84e0482
Comment 4 Artem S. Tashkinov 2019-10-17 18:52:36 UTC
My distro is Fedora 30 with all updates installed:

$ rpm -q systemd
systemd-241-12.git323cdf4.fc30.x86_64

# dnf update 
Fedora 30 - x86_64 - Updates                                                                                                                                  Dependencies resolved.
Nothing to do.
Complete!
Comment 5 Artem S. Tashkinov 2019-10-17 18:54:15 UTC
I could have asked ASUS to release a fixed BIOS to alleviate the issue but their support is absolutely atrocious and completely useless: for all the issues you encounter their advice is always the same: reset BIOS settings or RMA/replace your motherboard.
Comment 6 Borislav Petkov 2019-10-17 19:04:39 UTC
So in that dmesg I don't see that delay:

Oct 17 13:52:31.651584 localhost kernel: ccp 0000:09:00.1: enabling device (0000 -> 0002)
Oct 17 13:52:31.651774 localhost kernel: ccp 0000:09:00.1: ccp enabled
Oct 17 13:52:31.652526 localhost kernel: ccp 0000:09:00.1: psp enabled
Oct 17 13:52:36.821828 localhost kernel: ccp 0000:09:00.1: sev command 0x4 timed out, disabling PSP 
Oct 17 13:52:36.822384 localhost kernel: ccp 0000:09:00.1: SEV: failed to get status. Error: 0x0

You command times out very quickly. Are you saying the delay doesn't happen on every boot?
Comment 7 Artem S. Tashkinov 2019-10-17 19:15:17 UTC
It happens on every boot. Only after I recompiled the kernel without the ccp module (could have simply blacklisted it but if it doesn't work why would I need it?) the delay disappeared.

I also disabled the sp5100-tco module whose hardware looks not to be physically enabled but I doubt it had any effect on boot.
Comment 8 Artem S. Tashkinov 2019-10-17 19:16:04 UTC
(In reply to Borislav Petkov from comment #6)
> So in that dmesg I don't see that delay:
> 
> Oct 17 13:52:31.651584 localhost kernel: ccp 0000:09:00.1: enabling device
> (0000 -> 0002)
> Oct 17 13:52:31.651774 localhost kernel: ccp 0000:09:00.1: ccp enabled
> Oct 17 13:52:31.652526 localhost kernel: ccp 0000:09:00.1: psp enabled
> Oct 17 13:52:36.821828 localhost kernel: ccp 0000:09:00.1: sev command 0x4
> timed out, disabling PSP 
> Oct 17 13:52:36.822384 localhost kernel: ccp 0000:09:00.1: SEV: failed to
> get status. Error: 0x0
> 
> You command times out very quickly. Are you saying the delay doesn't happen
> on every boot?

Oct 17 13:52:31.652526 localhost kernel: ccp 0000:09:00.1: psp enabled
Oct 17 13:52:36.821828 localhost kernel: ccp 0000:09:00.1: sev command 0x4 timed out, disabling PSP 

Exactly five seconds between these two lines.
Comment 9 Borislav Petkov 2019-10-17 19:35:59 UTC
(In reply to Artem S. Tashkinov from comment #8)
> Oct 17 13:52:31.652526 localhost kernel: ccp 0000:09:00.1: psp enabled
> Oct 17 13:52:36.821828 localhost kernel: ccp 0000:09:00.1: sev command 0x4
> timed out, disabling PSP 
> 
> Exactly five seconds between these two lines.

Doh, of course, it is late here and I must be blind. :-(

Sorry.
Comment 10 Artem S. Tashkinov 2019-10-17 19:39:34 UTC
We are just people and may get inattentive when we're tired. It's OK :-)

If there's any other information I could provide I'd be glad to do so.
Comment 11 Borislav Petkov 2019-10-19 09:38:33 UTC
Please try these patches:

https://lore.kernel.org/linux-crypto/157142758885.6869.11882127817423670946.stgit@taos/T/#m2f3f27d81b03a3b68f11be4d3aa3466cae162915

If you have questions how, don't hesitate to ask.

Thx.
Comment 12 Artem S. Tashkinov 2020-04-12 10:49:29 UTC
(In reply to Borislav Petkov from comment #11)
> Please try these patches:
> 
> https://lore.kernel.org/linux-crypto/157142758885.6869.11882127817423670946.
> stgit@taos/T/#m2f3f27d81b03a3b68f11be4d3aa3466cae162915
> 
> If you have questions how, don't hesitate to ask.
> 
> Thx.

Thanks, it's finally working as expected in Linux 5.6.