From patchwork Sat Oct 2 12:52:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1535631 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=ep+GH9K8; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HM6SC6nrPz9sX3 for ; Sat, 2 Oct 2021 22:56:43 +1000 (AEST) Received: from localhost ([::1]:33150 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mWeZF-0004rh-O0 for incoming@patchwork.ozlabs.org; Sat, 02 Oct 2021 08:56:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33024) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mWeWA-0000XB-1Q for qemu-devel@nongnu.org; Sat, 02 Oct 2021 08:53:30 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:45505) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mWeW8-0000ZE-51 for qemu-devel@nongnu.org; Sat, 02 Oct 2021 08:53:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633179206; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=77XCyInhhDjafl0gvl8ONZ83GvKuNYK6mpZCL7SUumw=; b=ep+GH9K8FmZt02QS3Ybf3xdgx+qrha3NQCy9m5GOhjEL/QPgBewm71xRK9unD+H0fb3rkN vXq36OZIUau0HH26zkJaFkCjrkVpIkEdLhGJEDMjReiknCeyHbnuLZk7/ZhU0AobvFAO40 L9KwQTeLGFT/mNmmtQNnhYHkpzf6vsg= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-237-a-UGOi83MHWfFdRvt4Enbw-1; Sat, 02 Oct 2021 08:53:25 -0400 X-MC-Unique: a-UGOi83MHWfFdRvt4Enbw-1 Received: by mail-wm1-f72.google.com with SMTP id x3-20020a05600c21c300b0030d2b0fb3b4so4596844wmj.5 for ; Sat, 02 Oct 2021 05:53:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=77XCyInhhDjafl0gvl8ONZ83GvKuNYK6mpZCL7SUumw=; b=IUuraTF3WVy4pESJmByvgHbbd+CRhAYhGmTn/cC1zBdII5UzHaHaMITUfpAiB5N4ZH uMdTRzyRnA/b52yalJemShJL5phWsyuhUz6aEHlON0WtKR6mf17o2TYfa423JW2MA498 0FnOUwFMkOoXlRC6tXMNZDLomozqfBhXVvekGQGZyzDpq/y+54vX1sPEb5MKAsCHDSrY AIPsm+N9cqHpqgrbL7FXn/cNfYpqmZaqcVdhPhDIxI7f4H+wWIQfD1mUL1v6hQL2BFbE KfLNZJdJE+Rm14C9Wrb7mkIa3/JhV0CMz7z8xEfTt5ablxC6UALOLWju0py/CE9kXQ3F fA0Q== X-Gm-Message-State: AOAM530yTdphJH7AOf7bd/7kDgOJ57ig9sxyAEJR9O61rMIq5r0tSCl+ hnPExHiIinmyVZvdztZh+S3gBPhmSCRHr7RxNMjZV93Iquz1VVm/Lo4ShPlgaLb0qVaL9X1XAbc Yw3N4q5UJucS366OApkGtXEP5wBJQTVDf9OL5B8arlrCUoDW9s9oPetksckUACNn/ X-Received: by 2002:a1c:35c7:: with SMTP id c190mr9340548wma.57.1633179204218; Sat, 02 Oct 2021 05:53:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx1GirbsivBGcc75qonhC/tP/yFG+dbrQslj/ieJQDwUJOIb3YR9xlNe3qi6SdxOBKkUr/2Og== X-Received: by 2002:a1c:35c7:: with SMTP id c190mr9340526wma.57.1633179203922; Sat, 02 Oct 2021 05:53:23 -0700 (PDT) Received: from x1w.. (118.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.118]) by smtp.gmail.com with ESMTPSA id c7sm10953748wmq.13.2021.10.02.05.53.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Oct 2021 05:53:23 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v3 01/22] qapi/misc-target: Wrap long 'SEV Attestation Report' long lines Date: Sat, 2 Oct 2021 14:52:56 +0200 Message-Id: <20211002125317.3418648-2-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211002125317.3418648-1-philmd@redhat.com> References: <20211002125317.3418648-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Brijesh Singh , kvm@vger.kernel.org, Sergio Lopez , James Bottomley , "Dr . David Alan Gilbert" , Markus Armbruster , Dov Murik , "Daniel P . Berrange" , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Eduardo Habkost Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Wrap long lines before 70 characters for legibility. Suggested-by: Markus Armbruster Reviewed-by: Markus Armbruster Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Paolo Bonzini --- qapi/misc-target.json | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/qapi/misc-target.json b/qapi/misc-target.json index 594fbd1577f..ae5577e0390 100644 --- a/qapi/misc-target.json +++ b/qapi/misc-target.json @@ -300,8 +300,8 @@ ## # @SevAttestationReport: # -# The struct describes attestation report for a Secure Encrypted Virtualization -# feature. +# The struct describes attestation report for a Secure Encrypted +# Virtualization feature. # # @data: guest attestation report (base64 encoded) # @@ -315,10 +315,11 @@ ## # @query-sev-attestation-report: # -# This command is used to get the SEV attestation report, and is supported on AMD -# X86 platforms only. +# This command is used to get the SEV attestation report, and is +# supported on AMD X86 platforms only. # -# @mnonce: a random 16 bytes value encoded in base64 (it will be included in report) +# @mnonce: a random 16 bytes value encoded in base64 (it will be +# included in report) # # Returns: SevAttestationReport objects. # @@ -326,11 +327,13 @@ # # Example: # -# -> { "execute" : "query-sev-attestation-report", "arguments": { "mnonce": "aaaaaaa" } } +# -> { "execute" : "query-sev-attestation-report", +# "arguments": { "mnonce": "aaaaaaa" } } # <- { "return" : { "data": "aaaaaaaabbbddddd"} } # ## -{ 'command': 'query-sev-attestation-report', 'data': { 'mnonce': 'str' }, +{ 'command': 'query-sev-attestation-report', + 'data': { 'mnonce': 'str' }, 'returns': 'SevAttestationReport', 'if': 'TARGET_I386' } From patchwork Sat Oct 2 12:52:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1535635 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=GIsxXQil; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HM6ZV6f9vz9t0J for ; Sat, 2 Oct 2021 23:02:09 +1000 (AEST) Received: from localhost ([::1]:41724 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mWeeM-0002NA-8Y for incoming@patchwork.ozlabs.org; Sat, 02 Oct 2021 09:02:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33046) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mWeWH-0000kI-DX for qemu-devel@nongnu.org; Sat, 02 Oct 2021 08:53:37 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:57353) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mWeWD-0000bA-Ek for qemu-devel@nongnu.org; Sat, 02 Oct 2021 08:53:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633179212; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=uxFjxneImH8t+TNgA6RwI5GC/nMw3TKiWJEHDqKeLyw=; b=GIsxXQila3coD21BAwndch1qqhN/M0u+nhmt0O57/tu1WDWo5q1FLnWcoHiW124u5X/3ip EJvJgowgtrTnDNArxVBMetVuZzXodbE6TVqqcXFbuRxuzxtnWEOJfO26BujravVvVuGSij yYDx3KveYxw4LqSjdmi1i8NsgYCgSsw= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-457-imybw1HhMOqJ2RHwyHAmhg-1; Sat, 02 Oct 2021 08:53:30 -0400 X-MC-Unique: imybw1HhMOqJ2RHwyHAmhg-1 Received: by mail-wm1-f70.google.com with SMTP id 5-20020a1c00050000b02902e67111d9f0so6078728wma.4 for ; Sat, 02 Oct 2021 05:53:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=uxFjxneImH8t+TNgA6RwI5GC/nMw3TKiWJEHDqKeLyw=; b=QQsmLK3lim7fQuCqbtzw1jzf+JzJsyTSC+uUO3v07K8zjraj1HxVc1cbllC542fJ0t dY2ZzHcMj07qdYOors4+e/uF3dmKFPcAJQvoQr2KGMP4Qext0kXkivO7E9F5scPjFk89 dMkMi2R0su+pheaoKRmwzS1T3xVBngFkQQUYuoOlh6FRgDUj6aGczgslPuer72UAQNJ/ jfWxjqfWiw2Bjn2ijrKkdC/lgrY/3GrADSSblze5Nk326o/dzBf6Lty1N+3JiFH3kKnM u1Tpk8tRKBFvrVoNhrbQCY01ksoBTkeHUQozUtiP4LRqyuRsaDz209AmqjQ30ud9Q9v5 JRlQ== X-Gm-Message-State: AOAM532ck0qBvtUt9aOSEPGHeluafuM/7ylGcH+OhRSWptJHl80K5Hw0 pJJUqRMrtb50/jXhQek45JSaPy+rPyDRDutdRmf8/j5EtbkmMxK1g7KjDWvqL15meexYAU4kHhd szpubOE+p9oH4xF+++6JzitEdI32ZOwSJH6gNcBlStW4E0es8so76xfhfLOmIluFD X-Received: by 2002:a5d:6da9:: with SMTP id u9mr3290608wrs.58.1633179208669; Sat, 02 Oct 2021 05:53:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzDVSNYXZrFwgHN4o6mFCnb6T1FU6BIRdNia2pWh+N6e4sjnaGfMzRIY8qxl27Xi1WFkhgpNw== X-Received: by 2002:a5d:6da9:: with SMTP id u9mr3290585wrs.58.1633179208431; Sat, 02 Oct 2021 05:53:28 -0700 (PDT) Received: from x1w.. (118.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.118]) by smtp.gmail.com with ESMTPSA id 61sm8574908wrl.94.2021.10.02.05.53.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Oct 2021 05:53:28 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v3 02/22] qapi/misc-target: Group SEV QAPI definitions Date: Sat, 2 Oct 2021 14:52:57 +0200 Message-Id: <20211002125317.3418648-3-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211002125317.3418648-1-philmd@redhat.com> References: <20211002125317.3418648-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Brijesh Singh , kvm@vger.kernel.org, Sergio Lopez , James Bottomley , "Dr . David Alan Gilbert" , Dov Murik , "Daniel P . Berrange" , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Eduardo Habkost Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" There is already a section with various SEV commands / types, so move the SEV guest attestation together. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Paolo Bonzini --- qapi/misc-target.json | 80 +++++++++++++++++++++---------------------- 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/qapi/misc-target.json b/qapi/misc-target.json index ae5577e0390..5aa2b95b7d4 100644 --- a/qapi/misc-target.json +++ b/qapi/misc-target.json @@ -229,6 +229,46 @@ 'data': { 'packet-header': 'str', 'secret': 'str', '*gpa': 'uint64' }, 'if': 'TARGET_I386' } +## +# @SevAttestationReport: +# +# The struct describes attestation report for a Secure Encrypted +# Virtualization feature. +# +# @data: guest attestation report (base64 encoded) +# +# +# Since: 6.1 +## +{ 'struct': 'SevAttestationReport', + 'data': { 'data': 'str'}, + 'if': 'TARGET_I386' } + +## +# @query-sev-attestation-report: +# +# This command is used to get the SEV attestation report, and is +# supported on AMD X86 platforms only. +# +# @mnonce: a random 16 bytes value encoded in base64 (it will be +# included in report) +# +# Returns: SevAttestationReport objects. +# +# Since: 6.1 +# +# Example: +# +# -> { "execute" : "query-sev-attestation-report", +# "arguments": { "mnonce": "aaaaaaa" } } +# <- { "return" : { "data": "aaaaaaaabbbddddd"} } +# +## +{ 'command': 'query-sev-attestation-report', + 'data': { 'mnonce': 'str' }, + 'returns': 'SevAttestationReport', + 'if': 'TARGET_I386' } + ## # @dump-skeys: # @@ -297,46 +337,6 @@ 'if': 'TARGET_ARM' } -## -# @SevAttestationReport: -# -# The struct describes attestation report for a Secure Encrypted -# Virtualization feature. -# -# @data: guest attestation report (base64 encoded) -# -# -# Since: 6.1 -## -{ 'struct': 'SevAttestationReport', - 'data': { 'data': 'str'}, - 'if': 'TARGET_I386' } - -## -# @query-sev-attestation-report: -# -# This command is used to get the SEV attestation report, and is -# supported on AMD X86 platforms only. -# -# @mnonce: a random 16 bytes value encoded in base64 (it will be -# included in report) -# -# Returns: SevAttestationReport objects. -# -# Since: 6.1 -# -# Example: -# -# -> { "execute" : "query-sev-attestation-report", -# "arguments": { "mnonce": "aaaaaaa" } } -# <- { "return" : { "data": "aaaaaaaabbbddddd"} } -# -## -{ 'command': 'query-sev-attestation-report', - 'data': { 'mnonce': 'str' }, - 'returns': 'SevAttestationReport', - 'if': 'TARGET_I386' } - ## # @SGXInfo: # From patchwork Sat Oct 2 12:52:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1535632 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=I/8Xp4e2; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HM6Tk1ss4z9t0J for ; Sat, 2 Oct 2021 22:58:02 +1000 (AEST) Received: from localhost ([::1]:35394 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mWeaW-0006LB-27 for incoming@patchwork.ozlabs.org; Sat, 02 Oct 2021 08:58:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33058) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mWeWL-0000nh-1C for qemu-devel@nongnu.org; Sat, 02 Oct 2021 08:53:41 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:60458) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mWeWF-0000bj-U4 for qemu-devel@nongnu.org; Sat, 02 Oct 2021 08:53:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633179215; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=g4CQJdzlwnG2lhh6cD8LFOTW/FEZbmRSxqmO9AK0wf0=; b=I/8Xp4e2E+WL79W0XSEGvCPifPK2bhUerJaAixHYDFZv4YtEtGwgifBZfuqgqJArFiN9uv 5gGYpeRpnDETEKJ+MTpICjYpUmp96vczUjcQTJjIldTeuBS8fsqQRyvn/I138ozLwAa/qg GZ0H3LpZNUz3uE+bPo0Ayf3AbKAJxNM= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-221-I_kytIYQO82RzGiTfR4QbQ-1; Sat, 02 Oct 2021 08:53:34 -0400 X-MC-Unique: I_kytIYQO82RzGiTfR4QbQ-1 Received: by mail-wr1-f72.google.com with SMTP id e12-20020a056000178c00b001606927de88so3497210wrg.10 for ; Sat, 02 Oct 2021 05:53:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=g4CQJdzlwnG2lhh6cD8LFOTW/FEZbmRSxqmO9AK0wf0=; b=QIgtw185XQIXS74KdB5Enbz3jgRPQ+LMLPa2/JUKnjL5t6AZoDCZD1cThCBTq/fxmY TdLElt5YVHaFoYcCVn5Q4JWBtHUA6MDrk48dyaNFBtdnR1uReCaZttmmzKfCAKi+UWr+ 8R/9xjEhEYVhMhzY//38KY3HJONcf734XCFbXz4niSQxWoACAZtHJzk2JyIKlD75PTor YqmBdZhsnjr7n1eZ1u5MhjOVcKFgzpbYyVMBapAeX+Uzm8EQ6jTzZ5ffkZdmPCDbv8Wc oTRM62z0hS8JE4UGLQtzfVHR72GVbT0wO9oN22rUo/bwBOj5yE/8cTtgvYNHr2vUtgsT YgRA== X-Gm-Message-State: AOAM533VQ261Xx27AA/rfFb0ewTh0vt2lSlDsXZ/dvlYnTPGaP2eaTlT DfIOEY9WKBWZPdbZljqWahjFkZLfrkRwLQzt1TxE4bs9+QL5Zejc6lSz922TvJUVpRceahyhIW1 E4Azc9l61AOMLkG1Qt5wi8VAHX/UFHWPgK6H9XFr43PXVg6hEeO1AJAQROKRjlkNc X-Received: by 2002:a05:600c:240a:: with SMTP id 10mr9368895wmp.170.1633179213210; Sat, 02 Oct 2021 05:53:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwVukirZxFLCnS0tPkLQb551+kxcHjcGyPtCd0pzUdBEUoIeuKLgKAGClPI+IvXqQdALVy20Q== X-Received: by 2002:a05:600c:240a:: with SMTP id 10mr9368862wmp.170.1633179212853; Sat, 02 Oct 2021 05:53:32 -0700 (PDT) Received: from x1w.. (118.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.118]) by smtp.gmail.com with ESMTPSA id n17sm8399735wrp.17.2021.10.02.05.53.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Oct 2021 05:53:32 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v3 03/22] target/i386/kvm: Introduce i386_softmmu_kvm Meson source set Date: Sat, 2 Oct 2021 14:52:58 +0200 Message-Id: <20211002125317.3418648-4-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211002125317.3418648-1-philmd@redhat.com> References: <20211002125317.3418648-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Brijesh Singh , kvm@vger.kernel.org, Sergio Lopez , James Bottomley , "Dr . David Alan Gilbert" , Dov Murik , "Daniel P . Berrange" , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Eduardo Habkost Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Introduce the i386_softmmu_kvm Meson source set to be able to add features dependent on CONFIG_KVM. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Paolo Bonzini --- target/i386/kvm/meson.build | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/target/i386/kvm/meson.build b/target/i386/kvm/meson.build index 0a533411cab..b1c76957c76 100644 --- a/target/i386/kvm/meson.build +++ b/target/i386/kvm/meson.build @@ -1,8 +1,12 @@ i386_ss.add(when: 'CONFIG_KVM', if_false: files('kvm-stub.c')) -i386_softmmu_ss.add(when: 'CONFIG_KVM', if_true: files( +i386_softmmu_kvm_ss = ss.source_set() + +i386_softmmu_kvm_ss.add(files( 'kvm.c', 'kvm-cpu.c', )) i386_softmmu_ss.add(when: 'CONFIG_HYPERV', if_true: files('hyperv.c'), if_false: files('hyperv-stub.c')) + +i386_softmmu_ss.add_all(when: 'CONFIG_KVM', if_true: i386_softmmu_kvm_ss) From patchwork Sat Oct 2 12:52:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1535638 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=GZdx9slG; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HM6gB2gLvz9t0J for ; Sat, 2 Oct 2021 23:06:14 +1000 (AEST) Received: from localhost ([::1]:50302 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mWeiR-0008Id-TK for incoming@patchwork.ozlabs.org; Sat, 02 Oct 2021 09:06:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33068) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mWeWM-0000oS-Ab for qemu-devel@nongnu.org; Sat, 02 Oct 2021 08:53:42 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:48611) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mWeWK-0000cT-R0 for qemu-devel@nongnu.org; Sat, 02 Oct 2021 08:53:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633179219; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZlL6otvRUOhsGg4LexEjqPgBur9Sbw4O6pWOtqIiK2E=; b=GZdx9slGGrzOtU9ZPOPmAIm7BlEZi22L3Kj/0gw2xDL3iTkk2WbAEqFk+qTX5o4zko35ta hmjW4b5KIUkpQlqXMdfqaPphlL7bnURMg9GH43Cdpb7oOLXEEOVtHB2vQphzPK6Zb4l6R+ dwFw8DSMzMjSK7Wnz8J+rIsT7jAkYQM= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-196-0qlgN0ApOaWsxcRphZUuMw-1; Sat, 02 Oct 2021 08:53:38 -0400 X-MC-Unique: 0qlgN0ApOaWsxcRphZUuMw-1 Received: by mail-wm1-f69.google.com with SMTP id y142-20020a1c7d94000000b0030cdc76dedeso7348199wmc.5 for ; Sat, 02 Oct 2021 05:53:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ZlL6otvRUOhsGg4LexEjqPgBur9Sbw4O6pWOtqIiK2E=; b=G/dZh3dsOUV8UvmspmTbsXiiQ18tc45Prft6GPcfh6EDeOwalW4Q1km4dsT5E0fZPE Gp+7ribuIf9HAAjLt7tPQNBfubUNEIinN5sWZN8QX/ESphZlg8bdQXbU+N99iVOFtaiO cZqGeTJ9h9g3C9DY7//N8kyT8NBekSj4pfzQyUQHLHcebtkKaFAj21+P91DJa8CiDfW+ zxB8GqikKvVTygfwSsxH4RrtfBH28Rv8jw5jsC5NwZIrompzpCfLUYFJB+2rllgtb9Sx CB/MhQGfLh7WKSx43jCprLXlQHVbtSr2v/r/3nsDsim5C3uq5Um04kqDD+DgJ2Wm42F7 WT+Q== X-Gm-Message-State: AOAM533r0tGE4pV0kbouWt6OXm/1rL+tV+1ggfK8IkgVy7K6BTJdUJtb GmV1a0mE9RjJAe6v3MzdC7ziOGexuLJbzxKF8SDpqaCseN1+n8tBTEHg/WNN2c7KUZE03avGM0W GE9b5A2LNf55rR+ZlV74prIlpefq2zFTtW5OoXJFjk0kcAlaJ9TWhWbvE8iDwAi3j X-Received: by 2002:adf:ea45:: with SMTP id j5mr3279499wrn.291.1633179217582; Sat, 02 Oct 2021 05:53:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyvngRg6mSfZAPhLoI1z88TfL+DRAdtPTmC0GBIdj7S99yXfNxRBj9wMpPO15fh3FpbNOAwJw== X-Received: by 2002:adf:ea45:: with SMTP id j5mr3279481wrn.291.1633179217363; Sat, 02 Oct 2021 05:53:37 -0700 (PDT) Received: from x1w.. (118.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.118]) by smtp.gmail.com with ESMTPSA id b15sm10237676wru.9.2021.10.02.05.53.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Oct 2021 05:53:37 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v3 04/22] target/i386/kvm: Restrict SEV stubs to x86 architecture Date: Sat, 2 Oct 2021 14:52:59 +0200 Message-Id: <20211002125317.3418648-5-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211002125317.3418648-1-philmd@redhat.com> References: <20211002125317.3418648-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=170.10.133.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Brijesh Singh , kvm@vger.kernel.org, Sergio Lopez , James Bottomley , "Dr . David Alan Gilbert" , Dov Murik , "Daniel P . Berrange" , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Eduardo Habkost Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" SEV is x86-specific, no need to add its stub to other architectures. Move the stub file to target/i386/kvm/. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Paolo Bonzini --- {accel => target/i386}/kvm/sev-stub.c | 0 accel/kvm/meson.build | 1 - target/i386/kvm/meson.build | 2 ++ 3 files changed, 2 insertions(+), 1 deletion(-) rename {accel => target/i386}/kvm/sev-stub.c (100%) diff --git a/accel/kvm/sev-stub.c b/target/i386/kvm/sev-stub.c similarity index 100% rename from accel/kvm/sev-stub.c rename to target/i386/kvm/sev-stub.c diff --git a/accel/kvm/meson.build b/accel/kvm/meson.build index 8d219bea507..397a1fe1fd1 100644 --- a/accel/kvm/meson.build +++ b/accel/kvm/meson.build @@ -3,6 +3,5 @@ 'kvm-all.c', 'kvm-accel-ops.c', )) -kvm_ss.add(when: 'CONFIG_SEV', if_false: files('sev-stub.c')) specific_ss.add_all(when: 'CONFIG_KVM', if_true: kvm_ss) diff --git a/target/i386/kvm/meson.build b/target/i386/kvm/meson.build index b1c76957c76..736df8b72e3 100644 --- a/target/i386/kvm/meson.build +++ b/target/i386/kvm/meson.build @@ -7,6 +7,8 @@ 'kvm-cpu.c', )) +i386_softmmu_kvm_ss.add(when: 'CONFIG_SEV', if_false: files('sev-stub.c')) + i386_softmmu_ss.add(when: 'CONFIG_HYPERV', if_true: files('hyperv.c'), if_false: files('hyperv-stub.c')) i386_softmmu_ss.add_all(when: 'CONFIG_KVM', if_true: i386_softmmu_kvm_ss) From patchwork Sat Oct 2 12:53:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1535629 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=a3wrPNUs; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HM6Q74mvsz9sX3 for ; Sat, 2 Oct 2021 22:54:55 +1000 (AEST) Received: from localhost ([::1]:55650 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mWeXV-0000tR-Eu for incoming@patchwork.ozlabs.org; Sat, 02 Oct 2021 08:54:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33086) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mWeWQ-0000pl-Gb for qemu-devel@nongnu.org; Sat, 02 Oct 2021 08:53:46 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:45039) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mWeWP-0000eB-0N for qemu-devel@nongnu.org; Sat, 02 Oct 2021 08:53:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633179224; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=l2pfbYxP1f86zn1O+UmnIVR/OdXuADklhW48W/+4agE=; b=a3wrPNUsBVuFSd39Ry5BR29l1bW+jcDy5QBt08URukX0JGgIkzXeWJrWzxncBvMAbMCQNK nNx5S92KP1jCFXOCFsHEIrFWTGRXNiKjWOV1bRGXsa/x+AGEOqI0g7wAUIc2/iZF27Rx8v 5HPsJCE+J5IVaEI3zdZwixgEnjmT8pU= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-197-LI-aGiA4MamwNBeYTy0WZg-1; Sat, 02 Oct 2021 08:53:43 -0400 X-MC-Unique: LI-aGiA4MamwNBeYTy0WZg-1 Received: by mail-wm1-f69.google.com with SMTP id 10-20020a05600c240a00b0030d403f24e2so3204588wmp.9 for ; Sat, 02 Oct 2021 05:53:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=l2pfbYxP1f86zn1O+UmnIVR/OdXuADklhW48W/+4agE=; b=qFnyfu5o5Of9xVEXWPNi7EywkXBsmGm8VwyvAzOo67Ckr0/SsMQZL8cZVn6q5RdO1x +gt4/D78jnfSbYqM8XFxaWwPPFBbVIFFYMyfH6/a64AmQlZOjM8DdE4XrxFRAYmyrDJX mSNGXROXZzwtZssA1SYWTL+l7pJcEwbvkV0yGSJvYjnYr85yvxAvTMj3RUvIJ2l3IX+h OHv/FKiF5/ebrfZAtfMnpCoR/kS3jybjnKkJHtWwWViRoIRnTOrPyW1VrDhHMsNb5b+z S5wcbH4LmOblAblXoPp8F5sJUS8iezHWZunX351a5x/ZlBuAe7lDXsjMPJFE+s9xmi4p wuUQ== X-Gm-Message-State: AOAM533jMHUlRg9Lo4WMZ+6/0AV25FPhS1cBg7JINvzbhv+o9mss5GOJ peScsUqTnTZbb8wpb5qtIiluXzDUpDqZB1vwP5iagPjKB/n63Z8S9uj2WtZkT/65kdzHeJv2DeY lr5hLKcFYW3mJZron0hJEf/CrXaNmLlNSgQiC62pR+GtLENrKq/0kmNfzSrQ5gq4M X-Received: by 2002:adf:b19b:: with SMTP id q27mr3023141wra.125.1633179222070; Sat, 02 Oct 2021 05:53:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy0wFJ6jOD1dsu7MobrHxWDwOimiCMUGE3Wc9F0Vh2YBeD1QDrYkdFU3s2oEYQ/eTvQ2tlbQw== X-Received: by 2002:adf:b19b:: with SMTP id q27mr3023109wra.125.1633179221880; Sat, 02 Oct 2021 05:53:41 -0700 (PDT) Received: from x1w.. (118.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.118]) by smtp.gmail.com with ESMTPSA id l21sm1643231wmg.18.2021.10.02.05.53.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Oct 2021 05:53:41 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v3 05/22] target/i386/monitor: Return QMP error when SEV is disabled in build Date: Sat, 2 Oct 2021 14:53:00 +0200 Message-Id: <20211002125317.3418648-6-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211002125317.3418648-1-philmd@redhat.com> References: <20211002125317.3418648-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Brijesh Singh , kvm@vger.kernel.org, Sergio Lopez , Connor Kuehl , James Bottomley , "Dr . David Alan Gilbert" , Dov Murik , "Daniel P . Berrange" , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Eduardo Habkost Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" If the management layer tries to inject a secret, it gets an empty response in case the binary built without SEV: { "execute": "sev-inject-launch-secret", "arguments": { "packet-header": "mypkt", "secret": "mypass", "gpa": 4294959104 } } { "return": { } } Make it clearer by returning an error, mentioning the feature is disabled: { "execute": "sev-inject-launch-secret", "arguments": { "packet-header": "mypkt", "secret": "mypass", "gpa": 4294959104 } } { "error": { "class": "GenericError", "desc": "this feature or command is not currently supported" } } Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Connor Kuehl Signed-off-by: Philippe Mathieu-Daudé --- target/i386/monitor.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/target/i386/monitor.c b/target/i386/monitor.c index 196c1c9e77f..a9f85acd473 100644 --- a/target/i386/monitor.c +++ b/target/i386/monitor.c @@ -28,6 +28,7 @@ #include "monitor/hmp-target.h" #include "monitor/hmp.h" #include "qapi/qmp/qdict.h" +#include "qapi/qmp/qerror.h" #include "sysemu/kvm.h" #include "sysemu/sev.h" #include "qapi/error.h" @@ -743,6 +744,10 @@ void qmp_sev_inject_launch_secret(const char *packet_hdr, bool has_gpa, uint64_t gpa, Error **errp) { + if (!sev_enabled()) { + error_setg(errp, QERR_UNSUPPORTED); + return; + } if (!has_gpa) { uint8_t *data; struct sev_secret_area *area; From patchwork Sat Oct 2 12:53:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1535641 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=IOcMGwkJ; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HM6jW3kPyz9t0J for ; Sat, 2 Oct 2021 23:08:14 +1000 (AEST) Received: from localhost ([::1]:58382 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mWekM-0005JE-QX for incoming@patchwork.ozlabs.org; Sat, 02 Oct 2021 09:08:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33120) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mWeWW-0000tc-MZ for qemu-devel@nongnu.org; Sat, 02 Oct 2021 08:53:54 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:30005) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mWeWV-0000gG-BC for qemu-devel@nongnu.org; Sat, 02 Oct 2021 08:53:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633179230; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=T1NIBoSE4LuxR67pjfbeheswmOYBoIBhIFI0FnH33UA=; b=IOcMGwkJaSie4BtFLBt0Z/Xorv3SZb4wZPHhI2EMIWEbAzDO8J48K1EoBIXy9peerEPMny sUaDd1KxPY8DXnkOo0Oc21Blr2537jvtvCpIV4tPBPlQH6KqPkAQnCF/jZUW+r7ALnRHxx fNU35CuymihCxT3FUTds8HBgKOTiQus= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-262-J3rk7O8aPQOfOGVv1YFSbA-1; Sat, 02 Oct 2021 08:53:49 -0400 X-MC-Unique: J3rk7O8aPQOfOGVv1YFSbA-1 Received: by mail-wr1-f69.google.com with SMTP id c2-20020adfa302000000b0015e4260febdso3488903wrb.20 for ; Sat, 02 Oct 2021 05:53:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=T1NIBoSE4LuxR67pjfbeheswmOYBoIBhIFI0FnH33UA=; b=gnx8Y70v/kOtLpe3o/wrj5lxgEOc0kZ5pUvOCQl25W1hHo8bpM8tcdIkRasNkFMngS 3eRJ3tOT0Mr3DwHGA8KZIKLTa4Wtd5FgYmJhs7SgFRupAjq4c30QdiBfY3BX5IHvFoQ2 k/JxDtzKmXwcdy6ssPzBejXdVhZZAuXv7xZM3sg/BbbxGT2+TqJNnHDd+CXqrRac1b1f wjK8pdRtCnjB3B3cfEcjXcLeNM914kVF8KaeWhkdaj19CEOUOSaGQTRhNFXrNxb2fqLA LhjdOWpvSp5GFUTMcdmIS8at+eDQuuCuzki9lWe/D+Lt1LN+tJjjJEJyCeWyJbHl58zP +cMQ== X-Gm-Message-State: AOAM530eso2SolZiLEbI+EA8uZNA+cIZfOQPFrJfkCVDMycKtPc+5qtg h5MkkMDCS3pHCoE6bQ0/cRwu16E6BmGJKOdihT40xQfu7oekbZ9z0ZeJ8vVbcUTDGHreCqPoyAJ Xvq7MKZqpzFi+rx1P04N4IFDUZFLAoGzrddB6J3FDhSxxFGsE5dJskzTYNxt5dxgQ X-Received: by 2002:a05:6000:c3:: with SMTP id q3mr3272640wrx.361.1633179226541; Sat, 02 Oct 2021 05:53:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxSb9fTK6/UuOYq5MO4Gn39GE9tLudrOZsgwLInKNkYdtRvDdV88QT0skDGxAwXecnl0DrCeA== X-Received: by 2002:a05:6000:c3:: with SMTP id q3mr3272609wrx.361.1633179226312; Sat, 02 Oct 2021 05:53:46 -0700 (PDT) Received: from x1w.. (118.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.118]) by smtp.gmail.com with ESMTPSA id l26sm10571166wmi.25.2021.10.02.05.53.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Oct 2021 05:53:46 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v3 06/22] target/i386/cpu: Add missing 'qapi/error.h' header Date: Sat, 2 Oct 2021 14:53:01 +0200 Message-Id: <20211002125317.3418648-7-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211002125317.3418648-1-philmd@redhat.com> References: <20211002125317.3418648-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=170.10.133.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Brijesh Singh , kvm@vger.kernel.org, Sergio Lopez , Connor Kuehl , James Bottomley , "Dr . David Alan Gilbert" , Dov Murik , "Daniel P . Berrange" , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Eduardo Habkost Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Commit 00b81053244 ("target-i386: Remove assert_no_error usage") forgot to add the "qapi/error.h" for &error_abort, add it now. Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Connor Kuehl Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Paolo Bonzini --- target/i386/cpu.c | 1 + 1 file changed, 1 insertion(+) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index cacec605bf1..e169a01713d 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -27,6 +27,7 @@ #include "sysemu/hvf.h" #include "kvm/kvm_i386.h" #include "sev_i386.h" +#include "qapi/error.h" #include "qapi/qapi-visit-machine.h" #include "qapi/qmp/qerror.h" #include "qapi/qapi-commands-machine-target.h" From patchwork Sat Oct 2 12:53:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1535636 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=WOzXIdZr; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HM6c25ZVYz9t0J for ; Sat, 2 Oct 2021 23:03:30 +1000 (AEST) Received: from localhost ([::1]:43870 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mWefo-0003x8-Gx for incoming@patchwork.ozlabs.org; Sat, 02 Oct 2021 09:03:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33132) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mWeWZ-0000yT-JS for qemu-devel@nongnu.org; Sat, 02 Oct 2021 08:53:55 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:48273) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mWeWY-0000iF-5T for qemu-devel@nongnu.org; Sat, 02 Oct 2021 08:53:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633179233; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=J6Nu9xcD/1mLwA45H6T/mwE1HK3rKCkbuT6P4bJEEQ4=; b=WOzXIdZrMDUAtoo9o7MEfWUtNCtab60BP9qO4YEiZuIuEK82TskcazDOibkAZ0KkFnByaV J/idG34SH18tBH807TrZnHE/0ILZGiJwtFU9EcKQ+is8xja3/lLCKFzcBkP+4jPDxvuBR5 gbduzBxjASGFsz+DHjdyPHKn/Op9ZMc= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-22-XeUS17jDMGa7tRB5LPmQuA-1; Sat, 02 Oct 2021 08:53:52 -0400 X-MC-Unique: XeUS17jDMGa7tRB5LPmQuA-1 Received: by mail-wr1-f72.google.com with SMTP id t2-20020adf97c2000000b001608326aa2fso2763248wrb.8 for ; Sat, 02 Oct 2021 05:53:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=J6Nu9xcD/1mLwA45H6T/mwE1HK3rKCkbuT6P4bJEEQ4=; b=2St41/BKZfJpbUP7dlN/BZtBrWtfP3IvAuCluHFAIBC+pjE7zKQalT8Y3c2EWKkN0f OjF8DzwXOmtu+I7Ry+LH6x8mOa24chGmboBtgimz9fkAK2rq9oxi0whUolVwhUV8InAK ggOjVicbZgX2KOPq3+ajB0RjKszfA+mFP2gH4Q8sre6gh02dsl85NkEibfxn3g7YUCwN p4IsR2CqyHj6mKc29wS8FJBAhaAFGReOCko/pLVpSgbqXiDp8NlbjFPV5NOHGttccZ0c oBMV+DS1QufttQfaL3q7lAh2y9XN+qWcH6LaoUwKWSZK/Y8zGVBqLpHuLKMJRCxYAqUv L6+Q== X-Gm-Message-State: AOAM533hpBpBIcubIBhcImf1gyn8VM16pttVzqxhGxblMzx65Mcy1/dl O93IsXS1/zk1411inta4WhvcyCOTbLORs9wTcSDdFomBIW3DWw4v/Ks9xPYSGbqm6KHMNE7ed2t 2jOnpItxtKUpIRBgjNSt6MCPpoK0B5AzfQSowCdi6AfDYg2IvE8F3jY84VOuMv+Ud X-Received: by 2002:adf:97cc:: with SMTP id t12mr1334728wrb.189.1633179230928; Sat, 02 Oct 2021 05:53:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzEX2HQVvG0eH4EoV9kXNFJrMMQBJdc9DWwXnuA0OfpprIlXkRMpruuO+nx+/QeCu4EKQakjA== X-Received: by 2002:adf:97cc:: with SMTP id t12mr1334706wrb.189.1633179230756; Sat, 02 Oct 2021 05:53:50 -0700 (PDT) Received: from x1w.. (118.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.118]) by smtp.gmail.com with ESMTPSA id f18sm4106229wrj.30.2021.10.02.05.53.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Oct 2021 05:53:50 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v3 07/22] target/i386/sev_i386.h: Remove unused headers Date: Sat, 2 Oct 2021 14:53:02 +0200 Message-Id: <20211002125317.3418648-8-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211002125317.3418648-1-philmd@redhat.com> References: <20211002125317.3418648-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=170.10.133.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Brijesh Singh , kvm@vger.kernel.org, Sergio Lopez , Connor Kuehl , James Bottomley , "Dr . David Alan Gilbert" , Dov Murik , "Daniel P . Berrange" , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Eduardo Habkost Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Declarations don't require these headers, remove them. Reviewed-by: Connor Kuehl Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Paolo Bonzini --- target/i386/sev_i386.h | 4 ---- target/i386/sev-stub.c | 1 + 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/target/i386/sev_i386.h b/target/i386/sev_i386.h index ae6d8404787..f4223f1febf 100644 --- a/target/i386/sev_i386.h +++ b/target/i386/sev_i386.h @@ -14,11 +14,7 @@ #ifndef QEMU_SEV_I386_H #define QEMU_SEV_I386_H -#include "qom/object.h" -#include "qapi/error.h" -#include "sysemu/kvm.h" #include "sysemu/sev.h" -#include "qemu/error-report.h" #include "qapi/qapi-types-misc-target.h" #define SEV_POLICY_NODBG 0x1 diff --git a/target/i386/sev-stub.c b/target/i386/sev-stub.c index 0227cb51778..d91c2ece784 100644 --- a/target/i386/sev-stub.c +++ b/target/i386/sev-stub.c @@ -12,6 +12,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "sev_i386.h" SevInfo *sev_get_info(void) From patchwork Sat Oct 2 12:53:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1535633 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=RLz1lftk; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HM6VB359Gz9t0J for ; Sat, 2 Oct 2021 22:58:26 +1000 (AEST) Received: from localhost ([::1]:35960 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mWeau-0006mo-4t for incoming@patchwork.ozlabs.org; Sat, 02 Oct 2021 08:58:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33160) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mWeWi-0001Tq-36 for qemu-devel@nongnu.org; Sat, 02 Oct 2021 08:54:04 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:60620) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mWeWg-0000lB-FN for qemu-devel@nongnu.org; Sat, 02 Oct 2021 08:54:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633179241; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2JOuakDg9TjNTLsEL31Gb5qf2swMU1YyZ5LrMCCfA9Y=; b=RLz1lftkN0cwduFVWn3Hd0KYMtIWUddsKY5C053ou5kVGwAJwkQyEX3eiBQeyRN1gIIoLJ VOHBVxMdhOpSsQ/K52Jv4TRxcMVBj+gXXDuVjbXVtReO6vV9IrGf9TrxwFT3iLG8IMVStG fcO9p6vwsNJQndGmaoobvnVOBT1HXZs= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-578-kRMw81yOMJei9Y25zsL99w-1; Sat, 02 Oct 2021 08:53:57 -0400 X-MC-Unique: kRMw81yOMJei9Y25zsL99w-1 Received: by mail-wm1-f69.google.com with SMTP id h24-20020a7bc938000000b0030d400be5b5so3358243wml.0 for ; Sat, 02 Oct 2021 05:53:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=2JOuakDg9TjNTLsEL31Gb5qf2swMU1YyZ5LrMCCfA9Y=; b=qiJBHSsUNcFIhQVnTCOyPle53DhqrnqZNcLJfUQ1XCV1SfA4sCmfwOcTICpudH3s4c EbsMjWXdb3IMFJv3zy30CH0adl97AGyEQ6p9FkXg8ncL/hOm0U8jot0mC4hn0KPIE+hl Ag9wXr1fmmmPj10pgU2RG5AzDcdFubJofZIrhm0sJHwg/r36qsSKfHDE/N6igjLtDdHa jv3AiJyocc4/h4lnsAkuv/DNGfmlM4poAkyafLAdPHhk93zcToasT9GaZfU07kC8ld15 r/HotF5JJ8AxZruhgTU+7zHc6/1AidvgbbaNeUXl1cELfS97qgEyYGC2R8agmiEKTYFM Thkw== X-Gm-Message-State: AOAM533zoUtZWPax8cVbWaEhg/dTcTkhGE10wUPKkxI6jcT5gD6UZ4+L SfJOK4fAP8R8AEOlq+S4T+GyYecED1/w4LEMw1gQxqA6UyQ6RF65xoD/f5+o4SbHlrGWYbydV1z 2j82ICwR71BxeJlpPatK5aswF4J1wFdtX+wr8LciZcrrWTzXdgNxnUxgGYvCB1x0q X-Received: by 2002:adf:a18d:: with SMTP id u13mr3366730wru.275.1633179235495; Sat, 02 Oct 2021 05:53:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz3pw9/64lGQcYsWkhaqchQbJCRGpJ8vrpRflv453uN3gfkMzMibGa3diRsytvz2Ljjr0eAUQ== X-Received: by 2002:adf:a18d:: with SMTP id u13mr3366709wru.275.1633179235309; Sat, 02 Oct 2021 05:53:55 -0700 (PDT) Received: from x1w.. (118.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.118]) by smtp.gmail.com with ESMTPSA id o12sm8849678wms.15.2021.10.02.05.53.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Oct 2021 05:53:54 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v3 08/22] target/i386/sev: Remove sev_get_me_mask() Date: Sat, 2 Oct 2021 14:53:03 +0200 Message-Id: <20211002125317.3418648-9-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211002125317.3418648-1-philmd@redhat.com> References: <20211002125317.3418648-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=170.10.133.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Brijesh Singh , kvm@vger.kernel.org, Sergio Lopez , Connor Kuehl , James Bottomley , "Dr . David Alan Gilbert" , Dov Murik , "Daniel P . Berrange" , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Eduardo Habkost Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Unused dead code makes review harder, so remove it. Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Connor Kuehl Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Paolo Bonzini --- target/i386/sev_i386.h | 1 - target/i386/sev-stub.c | 5 ----- target/i386/sev.c | 9 --------- 3 files changed, 15 deletions(-) diff --git a/target/i386/sev_i386.h b/target/i386/sev_i386.h index f4223f1febf..afa19a0a161 100644 --- a/target/i386/sev_i386.h +++ b/target/i386/sev_i386.h @@ -25,7 +25,6 @@ #define SEV_POLICY_SEV 0x20 extern bool sev_es_enabled(void); -extern uint64_t sev_get_me_mask(void); extern SevInfo *sev_get_info(void); extern uint32_t sev_get_cbit_position(void); extern uint32_t sev_get_reduced_phys_bits(void); diff --git a/target/i386/sev-stub.c b/target/i386/sev-stub.c index d91c2ece784..eb0c89bf2be 100644 --- a/target/i386/sev-stub.c +++ b/target/i386/sev-stub.c @@ -25,11 +25,6 @@ bool sev_enabled(void) return false; } -uint64_t sev_get_me_mask(void) -{ - return ~0; -} - uint32_t sev_get_cbit_position(void) { return 0; diff --git a/target/i386/sev.c b/target/i386/sev.c index fa7210473a6..c88cd808410 100644 --- a/target/i386/sev.c +++ b/target/i386/sev.c @@ -64,7 +64,6 @@ struct SevGuestState { uint8_t api_major; uint8_t api_minor; uint8_t build_id; - uint64_t me_mask; int sev_fd; SevState state; gchar *measurement; @@ -362,12 +361,6 @@ sev_es_enabled(void) return sev_enabled() && (sev_guest->policy & SEV_POLICY_ES); } -uint64_t -sev_get_me_mask(void) -{ - return sev_guest ? sev_guest->me_mask : ~0; -} - uint32_t sev_get_cbit_position(void) { @@ -804,8 +797,6 @@ int sev_kvm_init(ConfidentialGuestSupport *cgs, Error **errp) goto err; } - sev->me_mask = ~(1UL << sev->cbitpos); - devname = object_property_get_str(OBJECT(sev), "sev-device", NULL); sev->sev_fd = open(devname, O_RDWR); if (sev->sev_fd < 0) { From patchwork Sat Oct 2 12:53:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1535639 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=IMROb0Jm; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HM6gy1r3vz9t0J for ; Sat, 2 Oct 2021 23:06:53 +1000 (AEST) Received: from localhost ([::1]:52646 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mWej5-0001Wg-Nv for incoming@patchwork.ozlabs.org; Sat, 02 Oct 2021 09:06:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33164) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mWeWj-0001Ux-FY for qemu-devel@nongnu.org; Sat, 02 Oct 2021 08:54:05 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:40097) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mWeWg-0000lJ-Rl for qemu-devel@nongnu.org; Sat, 02 Oct 2021 08:54:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633179242; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KJdW6m0Ma56hwzjCy1teOEHrEH20tchf6AQogJnEfxU=; b=IMROb0Jmtcifq0WE06BVpFvlcPZbhXPT0OmZYgYlj4whBtlz4N5yag++utQ0FO4vr1FBYy PeCMczK9CbCzOSnXMni4eO4wQ7+b35x87Ov4pnPsDb4oG6069DUETVZq3rtSm6Kod0vg30 xezFufs0RlYqf6TDnkCgPG0m/lv6caE= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-361-fo7qyVphNk2CZ85SDApV-Q-1; Sat, 02 Oct 2021 08:54:01 -0400 X-MC-Unique: fo7qyVphNk2CZ85SDApV-Q-1 Received: by mail-wm1-f72.google.com with SMTP id m9-20020a05600c4f4900b003057c761567so7367354wmq.1 for ; Sat, 02 Oct 2021 05:54:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=KJdW6m0Ma56hwzjCy1teOEHrEH20tchf6AQogJnEfxU=; b=3FORP0ALzs9qNUQZyze2n14vYjKDDSuBTfvE0yq6i38tmyXATE4Zr7ay5gvePEMa9H K73sfwHptl9n0UfMKx0qkuSo8RwEc7zPrFcLvTrt/CH8jTp63dxMOddBCYr04hqMhEra QoEAaPDWfFIgFWiLATTZIOcxaqqkxH4exo7+tNeFEunbjFi+8Zcgiy4/QCZJLaCjLHtW /exyhtZ/lhPPK0vx7VeRcNaoWPVZ+DdZ2q5fPowEL3mmw+hsN2JOsRUeSB/j/pk+k713 IubGZw9qFrJ7g65HZIGvm6ggtegMJfckogtG2WDuCkI4RhQVBmZz2S55PrSD+UnuD/ur uPqQ== X-Gm-Message-State: AOAM532vVkTR4zVUkTT/u29YvpSXpdrC5prWkCsp6Lft2lCnUsrLNwa8 5u5NoRWN6P7HxfcbdSLNatHcAJHtjttAj6Zs1ii+0bwgJgS7Q40FGSSpByARx41VPEvxb3gPYmL bmHf+UHFeB6286Ge82cYj19cz9yiZ72OXOUohFm7FjEV6T79rbSBzeW4uI84g35SY X-Received: by 2002:a05:6000:2c6:: with SMTP id o6mr3374991wry.292.1633179240125; Sat, 02 Oct 2021 05:54:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy1kpUWp8JDca6ogxcYyGFA/Lr3YXbhWtYHXiUio3plQycEwa1/nNlCgTVPD8fjk35/bjBa4A== X-Received: by 2002:a05:6000:2c6:: with SMTP id o6mr3374964wry.292.1633179239910; Sat, 02 Oct 2021 05:53:59 -0700 (PDT) Received: from x1w.. (118.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.118]) by smtp.gmail.com with ESMTPSA id f1sm9356839wri.43.2021.10.02.05.53.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Oct 2021 05:53:59 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v3 09/22] target/i386/sev: Mark unreachable code with g_assert_not_reached() Date: Sat, 2 Oct 2021 14:53:04 +0200 Message-Id: <20211002125317.3418648-10-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211002125317.3418648-1-philmd@redhat.com> References: <20211002125317.3418648-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Brijesh Singh , kvm@vger.kernel.org, Sergio Lopez , Connor Kuehl , James Bottomley , "Dr . David Alan Gilbert" , Dov Murik , "Daniel P . Berrange" , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Eduardo Habkost Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" The unique sev_encrypt_flash() invocation (in pc_system_flash_map) is protected by the "if (sev_enabled())" check, so is not reacheable. Replace the abort() call in sev_es_save_reset_vector() by g_assert_not_reached() which meaning is clearer. Reviewed-by: Connor Kuehl Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Paolo Bonzini --- target/i386/sev-stub.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/i386/sev-stub.c b/target/i386/sev-stub.c index eb0c89bf2be..4668365fd3e 100644 --- a/target/i386/sev-stub.c +++ b/target/i386/sev-stub.c @@ -54,7 +54,7 @@ int sev_inject_launch_secret(const char *hdr, const char *secret, int sev_encrypt_flash(uint8_t *ptr, uint64_t len, Error **errp) { - return 0; + g_assert_not_reached(); } bool sev_es_enabled(void) @@ -68,7 +68,7 @@ void sev_es_set_reset_vector(CPUState *cpu) int sev_es_save_reset_vector(void *flash_ptr, uint64_t flash_size) { - abort(); + g_assert_not_reached(); } SevAttestationReport * From patchwork Sat Oct 2 12:53:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1535637 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=RcnkKbOx; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HM6cK0TpFz9t0J for ; Sat, 2 Oct 2021 23:03:45 +1000 (AEST) Received: from localhost ([::1]:44494 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mWeg1-0004OL-SD for incoming@patchwork.ozlabs.org; Sat, 02 Oct 2021 09:03:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33178) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mWeWn-0001fZ-O5 for qemu-devel@nongnu.org; Sat, 02 Oct 2021 08:54:11 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:29914) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mWeWm-0000nA-4M for qemu-devel@nongnu.org; Sat, 02 Oct 2021 08:54:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633179247; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=tAj3BwaM+hRNB5Zlp17fWtjr58QjWY/+pHTXgMu/M3k=; b=RcnkKbOx/1oesT3+9rc8XkqyjFbbhFU+aU134LPqBv1M+Nzltn3lpSYQrOv5Bzkw1OB+0t yGHAUXzwQEaP9IKs1FyrjpR+253NeMQ233HG5LJyoqlUpdeJVrmUKUb0cvLjP65WU2TLcu GYYEH25RzQliPofg6zXWjv3ZdRkOw44= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-312-jt926YsCNEyMxUzM2TOaww-1; Sat, 02 Oct 2021 08:54:06 -0400 X-MC-Unique: jt926YsCNEyMxUzM2TOaww-1 Received: by mail-wm1-f72.google.com with SMTP id z22-20020a7bc7d6000000b0030d5c26120fso222416wmk.1 for ; Sat, 02 Oct 2021 05:54:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=tAj3BwaM+hRNB5Zlp17fWtjr58QjWY/+pHTXgMu/M3k=; b=jbgj1otzT7JoGXmOqmDUqb5VgucekqdrYcFPok2gzwhNSRL9k3061E+DyledjaPWK4 0hp9EAz409rQexISTC/MxpYZfrp1BSwg0y0EHb7lIztYJwZ6aIbcl+YviUMxcG3mSvKi trrEIC5tMnUJsaLgQXfUXOW7Y/bpPd3MV16OHeH02Cnqdf7y8YtkZN4PVMKuM1NOUFwx 5rwdJ4cdxoOYapwzGKz/LG5esLMzmou+LmiSaK2hGM7JLKIPJDkyrDWlXWWPtewAjuCG j8V2ydtLVMA/8zVLv1Xx1qWEt8JkT34gAdWWJIaTRAFTwzf4yhKtsX6B1yOvcBTAj/Xr BKog== X-Gm-Message-State: AOAM53012qP9+VoL31yZZjz1DWpPh8mUOE/6OvaKTQplQcaVLHtyNszK iYsjvQ6LgQ3ddgLWOV9c43a4vWn2sRmaSJUBoRUP99uhIgLNoOu/62xWSEB/iC2zPBY7VPfMLof ZivMlPF0Ea3dt/u11t+yNLgqLQfU69ZiteWw1ekAJMNYvzvsDYHCX/eZOwfCuVXk2 X-Received: by 2002:a5d:64cf:: with SMTP id f15mr3236693wri.284.1633179244658; Sat, 02 Oct 2021 05:54:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzgDxwlX5HGT9dZoGs+v2dDhfLDMjbUmMV+tcfi8guLt6V72knTXRGXTjkGozRRcnhuV3Vi0Q== X-Received: by 2002:a5d:64cf:: with SMTP id f15mr3236665wri.284.1633179244437; Sat, 02 Oct 2021 05:54:04 -0700 (PDT) Received: from x1w.. (118.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.118]) by smtp.gmail.com with ESMTPSA id i7sm8530172wrp.5.2021.10.02.05.54.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Oct 2021 05:54:04 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v3 10/22] target/i386/sev: sev_get_attestation_report use g_autofree Date: Sat, 2 Oct 2021 14:53:05 +0200 Message-Id: <20211002125317.3418648-11-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211002125317.3418648-1-philmd@redhat.com> References: <20211002125317.3418648-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=170.10.133.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Brijesh Singh , kvm@vger.kernel.org, Sergio Lopez , Connor Kuehl , James Bottomley , "Dr . David Alan Gilbert" , Dov Murik , "Daniel P . Berrange" , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Eduardo Habkost Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: "Dr. David Alan Gilbert" Removes a whole bunch of g_free's and a goto. Signed-off-by: Dr. David Alan Gilbert Reviewed-by: Connor Kuehl Reviewed-by: Brijesh Singh Message-Id: <20210603113017.34922-1-dgilbert@redhat.com> Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Paolo Bonzini --- target/i386/sev.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/target/i386/sev.c b/target/i386/sev.c index c88cd808410..aefbef4bb63 100644 --- a/target/i386/sev.c +++ b/target/i386/sev.c @@ -493,8 +493,8 @@ sev_get_attestation_report(const char *mnonce, Error **errp) struct kvm_sev_attestation_report input = {}; SevAttestationReport *report = NULL; SevGuestState *sev = sev_guest; - guchar *data; - guchar *buf; + g_autofree guchar *data = NULL; + g_autofree guchar *buf = NULL; gsize len; int err = 0, ret; @@ -514,7 +514,6 @@ sev_get_attestation_report(const char *mnonce, Error **errp) if (len != sizeof(input.mnonce)) { error_setg(errp, "SEV: mnonce must be %zu bytes (got %" G_GSIZE_FORMAT ")", sizeof(input.mnonce), len); - g_free(buf); return NULL; } @@ -525,7 +524,6 @@ sev_get_attestation_report(const char *mnonce, Error **errp) if (err != SEV_RET_INVALID_LEN) { error_setg(errp, "failed to query the attestation report length " "ret=%d fw_err=%d (%s)", ret, err, fw_error_to_str(err)); - g_free(buf); return NULL; } } @@ -540,7 +538,7 @@ sev_get_attestation_report(const char *mnonce, Error **errp) if (ret) { error_setg_errno(errp, errno, "Failed to get attestation report" " ret=%d fw_err=%d (%s)", ret, err, fw_error_to_str(err)); - goto e_free_data; + return NULL; } report = g_new0(SevAttestationReport, 1); @@ -548,9 +546,6 @@ sev_get_attestation_report(const char *mnonce, Error **errp) trace_kvm_sev_attestation_report(mnonce, report->data); -e_free_data: - g_free(data); - g_free(buf); return report; } From patchwork Sat Oct 2 12:53:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1535644 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=cAJsT9hP; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HM6nP1CqGz9t0J for ; Sat, 2 Oct 2021 23:11:36 +1000 (AEST) Received: from localhost ([::1]:37926 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mWene-00026F-J8 for incoming@patchwork.ozlabs.org; Sat, 02 Oct 2021 09:11:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33248) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mWeX0-0001ow-TB for qemu-devel@nongnu.org; Sat, 02 Oct 2021 08:54:22 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:33631) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mWeWq-0000oH-1r for qemu-devel@nongnu.org; Sat, 02 Oct 2021 08:54:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633179251; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=AZLS+m7xAvvk2uRB++FAfryJbzXnCIDe39YBz1qMJyo=; b=cAJsT9hPxKeAPOiS3lTpLkXmCWqN/L7g21neJdhTZYR3flL8ZYkm7Ao01JTNuM0pU6506T DSgw6vsSOGzMXhH+NXUd5jRFjYwpKU+EGZIRvrtKeRwl6jbhGf7TCY+zDev5KWPTzgzZTk zNTmPTfjSgj2aIJziMEdTDWyWzV3maw= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-458-Bf7x9KI8PFSy-dEkmrji5Q-1; Sat, 02 Oct 2021 08:54:10 -0400 X-MC-Unique: Bf7x9KI8PFSy-dEkmrji5Q-1 Received: by mail-wm1-f71.google.com with SMTP id z137-20020a1c7e8f000000b0030cd1800d86so6075745wmc.2 for ; Sat, 02 Oct 2021 05:54:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=AZLS+m7xAvvk2uRB++FAfryJbzXnCIDe39YBz1qMJyo=; b=1Tqjd4aFol6gAtPaaq+VNpHP4LitK65zU4XiQZCsI/qT143yhqN1GROjFfxBaepNln O9nCERR33OyVrn/BAKgFrve/oSeen50geo5Z/M+0p8dRBl7998nncS3hYa2HUeqZvbO8 CtzQ6AOyLiKkQDbqPcpUmY3e95Xn77DMxZ1MaoLUFxb0meTD4aR3KeGj3Pc6qsxk8ZuS wa3ejM31eG07IjGRTbm/fYQ44ahH8mzPj1znZ9VqvUrHXRmgF/tx/FHDPDdVp7ljwDs5 1mgph9uqCelcsxGDCqOcTWIOiMbmNHoGEAnV7RjaXgsEgQ3yV6gm2O9btZPwJowKRBk4 lW4Q== X-Gm-Message-State: AOAM533ErQ/qe99fBIxjcRG1c0aEEXjs7IkCO/9CXZo+mSQZrq72Q/Bw y0egiRm/MVYqQpD/OvWIByOAA463cr/wuSokO+xAdTNfGGwAeguKt2nTcbp5nuj59kCwTtSLOuJ nf7TZ1bsU0fXaOoxk8sOxjddMNxj8m6k+GOpatrTbphwkrn5BUJUj5BDJKaYeR7CA X-Received: by 2002:adf:b185:: with SMTP id q5mr1100026wra.213.1633179249029; Sat, 02 Oct 2021 05:54:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzhvlat8mS6Fsi/9Q+MqqxK+CL6/DlRnFXF7c3AjMW/EsZmLOxs5oU2baglAlxjjo/FnbXepw== X-Received: by 2002:adf:b185:: with SMTP id q5mr1100005wra.213.1633179248822; Sat, 02 Oct 2021 05:54:08 -0700 (PDT) Received: from x1w.. (118.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.118]) by smtp.gmail.com with ESMTPSA id z8sm9814721wrm.63.2021.10.02.05.54.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Oct 2021 05:54:08 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v3 11/22] target/i386/sev: Restrict SEV to system emulation Date: Sat, 2 Oct 2021 14:53:06 +0200 Message-Id: <20211002125317.3418648-12-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211002125317.3418648-1-philmd@redhat.com> References: <20211002125317.3418648-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=170.10.133.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Brijesh Singh , kvm@vger.kernel.org, Sergio Lopez , James Bottomley , "Dr . David Alan Gilbert" , Dov Murik , "Daniel P . Berrange" , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Eduardo Habkost Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" SEV is irrelevant on user emulation, so restrict it to sysemu. Some stubs are still required because used in cpu.c by x86_register_cpudef_types(), so move the sysemu specific stubs to sev-sysemu-stub.c instead. This will allow us to simplify monitor.c (which is not available in user emulation) in the next commit. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Paolo Bonzini --- target/i386/sev-stub.c | 43 ------------------------- target/i386/sev-sysemu-stub.c | 60 +++++++++++++++++++++++++++++++++++ target/i386/meson.build | 4 ++- 3 files changed, 63 insertions(+), 44 deletions(-) create mode 100644 target/i386/sev-sysemu-stub.c diff --git a/target/i386/sev-stub.c b/target/i386/sev-stub.c index 4668365fd3e..8eae5d2fa8d 100644 --- a/target/i386/sev-stub.c +++ b/target/i386/sev-stub.c @@ -15,11 +15,6 @@ #include "qapi/error.h" #include "sev_i386.h" -SevInfo *sev_get_info(void) -{ - return NULL; -} - bool sev_enabled(void) { return false; @@ -35,45 +30,7 @@ uint32_t sev_get_reduced_phys_bits(void) return 0; } -char *sev_get_launch_measurement(void) -{ - return NULL; -} - -SevCapability *sev_get_capabilities(Error **errp) -{ - error_setg(errp, "SEV is not available in this QEMU"); - return NULL; -} - -int sev_inject_launch_secret(const char *hdr, const char *secret, - uint64_t gpa, Error **errp) -{ - return 1; -} - -int sev_encrypt_flash(uint8_t *ptr, uint64_t len, Error **errp) -{ - g_assert_not_reached(); -} - bool sev_es_enabled(void) { return false; } - -void sev_es_set_reset_vector(CPUState *cpu) -{ -} - -int sev_es_save_reset_vector(void *flash_ptr, uint64_t flash_size) -{ - g_assert_not_reached(); -} - -SevAttestationReport * -sev_get_attestation_report(const char *mnonce, Error **errp) -{ - error_setg(errp, "SEV is not available in this QEMU"); - return NULL; -} diff --git a/target/i386/sev-sysemu-stub.c b/target/i386/sev-sysemu-stub.c new file mode 100644 index 00000000000..d556b4f091f --- /dev/null +++ b/target/i386/sev-sysemu-stub.c @@ -0,0 +1,60 @@ +/* + * QEMU SEV system stub + * + * Copyright Advanced Micro Devices 2018 + * + * Authors: + * Brijesh Singh + * + * This work is licensed under the terms of the GNU GPL, version 2 or later. + * See the COPYING file in the top-level directory. + * + */ + +#include "qemu/osdep.h" +#include "qapi/qapi-commands-misc-target.h" +#include "qapi/error.h" +#include "sev_i386.h" + +SevInfo *sev_get_info(void) +{ + return NULL; +} + +char *sev_get_launch_measurement(void) +{ + return NULL; +} + +SevCapability *sev_get_capabilities(Error **errp) +{ + error_setg(errp, "SEV is not available in this QEMU"); + return NULL; +} + +int sev_inject_launch_secret(const char *hdr, const char *secret, + uint64_t gpa, Error **errp) +{ + return 1; +} + +int sev_encrypt_flash(uint8_t *ptr, uint64_t len, Error **errp) +{ + g_assert_not_reached(); +} + +void sev_es_set_reset_vector(CPUState *cpu) +{ +} + +int sev_es_save_reset_vector(void *flash_ptr, uint64_t flash_size) +{ + g_assert_not_reached(); +} + +SevAttestationReport *sev_get_attestation_report(const char *mnonce, + Error **errp) +{ + error_setg(errp, "SEV is not available in this QEMU"); + return NULL; +} diff --git a/target/i386/meson.build b/target/i386/meson.build index dac19ec00d4..a4f45c3ec1d 100644 --- a/target/i386/meson.build +++ b/target/i386/meson.build @@ -6,7 +6,7 @@ 'xsave_helper.c', 'cpu-dump.c', )) -i386_ss.add(when: 'CONFIG_SEV', if_true: files('host-cpu.c', 'sev.c'), if_false: files('sev-stub.c')) +i386_ss.add(when: 'CONFIG_SEV', if_true: files('host-cpu.c'), if_false: files('sev-stub.c')) # x86 cpu type i386_ss.add(when: 'CONFIG_KVM', if_true: files('host-cpu.c')) @@ -20,6 +20,8 @@ 'monitor.c', 'cpu-sysemu.c', )) +i386_softmmu_ss.add(when: 'CONFIG_SEV', if_true: files('sev.c'), if_false: files('sev-sysemu-stub.c')) + i386_user_ss = ss.source_set() subdir('kvm') From patchwork Sat Oct 2 12:53:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1535630 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=G2SlhV2e; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HM6RN093Fz9sX3 for ; Sat, 2 Oct 2021 22:55:59 +1000 (AEST) Received: from localhost ([::1]:58328 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mWeYW-0002nt-T6 for incoming@patchwork.ozlabs.org; Sat, 02 Oct 2021 08:55:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33250) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mWeX0-0001pH-WF for qemu-devel@nongnu.org; Sat, 02 Oct 2021 08:54:23 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:42838) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mWeWw-0000qB-A6 for qemu-devel@nongnu.org; Sat, 02 Oct 2021 08:54:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633179257; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PLN18Kg90p6yE/kKbVk7ZeNbapKw0JC8XYHCCSL7Hxc=; b=G2SlhV2eoghm0rtn0L01sKnYP5pk49hGqs8TOctLQ7fvVxzpIJfOv+XwbTWbN95BF+6gZG 7WefoN+Bvo5xGWG+EUN8H3O5oS1JfkhxOX82or6G+6ONN9BnBlH+npKb9AVZmge11q+0xV CN0ADzEVNLlj54gOWWHoZweWS+m+F+4= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-286-EFnRYPv0PbmRt9G-1OjJwQ-1; Sat, 02 Oct 2021 08:54:15 -0400 X-MC-Unique: EFnRYPv0PbmRt9G-1OjJwQ-1 Received: by mail-wm1-f70.google.com with SMTP id j21-20020a05600c1c1500b0030ccce95837so3789266wms.3 for ; Sat, 02 Oct 2021 05:54:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=PLN18Kg90p6yE/kKbVk7ZeNbapKw0JC8XYHCCSL7Hxc=; b=h4VmvKhqrDkT+PKnUDr0gigCBMeO5iKcHpt4uokmg5yDbThfIhVvWwhwLpaHLOZZs5 Lf8IznzF1ujY1XqxhJyjvjGrYx8FLILrN8KMPQU/vEapTcQSV/r93PS+jtSkoaq7WIYm jZzsNOG2MqkRkdq4EdA4NjrPMTjmGBgdJu4WvrgBMsj0xPLmT5ciqM0kUnq/KO+JvpU5 0B5gEMxj1eIYPaAJdwsTGCIovQTGNNTeE4cKQC8pYKGJImWquvQ+7od89rqZZpUuW1ZV Xm0T2kBF/qXCrHHqRyS9GKmPNqdiO3/zUGOVlOXYZUT7uRweEXi+fhPq0+7Kz3g7QiTm BYMw== X-Gm-Message-State: AOAM5307OmXRUZ7rLDSxEVPgMGa0teo993HjHYqSN+H5n9eapV3fh4Ut oSAgsm3qKPytuOc9D+gSLsV3QRdWdr4Mvw3D12h4kS5KrXbbGKe5PxX6OgNCqy4UnoBYsRUz0iN 4EQW/qWlpjLarWG4hFHqLXDW7xvzwxk2jv13vTlpkcJWGL7lcE1Efy0qrtb0+ONyA X-Received: by 2002:a1c:451:: with SMTP id 78mr9420885wme.158.1633179253688; Sat, 02 Oct 2021 05:54:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxvcuP74ApKFXkJudhkd8SG4XnSX9kLVw5i9VtVFVZpVk56S2QPWclGVjksHGgaC8beyVsBGA== X-Received: by 2002:a1c:451:: with SMTP id 78mr9420859wme.158.1633179253445; Sat, 02 Oct 2021 05:54:13 -0700 (PDT) Received: from x1w.. (118.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.118]) by smtp.gmail.com with ESMTPSA id f3sm4714202wmb.12.2021.10.02.05.54.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Oct 2021 05:54:13 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v3 12/22] target/i386/sev: Declare system-specific functions in 'sev_i386.h' Date: Sat, 2 Oct 2021 14:53:07 +0200 Message-Id: <20211002125317.3418648-13-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211002125317.3418648-1-philmd@redhat.com> References: <20211002125317.3418648-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=170.10.133.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -8 X-Spam_score: -0.9 X-Spam_bar: / X-Spam_report: (-0.9 / 5.0 requ) DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Brijesh Singh , kvm@vger.kernel.org, Sergio Lopez , James Bottomley , "Dr . David Alan Gilbert" , Dov Murik , "Daniel P . Berrange" , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Eduardo Habkost Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" While prefixed with sysemu, 'sysemu/sev.h' contains the architecture specific declarations. The system specific parts are declared in 'sev_i386.h'. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Paolo Bonzini --- include/sysemu/sev.h | 6 ------ target/i386/sev_i386.h | 7 +++++++ hw/i386/pc_sysfw.c | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/include/sysemu/sev.h b/include/sysemu/sev.h index 94d821d737c..a329ed75c1c 100644 --- a/include/sysemu/sev.h +++ b/include/sysemu/sev.h @@ -18,11 +18,5 @@ bool sev_enabled(void); int sev_kvm_init(ConfidentialGuestSupport *cgs, Error **errp); -int sev_encrypt_flash(uint8_t *ptr, uint64_t len, Error **errp); -int sev_inject_launch_secret(const char *hdr, const char *secret, - uint64_t gpa, Error **errp); - -int sev_es_save_reset_vector(void *flash_ptr, uint64_t flash_size); -void sev_es_set_reset_vector(CPUState *cpu); #endif diff --git a/target/i386/sev_i386.h b/target/i386/sev_i386.h index afa19a0a161..0798ab3519a 100644 --- a/target/i386/sev_i386.h +++ b/target/i386/sev_i386.h @@ -33,4 +33,11 @@ extern SevCapability *sev_get_capabilities(Error **errp); extern SevAttestationReport * sev_get_attestation_report(const char *mnonce, Error **errp); +int sev_encrypt_flash(uint8_t *ptr, uint64_t len, Error **errp); +int sev_inject_launch_secret(const char *hdr, const char *secret, + uint64_t gpa, Error **errp); + +int sev_es_save_reset_vector(void *flash_ptr, uint64_t flash_size); +void sev_es_set_reset_vector(CPUState *cpu); + #endif diff --git a/hw/i386/pc_sysfw.c b/hw/i386/pc_sysfw.c index 68d6b1f783e..0b202138b66 100644 --- a/hw/i386/pc_sysfw.c +++ b/hw/i386/pc_sysfw.c @@ -37,7 +37,7 @@ #include "hw/qdev-properties.h" #include "hw/block/flash.h" #include "sysemu/kvm.h" -#include "sysemu/sev.h" +#include "sev_i386.h" #define FLASH_SECTOR_SIZE 4096 From patchwork Sat Oct 2 12:53:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1535648 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=azVNXQT2; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HM6qh078Gz9t0J for ; Sat, 2 Oct 2021 23:13:34 +1000 (AEST) Received: from localhost ([::1]:42224 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mWepX-00050G-Ih for incoming@patchwork.ozlabs.org; Sat, 02 Oct 2021 09:13:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33262) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mWeX1-0001qh-W7 for qemu-devel@nongnu.org; Sat, 02 Oct 2021 08:54:24 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:50057) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mWeWz-0000r8-OI for qemu-devel@nongnu.org; Sat, 02 Oct 2021 08:54:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633179260; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ORMXV0Tst1vudHF4i8O0+oN0mxRTrnSBxDsiV4I1LIw=; b=azVNXQT2y436HHjbImIHn3ngYWBz9otD9N8CRYxbul52vLOnwcBFxACikJN7XaBjBOk8Ct KCZvMka0+lWCufzg2AEMa/DO/nNUk0kcWborQX0tfujR6JjnrkIP6WxvQ1bINuYwtZj5Yf 9Pz6lT69SLeSvth/9Rz3CeAkt+yOj/k= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-574-DN_0jU3qOdWsRWe6A4tJsg-1; Sat, 02 Oct 2021 08:54:19 -0400 X-MC-Unique: DN_0jU3qOdWsRWe6A4tJsg-1 Received: by mail-wm1-f69.google.com with SMTP id m2-20020a05600c3b0200b0030cd1310631so3791437wms.7 for ; Sat, 02 Oct 2021 05:54:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ORMXV0Tst1vudHF4i8O0+oN0mxRTrnSBxDsiV4I1LIw=; b=fv/nPtddzN9hYPOXdSKG+kdxmjaqNUH6khCoS1NlixOaP9yOl53L41CMPCwTSErvGX sp2ZW3T8Y3LOlH6MoHxPNN9NrN/lGBmfSIeeVciw4ZKE3iuNlIScr9zrSBzOzYojBKL6 ec2lIHVuyBXxVyIwdyDgt2iqyoASQwzq5O0e/bZDEy4tb5utbGxDo+D1R+cG7lFmRc84 WeAaS4pLE50eQQFN0xRvjKiSUKTCTl8hnMas91V3/qkZCz8rR3U9QbVLwJsBZYEk1m5J uicaTCDcHHoD/PwruHG/Fma6Fn9aaQoRr33uXD5t2uea01t2cmnolTD1wjWzWsjpsWVx QN8w== X-Gm-Message-State: AOAM533C9kCn1cYfXPGiCxE0mcInt6txzMn36Rcc0rjgqXuSmoY8IGap yjlhaPnZbmo6PuVMpoIO2t5//iPc/Y0uGueCz4d3fJr67i07rUkUnr25b3mqK9bI8M4N/+a/+HA v0/wcU4Uq5N2LfWTc99Obeqhf+9++RZeT5RVUfEfPEhKQyxSj08gKqlst2uZ9fEXh X-Received: by 2002:adf:a18d:: with SMTP id u13mr3368099wru.275.1633179258259; Sat, 02 Oct 2021 05:54:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzuWjXvREy5i/oGIVOiC0tBm2gnRbqZb/64Psa7EoqmzOxcl6FWYaAG1lUh/i/7mWLZCmUUqw== X-Received: by 2002:adf:a18d:: with SMTP id u13mr3368069wru.275.1633179258011; Sat, 02 Oct 2021 05:54:18 -0700 (PDT) Received: from x1w.. (118.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.118]) by smtp.gmail.com with ESMTPSA id i2sm8381097wrq.78.2021.10.02.05.54.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Oct 2021 05:54:17 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v3 13/22] target/i386/sev: Remove stubs by using code elision Date: Sat, 2 Oct 2021 14:53:08 +0200 Message-Id: <20211002125317.3418648-14-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211002125317.3418648-1-philmd@redhat.com> References: <20211002125317.3418648-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=170.10.133.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Brijesh Singh , kvm@vger.kernel.org, Sergio Lopez , James Bottomley , "Dr . David Alan Gilbert" , Dov Murik , "Daniel P . Berrange" , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Eduardo Habkost Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Only declare sev_enabled() and sev_es_enabled() when CONFIG_SEV is set, to allow the compiler to elide unused code. Remove unnecessary stubs. Signed-off-by: Philippe Mathieu-Daudé --- include/sysemu/sev.h | 14 +++++++++++++- target/i386/sev_i386.h | 3 --- target/i386/cpu.c | 16 +++++++++------- target/i386/sev-stub.c | 36 ------------------------------------ target/i386/meson.build | 2 +- 5 files changed, 23 insertions(+), 48 deletions(-) delete mode 100644 target/i386/sev-stub.c diff --git a/include/sysemu/sev.h b/include/sysemu/sev.h index a329ed75c1c..f5c625bb3b3 100644 --- a/include/sysemu/sev.h +++ b/include/sysemu/sev.h @@ -14,9 +14,21 @@ #ifndef QEMU_SEV_H #define QEMU_SEV_H -#include "sysemu/kvm.h" +#ifndef CONFIG_USER_ONLY +#include CONFIG_DEVICES /* CONFIG_SEV */ +#endif +#ifdef CONFIG_SEV bool sev_enabled(void); +bool sev_es_enabled(void); +#else +#define sev_enabled() 0 +#define sev_es_enabled() 0 +#endif + +uint32_t sev_get_cbit_position(void); +uint32_t sev_get_reduced_phys_bits(void); + int sev_kvm_init(ConfidentialGuestSupport *cgs, Error **errp); #endif diff --git a/target/i386/sev_i386.h b/target/i386/sev_i386.h index 0798ab3519a..2d9a1a0112e 100644 --- a/target/i386/sev_i386.h +++ b/target/i386/sev_i386.h @@ -24,10 +24,7 @@ #define SEV_POLICY_DOMAIN 0x10 #define SEV_POLICY_SEV 0x20 -extern bool sev_es_enabled(void); extern SevInfo *sev_get_info(void); -extern uint32_t sev_get_cbit_position(void); -extern uint32_t sev_get_reduced_phys_bits(void); extern char *sev_get_launch_measurement(void); extern SevCapability *sev_get_capabilities(Error **errp); extern SevAttestationReport * diff --git a/target/i386/cpu.c b/target/i386/cpu.c index e169a01713d..27992bdc9f8 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -25,8 +25,8 @@ #include "tcg/helper-tcg.h" #include "sysemu/reset.h" #include "sysemu/hvf.h" +#include "sysemu/sev.h" #include "kvm/kvm_i386.h" -#include "sev_i386.h" #include "qapi/error.h" #include "qapi/qapi-visit-machine.h" #include "qapi/qmp/qerror.h" @@ -38,6 +38,7 @@ #include "exec/address-spaces.h" #include "hw/boards.h" #include "hw/i386/sgx-epc.h" +#include "sev_i386.h" #endif #include "disas/capstone.h" @@ -5764,12 +5765,13 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count, *edx = 0; break; case 0x8000001F: - *eax = sev_enabled() ? 0x2 : 0; - *eax |= sev_es_enabled() ? 0x8 : 0; - *ebx = sev_get_cbit_position(); - *ebx |= sev_get_reduced_phys_bits() << 6; - *ecx = 0; - *edx = 0; + *eax = *ebx = *ecx = *edx = 0; + if (sev_enabled()) { + *eax = 0x2; + *eax |= sev_es_enabled() ? 0x8 : 0; + *ebx = sev_get_cbit_position(); + *ebx |= sev_get_reduced_phys_bits() << 6; + } break; default: /* reserved values: zero */ diff --git a/target/i386/sev-stub.c b/target/i386/sev-stub.c deleted file mode 100644 index 8eae5d2fa8d..00000000000 --- a/target/i386/sev-stub.c +++ /dev/null @@ -1,36 +0,0 @@ -/* - * QEMU SEV stub - * - * Copyright Advanced Micro Devices 2018 - * - * Authors: - * Brijesh Singh - * - * This work is licensed under the terms of the GNU GPL, version 2 or later. - * See the COPYING file in the top-level directory. - * - */ - -#include "qemu/osdep.h" -#include "qapi/error.h" -#include "sev_i386.h" - -bool sev_enabled(void) -{ - return false; -} - -uint32_t sev_get_cbit_position(void) -{ - return 0; -} - -uint32_t sev_get_reduced_phys_bits(void) -{ - return 0; -} - -bool sev_es_enabled(void) -{ - return false; -} diff --git a/target/i386/meson.build b/target/i386/meson.build index a4f45c3ec1d..ae38dc95635 100644 --- a/target/i386/meson.build +++ b/target/i386/meson.build @@ -6,7 +6,7 @@ 'xsave_helper.c', 'cpu-dump.c', )) -i386_ss.add(when: 'CONFIG_SEV', if_true: files('host-cpu.c'), if_false: files('sev-stub.c')) +i386_ss.add(when: 'CONFIG_SEV', if_true: files('host-cpu.c')) # x86 cpu type i386_ss.add(when: 'CONFIG_KVM', if_true: files('host-cpu.c')) From patchwork Sat Oct 2 12:53:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1535640 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Fgg2WK/F; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HM6h23fqCz9t0J for ; Sat, 2 Oct 2021 23:06:58 +1000 (AEST) Received: from localhost ([::1]:52958 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mWejA-0001j5-9A for incoming@patchwork.ozlabs.org; Sat, 02 Oct 2021 09:06:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33286) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mWeX5-0001t5-7X for qemu-devel@nongnu.org; Sat, 02 Oct 2021 08:54:27 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:45397) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mWeX3-0000tK-GH for qemu-devel@nongnu.org; Sat, 02 Oct 2021 08:54:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633179264; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+4z6jUCebNJqEmNFJ/VStW7BTMEQNitBNtR46XouroI=; b=Fgg2WK/FoaEoFd1NraXoeMRhu0Ejvk+ZO18gpE195cVEbiWHmARp3Uq8HKHE8OdlUlC57w 6f3R+TFJOgDiaojdEuLwOWj8r/n4wsZyI3erDBOB4f4EyFTp4zHiIpvMJnjDqsnlxok1kp iLtWb7iQ8gdu/2kxEm+AHe5cXpEK0IU= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-131-mD1qi1iRPU2aDX5G65UJoA-1; Sat, 02 Oct 2021 08:54:24 -0400 X-MC-Unique: mD1qi1iRPU2aDX5G65UJoA-1 Received: by mail-wm1-f70.google.com with SMTP id u3-20020a7bcb03000000b0030d5228cbbdso2088953wmj.3 for ; Sat, 02 Oct 2021 05:54:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=+4z6jUCebNJqEmNFJ/VStW7BTMEQNitBNtR46XouroI=; b=CjjmkInaFB5ka24+/mWRnv5BR9a9O9Ho0wFqqq7sbLabTIz3rMrlUZWDtR3bTnT/bP IWYxWxrPFUYeTxkbS49ndeSJyxl77HBMqp94fMtDFWxnzrlKcUb5JAp0wSu+gLG16kSJ Nqyp1+3eM5hd+itQ2E3HfcT+FGKHtmeQh4ypcMGccGiA2T1yHP4wKIAjhdNaUVz3lgAj bzJIJ4lMBZAlMIUu5k5H2UuUhf/j3eBZ4Bdx5OrtnZSbgxhEPNihxuc1VAnzmDflmjOR ZDc1RjSlKzYbcUjwgCvk/bFmvXMYFzVb5hIww4keC3rm5FDvoIhs1v/C5TlrUHCk7KQD 5q9Q== X-Gm-Message-State: AOAM532MujfsMasJbGU5CTIx359dIvvwaWKHM20CZu3mgMW4tBnK/xFc pLlhP4a5RjLRLUJ3+c8joIlSYy7nZzKblL0LM84qmg0lYXvdO4/uSJLvCqhoRW1CU2Lo7WKzoNn IW5+YF2DP2+NepL0ta2WYKTUpboDjuiVq4xyIYlEsm/qWPISyZhDBEq6oMzRe8XoM X-Received: by 2002:a05:6000:2c6:: with SMTP id o6mr3376275wry.292.1633179262714; Sat, 02 Oct 2021 05:54:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwPg2SUP1KRqKQDM976J1UW+bK/dVfMUDIEqkBzFMQ49KQqAlYHTXe/I8QRvH6n2Zfw+A1FBw== X-Received: by 2002:a05:6000:2c6:: with SMTP id o6mr3376245wry.292.1633179262453; Sat, 02 Oct 2021 05:54:22 -0700 (PDT) Received: from x1w.. (118.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.118]) by smtp.gmail.com with ESMTPSA id o19sm9025753wrg.60.2021.10.02.05.54.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Oct 2021 05:54:22 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v3 14/22] target/i386/sev: Move qmp_query_sev_attestation_report() to sev.c Date: Sat, 2 Oct 2021 14:53:09 +0200 Message-Id: <20211002125317.3418648-15-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211002125317.3418648-1-philmd@redhat.com> References: <20211002125317.3418648-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Brijesh Singh , kvm@vger.kernel.org, Sergio Lopez , James Bottomley , "Dr . David Alan Gilbert" , Dov Murik , "Daniel P . Berrange" , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Eduardo Habkost Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Move qmp_query_sev_attestation_report() from monitor.c to sev.c and make sev_get_attestation_report() static. We don't need the stub anymore, remove it. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Paolo Bonzini --- target/i386/sev_i386.h | 2 -- target/i386/monitor.c | 6 ------ target/i386/sev-sysemu-stub.c | 7 ++++--- target/i386/sev.c | 12 ++++++++++-- 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/target/i386/sev_i386.h b/target/i386/sev_i386.h index 2d9a1a0112e..5f367f78eb7 100644 --- a/target/i386/sev_i386.h +++ b/target/i386/sev_i386.h @@ -27,8 +27,6 @@ extern SevInfo *sev_get_info(void); extern char *sev_get_launch_measurement(void); extern SevCapability *sev_get_capabilities(Error **errp); -extern SevAttestationReport * -sev_get_attestation_report(const char *mnonce, Error **errp); int sev_encrypt_flash(uint8_t *ptr, uint64_t len, Error **errp); int sev_inject_launch_secret(const char *hdr, const char *secret, diff --git a/target/i386/monitor.c b/target/i386/monitor.c index a9f85acd473..c05d70252a2 100644 --- a/target/i386/monitor.c +++ b/target/i386/monitor.c @@ -764,12 +764,6 @@ void qmp_sev_inject_launch_secret(const char *packet_hdr, sev_inject_launch_secret(packet_hdr, secret, gpa, errp); } -SevAttestationReport * -qmp_query_sev_attestation_report(const char *mnonce, Error **errp) -{ - return sev_get_attestation_report(mnonce, errp); -} - SGXInfo *qmp_query_sgx(Error **errp) { return sgx_get_info(errp); diff --git a/target/i386/sev-sysemu-stub.c b/target/i386/sev-sysemu-stub.c index d556b4f091f..813b9a6a03b 100644 --- a/target/i386/sev-sysemu-stub.c +++ b/target/i386/sev-sysemu-stub.c @@ -13,6 +13,7 @@ #include "qemu/osdep.h" #include "qapi/qapi-commands-misc-target.h" +#include "qapi/qmp/qerror.h" #include "qapi/error.h" #include "sev_i386.h" @@ -52,9 +53,9 @@ int sev_es_save_reset_vector(void *flash_ptr, uint64_t flash_size) g_assert_not_reached(); } -SevAttestationReport *sev_get_attestation_report(const char *mnonce, - Error **errp) +SevAttestationReport *qmp_query_sev_attestation_report(const char *mnonce, + Error **errp) { - error_setg(errp, "SEV is not available in this QEMU"); + error_setg(errp, QERR_UNSUPPORTED); return NULL; } diff --git a/target/i386/sev.c b/target/i386/sev.c index aefbef4bb63..91a217bbb85 100644 --- a/target/i386/sev.c +++ b/target/i386/sev.c @@ -31,6 +31,8 @@ #include "migration/blocker.h" #include "qom/object.h" #include "monitor/monitor.h" +#include "qapi/qapi-commands-misc-target.h" +#include "qapi/qmp/qerror.h" #include "exec/confidential-guest-support.h" #include "hw/i386/pc.h" @@ -487,8 +489,8 @@ out: return cap; } -SevAttestationReport * -sev_get_attestation_report(const char *mnonce, Error **errp) +static SevAttestationReport *sev_get_attestation_report(const char *mnonce, + Error **errp) { struct kvm_sev_attestation_report input = {}; SevAttestationReport *report = NULL; @@ -549,6 +551,12 @@ sev_get_attestation_report(const char *mnonce, Error **errp) return report; } +SevAttestationReport *qmp_query_sev_attestation_report(const char *mnonce, + Error **errp) +{ + return sev_get_attestation_report(mnonce, errp); +} + static int sev_read_file_base64(const char *filename, guchar **data, gsize *len) { From patchwork Sat Oct 2 12:53:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1535650 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=elrNA/5n; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HM6tv3QyHz9t0Y for ; Sat, 2 Oct 2021 23:16:23 +1000 (AEST) Received: from localhost ([::1]:46654 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mWesH-00088o-9a for incoming@patchwork.ozlabs.org; Sat, 02 Oct 2021 09:16:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33336) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mWeXA-0001yh-Pw for qemu-devel@nongnu.org; Sat, 02 Oct 2021 08:54:33 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:23989) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mWeX8-0000vT-IU for qemu-devel@nongnu.org; Sat, 02 Oct 2021 08:54:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633179270; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MFPED/lWL7McgnfaLMNLaFFcTGfU944hsrHyvaxNr8c=; b=elrNA/5n3qpS8hFD1pJVQ+uCmaTrTB1sWENsYLHh3ooEekyrgXwUtyDOX+4UOr+lvGzt/w Zsxc3/QEkjP/RxLlCqJkrT86R+TjM/+eW4KokvT/rtbCrCE9HnoC4MIEn2AGmQY8suzAvo r9kiaZXBd5JYFtSjZ7gIupvoNFAWI2I= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-299-tnPiqOHpO_iPvYhsOQ9Dug-1; Sat, 02 Oct 2021 08:54:29 -0400 X-MC-Unique: tnPiqOHpO_iPvYhsOQ9Dug-1 Received: by mail-wm1-f69.google.com with SMTP id m2-20020a05600c3b0200b0030cd1310631so3791524wms.7 for ; Sat, 02 Oct 2021 05:54:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=MFPED/lWL7McgnfaLMNLaFFcTGfU944hsrHyvaxNr8c=; b=DjM1qPA0xsxa/kisxudAdMNC6mCMZ+Cs5zb+NxC5cmoTp4bFjyfD09cZgpp/4slnVx XzU2C6blQ9Zjv8zLU4AEhDbqdE2kf8lVikpYtfOA6fNtDEJw/7Gxa2F1eWFZgZAoSR3m mSljk3Kd7ys8fe6eLAeqp7oL9bkus2ZZvNmQHeohrBWOvn11/Rq1X0oEy76HFrsBFsng bNap5geURKl41MEFZERv2uUvyQXEY/DNhDUZbY788zXJ6cWJQMQHeFH4Ixhwh6eX1Qol 3DNvQUzbIH6CZtC6y0CdYEjv8owBxpFDrqHOPzI/KjBxCvxJ018dm7zVxWj+eulAaYdV g0rw== X-Gm-Message-State: AOAM532Vkk+nj7NSi50ngDx3BEUa3Ej42OR6B58aGPrbjOlK7hasMglW WFrVVd5SqO1p9Ba872zmkMbxx0n34gKkJ5qz0sZu0x46puXNJIAXBd3WvH41V8Yfs4dNypwf6h4 TNjHGce8+EPin+nv2h+HPWXwSuem+pP/Suncbs7g8/gdWbFqT6USeT/pIC8rG1EkU X-Received: by 2002:a5d:608e:: with SMTP id w14mr3315480wrt.119.1633179267235; Sat, 02 Oct 2021 05:54:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx1NL6M/YsdfSGb125vbKkdnK0ovBHXMOfTrj0Zv4qPiwD4uvPRl8NF6jMFLf6uS8Tsr9ze6A== X-Received: by 2002:a5d:608e:: with SMTP id w14mr3315454wrt.119.1633179266991; Sat, 02 Oct 2021 05:54:26 -0700 (PDT) Received: from x1w.. (118.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.118]) by smtp.gmail.com with ESMTPSA id j7sm9971641wrr.27.2021.10.02.05.54.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Oct 2021 05:54:26 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v3 15/22] target/i386/sev: Move qmp_sev_inject_launch_secret() to sev.c Date: Sat, 2 Oct 2021 14:53:10 +0200 Message-Id: <20211002125317.3418648-16-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211002125317.3418648-1-philmd@redhat.com> References: <20211002125317.3418648-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Brijesh Singh , kvm@vger.kernel.org, Sergio Lopez , James Bottomley , "Dr . David Alan Gilbert" , Dov Murik , "Daniel P . Berrange" , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Eduardo Habkost Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Move qmp_sev_inject_launch_secret() from monitor.c to sev.c and make sev_inject_launch_secret() static. We don't need the stub anymore, remove it. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Paolo Bonzini --- target/i386/monitor.c | 31 ------------------------------- target/i386/sev-sysemu-stub.c | 6 +++--- target/i386/sev.c | 31 +++++++++++++++++++++++++++++++ 3 files changed, 34 insertions(+), 34 deletions(-) diff --git a/target/i386/monitor.c b/target/i386/monitor.c index c05d70252a2..188203da6f2 100644 --- a/target/i386/monitor.c +++ b/target/i386/monitor.c @@ -733,37 +733,6 @@ SevCapability *qmp_query_sev_capabilities(Error **errp) return sev_get_capabilities(errp); } -#define SEV_SECRET_GUID "4c2eb361-7d9b-4cc3-8081-127c90d3d294" -struct sev_secret_area { - uint32_t base; - uint32_t size; -}; - -void qmp_sev_inject_launch_secret(const char *packet_hdr, - const char *secret, - bool has_gpa, uint64_t gpa, - Error **errp) -{ - if (!sev_enabled()) { - error_setg(errp, QERR_UNSUPPORTED); - return; - } - if (!has_gpa) { - uint8_t *data; - struct sev_secret_area *area; - - if (!pc_system_ovmf_table_find(SEV_SECRET_GUID, &data, NULL)) { - error_setg(errp, "SEV: no secret area found in OVMF," - " gpa must be specified."); - return; - } - area = (struct sev_secret_area *)data; - gpa = area->base; - } - - sev_inject_launch_secret(packet_hdr, secret, gpa, errp); -} - SGXInfo *qmp_query_sgx(Error **errp) { return sgx_get_info(errp); diff --git a/target/i386/sev-sysemu-stub.c b/target/i386/sev-sysemu-stub.c index 813b9a6a03b..66b69540aa5 100644 --- a/target/i386/sev-sysemu-stub.c +++ b/target/i386/sev-sysemu-stub.c @@ -33,10 +33,10 @@ SevCapability *sev_get_capabilities(Error **errp) return NULL; } -int sev_inject_launch_secret(const char *hdr, const char *secret, - uint64_t gpa, Error **errp) +void qmp_sev_inject_launch_secret(const char *packet_header, const char *secret, + bool has_gpa, uint64_t gpa, Error **errp) { - return 1; + error_setg(errp, QERR_UNSUPPORTED); } int sev_encrypt_flash(uint8_t *ptr, uint64_t len, Error **errp) diff --git a/target/i386/sev.c b/target/i386/sev.c index 91a217bbb85..2198d550be2 100644 --- a/target/i386/sev.c +++ b/target/i386/sev.c @@ -949,6 +949,37 @@ int sev_inject_launch_secret(const char *packet_hdr, const char *secret, return 0; } +#define SEV_SECRET_GUID "4c2eb361-7d9b-4cc3-8081-127c90d3d294" +struct sev_secret_area { + uint32_t base; + uint32_t size; +}; + +void qmp_sev_inject_launch_secret(const char *packet_hdr, + const char *secret, + bool has_gpa, uint64_t gpa, + Error **errp) +{ + if (!sev_enabled()) { + error_setg(errp, QERR_UNSUPPORTED); + return; + } + if (!has_gpa) { + uint8_t *data; + struct sev_secret_area *area; + + if (!pc_system_ovmf_table_find(SEV_SECRET_GUID, &data, NULL)) { + error_setg(errp, "SEV: no secret area found in OVMF," + " gpa must be specified."); + return; + } + area = (struct sev_secret_area *)data; + gpa = area->base; + } + + sev_inject_launch_secret(packet_hdr, secret, gpa, errp); +} + static int sev_es_parse_reset_block(SevInfoBlock *info, uint32_t *addr) { From patchwork Sat Oct 2 12:53:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1535642 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=IlPgud7C; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HM6jt3YQmz9t0J for ; Sat, 2 Oct 2021 23:08:34 +1000 (AEST) Received: from localhost ([::1]:60050 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mWeki-0006Pw-AI for incoming@patchwork.ozlabs.org; Sat, 02 Oct 2021 09:08:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33350) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mWeXE-000237-3G for qemu-devel@nongnu.org; Sat, 02 Oct 2021 08:54:36 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:40426) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mWeXC-0000wa-Ks for qemu-devel@nongnu.org; Sat, 02 Oct 2021 08:54:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633179274; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=h6tz1pzz/4VduuxUJcTVLKl1Lh7BOZFtJinbrllV/PI=; b=IlPgud7CN/KA9MvgNbY6QcMz5e2pN72c5L/kh8qcbWC453AzpXyMQz/YYpPKZ6WfGOb/sb jjwfXozqaZDqz7CJgL3IZwgxiJmjSBdnAf4nufTNFxrpRWCqo8gFYT+Wn3cjQ4UvIvagtt McFag+hot0WtQg8TJY1VKt8MefAgQLM= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-388-luase3KiP4iE1V1nbSsBzw-1; Sat, 02 Oct 2021 08:54:33 -0400 X-MC-Unique: luase3KiP4iE1V1nbSsBzw-1 Received: by mail-wm1-f72.google.com with SMTP id x3-20020a05600c21c300b0030d2b0fb3b4so4597746wmj.5 for ; Sat, 02 Oct 2021 05:54:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=h6tz1pzz/4VduuxUJcTVLKl1Lh7BOZFtJinbrllV/PI=; b=TUd+/SZwrzzzkk4HC3U9+s/wCnbij1RtpXkQVBqSQIzR7LcgPB5350RfscYgUVrt7g n85nKtklzNiEt1wmJb7+itBfNXUTNI69m+C19CZVwJy+J/M13phApSaVvRscYVyMdP48 KqShu+fbtrIrkHcsE6wqqhBNfTb4mQbbU6iM3A2MkAhi3ZIfR9yrKmVIgpLCc03i1Rif Ojj2Iu8j2qLNbGlNP0bCaPdsLSdyx7ilo3+iMn0rvriUoA0wsWxVhgy0kClOahEP4FlD ftLvJyGeNZa/Rul9vrbYHGIlPkkfg4SzzoW8SKWxBMLrUkMUnxUSEKPYZvMs3fmnamjr EzVQ== X-Gm-Message-State: AOAM533MY0amDmZ7FhPM8WQMuW2+gHxIxZeEfEIq1FQ6026zXsr3tWul kCM1/zwxebay6kuKCr1neoJyhSTn/N0jyC+fClXUhVsEMJnfD1YzAWYsUL3Nj/L5Vkr51JB+clZ 6E6DKH9oNEDk4QVNZWfSRzOE0cKwmhqjCzIjJI7YFu+6wh7/ZcZY8bux2FJoklXrH X-Received: by 2002:adf:b311:: with SMTP id j17mr3202023wrd.340.1633179271744; Sat, 02 Oct 2021 05:54:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyu9v9AoE33m8O4FuueDOzXS5cpHqzVSB1CjLXdyosJZ9VfYPRTPpP3kB+NiZ18zNjZf4Yvsw== X-Received: by 2002:adf:b311:: with SMTP id j17mr3201997wrd.340.1633179271459; Sat, 02 Oct 2021 05:54:31 -0700 (PDT) Received: from x1w.. (118.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.118]) by smtp.gmail.com with ESMTPSA id l25sm8457300wmi.29.2021.10.02.05.54.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Oct 2021 05:54:31 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v3 16/22] target/i386/sev: Move qmp_query_sev_capabilities() to sev.c Date: Sat, 2 Oct 2021 14:53:11 +0200 Message-Id: <20211002125317.3418648-17-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211002125317.3418648-1-philmd@redhat.com> References: <20211002125317.3418648-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=170.10.133.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Brijesh Singh , kvm@vger.kernel.org, Sergio Lopez , James Bottomley , "Dr . David Alan Gilbert" , Dov Murik , "Daniel P . Berrange" , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Eduardo Habkost Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Move qmp_query_sev_capabilities() from monitor.c to sev.c and make sev_get_capabilities() static. We don't need the stub anymore, remove it. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Paolo Bonzini --- target/i386/sev_i386.h | 1 - target/i386/monitor.c | 5 ----- target/i386/sev-sysemu-stub.c | 4 ++-- target/i386/sev.c | 8 ++++++-- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/target/i386/sev_i386.h b/target/i386/sev_i386.h index 5f367f78eb7..8d9388d8c5c 100644 --- a/target/i386/sev_i386.h +++ b/target/i386/sev_i386.h @@ -26,7 +26,6 @@ extern SevInfo *sev_get_info(void); extern char *sev_get_launch_measurement(void); -extern SevCapability *sev_get_capabilities(Error **errp); int sev_encrypt_flash(uint8_t *ptr, uint64_t len, Error **errp); int sev_inject_launch_secret(const char *hdr, const char *secret, diff --git a/target/i386/monitor.c b/target/i386/monitor.c index 188203da6f2..da36522fa15 100644 --- a/target/i386/monitor.c +++ b/target/i386/monitor.c @@ -728,11 +728,6 @@ SevLaunchMeasureInfo *qmp_query_sev_launch_measure(Error **errp) return info; } -SevCapability *qmp_query_sev_capabilities(Error **errp) -{ - return sev_get_capabilities(errp); -} - SGXInfo *qmp_query_sgx(Error **errp) { return sgx_get_info(errp); diff --git a/target/i386/sev-sysemu-stub.c b/target/i386/sev-sysemu-stub.c index 66b69540aa5..cc486a1afbe 100644 --- a/target/i386/sev-sysemu-stub.c +++ b/target/i386/sev-sysemu-stub.c @@ -27,9 +27,9 @@ char *sev_get_launch_measurement(void) return NULL; } -SevCapability *sev_get_capabilities(Error **errp) +SevCapability *qmp_query_sev_capabilities(Error **errp) { - error_setg(errp, "SEV is not available in this QEMU"); + error_setg(errp, QERR_UNSUPPORTED); return NULL; } diff --git a/target/i386/sev.c b/target/i386/sev.c index 2198d550be2..fce007d6749 100644 --- a/target/i386/sev.c +++ b/target/i386/sev.c @@ -438,8 +438,7 @@ e_free: return 1; } -SevCapability * -sev_get_capabilities(Error **errp) +static SevCapability *sev_get_capabilities(Error **errp) { SevCapability *cap = NULL; guchar *pdh_data = NULL; @@ -489,6 +488,11 @@ out: return cap; } +SevCapability *qmp_query_sev_capabilities(Error **errp) +{ + return sev_get_capabilities(errp); +} + static SevAttestationReport *sev_get_attestation_report(const char *mnonce, Error **errp) { From patchwork Sat Oct 2 12:53:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1535643 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=D8Qn+Kgf; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HM6nL63Lqz9t0J for ; Sat, 2 Oct 2021 23:11:34 +1000 (AEST) Received: from localhost ([::1]:37918 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mWenc-000265-Mb for incoming@patchwork.ozlabs.org; Sat, 02 Oct 2021 09:11:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33376) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mWeXJ-0002AA-6v for qemu-devel@nongnu.org; Sat, 02 Oct 2021 08:54:41 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:40959) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mWeXH-0000yb-3U for qemu-devel@nongnu.org; Sat, 02 Oct 2021 08:54:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633179278; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0nKTjzIKPyPIMBpHVM/tD1diKI5Lwbe51EbfE5s5an0=; b=D8Qn+KgffYy5o7SjXAfU6hwJce5qS9uGRGHo/Y09Gl20tbCOW32GfGVu9Pp4Ath0RJYGBK SF8SoHev4t28BRtLG7MMajx3oeZFPZHeRV/IM03+F9qAu8x7LxkXhKBW/eVH+SjNpzxDtM DsFRQU5wbZAlxoS5XKgfLDXi7KqCoqs= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-194-B_Iz9WPBP5acuEURJf-ksA-1; Sat, 02 Oct 2021 08:54:37 -0400 X-MC-Unique: B_Iz9WPBP5acuEURJf-ksA-1 Received: by mail-wm1-f70.google.com with SMTP id r66-20020a1c4445000000b0030cf0c97157so6085499wma.1 for ; Sat, 02 Oct 2021 05:54:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=0nKTjzIKPyPIMBpHVM/tD1diKI5Lwbe51EbfE5s5an0=; b=u8flLCi26RmZXcBb8AF62iBZuQFlmvc4eLI9Z7+zEvhxMlsYoSUqRjzLehXfWoAr+C EsTEG4E6HB7PM+sXgStZFIUGXWjEWQuGpjsvx/BRd1EHEPkndCkz1UWmQbvg8vJKvipG hv9f3SFJeIde6+cUNv8M6/RyC1gm2ZR6XrvX47Fq4Lo9FLa48S/cvBnOGS4fE3K7jwfa +dWxO7gCU4gFXYr9yIOB1ZXN+Va8NEpgcqNU9USoqHLV3d/VhR6ezMWsmu0AWVCuiTJ6 9LeR9WJbQlo5AXZ51Ll+aUPPOvrHUZhbFEx2yMoydUhckjQmujAHMy8r6sk3N+65AVp8 SIug== X-Gm-Message-State: AOAM532AkDtFWIFPcemb/PsQVg5hoZtvdNyan03rg6Idgq6E+So3fdLp /8N6meLvLJzHQ7xuQ5thjYuHtpz0U8H3tpqYRomhw9i09wcbbrf3Pzl1boovCwxyx3JSZkWXP8i pmYuyo/khNHhKrIKIqxNocxQYy3D2JV1BcRG0JmWSgD5wTfHEHkC/DiRArNr4HrNT X-Received: by 2002:adf:a4cf:: with SMTP id h15mr3355724wrb.56.1633179276073; Sat, 02 Oct 2021 05:54:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyE7Ld4d7xRxNwNhximLYRSqvfEbRdkNWVwkt+fYHrToiPZNRg70XquUCHdmcVJ53wdpAfvzQ== X-Received: by 2002:adf:a4cf:: with SMTP id h15mr3355700wrb.56.1633179275866; Sat, 02 Oct 2021 05:54:35 -0700 (PDT) Received: from x1w.. (118.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.118]) by smtp.gmail.com with ESMTPSA id y15sm1796812wrp.44.2021.10.02.05.54.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Oct 2021 05:54:35 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v3 17/22] target/i386/sev: Move qmp_query_sev_launch_measure() to sev.c Date: Sat, 2 Oct 2021 14:53:12 +0200 Message-Id: <20211002125317.3418648-18-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211002125317.3418648-1-philmd@redhat.com> References: <20211002125317.3418648-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=170.10.133.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Brijesh Singh , kvm@vger.kernel.org, Sergio Lopez , James Bottomley , "Dr . David Alan Gilbert" , Dov Murik , "Daniel P . Berrange" , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Eduardo Habkost Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Move qmp_query_sev_launch_measure() from monitor.c to sev.c and make sev_get_launch_measurement() static. We don't need the stub anymore, remove it. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Paolo Bonzini --- target/i386/sev_i386.h | 1 - target/i386/monitor.c | 17 ----------------- target/i386/sev-sysemu-stub.c | 3 ++- target/i386/sev.c | 20 ++++++++++++++++++-- 4 files changed, 20 insertions(+), 21 deletions(-) diff --git a/target/i386/sev_i386.h b/target/i386/sev_i386.h index 8d9388d8c5c..1699376ad87 100644 --- a/target/i386/sev_i386.h +++ b/target/i386/sev_i386.h @@ -25,7 +25,6 @@ #define SEV_POLICY_SEV 0x20 extern SevInfo *sev_get_info(void); -extern char *sev_get_launch_measurement(void); int sev_encrypt_flash(uint8_t *ptr, uint64_t len, Error **errp); int sev_inject_launch_secret(const char *hdr, const char *secret, diff --git a/target/i386/monitor.c b/target/i386/monitor.c index da36522fa15..0b38e970c73 100644 --- a/target/i386/monitor.c +++ b/target/i386/monitor.c @@ -711,23 +711,6 @@ void hmp_info_sev(Monitor *mon, const QDict *qdict) qapi_free_SevInfo(info); } -SevLaunchMeasureInfo *qmp_query_sev_launch_measure(Error **errp) -{ - char *data; - SevLaunchMeasureInfo *info; - - data = sev_get_launch_measurement(); - if (!data) { - error_setg(errp, "Measurement is not available"); - return NULL; - } - - info = g_malloc0(sizeof(*info)); - info->data = data; - - return info; -} - SGXInfo *qmp_query_sgx(Error **errp) { return sgx_get_info(errp); diff --git a/target/i386/sev-sysemu-stub.c b/target/i386/sev-sysemu-stub.c index cc486a1afbe..355391c16c4 100644 --- a/target/i386/sev-sysemu-stub.c +++ b/target/i386/sev-sysemu-stub.c @@ -22,8 +22,9 @@ SevInfo *sev_get_info(void) return NULL; } -char *sev_get_launch_measurement(void) +SevLaunchMeasureInfo *qmp_query_sev_launch_measure(Error **errp) { + error_setg(errp, QERR_UNSUPPORTED); return NULL; } diff --git a/target/i386/sev.c b/target/i386/sev.c index fce007d6749..8e9cce62196 100644 --- a/target/i386/sev.c +++ b/target/i386/sev.c @@ -718,8 +718,7 @@ free_measurement: g_free(measurement); } -char * -sev_get_launch_measurement(void) +static char *sev_get_launch_measurement(void) { if (sev_guest && sev_guest->state >= SEV_STATE_LAUNCH_SECRET) { @@ -729,6 +728,23 @@ sev_get_launch_measurement(void) return NULL; } +SevLaunchMeasureInfo *qmp_query_sev_launch_measure(Error **errp) +{ + char *data; + SevLaunchMeasureInfo *info; + + data = sev_get_launch_measurement(); + if (!data) { + error_setg(errp, "Measurement is not available"); + return NULL; + } + + info = g_malloc0(sizeof(*info)); + info->data = data; + + return info; +} + static Notifier sev_machine_done_notify = { .notify = sev_launch_get_measure, }; From patchwork Sat Oct 2 12:53:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1535651 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=f9d9n+47; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HM6x95cz6z9t0J for ; Sat, 2 Oct 2021 23:18:21 +1000 (AEST) Received: from localhost ([::1]:50898 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mWeuB-0002qg-IS for incoming@patchwork.ozlabs.org; Sat, 02 Oct 2021 09:18:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33388) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mWeXN-0002ID-Hh for qemu-devel@nongnu.org; Sat, 02 Oct 2021 08:54:46 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:60543) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mWeXL-0000za-Iq for qemu-devel@nongnu.org; Sat, 02 Oct 2021 08:54:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633179283; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zmeHSaAJmvIQWkoqQvBbbph1YlHUwqkxNB0lhULs12o=; b=f9d9n+474myHbdMtMa4nwz4md0QpUXCxUGHaOVPuetXc6otKxKt/bYHNlTXRJ8qqsTXPLk frvg51/TBkyn1j7BSEIOo882wBAZXObDAY8BpmUOyDdKp3k5QjpsNTKh633KyY5MYy7uRa My/uC0YdLsU0DYosPX1CvSrXPu44QG4= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-136-2QSrX-FxNlqO4k0qYi0Wcw-1; Sat, 02 Oct 2021 08:54:42 -0400 X-MC-Unique: 2QSrX-FxNlqO4k0qYi0Wcw-1 Received: by mail-wm1-f72.google.com with SMTP id y142-20020a1c7d94000000b0030cdc76dedeso7349152wmc.5 for ; Sat, 02 Oct 2021 05:54:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=zmeHSaAJmvIQWkoqQvBbbph1YlHUwqkxNB0lhULs12o=; b=Aa2nvQPOIxStZOMbH+gLD/tQ9sZRMdbHlmpSt3PyMPED+Nbr2jsPw1nuD+GKk5a6HY Gh1Efm5TE/zzr1UJiQBs1VGw+UQyDys8A2QDRM8inY+gosEP1QWMah0iKMmBFawoB18I 6fwK49PWlZuyIGcVVEsEjuYBbrvTSrWOncnB0Z5xPte30OZg7e77MCzdM3+dgK3qbZqX IJ9cPK62Jls3JRLhyPlbsMQdW/Hpu/3R3BDUttBkK5gkf0DSHvrKFuL8K9RBSndGoyN5 0uzzJv5l3GzWhnb2BH4Bs/IKw/UpmpLIiRVpO8bnzZq3ISMuswkYczoLfbYlRAG9GYsN /Kdg== X-Gm-Message-State: AOAM531FKFUnHOy89YRnVkWlDZ0qeQ+dcSZcgw7ywXopju+aVeUBfFmi +qW/sdHu0C21YXM8vIsnM8P5NSeZhVWEZLMKEqZyrH7gpln2nGBK3jO2gudS4H+BGF7nchxiESo pVUwr84POvxYjpWbX1o/V1h5c04lQ5Yqld6YT9PladqApVB1S7ZF46WWOkCuwwnWT X-Received: by 2002:a1c:7302:: with SMTP id d2mr9391316wmb.92.1633179280687; Sat, 02 Oct 2021 05:54:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzgPMBEpdCmd98sav+qHs899wgnlAFISSby1vK2IYSyDBW7M/2t9a3jNO0u1D6NgduWenHWdg== X-Received: by 2002:a1c:7302:: with SMTP id d2mr9391291wmb.92.1633179280396; Sat, 02 Oct 2021 05:54:40 -0700 (PDT) Received: from x1w.. (118.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.118]) by smtp.gmail.com with ESMTPSA id m29sm8762685wrb.89.2021.10.02.05.54.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Oct 2021 05:54:40 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v3 18/22] target/i386/sev: Move qmp_query_sev() & hmp_info_sev() to sev.c Date: Sat, 2 Oct 2021 14:53:13 +0200 Message-Id: <20211002125317.3418648-19-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211002125317.3418648-1-philmd@redhat.com> References: <20211002125317.3418648-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=170.10.133.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Brijesh Singh , kvm@vger.kernel.org, Sergio Lopez , James Bottomley , "Dr . David Alan Gilbert" , Dov Murik , "Daniel P . Berrange" , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Eduardo Habkost Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Move qmp_query_sev() & hmp_info_sev()() from monitor.c to sev.c and make sev_get_info() static. We don't need the stub anymore, remove it. Add a stub for hmp_info_sev(). Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Paolo Bonzini --- target/i386/sev_i386.h | 3 --- target/i386/monitor.c | 38 +--------------------------------- target/i386/sev-sysemu-stub.c | 10 ++++++++- target/i386/sev.c | 39 +++++++++++++++++++++++++++++++++-- 4 files changed, 47 insertions(+), 43 deletions(-) diff --git a/target/i386/sev_i386.h b/target/i386/sev_i386.h index 1699376ad87..15a959d6174 100644 --- a/target/i386/sev_i386.h +++ b/target/i386/sev_i386.h @@ -15,7 +15,6 @@ #define QEMU_SEV_I386_H #include "sysemu/sev.h" -#include "qapi/qapi-types-misc-target.h" #define SEV_POLICY_NODBG 0x1 #define SEV_POLICY_NOKS 0x2 @@ -24,8 +23,6 @@ #define SEV_POLICY_DOMAIN 0x10 #define SEV_POLICY_SEV 0x20 -extern SevInfo *sev_get_info(void); - int sev_encrypt_flash(uint8_t *ptr, uint64_t len, Error **errp); int sev_inject_launch_secret(const char *hdr, const char *secret, uint64_t gpa, Error **errp); diff --git a/target/i386/monitor.c b/target/i386/monitor.c index 0b38e970c73..890870b252d 100644 --- a/target/i386/monitor.c +++ b/target/i386/monitor.c @@ -28,11 +28,9 @@ #include "monitor/hmp-target.h" #include "monitor/hmp.h" #include "qapi/qmp/qdict.h" -#include "qapi/qmp/qerror.h" +//#include "qapi/qmp/qerror.h" #include "sysemu/kvm.h" -#include "sysemu/sev.h" #include "qapi/error.h" -#include "sev_i386.h" #include "qapi/qapi-commands-misc-target.h" #include "qapi/qapi-commands-misc.h" #include "hw/i386/pc.h" @@ -677,40 +675,6 @@ void hmp_info_io_apic(Monitor *mon, const QDict *qdict) "removed soon. Please use 'info pic' instead.\n"); } -SevInfo *qmp_query_sev(Error **errp) -{ - SevInfo *info; - - info = sev_get_info(); - if (!info) { - error_setg(errp, "SEV feature is not available"); - return NULL; - } - - return info; -} - -void hmp_info_sev(Monitor *mon, const QDict *qdict) -{ - SevInfo *info = sev_get_info(); - - if (info && info->enabled) { - monitor_printf(mon, "handle: %d\n", info->handle); - monitor_printf(mon, "state: %s\n", SevState_str(info->state)); - monitor_printf(mon, "build: %d\n", info->build_id); - monitor_printf(mon, "api version: %d.%d\n", - info->api_major, info->api_minor); - monitor_printf(mon, "debug: %s\n", - info->policy & SEV_POLICY_NODBG ? "off" : "on"); - monitor_printf(mon, "key-sharing: %s\n", - info->policy & SEV_POLICY_NOKS ? "off" : "on"); - } else { - monitor_printf(mon, "SEV is not enabled\n"); - } - - qapi_free_SevInfo(info); -} - SGXInfo *qmp_query_sgx(Error **errp) { return sgx_get_info(errp); diff --git a/target/i386/sev-sysemu-stub.c b/target/i386/sev-sysemu-stub.c index 355391c16c4..1836b32e4fc 100644 --- a/target/i386/sev-sysemu-stub.c +++ b/target/i386/sev-sysemu-stub.c @@ -12,13 +12,16 @@ */ #include "qemu/osdep.h" +#include "monitor/monitor.h" +#include "monitor/hmp.h" #include "qapi/qapi-commands-misc-target.h" #include "qapi/qmp/qerror.h" #include "qapi/error.h" #include "sev_i386.h" -SevInfo *sev_get_info(void) +SevInfo *qmp_query_sev(Error **errp) { + error_setg(errp, QERR_UNSUPPORTED); return NULL; } @@ -60,3 +63,8 @@ SevAttestationReport *qmp_query_sev_attestation_report(const char *mnonce, error_setg(errp, QERR_UNSUPPORTED); return NULL; } + +void hmp_info_sev(Monitor *mon, const QDict *qdict) +{ + monitor_printf(mon, "SEV is not available in this QEMU\n"); +} diff --git a/target/i386/sev.c b/target/i386/sev.c index 8e9cce62196..7caaa117ff7 100644 --- a/target/i386/sev.c +++ b/target/i386/sev.c @@ -27,10 +27,12 @@ #include "sev_i386.h" #include "sysemu/sysemu.h" #include "sysemu/runstate.h" +#include "sysemu/sev.h" #include "trace.h" #include "migration/blocker.h" #include "qom/object.h" #include "monitor/monitor.h" +#include "monitor/hmp.h" #include "qapi/qapi-commands-misc-target.h" #include "qapi/qmp/qerror.h" #include "exec/confidential-guest-support.h" @@ -375,8 +377,7 @@ sev_get_reduced_phys_bits(void) return sev_guest ? sev_guest->reduced_phys_bits : 0; } -SevInfo * -sev_get_info(void) +static SevInfo *sev_get_info(void) { SevInfo *info; @@ -395,6 +396,40 @@ sev_get_info(void) return info; } +SevInfo *qmp_query_sev(Error **errp) +{ + SevInfo *info; + + info = sev_get_info(); + if (!info) { + error_setg(errp, "SEV feature is not available"); + return NULL; + } + + return info; +} + +void hmp_info_sev(Monitor *mon, const QDict *qdict) +{ + SevInfo *info = sev_get_info(); + + if (info && info->enabled) { + monitor_printf(mon, "handle: %d\n", info->handle); + monitor_printf(mon, "state: %s\n", SevState_str(info->state)); + monitor_printf(mon, "build: %d\n", info->build_id); + monitor_printf(mon, "api version: %d.%d\n", + info->api_major, info->api_minor); + monitor_printf(mon, "debug: %s\n", + info->policy & SEV_POLICY_NODBG ? "off" : "on"); + monitor_printf(mon, "key-sharing: %s\n", + info->policy & SEV_POLICY_NOKS ? "off" : "on"); + } else { + monitor_printf(mon, "SEV is not enabled\n"); + } + + qapi_free_SevInfo(info); +} + static int sev_get_pdh_info(int fd, guchar **pdh, size_t *pdh_len, guchar **cert_chain, size_t *cert_chain_len, Error **errp) From patchwork Sat Oct 2 12:53:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1535634 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=fVsltZ6H; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HM6W873TZz9t0J for ; Sat, 2 Oct 2021 22:59:16 +1000 (AEST) Received: from localhost ([::1]:38882 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mWebi-0000Nv-Oy for incoming@patchwork.ozlabs.org; Sat, 02 Oct 2021 08:59:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33400) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mWeXR-0002SW-Cs for qemu-devel@nongnu.org; Sat, 02 Oct 2021 08:54:49 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:32273) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mWeXP-00010W-RU for qemu-devel@nongnu.org; Sat, 02 Oct 2021 08:54:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633179287; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WyR/eNCtMhabJTiJL4KYPQfagO3ysZNetDQfcxieNmI=; b=fVsltZ6HffjC1hd7tmQU6T9GQyrwvL4MAOyBjfoUhvwkNh5jg49dTbrlb6cneTMLejizPX 6QakBJQu4NqoT+E6lCPMRXN2sSngDGsZYTiZQ/vnvhPKXe6dYfHJcYsDLhEzf9vQsqiDj3 zLfYKk8B/CZqo2Mqs1Um/m+B+x/6upg= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-485-HgLWEliTNb6XRwYnSB9rvQ-1; Sat, 02 Oct 2021 08:54:46 -0400 X-MC-Unique: HgLWEliTNb6XRwYnSB9rvQ-1 Received: by mail-wm1-f70.google.com with SMTP id n17-20020a7bc5d1000000b0030d4041f73eso1968612wmk.4 for ; Sat, 02 Oct 2021 05:54:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=WyR/eNCtMhabJTiJL4KYPQfagO3ysZNetDQfcxieNmI=; b=dkd8bm/1ld+O3b15xeO+ZX+sTTCOF/rtY+1Ffh4fqtX7dpwWj+u1dv7pQ9mELWmXeV WlA6x953VyidmGIWL4aoLFR+YmJOf0uWL5nD0b6ZO3aRYnR9UbCkOHxwUm6Hhwy9AUpM Tj6/cM67cmw94G60Xw3CiS7Nnzb3i9D/gk1ot/liHDVZBsyoJOrqYM8cXNiWGTtG91sr OxhTzPtwRZxEJT40oZxTmDvdm192g7pmaqAJG+U4TAA0E/zdxuCJxUeNucgaBB5bN8c4 /JrFENTf5sjZPZcDiaJoIwUeNkJRQix0R/7XOXKSWtkT8zzNDx4uGhGPI+jr88A09iDZ OVpg== X-Gm-Message-State: AOAM533flnbGAyH5+9iipGD0pWrQ3RA/xHdr89O5NihpuJz10bcCBQ2z u80xB00pfv3/9IuTrZxb/eWsPAdTQffpzA65E0ASWMJMHNygynldzX9V2uXUKBMFjEcpWsHu0zG es/wePTDrsmswo67AuyegMKHfmTuhdSXsamlMxM6cYIWvoCIbSKlhsZXR3hSjvBwI X-Received: by 2002:a5d:44d1:: with SMTP id z17mr3370235wrr.187.1633179285104; Sat, 02 Oct 2021 05:54:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy67yh1G/4H9iMDyZQOpRZdq+m1Nl/19ODGozR8E+nhB1/ZKWnqdXBw6WrBb4+UnlkFrV3bSA== X-Received: by 2002:a5d:44d1:: with SMTP id z17mr3370205wrr.187.1633179284860; Sat, 02 Oct 2021 05:54:44 -0700 (PDT) Received: from x1w.. (118.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.118]) by smtp.gmail.com with ESMTPSA id o12sm8851885wms.15.2021.10.02.05.54.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Oct 2021 05:54:44 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v3 19/22] monitor: Restrict 'info sev' to x86 targets Date: Sat, 2 Oct 2021 14:53:14 +0200 Message-Id: <20211002125317.3418648-20-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211002125317.3418648-1-philmd@redhat.com> References: <20211002125317.3418648-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Brijesh Singh , kvm@vger.kernel.org, Sergio Lopez , James Bottomley , "Dr . David Alan Gilbert" , Dov Murik , "Daniel P . Berrange" , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Eduardo Habkost Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Paolo Bonzini --- include/monitor/hmp-target.h | 1 + include/monitor/hmp.h | 1 - target/i386/sev-sysemu-stub.c | 2 +- target/i386/sev.c | 2 +- 4 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/monitor/hmp-target.h b/include/monitor/hmp-target.h index dc53add7eef..96956d0fc41 100644 --- a/include/monitor/hmp-target.h +++ b/include/monitor/hmp-target.h @@ -49,6 +49,7 @@ void hmp_info_tlb(Monitor *mon, const QDict *qdict); void hmp_mce(Monitor *mon, const QDict *qdict); void hmp_info_local_apic(Monitor *mon, const QDict *qdict); void hmp_info_io_apic(Monitor *mon, const QDict *qdict); +void hmp_info_sev(Monitor *mon, const QDict *qdict); void hmp_info_sgx(Monitor *mon, const QDict *qdict); #endif /* MONITOR_HMP_TARGET_H */ diff --git a/include/monitor/hmp.h b/include/monitor/hmp.h index 3baa1058e2c..6bc27639e01 100644 --- a/include/monitor/hmp.h +++ b/include/monitor/hmp.h @@ -124,7 +124,6 @@ void hmp_info_ramblock(Monitor *mon, const QDict *qdict); void hmp_hotpluggable_cpus(Monitor *mon, const QDict *qdict); void hmp_info_vm_generation_id(Monitor *mon, const QDict *qdict); void hmp_info_memory_size_summary(Monitor *mon, const QDict *qdict); -void hmp_info_sev(Monitor *mon, const QDict *qdict); void hmp_info_replay(Monitor *mon, const QDict *qdict); void hmp_replay_break(Monitor *mon, const QDict *qdict); void hmp_replay_delete_break(Monitor *mon, const QDict *qdict); diff --git a/target/i386/sev-sysemu-stub.c b/target/i386/sev-sysemu-stub.c index 1836b32e4fc..b2a4033a030 100644 --- a/target/i386/sev-sysemu-stub.c +++ b/target/i386/sev-sysemu-stub.c @@ -13,7 +13,7 @@ #include "qemu/osdep.h" #include "monitor/monitor.h" -#include "monitor/hmp.h" +#include "monitor/hmp-target.h" #include "qapi/qapi-commands-misc-target.h" #include "qapi/qmp/qerror.h" #include "qapi/error.h" diff --git a/target/i386/sev.c b/target/i386/sev.c index 7caaa117ff7..c6d8fc52eb2 100644 --- a/target/i386/sev.c +++ b/target/i386/sev.c @@ -32,7 +32,7 @@ #include "migration/blocker.h" #include "qom/object.h" #include "monitor/monitor.h" -#include "monitor/hmp.h" +#include "monitor/hmp-target.h" #include "qapi/qapi-commands-misc-target.h" #include "qapi/qmp/qerror.h" #include "exec/confidential-guest-support.h" From patchwork Sat Oct 2 12:53:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1535652 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=YEUy/6OP; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HM6zj0qcGz9t0J for ; Sat, 2 Oct 2021 23:20:33 +1000 (AEST) Received: from localhost ([::1]:55050 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mWewI-0005fM-T8 for incoming@patchwork.ozlabs.org; Sat, 02 Oct 2021 09:20:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33416) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mWeXW-0002hI-Ap for qemu-devel@nongnu.org; Sat, 02 Oct 2021 08:54:56 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:41905) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mWeXU-00012D-Cq for qemu-devel@nongnu.org; Sat, 02 Oct 2021 08:54:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633179291; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wGfA2j80SC2+4aGulWQ/r67RC6gVnbvOoez6cQaSfN0=; b=YEUy/6OPAksONY4PQ1DSGwJiZ4MiNHxrSmsTpP85GrC3lVugohYOR9vrp5dB8Xvb7YuCOn YboVzre+Y2Mb/0QbjZqYyK5cULIea54hQJc0NLJAxp3Sq2+WIVq47oATUMszNh8nZnKjZf NT9AhR4ZRuNUIuqC0nHZg2tlqz3k+NA= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-549-Q8Z66hWMNVihhSCidPm92w-1; Sat, 02 Oct 2021 08:54:51 -0400 X-MC-Unique: Q8Z66hWMNVihhSCidPm92w-1 Received: by mail-wm1-f71.google.com with SMTP id j21-20020a05600c1c1500b0030ccce95837so3789610wms.3 for ; Sat, 02 Oct 2021 05:54:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=wGfA2j80SC2+4aGulWQ/r67RC6gVnbvOoez6cQaSfN0=; b=C2izfzkYsAL0dXk2lmlf23fMj8w4I5pwHJ4bJ0RHtxdOnZYKm9bZIQHaOwiSQ6szBk FRa9oaPFCU1VeT9ICGCrPmKCIuQ3fh1z0wFXFVF13eJG+Y/sCyHXTYfFxHvYudS3llQc nedOnvaS10WYDX6+KAzXF3JKbOex4nAk3hgPCmylW/IxusdU7/4w9v0EJ2cwsZrI5tMt Q+O4BFhNUBdh8H2m5F8vbPw6jVeTwQrNJ+lszvDlRdYVXX/DoBsB/dVnZgvkOP7giQY6 6FMtirs9xjuvbNwmVcivnYihpwNG6CuvJDPaLsyyXNDRJAgRuqEPyCYCiPoygxbQbV4/ +RZw== X-Gm-Message-State: AOAM53376i6WrlTrCpzJccz8MYCsA/ASeZWw6Dg0wqRz6/2agFh5PaqD Y0ijaneAYcXoL60x9uqXXNoRoGuyYf/gTVgXX5XUupsNzX+f7/Bxns48mhQbAo3+xTjOC4OB4Ex PCOOfMZXw2SjddUEYIr5DYlugv/GYAtR+6t1C8+5kIfWXbdrd4XhtKlVrzqcuWCD1 X-Received: by 2002:adf:cf10:: with SMTP id o16mr3263921wrj.12.1633179289692; Sat, 02 Oct 2021 05:54:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwIlAGUzy37xRAc3wO3Jx5AvnPpGg0GVEAXuua31avnpgtYrsVxayrEFINAr8sZqcOzoicXYw== X-Received: by 2002:adf:cf10:: with SMTP id o16mr3263894wrj.12.1633179289485; Sat, 02 Oct 2021 05:54:49 -0700 (PDT) Received: from x1w.. (118.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.118]) by smtp.gmail.com with ESMTPSA id z5sm13146962wmp.26.2021.10.02.05.54.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Oct 2021 05:54:49 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v3 20/22] sev/i386: Introduce sev_add_kernel_loader_hashes for measured linux boot Date: Sat, 2 Oct 2021 14:53:15 +0200 Message-Id: <20211002125317.3418648-21-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211002125317.3418648-1-philmd@redhat.com> References: <20211002125317.3418648-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Brijesh Singh , kvm@vger.kernel.org, Sergio Lopez , James Bottomley , "Dr . David Alan Gilbert" , Dov Murik , "Daniel P . Berrange" , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Eduardo Habkost Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Dov Murik Add the sev_add_kernel_loader_hashes function to calculate the hashes of the kernel/initrd/cmdline and fill a designated OVMF encrypted hash table area. For this to work, OVMF must support an encrypted area to place the data which is advertised via a special GUID in the OVMF reset table. The hashes of each of the files is calculated (or the string in the case of the cmdline with trailing '\0' included). Each entry in the hashes table is GUID identified and since they're passed through the sev_encrypt_flash interface, the hashes will be accumulated by the AMD PSP measurement (SEV_LAUNCH_MEASURE). Co-developed-by: James Bottomley Signed-off-by: James Bottomley Signed-off-by: Dov Murik Reviewed-by: Daniel P. Berrangé Message-Id: <20210930054915.13252-2-dovmurik@linux.ibm.com> [PMD: Rebased on top of 0021c4765a6] Signed-off-by: Philippe Mathieu-Daudé --- target/i386/sev_i386.h | 12 ++++ target/i386/sev.c | 138 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 150 insertions(+) diff --git a/target/i386/sev_i386.h b/target/i386/sev_i386.h index 15a959d6174..17031cddd37 100644 --- a/target/i386/sev_i386.h +++ b/target/i386/sev_i386.h @@ -23,9 +23,21 @@ #define SEV_POLICY_DOMAIN 0x10 #define SEV_POLICY_SEV 0x20 +typedef struct SevKernelLoaderContext { + char *setup_data; + size_t setup_size; + char *kernel_data; + size_t kernel_size; + char *initrd_data; + size_t initrd_size; + char *cmdline_data; + size_t cmdline_size; +} SevKernelLoaderContext; + int sev_encrypt_flash(uint8_t *ptr, uint64_t len, Error **errp); int sev_inject_launch_secret(const char *hdr, const char *secret, uint64_t gpa, Error **errp); +bool sev_add_kernel_loader_hashes(SevKernelLoaderContext *ctx, Error **errp); int sev_es_save_reset_vector(void *flash_ptr, uint64_t flash_size); void sev_es_set_reset_vector(CPUState *cpu); diff --git a/target/i386/sev.c b/target/i386/sev.c index c6d8fc52eb2..91fdf0d4503 100644 --- a/target/i386/sev.c +++ b/target/i386/sev.c @@ -23,6 +23,7 @@ #include "qemu/base64.h" #include "qemu/module.h" #include "qemu/uuid.h" +#include "crypto/hash.h" #include "sysemu/kvm.h" #include "sev_i386.h" #include "sysemu/sysemu.h" @@ -86,6 +87,32 @@ typedef struct __attribute__((__packed__)) SevInfoBlock { uint32_t reset_addr; } SevInfoBlock; +#define SEV_HASH_TABLE_RV_GUID "7255371f-3a3b-4b04-927b-1da6efa8d454" +typedef struct QEMU_PACKED SevHashTableDescriptor { + /* SEV hash table area guest address */ + uint32_t base; + /* SEV hash table area size (in bytes) */ + uint32_t size; +} SevHashTableDescriptor; + +/* hard code sha256 digest size */ +#define HASH_SIZE 32 + +typedef struct QEMU_PACKED SevHashTableEntry { + QemuUUID guid; + uint16_t len; + uint8_t hash[HASH_SIZE]; +} SevHashTableEntry; + +typedef struct QEMU_PACKED SevHashTable { + QemuUUID guid; + uint16_t len; + SevHashTableEntry cmdline; + SevHashTableEntry initrd; + SevHashTableEntry kernel; + uint8_t padding[]; +} SevHashTable; + static SevGuestState *sev_guest; static Error *sev_mig_blocker; @@ -1151,6 +1178,117 @@ int sev_es_save_reset_vector(void *flash_ptr, uint64_t flash_size) return 0; } +static const QemuUUID sev_hash_table_header_guid = { + .data = UUID_LE(0x9438d606, 0x4f22, 0x4cc9, 0xb4, 0x79, 0xa7, 0x93, + 0xd4, 0x11, 0xfd, 0x21) +}; + +static const QemuUUID sev_kernel_entry_guid = { + .data = UUID_LE(0x4de79437, 0xabd2, 0x427f, 0xb8, 0x35, 0xd5, 0xb1, + 0x72, 0xd2, 0x04, 0x5b) +}; +static const QemuUUID sev_initrd_entry_guid = { + .data = UUID_LE(0x44baf731, 0x3a2f, 0x4bd7, 0x9a, 0xf1, 0x41, 0xe2, + 0x91, 0x69, 0x78, 0x1d) +}; +static const QemuUUID sev_cmdline_entry_guid = { + .data = UUID_LE(0x97d02dd8, 0xbd20, 0x4c94, 0xaa, 0x78, 0xe7, 0x71, + 0x4d, 0x36, 0xab, 0x2a) +}; + +/* + * Add the hashes of the linux kernel/initrd/cmdline to an encrypted guest page + * which is included in SEV's initial memory measurement. + */ +bool sev_add_kernel_loader_hashes(SevKernelLoaderContext *ctx, Error **errp) +{ + uint8_t *data; + SevHashTableDescriptor *area; + SevHashTable *ht; + uint8_t cmdline_hash[HASH_SIZE]; + uint8_t initrd_hash[HASH_SIZE]; + uint8_t kernel_hash[HASH_SIZE]; + uint8_t *hashp; + size_t hash_len = HASH_SIZE; + int aligned_len; + + if (!pc_system_ovmf_table_find(SEV_HASH_TABLE_RV_GUID, &data, NULL)) { + error_setg(errp, + "SEV: kernel specified but OVMF has no hash table guid"); + return false; + } + area = (SevHashTableDescriptor *)data; + + /* + * Calculate hash of kernel command-line with the terminating null byte. If + * the user doesn't supply a command-line via -append, the 1-byte "\0" will + * be used. + */ + hashp = cmdline_hash; + if (qcrypto_hash_bytes(QCRYPTO_HASH_ALG_SHA256, ctx->cmdline_data, + ctx->cmdline_size, &hashp, &hash_len, errp) < 0) { + return false; + } + assert(hash_len == HASH_SIZE); + + /* + * Calculate hash of initrd. If the user doesn't supply an initrd via + * -initrd, an empty buffer will be used (ctx->initrd_size == 0). + */ + hashp = initrd_hash; + if (qcrypto_hash_bytes(QCRYPTO_HASH_ALG_SHA256, ctx->initrd_data, + ctx->initrd_size, &hashp, &hash_len, errp) < 0) { + return false; + } + assert(hash_len == HASH_SIZE); + + /* Calculate hash of the kernel */ + hashp = kernel_hash; + struct iovec iov[2] = { + { .iov_base = ctx->setup_data, .iov_len = ctx->setup_size }, + { .iov_base = ctx->kernel_data, .iov_len = ctx->kernel_size } + }; + if (qcrypto_hash_bytesv(QCRYPTO_HASH_ALG_SHA256, iov, ARRAY_SIZE(iov), + &hashp, &hash_len, errp) < 0) { + return false; + } + assert(hash_len == HASH_SIZE); + + /* + * Populate the hashes table in the guest's memory at the OVMF-designated + * area for the SEV hashes table + */ + ht = qemu_map_ram_ptr(NULL, area->base); + + ht->guid = sev_hash_table_header_guid; + ht->len = sizeof(*ht); + + ht->cmdline.guid = sev_cmdline_entry_guid; + ht->cmdline.len = sizeof(ht->cmdline); + memcpy(ht->cmdline.hash, cmdline_hash, sizeof(ht->cmdline.hash)); + + ht->initrd.guid = sev_initrd_entry_guid; + ht->initrd.len = sizeof(ht->initrd); + memcpy(ht->initrd.hash, initrd_hash, sizeof(ht->initrd.hash)); + + ht->kernel.guid = sev_kernel_entry_guid; + ht->kernel.len = sizeof(ht->kernel); + memcpy(ht->kernel.hash, kernel_hash, sizeof(ht->kernel.hash)); + + /* When calling sev_encrypt_flash, the length has to be 16 byte aligned */ + aligned_len = ROUND_UP(ht->len, 16); + if (aligned_len != ht->len) { + /* zero the excess data so the measurement can be reliably calculated */ + memset(ht->padding, 0, aligned_len - ht->len); + } + + if (sev_encrypt_flash((uint8_t *)ht, aligned_len, errp) < 0) { + return false; + } + + return true; +} + static void sev_register_types(void) { From patchwork Sat Oct 2 12:53:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1535647 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=JqroPGK+; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HM6qh0QMnz9t0Y for ; Sat, 2 Oct 2021 23:13:34 +1000 (AEST) Received: from localhost ([::1]:42204 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mWepX-0004ze-Af for incoming@patchwork.ozlabs.org; Sat, 02 Oct 2021 09:13:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33456) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mWeXb-0002ke-Ax for qemu-devel@nongnu.org; Sat, 02 Oct 2021 08:55:01 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:21672) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mWeXZ-00014Z-3w for qemu-devel@nongnu.org; Sat, 02 Oct 2021 08:54:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633179296; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HQMlJLpBHn2fUxB+2/XhMlNl1C9ZrEw/LRArmGOAdEM=; b=JqroPGK+b3ioFC5fJzYNbHwIwD0gjhLgTD8WchAMjScyouB1rBAxelXXe2icXsJ09DtPgZ BdQdo32fUJs1LNKmklypCQULdR7sN3arFJrpM/BI7ahqwG8fZcuIrxhXLNykGBTiLEI91U MHS85HtztsRAE6FEw2sw6iRupV5acg8= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-443-SBQ_6eL1N0KDblFf7RCEeg-1; Sat, 02 Oct 2021 08:54:55 -0400 X-MC-Unique: SBQ_6eL1N0KDblFf7RCEeg-1 Received: by mail-wm1-f69.google.com with SMTP id 10-20020a05600c240a00b0030d403f24e2so3205761wmp.9 for ; Sat, 02 Oct 2021 05:54:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=HQMlJLpBHn2fUxB+2/XhMlNl1C9ZrEw/LRArmGOAdEM=; b=K+kURhgVjWhmqiVol6yKx2pcPyMs+2b97ta9GMtaKFmUr12LXR6AHdd+FyXR3ytTt+ QrCFKQlMlLhru9pJV33EmQ7AI6AEjqYC7HJljmwvUd3dKnK22JVVRn+RrfvjBuzZPiKi h1ecz6jjqYy5rwhEqmwldWE6qMLSYyHfu7R9Dm2mZOm8fXKM8IUrn+nAinDTBgEO4nDH 3xJ/5/tbYNJSVueAz4ltbLmDHGZrbumKNFRvdPgATgz7/jXCqa/4q5JsJY5xWEFVNzVk wHLyuzMobMr1Wggi0tnTvAzNj/rBgW5FvY/FCty6lYVG3eEvdb2Qrh1ouJXHFEINtoPr CaGA== X-Gm-Message-State: AOAM531LznDqmGWrgNiWYiUP2izLy+CQr0W54mpyoa+tn1EczVEq8Fon LckCLR0j/QZv1/ptrblmLKjgTU4q67as71vbq3O5UdHQVJPQ7eHppu724frPwKF16t1EB0gM8og bCy4Q4yKDjzu3W/SiGRH0/PXxWbqmWm0p388f1euC3vqp04J8J/X1MU4QXWSy+4Wa X-Received: by 2002:a05:600c:a05:: with SMTP id z5mr9289033wmp.73.1633179294265; Sat, 02 Oct 2021 05:54:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzZjFxaIEu9svYHDueJWKUmqvnq/eSj6AVK+xBQ/cs0mjHbQ9g0Mh2BXrylFwcs1VzcJPeV+Q== X-Received: by 2002:a05:600c:a05:: with SMTP id z5mr9289016wmp.73.1633179294045; Sat, 02 Oct 2021 05:54:54 -0700 (PDT) Received: from x1w.. (118.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.118]) by smtp.gmail.com with ESMTPSA id m4sm10915060wml.28.2021.10.02.05.54.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Oct 2021 05:54:53 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v3 21/22] x86/sev: generate SEV kernel loader hashes in x86_load_linux Date: Sat, 2 Oct 2021 14:53:16 +0200 Message-Id: <20211002125317.3418648-22-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211002125317.3418648-1-philmd@redhat.com> References: <20211002125317.3418648-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Brijesh Singh , kvm@vger.kernel.org, Sergio Lopez , James Bottomley , "Dr . David Alan Gilbert" , Dov Murik , "Daniel P . Berrange" , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Eduardo Habkost Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Dov Murik If SEV is enabled and a kernel is passed via -kernel, pass the hashes of kernel/initrd/cmdline in an encrypted guest page to OVMF for SEV measured boot. Co-developed-by: James Bottomley Signed-off-by: James Bottomley Signed-off-by: Dov Murik Reviewed-by: Daniel P. Berrangé Message-Id: <20210930054915.13252-3-dovmurik@linux.ibm.com> [PMD: Rebased on top of 0021c4765a6] Signed-off-by: Philippe Mathieu-Daudé --- hw/i386/x86.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/hw/i386/x86.c b/hw/i386/x86.c index 41ef9a84a9f..0c7c054e3a0 100644 --- a/hw/i386/x86.c +++ b/hw/i386/x86.c @@ -47,6 +47,7 @@ #include "hw/i386/fw_cfg.h" #include "hw/intc/i8259.h" #include "hw/rtc/mc146818rtc.h" +#include "target/i386/sev_i386.h" #include "hw/acpi/cpu_hotplug.h" #include "hw/irq.h" @@ -780,6 +781,7 @@ void x86_load_linux(X86MachineState *x86ms, const char *initrd_filename = machine->initrd_filename; const char *dtb_filename = machine->dtb; const char *kernel_cmdline = machine->kernel_cmdline; + SevKernelLoaderContext sev_load_ctx = {}; /* Align to 16 bytes as a paranoia measure */ cmdline_size = (strlen(kernel_cmdline) + 16) & ~15; @@ -926,6 +928,8 @@ void x86_load_linux(X86MachineState *x86ms, fw_cfg_add_i32(fw_cfg, FW_CFG_CMDLINE_ADDR, cmdline_addr); fw_cfg_add_i32(fw_cfg, FW_CFG_CMDLINE_SIZE, strlen(kernel_cmdline) + 1); fw_cfg_add_string(fw_cfg, FW_CFG_CMDLINE_DATA, kernel_cmdline); + sev_load_ctx.cmdline_data = (char *)kernel_cmdline; + sev_load_ctx.cmdline_size = strlen(kernel_cmdline) + 1; if (protocol >= 0x202) { stl_p(header + 0x228, cmdline_addr); @@ -1007,6 +1011,8 @@ void x86_load_linux(X86MachineState *x86ms, fw_cfg_add_i32(fw_cfg, FW_CFG_INITRD_ADDR, initrd_addr); fw_cfg_add_i32(fw_cfg, FW_CFG_INITRD_SIZE, initrd_size); fw_cfg_add_bytes(fw_cfg, FW_CFG_INITRD_DATA, initrd_data, initrd_size); + sev_load_ctx.initrd_data = initrd_data; + sev_load_ctx.initrd_size = initrd_size; stl_p(header + 0x218, initrd_addr); stl_p(header + 0x21c, initrd_size); @@ -1065,15 +1071,32 @@ void x86_load_linux(X86MachineState *x86ms, load_image_size(dtb_filename, setup_data->data, dtb_size); } - memcpy(setup, header, MIN(sizeof(header), setup_size)); + /* + * If we're starting an encrypted VM, it will be OVMF based, which uses the + * efi stub for booting and doesn't require any values to be placed in the + * kernel header. We therefore don't update the header so the hash of the + * kernel on the other side of the fw_cfg interface matches the hash of the + * file the user passed in. + */ + if (!sev_enabled()) { + memcpy(setup, header, MIN(sizeof(header), setup_size)); + } fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_ADDR, prot_addr); fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_SIZE, kernel_size); fw_cfg_add_bytes(fw_cfg, FW_CFG_KERNEL_DATA, kernel, kernel_size); + sev_load_ctx.kernel_data = (char *)kernel; + sev_load_ctx.kernel_size = kernel_size; fw_cfg_add_i32(fw_cfg, FW_CFG_SETUP_ADDR, real_addr); fw_cfg_add_i32(fw_cfg, FW_CFG_SETUP_SIZE, setup_size); fw_cfg_add_bytes(fw_cfg, FW_CFG_SETUP_DATA, setup, setup_size); + sev_load_ctx.setup_data = (char *)setup; + sev_load_ctx.setup_size = setup_size; + + if (sev_enabled()) { + sev_add_kernel_loader_hashes(&sev_load_ctx, &error_fatal); + } option_rom[nb_option_roms].bootindex = 0; option_rom[nb_option_roms].name = "linuxboot.bin"; From patchwork Sat Oct 2 12:53:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1535649 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=M/6JDvqk; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HM6tv2CTNz9t0J for ; Sat, 2 Oct 2021 23:16:23 +1000 (AEST) Received: from localhost ([::1]:46656 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mWesH-00088p-4u for incoming@patchwork.ozlabs.org; Sat, 02 Oct 2021 09:16:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33496) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mWeXg-0002po-07 for qemu-devel@nongnu.org; Sat, 02 Oct 2021 08:55:04 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:38582) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mWeXe-00016N-JI for qemu-devel@nongnu.org; Sat, 02 Oct 2021 08:55:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633179300; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9cOF84rCmS7WTO0HbW0oz9DUXo06vj+3GXepVVOD4Pg=; b=M/6JDvqkoQdDVXW2OzxyCwaqNJbJ0jTIoq7OBp0iwRMeeAzAfQCpqCJnDt74Oau12LVahh IFk3IO/bBSx3lpBdyNTqwVFq0/vZCLGk2IYLm8Fn38AnLrFZvUer1n3INtXNSI+kisoiQC +0gUKP0UtcZpU8Rau1h7rzNOpsSG+VY= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-238-2ykmLJsWM1KwMuuDU5mvjA-1; Sat, 02 Oct 2021 08:55:00 -0400 X-MC-Unique: 2ykmLJsWM1KwMuuDU5mvjA-1 Received: by mail-wm1-f72.google.com with SMTP id h24-20020a7bc938000000b0030d400be5b5so3359073wml.0 for ; Sat, 02 Oct 2021 05:54:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=9cOF84rCmS7WTO0HbW0oz9DUXo06vj+3GXepVVOD4Pg=; b=QfmFCaiOJVDuUSdSHU7UlegDYmOGpLsjE45Tl1H8ilL0i1yz4D7D8fxW1sttxVc/7W QwcJcHKeMTaCB8N1sEE7EYP0Uu8Uam0ixjW0HzzwJY96JflCkShJBJ2k9eHp21frzaso jwmbEwdf47xeME9kSC06WsVEDJxiv26nJi5saKYftAic3/6tXghDG7fw6Hr4jUpBo2kN ZHlI3Ee1YmuJHjuEjqDubJOVNXha7Y3R5yaTFrZqoCVBNcCImp3zN5Xd8kpFZAU8SiBJ vgFGRuK8E6lC+5hhcoERPb8FDVuii70bZKTLXmWKVC6rGJDvXsaDWegDdC6+mnY20xPX XfWQ== X-Gm-Message-State: AOAM530+fmm2ciovK417eYFdCkr9nSQNBuSJXPK2F6ZXR3ms+9Biwn7K i72qw/49m248QS4JVe8CHK1pFiJTMeu+Lv1hBx7/zYGWFFnM+isfRoi6hc2iFdWEf3JEnb3uDH5 HhLD7ymOv3X74KBclNhv9Mt+xx3hRAoqrTqMIp2hXWUsiVEqz6Eo0UsSWoVOeRVhM X-Received: by 2002:a05:600c:a4b:: with SMTP id c11mr9217349wmq.97.1633179298732; Sat, 02 Oct 2021 05:54:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxEYfPco7QeJt1MbnGV0YAVEkNIsPSX2xggQ+cxCOIhC5Ja//3oCylj2OTXEwQB2mCra2x0Dg== X-Received: by 2002:a05:600c:a4b:: with SMTP id c11mr9217325wmq.97.1633179298521; Sat, 02 Oct 2021 05:54:58 -0700 (PDT) Received: from x1w.. (118.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.118]) by smtp.gmail.com with ESMTPSA id o3sm8574713wra.52.2021.10.02.05.54.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Oct 2021 05:54:58 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v3 22/22] MAINTAINERS: Cover AMD SEV files Date: Sat, 2 Oct 2021 14:53:17 +0200 Message-Id: <20211002125317.3418648-23-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211002125317.3418648-1-philmd@redhat.com> References: <20211002125317.3418648-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=170.10.133.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Brijesh Singh , kvm@vger.kernel.org, Sergio Lopez , James Bottomley , "Dr . David Alan Gilbert" , Dov Murik , "Daniel P . Berrange" , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Eduardo Habkost Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Add an entry to list SEV-related files. Signed-off-by: Philippe Mathieu-Daudé --- MAINTAINERS | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 50435b8d2f5..733a5201e76 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -3038,6 +3038,13 @@ F: hw/core/clock-vmstate.c F: hw/core/qdev-clock.c F: docs/devel/clocks.rst +AMD Secure Encrypted Virtualization (SEV) +S: Orphan +F: docs/amd-memory-encryption.txt +F: target/i386/sev* +F: target/i386/kvm/sev-stub.c +F: include/sysemu/sev.h + Usermode Emulation ------------------ Overall usermode emulation