From nobody Sun Feb 8 18:10:39 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=1633623446; cv=none; d=zohomail.com; s=zohoarc; b=gvulnfnWiHCZxi2KyD8Isei6eETLk4STppowMYepaXXFZ5FIM9KamLqBg9bzNFuL1Pk3SCoZzYROJojZeWyY2D1pyJcG57tvdI8KTEzmMuR1Rh08IvimB1Ow20YZEqiDoLg2y9b31hpnxkyh9410grGywMagd4kuO0XpGNczefM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633623446; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=GNtxCZGvnxhj0iwK4swW8c7ZuwhRSlRGtvMCk2ldQWo=; b=kiXrcBmQmOWprjwuk8O/3Kp+J/nwIT75gLsSEI2rfqxzs2ztOXIMSfR8oWcwDWvCu0aQadTSAdcsfVgWInGUJAv6weh5f63zoLhe5gGea/jbAMv4oNzv8tvgSIB5Rye9HqkM21Jk0rNr+CENP3jINoKSRCFcbkqThkpNGgz6boo= 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 1633623446944307.8912275988911; Thu, 7 Oct 2021 09:17:26 -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-539-arYofFYZNHO3vpUgycdlyw-1; Thu, 07 Oct 2021 12:17:24 -0400 Received: by mail-wr1-f70.google.com with SMTP id r25-20020adfab59000000b001609ddd5579so5115947wrc.21 for ; Thu, 07 Oct 2021 09:17:24 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (118.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.118]) by smtp.gmail.com with ESMTPSA id d8sm48710wrz.84.2021.10.07.09.17.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Oct 2021 09:17:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633623445; 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=GNtxCZGvnxhj0iwK4swW8c7ZuwhRSlRGtvMCk2ldQWo=; b=GV3VS7S7T3TJI5NOvA/o6zMpnXJfw0k1XzNbixajGZkChWBndiSY3BfGMQas/JhHb62nRM kad6MoHDcGqYRe8YpbgfqdPg1V6lLHjZIMsCbaHGDHhVSMKN9p9ostmNR8fk5iEmuWIPS4 OLuycsu1eogNZuQSxGj/dgfdmw/p4sk= X-MC-Unique: arYofFYZNHO3vpUgycdlyw-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=GNtxCZGvnxhj0iwK4swW8c7ZuwhRSlRGtvMCk2ldQWo=; b=dV4tnbHCrWzYodLd/Z7HMzuDjspAvvfuDLXB3+pqiykPxQRcxZqTwV4XkntKjAQuDy sWbrE9WxDHsXFXkNMKGMYl+gwdXRldvRNb01YZA99xg94j2UUXR3HpdlRQjOHwt93s89 vwo2UmJJKmq6Luz6m2arSKxIovHGeZPjh8cIrLYefJd7MM/Nk2hEe4eEV/U1u0vdB7nK kwRrGfVdaHnE0k9uM7nLmXBQAHV+ISZ3wcQuMtLoPxAvPj3p5whVzEpbUyM6qKdlDMHq jUYu+Kgk4mB3rld1kXjjGiCHH9TgMvryqk62dH4rvQZM4rqQKGCOk10hnG5fX8QxliTm 1l9A== X-Gm-Message-State: AOAM532dOEYN00T22J1VusugmSB5ygxAYi28Of8E1uE7PeJY9hPhmzKF XZDGKVKzkZZcpOb3TJbUhMXVh7KilBKvDQ01kV0zPQdMHJCnmtrMkL3l3qyR+c42xNNPUb0ASOW LlPuZFmUnGI1LlQ== X-Received: by 2002:adf:a15c:: with SMTP id r28mr6657726wrr.287.1633623443181; Thu, 07 Oct 2021 09:17:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz+RMzqKfLp1HEW7IFDLlNjEi/iRuCQ1sFP+CVWglEu2hUVLxRR+2IyjSGZpZn9KcPO5riLYQ== X-Received: by 2002:adf:a15c:: with SMTP id r28mr6657700wrr.287.1633623443022; Thu, 07 Oct 2021 09:17:23 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Eduardo Habkost , kvm@vger.kernel.org, "Michael S. Tsirkin" , "Dr. David Alan Gilbert" , James Bottomley , Brijesh Singh , Sergio Lopez , Dov Murik , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Markus Armbruster Subject: [PATCH v4 01/23] qapi/misc-target: Wrap long 'SEV Attestation Report' long lines Date: Thu, 7 Oct 2021 18:16:54 +0200 Message-Id: <20211007161716.453984-2-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211007161716.453984-1-philmd@redhat.com> References: <20211007161716.453984-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: 1633623448632100001 Wrap long lines before 70 characters for legibility. Suggested-by: Markus Armbruster Reviewed-by: Markus Armbruster Reviewed-by: Paolo Bonzini Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- 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 18:10:39 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=1633623459; cv=none; d=zohomail.com; s=zohoarc; b=NFYIw2bPzreO/JFWYd+2t8szISqqHu3dVRsY+a+TFYfLmxUjHSgv+20Uu+Ex+c34nVaMO3HnKfJvpm4xhVJcjG0N4elZY0+8k+9FO1ZVuUkFYmtIJI52Juroyp77OXdW0SHGY6iYvzDo34Df8rv1O21rBVEgUtuU1C+y8eAn6S8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633623459; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=T2ImpqtRm6esWhnoDgzoQLTDZKGPR7WZ/icRmMlGH5o=; b=buXX3pIX+br2Cx1O0QV1SKbOH3a7SB0uZvJyIjRpDESHE1kZZMIBS5QdTYWaGsQNChFieThOhpmWiFSP9joZXNl3t9gqRZOI8qHhZtlI+6xxzQOaR+uNmpCEL/eCipVc/vWPa/dRxvdq0aO4WZEo38tQnAADV9Spxcv9RKl8W7M= 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 1633623459325305.5517156834867; Thu, 7 Oct 2021 09:17:39 -0700 (PDT) Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-110-03Ts1Q-sPyOBlIDc34iVoA-1; Thu, 07 Oct 2021 12:17:29 -0400 Received: by mail-wr1-f71.google.com with SMTP id e12-20020a056000178c00b001606927de88so5113054wrg.10 for ; Thu, 07 Oct 2021 09:17:28 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (118.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.118]) by smtp.gmail.com with ESMTPSA id w11sm4476wmc.44.2021.10.07.09.17.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Oct 2021 09:17:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633623458; 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=T2ImpqtRm6esWhnoDgzoQLTDZKGPR7WZ/icRmMlGH5o=; b=jLyxZatifkaieAlSYIBpbaPzXcuGbH16zockpCbtJc3Zqaxy8yqIRvE3zW/RnClGHt0Joj Ahhr+ftmepWutc+qRISLqiLu0MO7bZuBMcBFgJxYGAz7hBPLhrqSw1gAnumuwn5uWYijDz KPBwgv4K6pvrDxwPkCwB6mkWCXTyisY= X-MC-Unique: 03Ts1Q-sPyOBlIDc34iVoA-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=T2ImpqtRm6esWhnoDgzoQLTDZKGPR7WZ/icRmMlGH5o=; b=ptcLLVZ+4QWZWKJnF6Gn6A4Y9NDStzO1OElbGApO4HZmYh9uOVRUG8VowbiEBYz87B 6CA1nBTQ6HFohT4QNoYPM9SCIhGKm624pdkpRAWWO41LPIeXYilTRkaanRHcm9lTMAVs WYchdML5S2dTRHuf6iKtRGC3KqTj8SI08COfR4sdrVvqqHTBa1LY91AXiaKAxq3zYoWs Kwa/U1tBT8PqXdwIs1pXXeErvVfR0hdDP1rCyyi9uGKJu2xyFP/+pfBXksGhmAg+AX7f dLB+HywXweHdmcJ3/5nTQMkTERwD/9HE41H/pFuUY5eRt5wwz6VZ9BsoEZz68WUssArv 5hMA== X-Gm-Message-State: AOAM5335Acv9TwnJaWs+NaDI4LTqUydvLrRBbZJROKZjRfDjr90rb9Mk TgVBknQvBQ0SSS89q+w3IaozA7mRfZmQsdLQsrx57etAPtTtL8/kNt+AkrnayH+BrVhudSgTxjM yQoquzx5+0ZrLvA== X-Received: by 2002:a05:600c:240a:: with SMTP id 10mr17330253wmp.170.1633623447866; Thu, 07 Oct 2021 09:17:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxXiHFJgriMo7TGc679FzXDocjunP1esVffm6c4eGKKXk96WSVJZU9pFdlw5+ue8yJioBiocA== X-Received: by 2002:a05:600c:240a:: with SMTP id 10mr17330219wmp.170.1633623447678; Thu, 07 Oct 2021 09:17:27 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Eduardo Habkost , kvm@vger.kernel.org, "Michael S. Tsirkin" , "Dr. David Alan Gilbert" , James Bottomley , Brijesh Singh , Sergio Lopez , Dov Murik , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v4 02/23] qapi/misc-target: Group SEV QAPI definitions Date: Thu, 7 Oct 2021 18:16:55 +0200 Message-Id: <20211007161716.453984-3-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211007161716.453984-1-philmd@redhat.com> References: <20211007161716.453984-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: 1633623460105100001 There is already a section with various SEV commands / types, so move the SEV guest attestation together. Reviewed-by: Paolo Bonzini Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- 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 18:10:39 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=1633623456; cv=none; d=zohomail.com; s=zohoarc; b=MipYmSjOgtwrDlkNfxjpaPu2ES3iudvqshmexHIqv4LxCur6ol4Ew04CL8iuTYozfzKs0nPOIr4QT5zf8MtjwYFu9WfxYrJMoNy0KseE/sYlf02gC1SUaeh0ykpOrCdBey33DwcCrWP3Xl2hknV1ZdFYR7Xy6cbFliOKCmOsfFM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633623456; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=Y8MKkMv6eEYqC4N/epBYvYnHUWa4qpxEvyDLGqIxORI=; b=FDqCgZlJNEr3HcVwbi5h1lGVsHtuUNl0XfENV7RQSx5djgJxXLd4ZANaW9hvTMIyz4dUYnfrc6D8LvIIdZsgcraEjx//vArDGkAWM7pU2J3y3DUkM9zaavOcWOF5us1PFDWvkFUxJLOK2BVlnVj0si+do43jnAewXLl+mFui9zE= 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 1633623456499401.66037159605105; Thu, 7 Oct 2021 09:17:36 -0700 (PDT) Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-475-_2s6z9Y9Mteiu4MTQILXBQ-1; Thu, 07 Oct 2021 12:17:34 -0400 Received: by mail-wr1-f71.google.com with SMTP id 75-20020adf82d1000000b00160cbb0f800so4355712wrc.22 for ; Thu, 07 Oct 2021 09:17:33 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (118.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.118]) by smtp.gmail.com with ESMTPSA id y23sm1024155wmj.42.2021.10.07.09.17.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Oct 2021 09:17:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633623455; 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=Y8MKkMv6eEYqC4N/epBYvYnHUWa4qpxEvyDLGqIxORI=; b=IFF3vcia44C88nr0U/W2xUB442PcmYNXJnuZZSuEa4m52MQK/scGiz5bw6DYG3y4IEsLp3 ON04kKfh0mmbaKcjNpbnngG1pG5Le/i/QqSry6M12cJ7ma9d5pczknE8+su8BLhSDoLU6f kxMEtOrF+z3GXBsqHmmmgEEvEv2AoRM= X-MC-Unique: _2s6z9Y9Mteiu4MTQILXBQ-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=Y8MKkMv6eEYqC4N/epBYvYnHUWa4qpxEvyDLGqIxORI=; b=2Yv1p3PCQfSMJZBokNekeM5tC7FP64+tiSvih6Lymha27goZhvOQSzIooyAaLKd4SK G3JaWHa0OgmSe/h+o/1A7P7fwTzUAE9uvDe5CRYHykeqf5dZAnHBTm7jTeKvRQCRCbsM zcMnXb/DSPneDuQ0+bFN0cP7S8ns45Z9qCr9zITxuYc4+YP3/tPcC0x9osHe7Ub45j2Y HRWsBNI0goR+QX8neHUf+xGLAAgwsEuJpMI1NLClS0CEoT356r9kZ3YXfeiPpHJnJI2V WxZZR+vaQti8WfuFhCTh8+OFsguv1AYmBbFKIwR7Y6Mju3KATV3ppDZwmOZXQcS3ATB4 lxDQ== X-Gm-Message-State: AOAM532vVxva7aqxiZ5TRru5qEnIhdu1XMg3MUW8eN8fdYwws3W2Pjlo CSp5dv32cr/MSBB0q3br5qPdTmWZg/4oyhalBFJElU7M0EgblAW9z1i9Us9IfEJ0tvmlU366C+o PEdewStCgHTlY/Q== X-Received: by 2002:a1c:7d56:: with SMTP id y83mr17824178wmc.86.1633623452323; Thu, 07 Oct 2021 09:17:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwF+d5yHeqVCso2c8JoGm6EX0nJrH1IGYECCnAhCYPfhEDrS5UZoqX1jwZPwYaiW6EnnPePGQ== X-Received: by 2002:a1c:7d56:: with SMTP id y83mr17824160wmc.86.1633623452185; Thu, 07 Oct 2021 09:17:32 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Eduardo Habkost , kvm@vger.kernel.org, "Michael S. Tsirkin" , "Dr. David Alan Gilbert" , James Bottomley , Brijesh Singh , Sergio Lopez , Dov Murik , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v4 03/23] target/i386/kvm: Introduce i386_softmmu_kvm Meson source set Date: Thu, 7 Oct 2021 18:16:56 +0200 Message-Id: <20211007161716.453984-4-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211007161716.453984-1-philmd@redhat.com> References: <20211007161716.453984-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: 1633623457691100001 Introduce the i386_softmmu_kvm Meson source set to be able to add features dependent on CONFIG_KVM. Reviewed-by: Paolo Bonzini Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- 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 18:10:39 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1633623565649617.4699883417773; Thu, 7 Oct 2021 09:19:25 -0700 (PDT) Received: from localhost ([::1]:38680 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mYW79-0005wL-Ez for importer@patchew.org; Thu, 07 Oct 2021 12:19:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46980) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mYW5V-0003Hk-LP for qemu-devel@nongnu.org; Thu, 07 Oct 2021 12:17:41 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:49738) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mYW5U-0004hB-58 for qemu-devel@nongnu.org; Thu, 07 Oct 2021 12:17:41 -0400 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-300-ipvgLNRFNpCHuDkWc00hBQ-1; Thu, 07 Oct 2021 12:17:38 -0400 Received: by mail-wr1-f72.google.com with SMTP id r16-20020adfb1d0000000b00160bf8972ceso5115866wra.13 for ; Thu, 07 Oct 2021 09:17:38 -0700 (PDT) Received: from x1w.redhat.com (118.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.118]) by smtp.gmail.com with ESMTPSA id 189sm10244544wmz.27.2021.10.07.09.17.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Oct 2021 09:17:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633623459; 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=uq3GCe1ePuf4e4h9nXgJWeyky4oXCfK2GmOEpWIO22Y=; b=aS0Yf7/9ZNlbn9WnrCasxFQyUI6CU/K/HHP5d4hgCzkuLuUOI6v6eQ9DjEhRmXlaLyuQUB 7DITJkVqREc9F/1JfMjuKzcwrz/oUWvlyeo8wFHH6TxUmHuG6NLaXozS8tWojqS3dNjP1J BfgK96DV/dqaL2sg/wYoVi/n+Qzd/7U= X-MC-Unique: ipvgLNRFNpCHuDkWc00hBQ-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=uq3GCe1ePuf4e4h9nXgJWeyky4oXCfK2GmOEpWIO22Y=; b=uBRafT7pkLUczFs+Oz0azt+CSZ0XTInLFFErCJSU0p0gGVr5odnPORFXtf7UaEpsED FNGl8rjJXBYhuIhsL/5DyIKZh4Njqvo3XmQwDsGq0M7z7VLjS+f3/P0D/agJp2fuLrkF wgHpNln957PJjQ3je7lESOVRdOtpkP4SHodZLnY4HdT3YFgyhkTH6qyx2+1Nfi5d0jbp LLkHEsrOAQi7mi4cMZm3kILpGhv74vRGHNLN3ryP3Bt+2eDc/e4KcbrFacVEGsgp31fO xI0PcwqKQgaQE3hqnKQsURa6bijpN1sx4XRY1T4g3rouL1g77ZxEzQNYp9WxgWumLnDb WoKQ== X-Gm-Message-State: AOAM533Xqzm3/1WL0oILrL0rbJOo6YfpPlxjTvW9w09xGVB+yAJ++Xoh j49JzdP3a57UGj3brKEnO2oWLjrJmNoX+4NMiQMmevVy4SXv76K8DYHlW9Nk1bbFV/OLhx1lpyO NAlV0Pd2ia1f8SuW6J7DTHpikO+keffiNaRbjjK5pQuybJ8IUlU5fwxwLnMoLwBq0 X-Received: by 2002:a05:600c:3585:: with SMTP id p5mr17715023wmq.110.1633623457100; Thu, 07 Oct 2021 09:17:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyRrHz4LpvS4F9A81Irylf6VyS/KU+7ApS5LGF0wX1DCUn4RZ7VNHky7fCfqHI5KKojHx92LA== X-Received: by 2002:a05:600c:3585:: with SMTP id p5mr17714991wmq.110.1633623456879; Thu, 07 Oct 2021 09:17:36 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v4 04/23] target/i386/kvm: Restrict SEV stubs to x86 architecture Date: Thu, 7 Oct 2021 18:16:57 +0200 Message-Id: <20211007161716.453984-5-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211007161716.453984-1-philmd@redhat.com> References: <20211007161716.453984-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 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.05, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Brijesh Singh , Eduardo Habkost , kvm@vger.kernel.org, "Michael S. Tsirkin" , Sergio Lopez , James Bottomley , "Dr. David Alan Gilbert" , Dov Murik , Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1633623566506100005 SEV is x86-specific, no need to add its stub to other architectures. Move the stub file to target/i386/kvm/. Reviewed-by: Paolo Bonzini Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- {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 18:10:39 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=1633623465; cv=none; d=zohomail.com; s=zohoarc; b=VRNyOvNUkVSK3qv/87Cu1PCDxQ1IHgftyy1sggOBlGeA3OV4BQNmX+oiUSvjIBXO2fY+/OoWIdzj76Un1t2ug9H1H5OF6oSrjrM0tFpIoyUvGbBo96hlJwwhwW96Jyl9bkAclpfORuZQ4/db/0UcmwyUN+JsZENmxt6JB+KcC6g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633623465; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=YWQW4qwuIwVFhirEUS8iXAcoBuFkj6ZGIrq5y79ZQBA=; b=boEnestCGyM+R8kHvM48e+phGd7BYcZGV9JfR2zunLoS0ih3su0WoXNynbJXhXCmGcWVi15+vi0RJKj78Gy7tIW0w5e1RL58ANdRuVYhZH58VQzbP4hv2/wNRYulxTQqaQTd6OOC/WxqZ0gVtJb+gYwcJiCaqunOIPVwYqHl4BU= 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 1633623465375105.82058788575387; Thu, 7 Oct 2021 09:17:45 -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-250-hAnHzWsMO7qapDhsok__JQ-1; Thu, 07 Oct 2021 12:17:42 -0400 Received: by mail-wr1-f70.google.com with SMTP id m17-20020adffa11000000b00160c1ac74e9so5119790wrr.9 for ; Thu, 07 Oct 2021 09:17:42 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (118.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.118]) by smtp.gmail.com with ESMTPSA id e5sm88818wrd.1.2021.10.07.09.17.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Oct 2021 09:17:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633623464; 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=YWQW4qwuIwVFhirEUS8iXAcoBuFkj6ZGIrq5y79ZQBA=; b=ZVStX8WQ/vDYglNvj95se+TUlnLiFIScGjBKNl8uX4OL/JrPa15RsV/s7zTlmqH0pXvrwq SJqKjwpRVtXpyqrcQO2wN6oo+BuukcnzZU6cpCJfLLpeuwOJKJq2WpB90WQplQCxu1Jelz 6/1po4Yf0Hg2/9fZBU5w12rY+qdBDGA= X-MC-Unique: hAnHzWsMO7qapDhsok__JQ-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=YWQW4qwuIwVFhirEUS8iXAcoBuFkj6ZGIrq5y79ZQBA=; b=iew/XHXLMqRv0VLjAps5Ie23dGm4xL9ABLpJigNhxT8ubkHneUMNWP/7qkX0tr8az3 GIlYqRmY7pTp2rQDP1bLFKnpzOmgGaTfjgwHIs7UUlbIZDsG2d85YX9nj3B3NCHtZo6W MPMBTX9Ajqir2fr+psZh0S5RoT1abEdE8jp+li2x2QzRNAX4eDvG0jDjZuYmCt7hE/+w U5DbxWSjwbnUiBhHkaFkyoc2wwrP34A9x4TIjy7/uhf8YfS7VHHHGkbjZ2vPKK4fiVbX rDYFMEgajjUUsaIgxbhqDfGjkh/bU3OvMMiPVvTSpbtiY5xlAPDezv9njVxZsIRXvnPq lXMg== X-Gm-Message-State: AOAM5328DLPPjPLmuJDBO4osKkAn2P2Wq9K2s04JHWanIJ7/ZRhZGVfm SZ1WfNzFMVFQSkCjTmaGLXmU8RsQAAE42txgg18VIHD0q7fnahBX/lxDXGc8FcnkAkFCipX4NPH G1SclPYeavmEG2g== X-Received: by 2002:a05:600c:190c:: with SMTP id j12mr17723304wmq.122.1633623461588; Thu, 07 Oct 2021 09:17:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx4KQBsttMSUVTx9ahdzw6VyJFfQYYcVssfVN4N4+Jw4Mj8STX+6QzmCQF2fKgdLkdMPO9omQ== X-Received: by 2002:a05:600c:190c:: with SMTP id j12mr17723282wmq.122.1633623461414; Thu, 07 Oct 2021 09:17:41 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Eduardo Habkost , kvm@vger.kernel.org, "Michael S. Tsirkin" , "Dr. David Alan Gilbert" , James Bottomley , Brijesh Singh , Sergio Lopez , Dov Murik , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v4 05/23] target/i386/sev: Prefix QMP errors with 'SEV' Date: Thu, 7 Oct 2021 18:16:58 +0200 Message-Id: <20211007161716.453984-6-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211007161716.453984-1-philmd@redhat.com> References: <20211007161716.453984-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: 1633623466997100001 Multiple errors might be reported to the monitor, better to prefix the SEV ones so we can distinct them. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Dr. David Alan Gilbert --- target/i386/monitor.c | 2 +- target/i386/sev.c | 20 +++++++++++--------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/target/i386/monitor.c b/target/i386/monitor.c index 196c1c9e77f..eabbeb9be95 100644 --- a/target/i386/monitor.c +++ b/target/i386/monitor.c @@ -717,7 +717,7 @@ SevLaunchMeasureInfo *qmp_query_sev_launch_measure(Erro= r **errp) =20 data =3D sev_get_launch_measurement(); if (!data) { - error_setg(errp, "Measurement is not available"); + error_setg(errp, "SEV launch measurement is not available"); return NULL; } =20 diff --git a/target/i386/sev.c b/target/i386/sev.c index bcd9260fa46..4f1952cd32f 100644 --- a/target/i386/sev.c +++ b/target/i386/sev.c @@ -440,7 +440,8 @@ sev_get_pdh_info(int fd, guchar **pdh, size_t *pdh_len,= guchar **cert_chain, r =3D sev_platform_ioctl(fd, SEV_PDH_CERT_EXPORT, &export, &err); if (r < 0) { if (err !=3D SEV_RET_INVALID_LEN) { - error_setg(errp, "failed to export PDH cert ret=3D%d fw_err=3D= %d (%s)", + error_setg(errp, "SEV: Failed to export PDH cert" + " ret=3D%d fw_err=3D%d (%s)", r, err, fw_error_to_str(err)); return 1; } @@ -453,7 +454,7 @@ sev_get_pdh_info(int fd, guchar **pdh, size_t *pdh_len,= guchar **cert_chain, =20 r =3D sev_platform_ioctl(fd, SEV_PDH_CERT_EXPORT, &export, &err); if (r < 0) { - error_setg(errp, "failed to export PDH cert ret=3D%d fw_err=3D%d (= %s)", + error_setg(errp, "SEV: Failed to export PDH cert ret=3D%d fw_err= =3D%d (%s)", r, err, fw_error_to_str(err)); goto e_free; } @@ -491,7 +492,7 @@ sev_get_capabilities(Error **errp) =20 fd =3D open(DEFAULT_SEV_DEVICE, O_RDWR); if (fd < 0) { - error_setg_errno(errp, errno, "Failed to open %s", + error_setg_errno(errp, errno, "SEV: Failed to open %s", DEFAULT_SEV_DEVICE); return NULL; } @@ -557,8 +558,9 @@ sev_get_attestation_report(const char *mnonce, Error **= errp) &input, &err); if (ret < 0) { 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)); + error_setg(errp, "SEV: Failed to query the attestation report" + " length ret=3D%d fw_err=3D%d (%s)", + ret, err, fw_error_to_str(err)); g_free(buf); return NULL; } @@ -572,7 +574,7 @@ sev_get_attestation_report(const char *mnonce, Error **= errp) ret =3D sev_ioctl(sev->sev_fd, KVM_SEV_GET_ATTESTATION_REPORT, &input, &err); if (ret) { - error_setg_errno(errp, errno, "Failed to get attestation report" + error_setg_errno(errp, errno, "SEV: Failed to get attestation repo= rt" " ret=3D%d fw_err=3D%d (%s)", ret, err, fw_error_to_str(er= r)); goto e_free_data; } @@ -596,7 +598,7 @@ sev_read_file_base64(const char *filename, guchar **dat= a, gsize *len) GError *error =3D NULL; =20 if (!g_file_get_contents(filename, &base64, &sz, &error)) { - error_report("failed to read '%s' (%s)", filename, error->message); + error_report("SEV: Failed to read '%s' (%s)", filename, error->mes= sage); g_error_free(error); return -1; } @@ -911,7 +913,7 @@ sev_encrypt_flash(uint8_t *ptr, uint64_t len, Error **e= rrp) if (sev_check_state(sev_guest, SEV_STATE_LAUNCH_UPDATE)) { int ret =3D sev_launch_update_data(sev_guest, ptr, len); if (ret < 0) { - error_setg(errp, "failed to encrypt pflash rom"); + error_setg(errp, "SEV: Failed to encrypt pflash rom"); return ret; } } @@ -930,7 +932,7 @@ int sev_inject_launch_secret(const char *packet_hdr, co= nst char *secret, MemoryRegion *mr =3D NULL; =20 if (!sev_guest) { - error_setg(errp, "SEV: SEV not enabled."); + error_setg(errp, "SEV not enabled for guest"); return 1; } =20 --=20 2.31.1 From nobody Sun Feb 8 18:10:39 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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.129.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=1633623470; cv=none; d=zohomail.com; s=zohoarc; b=YPh+qZl9Zsijon/BMRMZJJtuxaq+ld+jhWL5E1Q/SdKDqdzgHkH7aaG4fx2VRS3KUjgjCX92xNkDZRR6e947QEmDELXFqD2XsMusNdhz2HNK3vbZAdSkg6PQJakySaYOQeABdPv4OhiUqYTL/MIzG/bJ//4xFWL/2TwgfzMOEh4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633623470; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=o9lSbhoBJitVWDueMdjjLMLVkRSyu1rE4Rg4emr9Ei8=; b=Z2bbJUtIXJilkkhOBSqmXA4Ta30kWrBjaDq7wQZRkaHRwox57XW0Vau6ig/oWYmC/gWh/TVmSPIbT2nUj3UB2nq9wXbQ5N9mH23c3UqaVKpfg08TonGfkatyF8kT3r2LsrNZG6kqUtlfyXdliTxs0a+7MxOPL4Z0QIMYHVPh5pk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.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.129.124]) by mx.zohomail.com with SMTPS id 1633623470340754.4193602853262; Thu, 7 Oct 2021 09:17:50 -0700 (PDT) Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-43-cB0LOtu-NraVin1n1guCJw-1; Thu, 07 Oct 2021 12:17:47 -0400 Received: by mail-wr1-f71.google.com with SMTP id 41-20020adf812c000000b00160dfbfe1a2so1450360wrm.3 for ; Thu, 07 Oct 2021 09:17:46 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (118.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.118]) by smtp.gmail.com with ESMTPSA id x15sm51076wrl.74.2021.10.07.09.17.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Oct 2021 09:17:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633623469; 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=o9lSbhoBJitVWDueMdjjLMLVkRSyu1rE4Rg4emr9Ei8=; b=LKGWtvBY357RpRJt3l25M0pN2JPgk3OFjogVrGp6s3NzAPfOl/DitfTD7GntS6mNPQe4dd 0HhY8zSN3SFHv2Yo7iyjBNalX6LCR1l2/qH+1gKCFw5iXgtcjn26nBD6p5IF9r0L9Ud+sF KaoxjR1XSuzxPsAlCA8frRiMhEOd9xc= X-MC-Unique: cB0LOtu-NraVin1n1guCJw-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=o9lSbhoBJitVWDueMdjjLMLVkRSyu1rE4Rg4emr9Ei8=; b=vWnaSwAK4Yb3b92b3n+qsG2ME28VcE0AwbqAUSczX5FFg1qCKmfKFMtOgRqJRTCaYK 9V6CFc6JhgJhT5TsxrLNpTf3ToNuMmiRvSmQlIDDEiobutmbKNXVl2YZYcRhnWzXn1wn /fVykwjIRo2srqklr2UMNHclmeIHXjyCUf0GI258/uUDyS8MX0nG9svQeQEac46eA0IF /fuesAvZZDjK1j07g7w5wSxgx9n+mnR87I2xuMJMmd0jhTCRULreeMEldD3gmkzEwnuZ W4H6dUzfVlVKBcbX5D1D0NIsX/PvRZPdNJp9FfCviODOUrv4TtVv0+/YCNyxvZd0I4uP SlBQ== X-Gm-Message-State: AOAM532OE9jLmuQC8chv9j+AHXBYQflVZAuXwInLMhaT2D/8GTLUk1t9 uZRUniH3bvVHRAq1kCynVnzQoymKvc4q/oQxEVUVmhPAcAibvLw2bU1Ym3ZTVfPQOLi6aD5Vjbg BR8T0i9D9x8cGkw== X-Received: by 2002:a05:6000:550:: with SMTP id b16mr6795183wrf.297.1633623466017; Thu, 07 Oct 2021 09:17:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwnfMiJdq3t4lKJrJn6gn2ZgOjVVHTpcfnmUwoUkpuTzHD+tLUzVsylqOO/srQz9P+TjP4dcA== X-Received: by 2002:a05:6000:550:: with SMTP id b16mr6795160wrf.297.1633623465856; Thu, 07 Oct 2021 09:17:45 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Eduardo Habkost , kvm@vger.kernel.org, "Michael S. Tsirkin" , "Dr. David Alan Gilbert" , James Bottomley , Brijesh Singh , Sergio Lopez , Dov Murik , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Connor Kuehl Subject: [PATCH v4 06/23] target/i386/monitor: Return QMP error when SEV is not enabled for guest Date: Thu, 7 Oct 2021 18:16:59 +0200 Message-Id: <20211007161716.453984-7-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211007161716.453984-1-philmd@redhat.com> References: <20211007161716.453984-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: 1633623471383100001 If the management layer tries to inject a secret, it gets an empty response in case the guest doesn't have SEV enabled, or the binary is 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: { "execute": "sev-inject-launch-secret", "arguments": { "packet-header": "mypkt", "secret": "mypass", "gpa": 429= 4959104 } } { "error": { "class": "GenericError", "desc": "SEV not enabled for guest" } } Note: we will remove the sev_inject_launch_secret() stub in few commits, so we don't bother to add error_setg() there. 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 eabbeb9be95..ea836678f51 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, "SEV not enabled for guest"); + return; + } if (!has_gpa) { uint8_t *data; struct sev_secret_area *area; --=20 2.31.1 From nobody Sun Feb 8 18:10:39 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=1633623476; cv=none; d=zohomail.com; s=zohoarc; b=Bg5k0NkX9uKRRz9Chsm3x3Z8H1rJuHUI4sK1AG1AHbp+sPn3+9Y38fqgjzBEXyH9uKMMBACjJKDxv4FHvfdZkiNK3EYAfRJCJ9XefZH7q8B0jSSaGhhaexGgN2Lc20z1OaPlt7TXUVe9PfCVLbYQfLaMq5nzoZsopI7kq9Pm1Vo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633623476; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=nFJahcuQnHhP8I03izotVBJeAm6M7KThunSrXMbgTQ0=; b=fjIE/x7Skrv5S2oiFBTABIjhpF4Fd69PPoebejWYTOVQ2cAxKksHsna6xVnuClVBDB0e71rcTKw/vrF01RFf7zDhYXmvKPFqmQTsmVXzcdE81RAYPMIe3fs5Nu3xAYRQn1ZL1vz++ic+rN3Mpcrw0eB0/cujnqgQ/kMpcj5pWTk= 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 1633623476751414.41542869828686; Thu, 7 Oct 2021 09:17:56 -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-287--ETgs16MPyuXaZyExzL9YQ-1; Thu, 07 Oct 2021 12:17:54 -0400 Received: by mail-wr1-f70.google.com with SMTP id d13-20020adfa34d000000b00160aa1cc5f1so5118220wrb.14 for ; Thu, 07 Oct 2021 09:17:53 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (118.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.118]) by smtp.gmail.com with ESMTPSA id g188sm3421wmg.46.2021.10.07.09.17.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Oct 2021 09:17:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633623475; 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=nFJahcuQnHhP8I03izotVBJeAm6M7KThunSrXMbgTQ0=; b=E9e6qrQEAl+p4NaBAP6a28G3iwD0AEeATYYiNuawL6knec1Z4wf1ukF9/1gPSKcFqDPaRg lqucypBGZ80/JSOINEu6z+6bc5bVcqALJdEKEtrsKNwWp4tmC3RoC4KxBEDv1wKXLfk/zt 7Nosz4FPBQX9EaEcU4H7DXEaQgSjXeA= X-MC-Unique: -ETgs16MPyuXaZyExzL9YQ-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=nFJahcuQnHhP8I03izotVBJeAm6M7KThunSrXMbgTQ0=; b=t9KFOPwFd/iRwYLT3toHaoI3f+32O6HdTJAXmuwUT6o0BiU2glR/VPXgQgZgiX9LrI agddWr0TyUf6x6mD6+HPic1O7oAKUTEbKQdnBynmbcuCL9olaGqAMaD8YO8uj+1Zf99a PZxJwJhT+waG3qjbm2rBwjecGxoVjjsgRWkV5CcfgiIRpDtNmjw16D7UF3CEs6G5fjsv /7RAcwAdDfuJrOB9nnepTLIR+EdyAsodDQSlSZRaB4GbaNEwY79/bKiERRpSspNb6F1T ics7HP5hh5Z33PmVftvVBy5VWhXbNoTOp8nVuOOstlobfhUN9BaGu81Fk11ZouJo4Xxt f4bw== X-Gm-Message-State: AOAM533mMub3EiAX8t2dcq3biIELK2/JPG2eNv0vOhVSaLvGZx0bPPMn F4I9QwdCmQUALrHEQoFjkh1c7ZKTtcDo4CxDhkaC8R4wKKvpmMzBW0I0z35DYYGpOrASTp72GBG GOXMgH6LrZ+6oeA== X-Received: by 2002:a05:600c:1552:: with SMTP id f18mr16953009wmg.184.1633623470770; Thu, 07 Oct 2021 09:17:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwPwOfgjE5w95h/skhL3N9RbbkKUO9R/p4rTX9ZmdO5wFGvZ/OZfqfGMboNdzGu5nRI4AFFTA== X-Received: by 2002:a05:600c:1552:: with SMTP id f18mr16952983wmg.184.1633623470613; Thu, 07 Oct 2021 09:17:50 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Eduardo Habkost , kvm@vger.kernel.org, "Michael S. Tsirkin" , "Dr. David Alan Gilbert" , James Bottomley , Brijesh Singh , Sergio Lopez , Dov Murik , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Connor Kuehl Subject: [PATCH v4 07/23] target/i386/cpu: Add missing 'qapi/error.h' header Date: Thu, 7 Oct 2021 18:17:00 +0200 Message-Id: <20211007161716.453984-8-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211007161716.453984-1-philmd@redhat.com> References: <20211007161716.453984-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: 1633623478213100001 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 Reviewed-by: Paolo Bonzini Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- target/i386/cpu.c | 1 + 1 file changed, 1 insertion(+) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index a7b1b6aa93a..b54b98551e9 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 18:10:39 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=1633623480; cv=none; d=zohomail.com; s=zohoarc; b=C92iKi+8g5o6nlvzE+bju+u8f69tOxMmYNMvJcHDbpU5MwefhG8FX2HjuzmUxYCc+/AjESSGFdNi5a/rLE+tgKfFUBM595fBZGhl93L/RirvKlHS6kbeBLk2nszlNxoZr1ztYZgGhawB1b+vQqR3EN4OL9VrpZzGtY2KA/9zllo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633623480; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=gGHqQ6nijElfXE8z0EcIVqckplNgbvyU+2uRGsS/qhw=; b=h63HIl3JdynNYyuZX7qKTJLNdV894QYuuptgODGGmEGLS72ozJlpKDkH7rSiGypGwU7xbs3nN6gfWKBJlwmnf97HvVOnqSorherZB2POYZeHYTLCDPr9iiXcaP03EdX+c/j4LUM0cuv5/sjNeMvLaPZMV7/V7iDVkNUGElZ/xC0= 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 1633623480828499.7528468895547; Thu, 7 Oct 2021 09:18:00 -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-576-PC8zZFozNo6etO8_UL9xDQ-1; Thu, 07 Oct 2021 12:17:58 -0400 Received: by mail-wr1-f70.google.com with SMTP id p12-20020adfc38c000000b00160d6a7e293so2632690wrf.18 for ; Thu, 07 Oct 2021 09:17:58 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (118.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.118]) by smtp.gmail.com with ESMTPSA id z5sm12440932wmp.26.2021.10.07.09.17.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Oct 2021 09:17:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633623479; 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=gGHqQ6nijElfXE8z0EcIVqckplNgbvyU+2uRGsS/qhw=; b=M/loBYOIJjEofziqONvIoumgd1LYscMN4vcYHE8p8bRBKwPB8l095/TeHJ2G70u+KT5cVW /v0+eTF4l3kkjPcXNZCgoMUa8haE6oolUM3tbLHTDATeuwzfdunaZnRpc4WSjQfTc5jELm wlSVyj7pM0bWjQbGb39kH0Dsz2dS5Bo= X-MC-Unique: PC8zZFozNo6etO8_UL9xDQ-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=gGHqQ6nijElfXE8z0EcIVqckplNgbvyU+2uRGsS/qhw=; b=4rWjZ/n7PMKvbL4lrWz3FfNjL1ztfiYuvvcmcKPMAUclslU9k170pl5pIFBy2QcwRC Nl5ZiU6XGa6ZMiOj2NHRARpbImVRuf4DYDzPs4mzSnbSFWxXFiYV/hKNBk4t9FC3h2fJ 1+s57XHoIk4oRvpZEuETWklKzX16slbWo2AwQbqUwTOuOBFO9xt5niJySoMizU6tnUyA PPIQ/f5GpTTHyhQX+bkZ+auZfSkWomjFwyt8tihVajOmiSvkhge5SfPKJtx6FXKf8y3l +Fr9xoAZakP8ezapr+Ferc4iWyqMx1wEd6enFT5pL0/l63Q47d1xANcADiI4QIUpNoDy kItQ== X-Gm-Message-State: AOAM533WgDTCpUmsIjvi+TNbL/wVaCsZ0FO64m3uw3KOFQ2L39y3NbH9 +14Wg5RSPkzW2zhv0PVu9c4XQCrq86MF841evjsYePT3+GGn43dBzEOf3dV3DR3PTBrfsEQ1xvk Ztl6hNvzBKzQaUQ== X-Received: by 2002:a7b:cb4f:: with SMTP id v15mr5561587wmj.21.1633623475369; Thu, 07 Oct 2021 09:17:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwfpdMNhU4CbAVvUdxNmWaSwoJzzerQY5uah7o9Fgx03HmJkEu8zn8P5fwyEHm478TyAhx7tQ== X-Received: by 2002:a7b:cb4f:: with SMTP id v15mr5561558wmj.21.1633623475187; Thu, 07 Oct 2021 09:17:55 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Eduardo Habkost , kvm@vger.kernel.org, "Michael S. Tsirkin" , "Dr. David Alan Gilbert" , James Bottomley , Brijesh Singh , Sergio Lopez , Dov Murik , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Connor Kuehl Subject: [PATCH v4 08/23] target/i386/sev_i386.h: Remove unused headers Date: Thu, 7 Oct 2021 18:17:01 +0200 Message-Id: <20211007161716.453984-9-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211007161716.453984-1-philmd@redhat.com> References: <20211007161716.453984-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: 1633623482629100001 Declarations don't require these headers, remove them. Reviewed-by: Connor Kuehl Reviewed-by: Paolo Bonzini Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- 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 2afe1080690..9bf6cd18789 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 d8e65831714..408441768dc 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 18:10:39 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=1633623483; cv=none; d=zohomail.com; s=zohoarc; b=ZS7AbAYK+g7UGXdivvqklz58kz/1+tqZ5n/2UeiEWdpEiL2p/AQTpvlSNqE15SA207BFLDhf5BbA6DqGldd57M/sckzPQjJ4hQ1pjs1J9M1o1NHomvsdHU6MJDNHuULESj+A1Jy7d7GuS55fGz18ooe+DUBQbww6TgcCBU+TRcM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633623483; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=sSsWEPfIasNtfedQFCfGwO+jHWqTcMPZG0w8furmgm0=; b=cPoAcdAVqvRQ8ulg7LG4gLEhfNfXFiNKGbJ3f9MzEufbgRTWPimhF0Mcbae7X7kTS8K0wakFbfGEbyDhH7S9zJe9+Yl8+t4YjNUBzPyaupD4ahSD3JcFd9FHe4wMrjsGGZdSVfux1FyREWPG0St57obM3aC24uWyQx2ydT3c69A= 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 1633623483851669.7493744850937; Thu, 7 Oct 2021 09:18:03 -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-501-GdpitIV5MvCjGt-PlHOZcw-1; Thu, 07 Oct 2021 12:18:01 -0400 Received: by mail-wr1-f72.google.com with SMTP id e12-20020a056000178c00b001606927de88so5114170wrg.10 for ; Thu, 07 Oct 2021 09:18:01 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (118.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.118]) by smtp.gmail.com with ESMTPSA id a25sm8734142wmj.34.2021.10.07.09.17.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Oct 2021 09:17:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633623482; 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=sSsWEPfIasNtfedQFCfGwO+jHWqTcMPZG0w8furmgm0=; b=W6kLVQDiM/yCBobzdG6+7DzrxsbzBwodtulwDRYzKp/FkyX9OKOV3kZAabsyG7sfClEctC AAKzIg6pAlp2Uyc2Vl7KHEvvztqW7MGmUE3zTOFLaKG6aBVgZPV1bHFyP6x3oIreSfpaRx fL9h75cxn0lYuXf8/wXEi45oOIVOV5E= X-MC-Unique: GdpitIV5MvCjGt-PlHOZcw-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=sSsWEPfIasNtfedQFCfGwO+jHWqTcMPZG0w8furmgm0=; b=M7kXSbI5SiD7ZWca7pOrgihiRkf9K1AQfltjCHxdf9VZfpveiQRO797m5rsP8Y5TDC oreIuB7K6KlcMzci+W6B6/M5vI7twSEs2IY2p3PJrWt+XXoujGpd2+Rm4yRzaeYi/ATx tAygSC48o9SOUtljv2iGKRjzaN2mZlCUm5ZqWQ4g4YCRI/Z+NiGzviVgu769yS8GQ6KB VVtdvbajZzB+vCbPRNgBOzaprmubj+RS8hf9BrSLvzmE2Hybsykjick/8WWrcJravR3o zuGql973K91a5hCaGMHtiUdKhLasZ2Zc4FJKWGYkIjXct7BorByXlyLm3x2nV9l0mo++ Jtbw== X-Gm-Message-State: AOAM531Isxkp2K6LHLQLOAAZXxD/lL7p/ovF6CCGqhbu8HsZ+/jKAIUT r8/uDdSWdNxreh2OqAHPOwzyKG9WvYOriIIMztg+5rWxuQf3WQQFq7GHIZo05nrVYA0xW3kgUP2 jbq4fPv9ikZaVpw== X-Received: by 2002:a1c:21c3:: with SMTP id h186mr17261146wmh.107.1633623480255; Thu, 07 Oct 2021 09:18:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxjsy2gU1mGBwP4i99ZbwNtks5RgQrT2oIJ/6iZksWTWx6vPIaxi9q5gezQizl94gxn/Bm+vw== X-Received: by 2002:a1c:21c3:: with SMTP id h186mr17261120wmh.107.1633623480062; Thu, 07 Oct 2021 09:18:00 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Eduardo Habkost , kvm@vger.kernel.org, "Michael S. Tsirkin" , "Dr. David Alan Gilbert" , James Bottomley , Brijesh Singh , Sergio Lopez , Dov Murik , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Connor Kuehl Subject: [PATCH v4 09/23] target/i386/sev: Remove sev_get_me_mask() Date: Thu, 7 Oct 2021 18:17:02 +0200 Message-Id: <20211007161716.453984-10-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211007161716.453984-1-philmd@redhat.com> References: <20211007161716.453984-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: 1633623484921100001 Unused dead code makes review harder, so remove it. Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Connor Kuehl Reviewed-by: Paolo Bonzini Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- 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 9bf6cd18789..d83428fa265 100644 --- a/target/i386/sev_i386.h +++ b/target/i386/sev_i386.h @@ -36,7 +36,6 @@ typedef struct SevKernelLoaderContext { } SevKernelLoaderContext; =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 408441768dc..20b1e18ec1b 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 4f1952cd32f..9e3f2ec8dd3 100644 --- a/target/i386/sev.c +++ b/target/i386/sev.c @@ -65,7 +65,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; @@ -389,12 +388,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) { @@ -833,8 +826,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 18:10:39 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=1633623491; cv=none; d=zohomail.com; s=zohoarc; b=HJEV2sLLhrxv2CANqBl2ZhbbYRCCkz/XJOhVRwCSIlzDpUjNdAsISdB4N3yixitPwrZyZYt2bbvrXBDyhX2e+XaTBtRMTj4qhlj/g+Jv7sPPGwr0bViMmoPuvermeRe6nFy5HJHog6HU3wZlnEIqYHDYlR102m/bTDPaBSKdsFI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633623491; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=Yu0i8hmAoNBqKA56xVa0FWOHuPb3wa3Ay0pPJ2J6oOs=; b=DaPxrVAT0P2d5GZ7yVNGhDhI/XCYfcA3eaSVUnScK+XawqMEOyV+EJhniUfWoCItHJ+kgotjOndHVFgyqOH8GBz/rMBbR3d1ywz0/NKTdkjgc1jJC5RF5ipT65kEXnu0c+hW9oE5WBT1FJZPg7waj8M3zurKaSf9KNitlQHiXmI= 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 1633623491889694.520064179537; Thu, 7 Oct 2021 09:18:11 -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-549-oYL6SQnEMoyevDR17Cs7gw-1; Thu, 07 Oct 2021 12:18:05 -0400 Received: by mail-wr1-f70.google.com with SMTP id v15-20020adfa1cf000000b00160940b17a2so5116712wrv.19 for ; Thu, 07 Oct 2021 09:18:05 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (118.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.118]) by smtp.gmail.com with ESMTPSA id u1sm8426658wmc.29.2021.10.07.09.18.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Oct 2021 09:18:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633623490; 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=Yu0i8hmAoNBqKA56xVa0FWOHuPb3wa3Ay0pPJ2J6oOs=; b=GVt1yT+itLUmXxIN/pgJBMpMb0IN2dtm9beZrzcogT0AVKh3mcNZb6eSPkJjf3kftFx2f7 mnqbiWB9Ka1bcTcYO/kRS+wigslP2ATitcb4NVAf0B7TYnt0AheuHCeH45TitDwDd2112Q JtX6bNywe9B0bZEs/lEe28hryPJFUus= X-MC-Unique: oYL6SQnEMoyevDR17Cs7gw-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=Yu0i8hmAoNBqKA56xVa0FWOHuPb3wa3Ay0pPJ2J6oOs=; b=pMejY8x4shohZBIJOtnLA2YgoNTotaP1jb/2UJ6+0Q8+4K/KaXNOlhIykuWMSXewqw m59dmHkB/0h1Aky9flBdineiSWMoIAT8nl2GyHUfHO25e3AYDpWdUmLrZ98/A/Ch7IxP jd6FZodOBkxEbpIJzNMywp++9biuMSA3zbTHcHl5hXi17HoyGyVVtyIHo82RZ7IbLmFe rzhZjq8mP1QXXT8CjujLEzIVmqZmNrXhU9/PjEJDUmL8/d65FkkFEc9gTlbp342w7mCh XJzq9M91/C5t/2ufiEi8pbsJoA0X32eA5iBOZV1trBtP7bZALfpkDsFZvHtXXtKdfJF7 fKZg== X-Gm-Message-State: AOAM531+GSc08VDWnFKnXZxbsvx/6Sq295/4H8N/BTSGo+YA/GY5orPx 9gmKGVgAqR05ewbVJdiia54+a3HmLXihqbmox7TYzitKU1okhKCP8KFEVmbyOxOdSFdgPGUPNjI yIiwoewKXh5nr3Q== X-Received: by 2002:adf:bb08:: with SMTP id r8mr6741293wrg.247.1633623484642; Thu, 07 Oct 2021 09:18:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz1j54x6mkDDT5G+p886ML0TNkhiqQSJ77tctklrBToCqo96VSPVZB4HfWC67SFWx8EPKXHSw== X-Received: by 2002:adf:bb08:: with SMTP id r8mr6741267wrg.247.1633623484503; Thu, 07 Oct 2021 09:18:04 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Eduardo Habkost , kvm@vger.kernel.org, "Michael S. Tsirkin" , "Dr. David Alan Gilbert" , James Bottomley , Brijesh Singh , Sergio Lopez , Dov Murik , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Connor Kuehl Subject: [PATCH v4 10/23] target/i386/sev: Mark unreachable code with g_assert_not_reached() Date: Thu, 7 Oct 2021 18:17:03 +0200 Message-Id: <20211007161716.453984-11-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211007161716.453984-1-philmd@redhat.com> References: <20211007161716.453984-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: 1633623494130100001 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 Reviewed-by: Paolo Bonzini Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- 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 20b1e18ec1b..55f1ec74196 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 18:10:39 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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.129.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=1633623493; cv=none; d=zohomail.com; s=zohoarc; b=lU6bYwEm2lsHrPQGkBIir2kb6JQEKdVSRBFIYLJY7E4o4N1g12xqlKdqxDrsEmtwPVRp5S6eDNWLEeMcCddPVOmb8EeM61/9WN2pEEnhf6rO6C19yaFS3z6jTygk95Wplupv9Zndr70WLSKTvTZNjQBkKaNEYIxMGrYnkUPGwng= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633623493; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=yEEZxUHWCMFJAaUbuJlVLcx9kbNHe4+tPDUcbMRvNgA=; b=neYuAoj1nSo88OZJS6jDaqn+XyZfnNteV2zD7x9RZF3wZJMTad/bM0rwfC9bVyyjqNaxjwIsPAySZ/K+FKjdaFNmXYGkVUwqV26e6Xagzau8WcBiHkEo4zyRd1s+U1pi72afvJbDvUF4H1q/vxXPCujHEDkiyXbL+fAC01kJaeI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.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.129.124]) by mx.zohomail.com with SMTPS id 1633623493322626.262228395519; Thu, 7 Oct 2021 09:18:13 -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-29-H6BXwIgWMReiWE4C5YXdow-1; Thu, 07 Oct 2021 12:18:10 -0400 Received: by mail-wr1-f70.google.com with SMTP id o2-20020a5d4a82000000b00160c6b7622aso5037806wrq.12 for ; Thu, 07 Oct 2021 09:18:10 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (118.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.118]) by smtp.gmail.com with ESMTPSA id y23sm1025623wmj.42.2021.10.07.09.18.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Oct 2021 09:18:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633623492; 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=yEEZxUHWCMFJAaUbuJlVLcx9kbNHe4+tPDUcbMRvNgA=; b=C2/0brevDUV6v6RqoUi8CIOQPUSlOobQZ52RQXj4FPySnhna1uuuffbn0zyGEO7PSBgM+7 llfKtK26v/lXrv8jMNxco6MvzdtK2h+yYc6AWBQjNZ5DAbqsw2jo3rd4bTkSW6Y34SSGhr 9E9WDknxycTb1cvgwlMVQCQvvOd3CNk= X-MC-Unique: H6BXwIgWMReiWE4C5YXdow-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=yEEZxUHWCMFJAaUbuJlVLcx9kbNHe4+tPDUcbMRvNgA=; b=WAqSYv1NvO9xxQjn8Ugc5Eq3RE916Ne525HNKP7B6U1V2V1+oVzqeNGSB5yb+7+eea ItBKXbUFgovcDbF164/g/jMs34/7Q7Eh2USbb2ufS49FugF6eWGNlgrei1vWFVef2aJU KA8Deli72GkZU1UXfnHnndIBnoPw1M6Tx97w1R93NL/oDe9362n+ahuLuJ4jEToHgBWK od+/OxqQ6Bh47r+RNhc1j/6w6qp/HTHRjZDLIDuOm6LUakfxF2sQQAk4q68qJaGqv1yU /mEQCY4a2Nxoe2ZCZsgqbC5xTayj7u0Y60HcVNpr9/A4K93fgbKbFK4tqY1DZ4+G76bx o3qg== X-Gm-Message-State: AOAM531g4AH6BHOsMIPGjJy2Zh1x9y6XWjxR9Ci5OH3N9EXMUUnZYzfp ef9UB0YKRxNTKv6ulDJkP+2uHSkmQjRGTcaF/j4lhuAmV5fWUf4nkRnm6E1YT4j0fHhyrnpeMEx 7Ugmk970jDkcQOg== X-Received: by 2002:a1c:e90a:: with SMTP id q10mr5781387wmc.108.1633623489196; Thu, 07 Oct 2021 09:18:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxyp5Icsi0NLMXs/baHrjAWHmxKv/JAM8Pc+VahgSSp1ZOQcJVEBNNgny0Hxow6Cf8o/4Ee8g== X-Received: by 2002:a1c:e90a:: with SMTP id q10mr5781363wmc.108.1633623489052; Thu, 07 Oct 2021 09:18:09 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Eduardo Habkost , kvm@vger.kernel.org, "Michael S. Tsirkin" , "Dr. David Alan Gilbert" , James Bottomley , Brijesh Singh , Sergio Lopez , Dov Murik , Connor Kuehl , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v4 11/23] target/i386/sev: sev_get_attestation_report use g_autofree Date: Thu, 7 Oct 2021 18:17:04 +0200 Message-Id: <20211007161716.453984-12-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211007161716.453984-1-philmd@redhat.com> References: <20211007161716.453984-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: 1633623494541100003 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> Reviewed-by: Paolo Bonzini Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- 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 9e3f2ec8dd3..3a30ba6d94a 100644 --- a/target/i386/sev.c +++ b/target/i386/sev.c @@ -521,8 +521,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 @@ -542,7 +542,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 @@ -554,7 +553,6 @@ sev_get_attestation_report(const char *mnonce, Error **= errp) error_setg(errp, "SEV: Failed to query the attestation report" " length ret=3D%d fw_err=3D%d (%s)", ret, err, fw_error_to_str(err)); - g_free(buf); return NULL; } } @@ -569,7 +567,7 @@ sev_get_attestation_report(const char *mnonce, Error **= errp) if (ret) { error_setg_errno(errp, errno, "SEV: Failed to get attestation repo= rt" " 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); @@ -577,9 +575,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 18:10:39 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=1633623496; cv=none; d=zohomail.com; s=zohoarc; b=NXW6RHZ9HVAJlBD5bcWKfDnMa1gs0c9cQk0h6OTFIMnBg9Z91JKRwN84+WSBjxZKTK9sHxXLBJwpb8VL49uC6hbJBW5Qm76otNLD4/5iF1dM5ZqWrUZmzf8bLEKD94AfoYhohVisJ3qzTit1viiSQgorkvDodLvoaC6GvXBoUZc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633623496; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=MMQ6iAvCxwnURglpVB4IW0fu5BXcN7B4HeGKo8BxsN0=; b=mDZ/ZqpaIHDABZiMGUJQlNxMKV0i2ZyBZiHn//hT60IrRZfSov0fETJL6itwU1hRgxCRKW1QMnn+uWPFY/RS3c4rdCiByYV7qFVWS6UAu1UeULEfZWM9Ah6WfyyO1TOKxTsRMCWbKs51gYmS1qT9aS69Lm2IVWu31bRQYte0JMA= 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 163362349698631.277737910314272; Thu, 7 Oct 2021 09:18:16 -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-327-ji4586CSPPOo88bgoMCxiw-1; Thu, 07 Oct 2021 12:18:14 -0400 Received: by mail-wr1-f69.google.com with SMTP id 75-20020adf82d1000000b00160cbb0f800so4357144wrc.22 for ; Thu, 07 Oct 2021 09:18:14 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (118.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.118]) by smtp.gmail.com with ESMTPSA id 1sm9454040wmb.24.2021.10.07.09.18.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Oct 2021 09:18:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633623495; 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=MMQ6iAvCxwnURglpVB4IW0fu5BXcN7B4HeGKo8BxsN0=; b=ZOeiXkUGBkEkX/yditrrDNpj+090gGh96ZUkggENJJQZGQhW22du0f6qKEqKds0vyFVDoD pFQxM6CI6R2+K3hfcXRU9n+RaX0CYix1+nT7eOOUKvnH3y10NAChW5zvlklcpdrUMidepB X4G63hRV9f32N3DtpUGGOJjgwWbcNE4= X-MC-Unique: ji4586CSPPOo88bgoMCxiw-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=MMQ6iAvCxwnURglpVB4IW0fu5BXcN7B4HeGKo8BxsN0=; b=6jf6Arl9qIq6S3RqD0YX+1NnGFntLBIDSkD1xN7JUFIYDAPEwKt3IDTKyfI6f7Yr7L 7NU5mBSlNQjzuI5qJXIze4DQTmFevtz7qCbtOBdGqzgyRFm1rnbEBbcosIaZH92r4KPe 8uzLXEA/CRlhC2N0bfZv+fHzJVxCE8Qt5C447BWYojnmhQZhlGBGpELdwa5ZOGvXujK+ alV7i4LrTGmHg8qvnvClZUogTYa5NNfk4gxjyZlyBIDwqlmr5mkw/PU2mMVzJTCA+glK uGC9dnrv7MW5siTBsRnJEfHQKRPLhWANbx8iKzqIHtJc0K1bwExhyAMU7+8YvuiuyZSl olXA== X-Gm-Message-State: AOAM531QDLAIqike34ogXjNbQAJI3E/9O3uwaGaRcrl/PvEeUCE8s72o EgIdoPRuH1kyYSQ/3U96NcwMoCsDEklb9ovezADsfNwInQSS8DgeRfuTW1RlyEn1Mz3A7TWXwDV r/ru8YW3LaFyafA== X-Received: by 2002:a1c:9857:: with SMTP id a84mr17228546wme.28.1633623493630; Thu, 07 Oct 2021 09:18:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy8ZfB3bnXzEPGWYDhd6PuaST01yQ2MZwVDhjZw+EgLXq2/Mov1UPnSHQG5FosvLqV9SCfneQ== X-Received: by 2002:a1c:9857:: with SMTP id a84mr17228508wme.28.1633623493502; Thu, 07 Oct 2021 09:18:13 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Eduardo Habkost , kvm@vger.kernel.org, "Michael S. Tsirkin" , "Dr. David Alan Gilbert" , James Bottomley , Brijesh Singh , Sergio Lopez , Dov Murik , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v4 12/23] target/i386/sev: Use g_autofree in sev_launch_get_measure() Date: Thu, 7 Oct 2021 18:17:05 +0200 Message-Id: <20211007161716.453984-13-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211007161716.453984-1-philmd@redhat.com> References: <20211007161716.453984-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: 1633623498816100001 Use g_autofree to remove a pair of g_free/goto. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- target/i386/sev.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/target/i386/sev.c b/target/i386/sev.c index 3a30ba6d94a..5cbbcf0bb93 100644 --- a/target/i386/sev.c +++ b/target/i386/sev.c @@ -685,8 +685,8 @@ sev_launch_get_measure(Notifier *notifier, void *unused) { SevGuestState *sev =3D sev_guest; int ret, error; - guchar *data; - struct kvm_sev_launch_measure *measurement; + g_autofree guchar *data =3D NULL; + g_autofree struct kvm_sev_launch_measure *measurement =3D NULL; =20 if (!sev_check_state(sev, SEV_STATE_LAUNCH_UPDATE)) { return; @@ -708,7 +708,7 @@ sev_launch_get_measure(Notifier *notifier, void *unused) if (!measurement->len) { error_report("%s: LAUNCH_MEASURE ret=3D%d fw_error=3D%d '%s'", __func__, ret, error, fw_error_to_str(errno)); - goto free_measurement; + return; } =20 data =3D g_new0(guchar, measurement->len); @@ -720,7 +720,7 @@ sev_launch_get_measure(Notifier *notifier, void *unused) if (ret) { error_report("%s: LAUNCH_MEASURE ret=3D%d fw_error=3D%d '%s'", __func__, ret, error, fw_error_to_str(errno)); - goto free_data; + return; } =20 sev_set_guest_state(sev, SEV_STATE_LAUNCH_SECRET); @@ -728,11 +728,6 @@ sev_launch_get_measure(Notifier *notifier, void *unuse= d) /* encode the measurement value and emit the event */ sev->measurement =3D g_base64_encode(data, measurement->len); trace_kvm_sev_launch_measurement(sev->measurement); - -free_data: - g_free(data); -free_measurement: - g_free(measurement); } =20 char * --=20 2.31.1 From nobody Sun Feb 8 18:10:39 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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.129.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=1633623502; cv=none; d=zohomail.com; s=zohoarc; b=czXFj2u1Y0oiMJ38uocpmjjpERtyM5h8IBmS/BG3HqCbxv8AYc8kkapKvu18/OEOZ8hVRUeKYL/BnWd+/0w3TDvUKKYAvJ3gyjgouQvdTAmMhJPWAsrNCsG1vfZwpRaC+PpXw9xOzxFpj0NrRfb7zFTjtpiFeZDmtFXOgWvJwWM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633623502; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=89V0d1PNFsuCxWRiRzeXMO8a63XAoQ+evMckrwIv15E=; b=f7OmVUSLuWMXqi4xDIGbTOhyxPxXOj4J6HE1Gut5iARWQf5Ysa0cP+cQg/VoRp37M4IyY5+PqQO3rhV6dqTRQFZfd4f3po/eDJ9DPMOYeLf/XBhqD/b8EB8ny8tFvN3oSGNE34zQJirqxa5GNDEBV4uwplyuKjAODX5aynnfvnI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.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.129.124]) by mx.zohomail.com with SMTPS id 1633623502285707.9632972085284; Thu, 7 Oct 2021 09:18:22 -0700 (PDT) Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-61-ZtOnBimuO2u_ULs9asMtSg-1; Thu, 07 Oct 2021 12:18:19 -0400 Received: by mail-wr1-f71.google.com with SMTP id a10-20020a5d508a000000b00160723ce588so5116281wrt.23 for ; Thu, 07 Oct 2021 09:18:19 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (118.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.118]) by smtp.gmail.com with ESMTPSA id c5sm9181006wml.9.2021.10.07.09.18.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Oct 2021 09:18:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633623501; 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=89V0d1PNFsuCxWRiRzeXMO8a63XAoQ+evMckrwIv15E=; b=A6v4XVbSCofAYoUF8+AvvL5BhAk/cBzkJhPivOqYmSGCOXwchxyNb+vkDjqXjvxP7bLpYf g5UGN9WeroYlBY1U5a+hh2C/hrxaj9hrHY920xlmZ6kMJCSCbf8tpG9FXSI2fKix4+HiG5 SjOP7WXjQxlTvQe7mnKEZZoK236vSZ0= X-MC-Unique: ZtOnBimuO2u_ULs9asMtSg-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=89V0d1PNFsuCxWRiRzeXMO8a63XAoQ+evMckrwIv15E=; b=YFSHvRP8z9af1jmbQEm2/AfrJ6pmgXBHIu+Ac86plXUNzMYWrwrUznxTxWKKNMDTIk XzERhAKCaznDtVPHzKTKWmj4KvI7p9Z8+UdkTrSQI5Nd1oP+ZxhTG1qRYnop9Wk5js0I 4tBAJQQQSlUCWXL7iRGAO672ZmS2INWHNPeomscla68m1TBMFlZ//+583jm4mz7SHjIC NA82Jay6faTfcrCae1dUpsIiqau7dkJUZ4BYRUJ3gIXuuioFO8Qq+xrjsvOzlRraaWFH hwvtXdin+dJvP7ywRT4cxYcRWJzXfpcOpf2Y2xto/NCGCZ/EtobRzPXuTPTKZ3KGTcwz gIqg== X-Gm-Message-State: AOAM531uyzFrhoW4MdbJAIcNwucFO7aoJkOtrbEM6ELh7zCO1raxnZmF svvfoVon20gmiCqLh3mf8lMI2sCVzl90k5W6PPFHJvXlw5uSvksW+80lEg/UmcdiKxLXHN+AXRQ 0fMXhZNJaowPZpQ== X-Received: by 2002:a1c:2:: with SMTP id 2mr17491468wma.87.1633623498397; Thu, 07 Oct 2021 09:18:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJybbjnGgx9aPwaHiTsiUUeAUcDEXJV3VetZXPeXIxDRjX+nW5gqW/S5HCcW3+GX4C5xkS0GDg== X-Received: by 2002:a1c:2:: with SMTP id 2mr17491444wma.87.1633623498131; Thu, 07 Oct 2021 09:18:18 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Eduardo Habkost , kvm@vger.kernel.org, "Michael S. Tsirkin" , "Dr. David Alan Gilbert" , James Bottomley , Brijesh Singh , Sergio Lopez , Dov Murik , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v4 13/23] target/i386/sev: Restrict SEV to system emulation Date: Thu, 7 Oct 2021 18:17:06 +0200 Message-Id: <20211007161716.453984-14-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211007161716.453984-1-philmd@redhat.com> References: <20211007161716.453984-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: 1633623504132100001 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. Reviewed-by: Paolo Bonzini Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- 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 55f1ec74196..170e9f50fee 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,49 +30,11 @@ 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; } =20 -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; -} - bool sev_add_kernel_loader_hashes(SevKernelLoaderContext *ctx, Error **err= p) { g_assert_not_reached(); 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 18:10:39 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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.129.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=1633623505; cv=none; d=zohomail.com; s=zohoarc; b=Xyp++SBYYppDPHCgVQFrh0ix3N78E9/mkYAbK/MpB/LkZmac1gWFUv0uXLvJK0YKpTa7oh3voNnrzSykMOlNhpXvYJ4IkngOBp4/R4t/6J0ayt06HiyOtr366UUGk+RFsUdk+8X0/9qGYtB+Bu+VvVX70toCX3j+kBOnm8L2vPs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633623505; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=NtntxYjzk/c/tBnUjs6wx6H836yPN9/32v9yVgz+JmI=; b=lifQQeVxc7CIo7H9DjFI9jIJ+Z6CGL2nqcy5/0Kg8+Cl9fRHs57ELdljEtBIpNk5Q3yP3m+LoA+qchh1j0DABS9vCfeYI5cdVO2cCrIJm9iBUqa47fS0h28t/VSF0yx0W1VVosJugUvNzvO4KWvgd3Ont+Q7N6pPfBTPqIKlEbA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.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.129.124]) by mx.zohomail.com with SMTPS id 1633623505979537.6010012682598; Thu, 7 Oct 2021 09:18:25 -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-27-mW_C6tneMxy_5Z_DL_0xuw-1; Thu, 07 Oct 2021 12:18:24 -0400 Received: by mail-wr1-f72.google.com with SMTP id h11-20020adfa4cb000000b00160c791a550so4943752wrb.6 for ; Thu, 07 Oct 2021 09:18:23 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (118.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.118]) by smtp.gmail.com with ESMTPSA id v10sm93782wri.29.2021.10.07.09.18.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Oct 2021 09:18:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633623505; 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=NtntxYjzk/c/tBnUjs6wx6H836yPN9/32v9yVgz+JmI=; b=QQU6WV8iv3GO9mFbzedap0hOlQCiI4Yy8UMD88eyjc4u2mwfzns3mM4/0Vhj6Wo89MC3vD 035HsxLBtWHpolxQQ3AHnDJ0nHm34dugNiLMh4o4OweEWxucYLCxjloCAmR5V0wPXtdcUe bn/qI4WQzDO8IYdLOXRW47sdben12lc= X-MC-Unique: mW_C6tneMxy_5Z_DL_0xuw-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=NtntxYjzk/c/tBnUjs6wx6H836yPN9/32v9yVgz+JmI=; b=BhknCB3Et2Yk5WmZmKrmcSWK9ha6+y4wyTCCe8u1zTHoB0fptpo0/61CZqE9G9nOMg sV7LDug27dxzHXZZcSgG7lV5Du10U0+g1Hw9US/aFpwpHavQtgAk4pd1QI6GbZ0VkMZ5 3Ua/XPrYTEJYArFq8sXeyT6+vSZ5Zpz432YfL0CEjIdK9qjentKWzdOSb8dRQaFeeGi4 OvDG9HLP54Gs2SSZKbr+gpkfNDJ5ql+6fhmIalZBtqA4DZx98LKHKq9fLxAYsAtv4MRL 3A3ZWFKa4p/uhgwdldRjqz+p5LSvCH9by7j/JVPPDUhQrLGm3sLdCnVXzC9T2z4tdyDv vnkw== X-Gm-Message-State: AOAM533uvenOU2Ps11ISDUXTOE5BJsK2M2UQKUXI4aswJNQDxupH7Ts0 RguDNOpVu9eW2Niq4n/eWGIKNbDY1eA/2twzsx/TSk3Rgeznq0SIqRh7ihXoeNzujNRNP9/XhcS K3gSoAaImwrhAOw== X-Received: by 2002:a05:600c:2057:: with SMTP id p23mr5628896wmg.67.1633623502741; Thu, 07 Oct 2021 09:18:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzbpkjWZoIcEo8CCNOMP08Kf3tAZlemKrKuxafvy6AWFRjok6953SFiC/moJkDRbEWcDARxSQ== X-Received: by 2002:a05:600c:2057:: with SMTP id p23mr5628876wmg.67.1633623502591; Thu, 07 Oct 2021 09:18:22 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Eduardo Habkost , kvm@vger.kernel.org, "Michael S. Tsirkin" , "Dr. David Alan Gilbert" , James Bottomley , Brijesh Singh , Sergio Lopez , Dov Murik , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v4 14/23] target/i386/sev: Rename sev_i386.h -> sev.h Date: Thu, 7 Oct 2021 18:17:07 +0200 Message-Id: <20211007161716.453984-15-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211007161716.453984-1-philmd@redhat.com> References: <20211007161716.453984-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: 1633623506562100001 SEV is a x86 specific feature, and the "sev_i386.h" header is already in target/i386/. Rename it as "sev.h" to simplify. Patch created mechanically using: $ git mv target/i386/sev_i386.h target/i386/sev.h $ sed -i s/sev_i386.h/sev.h/ $(git grep -l sev_i386.h) Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Dr. David Alan Gilbert --- target/i386/{sev_i386.h =3D> sev.h} | 0 hw/i386/x86.c | 2 +- target/i386/cpu.c | 2 +- target/i386/kvm/kvm.c | 2 +- target/i386/monitor.c | 2 +- target/i386/sev-stub.c | 2 +- target/i386/sev-sysemu-stub.c | 2 +- target/i386/sev.c | 2 +- 8 files changed, 7 insertions(+), 7 deletions(-) rename target/i386/{sev_i386.h =3D> sev.h} (100%) diff --git a/target/i386/sev_i386.h b/target/i386/sev.h similarity index 100% rename from target/i386/sev_i386.h rename to target/i386/sev.h diff --git a/hw/i386/x86.c b/hw/i386/x86.c index 0c7c054e3a0..76de7e2265e 100644 --- a/hw/i386/x86.c +++ b/hw/i386/x86.c @@ -47,7 +47,7 @@ #include "hw/i386/fw_cfg.h" #include "hw/intc/i8259.h" #include "hw/rtc/mc146818rtc.h" -#include "target/i386/sev_i386.h" +#include "target/i386/sev.h" =20 #include "hw/acpi/cpu_hotplug.h" #include "hw/irq.h" diff --git a/target/i386/cpu.c b/target/i386/cpu.c index b54b98551e9..8289dc87bd5 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -26,7 +26,7 @@ #include "sysemu/reset.h" #include "sysemu/hvf.h" #include "kvm/kvm_i386.h" -#include "sev_i386.h" +#include "sev.h" #include "qapi/error.h" #include "qapi/qapi-visit-machine.h" #include "qapi/qmp/qerror.h" diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c index f25837f63f4..a5f6ff63c81 100644 --- a/target/i386/kvm/kvm.c +++ b/target/i386/kvm/kvm.c @@ -28,7 +28,7 @@ #include "sysemu/kvm_int.h" #include "sysemu/runstate.h" #include "kvm_i386.h" -#include "sev_i386.h" +#include "sev.h" #include "hyperv.h" #include "hyperv-proto.h" =20 diff --git a/target/i386/monitor.c b/target/i386/monitor.c index ea836678f51..109e4e61c0a 100644 --- a/target/i386/monitor.c +++ b/target/i386/monitor.c @@ -32,7 +32,7 @@ #include "sysemu/kvm.h" #include "sysemu/sev.h" #include "qapi/error.h" -#include "sev_i386.h" +#include "sev.h" #include "qapi/qapi-commands-misc-target.h" #include "qapi/qapi-commands-misc.h" #include "hw/i386/pc.h" diff --git a/target/i386/sev-stub.c b/target/i386/sev-stub.c index 170e9f50fee..7e8b6f9a259 100644 --- a/target/i386/sev-stub.c +++ b/target/i386/sev-stub.c @@ -13,7 +13,7 @@ =20 #include "qemu/osdep.h" #include "qapi/error.h" -#include "sev_i386.h" +#include "sev.h" =20 bool sev_enabled(void) { diff --git a/target/i386/sev-sysemu-stub.c b/target/i386/sev-sysemu-stub.c index d556b4f091f..8082781febf 100644 --- a/target/i386/sev-sysemu-stub.c +++ b/target/i386/sev-sysemu-stub.c @@ -14,7 +14,7 @@ #include "qemu/osdep.h" #include "qapi/qapi-commands-misc-target.h" #include "qapi/error.h" -#include "sev_i386.h" +#include "sev.h" =20 SevInfo *sev_get_info(void) { diff --git a/target/i386/sev.c b/target/i386/sev.c index 5cbbcf0bb93..e43bbf3a17d 100644 --- a/target/i386/sev.c +++ b/target/i386/sev.c @@ -25,7 +25,7 @@ #include "qemu/uuid.h" #include "crypto/hash.h" #include "sysemu/kvm.h" -#include "sev_i386.h" +#include "sev.h" #include "sysemu/sysemu.h" #include "sysemu/runstate.h" #include "trace.h" --=20 2.31.1 From nobody Sun Feb 8 18:10:39 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=1633623510; cv=none; d=zohomail.com; s=zohoarc; b=c2imx20hm9DWyH3ptdjCWM/+0odTfEx18pQYCdU2qbuGCjKuPYnXnjSZjLtVuwEuAfZv3iiCQMTnPd604142/zNtB5RB6NmwwVFpFu62Pl26DUwU9fydqQyxOsYqvcQbuQq2eh0vBQzXfAvh9dtt284dHXDoGCIX79dkv5z82hU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633623510; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=lGxIOiDkjtO7lLXCNUhDroR/93vYB4x6AaMAet+1gIs=; b=mkyAXbYeIoXCARcYWkLs033DBSAU1UhEMWwMoOJTe9b7NZIvKNB8GbxQNz0paLtkjIJYT7oZNzIhjqGJ5VJ1nZJCKo1N0hm3+XF1nYZq9UaRkkP4Bydxd4nomxWaklnGudFRiNzf5cvJFQIAqrRA7PazK1eSwNkXlF1fFOyws64= 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 1633623510846461.2117617394862; Thu, 7 Oct 2021 09:18:30 -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-16-sv2uxtHUP6Gz4smJB9ICvw-1; Thu, 07 Oct 2021 12:18:28 -0400 Received: by mail-wr1-f70.google.com with SMTP id r25-20020adfab59000000b001609ddd5579so5118233wrc.21 for ; Thu, 07 Oct 2021 09:18:28 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (118.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.118]) by smtp.gmail.com with ESMTPSA id v185sm4584081wme.35.2021.10.07.09.18.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Oct 2021 09:18:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633623509; 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=lGxIOiDkjtO7lLXCNUhDroR/93vYB4x6AaMAet+1gIs=; b=QtjaN6s/rM0mv+kN/HKlf62BIwApMGgrHam2v3tS+7VsINWpN+fNsPLRppyh1WoRskiopE 36TnPejCkVH+jiQZ/dwzsbvGgvuV77GMxC74YPXHdcCS7ExpDMJ8njpJRhH87++ylFP/l0 r/18wfjHBlcL+BL5VJV+N3yxm39d1v0= X-MC-Unique: sv2uxtHUP6Gz4smJB9ICvw-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=lGxIOiDkjtO7lLXCNUhDroR/93vYB4x6AaMAet+1gIs=; b=qFF4q70FWv9ACz5JwUUsIuw206ctcicYEqwd6ioSiiEcsrdqU4fEZqLanxTUhuxZxX NxCSqZRyGRhoJouwBEEUZ533BbuSzR7OaGkLCS/uKK41WLq6LLSfkshWwroPLFJ+dJ3R xEzljTQnn/2mWoyEJbbeBNhTaDe5AK1HuUjnAr71GbnmWFiPbcI3b0QyscS2s7hH1idf 2z1WH77hHkNFobGXo+bmv3dZ/H2xRsuwf8UP8sst42qyCyJxa4npBVItWZ8xtbiWYxLi eISOxKgJfAKrRVi2T6lhOrlYugipX8+Sv0ORtEmofSHY4lfvEnr4uZ0gAhH/dQfEW+VZ +VbQ== X-Gm-Message-State: AOAM5334QtgI2k0oj8JJplMUQ1MRaCd7z+fJzVYOtqYgFsYaUg2nE4sg 7hi0HhV1C0ABQWvXC08xcsSjtMuEkshFp99JgacwLu0DQ/6U/k31fsxkiBXa20kJjfPmJZnfwIO UNmbNkR18cZcGOg== X-Received: by 2002:a05:6000:18a3:: with SMTP id b3mr6651387wri.178.1633623507249; Thu, 07 Oct 2021 09:18:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxGxFUSQBIuymUcqyNofEv5FzSKPyuPr7MuNzby3hK9l903zkFHngcL71AixMMoIYrkPVrZ9w== X-Received: by 2002:a05:6000:18a3:: with SMTP id b3mr6651373wri.178.1633623507093; Thu, 07 Oct 2021 09:18:27 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Eduardo Habkost , kvm@vger.kernel.org, "Michael S. Tsirkin" , "Dr. David Alan Gilbert" , James Bottomley , Brijesh Singh , Sergio Lopez , Dov Murik , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v4 15/23] target/i386/sev: Declare system-specific functions in 'sev.h' Date: Thu, 7 Oct 2021 18:17:08 +0200 Message-Id: <20211007161716.453984-16-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211007161716.453984-1-philmd@redhat.com> References: <20211007161716.453984-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: 1633623511390100001 "sysemu/sev.h" is only used from x86-specific files. Let's move it to include/hw/i386, and merge it with target/i386/sev.h. Suggested-by: Paolo Bonzini Reviewed-by: Paolo Bonzini Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- include/sysemu/sev.h | 28 ---------------------------- target/i386/sev.h | 12 +++++++++++- hw/i386/pc_sysfw.c | 2 +- target/i386/kvm/kvm.c | 1 - target/i386/kvm/sev-stub.c | 2 +- target/i386/monitor.c | 1 - 6 files changed, 13 insertions(+), 33 deletions(-) delete mode 100644 include/sysemu/sev.h diff --git a/include/sysemu/sev.h b/include/sysemu/sev.h deleted file mode 100644 index 94d821d737c..00000000000 --- a/include/sysemu/sev.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * QEMU Secure Encrypted Virutualization (SEV) support - * - * Copyright: Advanced Micro Devices, 2016-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. - * - */ - -#ifndef QEMU_SEV_H -#define QEMU_SEV_H - -#include "sysemu/kvm.h" - -bool sev_enabled(void); -int sev_kvm_init(ConfidentialGuestSupport *cgs, Error **errp); -int sev_encrypt_flash(uint8_t *ptr, uint64_t len, Error **errp); -int sev_inject_launch_secret(const char *hdr, const char *secret, - uint64_t gpa, Error **errp); - -int sev_es_save_reset_vector(void *flash_ptr, uint64_t flash_size); -void sev_es_set_reset_vector(CPUState *cpu); - -#endif diff --git a/target/i386/sev.h b/target/i386/sev.h index d83428fa265..c96072bf78d 100644 --- a/target/i386/sev.h +++ b/target/i386/sev.h @@ -14,7 +14,7 @@ #ifndef QEMU_SEV_I386_H #define QEMU_SEV_I386_H =20 -#include "sysemu/sev.h" +#include "exec/confidential-guest-support.h" #include "qapi/qapi-types-misc-target.h" =20 #define SEV_POLICY_NODBG 0x1 @@ -35,6 +35,7 @@ typedef struct SevKernelLoaderContext { size_t cmdline_size; } SevKernelLoaderContext; =20 +bool sev_enabled(void); extern bool sev_es_enabled(void); extern SevInfo *sev_get_info(void); extern uint32_t sev_get_cbit_position(void); @@ -45,4 +46,13 @@ extern SevAttestationReport * sev_get_attestation_report(const char *mnonce, Error **errp); extern bool sev_add_kernel_loader_hashes(SevKernelLoaderContext *ctx, Erro= r **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); + +int sev_kvm_init(ConfidentialGuestSupport *cgs, Error **errp); + #endif diff --git a/hw/i386/pc_sysfw.c b/hw/i386/pc_sysfw.c index 68d6b1f783e..c8b17af9535 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.h" =20 #define FLASH_SECTOR_SIZE 4096 =20 diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c index a5f6ff63c81..0eb7a0340cf 100644 --- a/target/i386/kvm/kvm.c +++ b/target/i386/kvm/kvm.c @@ -44,7 +44,6 @@ #include "hw/i386/intel_iommu.h" #include "hw/i386/x86-iommu.h" #include "hw/i386/e820_memory_layout.h" -#include "sysemu/sev.h" =20 #include "hw/pci/pci.h" #include "hw/pci/msi.h" diff --git a/target/i386/kvm/sev-stub.c b/target/i386/kvm/sev-stub.c index 9587d1b2a31..6080c007a2e 100644 --- a/target/i386/kvm/sev-stub.c +++ b/target/i386/kvm/sev-stub.c @@ -13,7 +13,7 @@ =20 #include "qemu/osdep.h" #include "qemu-common.h" -#include "sysemu/sev.h" +#include "sev.h" =20 int sev_kvm_init(ConfidentialGuestSupport *cgs, Error **errp) { diff --git a/target/i386/monitor.c b/target/i386/monitor.c index 109e4e61c0a..935a8ee8ca4 100644 --- a/target/i386/monitor.c +++ b/target/i386/monitor.c @@ -30,7 +30,6 @@ #include "qapi/qmp/qdict.h" #include "qapi/qmp/qerror.h" #include "sysemu/kvm.h" -#include "sysemu/sev.h" #include "qapi/error.h" #include "sev.h" #include "qapi/qapi-commands-misc-target.h" --=20 2.31.1 From nobody Sun Feb 8 18:10:39 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=1633623516; cv=none; d=zohomail.com; s=zohoarc; b=Xj/Th/jAJIsemXKzjtjZPqQPAEPRHarCpnxBooEgezng2qqkD481m//pi58dYJIB4ff2y9yfeDVFS+NechBKRos/eG7r+0xlK1qC2Tf5kCbrlIN+kuVmuuJCDAexxKTdDu1awR9u2cnrQk9oonxDxiB8bxJA7P+9juBZNBdl96c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633623516; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=avS7dA1xbWdOVEvDf5GxDqun22mmkWzrjGDOVnO4aN8=; b=KenWrou97c7SI6Oa308iZpOdMtyyBHcnmEFm5x1kDXhLrFS9LNCfBvqxqrHv0XSivxiKCUAD/M8ZLDL9e1P5RU7lCC+TlEioXuKPmL94t0oKEynrBiudDL0KAPA4V7aZnvSLRLhyf2hw+0cEVw3HxP4p0q7Y/Vqot4/zQqDz6Mc= 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 1633623516800417.096555044748; Thu, 7 Oct 2021 09:18:36 -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-222-Ha_wp889PWCW0ED4CdxgTA-1; Thu, 07 Oct 2021 12:18:32 -0400 Received: by mail-wr1-f69.google.com with SMTP id v15-20020adfa1cf000000b00160940b17a2so5117725wrv.19 for ; Thu, 07 Oct 2021 09:18:32 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (118.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.118]) by smtp.gmail.com with ESMTPSA id q3sm19131wmc.25.2021.10.07.09.18.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Oct 2021 09:18:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633623515; 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=avS7dA1xbWdOVEvDf5GxDqun22mmkWzrjGDOVnO4aN8=; b=JtU1wQCJsGDZ/EQZMUOggqLd6zddC3O51Hw20thp+pVRJue0/EFnj2HFelIhn49LhtQWgt PU5bj8Fg2GFl/RI84GhUckmmcuDO6S99YKefAdtqtw0IIGjhGaoA5rMx4qO4M+TF304Uzr X4LZO+5UmS0biKO82mr0asGTqGDAU34= X-MC-Unique: Ha_wp889PWCW0ED4CdxgTA-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=avS7dA1xbWdOVEvDf5GxDqun22mmkWzrjGDOVnO4aN8=; b=3QtstrZikhQB/AZ8E5c5BvwfoNhFlE1LC3ZNug4P+IKwzRQOFtFqJh1QgU7qdFN62A +cNDth6KdZZI68EUAXGInPo0mme1q/eyPR6rA4lS2Mj6vea9nYNFcJ/C8zsri7agA3a1 jwYHPrzA5aqHCLloYavKJR55rAbVT6O4MGshUnZBR7549KOVsvvtU9veYbTmKMYSep3h oReSh9HzU8DIc2+i0QsUz9tC/Z/eXeqEOb97hUafT9LPv2k1OrptXc6S1YYuomKpBRdl uCkWr3J6two4MOXST9G13p3aVxSn+GzVuMSgoO11Nk6PA6eDws6ciRAWimEXmeDP+Bop N8VQ== X-Gm-Message-State: AOAM531H05ZW45rS5bn9oGBI8+jKWocyX2D3d4dSCqxuEeZ1011PoYXL W/aUk1zktc3I2RJfTLgEUbABRUPOgJKsPWdrbbwGIT5oNNWK41wkzOAJaNsAObcsEloOnFzHsWn uao1EjW0rGJOFpA== X-Received: by 2002:adf:a550:: with SMTP id j16mr6790540wrb.180.1633623511670; Thu, 07 Oct 2021 09:18:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyiNFDP2mIfyzBdX6qysBlWdROekH+j9h8XYmdGma4KNZrh1RRhjU928Fdh1xrhu6HNRCOYpw== X-Received: by 2002:adf:a550:: with SMTP id j16mr6790510wrb.180.1633623511460; Thu, 07 Oct 2021 09:18:31 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Eduardo Habkost , kvm@vger.kernel.org, "Michael S. Tsirkin" , "Dr. David Alan Gilbert" , James Bottomley , Brijesh Singh , Sergio Lopez , Dov Murik , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v4 16/23] target/i386/sev: Remove stubs by using code elision Date: Thu, 7 Oct 2021 18:17:09 +0200 Message-Id: <20211007161716.453984-17-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211007161716.453984-1-philmd@redhat.com> References: <20211007161716.453984-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: 1633623518279100001 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 Reviewed-by: Eric Blake --- target/i386/sev.h | 14 ++++++++++++-- target/i386/cpu.c | 13 +++++++------ target/i386/sev-stub.c | 41 ----------------------------------------- target/i386/meson.build | 2 +- 4 files changed, 20 insertions(+), 50 deletions(-) delete mode 100644 target/i386/sev-stub.c diff --git a/target/i386/sev.h b/target/i386/sev.h index c96072bf78d..d9548e3e642 100644 --- a/target/i386/sev.h +++ b/target/i386/sev.h @@ -14,6 +14,10 @@ #ifndef QEMU_SEV_I386_H #define QEMU_SEV_I386_H =20 +#ifndef CONFIG_USER_ONLY +#include CONFIG_DEVICES /* CONFIG_SEV */ +#endif + #include "exec/confidential-guest-support.h" #include "qapi/qapi-types-misc-target.h" =20 @@ -35,8 +39,14 @@ typedef struct SevKernelLoaderContext { size_t cmdline_size; } SevKernelLoaderContext; =20 -bool sev_enabled(void); -extern bool sev_es_enabled(void); +#ifdef CONFIG_SEV + bool sev_enabled(void); +bool sev_es_enabled(void); +#else +#define sev_enabled() 0 +#define sev_es_enabled() 0 +#endif + 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/cpu.c b/target/i386/cpu.c index 8289dc87bd5..fc3ed80ef1e 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -5764,12 +5764,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 7e8b6f9a259..00000000000 --- a/target/i386/sev-stub.c +++ /dev/null @@ -1,41 +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.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; -} - -bool sev_add_kernel_loader_hashes(SevKernelLoaderContext *ctx, Error **err= p) -{ - g_assert_not_reached(); -} 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 18:10:39 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=1633623522; cv=none; d=zohomail.com; s=zohoarc; b=b/4BCKBou9+GXqj6+xDxz1/7CQAx/nED+KMFHAEvzc5otr2DB3sp2qqiEQRckm664xgTh+Gs/bvnOpZk7hr/GmnaVBqnKAjjcAaBHmy1YPFaOMNysSSTP2JjCPK0FuJMIyy/HyuZZBZFXsqDzUVATemnVqFmx6WQPN4E4/5kfDY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633623522; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=7zEBwyEs4hdAqxlobZpOUbNIVzNsUZbf4HLNIwXUpoo=; b=lRtFQ+7M4xVLmSrIx4jo8nfbSZ90wG4civwrL3O90oq67MhOWHFYbx7E3Mf3oOr7rJWWmfFLuiObDkMpcPtZe1ypXWIFD9QgxnFVI9Lc+UYU2Ft3H+h++j/LFLYgF4wJKLTek4BoDLsMY2qGrStSprDMRVyCKJBKoSGzXEUPios= 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 1633623522090285.3787471973334; Thu, 7 Oct 2021 09:18:42 -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-285-ZA_GnZpGMzWbaazzsFFDmA-1; Thu, 07 Oct 2021 12:18:37 -0400 Received: by mail-wr1-f70.google.com with SMTP id f11-20020adfc98b000000b0015fedc2a8d4so5146601wrh.0 for ; Thu, 07 Oct 2021 09:18:37 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (118.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.118]) by smtp.gmail.com with ESMTPSA id k18sm48278wrn.81.2021.10.07.09.18.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Oct 2021 09:18:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633623521; 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=7zEBwyEs4hdAqxlobZpOUbNIVzNsUZbf4HLNIwXUpoo=; b=JCT25Mk9uX4HZy8Wt+dc1TLP+zQne9/4swDoyo/7bBV5AZu7nGOXQenTVYn2Fs070UG2sb 9BiIb0hbBxP7cji5gbMqAcmDyBA7Ia01pFSVsH5Mp6FWTdnzBjxDhIgKsPq6lcIzjauJ9w XZi0DMu19CJEcEJTT3jGPUYWiXMqeqY= X-MC-Unique: ZA_GnZpGMzWbaazzsFFDmA-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=7zEBwyEs4hdAqxlobZpOUbNIVzNsUZbf4HLNIwXUpoo=; b=vBIOUAiezLR02gVpJBb06lJsPJzaWA/GIOJZn0+PUuAJZkclNPFJBcUHYPvsv6BXL7 zKsPdr8e+z5qgeErhtQWe7uWifbuEZRqbHvK/0yJ89v5Ogj8Ov4sHEtG4VC9zqKo/Ikc QyFV5vqXZ2TQRYiA6O2/GRWUWJbSr4kOH5ocdbTI4McK7V0sMtJhwvGy2PObcNg8nTLs lChc7x1XaXl+lk9FBcuhkSLh30No8d4xgnO8P0BKF8cdRzcAb35PLi1HPTUqixV7ksvF X8M6EUg8TYhNU7k5AB6mO/Xj5tZazdiCvydBDz+503E0sTi6n+rD6jUMkC6uUqNKHuiY C/uQ== X-Gm-Message-State: AOAM531X5UO5bjhr9txf3Tl4I33B7SVhbQ0bDbyHPd8UPeBD2+AXJ1Cl F0xEOOqz0jblXuONswSfMZQbnHhtI7YUG22qo/vkmytxdxsD3oJ/Pgx9x3W/t2wdU3+xOoUORUJ Nj8COqZG4xLGy1w== X-Received: by 2002:a1c:1b4a:: with SMTP id b71mr5629400wmb.33.1633623516166; Thu, 07 Oct 2021 09:18:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyRFIgrsHBHYJZN3sLOY8LrmO2MjqtYTxSRTA/ArKRINNK0kYWiSnReEM//lqCoEZRskTcw5A== X-Received: by 2002:a1c:1b4a:: with SMTP id b71mr5629375wmb.33.1633623515998; Thu, 07 Oct 2021 09:18:35 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Eduardo Habkost , kvm@vger.kernel.org, "Michael S. Tsirkin" , "Dr. David Alan Gilbert" , James Bottomley , Brijesh Singh , Sergio Lopez , Dov Murik , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v4 17/23] target/i386/sev: Move qmp_query_sev_attestation_report() to sev.c Date: Thu, 7 Oct 2021 18:17:10 +0200 Message-Id: <20211007161716.453984-18-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211007161716.453984-1-philmd@redhat.com> References: <20211007161716.453984-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: 1633623523174100001 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. Reviewed-by: Paolo Bonzini Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- target/i386/sev.h | 2 -- target/i386/monitor.c | 6 ------ target/i386/sev-sysemu-stub.c | 5 +++-- target/i386/sev.c | 12 ++++++++++-- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/target/i386/sev.h b/target/i386/sev.h index d9548e3e642..2e90c05fc3f 100644 --- a/target/i386/sev.h +++ b/target/i386/sev.h @@ -52,8 +52,6 @@ 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 * -sev_get_attestation_report(const char *mnonce, Error **errp); extern bool sev_add_kernel_loader_hashes(SevKernelLoaderContext *ctx, Erro= r **errp); =20 int sev_encrypt_flash(uint8_t *ptr, uint64_t len, Error **errp); diff --git a/target/i386/monitor.c b/target/i386/monitor.c index 935a8ee8ca4..cf4a8a61a02 100644 --- a/target/i386/monitor.c +++ b/target/i386/monitor.c @@ -763,12 +763,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 8082781febf..d5ec6b32e0a 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.h" =20 @@ -52,8 +53,8 @@ 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"); return NULL; diff --git a/target/i386/sev.c b/target/i386/sev.c index e43bbf3a17d..038fa560588 100644 --- a/target/i386/sev.c +++ b/target/i386/sev.c @@ -32,6 +32,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 @@ -515,8 +517,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; @@ -578,6 +580,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 18:10:39 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=1633623525; cv=none; d=zohomail.com; s=zohoarc; b=R716sjOoqOmHsJOOOTNM3qtRcuA3ATDGsMa6osgvKbktu1xp1krNPHQ1Hg34LGtC17YJzC5hKNlpZ3xGPsKKPqtbeBOUPZRgLpMhU9YGOcPMP6bQgVT/Qhx0zZyNdg4P2oOmZ+eXffxTd741ZBc4gX4v84Qd0bkCZtNGg8KJtAY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633623525; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=gRE3NNVTx8SI9X33FPifPWmCEg7suN8YDk0KQOEofaw=; b=cB2qdU78lCZRczyQo9KruB6HQ0dVYDW4q9xkmGgb+T5cSMolQMaPJNf9Ln6z9f+f5pRQ+ILHyxc8AuQdv+cHcuFffoUTCGa+8q+qGmthTuJLlp73h1PD84s52OuoFIbgetcZRmG7zFgBZvpLguS3C9fU7pZdRGoGUICIArPNUP0= 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 1633623525096955.2180833553679; Thu, 7 Oct 2021 09:18:45 -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-406-T_URfIopOgKdo5hpacWUNA-1; Thu, 07 Oct 2021 12:18:42 -0400 Received: by mail-wr1-f72.google.com with SMTP id v15-20020adfa1cf000000b00160940b17a2so5118034wrv.19 for ; Thu, 07 Oct 2021 09:18:41 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (118.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.118]) by smtp.gmail.com with ESMTPSA id c5sm9182174wml.9.2021.10.07.09.18.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Oct 2021 09:18:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633623524; 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=gRE3NNVTx8SI9X33FPifPWmCEg7suN8YDk0KQOEofaw=; b=au+MrQjzssM2t24uz7MRDC4hqXtSTx0Be5DU4Wjs/7LzL7tl9EqX8iL7UWdRPJjNwUBj0a p49cWId74EmGDfwzmRiLu31EH1dgfAMHhyWSNBx8HwHbX7VYYs8oFyEWZPuJLfigOyoPwc i5zIkPBQX2LJW9ebBXtzDfTc8v+0PLM= X-MC-Unique: T_URfIopOgKdo5hpacWUNA-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=gRE3NNVTx8SI9X33FPifPWmCEg7suN8YDk0KQOEofaw=; b=mBBA2QzjScblquRLPvyuWrS9yCJ5f0/0IbOCj+AYCexxxb7qvCn+omsNof/WTh9kB2 XY+r4Vjq0Beyq0bzPhkpFgPGiD1BBWPF97SL9YHv9RmQJdzMZXYut8GJ/xUVsiW+BcjI DXjeY+3WlTk6sBp1MGAfR2L5N+19CnAoI6QW4NXTCCugSs3+exd3SCZ5oB1+jJ3Dw8fo rUXe7vFwbEhuGXAsbxegfCktIT+RGnurjRRzzM1a85qj8LnKX/OL1OwVWElvyUWaySjU cO6dNw7xydmGTR2hiaIKmk9f+SjRqsdYIUxbQDL8XVu1RPjCvRHoGRqIt+OMWu0Zt6ZF GepA== X-Gm-Message-State: AOAM530DIdaQNV+9YglqI+IV/CwTXmax4hDSQ6WMhE7wH2bS08IveM85 70kaS8eBVlhp94IoXMfuvt8yZa4ZXxN1IB5YXB48k3WC5CbeQIxLJ0lEsj7229yRw77mwbtQ6iO qi0bh2VwCnpF5PA== X-Received: by 2002:a05:6000:18aa:: with SMTP id b10mr6550218wri.270.1633623520781; Thu, 07 Oct 2021 09:18:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyeSWibl7b2NVZJa7Vkddhan4RmMUK+An6BeboL1TOS5wajjOas8bdfopDiRz2IE0A5yVSojA== X-Received: by 2002:a05:6000:18aa:: with SMTP id b10mr6550171wri.270.1633623520408; Thu, 07 Oct 2021 09:18:40 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Eduardo Habkost , kvm@vger.kernel.org, "Michael S. Tsirkin" , "Dr. David Alan Gilbert" , James Bottomley , Brijesh Singh , Sergio Lopez , Dov Murik , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v4 18/23] target/i386/sev: Move qmp_sev_inject_launch_secret() to sev.c Date: Thu, 7 Oct 2021 18:17:11 +0200 Message-Id: <20211007161716.453984-19-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211007161716.453984-1-philmd@redhat.com> References: <20211007161716.453984-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: 1633623525730100001 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. Previously with binaries built without SEV, management layer was getting an empty response: { "execute": "sev-inject-launch-secret", "arguments": { "packet-header": "mypkt", "secret": "mypass", "gpa": 429= 4959104 } } { "return": { } } Now the response is explicit, mentioning the feature is disabled: { "execute": "sev-inject-launch-secret", "arguments": { "packet-header": "mypkt", "secret": "mypass", "gpa= ": 4294959104 } } { "error": { "class": "GenericError", "desc": "this feature or command is not currently supported" } } Reviewed-by: Paolo Bonzini Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- 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 cf4a8a61a02..22883ef2ebb 100644 --- a/target/i386/monitor.c +++ b/target/i386/monitor.c @@ -732,37 +732,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, "SEV not enabled for guest"); - 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 d5ec6b32e0a..82c5ebb92fa 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, "SEV is not available in this QEMU"); } =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 038fa560588..072bb6f0fd7 100644 --- a/target/i386/sev.c +++ b/target/i386/sev.c @@ -973,6 +973,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, "SEV not enabled for guest"); + 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 18:10:39 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=1633623528; cv=none; d=zohomail.com; s=zohoarc; b=K/ETP6sef0CuXs9l1xTtpfm+FBKbx1NCjT0AGzVbiRYZIfWwznbffGORuF5qA+GTgOUa1Q+Im4dNE7HkuXMlvHjdLll8iRu0tSCBi6Md/gKE2+eJgaF183yDlIaMd4eK3MGFisLaWnZfbFTXKtZ3019K5ubVQ/Cbnn/+w2u2DKU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633623528; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=eYG5GFyks0GfeQysE3VKr9sF8B7VadEExh3ZaL/jqtM=; b=hCou4B9YY/WyKfrvSbOjUs8ZnhBb1jFbSDKMQnbrJ4KBEnwarYiU1YN9VlyFpVivPDk5OY4DYdNgVcYwcflM9Fh/M27WbxZxVHVhSmO9Az2WuwOnD8a/o7mQ7d4gFudsBYg6sFh7lDrLATVbUVJDZOs11ZCDjId7PMoTylQf4Co= 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 1633623528312673.665803109891; Thu, 7 Oct 2021 09:18:48 -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-433-FMdWGB7JMWOc7DKVJjThPA-1; Thu, 07 Oct 2021 12:18:46 -0400 Received: by mail-wr1-f70.google.com with SMTP id d13-20020adfa34d000000b00160aa1cc5f1so5120097wrb.14 for ; Thu, 07 Oct 2021 09:18:46 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (118.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.118]) by smtp.gmail.com with ESMTPSA id f9sm85962wrt.11.2021.10.07.09.18.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Oct 2021 09:18:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633623527; 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=eYG5GFyks0GfeQysE3VKr9sF8B7VadEExh3ZaL/jqtM=; b=HW2M9TbVl0woqCe6zFOpZTW0BXVGpdmlKFMXcKBrDIUUluebWA5aA0qmAftqh8HK8LM3qt UoIUMKehFcAGBcdVdVxDo1x4S3rxSmXq0JCwKZVVzRCyZSNU4SlObpktHfTpPcJyBmRlgK ySy+asmNmalQrRVKRWJiSF2rd0KlvWo= X-MC-Unique: FMdWGB7JMWOc7DKVJjThPA-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=eYG5GFyks0GfeQysE3VKr9sF8B7VadEExh3ZaL/jqtM=; b=Fy6SZVW72hJTn/c4PZgGVypAwOt+OPF3j9DHmlfadiSTiT5637axdggSkrCZLxMXth GM0AZ4xn57iAT8Ty317LcO/PkNidl9A62tBHmswTp4sIPlvnjfTgLyFnVeI7AGetSPP+ /aqkCof3Go7cvpVIl7VWT4PEE1U1cSRcdyoza1SJHXhHprarIgyHHYYyCpDF1mvtSDWx e16uI7639C1K0xqlG022ZfCP0uPXWCwr4myAmxfTpJMsBkckdV6kapzKVirGx5f56sjB H379qWo7ymvw1eYFR1o0QUnkPpL1Sj2DcCs/I2I2MUQ/WvTQNzNJaELJLNEOOvlcOHyr 48Yg== X-Gm-Message-State: AOAM531n5PcJzjrUl71KA+9gpZgeNydsiABRbe5uu5UQAFFMaCneMpp6 jzlbZIeJVmri+pB2q4aBC/pbkxGWN5OzBIzMfd4APLg7XGMJzL+weOqJFMk3tGlJRuxRgjMGAay zTjSkTKT9VSNX3w== X-Received: by 2002:adf:aa92:: with SMTP id h18mr6442644wrc.372.1633623525128; Thu, 07 Oct 2021 09:18:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyHHZKQOjYRnT9+FmsxmDtac4YCe8C0X0vefev5KYvlUQXaIrRgt4AfzCSl6KGgaKbHDRYH0g== X-Received: by 2002:adf:aa92:: with SMTP id h18mr6442625wrc.372.1633623524973; Thu, 07 Oct 2021 09:18:44 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Eduardo Habkost , kvm@vger.kernel.org, "Michael S. Tsirkin" , "Dr. David Alan Gilbert" , James Bottomley , Brijesh Singh , Sergio Lopez , Dov Murik , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v4 19/23] target/i386/sev: Move qmp_query_sev_capabilities() to sev.c Date: Thu, 7 Oct 2021 18:17:12 +0200 Message-Id: <20211007161716.453984-20-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211007161716.453984-1-philmd@redhat.com> References: <20211007161716.453984-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: 1633623530213100001 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. Reviewed-by: Paolo Bonzini Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- target/i386/sev.h | 1 - target/i386/monitor.c | 5 ----- target/i386/sev-sysemu-stub.c | 2 +- target/i386/sev.c | 8 ++++++-- 4 files changed, 7 insertions(+), 9 deletions(-) diff --git a/target/i386/sev.h b/target/i386/sev.h index 2e90c05fc3f..b70b7b56cb8 100644 --- a/target/i386/sev.h +++ b/target/i386/sev.h @@ -51,7 +51,6 @@ 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 bool sev_add_kernel_loader_hashes(SevKernelLoaderContext *ctx, Erro= r **errp); =20 int sev_encrypt_flash(uint8_t *ptr, uint64_t len, Error **errp); diff --git a/target/i386/monitor.c b/target/i386/monitor.c index 22883ef2ebb..4c017b59b3a 100644 --- a/target/i386/monitor.c +++ b/target/i386/monitor.c @@ -727,11 +727,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 82c5ebb92fa..3e8cab4c144 100644 --- a/target/i386/sev-sysemu-stub.c +++ b/target/i386/sev-sysemu-stub.c @@ -27,7 +27,7 @@ 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"); return NULL; diff --git a/target/i386/sev.c b/target/i386/sev.c index 072bb6f0fd7..56e9e03accd 100644 --- a/target/i386/sev.c +++ b/target/i386/sev.c @@ -466,8 +466,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; @@ -517,6 +516,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 18:10:39 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=1633623534; cv=none; d=zohomail.com; s=zohoarc; b=gzTVm8N0R0b3kmpc9+650Pk+yfvjladmmBz3sT2KSnQpm5gUrZJgAzAav2eGhzXmYboKFVktqiE9jf5lp2+Qpvy0SLddeXjTLhU+xKkqZirTncahxVyH9tHxTPaq2l2AFaqqF3mY88HsKQIVmAbxZjjTvG3oWUy6G+ktYsERtdk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633623534; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=zXfwRbpC9Lbx4LzGOmEzDg8Z5na4+1mXZEo+IH6+b1c=; b=a6AFNLSlth4qUylFNoNRFu15SVLDuSn5ilXB/AgMDjJYm/vPRBLRaqt6qlx91A0BRsF09hHL2L5/cS3Zy9K11AzDd/UOAFyE1gwJLD5vVmiImhYC2nw1HTBZjXPjnkdESlsnJ/L/2LhpImKAmtFvwyqiH3EKsdYEnkC/c1mBSgQ= 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 1633623534198297.0060615479738; Thu, 7 Oct 2021 09:18:54 -0700 (PDT) Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-492-BQfjI92kPUqtYonFHE6VXw-1; Thu, 07 Oct 2021 12:18:50 -0400 Received: by mail-wr1-f71.google.com with SMTP id k2-20020adfc702000000b0016006b2da9bso5117128wrg.1 for ; Thu, 07 Oct 2021 09:18:50 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (118.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.118]) by smtp.gmail.com with ESMTPSA id w1sm60022wre.79.2021.10.07.09.18.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Oct 2021 09:18:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633623533; 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=zXfwRbpC9Lbx4LzGOmEzDg8Z5na4+1mXZEo+IH6+b1c=; b=c3c1IUlLf3leeUEwrQGFkuPtsUxCq2OgJ4lJs1PTxZRmXq/TiqB4SfRkLgj3Du6ErkKtZE o82MixkDZxzfEprSR7jU3LghpFzdprAJH+TKJ3IR1vv6o6f8M4Z5FmmH5WCXT3ghwyESuy 7DwtxAl+s0nMwW6HpUGedIa29Ijzmak= X-MC-Unique: BQfjI92kPUqtYonFHE6VXw-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=zXfwRbpC9Lbx4LzGOmEzDg8Z5na4+1mXZEo+IH6+b1c=; b=Bie7Xd6W9gYvAidJlCclOxS6qvw5ThunvUj03FqgUijwISNBxVbfCrP1yS0bcgLZ1G PqNzx1UCYnF74kpJbgK/eWYQL8PYqEJ5wBJPsN75Uy8qGeMvYmLGqOie/Hssag+m2Mru IQAh+sgJwrHmwUKZmDEXOarxOvI+MIRs7bshbH8sWO8VrQeTsHkcxlUTRD8+5UniZRPw WMjMcin8TALe34a9O4tqoQwJtswH2EnSrQmWibNoSOyh4yrAvxIytmGzV/zU/EjrbeyP O1abRRZw7o4+Fnvx235wFztDbeWkmlWEIZO1zzmwLOERiz01htAZJdOTTjxoslKkoS2g lqDA== X-Gm-Message-State: AOAM530sG+XT1BP/uBouxipG522cKEQskYZw9XBQVvuOu54/7xbbWJOK H83mBhUsNNjjcwNLH9IL9LwKLufHClzS9ndiWg01q+ZQW6u8CTo96k/y4n05zkMbhjuRefhD+bI AvoVQXgDvVd9aLg== X-Received: by 2002:a05:6000:15c9:: with SMTP id y9mr4937125wry.361.1633623529602; Thu, 07 Oct 2021 09:18:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxVZkZLJExUdIkU8eUXntS+EbMqWJ8pnYgvB7GErpwpgWp6MdaxC3o/caLpYVSADf5LX9m6nw== X-Received: by 2002:a05:6000:15c9:: with SMTP id y9mr4937095wry.361.1633623529405; Thu, 07 Oct 2021 09:18:49 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Eduardo Habkost , kvm@vger.kernel.org, "Michael S. Tsirkin" , "Dr. David Alan Gilbert" , James Bottomley , Brijesh Singh , Sergio Lopez , Dov Murik , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v4 20/23] target/i386/sev: Move qmp_query_sev_launch_measure() to sev.c Date: Thu, 7 Oct 2021 18:17:13 +0200 Message-Id: <20211007161716.453984-21-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211007161716.453984-1-philmd@redhat.com> References: <20211007161716.453984-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: 1633623534915100001 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. Reviewed-by: Paolo Bonzini Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- target/i386/sev.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.h b/target/i386/sev.h index b70b7b56cb8..dda350779f9 100644 --- a/target/i386/sev.h +++ b/target/i386/sev.h @@ -50,7 +50,6 @@ 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 bool sev_add_kernel_loader_hashes(SevKernelLoaderContext *ctx, Erro= r **errp); =20 int sev_encrypt_flash(uint8_t *ptr, uint64_t len, Error **errp); diff --git a/target/i386/monitor.c b/target/i386/monitor.c index 4c017b59b3a..bd24d0d4737 100644 --- a/target/i386/monitor.c +++ b/target/i386/monitor.c @@ -710,23 +710,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, "SEV launch 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 3e8cab4c144..8d97d7c7e14 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, "SEV is not available in this QEMU"); return NULL; } =20 diff --git a/target/i386/sev.c b/target/i386/sev.c index 56e9e03accd..ec874b3df82 100644 --- a/target/i386/sev.c +++ b/target/i386/sev.c @@ -742,8 +742,7 @@ sev_launch_get_measure(Notifier *notifier, void *unused) trace_kvm_sev_launch_measurement(sev->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) { @@ -753,6 +752,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, "SEV launch 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 18:10:39 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=1633623538; cv=none; d=zohomail.com; s=zohoarc; b=ITJsJVd/KyQNWAdgDl2kPwfqsIwJHeFHVhqEmBqrlj8E+0umFa+u6o0YOue1CFxzeyd7gzUBmAi16NHtlHV9KF/t+JpXRiR42bZ2ADSNqG3C4hItOsYIbupc4IcOYvmukGTKVYKA03Ih1H0dizdQ+QjOMQQwhCA20UeokFvqPKQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633623538; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=eCfS+Asf+f1waC4AVoz1E9eLdrSZudUp689oYCk0mwY=; b=TVH6phL+PBr1UsWu74uHmxWF1XvBKddHZc6n1DH8/hoLSdg2YvU0Rztu08iPvSA9yS/nZDEfKINzA0ZLgopTVu+GCXH5qGfH5RJ8YUmak4L/XnqP8YjQv5x/8rhxPQM7BAxCaZEF3Z9nxA0BfdQEeGi6mZWV0rRkvsaQ7GL/NS0= 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 1633623538006907.4773729690111; Thu, 7 Oct 2021 09:18:58 -0700 (PDT) Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-184-ES_6Tqc6PaW_fmrrEfuUBg-1; Thu, 07 Oct 2021 12:18:56 -0400 Received: by mail-wr1-f71.google.com with SMTP id r21-20020adfa155000000b001608162e16dso5105017wrr.15 for ; Thu, 07 Oct 2021 09:18:55 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (118.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.118]) by smtp.gmail.com with ESMTPSA id o6sm130018wri.49.2021.10.07.09.18.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Oct 2021 09:18:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633623536; 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=eCfS+Asf+f1waC4AVoz1E9eLdrSZudUp689oYCk0mwY=; b=J3ad5I2VsxAU1XRJ8Sf7uHgBZI9+swNsZ3nFaTVhB41DK3aFtzT+vFJq8OuwXsB15qIA8g OkoQhkdzAv3fvc735/3hO0h/J80cCkHlNICNDdrNKOzuyL1JwgwVOZ0JsJjy2tOMB0LKbx JcYbkajbiJrqUdGWoFiFNq5gA3iogo8= X-MC-Unique: ES_6Tqc6PaW_fmrrEfuUBg-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=eCfS+Asf+f1waC4AVoz1E9eLdrSZudUp689oYCk0mwY=; b=D+/XMtZn+B1DDllt3X5xBbLJa+GX5zPYmVDscEmIGH6F0DuXpiKx5hZ1w/ZKs09gcr Z+9asumWRSCj1/uVH+xT952OqizxyR3Q5TJptweXX8koCHfS4//QPAogBqBx3QQd2yXR ci4wUkcTwrCnHLpKNc7sD/oSNYuN2izGWSnBO9+QcGHkKy3KevEZ36HnaGIJWpift6Yw JHPh3Z9954Uagc7edAgw5PYjfAbOSlGUONMXuar5CBbeCjy0FM00OZNWEEkI2wKzKAlu qF+D++9pmHrIjkM96H+drK/l9bThaSwiaB2lXPrejJL/XxqhdXQes/fCZlW2ZFJfFIAw kJUg== X-Gm-Message-State: AOAM5321ZbCLzRQkMS+nxwgmRSplqlmImnrV79paRtrhAW4Glk7Vbfyw UXGTkmWPD4TkOkCXBcF6W4Ts0yJaUfiNCui01woOggA9SL/4XZEy4zdhzhdvRNX/vp5I0XqP0k1 69kCdEHOVhuyQXw== X-Received: by 2002:a7b:c351:: with SMTP id l17mr5734550wmj.120.1633623534006; Thu, 07 Oct 2021 09:18:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzMiBCCsPqIpoUFMotzmt5Xfmuwzj1LGT3FXGJkJ2kFOsOJzE9yp1pWqRATIf7s0cH57Uvvhg== X-Received: by 2002:a7b:c351:: with SMTP id l17mr5734533wmj.120.1633623533832; Thu, 07 Oct 2021 09:18:53 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Eduardo Habkost , kvm@vger.kernel.org, "Michael S. Tsirkin" , "Dr. David Alan Gilbert" , James Bottomley , Brijesh Singh , Sergio Lopez , Dov Murik , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v4 21/23] target/i386/sev: Move qmp_query_sev() & hmp_info_sev() to sev.c Date: Thu, 7 Oct 2021 18:17:14 +0200 Message-Id: <20211007161716.453984-22-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211007161716.453984-1-philmd@redhat.com> References: <20211007161716.453984-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: 1633623539428100001 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(). Reviewed-by: Paolo Bonzini Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- target/i386/sev.h | 2 -- target/i386/monitor.c | 35 -------------------------------- target/i386/sev-sysemu-stub.c | 10 ++++++++- target/i386/sev.c | 38 +++++++++++++++++++++++++++++++++-- 4 files changed, 45 insertions(+), 40 deletions(-) diff --git a/target/i386/sev.h b/target/i386/sev.h index dda350779f9..3fba1884a0d 100644 --- a/target/i386/sev.h +++ b/target/i386/sev.h @@ -19,7 +19,6 @@ #endif =20 #include "exec/confidential-guest-support.h" -#include "qapi/qapi-types-misc-target.h" =20 #define SEV_POLICY_NODBG 0x1 #define SEV_POLICY_NOKS 0x2 @@ -47,7 +46,6 @@ bool sev_es_enabled(void); #define sev_es_enabled() 0 #endif =20 -extern SevInfo *sev_get_info(void); extern uint32_t sev_get_cbit_position(void); extern uint32_t sev_get_reduced_phys_bits(void); extern bool sev_add_kernel_loader_hashes(SevKernelLoaderContext *ctx, Erro= r **errp); diff --git a/target/i386/monitor.c b/target/i386/monitor.c index bd24d0d4737..680d282591c 100644 --- a/target/i386/monitor.c +++ b/target/i386/monitor.c @@ -31,7 +31,6 @@ #include "qapi/qmp/qerror.h" #include "sysemu/kvm.h" #include "qapi/error.h" -#include "sev.h" #include "qapi/qapi-commands-misc-target.h" #include "qapi/qapi-commands-misc.h" #include "hw/i386/pc.h" @@ -676,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 8d97d7c7e14..68518fd3f9d 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.h" =20 -SevInfo *sev_get_info(void) +SevInfo *qmp_query_sev(Error **errp) { + error_setg(errp, "SEV is not available in this QEMU"); return NULL; } =20 @@ -60,3 +63,8 @@ SevAttestationReport *qmp_query_sev_attestation_report(co= nst char *mnonce, error_setg(errp, "SEV is not available in this QEMU"); 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 ec874b3df82..19504796fb7 100644 --- a/target/i386/sev.c +++ b/target/i386/sev.c @@ -32,6 +32,7 @@ #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" @@ -402,8 +403,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 @@ -422,6 +422,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 18:10:39 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=1633623542; cv=none; d=zohomail.com; s=zohoarc; b=CfHUv3aXnnc6Qw2xHWl9lSSiQq+7DeBnUKguIziLZhpX0Gd2YEBoB89idjnr4oAX/oCypjLw/jSBGx4GN99tb38zBVw1QHzB3QekUwr7n8DndmCSlH6NZkYqioY0+OSRaLvd9v+b5RTQntG5193o+5QLmiyCiHTtILCQglRjqw4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633623542; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=dszCsYIAf35aWLecKqc6M9ImtE7DijrXFcMIXKeRiqY=; b=BodA0uPqz3cfx7bPP61NUKCVTssqyQzDAD5hLnwu+VAfBEho6p6vz5/xKhKM5h2t1LBz9zirGbT6MjApdZ3iYyjrkS4dE9i40J6PtAS4f90C5UJbQwz/vAQ7FRNXmnkfSqUUkKjJiboVM14iyLVBLq5le1Tshb7SnWRgY8ak4Gk= 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 1633623542224745.2824255070593; Thu, 7 Oct 2021 09:19:02 -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-190-zyx9G975MxeDq_leKSZi1A-1; Thu, 07 Oct 2021 12:18:59 -0400 Received: by mail-wr1-f70.google.com with SMTP id f11-20020adfc98b000000b0015fedc2a8d4so5147375wrh.0 for ; Thu, 07 Oct 2021 09:18:59 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (118.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.118]) by smtp.gmail.com with ESMTPSA id c77sm4630wme.48.2021.10.07.09.18.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Oct 2021 09:18:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633623541; 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=dszCsYIAf35aWLecKqc6M9ImtE7DijrXFcMIXKeRiqY=; b=fOMoK7yu2Th/DklPfAtgBmj+ayBhrgWm59dOJGrfV8DltP4gr12ZIy8qg++UJFaiKDkTAo 3OxJ7lKn3nBGVm2rrVijF9IjQ0kBa/ry5s/1k8PvNbBifxPizTp3nXBt1l+ZPmvO2/X2ZL 6+9ZlPu5L6K74NZjZ7tT7bMIXb/sZg8= X-MC-Unique: zyx9G975MxeDq_leKSZi1A-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=dszCsYIAf35aWLecKqc6M9ImtE7DijrXFcMIXKeRiqY=; b=kDRMcGacU54djU7cX7E8RMx1HPcnVdqfDG+8K/IyJrdac5ZIqvhcJmTWpRhtNfAze7 diMQn+CRr5PNOrEhcGH2LS35SpN6A9u/X0K/3MM8J04VqvVW5uPcZ6v3jVQsx62wnap7 6AhhlXP/P8ZP4mVIizdf7mLN4m86DP/2q1OOApgt9j0LOCUyI+c++YBEdvPvxodpR+pW woVD64J1Q552Ec4YUJqBYINzPKYtGqIh5qUx6hSM2+SYVLYI2wAfi2Izdwu3c4HQqYyF u0nKxHiA6Exgek4Wab8nfrqaTzHrgv6zptGOCmhKnIxDuX2KTxmha8vye6wzH2rukJYn PkQw== X-Gm-Message-State: AOAM532tAyHGDgfhYKTj5ihO2GHM+8eDD7FyDnOAYndM2qTIvCmonzZh cm8LuGJdenSuRShDlP48FIjH8diFDNuuQITXaDTXtE4p07gZh4HtqVS5jeOysYLqqxtwVuBimFx akeDpovC0LCGOhA== X-Received: by 2002:a05:600c:2199:: with SMTP id e25mr17668176wme.67.1633623538506; Thu, 07 Oct 2021 09:18:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwNRqSXp1fcCQwH5Qrmb0ILMhSM78sS3Mu8PApG1hGseG2CcrM+8gbZcUik9BKir5O9HMblnA== X-Received: by 2002:a05:600c:2199:: with SMTP id e25mr17668154wme.67.1633623538287; Thu, 07 Oct 2021 09:18:58 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Eduardo Habkost , kvm@vger.kernel.org, "Michael S. Tsirkin" , "Dr. David Alan Gilbert" , James Bottomley , Brijesh Singh , Sergio Lopez , Dov Murik , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v4 22/23] monitor: Reduce hmp_info_sev() declaration Date: Thu, 7 Oct 2021 18:17:15 +0200 Message-Id: <20211007161716.453984-23-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211007161716.453984-1-philmd@redhat.com> References: <20211007161716.453984-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: 1633623543976100001 While being conditionally used for TARGET_I386 in hmp-commands-info.hx, hmp_info_sev() is declared for all targets. Reduce its declaration to target including "monitor/hmp-target.h". This is a minor cleanup. Reviewed-by: Paolo Bonzini Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- 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 68518fd3f9d..7a29295d1ed 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 19504796fb7..4c64c682442 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 18:10:39 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=1633623551; cv=none; d=zohomail.com; s=zohoarc; b=TDFt3bXRmMrIOJlPrmlNIs/41qBxeEdRb1HtpBnjpOq+mLYwNlD8Fsd7TOMEaG8DKU4oJ7sY7bPiuHGaN2QUEVs/wm9/TzGaVd35VRDt+TNIbya+z8DA+kYY9BT5xzdsKg+UP/0YZkQWRXyr8n4Az2a9NaSDbTipLVLhFj6yGFE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633623551; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=raENXGoMd83njG9X2No5AFJQfUuVjvhwyUCC5K+pe4w=; b=GNAM9s29zuS/ZI9NuWdsYlJixoIqIhduXOOTyWILuqZwjFtJlqVeYJT6h6Xe3jey36JlH/oCkO6UhkOD5v8XuW8OdO8Hy2Kl722jJmXD3kT2I7lEFiX8kIgxb0CsGAfsL6Tr/YNU1jiK1bGzcw1GfhW2mgx78eHrdjiiSFhTh+w= 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 1633623551570921.2378457087214; Thu, 7 Oct 2021 09:19:11 -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-58-XqWj8YPANUyahmFJxORB5Q-1; Thu, 07 Oct 2021 12:19:04 -0400 Received: by mail-wr1-f69.google.com with SMTP id f11-20020adfc98b000000b0015fedc2a8d4so5147549wrh.0 for ; Thu, 07 Oct 2021 09:19:04 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (118.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.118]) by smtp.gmail.com with ESMTPSA id d3sm78771wrb.36.2021.10.07.09.19.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Oct 2021 09:19:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633623550; 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=raENXGoMd83njG9X2No5AFJQfUuVjvhwyUCC5K+pe4w=; b=OA5t7zrqlv7zuQscdv1cfaUqAA2EjU2uQnAq8xB3Lb3JE6E4yvrntZBsvXUGFa+vw17hjN w7eLnvMRlazlgy7PWNR8wLmOVfIPEUS7GD5mZ8XFjXG1ByqzaxycQxn4PFj5ePAHWu/FT8 MDdyk5dzcmKgcn/+8ImWX+xUk9Mjmrg= X-MC-Unique: XqWj8YPANUyahmFJxORB5Q-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=raENXGoMd83njG9X2No5AFJQfUuVjvhwyUCC5K+pe4w=; b=eTscnhL6yvodjilqAU+Ul4LDrv3LwH5lOu4+rSW5wupsvQ12OhgLIv1JmUf6eLIRgp 12fNENW3MWn+jeSWEB1YyM+92NwBYHq+MAuh3DpXLzsKZ8iCZRtZ3O8ipTZjUpSqkjei 8qnQVWXbIL20R4dT5t6lMifnyWdQCYMdv0/n3kSpeebLNUpFvXwORq15UwxYOXXgN1bv qgEqqy9pez07K3KP2w/B+21fu4laG9iyrR4MZ5Ffwicow/LEnFkUniQn4ZTLb6WHrrsG xHsZu9J2I7dR6RzTuYrHvHlO16tX3UT+Rktz2zKi76sBA/9BeHqUmJpgOp9YCfzxt7jt DbTA== X-Gm-Message-State: AOAM530dsx6IqmSstqOVxKrdO2kM7yJvTrVHBgC8JzX+EctE03dOgn9N v67mmyG9oULe9EOgfqKxZwNCKtGw8seKnK6u2LzCEcic3TzjSHks6SP5LdmahkRYB37eYVx19wI tqZgIh0+2aBnroA== X-Received: by 2002:a1c:21d7:: with SMTP id h206mr17449924wmh.23.1633623543156; Thu, 07 Oct 2021 09:19:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwLVyjk8Yjb8T3LzpyyPDRcvNepzAgqY2opRKw88FbZnxb/11utVAJlVwGyacRlavjgmwnmOQ== X-Received: by 2002:a1c:21d7:: with SMTP id h206mr17449901wmh.23.1633623542998; Thu, 07 Oct 2021 09:19:02 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Eduardo Habkost , kvm@vger.kernel.org, "Michael S. Tsirkin" , "Dr. David Alan Gilbert" , James Bottomley , Brijesh Singh , Sergio Lopez , Dov Murik , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v4 23/23] MAINTAINERS: Cover SEV-related files with X86/KVM section Date: Thu, 7 Oct 2021 18:17:16 +0200 Message-Id: <20211007161716.453984-24-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211007161716.453984-1-philmd@redhat.com> References: <20211007161716.453984-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: 1633623553139100003 Complete the x86/KVM section with SEV-related files. Suggested-by: Paolo Bonzini Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- MAINTAINERS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 50435b8d2f5..a49555d94d5 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -417,7 +417,9 @@ M: Paolo Bonzini M: Marcelo Tosatti L: kvm@vger.kernel.org S: Supported +F: docs/amd-memory-encryption.txt F: target/i386/kvm/ +F: target/i386/sev* F: scripts/kvm/vmxcap =20 Guest CPU Cores (other accelerators) --=20 2.31.1