From patchwork Mon Oct 23 07:34:29 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Borislav Petkov X-Patchwork-Id: 10022107 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8C714603D7 for ; Mon, 23 Oct 2017 07:34:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7BAFE20163 for ; Mon, 23 Oct 2017 07:34:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6DEE220500; Mon, 23 Oct 2017 07:34:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 606DB20163 for ; Mon, 23 Oct 2017 07:34:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751121AbdJWHeh (ORCPT ); Mon, 23 Oct 2017 03:34:37 -0400 Received: from mail.skyhub.de ([5.9.137.197]:60390 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750756AbdJWHeg (ORCPT ); Mon, 23 Oct 2017 03:34:36 -0400 X-Virus-Scanned: Nedap ESD1 at mail.skyhub.de Received: from mail.skyhub.de ([127.0.0.1]) by localhost (blast.alien8.de [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id uXMjItMRftcK; Mon, 23 Oct 2017 09:34:34 +0200 (CEST) Received: from nazgul.tnic (unknown [62.168.35.105]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 8AF251EC060D; Mon, 23 Oct 2017 09:34:34 +0200 (CEST) Date: Mon, 23 Oct 2017 09:34:29 +0200 From: Borislav Petkov To: Brijesh Singh Cc: kvm@vger.kernel.org, Paolo Bonzini , Radim =?utf-8?B?S3LEjW3DocWZ?= , Herbert Xu , Gary Hook , Tom Lendacky , linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [Part2 PATCH v6 13/38] crypto: ccp: Add Secure Encrypted Virtualization (SEV) command support Message-ID: <20171023073429.GA10952@nazgul.tnic> References: <20171020023413.122280-1-brijesh.singh@amd.com> <20171020023413.122280-14-brijesh.singh@amd.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20171020023413.122280-14-brijesh.singh@amd.com> User-Agent: Mutt/1.6.0 (2016-04-01) Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Thu, Oct 19, 2017 at 09:33:48PM -0500, Brijesh Singh wrote: > AMD's new Secure Encrypted Virtualization (SEV) feature allows the > memory contents of virtual machines to be transparently encrypted with a > key unique to the VM. The programming and management of the encryption > keys are handled by the AMD Secure Processor (AMD-SP) which exposes the > commands for these tasks. The complete spec is available at: > > http://support.amd.com/TechDocs/55766_SEV-KM%20API_Specification.pdf > > Extend the AMD-SP driver to provide the following support: > > - an in-kernel API to communicate with the SEV firmware. The API can be > used by the hypervisor to create encryption context for a SEV guest. > > - a userspace IOCTL to manage the platform certificates. Just minor cleanups: diff --git a/drivers/crypto/ccp/psp-dev.c b/drivers/crypto/ccp/psp-dev.c index e9966d5fc6c4..f9a9a6e6ab99 100644 --- a/drivers/crypto/ccp/psp-dev.c +++ b/drivers/crypto/ccp/psp-dev.c @@ -31,7 +31,7 @@ static DEFINE_MUTEX(sev_cmd_mutex); static DEFINE_MUTEX(fw_init_mutex); -static struct sev_misc_dev *sev_misc_dev; +static struct sev_misc_dev *misc_dev; static int fw_init_count; static struct psp_device *psp_alloc_struct(struct sp_device *sp) @@ -299,14 +299,14 @@ static int sev_ops_init(struct psp_device *psp) * sev_do_cmd() finds the right master device to which to issue the * command to the firmware. */ - if (!sev_misc_dev) { + if (!misc_dev) { struct miscdevice *misc; - sev_misc_dev = devm_kzalloc(dev, sizeof(*sev_misc_dev), GFP_KERNEL); - if (!sev_misc_dev) + misc_dev = devm_kzalloc(dev, sizeof(*misc_dev), GFP_KERNEL); + if (!misc_dev) return -ENOMEM; - misc = &sev_misc_dev->misc; + misc = &misc_dev->misc; misc->minor = MISC_DYNAMIC_MINOR; misc->name = DEVICE_NAME; misc->fops = &sev_fops; @@ -315,13 +315,13 @@ static int sev_ops_init(struct psp_device *psp) if (ret) return ret; - kref_init(&sev_misc_dev->refcount); + kref_init(&misc_dev->refcount); } else { - kref_get(&sev_misc_dev->refcount); + kref_get(&misc_dev->refcount); } init_waitqueue_head(&psp->sev_int_queue); - psp->sev_misc = sev_misc_dev; + psp->sev_misc = misc_dev; dev_info(dev, "registered SEV device\n"); return 0; @@ -340,9 +340,9 @@ static int sev_init(struct psp_device *psp) static void sev_exit(struct kref *ref) { - struct sev_misc_dev *sev_dev = container_of(ref, struct sev_misc_dev, refcount); + struct sev_misc_dev *misc_dev = container_of(ref, struct sev_misc_dev, refcount); - misc_deregister(&sev_dev->misc); + misc_deregister(&misc_dev->misc); } int psp_dev_init(struct sp_device *sp) @@ -405,7 +405,7 @@ void psp_dev_destroy(struct sp_device *sp) struct psp_device *psp = sp->psp_data; if (psp->sev_misc) - kref_put(&sev_misc_dev->refcount, sev_exit); + kref_put(&misc_dev->refcount, sev_exit); sp_free_psp_irq(sp, psp); } diff --git a/include/linux/psp-sev.h b/include/linux/psp-sev.h index 21511419bfe6..eac850a97610 100644 --- a/include/linux/psp-sev.h +++ b/include/linux/psp-sev.h @@ -525,7 +525,7 @@ int sev_platform_shutdown(int *error); /** * sev_platform_status - perform SEV PLATFORM_STATUS command * - * @init: sev_data_status structure to be processed + * @status: sev_user_data_status structure to be processed * @error: SEV command return code * * Returns: