From patchwork Wed Feb 28 21:10:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Brijesh Singh X-Patchwork-Id: 10249817 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 B3BFA60212 for ; Wed, 28 Feb 2018 21:14:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A0C2B286F1 for ; Wed, 28 Feb 2018 21:14:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9546228DB3; Wed, 28 Feb 2018 21:14:31 +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=ham 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 014D4286F1 for ; Wed, 28 Feb 2018 21:14:31 +0000 (UTC) Received: from localhost ([::1]:46962 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1er93W-0004GU-4b for patchwork-qemu-devel@patchwork.kernel.org; Wed, 28 Feb 2018 16:14:30 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53141) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1er90G-0001GU-1D for qemu-devel@nongnu.org; Wed, 28 Feb 2018 16:11:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1er90B-0005gy-Ay for qemu-devel@nongnu.org; Wed, 28 Feb 2018 16:11:07 -0500 Received: from mail-dm3nam03on0040.outbound.protection.outlook.com ([104.47.41.40]:59821 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 1er90B-0005fB-1W for qemu-devel@nongnu.org; Wed, 28 Feb 2018 16:11:03 -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=B6gnT3uyVUyoZ27tLe09lmyBTnf5vpR95dAS54UHHP8=; b=WD6LgVJrKdG34diTJ8LDI1jK14aV/3lw7YpQx3QcZJVzOxPxxwW/pMRIhyneT1sqxoR5XFOFVeUyrnYd4fvtQiyky7jGtw8C7r+CSzgt3PbySRkdYHXcsMokpu37OQN8NWeG5K0I5R6Bh0SOcBJZqCpKnInbs0foLSXr6gECA2k= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=brijesh.singh@amd.com; Received: from wsp141597wss.amd.com (165.204.78.1) by DM2PR12MB0155.namprd12.prod.outlook.com (2a01:111:e400:50ce::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.527.15; Wed, 28 Feb 2018 21:10:59 +0000 From: Brijesh Singh To: qemu-devel@nongnu.org Date: Wed, 28 Feb 2018 15:10:09 -0600 Message-ID: <20180228211028.83970-10-brijesh.singh@amd.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180228211028.83970-1-brijesh.singh@amd.com> References: <20180228211028.83970-1-brijesh.singh@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.78.1] X-ClientProxiedBy: DM5PR10CA0008.namprd10.prod.outlook.com (2603:10b6:4:2::18) To DM2PR12MB0155.namprd12.prod.outlook.com (2a01:111:e400:50ce::18) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 3667bfcd-36f4-4d5c-6453-08d57eefc4d4 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(48565401081)(5600026)(4604075)(2017052603307)(7153060)(7193020); SRVR:DM2PR12MB0155; X-Microsoft-Exchange-Diagnostics: 1; DM2PR12MB0155; 3:BJi2pvb2vT2ZJpKB6G7qQ+TMEMtwxWrgzvh8X06KT7wVXd209/+4RqJMKhTFREKPIiU/aCfni9JUjX7QPX/hjYFZYHza4S3r//TS94BfuBk3cKd7INEmPCYBj8z3QAfnCTW1jGTohsW/vmj6BDhBD/2HtBjCBFQ0i9zebllaqT6I7BKJ7TxhSqrY34hyxw8kEaVP1zXZrtTWY8XnDaS64musfNriW5eyCp8+rhLCVMUdtUijAQxW7vyOo8oF/sib; 25:jPgbOyL76QVgDekEOBNeabv4R1dg/by9uJIFVpQtrzGET422eBhnkJiOC7g40QXBVJnMTdhChfL8hUOYk5RFKpXe5IjB091OcYV8+1ATG/wWwEh5IN7CJh3aXXrbHzuPht9OVWvJkQGdDzUig+7c9UL6OdDlYVzWAQfUZe2BL5qt5vnIzfJ2pyDrXFW34gufvpjXNM1AJjYBygiNuFC+HptafDAnmdduwp4+zNcj/u3ryfVgp/Y1zugwp1SZ56JjoN517jqqf+D54+4fN76shFVzSW0wfHd0BRok5T5ByxDASrfhA7ovSulK0nQBnkxbjlligmtfP4T67BSyFvYznw==; 31:o4SUMj8kUZtNLgkugAGX9dcsFcemFojaWcwxbJRJs/HCaCwPexrqS6CULkYJOQYIL80hHnN+B6Kx+pPfjGAZ9IY7r8LA/yClObM/l61gfhvbX60VoFbWXOTFeHtsKDc4b75YLO8WSTP4/QBWZ+CF59y2tRQXsYz4FuX9sdkOCDJew2egVfTCJ0Nk5sVdmU8Kby4d2zsO9YvW1wLvQ7sLctqsJPz9SJPk7b2BOvkqjlE= X-MS-TrafficTypeDiagnostic: DM2PR12MB0155: X-Microsoft-Exchange-Diagnostics: 1; DM2PR12MB0155; 20:cMfzyjtPRBduTPkoPM+N2WS/v/ZFTjFSUliutXHPhosydRXXgF3uwEzbj/xZI3JEmPHH+asOMDA0hf5dv3MqQhe5pP1FytovcTiB/MDXaSsjS2QErhNKLx7inAKNT2vfQATekHCI2Gjv+wVMIWz+G/s8SpkWIqAMPJxBgJD3D2h48Kk8af0tI46UTl6RbM8sIAfoxhIeU2XWhu8YCe/2GK3Rrh3LiCab8J+KfWNwciLgzmIpZnBG+EUnEOJafY8q/oEXk1TdMcoZAaqRzXSnfCwoZBrepSf3QtfNgu8YCaftV0EzvE6igcVc/fHEwUolfJQ8z85gpf19Zo/w4J0Ju46KWbdFZQ+PXwzABtHHP2yQMHFOtlCvgkrYFAoaLtaIrcd43lJh3av2uWGOFNLtRTW07tk4Tqn0Cc0BTLyFisDNr3Ifl3bm/vQuMSLXaiB3rIe0T4qewses8e5EJc/e09NDrcru9Cn1VNWsBhE7FM4yfM/0D8fX8CiJUQ3FnJbK; 4:uMGsiFs3QfDcKCoTkZyKSsfDgclhNxkQYAehadcsctkaYFgX9Tl9InknDiFA1J5B2KgMC+CjhlQhaY1gZxrEivJBA6zLBy5t6oic6NtdhrbmHW6z34VXOjN3HC4Xhz3222z2noJ5avlYssocfBPHMSkJOtWigBZqq+Y76FSlRZj1UIrrHHdAHhRIkqYXtBdjbiBeUW+olAmPKszRZNzEUwOithBUTJccF8brlxh6a9m+VG4qBOGhZjsMBd4i5YS0Bt2WrdRccrFLw2ijCu5Qa5G0xWTBxH9kDEulxnXeWIW1dkdgnolLCazkPc6ZRdp6 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040501)(2401047)(8121501046)(5005006)(3231220)(944501219)(52105095)(3002001)(93006095)(93001095)(10201501046)(6055026)(6041288)(20161123560045)(20161123564045)(20161123562045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:DM2PR12MB0155; BCL:0; PCL:0; RULEID:; SRVR:DM2PR12MB0155; X-Forefront-PRVS: 0597911EE1 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39860400002)(39380400002)(396003)(346002)(366004)(376002)(189003)(199004)(6486002)(6116002)(1076002)(2351001)(36756003)(16526019)(54906003)(53416004)(26005)(53936002)(66066001)(186003)(47776003)(59450400001)(2361001)(478600001)(8666007)(316002)(81166006)(50226002)(8676002)(8936002)(386003)(106356001)(2870700001)(97736004)(5660300001)(2950100002)(6666003)(23676004)(305945005)(4326008)(76176011)(7736002)(39060400002)(8656006)(105586002)(68736007)(50466002)(7696005)(25786009)(52116002)(3846002)(2906002)(86362001)(81156014)(7416002)(6916009); DIR:OUT; SFP:1101; SCL:1; SRVR:DM2PR12MB0155; H:wsp141597wss.amd.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A: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; DM2PR12MB0155; 23:ExVx8sFasYm4fCLk6Phmma6eLO2oSgQcT4lBXqfZf?= =?us-ascii?Q?ydXUBjQWZ4Ye10Qdnh7SDVMplo3akWxnU0DgMlYKj7SVjdrZOQD7nQXZR3dU?= =?us-ascii?Q?qImiVN6XKq+oj0sQOFxsyI/NEBgs88GwTZEK7RADuTTfQ1NX93Rj5MCEdeXX?= =?us-ascii?Q?RawWVbYquho//0dCiOE6OdzidYnwdkvtHCYm5gNEuuoCE+Re/XFL6VGb0RKM?= =?us-ascii?Q?4XMhUeYyD3/KLSBvvWwG1dCeifLhwTFgo6R6LjKqzIbdBvQV1OtS1/xkhI7M?= =?us-ascii?Q?V54Qo83Bhg2k/qef5fNN5rXWQ2m2Oic2WSjh5Jl3lsA+i1pT7zlWcB157PiI?= =?us-ascii?Q?MUIsZ1pEvOmCFTuepLY+tsCUmA4Cvw2PoB0nukjvsItsWoQQqENco4XyshFn?= =?us-ascii?Q?za+c/S2Hhz05drpPp5XftGyGk5/JaRekqjWUHt05z4iVBHk8l4fZLp22t/Sf?= =?us-ascii?Q?T+maBnkar/bXnW7phZSGQMvs9Tw2STa9AaHwqZ26GRbveytOUaKBBtnlpNw+?= =?us-ascii?Q?585b0i3topoHW+bDhf0XLUZANVjpF0asbkXWNqqmeAo0njYlfKZ4ght4ScEi?= =?us-ascii?Q?5zE8rNt5qmHZbpalvk/II/c3QTgx0OlXgctb6Jt0j/U+/3+I9Jn6y89pzeQb?= =?us-ascii?Q?in+r/fwLKf17ipJNGS94It3paj8oLo7Z5EFY5NCffgMd4EM82ozjb7CS/dEt?= =?us-ascii?Q?xDZLkCGs23SjZftzW7nN7HUSzhTB/3CdOJ11xf/tsZ3pquiIqRwM3VI2BYsx?= =?us-ascii?Q?4qljCpNPSDOiGsAT8raDQS+srher44mlFBJxNtiC86wXww+X3ag4b2LJDcoR?= =?us-ascii?Q?cR15V28EUVM31Ulz3eQWJJ47kqiq0qx+q2SSdUhEKtGpr13NWsVShF8GHglO?= =?us-ascii?Q?FekxmoTGm9h8hZR45WUFj0iBLw3erX+TSpKx8hr9A+G/voM6QI2BNAKt/uOH?= =?us-ascii?Q?/BXzYabutXa93mYTWHDZf/xWyyxznoCQ3UZpMwgY3Er9V1M+RL48ItoeJYnz?= =?us-ascii?Q?+sxGE39vHITULhhrJCL2J+q5paPuwMydSfC0HGwaUIvxPoxQUBXNeRZJdrqq?= =?us-ascii?Q?AChksjwA3/dVFP+k8ovwDeWshhtw30BiE0sGyQgKjePJwZJLvshJI5hVLJpR?= =?us-ascii?Q?fHCgZdJ7VrmIuE1fDHd90fJFTl0LkfIO5+QNdi44yIPyvRe3qSVSfL/6gmHU?= =?us-ascii?Q?3fQH7i6FJ7QVmN8MpRF7TFMdViaes3qU2CQVCkRhcdS1HoXIPdOoNbiV038I?= =?us-ascii?Q?AgK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l0AsMcSoQ3+4SZcQSrMlCvGldl0Ur8m8MRCd1SvF92T5a3i4d7qxhZ1XN3bhu3hrynU9hK/FewUDDrlmNxO/0hGeg42JAaJr/M95t3510VTWSIzkBORZXMXLdGtrRGWYwoNvvKeywhUa6SMpBU7Eqva6y0VqEinygA5fhCz/jaBwA0UefFFJeKjsO6KZJwFnLMJjmcTTXRebI7/vrDvqaqMnB+/t2ymScexP7UsBom74yn3gW7/8vQhC/ X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Feb 2018 21:10:59.9986 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3667bfcd-36f4-4d5c-6453-08d57eefc4d4 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM2PR12MB0155 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.41.40 Subject: [Qemu-devel] [PATCH v10 09/28] qmp: add query-sev command 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: Peter Maydell , Brijesh Singh , kvm@vger.kernel.org, "Michael S. Tsirkin" , Stefan Hajnoczi , Alexander Graf , "Edgar E. Iglesias" , Markus Armbruster , Bruce Rogers , Christian Borntraeger , Marcel Apfelbaum , Borislav Petkov , Thomas Lendacky , Eduardo Habkost , Richard Henderson , "Dr. David Alan Gilbert" , Alistair Francis , Cornelia Huck , Peter Crosthwaite , Paolo Bonzini Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP The QMP query command can used to retrieve the SEV information when memory encryption is enabled on AMD platform. Cc: Eric Blake Cc: "Daniel P. Berrangé" Cc: "Dr. David Alan Gilbert" Cc: Markus Armbruster Signed-off-by: Brijesh Singh Reviewed-by: Eric Blake --- monitor.c | 7 ++++++ qapi-schema.json | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++ target/i386/monitor.c | 8 +++++++ 3 files changed, 76 insertions(+) diff --git a/monitor.c b/monitor.c index d77edc4bb692..356d550aaf2d 100644 --- a/monitor.c +++ b/monitor.c @@ -983,6 +983,7 @@ static void qmp_unregister_commands_hack(void) #endif #ifndef TARGET_I386 qmp_unregister_command(&qmp_commands, "rtc-reset-reinjection"); + qmp_unregister_command(&qmp_commands, "query-sev"); #endif #ifndef TARGET_S390X qmp_unregister_command(&qmp_commands, "dump-skeys"); @@ -4157,6 +4158,12 @@ void qmp_rtc_reset_reinjection(Error **errp) { error_setg(errp, QERR_FEATURE_DISABLED, "rtc-reset-reinjection"); } + +SevInfo *qmp_query_sev(Error **errp) +{ + error_setg(errp, QERR_FEATURE_DISABLED, "query-sev"); + return NULL; +} #endif #ifndef TARGET_S390X diff --git a/qapi-schema.json b/qapi-schema.json index 0262b9f20bc6..467a06460ead 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -3189,3 +3189,64 @@ # Since: 2.11 ## { 'command': 'watchdog-set-action', 'data' : {'action': 'WatchdogAction'} } + +## +# @SevState: +# +# An enumeration of SEV state information used during @query-sev. +# +# Since: 2.12 +## +{ 'enum': 'SevState', + 'data': ['uninit', 'lupdate', 'lsecret', 'running', 'supdate', 'rupdate' ] } + +## +# @SevInfo: +# +# Information about Secure Encrypted Virtualization (SEV) support +# +# @enabled: true if SEV is active +# +# @api-major: SEV API major version +# +# @api-minor: SEV API minor version +# +# @build-id: SEV FW build id +# +# @policy: SEV policy value +# +# @state: SEV guest state +# +# @handle: SEV firmware handle +# +# Since: 2.12 +## +{ 'struct': 'SevInfo', + 'data': { 'enabled': 'bool', + 'api-major': 'uint8', + 'api-minor' : 'uint8', + 'build-id' : 'uint8', + 'policy' : 'uint32', + 'state' : 'SevState', + 'handle' : 'uint32' + } +} + +## +# @query-sev: +# +# Returns information about SEV +# +# Returns: @SevInfo +# +# Since: 2.12 +# +# Example: +# +# -> { "execute": "query-sev" } +# <- { "return": { "enabled": true, "api-major" : 0, "api-minor" : 0, +# "build-id" : 0, "policy" : 0, "state" : "running", +# "handle" : 1 } } +# +## +{ 'command': 'query-sev', 'returns': 'SevInfo' } diff --git a/target/i386/monitor.c b/target/i386/monitor.c index 55ea10deb8ef..f429b1fc5383 100644 --- a/target/i386/monitor.c +++ b/target/i386/monitor.c @@ -30,6 +30,8 @@ #include "hw/i386/pc.h" #include "sysemu/kvm.h" #include "hmp.h" +#include "sev_i386.h" +#include "qmp-commands.h" static void print_pte(Monitor *mon, CPUArchState *env, hwaddr addr, @@ -665,3 +667,9 @@ void hmp_info_io_apic(Monitor *mon, const QDict *qdict) ioapic_dump_state(mon, qdict); } } + +SevInfo *qmp_query_sev(Error **errp) +{ + error_setg(errp, "SEV feature is not available"); + return NULL; +}