From nobody Sat Apr 5 05:33:35 2025 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=1738233514; cv=none; d=zohomail.com; s=zohoarc; b=E8oiPiRMr95M5MLvhKtMCYLDDScFMtPr9qwXRqrvkFrnPyAqd1LjYpKUI8vRjOVthRr3zx2R/hLeAjp8oh5v1UIflBIbIaftMp7DHMEXt4VnQnNjC7OwB5AkmUlbk+mNdLW56glW/EWsk89vNVuahPe7aJwwV3H6HNB/SKIjCw8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1738233514; 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=Pg5MaFKnNzop8+TLP/dVC/2mW49fQZIVVDSrPsECg1A=; b=kimlqpL5Tu4EVxSnHeeaJ76hLhfu33gSvXiDMX7leqcXZj4yIypTmsvYBqZ9vm8kCo4+TSMZBRBNnIWnauf6KxY8jP6FmBtSlSc6kft3vmJo/4UBtUGfAI/Zwql4EjCNSZ+QH87j9aqf8gZtsu7etQDhdXJm7AyPgoWXtTSeejM= 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 1738233514487350.57730791530025; Thu, 30 Jan 2025 02:38:34 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tdRvY-0003eC-LL; Thu, 30 Jan 2025 05:37:40 -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 1tdRvW-0003dk-OM for qemu-devel@nongnu.org; Thu, 30 Jan 2025 05:37:38 -0500 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tdRvV-0002Yt-6K for qemu-devel@nongnu.org; Thu, 30 Jan 2025 05:37:38 -0500 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-43690d4605dso4033725e9.0 for ; Thu, 30 Jan 2025 02:37:36 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38c5c1cf831sm1596604f8f.90.2025.01.30.02.37.34 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 30 Jan 2025 02:37:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1738233455; x=1738838255; 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=Pg5MaFKnNzop8+TLP/dVC/2mW49fQZIVVDSrPsECg1A=; b=K3Djlh6ugtlKCQqmgHwDSSs+C6dM6WLkxogf+9cDAcW+VBEbJhulvStOskkFRbddRV pQZa5ah6uwGTajaG6jCBRgT/kD08+XHQQi9c4U8llUkT/ymn36xVwpkmbbs20FOzCIz8 MRFYmAXfIz/t0rPaV6JTex3TueGusS3B/qdlVp47bjCKDDM2A1n0giCpYYf9CkcO5ik1 iIxBLYVO4OYlqKmTA2OEYNZtYxBDB69cBUpNh4w6SMQpXaRfZ1TCgRhE6dvR96yzGTg+ LkEzXh1gQmnWko7Am+LCNjlW+MqX8QRtFNLwASXP/C3tdEAkh6dK+5W/k2rK95fpZPHc oiAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738233455; x=1738838255; 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=Pg5MaFKnNzop8+TLP/dVC/2mW49fQZIVVDSrPsECg1A=; b=OizelDYBZUFyasYYV0g3lt7TcWFX7s6npIkln0hsYUAyXGDQKJoCIKP4Q9oKteaRpe najvrMypYgdGZhJKpIfWigsbcs1/vm3BVHhRYFjrqij4UukzSFMuU3Hd8zyELg+NKtC4 Z4b8O45S8I4PWHgIPudMwGfkgWn2xyGWEiaC+6cyfjhw+Z2uSNLR3ywgKhlVn+bzd72y ZNTXwz3Co4DhD2uU8W71r0I/jAxHq4nNx4migtJIhhAfsGRxepvXoXK5VHJgunbXCHuv we/2O2aGvVddC20a6RaIN82RidROjJj1dKH+YoXvzMI5e837CPDFHrZ77soS8wlTD7dO Fw6g== X-Gm-Message-State: AOJu0Yz1x1U3z69kRTXS9DzLxHbjwiRmgLmca3dpVpQX8WRO+zymGbC4 35ae4Ieflr0zGJ0/3dA2eETUdcVbp3k0JlS/cYNy/gn3OeXZlxDkhVMY/5PJOVo7shpJWQ0zKSg hzUs= X-Gm-Gg: ASbGncuQaLaiplzu3Vk/SMtAa7yPTPYkgknMEqLrLa2v6bCkaEW6J+CM4HC/3R8uuHh OxlozmgFWU8ujtBn3WF4tqycpw7Z/3NLy521MC5VwVGz9Fgaq6GKMf2zlH1L+V5q0auw+5PAcZ6 RGXhKKFhDzVj2KhBiB3aO5Nj8zlziBfrn1EZmNcZ/v7BNoHaFhslEnxDbshNsE8ZdSeybJJ0sEp LZijGKexUe24snb6RLB7C/moF83f7dawnOBZAfQ7lisFoqp5PI20YF4v3IIaqziSOEb190v8S9B B9EExRfQU0fN0nx8Cr9ngQk+6oH70G8lxIeYTTx/bvU/9qc2u4VjHhfUjJSxEV4pIQ== X-Google-Smtp-Source: AGHT+IG+nd03K6bXfTItyDPlrQaxlloknSN7c9PECZGXc3Uso0wTuNV9xeI8f/uUiqaWMOWrrWjoWg== X-Received: by 2002:a05:600c:3d9b:b0:434:f297:8e85 with SMTP id 5b1f17b1804b1-438dc3c39d6mr65674835e9.10.1738233455104; Thu, 30 Jan 2025 02:37:35 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Paolo Bonzini , Bernhard Beschow , Thomas Huth , Markus Armbruster , Akihiko Odaki , Fabiano Rosas , Phil Dennis-Jordan , xen-devel@lists.xenproject.org, Laurent Vivier , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v2 1/2] tests/qtest: Extract qtest_qom_has_concrete_type() helper Date: Thu, 30 Jan 2025 11:37:27 +0100 Message-ID: <20250130103728.536-2-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250130103728.536-1-philmd@linaro.org> References: <20250130103728.536-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::333; envelope-from=philmd@linaro.org; helo=mail-wm1-x333.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 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: 1738233516516019000 Extract qtest_qom_has_concrete_type() out of qtest_has_device() in order to re-use it in the following commit. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Thomas Huth Reviewed-by: Akihiko Odaki --- tests/qtest/libqtest.c | 89 ++++++++++++++++++++++++------------------ 1 file changed, 51 insertions(+), 38 deletions(-) diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c index a1e105f27f9..7e9366ad6d5 100644 --- a/tests/qtest/libqtest.c +++ b/tests/qtest/libqtest.c @@ -978,6 +978,56 @@ const char *qtest_get_arch(void) return end + 1; } =20 +static bool qtest_qom_has_concrete_type(const char *parent_typename, + const char *child_typename, + QList **cached_list) +{ + QList *list =3D cached_list ? *cached_list : NULL; + const QListEntry *p; + QObject *qobj; + QString *qstr; + QDict *devinfo; + int idx; + + if (!list) { + QDict *resp; + QDict *args; + QTestState *qts =3D qtest_init("-machine none"); + + args =3D qdict_new(); + qdict_put_bool(args, "abstract", false); + qdict_put_str(args, "implements", parent_typename); + + resp =3D qtest_qmp(qts, "{'execute': 'qom-list-types', 'arguments'= : %p }", + args); + g_assert(qdict_haskey(resp, "return")); + list =3D qdict_get_qlist(resp, "return"); + qobject_ref(list); + qobject_unref(resp); + + qtest_quit(qts); + + if (cached_list) { + *cached_list =3D list; + } + } + + for (p =3D qlist_first(list), idx =3D 0; p; p =3D qlist_next(p), idx++= ) { + devinfo =3D qobject_to(QDict, qlist_entry_obj(p)); + g_assert(devinfo); + + qobj =3D qdict_get(devinfo, "name"); + g_assert(qobj); + qstr =3D qobject_to(QString, qobj); + g_assert(qstr); + if (g_str_equal(qstring_get_str(qstr), child_typename)) { + return true; + } + } + + return false; +} + bool qtest_has_accel(const char *accel_name) { if (g_str_equal(accel_name, "tcg")) { @@ -1757,45 +1807,8 @@ bool qtest_has_machine(const char *machine) bool qtest_has_device(const char *device) { static QList *list; - const QListEntry *p; - QObject *qobj; - QString *qstr; - QDict *devinfo; - int idx; =20 - if (!list) { - QDict *resp; - QDict *args; - QTestState *qts =3D qtest_init("-machine none"); - - args =3D qdict_new(); - qdict_put_bool(args, "abstract", false); - qdict_put_str(args, "implements", "device"); - - resp =3D qtest_qmp(qts, "{'execute': 'qom-list-types', 'arguments'= : %p }", - args); - g_assert(qdict_haskey(resp, "return")); - list =3D qdict_get_qlist(resp, "return"); - qobject_ref(list); - qobject_unref(resp); - - qtest_quit(qts); - } - - for (p =3D qlist_first(list), idx =3D 0; p; p =3D qlist_next(p), idx++= ) { - devinfo =3D qobject_to(QDict, qlist_entry_obj(p)); - g_assert(devinfo); - - qobj =3D qdict_get(devinfo, "name"); - g_assert(qobj); - qstr =3D qobject_to(QString, qobj); - g_assert(qstr); - if (g_str_equal(qstring_get_str(qstr), device)) { - return true; - } - } - - return false; + return qtest_qom_has_concrete_type("device", device, &list); } =20 /* --=20 2.47.1 From nobody Sat Apr 5 05:33:35 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1738233481; cv=none; d=zohomail.com; s=zohoarc; b=kQ7g291QS9Axk0/ZfRbuMSahur1K+0fHgjQZ56IOyIn7dSA0QRC7Ffm5qxF0hKqoBAFe9xBByGhWgx7o+w5GhAKUSe8BQlOjupi5tsssKGY0m9E9xRKPPrkpQRcFOrXHuRoZ3aSKH/HOoTXBYwE5q6YUhYZDcYY2WYi/2svr4a8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1738233481; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=crB/f7vCa5hLa4LpwRk/HholuVWafRL1UUnQ0YPYia4=; b=Cc5B3YIpX4fT+lPfSPsaxubCoB5y9tHWT1BwGBUScueqibZAqUgMCcdeXq19lqbkauhbQE3WcFDaH3e/Ie25EGdvZrAdzfp2HpMg4W5xIVYAC+I02y+ObvjVZoT17V+17xNkkSFWR3vvpA4aGadQwgCEG+Gxgdm45SlIghDeNmQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1738233481591131.2447214397016; Thu, 30 Jan 2025 02:38:01 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.879444.1289660 (Exim 4.92) (envelope-from ) id 1tdRvb-0005g0-VE; Thu, 30 Jan 2025 10:37:43 +0000 Received: by outflank-mailman (output) from mailman id 879444.1289660; Thu, 30 Jan 2025 10:37:43 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tdRvb-0005ft-Rm; Thu, 30 Jan 2025 10:37:43 +0000 Received: by outflank-mailman (input) for mailman id 879444; Thu, 30 Jan 2025 10:37:42 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tdRva-0005ei-Na for xen-devel@lists.xenproject.org; Thu, 30 Jan 2025 10:37:42 +0000 Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [2a00:1450:4864:20::333]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 3ad0cb19-def6-11ef-a0e6-8be0dac302b0; Thu, 30 Jan 2025 11:37:41 +0100 (CET) Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-4364a37a1d7so6050245e9.3 for ; Thu, 30 Jan 2025 02:37:41 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438d7aa296esm56173275e9.1.2025.01.30.02.37.38 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 30 Jan 2025 02:37:39 -0800 (PST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 3ad0cb19-def6-11ef-a0e6-8be0dac302b0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1738233460; x=1738838260; darn=lists.xenproject.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=crB/f7vCa5hLa4LpwRk/HholuVWafRL1UUnQ0YPYia4=; b=VqOm0gzhr3quEpr4WnAjq4/GloRgP63zeXrker0ksaWuVyu6KiNcuNVr+4hen4kKa5 k2fVtHNW2UgN/Bnz01POHaP+0SXcAG430xg9eckUfVYxgEHuFzXNK6Rs3PU3Vi5eZhgw 1wKXHKrM+4ycSU2ijdCs5fgSw6XqqFXRrWXaevdef3M3BFzWW68TtGNYJvbSGh9EHkv4 qYiXFMfkTN7lNQ33ighMpjfO8GduvrMTytRDF4sYU4Rhg0WPmAuTqhmX3zL/y2DqG7HV uxOMDufadSZbS55AyKy2CoLWuxkktkpHOG4AGpXaUd1bkp4E+qzqijEZOQHpqAQ8WjtZ lZOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738233460; x=1738838260; 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=crB/f7vCa5hLa4LpwRk/HholuVWafRL1UUnQ0YPYia4=; b=flxQk5A87/8Y4IfD6ikVzZTlyUpI87hrD3Vh3OcPKdphso7pK9UyULvCipJemKaGcR v/7L0i7yeFheG41/y91GqF/ZMgT6+7K4ZtNDvHvwIly85d7n26hFfnqVIHt3o2DWUFvN 3JbW0LTq9RjmnNEHRgPhONEJci+kIVLXfoPD9HjqJsGcNtbO2+cEyr854iyjEe9kgr4Z /EmW9jo7uU/YjvazOC30E3O5Vp0fyto/RKHrc+x5KW6Vy64fPUbapp3KOL7mqM6X3UYF 4N3FGss+Mq1lqaT4lt9M4RGiWx5J9LuafxBLPm7MOspBOBue6MvdIcThufNWhRMlRYxS q7Sw== X-Forwarded-Encrypted: i=1; AJvYcCUtME4wwEVFzxvT99/J23ltIP05RBzSxANI/PG0eP9y/W6M+dPUpVdNNmmlMubZM1ucso+ikpSpFxw=@lists.xenproject.org X-Gm-Message-State: AOJu0YzcDYOxeNcdd2PA4Cejsdc/rOhb/6sefOsZr3lE1SfHQSOCOm8P 24MtYooUc3wSAiqnqzg058R+afZEXkMcUzlKxC/pSM/gKW49yf4jeWMM4HRnRYc= X-Gm-Gg: ASbGncuSOfcz3YcTlXaqNcCEfkdVzyxqImAgPPdfQvF5bWXryzEBQlHe4qwtO1sgT/j T7CGgyUF8NEJJ6mOZFkxZfJvwRPKqGYKFU0z/EfFbLcfxAb3bjIYhEO0Mu2HTT4wz3m/nBVS+UD lg9bsvdOVuNMfzkWqnPDzSVhX/S/ERTtya+QFDvMroP0Se1Rn/Lp6nWM9K7ECJS8KwhiTnX/TOw nA31vZLVD+GDVOx3Ln332jt41lM3RMRSF5jH6Dt4969kXc19CDLCy7a1FZ0xcfu+ymnhWBwQ9BG /bSYvLTsnvYOvkKMc6Qr3IRVAoiTZueya1vNuWf49UYuEUC2itpBlGuhAZXjxHwVlw== X-Google-Smtp-Source: AGHT+IF1gLQHPAIuuIgyNdXKa7cL163sNFjn/3xyiZz/AIADfj2BGfFziESdqjtD8ZX3WUVzbzP+cQ== X-Received: by 2002:a05:600c:190e:b0:438:d9ae:337b with SMTP id 5b1f17b1804b1-438dc3ca414mr59396625e9.17.1738233459802; Thu, 30 Jan 2025 02:37:39 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Paolo Bonzini , Bernhard Beschow , Thomas Huth , Markus Armbruster , Akihiko Odaki , Fabiano Rosas , Phil Dennis-Jordan , xen-devel@lists.xenproject.org, Laurent Vivier , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v2 2/2] tests/qtest: Make qtest_has_accel() generic Date: Thu, 30 Jan 2025 11:37:28 +0100 Message-ID: <20250130103728.536-3-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250130103728.536-1-philmd@linaro.org> References: <20250130103728.536-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1738233482106019000 Since commit b14a0b7469f ("accel: Use QOM classes for accel types") accelerators are registered as QOM objects. Use QOM as a generic API to query for available accelerators. This is in particular useful to query hardware accelerators such HFV, Xen or WHPX which otherwise have their definitions poisoned in "exec/poison.h". Reviewed-by: Thomas Huth Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Akihiko Odaki --- tests/qtest/libqtest.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c index 7e9366ad6d5..a55ac57ff7e 100644 --- a/tests/qtest/libqtest.c +++ b/tests/qtest/libqtest.c @@ -30,6 +30,7 @@ =20 #include "libqtest.h" #include "libqmp.h" +#include "qemu/accel.h" #include "qemu/ctype.h" #include "qemu/cutils.h" #include "qemu/sockets.h" @@ -1030,13 +1031,10 @@ static bool qtest_qom_has_concrete_type(const char = *parent_typename, =20 bool qtest_has_accel(const char *accel_name) { - if (g_str_equal(accel_name, "tcg")) { -#if defined(CONFIG_TCG) - return true; -#else - return false; -#endif - } else if (g_str_equal(accel_name, "kvm")) { + static QList *list; + g_autofree char *accel_type =3D NULL; + + if (g_str_equal(accel_name, "kvm")) { int i; const char *arch =3D qtest_get_arch(); const char *targets[] =3D { CONFIG_KVM_TARGETS }; @@ -1048,11 +1046,12 @@ bool qtest_has_accel(const char *accel_name) } } } - } else { - /* not implemented */ - g_assert_not_reached(); + return false; } - return false; + + accel_type =3D g_strconcat(accel_name, ACCEL_CLASS_SUFFIX, NULL); + + return qtest_qom_has_concrete_type("accel", accel_type, &list); } =20 bool qtest_get_irq(QTestState *s, int num) --=20 2.47.1