From nobody Tue Apr 8 13:56:34 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=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1738602191; cv=none; d=zohomail.com; s=zohoarc; b=JH1omN06RfA68CKXhpOrnqzeaUFxFTnP3KWybKykNVqg/rPwuIZkn00mYpeAv45zii/cFVcbVrEW+G8/DAv8jM/Q4pZlrB2jnK8hH7iS3OoSzCMB8D3U9fgL9iyovSWcIc6SyIbShhSMyPXpVW31t4qpEi+IGPMwPiCVJrLrydU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1738602191; h=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=uG/0ZJ/Xxz/BLzmofmRVTfCL163uK0fqQ/R0xWxfNxo=; b=N3tU2527rCyEJLl+i5qBV+Oj40YMkj8b72AZ2699/DUl9e+R4NPkqUQ6uVJ2Zj4P6zlIxOFVZunZSKc6DEq+Qz5RLW+pUrx/muWIHpyHsq1emhXWkjD1XqppoEGm4V1l24MU1A2O7EeX35OJEKH8tBNuU+BDkGIn5et2vE4KFyE= 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 1738602191155327.92427273944463; Mon, 3 Feb 2025 09:03:11 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1teznZ-0006Ah-Hk; Mon, 03 Feb 2025 11:59:49 -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 1teznX-00069N-UR for qemu-devel@nongnu.org; Mon, 03 Feb 2025 11:59:47 -0500 Received: from smtp-out2.suse.de ([195.135.223.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1teznW-0001My-6I for qemu-devel@nongnu.org; Mon, 03 Feb 2025 11:59:47 -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 57B631F390; Mon, 3 Feb 2025 16:59:44 +0000 (UTC) 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 3CB5813A78; Mon, 3 Feb 2025 16:59:42 +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 IC+yOv71oGfDdgAAD6G6ig (envelope-from ); Mon, 03 Feb 2025 16:59:42 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1738601984; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=uG/0ZJ/Xxz/BLzmofmRVTfCL163uK0fqQ/R0xWxfNxo=; b=O41wfcPUVjk4JE49MUh86GM9dKWXAzaFN6TUx6QxxSr9x4kJqMAEJogMAHwbcjFZ1yj8kc gqpw5dr1QPYvb9L/eiCVmM2+c/ZThl6oiciQrmZhXl4i0XEvbL8CvahElyJXo5h3jwfaBH QcpLFDaZ9/qRneObjJoNEKt6BzMB4sw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1738601984; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=uG/0ZJ/Xxz/BLzmofmRVTfCL163uK0fqQ/R0xWxfNxo=; b=kR9+AnhMsxxwILSnUS71EVP+GBha/KFGLY2MAtPtSk6qL9KkiEnB5NpXwiCSB5308GMLX+ 3WtgnME21C1VX6DQ== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1738601984; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=uG/0ZJ/Xxz/BLzmofmRVTfCL163uK0fqQ/R0xWxfNxo=; b=O41wfcPUVjk4JE49MUh86GM9dKWXAzaFN6TUx6QxxSr9x4kJqMAEJogMAHwbcjFZ1yj8kc gqpw5dr1QPYvb9L/eiCVmM2+c/ZThl6oiciQrmZhXl4i0XEvbL8CvahElyJXo5h3jwfaBH QcpLFDaZ9/qRneObjJoNEKt6BzMB4sw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1738601984; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=uG/0ZJ/Xxz/BLzmofmRVTfCL163uK0fqQ/R0xWxfNxo=; b=kR9+AnhMsxxwILSnUS71EVP+GBha/KFGLY2MAtPtSk6qL9KkiEnB5NpXwiCSB5308GMLX+ 3WtgnME21C1VX6DQ== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Ani Sinha Subject: [PULL 1/6] libqos/fw_cfg: refactor file directory iteraton to make it more reusable Date: Mon, 3 Feb 2025 13:59:33 -0300 Message-Id: <20250203165938.14320-2-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 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.80 X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; RCPT_COUNT_TWO(0.00)[2]; RCVD_VIA_SMTP_AUTH(0.00)[]; MIME_TRACE(0.00)[0:+]; ARC_NA(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo]; RCVD_TLS_ALL(0.00)[] 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=195.135.223.131; 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, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, 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 @suse.de) X-ZM-MESSAGEID: 1738602193219019100 Content-Type: text/plain; charset="utf-8" From: Ani Sinha fw-cfg file directory iteration code can be used by other functions that may want to implement fw-cfg file operations. Refactor it into a smaller helper so that it can be reused. No functional change. Signed-off-by: Ani Sinha Reviewed-by: Fabiano Rosas Message-ID: <20250120043847.954881-2-anisinha@redhat.com> Signed-off-by: Fabiano Rosas --- tests/qtest/libqos/fw_cfg.c | 67 +++++++++++++++++++++++-------------- 1 file changed, 42 insertions(+), 25 deletions(-) diff --git a/tests/qtest/libqos/fw_cfg.c b/tests/qtest/libqos/fw_cfg.c index 89f053ccac..22435873d9 100644 --- a/tests/qtest/libqos/fw_cfg.c +++ b/tests/qtest/libqos/fw_cfg.c @@ -60,27 +60,18 @@ static void mm_fw_cfg_select(QFWCFG *fw_cfg, uint16_t k= ey) qtest_writew(fw_cfg->qts, fw_cfg->base, key); } =20 -/* - * The caller need check the return value. When the return value is - * nonzero, it means that some bytes have been transferred. - * - * If the fw_cfg file in question is smaller than the allocated & passed-in - * buffer, then the buffer has been populated only in part. - * - * If the fw_cfg file in question is larger than the passed-in - * buffer, then the return value explains how much room would have been - * necessary in total. And, while the caller's buffer has been fully - * populated, it has received only a starting slice of the fw_cfg file. - */ -size_t qfw_cfg_get_file(QFWCFG *fw_cfg, const char *filename, - void *data, size_t buflen) +static bool find_pdir_entry(QFWCFG *fw_cfg, const char *filename, + uint16_t *sel, uint32_t *size) { + g_autofree unsigned char *filesbuf =3D NULL; uint32_t count; - uint32_t i; - unsigned char *filesbuf =3D NULL; size_t dsize; FWCfgFile *pdir_entry; - size_t filesize =3D 0; + uint32_t i; + bool found =3D false; + + *size =3D 0; + *sel =3D 0; =20 qfw_cfg_get(fw_cfg, FW_CFG_FILE_DIR, &count, sizeof(count)); count =3D be32_to_cpu(count); @@ -90,17 +81,43 @@ size_t qfw_cfg_get_file(QFWCFG *fw_cfg, const char *fil= ename, pdir_entry =3D (FWCfgFile *)(filesbuf + sizeof(uint32_t)); for (i =3D 0; i < count; ++i, ++pdir_entry) { if (!strcmp(pdir_entry->name, filename)) { - uint32_t len =3D be32_to_cpu(pdir_entry->size); - uint16_t sel =3D be16_to_cpu(pdir_entry->select); - filesize =3D len; - if (len > buflen) { - len =3D buflen; - } - qfw_cfg_get(fw_cfg, sel, data, len); + *size =3D be32_to_cpu(pdir_entry->size); + *sel =3D be16_to_cpu(pdir_entry->select); + found =3D true; break; } } - g_free(filesbuf); + + return found; +} + +/* + * The caller need check the return value. When the return value is + * nonzero, it means that some bytes have been transferred. + * + * If the fw_cfg file in question is smaller than the allocated & passed-in + * buffer, then the buffer has been populated only in part. + * + * If the fw_cfg file in question is larger than the passed-in + * buffer, then the return value explains how much room would have been + * necessary in total. And, while the caller's buffer has been fully + * populated, it has received only a starting slice of the fw_cfg file. + */ +size_t qfw_cfg_get_file(QFWCFG *fw_cfg, const char *filename, + void *data, size_t buflen) +{ + size_t filesize =3D 0; + uint32_t len; + uint16_t sel; + + if (find_pdir_entry(fw_cfg, filename, &sel, &len)) { + filesize =3D len; + if (len > buflen) { + len =3D buflen; + } + qfw_cfg_get(fw_cfg, sel, data, len); + } + return filesize; } =20 --=20 2.35.3 From nobody Tue Apr 8 13:56:34 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=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1738602074; cv=none; d=zohomail.com; s=zohoarc; b=SKYIh0ceookJAiu29nLnnKcAaZ/TWtKRGZUZZCAt6+YF2Z9IuGlV0a5hUcCdh9mercDZd4dgECBbeaV1hyKNbOCbes3oO4zei2Yx+PA9k98nbw9o4rCJn90ihVRfeXp5X8BZ6aIZsUDbQSJ3fgYbfZmxdW5Xh/JyTFnBIQDkOBw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1738602074; h=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=DPDNLTWVN+OE+ok9AnUcFNvZ/BKBAvYZt5DIrYZfToE=; b=ALRoUweA/4rxsdZ6r5abWF46izHOD3Lj1Bn0KV3lGxCOxIQXayFrdxUxhH6t6+H1ykv5GwvvaUnXH/Oc1BjZPsqbPDuXFPAFAX+yKbw2coOVASVo7vbEDMX/JTu9ISz4cBr+ojOj617XbI6E3VzJThytBP5NwmOXGQPixBpsUgA= 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 1738602074169984.0110530773026; Mon, 3 Feb 2025 09:01:14 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tezna-0006BB-NP; Mon, 03 Feb 2025 11:59:50 -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 1teznZ-0006AL-7k for qemu-devel@nongnu.org; Mon, 03 Feb 2025 11:59:49 -0500 Received: from smtp-out1.suse.de ([195.135.223.130]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1teznX-0001N9-58 for qemu-devel@nongnu.org; Mon, 03 Feb 2025 11:59:48 -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-out1.suse.de (Postfix) with ESMTPS id E662A21161; Mon, 3 Feb 2025 16:59:45 +0000 (UTC) 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 D37C713A78; Mon, 3 Feb 2025 16:59:44 +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 CGUKJAD2oGfDdgAAD6G6ig (envelope-from ); Mon, 03 Feb 2025 16:59:44 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1738601985; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DPDNLTWVN+OE+ok9AnUcFNvZ/BKBAvYZt5DIrYZfToE=; b=D1eb0gqACB3BNqhSGM4UFTWMr1qMvD30n/PV6zSNlLt+TnTq+6rQD+MWKLjj+squxUsjZA tecVKdhukknAwAH18Gb+6Xh1UszItp8N3FjG19Zf14xYShdbiMOJESdVFEebEYf6E2NBkK XVErpMeELn1eiAfMWXVOmg4I9VaFcFY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1738601985; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DPDNLTWVN+OE+ok9AnUcFNvZ/BKBAvYZt5DIrYZfToE=; b=//m/Q3IBxlFWq0jFMlM0yvKr/ybo/DJpQH1ZkQWRsBubhzvFJ81X8zT5CFmZEUv8fWVtnC yTMseNJzGLh7htCA== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1738601985; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DPDNLTWVN+OE+ok9AnUcFNvZ/BKBAvYZt5DIrYZfToE=; b=D1eb0gqACB3BNqhSGM4UFTWMr1qMvD30n/PV6zSNlLt+TnTq+6rQD+MWKLjj+squxUsjZA tecVKdhukknAwAH18Gb+6Xh1UszItp8N3FjG19Zf14xYShdbiMOJESdVFEebEYf6E2NBkK XVErpMeELn1eiAfMWXVOmg4I9VaFcFY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1738601985; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DPDNLTWVN+OE+ok9AnUcFNvZ/BKBAvYZt5DIrYZfToE=; b=//m/Q3IBxlFWq0jFMlM0yvKr/ybo/DJpQH1ZkQWRsBubhzvFJ81X8zT5CFmZEUv8fWVtnC yTMseNJzGLh7htCA== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Ani Sinha Subject: [PULL 2/6] tests/qtest/libqos: add DMA support for writing and reading fw_cfg files Date: Mon, 3 Feb 2025 13:59:34 -0300 Message-Id: <20250203165938.14320-3-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 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.80 X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; RCPT_COUNT_TWO(0.00)[2]; RCVD_VIA_SMTP_AUTH(0.00)[]; MIME_TRACE(0.00)[0:+]; ARC_NA(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo]; RCVD_TLS_ALL(0.00)[] 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=195.135.223.130; envelope-from=farosas@suse.de; helo=smtp-out1.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, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, 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 @suse.de) X-ZM-MESSAGEID: 1738602076795019100 Content-Type: text/plain; charset="utf-8" From: Ani Sinha At present, the libqos/fw_cfg.c library does not support the modern DMA interface which is required to write to the fw_cfg files. It only uses the = IO interface. Implement read and write methods based on DMA. This will enable developers to add tests that writes to the fw_cfg file(s). The structure of the code is taken from edk2 fw_cfg implementation. It has been tested by writing a qtest that writes to a fw_cfg file. Signed-off-by: Ani Sinha Message-ID: <20250120043847.954881-3-anisinha@redhat.com> Signed-off-by: Fabiano Rosas --- tests/qtest/libqos/fw_cfg.c | 139 ++++++++++++++++++++++++++++++++++++ tests/qtest/libqos/fw_cfg.h | 6 +- 2 files changed, 144 insertions(+), 1 deletion(-) diff --git a/tests/qtest/libqos/fw_cfg.c b/tests/qtest/libqos/fw_cfg.c index 22435873d9..0ab3959171 100644 --- a/tests/qtest/libqos/fw_cfg.c +++ b/tests/qtest/libqos/fw_cfg.c @@ -14,6 +14,8 @@ =20 #include "qemu/osdep.h" #include "fw_cfg.h" +#include "malloc-pc.h" +#include "libqos-malloc.h" #include "../libqtest.h" #include "qemu/bswap.h" #include "hw/nvram/fw_cfg.h" @@ -60,6 +62,60 @@ static void mm_fw_cfg_select(QFWCFG *fw_cfg, uint16_t ke= y) qtest_writew(fw_cfg->qts, fw_cfg->base, key); } =20 +static void qfw_cfg_dma_transfer(QFWCFG *fw_cfg, QOSState *qs, void *addre= ss, + uint32_t length, uint32_t control) +{ + FWCfgDmaAccess access; + uint32_t addr; + uint64_t guest_access_addr; + uint64_t gaddr; + + /* create a data buffer in guest memory */ + gaddr =3D guest_alloc(&qs->alloc, length); + + if (control & FW_CFG_DMA_CTL_WRITE) { + qtest_bufwrite(fw_cfg->qts, gaddr, address, length); + } + access.address =3D cpu_to_be64(gaddr); + access.length =3D cpu_to_be32(length); + access.control =3D cpu_to_be32(control); + + /* now create a separate buffer in guest memory for 'access' */ + guest_access_addr =3D guest_alloc(&qs->alloc, sizeof(access)); + qtest_bufwrite(fw_cfg->qts, guest_access_addr, &access, sizeof(access)= ); + + /* write lower 32 bits of address */ + addr =3D cpu_to_be32((uint32_t)(uintptr_t)guest_access_addr); + qtest_outl(fw_cfg->qts, fw_cfg->base + 8, addr); + + /* write upper 32 bits of address */ + addr =3D cpu_to_be32((uint32_t)(uintptr_t)(guest_access_addr >> 32)); + qtest_outl(fw_cfg->qts, fw_cfg->base + 4, addr); + + g_assert(!(be32_to_cpu(access.control) & FW_CFG_DMA_CTL_ERROR)); + + if (control & FW_CFG_DMA_CTL_READ) { + qtest_bufread(fw_cfg->qts, gaddr, address, length); + } + + guest_free(&qs->alloc, guest_access_addr); + guest_free(&qs->alloc, gaddr); +} + +static void qfw_cfg_write_entry(QFWCFG *fw_cfg, QOSState *qs, uint16_t key, + void *buf, uint32_t len) +{ + qfw_cfg_select(fw_cfg, key); + qfw_cfg_dma_transfer(fw_cfg, qs, buf, len, FW_CFG_DMA_CTL_WRITE); +} + +static void qfw_cfg_read_entry(QFWCFG *fw_cfg, QOSState *qs, uint16_t key, + void *buf, uint32_t len) +{ + qfw_cfg_select(fw_cfg, key); + qfw_cfg_dma_transfer(fw_cfg, qs, buf, len, FW_CFG_DMA_CTL_READ); +} + static bool find_pdir_entry(QFWCFG *fw_cfg, const char *filename, uint16_t *sel, uint32_t *size) { @@ -121,6 +177,89 @@ size_t qfw_cfg_get_file(QFWCFG *fw_cfg, const char *fi= lename, return filesize; } =20 +/* + * The caller need check the return value. When the return value is + * nonzero, it means that some bytes have been transferred. + * + * If the fw_cfg file in question is smaller than the allocated & passed-in + * buffer, then the first len bytes were read. + * + * If the fw_cfg file in question is larger than the passed-in + * buffer, then the return value explains how much was actually read. + * + * It is illegal to call this function if fw_cfg does not support DMA + * interface. The caller should ensure that DMA is supported before + * calling this function. + * + * Passed QOSState pointer qs must be initialized. qs->alloc must also be + * properly initialized. + */ +size_t qfw_cfg_read_file(QFWCFG *fw_cfg, QOSState *qs, const char *filenam= e, + void *data, size_t buflen) +{ + uint32_t len =3D 0; + uint16_t sel; + uint32_t id; + + g_assert(qs); + g_assert(filename); + g_assert(data); + g_assert(buflen); + /* check if DMA is supported since we use DMA for read */ + id =3D qfw_cfg_get_u32(fw_cfg, FW_CFG_ID); + g_assert(id & FW_CFG_VERSION_DMA); + + if (find_pdir_entry(fw_cfg, filename, &sel, &len)) { + if (len > buflen) { + len =3D buflen; + } + qfw_cfg_read_entry(fw_cfg, qs, sel, data, len); + } + + return len; +} + +/* + * The caller need check the return value. When the return value is + * nonzero, it means that some bytes have been transferred. + * + * If the fw_cfg file in question is smaller than the allocated & passed-in + * buffer, then the buffer has been partially written. + * + * If the fw_cfg file in question is larger than the passed-in + * buffer, then the return value explains how much was actually written. + * + * It is illegal to call this function if fw_cfg does not support DMA + * interface. The caller should ensure that DMA is supported before + * calling this function. + * + * Passed QOSState pointer qs must be initialized. qs->alloc must also be + * properly initialized. + */ +size_t qfw_cfg_write_file(QFWCFG *fw_cfg, QOSState *qs, const char *filena= me, + void *data, size_t buflen) +{ + uint32_t len =3D 0; + uint16_t sel; + uint32_t id; + + g_assert(qs); + g_assert(filename); + g_assert(data); + g_assert(buflen); + /* write operation is only valid if DMA is supported */ + id =3D qfw_cfg_get_u32(fw_cfg, FW_CFG_ID); + g_assert(id & FW_CFG_VERSION_DMA); + + if (find_pdir_entry(fw_cfg, filename, &sel, &len)) { + if (len > buflen) { + len =3D buflen; + } + qfw_cfg_write_entry(fw_cfg, qs, sel, data, len); + } + return len; +} + static void mm_fw_cfg_read(QFWCFG *fw_cfg, void *data, size_t len) { uint8_t *ptr =3D data; diff --git a/tests/qtest/libqos/fw_cfg.h b/tests/qtest/libqos/fw_cfg.h index b0456a15df..6d6ff09725 100644 --- a/tests/qtest/libqos/fw_cfg.h +++ b/tests/qtest/libqos/fw_cfg.h @@ -14,6 +14,7 @@ #define LIBQOS_FW_CFG_H =20 #include "../libqtest.h" +#include "libqos.h" =20 typedef struct QFWCFG QFWCFG; =20 @@ -33,7 +34,10 @@ uint32_t qfw_cfg_get_u32(QFWCFG *fw_cfg, uint16_t key); uint64_t qfw_cfg_get_u64(QFWCFG *fw_cfg, uint16_t key); size_t qfw_cfg_get_file(QFWCFG *fw_cfg, const char *filename, void *data, size_t buflen); - +size_t qfw_cfg_write_file(QFWCFG *fw_cfg, QOSState *qs, const char *filena= me, + void *data, size_t buflen); +size_t qfw_cfg_read_file(QFWCFG *fw_cfg, QOSState *qs, const char *filenam= e, + void *data, size_t buflen); QFWCFG *mm_fw_cfg_init(QTestState *qts, uint64_t base); void mm_fw_cfg_uninit(QFWCFG *fw_cfg); QFWCFG *io_fw_cfg_init(QTestState *qts, uint16_t base); --=20 2.35.3 From nobody Tue Apr 8 13:56:34 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=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1738602089; cv=none; d=zohomail.com; s=zohoarc; b=geT75xk5ppc98x97UDsEb9QUVPEVYdf5Ors2Hyp9IvQtDewwoAINsh6cjhmXzQ1PbrRs13NAAlNSju60c798WuAZdZLgMG3vcWZa2WezixiP7e4Pm602hkmF0BTM5NueMVo8yVJtU+Mmo2+eerMO/E0c/EuEV8Ge/5mNwk4jZKA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1738602089; 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=OmHuD75OpXLe1iwiCge0smuv5ceTKz9zfyIrk9gDRa4=; b=RsgLkYcRsmDlh/Fb/GZDlsTfQfeNzhYRrDrp6VGbQ9k5RUTXuIMpZr6Lwb8N9x/2vqMjM9GsvaEan2CfRlvJoMUezoPMJn2/W3ab2G89kU16+r1KCpQMgyjzKJycB6tUm96mmamrHAtaSB+EBNs4o2WLEuyd/JJw2+ZynCbuDug= 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 1738602089867500.92885795221787; Mon, 3 Feb 2025 09:01:29 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1teznb-0006CY-Ux; Mon, 03 Feb 2025 11:59:51 -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 1tezna-0006BI-Lb for qemu-devel@nongnu.org; Mon, 03 Feb 2025 11:59:50 -0500 Received: from smtp-out2.suse.de ([195.135.223.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1teznY-0001NT-Ns for qemu-devel@nongnu.org; Mon, 03 Feb 2025 11:59:50 -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 83FCD1F381; Mon, 3 Feb 2025 16:59:47 +0000 (UTC) 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 6F13813A78; Mon, 3 Feb 2025 16:59:46 +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 WHd/CwL2oGfDdgAAD6G6ig (envelope-from ); Mon, 03 Feb 2025 16:59:46 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1738601987; 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=OmHuD75OpXLe1iwiCge0smuv5ceTKz9zfyIrk9gDRa4=; b=tGW1sD3yO6lGJ0s0vXsePiHBXprAJDnC8OPbuzklkAfQvZpvARzU924T23rHH2m1s+QhqG 2JJSFdQZ0/6KebGuaB1t240cs6mjXSMEu7pbrVMFzLmyUkQSxu5YPpLebJS9SQwB/A93ZK hyxEqXASeZDKN1+UNxDub2288wONSCI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1738601987; 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=OmHuD75OpXLe1iwiCge0smuv5ceTKz9zfyIrk9gDRa4=; b=WO86BEYykb2tRxDF7D6Nb0S8QpKJlQZoWlf5/caK69Fc2jS+fXDijTCfRNKPAJh4ySl1Uc S+9dgfVXS6EOCuBA== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1738601987; 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=OmHuD75OpXLe1iwiCge0smuv5ceTKz9zfyIrk9gDRa4=; b=tGW1sD3yO6lGJ0s0vXsePiHBXprAJDnC8OPbuzklkAfQvZpvARzU924T23rHH2m1s+QhqG 2JJSFdQZ0/6KebGuaB1t240cs6mjXSMEu7pbrVMFzLmyUkQSxu5YPpLebJS9SQwB/A93ZK hyxEqXASeZDKN1+UNxDub2288wONSCI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1738601987; 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=OmHuD75OpXLe1iwiCge0smuv5ceTKz9zfyIrk9gDRa4=; b=WO86BEYykb2tRxDF7D6Nb0S8QpKJlQZoWlf5/caK69Fc2jS+fXDijTCfRNKPAJh4ySl1Uc S+9dgfVXS6EOCuBA== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Ani Sinha Subject: [PULL 3/6] tests/qtest/vmcoreinfo: add a unit test to exercize basic vmcoreinfo function Date: Mon, 3 Feb 2025 13:59:35 -0300 Message-Id: <20250203165938.14320-4-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Spam-Score: -3.30 X-Spamd-Result: default: False [-3.30 / 50.00]; BAYES_HAM(-3.00)[100.00%]; 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]; FUZZY_BLOCKED(0.00)[rspamd.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_TWO(0.00)[2]; MIME_TRACE(0.00)[0:+]; ARC_NA(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCVD_TLS_ALL(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; TO_DN_SOME(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; RCVD_VIA_SMTP_AUTH(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo] 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=195.135.223.131; 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, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, 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 @suse.de) X-ZM-MESSAGEID: 1738602092788019100 From: Ani Sinha A new qtest is written that exercizes the fw-cfg DMA based read and write o= ps to write values into vmcoreinfo fw-cfg file and read them back and verify t= hat they are the same. Signed-off-by: Ani Sinha Message-ID: <20250120043847.954881-4-anisinha@redhat.com> Signed-off-by: Fabiano Rosas --- MAINTAINERS | 2 + tests/qtest/meson.build | 1 + tests/qtest/vmcoreinfo-test.c | 90 +++++++++++++++++++++++++++++++++++ 3 files changed, 93 insertions(+) create mode 100644 tests/qtest/vmcoreinfo-test.c diff --git a/MAINTAINERS b/MAINTAINERS index bf737eb6db..0cf37fce7b 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -3019,6 +3019,7 @@ F: include/system/device_tree.h Dump S: Supported M: Marc-Andr=C3=A9 Lureau +R: Ani Sinha F: dump/ F: hw/misc/vmcoreinfo.c F: include/hw/misc/vmcoreinfo.h @@ -3029,6 +3030,7 @@ F: qapi/dump.json F: scripts/dump-guest-memory.py F: stubs/dump.c F: docs/specs/vmcoreinfo.rst +F: tests/qtest/vmcoreinfo-test.c =20 Error reporting M: Markus Armbruster diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build index e60e92fe9d..5e062c752a 100644 --- a/tests/qtest/meson.build +++ b/tests/qtest/meson.build @@ -57,6 +57,7 @@ qtests_i386 =3D \ (config_all_devices.has_key('CONFIG_AHCI_ICH9') ? ['tco-test'] : []) + = \ (config_all_devices.has_key('CONFIG_FDC_ISA') ? ['fdc-test'] : []) + = \ (config_all_devices.has_key('CONFIG_I440FX') ? ['fw_cfg-test'] : []) + = \ + (config_all_devices.has_key('CONFIG_FW_CFG_DMA') ? ['vmcoreinfo-test'] := []) + \ (config_all_devices.has_key('CONFIG_I440FX') ? ['i440fx-test'] : []) + = \ (config_all_devices.has_key('CONFIG_I440FX') ? ['ide-test'] : []) + = \ (config_all_devices.has_key('CONFIG_I440FX') ? ['numa-test'] : []) + = \ diff --git a/tests/qtest/vmcoreinfo-test.c b/tests/qtest/vmcoreinfo-test.c new file mode 100644 index 0000000000..dcf3b5ae05 --- /dev/null +++ b/tests/qtest/vmcoreinfo-test.c @@ -0,0 +1,90 @@ +/* + * qtest vmcoreinfo test case + * + * Copyright Red Hat. 2025. + * + * Authors: + * Ani Sinha + * + * This work is licensed under the terms of the GNU GPL, version 2 or late= r. + * See the COPYING file in the top-level directory. + */ + +#include "qemu/osdep.h" +#include "qemu/units.h" +#include "libqos/libqos-pc.h" +#include "libqtest.h" +#include "standard-headers/linux/qemu_fw_cfg.h" +#include "libqos/fw_cfg.h" +#include "qemu/bswap.h" +#include "hw/misc/vmcoreinfo.h" + +static void test_vmcoreinfo_write_basic(void) +{ + QFWCFG *fw_cfg; + QOSState *qs; + FWCfgVMCoreInfo info; + size_t filesize; + uint16_t guest_format; + uint16_t host_format; + uint32_t size; + uint64_t paddr; + + qs =3D qtest_pc_boot("-device vmcoreinfo"); + fw_cfg =3D pc_fw_cfg_init(qs->qts); + + memset(&info, 0 , sizeof(info)); + /* read vmcoreinfo and read back the host format */ + filesize =3D qfw_cfg_read_file(fw_cfg, qs, FW_CFG_VMCOREINFO_FILENAME, + &info, sizeof(info)); + g_assert_cmpint(filesize, =3D=3D, sizeof(info)); + + host_format =3D le16_to_cpu(info.host_format); + g_assert_cmpint(host_format, =3D=3D, FW_CFG_VMCOREINFO_FORMAT_ELF); + + memset(&info, 0 , sizeof(info)); + info.guest_format =3D cpu_to_le16(FW_CFG_VMCOREINFO_FORMAT_ELF); + info.size =3D cpu_to_le32(1 * MiB); + info.paddr =3D cpu_to_le64(0xffffff00); + info.host_format =3D cpu_to_le16(host_format); + + /* write the values to the host */ + filesize =3D qfw_cfg_write_file(fw_cfg, qs, FW_CFG_VMCOREINFO_FILENAME, + &info, sizeof(info)); + g_assert_cmpint(filesize, =3D=3D, sizeof(info)); + + memset(&info, 0 , sizeof(info)); + + /* now read back the values we wrote and compare that they are the sam= e */ + filesize =3D qfw_cfg_read_file(fw_cfg, qs, FW_CFG_VMCOREINFO_FILENAME, + &info, sizeof(info)); + g_assert_cmpint(filesize, =3D=3D, sizeof(info)); + + size =3D le32_to_cpu(info.size); + paddr =3D le64_to_cpu(info.paddr); + guest_format =3D le16_to_cpu(info.guest_format); + + g_assert_cmpint(size, =3D=3D, 1 * MiB); + g_assert_cmpint(paddr, =3D=3D, 0xffffff00); + g_assert_cmpint(guest_format, =3D=3D, FW_CFG_VMCOREINFO_FORMAT_ELF); + + pc_fw_cfg_uninit(fw_cfg); + qtest_shutdown(qs); +} + +int main(int argc, char **argv) +{ + const char *arch =3D qtest_get_arch(); + + g_test_init(&argc, &argv, NULL); + + if (strcmp(arch, "i386") && strcmp(arch, "x86_64")) { + /* skip for non-x86 */ + exit(EXIT_SUCCESS); + } + + qtest_add_func("vmcoreinfo/basic-write", + test_vmcoreinfo_write_basic); + + return g_test_run(); +} --=20 2.35.3 From nobody Tue Apr 8 13:56:34 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=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1738602049; cv=none; d=zohomail.com; s=zohoarc; b=C6+TjzLRmhH2qZ0LDKvicSjuRonQ4qH0FeIb+mu86Ic/VdURxqO5DXbqID5zGBGkDR403Bjnhci5LyOde9mRwvSd/gHXGmMdBHjRTJRbL2d91jt+9PkP7kdqyqxaUXPmCL3GAFR7OjeKunseiDWHxfqJEgucMLNOCaIEp9tJrtA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1738602049; 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=mwwlVs98Dy6PJeNVxxIIwQOS72rHLpt5ESIJP8J3POc=; b=j2tw5ty9w2PlIKxyGNQq841FUB3UWs+207kmGSh5gLC9Showtn0yQ1u9cC3XFdDTv+UsScB65Z4yVdpZ2liyYD1yYkrY1dijYAUtl0mAQ/hPHgF2WztGiwbfd/pJgedr7JLSlBkeJyxxh3QH7XwlM/8PanpxhgyYmdRfqvV8IRI= 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 1738602049622322.6712892800723; Mon, 3 Feb 2025 09:00:49 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tezne-0006DS-I0; Mon, 03 Feb 2025 11:59:54 -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 1teznc-0006D3-Ki for qemu-devel@nongnu.org; Mon, 03 Feb 2025 11:59:52 -0500 Received: from smtp-out1.suse.de ([195.135.223.130]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tezna-0001OG-VB for qemu-devel@nongnu.org; Mon, 03 Feb 2025 11:59:52 -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-out1.suse.de (Postfix) with ESMTPS id A29C82115B; Mon, 3 Feb 2025 16:59:49 +0000 (UTC) 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 0C15513A78; Mon, 3 Feb 2025 16:59:47 +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 uM/pLgP2oGfDdgAAD6G6ig (envelope-from ); Mon, 03 Feb 2025 16:59:47 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1738601989; 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=mwwlVs98Dy6PJeNVxxIIwQOS72rHLpt5ESIJP8J3POc=; b=hfThKutLSqxoHwAbf6KvU8wz88p2r3z1FeeiC1TThoWacN1tL2SPHY58nnYnlDMujpzsiV 9/LQOlhqczClWcCDnHdrejewkPa7w1ebmBqjAOwmm58pPejktYF2Bf4S9K8MEa7zlccsaV cyhcoJDU2mJuUpl3TqwhwGipTUmqlf8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1738601989; 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=mwwlVs98Dy6PJeNVxxIIwQOS72rHLpt5ESIJP8J3POc=; b=Wt+QyvXlneL3BZdrhKChnWpJm8yUp+NFGWhykuvuNqbY8zQEpz929C+0nqQb9W6vKFsCjm 8HJVyhcw0TZIZhCg== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1738601989; 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=mwwlVs98Dy6PJeNVxxIIwQOS72rHLpt5ESIJP8J3POc=; b=hfThKutLSqxoHwAbf6KvU8wz88p2r3z1FeeiC1TThoWacN1tL2SPHY58nnYnlDMujpzsiV 9/LQOlhqczClWcCDnHdrejewkPa7w1ebmBqjAOwmm58pPejktYF2Bf4S9K8MEa7zlccsaV cyhcoJDU2mJuUpl3TqwhwGipTUmqlf8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1738601989; 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=mwwlVs98Dy6PJeNVxxIIwQOS72rHLpt5ESIJP8J3POc=; b=Wt+QyvXlneL3BZdrhKChnWpJm8yUp+NFGWhykuvuNqbY8zQEpz929C+0nqQb9W6vKFsCjm 8HJVyhcw0TZIZhCg== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Thomas Huth , Akihiko Odaki Subject: [PULL 4/6] tests/qtest: Extract qtest_qom_has_concrete_type() helper Date: Mon, 3 Feb 2025 13:59:36 -0300 Message-Id: <20250203165938.14320-5-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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 (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=195.135.223.130; envelope-from=farosas@suse.de; helo=smtp-out1.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, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, 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 @suse.de) X-ZM-MESSAGEID: 1738602052603019100 From: Philippe Mathieu-Daud=C3=A9 Extract qtest_qom_has_concrete_type() out of qtest_has_device() in order to re-use it in the following commit. Reviewed-by: Thomas Huth Reviewed-by: Akihiko Odaki Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-ID: <20250130103728.536-2-philmd@linaro.org> Signed-off-by: Fabiano Rosas --- 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 437b24fa2e..f416cf8a59 100644 --- a/tests/qtest/libqtest.c +++ b/tests/qtest/libqtest.c @@ -1011,6 +1011,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")) { @@ -1790,45 +1840,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.35.3 From nobody Tue Apr 8 13:56:34 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=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1738602022; cv=none; d=zohomail.com; s=zohoarc; b=FJnbyFtbR5tpjDwodOi7hx3DszkKnZnfd0DbCx44FPxFwL7LIvqX40q17sIUrZ2jnabZ7CXQpcCvbcfpcD7K4RdloDvcwQ9HFomZRmDXqpv+Fn7COdJPDHmJySa4T4zxrGYpDpKRAa34I6DVm/XW57vXQ9Uir8uQfiZ9uf1FzTE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1738602022; 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=7fBhyOPw+uV+tDm35m3Dodwm2GOVrzdUMocvY919AmQ=; b=SSHgs+W1B08gOYkVgXIUGG8G8RXI1JvTRCUT31aUPh1yI0efqfHdxH8h7bw1rL+nZ7ZS/32oE9qa+RKjRoyAlmZJpE4HmbJ39szeNs+XnJ4n3YuhJcYFqWpsGdq7I9ISPHuWIjPHBKHOJNTiZ+NMTR3L7wh4+MmZeGUwoMeXry8= 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 1738602022120417.4766461872372; Mon, 3 Feb 2025 09:00:22 -0800 (PST) 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) 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 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== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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 (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=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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1738602024363019100 From: Philippe Mathieu-Daud=C3=A9 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=C3=A9 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 @@ =20 #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, =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 }; @@ -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 =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.35.3 From nobody Tue Apr 8 13:56:34 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=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1738602013; cv=none; d=zohomail.com; s=zohoarc; b=J/IgtthNfkp395rahrRd/xv3oXBfeGK4SKGXlaLrNVU/yBYzjlb7PiVMtm1XUEKxUhy8qGjnEG2NIvFjWIpLed6askXh9npZAIEEigfvtFSD9t3Xs8/VxtDkuVMn58uvEazm6wALS1ZSGrIVEl5Wt3WvCZLq+5QGAUSSocutIvM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1738602013; h=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=I20nL6M+WpnaSWzjAM3pyCE0ib0ir3WXI0nhTX/HC6Y=; b=IoAQtxriuxCpg7Z9PVT/F3ea3dVikKjPX0XbNAy3HVx0k42NJjbXknDzqDBnQsPpw2PbSXf8KeZKEU+E1QHIun2I9lD2Hh8lziE47yES0NanMjmaQ8DrCxkqteXRyWoe7/empZ6+lglznoO9lW74I7cOm5GFUtAzusDi5X0ubh8= 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 1738602012877522.8229549207169; Mon, 3 Feb 2025 09:00:12 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1teznk-0006EZ-OX; Mon, 03 Feb 2025 12:00:00 -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 1teznh-0006EO-Nb for qemu-devel@nongnu.org; Mon, 03 Feb 2025 11:59:57 -0500 Received: from smtp-out1.suse.de ([195.135.223.130]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tezng-0001P6-0E for qemu-devel@nongnu.org; Mon, 03 Feb 2025 11:59:57 -0500 Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104: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-out1.suse.de (Postfix) with ESMTPS id 642662115B; Mon, 3 Feb 2025 16:59:53 +0000 (UTC) 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 4E85513A78; Mon, 3 Feb 2025 16:59:52 +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 4AIfAwj2oGfDdgAAD6G6ig (envelope-from ); Mon, 03 Feb 2025 16:59:52 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1738601994; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=I20nL6M+WpnaSWzjAM3pyCE0ib0ir3WXI0nhTX/HC6Y=; b=AmgOqV8YcDglPKbAgmjw0nPCAw2pWtoVCTdrvosLscx1+DMlVj3weHC0dHN9s7RcGQ5+VS AgjzSJScvXuN5lWJYp4O1hgTjySkxbvmKG0+KWLPENsrL9iUaEfxUinYhSYeKcxQ3hdgdT qQmQwDzxGGVW+PlUhNYrpvX9cJDQPqg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1738601994; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=I20nL6M+WpnaSWzjAM3pyCE0ib0ir3WXI0nhTX/HC6Y=; b=vpa5T+Sj4h2nKwP+WNUYdaWIF71vV0xZOwXpTOhkFLZh1lwOYon7/Js7XO/Y4CvUQZYzua /e0mq1BXvi1ZS8BQ== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=M5wVaoVn; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=C6fz+TaC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1738601993; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=I20nL6M+WpnaSWzjAM3pyCE0ib0ir3WXI0nhTX/HC6Y=; b=M5wVaoVnB+SolnIfOCraK8srXopwtWqZdSLZ+HqNFGChW86eqEY3HT//pKO0kmr/B28Fp6 4u7kSS6LUIrL0J1m36JoM+1IXq34J+LbaOMNpW4CCuaIMdANrJPiwI5BRnUKdg4sh4onK4 Xw+38MlUIhzLUzoW2Wqu0FOZ/cG6DVk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1738601993; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=I20nL6M+WpnaSWzjAM3pyCE0ib0ir3WXI0nhTX/HC6Y=; b=C6fz+TaC0z1pivyFDVBXpzp7/8f6lVucLI7D3L7DyCHANqI+C7Nkav/5k9a0rz5vPt1maq hIn2z+xo7kGMdMCw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Thomas Huth Subject: [PULL 6/6] tests/qtest/vhost-user-test: Use modern virtio for vhost-user tests Date: Mon, 3 Feb 2025 13:59:38 -0300 Message-Id: <20250203165938.14320-7-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 Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 642662115B X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[99.99%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; ASN(0.00)[asn:25478, ipnet:::/0, country:RU]; MIME_TRACE(0.00)[0:+]; RCVD_VIA_SMTP_AUTH(0.00)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; ARC_NA(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; RCVD_TLS_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Rspamd-Action: no action X-Spam-Score: -3.01 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=195.135.223.130; envelope-from=farosas@suse.de; helo=smtp-out1.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, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, 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 @suse.de) (identity @suse.de) X-ZM-MESSAGEID: 1738602014334019100 Content-Type: text/plain; charset="utf-8" From: Thomas Huth All other vhost-user tests here use modern virtio, too, so let's adjust the vhost-user-net test accordingly. Signed-off-by: Thomas Huth Message-ID: <20250203124346.169607-1-thuth@redhat.com> Reviewed-by: Fabiano Rosas Signed-off-by: Fabiano Rosas --- tests/qtest/vhost-user-test.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/qtest/vhost-user-test.c b/tests/qtest/vhost-user-test.c index 76d142a158..bd977ef28d 100644 --- a/tests/qtest/vhost-user-test.c +++ b/tests/qtest/vhost-user-test.c @@ -1043,7 +1043,8 @@ static void test_multiqueue(void *obj, void *arg, QGu= estAllocator *alloc) =20 static uint64_t vu_net_get_features(TestServer *s) { - uint64_t features =3D 0x1ULL << VHOST_F_LOG_ALL | + uint64_t features =3D 0x1ULL << VIRTIO_F_VERSION_1 | + 0x1ULL << VHOST_F_LOG_ALL | 0x1ULL << VHOST_USER_F_PROTOCOL_FEATURES; =20 if (s->queues > 1) { --=20 2.35.3