From nobody Mon Feb 9 11:32:48 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1633623510; cv=none; d=zohomail.com; s=zohoarc; b=c2imx20hm9DWyH3ptdjCWM/+0odTfEx18pQYCdU2qbuGCjKuPYnXnjSZjLtVuwEuAfZv3iiCQMTnPd604142/zNtB5RB6NmwwVFpFu62Pl26DUwU9fydqQyxOsYqvcQbuQq2eh0vBQzXfAvh9dtt284dHXDoGCIX79dkv5z82hU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633623510; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=lGxIOiDkjtO7lLXCNUhDroR/93vYB4x6AaMAet+1gIs=; b=mkyAXbYeIoXCARcYWkLs033DBSAU1UhEMWwMoOJTe9b7NZIvKNB8GbxQNz0paLtkjIJYT7oZNzIhjqGJ5VJ1nZJCKo1N0hm3+XF1nYZq9UaRkkP4Bydxd4nomxWaklnGudFRiNzf5cvJFQIAqrRA7PazK1eSwNkXlF1fFOyws64= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1633623510846461.2117617394862; Thu, 7 Oct 2021 09:18:30 -0700 (PDT) Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-16-sv2uxtHUP6Gz4smJB9ICvw-1; Thu, 07 Oct 2021 12:18:28 -0400 Received: by mail-wr1-f70.google.com with SMTP id r25-20020adfab59000000b001609ddd5579so5118233wrc.21 for ; Thu, 07 Oct 2021 09:18:28 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (118.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.118]) by smtp.gmail.com with ESMTPSA id v185sm4584081wme.35.2021.10.07.09.18.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Oct 2021 09:18:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633623509; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lGxIOiDkjtO7lLXCNUhDroR/93vYB4x6AaMAet+1gIs=; b=QtjaN6s/rM0mv+kN/HKlf62BIwApMGgrHam2v3tS+7VsINWpN+fNsPLRppyh1WoRskiopE 36TnPejCkVH+jiQZ/dwzsbvGgvuV77GMxC74YPXHdcCS7ExpDMJ8njpJRhH87++ylFP/l0 r/18wfjHBlcL+BL5VJV+N3yxm39d1v0= X-MC-Unique: sv2uxtHUP6Gz4smJB9ICvw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=lGxIOiDkjtO7lLXCNUhDroR/93vYB4x6AaMAet+1gIs=; b=qFF4q70FWv9ACz5JwUUsIuw206ctcicYEqwd6ioSiiEcsrdqU4fEZqLanxTUhuxZxX NxCSqZRyGRhoJouwBEEUZ533BbuSzR7OaGkLCS/uKK41WLq6LLSfkshWwroPLFJ+dJ3R xEzljTQnn/2mWoyEJbbeBNhTaDe5AK1HuUjnAr71GbnmWFiPbcI3b0QyscS2s7hH1idf 2z1WH77hHkNFobGXo+bmv3dZ/H2xRsuwf8UP8sst42qyCyJxa4npBVItWZ8xtbiWYxLi eISOxKgJfAKrRVi2T6lhOrlYugipX8+Sv0ORtEmofSHY4lfvEnr4uZ0gAhH/dQfEW+VZ +VbQ== X-Gm-Message-State: AOAM5334QtgI2k0oj8JJplMUQ1MRaCd7z+fJzVYOtqYgFsYaUg2nE4sg 7hi0HhV1C0ABQWvXC08xcsSjtMuEkshFp99JgacwLu0DQ/6U/k31fsxkiBXa20kJjfPmJZnfwIO UNmbNkR18cZcGOg== X-Received: by 2002:a05:6000:18a3:: with SMTP id b3mr6651387wri.178.1633623507249; Thu, 07 Oct 2021 09:18:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxGxFUSQBIuymUcqyNofEv5FzSKPyuPr7MuNzby3hK9l903zkFHngcL71AixMMoIYrkPVrZ9w== X-Received: by 2002:a05:6000:18a3:: with SMTP id b3mr6651373wri.178.1633623507093; Thu, 07 Oct 2021 09:18:27 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Eduardo Habkost , kvm@vger.kernel.org, "Michael S. Tsirkin" , "Dr. David Alan Gilbert" , James Bottomley , Brijesh Singh , Sergio Lopez , Dov Murik , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v4 15/23] target/i386/sev: Declare system-specific functions in 'sev.h' Date: Thu, 7 Oct 2021 18:17:08 +0200 Message-Id: <20211007161716.453984-16-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211007161716.453984-1-philmd@redhat.com> References: <20211007161716.453984-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1633623511390100001 "sysemu/sev.h" is only used from x86-specific files. Let's move it to include/hw/i386, and merge it with target/i386/sev.h. Suggested-by: Paolo Bonzini Reviewed-by: Paolo Bonzini Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- include/sysemu/sev.h | 28 ---------------------------- target/i386/sev.h | 12 +++++++++++- hw/i386/pc_sysfw.c | 2 +- target/i386/kvm/kvm.c | 1 - target/i386/kvm/sev-stub.c | 2 +- target/i386/monitor.c | 1 - 6 files changed, 13 insertions(+), 33 deletions(-) delete mode 100644 include/sysemu/sev.h diff --git a/include/sysemu/sev.h b/include/sysemu/sev.h deleted file mode 100644 index 94d821d737c..00000000000 --- a/include/sysemu/sev.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * QEMU Secure Encrypted Virutualization (SEV) support - * - * Copyright: Advanced Micro Devices, 2016-2018 - * - * Authors: - * Brijesh Singh - * - * This work is licensed under the terms of the GNU GPL, version 2 or late= r. - * See the COPYING file in the top-level directory. - * - */ - -#ifndef QEMU_SEV_H -#define QEMU_SEV_H - -#include "sysemu/kvm.h" - -bool sev_enabled(void); -int sev_kvm_init(ConfidentialGuestSupport *cgs, Error **errp); -int sev_encrypt_flash(uint8_t *ptr, uint64_t len, Error **errp); -int sev_inject_launch_secret(const char *hdr, const char *secret, - uint64_t gpa, Error **errp); - -int sev_es_save_reset_vector(void *flash_ptr, uint64_t flash_size); -void sev_es_set_reset_vector(CPUState *cpu); - -#endif diff --git a/target/i386/sev.h b/target/i386/sev.h index d83428fa265..c96072bf78d 100644 --- a/target/i386/sev.h +++ b/target/i386/sev.h @@ -14,7 +14,7 @@ #ifndef QEMU_SEV_I386_H #define QEMU_SEV_I386_H =20 -#include "sysemu/sev.h" +#include "exec/confidential-guest-support.h" #include "qapi/qapi-types-misc-target.h" =20 #define SEV_POLICY_NODBG 0x1 @@ -35,6 +35,7 @@ typedef struct SevKernelLoaderContext { size_t cmdline_size; } SevKernelLoaderContext; =20 +bool sev_enabled(void); extern bool sev_es_enabled(void); extern SevInfo *sev_get_info(void); extern uint32_t sev_get_cbit_position(void); @@ -45,4 +46,13 @@ extern SevAttestationReport * sev_get_attestation_report(const char *mnonce, Error **errp); extern bool sev_add_kernel_loader_hashes(SevKernelLoaderContext *ctx, Erro= r **errp); =20 +int sev_encrypt_flash(uint8_t *ptr, uint64_t len, Error **errp); +int sev_inject_launch_secret(const char *hdr, const char *secret, + uint64_t gpa, Error **errp); + +int sev_es_save_reset_vector(void *flash_ptr, uint64_t flash_size); +void sev_es_set_reset_vector(CPUState *cpu); + +int sev_kvm_init(ConfidentialGuestSupport *cgs, Error **errp); + #endif diff --git a/hw/i386/pc_sysfw.c b/hw/i386/pc_sysfw.c index 68d6b1f783e..c8b17af9535 100644 --- a/hw/i386/pc_sysfw.c +++ b/hw/i386/pc_sysfw.c @@ -37,7 +37,7 @@ #include "hw/qdev-properties.h" #include "hw/block/flash.h" #include "sysemu/kvm.h" -#include "sysemu/sev.h" +#include "sev.h" =20 #define FLASH_SECTOR_SIZE 4096 =20 diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c index a5f6ff63c81..0eb7a0340cf 100644 --- a/target/i386/kvm/kvm.c +++ b/target/i386/kvm/kvm.c @@ -44,7 +44,6 @@ #include "hw/i386/intel_iommu.h" #include "hw/i386/x86-iommu.h" #include "hw/i386/e820_memory_layout.h" -#include "sysemu/sev.h" =20 #include "hw/pci/pci.h" #include "hw/pci/msi.h" diff --git a/target/i386/kvm/sev-stub.c b/target/i386/kvm/sev-stub.c index 9587d1b2a31..6080c007a2e 100644 --- a/target/i386/kvm/sev-stub.c +++ b/target/i386/kvm/sev-stub.c @@ -13,7 +13,7 @@ =20 #include "qemu/osdep.h" #include "qemu-common.h" -#include "sysemu/sev.h" +#include "sev.h" =20 int sev_kvm_init(ConfidentialGuestSupport *cgs, Error **errp) { diff --git a/target/i386/monitor.c b/target/i386/monitor.c index 109e4e61c0a..935a8ee8ca4 100644 --- a/target/i386/monitor.c +++ b/target/i386/monitor.c @@ -30,7 +30,6 @@ #include "qapi/qmp/qdict.h" #include "qapi/qmp/qerror.h" #include "sysemu/kvm.h" -#include "sysemu/sev.h" #include "qapi/error.h" #include "sev.h" #include "qapi/qapi-commands-misc-target.h" --=20 2.31.1