From nobody Thu Dec 18 22:23:40 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=1733960324; cv=none; d=zohomail.com; s=zohoarc; b=VxS3lMJRoOQHX//6VANklipSmRYfyiOKf44wALM+G4GKn2lgqEoacqSK6/83+BidFr57+J4ZsSFTqOKV/LuPrge82NSn2wp65yjkBeU/mq2ERRDyjiM0U9lU8mHeTS8jroLWRh7ZpeZWIz+VYH687octeSTVuHzrbJTE9DVh+nE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1733960324; 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=4dOD/dJ5Q8iBnkA8YIiW83dNp0NpX2SUkRELRiJ4WJo=; b=N4KSVpOCIC+apspjP4PCf3r0/biJS3CrRbc4H0SZZnVBK/SISZyoKmxe3hxAdD+XOoUaguwe0m5Ot67jVTBbk9qPdyTx4cUms0JJNr2XXmBgkSesO5K1IcMBJ9pwD5Az41Em3Ads/TC1IK5gI78ASWvxsgnvCYcVy/y18Ub2nJc= 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 1733960324700208.02115757768013; Wed, 11 Dec 2024 15:38:44 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tLWGy-0000lY-Da; Wed, 11 Dec 2024 18: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 1tLWGw-0000lM-Fj for qemu-devel@nongnu.org; Wed, 11 Dec 2024 18:37:38 -0500 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tLWGu-0007Pm-Mi for qemu-devel@nongnu.org; Wed, 11 Dec 2024 18:37:38 -0500 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-43622354a3eso35605e9.1 for ; Wed, 11 Dec 2024 15: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-3878251c4e1sm2413321f8f.89.2024.12.11.15.37.32 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 11 Dec 2024 15:37:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733960255; x=1734565055; 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=4dOD/dJ5Q8iBnkA8YIiW83dNp0NpX2SUkRELRiJ4WJo=; b=uuPFS2sgRrTnOmPDMpdGgrG1qZIGuyvvr3+IsBlVCJlTeW/unwiInC3QHh7GkVNM4V 29RUuLNDwhEl7naghjTzqLSnHz49XN5QPJXfE3t1ucCxegXQAVW8xJklfpO/+KNs9dnF MH9Kqoy1u9oNkHjVHOrCp+lLoAdQMcaM7tfhskP0gqjAdRXRgdJEmJNuEu6n4UNOlFIL v5NEOeBj14jwE8B4TvLjciEKqFXE/a7s8o/R7tNEmtVIDJbdEDm7+AFtY8Gb6EwWycFl j0NlT3sb5v8ErwrPzOUJK27ssS2i24k/KsKFXmrbsjQ2vNtUDreTLnVh8VH1kS19covy La3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733960255; x=1734565055; 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=4dOD/dJ5Q8iBnkA8YIiW83dNp0NpX2SUkRELRiJ4WJo=; b=HX9OMpuqACT7irECLcthPLJIOuBo1okc8IRQiktpf4niuFLpF1mrVk0ly3RnWZtB41 DGrqQrmPLicXPjOwRTC6KFMwK9P1FQMyzhSmxts3nqrhZ2AmWbwvRw4CIK4DFowRV1Pz k942AypW9ODk1vvNBLeUF9CKKLzOwC/X6KPH9QNMFza/d9a1+Xyke4jPIigwWP7YqpQ3 kjK1A+rdjhuVR/7veyxhjWtLkXG+a1K5Ah7+5hyfMH991qSJtjJgvIl1qNe0cEnTVajO 5jQjP5ELEKbVnf7CuuwsBqdVVlB3GY4oqyUEKrPBbHev/dDpqaRxpQaNb/OfLoArAhZu HI6Q== X-Gm-Message-State: AOJu0Yza4/sHTZuJgnX3uoLttLuEX6qrO+uSoSTRn8/Ky/L/13qWiXrv HgXihEgcVoRRJ+XayKycdDugGxLVG5GtMhCqRR+vDWXUpcclO42kpXOEjIKUo8glkeZALpueaYc P X-Gm-Gg: ASbGncuJhq11s/hCSpBbo7Q5HfoU29gtcsGsIRr912onm6Um+s9AZU5qMAxn/oyVHlz KkQObAC/XaanITQBeUcvBtIIlZ/OUK6kYe7Vylkqk8ECfbdC/usqh7ouHyIf7Y/ZkIhsHB+N373 2AsjF2dmWK7Lc1FZ94MutLEJdHjlXW1vp4T9FgFcZD+s7shtAcsDKWvDMuKEq/5CUuEqtHad68q X2MkCOkGVhGSYabu2V48ikO2UWAR+Jp3WyaU6v37ZFotMJXNUxyfBBrPCnmkFkNBwVkHjQvZYA6 JuFzGHywpMk0yX0fR8rWxpX0rFHdr8GbGA== X-Google-Smtp-Source: AGHT+IGxFPnS+NYN2vFkcf2kaMduoLI5S071VgFuE2MRUP79cV5KpaPnMD9ijblnYAn326e1xf+4Xw== X-Received: by 2002:a05:6000:481e:b0:385:e0d6:fb73 with SMTP id ffacd0b85a97d-3864ce54f0amr3844818f8f.15.1733960254687; Wed, 11 Dec 2024 15:37:34 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Bandan Das , Alexander Bulekov , Paolo Bonzini , Fabiano Rosas , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v2 1/2] system/qtest: Remove uses of 'first_cpu' Date: Thu, 12 Dec 2024 00:37:26 +0100 Message-ID: <20241211233727.98923-2-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241211233727.98923-1-philmd@linaro.org> References: <20241211233727.98923-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::32b; envelope-from=philmd@linaro.org; helo=mail-wm1-x32b.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: 1733960325632116600 There is no vCPU within the QTest accelerator (well, they are stubs doing nothing, see dummy_cpu_thread_fn). Directly access the global &address_space_memory to reduce access to the 'first_cpu' global (which is meaningless in a heterogeneous emulation setup). Cast the returned value to (void) to explicit we don't care about invalid accesses. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- We will likely remove &address_space_memory too, but one global at a time. first_cpu is more annoying so I'm starting with it. --- system/qtest.c | 53 +++++++++++++++++++++++++------------------------- 1 file changed, 27 insertions(+), 26 deletions(-) diff --git a/system/qtest.c b/system/qtest.c index 12703a20455..cc26dd75bef 100644 --- a/system/qtest.c +++ b/system/qtest.c @@ -16,6 +16,7 @@ #include "sysemu/qtest.h" #include "sysemu/runstate.h" #include "chardev/char-fe.h" +#include "exec/address-spaces.h" #include "exec/ioport.h" #include "exec/memory.h" #include "exec/tswap.h" @@ -514,23 +515,23 @@ static void qtest_process_command(CharBackend *chr, g= char **words) =20 if (words[0][5] =3D=3D 'b') { uint8_t data =3D value; - address_space_write(first_cpu->as, addr, MEMTXATTRS_UNSPECIFIE= D, - &data, 1); + (void)address_space_write(&address_space_memory, addr, + MEMTXATTRS_UNSPECIFIED, &data, 1); } else if (words[0][5] =3D=3D 'w') { uint16_t data =3D value; tswap16s(&data); - address_space_write(first_cpu->as, addr, MEMTXATTRS_UNSPECIFIE= D, - &data, 2); + (void)address_space_write(&address_space_memory, addr, + MEMTXATTRS_UNSPECIFIED, &data, 2); } else if (words[0][5] =3D=3D 'l') { uint32_t data =3D value; tswap32s(&data); - address_space_write(first_cpu->as, addr, MEMTXATTRS_UNSPECIFIE= D, - &data, 4); + (void)address_space_write(&address_space_memory, addr, + MEMTXATTRS_UNSPECIFIED, &data, 4); } else if (words[0][5] =3D=3D 'q') { uint64_t data =3D value; tswap64s(&data); - address_space_write(first_cpu->as, addr, MEMTXATTRS_UNSPECIFIE= D, - &data, 8); + (void)address_space_write(&address_space_memory, addr, + MEMTXATTRS_UNSPECIFIED, &data, 8); } qtest_send_prefix(chr); qtest_send(chr, "OK\n"); @@ -548,22 +549,22 @@ static void qtest_process_command(CharBackend *chr, g= char **words) =20 if (words[0][4] =3D=3D 'b') { uint8_t data; - address_space_read(first_cpu->as, addr, MEMTXATTRS_UNSPECIFIED, - &data, 1); + (void)address_space_read(&address_space_memory, addr, + MEMTXATTRS_UNSPECIFIED, &data, 1); value =3D data; } else if (words[0][4] =3D=3D 'w') { uint16_t data; - address_space_read(first_cpu->as, addr, MEMTXATTRS_UNSPECIFIED, - &data, 2); + (void)address_space_read(&address_space_memory, addr, + MEMTXATTRS_UNSPECIFIED, &data, 2); value =3D tswap16(data); } else if (words[0][4] =3D=3D 'l') { uint32_t data; - address_space_read(first_cpu->as, addr, MEMTXATTRS_UNSPECIFIED, - &data, 4); + (void)address_space_read(&address_space_memory, addr, + MEMTXATTRS_UNSPECIFIED, &data, 4); value =3D tswap32(data); } else if (words[0][4] =3D=3D 'q') { - address_space_read(first_cpu->as, addr, MEMTXATTRS_UNSPECIFIED, - &value, 8); + (void)address_space_read(&address_space_memory, addr, + MEMTXATTRS_UNSPECIFIED, &value, 8); tswap64s(&value); } qtest_send_prefix(chr); @@ -583,8 +584,8 @@ static void qtest_process_command(CharBackend *chr, gch= ar **words) g_assert(len); =20 data =3D g_malloc(len); - address_space_read(first_cpu->as, addr, MEMTXATTRS_UNSPECIFIED, da= ta, - len); + (void)address_space_read(&address_space_memory, addr, + MEMTXATTRS_UNSPECIFIED, data, len); =20 enc =3D qemu_hexdump_line(NULL, data, len, 0, 0); =20 @@ -605,8 +606,8 @@ static void qtest_process_command(CharBackend *chr, gch= ar **words) g_assert(ret =3D=3D 0); =20 data =3D g_malloc(len); - address_space_read(first_cpu->as, addr, MEMTXATTRS_UNSPECIFIED, da= ta, - len); + (void)address_space_read(&address_space_memory, addr, + MEMTXATTRS_UNSPECIFIED, data, len); b64_data =3D g_base64_encode(data, len); qtest_send_prefix(chr); qtest_sendf(chr, "OK %s\n", b64_data); @@ -640,8 +641,8 @@ static void qtest_process_command(CharBackend *chr, gch= ar **words) data[i] =3D 0; } } - address_space_write(first_cpu->as, addr, MEMTXATTRS_UNSPECIFIED, d= ata, - len); + (void)address_space_write(&address_space_memory, addr, + MEMTXATTRS_UNSPECIFIED, data, len); g_free(data); =20 qtest_send_prefix(chr); @@ -663,8 +664,8 @@ static void qtest_process_command(CharBackend *chr, gch= ar **words) if (len) { data =3D g_malloc(len); memset(data, pattern, len); - address_space_write(first_cpu->as, addr, MEMTXATTRS_UNSPECIFIE= D, - data, len); + (void)address_space_write(&address_space_memory, addr, + MEMTXATTRS_UNSPECIFIED, data, len); g_free(data); } =20 @@ -697,8 +698,8 @@ static void qtest_process_command(CharBackend *chr, gch= ar **words) out_len =3D MIN(out_len, len); } =20 - address_space_write(first_cpu->as, addr, MEMTXATTRS_UNSPECIFIED, d= ata, - len); + (void)address_space_write(&address_space_memory, addr, + MEMTXATTRS_UNSPECIFIED, data, len); =20 qtest_send_prefix(chr); qtest_send(chr, "OK\n"); --=20 2.45.2