@@ -396,7 +396,6 @@ struct OtEntropySrcState {
396
396
OtFifo32 final_fifo ; /* output FIFO */
397
397
hash_state sha3_state ; /* libtomcrypt hash state */
398
398
OtEntropySrcFsmState state ;
399
- unsigned gennum ;
400
399
unsigned cond_word ; /* count of words processed with SHA3 till hash */
401
400
unsigned noise_count ; /* count of consumed noise words since enabled */
402
401
unsigned packet_count ; /* count of output packets since enabled */
@@ -478,33 +477,21 @@ static int ot_entropy_src_get_generation(OtRandomSrcIf *dev)
478
477
{
479
478
OtEntropySrcState * s = OT_ENTROPY_SRC (dev );
480
479
481
- return ot_entropy_src_is_module_enabled (s ) ? ( int ) s -> gennum : 0 ;
480
+ return ot_entropy_src_is_module_enabled (s ) ? -1 : 0 ;
482
481
}
483
482
484
483
static int ot_entropy_src_get_random (OtRandomSrcIf * dev , int genid ,
485
484
uint64_t random [OT_RANDOM_SRC_DWORD_COUNT ],
486
485
bool * fips )
487
486
{
488
487
OtEntropySrcState * s = OT_ENTROPY_SRC (dev );
488
+ (void )genid ; /* accept any generation identifier */
489
489
490
490
if (!ot_entropy_src_is_module_enabled (s )) {
491
491
qemu_log_mask (LOG_GUEST_ERROR , "%s: entropy_src is down\n" , __func__ );
492
492
return -2 ;
493
493
}
494
494
495
- if (genid != (int )s -> gennum ) {
496
- qemu_log_mask (LOG_GUEST_ERROR ,
497
- "%s: entropy_src gennum mismatch req:%d cur:%u\n" ,
498
- __func__ , genid , s -> gennum );
499
- /*
500
- * Continue anyway as it seems HW does not enforce what is documented.
501
- * Force the generation id so the warning message is only shown once.
502
- */
503
- if (genid != 0 ) {
504
- s -> gennum = (unsigned )genid ;
505
- }
506
- }
507
-
508
495
bool fips_compliant ;
509
496
510
497
switch (s -> state ) {
@@ -1354,8 +1341,6 @@ static void ot_entropy_src_regs_write(void *opaque, hwaddr addr, uint64_t val64,
1354
1341
break ;
1355
1342
}
1356
1343
if ((old ^ s -> regs [reg ]) && ot_entropy_src_is_module_enabled (s )) {
1357
- s -> gennum += 1 ;
1358
- trace_ot_entropy_src_update_generation (s -> gennum );
1359
1344
if (ot_entropy_src_is_fips_enabled (s )) {
1360
1345
/* start up phase */
1361
1346
ot_entropy_src_change_state (s ,
@@ -1364,7 +1349,6 @@ static void ot_entropy_src_regs_write(void *opaque, hwaddr addr, uint64_t val64,
1364
1349
/* boot phase */
1365
1350
ot_entropy_src_change_state (s , ENTROPY_SRC_BOOT_HT_RUNNING );
1366
1351
}
1367
- trace_ot_entropy_src_info ("initial schedule" );
1368
1352
uint64_t now = qemu_clock_get_ns (OT_VIRTUAL_CLOCK );
1369
1353
timer_mod (s -> scheduler ,
1370
1354
(int64_t )(now +
@@ -1616,7 +1600,7 @@ static void ot_entropy_src_reset(DeviceState *dev)
1616
1600
ot_fifo32_reset (& s -> observe_fifo );
1617
1601
ot_fifo32_reset (& s -> swread_fifo );
1618
1602
ot_fifo32_reset (& s -> final_fifo );
1619
- /* note: s->gennum should not be updated on reset */
1603
+
1620
1604
s -> cond_word = 0u ;
1621
1605
s -> noise_count = 0u ;
1622
1606
s -> packet_count = 0u ;
0 commit comments