From nobody Tue Feb 10 02:55:40 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1590033163; cv=none; d=zohomail.com; s=zohoarc; b=VZb5ikD7L1DSINe0g5C1FOzrKhg+yKz1Dg+PM8ks0NdPVoMBvWzzlidDIx6E1bTE6c3iCizNtHx+Ves1Ond4RWFujme4/wb191DG5DCuSO8/E3ob/NyZeiEhyhQCRGWlvsHLHzbA90YpYkMZdvNdS4JVYbPTma9NR7JASDq8NI8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1590033163; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=+QgPlPT/Jsud11pV37c4IdJ8a1iHwti6nFKVFZ6DIZI=; b=TSRJJa4mla9/vHhWKy2HbUQ30nCB7x2xaA2oWx2TVW55BpcXBfsaw91jk6uwDkoBF/KTtwJTeAcX2NgcUrU3CzUg2Xdk09ROHXMRV7mfMf6E/2LVit4ZAcptOCet4947aZ+kHPuE550SVeCLryG/7IVYrQd4ZuaisB8KIJu8/Kc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1590033163796491.24011145026884; Wed, 20 May 2020 20:52:43 -0700 (PDT) Received: from localhost ([::1]:54402 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jbcGA-0002Co-Jp for importer@patchew.org; Wed, 20 May 2020 23:52:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53294) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jbc7J-000362-AA; Wed, 20 May 2020 23:43:33 -0400 Received: from ozlabs.org ([2401:3900:2:1::2]:48147) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jbc7H-0003Wh-PI; Wed, 20 May 2020 23:43:32 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 49SFns1NXdz9sTT; Thu, 21 May 2020 13:43:13 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1590032593; bh=d27Ffc+UM25I6jMKKixH/o4N+rS/wECOugs7Ml/AULE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NyyiKIgRv8Sa41xtepCYVJluBW+AhLBvINnbN87OdeeyM3yp4/39vXYbVeNhQymmh w9h5HFnBxqtFma/Dgw4COf4HOWHWO0y7kNHNCWwxUKEF0NL/sue/3Cjot/cnJ24R8g 0hCZAyi+kNc4RRVPYdd1yxxpob8XWUeWxID41pRw= From: David Gibson To: qemu-devel@nongnu.org, brijesh.singh@amd.com, frankja@linux.ibm.com, dgilbert@redhat.com, pair@us.ibm.com Subject: [RFC v2 08/18] target/i386: sev: Remove redundant handle field Date: Thu, 21 May 2020 13:42:54 +1000 Message-Id: <20200521034304.340040-9-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200521034304.340040-1-david@gibson.dropbear.id.au> References: <20200521034304.340040-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2401:3900:2:1::2; envelope-from=dgibson@ozlabs.org; helo=ozlabs.org X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN 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: Eduardo Habkost , kvm@vger.kernel.org, "Michael S. Tsirkin" , cohuck@redhat.com, mdroth@linux.vnet.ibm.com, qemu-ppc@nongnu.org, Paolo Bonzini , Richard Henderson , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" The user can explicitly specify a handle via the "handle" property wired to SevGuestState::handle. That gets passed to the KVM_SEV_LAUNCH_START ioctl() which may update it, the final value being copied back to both SevGuestState::handle and SEVState::handle. AFAICT, nothing will be looking SEVState::handle before it and SevGuestState::handle have been updated from the ioctl(). So, remove the field and just use SevGuestState::handle directly. Signed-off-by: David Gibson Reviewed-by: Richard Henderson --- target/i386/sev.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/target/i386/sev.c b/target/i386/sev.c index 4b261beaa7..24e2dea9b8 100644 --- a/target/i386/sev.c +++ b/target/i386/sev.c @@ -40,7 +40,6 @@ struct SEVState { uint8_t api_minor; uint8_t build_id; uint64_t me_mask; - uint32_t handle; int sev_fd; SevState state; gchar *measurement; @@ -64,13 +63,13 @@ struct SevGuestState { /* configuration parameters */ char *sev_device; uint32_t policy; - uint32_t handle; char *dh_cert_file; char *session_file; uint32_t cbitpos; uint32_t reduced_phys_bits; =20 /* runtime state */ + uint32_t handle; SEVState state; }; =20 @@ -398,7 +397,7 @@ sev_get_info(void) info->build_id =3D sev_guest->state.build_id; info->policy =3D sev_guest->policy; info->state =3D sev_guest->state.state; - info->handle =3D sev_guest->state.handle; + info->handle =3D sev_guest->handle; } =20 return info; @@ -517,8 +516,7 @@ sev_launch_start(SevGuestState *sev) =20 start =3D g_new0(struct kvm_sev_launch_start, 1); =20 - start->handle =3D object_property_get_int(OBJECT(sev), "handle", - &error_abort); + start->handle =3D sev->handle; start->policy =3D sev->policy; if (sev->session_file) { if (sev_read_file_base64(sev->session_file, &session, &sz) < 0) { @@ -544,10 +542,8 @@ sev_launch_start(SevGuestState *sev) goto out; } =20 - object_property_set_int(OBJECT(sev), start->handle, "handle", - &error_abort); sev_set_guest_state(sev, SEV_STATE_LAUNCH_UPDATE); - s->handle =3D start->handle; + sev->handle =3D start->handle; ret =3D 0; =20 out: --=20 2.26.2