From patchwork Mon Feb 3 16:59:37 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Fabiano Rosas X-Patchwork-Id: 861571 Delivered-To: patch@linaro.org Received: by 2002:adf:fb05:0:b0:385:e875:8a9e with SMTP id c5csp2125242wrr; Mon, 3 Feb 2025 09:00:22 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUvwAiRq4dZfpdftC55Ok7FUPWivF+b/kLd5+ar1s1gaTRzjG4EO5grHqyxI7ki4is7+EsY2w==@linaro.org X-Google-Smtp-Source: AGHT+IFIq9frAlgC7+mifXWBICLfoN4WRwfhQ5Mv0NlWiVdvUlBmcY7P9fH2oTrk1NLueo4cEJWi X-Received: by 2002:a05:622a:4:b0:466:9ab3:c2c7 with SMTP id d75a77b69052e-470186d31e3mr227491cf.14.1738602021732; Mon, 03 Feb 2025 09:00:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1738602021; cv=none; d=google.com; s=arc-20240605; b=YUog8oBADJHPZ5RTabQBc3J7sYgSc4PBT89L2B31MfkC6uDMETfHpZpI1Vv+KJhOW6 1C1UC/J3AqOAbem9y9gWO6WaHMr9hmj4h+WM35PwSnll11dr/ct1EHyvzdZ61TjHzdpC EaQkfTTrp6Fp9yu712H2p06249HJ/SvM9Vlqf3ZPyPauh1JtvC7nnog+Lm3YFwGo7eNH tZ8HuVNw3JgICBkq7GNFjde9t0JdgceUGtjXNbSa3IQcCCuu+5sMyDNJ4McQJId/QsFu 9iCNzIaj3GhrD+ZfnVxumvovgVXGBmPXFhSb7b5yYqxiebvwkfjPZAh36zya0pTsDlIc kxXQ== 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:dkim-signature:dkim-signature:dkim-signature; bh=7fBhyOPw+uV+tDm35m3Dodwm2GOVrzdUMocvY919AmQ=; fh=jSaGO2ykaUHOw+MsYsOxK5I6lqRZyc5wbWAXO+flk9I=; b=L1Wh3gYM9XStjbKg3qJvdRlQY3JLmWuDHzPRzNizQJv7+A4J/XQg8T+NSnuALDxNrJ K1vj0OTkYLdSnMkAir5zvGCNd11CLPZkxGhMSlEDs7ooy5xyMHZbwSPGBBGQc61/3XtD QkiJV+yJQahZqlWjsMcYNNssv7WQjHT1PB9wE9899fC50t72tX/IUaQWk33skAa5ZkRq 5QqOA++SiLxuEMRx7p4cuGAsWMEWkEyrfqV3pjcyfbfhXpsVbbDoE9HMGIOt5B1eGw7g IlvfjOh0Smo9PeZOf573vgAOAMI+Tx8zZx5PhSzAudMFx9TxMrKjg6vV5/IVyqYMhAvo U+Vw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=hXmTMvRy; dkim=neutral (no key) header.i=@suse.de; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=hXmTMvRy; dkim=neutral (no key) header.i=@suse.de; 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=suse.de Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-47016ba0f84si5628241cf.382.2025.02.03.09.00.21 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 03 Feb 2025 09:00:21 -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=@suse.de header.s=susede2_rsa header.b=hXmTMvRy; dkim=neutral (no key) header.i=@suse.de; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=hXmTMvRy; dkim=neutral (no key) header.i=@suse.de; 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=suse.de Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1teznf-0006Dw-Tz; Mon, 03 Feb 2025 11:59:55 -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 1teznf-0006Dg-4T for qemu-devel@nongnu.org; Mon, 03 Feb 2025 11:59:55 -0500 Received: from smtp-out2.suse.de ([2a07:de40:b251:101:10:150:64:2]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1teznd-0001Od-IW for qemu-devel@nongnu.org; Mon, 03 Feb 2025 11:59:54 -0500 Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id CFD781F381; Mon, 3 Feb 2025 16:59:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1738601991; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7fBhyOPw+uV+tDm35m3Dodwm2GOVrzdUMocvY919AmQ=; b=hXmTMvRyd87zkpwvv5UV5Vu/LFzmrFgGw42mKDguszhWk8ffZ6QzJzV6UA5tK44Wz5drRG +w/0QpXB0zWvXs4QuBxcivLBjLY9DPJL13NTcecLHxuC1Fvi35tAKx9GXc4mnk45YOQqeW GdyeVmt4CyfvP7c5AAUEhxEE6Gt1Yrc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1738601991; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7fBhyOPw+uV+tDm35m3Dodwm2GOVrzdUMocvY919AmQ=; b=UsFXYXz8rdGE5CkpbbyE8MS2YommWyT5mA8I3jayTIrs7/ryvwJ2ijOcu1B8cTBv1HdPWe s9tpnH5pW+arqcDw== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1738601991; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7fBhyOPw+uV+tDm35m3Dodwm2GOVrzdUMocvY919AmQ=; b=hXmTMvRyd87zkpwvv5UV5Vu/LFzmrFgGw42mKDguszhWk8ffZ6QzJzV6UA5tK44Wz5drRG +w/0QpXB0zWvXs4QuBxcivLBjLY9DPJL13NTcecLHxuC1Fvi35tAKx9GXc4mnk45YOQqeW GdyeVmt4CyfvP7c5AAUEhxEE6Gt1Yrc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1738601991; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7fBhyOPw+uV+tDm35m3Dodwm2GOVrzdUMocvY919AmQ=; b=UsFXYXz8rdGE5CkpbbyE8MS2YommWyT5mA8I3jayTIrs7/ryvwJ2ijOcu1B8cTBv1HdPWe s9tpnH5pW+arqcDw== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 29E5D13A78; Mon, 3 Feb 2025 16:59:49 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id mDNJNgX2oGfDdgAAD6G6ig (envelope-from ); Mon, 03 Feb 2025 16:59:49 +0000 From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Thomas Huth , Akihiko Odaki Subject: [PULL 5/6] tests/qtest: Make qtest_has_accel() generic Date: Mon, 3 Feb 2025 13:59:37 -0300 Message-Id: <20250203165938.14320-6-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20250203165938.14320-1-farosas@suse.de> References: <20250203165938.14320-1-farosas@suse.de> MIME-Version: 1.0 X-Spamd-Result: default: False [-3.30 / 50.00]; BAYES_HAM(-3.00)[99.99%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MIME_TRACE(0.00)[0:+]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; ARC_NA(0.00)[]; RCVD_TLS_ALL(0.00)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCPT_COUNT_THREE(0.00)[4]; FROM_HAS_DN(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_EQ_ENVFROM(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo] X-Spam-Score: -3.30 Received-SPF: pass client-ip=2a07:de40:b251:101:10:150:64:2; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Philippe Mathieu-Daudé 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 Reviewed-by: Akihiko Odaki Signed-off-by: Philippe Mathieu-Daudé Message-ID: <20250130103728.536-3-philmd@linaro.org> Signed-off-by: Fabiano Rosas --- 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 f416cf8a59..fe8606ba6a 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" @@ -1063,13 +1064,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 }; @@ -1081,11 +1079,12 @@ bool qtest_has_accel(const char *accel_name) } } } - } else { - /* not implemented */ - g_assert_not_reached(); + return false; } - return false; + + accel_type = g_strconcat(accel_name, ACCEL_CLASS_SUFFIX, NULL); + + return qtest_qom_has_concrete_type("accel", accel_type, &list); } bool qtest_get_irq(QTestState *s, int num)