From nobody Sun Feb 8 17:13:49 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1633179207; cv=none; d=zohomail.com; s=zohoarc; b=IvP8ZwmGDZkY+1wjAsoMJKi0lZxm6JhfNT/e2JKpPmZQr/drTgD2fcwgMCZLm0QldmUl2H0Npo7f7d/NxLO6Wqtb6BBlSENAjCR0JzT7oo/QyYiYtF+iXYzgo9Pb/2reu9biwoT5nPwom/zEdZ5Y+QpGg2mwKeYZRuckgLOkvm4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633179207; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=77XCyInhhDjafl0gvl8ONZ83GvKuNYK6mpZCL7SUumw=; b=YGZbA/R+qO2s0ITg3YjrQWCioThoKN16jyNK9dzOgcgYqI6P0tdz44DtxYB7/UwEE+3X9N3tBP68M+n4m/GKPjI8lOzkpfInKwF7uUr8luQd4EJ//h694VNcqyaJi3C4STzRIfJpMconcyxciMVs1F9UJC3lnmQrGSUV+8HVUvk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1633179207377972.0841997466877; Sat, 2 Oct 2021 05:53:27 -0700 (PDT) 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-358--dmwthK5PUScpgV9fj7o6A-1; Sat, 02 Oct 2021 08:53:25 -0400 Received: by mail-wm1-f71.google.com with SMTP id o11-20020a05600c378b00b0030d4f47013aso2285285wmr.7 for ; Sat, 02 Oct 2021 05:53:24 -0700 (PDT) Return-Path: Return-Path: 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) 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= X-MC-Unique: -dmwthK5PUScpgV9fj7o6A-1 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=FO4tZGRsw94T/ge15PGkkQRvZqDjFlAICGf0B8BUkGdSliQlbeCZEMEdcmio5iyH42 ZmHhzXC5Cqo6vQK3YjB9WUGuAsIsh5tmTQJFaHiQtkQcDo8XNuHUlmi9OA09sbKpdXT9 PZGM0PtLjwHxnrpjEBD8zzsLPkHvkxj158Bb9zU1B8biQQLLsBuZu+iGZS3lKm1ZtwqU XMzhge/smUrMLlhKbpxLqB58J33JNk+BN7LFxdxD5sI9T2LnXknlvruIT6sXIFm/ncep oBDFuUqQnJRfsOJdEDA9ztyP7fLFeWDRU2pHOMEc1itc0shTaPyOxxSPc5V3uvKSay4a rPfQ== X-Gm-Message-State: AOAM532vAaVh9m2kSH4rnswKluzOzKEneNoUOhk9H3S4qIldletgPVRE JZk1+kupiBrugAFIvh/44c9m63bsqFbfYEkinq+9H/VHZfPek+7HldUfY8NM1hFtkRiQxHCM7mG ugpn5+Ky0i//fkg== X-Received: by 2002:a1c:35c7:: with SMTP id c190mr9340541wma.57.1633179204063; 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) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Dr . David Alan Gilbert" , Dov Murik , Sergio Lopez , kvm@vger.kernel.org, James Bottomley , Eduardo Habkost , Paolo Bonzini , Brijesh Singh , "Daniel P . Berrange" , Markus Armbruster 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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1633179208123100001 Wrap long lines before 70 characters for legibility. Suggested-by: Markus Armbruster Reviewed-by: Markus Armbruster Signed-off-by: Philippe Mathieu-Daud=C3=A9 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 Virtualiz= ation -# 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' } =20 --=20 2.31.1 From nobody Sun Feb 8 17:13:49 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1633179213; cv=none; d=zohomail.com; s=zohoarc; b=aTYU6pBoLdDv+7P13TATQ3b9khyIuumFjaRJH30VZsewuJU2aZHsD7voY01iZKr2BdttOf6X8z2eIopHwGsO8dOvwCdX7JFQJvo8LQRo7CeHhI41gEvmv9mKg5c5fDGizAJMRextz0TI1fopZuJSyl0tZvx2G6Msih18Xa+/T/M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633179213; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=uxFjxneImH8t+TNgA6RwI5GC/nMw3TKiWJEHDqKeLyw=; b=Z9LThHqtaE5M0cSSnuNoYBwK+B/7X3+p/+eVeEviOcV2VxtEWTITv62x6d2Qzp4kzGVFEMeb/mDogvz9+bnkoet0il+axp0c+qbsivARMyYnf5/GZtiIayQYPyTMh+2kzddEqAXw2lsBphSgPLIHIPXRSwz1MPhqEig99k3Twe4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 16331792136891008.7278703193263; Sat, 2 Oct 2021 05:53:33 -0700 (PDT) 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-457-O6GgWeGLM1SLaGcq4zBfpA-1; Sat, 02 Oct 2021 08:53:29 -0400 Received: by mail-wm1-f71.google.com with SMTP id z137-20020a1c7e8f000000b0030cd1800d86so6075166wmc.2 for ; Sat, 02 Oct 2021 05:53:29 -0700 (PDT) Return-Path: Return-Path: 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) 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= X-MC-Unique: O6GgWeGLM1SLaGcq4zBfpA-1 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=RhPzZ6vxAWSubUiDfYAE74CHm00+rumxHtxvOyUihHPxYAHlaydaaWVaUP9BCzxORY +FjAf1BWUIGsPZtvC8CHE3+vOEahxAphhaJeIY5iNuia7D4gIBgoGVLyFDfPGG/BvqYg /EMudntD0F2MErBCcGSalPWt9H1ti+Qvme3mC4oeX3c/m1Lrl+9GbKMHdXAURRM/6ckr YW1m/7HozRnjvUkoRZ5QDTJeJelapDTVI8EoqdaxI0xYgvqBIhiTOXWNC+Bm3m8Hp3kW pDkC5qzBllppRWU/KW6ibLx6Wj1mFzUun7WDi6zgtDC2e1DcBNG9jCPFKrR1gBYigLFX 6ZYg== X-Gm-Message-State: AOAM530Snl0iAL4JLt1YzVD6t9wRp2AOVLWgyy7YyLb81RgewjHX00Jv Z9uXSySCV0AGz9XVB3VDOfeo59PeSX4tjHrCjw/O12+4/ePrdR7nN6J0zQC6c+wgn+tht0IdsHO OnTfZElValFwLFA== X-Received: by 2002:a5d:6da9:: with SMTP id u9mr3290595wrs.58.1633179208579; 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) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Dr . David Alan Gilbert" , Dov Murik , Sergio Lopez , kvm@vger.kernel.org, James Bottomley , Eduardo Habkost , Paolo Bonzini , Brijesh Singh , "Daniel P . Berrange" 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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1633179214309100001 There is already a section with various SEV commands / types, so move the SEV guest attestation together. Signed-off-by: Philippe Mathieu-Daud=C3=A9 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' } =20 +## +# @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' } =20 =20 -## -# @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: # --=20 2.31.1 From nobody Sun Feb 8 17:13:49 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1633179216; cv=none; d=zohomail.com; s=zohoarc; b=ljq3QBdbmXPAeJl0+fzSXcF+zNqe1J6Z3+C9eKUA2rrgOMEQIx6kcOy7NXiFVztbM2b/z/Lpdp5Cv0+wr5tL4T2DdfbcyfILWsOyY5TkhD8Fqj5OrZ9Ce2KH22KKnj7j1RiSJZVjuia6+eMEGM35QUVY6/sL8rGwadZ7Px+4PLE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633179216; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=g4CQJdzlwnG2lhh6cD8LFOTW/FEZbmRSxqmO9AK0wf0=; b=SOKAogWNsaxzyIakk/0WqbMn4lsWnyqtQSjbuNxQ36XsXbkNTvP/Wq4QwkZtUAs3FbqPTjFilxsnuA+JMNHEH1UE3PMYSJtCkG947Wd+mCmNalQojRQ7XjL52AxAKokTSFgYRN++vnhFVM6jvluAQdYFNCR3Ox3PX85be24bGNk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1633179216376307.2717478357432; Sat, 2 Oct 2021 05:53:36 -0700 (PDT) Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-569-nJWq-hhdM0OITci3nF5IAQ-1; Sat, 02 Oct 2021 08:53:34 -0400 Received: by mail-wr1-f70.google.com with SMTP id p12-20020a5d4e0c000000b001605e330b62so3503990wrt.5 for ; Sat, 02 Oct 2021 05:53:34 -0700 (PDT) Return-Path: Return-Path: 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) 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= X-MC-Unique: nJWq-hhdM0OITci3nF5IAQ-1 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=N6XLVS6J7cGhfCQQj6hUUP3tZ2v9ygQ3qEXgU+kUSnPNRmG6iAqW3YCWKf4HpznL7K 9vYE4PQrIQiyBVw3qudr4LA7VdhBN8I/DBklUFaxRhZi1MX1Blh+FUwKn3xl81u9crR/ huQJ/CtV90s94Bxg6F+TyynBO1q+3zTuKBbC9cW+4u1AxF1HHZZL+jWPYA74Q1wH29CU ZB6U+/JlIhCF/+g8/kBIMa5oI36aIanJUekZkxRO5EzmGT36Hkar8POGV4tOawdTGlj4 T7V+mgAVvKllDAQ+/ZjeMPPazDkV6UJpmzCcsh4pi79cqpVuRXgL84oxDVb10xWkCiBe wrdw== X-Gm-Message-State: AOAM530ZFOpgZFGp/pWmpiQymGABUeghwGtW/PXb6l/wtI+K2RprZIaK FhD/zyHc4Z/l1xsN2aHkjQbizYPgJ8KaENHg2Zx3Y1Z6NFB+OAqWLLsdiWwN2ERoE9UoR9e7NMm n8+xVNvLAmdpUtg== X-Received: by 2002:a05:600c:240a:: with SMTP id 10mr9368875wmp.170.1633179213048; 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) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Dr . David Alan Gilbert" , Dov Murik , Sergio Lopez , kvm@vger.kernel.org, James Bottomley , Eduardo Habkost , Paolo Bonzini , Brijesh Singh , "Daniel P . Berrange" 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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1633179218334100001 Introduce the i386_softmmu_kvm Meson source set to be able to add features dependent on CONFIG_KVM. Signed-off-by: Philippe Mathieu-Daud=C3=A9 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')) =20 -i386_softmmu_ss.add(when: 'CONFIG_KVM', if_true: files( +i386_softmmu_kvm_ss =3D ss.source_set() + +i386_softmmu_kvm_ss.add(files( 'kvm.c', 'kvm-cpu.c', )) =20 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) --=20 2.31.1 From nobody Sun Feb 8 17:13:49 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1633179220; cv=none; d=zohomail.com; s=zohoarc; b=Llxviqobgu9RWw94I4rLh4Psdo9XbLxmu1d376gx37ETFsmdkwEa1ftje3VtxzH3nLwb8Fx441Z6jnKRwpuebK8mJajErrU8fXPsgjtz8YyldP594Fa2L7LhW6YNdprg962JUOCmacn1TI7TzK0Tu7SSTZOY7R+tBL6bgtrj8G8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633179220; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=ZlL6otvRUOhsGg4LexEjqPgBur9Sbw4O6pWOtqIiK2E=; b=lN/owGnslhjAcfI4ltuHdF4gGZX1Oo0eeuxnK8aDu0gofydyG2jJ918iyP87YM50zWDcUX34cMAeuox7Vfsx+k9Dx+GzlDxfeeZCcjY2/Bo3EcGtipZPOZf/MwBogLJD/uYxsdIWDG8SGTdKR2YRUh2+LIiCsNFhwzFfTut5ei8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 16331792205861017.1384385364612; Sat, 2 Oct 2021 05:53:40 -0700 (PDT) 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-351-oPtwjFYHMha79Svr6cPCjg-1; Sat, 02 Oct 2021 08:53:38 -0400 Received: by mail-wm1-f71.google.com with SMTP id 10-20020a05600c240a00b0030d403f24e2so3204519wmp.9 for ; Sat, 02 Oct 2021 05:53:38 -0700 (PDT) Return-Path: Return-Path: 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) 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= X-MC-Unique: oPtwjFYHMha79Svr6cPCjg-1 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=NgrlDwqhOuRWt8ddREB/7uuH0rNcsnNh4jr8k6Pv33Vqxu7T4Y0K2wstXX30VjQ95c Ko21OW5zQDE9ELUopIIZ5tRmbi9413rKD06ZAvRxPmZxcGBPB1XvCPYGoJ3ZWwFP7P2/ fUOFp506RelC5ORk+ImNHzyiPCTBNOZzRAw8rzjfERem32/wsudojrSc18rjJK7AFFHG H6+SLb7pSkYFiOX47M6wFQEesFqtx3+pv0GYzA6p5w+ZkQRPl4A+0P1fyEOKEFBjxAOl K9bliJ5nn40esjNYjIXm+1WhU+iYgDWh87+57URrjfnN9+m4HR/pZXAqYR7SeFFA3Ne0 JlXA== X-Gm-Message-State: AOAM530sSxrkgmNtf5i2Kk+cv7G2bIpPaM2HCDdKWDqmWyz+rDhdtzAU WY3IgSPltYSofzW81FHRlpy4ZZ9mfoJ7vP+MFSj1GbTaza9booE5/YtgrQgntLEwECutdjds8qF 5RhibuyR6AydaKA== X-Received: by 2002:adf:ea45:: with SMTP id j5mr3279489wrn.291.1633179217541; 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) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Dr . David Alan Gilbert" , Dov Murik , Sergio Lopez , kvm@vger.kernel.org, James Bottomley , Eduardo Habkost , Paolo Bonzini , Brijesh Singh , "Daniel P . Berrange" 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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1633179222533100001 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=C3=A9 Reviewed-by: Paolo Bonzini --- {accel =3D> 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 =3D> 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')) =20 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', )) =20 +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')) =20 i386_softmmu_ss.add_all(when: 'CONFIG_KVM', if_true: i386_softmmu_kvm_ss) --=20 2.31.1 From nobody Sun Feb 8 17:13:49 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1633179225; cv=none; d=zohomail.com; s=zohoarc; b=G7jjjZX32jrnHUQ3GGOSO6+VG88hzfw36Ixb2dWO7wt5znIIduDtvabeci0e1J8IB5AnU0ovYTj9jQC6BL3UXeWy7u+1+hgQhFNyHIrciNBS81XJjRM0yPbmlo2Q7Gy/9tijF6NLW/Gp/PefT6V5ApxMuA3JKruF7LkyHtO+YEg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633179225; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=l2pfbYxP1f86zn1O+UmnIVR/OdXuADklhW48W/+4agE=; b=X+LUKCK/LKiKWyQG4dzfxRkI5TGguebE+Un4425Cgn0DBKWDYjHIVAHHnsU5+lR0sjbY6wGf8lS0uAG5puywi5IKagdp7DjFKuF4SazekYCeMw9N8K4zMJjjKEokPdjcs3l7yHgeEkFPCq9C5meGaL9OVge1RnLbr3pWt004fYU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1633179225204926.0231205991621; Sat, 2 Oct 2021 05:53:45 -0700 (PDT) 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-367-9LIFfTulOcSgohn_JfJSEA-1; Sat, 02 Oct 2021 08:53:43 -0400 Received: by mail-wm1-f69.google.com with SMTP id r66-20020a1c4445000000b0030cf0c97157so6084764wma.1 for ; Sat, 02 Oct 2021 05:53:42 -0700 (PDT) Return-Path: Return-Path: 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) 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= X-MC-Unique: 9LIFfTulOcSgohn_JfJSEA-1 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=AFneEQW/vwzl8l0s+8EtJWO735zqTvDPPriA3VgoEa2FAI9kqGWEKIi4t9R15/sOez aOUDtzHMYMBHbzIPHONuebJsWgjveRk2/w44BW9I9SUq96kx3EF/pHdgJrsz+4zzJroD drhFCjZnZ/HrmGR/Ch7WoQlHr6nOXDZbIGg+kAlskJGrP+/tIv7kK32Eynv/mTO8HKEA 8oTZG/QQd5SjXcLZ1TKnloPzo260WNPs06l0gOUJ5u6jJ0ELQ+RULM1pDbBCyuJoZYjZ bOrn3wJZplFoMh6oY1c4rE3MQNRn5JYJ6EEXNU6FPHsN/MjbjfA4eFyEfsbVjN+6gT/3 Nk/Q== X-Gm-Message-State: AOAM531NfRYDQSG421c5FPEABifJtyM2DgvMeOHdqC1AppjGayvgTVka NY27Rsv/raX+2uOlGFAoNLqGBgn/+YQ+V6gxTEv2AF5IriKjVs6C61QUfixErb7zUYaskbmpsLc D/e8UPFJ76cB5cQ== X-Received: by 2002:adf:b19b:: with SMTP id q27mr3023136wra.125.1633179222032; 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) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Dr . David Alan Gilbert" , Dov Murik , Sergio Lopez , kvm@vger.kernel.org, James Bottomley , Eduardo Habkost , Paolo Bonzini , Brijesh Singh , "Daniel P . Berrange" , Connor Kuehl 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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1633179226722100001 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": 429= 4959104 } } { "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": 429= 4959104 } } { "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=C3=A9 --- 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_h= dr, 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; --=20 2.31.1 From nobody Sun Feb 8 17:13:49 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1633179231; cv=none; d=zohomail.com; s=zohoarc; b=VJpEQCCY+j3WpGe8VqJuUwL88zxnX4qekz8PbM/tIm9bv1ZA4jzwCLLVgILpHf6+YtmADtAn5dZewzSe1ihI+8Th4N+avvojQgQv8ETUzj0Kqd2XmQFEI00Ro29pBCSIj0HYvSJ37P7YhLWIgq0y2Sd1ZSLGh5Ssf+tGqiaCZFU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633179231; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=T1NIBoSE4LuxR67pjfbeheswmOYBoIBhIFI0FnH33UA=; b=WRFfP5DKiU2wWq/X9IJ3hIvZMEpH9A0cv/EQymeHnEL9hgOteILOe31J4xw1RlaXpH11IOl527RZa0lVvxRQ3TsUeed/TPFAVu5UflA1KB9HjJ2SMYsZYv1nXEDyMNqz0fLmpcPOodxGqTK3SDz7mONWpHqvvelZ1VHgGosTlP0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1633179231778800.382483942853; Sat, 2 Oct 2021 05:53:51 -0700 (PDT) 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-588-KGhpC9gVOm66WnN_qo_2lw-1; Sat, 02 Oct 2021 08:53:49 -0400 Received: by mail-wr1-f72.google.com with SMTP id v15-20020adfa1cf000000b00160940b17a2so2018131wrv.19 for ; Sat, 02 Oct 2021 05:53:49 -0700 (PDT) Return-Path: Return-Path: 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) 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= X-MC-Unique: KGhpC9gVOm66WnN_qo_2lw-1 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=a5lYPgJVyttYL06BGoiHr6JlLjXqB3Oiz0K8gQf7jpjU+7hGrf+jlbZREn5oDXJNah wS0DLE2mrlMJU3/iOgEaI31r2KXUlp1SFTo73CQlzSFVqqEwiBEvWLIbFkeCSdL6Zs8u nHg2ZScu4LRCbK6aMatW1qF8UNg48IMHfJYTq3Ui82UNqnZJ2WEd6bBgWumRjk94mSHr ehc4DDo/f3pBdrLDyemB1H7YTeBEQnzpsbXe395diCnCrrFbH2LEgc7lwv7br55cTabE d3+nb3Nh4Lx2zlGLCU+gM/rh5lrNQ2YoEhvla1XDWrqmkTQb+sqGG6lcFxx/5eRkc3eS Fx5g== X-Gm-Message-State: AOAM530eP6l427AdmhbCXSvF6fj/wac9JdNhZx6clQYpQbo94dptFKk+ 6nFdduDxJPLxy+83aWsyNRaucA1IQmoIce7XOUfaVP9Kp5GcjGiJX9yF1Ghu/jzFkgJ00wwQxEM KalHy+whqYxZ0SA== X-Received: by 2002:a05:6000:c3:: with SMTP id q3mr3272624wrx.361.1633179226451; 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) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Dr . David Alan Gilbert" , Dov Murik , Sergio Lopez , kvm@vger.kernel.org, James Bottomley , Eduardo Habkost , Paolo Bonzini , Brijesh Singh , "Daniel P . Berrange" , Connor Kuehl 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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1633179233014100001 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=C3=A9 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" --=20 2.31.1 From nobody Sun Feb 8 17:13:49 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1633179234; cv=none; d=zohomail.com; s=zohoarc; b=DNpbbzPHd27yY9hng6g4zl3awLiaqgqv0c74hUEiw9sVOhYt0z6BY+iVA4TN7LA/znNwtC2TGcbFfLmsEgO4T76dOxZKAX/irE1EDaZkQbOEAWJ31Kv0XlM25hy7jBN5TTv32tUWbQmRcW50L0bleHavwJ69gjCOy9tzVMMQvc0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633179234; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=J6Nu9xcD/1mLwA45H6T/mwE1HK3rKCkbuT6P4bJEEQ4=; b=bEhIgp5ZHuB8zoDrVKJyD8jDpigSPlTOSGbtKap3NRvWixJu0P6HUgKhDln08Gg2R5v2TCEI2qf3qj0vk2jE+jdutMv04muUSoLNM08Sh8zooAPwukyfrPFrzo9P2EkLKbRs4zXnLIvaAJwxjFFhdKDkjo5dz6u8P42z2313rC4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 16331792342047.384141674205694; Sat, 2 Oct 2021 05:53:54 -0700 (PDT) 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-554-u9qG6sEBMyesUnqfutnRUw-1; Sat, 02 Oct 2021 08:53:52 -0400 Received: by mail-wm1-f72.google.com with SMTP id x3-20020a05600c21c300b0030d2b0fb3b4so4597191wmj.5 for ; Sat, 02 Oct 2021 05:53:51 -0700 (PDT) Return-Path: Return-Path: 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) 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= X-MC-Unique: u9qG6sEBMyesUnqfutnRUw-1 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=k/lM9DtthUU5t96krWA/T0DNNNO8vn4lxUnlg4SAJUzdh6V2LH6xRGhzzPj4SGSr2D DkFuye+2VCf43M5BnYQ8MWmSlG+Le6ou97V62b8Yako7I4VsX+Hk9mTbIAqwaz/Hle4w vmJ9hG1xJsa1huxzYInXe3eFgRAS9PciSsa0BsWRy00ckNjWwp1YD4EDvbPE0pyZ8rnz GbkHhiPFfAKxXoWQ/wMJr931UND1XlzH2uX6cMlqM//JfUQjZOYhpdMlmD8vXiImCmTJ M576KhHomWvcMjzEb5ruB1ZjzZuIds/1ROR/CO8euBtJZUWizBML89W7zL1VYGlpkzk2 Zx7g== X-Gm-Message-State: AOAM530MU9sjodDD9Lh7LATfd27JaE1mgcL25uZ7Q0aJVOUJGNdz3o13 sdVW2vYyAkeS7/dvKPAjZPCL/v5/iTj6/IlqP8ai5xIPwL2dTHxldT9Y3nvMKtj0XX3Tqb46Sa/ 8xBvG4cKCrulHeg== X-Received: by 2002:adf:97cc:: with SMTP id t12mr1334714wrb.189.1633179230887; 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) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Dr . David Alan Gilbert" , Dov Murik , Sergio Lopez , kvm@vger.kernel.org, James Bottomley , Eduardo Habkost , Paolo Bonzini , Brijesh Singh , "Daniel P . Berrange" , Connor Kuehl 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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1633179235126100001 Declarations don't require these headers, remove them. Reviewed-by: Connor Kuehl Signed-off-by: Philippe Mathieu-Daud=C3=A9 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 =20 -#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" =20 #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 @@ */ =20 #include "qemu/osdep.h" +#include "qapi/error.h" #include "sev_i386.h" =20 SevInfo *sev_get_info(void) --=20 2.31.1 From nobody Sun Feb 8 17:13:49 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1633179244; cv=none; d=zohomail.com; s=zohoarc; b=O4+O3SYt2mpi8M/+X7kDaJgxppOIAFbh4EXpwhTR2tz2QbnxcZbxil7CQJ1/WQeTvbE0s2o0L/GGPAno0kgMnwrcU5+b3+VlEqClgjaa7FXsaWw2SbWte7hs97O/Hc3E2mUPdRrCxmkmZc4VEeP4HQWbjylpDb42UxIA+2CpI9A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633179244; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=2JOuakDg9TjNTLsEL31Gb5qf2swMU1YyZ5LrMCCfA9Y=; b=lZE+LpxJnecvTE3dAAVz2C0LSBlJ6Yc7M4IXyvxMmnRo+RUsT8FeggSArvzEKTMy488VTg4OXRM52U1/r6bUB12tKYMBfwDCl2LlA1i8xIruxQdcdjGwVOtvf9ssEWa4zmBqm73BpC8Crg46g9neu1fmq9URBmi4CL5nEnArD3k= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1633179244792798.0423555168134; Sat, 2 Oct 2021 05:54:04 -0700 (PDT) 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-190--j2yMi76PoOflfkuBcWh-w-1; Sat, 02 Oct 2021 08:53:56 -0400 Received: by mail-wm1-f70.google.com with SMTP id z137-20020a1c7e8f000000b0030cd1800d86so6075582wmc.2 for ; Sat, 02 Oct 2021 05:53:56 -0700 (PDT) Return-Path: Return-Path: 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633179243; 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=atJkaSqSD0IQc1ORNLP5tLwT/yz72MUEJk1o/1f3m7LkYhGdaea15qXRT+PCNYxQ7VltCA u4BFLgXUr0XiB3P9H+3jVpKlf2qElOOwyfE9sIt9m/fr6jy+iDaldePzbIajNtkza7pzBV jgXReu0EDNFvFAf+/l3vrZskGM7mkOw= X-MC-Unique: -j2yMi76PoOflfkuBcWh-w-1 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=7uEs9W6OkXRxPZ6PJPzC1HPBh/yRHIBgeZaoAm4ocgeKZg0j16i7lxGk9DmC/elgek 4VXhFrvMxSQbKHGbCgJDZgT9fKprTIbhv+7aka1ovR7bTPiO/QpmPnYI/aLZY5O2+uKL NdrqHBYHA7xzdUEpfOc4gYD0cDKSAeQQlIRAh3VIkvwYcnY/KLSO4/alycAxeoAZ4JvQ hZtQ+V0x7zmAgSpszkstLnUbf5PTGIYaU23Y6T3V2dfqacF5nH7uUI8UTH+BApJ+mYGJ k8FNrGxDt6bfBpf/4pkLHK0Ift/KzZFQqKNgMytzV+xdY7p65UNY56ATyrk8Be4jbX4z BEIw== X-Gm-Message-State: AOAM5338EJ+4aKcmHfrWt6QMzqJhz833tmwYlyzyBSE/68O55n2F8cBt kdkX9vCGCUVAvV/U+EtH/84ebnr5fBwNIGKhnmMfyyM404oAz+d2FDWcWfAIBvDaLB4cfAL23tO 0PWzq3z5TsAGMtA== X-Received: by 2002:adf:a18d:: with SMTP id u13mr3366718wru.275.1633179235452; 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) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Dr . David Alan Gilbert" , Dov Murik , Sergio Lopez , kvm@vger.kernel.org, James Bottomley , Eduardo Habkost , Paolo Bonzini , Brijesh Singh , "Daniel P . Berrange" , Connor Kuehl 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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1633179245663100001 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=C3=A9 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 =20 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; } =20 -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); } =20 -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; } =20 - sev->me_mask =3D ~(1UL << sev->cbitpos); - devname =3D object_property_get_str(OBJECT(sev), "sev-device", NULL); sev->sev_fd =3D open(devname, O_RDWR); if (sev->sev_fd < 0) { --=20 2.31.1 From nobody Sun Feb 8 17:13:49 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1633179245; cv=none; d=zohomail.com; s=zohoarc; b=SIcbMzSnXZ9QtkbEbe4HL+GzmnJ2/4eJ+8TYLBYXrI7WHrD7Qg2UMFAbaDmU7d4z8PcWYw56nwojywiSU0yNl6ZwVERwJG+sOKashm0yqk1/cwVVYmK3ImUFamknePXDcI7yQctRYW9uj9MR0hhuLC1JgGWoiGfE1p2ssxmLhbA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633179245; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=KJdW6m0Ma56hwzjCy1teOEHrEH20tchf6AQogJnEfxU=; b=OQJZIkvVd0km81PAjQexZHCm9ax3E3pRxRXNwMlSSt66bRMNUnoKWl/Y2OiVRvOyawO0Vnx2P1SK6SXHnkRjop3JOed9xXLFKvZLrN+AhFjjKb0jWhJ4mjVFtW8pN5TGazwyyyjUnhUu03Sj6cJc89PuRo6hjUSgUIL0A8gz4VM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1633179245099396.60003725648085; Sat, 2 Oct 2021 05:54:05 -0700 (PDT) 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-390-0bzUdgF3PuKuIaEr1EeY8Q-1; Sat, 02 Oct 2021 08:54:01 -0400 Received: by mail-wm1-f72.google.com with SMTP id p63-20020a1c2942000000b0030ccf0767baso7337069wmp.6 for ; Sat, 02 Oct 2021 05:54:01 -0700 (PDT) Return-Path: Return-Path: 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633179244; 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=Er+pX0m24AQlNquJtjyPPllr3nUvDCaGJ6xTjVp3WCq752g5CqOoCxOE9Gn4i0SIpSgcv/ wnqH3viL7bZxmQrU8jJyGWoKgocLsZYQ+oIjYWdawMMNqCk6fGA6s0KhKE2tRMR4B8RcXN eIlW/lcZJ2caFemlxQNq1JJWCd/5TxQ= X-MC-Unique: 0bzUdgF3PuKuIaEr1EeY8Q-1 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=ccOK9AUVjiKXKTt+mB+oU7C7MKcwJyXcAOatPmCD9Nx3tjrQPOvZhpxyJ6hD8Brzpm J0UTCoAfXj84V1EUO/NzjP3Kpc7ookuxCV4Dq3KxYBnChqJGG3aMdPnZ+lyZHl2yTLgh NOeUN/rNRRjlBYIgEzTV5vXVGbTmJZ+M3Z/BL+kIkozNkxAVzKaU9/NLlSdU6jkL9pnm TmPo6g3RoA7w+z6AeGdcFQWAgMcdjJdezKacNWq6on9ZpbOkKzba/aEBpPRia+IJ/sl/ FD9vdXLF+0/5CDORYWwoHSG0/3ld9B29U82NFimdpF9vFVIBCT4mmtoBhckIlSUIT9/d 9b8g== X-Gm-Message-State: AOAM5309049QD+x+On4xn06/GC27if3t2JYzVrowtE3zQ0bQfqyueXAR NjF8SlXSoL5MuU2MbiGgXQIVpMuna155/0yD10rGpNdlD3ip6VkSUg3r1Qzdu+PhYXkRhRhdgnp 089ZOOXQn4xBb1A== X-Received: by 2002:a05:6000:2c6:: with SMTP id o6mr3374981wry.292.1633179240040; 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) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Dr . David Alan Gilbert" , Dov Murik , Sergio Lopez , kvm@vger.kernel.org, James Bottomley , Eduardo Habkost , Paolo Bonzini , Brijesh Singh , "Daniel P . Berrange" , Connor Kuehl 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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1633179245677100002 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=C3=A9 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, =20 int sev_encrypt_flash(uint8_t *ptr, uint64_t len, Error **errp) { - return 0; + g_assert_not_reached(); } =20 bool sev_es_enabled(void) @@ -68,7 +68,7 @@ void sev_es_set_reset_vector(CPUState *cpu) =20 int sev_es_save_reset_vector(void *flash_ptr, uint64_t flash_size) { - abort(); + g_assert_not_reached(); } =20 SevAttestationReport * --=20 2.31.1 From nobody Sun Feb 8 17:13:49 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1633179247; cv=none; d=zohomail.com; s=zohoarc; b=O1pOKR8uHNVcGRhv+e4HDPDhon4ognNxjpjgHUKuYJyvW47UF6MvZjJutXegKesLH9UTp2m28PeJ7avb/v+afRCFAC0p0en5J/gHgKPVY6oSxK1Qz7yJHgmtil1OwRdogQqhgprJMpvmg/LLC4t+WZaZEdE5cGQOhN6L6g6CLqU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633179247; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=tAj3BwaM+hRNB5Zlp17fWtjr58QjWY/+pHTXgMu/M3k=; b=WiaDAUe6ykL1ne4KMVPSngBstVYkWofK6EwQBYo5ygrj0B24wO1X9PFm4rzahBjnqP5tIGiJ0BaBDMYts124ii1zwiIM8rckgPGWclaD8HDnuOfGYUFcneHaTi8a7DTkJYGFl7Mljs+RfEPLsQOfysjad8WAyJuWLufAZ5o5Cek= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 16331792476161015.6050267601278; Sat, 2 Oct 2021 05:54:07 -0700 (PDT) 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-410-qWPYFU7TMtSL3Hvn5oqaog-1; Sat, 02 Oct 2021 08:54:05 -0400 Received: by mail-wr1-f69.google.com with SMTP id v15-20020adfa1cf000000b00160940b17a2so2018152wrv.19 for ; Sat, 02 Oct 2021 05:54:05 -0700 (PDT) Return-Path: Return-Path: 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633179246; 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=h1vwdqi3clcwQTiohmLUDcW6m+2c07K/a7ivbvFgW+8hW0zvRhYX2ZLEVXdrrnyh3/qR5I RLRHOFp7cBiy5EGDkq2vuefylBCsOs6YC0QWt3mMPGNl6kz8W3MPanbHdWaGid+UzwG7Fe 2M30Azd0QqWw/fXm42rSBy70DvXgGB4= X-MC-Unique: qWPYFU7TMtSL3Hvn5oqaog-1 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=h9eDtkFqo3vw7PknsrlqQPRVKICKQv+kTcifeCCbONhePUkNih2W9vKc0u4ctM2BxY xMbJSv0GIYiVUF0ceYNMhGK+dNGm2Fz12OK/+WRayccI89C1tLZxscR0UdFEdnLdR9Ie bvN23aQtvQNf6RRwYNwiBL3Pw+BdoxU/DFs38jmQxYYP1T5nFkroi6LzfhE1KNnFpFbO 5yRg35W50ugxqdf4eIBAD3mNtKQ9AWrOLydjikcOzOod+QNVLAriA7cukx8LiFfzLceN MwF2iONTbAcUdcc1Zu3OdmZNJF5osDl7e3KHIl4mdc8vdkvOn6z5fW5Mn7RyTPXP/aBo iUAQ== X-Gm-Message-State: AOAM5329RAhU/OkNVpNwcMPmpBXBkFTDsbyecIjhz8KpzT+CD73kTaET mVhMbia3oCoE1At9/Y8w1vK958ZmPRWkUiw9xho9V/EDLtir6eYx0Ru6+hsLE6Cvr8ixcVQmcts S4VxUEAozEF5Syg== X-Received: by 2002:a5d:64cf:: with SMTP id f15mr3236680wri.284.1633179244575; 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) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Dr . David Alan Gilbert" , Dov Murik , Sergio Lopez , kvm@vger.kernel.org, James Bottomley , Eduardo Habkost , Paolo Bonzini , Brijesh Singh , "Daniel P . Berrange" , Connor Kuehl 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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1633179249872100001 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=C3=A9 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 =3D {}; SevAttestationReport *report =3D NULL; SevGuestState *sev =3D sev_guest; - guchar *data; - guchar *buf; + g_autofree guchar *data =3D NULL; + g_autofree guchar *buf =3D NULL; gsize len; int err =3D 0, ret; =20 @@ -514,7 +514,6 @@ sev_get_attestation_report(const char *mnonce, Error **= errp) if (len !=3D sizeof(input.mnonce)) { error_setg(errp, "SEV: mnonce must be %zu bytes (got %" G_GSIZE_FO= RMAT ")", sizeof(input.mnonce), len); - g_free(buf); return NULL; } =20 @@ -525,7 +524,6 @@ sev_get_attestation_report(const char *mnonce, Error **= errp) if (err !=3D SEV_RET_INVALID_LEN) { error_setg(errp, "failed to query the attestation report lengt= h " "ret=3D%d fw_err=3D%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=3D%d fw_err=3D%d (%s)", ret, err, fw_error_to_str(er= r)); - goto e_free_data; + return NULL; } =20 report =3D g_new0(SevAttestationReport, 1); @@ -548,9 +546,6 @@ sev_get_attestation_report(const char *mnonce, Error **= errp) =20 trace_kvm_sev_attestation_report(mnonce, report->data); =20 -e_free_data: - g_free(data); - g_free(buf); return report; } =20 --=20 2.31.1 From nobody Sun Feb 8 17:13:49 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1633179252; cv=none; d=zohomail.com; s=zohoarc; b=i/YXQQrutv6f/UiH52AoMNZiEsVkqsnmBo6CcbFuUE4LHAUe/XvguYnb2EjS7ph0YgKntOwA/khLibHml3OlwsvWXldsamcT6fTRN4zCEs3VOWT8wnvbbx9o0sltvvlv+D3wF7E1pRUZE5acXOT/MPhOJQdUdICofvLeaq3E3Qs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633179252; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=AZLS+m7xAvvk2uRB++FAfryJbzXnCIDe39YBz1qMJyo=; b=KlwD7MkUZYkfvOOCeN1oHSVtRV1+3oftnZsFTc3FUsQvNXZOvkMTMvGC3p2nDEhLxcapSRS60ZAhjpOReAeTuTNjGGBNm/17B2LuCSth35Vn/2jkoxsfYu32uHLza7o9y2nPPWXPt26I01cmRhJUagSSH2wpHbWxKqRefMTTxP4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1633179252026143.28537566731677; Sat, 2 Oct 2021 05:54:12 -0700 (PDT) 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-232-m_ldEtBrPO-yKVKnUTgoIA-1; Sat, 02 Oct 2021 08:54:10 -0400 Received: by mail-wm1-f72.google.com with SMTP id k6-20020a05600c0b4600b0030d2a0a259eso4722781wmr.6 for ; Sat, 02 Oct 2021 05:54:09 -0700 (PDT) Return-Path: Return-Path: 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) 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= X-MC-Unique: m_ldEtBrPO-yKVKnUTgoIA-1 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=cmcElccllZ7hR4G3B5nWB2V9YXCMYiPp/RPzc+HapfQYmVsRbU6vgXiIl61H/lxaTQ jIxXeI3hA12raj8PpYnMFcZOMVVdjDRW91Z0iRXpzimLLXWPxDXyUAoJsdDfDrV67cY9 mXVFrO+lqY+wftoMcOMa1MMck293oiF7WAKGf67P97/rAdyUz0iZW34A8t68KebmAnrX ba9na4sAV0ogwPaB/pOFMzW6D26jE2TaWjpLRfiqdeArG4MiCDgMMn0Xp2lEwnWjF93/ qawCj4+QHn/B+TwOSfxNW8vsxFrC7mPfHkQIbzpUsMP/Ql4ryYooAsKYb4yQCQd6RISf Fxzw== X-Gm-Message-State: AOAM532TIHcZsC4a8xqfyNlaErJt85LtBsMIX/mQK7wrKFR/SD/LSuI5 xJukXINnVHKWCJ+FAQpENa1IlhvQkZT/jIimRPWt3y3Dtknz0GTs28BxWbx+0VBFfvB7b9jAnAJ 1JwKodt5C78p0Kg== X-Received: by 2002:adf:b185:: with SMTP id q5mr1100019wra.213.1633179248985; Sat, 02 Oct 2021 05:54:08 -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) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Dr . David Alan Gilbert" , Dov Murik , Sergio Lopez , kvm@vger.kernel.org, James Bottomley , Eduardo Habkost , Paolo Bonzini , Brijesh Singh , "Daniel P . Berrange" 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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1633179253957100001 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=C3=A9 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" =20 -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; } =20 -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 late= r. + * 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: fi= les('sev-stub.c')) =20 # 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 =3D ss.source_set() =20 subdir('kvm') --=20 2.31.1 From nobody Sun Feb 8 17:13:49 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1633179256; cv=none; d=zohomail.com; s=zohoarc; b=gC900bp4bzlvXnZszdDPuxeIIW2DutmuoPtUs6QsKNsHLKLXzWmcCeW9oGdQmNkQxgH+Xwf25XsjS1aFUQh76EHJvOpVj18Q3uQY6XsO6SgcUKu6xT9do6NG/MPlwfp+iPUg6YelUsM9lhl8uG1/tDIMhSc6inIuKS7dpGnjPkA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633179256; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=PLN18Kg90p6yE/kKbVk7ZeNbapKw0JC8XYHCCSL7Hxc=; b=fMldhAbt4ihrYMwmI6ZEXS1Mf+5soicpRbtT5ixkFgXlr7LMscW1lPf50OOqXtcFeCNf5iQt7ZMUMesX7gjF0tIuFuIKxKBU9q/2CYIp9dTNG6S9WamkXKbfKovj9JIVCQvGillTRCNq+MnB5Cffe0I8dwzHQ1m00GSSHGtIX30= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1633179256792634.6663684680522; Sat, 2 Oct 2021 05:54:16 -0700 (PDT) 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-286-p2W17XewO4Gp_s3tQBWURQ-1; Sat, 02 Oct 2021 08:54:14 -0400 Received: by mail-wm1-f72.google.com with SMTP id z137-20020a1c7e8f000000b0030cd1800d86so6075793wmc.2 for ; Sat, 02 Oct 2021 05:54:14 -0700 (PDT) Return-Path: Return-Path: 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633179255; 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=etXpZTMhtcxlTAj/aUjMyRJvSMwZi8XEXT+dywoWVH/u+ime8yP46KiIeDgck1MZXCcBc9 BC6ei2NB0K6NTxZ3G1IzN2eGoislqAWRc8QUk2rSpt9voHHsCA1Y5HI9aICN6jF0nzMSYI ekZ8gtirTLv4bAZaCddD6Oqr+rE0isM= X-MC-Unique: p2W17XewO4Gp_s3tQBWURQ-1 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=ve4xUiv2YS/eImge0VxN0mtLntUCI3c/Igj/f5CVujeuGMAXqy4JVXyZXe0mS+W2X/ Bu/29o5So5CQOyZfox9Q4mLje/gqkqvT8dd1E0ASkCvYtAfPQ/dED6x3Rf4mUa6Vk8Zr ErGQHEdgUuiZY1TQe8fmzH7r8RyCln+oP/6RbrgDF5O6bdCYpb2S1OJGJhw5QdvMsysj 71YVTS1L7JdHR9MxarMv9rN+MdiBSynyweMyqhZhE3djAF5GuHiFdBvAOPkGU4NEGxL4 4RmXb0WWcWdKoKvOeGkocE+MKjjKXyyDktCDpztGfX3/cljulZplAE+8JhEVUyRk8AEL I3AQ== X-Gm-Message-State: AOAM532GK629yXxHCEHYC7tI/5oW/nFPc0lNhkR41wSzCXvlVOJySnGU DHsxUDQAuR/zHtP0aQLcEUJoXjQwQ7FP39slKKqCXaplTz7BA/SE5xPNUBBVgOgfeu32tMe3CQr or0PgW3WWa8lP5A== X-Received: by 2002:a1c:451:: with SMTP id 78mr9420864wme.158.1633179253569; 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) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Dr . David Alan Gilbert" , Dov Murik , Sergio Lopez , kvm@vger.kernel.org, James Bottomley , Eduardo Habkost , Paolo Bonzini , Brijesh Singh , "Daniel P . Berrange" 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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1633179258094100001 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=C3=A9 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 @@ =20 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); =20 #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); =20 +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" =20 #define FLASH_SECTOR_SIZE 4096 =20 --=20 2.31.1 From nobody Sun Feb 8 17:13:49 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1633179266; cv=none; d=zohomail.com; s=zohoarc; b=VEIgNI4OoCh4e8/hLaJNxfPek4UEjebVOdc2mnJtEopcdUHE+bY6cNG4pH5GnbGvSk+jNdV9/K0RVsoAP0pHbdZ8X9PstuJbyc+f6dnWQxTf7NLx1yjQbJKj7+D/KDiAFlOeTbWZqw1+Hs+8zNIuup8BebpaI9RJvKPHf7vEc/4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633179266; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=ORMXV0Tst1vudHF4i8O0+oN0mxRTrnSBxDsiV4I1LIw=; b=YKVhOVKZDtLIVvI3lf/5PaqGwq0Y//yp8qRR7eZQn+jGKQLA/TDYPUwgzYeX5bQwoRO/w9IELgRCOSj8F4Xj6v57SSWxmyeCEt+Ts9R1AthJdQ2xha/pmOeLFyE9mTvkMhqpG+uqdEVO7Aiaj7wenGu/3jaHv64b8TIoTfgf4eA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1633179266401759.310039475; Sat, 2 Oct 2021 05:54:26 -0700 (PDT) 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-269-Qmjesy6VN2eV_fWf3Pp8_A-1; Sat, 02 Oct 2021 08:54:19 -0400 Received: by mail-wm1-f72.google.com with SMTP id k6-20020a05600c0b4600b0030d2a0a259eso4722876wmr.6 for ; Sat, 02 Oct 2021 05:54:19 -0700 (PDT) Return-Path: Return-Path: 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633179265; 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=ZQS9BEOWDrzD4wnK0mRGC2oXIjppS0dWDgwuaBR8KAXaDv7i+Oe5y4BfF8TDmwt95AhSZV G7KtVtAkQEAM+lP98jR2Fo9BJs3r/x2zIrbs5dDwoDHZTI5jzapRdufpq3HzperGtNMpTf 3dYDquVDiCehlwTzB/P8xkCBCSdcVe4= X-MC-Unique: Qmjesy6VN2eV_fWf3Pp8_A-1 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=2UqED/+zYrtSshyZH0/QNjlvAJY4BL6mNXqcI45aLWtzy4Gcx+pGJUkdc5rlWJ5vIi FWs9Ruo49nylnHvfRZpbP5WHQk3Pgy8TE/SukfX8DB0O0dJxw5nZbuGUgt1Qs9evc2yV BQWC3ey7jT5pefD48oypEENyh/5JEtrVhyXRRe0T0vpv2XsDk9NZsw1HiQrTFRbPNHI/ hRV/HAWWrvcac1znKHbjxaFrWysTaYbl9cgiW/LTi8h5Nry98kfweU4E95AyrxW1kSoJ 87Um3qhgQ0E8j+RdzN90abj4oh6/TkdakcS7aDzWah0esM8wM3IBKF44gEG2z+9DR4Ma ixqw== X-Gm-Message-State: AOAM531ETlQ5SBwCaIYaKyOCVRjdjIF0kS/qNobQURCGVdXCgNYqVkJ+ VdlinnbPPhFQda2iMJaxRpKlEZumR9BNnLZsAATob/NpCLlVWz9beRImbArc2FXeGnclP0Hu6rl ml86S7jG18G1udA== X-Received: by 2002:adf:a18d:: with SMTP id u13mr3368087wru.275.1633179258172; 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) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Dr . David Alan Gilbert" , Dov Murik , Sergio Lopez , kvm@vger.kernel.org, James Bottomley , Eduardo Habkost , Paolo Bonzini , Brijesh Singh , "Daniel P . Berrange" 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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1633179268590100001 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=C3=A9 --- 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 =20 -#include "sysemu/kvm.h" +#ifndef CONFIG_USER_ONLY +#include CONFIG_DEVICES /* CONFIG_SEV */ +#endif =20 +#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); =20 #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 =20 -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 =20 #include "disas/capstone.h" @@ -5764,12 +5765,13 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index= , uint32_t count, *edx =3D 0; break; case 0x8000001F: - *eax =3D sev_enabled() ? 0x2 : 0; - *eax |=3D sev_es_enabled() ? 0x8 : 0; - *ebx =3D sev_get_cbit_position(); - *ebx |=3D sev_get_reduced_phys_bits() << 6; - *ecx =3D 0; - *edx =3D 0; + *eax =3D *ebx =3D *ecx =3D *edx =3D 0; + if (sev_enabled()) { + *eax =3D 0x2; + *eax |=3D sev_es_enabled() ? 0x8 : 0; + *ebx =3D sev_get_cbit_position(); + *ebx |=3D 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 late= r. - * 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: fi= les('sev-stub.c')) +i386_ss.add(when: 'CONFIG_SEV', if_true: files('host-cpu.c')) =20 # x86 cpu type i386_ss.add(when: 'CONFIG_KVM', if_true: files('host-cpu.c')) --=20 2.31.1 From nobody Sun Feb 8 17:13:49 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1633179265; cv=none; d=zohomail.com; s=zohoarc; b=nkd/EqNJypJYv3YaN/eUa2lPtOK7rv5+21jINxii/ytuzS1QsZBpenbIYOgtMVffHNntSCYSNf8XiFvfamzxCQWenSD1RxmCTiDLY6FIdaDof6ZBDBHR16/L2LbAZSjVxY7eMnwV7yf9agEEmoGgFnZ+nblHP5nAO2ORoj/Iv9o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633179265; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=+4z6jUCebNJqEmNFJ/VStW7BTMEQNitBNtR46XouroI=; b=PfC43aAsronVIkfrZgddaVbodG8nVaZJMNwNFmB8q6BD3cNpbiTQXKCJtQBIHkVCJCgiNKccKqBtYssgoLCGa6L/4DFNzplOkRAjFO9rbv4gPwk8yaRRgyfxs++7VR1bfInBJiVcSODD/gZ3hHPHql2du5PZIadLghh0BgR2aHg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1633179265904492.51038193986744; Sat, 2 Oct 2021 05:54:25 -0700 (PDT) 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-397-YFZ78WzIMNyynUU5ofe-Yg-1; Sat, 02 Oct 2021 08:54:23 -0400 Received: by mail-wm1-f72.google.com with SMTP id h24-20020a7bc938000000b0030d400be5b5so3358580wml.0 for ; Sat, 02 Oct 2021 05:54:23 -0700 (PDT) Return-Path: Return-Path: 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) 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= X-MC-Unique: YFZ78WzIMNyynUU5ofe-Yg-1 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=XP2JKnfe/258MfBQVHZyYY7ODHO/MQhCD/krGkN84cRCSo3xOek2BtR+oYFz8mOy0S Mpj2ywjnO9wX85o/ydfB6H5j/jyfSp0MyZaD1tEgY+DQ24jiL0D38Y50yt7Ss/aHcMx8 8vG6gSq8yY5YUNN/tU8Tr47E2E9ZHESIlIAdnCdYFpZgvgG86MBf0wkIabDoWJoNP2rO pE6qg6NOXqcguiqA1x2nYmizLdus7o+vkfwwoVx8cLghwN6ym/IrO6SsNs0z2i4CbZtw otXFYaa9SDDVywJTjoQiToNtl1jN/+Jtc9JG9liPOnvf4dHWwHLEMeqVBCUJNuaLSZUk cSpQ== X-Gm-Message-State: AOAM5339IX/2WfyQwHcKKi1YPSq5c2quzeMkqRkMuLIypC20SV/6DH2n ybw25rnssithfo8/5Hhexc8vtduVsvP0NFvmAKzqo4k9xcHTIn7MKsF0ba+JmErFVuwHVk5h04P ksfMsqll2ISB9qQ== X-Received: by 2002:a05:6000:2c6:: with SMTP id o6mr3376264wry.292.1633179262579; 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) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Dr . David Alan Gilbert" , Dov Murik , Sergio Lopez , kvm@vger.kernel.org, James Bottomley , Eduardo Habkost , Paolo Bonzini , Brijesh Singh , "Daniel P . Berrange" 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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1633179266376100001 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=C3=A9 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); =20 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_h= dr, sev_inject_launch_secret(packet_hdr, secret, gpa, errp); } =20 -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 @@ =20 #include "qemu/osdep.h" #include "qapi/qapi-commands-misc-target.h" +#include "qapi/qmp/qerror.h" #include "qapi/error.h" #include "sev_i386.h" =20 @@ -52,9 +53,9 @@ int sev_es_save_reset_vector(void *flash_ptr, uint64_t fl= ash_size) g_assert_not_reached(); } =20 -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" =20 @@ -487,8 +489,8 @@ out: return cap; } =20 -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 =3D {}; SevAttestationReport *report =3D NULL; @@ -549,6 +551,12 @@ sev_get_attestation_report(const char *mnonce, Error *= *errp) return report; } =20 +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) { --=20 2.31.1 From nobody Sun Feb 8 17:13:49 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1633179270; cv=none; d=zohomail.com; s=zohoarc; b=JhfJ3R8Brxqa3h4T0kD++BAJ5/CrqpfE024LmknUOlZOEVL4X5JyiNyJl6RkMWkQOPnWWu/R6qoYVs8+Dc8Os0OfQEb1umL8GidbrXW1Fc57k5xzj9dLbw55pDpJRpoTcQA/qA6tivwqWraLAlXJ3QplmD04uO/UTCxxWUX+Uk0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633179270; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=MFPED/lWL7McgnfaLMNLaFFcTGfU944hsrHyvaxNr8c=; b=a7L4Zjo68bWV/lzv/TiAMnsaG1i/QZyocuxS+f7QL6Xx6y3RjfFgycv9pmg3gG9QK8NHH+FYWUwtPa4IDracqHJvxgLwF9RsWJHybSsR7WB2v7kohlKhN09KDg5NjJtWnUQ8638sQBKQpuu6uaugQdSK/S04O+PSdy9FDmy0WOo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1633179270377315.2161107390368; Sat, 2 Oct 2021 05:54:30 -0700 (PDT) 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-172-YePVi50NPSSe6ZGvP3PdpQ-1; Sat, 02 Oct 2021 08:54:28 -0400 Received: by mail-wm1-f70.google.com with SMTP id n3-20020a7bcbc3000000b0030b68c4de38so3791180wmi.8 for ; Sat, 02 Oct 2021 05:54:28 -0700 (PDT) Return-Path: Return-Path: 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633179269; 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=Np2brtWWkoftLajluTJEbcJ9Td+yudIRnJOCacgoCA7kvZ+Nnu8EkgcCqlGtBUZ01XFEZp QvDpOvhIB4mIKGkQqzrHHLEWDu69JrDBww4kkYKXUqOfWeBEj5fL33a6cL5XrQhqIgtUQA O3/n91SjMtIZZF4/bF4xLG+x1vPPthg= X-MC-Unique: YePVi50NPSSe6ZGvP3PdpQ-1 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=ZVjh6A8g/9cRobmzNdXAHnDm1KPdrFW3TAyZvujuowajByvZ+AJlW5GDv5dU0hCt93 9AlVRQy1J//wfCyDd3S2A3ioy2eqiRT0kcnKRLbo8a1MKZ9f1W1L5iG72A3GvWN0QeDr RS/7lQdHW2Mz7L3BVgcDvmaEjVRwdbP/8srrfYVHw+zPiqkdPLC/L13ieMpHpkAYt6oi WhatcaLL2JZCBjgMBjawOSOr5CxINz2sK9gWfvGs/Lvk+pbuL7aFDKSUgZPw+TeNKY20 YrhcwsOEhMD134lV34iWUkd/SujIxeak0pDQY8qiuRF0C35ME29LHY3oQOt1BBU7E5LL qyTg== X-Gm-Message-State: AOAM531V6H4FkbwtX2gV7UX84XhtmP/v9QXa9sISRq7+gJg8vEb62dE0 Fbqk3z6tZtY6ZrLJpjMZxwTl/tg/5Cp099LDRUDf74X1wXUf2T+20cmFomStxJa92ZT9If3d/wl zepUKSqSRtIfLNQ== X-Received: by 2002:a5d:608e:: with SMTP id w14mr3315473wrt.119.1633179267186; 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) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Dr . David Alan Gilbert" , Dov Murik , Sergio Lopez , kvm@vger.kernel.org, James Bottomley , Eduardo Habkost , Paolo Bonzini , Brijesh Singh , "Daniel P . Berrange" 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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1633179270891100001 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=C3=A9 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); } =20 -#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 =3D (struct sev_secret_area *)data; - gpa =3D 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; } =20 -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 *s= ecret, + bool has_gpa, uint64_t gpa, Error **errp) { - return 1; + error_setg(errp, QERR_UNSUPPORTED); } =20 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, c= onst char *secret, return 0; } =20 +#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 =3D (struct sev_secret_area *)data; + gpa =3D area->base; + } + + sev_inject_launch_secret(packet_hdr, secret, gpa, errp); +} + static int sev_es_parse_reset_block(SevInfoBlock *info, uint32_t *addr) { --=20 2.31.1 From nobody Sun Feb 8 17:13:49 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1633179274; cv=none; d=zohomail.com; s=zohoarc; b=eAxlxGNomX3DwOnmvZlQ+Rw35S1bRaolVfkKFC2l2Y865wWEc04aj/68OpfTTJT5MYkDhFGt+8KHmrrBMe1rcntQGcnOqxv20J46oiphAhb7z5qFmO8lYVm0b5NkyVYRdyAz7Vrf3nbwQ/xNFaMTKAhnjg8AlYhaBmMnyjcqI2U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633179274; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=h6tz1pzz/4VduuxUJcTVLKl1Lh7BOZFtJinbrllV/PI=; b=ClOeLQJzloTDU8Dodi5zlk3GD1EYS5vYe5ozu8aQnhlpQOorcQN7Nn5l2M6ndKEaZEmmHq2ntdpwfvrWvEWyk+lIOBhSOUx0GhPSRl9xFQT4DQtMezM9S0I1QpHF6uAQkFXnNEgBEK0OcwGDNx/uRsb0jjZj8JsRm66nK5TDSn4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1633179274702543.3136985837938; Sat, 2 Oct 2021 05:54:34 -0700 (PDT) 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-231-3RE_954BMRajAAoEOSS9Bw-1; Sat, 02 Oct 2021 08:54:32 -0400 Received: by mail-wm1-f70.google.com with SMTP id v5-20020a1cac05000000b0030b85d2d479so6061013wme.9 for ; Sat, 02 Oct 2021 05:54:32 -0700 (PDT) Return-Path: Return-Path: 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633179273; 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=YvwW9ped/qvn23GQQ4T2N9ZGWnRJgZT7yGJ9TrhG/6bz6UpILDRQ9puMuJD1vx++fvwop0 /q573ByRd28JPn7YduAqCh4xkD9gLmexnhI/3gJo/yc9Z/jSpDFon2h1VjaI+BvfhEHKE4 KKNA6FuWU9hGh+MdIDCXfb+nRzOF7zg= X-MC-Unique: 3RE_954BMRajAAoEOSS9Bw-1 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=fdsB7R3WrQdw3MQWNnKHLzOn2xt7+FZupl0cxHLTt4beMGAHDr2Pfivp7NbintnyNQ Spc+aIiml5CJl9ETR/GH7zMewX633GiVlp+FrSm5IitSJ6EzE+epH1Vq/7iHojUH5lrp ACrc+GaaOCVOTVbaNi5ylT8zHsAuH03382prLcNVaNpCzI4cOq3B/Un5oQFZYtr26XMO yEF6Y9/7jdLnkbDb/8lQ2+taAlKzKrIV2iRgjOtOpk9KcSH5yHx2H3RcA25FGu0ROVs0 wVHqit4cP49bK22EWGmrLqPFJO1renCndx0kD/1tt/XrNmVVhtQRgq6uA/AbRLTl1DqI dJ+g== X-Gm-Message-State: AOAM5335hqLGDc+SV5Muv3j3UIC2ROrvt5Fq6Rq/dcu3jBVpK0YI5trK K81pweocnuvvgdX8EiZlbgOTmsm6/0FuRG+2wDcJ6HrQMpt9GuK8ObnXc0gLhdpG2hKpHf/TVnN IPsAvjSATuSazFg== X-Received: by 2002:adf:b311:: with SMTP id j17mr3202011wrd.340.1633179271656; 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) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Dr . David Alan Gilbert" , Dov Murik , Sergio Lopez , kvm@vger.kernel.org, James Bottomley , Eduardo Habkost , Paolo Bonzini , Brijesh Singh , "Daniel P . Berrange" 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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1633179276980100001 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=C3=A9 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 @@ =20 extern SevInfo *sev_get_info(void); extern char *sev_get_launch_measurement(void); -extern SevCapability *sev_get_capabilities(Error **errp); =20 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(Err= or **errp) return info; } =20 -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; } =20 -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; } =20 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; } =20 -SevCapability * -sev_get_capabilities(Error **errp) +static SevCapability *sev_get_capabilities(Error **errp) { SevCapability *cap =3D NULL; guchar *pdh_data =3D NULL; @@ -489,6 +488,11 @@ out: return cap; } =20 +SevCapability *qmp_query_sev_capabilities(Error **errp) +{ + return sev_get_capabilities(errp); +} + static SevAttestationReport *sev_get_attestation_report(const char *mnonce, Error **errp) { --=20 2.31.1 From nobody Sun Feb 8 17:13:49 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1633179279; cv=none; d=zohomail.com; s=zohoarc; b=WwE8pPrdv/fSNJdk8NjXRcGx/V7zLzBxclFwty8ioIkhgMU2Ig16yn5Oa9p0tLR9crJnDBPEbMmk7MjIFQ3MQ3bMEfDdSBMM/yGRQLAOQS5n5VVe9lhtjWsWr1DYw7SyblIzQ2YI0yWxryiqVo/Rex7kEdC0eTj3ABvi88UNgk4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633179279; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=0nKTjzIKPyPIMBpHVM/tD1diKI5Lwbe51EbfE5s5an0=; b=RfqPpKCccpXTQNohKatBi8hN9LXPgODlZQe+p48jh0QlUKyxDrLx/HEdk1vL5/KpMED82m0U/TQhjDOF7z6/YrFq0y9YLtJPB36pCa+fF4fBhHBRwcSPWpjM/yAwsdSjnebuuoeSrX3wNueZS8xmfoiu3Tx1GoJLr5bArckaeHA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1633179279352141.2723127120563; Sat, 2 Oct 2021 05:54:39 -0700 (PDT) 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-219-i-tMsStwMoCfBbBWwLOt9Q-1; Sat, 02 Oct 2021 08:54:37 -0400 Received: by mail-wm1-f72.google.com with SMTP id y142-20020a1c7d94000000b0030cdc76dedeso7349095wmc.5 for ; Sat, 02 Oct 2021 05:54:36 -0700 (PDT) Return-Path: Return-Path: 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) 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= X-MC-Unique: i-tMsStwMoCfBbBWwLOt9Q-1 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=aUWwfBBnf7LWtRdnkMkZ6rEal83WUlknxNyzgOpuqeE+sipNlMBb0m2n91CqEwcBdS opIIIzuJBgGUhF1bvq+uCIhg/TikgicYktDE5pOM9oPqKKP8AZ6AffAARoBa0jc3MRrD WSD4L8zaivRw/2B9nCI40iaDMC2jgjodEhjASO1tHOSx2dWAmZkKj9yodC9RW73fqaGw iQwNJ3XOLKNGsQ8eN2gMX1ewBjT78wJQ0MJh5UNt2xdrYvdgaRNDSAi33qw3xjw7pGVe D8+9R78qiDTc2H6mTP3F/qz9cV0XL6G0SFkIj9ax5a/S91UQ1ft9siimdb5XXaeb/IrI bbLQ== X-Gm-Message-State: AOAM530/xE17vns20olxj5tVSp+2GifI8d7Mho7gjD3JYNo1dXKC+xzm siSTdJUGrqc51HES+bKp2nfjjm68kT4enIV7krOi7OzVTlhZ0aPpImTTffaGkBOwb+K1rUjzeDn nHY9rxzXHzdq32w== X-Received: by 2002:adf:a4cf:: with SMTP id h15mr3355720wrb.56.1633179276025; 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) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Dr . David Alan Gilbert" , Dov Murik , Sergio Lopez , kvm@vger.kernel.org, James Bottomley , Eduardo Habkost , Paolo Bonzini , Brijesh Singh , "Daniel P . Berrange" 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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1633179280996100001 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=C3=A9 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 =20 extern SevInfo *sev_get_info(void); -extern char *sev_get_launch_measurement(void); =20 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); } =20 -SevLaunchMeasureInfo *qmp_query_sev_launch_measure(Error **errp) -{ - char *data; - SevLaunchMeasureInfo *info; - - data =3D sev_get_launch_measurement(); - if (!data) { - error_setg(errp, "Measurement is not available"); - return NULL; - } - - info =3D g_malloc0(sizeof(*info)); - info->data =3D 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; } =20 -char *sev_get_launch_measurement(void) +SevLaunchMeasureInfo *qmp_query_sev_launch_measure(Error **errp) { + error_setg(errp, QERR_UNSUPPORTED); return NULL; } =20 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); } =20 -char * -sev_get_launch_measurement(void) +static char *sev_get_launch_measurement(void) { if (sev_guest && sev_guest->state >=3D SEV_STATE_LAUNCH_SECRET) { @@ -729,6 +728,23 @@ sev_get_launch_measurement(void) return NULL; } =20 +SevLaunchMeasureInfo *qmp_query_sev_launch_measure(Error **errp) +{ + char *data; + SevLaunchMeasureInfo *info; + + data =3D sev_get_launch_measurement(); + if (!data) { + error_setg(errp, "Measurement is not available"); + return NULL; + } + + info =3D g_malloc0(sizeof(*info)); + info->data =3D data; + + return info; +} + static Notifier sev_machine_done_notify =3D { .notify =3D sev_launch_get_measure, }; --=20 2.31.1 From nobody Sun Feb 8 17:13:49 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1633179283; cv=none; d=zohomail.com; s=zohoarc; b=aIdrdos9jypI7syAi9q+a4zqELUs+E94o1CrVhVh8PKw9F3q+NBcTDrWWr1y8YLVct8q6kQg0cayVFFOq2BCz9hWvHpJGm+YIqkeq9me83CV7amvPIwauX3lm4zAQjQBKnxNGgxSywoX73TYK9+Dp68Q1jWbm4Uq/dQo6xmXViE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633179283; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=zmeHSaAJmvIQWkoqQvBbbph1YlHUwqkxNB0lhULs12o=; b=cQqstxsNJyg850if0Sp3GfVjWnd/vbNqk+JAfatrYdAMqI9AZPbZmaolIdUpvVwa5BKpDxVjqHrIFC2p8XuzsCfnXQQAKmaaeankfbuQvMixsNif5J5zj4x5kAtm4nm5kuFqs5akxKMov3LalzUBQK6OaZwY7ybPWQQUkKKzSmk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1633179283704763.6425345729574; Sat, 2 Oct 2021 05:54:43 -0700 (PDT) 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-601-0SvB1DCIOlKGyfyD6pPhAQ-1; Sat, 02 Oct 2021 08:54:41 -0400 Received: by mail-wm1-f71.google.com with SMTP id z194-20020a1c7ecb000000b0030b7ccea080so7342050wmc.8 for ; Sat, 02 Oct 2021 05:54:41 -0700 (PDT) Return-Path: Return-Path: 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633179282; 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=dEXr5s7SYEVzrCJkqbkCyFQPKiHvGw1Qx+TKubLr5Oeh65dpiFmyE5J+ade8c3AdKZuvtc DXF4OWfleF9GWDkYIMmSYmf9Tsa1RtrRUHISC/5LRloXdU/KjqA0XFE35SDH5XIyvkRLag oqgBFdoYUcwZ8Tiiu4VEPnVxVQRCSJo= X-MC-Unique: 0SvB1DCIOlKGyfyD6pPhAQ-1 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=UUaRrLspU7pkrn7CoR/vM8VMBbKYNIQ+s//Q2JfNBcxE6fxjCzUnV698x0UfW5qG5S 5bvdzoLGPu9sj8LCBZUw01HTxefRzYAq5UCD/Agj+CGYVLLnmzO/vc8pBYFT8+7nWcec TWN/RgsDBBhZr8td2/oBeFxFXWs/6V51F52pZIm/F5KijdwynmL4JMzu8fS+5qODHfas 8kXXhFihuZSCDdaobcdtB4UrvEoL3XBcVwze9KC9t0tkAMt0eSkIBRT0wMypGAHLoWX0 mZl2zQ8NU5JN2oWK9roKx0zHzL+6waNfPVU9VtoPOKY3Qyx3ti2/mU5IK/kG/MrbXkt+ FzJw== X-Gm-Message-State: AOAM530DfgCPyHQCEX/4sa3nRVBW9A9bPN0iWniVY2ZFoOVk5YOhcqBt Q4GuYgX6si3XBw/9uadNXz78HAimlCFe7dpsTdAgeAAYRcUVHgybhjC/8gO1ryf7PIqeRUjaJZA dgYswHOeJ8LPpOg== X-Received: by 2002:a1c:7302:: with SMTP id d2mr9391306wmb.92.1633179280618; 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) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Dr . David Alan Gilbert" , Dov Murik , Sergio Lopez , kvm@vger.kernel.org, James Bottomley , Eduardo Habkost , Paolo Bonzini , Brijesh Singh , "Daniel P . Berrange" 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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1633179285202100001 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=C3=A9 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 =20 #include "sysemu/sev.h" -#include "qapi/qapi-types-misc-target.h" =20 #define SEV_POLICY_NODBG 0x1 #define SEV_POLICY_NOKS 0x2 @@ -24,8 +23,6 @@ #define SEV_POLICY_DOMAIN 0x10 #define SEV_POLICY_SEV 0x20 =20 -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"); } =20 -SevInfo *qmp_query_sev(Error **errp) -{ - SevInfo *info; - - info =3D 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 =3D 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 @@ */ =20 #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" =20 -SevInfo *sev_get_info(void) +SevInfo *qmp_query_sev(Error **errp) { + error_setg(errp, QERR_UNSUPPORTED); return NULL; } =20 @@ -60,3 +63,8 @@ SevAttestationReport *qmp_query_sev_attestation_report(co= nst 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; } =20 -SevInfo * -sev_get_info(void) +static SevInfo *sev_get_info(void) { SevInfo *info; =20 @@ -395,6 +396,40 @@ sev_get_info(void) return info; } =20 +SevInfo *qmp_query_sev(Error **errp) +{ + SevInfo *info; + + info =3D 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 =3D 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_chai= n, size_t *cert_chain_len, Error **errp) --=20 2.31.1 From nobody Sun Feb 8 17:13:49 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1633179288; cv=none; d=zohomail.com; s=zohoarc; b=ZPD8TJ6XshinL70v20UtheyVbKjcNqKtumvYVNfxB28bPd0pBG1uN4h2RE1iDGFKD1ZqaSyD70Qtwiaw18fG+V7CAuhuvZ1cs422BfJwe4mZenU/SXtX+FotY91MSvoqxbSDFgY1ps2an+klBqHdQpaSxJeJcwVprLrfRgwoTYI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633179288; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=WyR/eNCtMhabJTiJL4KYPQfagO3ysZNetDQfcxieNmI=; b=DH5n3rCg9orJCy2vXlrAj4OKEIFnFfJiL4OlIUFxTbSYAsVZjwBopRnHf9U8wAdDWU9pD4CFqRo/XQmBWvSZOXe1j+5VabEeQgrTPSB3LRHBcafphRvy46QjcXHXUlnZr/bkQ8YXhi8TbjaIYWO50Oz1Vdg48+wVfW+zOdgIn7o= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1633179288244378.73632296468327; Sat, 2 Oct 2021 05:54:48 -0700 (PDT) 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-272-DhhHMBczN86ZiAPZL8AH2g-1; Sat, 02 Oct 2021 08:54:46 -0400 Received: by mail-wm1-f70.google.com with SMTP id d12-20020a1c730c000000b0030b4e0ecf5dso3788071wmb.9 for ; Sat, 02 Oct 2021 05:54:46 -0700 (PDT) Return-Path: Return-Path: 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) 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= X-MC-Unique: DhhHMBczN86ZiAPZL8AH2g-1 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=e5OsGCIRvL90o7fu7uhKT3PsTuM5BYEFDauyuhmxBM9RWtTdPec3Upp3lh6TuDThfz lXG2SN6+0LzGh9XQhaOMGfY4BSXv9+Opyj5wCcJ/lA6rESex2g3s0XjoCEjL5vr48Crq SjtfP6PyYESuIH4FYqvzJrmF5isLeNRe69fDkFSD4fHhhQGKm8l6zj1BmAzluoi8I+W/ OyNO1s8XMT9RsOSQEmHsx28bm4hpc9E/OmaSEBa9KInqCGlHTQ27mDEnxLTVfJh3F375 RSIayFv1YPCQvVmT/jeKeusz9w3ReQSMVQCmCbP8p5ozdKzH+SI7Wql79dFu0AnPB4UW gngg== X-Gm-Message-State: AOAM530wsACOOanT2dd+oljBwUjuUWA13QYMNlJ32FEheuKexj4SG+ob 5F5uP2xh8O0Kl2vIm+50eYpqydF4UdCqrEqhdFi4KUTlSYjBG6U+PimbB5mW/QojbONSB9SAPUR XlPIpNPE2L71o0A== X-Received: by 2002:a5d:44d1:: with SMTP id z17mr3370220wrr.187.1633179285064; 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) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Dr . David Alan Gilbert" , Dov Murik , Sergio Lopez , kvm@vger.kernel.org, James Bottomley , Eduardo Habkost , Paolo Bonzini , Brijesh Singh , "Daniel P . Berrange" 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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1633179291260100001 Signed-off-by: Philippe Mathieu-Daud=C3=A9 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); =20 #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 @@ =20 #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" --=20 2.31.1 From nobody Sun Feb 8 17:13:49 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1633179295; cv=none; d=zohomail.com; s=zohoarc; b=atw1a8a114DFx05ciOtFD55+C+BWtGEdcES8SO/zmEkfXwSz5S/v41CaArU3iAvvFntvpIEJIsdG/KPW3l+r/s8cdPiwuMSpaoYMweb5oZSgCs/2sOcWvp4GVYzqsncKwpdPwqxKBCXJMbIrtTJxnBTMUFac+aL+yKkfrPs60xQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633179295; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=wGfA2j80SC2+4aGulWQ/r67RC6gVnbvOoez6cQaSfN0=; b=kJ4yHo7hH9j+YyFy/UJr6GKaS3brfNwAw8D+FRS7E4c9m+hlu2Xnu6aMdCvMe0+ZYv/bswMvy0FaNRgVg4l4ar9Iq7H5Kytz0Ya3qocQkQX5ayxkJn7vMlNTVlbBkBYs9UV8Q1ObXzeVjBcJWW5lTXt/6r992OpQCt2yc8CUmwg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1633179294896336.85672716425154; Sat, 2 Oct 2021 05:54:54 -0700 (PDT) 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-547-FxQk8tPlM_OmuyhQbOSioA-1; Sat, 02 Oct 2021 08:54:50 -0400 Received: by mail-wm1-f71.google.com with SMTP id x3-20020a05600c21c300b0030d2b0fb3b4so4597978wmj.5 for ; Sat, 02 Oct 2021 05:54:50 -0700 (PDT) Return-Path: Return-Path: 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633179293; 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=F4lEicq4POgH5S4S+PuEq4PQfogtsD20a/y8/nRLit2FfSMAqnSjouvoBZ3dUgKDrrD+Wj QCUXBsNdrD8eG4HJya8j5VZeKhmDc/iJjvSwH2mIrhSEpXSrS+f+gfmd5xrvHqmBwkN+I0 EUNOpIG1K+mzXX2PPduPUb/cOuWaUVA= X-MC-Unique: FxQk8tPlM_OmuyhQbOSioA-1 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=ljyU0DUz6fGwLU/FzMaqu7xytLy8O+PKkTMBbTfQwHQZD32n1Lgb8ifFFOQKm6M1vo 7NNprkTZli4MVz/ZRHY5vAD2Z+9BcN1z7ZJRKFUVSI/MlanM2g3PUWLiNaRqB8UvvZ9d i00taDD1R8i1pvr3uzDbZ4PiCcL6aNQja3kYA0RSYo3VTzZJFtbrAxT41iBeYpDabdqM eqZMX31nNv9snKymkDorNMBeXVaQdk8HH7+wUWOuOxh4GML/yr0djok/Jt7hLx2jm3fI TIAizIEOMpRN9s0KVYKStAAWkpmp5iQiYGnzGa9GeXcNcPJuZ5d/b6hRaPw+9oc+72MU yZ8A== X-Gm-Message-State: AOAM531WbSTeU+6ghCgTq9eumzdh1cLogJIZWrY2QT3SR8M394OnIpAn 1KYVEbqKWx0GJuSmGaZ0XtIUxhtz0rbitciJ7aNvZ7zax0MEtj1eY5pkx4/5ghtrgxJxVHZbL/9 aBOwTBNgTjrSoKw== X-Received: by 2002:adf:cf10:: with SMTP id o16mr3263912wrj.12.1633179289664; 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) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Dr . David Alan Gilbert" , Dov Murik , Sergio Lopez , kvm@vger.kernel.org, James Bottomley , Eduardo Habkost , Paolo Bonzini , Brijesh Singh , "Daniel P . Berrange" 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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1633179295417100001 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=C3=A9 Message-Id: <20210930054915.13252-2-dovmurik@linux.ibm.com> [PMD: Rebased on top of 0021c4765a6] Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- 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 =20 +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 **err= p); =20 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; =20 +#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; =20 @@ -1151,6 +1178,117 @@ int sev_es_save_reset_vector(void *flash_ptr, uint6= 4_t flash_size) return 0; } =20 +static const QemuUUID sev_hash_table_header_guid =3D { + .data =3D UUID_LE(0x9438d606, 0x4f22, 0x4cc9, 0xb4, 0x79, 0xa7, 0x93, + 0xd4, 0x11, 0xfd, 0x21) +}; + +static const QemuUUID sev_kernel_entry_guid =3D { + .data =3D UUID_LE(0x4de79437, 0xabd2, 0x427f, 0xb8, 0x35, 0xd5, 0xb1, + 0x72, 0xd2, 0x04, 0x5b) +}; +static const QemuUUID sev_initrd_entry_guid =3D { + .data =3D UUID_LE(0x44baf731, 0x3a2f, 0x4bd7, 0x9a, 0xf1, 0x41, 0xe2, + 0x91, 0x69, 0x78, 0x1d) +}; +static const QemuUUID sev_cmdline_entry_guid =3D { + .data =3D 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 **err= p) +{ + 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 =3D 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 =3D (SevHashTableDescriptor *)data; + + /* + * Calculate hash of kernel command-line with the terminating null byt= e. If + * the user doesn't supply a command-line via -append, the 1-byte "\0"= will + * be used. + */ + hashp =3D 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 =3D=3D 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 =3D=3D 0). + */ + hashp =3D 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 =3D=3D HASH_SIZE); + + /* Calculate hash of the kernel */ + hashp =3D kernel_hash; + struct iovec iov[2] =3D { + { .iov_base =3D ctx->setup_data, .iov_len =3D ctx->setup_size }, + { .iov_base =3D ctx->kernel_data, .iov_len =3D 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 =3D=3D HASH_SIZE); + + /* + * Populate the hashes table in the guest's memory at the OVMF-designa= ted + * area for the SEV hashes table + */ + ht =3D qemu_map_ram_ptr(NULL, area->base); + + ht->guid =3D sev_hash_table_header_guid; + ht->len =3D sizeof(*ht); + + ht->cmdline.guid =3D sev_cmdline_entry_guid; + ht->cmdline.len =3D sizeof(ht->cmdline); + memcpy(ht->cmdline.hash, cmdline_hash, sizeof(ht->cmdline.hash)); + + ht->initrd.guid =3D sev_initrd_entry_guid; + ht->initrd.len =3D sizeof(ht->initrd); + memcpy(ht->initrd.hash, initrd_hash, sizeof(ht->initrd.hash)); + + ht->kernel.guid =3D sev_kernel_entry_guid; + ht->kernel.len =3D 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 aligne= d */ + aligned_len =3D ROUND_UP(ht->len, 16); + if (aligned_len !=3D ht->len) { + /* zero the excess data so the measurement can be reliably calcula= ted */ + 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) { --=20 2.31.1 From nobody Sun Feb 8 17:13:49 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1633179297; cv=none; d=zohomail.com; s=zohoarc; b=aj8qF57364g6TC7bA/ELLHBkZobm9RHTWchgRzyccZA0AKE6QNifWHJa9Xp7Kzf4PftDv43zReKEY/stUFLdF+6zaRjXddhYEqn9h3P22UZ7tZcLa7cz/JlztfbMKSba60VfAGa/LHpCzFPLYkB8o+n/9qvUrJsgkFveZ+gVZRY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633179297; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=HQMlJLpBHn2fUxB+2/XhMlNl1C9ZrEw/LRArmGOAdEM=; b=CL4WTUeOBEqnsd/rvTmRoAGjSQBez0EXAymcnR7fpTjVlD1Fum54c/dM08DLXFrmKCexsG6NCa5ar3g382A1O+mDljhULWQbkED4q1J1jzJokLojr6u6l/sL0J82sQ+bNubjFnbWFrd+sSXd6MGiSs1eulEQ4/Gl6WPFOvxd3Us= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1633179297389976.2393262941637; Sat, 2 Oct 2021 05:54:57 -0700 (PDT) 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-140-eapM5VdjPA-1AtIU6VbKrw-1; Sat, 02 Oct 2021 08:54:55 -0400 Received: by mail-wm1-f69.google.com with SMTP id x23-20020a05600c21d700b0030d23749278so5119578wmj.2 for ; Sat, 02 Oct 2021 05:54:55 -0700 (PDT) Return-Path: Return-Path: 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) 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= X-MC-Unique: eapM5VdjPA-1AtIU6VbKrw-1 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=0gz6vM1fuXfXd+tlEwoy9TRK2KCL+7bCbggKnavmNYPoOzG23cFyDclHAfFa6noB5m A194m5jq7Bk0sMc3E/OzTdcQePGzqMJxXbmU8O0Qq3xkAFdOmimVZ+HuWOrCKQ0tPouI d5OZo8+lPCfLUMtWmm/OeccPendRtJo5YMkd5ATIWIUpzIUKpOe/iQ38o9lpiQb8L30w +BsB8MP97EfMkR5HmlEYkk/3opbRw5NIVJP8k0zcyA5S+LFFAL4adMVrrrGLHH3LGcPs pGwyzIZPpVFwe8c/TqARpI4k0f4WpPfdvF9NC2hzAIJNhCNIyyXfPt/x/sxGBhbbbB3u poZA== X-Gm-Message-State: AOAM530zrcIKLTODR8cgCdN3gm0E4BdfGr9/BMil0XIe0bTQ6T9ZnyME MIz8tBkVGo5adDQLii87tDvkPLjqd1g3Ibh/uvdxIlaA4SgYm35mRk/yFu1Fj9bhIyVLakHbsqJ M9VXiH74pzqKeDw== X-Received: by 2002:a05:600c:a05:: with SMTP id z5mr9289018wmp.73.1633179294184; 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) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Dr . David Alan Gilbert" , Dov Murik , Sergio Lopez , kvm@vger.kernel.org, James Bottomley , Eduardo Habkost , Paolo Bonzini , Brijesh Singh , "Daniel P . Berrange" 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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1633179299537100001 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=C3=A9 Message-Id: <20210930054915.13252-3-dovmurik@linux.ibm.com> [PMD: Rebased on top of 0021c4765a6] Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- 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" =20 #include "hw/acpi/cpu_hotplug.h" #include "hw/irq.h" @@ -780,6 +781,7 @@ void x86_load_linux(X86MachineState *x86ms, const char *initrd_filename =3D machine->initrd_filename; const char *dtb_filename =3D machine->dtb; const char *kernel_cmdline =3D machine->kernel_cmdline; + SevKernelLoaderContext sev_load_ctx =3D {}; =20 /* Align to 16 bytes as a paranoia measure */ cmdline_size =3D (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 =3D (char *)kernel_cmdline; + sev_load_ctx.cmdline_size =3D strlen(kernel_cmdline) + 1; =20 if (protocol >=3D 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_s= ize); + sev_load_ctx.initrd_data =3D initrd_data; + sev_load_ctx.initrd_size =3D initrd_size; =20 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); } =20 - memcpy(setup, header, MIN(sizeof(header), setup_size)); + /* + * If we're starting an encrypted VM, it will be OVMF based, which use= s 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 o= f the + * file the user passed in. + */ + if (!sev_enabled()) { + memcpy(setup, header, MIN(sizeof(header), setup_size)); + } =20 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 =3D (char *)kernel; + sev_load_ctx.kernel_size =3D kernel_size; =20 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 =3D (char *)setup; + sev_load_ctx.setup_size =3D setup_size; + + if (sev_enabled()) { + sev_add_kernel_loader_hashes(&sev_load_ctx, &error_fatal); + } =20 option_rom[nb_option_roms].bootindex =3D 0; option_rom[nb_option_roms].name =3D "linuxboot.bin"; --=20 2.31.1 From nobody Sun Feb 8 17:13:49 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1633179301; cv=none; d=zohomail.com; s=zohoarc; b=oKpmsIebiPmVvgcDgRvObrcxMMMYdzJJkbZ1F6QAoxVRalFawQPHvQNgAC6iFbd8SzmblH0Bc737CdY64vaz1G6GKF0D5Z51KjkLgPm8Rtt3p6Y76Hp4y7iWCWGhcbE9P7ea+KAgBYtzkA9bjdU4Mz+w81RS45JQUDDnEot0aXc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633179301; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=9cOF84rCmS7WTO0HbW0oz9DUXo06vj+3GXepVVOD4Pg=; b=KIIy3+FBTKhUAuAr70Ot7TAaJ43w7JtN0ImECaHV0kjGCrhPi9qmo0W275TjHqW1FMdksf3YeG6F9GZNGxKx1qvhih9MsOrbNG6ztn751p01jFeXvud77rNApz0ON5qszwYO/4gxsab4LvKbVvTQwdKp8o505/E+WnzJ/3Xu3pU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 163317930177627.187862304912528; Sat, 2 Oct 2021 05:55:01 -0700 (PDT) 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-453-iFhUS55IP42C76wcS8fb6Q-1; Sat, 02 Oct 2021 08:54:59 -0400 Received: by mail-wm1-f70.google.com with SMTP id r66-20020a1c4445000000b0030cf0c97157so6085821wma.1 for ; Sat, 02 Oct 2021 05:54:59 -0700 (PDT) Return-Path: Return-Path: 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) 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= X-MC-Unique: iFhUS55IP42C76wcS8fb6Q-1 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=RZjW4eAWmDrharifw0U5B+KmIqweuC9oGJVUlnq+UnlxyddrLzn+CrZmAlLcfRVxWT rve7R1Cr6i9Dhy58QaDiDEgkQ/aKl1zf88y978202iythv5nABme49HlmzveIzhFsjxy 8DJmXEtiIspcjpISgqemdxARzr3D7O/AwAH2h/DgNvYJxhmR9ZR0Hep3LtRsDJLyyuGY /hNpJqfgiLvJpNo1kakgAM1k8Ko8RppEDwl3IEL6Q/+xhseA92mZvrGtTX0YNIIDHnYZ j0Dyyvccfr4M6e2febNH9G1UxeGLyIExtWLQ7pGVC1AAh1BMXD1nMRmSZ5gCQCuix/do 0R/g== X-Gm-Message-State: AOAM533djI4+r+G7ZpAF+eOVZ65nXx2ZrI+WerN4udU2KEYeHIv7c5MJ sEftRmesWHEkLCsLsCSFclEMCej9B5f2knqWYXVK1HErtrABEuxr+o0cezUACgFy1mdip3xO1NY 6u/tWRtQqrtU63w== X-Received: by 2002:a05:600c:a4b:: with SMTP id c11mr9217345wmq.97.1633179298648; 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) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Dr . David Alan Gilbert" , Dov Murik , Sergio Lopez , kvm@vger.kernel.org, James Bottomley , Eduardo Habkost , Paolo Bonzini , Brijesh Singh , "Daniel P . Berrange" 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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1633179303836100001 Add an entry to list SEV-related files. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- 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 =20 +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 --=20 2.31.1