From patchwork Thu Oct 7 16:16:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 12542247 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8BE30C433F5 for ; Thu, 7 Oct 2021 16:19:02 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 56C8261245 for ; Thu, 7 Oct 2021 16:19:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 56C8261245 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:37510 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mYW6m-00059r-RQ for qemu-devel@archiver.kernel.org; Thu, 07 Oct 2021 12:19:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46886) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mYW5L-0002ws-D6 for qemu-devel@nongnu.org; Thu, 07 Oct 2021 12:17:31 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:23240) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mYW5J-0004WF-Uj for qemu-devel@nongnu.org; Thu, 07 Oct 2021 12:17:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633623448; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GNtxCZGvnxhj0iwK4swW8c7ZuwhRSlRGtvMCk2ldQWo=; b=i4uWre7dXPq3Egm63tsxtJoMasKOl29mBbITddMdCKqgi/dJSar3iFBq/Z74yZZa6NjxAd mfK6sdyy1cBmkstGGPuhI/pztZaIzV3cslCaaFFUj6sSkMR7dsKnE+s88HEPuBbvzm1IGS XyZvsEy5QSfi8b9cDIZzr6LnMr8RtfU= 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-590-mp5nRv4OPnSHBeu6diM8vA-1; Thu, 07 Oct 2021 12:17:25 -0400 X-MC-Unique: mp5nRv4OPnSHBeu6diM8vA-1 Received: by mail-wr1-f71.google.com with SMTP id y12-20020a056000168c00b00160da4de2c7so2031142wrd.5 for ; Thu, 07 Oct 2021 09:17:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=GNtxCZGvnxhj0iwK4swW8c7ZuwhRSlRGtvMCk2ldQWo=; b=DDhgqF+ceMaU0wDreBV0qCZbLijD7sLCuOi5VNcdkpNkIBbi99obQIWAcg97BUmSFN zwvX8TWF5T6Esl83FeDX9Ojn/vM1AQUn3Yvht6gh8/2AYh/VJQRucfXyymoHPdBhQe/N pDbbgnmHHhhPYnPcgQKuiJAV5aSBj3+jJyhaOo8YuabcjNmVCPbc3821TrLaYgV1RnKJ S4qhATA6R/C09Swev8/ypkrDAZ+e4tOMIqGkmBL0jq/VDy4XcWKU9qm9T50XYCj8UdGw IAL1i7juIVaW237cqEKzU8mTbeALNYxOi9cm1siPkHIY9n2R0o90plPmlIfmUDyqaLsB KTig== X-Gm-Message-State: AOAM532bb2GSXzUcjAdSZCJ2ti6UskNGJlzcvF/WbaVQi0D69DCZUtCg ymkjDTyavkpC6fLTEOENiuvwoS45u1ieXUVtRcS9igdIgWMHpq24NumIj+gZUgVnuZeqDbEv6cG RW+Aa8rQaQsuymU38wM8L9URAZb9CVLKrCgBB2Uf8AFbnObpi0bLpIs93ukbxkbVy X-Received: by 2002:adf:a15c:: with SMTP id r28mr6657742wrr.287.1633623443237; Thu, 07 Oct 2021 09:17:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz+RMzqKfLp1HEW7IFDLlNjEi/iRuCQ1sFP+CVWglEu2hUVLxRR+2IyjSGZpZn9KcPO5riLYQ== X-Received: by 2002:adf:a15c:: with SMTP id r28mr6657700wrr.287.1633623443022; Thu, 07 Oct 2021 09:17:23 -0700 (PDT) Received: from x1w.redhat.com (118.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.118]) by smtp.gmail.com with ESMTPSA id d8sm48710wrz.84.2021.10.07.09.17.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Oct 2021 09:17:22 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v4 01/23] qapi/misc-target: Wrap long 'SEV Attestation Report' long lines Date: Thu, 7 Oct 2021 18:16:54 +0200 Message-Id: <20211007161716.453984-2-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211007161716.453984-1-philmd@redhat.com> References: <20211007161716.453984-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=170.10.133.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.05, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Brijesh Singh , Eduardo Habkost , kvm@vger.kernel.org, "Michael S. Tsirkin" , Sergio Lopez , James Bottomley , "Dr. David Alan Gilbert" , Markus Armbruster , Dov Murik , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Wrap long lines before 70 characters for legibility. Suggested-by: Markus Armbruster Reviewed-by: Markus Armbruster Reviewed-by: Paolo Bonzini Signed-off-by: Philippe Mathieu-Daudé --- qapi/misc-target.json | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/qapi/misc-target.json b/qapi/misc-target.json index 594fbd1577f..ae5577e0390 100644 --- a/qapi/misc-target.json +++ b/qapi/misc-target.json @@ -300,8 +300,8 @@ ## # @SevAttestationReport: # -# The struct describes attestation report for a Secure Encrypted Virtualization -# feature. +# The struct describes attestation report for a Secure Encrypted +# Virtualization feature. # # @data: guest attestation report (base64 encoded) # @@ -315,10 +315,11 @@ ## # @query-sev-attestation-report: # -# This command is used to get the SEV attestation report, and is supported on AMD -# X86 platforms only. +# This command is used to get the SEV attestation report, and is +# supported on AMD X86 platforms only. # -# @mnonce: a random 16 bytes value encoded in base64 (it will be included in report) +# @mnonce: a random 16 bytes value encoded in base64 (it will be +# included in report) # # Returns: SevAttestationReport objects. # @@ -326,11 +327,13 @@ # # Example: # -# -> { "execute" : "query-sev-attestation-report", "arguments": { "mnonce": "aaaaaaa" } } +# -> { "execute" : "query-sev-attestation-report", +# "arguments": { "mnonce": "aaaaaaa" } } # <- { "return" : { "data": "aaaaaaaabbbddddd"} } # ## -{ 'command': 'query-sev-attestation-report', 'data': { 'mnonce': 'str' }, +{ 'command': 'query-sev-attestation-report', + 'data': { 'mnonce': 'str' }, 'returns': 'SevAttestationReport', 'if': 'TARGET_I386' } From patchwork Thu Oct 7 16:16:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 12542323 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 53FB0C433F5 for ; Thu, 7 Oct 2021 16:24:04 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CA9636120D for ; Thu, 7 Oct 2021 16:24:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org CA9636120D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:54682 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mYWBe-0008DH-L4 for qemu-devel@archiver.kernel.org; Thu, 07 Oct 2021 12:24:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46960) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mYW5T-0003Cg-O3 for qemu-devel@nongnu.org; Thu, 07 Oct 2021 12:17:39 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:26175) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mYW5R-0004eg-Hd for qemu-devel@nongnu.org; Thu, 07 Oct 2021 12:17:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633623456; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=T2ImpqtRm6esWhnoDgzoQLTDZKGPR7WZ/icRmMlGH5o=; b=Fo0sdOOcLpO7nqXoseb9+xIKXUtY1sp5KjteTDiIbGUBKi4qdTxOSKiO/gegqgRIWDuCq/ tQNU20Pdq+UCFMwboWlayzqr5VJ2z5u8ztyIwinYujucaS+4M9j12gWUttaAgL3mZ2v7+c KXYXt4+lOCoLmGo7Hd4n5uIF8+GFJE8= 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-178-ksnyOWZFMySUGoZd_rHIrw-1; Thu, 07 Oct 2021 12:17:29 -0400 X-MC-Unique: ksnyOWZFMySUGoZd_rHIrw-1 Received: by mail-wr1-f72.google.com with SMTP id l9-20020adfc789000000b00160111fd4e8so5140992wrg.17 for ; Thu, 07 Oct 2021 09:17:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=T2ImpqtRm6esWhnoDgzoQLTDZKGPR7WZ/icRmMlGH5o=; b=oLOO40QeivEIT+C9aFGKhY74AYZVVtaHVtpPVS1l3h5GlcTdVJnFkADbXieSCn09wi WnbnUCzu5J/iAiiTvqXGSHzaUx1yXUuP2AOhHvXs/T290970lY5QfE1jEyAzI0WD6b7n 20KbZmnW+6PT0BnSt6tLrULJEm+OE2ok72cede6Q3DMKmQrnrBEq9bfRDnRBH3w3wliv vs6WSEPvC925Zg91yjoEWWuxMpOYECXHl+KVNoQCcpFRq4DeF0UcYf1RBO8mv0duUG3U MlAr8KI3vhqdUgRMqPEiPCtpKH238Ruk5mFnmIKAGwBmYfE1Tge33gRs+xJy0BxAOroQ /rww== X-Gm-Message-State: AOAM531XTHzmE3tmG0bDhG/bUJR8tRwXO4Uyq8Xr7sjiS4sg2eLD8t2u 3cc8BDTW/u0Lo4ZcdB3uqM6Om0MSCBZgcDnyO4q/2C/JkDYdohivocGZOD1EKiQjxyxzWHah52f MvNKM6hxFSFHIm8qLi1j1IvYWa4VadO8Dtu08eiHmgGxNaIjX1NWzmZYwRA5nugDT X-Received: by 2002:a05:600c:240a:: with SMTP id 10mr17330265wmp.170.1633623448024; Thu, 07 Oct 2021 09:17:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxXiHFJgriMo7TGc679FzXDocjunP1esVffm6c4eGKKXk96WSVJZU9pFdlw5+ue8yJioBiocA== X-Received: by 2002:a05:600c:240a:: with SMTP id 10mr17330219wmp.170.1633623447678; Thu, 07 Oct 2021 09:17:27 -0700 (PDT) Received: from x1w.redhat.com (118.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.118]) by smtp.gmail.com with ESMTPSA id w11sm4476wmc.44.2021.10.07.09.17.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Oct 2021 09:17:27 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v4 02/23] qapi/misc-target: Group SEV QAPI definitions Date: Thu, 7 Oct 2021 18:16:55 +0200 Message-Id: <20211007161716.453984-3-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211007161716.453984-1-philmd@redhat.com> References: <20211007161716.453984-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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: -9 X-Spam_score: -1.0 X-Spam_bar: - X-Spam_report: (-1.0 / 5.0 requ) DKIMWL_WL_HIGH=-0.05, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Brijesh Singh , Eduardo Habkost , kvm@vger.kernel.org, "Michael S. Tsirkin" , Sergio Lopez , James Bottomley , "Dr. David Alan Gilbert" , Dov Murik , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" There is already a section with various SEV commands / types, so move the SEV guest attestation together. Reviewed-by: Paolo Bonzini Signed-off-by: Philippe Mathieu-Daudé --- qapi/misc-target.json | 80 +++++++++++++++++++++---------------------- 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/qapi/misc-target.json b/qapi/misc-target.json index ae5577e0390..5aa2b95b7d4 100644 --- a/qapi/misc-target.json +++ b/qapi/misc-target.json @@ -229,6 +229,46 @@ 'data': { 'packet-header': 'str', 'secret': 'str', '*gpa': 'uint64' }, 'if': 'TARGET_I386' } +## +# @SevAttestationReport: +# +# The struct describes attestation report for a Secure Encrypted +# Virtualization feature. +# +# @data: guest attestation report (base64 encoded) +# +# +# Since: 6.1 +## +{ 'struct': 'SevAttestationReport', + 'data': { 'data': 'str'}, + 'if': 'TARGET_I386' } + +## +# @query-sev-attestation-report: +# +# This command is used to get the SEV attestation report, and is +# supported on AMD X86 platforms only. +# +# @mnonce: a random 16 bytes value encoded in base64 (it will be +# included in report) +# +# Returns: SevAttestationReport objects. +# +# Since: 6.1 +# +# Example: +# +# -> { "execute" : "query-sev-attestation-report", +# "arguments": { "mnonce": "aaaaaaa" } } +# <- { "return" : { "data": "aaaaaaaabbbddddd"} } +# +## +{ 'command': 'query-sev-attestation-report', + 'data': { 'mnonce': 'str' }, + 'returns': 'SevAttestationReport', + 'if': 'TARGET_I386' } + ## # @dump-skeys: # @@ -297,46 +337,6 @@ 'if': 'TARGET_ARM' } -## -# @SevAttestationReport: -# -# The struct describes attestation report for a Secure Encrypted -# Virtualization feature. -# -# @data: guest attestation report (base64 encoded) -# -# -# Since: 6.1 -## -{ 'struct': 'SevAttestationReport', - 'data': { 'data': 'str'}, - 'if': 'TARGET_I386' } - -## -# @query-sev-attestation-report: -# -# This command is used to get the SEV attestation report, and is -# supported on AMD X86 platforms only. -# -# @mnonce: a random 16 bytes value encoded in base64 (it will be -# included in report) -# -# Returns: SevAttestationReport objects. -# -# Since: 6.1 -# -# Example: -# -# -> { "execute" : "query-sev-attestation-report", -# "arguments": { "mnonce": "aaaaaaa" } } -# <- { "return" : { "data": "aaaaaaaabbbddddd"} } -# -## -{ 'command': 'query-sev-attestation-report', - 'data': { 'mnonce': 'str' }, - 'returns': 'SevAttestationReport', - 'if': 'TARGET_I386' } - ## # @SGXInfo: # From patchwork Thu Oct 7 16:16:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 12542255 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 898B6C433F5 for ; Thu, 7 Oct 2021 16:22:01 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 52D43610CC for ; Thu, 7 Oct 2021 16:22:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 52D43610CC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:46154 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mYW9g-0002ai-Cr for qemu-devel@archiver.kernel.org; Thu, 07 Oct 2021 12:22:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46928) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mYW5S-00038O-1S for qemu-devel@nongnu.org; Thu, 07 Oct 2021 12:17:38 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:21687) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mYW5Q-0004cT-Cb for qemu-devel@nongnu.org; Thu, 07 Oct 2021 12:17:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633623455; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Y8MKkMv6eEYqC4N/epBYvYnHUWa4qpxEvyDLGqIxORI=; b=IFF3vcia44C88nr0U/W2xUB442PcmYNXJnuZZSuEa4m52MQK/scGiz5bw6DYG3y4IEsLp3 ON04kKfh0mmbaKcjNpbnngG1pG5Le/i/QqSry6M12cJ7ma9d5pczknE8+su8BLhSDoLU6f kxMEtOrF+z3GXBsqHmmmgEEvEv2AoRM= 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-5-vc7WhhnQNpyPZbIaa6UY-g-1; Thu, 07 Oct 2021 12:17:34 -0400 X-MC-Unique: vc7WhhnQNpyPZbIaa6UY-g-1 Received: by mail-wr1-f71.google.com with SMTP id e12-20020a056000178c00b001606927de88so5113212wrg.10 for ; Thu, 07 Oct 2021 09:17:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Y8MKkMv6eEYqC4N/epBYvYnHUWa4qpxEvyDLGqIxORI=; b=3bpxtE/oGLIGVNQw5Y99rm1ZGD6nESkiuSkMW9IAoraYgGuYZPLu2yZ/IrrcWQhOM5 UCgVGDaqu8eGirItHxzItmr8imgvV9KYz9EkOTglzgngkdmbjuZE+kXlzsI5+MFM2RTY 9py5WDVCBIh64kot7c0TmVvt37mjZpGAJeA32BXR4ZAQJ1iK+9rEAuhyWWlr6CpVz6iv GP9+AOmOoouINuH8SPJDqExesOqmNUA+AzUJQ5fhd1MQNWqfaf/dlIAVxK0NPKFQ3HaO toP1P792PausE/bpD0I/L+Nf3q3t+mHGexV+849JMGJSHrz5ATiUo3p2rw32Pz0al72q AAfQ== X-Gm-Message-State: AOAM530s82O7x9bYmbZ+2lGk96HmzQkKvny99AiYM9BKL8Qt1yjN7Esz jLdcKvMzrB2gdKsnOMzAayG4IF+qIDIi5EWnaFn0pLKz4jRU+IQ8RavhtK4ImXhY13UBVnozUcR rjildm8bprjX6vK8DimaQ6cjQt0Ui6H0zI76dqdXuGxw+KdH8ObP9ZuQtZVAmnUl5 X-Received: by 2002:a1c:7d56:: with SMTP id y83mr17824184wmc.86.1633623452366; Thu, 07 Oct 2021 09:17:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwF+d5yHeqVCso2c8JoGm6EX0nJrH1IGYECCnAhCYPfhEDrS5UZoqX1jwZPwYaiW6EnnPePGQ== X-Received: by 2002:a1c:7d56:: with SMTP id y83mr17824160wmc.86.1633623452185; Thu, 07 Oct 2021 09:17:32 -0700 (PDT) Received: from x1w.redhat.com (118.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.118]) by smtp.gmail.com with ESMTPSA id y23sm1024155wmj.42.2021.10.07.09.17.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Oct 2021 09:17:31 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v4 03/23] target/i386/kvm: Introduce i386_softmmu_kvm Meson source set Date: Thu, 7 Oct 2021 18:16:56 +0200 Message-Id: <20211007161716.453984-4-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211007161716.453984-1-philmd@redhat.com> References: <20211007161716.453984-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=170.10.129.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.05, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_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 , Eduardo Habkost , kvm@vger.kernel.org, "Michael S. Tsirkin" , Sergio Lopez , James Bottomley , "Dr. David Alan Gilbert" , Dov Murik , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Introduce the i386_softmmu_kvm Meson source set to be able to add features dependent on CONFIG_KVM. Reviewed-by: Paolo Bonzini Signed-off-by: Philippe Mathieu-Daudé --- target/i386/kvm/meson.build | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/target/i386/kvm/meson.build b/target/i386/kvm/meson.build index 0a533411cab..b1c76957c76 100644 --- a/target/i386/kvm/meson.build +++ b/target/i386/kvm/meson.build @@ -1,8 +1,12 @@ i386_ss.add(when: 'CONFIG_KVM', if_false: files('kvm-stub.c')) -i386_softmmu_ss.add(when: 'CONFIG_KVM', if_true: files( +i386_softmmu_kvm_ss = ss.source_set() + +i386_softmmu_kvm_ss.add(files( 'kvm.c', 'kvm-cpu.c', )) i386_softmmu_ss.add(when: 'CONFIG_HYPERV', if_true: files('hyperv.c'), if_false: files('hyperv-stub.c')) + +i386_softmmu_ss.add_all(when: 'CONFIG_KVM', if_true: i386_softmmu_kvm_ss) From patchwork Thu Oct 7 16:16:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 12542251 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DA93BC433F5 for ; Thu, 7 Oct 2021 16:19:20 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 78FD66113E for ; Thu, 7 Oct 2021 16:19:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 78FD66113E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:38680 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mYW75-0005wL-MM for qemu-devel@archiver.kernel.org; Thu, 07 Oct 2021 12:19:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46980) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mYW5V-0003Hk-LP for qemu-devel@nongnu.org; Thu, 07 Oct 2021 12:17:41 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:49738) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mYW5U-0004hB-58 for qemu-devel@nongnu.org; Thu, 07 Oct 2021 12:17:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633623459; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=uq3GCe1ePuf4e4h9nXgJWeyky4oXCfK2GmOEpWIO22Y=; b=aS0Yf7/9ZNlbn9WnrCasxFQyUI6CU/K/HHP5d4hgCzkuLuUOI6v6eQ9DjEhRmXlaLyuQUB 7DITJkVqREc9F/1JfMjuKzcwrz/oUWvlyeo8wFHH6TxUmHuG6NLaXozS8tWojqS3dNjP1J BfgK96DV/dqaL2sg/wYoVi/n+Qzd/7U= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-300-ipvgLNRFNpCHuDkWc00hBQ-1; Thu, 07 Oct 2021 12:17:38 -0400 X-MC-Unique: ipvgLNRFNpCHuDkWc00hBQ-1 Received: by mail-wr1-f72.google.com with SMTP id r16-20020adfb1d0000000b00160bf8972ceso5115866wra.13 for ; Thu, 07 Oct 2021 09:17:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=uq3GCe1ePuf4e4h9nXgJWeyky4oXCfK2GmOEpWIO22Y=; b=uBRafT7pkLUczFs+Oz0azt+CSZ0XTInLFFErCJSU0p0gGVr5odnPORFXtf7UaEpsED FNGl8rjJXBYhuIhsL/5DyIKZh4Njqvo3XmQwDsGq0M7z7VLjS+f3/P0D/agJp2fuLrkF wgHpNln957PJjQ3je7lESOVRdOtpkP4SHodZLnY4HdT3YFgyhkTH6qyx2+1Nfi5d0jbp LLkHEsrOAQi7mi4cMZm3kILpGhv74vRGHNLN3ryP3Bt+2eDc/e4KcbrFacVEGsgp31fO xI0PcwqKQgaQE3hqnKQsURa6bijpN1sx4XRY1T4g3rouL1g77ZxEzQNYp9WxgWumLnDb WoKQ== X-Gm-Message-State: AOAM533Xqzm3/1WL0oILrL0rbJOo6YfpPlxjTvW9w09xGVB+yAJ++Xoh j49JzdP3a57UGj3brKEnO2oWLjrJmNoX+4NMiQMmevVy4SXv76K8DYHlW9Nk1bbFV/OLhx1lpyO NAlV0Pd2ia1f8SuW6J7DTHpikO+keffiNaRbjjK5pQuybJ8IUlU5fwxwLnMoLwBq0 X-Received: by 2002:a05:600c:3585:: with SMTP id p5mr17715023wmq.110.1633623457100; Thu, 07 Oct 2021 09:17:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyRrHz4LpvS4F9A81Irylf6VyS/KU+7ApS5LGF0wX1DCUn4RZ7VNHky7fCfqHI5KKojHx92LA== X-Received: by 2002:a05:600c:3585:: with SMTP id p5mr17714991wmq.110.1633623456879; Thu, 07 Oct 2021 09:17:36 -0700 (PDT) Received: from x1w.redhat.com (118.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.118]) by smtp.gmail.com with ESMTPSA id 189sm10244544wmz.27.2021.10.07.09.17.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Oct 2021 09:17:36 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v4 04/23] target/i386/kvm: Restrict SEV stubs to x86 architecture Date: Thu, 7 Oct 2021 18:16:57 +0200 Message-Id: <20211007161716.453984-5-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211007161716.453984-1-philmd@redhat.com> References: <20211007161716.453984-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=170.10.133.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.05, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Brijesh Singh , Eduardo Habkost , kvm@vger.kernel.org, "Michael S. Tsirkin" , Sergio Lopez , James Bottomley , "Dr. David Alan Gilbert" , Dov Murik , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" SEV is x86-specific, no need to add its stub to other architectures. Move the stub file to target/i386/kvm/. Reviewed-by: Paolo Bonzini Signed-off-by: Philippe Mathieu-Daudé --- {accel => target/i386}/kvm/sev-stub.c | 0 accel/kvm/meson.build | 1 - target/i386/kvm/meson.build | 2 ++ 3 files changed, 2 insertions(+), 1 deletion(-) rename {accel => target/i386}/kvm/sev-stub.c (100%) diff --git a/accel/kvm/sev-stub.c b/target/i386/kvm/sev-stub.c similarity index 100% rename from accel/kvm/sev-stub.c rename to target/i386/kvm/sev-stub.c diff --git a/accel/kvm/meson.build b/accel/kvm/meson.build index 8d219bea507..397a1fe1fd1 100644 --- a/accel/kvm/meson.build +++ b/accel/kvm/meson.build @@ -3,6 +3,5 @@ 'kvm-all.c', 'kvm-accel-ops.c', )) -kvm_ss.add(when: 'CONFIG_SEV', if_false: files('sev-stub.c')) specific_ss.add_all(when: 'CONFIG_KVM', if_true: kvm_ss) diff --git a/target/i386/kvm/meson.build b/target/i386/kvm/meson.build index b1c76957c76..736df8b72e3 100644 --- a/target/i386/kvm/meson.build +++ b/target/i386/kvm/meson.build @@ -7,6 +7,8 @@ 'kvm-cpu.c', )) +i386_softmmu_kvm_ss.add(when: 'CONFIG_SEV', if_false: files('sev-stub.c')) + i386_softmmu_ss.add(when: 'CONFIG_HYPERV', if_true: files('hyperv.c'), if_false: files('hyperv-stub.c')) i386_softmmu_ss.add_all(when: 'CONFIG_KVM', if_true: i386_softmmu_kvm_ss) From patchwork Thu Oct 7 16:16:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 12542329 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DB9D4C433EF for ; Thu, 7 Oct 2021 16:27:04 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 671F160FE3 for ; Thu, 7 Oct 2021 16:27:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 671F160FE3 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:34178 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mYWEZ-0004xQ-Fb for qemu-devel@archiver.kernel.org; Thu, 07 Oct 2021 12:27:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47004) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mYW5b-0003Yv-Ij for qemu-devel@nongnu.org; Thu, 07 Oct 2021 12:17:47 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:27274) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mYW5Z-0004lF-QB for qemu-devel@nongnu.org; Thu, 07 Oct 2021 12:17:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633623465; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YWQW4qwuIwVFhirEUS8iXAcoBuFkj6ZGIrq5y79ZQBA=; b=ism7fi9AriLQcgWzijaODOlGAwt3zSc/MR6TrcvttBTacU234FgYM0In2CpFIwG+y0f2X5 Qh+jFLrckfi+8hcuFdI3T8q238q92g6S2ncKxrQ0b5YFiICExu/nXo3lxZIbbk0lFj2Qa0 5c5bwXfIrXwya3cxEJ72twdDiXZgaOM= 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-50-9V5cPOX7PiCg9Ksf7N9lBQ-1; Thu, 07 Oct 2021 12:17:43 -0400 X-MC-Unique: 9V5cPOX7PiCg9Ksf7N9lBQ-1 Received: by mail-wr1-f69.google.com with SMTP id r21-20020adfa155000000b001608162e16dso5102460wrr.15 for ; Thu, 07 Oct 2021 09:17:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=YWQW4qwuIwVFhirEUS8iXAcoBuFkj6ZGIrq5y79ZQBA=; b=bqLrntUVLItVAQ+Vt++sQch/9UOV/D6Bfho/UjrHPDYWUC3u5rBr2comSLzWeEHHEX teMkldHxeiu1Sw6UCjDJojUnVSbCDet5H1ndCUg3NTErtjGIbD58U7nwq3pvqerhxtSw rkgf0oUJbPoYccxM5DEIyZYCmgvLpN5QZzBt/gzwUlUsHkc9K/LYUvXGZLcPH1U5646t y7bmuFN9qhuLcOEhmWT3eaOJ4DNZB+Aw+CUnvUEqhK/Bs4TzeYibFicXa/urZPR38Ncv Wwo8rUXW070DvbOeYjOEQXr8kgp/m9rv0StX5TSBRp8Y5io6HMjokDYjJ3xwSCd1/UMl 1hjA== X-Gm-Message-State: AOAM530HDXsZX/PDLLRimWugbYZ+LGKqyXihePVgQlqtfHnR/WwzTVj8 GVHEKsmDMviRZcTcBjZxDC8rQELih+7urX4juhPR01nXPoV8m1qDjTo1qRSlQ2HvIPSf2HEm6JO nmFUqwyLgmaOyPgl9ImOPkiiOXdYMuZChiPb2x0fknFT3v6jYXFCdGZ9FWwUfjmh6 X-Received: by 2002:a05:600c:190c:: with SMTP id j12mr17723318wmq.122.1633623461638; Thu, 07 Oct 2021 09:17:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx4KQBsttMSUVTx9ahdzw6VyJFfQYYcVssfVN4N4+Jw4Mj8STX+6QzmCQF2fKgdLkdMPO9omQ== X-Received: by 2002:a05:600c:190c:: with SMTP id j12mr17723282wmq.122.1633623461414; Thu, 07 Oct 2021 09:17:41 -0700 (PDT) Received: from x1w.redhat.com (118.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.118]) by smtp.gmail.com with ESMTPSA id e5sm88818wrd.1.2021.10.07.09.17.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Oct 2021 09:17:41 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v4 05/23] target/i386/sev: Prefix QMP errors with 'SEV' Date: Thu, 7 Oct 2021 18:16:58 +0200 Message-Id: <20211007161716.453984-6-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211007161716.453984-1-philmd@redhat.com> References: <20211007161716.453984-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=170.10.133.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.05, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Brijesh Singh , Eduardo Habkost , kvm@vger.kernel.org, "Michael S. Tsirkin" , Sergio Lopez , James Bottomley , "Dr. David Alan Gilbert" , Dov Murik , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Multiple errors might be reported to the monitor, better to prefix the SEV ones so we can distinct them. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Dr. David Alan Gilbert --- target/i386/monitor.c | 2 +- target/i386/sev.c | 20 +++++++++++--------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/target/i386/monitor.c b/target/i386/monitor.c index 196c1c9e77f..eabbeb9be95 100644 --- a/target/i386/monitor.c +++ b/target/i386/monitor.c @@ -717,7 +717,7 @@ SevLaunchMeasureInfo *qmp_query_sev_launch_measure(Error **errp) data = sev_get_launch_measurement(); if (!data) { - error_setg(errp, "Measurement is not available"); + error_setg(errp, "SEV launch measurement is not available"); return NULL; } diff --git a/target/i386/sev.c b/target/i386/sev.c index bcd9260fa46..4f1952cd32f 100644 --- a/target/i386/sev.c +++ b/target/i386/sev.c @@ -440,7 +440,8 @@ sev_get_pdh_info(int fd, guchar **pdh, size_t *pdh_len, guchar **cert_chain, r = sev_platform_ioctl(fd, SEV_PDH_CERT_EXPORT, &export, &err); if (r < 0) { if (err != SEV_RET_INVALID_LEN) { - error_setg(errp, "failed to export PDH cert ret=%d fw_err=%d (%s)", + error_setg(errp, "SEV: Failed to export PDH cert" + " ret=%d fw_err=%d (%s)", r, err, fw_error_to_str(err)); return 1; } @@ -453,7 +454,7 @@ sev_get_pdh_info(int fd, guchar **pdh, size_t *pdh_len, guchar **cert_chain, r = sev_platform_ioctl(fd, SEV_PDH_CERT_EXPORT, &export, &err); if (r < 0) { - error_setg(errp, "failed to export PDH cert ret=%d fw_err=%d (%s)", + error_setg(errp, "SEV: Failed to export PDH cert ret=%d fw_err=%d (%s)", r, err, fw_error_to_str(err)); goto e_free; } @@ -491,7 +492,7 @@ sev_get_capabilities(Error **errp) fd = open(DEFAULT_SEV_DEVICE, O_RDWR); if (fd < 0) { - error_setg_errno(errp, errno, "Failed to open %s", + error_setg_errno(errp, errno, "SEV: Failed to open %s", DEFAULT_SEV_DEVICE); return NULL; } @@ -557,8 +558,9 @@ sev_get_attestation_report(const char *mnonce, Error **errp) &input, &err); if (ret < 0) { if (err != SEV_RET_INVALID_LEN) { - error_setg(errp, "failed to query the attestation report length " - "ret=%d fw_err=%d (%s)", ret, err, fw_error_to_str(err)); + error_setg(errp, "SEV: Failed to query the attestation report" + " length ret=%d fw_err=%d (%s)", + ret, err, fw_error_to_str(err)); g_free(buf); return NULL; } @@ -572,7 +574,7 @@ sev_get_attestation_report(const char *mnonce, Error **errp) ret = sev_ioctl(sev->sev_fd, KVM_SEV_GET_ATTESTATION_REPORT, &input, &err); if (ret) { - error_setg_errno(errp, errno, "Failed to get attestation report" + error_setg_errno(errp, errno, "SEV: Failed to get attestation report" " ret=%d fw_err=%d (%s)", ret, err, fw_error_to_str(err)); goto e_free_data; } @@ -596,7 +598,7 @@ sev_read_file_base64(const char *filename, guchar **data, gsize *len) GError *error = NULL; if (!g_file_get_contents(filename, &base64, &sz, &error)) { - error_report("failed to read '%s' (%s)", filename, error->message); + error_report("SEV: Failed to read '%s' (%s)", filename, error->message); g_error_free(error); return -1; } @@ -911,7 +913,7 @@ sev_encrypt_flash(uint8_t *ptr, uint64_t len, Error **errp) if (sev_check_state(sev_guest, SEV_STATE_LAUNCH_UPDATE)) { int ret = sev_launch_update_data(sev_guest, ptr, len); if (ret < 0) { - error_setg(errp, "failed to encrypt pflash rom"); + error_setg(errp, "SEV: Failed to encrypt pflash rom"); return ret; } } @@ -930,7 +932,7 @@ int sev_inject_launch_secret(const char *packet_hdr, const char *secret, MemoryRegion *mr = NULL; if (!sev_guest) { - error_setg(errp, "SEV: SEV not enabled."); + error_setg(errp, "SEV not enabled for guest"); return 1; } From patchwork Thu Oct 7 16:16:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 12542253 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 72806C433EF for ; Thu, 7 Oct 2021 16:19:32 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 27FB761248 for ; Thu, 7 Oct 2021 16:19:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 27FB761248 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:39600 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mYW7H-0006aB-9l for qemu-devel@archiver.kernel.org; Thu, 07 Oct 2021 12:19:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47038) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mYW5f-0003kB-Mx for qemu-devel@nongnu.org; Thu, 07 Oct 2021 12:17:51 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:30737) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mYW5e-0004ou-5g for qemu-devel@nongnu.org; Thu, 07 Oct 2021 12:17:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633623469; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=o9lSbhoBJitVWDueMdjjLMLVkRSyu1rE4Rg4emr9Ei8=; b=LKGWtvBY357RpRJt3l25M0pN2JPgk3OFjogVrGp6s3NzAPfOl/DitfTD7GntS6mNPQe4dd 0HhY8zSN3SFHv2Yo7iyjBNalX6LCR1l2/qH+1gKCFw5iXgtcjn26nBD6p5IF9r0L9Ud+sF KaoxjR1XSuzxPsAlCA8frRiMhEOd9xc= 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-194-ZE5xBiIeNwGn2zhnBmb2Fw-1; Thu, 07 Oct 2021 12:17:47 -0400 X-MC-Unique: ZE5xBiIeNwGn2zhnBmb2Fw-1 Received: by mail-wr1-f69.google.com with SMTP id s18-20020adfbc12000000b00160b2d4d5ebso5150196wrg.7 for ; Thu, 07 Oct 2021 09:17:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=o9lSbhoBJitVWDueMdjjLMLVkRSyu1rE4Rg4emr9Ei8=; b=pwIpfFTRs5yVuZIWkx6ebvx/pGb9vGgGy2Febhhyemw9iqvJMrCpKoyA3teLxiUmAy 1eGe4lv2dR+D+kxK7yThPjaA1i7ryrGRespXOlObPLuDL14cQhCDUtS01pBTPXekga32 pZVg1DA/167xMScW1kMQAXpxt7Vtu8FMGQcfaV0ispVntKP+2XIl+gi6tFSIsdoYTsoo 3IWnYHJEBtOU4cojp5NB2xgtUzq4PUH3MDr8otB7FXqPb9GzQacPf5IRCaae+OjljerG 6vHltstWAxcLRumIILJ+iTiZI3ex9cTP6/c/RblZbWMc24oMjylcd0FeFSjhaYZ3kAVq 9cUQ== X-Gm-Message-State: AOAM531zNTXneyWu6ut5wDR8/g7DPsqSU/48yYzrWTxR2IqPRSEzrHcS QDqWUT6ahcv6aAQz09TwbFhRkRFrLbdwAvwVJVwHT4F65MzD8MiKx4PJRGh97MaJ5DoRkqQPc1q w9SVL9VuWyq6cbwihVGVZFNYwXPv2D5zmp+ALZtgufjklpi9deC0n6u7f4IVj/cBQ X-Received: by 2002:a05:6000:550:: with SMTP id b16mr6795196wrf.297.1633623466115; Thu, 07 Oct 2021 09:17:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwnfMiJdq3t4lKJrJn6gn2ZgOjVVHTpcfnmUwoUkpuTzHD+tLUzVsylqOO/srQz9P+TjP4dcA== X-Received: by 2002:a05:6000:550:: with SMTP id b16mr6795160wrf.297.1633623465856; Thu, 07 Oct 2021 09:17:45 -0700 (PDT) Received: from x1w.redhat.com (118.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.118]) by smtp.gmail.com with ESMTPSA id x15sm51076wrl.74.2021.10.07.09.17.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Oct 2021 09:17:45 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v4 06/23] target/i386/monitor: Return QMP error when SEV is not enabled for guest Date: Thu, 7 Oct 2021 18:16:59 +0200 Message-Id: <20211007161716.453984-7-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211007161716.453984-1-philmd@redhat.com> References: <20211007161716.453984-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=170.10.133.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.05, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Brijesh Singh , Eduardo Habkost , kvm@vger.kernel.org, "Michael S. Tsirkin" , Sergio Lopez , James Bottomley , "Dr. David Alan Gilbert" , Dov Murik , Connor Kuehl , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" If the management layer tries to inject a secret, it gets an empty response in case the guest doesn't have SEV enabled, or the binary is built without SEV: { "execute": "sev-inject-launch-secret", "arguments": { "packet-header": "mypkt", "secret": "mypass", "gpa": 4294959104 } } { "return": { } } Make it clearer by returning an error: { "execute": "sev-inject-launch-secret", "arguments": { "packet-header": "mypkt", "secret": "mypass", "gpa": 4294959104 } } { "error": { "class": "GenericError", "desc": "SEV not enabled for guest" } } Note: we will remove the sev_inject_launch_secret() stub in few commits, so we don't bother to add error_setg() there. Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Connor Kuehl Signed-off-by: Philippe Mathieu-Daudé --- target/i386/monitor.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/target/i386/monitor.c b/target/i386/monitor.c index eabbeb9be95..ea836678f51 100644 --- a/target/i386/monitor.c +++ b/target/i386/monitor.c @@ -28,6 +28,7 @@ #include "monitor/hmp-target.h" #include "monitor/hmp.h" #include "qapi/qmp/qdict.h" +#include "qapi/qmp/qerror.h" #include "sysemu/kvm.h" #include "sysemu/sev.h" #include "qapi/error.h" @@ -743,6 +744,10 @@ void qmp_sev_inject_launch_secret(const char *packet_hdr, bool has_gpa, uint64_t gpa, Error **errp) { + if (!sev_enabled()) { + error_setg(errp, "SEV not enabled for guest"); + return; + } if (!has_gpa) { uint8_t *data; struct sev_secret_area *area; From patchwork Thu Oct 7 16:17:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 12542257 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6BA6DC433FE for ; Thu, 7 Oct 2021 16:22:02 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 28961610CC for ; Thu, 7 Oct 2021 16:22:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 28961610CC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:46284 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mYW9h-0002g4-7D for qemu-devel@archiver.kernel.org; Thu, 07 Oct 2021 12:22:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47074) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mYW5m-00047B-TE for qemu-devel@nongnu.org; Thu, 07 Oct 2021 12:17:58 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:58407) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mYW5l-0004uB-1E for qemu-devel@nongnu.org; Thu, 07 Oct 2021 12:17:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633623475; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nFJahcuQnHhP8I03izotVBJeAm6M7KThunSrXMbgTQ0=; b=E9e6qrQEAl+p4NaBAP6a28G3iwD0AEeATYYiNuawL6knec1Z4wf1ukF9/1gPSKcFqDPaRg lqucypBGZ80/JSOINEu6z+6bc5bVcqALJdEKEtrsKNwWp4tmC3RoC4KxBEDv1wKXLfk/zt 7Nosz4FPBQX9EaEcU4H7DXEaQgSjXeA= 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-549-WwrI2evqN7akb_cuVYLUiA-1; Thu, 07 Oct 2021 12:17:54 -0400 X-MC-Unique: WwrI2evqN7akb_cuVYLUiA-1 Received: by mail-wr1-f71.google.com with SMTP id 75-20020adf82d1000000b00160cbb0f800so4356359wrc.22 for ; Thu, 07 Oct 2021 09:17:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=nFJahcuQnHhP8I03izotVBJeAm6M7KThunSrXMbgTQ0=; b=vGFdM62eCY51vkdGMzKuX5nGXrSDYUbDXbNgVoXRGlzZjGivq73vKuv5zqTTkU34Vp /IHwW8UMWZqHq8x/Cpn4DUvEm4UZ4g9f86631MErdKEwz3Pv8XSKzljgbtZa+cXYH196 m+nQUsVrrxtvKy/Zr3oBD/elk4J8ErH1MVj1b9a0qenVJsa53Q82YFsdVUeZEyPe80ns 7QkEJRY8QvAEVwTW4oRX9IGPTxtMS+DB0FI+Hv5H1ZP5dqHLvqM8Tobih60uYrjQVlR0 COrcgTN5K7nLelxWLj8m/5v7ymhZ4kK6XrLxhYtkSUJeaBfzD33jkhz9IMmMZU2iawtb ILAg== X-Gm-Message-State: AOAM530CO5fXn494kS+VlfGHuqcwWhjlqmDz84puyxTFxpCGDwc1AZN3 e36nxB3bRImgwkhceOL1czM3ncSeDdHj8/uqi85VEn1v60czJz9JAZ56MVtm7w58c6jVDNjRZPn FGuYbv+ZaTzVSsXp/YwrGV8V/2oYkDcXvw9lwrzQgaxDXc52XZM8K8mhpu4AJOOpm X-Received: by 2002:a05:600c:1552:: with SMTP id f18mr16953024wmg.184.1633623470855; Thu, 07 Oct 2021 09:17:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwPwOfgjE5w95h/skhL3N9RbbkKUO9R/p4rTX9ZmdO5wFGvZ/OZfqfGMboNdzGu5nRI4AFFTA== X-Received: by 2002:a05:600c:1552:: with SMTP id f18mr16952983wmg.184.1633623470613; Thu, 07 Oct 2021 09:17:50 -0700 (PDT) Received: from x1w.redhat.com (118.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.118]) by smtp.gmail.com with ESMTPSA id g188sm3421wmg.46.2021.10.07.09.17.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Oct 2021 09:17:50 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v4 07/23] target/i386/cpu: Add missing 'qapi/error.h' header Date: Thu, 7 Oct 2021 18:17:00 +0200 Message-Id: <20211007161716.453984-8-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211007161716.453984-1-philmd@redhat.com> References: <20211007161716.453984-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.05, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Brijesh Singh , Eduardo Habkost , kvm@vger.kernel.org, "Michael S. Tsirkin" , Sergio Lopez , James Bottomley , "Dr. David Alan Gilbert" , Dov Murik , Connor Kuehl , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Commit 00b81053244 ("target-i386: Remove assert_no_error usage") forgot to add the "qapi/error.h" for &error_abort, add it now. Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Connor Kuehl Reviewed-by: Paolo Bonzini Signed-off-by: Philippe Mathieu-Daudé --- target/i386/cpu.c | 1 + 1 file changed, 1 insertion(+) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index a7b1b6aa93a..b54b98551e9 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -27,6 +27,7 @@ #include "sysemu/hvf.h" #include "kvm/kvm_i386.h" #include "sev_i386.h" +#include "qapi/error.h" #include "qapi/qapi-visit-machine.h" #include "qapi/qmp/qerror.h" #include "qapi/qapi-commands-machine-target.h" From patchwork Thu Oct 7 16:17:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 12542325 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D7D12C433EF for ; Thu, 7 Oct 2021 16:24:06 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8430A6120D for ; Thu, 7 Oct 2021 16:24:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 8430A6120D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:54692 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mYWBh-0008Dn-Dn for qemu-devel@archiver.kernel.org; Thu, 07 Oct 2021 12:24:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47106) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mYW5p-0004HK-K3 for qemu-devel@nongnu.org; Thu, 07 Oct 2021 12:18:01 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:31418) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mYW5o-0004xT-5U for qemu-devel@nongnu.org; Thu, 07 Oct 2021 12:18:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633623479; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gGHqQ6nijElfXE8z0EcIVqckplNgbvyU+2uRGsS/qhw=; b=M/loBYOIJjEofziqONvIoumgd1LYscMN4vcYHE8p8bRBKwPB8l095/TeHJ2G70u+KT5cVW /v0+eTF4l3kkjPcXNZCgoMUa8haE6oolUM3tbLHTDATeuwzfdunaZnRpc4WSjQfTc5jELm wlSVyj7pM0bWjQbGb39kH0Dsz2dS5Bo= 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-474-xkWvtlZ8PP6ScVx7tjhAcA-1; Thu, 07 Oct 2021 12:17:58 -0400 X-MC-Unique: xkWvtlZ8PP6ScVx7tjhAcA-1 Received: by mail-wr1-f70.google.com with SMTP id y12-20020a056000168c00b00160da4de2c7so2032430wrd.5 for ; Thu, 07 Oct 2021 09:17:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=gGHqQ6nijElfXE8z0EcIVqckplNgbvyU+2uRGsS/qhw=; b=jSYb5J2O4UTbeu5JBLqF81ddZ/CJe1jPQkamgT/IHd7ecJFFU5sNHcx/sYdtyjoSwr 0oWgYjw0GKR46jI2mJ6CVb0uj/oYE9cHMeGGpWEwqPeQAzLSG7al7Q6HANdqdg6dqAUg lAakXpFNcGDiumK3Em/OWCzF6jJNDW9QppA3YVBW08+ShnAZ8XK5LQyd9pAxIGjYT+PH slPXgYy6379OscMBoJJjbBito77QMlnQ7M5z1A7jdVkYUgBgQYKmi/q1j2Xh6IKCU/zc enHtDoMcjkltotvExoB53cKBuVgWLHOfERV9RnH/rEhFKsNp+mgIlE227MbWXpUrph5+ OnDQ== X-Gm-Message-State: AOAM531fZEK1KlJIRImIQ32fsCJ/Wqul9JOuLLsji91/v/nmQvSBuS5g CBU/lp6mQ7rpypD4FawS/k9JpnNLvTCiNLSKqJx1U022OwjbCrYc+m/w08qtmcQZg7PhQX6sUVn TwhdJbClgT8BwGR3jH4leXAWV8wu0ngx+3Kce//p81gDAeGDfNfIPJdLUfbp1yGVz X-Received: by 2002:a7b:cb4f:: with SMTP id v15mr5561603wmj.21.1633623475405; Thu, 07 Oct 2021 09:17:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwfpdMNhU4CbAVvUdxNmWaSwoJzzerQY5uah7o9Fgx03HmJkEu8zn8P5fwyEHm478TyAhx7tQ== X-Received: by 2002:a7b:cb4f:: with SMTP id v15mr5561558wmj.21.1633623475187; Thu, 07 Oct 2021 09:17:55 -0700 (PDT) Received: from x1w.redhat.com (118.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.118]) by smtp.gmail.com with ESMTPSA id z5sm12440932wmp.26.2021.10.07.09.17.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Oct 2021 09:17:54 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v4 08/23] target/i386/sev_i386.h: Remove unused headers Date: Thu, 7 Oct 2021 18:17:01 +0200 Message-Id: <20211007161716.453984-9-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211007161716.453984-1-philmd@redhat.com> References: <20211007161716.453984-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=170.10.133.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.05, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Brijesh Singh , Eduardo Habkost , kvm@vger.kernel.org, "Michael S. Tsirkin" , Sergio Lopez , James Bottomley , "Dr. David Alan Gilbert" , Dov Murik , Connor Kuehl , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Declarations don't require these headers, remove them. Reviewed-by: Connor Kuehl Reviewed-by: Paolo Bonzini Signed-off-by: Philippe Mathieu-Daudé --- target/i386/sev_i386.h | 4 ---- target/i386/sev-stub.c | 1 + 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/target/i386/sev_i386.h b/target/i386/sev_i386.h index 2afe1080690..9bf6cd18789 100644 --- a/target/i386/sev_i386.h +++ b/target/i386/sev_i386.h @@ -14,11 +14,7 @@ #ifndef QEMU_SEV_I386_H #define QEMU_SEV_I386_H -#include "qom/object.h" -#include "qapi/error.h" -#include "sysemu/kvm.h" #include "sysemu/sev.h" -#include "qemu/error-report.h" #include "qapi/qapi-types-misc-target.h" #define SEV_POLICY_NODBG 0x1 diff --git a/target/i386/sev-stub.c b/target/i386/sev-stub.c index d8e65831714..408441768dc 100644 --- a/target/i386/sev-stub.c +++ b/target/i386/sev-stub.c @@ -12,6 +12,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "sev_i386.h" SevInfo *sev_get_info(void) From patchwork Thu Oct 7 16:17:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 12542261 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CE283C433F5 for ; Thu, 7 Oct 2021 16:22:22 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9383161074 for ; Thu, 7 Oct 2021 16:22:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 9383161074 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:48012 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mYWA1-0003oE-Of for qemu-devel@archiver.kernel.org; Thu, 07 Oct 2021 12:22:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47136) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mYW5w-0004cV-RR for qemu-devel@nongnu.org; Thu, 07 Oct 2021 12:18:08 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:40292) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mYW5u-000528-4O for qemu-devel@nongnu.org; Thu, 07 Oct 2021 12:18:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633623485; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sSsWEPfIasNtfedQFCfGwO+jHWqTcMPZG0w8furmgm0=; b=Igs+Y0C7Zh7F5iOckiaLfAqhkK1TxFUjkNn1jjC/Rs4SplfxhpkXKKgdTxJz8t7DorrYK+ KeB4lPX6OtuyrDdyd8Da7IC3z9IXSV41IQ3hpQGIxfArJCjOcUkk1wbmcXr7mOVVFWMfZN 26o4gRBqgPHB5lgezCsKuTQeUwYq/XA= 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-440-mjlOx0tEOSuEUb-Hx6oMXQ-1; Thu, 07 Oct 2021 12:18:02 -0400 X-MC-Unique: mjlOx0tEOSuEUb-Hx6oMXQ-1 Received: by mail-wr1-f71.google.com with SMTP id k2-20020adfc702000000b0016006b2da9bso5115356wrg.1 for ; Thu, 07 Oct 2021 09:18:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=sSsWEPfIasNtfedQFCfGwO+jHWqTcMPZG0w8furmgm0=; b=zLvoJKoneriofS00+b1Eb6y7hrB6sPw0fceSpPoCV4Qp2futv7IFl+qlDGHbVCi3r9 oZgtYBmAWs/yoM2GFyO0z5uknOOoNOBn/K2pSSEU7AlAQmyy5OtVMT7rtvV/VaD2epJO eE711u50HZ1UnU7ilxS2Xxj2cxURY1b3iVYIpY4ArXlafWj1lJJem6I9w9ghVqBMMZAN C2UXCaJEY44NFKxMuKeDxoA3/TaIogPbjaSgVYIYgnMH2bi82B7CsIZuFLIBsbsocOWy bvNV5OBr4FGJECaS3itBq4wJ82U9E2sAmvTfUHvgFj0ZG7fdgktAkasw784jfsvV32Qg MpAA== X-Gm-Message-State: AOAM5322aT2mDo12hQnGqxyP6ziVilrnZH/n673py3ZlPeuRs85JrgSb cvROHV1tyGUK8VBDO4fmxpWoLJtGMcf3M9m7mw7slH57giyrNXDifE1RcevXa3lpLNkPe0Bux+9 5IHG74JsXu7Jpvc8FQzCG2qp/0U/uPfNDEDbAkEydJw+rxS752qc+QGz0NCaJy70d X-Received: by 2002:a1c:21c3:: with SMTP id h186mr17261161wmh.107.1633623480347; Thu, 07 Oct 2021 09:18:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxjsy2gU1mGBwP4i99ZbwNtks5RgQrT2oIJ/6iZksWTWx6vPIaxi9q5gezQizl94gxn/Bm+vw== X-Received: by 2002:a1c:21c3:: with SMTP id h186mr17261120wmh.107.1633623480062; Thu, 07 Oct 2021 09:18:00 -0700 (PDT) Received: from x1w.redhat.com (118.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.118]) by smtp.gmail.com with ESMTPSA id a25sm8734142wmj.34.2021.10.07.09.17.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Oct 2021 09:17:59 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v4 09/23] target/i386/sev: Remove sev_get_me_mask() Date: Thu, 7 Oct 2021 18:17:02 +0200 Message-Id: <20211007161716.453984-10-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211007161716.453984-1-philmd@redhat.com> References: <20211007161716.453984-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=170.10.133.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.05, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Brijesh Singh , Eduardo Habkost , kvm@vger.kernel.org, "Michael S. Tsirkin" , Sergio Lopez , James Bottomley , "Dr. David Alan Gilbert" , Dov Murik , Connor Kuehl , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Unused dead code makes review harder, so remove it. Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Connor Kuehl Reviewed-by: Paolo Bonzini Signed-off-by: Philippe Mathieu-Daudé --- target/i386/sev_i386.h | 1 - target/i386/sev-stub.c | 5 ----- target/i386/sev.c | 9 --------- 3 files changed, 15 deletions(-) diff --git a/target/i386/sev_i386.h b/target/i386/sev_i386.h index 9bf6cd18789..d83428fa265 100644 --- a/target/i386/sev_i386.h +++ b/target/i386/sev_i386.h @@ -36,7 +36,6 @@ typedef struct SevKernelLoaderContext { } SevKernelLoaderContext; extern bool sev_es_enabled(void); -extern uint64_t sev_get_me_mask(void); extern SevInfo *sev_get_info(void); extern uint32_t sev_get_cbit_position(void); extern uint32_t sev_get_reduced_phys_bits(void); diff --git a/target/i386/sev-stub.c b/target/i386/sev-stub.c index 408441768dc..20b1e18ec1b 100644 --- a/target/i386/sev-stub.c +++ b/target/i386/sev-stub.c @@ -25,11 +25,6 @@ bool sev_enabled(void) return false; } -uint64_t sev_get_me_mask(void) -{ - return ~0; -} - uint32_t sev_get_cbit_position(void) { return 0; diff --git a/target/i386/sev.c b/target/i386/sev.c index 4f1952cd32f..9e3f2ec8dd3 100644 --- a/target/i386/sev.c +++ b/target/i386/sev.c @@ -65,7 +65,6 @@ struct SevGuestState { uint8_t api_major; uint8_t api_minor; uint8_t build_id; - uint64_t me_mask; int sev_fd; SevState state; gchar *measurement; @@ -389,12 +388,6 @@ sev_es_enabled(void) return sev_enabled() && (sev_guest->policy & SEV_POLICY_ES); } -uint64_t -sev_get_me_mask(void) -{ - return sev_guest ? sev_guest->me_mask : ~0; -} - uint32_t sev_get_cbit_position(void) { @@ -833,8 +826,6 @@ int sev_kvm_init(ConfidentialGuestSupport *cgs, Error **errp) goto err; } - sev->me_mask = ~(1UL << sev->cbitpos); - devname = object_property_get_str(OBJECT(sev), "sev-device", NULL); sev->sev_fd = open(devname, O_RDWR); if (sev->sev_fd < 0) { From patchwork Thu Oct 7 16:17:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 12542339 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B09ACC433EF for ; Thu, 7 Oct 2021 16:30:05 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4BA4D61245 for ; Thu, 7 Oct 2021 16:30:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 4BA4D61245 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:41106 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mYWHU-0001Dg-8h for qemu-devel@archiver.kernel.org; Thu, 07 Oct 2021 12:30:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47148) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mYW5z-0004ku-9l for qemu-devel@nongnu.org; Thu, 07 Oct 2021 12:18:11 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:59228) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mYW5x-000550-Hy for qemu-devel@nongnu.org; Thu, 07 Oct 2021 12:18:11 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633623488; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Yu0i8hmAoNBqKA56xVa0FWOHuPb3wa3Ay0pPJ2J6oOs=; b=HkyFXvC/TGng8TPcoJfsfVfXvBkSuPU5ytzQ4UHqUavtm5a29TieoY44UddczDQBEEYasy 3qT8aJ3W4c7RxlnGgBO6YEsv4tNdMk7zj6NrzerCsWxEff1YE2vZfWSCtbBYerdu/rEsL2 qzHvespJkWO8kHxpeXl6NzQnTzXKOA4= 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-467-QZW7TtxNPX-oonVk5gjHKA-1; Thu, 07 Oct 2021 12:18:06 -0400 X-MC-Unique: QZW7TtxNPX-oonVk5gjHKA-1 Received: by mail-wr1-f72.google.com with SMTP id h11-20020adfa4cb000000b00160c791a550so4943069wrb.6 for ; Thu, 07 Oct 2021 09:18:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Yu0i8hmAoNBqKA56xVa0FWOHuPb3wa3Ay0pPJ2J6oOs=; b=2JOXi4MpxFAFxaVSgJWrCCIWKonUMqL8QLOdNDpaj60mW4tsqEYoAPTUEeEdo4e9Hk 2oNWslQxhBGt6O6+3B20XWiWTYgr17XI5HrXc7QNvM44EgUOYfltIk/mjFpTiO/S5IoH M6pg9YqhtS5hNLE208wep5McRRT23UaiPWat7DJjqxEcRtIYB/M5u/pEUPHJXD5xpiaK 2o0Q1OKUEVE5jiEynMRxwkXDd9tS4hmaybmIsb9rWbqe2UlKCABYd+AZTPcYs2zbRKHF PBeMsij4kd5JmjuhyHNCVl+H9ay9oefDw1F3lv7oHJH0E+aESIoNzz5rW3uPFLoLaGyt evcQ== X-Gm-Message-State: AOAM531tz15kyX2dJrF4hk/nyZrAs4Y7ibkou6dljBsVphXRHLvixhUG 79bkYX3jtRXYzJDOErJeABdnbUTkIZCnlH3cp+/OhnejTameZmfXXNiG+SNB74nsiN5EmZUWhnw /f2DhBlBXk07mIvGgvvZbdZj0iJt5mGr5thl1zuUq6mTyF32JLUaj9jvZFCUqbhPW X-Received: by 2002:adf:bb08:: with SMTP id r8mr6741312wrg.247.1633623484758; Thu, 07 Oct 2021 09:18:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz1j54x6mkDDT5G+p886ML0TNkhiqQSJ77tctklrBToCqo96VSPVZB4HfWC67SFWx8EPKXHSw== X-Received: by 2002:adf:bb08:: with SMTP id r8mr6741267wrg.247.1633623484503; Thu, 07 Oct 2021 09:18:04 -0700 (PDT) Received: from x1w.redhat.com (118.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.118]) by smtp.gmail.com with ESMTPSA id u1sm8426658wmc.29.2021.10.07.09.18.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Oct 2021 09:18:04 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v4 10/23] target/i386/sev: Mark unreachable code with g_assert_not_reached() Date: Thu, 7 Oct 2021 18:17:03 +0200 Message-Id: <20211007161716.453984-11-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211007161716.453984-1-philmd@redhat.com> References: <20211007161716.453984-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.05, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Brijesh Singh , Eduardo Habkost , kvm@vger.kernel.org, "Michael S. Tsirkin" , Sergio Lopez , James Bottomley , "Dr. David Alan Gilbert" , Dov Murik , Connor Kuehl , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" The unique sev_encrypt_flash() invocation (in pc_system_flash_map) is protected by the "if (sev_enabled())" check, so is not reacheable. Replace the abort() call in sev_es_save_reset_vector() by g_assert_not_reached() which meaning is clearer. Reviewed-by: Connor Kuehl Reviewed-by: Paolo Bonzini Signed-off-by: Philippe Mathieu-Daudé --- target/i386/sev-stub.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/i386/sev-stub.c b/target/i386/sev-stub.c index 20b1e18ec1b..55f1ec74196 100644 --- a/target/i386/sev-stub.c +++ b/target/i386/sev-stub.c @@ -54,7 +54,7 @@ int sev_inject_launch_secret(const char *hdr, const char *secret, int sev_encrypt_flash(uint8_t *ptr, uint64_t len, Error **errp) { - return 0; + g_assert_not_reached(); } bool sev_es_enabled(void) @@ -68,7 +68,7 @@ void sev_es_set_reset_vector(CPUState *cpu) int sev_es_save_reset_vector(void *flash_ptr, uint64_t flash_size) { - abort(); + g_assert_not_reached(); } SevAttestationReport * From patchwork Thu Oct 7 16:17:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 12542347 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E60F6C433FE for ; Thu, 7 Oct 2021 16:34:06 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 85922610A1 for ; Thu, 7 Oct 2021 16:34:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 85922610A1 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:49654 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mYWLN-00073y-Kc for qemu-devel@archiver.kernel.org; Thu, 07 Oct 2021 12:34:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47160) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mYW65-0004vF-2j for qemu-devel@nongnu.org; Thu, 07 Oct 2021 12:18:17 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:22991) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mYW62-00057U-BJ for qemu-devel@nongnu.org; Thu, 07 Oct 2021 12:18:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633623492; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yEEZxUHWCMFJAaUbuJlVLcx9kbNHe4+tPDUcbMRvNgA=; b=C2/0brevDUV6v6RqoUi8CIOQPUSlOobQZ52RQXj4FPySnhna1uuuffbn0zyGEO7PSBgM+7 llfKtK26v/lXrv8jMNxco6MvzdtK2h+yYc6AWBQjNZ5DAbqsw2jo3rd4bTkSW6Y34SSGhr 9E9WDknxycTb1cvgwlMVQCQvvOd3CNk= 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-39-D4T1Ae1UPpuJa4xZnYRVEg-1; Thu, 07 Oct 2021 12:18:11 -0400 X-MC-Unique: D4T1Ae1UPpuJa4xZnYRVEg-1 Received: by mail-wr1-f71.google.com with SMTP id e12-20020a056000178c00b001606927de88so5114528wrg.10 for ; Thu, 07 Oct 2021 09:18:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=yEEZxUHWCMFJAaUbuJlVLcx9kbNHe4+tPDUcbMRvNgA=; b=6DKJ5FE29jznJQbgbAeS9TatR4MRZLGBbifTlJYYy9A/KlyU4kOFJ3ZvZMugKw0czZ OGVLPjZ4THCuZ+esHsNQa5We4qmPEQIiDknV8k++/WVzroNP4CRmEN8gYHKBHQjL3oU/ UKFDmoBP0IoV2dFMTpXv7PXa4/jl8SmoSvR6K3hX4yeRCHGiynveFVU+Lg93T87iZ3U3 CB0UlbenJjAhesq3x/DkBLh/rr/XhGjyT+AFi4xgCBJfeomsTL4sduTuGgrUxYYTfkwL MNzqgVSpPel5Zsrw+mzZtBIQvH5eEWIR/pOzt99qFZKiMwKqrFiFsi9dBpOAcoU769od 7HlA== X-Gm-Message-State: AOAM5320IC1oO+qdq2zzJ/TQbKnaDrhif+9xygKXOUlVhpFmujqqYg3W px6w/XlVDLQqvak0UBv4LPZrPIgpiY6BU2nr96B0nZKGyop8VMAs/2U9WaI+9xF/hbcx15Ts5zM tFOD1xY96Y6fwrdYo4s46+BxW7cckgi5KfY7h9EcS4rjNRprdNLcSykCOB0YdPmUo X-Received: by 2002:a1c:e90a:: with SMTP id q10mr5781393wmc.108.1633623489238; Thu, 07 Oct 2021 09:18:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxyp5Icsi0NLMXs/baHrjAWHmxKv/JAM8Pc+VahgSSp1ZOQcJVEBNNgny0Hxow6Cf8o/4Ee8g== X-Received: by 2002:a1c:e90a:: with SMTP id q10mr5781363wmc.108.1633623489052; Thu, 07 Oct 2021 09:18:09 -0700 (PDT) Received: from x1w.redhat.com (118.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.118]) by smtp.gmail.com with ESMTPSA id y23sm1025623wmj.42.2021.10.07.09.18.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Oct 2021 09:18:08 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v4 11/23] target/i386/sev: sev_get_attestation_report use g_autofree Date: Thu, 7 Oct 2021 18:17:04 +0200 Message-Id: <20211007161716.453984-12-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211007161716.453984-1-philmd@redhat.com> References: <20211007161716.453984-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=170.10.129.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.05, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_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 , Eduardo Habkost , kvm@vger.kernel.org, "Michael S. Tsirkin" , Sergio Lopez , James Bottomley , "Dr. David Alan Gilbert" , Dov Murik , Connor Kuehl , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Dr. David Alan Gilbert" Removes a whole bunch of g_free's and a goto. Signed-off-by: Dr. David Alan Gilbert Reviewed-by: Connor Kuehl Reviewed-by: Brijesh Singh Message-Id: <20210603113017.34922-1-dgilbert@redhat.com> Reviewed-by: Paolo Bonzini Signed-off-by: Philippe Mathieu-Daudé --- target/i386/sev.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/target/i386/sev.c b/target/i386/sev.c index 9e3f2ec8dd3..3a30ba6d94a 100644 --- a/target/i386/sev.c +++ b/target/i386/sev.c @@ -521,8 +521,8 @@ sev_get_attestation_report(const char *mnonce, Error **errp) struct kvm_sev_attestation_report input = {}; SevAttestationReport *report = NULL; SevGuestState *sev = sev_guest; - guchar *data; - guchar *buf; + g_autofree guchar *data = NULL; + g_autofree guchar *buf = NULL; gsize len; int err = 0, ret; @@ -542,7 +542,6 @@ sev_get_attestation_report(const char *mnonce, Error **errp) if (len != sizeof(input.mnonce)) { error_setg(errp, "SEV: mnonce must be %zu bytes (got %" G_GSIZE_FORMAT ")", sizeof(input.mnonce), len); - g_free(buf); return NULL; } @@ -554,7 +553,6 @@ sev_get_attestation_report(const char *mnonce, Error **errp) error_setg(errp, "SEV: Failed to query the attestation report" " length ret=%d fw_err=%d (%s)", ret, err, fw_error_to_str(err)); - g_free(buf); return NULL; } } @@ -569,7 +567,7 @@ sev_get_attestation_report(const char *mnonce, Error **errp) if (ret) { error_setg_errno(errp, errno, "SEV: Failed to get attestation report" " ret=%d fw_err=%d (%s)", ret, err, fw_error_to_str(err)); - goto e_free_data; + return NULL; } report = g_new0(SevAttestationReport, 1); @@ -577,9 +575,6 @@ sev_get_attestation_report(const char *mnonce, Error **errp) trace_kvm_sev_attestation_report(mnonce, report->data); -e_free_data: - g_free(data); - g_free(buf); return report; } From patchwork Thu Oct 7 16:17:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 12542327 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C07B1C433F5 for ; Thu, 7 Oct 2021 16:24:35 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5577F61074 for ; Thu, 7 Oct 2021 16:24:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 5577F61074 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:56592 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mYWCA-00014M-J8 for qemu-devel@archiver.kernel.org; Thu, 07 Oct 2021 12:24:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47182) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mYW68-0004yg-EG for qemu-devel@nongnu.org; Thu, 07 Oct 2021 12:18:20 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:35370) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mYW65-0005Ba-T6 for qemu-devel@nongnu.org; Thu, 07 Oct 2021 12:18:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633623497; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MMQ6iAvCxwnURglpVB4IW0fu5BXcN7B4HeGKo8BxsN0=; b=BylBhbZXgIRTpXQRTHLDpkyXj2/B+Tos0ufFj0PNtstPew9RP/7uMBTw6NKRwOEnsJC1/9 G3Ln5/y0TF3uqMmaJgO77tezYRaySPKbEbw7qWL1Fu4WhFkooJ0cFq1IdraWfsBIxpwB4x RZoUxfB08octcOk9TZx0/8683igJ7no= 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-469-44n72tAtPN26h7kgkKYZ9A-1; Thu, 07 Oct 2021 12:18:16 -0400 X-MC-Unique: 44n72tAtPN26h7kgkKYZ9A-1 Received: by mail-wr1-f72.google.com with SMTP id d13-20020adfa34d000000b00160aa1cc5f1so5119066wrb.14 for ; Thu, 07 Oct 2021 09:18:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=MMQ6iAvCxwnURglpVB4IW0fu5BXcN7B4HeGKo8BxsN0=; b=pbERvTaeu6m8sCaHyjc52etKCFPCEFn0q7gx8SaRxKD5/lsEFZD69ImZ0yG4CbsJpS fbZL+hq0yVQ647kfmVclApMp7uuHNRPNQhhb/Y+B2BLhLmtdjiydGNd9oHLnQfHkEgU6 t7hhUOUkyBQThtWbdRX9ZBdP1g0bp83SqZYhnKYN5vdmrYxkYctfcPmD/HnM4aj/I0Y7 ySYowGZjEHIP+Ii1z185pphEzQTnIyxdSY0zCwaeOPIO6iFwuF/wzTtYqoMttXuT/RXj ApSq9lfzjDmsobC/I94E5/2+/0BhQfp3Gcplz4ipKZQDI+RSi86zrj4rqXTs+rjoyHDI fpOw== X-Gm-Message-State: AOAM531Bp7DVOTUSDDySpskeKsTKDAP5esxaeRNBdou4xkG5XwJcIbgw 6SPennB5ap7QHA1V36RHz2HCvrRwQ/eAA6Hm1XCTfd4lIAGb9CR1KLYClasEoP4CrkvnxFXzaM1 bKX1j8tzq1p2umbMXXW40+NCYosat62W7bIMV/QGvtGwp+NIOgb1vcQXEF8uvEW6H X-Received: by 2002:a1c:9857:: with SMTP id a84mr17228558wme.28.1633623493662; Thu, 07 Oct 2021 09:18:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy8ZfB3bnXzEPGWYDhd6PuaST01yQ2MZwVDhjZw+EgLXq2/Mov1UPnSHQG5FosvLqV9SCfneQ== X-Received: by 2002:a1c:9857:: with SMTP id a84mr17228508wme.28.1633623493502; Thu, 07 Oct 2021 09:18:13 -0700 (PDT) Received: from x1w.redhat.com (118.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.118]) by smtp.gmail.com with ESMTPSA id 1sm9454040wmb.24.2021.10.07.09.18.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Oct 2021 09:18:13 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v4 12/23] target/i386/sev: Use g_autofree in sev_launch_get_measure() Date: Thu, 7 Oct 2021 18:17:05 +0200 Message-Id: <20211007161716.453984-13-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211007161716.453984-1-philmd@redhat.com> References: <20211007161716.453984-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.05, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Brijesh Singh , Eduardo Habkost , kvm@vger.kernel.org, "Michael S. Tsirkin" , Sergio Lopez , James Bottomley , "Dr. David Alan Gilbert" , Dov Murik , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Use g_autofree to remove a pair of g_free/goto. Signed-off-by: Philippe Mathieu-Daudé --- target/i386/sev.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/target/i386/sev.c b/target/i386/sev.c index 3a30ba6d94a..5cbbcf0bb93 100644 --- a/target/i386/sev.c +++ b/target/i386/sev.c @@ -685,8 +685,8 @@ sev_launch_get_measure(Notifier *notifier, void *unused) { SevGuestState *sev = sev_guest; int ret, error; - guchar *data; - struct kvm_sev_launch_measure *measurement; + g_autofree guchar *data = NULL; + g_autofree struct kvm_sev_launch_measure *measurement = NULL; if (!sev_check_state(sev, SEV_STATE_LAUNCH_UPDATE)) { return; @@ -708,7 +708,7 @@ sev_launch_get_measure(Notifier *notifier, void *unused) if (!measurement->len) { error_report("%s: LAUNCH_MEASURE ret=%d fw_error=%d '%s'", __func__, ret, error, fw_error_to_str(errno)); - goto free_measurement; + return; } data = g_new0(guchar, measurement->len); @@ -720,7 +720,7 @@ sev_launch_get_measure(Notifier *notifier, void *unused) if (ret) { error_report("%s: LAUNCH_MEASURE ret=%d fw_error=%d '%s'", __func__, ret, error, fw_error_to_str(errno)); - goto free_data; + return; } sev_set_guest_state(sev, SEV_STATE_LAUNCH_SECRET); @@ -728,11 +728,6 @@ sev_launch_get_measure(Notifier *notifier, void *unused) /* encode the measurement value and emit the event */ sev->measurement = g_base64_encode(data, measurement->len); trace_kvm_sev_launch_measurement(sev->measurement); - -free_data: - g_free(data); -free_measurement: - g_free(measurement); } char * From patchwork Thu Oct 7 16:17:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 12542351 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 86F6EC433F5 for ; Thu, 7 Oct 2021 16:37:34 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2F07961090 for ; Thu, 7 Oct 2021 16:37:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 2F07961090 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:58306 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mYWOj-0004Z8-8K for qemu-devel@archiver.kernel.org; Thu, 07 Oct 2021 12:37:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47208) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mYW6B-00052l-OM for qemu-devel@nongnu.org; Thu, 07 Oct 2021 12:18:24 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:25647) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mYW69-0005Df-Da for qemu-devel@nongnu.org; Thu, 07 Oct 2021 12:18:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633623500; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=89V0d1PNFsuCxWRiRzeXMO8a63XAoQ+evMckrwIv15E=; b=U8EK2I0v6c1EzTw2OovbpOkeMbbmfVl6eKv73reS+0OqZFKm5hWddsFZG1omkLrNr0aGZz vxLxBeOPMalF4UpoEySU3CRaJYDoC1Z5bYUDee6/zxUuZQx8ZXExwc5EIerzbGcxkTLvi7 qPN8cwbasduumKVIqOBHJaawm8E0VbQ= 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-35-1_zl6fDuPEyEmaZSR2c-sg-1; Thu, 07 Oct 2021 12:18:19 -0400 X-MC-Unique: 1_zl6fDuPEyEmaZSR2c-sg-1 Received: by mail-wr1-f69.google.com with SMTP id p12-20020adfc38c000000b00160d6a7e293so2633528wrf.18 for ; Thu, 07 Oct 2021 09:18:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=89V0d1PNFsuCxWRiRzeXMO8a63XAoQ+evMckrwIv15E=; b=iTU+PtXt7noYc34UfjNQNvyBGRJzTnALnismyplUitn+/6CvNMuzOSCpa1LO+m1gde HWEkCRlSFMmqVMgkqMHGx6UYkgrW/aNvus2NEnjgmUmWxNvDHCj4l3E0ScJMbDI6Oc6Y KtqojIe1L4Sc1y7Z1kWBp/G4h0aXNJyEKOjFgW3dfG+9rMGIH2dbJKY54i986jDhOEpi BOk3yZ7+62jvRkW4k7O6Ec8Pxva9GtUp8D+vfaRKoC9KJfd4XQm8nFA5lKmACQPp1Mo2 GZJMs6PY+mTbOxRDpXtx7/PaRM4zvoKEzSrevVvtBurw5LA4/9zRcFJNKhV0vGhL3HXV +aKA== X-Gm-Message-State: AOAM533Y1prrthVPkZgzpWwF8lVBgEtL2KexRXIPWOYBg3cygXI4pD84 eTHByTJ7wLQfaVDAnrgP41JVO4GT5zhrqoqoX3nNbvZpcnfrD+h7qwM69XCtUdQovPyxx5+yg0k w+Rqd63yDdHeJAuO1kyXFAJn06a2OaU4MKB7v+hsdLdTyLPg9BjisLoFMXvnxdd3M X-Received: by 2002:a1c:2:: with SMTP id 2mr17491493wma.87.1633623498493; Thu, 07 Oct 2021 09:18:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJybbjnGgx9aPwaHiTsiUUeAUcDEXJV3VetZXPeXIxDRjX+nW5gqW/S5HCcW3+GX4C5xkS0GDg== X-Received: by 2002:a1c:2:: with SMTP id 2mr17491444wma.87.1633623498131; Thu, 07 Oct 2021 09:18:18 -0700 (PDT) Received: from x1w.redhat.com (118.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.118]) by smtp.gmail.com with ESMTPSA id c5sm9181006wml.9.2021.10.07.09.18.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Oct 2021 09:18:17 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v4 13/23] target/i386/sev: Restrict SEV to system emulation Date: Thu, 7 Oct 2021 18:17:06 +0200 Message-Id: <20211007161716.453984-14-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211007161716.453984-1-philmd@redhat.com> References: <20211007161716.453984-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=170.10.129.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.05, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_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 , Eduardo Habkost , kvm@vger.kernel.org, "Michael S. Tsirkin" , Sergio Lopez , James Bottomley , "Dr. David Alan Gilbert" , Dov Murik , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" SEV is irrelevant on user emulation, so restrict it to sysemu. Some stubs are still required because used in cpu.c by x86_register_cpudef_types(), so move the sysemu specific stubs to sev-sysemu-stub.c instead. This will allow us to simplify monitor.c (which is not available in user emulation) in the next commit. Reviewed-by: Paolo Bonzini Signed-off-by: Philippe Mathieu-Daudé --- target/i386/sev-stub.c | 43 ------------------------- target/i386/sev-sysemu-stub.c | 60 +++++++++++++++++++++++++++++++++++ target/i386/meson.build | 4 ++- 3 files changed, 63 insertions(+), 44 deletions(-) create mode 100644 target/i386/sev-sysemu-stub.c diff --git a/target/i386/sev-stub.c b/target/i386/sev-stub.c index 55f1ec74196..170e9f50fee 100644 --- a/target/i386/sev-stub.c +++ b/target/i386/sev-stub.c @@ -15,11 +15,6 @@ #include "qapi/error.h" #include "sev_i386.h" -SevInfo *sev_get_info(void) -{ - return NULL; -} - bool sev_enabled(void) { return false; @@ -35,49 +30,11 @@ uint32_t sev_get_reduced_phys_bits(void) return 0; } -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; -} - bool sev_add_kernel_loader_hashes(SevKernelLoaderContext *ctx, Error **errp) { g_assert_not_reached(); diff --git a/target/i386/sev-sysemu-stub.c b/target/i386/sev-sysemu-stub.c new file mode 100644 index 00000000000..d556b4f091f --- /dev/null +++ b/target/i386/sev-sysemu-stub.c @@ -0,0 +1,60 @@ +/* + * QEMU SEV system stub + * + * Copyright Advanced Micro Devices 2018 + * + * Authors: + * Brijesh Singh + * + * This work is licensed under the terms of the GNU GPL, version 2 or later. + * See the COPYING file in the top-level directory. + * + */ + +#include "qemu/osdep.h" +#include "qapi/qapi-commands-misc-target.h" +#include "qapi/error.h" +#include "sev_i386.h" + +SevInfo *sev_get_info(void) +{ + return NULL; +} + +char *sev_get_launch_measurement(void) +{ + return NULL; +} + +SevCapability *sev_get_capabilities(Error **errp) +{ + error_setg(errp, "SEV is not available in this QEMU"); + return NULL; +} + +int sev_inject_launch_secret(const char *hdr, const char *secret, + uint64_t gpa, Error **errp) +{ + return 1; +} + +int sev_encrypt_flash(uint8_t *ptr, uint64_t len, Error **errp) +{ + g_assert_not_reached(); +} + +void sev_es_set_reset_vector(CPUState *cpu) +{ +} + +int sev_es_save_reset_vector(void *flash_ptr, uint64_t flash_size) +{ + g_assert_not_reached(); +} + +SevAttestationReport *sev_get_attestation_report(const char *mnonce, + Error **errp) +{ + error_setg(errp, "SEV is not available in this QEMU"); + return NULL; +} diff --git a/target/i386/meson.build b/target/i386/meson.build index dac19ec00d4..a4f45c3ec1d 100644 --- a/target/i386/meson.build +++ b/target/i386/meson.build @@ -6,7 +6,7 @@ 'xsave_helper.c', 'cpu-dump.c', )) -i386_ss.add(when: 'CONFIG_SEV', if_true: files('host-cpu.c', 'sev.c'), if_false: files('sev-stub.c')) +i386_ss.add(when: 'CONFIG_SEV', if_true: files('host-cpu.c'), if_false: files('sev-stub.c')) # x86 cpu type i386_ss.add(when: 'CONFIG_KVM', if_true: files('host-cpu.c')) @@ -20,6 +20,8 @@ 'monitor.c', 'cpu-sysemu.c', )) +i386_softmmu_ss.add(when: 'CONFIG_SEV', if_true: files('sev.c'), if_false: files('sev-sysemu-stub.c')) + i386_user_ss = ss.source_set() subdir('kvm') From patchwork Thu Oct 7 16:17:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 12542333 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1C2CEC433EF for ; Thu, 7 Oct 2021 16:27:40 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9C08A61074 for ; Thu, 7 Oct 2021 16:27:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 9C08A61074 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:35702 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mYWF8-000613-PC for qemu-devel@archiver.kernel.org; Thu, 07 Oct 2021 12:27:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47232) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mYW6G-00054t-0U for qemu-devel@nongnu.org; Thu, 07 Oct 2021 12:18:28 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:35778) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mYW6E-0005IK-9M for qemu-devel@nongnu.org; Thu, 07 Oct 2021 12:18:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633623505; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NtntxYjzk/c/tBnUjs6wx6H836yPN9/32v9yVgz+JmI=; b=QQU6WV8iv3GO9mFbzedap0hOlQCiI4Yy8UMD88eyjc4u2mwfzns3mM4/0Vhj6Wo89MC3vD 035HsxLBtWHpolxQQ3AHnDJ0nHm34dugNiLMh4o4OweEWxucYLCxjloCAmR5V0wPXtdcUe bn/qI4WQzDO8IYdLOXRW47sdben12lc= 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-268-gvXUHGMJOrq4GJ1WReP7oA-1; Thu, 07 Oct 2021 12:18:24 -0400 X-MC-Unique: gvXUHGMJOrq4GJ1WReP7oA-1 Received: by mail-wr1-f72.google.com with SMTP id d13-20020adf9b8d000000b00160a94c235aso5130891wrc.2 for ; Thu, 07 Oct 2021 09:18:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=NtntxYjzk/c/tBnUjs6wx6H836yPN9/32v9yVgz+JmI=; b=Hh/0CrBU3lUYck5qPzzeHTBRk+iwtTsr+zgfqX2mgQqR9UqWdg8nHWavCVpWIaXdcM NV7s5zoLt/VwOIB7hHU2+pC0YBNWMpMwvqo0i/1fvHb3UQJHASiRRC4/bZMYBHDoUSVN MyAbUrnBRx6ffcUwyvs+N87d2VFy2sZL3GcQUTHRumJ1H/qVTdk95DQqoY5ErdwlypLz Og6TAqap8oYEOtFC+r0YSkHxNamGKlDnLjPloon3PTR3WvA2rz4nLj3BOA7xZCPA9Tfe DqrOVO24Nly1jrFW8QRG1SAfggn+fn6AJnsOO1K8ID55sEdm60xKlzyHzgrcmc/7HQek EIsg== X-Gm-Message-State: AOAM5310CNSINdeRvbGXRVlJrfIAN3lAS0N5flBgrjjWulCydxd1SftQ zplNM+fm3FrpItFfBzT4HqSeydC51wPnZDebqDJwd1fL5GM3JAZUwu96GBMt3moqWFXHzQttG4c fIH1mHNIBMeaUJPWk5AXDgP9dgN2+42r6i/vjbQPommImXtl5hdCFaX9ZKy4YtIar X-Received: by 2002:a05:600c:2057:: with SMTP id p23mr5628916wmg.67.1633623502879; Thu, 07 Oct 2021 09:18:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzbpkjWZoIcEo8CCNOMP08Kf3tAZlemKrKuxafvy6AWFRjok6953SFiC/moJkDRbEWcDARxSQ== X-Received: by 2002:a05:600c:2057:: with SMTP id p23mr5628876wmg.67.1633623502591; Thu, 07 Oct 2021 09:18:22 -0700 (PDT) Received: from x1w.redhat.com (118.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.118]) by smtp.gmail.com with ESMTPSA id v10sm93782wri.29.2021.10.07.09.18.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Oct 2021 09:18:22 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v4 14/23] target/i386/sev: Rename sev_i386.h -> sev.h Date: Thu, 7 Oct 2021 18:17:07 +0200 Message-Id: <20211007161716.453984-15-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211007161716.453984-1-philmd@redhat.com> References: <20211007161716.453984-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=170.10.133.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.05, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Brijesh Singh , Eduardo Habkost , kvm@vger.kernel.org, "Michael S. Tsirkin" , Sergio Lopez , James Bottomley , "Dr. David Alan Gilbert" , Dov Murik , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" SEV is a x86 specific feature, and the "sev_i386.h" header is already in target/i386/. Rename it as "sev.h" to simplify. Patch created mechanically using: $ git mv target/i386/sev_i386.h target/i386/sev.h $ sed -i s/sev_i386.h/sev.h/ $(git grep -l sev_i386.h) Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Dr. David Alan Gilbert --- target/i386/{sev_i386.h => sev.h} | 0 hw/i386/x86.c | 2 +- target/i386/cpu.c | 2 +- target/i386/kvm/kvm.c | 2 +- target/i386/monitor.c | 2 +- target/i386/sev-stub.c | 2 +- target/i386/sev-sysemu-stub.c | 2 +- target/i386/sev.c | 2 +- 8 files changed, 7 insertions(+), 7 deletions(-) rename target/i386/{sev_i386.h => sev.h} (100%) diff --git a/target/i386/sev_i386.h b/target/i386/sev.h similarity index 100% rename from target/i386/sev_i386.h rename to target/i386/sev.h diff --git a/hw/i386/x86.c b/hw/i386/x86.c index 0c7c054e3a0..76de7e2265e 100644 --- a/hw/i386/x86.c +++ b/hw/i386/x86.c @@ -47,7 +47,7 @@ #include "hw/i386/fw_cfg.h" #include "hw/intc/i8259.h" #include "hw/rtc/mc146818rtc.h" -#include "target/i386/sev_i386.h" +#include "target/i386/sev.h" #include "hw/acpi/cpu_hotplug.h" #include "hw/irq.h" diff --git a/target/i386/cpu.c b/target/i386/cpu.c index b54b98551e9..8289dc87bd5 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -26,7 +26,7 @@ #include "sysemu/reset.h" #include "sysemu/hvf.h" #include "kvm/kvm_i386.h" -#include "sev_i386.h" +#include "sev.h" #include "qapi/error.h" #include "qapi/qapi-visit-machine.h" #include "qapi/qmp/qerror.h" diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c index f25837f63f4..a5f6ff63c81 100644 --- a/target/i386/kvm/kvm.c +++ b/target/i386/kvm/kvm.c @@ -28,7 +28,7 @@ #include "sysemu/kvm_int.h" #include "sysemu/runstate.h" #include "kvm_i386.h" -#include "sev_i386.h" +#include "sev.h" #include "hyperv.h" #include "hyperv-proto.h" diff --git a/target/i386/monitor.c b/target/i386/monitor.c index ea836678f51..109e4e61c0a 100644 --- a/target/i386/monitor.c +++ b/target/i386/monitor.c @@ -32,7 +32,7 @@ #include "sysemu/kvm.h" #include "sysemu/sev.h" #include "qapi/error.h" -#include "sev_i386.h" +#include "sev.h" #include "qapi/qapi-commands-misc-target.h" #include "qapi/qapi-commands-misc.h" #include "hw/i386/pc.h" diff --git a/target/i386/sev-stub.c b/target/i386/sev-stub.c index 170e9f50fee..7e8b6f9a259 100644 --- a/target/i386/sev-stub.c +++ b/target/i386/sev-stub.c @@ -13,7 +13,7 @@ #include "qemu/osdep.h" #include "qapi/error.h" -#include "sev_i386.h" +#include "sev.h" bool sev_enabled(void) { diff --git a/target/i386/sev-sysemu-stub.c b/target/i386/sev-sysemu-stub.c index d556b4f091f..8082781febf 100644 --- a/target/i386/sev-sysemu-stub.c +++ b/target/i386/sev-sysemu-stub.c @@ -14,7 +14,7 @@ #include "qemu/osdep.h" #include "qapi/qapi-commands-misc-target.h" #include "qapi/error.h" -#include "sev_i386.h" +#include "sev.h" SevInfo *sev_get_info(void) { diff --git a/target/i386/sev.c b/target/i386/sev.c index 5cbbcf0bb93..e43bbf3a17d 100644 --- a/target/i386/sev.c +++ b/target/i386/sev.c @@ -25,7 +25,7 @@ #include "qemu/uuid.h" #include "crypto/hash.h" #include "sysemu/kvm.h" -#include "sev_i386.h" +#include "sev.h" #include "sysemu/sysemu.h" #include "sysemu/runstate.h" #include "trace.h" From patchwork Thu Oct 7 16:17:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 12542361 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1442EC433F5 for ; Thu, 7 Oct 2021 16:39:27 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8DA0861090 for ; Thu, 7 Oct 2021 16:39:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 8DA0861090 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:37068 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mYWQX-0000wD-Op for qemu-devel@archiver.kernel.org; Thu, 07 Oct 2021 12:39:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47244) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mYW6M-0005AW-FQ for qemu-devel@nongnu.org; Thu, 07 Oct 2021 12:18:34 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:33595) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mYW6J-0005Mq-QT for qemu-devel@nongnu.org; Thu, 07 Oct 2021 12:18:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633623511; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lGxIOiDkjtO7lLXCNUhDroR/93vYB4x6AaMAet+1gIs=; b=UC0orvLe8RgcZ1RUB/nCtphFqKEfmTTkx8i8SuleeOTjPqxYYs39eVk0+Jyn5L9lfompp9 z8a6KpZZpTFf/ID3YdHoxAF8sX27pznPNJSauyW5vc4d19tqNW4XNPp9SObqoMej+45qoQ 0EBnygYU93r+w80P1y+3menJ4B9/+Vk= 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-48-jfyhUZXBNIKVfkvHS2QXlQ-1; Thu, 07 Oct 2021 12:18:30 -0400 X-MC-Unique: jfyhUZXBNIKVfkvHS2QXlQ-1 Received: by mail-wr1-f71.google.com with SMTP id y12-20020a056000168c00b00160da4de2c7so2033648wrd.5 for ; Thu, 07 Oct 2021 09:18:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=lGxIOiDkjtO7lLXCNUhDroR/93vYB4x6AaMAet+1gIs=; b=wTC79br7HuDIG3bF/HusH3CEeNkGoX3ni7DdINjDIPHEppgawIaW8GqKI6muCACHaI RjcWuWJThJfvyNSildQE3GCSyV1GPNOEhLYEd0/ZUZc+rcFzlo6UFiRffqJ2Pdq4L/g0 +N6DHLuGVpd4RUqX3/OFC8CK/1Z5chdIVZlPdGgBYuH+iS+iT58XjDdQ2NPuX5TeU/1Q Wa0TA4IlO4NC2wexjDZ/NUMSXEIqlNzaKQjXWnHrxR8qMDEP/deZKAAzIN4EKl7rMaJj Bl2/cKeid0HiD7XWaMuSVpIubo1P4CCqDPxX89kcV9G+h8dkKjR3iR7p8J0n6Jl7dk8/ GOAw== X-Gm-Message-State: AOAM532T7JwXERL8ghFb47tIJ+NOkPnXlqHNFJ/MBKbJareJy/4VPCd+ hAuPnVklC7DIoP96+YZbEIyT1bA9OcJz8rFTY60hKWZUakgrYr2wIszYpgGNXQk5xv3dy+uJOfW 4wV07tLdZUUChzBp4NzJgQfnjo6M0rCR8IOB96WhtGmOU78wuelu8zXJ7jVLq44Zb X-Received: by 2002:a05:6000:18a3:: with SMTP id b3mr6651405wri.178.1633623507286; Thu, 07 Oct 2021 09:18:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxGxFUSQBIuymUcqyNofEv5FzSKPyuPr7MuNzby3hK9l903zkFHngcL71AixMMoIYrkPVrZ9w== X-Received: by 2002:a05:6000:18a3:: with SMTP id b3mr6651373wri.178.1633623507093; Thu, 07 Oct 2021 09:18:27 -0700 (PDT) Received: from x1w.redhat.com (118.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.118]) by smtp.gmail.com with ESMTPSA id v185sm4584081wme.35.2021.10.07.09.18.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Oct 2021 09:18:26 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v4 15/23] target/i386/sev: Declare system-specific functions in 'sev.h' Date: Thu, 7 Oct 2021 18:17:08 +0200 Message-Id: <20211007161716.453984-16-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211007161716.453984-1-philmd@redhat.com> References: <20211007161716.453984-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=170.10.133.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.05, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Brijesh Singh , Eduardo Habkost , kvm@vger.kernel.org, "Michael S. Tsirkin" , Sergio Lopez , James Bottomley , "Dr. David Alan Gilbert" , Dov Murik , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" "sysemu/sev.h" is only used from x86-specific files. Let's move it to include/hw/i386, and merge it with target/i386/sev.h. Suggested-by: Paolo Bonzini Reviewed-by: Paolo Bonzini Signed-off-by: Philippe Mathieu-Daudé --- include/sysemu/sev.h | 28 ---------------------------- target/i386/sev.h | 12 +++++++++++- hw/i386/pc_sysfw.c | 2 +- target/i386/kvm/kvm.c | 1 - target/i386/kvm/sev-stub.c | 2 +- target/i386/monitor.c | 1 - 6 files changed, 13 insertions(+), 33 deletions(-) delete mode 100644 include/sysemu/sev.h diff --git a/include/sysemu/sev.h b/include/sysemu/sev.h deleted file mode 100644 index 94d821d737c..00000000000 --- a/include/sysemu/sev.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * QEMU Secure Encrypted Virutualization (SEV) support - * - * Copyright: Advanced Micro Devices, 2016-2018 - * - * Authors: - * Brijesh Singh - * - * This work is licensed under the terms of the GNU GPL, version 2 or later. - * See the COPYING file in the top-level directory. - * - */ - -#ifndef QEMU_SEV_H -#define QEMU_SEV_H - -#include "sysemu/kvm.h" - -bool sev_enabled(void); -int sev_kvm_init(ConfidentialGuestSupport *cgs, Error **errp); -int sev_encrypt_flash(uint8_t *ptr, uint64_t len, Error **errp); -int sev_inject_launch_secret(const char *hdr, const char *secret, - uint64_t gpa, Error **errp); - -int sev_es_save_reset_vector(void *flash_ptr, uint64_t flash_size); -void sev_es_set_reset_vector(CPUState *cpu); - -#endif diff --git a/target/i386/sev.h b/target/i386/sev.h index d83428fa265..c96072bf78d 100644 --- a/target/i386/sev.h +++ b/target/i386/sev.h @@ -14,7 +14,7 @@ #ifndef QEMU_SEV_I386_H #define QEMU_SEV_I386_H -#include "sysemu/sev.h" +#include "exec/confidential-guest-support.h" #include "qapi/qapi-types-misc-target.h" #define SEV_POLICY_NODBG 0x1 @@ -35,6 +35,7 @@ typedef struct SevKernelLoaderContext { size_t cmdline_size; } SevKernelLoaderContext; +bool sev_enabled(void); extern bool sev_es_enabled(void); extern SevInfo *sev_get_info(void); extern uint32_t sev_get_cbit_position(void); @@ -45,4 +46,13 @@ extern SevAttestationReport * sev_get_attestation_report(const char *mnonce, Error **errp); extern bool sev_add_kernel_loader_hashes(SevKernelLoaderContext *ctx, Error **errp); +int sev_encrypt_flash(uint8_t *ptr, uint64_t len, Error **errp); +int sev_inject_launch_secret(const char *hdr, const char *secret, + uint64_t gpa, Error **errp); + +int sev_es_save_reset_vector(void *flash_ptr, uint64_t flash_size); +void sev_es_set_reset_vector(CPUState *cpu); + +int sev_kvm_init(ConfidentialGuestSupport *cgs, Error **errp); + #endif diff --git a/hw/i386/pc_sysfw.c b/hw/i386/pc_sysfw.c index 68d6b1f783e..c8b17af9535 100644 --- a/hw/i386/pc_sysfw.c +++ b/hw/i386/pc_sysfw.c @@ -37,7 +37,7 @@ #include "hw/qdev-properties.h" #include "hw/block/flash.h" #include "sysemu/kvm.h" -#include "sysemu/sev.h" +#include "sev.h" #define FLASH_SECTOR_SIZE 4096 diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c index a5f6ff63c81..0eb7a0340cf 100644 --- a/target/i386/kvm/kvm.c +++ b/target/i386/kvm/kvm.c @@ -44,7 +44,6 @@ #include "hw/i386/intel_iommu.h" #include "hw/i386/x86-iommu.h" #include "hw/i386/e820_memory_layout.h" -#include "sysemu/sev.h" #include "hw/pci/pci.h" #include "hw/pci/msi.h" diff --git a/target/i386/kvm/sev-stub.c b/target/i386/kvm/sev-stub.c index 9587d1b2a31..6080c007a2e 100644 --- a/target/i386/kvm/sev-stub.c +++ b/target/i386/kvm/sev-stub.c @@ -13,7 +13,7 @@ #include "qemu/osdep.h" #include "qemu-common.h" -#include "sysemu/sev.h" +#include "sev.h" int sev_kvm_init(ConfidentialGuestSupport *cgs, Error **errp) { diff --git a/target/i386/monitor.c b/target/i386/monitor.c index 109e4e61c0a..935a8ee8ca4 100644 --- a/target/i386/monitor.c +++ b/target/i386/monitor.c @@ -30,7 +30,6 @@ #include "qapi/qmp/qdict.h" #include "qapi/qmp/qerror.h" #include "sysemu/kvm.h" -#include "sysemu/sev.h" #include "qapi/error.h" #include "sev.h" #include "qapi/qapi-commands-misc-target.h" From patchwork Thu Oct 7 16:17:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 12542331 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 11DD7C433FE for ; Thu, 7 Oct 2021 16:27:06 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 99EA460FE3 for ; Thu, 7 Oct 2021 16:27:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 99EA460FE3 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:34314 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mYWEa-00052w-Q5 for qemu-devel@archiver.kernel.org; Thu, 07 Oct 2021 12:27:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47260) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mYW6O-0005Kf-JM for qemu-devel@nongnu.org; Thu, 07 Oct 2021 12:18:36 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:35966) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mYW6M-0005PD-O0 for qemu-devel@nongnu.org; Thu, 07 Oct 2021 12:18:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633623514; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=avS7dA1xbWdOVEvDf5GxDqun22mmkWzrjGDOVnO4aN8=; b=TLfgnurrfuxpPWFtSWOHh+VTGr6qABHHC8cO/stUON2313pWYI9oBvphXlT9Vp3mokOj1B 8OnVuJEFbXlZvFAZH5ovOJpI5ZMT51OGGVkLmUjsRsZtSroL8d5E0QnRAm2rJXGbE7qzkZ /ibbTTQTK38oewE9ltjGe+to2zhFDzo= 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-171-JVFbV8ThOiqiEYDd7EjmYQ-1; Thu, 07 Oct 2021 12:18:33 -0400 X-MC-Unique: JVFbV8ThOiqiEYDd7EjmYQ-1 Received: by mail-wr1-f69.google.com with SMTP id r16-20020adfbb10000000b00160958ed8acso5118391wrg.16 for ; Thu, 07 Oct 2021 09:18:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=avS7dA1xbWdOVEvDf5GxDqun22mmkWzrjGDOVnO4aN8=; b=ESC5Pvv47idL9ULov51rRbLAHJD4VsyN139wnhNBMHBXcODCx/Hpii/Dlh+Dpom7Ae c+ND9FR7BXz0QYj6w/UvnKz/3Pr+iyKhidVk90h8ITSOvK/jM0heyNWn8fKYK7iMpUJ+ SZzlA2AT1eFYm597gntbvWLqrmrJE4yB+/wNcyYIp16i3aCX5nHfCAc4zsJ20rCrgxoX bPfISnXufXeGQupegaTA7mtE87Fth2o9wRz/cF9zBmqSuVmoe7pu9OqP4sB4DOpjYPnB CqtRJndtphPLpJfV/9aMWrSC7FvKiBg1wkKjKwuM0KYr662jyXZyUy2pWU9+Dou43nkf +Ojg== X-Gm-Message-State: AOAM530VrSgGosyMxYC3087PAVBTSz4xVyR3WooPb2TIAeCeW3nknTH6 pslqAotfWoSTGUU9tzc0ufy/0V+XN51ChKF2ZZqC9l2Pyoo+QwB/Ki7Li29LVFMffHAVEaZErBo DzjdjWAaSuC8h1WTCfHvzGynfoUxNAzuARzHZx1IydzcdQYUqH+sJlSVpRlblekH8 X-Received: by 2002:adf:a550:: with SMTP id j16mr6790562wrb.180.1633623511779; Thu, 07 Oct 2021 09:18:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyiNFDP2mIfyzBdX6qysBlWdROekH+j9h8XYmdGma4KNZrh1RRhjU928Fdh1xrhu6HNRCOYpw== X-Received: by 2002:adf:a550:: with SMTP id j16mr6790510wrb.180.1633623511460; Thu, 07 Oct 2021 09:18:31 -0700 (PDT) Received: from x1w.redhat.com (118.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.118]) by smtp.gmail.com with ESMTPSA id q3sm19131wmc.25.2021.10.07.09.18.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Oct 2021 09:18:31 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v4 16/23] target/i386/sev: Remove stubs by using code elision Date: Thu, 7 Oct 2021 18:17:09 +0200 Message-Id: <20211007161716.453984-17-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211007161716.453984-1-philmd@redhat.com> References: <20211007161716.453984-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.05, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Brijesh Singh , Eduardo Habkost , kvm@vger.kernel.org, "Michael S. Tsirkin" , Sergio Lopez , James Bottomley , "Dr. David Alan Gilbert" , Dov Murik , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Only declare sev_enabled() and sev_es_enabled() when CONFIG_SEV is set, to allow the compiler to elide unused code. Remove unnecessary stubs. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Eric Blake --- target/i386/sev.h | 14 ++++++++++++-- target/i386/cpu.c | 13 +++++++------ target/i386/sev-stub.c | 41 ----------------------------------------- target/i386/meson.build | 2 +- 4 files changed, 20 insertions(+), 50 deletions(-) delete mode 100644 target/i386/sev-stub.c diff --git a/target/i386/sev.h b/target/i386/sev.h index c96072bf78d..d9548e3e642 100644 --- a/target/i386/sev.h +++ b/target/i386/sev.h @@ -14,6 +14,10 @@ #ifndef QEMU_SEV_I386_H #define QEMU_SEV_I386_H +#ifndef CONFIG_USER_ONLY +#include CONFIG_DEVICES /* CONFIG_SEV */ +#endif + #include "exec/confidential-guest-support.h" #include "qapi/qapi-types-misc-target.h" @@ -35,8 +39,14 @@ typedef struct SevKernelLoaderContext { size_t cmdline_size; } SevKernelLoaderContext; -bool sev_enabled(void); -extern bool sev_es_enabled(void); +#ifdef CONFIG_SEV + bool sev_enabled(void); +bool sev_es_enabled(void); +#else +#define sev_enabled() 0 +#define sev_es_enabled() 0 +#endif + extern SevInfo *sev_get_info(void); extern uint32_t sev_get_cbit_position(void); extern uint32_t sev_get_reduced_phys_bits(void); diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 8289dc87bd5..fc3ed80ef1e 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -5764,12 +5764,13 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count, *edx = 0; break; case 0x8000001F: - *eax = sev_enabled() ? 0x2 : 0; - *eax |= sev_es_enabled() ? 0x8 : 0; - *ebx = sev_get_cbit_position(); - *ebx |= sev_get_reduced_phys_bits() << 6; - *ecx = 0; - *edx = 0; + *eax = *ebx = *ecx = *edx = 0; + if (sev_enabled()) { + *eax = 0x2; + *eax |= sev_es_enabled() ? 0x8 : 0; + *ebx = sev_get_cbit_position(); + *ebx |= sev_get_reduced_phys_bits() << 6; + } break; default: /* reserved values: zero */ diff --git a/target/i386/sev-stub.c b/target/i386/sev-stub.c deleted file mode 100644 index 7e8b6f9a259..00000000000 --- a/target/i386/sev-stub.c +++ /dev/null @@ -1,41 +0,0 @@ -/* - * QEMU SEV stub - * - * Copyright Advanced Micro Devices 2018 - * - * Authors: - * Brijesh Singh - * - * This work is licensed under the terms of the GNU GPL, version 2 or later. - * See the COPYING file in the top-level directory. - * - */ - -#include "qemu/osdep.h" -#include "qapi/error.h" -#include "sev.h" - -bool sev_enabled(void) -{ - return false; -} - -uint32_t sev_get_cbit_position(void) -{ - return 0; -} - -uint32_t sev_get_reduced_phys_bits(void) -{ - return 0; -} - -bool sev_es_enabled(void) -{ - return false; -} - -bool sev_add_kernel_loader_hashes(SevKernelLoaderContext *ctx, Error **errp) -{ - g_assert_not_reached(); -} diff --git a/target/i386/meson.build b/target/i386/meson.build index a4f45c3ec1d..ae38dc95635 100644 --- a/target/i386/meson.build +++ b/target/i386/meson.build @@ -6,7 +6,7 @@ 'xsave_helper.c', 'cpu-dump.c', )) -i386_ss.add(when: 'CONFIG_SEV', if_true: files('host-cpu.c'), if_false: files('sev-stub.c')) +i386_ss.add(when: 'CONFIG_SEV', if_true: files('host-cpu.c')) # x86 cpu type i386_ss.add(when: 'CONFIG_KVM', if_true: files('host-cpu.c')) From patchwork Thu Oct 7 16:17:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 12542341 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 938F5C433F5 for ; Thu, 7 Oct 2021 16:31:36 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 304D361074 for ; Thu, 7 Oct 2021 16:31:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 304D361074 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:43130 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mYWIx-0002aJ-AB for qemu-devel@archiver.kernel.org; Thu, 07 Oct 2021 12:31:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47292) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mYW6T-0005dX-Ct for qemu-devel@nongnu.org; Thu, 07 Oct 2021 12:18:41 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:25695) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mYW6R-0005TY-Hl for qemu-devel@nongnu.org; Thu, 07 Oct 2021 12:18:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633623519; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7zEBwyEs4hdAqxlobZpOUbNIVzNsUZbf4HLNIwXUpoo=; b=KFHC5yobkcZSH+KWM9hze+AtQr3HnfVJUrx4W5uwPHqc9BGTjVqEL+YiHv8nRcValYEOEB +1QABn5ELGnV2tXcLcVORqCUA7+esuLcF9Jj2ybmLNEnDoCAET6tPT0TsUsJLCFFb1yGHz Z5PEqfSplJMFwRTelDm5slKA17tHRmM= 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-55-kuoGVhMgPZC03cfPQd_8Tw-1; Thu, 07 Oct 2021 12:18:37 -0400 X-MC-Unique: kuoGVhMgPZC03cfPQd_8Tw-1 Received: by mail-wr1-f72.google.com with SMTP id m17-20020adffa11000000b00160c1ac74e9so5121651wrr.9 for ; Thu, 07 Oct 2021 09:18:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=7zEBwyEs4hdAqxlobZpOUbNIVzNsUZbf4HLNIwXUpoo=; b=gjhwm5540tzQSpYc93RCZRqYes5VqhcnNCP4ibtbJBciq8D2YknWN8wzf5qJVYHSi4 ok+lY7nTBafDoWxJIy7Z19AMekoSzvRO4gmmz/9ciRicVxGMAVsc4fguVCZu+LOOqSwA AhiF2doQqBpgnjEbl19DtGe6ci89JfKOJI2Tz3iN+668jR5cVNOoeIPNtaMh+F75GUQe zd7I1kiDw5JOdRY0mjR9QRAhYf/YLoe7bNvcx4OqfyqvqL2aj6FUHgJveYa8hxBT7fl5 N/AKFhHQoP+Jbs1HdPyTr2CZcrFzBFjuH/qbtpmNBxIHV90mDPzkNtTZShBKF2GAM91p gxZw== X-Gm-Message-State: AOAM531sTUkA5VgB7RnxRo+zdIM0VVok/grl17mLaoDRhDgTDatpXk6R 5JR2n6ErRGmCGzbIZeVC7uCUQGe8BBP4+3MrWQlcOTcBehTrHzizBKjwD5W7Gofqe/3N9fhL1Rz O7T0DEPTSQwxQ+mJXOh1sj5J17Ff1MZOLr0Wldld/k6qT/chyTnfXH63lkTJaFx80 X-Received: by 2002:a1c:1b4a:: with SMTP id b71mr5629413wmb.33.1633623516238; Thu, 07 Oct 2021 09:18:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyRFIgrsHBHYJZN3sLOY8LrmO2MjqtYTxSRTA/ArKRINNK0kYWiSnReEM//lqCoEZRskTcw5A== X-Received: by 2002:a1c:1b4a:: with SMTP id b71mr5629375wmb.33.1633623515998; Thu, 07 Oct 2021 09:18:35 -0700 (PDT) Received: from x1w.redhat.com (118.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.118]) by smtp.gmail.com with ESMTPSA id k18sm48278wrn.81.2021.10.07.09.18.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Oct 2021 09:18:35 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v4 17/23] target/i386/sev: Move qmp_query_sev_attestation_report() to sev.c Date: Thu, 7 Oct 2021 18:17:10 +0200 Message-Id: <20211007161716.453984-18-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211007161716.453984-1-philmd@redhat.com> References: <20211007161716.453984-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=170.10.129.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.05, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_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 , Eduardo Habkost , kvm@vger.kernel.org, "Michael S. Tsirkin" , Sergio Lopez , James Bottomley , "Dr. David Alan Gilbert" , Dov Murik , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Move qmp_query_sev_attestation_report() from monitor.c to sev.c and make sev_get_attestation_report() static. We don't need the stub anymore, remove it. Reviewed-by: Paolo Bonzini Signed-off-by: Philippe Mathieu-Daudé --- target/i386/sev.h | 2 -- target/i386/monitor.c | 6 ------ target/i386/sev-sysemu-stub.c | 5 +++-- target/i386/sev.c | 12 ++++++++++-- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/target/i386/sev.h b/target/i386/sev.h index d9548e3e642..2e90c05fc3f 100644 --- a/target/i386/sev.h +++ b/target/i386/sev.h @@ -52,8 +52,6 @@ extern uint32_t sev_get_cbit_position(void); extern uint32_t sev_get_reduced_phys_bits(void); extern char *sev_get_launch_measurement(void); extern SevCapability *sev_get_capabilities(Error **errp); -extern SevAttestationReport * -sev_get_attestation_report(const char *mnonce, Error **errp); extern bool sev_add_kernel_loader_hashes(SevKernelLoaderContext *ctx, Error **errp); int sev_encrypt_flash(uint8_t *ptr, uint64_t len, Error **errp); diff --git a/target/i386/monitor.c b/target/i386/monitor.c index 935a8ee8ca4..cf4a8a61a02 100644 --- a/target/i386/monitor.c +++ b/target/i386/monitor.c @@ -763,12 +763,6 @@ void qmp_sev_inject_launch_secret(const char *packet_hdr, sev_inject_launch_secret(packet_hdr, secret, gpa, errp); } -SevAttestationReport * -qmp_query_sev_attestation_report(const char *mnonce, Error **errp) -{ - return sev_get_attestation_report(mnonce, errp); -} - SGXInfo *qmp_query_sgx(Error **errp) { return sgx_get_info(errp); diff --git a/target/i386/sev-sysemu-stub.c b/target/i386/sev-sysemu-stub.c index 8082781febf..d5ec6b32e0a 100644 --- a/target/i386/sev-sysemu-stub.c +++ b/target/i386/sev-sysemu-stub.c @@ -13,6 +13,7 @@ #include "qemu/osdep.h" #include "qapi/qapi-commands-misc-target.h" +#include "qapi/qmp/qerror.h" #include "qapi/error.h" #include "sev.h" @@ -52,8 +53,8 @@ int sev_es_save_reset_vector(void *flash_ptr, uint64_t flash_size) g_assert_not_reached(); } -SevAttestationReport *sev_get_attestation_report(const char *mnonce, - Error **errp) +SevAttestationReport *qmp_query_sev_attestation_report(const char *mnonce, + Error **errp) { error_setg(errp, "SEV is not available in this QEMU"); return NULL; diff --git a/target/i386/sev.c b/target/i386/sev.c index e43bbf3a17d..038fa560588 100644 --- a/target/i386/sev.c +++ b/target/i386/sev.c @@ -32,6 +32,8 @@ #include "migration/blocker.h" #include "qom/object.h" #include "monitor/monitor.h" +#include "qapi/qapi-commands-misc-target.h" +#include "qapi/qmp/qerror.h" #include "exec/confidential-guest-support.h" #include "hw/i386/pc.h" @@ -515,8 +517,8 @@ out: return cap; } -SevAttestationReport * -sev_get_attestation_report(const char *mnonce, Error **errp) +static SevAttestationReport *sev_get_attestation_report(const char *mnonce, + Error **errp) { struct kvm_sev_attestation_report input = {}; SevAttestationReport *report = NULL; @@ -578,6 +580,12 @@ sev_get_attestation_report(const char *mnonce, Error **errp) return report; } +SevAttestationReport *qmp_query_sev_attestation_report(const char *mnonce, + Error **errp) +{ + return sev_get_attestation_report(mnonce, errp); +} + static int sev_read_file_base64(const char *filename, guchar **data, gsize *len) { From patchwork Thu Oct 7 16:17:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 12542259 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id ABECBC433EF for ; Thu, 7 Oct 2021 16:22:15 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2420E610CC for ; Thu, 7 Oct 2021 16:22:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 2420E610CC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:47374 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mYW9t-0003Nw-8P for qemu-devel@archiver.kernel.org; Thu, 07 Oct 2021 12:22:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47320) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mYW6Y-0005ux-1i for qemu-devel@nongnu.org; Thu, 07 Oct 2021 12:18:46 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:42601) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mYW6W-0005XJ-41 for qemu-devel@nongnu.org; Thu, 07 Oct 2021 12:18:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633623523; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gRE3NNVTx8SI9X33FPifPWmCEg7suN8YDk0KQOEofaw=; b=GsZ8Az/59ZZaDLydHoDSus0pDAlHpBQsotHKEGnSJRDyIO3Vf5okgEMhnFLyAV71zVTBSh C06BMZzMpERv4FkIfduneQpt8SBatxcImuyItwzkjRqaoNK/0mru0vPdZxjBUzqpzo0Znc e1rEKKQycPB8R8bqiSyIl6tjZzkwikY= 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-581-QFPLu4qhNW-f70gGQwk-8w-1; Thu, 07 Oct 2021 12:18:42 -0400 X-MC-Unique: QFPLu4qhNW-f70gGQwk-8w-1 Received: by mail-wr1-f72.google.com with SMTP id k16-20020a5d6290000000b00160753b430fso5147721wru.11 for ; Thu, 07 Oct 2021 09:18:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=gRE3NNVTx8SI9X33FPifPWmCEg7suN8YDk0KQOEofaw=; b=mZjFjViFDcQdctAitlEuVNRIiBlDryQtuArlndDpFgHbn6ZrL+Yi03YcKCUmM8xHyN 6u7RudAIW2qQf5a9m39b31OKZ9jh3DZVgPZ7yeYgehxhzupR2wvCAGWr1vTDmTzF4M2m Nx45odGPQp2M9b/CVMosPyNLblH7pBZZXfGXE58G1vPkcqDzV7o45whPTXleYglUnmEm eREooXzfGy/wHkVU/GI7Q7/5MMSj4U9I92lEeTqTZ9jy916SoN/F/nGjH/ZwwmA+WBDn DXnHUvNRzdBuIZPk0mPhWp+ndNgQ2LvyO7PPFhjXqcxIIM3Ohwi+GUcvbMGhPohjTG0V pnfw== X-Gm-Message-State: AOAM533nL2pez3wotu+ASQWeFy+D3/MA14u+tWGo8E12Cup7dZbEGaB4 TCtJAC9G/nTn1FjXwJDJdt4bj44RaefgPkxsAnsh4q4pSZ0El9OfMg9t+ocEeHIzAWxo6JgYwBE jg36Za8J+TW9tdxE4tsRQ2ITf3HWl02WMlawYPjAaeVFzcxqb8foIdlelHw3n/Ykh X-Received: by 2002:a05:6000:18aa:: with SMTP id b10mr6550229wri.270.1633623520817; Thu, 07 Oct 2021 09:18:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyeSWibl7b2NVZJa7Vkddhan4RmMUK+An6BeboL1TOS5wajjOas8bdfopDiRz2IE0A5yVSojA== X-Received: by 2002:a05:6000:18aa:: with SMTP id b10mr6550171wri.270.1633623520408; Thu, 07 Oct 2021 09:18:40 -0700 (PDT) Received: from x1w.redhat.com (118.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.118]) by smtp.gmail.com with ESMTPSA id c5sm9182174wml.9.2021.10.07.09.18.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Oct 2021 09:18:40 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v4 18/23] target/i386/sev: Move qmp_sev_inject_launch_secret() to sev.c Date: Thu, 7 Oct 2021 18:17:11 +0200 Message-Id: <20211007161716.453984-19-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211007161716.453984-1-philmd@redhat.com> References: <20211007161716.453984-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.05, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Brijesh Singh , Eduardo Habkost , kvm@vger.kernel.org, "Michael S. Tsirkin" , Sergio Lopez , James Bottomley , "Dr. David Alan Gilbert" , Dov Murik , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Move qmp_sev_inject_launch_secret() from monitor.c to sev.c and make sev_inject_launch_secret() static. We don't need the stub anymore, remove it. Previously with binaries built without SEV, management layer was getting an empty response: { "execute": "sev-inject-launch-secret", "arguments": { "packet-header": "mypkt", "secret": "mypass", "gpa": 4294959104 } } { "return": { } } Now the response is explicit, mentioning the feature is disabled: { "execute": "sev-inject-launch-secret", "arguments": { "packet-header": "mypkt", "secret": "mypass", "gpa": 4294959104 } } { "error": { "class": "GenericError", "desc": "this feature or command is not currently supported" } } Reviewed-by: Paolo Bonzini Signed-off-by: Philippe Mathieu-Daudé --- target/i386/monitor.c | 31 ------------------------------- target/i386/sev-sysemu-stub.c | 6 +++--- target/i386/sev.c | 31 +++++++++++++++++++++++++++++++ 3 files changed, 34 insertions(+), 34 deletions(-) diff --git a/target/i386/monitor.c b/target/i386/monitor.c index cf4a8a61a02..22883ef2ebb 100644 --- a/target/i386/monitor.c +++ b/target/i386/monitor.c @@ -732,37 +732,6 @@ SevCapability *qmp_query_sev_capabilities(Error **errp) return sev_get_capabilities(errp); } -#define SEV_SECRET_GUID "4c2eb361-7d9b-4cc3-8081-127c90d3d294" -struct sev_secret_area { - uint32_t base; - uint32_t size; -}; - -void qmp_sev_inject_launch_secret(const char *packet_hdr, - const char *secret, - bool has_gpa, uint64_t gpa, - Error **errp) -{ - if (!sev_enabled()) { - error_setg(errp, "SEV not enabled for guest"); - return; - } - if (!has_gpa) { - uint8_t *data; - struct sev_secret_area *area; - - if (!pc_system_ovmf_table_find(SEV_SECRET_GUID, &data, NULL)) { - error_setg(errp, "SEV: no secret area found in OVMF," - " gpa must be specified."); - return; - } - area = (struct sev_secret_area *)data; - gpa = area->base; - } - - sev_inject_launch_secret(packet_hdr, secret, gpa, errp); -} - SGXInfo *qmp_query_sgx(Error **errp) { return sgx_get_info(errp); diff --git a/target/i386/sev-sysemu-stub.c b/target/i386/sev-sysemu-stub.c index d5ec6b32e0a..82c5ebb92fa 100644 --- a/target/i386/sev-sysemu-stub.c +++ b/target/i386/sev-sysemu-stub.c @@ -33,10 +33,10 @@ SevCapability *sev_get_capabilities(Error **errp) return NULL; } -int sev_inject_launch_secret(const char *hdr, const char *secret, - uint64_t gpa, Error **errp) +void qmp_sev_inject_launch_secret(const char *packet_header, const char *secret, + bool has_gpa, uint64_t gpa, Error **errp) { - return 1; + error_setg(errp, "SEV is not available in this QEMU"); } int sev_encrypt_flash(uint8_t *ptr, uint64_t len, Error **errp) diff --git a/target/i386/sev.c b/target/i386/sev.c index 038fa560588..072bb6f0fd7 100644 --- a/target/i386/sev.c +++ b/target/i386/sev.c @@ -973,6 +973,37 @@ int sev_inject_launch_secret(const char *packet_hdr, const char *secret, return 0; } +#define SEV_SECRET_GUID "4c2eb361-7d9b-4cc3-8081-127c90d3d294" +struct sev_secret_area { + uint32_t base; + uint32_t size; +}; + +void qmp_sev_inject_launch_secret(const char *packet_hdr, + const char *secret, + bool has_gpa, uint64_t gpa, + Error **errp) +{ + if (!sev_enabled()) { + error_setg(errp, "SEV not enabled for guest"); + return; + } + if (!has_gpa) { + uint8_t *data; + struct sev_secret_area *area; + + if (!pc_system_ovmf_table_find(SEV_SECRET_GUID, &data, NULL)) { + error_setg(errp, "SEV: no secret area found in OVMF," + " gpa must be specified."); + return; + } + area = (struct sev_secret_area *)data; + gpa = area->base; + } + + sev_inject_launch_secret(packet_hdr, secret, gpa, errp); +} + static int sev_es_parse_reset_block(SevInfoBlock *info, uint32_t *addr) { From patchwork Thu Oct 7 16:17:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 12542365 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9BA95C433F5 for ; Thu, 7 Oct 2021 16:42:27 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 34B1E61090 for ; Thu, 7 Oct 2021 16:42:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 34B1E61090 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:44238 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mYWTS-0005x3-Ex for qemu-devel@archiver.kernel.org; Thu, 07 Oct 2021 12:42:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47354) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mYW6e-000634-7s for qemu-devel@nongnu.org; Thu, 07 Oct 2021 12:18:53 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:43324) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mYW6a-0005ac-3J for qemu-devel@nongnu.org; Thu, 07 Oct 2021 12:18:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633623527; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=eYG5GFyks0GfeQysE3VKr9sF8B7VadEExh3ZaL/jqtM=; b=HW2M9TbVl0woqCe6zFOpZTW0BXVGpdmlKFMXcKBrDIUUluebWA5aA0qmAftqh8HK8LM3qt UoIUMKehFcAGBcdVdVxDo1x4S3rxSmXq0JCwKZVVzRCyZSNU4SlObpktHfTpPcJyBmRlgK ySy+asmNmalQrRVKRWJiSF2rd0KlvWo= 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-83-GRL1Xd2MNS-XOogBfi74eA-1; Thu, 07 Oct 2021 12:18:46 -0400 X-MC-Unique: GRL1Xd2MNS-XOogBfi74eA-1 Received: by mail-wr1-f72.google.com with SMTP id d13-20020adfa34d000000b00160aa1cc5f1so5120103wrb.14 for ; Thu, 07 Oct 2021 09:18:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=eYG5GFyks0GfeQysE3VKr9sF8B7VadEExh3ZaL/jqtM=; b=KEFgsYQ6N2IE+i+frfS819TMM43+8U+LMIadkPiEoy1sxWKjbzHx04/9eMcg1iofw0 PvaFTXvezM3pDYfyIlnbnnoHuGvjgQtIZtcWnUr9yHfQZHjHTDddrS5pb7hOCWgnlB6s oS4uJCLJjr19zmQ229n4oveLwXcRkqaxBbg2kRTbkR7RraVQKso1wlrmooX3NHpx0BR9 lWHWkV8oHqhhv4iMDeDfMBUAts8rvBkhb5l+iFj7g/heJS1Seu4f39CGyrlZcpEgue3t 6Trta5H/gDwY2E4h/VkMAAWwVUlKjU37pfcQ5f7YQSXomLOo7eUi0QHhha5HU9FiN/44 hU6w== X-Gm-Message-State: AOAM53049YqtJJ+R4M1HlgstiN0JxWvzy6N/btADr3Hfj+xGeqrocCkK 0EgkFTMX7ayzi9uM2mcvDW1WdPexvSzeg9pkCKToPG53OIqX9aeDVUhgReRNwrIWefVbqzr7hZM spJQH/Y/GmiqNden/2kzFjhRYbp+XLIx74j0iRBgurZYKsn20EWg1cSWE66rTzuz7 X-Received: by 2002:adf:aa92:: with SMTP id h18mr6442657wrc.372.1633623525197; Thu, 07 Oct 2021 09:18:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyHHZKQOjYRnT9+FmsxmDtac4YCe8C0X0vefev5KYvlUQXaIrRgt4AfzCSl6KGgaKbHDRYH0g== X-Received: by 2002:adf:aa92:: with SMTP id h18mr6442625wrc.372.1633623524973; Thu, 07 Oct 2021 09:18:44 -0700 (PDT) Received: from x1w.redhat.com (118.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.118]) by smtp.gmail.com with ESMTPSA id f9sm85962wrt.11.2021.10.07.09.18.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Oct 2021 09:18:44 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v4 19/23] target/i386/sev: Move qmp_query_sev_capabilities() to sev.c Date: Thu, 7 Oct 2021 18:17:12 +0200 Message-Id: <20211007161716.453984-20-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211007161716.453984-1-philmd@redhat.com> References: <20211007161716.453984-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.05, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Brijesh Singh , Eduardo Habkost , kvm@vger.kernel.org, "Michael S. Tsirkin" , Sergio Lopez , James Bottomley , "Dr. David Alan Gilbert" , Dov Murik , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Move qmp_query_sev_capabilities() from monitor.c to sev.c and make sev_get_capabilities() static. We don't need the stub anymore, remove it. Reviewed-by: Paolo Bonzini Signed-off-by: Philippe Mathieu-Daudé --- target/i386/sev.h | 1 - target/i386/monitor.c | 5 ----- target/i386/sev-sysemu-stub.c | 2 +- target/i386/sev.c | 8 ++++++-- 4 files changed, 7 insertions(+), 9 deletions(-) diff --git a/target/i386/sev.h b/target/i386/sev.h index 2e90c05fc3f..b70b7b56cb8 100644 --- a/target/i386/sev.h +++ b/target/i386/sev.h @@ -51,7 +51,6 @@ extern SevInfo *sev_get_info(void); extern uint32_t sev_get_cbit_position(void); extern uint32_t sev_get_reduced_phys_bits(void); extern char *sev_get_launch_measurement(void); -extern SevCapability *sev_get_capabilities(Error **errp); extern bool sev_add_kernel_loader_hashes(SevKernelLoaderContext *ctx, Error **errp); int sev_encrypt_flash(uint8_t *ptr, uint64_t len, Error **errp); diff --git a/target/i386/monitor.c b/target/i386/monitor.c index 22883ef2ebb..4c017b59b3a 100644 --- a/target/i386/monitor.c +++ b/target/i386/monitor.c @@ -727,11 +727,6 @@ SevLaunchMeasureInfo *qmp_query_sev_launch_measure(Error **errp) return info; } -SevCapability *qmp_query_sev_capabilities(Error **errp) -{ - return sev_get_capabilities(errp); -} - SGXInfo *qmp_query_sgx(Error **errp) { return sgx_get_info(errp); diff --git a/target/i386/sev-sysemu-stub.c b/target/i386/sev-sysemu-stub.c index 82c5ebb92fa..3e8cab4c144 100644 --- a/target/i386/sev-sysemu-stub.c +++ b/target/i386/sev-sysemu-stub.c @@ -27,7 +27,7 @@ char *sev_get_launch_measurement(void) return NULL; } -SevCapability *sev_get_capabilities(Error **errp) +SevCapability *qmp_query_sev_capabilities(Error **errp) { error_setg(errp, "SEV is not available in this QEMU"); return NULL; diff --git a/target/i386/sev.c b/target/i386/sev.c index 072bb6f0fd7..56e9e03accd 100644 --- a/target/i386/sev.c +++ b/target/i386/sev.c @@ -466,8 +466,7 @@ e_free: return 1; } -SevCapability * -sev_get_capabilities(Error **errp) +static SevCapability *sev_get_capabilities(Error **errp) { SevCapability *cap = NULL; guchar *pdh_data = NULL; @@ -517,6 +516,11 @@ out: return cap; } +SevCapability *qmp_query_sev_capabilities(Error **errp) +{ + return sev_get_capabilities(errp); +} + static SevAttestationReport *sev_get_attestation_report(const char *mnonce, Error **errp) { From patchwork Thu Oct 7 16:17:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 12542349 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 40063C433EF for ; Thu, 7 Oct 2021 16:34:52 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C29C161074 for ; Thu, 7 Oct 2021 16:34:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org C29C161074 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:51666 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mYWM6-0008QG-Ut for qemu-devel@archiver.kernel.org; Thu, 07 Oct 2021 12:34:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47372) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mYW6i-00066m-NO for qemu-devel@nongnu.org; Thu, 07 Oct 2021 12:18:58 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:22084) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mYW6e-0005ef-M1 for qemu-devel@nongnu.org; Thu, 07 Oct 2021 12:18:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633623532; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zXfwRbpC9Lbx4LzGOmEzDg8Z5na4+1mXZEo+IH6+b1c=; b=cOnzVX7EHjvcwKz7SN0sKzPNjOA/x5IP1HcZfhhmwholb0oveomU0RSh2FSUdoW4B1EPvH 3iBGk/g5xOm2AGPdqTioLQWmuJ/Sg0oKoheNXBCDW5DCPMr9uFRgXy1AqUyazOFJxNmAtw udzRjiVuYGYQQk0Y84V27GGmrIaDF5U= 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-544-jpmToWxRPxKhEws2D9Ps8g-1; Thu, 07 Oct 2021 12:18:51 -0400 X-MC-Unique: jpmToWxRPxKhEws2D9Ps8g-1 Received: by mail-wr1-f69.google.com with SMTP id a10-20020a5d508a000000b00160723ce588so5117349wrt.23 for ; Thu, 07 Oct 2021 09:18:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=zXfwRbpC9Lbx4LzGOmEzDg8Z5na4+1mXZEo+IH6+b1c=; b=SMt9W0jN/Nv0zxWgdngZeHGKFwBCROo5hHbHkdUUDX8gLQT4L3X1XffBYwYz8XiMkv SVKRirUEz2j0GzG9kpZNJTtMftdsbxqnAqVf6lh6/H5okiKm4L4BV/SNCgWUROmqTwe9 NxSCB/nLfliSCIKhKX5EoFamFg0Sjp6IcZPc8AiGhm86fe6PEQM6xZnXl2VR6/qnyngp S8+5YMXvkYXxkYNgewzdaKfu/hpuYMQuya8fvXWbyo55z590XEVpfz02I7g6FfPeJXxz PPaWGJWHf0tDPyNCpa2xgYsAwmOYHpH4JIe0jHJzH0KSGiUWmQ6kIbjF7eGrfdJv1G34 sNlw== X-Gm-Message-State: AOAM5337ntQkHINVoYb+TaGhV43F57E3rA24uj5Czv7yIrhnGlC5HAB6 E0INTleS0lkksm7AigRxQm5aFNmL1eAXVQxDYRcoBhZZvRM7XPAXE7NY04b1rPQ9XBbO1kPwgec t3v1tkSvXj9uGR4FbJUP1TqKvZ45JCU65oXxUYqpiI3oCxkENhSU8sZzsVi/F/sT5 X-Received: by 2002:a05:6000:15c9:: with SMTP id y9mr4937138wry.361.1633623529631; Thu, 07 Oct 2021 09:18:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxVZkZLJExUdIkU8eUXntS+EbMqWJ8pnYgvB7GErpwpgWp6MdaxC3o/caLpYVSADf5LX9m6nw== X-Received: by 2002:a05:6000:15c9:: with SMTP id y9mr4937095wry.361.1633623529405; Thu, 07 Oct 2021 09:18:49 -0700 (PDT) Received: from x1w.redhat.com (118.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.118]) by smtp.gmail.com with ESMTPSA id w1sm60022wre.79.2021.10.07.09.18.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Oct 2021 09:18:49 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v4 20/23] target/i386/sev: Move qmp_query_sev_launch_measure() to sev.c Date: Thu, 7 Oct 2021 18:17:13 +0200 Message-Id: <20211007161716.453984-21-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211007161716.453984-1-philmd@redhat.com> References: <20211007161716.453984-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=170.10.133.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.05, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Brijesh Singh , Eduardo Habkost , kvm@vger.kernel.org, "Michael S. Tsirkin" , Sergio Lopez , James Bottomley , "Dr. David Alan Gilbert" , Dov Murik , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Move qmp_query_sev_launch_measure() from monitor.c to sev.c and make sev_get_launch_measurement() static. We don't need the stub anymore, remove it. Reviewed-by: Paolo Bonzini Signed-off-by: Philippe Mathieu-Daudé --- target/i386/sev.h | 1 - target/i386/monitor.c | 17 ----------------- target/i386/sev-sysemu-stub.c | 3 ++- target/i386/sev.c | 20 ++++++++++++++++++-- 4 files changed, 20 insertions(+), 21 deletions(-) diff --git a/target/i386/sev.h b/target/i386/sev.h index b70b7b56cb8..dda350779f9 100644 --- a/target/i386/sev.h +++ b/target/i386/sev.h @@ -50,7 +50,6 @@ bool sev_es_enabled(void); extern SevInfo *sev_get_info(void); extern uint32_t sev_get_cbit_position(void); extern uint32_t sev_get_reduced_phys_bits(void); -extern char *sev_get_launch_measurement(void); extern bool sev_add_kernel_loader_hashes(SevKernelLoaderContext *ctx, Error **errp); int sev_encrypt_flash(uint8_t *ptr, uint64_t len, Error **errp); diff --git a/target/i386/monitor.c b/target/i386/monitor.c index 4c017b59b3a..bd24d0d4737 100644 --- a/target/i386/monitor.c +++ b/target/i386/monitor.c @@ -710,23 +710,6 @@ void hmp_info_sev(Monitor *mon, const QDict *qdict) qapi_free_SevInfo(info); } -SevLaunchMeasureInfo *qmp_query_sev_launch_measure(Error **errp) -{ - char *data; - SevLaunchMeasureInfo *info; - - data = sev_get_launch_measurement(); - if (!data) { - error_setg(errp, "SEV launch measurement is not available"); - return NULL; - } - - info = g_malloc0(sizeof(*info)); - info->data = data; - - return info; -} - SGXInfo *qmp_query_sgx(Error **errp) { return sgx_get_info(errp); diff --git a/target/i386/sev-sysemu-stub.c b/target/i386/sev-sysemu-stub.c index 3e8cab4c144..8d97d7c7e14 100644 --- a/target/i386/sev-sysemu-stub.c +++ b/target/i386/sev-sysemu-stub.c @@ -22,8 +22,9 @@ SevInfo *sev_get_info(void) return NULL; } -char *sev_get_launch_measurement(void) +SevLaunchMeasureInfo *qmp_query_sev_launch_measure(Error **errp) { + error_setg(errp, "SEV is not available in this QEMU"); return NULL; } diff --git a/target/i386/sev.c b/target/i386/sev.c index 56e9e03accd..ec874b3df82 100644 --- a/target/i386/sev.c +++ b/target/i386/sev.c @@ -742,8 +742,7 @@ sev_launch_get_measure(Notifier *notifier, void *unused) trace_kvm_sev_launch_measurement(sev->measurement); } -char * -sev_get_launch_measurement(void) +static char *sev_get_launch_measurement(void) { if (sev_guest && sev_guest->state >= SEV_STATE_LAUNCH_SECRET) { @@ -753,6 +752,23 @@ sev_get_launch_measurement(void) return NULL; } +SevLaunchMeasureInfo *qmp_query_sev_launch_measure(Error **errp) +{ + char *data; + SevLaunchMeasureInfo *info; + + data = sev_get_launch_measurement(); + if (!data) { + error_setg(errp, "SEV launch measurement is not available"); + return NULL; + } + + info = g_malloc0(sizeof(*info)); + info->data = data; + + return info; +} + static Notifier sev_machine_done_notify = { .notify = sev_launch_get_measure, }; From patchwork Thu Oct 7 16:17:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 12542383 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2AACFC433FE for ; Thu, 7 Oct 2021 16:44:30 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C7F096120D for ; Thu, 7 Oct 2021 16:44:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org C7F096120D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:48348 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mYWVQ-0000Qe-L4 for qemu-devel@archiver.kernel.org; Thu, 07 Oct 2021 12:44:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47394) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mYW6o-0006CI-Aq for qemu-devel@nongnu.org; Thu, 07 Oct 2021 12:19:04 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:46913) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mYW6l-00067x-Jt for qemu-devel@nongnu.org; Thu, 07 Oct 2021 12:19:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633623538; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=eCfS+Asf+f1waC4AVoz1E9eLdrSZudUp689oYCk0mwY=; b=CYr9t9tfaR2ShWMKeI5RQ7BLDXxTvEW7aUN9jU1LPnvq40YGTxIGxLgPzL+tutw4erdbs8 n5ttsKv+ObtkGJTjf4OlBypGI/HvsS/fi4kmyKP9D2t1rpIuSxGAMl61Ekg/chGfUoG3UU fgIu7gptH8M0+LOKKnPvcBinqdwhubU= 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-292-iZ4HWzO-OGuP-u54_96OoQ-1; Thu, 07 Oct 2021 12:18:57 -0400 X-MC-Unique: iZ4HWzO-OGuP-u54_96OoQ-1 Received: by mail-wr1-f72.google.com with SMTP id o2-20020a5d4a82000000b00160c6b7622aso5039409wrq.12 for ; Thu, 07 Oct 2021 09:18:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=eCfS+Asf+f1waC4AVoz1E9eLdrSZudUp689oYCk0mwY=; b=YBRuT197eqmKNpRxCK/OvBEvs8iRExIOpP/uZOgpUFHv1OH9KyK8c51/4Kg9iO4LAD 6WItHeX8cGt9bs//G1aJvkOgTT7DbW7oba7oyNO0h/sqDvQlzkJBuyBchGINH6TVGeiN LFkxTJqa5tmPwlvDv6XMPOyyW6WkVGUc3yFbqd8iaBUrIgC7c7yyEkkqyEIeR2bRT7Kc XPrEofa718nqhMGbsHl2uEDWte0hT5chBW6leMGXthfU5lTGtMTP5BcJiieiz7/EnuIc FaAZm8AMDQTE/UtdzP4hdeU6jk/LfOMOrsBWnFp5hTJk+6YGwL4EIHEU9lrILxiuwlaZ KLyg== X-Gm-Message-State: AOAM530hYsBbk/MyjW9HYxArs3+NJczpjIygfM8+opc83gDABqn+u/5H SJ1Aj5VRTk8FZ/eX1ns4nnp2rVnc88dybbgCTMSsAwzaq66sdXOQyWJDkLNIU01p5bYIUs1bn8v QTQiJJsKvC8DTwiDfnJDIsRbJne9iU/QnTWusH6DTkWAfjzjb8sj9xTwc0vr+wbdY X-Received: by 2002:a7b:c351:: with SMTP id l17mr5734566wmj.120.1633623534099; Thu, 07 Oct 2021 09:18:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzMiBCCsPqIpoUFMotzmt5Xfmuwzj1LGT3FXGJkJ2kFOsOJzE9yp1pWqRATIf7s0cH57Uvvhg== X-Received: by 2002:a7b:c351:: with SMTP id l17mr5734533wmj.120.1633623533832; Thu, 07 Oct 2021 09:18:53 -0700 (PDT) Received: from x1w.redhat.com (118.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.118]) by smtp.gmail.com with ESMTPSA id o6sm130018wri.49.2021.10.07.09.18.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Oct 2021 09:18:53 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v4 21/23] target/i386/sev: Move qmp_query_sev() & hmp_info_sev() to sev.c Date: Thu, 7 Oct 2021 18:17:14 +0200 Message-Id: <20211007161716.453984-22-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211007161716.453984-1-philmd@redhat.com> References: <20211007161716.453984-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=170.10.133.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.05, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Brijesh Singh , Eduardo Habkost , kvm@vger.kernel.org, "Michael S. Tsirkin" , Sergio Lopez , James Bottomley , "Dr. David Alan Gilbert" , Dov Murik , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Move qmp_query_sev() & hmp_info_sev()() from monitor.c to sev.c and make sev_get_info() static. We don't need the stub anymore, remove it. Add a stub for hmp_info_sev(). Reviewed-by: Paolo Bonzini Signed-off-by: Philippe Mathieu-Daudé --- target/i386/sev.h | 2 -- target/i386/monitor.c | 35 -------------------------------- target/i386/sev-sysemu-stub.c | 10 ++++++++- target/i386/sev.c | 38 +++++++++++++++++++++++++++++++++-- 4 files changed, 45 insertions(+), 40 deletions(-) diff --git a/target/i386/sev.h b/target/i386/sev.h index dda350779f9..3fba1884a0d 100644 --- a/target/i386/sev.h +++ b/target/i386/sev.h @@ -19,7 +19,6 @@ #endif #include "exec/confidential-guest-support.h" -#include "qapi/qapi-types-misc-target.h" #define SEV_POLICY_NODBG 0x1 #define SEV_POLICY_NOKS 0x2 @@ -47,7 +46,6 @@ bool sev_es_enabled(void); #define sev_es_enabled() 0 #endif -extern SevInfo *sev_get_info(void); extern uint32_t sev_get_cbit_position(void); extern uint32_t sev_get_reduced_phys_bits(void); extern bool sev_add_kernel_loader_hashes(SevKernelLoaderContext *ctx, Error **errp); diff --git a/target/i386/monitor.c b/target/i386/monitor.c index bd24d0d4737..680d282591c 100644 --- a/target/i386/monitor.c +++ b/target/i386/monitor.c @@ -31,7 +31,6 @@ #include "qapi/qmp/qerror.h" #include "sysemu/kvm.h" #include "qapi/error.h" -#include "sev.h" #include "qapi/qapi-commands-misc-target.h" #include "qapi/qapi-commands-misc.h" #include "hw/i386/pc.h" @@ -676,40 +675,6 @@ void hmp_info_io_apic(Monitor *mon, const QDict *qdict) "removed soon. Please use 'info pic' instead.\n"); } -SevInfo *qmp_query_sev(Error **errp) -{ - SevInfo *info; - - info = sev_get_info(); - if (!info) { - error_setg(errp, "SEV feature is not available"); - return NULL; - } - - return info; -} - -void hmp_info_sev(Monitor *mon, const QDict *qdict) -{ - SevInfo *info = sev_get_info(); - - if (info && info->enabled) { - monitor_printf(mon, "handle: %d\n", info->handle); - monitor_printf(mon, "state: %s\n", SevState_str(info->state)); - monitor_printf(mon, "build: %d\n", info->build_id); - monitor_printf(mon, "api version: %d.%d\n", - info->api_major, info->api_minor); - monitor_printf(mon, "debug: %s\n", - info->policy & SEV_POLICY_NODBG ? "off" : "on"); - monitor_printf(mon, "key-sharing: %s\n", - info->policy & SEV_POLICY_NOKS ? "off" : "on"); - } else { - monitor_printf(mon, "SEV is not enabled\n"); - } - - qapi_free_SevInfo(info); -} - SGXInfo *qmp_query_sgx(Error **errp) { return sgx_get_info(errp); diff --git a/target/i386/sev-sysemu-stub.c b/target/i386/sev-sysemu-stub.c index 8d97d7c7e14..68518fd3f9d 100644 --- a/target/i386/sev-sysemu-stub.c +++ b/target/i386/sev-sysemu-stub.c @@ -12,13 +12,16 @@ */ #include "qemu/osdep.h" +#include "monitor/monitor.h" +#include "monitor/hmp.h" #include "qapi/qapi-commands-misc-target.h" #include "qapi/qmp/qerror.h" #include "qapi/error.h" #include "sev.h" -SevInfo *sev_get_info(void) +SevInfo *qmp_query_sev(Error **errp) { + error_setg(errp, "SEV is not available in this QEMU"); return NULL; } @@ -60,3 +63,8 @@ SevAttestationReport *qmp_query_sev_attestation_report(const char *mnonce, error_setg(errp, "SEV is not available in this QEMU"); return NULL; } + +void hmp_info_sev(Monitor *mon, const QDict *qdict) +{ + monitor_printf(mon, "SEV is not available in this QEMU\n"); +} diff --git a/target/i386/sev.c b/target/i386/sev.c index ec874b3df82..19504796fb7 100644 --- a/target/i386/sev.c +++ b/target/i386/sev.c @@ -32,6 +32,7 @@ #include "migration/blocker.h" #include "qom/object.h" #include "monitor/monitor.h" +#include "monitor/hmp.h" #include "qapi/qapi-commands-misc-target.h" #include "qapi/qmp/qerror.h" #include "exec/confidential-guest-support.h" @@ -402,8 +403,7 @@ sev_get_reduced_phys_bits(void) return sev_guest ? sev_guest->reduced_phys_bits : 0; } -SevInfo * -sev_get_info(void) +static SevInfo *sev_get_info(void) { SevInfo *info; @@ -422,6 +422,40 @@ sev_get_info(void) return info; } +SevInfo *qmp_query_sev(Error **errp) +{ + SevInfo *info; + + info = sev_get_info(); + if (!info) { + error_setg(errp, "SEV feature is not available"); + return NULL; + } + + return info; +} + +void hmp_info_sev(Monitor *mon, const QDict *qdict) +{ + SevInfo *info = sev_get_info(); + + if (info && info->enabled) { + monitor_printf(mon, "handle: %d\n", info->handle); + monitor_printf(mon, "state: %s\n", SevState_str(info->state)); + monitor_printf(mon, "build: %d\n", info->build_id); + monitor_printf(mon, "api version: %d.%d\n", + info->api_major, info->api_minor); + monitor_printf(mon, "debug: %s\n", + info->policy & SEV_POLICY_NODBG ? "off" : "on"); + monitor_printf(mon, "key-sharing: %s\n", + info->policy & SEV_POLICY_NOKS ? "off" : "on"); + } else { + monitor_printf(mon, "SEV is not enabled\n"); + } + + qapi_free_SevInfo(info); +} + static int sev_get_pdh_info(int fd, guchar **pdh, size_t *pdh_len, guchar **cert_chain, size_t *cert_chain_len, Error **errp) From patchwork Thu Oct 7 16:17:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 12542359 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3D66FC433EF for ; Thu, 7 Oct 2021 16:37:59 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BF30161090 for ; Thu, 7 Oct 2021 16:37:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org BF30161090 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:60258 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mYWP7-0005u4-Vc for qemu-devel@archiver.kernel.org; Thu, 07 Oct 2021 12:37:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47414) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mYW6s-0006IA-5I for qemu-devel@nongnu.org; Thu, 07 Oct 2021 12:19:07 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:60980) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mYW6o-0006PJ-3S for qemu-devel@nongnu.org; Thu, 07 Oct 2021 12:19:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633623541; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=dszCsYIAf35aWLecKqc6M9ImtE7DijrXFcMIXKeRiqY=; b=fOMoK7yu2Th/DklPfAtgBmj+ayBhrgWm59dOJGrfV8DltP4gr12ZIy8qg++UJFaiKDkTAo 3OxJ7lKn3nBGVm2rrVijF9IjQ0kBa/ry5s/1k8PvNbBifxPizTp3nXBt1l+ZPmvO2/X2ZL 6+9ZlPu5L6K74NZjZ7tT7bMIXb/sZg8= 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-49-hQF28j5INBOUj-mpoG96ug-1; Thu, 07 Oct 2021 12:19:00 -0400 X-MC-Unique: hQF28j5INBOUj-mpoG96ug-1 Received: by mail-wr1-f69.google.com with SMTP id r25-20020adfab59000000b001609ddd5579so5119412wrc.21 for ; Thu, 07 Oct 2021 09:18:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=dszCsYIAf35aWLecKqc6M9ImtE7DijrXFcMIXKeRiqY=; b=OT8YtTFsRrfxiqTp01yKJVKXnd6OwxCDK/dMR/rgIRSk6A0dH7KNUAsf7emBORjOkT /CTw+4SmjSovBnRAzSDKWKmGGVd//vuZEii+06JkM2jMaZfAsHGA/hWWbfvn5x+BPfpo D0DMZVn5CpEpDiyGv1tt4fAmEncKw2Stm7weRRD3E4LhCLrYvzAL3C/GE+7oI5Q0cFLR q7i09hLiYvWzQUwFMur0KMOTNj/vGo/Eg7GE9+whCHSdHisInfK240hhf3P0GwqOvdSy XktNQRPoYPxsoyfn6Zc7RTh0oDUh81OPiuO/tbc5Ez9MGbripVTyW+K4va1tBR751Fnd rkQQ== X-Gm-Message-State: AOAM530NxyR9KcjgK4i5vWtHtPdEslFEn9dssPacFDgrmT1zejLyl0fW hdzo7kKt+3j+s6mvucOPld0HuvPMtiYDhzghrNU5Ydox2coH4qGLgFkn5gCJplovx6BTG/ROj8G scAYh9NWg+rx89oUeiMWzivz5IuJu7C6bLP9izOvrR8Xa3+Pg9r+QrdgU4YPFsRWN X-Received: by 2002:a05:600c:2199:: with SMTP id e25mr17668201wme.67.1633623538612; Thu, 07 Oct 2021 09:18:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwNRqSXp1fcCQwH5Qrmb0ILMhSM78sS3Mu8PApG1hGseG2CcrM+8gbZcUik9BKir5O9HMblnA== X-Received: by 2002:a05:600c:2199:: with SMTP id e25mr17668154wme.67.1633623538287; Thu, 07 Oct 2021 09:18:58 -0700 (PDT) Received: from x1w.redhat.com (118.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.118]) by smtp.gmail.com with ESMTPSA id c77sm4630wme.48.2021.10.07.09.18.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Oct 2021 09:18:57 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v4 22/23] monitor: Reduce hmp_info_sev() declaration Date: Thu, 7 Oct 2021 18:17:15 +0200 Message-Id: <20211007161716.453984-23-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211007161716.453984-1-philmd@redhat.com> References: <20211007161716.453984-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=170.10.129.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.05, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_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 , Eduardo Habkost , kvm@vger.kernel.org, "Michael S. Tsirkin" , Sergio Lopez , James Bottomley , "Dr. David Alan Gilbert" , Dov Murik , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" While being conditionally used for TARGET_I386 in hmp-commands-info.hx, hmp_info_sev() is declared for all targets. Reduce its declaration to target including "monitor/hmp-target.h". This is a minor cleanup. Reviewed-by: Paolo Bonzini Signed-off-by: Philippe Mathieu-Daudé --- include/monitor/hmp-target.h | 1 + include/monitor/hmp.h | 1 - target/i386/sev-sysemu-stub.c | 2 +- target/i386/sev.c | 2 +- 4 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/monitor/hmp-target.h b/include/monitor/hmp-target.h index dc53add7eef..96956d0fc41 100644 --- a/include/monitor/hmp-target.h +++ b/include/monitor/hmp-target.h @@ -49,6 +49,7 @@ void hmp_info_tlb(Monitor *mon, const QDict *qdict); void hmp_mce(Monitor *mon, const QDict *qdict); void hmp_info_local_apic(Monitor *mon, const QDict *qdict); void hmp_info_io_apic(Monitor *mon, const QDict *qdict); +void hmp_info_sev(Monitor *mon, const QDict *qdict); void hmp_info_sgx(Monitor *mon, const QDict *qdict); #endif /* MONITOR_HMP_TARGET_H */ diff --git a/include/monitor/hmp.h b/include/monitor/hmp.h index 3baa1058e2c..6bc27639e01 100644 --- a/include/monitor/hmp.h +++ b/include/monitor/hmp.h @@ -124,7 +124,6 @@ void hmp_info_ramblock(Monitor *mon, const QDict *qdict); void hmp_hotpluggable_cpus(Monitor *mon, const QDict *qdict); void hmp_info_vm_generation_id(Monitor *mon, const QDict *qdict); void hmp_info_memory_size_summary(Monitor *mon, const QDict *qdict); -void hmp_info_sev(Monitor *mon, const QDict *qdict); void hmp_info_replay(Monitor *mon, const QDict *qdict); void hmp_replay_break(Monitor *mon, const QDict *qdict); void hmp_replay_delete_break(Monitor *mon, const QDict *qdict); diff --git a/target/i386/sev-sysemu-stub.c b/target/i386/sev-sysemu-stub.c index 68518fd3f9d..7a29295d1ed 100644 --- a/target/i386/sev-sysemu-stub.c +++ b/target/i386/sev-sysemu-stub.c @@ -13,7 +13,7 @@ #include "qemu/osdep.h" #include "monitor/monitor.h" -#include "monitor/hmp.h" +#include "monitor/hmp-target.h" #include "qapi/qapi-commands-misc-target.h" #include "qapi/qmp/qerror.h" #include "qapi/error.h" diff --git a/target/i386/sev.c b/target/i386/sev.c index 19504796fb7..4c64c682442 100644 --- a/target/i386/sev.c +++ b/target/i386/sev.c @@ -32,7 +32,7 @@ #include "migration/blocker.h" #include "qom/object.h" #include "monitor/monitor.h" -#include "monitor/hmp.h" +#include "monitor/hmp-target.h" #include "qapi/qapi-commands-misc-target.h" #include "qapi/qmp/qerror.h" #include "exec/confidential-guest-support.h" From patchwork Thu Oct 7 16:17:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 12542363 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 07218C433F5 for ; Thu, 7 Oct 2021 16:40:08 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9D5EA61090 for ; Thu, 7 Oct 2021 16:40:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 9D5EA61090 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:38426 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mYWRC-0001se-Sv for qemu-devel@archiver.kernel.org; Thu, 07 Oct 2021 12:40:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47434) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mYW6v-0006NU-Bk for qemu-devel@nongnu.org; Thu, 07 Oct 2021 12:19:09 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:54878) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mYW6t-0006cu-3u for qemu-devel@nongnu.org; Thu, 07 Oct 2021 12:19:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633623545; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=raENXGoMd83njG9X2No5AFJQfUuVjvhwyUCC5K+pe4w=; b=LeVi/e0jpwBveUMQPTrg7o2Q6WeWc09cBScJovYpMBwKqYwaggy0Q1sgpZpP6ssYXIlyuc 4bWWb3RIXtLUw04Cpidks+9epXP+k6vrRUkZStoO8wg1o0uAt2g+nRrOOi6HnwAsUDZeTr FAkpoKigDG32OZJsHIERu5YXQA88Uao= 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-567-HUbW22_VNJCJtCFtckfLwQ-1; Thu, 07 Oct 2021 12:19:04 -0400 X-MC-Unique: HUbW22_VNJCJtCFtckfLwQ-1 Received: by mail-wr1-f71.google.com with SMTP id d13-20020adf9b8d000000b00160a94c235aso5132293wrc.2 for ; Thu, 07 Oct 2021 09:19:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=raENXGoMd83njG9X2No5AFJQfUuVjvhwyUCC5K+pe4w=; b=RJ2nydXJUhf1M79uHW1phaHs8iU4RFayTLCF64U9msypQ3LT7BO3xAj/sRhsJv1z9A g+wLbx2W2XfQVIEV1/63sFRyu3WJCx7tMj0lwJ4A4xTX4m3sg1mvhFruBmXWlmSap/Ef py5sbpMzeS3nLiyqorIzdEh43Um0AcjNu6UoiK9m4z5uaywBrw16W988i8+BZwtgTJn8 e2rL/tD90HQYbQsn75OuBL9U03/rpbIqftseU9nbvGknXVbid9kghoTOXNdwK6FsCR4p Z1TnwK1SE+Iff0O2inDibNgCc8udt0KRZjeMmPAircj/KD4C8Mp/Sy3ch6vGQkjMnFqB IEIQ== X-Gm-Message-State: AOAM533CxVrFMevWT8lsopx9G9rqSGhMvF72SuW4vrL3KRByq0BwPSZ6 +WHN7MidjNYveGeygPnqriXSsLqvywszS8wZKC9h9nhZjsy5l1MsuJSKGj9C9Yh2yFZ7ND+mBuB 9G5K5MY84K81mAVAYqQOGAXTkgmbnqJubgC0XFk09nsAuBNtJ7f8DFfBQgegKNNRi X-Received: by 2002:a1c:21d7:: with SMTP id h206mr17449934wmh.23.1633623543230; Thu, 07 Oct 2021 09:19:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwLVyjk8Yjb8T3LzpyyPDRcvNepzAgqY2opRKw88FbZnxb/11utVAJlVwGyacRlavjgmwnmOQ== X-Received: by 2002:a1c:21d7:: with SMTP id h206mr17449901wmh.23.1633623542998; Thu, 07 Oct 2021 09:19:02 -0700 (PDT) Received: from x1w.redhat.com (118.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.118]) by smtp.gmail.com with ESMTPSA id d3sm78771wrb.36.2021.10.07.09.19.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Oct 2021 09:19:02 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v4 23/23] MAINTAINERS: Cover SEV-related files with X86/KVM section Date: Thu, 7 Oct 2021 18:17:16 +0200 Message-Id: <20211007161716.453984-24-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211007161716.453984-1-philmd@redhat.com> References: <20211007161716.453984-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.05, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Brijesh Singh , Eduardo Habkost , kvm@vger.kernel.org, "Michael S. Tsirkin" , Sergio Lopez , James Bottomley , "Dr. David Alan Gilbert" , Dov Murik , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Complete the x86/KVM section with SEV-related files. Suggested-by: Paolo Bonzini Signed-off-by: Philippe Mathieu-Daudé --- MAINTAINERS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 50435b8d2f5..a49555d94d5 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -417,7 +417,9 @@ M: Paolo Bonzini M: Marcelo Tosatti L: kvm@vger.kernel.org S: Supported +F: docs/amd-memory-encryption.txt F: target/i386/kvm/ +F: target/i386/sev* F: scripts/kvm/vmxcap Guest CPU Cores (other accelerators)