From nobody Thu Mar 28 16:44:16 2024 Delivered-To: importer2@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+importer2=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1623307723; cv=none; d=zohomail.com; s=zohoarc; b=leEgXiUh7Fh2bO50ua2dX98kA/NpAWN/TzXEAHnKarz1rYyFOk0EBONlCr7nxNZo5Tb/uve0HXmzj8LMEFsrlUWTwknqexRYMmgU/Oq4TYQjWGUqE7RYKGQhLKjeNg4RElW/7GFIQ0sFPDji2gC2swWz9K3TGQ87ru5gF494cm8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1623307723; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=KTE3q/L3zX2olanVbDbjGlNnVrM20+mQiCxT9CvYLMk=; b=QlFQCt+UUGkkaVY+ms2cuDEvNQIk/9ElU4MJNtrBkMEOAbrd9VLAspDDTidDdguA/MswK62BixDOypAprVGo791vFKvRoBlxL2QR/Dsu6t7l65yHfErAe6FliY10BHC3B/dIQAXUmbALDM5wUHXXmgkgcd1sjH69C2YF1aJLVJE= ARC-Authentication-Results: i=1; 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+importer2=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 162330772370262.137381751980115; Wed, 9 Jun 2021 23:48:43 -0700 (PDT) Received: from localhost ([::1]:59792 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lrEUc-0001jm-EQ for importer2@patchew.org; Thu, 10 Jun 2021 02:48:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55590) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lrES9-0007Tj-5C for qemu-devel@nongnu.org; Thu, 10 Jun 2021 02:46:09 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:39674) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lrES6-00055i-EY for qemu-devel@nongnu.org; Thu, 10 Jun 2021 02:46:08 -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-324-dSOsBZSRM5-AipSXHB-ScA-1; Thu, 10 Jun 2021 02:46:04 -0400 Received: by mail-wr1-f72.google.com with SMTP id f22-20020a5d58f60000b029011634e39889so423694wrd.7 for ; Wed, 09 Jun 2021 23:46:04 -0700 (PDT) Received: from x1w.redhat.com (235.red-83-57-168.dynamicip.rima-tde.net. [83.57.168.235]) by smtp.gmail.com with ESMTPSA id a15sm2828880wrs.63.2021.06.09.23.46.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Jun 2021 23:46:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1623307565; 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=KTE3q/L3zX2olanVbDbjGlNnVrM20+mQiCxT9CvYLMk=; b=ZjyKC/Jdx7f9XIprK3NVYO5iEeea4onjwnz2kRa1AsfAfXoQScX//FlIyZI8fMmVDsFCXR JhMvqILlkkCWA5bHWBbV5rtHfocVPEJRszs3XiuNYr0QV/trvNecdMPtka3cJpwIDMtvrP I5bAX5z54JQxtLeOq/YY26Z2oBv447w= X-MC-Unique: dSOsBZSRM5-AipSXHB-ScA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=KTE3q/L3zX2olanVbDbjGlNnVrM20+mQiCxT9CvYLMk=; b=Ux5uUB5GjPUWh8hPncEVe7vMz98ddEfgHhUYl8ZUGQxuk1VGQcxRUjE32Bpu/CZ8PW 5yUQoYR+RikYkIbhbJ81mO3w5WpelOmm9JWGWrZfY8UcJPZck2MkzAoTIEE1ydsOG2YA BatIUnHUQJQ9fU3LeC5vJeFDvuDRsogohwjmkyOjsjgc5MQoS7zxhB/bAxMejG7l19i+ lnuQBvWkTA2Wng3yfFCeGniPC7TUZ1QYK2PoS+eH5mkrkWSMoNRLMh1yEJ63Gfbxvfhh cHu7SB4SPg4L7gjlhC3FqDVjskCITC8HY/lciAhHjnraOuraU8Iepo6VWf0Qz/1NkgT9 Zawg== X-Gm-Message-State: AOAM530ylG70N9bp5R2rfmVGzITsut1Ojnw706lCzDVJY/0dsTfqzU8F 1vJpCEIY79Vwy2Y5e67vdCCnGLXWts+NOutrj/0JVaJuoevvJHvgOfol8G5/S1Uw8V86J0lRGjC I7bkCbZLrpMvFkIVnNOyADFtbeqqzGIBEJC3n5d2oWPHkfqfDBlaNUPnYy/LnTThh X-Received: by 2002:adf:82a3:: with SMTP id 32mr3458048wrc.136.1623307563190; Wed, 09 Jun 2021 23:46:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw3uVWgGvxAZag/6LTsU9LqoIL6Y+rsidBBSrloLYd7Hfw5JQlXWNY1orKvivVNb5ptzcztzA== X-Received: by 2002:adf:82a3:: with SMTP id 32mr3458011wrc.136.1623307562959; Wed, 09 Jun 2021 23:46:02 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH 01/11] MAINTAINERS: Add Connor Kuehl as reviewer for AMD SEV Date: Thu, 10 Jun 2021 08:45:46 +0200 Message-Id: <20210610064556.1421620-2-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210610064556.1421620-1-philmd@redhat.com> References: <20210610064556.1421620-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+importer2=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: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.199, 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_H4=0.001, RCVD_IN_MSPIKE_WL=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 , Connor Kuehl , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Dr . David Alan Gilbert" , Markus Armbruster , Eric Blake Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Connor Kuehl It may not be appropriate for me to take over as a maintainer at this time, but I would consider myself familiar with AMD SEV and what this code is meant to be doing as part of a VMM for launching SEV-protected guests. To that end, I would be happy to volunteer as a reviewer for SEV-related changes so that I am CC'd on them and can help share the review burden with whoever does maintain this code. Signed-off-by: Connor Kuehl Message-Id: <20210608192537.103584-1-ckuehl@redhat.com> [PMD: Cover more files] Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- MAINTAINERS | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 56888121ec8..a93f4ba1861 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2938,6 +2938,13 @@ F: hw/core/clock-vmstate.c F: hw/core/qdev-clock.c F: docs/devel/clocks.rst =20 +AMD Secure Encrypted Virtualization (SEV) +R: Connor Kuehl +F: docs/amd-memory-encryption.txt +F: accel/kvm/sev-stub.c +F: target/i386/sev* +F: include/sysemu/sev.h + Usermode Emulation ------------------ Overall usermode emulation --=20 2.31.1 From nobody Thu Mar 28 16:44:16 2024 Delivered-To: importer2@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+importer2=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1623307724; cv=none; d=zohomail.com; s=zohoarc; b=M3W+OAWp4SJZj1B6E8KzyTghh87EVTCl/E1oKoziT0xlxVKSURBQG6iQAnYlgaONqbVXTbZIDyTX7vuwtqgk+S4J7+FYtZCX1f3J7bFxDogGAViHPjLtwmyxpKJsePy6jgmnQNHuOmvd9JdmcGjn6kXARbSOn6ywdM1wGxDpwxs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1623307724; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=FjkQZ0yzu9xDnZx5K+AIPt7jpTRH0jKavlFDBx0pW4E=; b=d9RlNdGzagKXEUadWdcwBjNlaItqHuhIl8s5/R3BuaeOvNwm+7NI3X7V7pVeMvuubsKzUcbaoXBL11VnWC8JF1w3ctEXoAzx5hRCiI3lrcGK86wmpEO6bFvFatCikc3wU6amNOd084or6wr04emaJJAn1SpxhrHde/E3FfAy9hc= ARC-Authentication-Results: i=1; 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+importer2=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1623307724539681.9077123015095; Wed, 9 Jun 2021 23:48:44 -0700 (PDT) Received: from localhost ([::1]:59898 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lrEUd-0001oQ-ED for importer2@patchew.org; Thu, 10 Jun 2021 02:48:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55612) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lrESC-0007Vq-Ch for qemu-devel@nongnu.org; Thu, 10 Jun 2021 02:46:12 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:60719) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lrESA-00058o-Cr for qemu-devel@nongnu.org; Thu, 10 Jun 2021 02:46:11 -0400 Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-196-_mchGanOMl2UaEgDa2FEnA-1; Thu, 10 Jun 2021 02:46:09 -0400 Received: by mail-wm1-f72.google.com with SMTP id z25-20020a1c4c190000b029019f15b0657dso2665069wmf.8 for ; Wed, 09 Jun 2021 23:46:08 -0700 (PDT) Received: from x1w.redhat.com (235.red-83-57-168.dynamicip.rima-tde.net. [83.57.168.235]) by smtp.gmail.com with ESMTPSA id z3sm2371221wrl.13.2021.06.09.23.46.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Jun 2021 23:46:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1623307569; 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=FjkQZ0yzu9xDnZx5K+AIPt7jpTRH0jKavlFDBx0pW4E=; b=aya2ydUTACtW4R/1800one6PxE4WnjS1OMJHgu9loe6RJWm39dXQ1sl8ByNFEF/yJ6FYCP 4+a8uNsGW/GcvdMyOx5vR7GNBa37StlydI2PjDAkhWK1fNNgDFKrbyOW2dkAImMeZ/ig9g Dchh7QQHo3QnOKWNWwxnCRL8b7v+Z08= X-MC-Unique: _mchGanOMl2UaEgDa2FEnA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=FjkQZ0yzu9xDnZx5K+AIPt7jpTRH0jKavlFDBx0pW4E=; b=UwKBgsHzv4ic0cki2qM1wZvIoUSO2PDrXHoHuWWCTGwknChd0QwImpCCwXH/QaB8FF m6cSbpsla9YipdLL3XmnihOJgL7VsiPl0syR6lrOPGqdjfGLnIQODVRY0jSuqiUi+vte AFPPVl24ixRsn/YuwjAzCynTxyvO5BwzjcrIjX4iDNwxQU9dQt8K0N/oi2IZktx12kPh RUFIOGaGvwMD9W8kkQ7LGPtZ5pzyVCtJ+7r6cQxyw0zUyIC/eUDxdxpYywPC+B9hVa5E Y9QZQIAGFmG/dpY0kR2TvxvVFS261KjGQTVV89DpuaSxD0tC4m4Xe/szMdX28SP7c70f +JGg== X-Gm-Message-State: AOAM530/oZbECQ5wVTxzuFKbHwRwO8qhZs1+AXqnwrFC9K9GOjwpebpu DEQy+1fQwf6OkMA0H5v8qfmS87hi3s/ruNEleZ9OwqFu2u7kGhcJZw4bFF27UhwTy18s7bz5FC9 ee2lNqQkJmj4qq/0DJBPVmRHYFzExZyP0UNpd/gtG5sMbrhfYwHqYqmq930YxmbuD X-Received: by 2002:adf:f382:: with SMTP id m2mr3538152wro.394.1623307567561; Wed, 09 Jun 2021 23:46:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwD3Y33J1pqwWZ9Wgz1TCngLNjD7qht0/s4Q5cBDHjR8jdAs61L8MQXcXpM3FRBfHv1mIIpEQ== X-Received: by 2002:adf:f382:: with SMTP id m2mr3538127wro.394.1623307567295; Wed, 09 Jun 2021 23:46:07 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH 02/11] qapi/misc-target: Group SEV QAPI definitions Date: Thu, 10 Jun 2021 08:45:47 +0200 Message-Id: <20210610064556.1421620-3-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210610064556.1421620-1-philmd@redhat.com> References: <20210610064556.1421620-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+importer2=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: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.199, 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_H4=0.001, RCVD_IN_MSPIKE_WL=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 , Connor Kuehl , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Dr . David Alan Gilbert" , Markus Armbruster , Eric Blake Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) There is already a section with various SEV commands / types, so move the SEV guest attestation together. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Acked-by: Markus Armbruster --- qapi/misc-target.json | 75 +++++++++++++++++++++---------------------- 1 file changed, 37 insertions(+), 38 deletions(-) diff --git a/qapi/misc-target.json b/qapi/misc-target.json index 5573dcf8f08..1b81f7017d4 100644 --- a/qapi/misc-target.json +++ b/qapi/misc-target.json @@ -219,6 +219,43 @@ 'data': { 'packet-header': 'str', 'secret': 'str', '*gpa': 'uint64' }, 'if': 'defined(TARGET_I386)' } =20 +## +# @SevAttestationReport: +# +# The struct describes attestation report for a Secure Encrypted Virtualiz= ation +# feature. +# +# @data: guest attestation report (base64 encoded) +# +# +# Since: 6.1 +## +{ 'struct': 'SevAttestationReport', + 'data': { 'data': 'str'}, + 'if': 'defined(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': 'defined(TARGET_I386)' } + ## # @dump-skeys: # @@ -285,41 +322,3 @@ ## { 'command': 'query-gic-capabilities', 'returns': ['GICCapability'], 'if': 'defined(TARGET_ARM)' } - - -## -# @SevAttestationReport: -# -# The struct describes attestation report for a Secure Encrypted Virtualiz= ation -# feature. -# -# @data: guest attestation report (base64 encoded) -# -# -# Since: 6.1 -## -{ 'struct': 'SevAttestationReport', - 'data': { 'data': 'str'}, - 'if': 'defined(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': 'defined(TARGET_I386)' } --=20 2.31.1 From nobody Thu Mar 28 16:44:16 2024 Delivered-To: importer2@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+importer2=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1623307726; cv=none; d=zohomail.com; s=zohoarc; b=JfdEUzHrB1HVw3AGvIfSpM7ydCXVdcA0+tVycEd5tKJcr2sl+KiTqcV+xZH5vsk04A12ReUZcSP2BFzGmCpUy2+za8X2obx6HQWh0UBzs65e8VMQMM4FIpI93ub5M2IGSDsGgIFxbBxNjuYZvcgYjE4tOjEkpsrNtXHGa+JzRYw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1623307726; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=qAeYox9UkBZPHYKkLVvU16TBQxc6Vg+PmuhGEFonMEo=; b=RzJYJzCeIDCxj3zDEif3KlzKmOnimoS5KQdpHPDHAtdUH8bzAbPk5gHYgSiFSV4VxjyT8m0Ob4+NOixurbjFClipYTZTYRRkKpBEnT4G1zt3OI7yBk9IiKgHxBSMhyr6awZkgfeFQjo1nLsDheOBcdqF4vehDDwLXrnYu9CH2qM= ARC-Authentication-Results: i=1; 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+importer2=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1623307726742840.3674618190969; Wed, 9 Jun 2021 23:48:46 -0700 (PDT) Received: from localhost ([::1]:60106 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lrEUf-0001wd-Io for importer2@patchew.org; Thu, 10 Jun 2021 02:48:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55640) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lrESJ-0007b4-OK for qemu-devel@nongnu.org; Thu, 10 Jun 2021 02:46:20 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:28455) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lrESG-0005E5-UB for qemu-devel@nongnu.org; Thu, 10 Jun 2021 02:46:19 -0400 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-427-RUaZUZmUO8a71ZFaArt9cg-1; Thu, 10 Jun 2021 02:46:13 -0400 Received: by mail-wr1-f71.google.com with SMTP id z4-20020adfe5440000b0290114f89c9931so415270wrm.17 for ; Wed, 09 Jun 2021 23:46:12 -0700 (PDT) Received: from x1w.redhat.com (235.red-83-57-168.dynamicip.rima-tde.net. [83.57.168.235]) by smtp.gmail.com with ESMTPSA id g23sm8523342wmk.3.2021.06.09.23.46.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Jun 2021 23:46:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1623307576; 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=qAeYox9UkBZPHYKkLVvU16TBQxc6Vg+PmuhGEFonMEo=; b=KVIw1crK1ozf8htPQGLqlP7geu6ZaM5QrEhZnkuOWRCBKvjwoehqUj/0vq3QHyCb2/tfFZ VcfQ5dLTCyWuaKBK50Xa7XkrsMh4hMGeMFF+vpcT9h8YzolID4mf2Nzlg1tHCNPjhzV60S Apt9mBTDow/yFqszavHWMTP7+gi/bZ8= X-MC-Unique: RUaZUZmUO8a71ZFaArt9cg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qAeYox9UkBZPHYKkLVvU16TBQxc6Vg+PmuhGEFonMEo=; b=K6pDAcaHt3tg9bbFbKjqilKihRuR7/HdwWjruiaIcr525tXshp/o7KOj4NVAbOaWN2 EJ3XhLfNG0heWrqxXvkfkwdjPP4mghIZ8bN73UKGmtRcuaqmexoSW7EXlXRhjkgchVca s5igXImr/itSrLqofcwScre7o2ice00yQFUKYoaR5c/yRkZmR6x/112e1FdaIewvLMsJ V0tLvkdRYhRZ5VL3XeCwRla52MZXJlYdSfvIQFYalHsWx42OpIacEWK174pT7GsTVTP6 HdaTTcEd+ORREvpX5RV/5Im78iTajLpG/uLoOyFIXLVeOgvk93ol4jiOnY+P7gmS4yTR 36fQ== X-Gm-Message-State: AOAM5304pJwD99kiLCTRiqUwjPO7BWK3kzeV77TbiRHDG9Kg5GkoMb9I troOhH3kFgxPit8E+e2DPilwrBG1RGw0QZL3U1A3ghx1gbLvH9E30bnLDkz7CBPQjOqHijsbIw8 JqOro66nohhujXMd1t08xrncHuQ4K3Om1j84xWdvkRVPS84f+tlcRmR1VoS36zPTk X-Received: by 2002:a1c:c90f:: with SMTP id f15mr13488947wmb.142.1623307571695; Wed, 09 Jun 2021 23:46:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw6Hq00i0ztkKyzUvWxnzo1iEeA/63BuNypt08r8vuuELaHl+8hw5IieEoeFEuIHHuDDp5dsA== X-Received: by 2002:a1c:c90f:: with SMTP id f15mr13488926wmb.142.1623307571548; Wed, 09 Jun 2021 23:46:11 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH 03/11] target/i386/monitor: Return QMP error when SEV is disabled in build Date: Thu, 10 Jun 2021 08:45:48 +0200 Message-Id: <20210610064556.1421620-4-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210610064556.1421620-1-philmd@redhat.com> References: <20210610064556.1421620-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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.199, 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_H4=0.001, RCVD_IN_MSPIKE_WL=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 , Connor Kuehl , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Dr . David Alan Gilbert" , Markus Armbruster , Eric Blake Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) If the management layer tries to inject a secret, it gets an empty response in case the binary built without SEV: { "execute": "sev-inject-launch-secret", "arguments": { "packet-header": "mypkt", "secret": "mypass", "gpa": 429= 4959104 } } { "return": { } } Make it clearer by returning an error, mentioning the feature is disabled: { "execute": "sev-inject-launch-secret", "arguments": { "packet-header": "mypkt", "secret": "mypass", "gpa": 429= 4959104 } } { "error": { "class": "GenericError", "desc": "this feature or command is not currently supported" } } Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Connor Kuehl Reviewed-by: Dr. David Alan Gilbert --- target/i386/monitor.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/target/i386/monitor.c b/target/i386/monitor.c index 119211f0b06..c83cca80dc2 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" @@ -742,6 +743,10 @@ void qmp_sev_inject_launch_secret(const char *packet_h= dr, bool has_gpa, uint64_t gpa, Error **errp) { + if (!sev_enabled()) { + error_setg(errp, QERR_UNSUPPORTED); + return; + } if (!has_gpa) { uint8_t *data; struct sev_secret_area *area; --=20 2.31.1 From nobody Thu Mar 28 16:44:16 2024 Delivered-To: importer2@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+importer2=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1623307916; cv=none; d=zohomail.com; s=zohoarc; b=Lk72Z5od4RB4odL49+JxxbUvN/QvBlr5idwizzMh6jQIvjtlMwMTY6b3ZJT/FiGGG9+NBmNZrcVi28awEFnU75O5oY+LAHJ+N/rbroQ+cusGT2SQ83yU+Txf5trh6d0sR4WGu5ZmxffBelyYKHHqKVkrl7pTl6YEleyb5Qsui8I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1623307916; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=abMGkqHNLRSz2XVMNM96qbiYgCQOOhe/IPGd2ZkcJAU=; b=diJJA+DcDeNiXPOLBeGllRTQteKK2pez1zj96436Mbe4B6ZAMJ/S2W4GfTcgERP6k+OB4cEO96nZ1suc7PheABD53Ye/4Yaov+96x8uWoLsdDET34keiU3v59e/7s+11kTurHe5gFwEtkpT6LJjARvEO0uaP1TyLsWnhcU1/tz8= ARC-Authentication-Results: i=1; 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+importer2=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1623307916791653.363340445809; Wed, 9 Jun 2021 23:51:56 -0700 (PDT) Received: from localhost ([::1]:40374 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lrEXj-0007cu-N3 for importer2@patchew.org; Thu, 10 Jun 2021 02:51:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55652) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lrESM-0007d2-PJ for qemu-devel@nongnu.org; Thu, 10 Jun 2021 02:46:23 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:43984) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lrESK-0005GB-50 for qemu-devel@nongnu.org; Thu, 10 Jun 2021 02:46:22 -0400 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-140-rv4dqHPdM_O-btu4E64kuw-1; Thu, 10 Jun 2021 02:46:18 -0400 Received: by mail-wr1-f70.google.com with SMTP id s8-20020adff8080000b0290114e1eeb8c6so404265wrp.23 for ; Wed, 09 Jun 2021 23:46:18 -0700 (PDT) Received: from x1w.redhat.com (235.red-83-57-168.dynamicip.rima-tde.net. [83.57.168.235]) by smtp.gmail.com with ESMTPSA id s62sm8948465wms.13.2021.06.09.23.46.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Jun 2021 23:46:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1623307579; 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=abMGkqHNLRSz2XVMNM96qbiYgCQOOhe/IPGd2ZkcJAU=; b=Tayq8trtdn8S4tn4MhLXWkW6yBZUknzG+1qwW/+VZKec5xejMZZPJZ8NdaOjDNStnR1yRJ A6knC7RqrqDZjNtOSDfsi5sY26Mne+m0hs4SDUiL+cKtWTUSSwK8tGRx1TiIIDRNred+gv 0JXGC1jyg8dZymzegMditBnF9pcS1J4= X-MC-Unique: rv4dqHPdM_O-btu4E64kuw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=abMGkqHNLRSz2XVMNM96qbiYgCQOOhe/IPGd2ZkcJAU=; b=TSLSJ8U1kJMfd3plKJ1HJv9EciyN1uQ07kjuqpfjdMzSqtXXFAiifPfzWOZgoeBdyu Ly9ZfUYp6rYVZpktUYBsvwtF/ZdEXP2/YUYyPwAgY4niPk6Q87BojxXaFFTD9csT01zD MlVRRgN+04/vn2FhUkUX1Q53J6+8zL65NRRtS7djfbTjwR7zpJSxcrPs8wzkDMXB7PKE 0YH9fhogcYRh1PSaVJR0EMY9ZIoRRmZ8cXyoyBPCvJRFxXhNLF8lhtZDlvE2ZjtzNPMj 9SQU9j4MiARC8AaoUoLHI6CEvbnk+GkQXdZBgRIxvXMoC2c5fZC4XAqZGq0E2gO02/En coqQ== X-Gm-Message-State: AOAM531tgxdCKoHzOLF3hDlAjEDrWijKBH/TUV0FisqWw4BWnFgjRk/l eqF+7MK7Hp3Wa0t2X3kEJGuJMV572b3x5LKlhd/jkN6yAEoI21x0i5aozvsvD4ZzYy0CXJAiWb5 abhkqm5DzrGyiItSqUMmhNdwpDZow58dQdmV/0l0lyDXMxRe7R33hLect3GAL5mcG X-Received: by 2002:a5d:58d3:: with SMTP id o19mr3638238wrf.404.1623307576068; Wed, 09 Jun 2021 23:46:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwcqxK7Oz2MwnKpnAK9Ck+rvLsYuPvTTzt8ICafCOw5dzmwviihiUQ7TWP+uv/n/WN660+Kdg== X-Received: by 2002:a5d:58d3:: with SMTP id o19mr3638224wrf.404.1623307575938; Wed, 09 Jun 2021 23:46:15 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH 04/11] target/i386/cpu: Add missing 'qapi/error.h' header Date: Thu, 10 Jun 2021 08:45:49 +0200 Message-Id: <20210610064556.1421620-5-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210610064556.1421620-1-philmd@redhat.com> References: <20210610064556.1421620-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+importer2=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: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.199, 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_H4=0.001, RCVD_IN_MSPIKE_WL=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 , Connor Kuehl , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Dr . David Alan Gilbert" , Markus Armbruster , Eric Blake Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Commit 00b81053244 ("target-i386: Remove assert_no_error usage") forgot to add the "qapi/error.h", add it now. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Connor Kuehl Reviewed-by: Dr. David Alan Gilbert --- target/i386/cpu.c | 1 + 1 file changed, 1 insertion(+) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index a9fe1662d39..694031e4aec 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 Thu Mar 28 16:44:16 2024 Delivered-To: importer2@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+importer2=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1623307892; cv=none; d=zohomail.com; s=zohoarc; b=WSXTDHRh19TczH1g8nrm/uxEGmwXrQYGeeHMbL59KIdrVgpm4S7SXFjk7WfjTLt26r6VcN1dl23X7T5sJV3Z3tRLmlM9+h5OCrC8wG3cBVA5zZv5msVHOy+5FpTxFpIkcwXopqBrdaKx/11HkPJuCYIkXCcptdRx2WQp4qLsOz0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1623307892; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=nY3qEuS9AxbSdkAg7h/9CaXvosetNidvdNCAZ2K6Tak=; b=Fo3eu3xwEBDlqRVUnVX5LTSd4Z0NAJj19ccdYwfy0DPnxXQHjO6iaTlM8HIwr4xD44UWL2DnjSmOh2rZowQEK48xGN2w8b8ET0LVhYDuhk37HFdR/Dl5e1MNsxc3/ZnAcBuQT2eCzcbTcpOaEGRUIuVSn5xv0hskw13zO45ENCY= ARC-Authentication-Results: i=1; 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+importer2=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1623307892720147.9597327769236; Wed, 9 Jun 2021 23:51:32 -0700 (PDT) Received: from localhost ([::1]:39716 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lrEXL-0007Ad-M5 for importer2@patchew.org; Thu, 10 Jun 2021 02:51:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55672) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lrESP-0007fr-SP for qemu-devel@nongnu.org; Thu, 10 Jun 2021 02:46:27 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:49954) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lrESN-0005Iv-Cg for qemu-devel@nongnu.org; Thu, 10 Jun 2021 02:46:25 -0400 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-8-S74Z4pHhPZ25Xgl_lJr5oA-1; Thu, 10 Jun 2021 02:46:21 -0400 Received: by mail-wr1-f69.google.com with SMTP id m27-20020a056000025bb0290114d19822edso409590wrz.21 for ; Wed, 09 Jun 2021 23:46:21 -0700 (PDT) Received: from x1w.redhat.com (235.red-83-57-168.dynamicip.rima-tde.net. [83.57.168.235]) by smtp.gmail.com with ESMTPSA id u16sm2413575wru.56.2021.06.09.23.46.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Jun 2021 23:46:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1623307582; 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=nY3qEuS9AxbSdkAg7h/9CaXvosetNidvdNCAZ2K6Tak=; b=BAhDs69XHDWlbBKcPRG8IZgvtgUHGEis6PjTHoWm2vghQ5V9QvV+ja3rPr5VZpk4vmMViK 6keHGQ8OugDGlvOw6RBtm6+ZoEDZ0JGCcmPqOyaLjkd4/0YlTOQhh87K2e5QqHHaYgmcF1 WtS5e2bwViDDNA9z+2Uh5kIrDxXqTno= X-MC-Unique: S74Z4pHhPZ25Xgl_lJr5oA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=nY3qEuS9AxbSdkAg7h/9CaXvosetNidvdNCAZ2K6Tak=; b=BNaZypW5+Um2WU35ZJ+262NYrqiZFEgquwm1HFCrbLWLY36QGKcFzJH+wHlUAQhRKi UpOYyoaKHf1NY4fkpQotQ1JaBHwP2Qt808cJicGbZ/Tx/9jXnKd3f0M+kj455PYLxBzS qpClgU5arzbqeD8b8Bp+rwLU7RJzhkiYBIcNj4/lVb9bJTdcGJi6lXrLEZRabiHRosr0 8ubqb110MIBb6koHmVFB0NkTXjjUaym6hQZOQxWloSf3kLStDy9SZ4/Ys2KqCfx8bGlU JjcZCXc+d0/KOYlcJTWe2IVzsNEkkijeu8RLJOj+MnyoiDHiwdJSt2wzHoqFF7z2exy+ dT2w== X-Gm-Message-State: AOAM531+hRKiG4aYhgnIkXV6/nP0Xyy+DpOwyVFWRhE75ZPgFnHbig4H l0+q1YnaoV/drEhBIJmYE4u6i+/UCBx/l8fiFla/gqoIo8m8mf6NHbFtcmHgGqb4BOgmJ3KgJTx 1Mf2e6wRJuiY7jDGJ9HLKeV+u/Epuxa64UWurR/hY+z5ZincyD0+VbOkKqvArJYUJ X-Received: by 2002:a5d:68ca:: with SMTP id p10mr3508512wrw.65.1623307580350; Wed, 09 Jun 2021 23:46:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwrv9krf1natY0ufeAb5MkcR/iVnZ1zGJbOfoN3joO/iW/L3yCablR2KaZkqOiAWFO9zxPG4A== X-Received: by 2002:a5d:68ca:: with SMTP id p10mr3508489wrw.65.1623307580167; Wed, 09 Jun 2021 23:46:20 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH 05/11] target/i386/sev_i386.h: Remove unused headers Date: Thu, 10 Jun 2021 08:45:50 +0200 Message-Id: <20210610064556.1421620-6-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210610064556.1421620-1-philmd@redhat.com> References: <20210610064556.1421620-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+importer2=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: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.199, 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_H4=0.001, RCVD_IN_MSPIKE_WL=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 , Connor Kuehl , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Dr . David Alan Gilbert" , Markus Armbruster , Eric Blake Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Declarations don't require these headers, remove them. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Connor Kuehl --- target/i386/sev_i386.h | 4 ---- target/i386/sev-stub.c | 1 + 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/target/i386/sev_i386.h b/target/i386/sev_i386.h index ae6d8404787..f4223f1febf 100644 --- a/target/i386/sev_i386.h +++ b/target/i386/sev_i386.h @@ -14,11 +14,7 @@ #ifndef QEMU_SEV_I386_H #define QEMU_SEV_I386_H =20 -#include "qom/object.h" -#include "qapi/error.h" -#include "sysemu/kvm.h" #include "sysemu/sev.h" -#include "qemu/error-report.h" #include "qapi/qapi-types-misc-target.h" =20 #define SEV_POLICY_NODBG 0x1 diff --git a/target/i386/sev-stub.c b/target/i386/sev-stub.c index 0227cb51778..d91c2ece784 100644 --- a/target/i386/sev-stub.c +++ b/target/i386/sev-stub.c @@ -12,6 +12,7 @@ */ =20 #include "qemu/osdep.h" +#include "qapi/error.h" #include "sev_i386.h" =20 SevInfo *sev_get_info(void) --=20 2.31.1 From nobody Thu Mar 28 16:44:16 2024 Delivered-To: importer2@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+importer2=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1623308073; cv=none; d=zohomail.com; s=zohoarc; b=NglBFjR4y1/Xf4Gn8K3SQ/Pz2Ru4jCcFjfPIoSxDnyweJD0bEjy+tAHMS1cyn2wnutCEBxLE2ewg6XYKbZGg09WfYVmSvOow0Dmfiea2MoptGf9Yx1Rg8ASs1V9Y+AMI6OKmIw4n961RrS1MVJR8gkPgKjSxHGXtjdw6iPQYZT8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1623308073; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=iGa9GgRsKFPGgrQdxnus+fnHfkZl38eP+21GVfWY47E=; b=gvrQ9Kq8a4e7CUxUyX1byYBQz5AoS6LEmoc8E8/7Es4lF8k8TRfkVirMuxw4MnfY6WgSLxnjmbAty03qbVfU6jCZXWADmha4pjDvq4tnMxV6R/vknNjyTzpQqoWbKQvvrMqP66+8XEqkCTfepRfPM8oTXcjSU8HN9Al1s0hsSnI= ARC-Authentication-Results: i=1; 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+importer2=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1623308073341493.1873046334214; Wed, 9 Jun 2021 23:54:33 -0700 (PDT) Received: from localhost ([::1]:48974 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lrEaG-0004uO-AV for importer2@patchew.org; Thu, 10 Jun 2021 02:54:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55684) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lrEST-0007hh-Qq for qemu-devel@nongnu.org; Thu, 10 Jun 2021 02:46:30 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:26472) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lrESS-0005Mt-89 for qemu-devel@nongnu.org; Thu, 10 Jun 2021 02:46:29 -0400 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-494-nsvoEDeANWaoLYgqhMg3pA-1; Thu, 10 Jun 2021 02:46:26 -0400 Received: by mail-wr1-f69.google.com with SMTP id h10-20020a5d688a0000b0290119c2ce2499so403242wru.19 for ; Wed, 09 Jun 2021 23:46:26 -0700 (PDT) Received: from x1w.redhat.com (235.red-83-57-168.dynamicip.rima-tde.net. [83.57.168.235]) by smtp.gmail.com with ESMTPSA id o18sm8036094wmq.23.2021.06.09.23.46.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Jun 2021 23:46:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1623307587; 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=iGa9GgRsKFPGgrQdxnus+fnHfkZl38eP+21GVfWY47E=; b=B5WCKoLf1/2etqlE9Ez5CA7GEiVkKKTZTvbRSKza14Mg+yYlESjxgcGbNSp5DgkuA6Tc5N Xcr2EADfHJghkHU29yLtBbV2OjAlYFQ91ztDj2uvECADODnp6gl9fLZuQbw/LQw0nLdkDT Gx9NoGU4DkxW3tCtGrmgLQ618XeOYec= X-MC-Unique: nsvoEDeANWaoLYgqhMg3pA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=iGa9GgRsKFPGgrQdxnus+fnHfkZl38eP+21GVfWY47E=; b=f10Ng8I1WUWGRQ4uaJPKOy6FY/kWRT5T2ERknWolOsb79E4NKKArnrAFc9GNWOjhNe gSAWliBEDq31H+25J8PYc1n1DcdXhwzeipe/JECpYix/TQkEZYJlpf2GM2HdIhwKagTe KIlcikYGbe7m/Havh6b2cpp3UV7lsuzwMnl/BB1PNfh72mA2EHUKVRDIAD1z1gpoMZux WFP0Mengz4s2jY9wtoZkJVIovNVj/K08pKyA5bq28QhadUJaHORMQ5uCATp2qoUhxLNc pMyQCqSkrxkNk5NnLp+9ba+XClN1orSdYm7rUKdd1V4b9dWxOYpFTZZMgNfD3+IbnOrP zYDQ== X-Gm-Message-State: AOAM531zhqjEBe9M0Gh/HajC6YKLUWawI+goRQ7JSbRNSileOEqSogYm 32rytAqW64kz/uzyXu1JSHDtH47+/owUtLRN4QugilZxJTC+zQnEoMSEHNaTpJUSB1TYgBlnG8v AZ3+CI9AzuDPl6uY5Fyc1zM7cZUDt/GRwFh/nnMr6GBWL3ABFYTDB6WGeokdBUjHn X-Received: by 2002:a05:600c:3789:: with SMTP id o9mr13642800wmr.78.1623307584703; Wed, 09 Jun 2021 23:46:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxj9bOSjIIpn4Htpr0eoyArki2BLxHFaXvkWyCmUG4eX2ivVlAKyW+ufFNGjDx6sGaAtVtHsw== X-Received: by 2002:a05:600c:3789:: with SMTP id o9mr13642779wmr.78.1623307584527; Wed, 09 Jun 2021 23:46:24 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH 06/11] target/i386/sev: Remove sev_get_me_mask() Date: Thu, 10 Jun 2021 08:45:51 +0200 Message-Id: <20210610064556.1421620-7-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210610064556.1421620-1-philmd@redhat.com> References: <20210610064556.1421620-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+importer2=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: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.199, 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_H4=0.001, RCVD_IN_MSPIKE_WL=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 , Connor Kuehl , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Dr . David Alan Gilbert" , Markus Armbruster , Eric Blake Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Unused dead code makes review harder, so remove it. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Connor Kuehl Reviewed-by: Dr. David Alan Gilbert --- target/i386/sev_i386.h | 1 - target/i386/sev-stub.c | 5 ----- target/i386/sev.c | 9 --------- 3 files changed, 15 deletions(-) diff --git a/target/i386/sev_i386.h b/target/i386/sev_i386.h index f4223f1febf..afa19a0a161 100644 --- a/target/i386/sev_i386.h +++ b/target/i386/sev_i386.h @@ -25,7 +25,6 @@ #define SEV_POLICY_SEV 0x20 =20 extern bool sev_es_enabled(void); -extern uint64_t sev_get_me_mask(void); extern SevInfo *sev_get_info(void); extern uint32_t sev_get_cbit_position(void); extern uint32_t sev_get_reduced_phys_bits(void); diff --git a/target/i386/sev-stub.c b/target/i386/sev-stub.c index d91c2ece784..eb0c89bf2be 100644 --- a/target/i386/sev-stub.c +++ b/target/i386/sev-stub.c @@ -25,11 +25,6 @@ bool sev_enabled(void) return false; } =20 -uint64_t sev_get_me_mask(void) -{ - return ~0; -} - uint32_t sev_get_cbit_position(void) { return 0; diff --git a/target/i386/sev.c b/target/i386/sev.c index 83df8c09f6a..0a36e81f66c 100644 --- a/target/i386/sev.c +++ b/target/i386/sev.c @@ -64,7 +64,6 @@ struct SevGuestState { uint8_t api_major; uint8_t api_minor; uint8_t build_id; - uint64_t me_mask; int sev_fd; SevState state; gchar *measurement; @@ -362,12 +361,6 @@ sev_es_enabled(void) return sev_enabled() && (sev_guest->policy & SEV_POLICY_ES); } =20 -uint64_t -sev_get_me_mask(void) -{ - return sev_guest ? sev_guest->me_mask : ~0; -} - uint32_t sev_get_cbit_position(void) { @@ -810,8 +803,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 Thu Mar 28 16:44:16 2024 Delivered-To: importer2@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+importer2=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1623307918; cv=none; d=zohomail.com; s=zohoarc; b=DmXBxiL50vqbUdGVqgBEu52sUXJWbecbg6thkZg3kll7eKA3W9ez19gpWPNp9LQzE8dhrmV5LoJWo2ki4BpZU1ZV71Oj6K92cvlSiHFL72BCEXh3wjIDZhvJTOiUm271Nz7cjqMzboE0/xQmvlhIDyGhM0unZ+XbGNIvxeWbUBY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1623307918; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=6XX5j3UbRtfmHxe3V1ph1hTBGyFJAYSVF+9Z2vcsOdo=; b=Tjx4ZmZ61GSmpKdxMDWEPL9WexntX+UmzA5DpDcPj9dQxp4tzIisIwomMbwGDdmYl5LDNyorr377yojBTZSvXZOLBUvDBm6NIEvZlfO3FLi9cUw/ZCcM9w4PYA8Wc924qu7oQ4cCXRT7I2vi19kToFQRz3T/TMyCjqkRuV7SbeE= ARC-Authentication-Results: i=1; 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+importer2=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1623307918313498.05288779087994; Wed, 9 Jun 2021 23:51:58 -0700 (PDT) Received: from localhost ([::1]:40412 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lrEXk-0007em-5P for importer2@patchew.org; Thu, 10 Jun 2021 02:51:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55696) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lrESZ-0007wY-8e for qemu-devel@nongnu.org; Thu, 10 Jun 2021 02:46:35 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:40529) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lrESW-0005QA-Ko for qemu-devel@nongnu.org; Thu, 10 Jun 2021 02:46:35 -0400 Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-173-icv1Fz37NRadHe2wG9rcTQ-1; Thu, 10 Jun 2021 02:46:30 -0400 Received: by mail-wm1-f70.google.com with SMTP id w3-20020a1cf6030000b0290195fd5fd0f2so2678206wmc.4 for ; Wed, 09 Jun 2021 23:46:30 -0700 (PDT) Received: from x1w.redhat.com (235.red-83-57-168.dynamicip.rima-tde.net. [83.57.168.235]) by smtp.gmail.com with ESMTPSA id c7sm2565263wrc.42.2021.06.09.23.46.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Jun 2021 23:46:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1623307591; 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=6XX5j3UbRtfmHxe3V1ph1hTBGyFJAYSVF+9Z2vcsOdo=; b=I9TZd+e+a4bSwGF0ZcuCiaMF+9xkcouezRePDdDhdiYHES4rGp+B92fxYi7tzICQ8w7fle EkEejveND3XASqIPW2GrTFNXk0cJNbXUF/CtzmMItrS72evP9jA8msKJA8L2iqpAU6shdI Vgq8cd1ATC4suOZoxIHPh/DNXujD094= X-MC-Unique: icv1Fz37NRadHe2wG9rcTQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=6XX5j3UbRtfmHxe3V1ph1hTBGyFJAYSVF+9Z2vcsOdo=; b=gQn02sXqI1fBN0NRGZEwtRWTQma/u6B7LlUm0dJUypwBv9NZ3Xffze1JvDECcUx+96 KYlyEZmflyddEOLdArMTq7wV3xCkagFFzDNXc84hP69z9D4UR4mn2W8EzuxOuoQ7QrFj H/8H1EpYrpRB2xCGbOgOECLDlUBKqo176ZveqUqHJCH6eaMMTUNERQY02QGiE73nmaAZ sMr+FAh/K7qxz8TRWj6Q8MmPiKPdXqQSSBwJPfqOZqQo3/He3/uKFrg+EcLqhWuMBGH2 +J2o7IywTFYX4aITSpiurNTqPsNrgoXbsU/MJdsmoYBnJRLDYAEbJToMwhtrlCF/Ixqf 1HAQ== X-Gm-Message-State: AOAM530QU1+JU1KEw/OQpSzd0uCg+OrirUuWJtP2XaIXNymJSVVOPu+I AgwR5UQzNpFJpgllpCsNp931hyWWzuKKrG6+bYypO1U6xyIMROsawZrxWqNK+IvvdJ6hNiaZu0i 9eXtEv7IqoNRDlahvZvug6oZAfbrlTk3Vu+UnmlUBsp+qElGzEcQ6ztC/z+gGDnUZ X-Received: by 2002:a5d:59af:: with SMTP id p15mr3613317wrr.292.1623307588960; Wed, 09 Jun 2021 23:46:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwRbDkQkHoVvh05WdUyTY3UiGUarqHqJGvkE3/nADrw0FfjHi0DsxfVZd0wbOGhUwO0kH48pg== X-Received: by 2002:a5d:59af:: with SMTP id p15mr3613289wrr.292.1623307588768; Wed, 09 Jun 2021 23:46:28 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH 07/11] target/i386/sev: Mark unreachable code with g_assert_not_reached() Date: Thu, 10 Jun 2021 08:45:52 +0200 Message-Id: <20210610064556.1421620-8-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210610064556.1421620-1-philmd@redhat.com> References: <20210610064556.1421620-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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.199, 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_H4=0.001, RCVD_IN_MSPIKE_WL=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 , Connor Kuehl , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Dr . David Alan Gilbert" , Markus Armbruster , Eric Blake Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) 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. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Connor Kuehl --- target/i386/sev-stub.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/i386/sev-stub.c b/target/i386/sev-stub.c index eb0c89bf2be..4668365fd3e 100644 --- a/target/i386/sev-stub.c +++ b/target/i386/sev-stub.c @@ -54,7 +54,7 @@ int sev_inject_launch_secret(const char *hdr, const char = *secret, =20 int sev_encrypt_flash(uint8_t *ptr, uint64_t len, Error **errp) { - return 0; + g_assert_not_reached(); } =20 bool sev_es_enabled(void) @@ -68,7 +68,7 @@ void sev_es_set_reset_vector(CPUState *cpu) =20 int sev_es_save_reset_vector(void *flash_ptr, uint64_t flash_size) { - abort(); + g_assert_not_reached(); } =20 SevAttestationReport * --=20 2.31.1 From nobody Thu Mar 28 16:44:16 2024 Delivered-To: importer2@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+importer2=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1623308074; cv=none; d=zohomail.com; s=zohoarc; b=UpUuU3KHWdY1J/w/pnA4o5fWMDMZolz266Isg4+L8416tIx4QNdlENerl+6dFWlfojb8593/e8M+qXFTaINbNT9Gwc5p6J2L6/+KO0yHoJnsxXOLSXX5B9OTibkltKw7r5D9bQud0ABQlVmD43cSuAznA7rYEvFiAokDjwIaGLg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1623308074; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=eDwwyP6lYjqDrcaWITpcvIceEJU79Gyjn65Ig5GC5tE=; b=d8QWOi7fwPa60sKPIRPB6knvlpWCXQ779TvGfGlERHKpXIb3M0JAGV17lX49tHSWiKZV6KzP7kReV3BQsdUipi4BPSu63fuRMLhcnRMnIMwCA37wK/760BufjrHzGK21bAr9yyrjCI6pwR7O+41+C8KAdN7agVkMQuBpFMxY/aw= ARC-Authentication-Results: i=1; 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+importer2=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1623308074262274.7905118143152; Wed, 9 Jun 2021 23:54:34 -0700 (PDT) Received: from localhost ([::1]:49044 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lrEaH-0004wq-4F for importer2@patchew.org; Thu, 10 Jun 2021 02:54:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55732) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lrESh-00087c-Dw for qemu-devel@nongnu.org; Thu, 10 Jun 2021 02:46:43 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:36388) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lrESa-0005Rc-0a for qemu-devel@nongnu.org; Thu, 10 Jun 2021 02:46:41 -0400 Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-299-EnCPmFirMiW9azVCPinquw-1; Thu, 10 Jun 2021 02:46:34 -0400 Received: by mail-wm1-f72.google.com with SMTP id j6-20020a05600c1906b029019e9c982271so3492259wmq.0 for ; Wed, 09 Jun 2021 23:46:34 -0700 (PDT) Received: from x1w.redhat.com (235.red-83-57-168.dynamicip.rima-tde.net. [83.57.168.235]) by smtp.gmail.com with ESMTPSA id n1sm1912293wms.18.2021.06.09.23.46.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Jun 2021 23:46:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1623307595; 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=eDwwyP6lYjqDrcaWITpcvIceEJU79Gyjn65Ig5GC5tE=; b=c28KtHkk6Iy348dyBPUm0WyBL5miM3twH93E9mkl6Nrlko3g2W+OcgKIjk7+r+6ltVObt7 GRvUtfCJGpKe8T7s7zStOn8tplpfgtnRUlu7JYOwNZqqseXQ49c/xHdtrlrDN2h5nMO/zL sx8XpQzIG8vOTanoYYWGW665Jxzm4ko= X-MC-Unique: EnCPmFirMiW9azVCPinquw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=eDwwyP6lYjqDrcaWITpcvIceEJU79Gyjn65Ig5GC5tE=; b=MpN3lrJ9LWLLdTe+EPQqZCg7T1FrGUFh/15YVr3CihCt8ShsHiVC1L3D3I/TzG8GA8 jH8OtFHs/YYKUesFu2itoEaW3Xb1ebst2sgdvP3uqg6az8k6wej4AYJyX6LlWfEaZoYC KLTTnhU5MGCPeZ/KOKIgtroUNMX1xlqMNjo6xtEdUxLN247JyChoxhJtxvinrGjlkgWy 5Fqv+QhCD33b20KgUFRqBQBbjaDYe7hh6ImkFPcbJGZb+f5uvYTsLuUxINp1llSbrIb2 JFdpEoULSVyd0IsuPI23KXY7dynJ6HIV3elombM4tvO0xt93FN8h2++J1LJ5lAawyb5k Qxyg== X-Gm-Message-State: AOAM533rDLis7EHEscVqDXv01qjw3lz1SJ2K37qKFqH2v2o64GomGrIh Nv0ywNvSuGsO13+MlLDF3SWd4p1CEAr/Jp8lbobSPeDqAb3yCsgL68peNEgN4kCoUeznrOF2xk5 SGQJGuIn+abtjAuy/mIYaIfG7YBQud7H4PICum653RiTnN3YeMo6TnV4cNfRKkMir X-Received: by 2002:a1c:7c13:: with SMTP id x19mr13475426wmc.96.1623307593225; Wed, 09 Jun 2021 23:46:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyq430EH3zL9NUHu9SOQcza1M/2b3f3T8rGuv0jhve740X/XdxN6xQ6G+p0Qc6mMw6eT/oihw== X-Received: by 2002:a1c:7c13:: with SMTP id x19mr13475404wmc.96.1623307593078; Wed, 09 Jun 2021 23:46:33 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH 08/11] target/i386/sev: sev_get_attestation_report use g_autofree Date: Thu, 10 Jun 2021 08:45:53 +0200 Message-Id: <20210610064556.1421620-9-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210610064556.1421620-1-philmd@redhat.com> References: <20210610064556.1421620-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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.199, 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_H4=0.001, RCVD_IN_MSPIKE_WL=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 , Connor Kuehl , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Dr . David Alan Gilbert" , Markus Armbruster , Eric Blake Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: "Dr. David Alan Gilbert" Removes a whole bunch of g_free's and a goto. Signed-off-by: Dr. David Alan Gilbert Reviewed-by: Connor Kuehl Reviewed-by: Brijesh Singh Message-Id: <20210603113017.34922-1-dgilbert@redhat.com> Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- 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 0a36e81f66c..791804954e9 100644 --- a/target/i386/sev.c +++ b/target/i386/sev.c @@ -493,8 +493,8 @@ sev_get_attestation_report(const char *mnonce, Error **= errp) struct kvm_sev_attestation_report input =3D {}; SevAttestationReport *report =3D NULL; SevGuestState *sev =3D sev_guest; - guchar *data; - guchar *buf; + g_autofree guchar *data =3D NULL; + g_autofree guchar *buf =3D NULL; gsize len; int err =3D 0, ret; =20 @@ -514,7 +514,6 @@ sev_get_attestation_report(const char *mnonce, Error **= errp) if (len !=3D sizeof(input.mnonce)) { error_setg(errp, "SEV: mnonce must be %zu bytes (got %" G_GSIZE_FO= RMAT ")", sizeof(input.mnonce), len); - g_free(buf); return NULL; } =20 @@ -525,7 +524,6 @@ sev_get_attestation_report(const char *mnonce, Error **= errp) if (err !=3D SEV_RET_INVALID_LEN) { error_setg(errp, "failed to query the attestation report lengt= h " "ret=3D%d fw_err=3D%d (%s)", ret, err, fw_error_to_str= (err)); - g_free(buf); return NULL; } } @@ -540,7 +538,7 @@ sev_get_attestation_report(const char *mnonce, Error **= errp) if (ret) { error_setg_errno(errp, errno, "Failed to get attestation report" " ret=3D%d fw_err=3D%d (%s)", ret, err, fw_error_to_str(er= r)); - goto e_free_data; + return NULL; } =20 report =3D g_new0(SevAttestationReport, 1); @@ -548,9 +546,6 @@ sev_get_attestation_report(const char *mnonce, Error **= errp) =20 trace_kvm_sev_attestation_report(mnonce, report->data); =20 -e_free_data: - g_free(data); - g_free(buf); return report; } =20 --=20 2.31.1 From nobody Thu Mar 28 16:44:16 2024 Delivered-To: importer2@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+importer2=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1623307956; cv=none; d=zohomail.com; s=zohoarc; b=ItaVnWi0wSH0fRjpPrWxVtWAyXHcJMN/SKAT3jn61PoyLNqqS/8XYYQb2XR3Q5CqgWLC6xFYQ82qP5wNndWqVTcR1B6/XCPFiUZ+NUZn4a80EE9sxG9o1wL22joeW2nCfzL8A55/M3v4BekKbUWCC+o2VllVZOiyqycrN56tCv0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1623307956; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=AZLS+m7xAvvk2uRB++FAfryJbzXnCIDe39YBz1qMJyo=; b=DcJBHEcqnqSenw5EmaM06HEUXgQz9aB0MYOQ0AIH77FjgZvcjTo9W95Z/1m0GsACNbJSvmxwBaj/KHr5EShnPyjLOBmyPl/QPU1fn973TWxCEbmSvn0hEkaAZCZDOJ2Z8H5SOcqBgl40AMod7ZEMXQ/s5xo6GjFnhzxyLz2U3JY= ARC-Authentication-Results: i=1; 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+importer2=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1623307956973341.7910226984577; Wed, 9 Jun 2021 23:52:36 -0700 (PDT) Received: from localhost ([::1]:42342 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lrEYN-0000WR-SS for importer2@patchew.org; Thu, 10 Jun 2021 02:52:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55760) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lrESm-0008H0-D7 for qemu-devel@nongnu.org; Thu, 10 Jun 2021 02:46:48 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:36035) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lrESj-0005XI-1y for qemu-devel@nongnu.org; Thu, 10 Jun 2021 02:46:47 -0400 Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-453-bDrHtwWsMli3P7SyxUK32A-1; Thu, 10 Jun 2021 02:46:39 -0400 Received: by mail-wm1-f71.google.com with SMTP id f22-20020a1c6a160000b029018f49a7efb7so3478960wmc.1 for ; Wed, 09 Jun 2021 23:46:39 -0700 (PDT) Received: from x1w.redhat.com (235.red-83-57-168.dynamicip.rima-tde.net. [83.57.168.235]) by smtp.gmail.com with ESMTPSA id c7sm2565760wrc.42.2021.06.09.23.46.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Jun 2021 23:46:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1623307603; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=AZLS+m7xAvvk2uRB++FAfryJbzXnCIDe39YBz1qMJyo=; b=Y3bGqemaViahPuo5jnF3WgoKTQJ3zINfudLISFSq9WgHm0hvFvt5IdR3WWefVhFiYw+PFR VrHIUkydxVAHuO4k4e5YnqKfRU/19ZZzrIBy+VfHqiZNOAU+g0UKWUMUP8prCaKFtgkKXM fhWoIeG9u5CIMRmPC3/q9wkGtAJ+zyY= X-MC-Unique: bDrHtwWsMli3P7SyxUK32A-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=AZLS+m7xAvvk2uRB++FAfryJbzXnCIDe39YBz1qMJyo=; b=gCa6Mbv2zwK+893IGDWgVFse7iRxVhKAPxIUt/WhGP23CLKyuD8DQgNZnKESPX/Oxx lVZZsZ/80zNBNbpP3guAknLqQu/dZJxZvraN+Yx8H7lBSJTE7J8qy4fSGa3QX8e/YVLH k+qCK3KeQakGPEzFPCkJtp7284XFW0LdWfO8sv9GpAz4RpPCj3TPsToEpqMFoUkI3BJj nQ95QrVMjES6ENWr0mFINtPCzyp8AvRJzOGKGHEDwZMXU8Tpemk8pzVijiMlwuIh6Iyg DjCnRIHp4hKdX58LHB6yrmhXPk1zQHS4lnMEdjh667dpehfJTShBk7sj+IRi4n3rLU5s mYVw== X-Gm-Message-State: AOAM533Zr8X0Ia0/Jw56TtyI65FkVBacoizSqrCvILy101fLFPE6Yiva /EZBwsGBCCmQsrlcErMTiK4iSjmLeYbW11YI1wbXYzS5JXHrmRcni9O25YVehuSoD/js4yfCcKg HdWV6nvUl277CFSrb0oOTRAoc4qMWDnTsjuvDJhqli+doUWPXQtM1xP/eg6wljs49 X-Received: by 2002:adf:a503:: with SMTP id i3mr3580176wrb.334.1623307597756; Wed, 09 Jun 2021 23:46:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwrIqFQOvX5o7dmyskcowDqb/EBdaqma7cMNQ0C9Rxm1XrQ3nNutiBK+ALvwB6QEnsTHuHpUQ== X-Received: by 2002:adf:a503:: with SMTP id i3mr3580152wrb.334.1623307597545; Wed, 09 Jun 2021 23:46:37 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH 09/11] target/i386/sev: Restrict SEV to system emulation Date: Thu, 10 Jun 2021 08:45:54 +0200 Message-Id: <20210610064556.1421620-10-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210610064556.1421620-1-philmd@redhat.com> References: <20210610064556.1421620-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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.199, 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_H4=0.001, RCVD_IN_MSPIKE_WL=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 , Connor Kuehl , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Dr . David Alan Gilbert" , Markus Armbruster , Eric Blake Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) SEV is irrelevant on user emulation, so restrict it to sysemu. Some stubs are still required because used in cpu.c by x86_register_cpudef_types(), so move the sysemu specific stubs to sev-sysemu-stub.c instead. This will allow us to simplify monitor.c (which is not available in user emulation) in the next commit. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- target/i386/sev-stub.c | 43 ------------------------- target/i386/sev-sysemu-stub.c | 60 +++++++++++++++++++++++++++++++++++ target/i386/meson.build | 4 ++- 3 files changed, 63 insertions(+), 44 deletions(-) create mode 100644 target/i386/sev-sysemu-stub.c diff --git a/target/i386/sev-stub.c b/target/i386/sev-stub.c index 4668365fd3e..8eae5d2fa8d 100644 --- a/target/i386/sev-stub.c +++ b/target/i386/sev-stub.c @@ -15,11 +15,6 @@ #include "qapi/error.h" #include "sev_i386.h" =20 -SevInfo *sev_get_info(void) -{ - return NULL; -} - bool sev_enabled(void) { return false; @@ -35,45 +30,7 @@ uint32_t sev_get_reduced_phys_bits(void) return 0; } =20 -char *sev_get_launch_measurement(void) -{ - return NULL; -} - -SevCapability *sev_get_capabilities(Error **errp) -{ - error_setg(errp, "SEV is not available in this QEMU"); - return NULL; -} - -int sev_inject_launch_secret(const char *hdr, const char *secret, - uint64_t gpa, Error **errp) -{ - return 1; -} - -int sev_encrypt_flash(uint8_t *ptr, uint64_t len, Error **errp) -{ - g_assert_not_reached(); -} - bool sev_es_enabled(void) { return false; } - -void sev_es_set_reset_vector(CPUState *cpu) -{ -} - -int sev_es_save_reset_vector(void *flash_ptr, uint64_t flash_size) -{ - g_assert_not_reached(); -} - -SevAttestationReport * -sev_get_attestation_report(const char *mnonce, Error **errp) -{ - error_setg(errp, "SEV is not available in this QEMU"); - return NULL; -} diff --git a/target/i386/sev-sysemu-stub.c b/target/i386/sev-sysemu-stub.c new file mode 100644 index 00000000000..d556b4f091f --- /dev/null +++ b/target/i386/sev-sysemu-stub.c @@ -0,0 +1,60 @@ +/* + * QEMU SEV system stub + * + * Copyright Advanced Micro Devices 2018 + * + * Authors: + * Brijesh Singh + * + * This work is licensed under the terms of the GNU GPL, version 2 or late= r. + * See the COPYING file in the top-level directory. + * + */ + +#include "qemu/osdep.h" +#include "qapi/qapi-commands-misc-target.h" +#include "qapi/error.h" +#include "sev_i386.h" + +SevInfo *sev_get_info(void) +{ + return NULL; +} + +char *sev_get_launch_measurement(void) +{ + return NULL; +} + +SevCapability *sev_get_capabilities(Error **errp) +{ + error_setg(errp, "SEV is not available in this QEMU"); + return NULL; +} + +int sev_inject_launch_secret(const char *hdr, const char *secret, + uint64_t gpa, Error **errp) +{ + return 1; +} + +int sev_encrypt_flash(uint8_t *ptr, uint64_t len, Error **errp) +{ + g_assert_not_reached(); +} + +void sev_es_set_reset_vector(CPUState *cpu) +{ +} + +int sev_es_save_reset_vector(void *flash_ptr, uint64_t flash_size) +{ + g_assert_not_reached(); +} + +SevAttestationReport *sev_get_attestation_report(const char *mnonce, + Error **errp) +{ + error_setg(errp, "SEV is not available in this QEMU"); + return NULL; +} diff --git a/target/i386/meson.build b/target/i386/meson.build index dac19ec00d4..a4f45c3ec1d 100644 --- a/target/i386/meson.build +++ b/target/i386/meson.build @@ -6,7 +6,7 @@ 'xsave_helper.c', 'cpu-dump.c', )) -i386_ss.add(when: 'CONFIG_SEV', if_true: files('host-cpu.c', 'sev.c'), if_= false: files('sev-stub.c')) +i386_ss.add(when: 'CONFIG_SEV', if_true: files('host-cpu.c'), if_false: fi= les('sev-stub.c')) =20 # x86 cpu type i386_ss.add(when: 'CONFIG_KVM', if_true: files('host-cpu.c')) @@ -20,6 +20,8 @@ 'monitor.c', 'cpu-sysemu.c', )) +i386_softmmu_ss.add(when: 'CONFIG_SEV', if_true: files('sev.c'), if_false:= files('sev-sysemu-stub.c')) + i386_user_ss =3D ss.source_set() =20 subdir('kvm') --=20 2.31.1 From nobody Thu Mar 28 16:44:16 2024 Delivered-To: importer2@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+importer2=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1623308112; cv=none; d=zohomail.com; s=zohoarc; b=KJiezkQPEPzwcXOgxl0jh5QMnaH5TiyF6yKQ5e2xnAGForqyAt+JUZB8p2/7ZauHm4YCjxw36uwjHNfy7klnQG/yFjtQL7P6N3LOC/2p9uxwK6KclW32Yuu9yND2Na75YULmC5WWg0Wp8gzNGdSZNtfZyMRO2pvBwcRcb1YyL7g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1623308112; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=3dVHGUrDmml8HUud+bRTuXjOS6AbsjG7OqruqOvXxLA=; b=mT9N+IiUO/eqGzNGXYsggwj3R0AieJ3a0ecEqVhH3zP5PduUzdGh7XTOzsHuIoPn6KDbPD28+yqOcsiYkN7VaI/3Zt/L+HG8qGiAHKTXaGKtfyRTDUNAkgj8aynhgZ0Q56KxEMGVyYEVsEt+LG8hdQw+wosRCghmWaAtHKgT6kU= ARC-Authentication-Results: i=1; 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+importer2=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1623308112581138.7376190411818; Wed, 9 Jun 2021 23:55:12 -0700 (PDT) Received: from localhost ([::1]:51148 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lrEat-0006Lf-Cz for importer2@patchew.org; Thu, 10 Jun 2021 02:55:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55762) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lrESn-0008I6-8b for qemu-devel@nongnu.org; Thu, 10 Jun 2021 02:46:49 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:58475) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lrESk-0005Y1-Ar for qemu-devel@nongnu.org; Thu, 10 Jun 2021 02:46:48 -0400 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-239-h2NYlRoSM--DMY9fOPd09Q-1; Thu, 10 Jun 2021 02:46:43 -0400 Received: by mail-wr1-f70.google.com with SMTP id x9-20020a5d49090000b0290118d8746e06so425450wrq.10 for ; Wed, 09 Jun 2021 23:46:43 -0700 (PDT) Received: from x1w.redhat.com (235.red-83-57-168.dynamicip.rima-tde.net. [83.57.168.235]) by smtp.gmail.com with ESMTPSA id u7sm2717164wrt.18.2021.06.09.23.46.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Jun 2021 23:46:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1623307605; 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=3dVHGUrDmml8HUud+bRTuXjOS6AbsjG7OqruqOvXxLA=; b=YuTmH01Z9JCLINqt4JGkuBSNw9o8grMeJExGYYxNTPIeAaeEbAK1EumA5aQt5IUhtMMchA eIiF97ayTRTWVduzB3A21RHoNQPd7HUsK4jOZ70ePx64EbJ1KMWvPVE9PvXQrtYf4C94xI YV3BVLVX3phhChEeoanLpB1QsFkP0PQ= X-MC-Unique: h2NYlRoSM--DMY9fOPd09Q-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=3dVHGUrDmml8HUud+bRTuXjOS6AbsjG7OqruqOvXxLA=; b=F+w9r1Hq5S6Xs3jZI1JqKZWodpIV6ToCytBRE33TQ3OMavgUNfmnyy3rIryBr+2mSG KoEbxTR38Xg/Ded0Y91/ErtNyWan2NF0PMKBXxbjVjVqHaS+cUwBNsGeHnMSnaQK08+y lob5JsbiZr3UjTsbqMiiGWc6ium1sRlLohanCCWyi/imTK5EJBqCS3D/I2UE3G5yUTHV tsOm4jXUzt+J/L5rFAne9jQT9lJYSbflu2usGsP/MQRFI0wAb3s2dtKXJTKww7rD86cC fO/j0wfdB1oANk98+vV4eB5mBOqP67BfJmOe4KuGeW6QvmNDk5eYQaZGyUD9tO9AmxjH F/tA== X-Gm-Message-State: AOAM5303/+Biv3rv4bxp581NIC062e1l3Etb2Zv72vB6DL+tOyljYOJU ZCL7xc8sol3kMe1J/7aIZIY19NsgXWXNAPetCKt1b0Skb1e98RsEJ6nb39BA89EXla2oX53aCvz 4Jh897fo5jAEHJgQwXFrRfvTCigb9rFzlWQlgxuD4qMddlXYCPz7hsnFRYAULGc03 X-Received: by 2002:a05:600c:5112:: with SMTP id o18mr3244271wms.15.1623307602263; Wed, 09 Jun 2021 23:46:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw3lYL97rKIpPn8OrukcXxgeN2hegkXzMDV7tnIlcGGlFmAze2J7KUSbNCYzgsmohTVtaA40A== X-Received: by 2002:a05:600c:5112:: with SMTP id o18mr3244249wms.15.1623307602019; Wed, 09 Jun 2021 23:46:42 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH 10/11] target/i386/monitor: Move SEV specific commands to sev.c Date: Thu, 10 Jun 2021 08:45:55 +0200 Message-Id: <20210610064556.1421620-11-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210610064556.1421620-1-philmd@redhat.com> References: <20210610064556.1421620-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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.199, 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_H4=0.001, RCVD_IN_MSPIKE_WL=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 , Connor Kuehl , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Dr . David Alan Gilbert" , Markus Armbruster , Eric Blake Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Having the HMP/QMP commands defined in monitor.c makes the stubs rather complicated when SEV is not built in. To simplify, move the SEV functions to sev.c, and remove a layer of stubs. Also make it clearer when SEV is not built in, so developers don't try to enable it when it is not enablable: - before: (qemu) info sev SEV is not enabled - after: (qemu) info sev SEV is not available in this QEMU Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- target/i386/monitor.c | 96 ---------------------------------- target/i386/sev-sysemu-stub.c | 29 +++++++---- target/i386/sev.c | 97 +++++++++++++++++++++++++++++++++++ 3 files changed, 116 insertions(+), 106 deletions(-) diff --git a/target/i386/monitor.c b/target/i386/monitor.c index c83cca80dc2..af3501095e5 100644 --- a/target/i386/monitor.c +++ b/target/i386/monitor.c @@ -28,11 +28,8 @@ #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" -#include "sev_i386.h" #include "qapi/qapi-commands-misc-target.h" #include "qapi/qapi-commands-misc.h" #include "hw/i386/pc.h" @@ -675,96 +672,3 @@ void hmp_info_io_apic(Monitor *mon, const QDict *qdict) monitor_printf(mon, "This command is obsolete and will be " "removed soon. Please use 'info pic' instead.\n"); } - -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); -} - -SevLaunchMeasureInfo *qmp_query_sev_launch_measure(Error **errp) -{ - char *data; - SevLaunchMeasureInfo *info; - - data =3D sev_get_launch_measurement(); - if (!data) { - error_setg(errp, "Measurement is not available"); - return NULL; - } - - info =3D g_malloc0(sizeof(*info)); - info->data =3D data; - - return info; -} - -SevCapability *qmp_query_sev_capabilities(Error **errp) -{ - return sev_get_capabilities(errp); -} - -#define SEV_SECRET_GUID "4c2eb361-7d9b-4cc3-8081-127c90d3d294" -struct sev_secret_area { - uint32_t base; - uint32_t size; -}; - -void qmp_sev_inject_launch_secret(const char *packet_hdr, - const char *secret, - bool has_gpa, uint64_t gpa, - Error **errp) -{ - if (!sev_enabled()) { - error_setg(errp, QERR_UNSUPPORTED); - return; - } - if (!has_gpa) { - uint8_t *data; - struct sev_secret_area *area; - - if (!pc_system_ovmf_table_find(SEV_SECRET_GUID, &data, NULL)) { - error_setg(errp, "SEV: no secret area found in OVMF," - " gpa must be specified."); - return; - } - area =3D (struct sev_secret_area *)data; - gpa =3D area->base; - } - - sev_inject_launch_secret(packet_hdr, secret, gpa, errp); -} - -SevAttestationReport * -qmp_query_sev_attestation_report(const char *mnonce, Error **errp) -{ - return sev_get_attestation_report(mnonce, errp); -} diff --git a/target/i386/sev-sysemu-stub.c b/target/i386/sev-sysemu-stub.c index d556b4f091f..7a35f0432b2 100644 --- a/target/i386/sev-sysemu-stub.c +++ b/target/i386/sev-sysemu-stub.c @@ -12,30 +12,35 @@ */ =20 #include "qemu/osdep.h" +#include "monitor/monitor.h" +#include "monitor/hmp.h" #include "qapi/qapi-commands-misc-target.h" +#include "qapi/qmp/qerror.h" #include "qapi/error.h" #include "sev_i386.h" =20 -SevInfo *sev_get_info(void) +SevInfo *qmp_query_sev(Error **errp) { + error_setg(errp, QERR_UNSUPPORTED); return NULL; } =20 -char *sev_get_launch_measurement(void) +SevLaunchMeasureInfo *qmp_query_sev_launch_measure(Error **errp) { + error_setg(errp, QERR_UNSUPPORTED); return NULL; } =20 -SevCapability *sev_get_capabilities(Error **errp) +SevCapability *qmp_query_sev_capabilities(Error **errp) { - error_setg(errp, "SEV is not available in this QEMU"); + error_setg(errp, QERR_UNSUPPORTED); return NULL; } =20 -int sev_inject_launch_secret(const char *hdr, const char *secret, - uint64_t gpa, Error **errp) +void qmp_sev_inject_launch_secret(const char *packet_header, const char *s= ecret, + bool has_gpa, uint64_t gpa, Error **errp) { - return 1; + error_setg(errp, QERR_UNSUPPORTED); } =20 int sev_encrypt_flash(uint8_t *ptr, uint64_t len, Error **errp) @@ -52,9 +57,13 @@ int sev_es_save_reset_vector(void *flash_ptr, uint64_t f= lash_size) g_assert_not_reached(); } =20 -SevAttestationReport *sev_get_attestation_report(const char *mnonce, - Error **errp) +SevAttestationReport *qmp_query_sev_attestation_report(const char *mnonce,= Error **errp) { - error_setg(errp, "SEV is not available in this QEMU"); + error_setg(errp, QERR_UNSUPPORTED); return NULL; } + +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 791804954e9..b4d7c41d3fb 100644 --- a/target/i386/sev.c +++ b/target/i386/sev.c @@ -27,10 +27,14 @@ #include "sev_i386.h" #include "sysemu/sysemu.h" #include "sysemu/runstate.h" +#include "sysemu/sev.h" #include "trace.h" #include "migration/blocker.h" #include "qom/object.h" #include "monitor/monitor.h" +#include "monitor/hmp.h" +#include "qapi/qapi-commands-misc-target.h" +#include "qapi/qmp/qerror.h" #include "exec/confidential-guest-support.h" #include "hw/i386/pc.h" =20 @@ -1070,3 +1074,96 @@ sev_register_types(void) } =20 type_init(sev_register_types); + +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); +} + +SevLaunchMeasureInfo *qmp_query_sev_launch_measure(Error **errp) +{ + char *data; + SevLaunchMeasureInfo *info; + + data =3D sev_get_launch_measurement(); + if (!data) { + error_setg(errp, "Measurement is not available"); + return NULL; + } + + info =3D g_malloc0(sizeof(*info)); + info->data =3D data; + + return info; +} + +SevCapability *qmp_query_sev_capabilities(Error **errp) +{ + return sev_get_capabilities(errp); +} + +#define SEV_SECRET_GUID "4c2eb361-7d9b-4cc3-8081-127c90d3d294" +struct sev_secret_area { + uint32_t base; + uint32_t size; +}; + +void qmp_sev_inject_launch_secret(const char *packet_hdr, + const char *secret, + bool has_gpa, uint64_t gpa, + Error **errp) +{ + if (!sev_enabled()) { + error_setg(errp, QERR_UNSUPPORTED); + return; + } + if (!has_gpa) { + uint8_t *data; + struct sev_secret_area *area; + + if (!pc_system_ovmf_table_find(SEV_SECRET_GUID, &data, NULL)) { + error_setg(errp, "SEV: no secret area found in OVMF," + " gpa must be specified."); + return; + } + area =3D (struct sev_secret_area *)data; + gpa =3D area->base; + } + + sev_inject_launch_secret(packet_hdr, secret, gpa, errp); +} + +SevAttestationReport *qmp_query_sev_attestation_report(const char *mnonce, + Error **errp) +{ + return sev_get_attestation_report(mnonce, errp); +} --=20 2.31.1 From nobody Thu Mar 28 16:44:16 2024 Delivered-To: importer2@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+importer2=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1623308066; cv=none; d=zohomail.com; s=zohoarc; b=C3nNOno3DPHKw3Jh/DukXtSXaGtdveMK5mLOv3Y36PkL5NlF3MOEmHFH71sX5TxbXNNnQAttIrHQjNWizohHe1kh3VEWTJhvYw5sNCg/cI35lE8gPJWntpje8ES7JLZJJTWap1jEV8ZvLpBSItWN4HzyhFhpc6Nwt9SiegXvFJA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1623308066; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=bsDSEZHNo/Alerya/rQccn2RkvkTAbWl3TalIqQPVK0=; b=K0zmjL6WDXGp2JeAVcNhyU+eCy3cJjqVeJmTzSt0tPokryEpb0l80bRXkoSMaAqpDTuhenWIC5kqmkEb4tTWyMLrc3OboDwvbPZJRvfXJmuJMPcSVXxI7zdnmZe01Zyf0aGaHIhfVobBt7qB526/vUUYbVBlHNVuhvrWM1P/CWU= ARC-Authentication-Results: i=1; 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+importer2=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1623308066317889.9811938314297; Wed, 9 Jun 2021 23:54:26 -0700 (PDT) Received: from localhost ([::1]:48392 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lrEa9-0004Wf-74 for importer2@patchew.org; Thu, 10 Jun 2021 02:54:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55778) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lrESq-0008Mr-Ne for qemu-devel@nongnu.org; Thu, 10 Jun 2021 02:46:52 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:23825) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lrESn-0005bJ-ER for qemu-devel@nongnu.org; Thu, 10 Jun 2021 02:46:51 -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-465-DxpslVfePdiKH7YcdyVVpg-1; Thu, 10 Jun 2021 02:46:48 -0400 Received: by mail-wr1-f72.google.com with SMTP id h10-20020a5d688a0000b0290119c2ce2499so403571wru.19 for ; Wed, 09 Jun 2021 23:46:47 -0700 (PDT) Received: from x1w.redhat.com (235.red-83-57-168.dynamicip.rima-tde.net. [83.57.168.235]) by smtp.gmail.com with ESMTPSA id b8sm8979812wmd.35.2021.06.09.23.46.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Jun 2021 23:46:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1623307608; 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=bsDSEZHNo/Alerya/rQccn2RkvkTAbWl3TalIqQPVK0=; b=M5zbnJ/fn5kazmjISKEK3DRvPp+fCyumBYvCVKDgu/DPoOjkpZFcNoBB4vBTMhSBIwRmSv mHdx8BJ9otfKEBz297CwuN4dJ6NO5dSFDOz+fnDgx+cYzHUYWSgWG4xnu3cri18vxIp/k3 8wYWSvhL6oXysfYZ3rIarP43e2mQVfg= X-MC-Unique: DxpslVfePdiKH7YcdyVVpg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=bsDSEZHNo/Alerya/rQccn2RkvkTAbWl3TalIqQPVK0=; b=f2pkqQKL/KAGJXtBwg1j0Mpv7PvfPyFFsZmdiKahGP6CgtohyRigFHI5eKYgQtX1Z7 45vHQOj80FLQ35Qp1kvcwdJ236tC/zl6guP2XpQZ8+dw8CqKwaW9CXdqBgw6iL46IkG/ x9wW2tLmS+HeoAW61eXbodR6lsSYHAZ57foRIf3VnAJosuD57e9qI2yqIl5JGkruCGu/ aBqZvfGRZJ9LYafZ9DPoIr7kp80JH1wKrQqervU6OD4sDoK8ETO3xaGLWXe6U2McEHKK ROmxFL3VdDyXeqeSb7iYayncn7UFCgmX7Yh0XULWfa3pxlOiHHmzUWMdTiHrlllMvNJZ KNaw== X-Gm-Message-State: AOAM532zOjalVkV+CUAMxihmD5ZINWlBUUYLOgpwzxwm+tsqx2hHNwqg GHseMn/dgpPkCsJ22ItVBYgGHU9c+GpW7+YjkoSjxhgFqas1XoExLbUoO8rAm+TaerdqrnS4vE8 B+a+nbHqVOy6cv4kEdGD5xnJElklIRubyoQDiKJ1eRRhYMzOMwbGQCXLGQau0uUfZ X-Received: by 2002:a5d:6e0d:: with SMTP id h13mr3639759wrz.118.1623307606587; Wed, 09 Jun 2021 23:46:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxoMqBQzSEIDPhtn+U1WPKOViLtnTR8w/NhzGhlY/FbON1/5ZMe5byPybtrz6pp4xv4o53j3g== X-Received: by 2002:a5d:6e0d:: with SMTP id h13mr3639737wrz.118.1623307606396; Wed, 09 Jun 2021 23:46:46 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH 11/11] monitor: Restrict 'info sev' to x86 targets Date: Thu, 10 Jun 2021 08:45:56 +0200 Message-Id: <20210610064556.1421620-12-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210610064556.1421620-1-philmd@redhat.com> References: <20210610064556.1421620-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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.199, 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_H4=0.001, RCVD_IN_MSPIKE_WL=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 , Connor Kuehl , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Dr . David Alan Gilbert" , Markus Armbruster , Eric Blake Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) 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 60fc92722ae..20adbea5154 100644 --- a/include/monitor/hmp-target.h +++ b/include/monitor/hmp-target.h @@ -49,5 +49,6 @@ 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); =20 #endif /* MONITOR_HMP_TARGET_H */ diff --git a/include/monitor/hmp.h b/include/monitor/hmp.h index 605d57287ae..ac03adc6f0a 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 7a35f0432b2..aba02f3c332 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 b4d7c41d3fb..0103b28c396 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