From patchwork Tue Jan 28 11:18:21 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 860390 Delivered-To: patch@linaro.org Received: by 2002:a5d:6b8c:0:b0:385:e875:8a9e with SMTP id n12csp297760wrx; Tue, 28 Jan 2025 03:19:23 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWNhNMVgeUfGFwFQi3xNw8tmRl+ivdMFbF/kIM+y7J5eiLiDRtvaPDQR/dnfMoTXK075ByrwA==@linaro.org X-Google-Smtp-Source: AGHT+IEfMBEAuhGKaUUAMMHvLD+3g9IXvULcro5ABWZ1kUBRgIOv6y/rOikKBJ6o59mzv1dvQquW X-Received: by 2002:a05:622a:28c:b0:467:6c95:19e5 with SMTP id d75a77b69052e-46e12a0c21fmr650384131cf.8.1738063163456; Tue, 28 Jan 2025 03:19:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1738063163; cv=none; d=google.com; s=arc-20240605; b=b7o1r/Hb54/uvGhLHstu+hSmnbhUPHRxpB/0lmpjFmGCtQdC7Ge+auZFd+otbVOUQ8 hTjXXfTY9UgEya2TF8JmRu1ruyvWtyV7L9QYFsvBPHX1sf8xkiLj4yJ4wz+TXO04xCYl rbjfMT1RKHwOK8tyB8v435sAAYNEOsJqyAbOboB3FrUfYXAxbzaxiMAC8z9h+QyeS6Cn 8hCZWzNdIGYFjOWnz/Eoz6+oKIpaL441LbbAInzMcDwVsrpqGRDKeaRXTnVbbq64tVA7 bI5XPytzSMl+buU44+qIRFeKvYWoiwo+Y93fXfeSAY/ALxhycMDpZ54YXhh8pfBmXoVL gnVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=PN2sEDLcal0RxGhKQBHLWKpiMjFeqeXkP17+0wDdg70=; fh=dsJNptj/jPUPwxfpQFcIkopVEPq3MWeZobwsY/YrgAA=; b=EBJnWMHDGIl/I5xSt/TcCc67E69ewmum2wQd3ImOY3zYqvhREH1fhgx20TC0wWvz96 FXgSBYk+Rgtecoz+1VWXGjK9JKVy6lFaft7jkpRcdWRFNmNTOebvdtwFxIDTe2Z09Lxd qVQM6aVu8s4fleFcCJqUiBydsti2wrqPvGdPPr95XY3G/oOJq9FrZjnyZ5tie2rHYjvH 7GJvwozr2BmMqS7QBNCP2qIVT5Fl+rC2NWZnRdspQxMZHqkuhWDwee3rpYbSmvzt56JG X2Z4S94/PEubTrMcWo1ssB8g/AmhgqjfIDVR/G7P6wf+5e0nCAJaI0ezwCCxEy64y0cE zE3w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=I4HN59Gl; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-46e6686c146si135845341cf.81.2025.01.28.03.19.23 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 28 Jan 2025 03:19:23 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=I4HN59Gl; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tcjcB-0002JM-3c; Tue, 28 Jan 2025 06:18:44 -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 1tcjc4-0002Ew-Pt for qemu-devel@nongnu.org; Tue, 28 Jan 2025 06:18:38 -0500 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tcjc2-00056a-CS for qemu-devel@nongnu.org; Tue, 28 Jan 2025 06:18:36 -0500 Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-38633b5dbcfso6152319f8f.2 for ; Tue, 28 Jan 2025 03:18:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1738063112; x=1738667912; 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=PN2sEDLcal0RxGhKQBHLWKpiMjFeqeXkP17+0wDdg70=; b=I4HN59Gl6vhGqXO+mQgEL5ronJxsyNLpSxdLQSMjEcKSA8UzHiLKEbOBzxu0roMTEV ltwEo7d6cDmGZOV2Ml833DmqTTMl1ePerPP0SxZPcL+xMfFbGO47w7H8toECAouexZhX x6hKY55XN7kQHfLMSb9znqyAYUG9k6N7YSfSyVs7MUBj4Q6AVu5or9NqyA2NdhLqR6eN +VRB7aGTXzheIA9YHbjJvcKmOk4NioeVsuyeSSQloXndryHIQJ9qijoBjqkL+RXlChsm iVm4jDlc5U6ekzMuVZpqdE0Z/YwbmPuj1eyoPzNT/xH1VvbhZ3zyhnRLiORaBhWOgE5v hw0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738063112; x=1738667912; 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=PN2sEDLcal0RxGhKQBHLWKpiMjFeqeXkP17+0wDdg70=; b=YwO+d6eGhPP758HHHbi5X1X7D7Z8X6hGftyuaUAASfZ/sA7PGRr+T/ZQtqsq0GjRnC ZEKWOW2ystOPXU8RmbkQP0Uc/6n+pj01H3rUhf3VaUxjKP7V0oevQBofu1JNsEm7y605 U0pkCModgHZrNkaCukMzCqNmS4eKFZVFYwbQ1JWbyhfjnGHfSmzVsDmPJT7+SFVYq31u nYR6sfnMRd3b4D6+JbdpOyHuTZI2P6ea6Qqn8lYVq3NijopTv/00kfsKXDiYGu3IW6E6 5xyb04BvujRttf0of0d5X/JeLkfI2oBokSaE+Cecvcmo8fDc0i77uDn/R0cpDbI2OC6o cwxA== X-Gm-Message-State: AOJu0YyEVsHE5ZhvaB5AL5W02++AcYTg/2uB3eR1kQKGQPbp05+m+PN0 ODXP/RwJ4793XXvGd3PN158XdxgUnZO3EZ07POpRNxCz2lfWvqGusLD6z8xs+exe3jrsr9o3gB6 QQyw= X-Gm-Gg: ASbGncvn5ry1Aqy3Z48AbRjOw3FRmgCkggA6UTVLQQJWBoUY+KPophT0ReVGi4T2V4N s1gWwLggLAYY3pv7FnwrTAPDOx29W3feVJ7YOte4i3N5E7xE1IxAjOgTSw+Y9EHj8tWhTwOSUGw nM2J1Nq8W6SqK6ooAncJ2PilDRhVzoOyuiG6uLvMv9ng72WU9V2aGJbCis1Opz5IwZ5orZDv6u6 jTggW+6uME0DTU9zGXyqtYhOY1DWrOwa0xx9zl64qkA/P5rpU+xC3ANpQVQG6Th8COnnwOECbVu OasFz2vyt2QmojtjAtnX+3x7JWySimuE+MtmWXU3Us84fThJR8ZPmCmQIAeaKlaR7Q== X-Received: by 2002:a5d:54ce:0:b0:38a:88ac:ed14 with SMTP id ffacd0b85a97d-38bf5659e26mr28903902f8f.19.1738063112306; Tue, 28 Jan 2025 03:18:32 -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-38c2a18931esm14090518f8f.60.2025.01.28.03.18.31 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 28 Jan 2025 03:18:31 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: xen-devel@lists.xenproject.org, =?utf-8?q?Daniel_P_=2E_Berrang=C3=A9?= , Fabiano Rosas , Markus Armbruster , Thomas Huth , Laurent Vivier , Phil Dennis-Jordan , Bernhard Beschow , Akihiko Odaki , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 2/2] tests/qtest: Make qtest_has_accel() generic Date: Tue, 28 Jan 2025 12:18:21 +0100 Message-ID: <20250128111821.93767-3-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250128111821.93767-1-philmd@linaro.org> References: <20250128111821.93767-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42c; envelope-from=philmd@linaro.org; helo=mail-wr1-x42c.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=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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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". Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Thomas Huth --- 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..3071dedeff6 100644 --- a/tests/qtest/libqtest.c +++ b/tests/qtest/libqtest.c @@ -30,6 +30,7 @@ #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, 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 = NULL; + + if (g_str_equal(accel_name, "kvm")) { int i; const char *arch = qtest_get_arch(); const char *targets[] = { 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 = g_strdup_printf("%s%s", accel_name, ACCEL_CLASS_SUFFIX); + + return qtest_qom_has_concrete_type("accel", accel_type, &list); } bool qtest_get_irq(QTestState *s, int num)