From patchwork Mon Jan 29 17:41:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brijesh Singh X-Patchwork-Id: 10190313 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 C75A560388 for ; Mon, 29 Jan 2018 17:59:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B73F128497 for ; Mon, 29 Jan 2018 17:59:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id ABE74284CE; Mon, 29 Jan 2018 17:59:34 +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.8 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 938C128497 for ; Mon, 29 Jan 2018 17:59:33 +0000 (UTC) Received: from localhost ([::1]:53783 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1egDiO-0003MT-Pk for patchwork-qemu-devel@patchwork.kernel.org; Mon, 29 Jan 2018 12:59:32 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49089) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1egDRZ-0005eb-Ks for qemu-devel@nongnu.org; Mon, 29 Jan 2018 12:42:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1egDRV-0003Tw-C5 for qemu-devel@nongnu.org; Mon, 29 Jan 2018 12:42:09 -0500 Received: from mail-dm3nam03on0050.outbound.protection.outlook.com ([104.47.41.50]:48256 helo=NAM03-DM3-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1egDRV-0003TB-4q for qemu-devel@nongnu.org; Mon, 29 Jan 2018 12:42:05 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=QXOqNbqENmNPaGH6RO85h6Whe5+SM4kNclCGQ2XRi08=; b=O0PaZWJtVGknMuGLLh+qV42oo4Imud6r1zFSSbI9tUdvjNXM3agtp/7lOqiFK6WBR3juLKq6vMDbJHyojFC7xySiUK1qAO4y1/XCoWaNUtc5yS6MUQhAb9p4Ir9riV0pmsdjZCf9rylMftGR9Y67f3XKoK3cMMuuEx3kdMdbZAc= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=brijesh.singh@amd.com; Received: from wsp141597wss.amd.com (165.204.78.1) by DM2PR12MB0154.namprd12.prod.outlook.com (2a01:111:e400:50ce::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.444.14; Mon, 29 Jan 2018 17:42:01 +0000 From: Brijesh Singh To: qemu-devel@nongnu.org Date: Mon, 29 Jan 2018 11:41:19 -0600 Message-Id: <20180129174132.108925-11-brijesh.singh@amd.com> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20180129174132.108925-1-brijesh.singh@amd.com> References: <20180129174132.108925-1-brijesh.singh@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.78.1] X-ClientProxiedBy: BN6PR17CA0018.namprd17.prod.outlook.com (2603:10b6:404:65::28) To DM2PR12MB0154.namprd12.prod.outlook.com (2a01:111:e400:50ce::17) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 8e6ad1f6-e0fc-4adc-afb1-08d5673f9b55 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(48565401081)(5600026)(4604075)(2017052603307)(7153060)(7193020); SRVR:DM2PR12MB0154; X-Microsoft-Exchange-Diagnostics: 1; DM2PR12MB0154; 3:at9naOXjAv3dgTAe++EPUpUO6hEjVhXExFxlkk3DmZzfMGrcPhzehaeOApWJYHjtUl4h3aBs7MAJQBNP2LRVMQiMatG/6/Cg9vucmdfuWQGxkJYJ1VIOCYfDrMvlI9SOWgtvJvNPUJRlmYC0k0YgTnwpEqkvnkGKXDDuNrLAxsE+ria1pOhZZjpzBbksiOpmryPDCyxvQe/zfK5kI2360chxA7MJE6uCdZBkLO2cLHHeCUWkwx2tILW2s6Fe3CIL; 25:OcGWYoRXCRgXgGWoVA906v+oyy1y2u6tcdQUhoFacPTISkNGbN3fS5SJ8w7mXJDBiJO1N/BhiRBLnasquvHzz7Pm0AbOZX6CPM58Z1qpZf5iSIUrNgHmEqaHS6ayWzK8XzyEdvpSQrQO8BoSZ+dt4dJx1WJQVxtmJ6PIYKXVcKR6kVmHzzNKiP7YKWQldcJhOSz1Q6FBI4gGL1XEhl+/Jqow0q0IiemJ2zL66fvDp12yrlzsddOrBYKJxuDyNgNC17bLqTw7oV0T1pSt73+63ObWtymLWewYXAJjyeXB4ueEAyFSEnnWPqhwRD8zbyV3gKl091eAggEcDV54Cs3aFQ==; 31:TQymoou5XgKxQi/PuWr/ZILgSsLU/ATdPfu+esqfGF9g9LGmjOawk2pH0NsjFbSggles9a5DKD0i8rCG/4NimYxN1hDk3WaiSqTdqTP633FcdIPTZO1EkS11Fri6a52dgklTUrsz5FVwwm9cey+X0pt2Jr1XtBaasSvzHggwvYvSEFevgfrpz96hffD4hs62G1uCwYMJ7IB0opPmmwOAXB91HpdoIY1kqAL63ijn2lw= X-MS-TrafficTypeDiagnostic: DM2PR12MB0154: X-Microsoft-Exchange-Diagnostics: 1; DM2PR12MB0154; 20:a1sTJIRRcLQnn/kXYQrXBVQtjbotGgitoPkoM4adQ21kmgnZ7GBh1Ta2aF7Iu3TEJh9+xMZY4oC16v61u6doDvbtKLm3UB6VJPL+7zpWKPKTWhSpKICbYsZ8UcUQkToRvKu7xcriMswwDXafGilET2JnOJtqCfyqPTjlaBZzr5uarEmHv7UZ7CVwu10EdQcXn5cnlcxOg0XsXStyadiw1Yc86wUpngV68ZWK9ZXx+3vdF9B20RYDekxQzHv1A1F+6yNPNjONZAn4vZVIaLpuCo1K7KJTnU55+LNmbppmtEcWePeh3HFmliGkE8mgXKx7LnpjKSrP6BzgHK0OkQsMH4Mg9ZpRMh0V9OyZF6fFPeAd3D3XE7KPnq+EazFfy/qeOmyZKU7xQU6lVGMzHIdKa0F8uIlYUFGL6pdAVUjOZc4txqPYNFxFHzwXK5xPKdh4Ra9sOSILUjc0hT96qD6kyqfrAVyy3QI7BRiiue8t1XSNvYGHDBDeXRgwAvhJnR1o; 4:tA+5LIn736Cd8p/t6BlJC5golUhFjG4oYZK1QxvDIs+y1GaUTWRUZVxPaF8jf6pdLiD60Qut9z7rTRcRK+rAL7oIo5h/uvpHhqpv1rSjmvmbjsC4cp4SdTr8o5bqzMmZgVW6wil01zbBxNA4kSBowDqxMHRJ6LxMHMAe1QCsxLgnAH053PtB4hOrDD6mND34KuBl6++D3Sq3HvnaU7eooVoblF5dUxhiEYJFPYiEJboArJeffLQu4iuOVWw2HbSzEMsaT3odHqKboLUbf/TQA3R3dYY/4SsZMMGxKABWnmmdnv42B1HWyfw4AczIGPa/ X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040501)(2401047)(8121501046)(5005006)(10201501046)(3231101)(944501161)(93006095)(93001095)(3002001)(6055026)(6041288)(20161123560045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123564045)(6072148)(201708071742011); SRVR:DM2PR12MB0154; BCL:0; PCL:0; RULEID:; SRVR:DM2PR12MB0154; X-Forefront-PRVS: 0567A15835 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39860400002)(376002)(39380400002)(396003)(366004)(346002)(199004)(189003)(48376002)(8656006)(39060400002)(4326008)(6486002)(68736007)(36756003)(478600001)(26005)(97736004)(16526019)(53936002)(386003)(50466002)(86362001)(575784001)(25786009)(8666007)(16586007)(54906003)(186003)(47776003)(59450400001)(316002)(7416002)(305945005)(7696005)(105586002)(106356001)(76176011)(51416003)(2906002)(81156014)(66066001)(81166006)(8676002)(2361001)(53416004)(3846002)(50226002)(52116002)(6116002)(2351001)(1076002)(8936002)(7736002)(6666003)(6916009)(5660300001)(2950100002); DIR:OUT; SFP:1101; SCL:1; SRVR:DM2PR12MB0154; H:wsp141597wss.amd.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM2PR12MB0154; 23:CUlvwpF6WCsM5+YdGn92PwhTrGccE++fYOfb4HLiu?= =?us-ascii?Q?NM53d+fpMDVe1ihliNk6jP/P4EYQ5Wf3kPEX/2yX4FSMWeFZareBYVW4caoA?= =?us-ascii?Q?WTkQMLzuyzI3VR29y5ZPvTjIzintgCbeXhvZJYSNZFa+3Oo3y69AZbGwH5XO?= =?us-ascii?Q?nIjFYPcfpujUGHnWnRMOXomeh18VnTqvwgzVNnpRpZx5haZOvYIx/3MWAyS4?= =?us-ascii?Q?1wnrr+i3WtWG3CGsm/v+f4Nuw5qmn3l0AqmPp2dgqTS+TYKFroYonfaKRiWx?= =?us-ascii?Q?qArCqTgFnju1Xz+1sQSNJNeavcg7wWCwyEVW3LOwe8ism4RgoMzmtghFUSAS?= =?us-ascii?Q?4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6XmYPBXkimqI SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM2PR12MB0154; 20:pHhkhD3ZUL1yO+qJMgzYupcXjjKBVo2kNee15aO/LI+9BFxRlztQ8ivpQV7FjhRZ3a8L/bThiTJGicJ2+Imykkw5QCT6fuEwp00ts9SdgnOBIgh537RccdhdBdQOC2pbe5KjA5weL7XgujKwOz2m71aot05Wsf+ky5wkSWbvk3Q6J03uUtKJY/RbJQiORCTO8CVOPHZmeh7cs6j9zl7XXHluZf2Ja5bVu3hK0/eZfVcTPIaKEHqE2xmMVQTbZsCf X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Jan 2018 17:42:01.6665 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8e6ad1f6-e0fc-4adc-afb1-08d5673f9b55 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM2PR12MB0154 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.41.50 Subject: [Qemu-devel] [PATCH v6 10/23] sev: add command to initialize the memory encryption context X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Edgar E. Iglesias" , Peter Maydell , Eduardo Habkost , kvm@vger.kernel.org, Tom Lendacky , Stefan Hajnoczi , "Michael S. Tsirkin" , Richard Henderson , "Dr. David Alan Gilbert" , Brijesh Singh , Paolo Bonzini Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP When memory encryption is enabled, KVM_SEV_INIT command is used to initialize the platform. The command loads the SEV related persistent data from non-volatile storage and initializes the platform context. This command should be first issued before invoking any other guest commands provided by the SEV firmware. Cc: Paolo Bonzini Signed-off-by: Brijesh Singh --- accel/kvm/kvm-all.c | 15 ++++++ accel/kvm/sev.c | 124 +++++++++++++++++++++++++++++++++++++++++++++++++ accel/kvm/trace-events | 2 + include/sysemu/sev.h | 10 ++++ 4 files changed, 151 insertions(+) diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c index f290f487a573..a9b16846675e 100644 --- a/accel/kvm/kvm-all.c +++ b/accel/kvm/kvm-all.c @@ -38,6 +38,7 @@ #include "qemu/event_notifier.h" #include "trace.h" #include "hw/irq.h" +#include "sysemu/sev.h" #include "hw/boards.h" @@ -103,6 +104,9 @@ struct KVMState #endif KVMMemoryListener memory_listener; QLIST_HEAD(, KVMParkedVcpu) kvm_parked_vcpus; + + /* memory encryption */ + void *memcrypt_handle; }; KVMState *kvm_state; @@ -1632,6 +1636,17 @@ static int kvm_init(MachineState *ms) kvm_state = s; + /* + * if memory encryption object is specified then initialize the memory + * encryption context. + * */ + if (ms->memory_encryption) { + kvm_state->memcrypt_handle = sev_guest_init(ms->memory_encryption); + if (!kvm_state->memcrypt_handle) { + goto err; + } + } + ret = kvm_arch_init(ms, s); if (ret < 0) { goto err; diff --git a/accel/kvm/sev.c b/accel/kvm/sev.c index e93fdfeb0c8f..be1791e510b3 100644 --- a/accel/kvm/sev.c +++ b/accel/kvm/sev.c @@ -18,10 +18,72 @@ #include "sysemu/kvm.h" #include "sysemu/sev.h" #include "sysemu/sysemu.h" +#include "trace.h" #define DEFAULT_GUEST_POLICY 0x1 /* disable debug */ #define DEFAULT_SEV_DEVICE "/dev/sev" +static int sev_fd; + +#define SEV_FW_MAX_ERROR 0x17 + +static char sev_fw_errlist[SEV_FW_MAX_ERROR][100] = { + "", + "Platform state is invalid", + "Guest state is invalid", + "Platform configuration is invalid", + "Buffer too small", + "Platform is already owned", + "Certificate is invalid", + "Policy is not allowed", + "Guest is not active", + "Invalid address", + "Bad signature", + "Bad measurement", + "Asid is already owned", + "Invalid ASID", + "WBINVD is required", + "DF_FLUSH is required", + "Guest handle is invalid", + "Invalid command", + "Guest is active", + "Hardware error", + "Hardware unsafe", + "Feature not supported", + "Invalid parameter" +}; + +static int +sev_ioctl(int cmd, void *data, int *error) +{ + int r; + struct kvm_sev_cmd input; + + memset(&input, 0x0, sizeof(input)); + + input.id = cmd; + input.sev_fd = sev_fd; + input.data = (__u64)data; + + r = kvm_vm_ioctl(kvm_state, KVM_MEMORY_ENCRYPT_OP, &input); + + if (error) { + *error = input.error; + } + + return r; +} + +static char * +fw_error_to_str(int code) +{ + if (code > SEV_FW_MAX_ERROR) { + return NULL; + } + + return sev_fw_errlist[code]; +} + static void qsev_guest_finalize(Object *obj) { @@ -170,6 +232,68 @@ static const TypeInfo qsev_guest_info = { } }; +static QSevGuestInfo * +lookup_sev_guest_info(const char *id) +{ + Object *obj; + QSevGuestInfo *info; + + obj = object_resolve_path_component(object_get_objects_root(), id); + if (!obj) { + return NULL; + } + + info = (QSevGuestInfo *) + object_dynamic_cast(obj, TYPE_QSEV_GUEST_INFO); + if (!info) { + return NULL; + } + + return info; +} + +void * +sev_guest_init(const char *id) +{ + SEVState *s; + char *devname; + int ret, fw_error; + + s = g_malloc0(sizeof(SEVState)); + if (!s) { + return NULL; + } + + s->sev_info = lookup_sev_guest_info(id); + if (!s->sev_info) { + error_report("%s: '%s' is not a valid '%s' object", + __func__, id, TYPE_QSEV_GUEST_INFO); + goto err; + } + + devname = object_property_get_str(OBJECT(s->sev_info), "sev-device", NULL); + sev_fd = open(devname, O_RDWR); + if (sev_fd < 0) { + error_report("%s: Failed to open %s '%s'", __func__, + devname, strerror(errno)); + goto err; + } + g_free(devname); + + trace_kvm_sev_init(); + ret = sev_ioctl(KVM_SEV_INIT, NULL, &fw_error); + if (ret) { + error_report("%s: failed to initialize ret=%d fw_error=%d '%s'", + __func__, ret, fw_error, fw_error_to_str(fw_error)); + goto err; + } + + return s; +err: + g_free(s); + return NULL; +} + static void sev_register_types(void) { diff --git a/accel/kvm/trace-events b/accel/kvm/trace-events index f89ba5578dc1..ea487e5a5913 100644 --- a/accel/kvm/trace-events +++ b/accel/kvm/trace-events @@ -13,3 +13,5 @@ kvm_irqchip_add_msi_route(char *name, int vector, int virq) "dev %s vector %d vi kvm_irqchip_update_msi_route(int virq) "Updating MSI route virq=%d" kvm_irqchip_release_virq(int virq) "virq %d" +# sev.c +kvm_sev_init(void) "" diff --git a/include/sysemu/sev.h b/include/sysemu/sev.h index d2621a9d1100..6aec25bc05e5 100644 --- a/include/sysemu/sev.h +++ b/include/sysemu/sev.h @@ -14,6 +14,8 @@ #ifndef QEMU_SEV_H #define QEMU_SEV_H +#include + #include "qom/object.h" #include "qapi/error.h" #include "sysemu/kvm.h" @@ -49,5 +51,13 @@ struct QSevGuestInfoClass { ObjectClass parent_class; }; +struct SEVState { + QSevGuestInfo *sev_info; +}; + +typedef struct SEVState SEVState; + +void *sev_guest_init(const char *id); + #endif