Very short advice: If you want to use Ryzen 5000 series and your BIOS version is P1.10 or lower, I suggest you to upgrade BIOS before installing Qubes OS and before configuring the BIOS.
## Short story
After some research, I decided to update BIOS. While ASRock advertises this MoBo to be comptabile with Ryzen 5000 series (see
https://www.asrock.com/mb/AMD/B550%20Phantom%20Gaming%204ac/index.asp#Specification ), this seems to be a half-truth. According to their changelog at
https://www.asrock.com/mb/AMD/B550%20Phantom%20Gaming%204ac/index.asp#BIOS , the BIOS 1.20 description contains "Support AMD Ryzen™ 5000 Series processors". So, with versions 1.00 and 1.10, you are probably out of luck.
What the BIOS change resolved:
* the rdrand issue with dnf
* the USB issues with my trackball.
One-time issues with the new BIOS version:
* When you flash the BIOS, it resets the settings, so you lose IOMMU etc. until you configure it again.
* It has probably changed the PCI identifiers, which has caused weird freezes when starting a VM with a PCI device assigned. Fortunatelly, in my temporary setup, no VM with any PCI device was configured to start on boot. If this was not my case, I would probably end up with non-bootable system and hard debugging...
Not resolved: suspend/resume issues. Symptoms remain the same, including , regardless the smt configuration.
Changed: /proc/cpuinfo - at least added rdrand.
## Long story about rdrand
(You probably don't need to read this to make this MoBo working, but you might be interested for any other reason.)
I've googled for the rdrand issue. Aside from many irelevant results (AMD's and Intel's issues with bad randomness or Google treating "Xen" in phrase with "AMD" as typo), I've learnt something:
1. The source that writes those errors is probably this:
https://github.com/gcc-mirror/gcc/blob/master/libstdc%2B%2B-v3/src/c%2B%2B11/random.cc2. Found the Intel's documentation of the _rdrand32_step instruction (well, intristic function)
https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_rdrand32_step via
https://doc.rust-lang.org/core/arch/x86_64/fn._rdrand32_step.html . So, the instruction can sometimes just fail without any apparent reason, and libstdc++ tries 100 times until it fails.
3. I've tried a code that tests _rdrand32_step (adjusted version of testing program from
https://arstechnica.com/gadgets/2019/10/how-a-months-old-amd-microcode-bug-destroyed-my-weekend/ ), see the attachment. It seems to always fail in both Dom0 and DomU.
4. Interesting finding: qubes-dom0-update works well, even though it runs dnf. I've tried to adjust the command to find the minimal difference that causes the command to fail/succeed:
$ sudo dnf update --installroot /
Error: random_device: rdrand failed
$ sudo dnf update --installroot /var/lib/qubes/dom0-updates
Last metadata expiration check: 0:44:30 ago on Sat Mar 6 16:25:06 2021.
Dependencies resolved.
Nothing to do.
Complete!
5. Since this seems to be related to a CPU instruction which seems to be affected by microcode/BIOS, I've decided to update the BIOS. Which seems to have been the way to go, see above.
Regards,