From nobody Tue Nov 26 11:39:58 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=1707808645; cv=none; d=zohomail.com; s=zohoarc; b=V8Fh4X8RwoCUMNu+idAqYrGKl1jyfcL5BQ/KXQNATg2oKUjNRatsze/AlUX2vOSEq3SRjf4k+QYGKwZ8lShPShd1RxcqCuFh0VztK3RxR6eSTBr2F77tAYCKPXPAGEKLG1b3n8/bApm5aaOPrvQGA7jPOpIY/cPZxc/DJTbI3Hw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1707808645; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Cj9qCj9mT2tt5rgoG2stTmiFvC9CmzQUn4FtQx8Dgyg=; b=SWqckkFOKj5+L3HjAJniX3rYP0Uu9sAtsAiqLhY+TP7LS0zlN+JDhu047djECCAUfZ88NlSrInhhqjIZUlgu7skX+lea33egoOY0eTi2YzH1KfvksC21nFviJel2gO1abW76jsNWFM3dEwbSYm2z0uBvLJ1bWKqlxm0lLuPH4bg= 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 1707808645823745.8732742508469; Mon, 12 Feb 2024 23:17:25 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rZn1k-0002JS-Lr; Tue, 13 Feb 2024 02:16:24 -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 1rZn1i-0002IM-Rv for qemu-devel@nongnu.org; Tue, 13 Feb 2024 02:16:22 -0500 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rZn1e-0007tj-8T for qemu-devel@nongnu.org; Tue, 13 Feb 2024 02:16:20 -0500 Received: by mail-wr1-x432.google.com with SMTP id ffacd0b85a97d-33b2960ff60so2839640f8f.1 for ; Mon, 12 Feb 2024 23:16:17 -0800 (PST) Received: from m1x-phil.lan ([176.176.128.243]) by smtp.gmail.com with ESMTPSA id dv5-20020a0560000d8500b0033b483d1abcsm8709565wrb.53.2024.02.12.23.16.15 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 12 Feb 2024 23:16:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1707808576; x=1708413376; darn=nongnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=Cj9qCj9mT2tt5rgoG2stTmiFvC9CmzQUn4FtQx8Dgyg=; b=Nyugot3aKozmEN3Od4aVM4pM7pkounGGNXLkw0W5IVimYeo7vi9p45XlNjOPKcyLb0 ucwVi14PwNoqAH587zDLvN/o5As9DxqXHBts89vViw0MNsrA7uEPWssDKS8TjjL+EWvW L2XGrstl/QWtDKZpRqYbpowyGfwJMJpP1XPz+lgx4vGkWs+R7TlMO6OdnOBYo2Nn9qxu T+PvwZrcgmXPQH17j6cwgtfzYzv2IlmxmSXT+m+VxgDAt9zXvlaIQ/z8wyxnCkPUTBeI N06qJQ6lMMbeVcp05CjT1Lb9P0+eNdJ5qoXcKy7w9a/vHY+vGfMV8DoZudZLOL5KCSUq aNVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707808576; x=1708413376; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Cj9qCj9mT2tt5rgoG2stTmiFvC9CmzQUn4FtQx8Dgyg=; b=CdaLWfkuxQBsspLKp2niqZICOZhG5ECMvpn3D77hXCAMtrf9I4yirRCzBCXgBIfSuD F2uV6wb5B0R+w+d7smVBDxkgwLNylH+UWQdqIQdo/HiH+4S+XJOLSWiNWDwqdGScdXNC yaOM0gE2o9JWXz0tsq+0OWynXzTjzVBz1jpRWtXv+vB28pDK2ItTZqX6n/nTDKtftxpT GlubQC84+cerAJD2hnSxitdnjjpabVtlibPkNJPJYIQTEnDr1NWaDQ6V6NOTmrFj0Sk/ PKAZFAyjxxHEUYQf5iGlgQpoEQnS9o8cOWg2qG1NmIB60eVWIWRZwUc4kqSB3NHYvH1V 449A== X-Gm-Message-State: AOJu0YybK9yd3Lrq/47RhdjM8RcdyPyIbw/MKtf6xyWcDjHyJQ4OlnLZ 7dhrAIXAj48qieB596/1i7r3cp45wPH5ZQbeh5hHj15CawKg8TADRB4N1qtXpnfGC+ZAL6CDClW w X-Google-Smtp-Source: AGHT+IHrTLLFI1tqRrznVpJefkYRpov81hxKrswb+qr8oG1krRE3F60MHN+PzxhK8sZc6q4GGy5DPA== X-Received: by 2002:a5d:680a:0:b0:33b:58c7:8281 with SMTP id w10-20020a5d680a000000b0033b58c78281mr1332042wru.10.1707808576417; Mon, 12 Feb 2024 23:16:16 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCWXMyN4Ms6ScJQQh7dqSy6GHbE06UMgK9JZeeYZ9dG7RPFxdwmu0sY+47koNoHh+ljrad1MOEabRm2rvp9PCAl+NJ8Nd7UUfsfFBbWB4V2mbZNhg2jCeHDCnJqMdbFPnKjt8CD/WqqGG7w9iyiK/JUF2m3CtU2AamnOdVAvdLlrXPBpDdlpYbblD6okSn/zo+kuRXcrite5nUivZiblO/1spB3ldJUanQTHWmwBfAOQWhXGyV1vlGieRg== From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Eduardo Habkost , "Michael S. Tsirkin" , qemu-trivial@nongnu.org, Richard Henderson , Marcel Apfelbaum , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH] hw/i386/sgx: Use QDev API Date: Tue, 13 Feb 2024 08:16:13 +0100 Message-ID: <20240213071613.72566-1-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 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::432; envelope-from=philmd@linaro.org; helo=mail-wr1-x432.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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable 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: 1707808647924100003 Prefer the QDev API over the low level QOM one. No logical change intended. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Michael Tokarev --- hw/i386/sgx.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/hw/i386/sgx.c b/hw/i386/sgx.c index 70305547d4..9176040f8f 100644 --- a/hw/i386/sgx.c +++ b/hw/i386/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, &error_fatal); } =20 if ((sgx_epc->base + sgx_epc->size) < sgx_epc->base) { --=20 2.41.0