From nobody Tue Nov 26 12:50:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1708006919; cv=none; d=zohomail.com; s=zohoarc; b=EGZTQVJg1EU4Izo6HCCVc0FVuRgna7WdM4m/CyCXRG3b3U9tB0piG36kOCwbJjrE/+sgWfOltedwLBLS3M3nzyx0rWpzhfgAkmZx4rlNoFsCPhZXftlbSDxMFwzMUW8uIbYBoHXhZ/hBNAH/MbEw/w2Lt7FAuH6fHAYeFWTqRvY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1708006919; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=V9a2tbqcFhv7866Po+eazVne7c9fJyb++6ZKJPt9MeE=; b=RColTYc7dcrtq2gpLjSu7wnfi6I9Rcs4Ge0cCw2vq94uQHrzs0jad80trvb2vC+F4/Z5h/PvlAy2s/Z+anUN1pgqJR1JwIgtBbJwwjZ+EcUrd3iu8xQ119rVsKNSPBpl3GwV1YCUWKORU5fK9uzs8zTuosF2ASS66A6LhPI0iUs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1708006919758470.5811930502289; Thu, 15 Feb 2024 06:21:59 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1racbu-0005gS-RS; Thu, 15 Feb 2024 09:21:10 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1racbs-0005dL-EQ for qemu-devel@nongnu.org; Thu, 15 Feb 2024 09:21:08 -0500 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1racbh-0000En-BZ for qemu-devel@nongnu.org; Thu, 15 Feb 2024 09:21:08 -0500 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-4121954d4c0so3556245e9.0 for ; Thu, 15 Feb 2024 06:20:56 -0800 (PST) Received: from m1x-phil.lan ([176.187.193.50]) by smtp.gmail.com with ESMTPSA id bi20-20020a05600c3d9400b004103e15441dsm2147381wmb.6.2024.02.15.06.20.53 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 15 Feb 2024 06:20:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1708006855; x=1708611655; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=V9a2tbqcFhv7866Po+eazVne7c9fJyb++6ZKJPt9MeE=; b=jQ5qJT7TFC22SWPzleXZ0K8hWMveJGkAQ6eXr4/RMaXQv6sE0mmFX7JPKTE/2msJE8 krjuisnwpOUV2WelnoK0fde9HgHt5Ms/LhyyIFUovlCrnyM0EDHC1LTmEfyC8G7L6btL Pi5uR/VUPa/Lb2ZBhC21z7lOE/uZk40o9IXPAvAEfPVjPvMHG0JVerHkpSqpprjnk4+T zj8TvmvWTScBREGd9TAlQPZqjqBNpCmyAmtrnCuJ0nBpMYRkAjTweEVzftWufzNxuHVZ GzLGyHDtO2/+nbXykpr2XV59qmrvpgnarB2zD6o4lBf5zlBjmggxhDuI+t0Q7VT2Q7GQ 6BGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708006855; x=1708611655; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=V9a2tbqcFhv7866Po+eazVne7c9fJyb++6ZKJPt9MeE=; b=HyVa1gfE7elpqrKr9A8UP6bI2g6iTal3W6ee7cBGywUZrg+DYnWaSnDXg28g8Hnn4k i4o2Qhu2hTCOdJKEQxd02EtTsLVs/8P1TzCTcH5RxVQdIKR8XL5gDDyTgdg92fzfLmfg FmY3PRiBtIrLXOP7o5TiugoztrMxZBX2HuKQT6FnMmWUdjhUIoXJu1jiZGaYPiX4HITI ALKoaD8rKB7lexpN+iQHxje02eDR+VzPc70J6Qvt7AGCezEJ8fcSOscnI5JRZBLyaU7W 5TwsvKx2k5QJk2efPiRmeLS6Jfhbpos+xqcJ0EPB99TBDNHVClgsHdeLi8HSdOF3dIYf sgtg== X-Gm-Message-State: AOJu0Yz6d0CaVhoHAmMTRyErKDPOar3veglUF0/XThg28FO62pPKIr+u u79pTPYEV7GB8V2XKycPTaUqE983maeSdYff/WuW7UC+M1nsGLyoQ6ud4gZYIwenTsda59f2Ik7 7/Dg= X-Google-Smtp-Source: AGHT+IHZtXtX6MfTefPcXDCoXO9cBpuaZm8C6bzeO6EAUHK2OKEi7VgqOojokGFFWz2RMHHac1bnig== X-Received: by 2002:a05:600c:1c0a:b0:411:dd82:a23c with SMTP id j10-20020a05600c1c0a00b00411dd82a23cmr1813787wms.0.1708006855024; Thu, 15 Feb 2024 06:20:55 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: "Michael S. Tsirkin" , Eduardo Habkost , Richard Henderson , Paolo Bonzini , kvm@vger.kernel.org, Marcelo Tosatti , Marcel Apfelbaum , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Michael Tokarev Subject: [PATCH v2 3/3] hw/i386/sgx: Use QDev API Date: Thu, 15 Feb 2024 15:20:35 +0100 Message-ID: <20240215142035.73331-4-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240215142035.73331-1-philmd@linaro.org> References: <20240215142035.73331-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=philmd@linaro.org; helo=mail-wm1-x335.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1708006921550100001 Prefer the QDev API over the low level QOM one. No logical change intended. Reviewed-by: Michael Tokarev Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- Only build-tested. --- hw/i386/kvm/sgx.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/hw/i386/kvm/sgx.c b/hw/i386/kvm/sgx.c index 70305547d4..de76397bcf 100644 --- a/hw/i386/kvm/sgx.c +++ b/hw/i386/kvm/sgx.c @@ -286,7 +286,6 @@ void pc_machine_init_sgx_epc(PCMachineState *pcms) SGXEPCState *sgx_epc =3D &pcms->sgx_epc; X86MachineState *x86ms =3D X86_MACHINE(pcms); SgxEPCList *list =3D NULL; - Object *obj; =20 memset(sgx_epc, 0, sizeof(SGXEPCState)); if (!x86ms->sgx_epc_list) { @@ -300,16 +299,15 @@ void pc_machine_init_sgx_epc(PCMachineState *pcms) &sgx_epc->mr); =20 for (list =3D x86ms->sgx_epc_list; list; list =3D list->next) { - obj =3D object_new("sgx-epc"); + DeviceState *dev =3D qdev_new(TYPE_SGX_EPC); =20 /* set the memdev link with memory backend */ - object_property_parse(obj, SGX_EPC_MEMDEV_PROP, list->value->memde= v, - &error_fatal); + object_property_parse(OBJECT(dev), SGX_EPC_MEMDEV_PROP, + list->value->memdev, &error_fatal); /* set the numa node property for sgx epc object */ - object_property_set_uint(obj, SGX_EPC_NUMA_NODE_PROP, list->value-= >node, - &error_fatal); - object_property_set_bool(obj, "realized", true, &error_fatal); - object_unref(obj); + object_property_set_uint(OBJECT(dev), SGX_EPC_NUMA_NODE_PROP, + list->value->node, &error_fatal); + qdev_realize_and_unref(dev, NULL, &error_fatal); } =20 if ((sgx_epc->base + sgx_epc->size) < sgx_epc->base) { --=20 2.41.0