Re: [PATCH v4 08/13] x86/power/keylocker: Restore internal wrapping key from the ACPI S3/4 sleep states

From: Bae, Chang Seok
Date: Tue Dec 21 2021 - 23:58:47 EST


On Dec 17, 2021, at 07:42, Rafael J. Wysocki <rafael@xxxxxxxxxx> wrote:
>
> First, I would change the subject to "x86/PM/keylocker: Restore
> internal wrapping key on resume from ACPI S3/S4".
>
> On Tue, Dec 14, 2021 at 2:00 AM Chang S. Bae <chang.seok.bae@xxxxxxxxx> wrote:
>>
>> When the system state switches to these sleep states, the internal
>> wrapping key gets reset in the CPU state.
>
> And here I would say
>
> "When the system enters the ACPI S3 or S4 sleep state, the internal
> wrapping key is discarded.”
>

<snip>

>> /**
>> * setup_keylocker - Enable the feature.
>> * @c: A pointer to struct cpuinfo_x86
>> @@ -49,6 +87,7 @@ void __ref setup_keylocker(struct cpuinfo_x86 *c)
>>
>> if (c == &boot_cpu_data) {
>> u32 eax, ebx, ecx, edx;
>> + bool backup_available;
>>
>> cpuid_count(KEYLOCKER_CPUID, 0, &eax, &ebx, &ecx, &edx);
>> /*
>> @@ -62,10 +101,49 @@ void __ref setup_keylocker(struct cpuinfo_x86 *c)
>> goto disable;
>> }
>>
>> + backup_available = (ebx & KEYLOCKER_CPUID_EBX_BACKUP) ? true : false;
>
> Why not
>
> backup_available = !!(ebx & KEYLOCKER_CPUID_EBX_BACKUP);
>
> Apart from this it looks OK, so with the above addressed, please feel
> free to add
>
> Acked-by: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx>
>
> to this patch.

Thanks Rafael! Will do.

Chang