Message ID | 20171206200346.116537-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 1F70860327 for <patchwork-qemu-devel@patchwork.kernel.org>; Wed, 6 Dec 2017 20:32:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 103412A11C for <patchwork-qemu-devel@patchwork.kernel.org>; Wed, 6 Dec 2017 20:32:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 038812A11F; Wed, 6 Dec 2017 20:32: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 7F2522A11C for <patchwork-qemu-devel@patchwork.kernel.org>; Wed, 6 Dec 2017 20:32:33 +0000 (UTC) Received: from localhost ([::1]:57684 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 1eMgMq-0001XX-O2 for patchwork-qemu-devel@patchwork.kernel.org; Wed, 06 Dec 2017 15:32:32 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50083) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <brijesh.singh@amd.com>) id 1eMfwA-0006ZY-Vw for qemu-devel@nongnu.org; Wed, 06 Dec 2017 15:05:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <brijesh.singh@amd.com>) id 1eMfw7-0002p9-OP for qemu-devel@nongnu.org; Wed, 06 Dec 2017 15:04:58 -0500 Received: from mail-sn1nam01on0076.outbound.protection.outlook.com ([104.47.32.76]:59904 helo=NAM01-SN1-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 1eMfw7-0002os-HZ for qemu-devel@nongnu.org; Wed, 06 Dec 2017 15:04:55 -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=nkZtGwqEO8oO5Twon/Xz2ETQ9fPJUoaPNHz5i0s8cMg=; b=LuvBOGocKgbkqrqGqVjIZqkFD5PAYtBZ15993mL93o1JSkrF0CqnOpKVNzCvsLX1ho3nOFuAIZyYVnIdy/LCrPiCA8KnjhAun+AMdVrt6B3CjnZm0dk88JT+zumDG+Zova6DDzL4mzLEX7n/xYMOitUAX2wS1YoSpLxMec7UcoE= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=brijesh.singh@amd.com; Received: from wsp141597wss.amd.com (165.204.78.1) by SN1PR12MB0158.namprd12.prod.outlook.com (10.162.3.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.282.5; Wed, 6 Dec 2017 20:04:50 +0000 From: Brijesh Singh <brijesh.singh@amd.com> To: qemu-devel@nongnu.org Date: Wed, 6 Dec 2017 14:03:42 -0600 Message-Id: <20171206200346.116537-20-brijesh.singh@amd.com> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20171206200346.116537-1-brijesh.singh@amd.com> References: <20171206200346.116537-1-brijesh.singh@amd.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [165.204.78.1] X-ClientProxiedBy: BN6PR14CA0035.namprd14.prod.outlook.com (10.171.172.149) To SN1PR12MB0158.namprd12.prod.outlook.com (10.162.3.145) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: f87a0a53-7078-47ca-f031-08d53ce49cfb X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(48565401081)(5600026)(4604075)(2017052603286); SRVR:SN1PR12MB0158; X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0158; 3:lEbAXPInPVwxgsTPgolDkmUQEFCqAL0wlSbS6L4TzsdUEprVcJ/hGRte8q/jSYpU+vvPIOYTYbzezET4o3R+rOti45Wug9hQWaTqWIibbZlEy5E08+qKKawEsFIEdajbktVTZyZGXegQHVWHBQFT+M9fyER0B5kQpswqRw9P2mXqLhXyzSoQyW98wMK7Lg3+mmvW2I9kEYbV5Od4TDxKdPoqWMfs9mMDq12RjPdaAPRekFhJPS1avYfhFQ4931gb; 25:NhbPJKZEF8OaKw21RhL6OmoS1gvTD6fFZ2MJH7vUoVF6vtZG/Ftbg79MsYK3fxk30718LLsFd7ikpGpp5VzI+pu39XQfhs7NHPze5RxA9Hg0qAMCIQ/v5hIkUSlmI+4VeQbhblLqhIdj8C+F+eonC06getxStTSo9ip+5W+8kgWKnqtG/1/+6NtKV7fMAzLqssf7FMI8tfQS0jkzyeTwVmiCAuord7Mff+kOo31IcH67qDJFGcmz7g7llWjsbBWyPa8qq5PcH2gYCjfb2moMWAmB/EM+9kJDXovkyi/f6Y+IaXYZgE/0qDXvEjtdNPUryBk5+zO98FRVAI3XfvfUOg==; 31:PGnK42Z6GKr66CtalopionQn9ygOcBCXKt/WWmmyODEkMBhKgbti1YLs2iOJoBFxA4Vs5T7ZI03L6BtQ3oBYsVDdfeg5zEkXNyEBKiX0NAJlsFk2WklZau2+haJ1sC75nvuTazzphRekBinjw1MuO4jQde5L8KoDkV6sMCssMIaIxIU+BB1nAKeFn4RG+f6tuDw6LWWL6tV1Crm5XcNGnKbfy/a5HF2PHP34odFY5BU= X-MS-TrafficTypeDiagnostic: SN1PR12MB0158: X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0158; 20:rdoWRNNuRdX70/w0SiUe7+eoCrtWvfQsGbXqd/akPgDCmWRi19U7kIRrBYyqBkFxxdXmPmO6fsCwJlHvbCywRMh+vcEiU8qnB6206ewBl0EOCXRy1DuuVBF/CQV2MnFM7/MgHMH3TorLiGwRcXekIKrueJYCmFroUGktDV3N/1RPGXtTN8TvuN++OS8PvBLN9AYZKrA4U+CkIpfTdJ54QgbWquTXsb/gOtgn3CGfass7PjsyDWqUndOQSIolouChnYgLwQSveV6F4L/lSby2n2RVcqsMvB5wbzvs57CdryAwpPtqkL7/jghoKWbGQxE4e2fOKcGjwySFxAlyEpl+voWyE6/umX3K3DE8K/LgR1wQToem9WIxZBmm0GJL155eXko7gxB4LKJ7TKB3XzWLe2XPgt/d1dQICqqoSsOoYUBiIo3LVyyk/7pa6xERO6jk/GWm1GhKNTlYCI/osApnh/zG2FJnOjckm6LFE4CXrjL3LJfRCu9iVRLtDwcvRadC; 4:fJyXhq8df9AkoGr52BUxells/nwe/CkJV9YNj3ETOLWwnuBeryHpBZBkoZvQRcSd2OTJen/FMGHa/7P/JVZGY/vGiKMyAbQkRLc2lQw7r+qvKkhNcY19MsTcFs3gsCF8GAueukMo78a4WXmXt9g1bpb2pqvRZNl3R9kU+wOmxaqgFAdh0PUovoLqJclvQWyg9WRbOKajtqDWvnCIPlmZfkhEX2lVNAyFfGOUUiTJIsNC4FChUg/qco0vxvtseLMD5ywFOiidFmAmUEF2qB8w7jDxPFVhRnw26SCcAl/V8S1B64vAdvVRyfJJ8UuJH2tZfP/Jku+jfvqpWQbl2Y3nog== X-Microsoft-Antispam-PRVS: <SN1PR12MB01584444AF6B538FF798B313E5320@SN1PR12MB0158.namprd12.prod.outlook.com> X-Exchange-Antispam-Report-Test: UriScan:(9452136761055)(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(2401047)(8121501046)(5005006)(93006095)(93001095)(10201501046)(3002001)(3231022)(6055026)(6041248)(20161123555025)(20161123558100)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(20161123564025)(6072148)(201708071742011); SRVR:SN1PR12MB0158; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:SN1PR12MB0158; X-Forefront-PRVS: 05134F8B4F X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(376002)(39860400002)(346002)(366004)(199004)(189003)(16526018)(16586007)(33646002)(53416004)(105586002)(39060400002)(4326008)(305945005)(2351001)(106356001)(2361001)(7736002)(7696005)(86362001)(52116002)(8936002)(316002)(575784001)(53936002)(97736004)(76176011)(51416003)(36756003)(66066001)(1076002)(3846002)(25786009)(6116002)(47776003)(50226002)(68736007)(54906003)(6916009)(2950100002)(478600001)(6666003)(8666007)(5660300001)(8656006)(8676002)(101416001)(81156014)(81166006)(2906002)(7416002)(48376002)(6486002)(50466002); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR12MB0158; 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; SN1PR12MB0158; 23:h555VPRWlA1//NVni9nVjS2Nn7QNaXiV4tiDkI4ra?= =?us-ascii?Q?9CsbUuJiHWOhQO1zkbodxP05gymwIyzBdyd9RLJ2EUlfDuLgvMwBn+Sa6cW6?= =?us-ascii?Q?5Cj1oqkVhHcJ4ucHyl67onq/Q9YPnTkJGV7hq5oSN1qNTM6q7bFpFkZFqTwQ?= =?us-ascii?Q?OAznCm7otA4ZPM+Vw5RXSLtewHvs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yp3S3lLkZAGpHSpLtZcK3dqladTS0HId0a/1zX8CZZoKRWNvlVmSl8pygYZ8M+UYNjXAJKgLqSAxuyJMhYHu/fAiOipBRN3CxFqcXlC8u+5aiprUqLVzD3/qiUqiSsKPYrUI SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0158; 20:e3eUZhG3BPsmJQE0qBnL5MSyo4xkOwv2phUBExoPVQEI/hj4XWrF/Qp2Z56BtX+yBIjCUQjJH7C3D0qUEbyKnaKQiuBD7aacDn4mPQZpZtojB3j5MDjjyVRhBrHeIdJtUCFn6NXMN1z20jbw5mMAIx499VHNtBcmdsG2eeFOBNBQkEpd+Z62rKzOLBgI7qsYeS8qXmzWNMB+JjTVLdiWlH+yyia/IBSGd+DDtJQF/TixhtlBMI8Wo7Cz4kGKutWj X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Dec 2017 20:04:50.9416 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f87a0a53-7078-47ca-f031-08d53ce49cfb X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR12MB0158 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.32.76 Subject: [Qemu-devel] [PATCH v5 19/23] sev: 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: "Edgar E . Iglesias " <edgar.iglesias@xilinx.com>, Peter Maydell <peter.maydell@linaro.org>, Peter Crosthwaite <crosthwaite.peter@gmail.com>, Eduardo Habkost <ehabkost@redhat.com>, kvm@vger.kernel.org, Marcel Apfelbaum <marcel@redhat.com>, Markus Armbruster <armbru@redhat.com>, "Michael S. Tsirkin" <mst@redhat.com>, Richard Henderson <richard.henderson@linaro.org>, "Dr. David Alan Gilbert" <dgilbert@redhat.com>, Alistair Francis <alistair.francis@xilinx.com>, Christian Borntraeger <borntraeger@de.ibm.com>, Brijesh Singh <brijesh.singh@amd.com>, Stefan Hajnoczi <stefanha@gmail.com>, Cornelia Huck <cornelia.huck@de.ibm.com>, Paolo Bonzini <pbonzini@redhat.com>, Thomas Lendacky <Thomas.Lendacky@amd.com>, Borislav Petkov <bp@suse.de>, Richard Henderson <rth@twiddle.net> 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/accel/kvm/sev.c b/accel/kvm/sev.c index c0eea371fa06..fbbd99becc0a 100644 --- a/accel/kvm/sev.c +++ b/accel/kvm/sev.c @@ -454,6 +454,35 @@ static Notifier sev_machine_done_notify = { .notify = sev_launch_get_measure, }; +static void +sev_launch_finish(SEVState *s) +{ + int ret, error; + + ret = sev_ioctl(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); + } + + s->cur_state = SEV_STATE_RUNNING; + DPRINTF("SEV: LAUNCH_FINISH\n"); +} + +static void +sev_vm_state_change(void *opaque, int running, RunState state) +{ + SEVState *s = opaque; + + if (running) { + /* we are about to resume the guest, finalize the launch flow */ + if (s->cur_state == SEV_STATE_SECRET) { + sev_launch_finish(s); + } + } +} + void * sev_guest_init(const char *id) { @@ -497,6 +526,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); sev_state = s;
SEV launch flow requires us to issue LAUNCH_FINISH command before guest is ready to run. Cc: Paolo Bonzini <pbonzini@redhat.com> Cc: kvm@vger.kernel.org Signed-off-by: Brijesh Singh <brijesh.singh@amd.com> --- accel/kvm/sev.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+)