From nobody Mon Feb 9 17:06:50 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1623876285; cv=none; d=zohomail.com; s=zohoarc; b=j+YuWTj3NpcL0uitVPsrxTvbOf5+u8aQSPRiATPV/5SYhg7A+OuZpILs5eSz9Xv8xJ5ilAml8GtddDZEFTzd/YKELsNfSxe7RTYnV+e+pPo2s6haTtZnTzu0BbO/uAhE6XZc2BMnIcx0CdcfHdIUtRD76Gi4mgrYWemQ8BO/d/A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1623876285; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=6Qhs5Kaq2kwAeqkE8Rl6FNf/UagyAFBSfq4AHlQjz5U=; b=h+plSS1lwBelvm0fmtPeoOn9lxSqeatmZ5HSRbBi9WgcpmIu6We8sTaoAs/Say7cU96MnlsmzUn7hsIKr5rJ67hwD8T2n0w2KyO+yoOVc4AyfMG1jC2ryrVjj8YZZ4kY8SByUrK7Zan3TqFNtNcFUTun2f0bDM1c57EU2Xh6G8c= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1623876285454596.1366436932883; Wed, 16 Jun 2021 13:44:45 -0700 (PDT) Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-191-0qU_vK93MmiHjZkI9-2o8w-1; Wed, 16 Jun 2021 16:44:43 -0400 Received: by mail-wr1-f72.google.com with SMTP id q15-20020adfc50f0000b0290111f48b865cso1866801wrf.4 for ; Wed, 16 Jun 2021 13:44:43 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.. (93.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.93]) by smtp.gmail.com with ESMTPSA id t11sm3211509wrz.7.2021.06.16.13.44.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Jun 2021 13:44:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1623876284; 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=6Qhs5Kaq2kwAeqkE8Rl6FNf/UagyAFBSfq4AHlQjz5U=; b=QVvrw6exWpcnnp8nb0rVJRLGRlWyor6vat2JPNEkzgkXMEFkw1SFStxUfp9Mq2GlDCL+Rz GUL0KhhGP2b7qdhm4hoZ4NGaFbRVF1P+fznKuTiEBbuO5ktmOeL7GnYDh0fIJOrfA5CsHb GBK8KMr41/d3I8GoJpO+wHHCCcMEKQU= X-MC-Unique: 0qU_vK93MmiHjZkI9-2o8w-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=6Qhs5Kaq2kwAeqkE8Rl6FNf/UagyAFBSfq4AHlQjz5U=; b=VWA72xckhoFiYWQrJUh9Ma8klQqAImMUkqUnig8o//oiK1pFdmm/iEnZAiOnznLPct X9f2kgqo0cuzpghO72/EuJe56s+WwVEbl6UZHsPEee6b/cjL96IwybNu/P4t7Er5SXlV ifCciJQWxGpPnXTx2Edqf3e3bSCllxSxYpqk5/sl84l2GWfNrmScQwOd0z3moSsW3ikw PIOeSpuSy4vSLAtGSxtj+CEL5JUef9zf6fyMiSsSsPjMp+xSIqkBCs2jFWIh7Y1JTHkk pE4mMbC+8LHHwCCGnpep02J399Swmb+D9y7w32rllI6IvBAP8+tEdziLy094x9Oc+SRu YwnA== X-Gm-Message-State: AOAM530qsmH7n9m6/V/ytH25lzJbfzIwfj0Ei4zKRFeFABxc1uL5iCBL zCiPsofPZvzJGCRwH5u99hBmGgQ5jvonx2u2o7b79PC6JPQUKqxOTRERXknei3eoSg4a0w7CIbM p1vyAwnpZW7Ue8Q== X-Received: by 2002:a1c:5413:: with SMTP id i19mr976139wmb.12.1623876281995; Wed, 16 Jun 2021 13:44:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzMbDqWgrIVYtvX6JNR7PcIPKcThRnUplFPf217UThn8MrR9IcG/XNIUpoiLFSpPT/JeLAfcQ== X-Received: by 2002:a1c:5413:: with SMTP id i19mr976116wmb.12.1623876281777; Wed, 16 Jun 2021 13:44:41 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , Paolo Bonzini , Connor Kuehl , Gerd Hoffmann , Brijesh Singh , "Dr . David Alan Gilbert" , Eric Blake , Eduardo Habkost , Markus Armbruster , Igor Mammedov , James Bottomley , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Sergio Lopez , Marcel Apfelbaum , "Michael S. Tsirkin" , Laszlo Ersek , Dov Murik Subject: [PATCH v2 12/23] target/i386/sev: Move qmp_sev_inject_launch_secret() to sev.c Date: Wed, 16 Jun 2021 22:43:17 +0200 Message-Id: <20210616204328.2611406-13-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210616204328.2611406-1-philmd@redhat.com> References: <20210616204328.2611406-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Move qmp_sev_inject_launch_secret() from monitor.c to sev.c and make sev_inject_launch_secret() static. We don't need the stub anymore, remove it. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- 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 eb4539bf88b..95b9ada189e 100644 --- a/target/i386/monitor.c +++ b/target/i386/monitor.c @@ -731,34 +731,3 @@ SevCapability *qmp_query_sev_capabilities(Error **errp) { return sev_get_capabilities(errp); } - -#define SEV_SECRET_GUID "4c2eb361-7d9b-4cc3-8081-127c90d3d294" -struct sev_secret_area { - uint32_t base; - uint32_t size; -}; - -void qmp_sev_inject_launch_secret(const char *packet_hdr, - const char *secret, - bool has_gpa, uint64_t gpa, - Error **errp) -{ - if (!sev_enabled()) { - error_setg(errp, QERR_UNSUPPORTED); - return; - } - if (!has_gpa) { - uint8_t *data; - struct sev_secret_area *area; - - if (!pc_system_ovmf_table_find(SEV_SECRET_GUID, &data, NULL)) { - error_setg(errp, "SEV: no secret area found in OVMF," - " gpa must be specified."); - return; - } - area =3D (struct sev_secret_area *)data; - gpa =3D area->base; - } - - sev_inject_launch_secret(packet_hdr, secret, gpa, errp); -} diff --git a/target/i386/sev-sysemu-stub.c b/target/i386/sev-sysemu-stub.c index 1f7573ad528..a66ae4f5efb 100644 --- a/target/i386/sev-sysemu-stub.c +++ b/target/i386/sev-sysemu-stub.c @@ -33,10 +33,10 @@ SevCapability *sev_get_capabilities(Error **errp) return NULL; } =20 -int sev_inject_launch_secret(const char *hdr, const char *secret, - uint64_t gpa, Error **errp) +void qmp_sev_inject_launch_secret(const char *packet_header, const char *s= ecret, + bool has_gpa, uint64_t gpa, Error **errp) { - return 1; + error_setg(errp, QERR_UNSUPPORTED); } =20 int sev_encrypt_flash(uint8_t *ptr, uint64_t len, Error **errp) diff --git a/target/i386/sev.c b/target/i386/sev.c index 809054a84f2..7cdf8d857c8 100644 --- a/target/i386/sev.c +++ b/target/i386/sev.c @@ -955,6 +955,37 @@ int sev_inject_launch_secret(const char *packet_hdr, c= onst char *secret, return 0; } =20 +#define SEV_SECRET_GUID "4c2eb361-7d9b-4cc3-8081-127c90d3d294" +struct sev_secret_area { + uint32_t base; + uint32_t size; +}; + +void qmp_sev_inject_launch_secret(const char *packet_hdr, + const char *secret, + bool has_gpa, uint64_t gpa, + Error **errp) +{ + if (!sev_enabled()) { + error_setg(errp, QERR_UNSUPPORTED); + return; + } + if (!has_gpa) { + uint8_t *data; + struct sev_secret_area *area; + + if (!pc_system_ovmf_table_find(SEV_SECRET_GUID, &data, NULL)) { + error_setg(errp, "SEV: no secret area found in OVMF," + " gpa must be specified."); + return; + } + area =3D (struct sev_secret_area *)data; + gpa =3D area->base; + } + + sev_inject_launch_secret(packet_hdr, secret, gpa, errp); +} + static int sev_es_parse_reset_block(SevInfoBlock *info, uint32_t *addr) { --=20 2.31.1