[lkml]   [2017]   [Oct]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [Part2 PATCH v6 13/38] crypto: ccp: Add Secure Encrypted Virtualization (SEV) command support

On 10/23/2017 04:20 AM, Borislav Petkov wrote:
> On Thu, Oct 19, 2017 at 09:33:48PM -0500, Brijesh Singh wrote:
>> +static int __sev_platform_init(struct sev_data_init *data, int *error)
>> +{
>> + int rc = 0;
>> +
>> + mutex_lock(&fw_init_mutex);
>> +
>> + if (!fw_init_count) {
> I still don't like global semaphores. Can you get the status and check
> for PSTATE.INIT state and do the init only if the platform is in

Calling PLATFORM_GET_STATUS is not required, we can manage the state
through a simple ref count variable. Issuing PSP commands will always be
much more expensive compare to accessing a protected global variable. I
would prefer to avoid invoking PSP command if possible. Additionally,
the global semaphore is still needed to serialize the
sev_platform_init() and sev_platform_shutdown() from multiple processes.
e.g If process "A" calls sev_platform_init() and if it gets preempted
due to whatever reason then we don't want another process to issue the
shutdown command while process "A" is in middle of sev_platform_init().


 \ /
  Last update: 2017-10-23 21:58    [W:0.176 / U:1.848 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site