Message ID | 20180308124901.83533-20-brijesh.singh@amd.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org> 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 40745602C8 for <patchwork-qemu-devel@patchwork.kernel.org>; Thu, 8 Mar 2018 13:02:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 302501FFFF for <patchwork-qemu-devel@patchwork.kernel.org>; Thu, 8 Mar 2018 13:02:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 244D7209CC; Thu, 8 Mar 2018 13:02:53 +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 81E671FFFF for <patchwork-qemu-devel@patchwork.kernel.org>; Thu, 8 Mar 2018 13:02:52 +0000 (UTC) Received: from localhost ([::1]:38534 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org>) id 1etvC7-00008C-Nv for patchwork-qemu-devel@patchwork.kernel.org; Thu, 08 Mar 2018 08:02:51 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59045) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <brijesh.singh@amd.com>) id 1etv01-0005ak-Q2 for qemu-devel@nongnu.org; Thu, 08 Mar 2018 07:50:22 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <brijesh.singh@amd.com>) id 1etuzx-0004GJ-Lv for qemu-devel@nongnu.org; Thu, 08 Mar 2018 07:50:21 -0500 Received: from mail-cys01nam02on0053.outbound.protection.outlook.com ([104.47.37.53]:44877 helo=NAM02-CY1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from <brijesh.singh@amd.com>) id 1etuzx-0004EQ-8Y for qemu-devel@nongnu.org; Thu, 08 Mar 2018 07:50:17 -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=APtFSfmfQbRUvav+PgJ/V/oQLME46VKmdYbsWGac5Eg=; b=qPVFh1vaoNEXXqXf3BefU3Er4/KAd5YfoItZGKpbY3wKWKPhG/3kHIpGhA7e8KUM5x/SlFccg0mhE943YYFzRZXSDrZpUchwNxbFDl4RRg9iTU2IGCi8oBiXN+Fb70lh8DGV56ti2CBoiGERe2X+CBsVLBzGsS0VwqoGeVZFVDg= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=brijesh.singh@amd.com; Received: from wsp141597wss.amd.com (165.204.78.1) by DM2PR12MB0156.namprd12.prod.outlook.com (2a01:111:e400:50ce::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.548.13; Thu, 8 Mar 2018 12:50:10 +0000 From: Brijesh Singh <brijesh.singh@amd.com> To: qemu-devel@nongnu.org Date: Thu, 8 Mar 2018 06:48:52 -0600 Message-Id: <20180308124901.83533-20-brijesh.singh@amd.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180308124901.83533-1-brijesh.singh@amd.com> References: <20180308124901.83533-1-brijesh.singh@amd.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [165.204.78.1] X-ClientProxiedBy: BN6PR14CA0031.namprd14.prod.outlook.com (2603:10b6:404:13f::17) To DM2PR12MB0156.namprd12.prod.outlook.com (2a01:111:e400:50ce::19) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 15ea17c2-b2d0-4c38-fda5-08d584f321fb X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:DM2PR12MB0156; X-Microsoft-Exchange-Diagnostics: 1; DM2PR12MB0156; 3:ORfIyAfrh0z8cVDJlBqtcB5BnCvauDVCnx0192FkkXQ1ogrNVEBvigZP4rJ5VW8j8FkT8qJ+gmOv2yWy5FsRRmZxjtzXyJD+mocYBKOKnEvNCDd29h6GP0M6hPKOj+5cDJSAz3awWYp9kfVvwG23wc0tA8BHPW/yKBQ04N/wmi+TbuG6eJMMAyCGg2n1fB2J6O5UrZf/TmhGAaugva+zj3LfiT0YFrddE9je1De/1BE31ZZ6HZIt3JKPNo1YT1H/; 25:3hUaIbEk24OrBNw29b2KvKv4MK3B+YK3+hHicN8BpFnRcJfWHxPBsOldnClss3cCJGEpX2qv8naIN4hsi1VZrAifE3B+nNDAOw+/DsqMAZDUWLHGsPFI1uyK+5m+SCGJeVJM+bclIel/L1I8xe9mao2CcKMbEtwm8dGUCQtAwGVnW8/Hp81vXfSqBfBsakmB6NokScDXavJ9hHxRpYMFnpXqDfU915e+BrNVrHh3ZPcJskK1HYoT5OfWOiMSPlPat0fL8HP76ZopxFePhTwB7qhn8HQNQwKVRKiESU46vXXoo39k0nVp1Eml8mUOc4D1OtzHS9sFEEPn+8jNR8d61Q==; 31:Xfq6wtWIJe3XDxIYiR8t2tVcT0JCEwnHNB2DE/vY3b/FfWyKt8SSrBWE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1iWix+C2AB3/En7x X-Microsoft-Antispam-PRVS: <DM2PR12MB0156621B80571668F2C3CE03E5DF0@DM2PR12MB0156.namprd12.prod.outlook.com> X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040501)(2401047)(5005006)(8121501046)(93006095)(93001095)(10201501046)(3231220)(944501244)(52105095)(3002001)(6055026)(6041288)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123560045)(20161123558120)(20161123562045)(6072148)(201708071742011); SRVR:DM2PR12MB0156; BCL:0; PCL:0; RULEID:; SRVR:DM2PR12MB0156; X-Forefront-PRVS: 060503E79B X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(1496009)(39380400002)(39860400002)(376002)(396003)(346002)(366004)(199004)(189003)(50226002)(53936002)(2950100002)(6916009)(2906002)(2361001)(6666003)(2351001)(106356001)(81156014)(53416004)(8676002)(81166006)(7736002)(36756003)(305945005)(8936002)(105586002)(48376002)(50466002)(68736007)(97736004)(47776003)(66066001)(25786009)(4326008)(39060400002)(6486002)(7416002)(5660300001)(3846002)(478600001)(76176011)(51416003)(7696005)(52116002)(6116002)(16586007)(16526019)(186003)(26005)(1076002)(8656006)(386003)(54906003)(86362001)(316002)(59450400001)(8666007); DIR:OUT; SFP:1101; SCL:1; SRVR:DM2PR12MB0156; 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; DM2PR12MB0156; 23:4GxRtY1GURom7prm1L1xvqAHKPwFoIO9b8/ekPvqh?= =?us-ascii?Q?d7aWW019FVVqvksoJmhurpHai8JQjr/vK5e9wuH4gGu00USovKCmGu5089gx?= =?us-ascii?Q?1R3uyxtB5t83XlXdVKbOBApqVOD1b6QSvOyoGjz86N+v5Jy52aR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QuqHHi9XNHUHkpwDFre1bw5DP5wCBXPHezwMId4OIqsqyRj9IO7Exe2ZiaRC3F16p71sI1Jn7FphQwpC3g/K/szlUiDfI4=; 24:68YIjyr7ybVdKXf9JO1ArrnljKQQ2ObivuoFEfn8fK3AMCdgN6gr79zrIgeLD3EwoNt5lK1tX4NgnEXGMPONLaq7R6EaGndz3abO0EguU4A=; 7:jo9gZEhk2UmGZqicSIqwq7tuR/IZki5pmTAcKgyawbHmFndWKkTzjsTqhptk2VUJjeNCHPCvhw2b/GfmCiqvNPz93pR9WXCYSwNp1iuU0wed9OBFTua1vN6CfqvM19OFtz/XZA8GMscIDneSHv0l3UdUARKchUDwaznFt2/BdFX24NfdsScKI6JE/ycogt+7Aurh0vGfcDS9RCh1fTD7Q+ut6o4dTzTwrgHOAb69uhjTsj5IO0X8xLHqHHnbwF2R SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM2PR12MB0156; 20:hS7xRBsLSyUJEA+Fw6BQ+6uSAUx+LGQhdXUlyd18bvEUwjQgYjMFeA48ICtahXauHS6uuUhersIrm99UKe3u82Ky45RcxZo+cylokf2kv62XLPAvPBvyPwo5o9iylGzibGvjgCxiuHahbbfbvHHJWBQ1O9Z5to4vdGaBjswVHSJKiOgABDvLaa+2QJILLTf1DF5XnSbLqtMjknJN+YFGb8OwxpEElFbcjrRNcsPd9tFA6SaxISOEw7wXRVc4Ur5w X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Mar 2018 12:50:10.4406 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 15ea17c2-b2d0-4c38-fda5-08d584f321fb X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM2PR12MB0156 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.37.53 Subject: [Qemu-devel] [PATCH v12 19/28] sev/i386: finalize the SEV guest launch flow X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: <qemu-devel.nongnu.org> List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>, <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe> List-Archive: <http://lists.nongnu.org/archive/html/qemu-devel/> List-Post: <mailto:qemu-devel@nongnu.org> List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help> List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>, <mailto:qemu-devel-request@nongnu.org?subject=subscribe> Cc: Peter Maydell <peter.maydell@linaro.org>, Brijesh Singh <brijesh.singh@amd.com>, kvm@vger.kernel.org, "Michael S. Tsirkin" <mst@redhat.com>, Stefan Hajnoczi <stefanha@gmail.com>, Alexander Graf <agraf@suse.de>, "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>, Markus Armbruster <armbru@redhat.com>, Bruce Rogers <brogers@suse.com>, Christian Borntraeger <borntraeger@de.ibm.com>, Marcel Apfelbaum <marcel@redhat.com>, Borislav Petkov <bp@suse.de>, Thomas Lendacky <Thomas.Lendacky@amd.com>, Eduardo Habkost <ehabkost@redhat.com>, Richard Henderson <richard.henderson@linaro.org>, "Dr. David Alan Gilbert" <dgilbert@redhat.com>, Alistair Francis <alistair.francis@xilinx.com>, Cornelia Huck <cornelia.huck@de.ibm.com>, Richard Henderson <rth@twiddle.net>, Peter Crosthwaite <crosthwaite.peter@gmail.com>, Paolo Bonzini <pbonzini@redhat.com> Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" <qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org> X-Virus-Scanned: ClamAV using ClamSMTP |
diff --git a/target/i386/sev.c b/target/i386/sev.c index 7ad7eaf600a7..ce199d259f7a 100644 --- a/target/i386/sev.c +++ b/target/i386/sev.c @@ -578,6 +578,34 @@ static Notifier sev_machine_done_notify = { .notify = sev_launch_get_measure, }; +static void +sev_launch_finish(SEVState *s) +{ + int ret, error; + + trace_kvm_sev_launch_finish(); + ret = sev_ioctl(sev_state->sev_fd, KVM_SEV_LAUNCH_FINISH, 0, &error); + if (ret) { + error_report("%s: LAUNCH_FINISH ret=%d fw_error=%d '%s'", + __func__, ret, error, fw_error_to_str(error)); + exit(1); + } + + sev_set_guest_state(SEV_STATE_RUNNING); +} + +static void +sev_vm_state_change(void *opaque, int running, RunState state) +{ + SEVState *s = opaque; + + if (running) { + if (!sev_check_state(SEV_STATE_RUNNING)) { + sev_launch_finish(s); + } + } +} + void * sev_guest_init(const char *id) { @@ -656,6 +684,7 @@ sev_guest_init(const char *id) ram_block_notifier_add(&sev_ram_notifier); qemu_add_machine_init_done_notifier(&sev_machine_done_notify); + qemu_add_vm_change_state_handler(sev_vm_state_change, s); return s; err: diff --git a/target/i386/trace-events b/target/i386/trace-events index f7a1a1e6b85c..b1fbde6e40fe 100644 --- a/target/i386/trace-events +++ b/target/i386/trace-events @@ -14,3 +14,4 @@ kvm_sev_change_state(const char *old, const char *new) "%s -> %s" kvm_sev_launch_start(int policy, void *session, void *pdh) "policy 0x%x session %p pdh %p" kvm_sev_launch_update_data(void *addr, uint64_t len) "addr %p len 0x%" PRIu64 kvm_sev_launch_measurement(const char *value) "data %s" +kvm_sev_launch_finish(void) ""
SEV launch flow requires us to issue LAUNCH_FINISH command before guest is ready to run. Cc: Paolo Bonzini <pbonzini@redhat.com> Cc: Richard Henderson <rth@twiddle.net> Cc: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Brijesh Singh <brijesh.singh@amd.com> --- target/i386/sev.c | 29 +++++++++++++++++++++++++++++ target/i386/trace-events | 1 + 2 files changed, 30 insertions(+)