Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

tpm: return false from tpm_amd_is_rng_defective on non-x86 platforms

tpm_amd_is_rng_defective is for dealing with an issue related to the
AMD firmware TPM, so on non-x86 architectures just have it inline and
return false.

Cc: stable@vger.kernel.org # v6.3+
Reported-by: Sachin Sant <sachinp@linux.ibm.com>
Reported-by: Aneesh Kumar K. V <aneesh.kumar@linux.ibm.com>
Closes: https://lore.kernel.org/lkml/99B81401-DB46-49B9-B321-CF832B50CAC3@linux.ibm.com/
Fixes: f1324bbc4011 ("tpm: disable hwrng for fTPM on some AMD designs")
Signed-off-by: Jerry Snitselaar <jsnitsel@redhat.com>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>

authored by

Jerry Snitselaar and committed by
Jarkko Sakkinen
ecff6813 d5590152

+7
+7
drivers/char/tpm/tpm-chip.c
··· 518 518 * 6.x.y.z series: 6.0.18.6 + 519 519 * 3.x.y.z series: 3.57.y.5 + 520 520 */ 521 + #ifdef CONFIG_X86 521 522 static bool tpm_amd_is_rng_defective(struct tpm_chip *chip) 522 523 { 523 524 u32 val1, val2; ··· 567 566 568 567 return true; 569 568 } 569 + #else 570 + static inline bool tpm_amd_is_rng_defective(struct tpm_chip *chip) 571 + { 572 + return false; 573 + } 574 + #endif /* CONFIG_X86 */ 570 575 571 576 static int tpm_hwrng_read(struct hwrng *rng, void *data, size_t max, bool wait) 572 577 {